[TS] Update auto-generated bindings to LDK-C-Bindings 0.0.123.1
[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 // The C# Bool marshalling is defined as 4 bytes, but the size of bool is platform-dependent
85 typedef int32_t jboolean;
86
87 int64_t CS_LDK_allocate_buffer(int64_t len) {
88         return (int64_t)MALLOC(len, "C#-requested buffer");
89 }
90
91 void CS_LDK_free_buffer(int64_t buf) {
92         FREE((void*)buf);
93 }
94
95 jstring CS_LDK_get_ldk_c_bindings_version() {
96         return str_ref_to_cs(check_get_ldk_bindings_version(), strlen(check_get_ldk_bindings_version()));
97 }
98 jstring CS_LDK_get_ldk_version() {
99         return str_ref_to_cs(check_get_ldk_version(), strlen(check_get_ldk_version()));
100 }
101 #include "version.c"
102
103 typedef int64_t (*invoker_l_l)(int obj_ptr, int fn_id, int64_t a);
104 static invoker_l_l js_invoke_function_l_l;
105 int CS_LDK_register_l_l_invoker(invoker_l_l invoker) {
106         js_invoke_function_l_l = invoker;
107         return 0;
108 }
109
110 typedef int64_t (*invoker_l_ll)(int obj_ptr, int fn_id, int64_t a, int64_t b);
111 static invoker_l_ll js_invoke_function_l_ll;
112 int CS_LDK_register_l_ll_invoker(invoker_l_ll invoker) {
113         js_invoke_function_l_ll = invoker;
114         return 0;
115 }
116
117 typedef int64_t (*invoker_l_)(int obj_ptr, int fn_id);
118 static invoker_l_ js_invoke_function_l_;
119 int CS_LDK_register_l__invoker(invoker_l_ invoker) {
120         js_invoke_function_l_ = invoker;
121         return 0;
122 }
123
124 typedef void (*invoker_void_l)(int obj_ptr, int fn_id, int64_t a);
125 static invoker_void_l js_invoke_function_void_l;
126 int CS_LDK_register_void_l_invoker(invoker_void_l invoker) {
127         js_invoke_function_void_l = invoker;
128         return 0;
129 }
130
131 typedef int64_t (*invoker_l_lll)(int obj_ptr, int fn_id, int64_t a, int64_t b, int64_t c);
132 static invoker_l_lll js_invoke_function_l_lll;
133 int CS_LDK_register_l_lll_invoker(invoker_l_lll invoker) {
134         js_invoke_function_l_lll = invoker;
135         return 0;
136 }
137
138 typedef int64_t (*invoker_l_llll)(int obj_ptr, int fn_id, int64_t a, int64_t b, int64_t c, int64_t d);
139 static invoker_l_llll js_invoke_function_l_llll;
140 int CS_LDK_register_l_llll_invoker(invoker_l_llll invoker) {
141         js_invoke_function_l_llll = invoker;
142         return 0;
143 }
144
145 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);
146 static invoker_l_lllll js_invoke_function_l_lllll;
147 int CS_LDK_register_l_lllll_invoker(invoker_l_lllll invoker) {
148         js_invoke_function_l_lllll = invoker;
149         return 0;
150 }
151
152 typedef void (*invoker_void_lll)(int obj_ptr, int fn_id, int64_t a, int64_t b, int64_t c);
153 static invoker_void_lll js_invoke_function_void_lll;
154 int CS_LDK_register_void_lll_invoker(invoker_void_lll invoker) {
155         js_invoke_function_void_lll = invoker;
156         return 0;
157 }
158
159 typedef void (*invoker_void_ll)(int obj_ptr, int fn_id, int64_t a, int64_t b);
160 static invoker_void_ll js_invoke_function_void_ll;
161 int CS_LDK_register_void_ll_invoker(invoker_void_ll invoker) {
162         js_invoke_function_void_ll = invoker;
163         return 0;
164 }
165
166 typedef int32_t (*invoker_ChannelMonitorUpdateStatus_ll)(int obj_ptr, int fn_id, int64_t a, int64_t b);
167 static invoker_ChannelMonitorUpdateStatus_ll js_invoke_function_ChannelMonitorUpdateStatus_ll;
168 int CS_LDK_register_ChannelMonitorUpdateStatus_ll_invoker(invoker_ChannelMonitorUpdateStatus_ll invoker) {
169         js_invoke_function_ChannelMonitorUpdateStatus_ll = invoker;
170         return 0;
171 }
172
173 typedef int64_t (*invoker_l_Recipient)(int obj_ptr, int fn_id, int32_t a);
174 static invoker_l_Recipient js_invoke_function_l_Recipient;
175 int CS_LDK_register_l_Recipient_invoker(invoker_l_Recipient invoker) {
176         js_invoke_function_l_Recipient = invoker;
177         return 0;
178 }
179
180 typedef int64_t (*invoker_l_Recipientll)(int obj_ptr, int fn_id, int32_t a, int64_t b, int64_t c);
181 static invoker_l_Recipientll js_invoke_function_l_Recipientll;
182 int CS_LDK_register_l_Recipientll_invoker(invoker_l_Recipientll invoker) {
183         js_invoke_function_l_Recipientll = invoker;
184         return 0;
185 }
186
187 typedef int64_t (*invoker_l_llRecipient)(int obj_ptr, int fn_id, int64_t a, int64_t b, int32_t c);
188 static invoker_l_llRecipient js_invoke_function_l_llRecipient;
189 int CS_LDK_register_l_llRecipient_invoker(invoker_l_llRecipient invoker) {
190         js_invoke_function_l_llRecipient = invoker;
191         return 0;
192 }
193
194 typedef int64_t (*invoker_l_bll)(int obj_ptr, int fn_id, jboolean a, int64_t b, int64_t c);
195 static invoker_l_bll js_invoke_function_l_bll;
196 int CS_LDK_register_l_bll_invoker(invoker_l_bll invoker) {
197         js_invoke_function_l_bll = invoker;
198         return 0;
199 }
200
201 typedef int32_t (*invoker_i_ConfirmationTarget)(int obj_ptr, int fn_id, int32_t a);
202 static invoker_i_ConfirmationTarget js_invoke_function_i_ConfirmationTarget;
203 int CS_LDK_register_i_ConfirmationTarget_invoker(invoker_i_ConfirmationTarget invoker) {
204         js_invoke_function_i_ConfirmationTarget = invoker;
205         return 0;
206 }
207
208 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);
209 static invoker_l_llllll js_invoke_function_l_llllll;
210 int CS_LDK_register_l_llllll_invoker(invoker_l_llllll invoker) {
211         js_invoke_function_l_llllll = invoker;
212         return 0;
213 }
214
215 typedef int16_t (*invoker_s_)(int obj_ptr, int fn_id);
216 static invoker_s_ js_invoke_function_s_;
217 int CS_LDK_register_s__invoker(invoker_s_ invoker) {
218         js_invoke_function_s_ = invoker;
219         return 0;
220 }
221
222 typedef int64_t (*invoker_l_lllb)(int obj_ptr, int fn_id, int64_t a, int64_t b, int64_t c, jboolean d);
223 static invoker_l_lllb js_invoke_function_l_lllb;
224 int CS_LDK_register_l_lllb_invoker(invoker_l_lllb invoker) {
225         js_invoke_function_l_lllb = invoker;
226         return 0;
227 }
228
229 typedef int64_t (*invoker_l_lllil)(int obj_ptr, int fn_id, int64_t a, int64_t b, int64_t c, int32_t d, int64_t e);
230 static invoker_l_lllil js_invoke_function_l_lllil;
231 int CS_LDK_register_l_lllil_invoker(invoker_l_lllil invoker) {
232         js_invoke_function_l_lllil = invoker;
233         return 0;
234 }
235
236 typedef int32_t (*invoker_ChannelMonitorUpdateStatus_lll)(int obj_ptr, int fn_id, int64_t a, int64_t b, int64_t c);
237 static invoker_ChannelMonitorUpdateStatus_lll js_invoke_function_ChannelMonitorUpdateStatus_lll;
238 int CS_LDK_register_ChannelMonitorUpdateStatus_lll_invoker(invoker_ChannelMonitorUpdateStatus_lll invoker) {
239         js_invoke_function_ChannelMonitorUpdateStatus_lll = invoker;
240         return 0;
241 }
242
243 typedef int32_t (*invoker_ChannelMonitorUpdateStatus_llll)(int obj_ptr, int fn_id, int64_t a, int64_t b, int64_t c, int64_t d);
244 static invoker_ChannelMonitorUpdateStatus_llll js_invoke_function_ChannelMonitorUpdateStatus_llll;
245 int CS_LDK_register_ChannelMonitorUpdateStatus_llll_invoker(invoker_ChannelMonitorUpdateStatus_llll invoker) {
246         js_invoke_function_ChannelMonitorUpdateStatus_llll = invoker;
247         return 0;
248 }
249
250 typedef void (*invoker_void_lli)(int obj_ptr, int fn_id, int64_t a, int64_t b, int32_t c);
251 static invoker_void_lli js_invoke_function_void_lli;
252 int CS_LDK_register_void_lli_invoker(invoker_void_lli invoker) {
253         js_invoke_function_void_lli = invoker;
254         return 0;
255 }
256
257 typedef void (*invoker_void_li)(int obj_ptr, int fn_id, int64_t a, int32_t b);
258 static invoker_void_li js_invoke_function_void_li;
259 int CS_LDK_register_void_li_invoker(invoker_void_li invoker) {
260         js_invoke_function_void_li = invoker;
261         return 0;
262 }
263
264 typedef void (*invoker_void_)(int obj_ptr, int fn_id);
265 static invoker_void_ js_invoke_function_void_;
266 int CS_LDK_register_void__invoker(invoker_void_ invoker) {
267         js_invoke_function_void_ = invoker;
268         return 0;
269 }
270
271 typedef int64_t (*invoker_l_llb)(int obj_ptr, int fn_id, int64_t a, int64_t b, jboolean c);
272 static invoker_l_llb js_invoke_function_l_llb;
273 int CS_LDK_register_l_llb_invoker(invoker_l_llb invoker) {
274         js_invoke_function_l_llb = invoker;
275         return 0;
276 }
277
278 typedef jboolean (*invoker_b_)(int obj_ptr, int fn_id);
279 static invoker_b_ js_invoke_function_b_;
280 int CS_LDK_register_b__invoker(invoker_b_ invoker) {
281         js_invoke_function_b_ = invoker;
282         return 0;
283 }
284
285 typedef int64_t (*invoker_l_sl)(int obj_ptr, int fn_id, int16_t a, int64_t b);
286 static invoker_l_sl js_invoke_function_l_sl;
287 int CS_LDK_register_l_sl_invoker(invoker_l_sl invoker) {
288         js_invoke_function_l_sl = invoker;
289         return 0;
290 }
291
292 typedef int64_t (*invoker_l_lb)(int obj_ptr, int fn_id, int64_t a, jboolean b);
293 static invoker_l_lb js_invoke_function_l_lb;
294 int CS_LDK_register_l_lb_invoker(invoker_l_lb invoker) {
295         js_invoke_function_l_lb = invoker;
296         return 0;
297 }
298
299 typedef jboolean (*invoker_b_l)(int obj_ptr, int fn_id, int64_t a);
300 static invoker_b_l js_invoke_function_b_l;
301 int CS_LDK_register_b_l_invoker(invoker_b_l invoker) {
302         js_invoke_function_b_l = invoker;
303         return 0;
304 }
305
306 typedef int64_t (*invoker_l_llli)(int obj_ptr, int fn_id, int64_t a, int64_t b, int64_t c, int32_t d);
307 static invoker_l_llli js_invoke_function_l_llli;
308 int CS_LDK_register_l_llli_invoker(invoker_l_llli invoker) {
309         js_invoke_function_l_llli = invoker;
310         return 0;
311 }
312 static inline struct LDKThirtyTwoBytes ThirtyTwoBytes_clone(const struct LDKThirtyTwoBytes *orig) { struct LDKThirtyTwoBytes ret; memcpy(ret.data, orig->data, 32); return ret; }
313
314 static inline void* untag_ptr(uint64_t ptr) {
315         if (ptr < 4096) return (void*)ptr;
316         if (sizeof(void*) == 4) {
317                 // For 32-bit systems, store pointers as 64-bit ints and use the 31st bit
318                 return (void*)(uintptr_t)ptr;
319         } else {
320                 // For 64-bit systems, assume the top byte is used for tagging, then
321                 // use bit 9 ^ bit 10.
322                 uint64_t tenth_bit = (((uintptr_t)ptr) & (1ULL << 54)) >> 54;
323                 uintptr_t p = (ptr & ~(1ULL << 55)) | (tenth_bit << 55);
324 #ifdef LDK_DEBUG_BUILD
325                 // On debug builds we also use the 11th bit as a debug flag
326                 uintptr_t eleventh_bit = (((uintptr_t)ptr) & (1ULL << 53)) >> 53;
327                 CHECK(tenth_bit != eleventh_bit);
328                 p ^= 1ULL << 53;
329 #endif
330                 return (void*)p;
331         }
332 }
333 static inline bool ptr_is_owned(uint64_t ptr) {
334         if(ptr < 4096) return true;
335         if (sizeof(void*) == 4) {
336                 return ptr & (1ULL << 32);
337         } else {
338                 uintptr_t ninth_bit = (((uintptr_t)ptr) & (1ULL << 55)) >> 55;
339                 uintptr_t tenth_bit = (((uintptr_t)ptr) & (1ULL << 54)) >> 54;
340 #ifdef LDK_DEBUG_BUILD
341                 // On debug builds we also use the 11th bit as a debug flag
342                 uintptr_t eleventh_bit = (((uintptr_t)ptr) & (1ULL << 53)) >> 53;
343                 CHECK(tenth_bit != eleventh_bit);
344 #endif
345                 return (ninth_bit ^ tenth_bit) ? true : false;
346         }
347 }
348 static inline uint64_t tag_ptr(const void* ptr, bool is_owned) {
349         if ((uintptr_t)ptr < 4096) return (uint64_t)ptr;
350         if (sizeof(void*) == 4) {
351                 return (((uint64_t)ptr) | ((is_owned ? 1ULL : 0) << 32));
352         } else {
353                 CHECK(sizeof(uintptr_t) == 8);
354                 uintptr_t tenth_bit = (((uintptr_t)ptr) & (1ULL << 54)) >> 54;
355                 uintptr_t t = (((uintptr_t)ptr) | (((is_owned ? 1ULL : 0ULL) ^ tenth_bit) << 55));
356 #ifdef LDK_DEBUG_BUILD
357                 uintptr_t ninth_bit = (((uintptr_t)ptr) & (1ULL << 55)) >> 55;
358                 uintptr_t eleventh_bit = (((uintptr_t)ptr) & (1ULL << 53)) >> 53;
359                 CHECK(ninth_bit == tenth_bit);
360                 CHECK(ninth_bit == eleventh_bit);
361                 t ^= 1ULL << 53;
362 #endif
363                 CHECK(ptr_is_owned(t) == is_owned);
364                 CHECK(untag_ptr(t) == ptr);
365                 return t;
366         }
367 }
368
369 static inline LDKBlindedFailure LDKBlindedFailure_from_cs(int32_t ord) {
370         switch (ord) {
371                 case 0: return LDKBlindedFailure_FromIntroductionNode;
372                 case 1: return LDKBlindedFailure_FromBlindedNode;
373                 default: abort();
374         }
375 }
376 static inline int32_t LDKBlindedFailure_to_cs(LDKBlindedFailure val) {
377         switch (val) {
378                 case LDKBlindedFailure_FromIntroductionNode: return 0;
379                 case LDKBlindedFailure_FromBlindedNode: return 1;
380                 default: abort();
381         }
382 }
383 static inline LDKBolt11SemanticError LDKBolt11SemanticError_from_cs(int32_t ord) {
384         switch (ord) {
385                 case 0: return LDKBolt11SemanticError_NoPaymentHash;
386                 case 1: return LDKBolt11SemanticError_MultiplePaymentHashes;
387                 case 2: return LDKBolt11SemanticError_NoDescription;
388                 case 3: return LDKBolt11SemanticError_MultipleDescriptions;
389                 case 4: return LDKBolt11SemanticError_NoPaymentSecret;
390                 case 5: return LDKBolt11SemanticError_MultiplePaymentSecrets;
391                 case 6: return LDKBolt11SemanticError_InvalidFeatures;
392                 case 7: return LDKBolt11SemanticError_InvalidRecoveryId;
393                 case 8: return LDKBolt11SemanticError_InvalidSignature;
394                 case 9: return LDKBolt11SemanticError_ImpreciseAmount;
395                 default: abort();
396         }
397 }
398 static inline int32_t LDKBolt11SemanticError_to_cs(LDKBolt11SemanticError val) {
399         switch (val) {
400                 case LDKBolt11SemanticError_NoPaymentHash: return 0;
401                 case LDKBolt11SemanticError_MultiplePaymentHashes: return 1;
402                 case LDKBolt11SemanticError_NoDescription: return 2;
403                 case LDKBolt11SemanticError_MultipleDescriptions: return 3;
404                 case LDKBolt11SemanticError_NoPaymentSecret: return 4;
405                 case LDKBolt11SemanticError_MultiplePaymentSecrets: return 5;
406                 case LDKBolt11SemanticError_InvalidFeatures: return 6;
407                 case LDKBolt11SemanticError_InvalidRecoveryId: return 7;
408                 case LDKBolt11SemanticError_InvalidSignature: return 8;
409                 case LDKBolt11SemanticError_ImpreciseAmount: return 9;
410                 default: abort();
411         }
412 }
413 static inline LDKBolt12SemanticError LDKBolt12SemanticError_from_cs(int32_t ord) {
414         switch (ord) {
415                 case 0: return LDKBolt12SemanticError_AlreadyExpired;
416                 case 1: return LDKBolt12SemanticError_UnsupportedChain;
417                 case 2: return LDKBolt12SemanticError_UnexpectedChain;
418                 case 3: return LDKBolt12SemanticError_MissingAmount;
419                 case 4: return LDKBolt12SemanticError_InvalidAmount;
420                 case 5: return LDKBolt12SemanticError_InsufficientAmount;
421                 case 6: return LDKBolt12SemanticError_UnexpectedAmount;
422                 case 7: return LDKBolt12SemanticError_UnsupportedCurrency;
423                 case 8: return LDKBolt12SemanticError_UnknownRequiredFeatures;
424                 case 9: return LDKBolt12SemanticError_UnexpectedFeatures;
425                 case 10: return LDKBolt12SemanticError_MissingDescription;
426                 case 11: return LDKBolt12SemanticError_MissingSigningPubkey;
427                 case 12: return LDKBolt12SemanticError_InvalidSigningPubkey;
428                 case 13: return LDKBolt12SemanticError_UnexpectedSigningPubkey;
429                 case 14: return LDKBolt12SemanticError_MissingQuantity;
430                 case 15: return LDKBolt12SemanticError_InvalidQuantity;
431                 case 16: return LDKBolt12SemanticError_UnexpectedQuantity;
432                 case 17: return LDKBolt12SemanticError_InvalidMetadata;
433                 case 18: return LDKBolt12SemanticError_UnexpectedMetadata;
434                 case 19: return LDKBolt12SemanticError_MissingPayerMetadata;
435                 case 20: return LDKBolt12SemanticError_MissingPayerId;
436                 case 21: return LDKBolt12SemanticError_DuplicatePaymentId;
437                 case 22: return LDKBolt12SemanticError_MissingPaths;
438                 case 23: return LDKBolt12SemanticError_UnexpectedPaths;
439                 case 24: return LDKBolt12SemanticError_InvalidPayInfo;
440                 case 25: return LDKBolt12SemanticError_MissingCreationTime;
441                 case 26: return LDKBolt12SemanticError_MissingPaymentHash;
442                 case 27: return LDKBolt12SemanticError_MissingSignature;
443                 default: abort();
444         }
445 }
446 static inline int32_t LDKBolt12SemanticError_to_cs(LDKBolt12SemanticError val) {
447         switch (val) {
448                 case LDKBolt12SemanticError_AlreadyExpired: return 0;
449                 case LDKBolt12SemanticError_UnsupportedChain: return 1;
450                 case LDKBolt12SemanticError_UnexpectedChain: return 2;
451                 case LDKBolt12SemanticError_MissingAmount: return 3;
452                 case LDKBolt12SemanticError_InvalidAmount: return 4;
453                 case LDKBolt12SemanticError_InsufficientAmount: return 5;
454                 case LDKBolt12SemanticError_UnexpectedAmount: return 6;
455                 case LDKBolt12SemanticError_UnsupportedCurrency: return 7;
456                 case LDKBolt12SemanticError_UnknownRequiredFeatures: return 8;
457                 case LDKBolt12SemanticError_UnexpectedFeatures: return 9;
458                 case LDKBolt12SemanticError_MissingDescription: return 10;
459                 case LDKBolt12SemanticError_MissingSigningPubkey: return 11;
460                 case LDKBolt12SemanticError_InvalidSigningPubkey: return 12;
461                 case LDKBolt12SemanticError_UnexpectedSigningPubkey: return 13;
462                 case LDKBolt12SemanticError_MissingQuantity: return 14;
463                 case LDKBolt12SemanticError_InvalidQuantity: return 15;
464                 case LDKBolt12SemanticError_UnexpectedQuantity: return 16;
465                 case LDKBolt12SemanticError_InvalidMetadata: return 17;
466                 case LDKBolt12SemanticError_UnexpectedMetadata: return 18;
467                 case LDKBolt12SemanticError_MissingPayerMetadata: return 19;
468                 case LDKBolt12SemanticError_MissingPayerId: return 20;
469                 case LDKBolt12SemanticError_DuplicatePaymentId: return 21;
470                 case LDKBolt12SemanticError_MissingPaths: return 22;
471                 case LDKBolt12SemanticError_UnexpectedPaths: return 23;
472                 case LDKBolt12SemanticError_InvalidPayInfo: return 24;
473                 case LDKBolt12SemanticError_MissingCreationTime: return 25;
474                 case LDKBolt12SemanticError_MissingPaymentHash: return 26;
475                 case LDKBolt12SemanticError_MissingSignature: return 27;
476                 default: abort();
477         }
478 }
479 static inline LDKCOption_NoneZ LDKCOption_NoneZ_from_cs(int32_t ord) {
480         switch (ord) {
481                 case 0: return LDKCOption_NoneZ_Some;
482                 case 1: return LDKCOption_NoneZ_None;
483                 default: abort();
484         }
485 }
486 static inline int32_t LDKCOption_NoneZ_to_cs(LDKCOption_NoneZ val) {
487         switch (val) {
488                 case LDKCOption_NoneZ_Some: return 0;
489                 case LDKCOption_NoneZ_None: return 1;
490                 default: abort();
491         }
492 }
493 static inline LDKChannelMonitorUpdateStatus LDKChannelMonitorUpdateStatus_from_cs(int32_t ord) {
494         switch (ord) {
495                 case 0: return LDKChannelMonitorUpdateStatus_Completed;
496                 case 1: return LDKChannelMonitorUpdateStatus_InProgress;
497                 case 2: return LDKChannelMonitorUpdateStatus_UnrecoverableError;
498                 default: abort();
499         }
500 }
501 static inline int32_t LDKChannelMonitorUpdateStatus_to_cs(LDKChannelMonitorUpdateStatus val) {
502         switch (val) {
503                 case LDKChannelMonitorUpdateStatus_Completed: return 0;
504                 case LDKChannelMonitorUpdateStatus_InProgress: return 1;
505                 case LDKChannelMonitorUpdateStatus_UnrecoverableError: return 2;
506                 default: abort();
507         }
508 }
509 static inline LDKChannelShutdownState LDKChannelShutdownState_from_cs(int32_t ord) {
510         switch (ord) {
511                 case 0: return LDKChannelShutdownState_NotShuttingDown;
512                 case 1: return LDKChannelShutdownState_ShutdownInitiated;
513                 case 2: return LDKChannelShutdownState_ResolvingHTLCs;
514                 case 3: return LDKChannelShutdownState_NegotiatingClosingFee;
515                 case 4: return LDKChannelShutdownState_ShutdownComplete;
516                 default: abort();
517         }
518 }
519 static inline int32_t LDKChannelShutdownState_to_cs(LDKChannelShutdownState val) {
520         switch (val) {
521                 case LDKChannelShutdownState_NotShuttingDown: return 0;
522                 case LDKChannelShutdownState_ShutdownInitiated: return 1;
523                 case LDKChannelShutdownState_ResolvingHTLCs: return 2;
524                 case LDKChannelShutdownState_NegotiatingClosingFee: return 3;
525                 case LDKChannelShutdownState_ShutdownComplete: return 4;
526                 default: abort();
527         }
528 }
529 static inline LDKConfirmationTarget LDKConfirmationTarget_from_cs(int32_t ord) {
530         switch (ord) {
531                 case 0: return LDKConfirmationTarget_OnChainSweep;
532                 case 1: return LDKConfirmationTarget_MinAllowedAnchorChannelRemoteFee;
533                 case 2: return LDKConfirmationTarget_MinAllowedNonAnchorChannelRemoteFee;
534                 case 3: return LDKConfirmationTarget_AnchorChannelFee;
535                 case 4: return LDKConfirmationTarget_NonAnchorChannelFee;
536                 case 5: return LDKConfirmationTarget_ChannelCloseMinimum;
537                 case 6: return LDKConfirmationTarget_OutputSpendingFee;
538                 default: abort();
539         }
540 }
541 static inline int32_t LDKConfirmationTarget_to_cs(LDKConfirmationTarget val) {
542         switch (val) {
543                 case LDKConfirmationTarget_OnChainSweep: return 0;
544                 case LDKConfirmationTarget_MinAllowedAnchorChannelRemoteFee: return 1;
545                 case LDKConfirmationTarget_MinAllowedNonAnchorChannelRemoteFee: return 2;
546                 case LDKConfirmationTarget_AnchorChannelFee: return 3;
547                 case LDKConfirmationTarget_NonAnchorChannelFee: return 4;
548                 case LDKConfirmationTarget_ChannelCloseMinimum: return 5;
549                 case LDKConfirmationTarget_OutputSpendingFee: return 6;
550                 default: abort();
551         }
552 }
553 static inline LDKCreationError LDKCreationError_from_cs(int32_t ord) {
554         switch (ord) {
555                 case 0: return LDKCreationError_DescriptionTooLong;
556                 case 1: return LDKCreationError_RouteTooLong;
557                 case 2: return LDKCreationError_TimestampOutOfBounds;
558                 case 3: return LDKCreationError_InvalidAmount;
559                 case 4: return LDKCreationError_MissingRouteHints;
560                 case 5: return LDKCreationError_MinFinalCltvExpiryDeltaTooShort;
561                 default: abort();
562         }
563 }
564 static inline int32_t LDKCreationError_to_cs(LDKCreationError val) {
565         switch (val) {
566                 case LDKCreationError_DescriptionTooLong: return 0;
567                 case LDKCreationError_RouteTooLong: return 1;
568                 case LDKCreationError_TimestampOutOfBounds: return 2;
569                 case LDKCreationError_InvalidAmount: return 3;
570                 case LDKCreationError_MissingRouteHints: return 4;
571                 case LDKCreationError_MinFinalCltvExpiryDeltaTooShort: return 5;
572                 default: abort();
573         }
574 }
575 static inline LDKCurrency LDKCurrency_from_cs(int32_t ord) {
576         switch (ord) {
577                 case 0: return LDKCurrency_Bitcoin;
578                 case 1: return LDKCurrency_BitcoinTestnet;
579                 case 2: return LDKCurrency_Regtest;
580                 case 3: return LDKCurrency_Simnet;
581                 case 4: return LDKCurrency_Signet;
582                 default: abort();
583         }
584 }
585 static inline int32_t LDKCurrency_to_cs(LDKCurrency val) {
586         switch (val) {
587                 case LDKCurrency_Bitcoin: return 0;
588                 case LDKCurrency_BitcoinTestnet: return 1;
589                 case LDKCurrency_Regtest: return 2;
590                 case LDKCurrency_Simnet: return 3;
591                 case LDKCurrency_Signet: return 4;
592                 default: abort();
593         }
594 }
595 static inline LDKDirection LDKDirection_from_cs(int32_t ord) {
596         switch (ord) {
597                 case 0: return LDKDirection_NodeOne;
598                 case 1: return LDKDirection_NodeTwo;
599                 default: abort();
600         }
601 }
602 static inline int32_t LDKDirection_to_cs(LDKDirection val) {
603         switch (val) {
604                 case LDKDirection_NodeOne: return 0;
605                 case LDKDirection_NodeTwo: return 1;
606                 default: abort();
607         }
608 }
609 static inline LDKHTLCClaim LDKHTLCClaim_from_cs(int32_t ord) {
610         switch (ord) {
611                 case 0: return LDKHTLCClaim_OfferedTimeout;
612                 case 1: return LDKHTLCClaim_OfferedPreimage;
613                 case 2: return LDKHTLCClaim_AcceptedTimeout;
614                 case 3: return LDKHTLCClaim_AcceptedPreimage;
615                 case 4: return LDKHTLCClaim_Revocation;
616                 default: abort();
617         }
618 }
619 static inline int32_t LDKHTLCClaim_to_cs(LDKHTLCClaim val) {
620         switch (val) {
621                 case LDKHTLCClaim_OfferedTimeout: return 0;
622                 case LDKHTLCClaim_OfferedPreimage: return 1;
623                 case LDKHTLCClaim_AcceptedTimeout: return 2;
624                 case LDKHTLCClaim_AcceptedPreimage: return 3;
625                 case LDKHTLCClaim_Revocation: return 4;
626                 default: abort();
627         }
628 }
629 static inline LDKIOError LDKIOError_from_cs(int32_t ord) {
630         switch (ord) {
631                 case 0: return LDKIOError_NotFound;
632                 case 1: return LDKIOError_PermissionDenied;
633                 case 2: return LDKIOError_ConnectionRefused;
634                 case 3: return LDKIOError_ConnectionReset;
635                 case 4: return LDKIOError_ConnectionAborted;
636                 case 5: return LDKIOError_NotConnected;
637                 case 6: return LDKIOError_AddrInUse;
638                 case 7: return LDKIOError_AddrNotAvailable;
639                 case 8: return LDKIOError_BrokenPipe;
640                 case 9: return LDKIOError_AlreadyExists;
641                 case 10: return LDKIOError_WouldBlock;
642                 case 11: return LDKIOError_InvalidInput;
643                 case 12: return LDKIOError_InvalidData;
644                 case 13: return LDKIOError_TimedOut;
645                 case 14: return LDKIOError_WriteZero;
646                 case 15: return LDKIOError_Interrupted;
647                 case 16: return LDKIOError_Other;
648                 case 17: return LDKIOError_UnexpectedEof;
649                 default: abort();
650         }
651 }
652 static inline int32_t LDKIOError_to_cs(LDKIOError val) {
653         switch (val) {
654                 case LDKIOError_NotFound: return 0;
655                 case LDKIOError_PermissionDenied: return 1;
656                 case LDKIOError_ConnectionRefused: return 2;
657                 case LDKIOError_ConnectionReset: return 3;
658                 case LDKIOError_ConnectionAborted: return 4;
659                 case LDKIOError_NotConnected: return 5;
660                 case LDKIOError_AddrInUse: return 6;
661                 case LDKIOError_AddrNotAvailable: return 7;
662                 case LDKIOError_BrokenPipe: return 8;
663                 case LDKIOError_AlreadyExists: return 9;
664                 case LDKIOError_WouldBlock: return 10;
665                 case LDKIOError_InvalidInput: return 11;
666                 case LDKIOError_InvalidData: return 12;
667                 case LDKIOError_TimedOut: return 13;
668                 case LDKIOError_WriteZero: return 14;
669                 case LDKIOError_Interrupted: return 15;
670                 case LDKIOError_Other: return 16;
671                 case LDKIOError_UnexpectedEof: return 17;
672                 default: abort();
673         }
674 }
675 static inline LDKInboundHTLCStateDetails LDKInboundHTLCStateDetails_from_cs(int32_t ord) {
676         switch (ord) {
677                 case 0: return LDKInboundHTLCStateDetails_AwaitingRemoteRevokeToAdd;
678                 case 1: return LDKInboundHTLCStateDetails_Committed;
679                 case 2: return LDKInboundHTLCStateDetails_AwaitingRemoteRevokeToRemoveFulfill;
680                 case 3: return LDKInboundHTLCStateDetails_AwaitingRemoteRevokeToRemoveFail;
681                 default: abort();
682         }
683 }
684 static inline int32_t LDKInboundHTLCStateDetails_to_cs(LDKInboundHTLCStateDetails val) {
685         switch (val) {
686                 case LDKInboundHTLCStateDetails_AwaitingRemoteRevokeToAdd: return 0;
687                 case LDKInboundHTLCStateDetails_Committed: return 1;
688                 case LDKInboundHTLCStateDetails_AwaitingRemoteRevokeToRemoveFulfill: return 2;
689                 case LDKInboundHTLCStateDetails_AwaitingRemoteRevokeToRemoveFail: return 3;
690                 default: abort();
691         }
692 }
693 static inline LDKLevel LDKLevel_from_cs(int32_t ord) {
694         switch (ord) {
695                 case 0: return LDKLevel_Gossip;
696                 case 1: return LDKLevel_Trace;
697                 case 2: return LDKLevel_Debug;
698                 case 3: return LDKLevel_Info;
699                 case 4: return LDKLevel_Warn;
700                 case 5: return LDKLevel_Error;
701                 default: abort();
702         }
703 }
704 static inline int32_t LDKLevel_to_cs(LDKLevel val) {
705         switch (val) {
706                 case LDKLevel_Gossip: return 0;
707                 case LDKLevel_Trace: return 1;
708                 case LDKLevel_Debug: return 2;
709                 case LDKLevel_Info: return 3;
710                 case LDKLevel_Warn: return 4;
711                 case LDKLevel_Error: return 5;
712                 default: abort();
713         }
714 }
715 static inline LDKNetwork LDKNetwork_from_cs(int32_t ord) {
716         switch (ord) {
717                 case 0: return LDKNetwork_Bitcoin;
718                 case 1: return LDKNetwork_Testnet;
719                 case 2: return LDKNetwork_Regtest;
720                 case 3: return LDKNetwork_Signet;
721                 default: abort();
722         }
723 }
724 static inline int32_t LDKNetwork_to_cs(LDKNetwork val) {
725         switch (val) {
726                 case LDKNetwork_Bitcoin: return 0;
727                 case LDKNetwork_Testnet: return 1;
728                 case LDKNetwork_Regtest: return 2;
729                 case LDKNetwork_Signet: return 3;
730                 default: abort();
731         }
732 }
733 static inline LDKOutboundHTLCStateDetails LDKOutboundHTLCStateDetails_from_cs(int32_t ord) {
734         switch (ord) {
735                 case 0: return LDKOutboundHTLCStateDetails_AwaitingRemoteRevokeToAdd;
736                 case 1: return LDKOutboundHTLCStateDetails_Committed;
737                 case 2: return LDKOutboundHTLCStateDetails_AwaitingRemoteRevokeToRemoveSuccess;
738                 case 3: return LDKOutboundHTLCStateDetails_AwaitingRemoteRevokeToRemoveFailure;
739                 default: abort();
740         }
741 }
742 static inline int32_t LDKOutboundHTLCStateDetails_to_cs(LDKOutboundHTLCStateDetails val) {
743         switch (val) {
744                 case LDKOutboundHTLCStateDetails_AwaitingRemoteRevokeToAdd: return 0;
745                 case LDKOutboundHTLCStateDetails_Committed: return 1;
746                 case LDKOutboundHTLCStateDetails_AwaitingRemoteRevokeToRemoveSuccess: return 2;
747                 case LDKOutboundHTLCStateDetails_AwaitingRemoteRevokeToRemoveFailure: return 3;
748                 default: abort();
749         }
750 }
751 static inline LDKPaymentFailureReason LDKPaymentFailureReason_from_cs(int32_t ord) {
752         switch (ord) {
753                 case 0: return LDKPaymentFailureReason_RecipientRejected;
754                 case 1: return LDKPaymentFailureReason_UserAbandoned;
755                 case 2: return LDKPaymentFailureReason_RetriesExhausted;
756                 case 3: return LDKPaymentFailureReason_PaymentExpired;
757                 case 4: return LDKPaymentFailureReason_RouteNotFound;
758                 case 5: return LDKPaymentFailureReason_UnexpectedError;
759                 default: abort();
760         }
761 }
762 static inline int32_t LDKPaymentFailureReason_to_cs(LDKPaymentFailureReason val) {
763         switch (val) {
764                 case LDKPaymentFailureReason_RecipientRejected: return 0;
765                 case LDKPaymentFailureReason_UserAbandoned: return 1;
766                 case LDKPaymentFailureReason_RetriesExhausted: return 2;
767                 case LDKPaymentFailureReason_PaymentExpired: return 3;
768                 case LDKPaymentFailureReason_RouteNotFound: return 4;
769                 case LDKPaymentFailureReason_UnexpectedError: return 5;
770                 default: abort();
771         }
772 }
773 static inline LDKRecipient LDKRecipient_from_cs(int32_t ord) {
774         switch (ord) {
775                 case 0: return LDKRecipient_Node;
776                 case 1: return LDKRecipient_PhantomNode;
777                 default: abort();
778         }
779 }
780 static inline int32_t LDKRecipient_to_cs(LDKRecipient val) {
781         switch (val) {
782                 case LDKRecipient_Node: return 0;
783                 case LDKRecipient_PhantomNode: return 1;
784                 default: abort();
785         }
786 }
787 static inline LDKRetryableSendFailure LDKRetryableSendFailure_from_cs(int32_t ord) {
788         switch (ord) {
789                 case 0: return LDKRetryableSendFailure_PaymentExpired;
790                 case 1: return LDKRetryableSendFailure_RouteNotFound;
791                 case 2: return LDKRetryableSendFailure_DuplicatePayment;
792                 default: abort();
793         }
794 }
795 static inline int32_t LDKRetryableSendFailure_to_cs(LDKRetryableSendFailure val) {
796         switch (val) {
797                 case LDKRetryableSendFailure_PaymentExpired: return 0;
798                 case LDKRetryableSendFailure_RouteNotFound: return 1;
799                 case LDKRetryableSendFailure_DuplicatePayment: return 2;
800                 default: abort();
801         }
802 }
803 static inline LDKSecp256k1Error LDKSecp256k1Error_from_cs(int32_t ord) {
804         switch (ord) {
805                 case 0: return LDKSecp256k1Error_IncorrectSignature;
806                 case 1: return LDKSecp256k1Error_InvalidMessage;
807                 case 2: return LDKSecp256k1Error_InvalidPublicKey;
808                 case 3: return LDKSecp256k1Error_InvalidSignature;
809                 case 4: return LDKSecp256k1Error_InvalidSecretKey;
810                 case 5: return LDKSecp256k1Error_InvalidSharedSecret;
811                 case 6: return LDKSecp256k1Error_InvalidRecoveryId;
812                 case 7: return LDKSecp256k1Error_InvalidTweak;
813                 case 8: return LDKSecp256k1Error_NotEnoughMemory;
814                 case 9: return LDKSecp256k1Error_InvalidPublicKeySum;
815                 case 10: return LDKSecp256k1Error_InvalidParityValue;
816                 default: abort();
817         }
818 }
819 static inline int32_t LDKSecp256k1Error_to_cs(LDKSecp256k1Error val) {
820         switch (val) {
821                 case LDKSecp256k1Error_IncorrectSignature: return 0;
822                 case LDKSecp256k1Error_InvalidMessage: return 1;
823                 case LDKSecp256k1Error_InvalidPublicKey: return 2;
824                 case LDKSecp256k1Error_InvalidSignature: return 3;
825                 case LDKSecp256k1Error_InvalidSecretKey: return 4;
826                 case LDKSecp256k1Error_InvalidSharedSecret: return 5;
827                 case LDKSecp256k1Error_InvalidRecoveryId: return 6;
828                 case LDKSecp256k1Error_InvalidTweak: return 7;
829                 case LDKSecp256k1Error_NotEnoughMemory: return 8;
830                 case LDKSecp256k1Error_InvalidPublicKeySum: return 9;
831                 case LDKSecp256k1Error_InvalidParityValue: return 10;
832                 default: abort();
833         }
834 }
835 static inline LDKShortChannelIdError LDKShortChannelIdError_from_cs(int32_t ord) {
836         switch (ord) {
837                 case 0: return LDKShortChannelIdError_BlockOverflow;
838                 case 1: return LDKShortChannelIdError_TxIndexOverflow;
839                 case 2: return LDKShortChannelIdError_VoutIndexOverflow;
840                 default: abort();
841         }
842 }
843 static inline int32_t LDKShortChannelIdError_to_cs(LDKShortChannelIdError val) {
844         switch (val) {
845                 case LDKShortChannelIdError_BlockOverflow: return 0;
846                 case LDKShortChannelIdError_TxIndexOverflow: return 1;
847                 case LDKShortChannelIdError_VoutIndexOverflow: return 2;
848                 default: abort();
849         }
850 }
851 static inline LDKSiPrefix LDKSiPrefix_from_cs(int32_t ord) {
852         switch (ord) {
853                 case 0: return LDKSiPrefix_Milli;
854                 case 1: return LDKSiPrefix_Micro;
855                 case 2: return LDKSiPrefix_Nano;
856                 case 3: return LDKSiPrefix_Pico;
857                 default: abort();
858         }
859 }
860 static inline int32_t LDKSiPrefix_to_cs(LDKSiPrefix val) {
861         switch (val) {
862                 case LDKSiPrefix_Milli: return 0;
863                 case LDKSiPrefix_Micro: return 1;
864                 case LDKSiPrefix_Nano: return 2;
865                 case LDKSiPrefix_Pico: return 3;
866                 default: abort();
867         }
868 }
869 static inline LDKSocketAddressParseError LDKSocketAddressParseError_from_cs(int32_t ord) {
870         switch (ord) {
871                 case 0: return LDKSocketAddressParseError_SocketAddrParse;
872                 case 1: return LDKSocketAddressParseError_InvalidInput;
873                 case 2: return LDKSocketAddressParseError_InvalidPort;
874                 case 3: return LDKSocketAddressParseError_InvalidOnionV3;
875                 default: abort();
876         }
877 }
878 static inline int32_t LDKSocketAddressParseError_to_cs(LDKSocketAddressParseError val) {
879         switch (val) {
880                 case LDKSocketAddressParseError_SocketAddrParse: return 0;
881                 case LDKSocketAddressParseError_InvalidInput: return 1;
882                 case LDKSocketAddressParseError_InvalidPort: return 2;
883                 case LDKSocketAddressParseError_InvalidOnionV3: return 3;
884                 default: abort();
885         }
886 }
887 static inline LDKUtxoLookupError LDKUtxoLookupError_from_cs(int32_t ord) {
888         switch (ord) {
889                 case 0: return LDKUtxoLookupError_UnknownChain;
890                 case 1: return LDKUtxoLookupError_UnknownTx;
891                 default: abort();
892         }
893 }
894 static inline int32_t LDKUtxoLookupError_to_cs(LDKUtxoLookupError val) {
895         switch (val) {
896                 case LDKUtxoLookupError_UnknownChain: return 0;
897                 case LDKUtxoLookupError_UnknownTx: return 1;
898                 default: abort();
899         }
900 }
901 static inline LDKCVec_u8Z CVec_u8Z_clone(const LDKCVec_u8Z *orig) {
902         LDKCVec_u8Z ret = { .data = MALLOC(sizeof(int8_t) * orig->datalen, "LDKCVec_u8Z clone bytes"), .datalen = orig->datalen };
903         memcpy(ret.data, orig->data, sizeof(int8_t) * ret.datalen);
904         return ret;
905 }
906 struct LDKThirtyTwoBytes BigEndianScalar_get_bytes (struct LDKBigEndianScalar* thing) {
907         LDKThirtyTwoBytes ret = { .data = *thing->big_endian_bytes };
908         return ret;
909 }
910 int8_tArray  CS_LDK_BigEndianScalar_get_bytes(int64_t thing) {
911         LDKBigEndianScalar* thing_conv = (LDKBigEndianScalar*)untag_ptr(thing);
912         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
913         memcpy(ret_arr->elems, BigEndianScalar_get_bytes(thing_conv).data, 32);
914         return ret_arr;
915 }
916
917 static void BigEndianScalar_free (struct LDKBigEndianScalar thing) {}
918 void  CS_LDK_BigEndianScalar_free(int64_t thing) {
919         if (!ptr_is_owned(thing)) return;
920         void* thing_ptr = untag_ptr(thing);
921         CHECK_ACCESS(thing_ptr);
922         LDKBigEndianScalar thing_conv = *(LDKBigEndianScalar*)(thing_ptr);
923         FREE(untag_ptr(thing));
924         BigEndianScalar_free(thing_conv);
925 }
926
927 uint32_t CS_LDK_LDKBech32Error_ty_from_ptr(int64_t ptr) {
928         LDKBech32Error *obj = (LDKBech32Error*)untag_ptr(ptr);
929         switch(obj->tag) {
930                 case LDKBech32Error_MissingSeparator: return 0;
931                 case LDKBech32Error_InvalidChecksum: return 1;
932                 case LDKBech32Error_InvalidLength: return 2;
933                 case LDKBech32Error_InvalidChar: return 3;
934                 case LDKBech32Error_InvalidData: return 4;
935                 case LDKBech32Error_InvalidPadding: return 5;
936                 case LDKBech32Error_MixedCase: return 6;
937                 default: abort();
938         }
939 }
940 int32_t CS_LDK_LDKBech32Error_InvalidChar_get_invalid_char(int64_t ptr) {
941         LDKBech32Error *obj = (LDKBech32Error*)untag_ptr(ptr);
942         CHECK(obj->tag == LDKBech32Error_InvalidChar);
943         int32_t invalid_char_conv = obj->invalid_char;
944         return invalid_char_conv;
945 }
946 int8_t CS_LDK_LDKBech32Error_InvalidData_get_invalid_data(int64_t ptr) {
947         LDKBech32Error *obj = (LDKBech32Error*)untag_ptr(ptr);
948         CHECK(obj->tag == LDKBech32Error_InvalidData);
949         int8_t invalid_data_conv = obj->invalid_data;
950         return invalid_data_conv;
951 }
952 static inline struct LDKRefundMaybeWithDerivedMetadataBuilder CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_get_ok(LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ *NONNULL_PTR owner){
953         LDKRefundMaybeWithDerivedMetadataBuilder ret = *owner->contents.result;
954         ret.is_owned = false;
955         return ret;
956 }
957 int64_t  CS_LDK_CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_get_ok(int64_t owner) {
958         LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ* owner_conv = (LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ*)untag_ptr(owner);
959         LDKRefundMaybeWithDerivedMetadataBuilder ret_var = CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_get_ok(owner_conv);
960         int64_t ret_ref = 0;
961         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
962         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
963         return ret_ref;
964 }
965
966 static inline enum LDKBolt12SemanticError CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_get_err(LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ *NONNULL_PTR owner){
967 CHECK(!owner->result_ok);
968         return Bolt12SemanticError_clone(&*owner->contents.err);
969 }
970 int32_t  CS_LDK_CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_get_err(int64_t owner) {
971         LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ* owner_conv = (LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ*)untag_ptr(owner);
972         int32_t ret_conv = LDKBolt12SemanticError_to_cs(CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_get_err(owner_conv));
973         return ret_conv;
974 }
975
976 static inline struct LDKRefund CResult_RefundBolt12SemanticErrorZ_get_ok(LDKCResult_RefundBolt12SemanticErrorZ *NONNULL_PTR owner){
977         LDKRefund ret = *owner->contents.result;
978         ret.is_owned = false;
979         return ret;
980 }
981 int64_t  CS_LDK_CResult_RefundBolt12SemanticErrorZ_get_ok(int64_t owner) {
982         LDKCResult_RefundBolt12SemanticErrorZ* owner_conv = (LDKCResult_RefundBolt12SemanticErrorZ*)untag_ptr(owner);
983         LDKRefund ret_var = CResult_RefundBolt12SemanticErrorZ_get_ok(owner_conv);
984         int64_t ret_ref = 0;
985         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
986         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
987         return ret_ref;
988 }
989
990 static inline enum LDKBolt12SemanticError CResult_RefundBolt12SemanticErrorZ_get_err(LDKCResult_RefundBolt12SemanticErrorZ *NONNULL_PTR owner){
991 CHECK(!owner->result_ok);
992         return Bolt12SemanticError_clone(&*owner->contents.err);
993 }
994 int32_t  CS_LDK_CResult_RefundBolt12SemanticErrorZ_get_err(int64_t owner) {
995         LDKCResult_RefundBolt12SemanticErrorZ* owner_conv = (LDKCResult_RefundBolt12SemanticErrorZ*)untag_ptr(owner);
996         int32_t ret_conv = LDKBolt12SemanticError_to_cs(CResult_RefundBolt12SemanticErrorZ_get_err(owner_conv));
997         return ret_conv;
998 }
999
1000 uint32_t CS_LDK_LDKCOption_u64Z_ty_from_ptr(int64_t ptr) {
1001         LDKCOption_u64Z *obj = (LDKCOption_u64Z*)untag_ptr(ptr);
1002         switch(obj->tag) {
1003                 case LDKCOption_u64Z_Some: return 0;
1004                 case LDKCOption_u64Z_None: return 1;
1005                 default: abort();
1006         }
1007 }
1008 int64_t CS_LDK_LDKCOption_u64Z_Some_get_some(int64_t ptr) {
1009         LDKCOption_u64Z *obj = (LDKCOption_u64Z*)untag_ptr(ptr);
1010         CHECK(obj->tag == LDKCOption_u64Z_Some);
1011         int64_t some_conv = obj->some;
1012         return some_conv;
1013 }
1014 static inline LDKCVec_BlindedPathZ CVec_BlindedPathZ_clone(const LDKCVec_BlindedPathZ *orig) {
1015         LDKCVec_BlindedPathZ ret = { .data = MALLOC(sizeof(LDKBlindedPath) * orig->datalen, "LDKCVec_BlindedPathZ clone bytes"), .datalen = orig->datalen };
1016         for (size_t i = 0; i < ret.datalen; i++) {
1017                 ret.data[i] = BlindedPath_clone(&orig->data[i]);
1018         }
1019         return ret;
1020 }
1021 static inline struct LDKRefund CResult_RefundBolt12ParseErrorZ_get_ok(LDKCResult_RefundBolt12ParseErrorZ *NONNULL_PTR owner){
1022         LDKRefund ret = *owner->contents.result;
1023         ret.is_owned = false;
1024         return ret;
1025 }
1026 int64_t  CS_LDK_CResult_RefundBolt12ParseErrorZ_get_ok(int64_t owner) {
1027         LDKCResult_RefundBolt12ParseErrorZ* owner_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(owner);
1028         LDKRefund ret_var = CResult_RefundBolt12ParseErrorZ_get_ok(owner_conv);
1029         int64_t ret_ref = 0;
1030         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1031         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1032         return ret_ref;
1033 }
1034
1035 static inline struct LDKBolt12ParseError CResult_RefundBolt12ParseErrorZ_get_err(LDKCResult_RefundBolt12ParseErrorZ *NONNULL_PTR owner){
1036         LDKBolt12ParseError ret = *owner->contents.err;
1037         ret.is_owned = false;
1038         return ret;
1039 }
1040 int64_t  CS_LDK_CResult_RefundBolt12ParseErrorZ_get_err(int64_t owner) {
1041         LDKCResult_RefundBolt12ParseErrorZ* owner_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(owner);
1042         LDKBolt12ParseError ret_var = CResult_RefundBolt12ParseErrorZ_get_err(owner_conv);
1043         int64_t ret_ref = 0;
1044         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1045         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1046         return ret_ref;
1047 }
1048
1049 uint32_t CS_LDK_LDKRetry_ty_from_ptr(int64_t ptr) {
1050         LDKRetry *obj = (LDKRetry*)untag_ptr(ptr);
1051         switch(obj->tag) {
1052                 case LDKRetry_Attempts: return 0;
1053                 case LDKRetry_Timeout: return 1;
1054                 default: abort();
1055         }
1056 }
1057 int32_t CS_LDK_LDKRetry_Attempts_get_attempts(int64_t ptr) {
1058         LDKRetry *obj = (LDKRetry*)untag_ptr(ptr);
1059         CHECK(obj->tag == LDKRetry_Attempts);
1060         int32_t attempts_conv = obj->attempts;
1061         return attempts_conv;
1062 }
1063 int64_t CS_LDK_LDKRetry_Timeout_get_timeout(int64_t ptr) {
1064         LDKRetry *obj = (LDKRetry*)untag_ptr(ptr);
1065         CHECK(obj->tag == LDKRetry_Timeout);
1066         int64_t timeout_conv = obj->timeout;
1067         return timeout_conv;
1068 }
1069 uint32_t CS_LDK_LDKDecodeError_ty_from_ptr(int64_t ptr) {
1070         LDKDecodeError *obj = (LDKDecodeError*)untag_ptr(ptr);
1071         switch(obj->tag) {
1072                 case LDKDecodeError_UnknownVersion: return 0;
1073                 case LDKDecodeError_UnknownRequiredFeature: return 1;
1074                 case LDKDecodeError_InvalidValue: return 2;
1075                 case LDKDecodeError_ShortRead: return 3;
1076                 case LDKDecodeError_BadLengthDescriptor: return 4;
1077                 case LDKDecodeError_Io: return 5;
1078                 case LDKDecodeError_UnsupportedCompression: return 6;
1079                 case LDKDecodeError_DangerousValue: return 7;
1080                 default: abort();
1081         }
1082 }
1083 int32_t CS_LDK_LDKDecodeError_Io_get_io(int64_t ptr) {
1084         LDKDecodeError *obj = (LDKDecodeError*)untag_ptr(ptr);
1085         CHECK(obj->tag == LDKDecodeError_Io);
1086         int32_t io_conv = LDKIOError_to_cs(obj->io);
1087         return io_conv;
1088 }
1089 static inline struct LDKRetry CResult_RetryDecodeErrorZ_get_ok(LDKCResult_RetryDecodeErrorZ *NONNULL_PTR owner){
1090 CHECK(owner->result_ok);
1091         return Retry_clone(&*owner->contents.result);
1092 }
1093 int64_t  CS_LDK_CResult_RetryDecodeErrorZ_get_ok(int64_t owner) {
1094         LDKCResult_RetryDecodeErrorZ* owner_conv = (LDKCResult_RetryDecodeErrorZ*)untag_ptr(owner);
1095         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
1096         *ret_copy = CResult_RetryDecodeErrorZ_get_ok(owner_conv);
1097         int64_t ret_ref = tag_ptr(ret_copy, true);
1098         return ret_ref;
1099 }
1100
1101 static inline struct LDKDecodeError CResult_RetryDecodeErrorZ_get_err(LDKCResult_RetryDecodeErrorZ *NONNULL_PTR owner){
1102 CHECK(!owner->result_ok);
1103         return DecodeError_clone(&*owner->contents.err);
1104 }
1105 int64_t  CS_LDK_CResult_RetryDecodeErrorZ_get_err(int64_t owner) {
1106         LDKCResult_RetryDecodeErrorZ* owner_conv = (LDKCResult_RetryDecodeErrorZ*)untag_ptr(owner);
1107         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1108         *ret_copy = CResult_RetryDecodeErrorZ_get_err(owner_conv);
1109         int64_t ret_ref = tag_ptr(ret_copy, true);
1110         return ret_ref;
1111 }
1112
1113 uint32_t CS_LDK_LDKAPIError_ty_from_ptr(int64_t ptr) {
1114         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
1115         switch(obj->tag) {
1116                 case LDKAPIError_APIMisuseError: return 0;
1117                 case LDKAPIError_FeeRateTooHigh: return 1;
1118                 case LDKAPIError_InvalidRoute: return 2;
1119                 case LDKAPIError_ChannelUnavailable: return 3;
1120                 case LDKAPIError_MonitorUpdateInProgress: return 4;
1121                 case LDKAPIError_IncompatibleShutdownScript: return 5;
1122                 default: abort();
1123         }
1124 }
1125 jstring CS_LDK_LDKAPIError_APIMisuseError_get_err(int64_t ptr) {
1126         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
1127         CHECK(obj->tag == LDKAPIError_APIMisuseError);
1128         LDKStr err_str = obj->api_misuse_error.err;
1129                         jstring err_conv = str_ref_to_cs(err_str.chars, err_str.len);
1130         return err_conv;
1131 }
1132 jstring CS_LDK_LDKAPIError_FeeRateTooHigh_get_err(int64_t ptr) {
1133         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
1134         CHECK(obj->tag == LDKAPIError_FeeRateTooHigh);
1135         LDKStr err_str = obj->fee_rate_too_high.err;
1136                         jstring err_conv = str_ref_to_cs(err_str.chars, err_str.len);
1137         return err_conv;
1138 }
1139 int32_t CS_LDK_LDKAPIError_FeeRateTooHigh_get_feerate(int64_t ptr) {
1140         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
1141         CHECK(obj->tag == LDKAPIError_FeeRateTooHigh);
1142         int32_t feerate_conv = obj->fee_rate_too_high.feerate;
1143         return feerate_conv;
1144 }
1145 jstring CS_LDK_LDKAPIError_InvalidRoute_get_err(int64_t ptr) {
1146         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
1147         CHECK(obj->tag == LDKAPIError_InvalidRoute);
1148         LDKStr err_str = obj->invalid_route.err;
1149                         jstring err_conv = str_ref_to_cs(err_str.chars, err_str.len);
1150         return err_conv;
1151 }
1152 jstring CS_LDK_LDKAPIError_ChannelUnavailable_get_err(int64_t ptr) {
1153         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
1154         CHECK(obj->tag == LDKAPIError_ChannelUnavailable);
1155         LDKStr err_str = obj->channel_unavailable.err;
1156                         jstring err_conv = str_ref_to_cs(err_str.chars, err_str.len);
1157         return err_conv;
1158 }
1159 int64_t CS_LDK_LDKAPIError_IncompatibleShutdownScript_get_script(int64_t ptr) {
1160         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
1161         CHECK(obj->tag == LDKAPIError_IncompatibleShutdownScript);
1162         LDKShutdownScript script_var = obj->incompatible_shutdown_script.script;
1163                         int64_t script_ref = 0;
1164                         CHECK_INNER_FIELD_ACCESS_OR_NULL(script_var);
1165                         script_ref = tag_ptr(script_var.inner, false);
1166         return script_ref;
1167 }
1168 static inline void CResult_NoneAPIErrorZ_get_ok(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
1169 CHECK(owner->result_ok);
1170         return *owner->contents.result;
1171 }
1172 void  CS_LDK_CResult_NoneAPIErrorZ_get_ok(int64_t owner) {
1173         LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(owner);
1174         CResult_NoneAPIErrorZ_get_ok(owner_conv);
1175 }
1176
1177 static inline struct LDKAPIError CResult_NoneAPIErrorZ_get_err(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
1178 CHECK(!owner->result_ok);
1179         return APIError_clone(&*owner->contents.err);
1180 }
1181 int64_t  CS_LDK_CResult_NoneAPIErrorZ_get_err(int64_t owner) {
1182         LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(owner);
1183         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
1184         *ret_copy = CResult_NoneAPIErrorZ_get_err(owner_conv);
1185         int64_t ret_ref = tag_ptr(ret_copy, true);
1186         return ret_ref;
1187 }
1188
1189 static inline LDKCVec_CResult_NoneAPIErrorZZ CVec_CResult_NoneAPIErrorZZ_clone(const LDKCVec_CResult_NoneAPIErrorZZ *orig) {
1190         LDKCVec_CResult_NoneAPIErrorZZ ret = { .data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * orig->datalen, "LDKCVec_CResult_NoneAPIErrorZZ clone bytes"), .datalen = orig->datalen };
1191         for (size_t i = 0; i < ret.datalen; i++) {
1192                 ret.data[i] = CResult_NoneAPIErrorZ_clone(&orig->data[i]);
1193         }
1194         return ret;
1195 }
1196 static inline LDKCVec_APIErrorZ CVec_APIErrorZ_clone(const LDKCVec_APIErrorZ *orig) {
1197         LDKCVec_APIErrorZ ret = { .data = MALLOC(sizeof(LDKAPIError) * orig->datalen, "LDKCVec_APIErrorZ clone bytes"), .datalen = orig->datalen };
1198         for (size_t i = 0; i < ret.datalen; i++) {
1199                 ret.data[i] = APIError_clone(&orig->data[i]);
1200         }
1201         return ret;
1202 }
1203 uint32_t CS_LDK_LDKCOption_ThirtyTwoBytesZ_ty_from_ptr(int64_t ptr) {
1204         LDKCOption_ThirtyTwoBytesZ *obj = (LDKCOption_ThirtyTwoBytesZ*)untag_ptr(ptr);
1205         switch(obj->tag) {
1206                 case LDKCOption_ThirtyTwoBytesZ_Some: return 0;
1207                 case LDKCOption_ThirtyTwoBytesZ_None: return 1;
1208                 default: abort();
1209         }
1210 }
1211 int8_tArray CS_LDK_LDKCOption_ThirtyTwoBytesZ_Some_get_some(int64_t ptr) {
1212         LDKCOption_ThirtyTwoBytesZ *obj = (LDKCOption_ThirtyTwoBytesZ*)untag_ptr(ptr);
1213         CHECK(obj->tag == LDKCOption_ThirtyTwoBytesZ_Some);
1214         int8_tArray some_arr = init_int8_tArray(32, __LINE__);
1215         memcpy(some_arr->elems, obj->some.data, 32);
1216         return some_arr;
1217 }
1218 uint32_t CS_LDK_LDKCOption_CVec_u8ZZ_ty_from_ptr(int64_t ptr) {
1219         LDKCOption_CVec_u8ZZ *obj = (LDKCOption_CVec_u8ZZ*)untag_ptr(ptr);
1220         switch(obj->tag) {
1221                 case LDKCOption_CVec_u8ZZ_Some: return 0;
1222                 case LDKCOption_CVec_u8ZZ_None: return 1;
1223                 default: abort();
1224         }
1225 }
1226 int8_tArray CS_LDK_LDKCOption_CVec_u8ZZ_Some_get_some(int64_t ptr) {
1227         LDKCOption_CVec_u8ZZ *obj = (LDKCOption_CVec_u8ZZ*)untag_ptr(ptr);
1228         CHECK(obj->tag == LDKCOption_CVec_u8ZZ_Some);
1229         LDKCVec_u8Z some_var = obj->some;
1230                         int8_tArray some_arr = init_int8_tArray(some_var.datalen, __LINE__);
1231                         memcpy(some_arr->elems, some_var.data, some_var.datalen);
1232         return some_arr;
1233 }
1234 static inline struct LDKRecipientOnionFields CResult_RecipientOnionFieldsDecodeErrorZ_get_ok(LDKCResult_RecipientOnionFieldsDecodeErrorZ *NONNULL_PTR owner){
1235         LDKRecipientOnionFields ret = *owner->contents.result;
1236         ret.is_owned = false;
1237         return ret;
1238 }
1239 int64_t  CS_LDK_CResult_RecipientOnionFieldsDecodeErrorZ_get_ok(int64_t owner) {
1240         LDKCResult_RecipientOnionFieldsDecodeErrorZ* owner_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(owner);
1241         LDKRecipientOnionFields ret_var = CResult_RecipientOnionFieldsDecodeErrorZ_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_RecipientOnionFieldsDecodeErrorZ_get_err(LDKCResult_RecipientOnionFieldsDecodeErrorZ *NONNULL_PTR owner){
1249 CHECK(!owner->result_ok);
1250         return DecodeError_clone(&*owner->contents.err);
1251 }
1252 int64_t  CS_LDK_CResult_RecipientOnionFieldsDecodeErrorZ_get_err(int64_t owner) {
1253         LDKCResult_RecipientOnionFieldsDecodeErrorZ* owner_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(owner);
1254         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1255         *ret_copy = CResult_RecipientOnionFieldsDecodeErrorZ_get_err(owner_conv);
1256         int64_t ret_ref = tag_ptr(ret_copy, true);
1257         return ret_ref;
1258 }
1259
1260 static inline uint64_t C2Tuple_u64CVec_u8ZZ_get_a(LDKC2Tuple_u64CVec_u8ZZ *NONNULL_PTR owner){
1261         return owner->a;
1262 }
1263 int64_t  CS_LDK_C2Tuple_u64CVec_u8ZZ_get_a(int64_t owner) {
1264         LDKC2Tuple_u64CVec_u8ZZ* owner_conv = (LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(owner);
1265         int64_t ret_conv = C2Tuple_u64CVec_u8ZZ_get_a(owner_conv);
1266         return ret_conv;
1267 }
1268
1269 static inline struct LDKCVec_u8Z C2Tuple_u64CVec_u8ZZ_get_b(LDKC2Tuple_u64CVec_u8ZZ *NONNULL_PTR owner){
1270         return CVec_u8Z_clone(&owner->b);
1271 }
1272 int8_tArray  CS_LDK_C2Tuple_u64CVec_u8ZZ_get_b(int64_t owner) {
1273         LDKC2Tuple_u64CVec_u8ZZ* owner_conv = (LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(owner);
1274         LDKCVec_u8Z ret_var = C2Tuple_u64CVec_u8ZZ_get_b(owner_conv);
1275         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
1276         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
1277         CVec_u8Z_free(ret_var);
1278         return ret_arr;
1279 }
1280
1281 static inline LDKCVec_C2Tuple_u64CVec_u8ZZZ CVec_C2Tuple_u64CVec_u8ZZZ_clone(const LDKCVec_C2Tuple_u64CVec_u8ZZZ *orig) {
1282         LDKCVec_C2Tuple_u64CVec_u8ZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ) * orig->datalen, "LDKCVec_C2Tuple_u64CVec_u8ZZZ clone bytes"), .datalen = orig->datalen };
1283         for (size_t i = 0; i < ret.datalen; i++) {
1284                 ret.data[i] = C2Tuple_u64CVec_u8ZZ_clone(&orig->data[i]);
1285         }
1286         return ret;
1287 }
1288 static inline struct LDKRecipientOnionFields CResult_RecipientOnionFieldsNoneZ_get_ok(LDKCResult_RecipientOnionFieldsNoneZ *NONNULL_PTR owner){
1289         LDKRecipientOnionFields ret = *owner->contents.result;
1290         ret.is_owned = false;
1291         return ret;
1292 }
1293 int64_t  CS_LDK_CResult_RecipientOnionFieldsNoneZ_get_ok(int64_t owner) {
1294         LDKCResult_RecipientOnionFieldsNoneZ* owner_conv = (LDKCResult_RecipientOnionFieldsNoneZ*)untag_ptr(owner);
1295         LDKRecipientOnionFields ret_var = CResult_RecipientOnionFieldsNoneZ_get_ok(owner_conv);
1296         int64_t ret_ref = 0;
1297         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1298         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1299         return ret_ref;
1300 }
1301
1302 static inline void CResult_RecipientOnionFieldsNoneZ_get_err(LDKCResult_RecipientOnionFieldsNoneZ *NONNULL_PTR owner){
1303 CHECK(!owner->result_ok);
1304         return *owner->contents.err;
1305 }
1306 void  CS_LDK_CResult_RecipientOnionFieldsNoneZ_get_err(int64_t owner) {
1307         LDKCResult_RecipientOnionFieldsNoneZ* owner_conv = (LDKCResult_RecipientOnionFieldsNoneZ*)untag_ptr(owner);
1308         CResult_RecipientOnionFieldsNoneZ_get_err(owner_conv);
1309 }
1310
1311 static inline struct LDKUnsignedBolt12Invoice CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_get_ok(LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ *NONNULL_PTR owner){
1312         LDKUnsignedBolt12Invoice ret = *owner->contents.result;
1313         ret.is_owned = false;
1314         return ret;
1315 }
1316 int64_t  CS_LDK_CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_get_ok(int64_t owner) {
1317         LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ* owner_conv = (LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ*)untag_ptr(owner);
1318         LDKUnsignedBolt12Invoice ret_var = CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_get_ok(owner_conv);
1319         int64_t ret_ref = 0;
1320         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1321         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1322         return ret_ref;
1323 }
1324
1325 static inline enum LDKBolt12SemanticError CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_get_err(LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ *NONNULL_PTR owner){
1326 CHECK(!owner->result_ok);
1327         return Bolt12SemanticError_clone(&*owner->contents.err);
1328 }
1329 int32_t  CS_LDK_CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_get_err(int64_t owner) {
1330         LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ* owner_conv = (LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ*)untag_ptr(owner);
1331         int32_t ret_conv = LDKBolt12SemanticError_to_cs(CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_get_err(owner_conv));
1332         return ret_conv;
1333 }
1334
1335 static inline struct LDKBolt12Invoice CResult_Bolt12InvoiceBolt12SemanticErrorZ_get_ok(LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ *NONNULL_PTR owner){
1336         LDKBolt12Invoice ret = *owner->contents.result;
1337         ret.is_owned = false;
1338         return ret;
1339 }
1340 int64_t  CS_LDK_CResult_Bolt12InvoiceBolt12SemanticErrorZ_get_ok(int64_t owner) {
1341         LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ* owner_conv = (LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ*)untag_ptr(owner);
1342         LDKBolt12Invoice ret_var = CResult_Bolt12InvoiceBolt12SemanticErrorZ_get_ok(owner_conv);
1343         int64_t ret_ref = 0;
1344         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1345         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1346         return ret_ref;
1347 }
1348
1349 static inline enum LDKBolt12SemanticError CResult_Bolt12InvoiceBolt12SemanticErrorZ_get_err(LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ *NONNULL_PTR owner){
1350 CHECK(!owner->result_ok);
1351         return Bolt12SemanticError_clone(&*owner->contents.err);
1352 }
1353 int32_t  CS_LDK_CResult_Bolt12InvoiceBolt12SemanticErrorZ_get_err(int64_t owner) {
1354         LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ* owner_conv = (LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ*)untag_ptr(owner);
1355         int32_t ret_conv = LDKBolt12SemanticError_to_cs(CResult_Bolt12InvoiceBolt12SemanticErrorZ_get_err(owner_conv));
1356         return ret_conv;
1357 }
1358
1359 static inline struct LDKSchnorrSignature CResult_SchnorrSignatureNoneZ_get_ok(LDKCResult_SchnorrSignatureNoneZ *NONNULL_PTR owner){
1360 CHECK(owner->result_ok);
1361         return *owner->contents.result;
1362 }
1363 int8_tArray  CS_LDK_CResult_SchnorrSignatureNoneZ_get_ok(int64_t owner) {
1364         LDKCResult_SchnorrSignatureNoneZ* owner_conv = (LDKCResult_SchnorrSignatureNoneZ*)untag_ptr(owner);
1365         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
1366         memcpy(ret_arr->elems, CResult_SchnorrSignatureNoneZ_get_ok(owner_conv).compact_form, 64);
1367         return ret_arr;
1368 }
1369
1370 static inline void CResult_SchnorrSignatureNoneZ_get_err(LDKCResult_SchnorrSignatureNoneZ *NONNULL_PTR owner){
1371 CHECK(!owner->result_ok);
1372         return *owner->contents.err;
1373 }
1374 void  CS_LDK_CResult_SchnorrSignatureNoneZ_get_err(int64_t owner) {
1375         LDKCResult_SchnorrSignatureNoneZ* owner_conv = (LDKCResult_SchnorrSignatureNoneZ*)untag_ptr(owner);
1376         CResult_SchnorrSignatureNoneZ_get_err(owner_conv);
1377 }
1378
1379 static inline LDKCVec_ThirtyTwoBytesZ CVec_ThirtyTwoBytesZ_clone(const LDKCVec_ThirtyTwoBytesZ *orig) {
1380         LDKCVec_ThirtyTwoBytesZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_ThirtyTwoBytesZ clone bytes"), .datalen = orig->datalen };
1381         for (size_t i = 0; i < ret.datalen; i++) {
1382                 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
1383         }
1384         return ret;
1385 }
1386 uint32_t CS_LDK_LDKCOption_CVec_ThirtyTwoBytesZZ_ty_from_ptr(int64_t ptr) {
1387         LDKCOption_CVec_ThirtyTwoBytesZZ *obj = (LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(ptr);
1388         switch(obj->tag) {
1389                 case LDKCOption_CVec_ThirtyTwoBytesZZ_Some: return 0;
1390                 case LDKCOption_CVec_ThirtyTwoBytesZZ_None: return 1;
1391                 default: abort();
1392         }
1393 }
1394 ptrArray CS_LDK_LDKCOption_CVec_ThirtyTwoBytesZZ_Some_get_some(int64_t ptr) {
1395         LDKCOption_CVec_ThirtyTwoBytesZZ *obj = (LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(ptr);
1396         CHECK(obj->tag == LDKCOption_CVec_ThirtyTwoBytesZZ_Some);
1397         LDKCVec_ThirtyTwoBytesZ some_var = obj->some;
1398                         ptrArray some_arr = NULL;
1399                         some_arr = init_ptrArray(some_var.datalen, __LINE__);
1400                         int8_tArray *some_arr_ptr = (int8_tArray*)(((uint8_t*)some_arr) + 8);
1401                         for (size_t i = 0; i < some_var.datalen; i++) {
1402                                 int8_tArray some_conv_8_arr = init_int8_tArray(32, __LINE__);
1403                                 memcpy(some_conv_8_arr->elems, some_var.data[i].data, 32);
1404                                 some_arr_ptr[i] = some_conv_8_arr;
1405                         }
1406                         
1407         return some_arr;
1408 }
1409 uint32_t CS_LDK_LDKAmount_ty_from_ptr(int64_t ptr) {
1410         LDKAmount *obj = (LDKAmount*)untag_ptr(ptr);
1411         switch(obj->tag) {
1412                 case LDKAmount_Bitcoin: return 0;
1413                 case LDKAmount_Currency: return 1;
1414                 default: abort();
1415         }
1416 }
1417 int64_t CS_LDK_LDKAmount_Bitcoin_get_amount_msats(int64_t ptr) {
1418         LDKAmount *obj = (LDKAmount*)untag_ptr(ptr);
1419         CHECK(obj->tag == LDKAmount_Bitcoin);
1420         int64_t amount_msats_conv = obj->bitcoin.amount_msats;
1421         return amount_msats_conv;
1422 }
1423 int8_tArray CS_LDK_LDKAmount_Currency_get_iso4217_code(int64_t ptr) {
1424         LDKAmount *obj = (LDKAmount*)untag_ptr(ptr);
1425         CHECK(obj->tag == LDKAmount_Currency);
1426         int8_tArray iso4217_code_arr = init_int8_tArray(3, __LINE__);
1427         memcpy(iso4217_code_arr->elems, obj->currency.iso4217_code.data, 3);
1428         return iso4217_code_arr;
1429 }
1430 int64_t CS_LDK_LDKAmount_Currency_get_amount(int64_t ptr) {
1431         LDKAmount *obj = (LDKAmount*)untag_ptr(ptr);
1432         CHECK(obj->tag == LDKAmount_Currency);
1433         int64_t amount_conv = obj->currency.amount;
1434         return amount_conv;
1435 }
1436 uint32_t CS_LDK_LDKCOption_AmountZ_ty_from_ptr(int64_t ptr) {
1437         LDKCOption_AmountZ *obj = (LDKCOption_AmountZ*)untag_ptr(ptr);
1438         switch(obj->tag) {
1439                 case LDKCOption_AmountZ_Some: return 0;
1440                 case LDKCOption_AmountZ_None: return 1;
1441                 default: abort();
1442         }
1443 }
1444 int64_t CS_LDK_LDKCOption_AmountZ_Some_get_some(int64_t ptr) {
1445         LDKCOption_AmountZ *obj = (LDKCOption_AmountZ*)untag_ptr(ptr);
1446         CHECK(obj->tag == LDKCOption_AmountZ_Some);
1447         int64_t some_ref = tag_ptr(&obj->some, false);
1448         return some_ref;
1449 }
1450 uint32_t CS_LDK_LDKQuantity_ty_from_ptr(int64_t ptr) {
1451         LDKQuantity *obj = (LDKQuantity*)untag_ptr(ptr);
1452         switch(obj->tag) {
1453                 case LDKQuantity_Bounded: return 0;
1454                 case LDKQuantity_Unbounded: return 1;
1455                 case LDKQuantity_One: return 2;
1456                 default: abort();
1457         }
1458 }
1459 int64_t CS_LDK_LDKQuantity_Bounded_get_bounded(int64_t ptr) {
1460         LDKQuantity *obj = (LDKQuantity*)untag_ptr(ptr);
1461         CHECK(obj->tag == LDKQuantity_Bounded);
1462         int64_t bounded_conv = obj->bounded;
1463         return bounded_conv;
1464 }
1465 uint32_t CS_LDK_LDKCOption_QuantityZ_ty_from_ptr(int64_t ptr) {
1466         LDKCOption_QuantityZ *obj = (LDKCOption_QuantityZ*)untag_ptr(ptr);
1467         switch(obj->tag) {
1468                 case LDKCOption_QuantityZ_Some: return 0;
1469                 case LDKCOption_QuantityZ_None: return 1;
1470                 default: abort();
1471         }
1472 }
1473 int64_t CS_LDK_LDKCOption_QuantityZ_Some_get_some(int64_t ptr) {
1474         LDKCOption_QuantityZ *obj = (LDKCOption_QuantityZ*)untag_ptr(ptr);
1475         CHECK(obj->tag == LDKCOption_QuantityZ_Some);
1476         int64_t some_ref = tag_ptr(&obj->some, false);
1477         return some_ref;
1478 }
1479 static inline struct LDKThirtyTwoBytes CResult_ThirtyTwoBytesNoneZ_get_ok(LDKCResult_ThirtyTwoBytesNoneZ *NONNULL_PTR owner){
1480 CHECK(owner->result_ok);
1481         return ThirtyTwoBytes_clone(&*owner->contents.result);
1482 }
1483 int8_tArray  CS_LDK_CResult_ThirtyTwoBytesNoneZ_get_ok(int64_t owner) {
1484         LDKCResult_ThirtyTwoBytesNoneZ* owner_conv = (LDKCResult_ThirtyTwoBytesNoneZ*)untag_ptr(owner);
1485         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
1486         memcpy(ret_arr->elems, CResult_ThirtyTwoBytesNoneZ_get_ok(owner_conv).data, 32);
1487         return ret_arr;
1488 }
1489
1490 static inline void CResult_ThirtyTwoBytesNoneZ_get_err(LDKCResult_ThirtyTwoBytesNoneZ *NONNULL_PTR owner){
1491 CHECK(!owner->result_ok);
1492         return *owner->contents.err;
1493 }
1494 void  CS_LDK_CResult_ThirtyTwoBytesNoneZ_get_err(int64_t owner) {
1495         LDKCResult_ThirtyTwoBytesNoneZ* owner_conv = (LDKCResult_ThirtyTwoBytesNoneZ*)untag_ptr(owner);
1496         CResult_ThirtyTwoBytesNoneZ_get_err(owner_conv);
1497 }
1498
1499 static inline struct LDKBlindedPayInfo CResult_BlindedPayInfoDecodeErrorZ_get_ok(LDKCResult_BlindedPayInfoDecodeErrorZ *NONNULL_PTR owner){
1500         LDKBlindedPayInfo ret = *owner->contents.result;
1501         ret.is_owned = false;
1502         return ret;
1503 }
1504 int64_t  CS_LDK_CResult_BlindedPayInfoDecodeErrorZ_get_ok(int64_t owner) {
1505         LDKCResult_BlindedPayInfoDecodeErrorZ* owner_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(owner);
1506         LDKBlindedPayInfo ret_var = CResult_BlindedPayInfoDecodeErrorZ_get_ok(owner_conv);
1507         int64_t ret_ref = 0;
1508         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1509         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1510         return ret_ref;
1511 }
1512
1513 static inline struct LDKDecodeError CResult_BlindedPayInfoDecodeErrorZ_get_err(LDKCResult_BlindedPayInfoDecodeErrorZ *NONNULL_PTR owner){
1514 CHECK(!owner->result_ok);
1515         return DecodeError_clone(&*owner->contents.err);
1516 }
1517 int64_t  CS_LDK_CResult_BlindedPayInfoDecodeErrorZ_get_err(int64_t owner) {
1518         LDKCResult_BlindedPayInfoDecodeErrorZ* owner_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(owner);
1519         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1520         *ret_copy = CResult_BlindedPayInfoDecodeErrorZ_get_err(owner_conv);
1521         int64_t ret_ref = tag_ptr(ret_copy, true);
1522         return ret_ref;
1523 }
1524
1525 static inline struct LDKDelayedPaymentOutputDescriptor CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
1526         LDKDelayedPaymentOutputDescriptor ret = *owner->contents.result;
1527         ret.is_owned = false;
1528         return ret;
1529 }
1530 int64_t  CS_LDK_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(int64_t owner) {
1531         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
1532         LDKDelayedPaymentOutputDescriptor ret_var = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
1533         int64_t ret_ref = 0;
1534         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1535         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1536         return ret_ref;
1537 }
1538
1539 static inline struct LDKDecodeError CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
1540 CHECK(!owner->result_ok);
1541         return DecodeError_clone(&*owner->contents.err);
1542 }
1543 int64_t  CS_LDK_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(int64_t owner) {
1544         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
1545         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1546         *ret_copy = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
1547         int64_t ret_ref = tag_ptr(ret_copy, true);
1548         return ret_ref;
1549 }
1550
1551 static inline struct LDKStaticPaymentOutputDescriptor CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
1552         LDKStaticPaymentOutputDescriptor ret = *owner->contents.result;
1553         ret.is_owned = false;
1554         return ret;
1555 }
1556 int64_t  CS_LDK_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(int64_t owner) {
1557         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
1558         LDKStaticPaymentOutputDescriptor ret_var = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
1559         int64_t ret_ref = 0;
1560         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1561         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1562         return ret_ref;
1563 }
1564
1565 static inline struct LDKDecodeError CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
1566 CHECK(!owner->result_ok);
1567         return DecodeError_clone(&*owner->contents.err);
1568 }
1569 int64_t  CS_LDK_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(int64_t owner) {
1570         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
1571         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1572         *ret_copy = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
1573         int64_t ret_ref = tag_ptr(ret_copy, true);
1574         return ret_ref;
1575 }
1576
1577 uint32_t CS_LDK_LDKSpendableOutputDescriptor_ty_from_ptr(int64_t ptr) {
1578         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1579         switch(obj->tag) {
1580                 case LDKSpendableOutputDescriptor_StaticOutput: return 0;
1581                 case LDKSpendableOutputDescriptor_DelayedPaymentOutput: return 1;
1582                 case LDKSpendableOutputDescriptor_StaticPaymentOutput: return 2;
1583                 default: abort();
1584         }
1585 }
1586 int64_t CS_LDK_LDKSpendableOutputDescriptor_StaticOutput_get_outpoint(int64_t ptr) {
1587         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1588         CHECK(obj->tag == LDKSpendableOutputDescriptor_StaticOutput);
1589         LDKOutPoint outpoint_var = obj->static_output.outpoint;
1590                         int64_t outpoint_ref = 0;
1591                         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_var);
1592                         outpoint_ref = tag_ptr(outpoint_var.inner, false);
1593         return outpoint_ref;
1594 }
1595 int64_t CS_LDK_LDKSpendableOutputDescriptor_StaticOutput_get_output(int64_t ptr) {
1596         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1597         CHECK(obj->tag == LDKSpendableOutputDescriptor_StaticOutput);
1598         LDKTxOut* output_ref = &obj->static_output.output;
1599         return tag_ptr(output_ref, false);
1600 }
1601 int8_tArray CS_LDK_LDKSpendableOutputDescriptor_StaticOutput_get_channel_keys_id(int64_t ptr) {
1602         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1603         CHECK(obj->tag == LDKSpendableOutputDescriptor_StaticOutput);
1604         int8_tArray channel_keys_id_arr = init_int8_tArray(32, __LINE__);
1605         memcpy(channel_keys_id_arr->elems, obj->static_output.channel_keys_id.data, 32);
1606         return channel_keys_id_arr;
1607 }
1608 int64_t CS_LDK_LDKSpendableOutputDescriptor_DelayedPaymentOutput_get_delayed_payment_output(int64_t ptr) {
1609         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1610         CHECK(obj->tag == LDKSpendableOutputDescriptor_DelayedPaymentOutput);
1611         LDKDelayedPaymentOutputDescriptor delayed_payment_output_var = obj->delayed_payment_output;
1612                         int64_t delayed_payment_output_ref = 0;
1613                         CHECK_INNER_FIELD_ACCESS_OR_NULL(delayed_payment_output_var);
1614                         delayed_payment_output_ref = tag_ptr(delayed_payment_output_var.inner, false);
1615         return delayed_payment_output_ref;
1616 }
1617 int64_t CS_LDK_LDKSpendableOutputDescriptor_StaticPaymentOutput_get_static_payment_output(int64_t ptr) {
1618         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1619         CHECK(obj->tag == LDKSpendableOutputDescriptor_StaticPaymentOutput);
1620         LDKStaticPaymentOutputDescriptor static_payment_output_var = obj->static_payment_output;
1621                         int64_t static_payment_output_ref = 0;
1622                         CHECK_INNER_FIELD_ACCESS_OR_NULL(static_payment_output_var);
1623                         static_payment_output_ref = tag_ptr(static_payment_output_var.inner, false);
1624         return static_payment_output_ref;
1625 }
1626 static inline struct LDKSpendableOutputDescriptor CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
1627 CHECK(owner->result_ok);
1628         return SpendableOutputDescriptor_clone(&*owner->contents.result);
1629 }
1630 int64_t  CS_LDK_CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(int64_t owner) {
1631         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
1632         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
1633         *ret_copy = CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
1634         int64_t ret_ref = tag_ptr(ret_copy, true);
1635         return ret_ref;
1636 }
1637
1638 static inline struct LDKDecodeError CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
1639 CHECK(!owner->result_ok);
1640         return DecodeError_clone(&*owner->contents.err);
1641 }
1642 int64_t  CS_LDK_CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(int64_t owner) {
1643         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
1644         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1645         *ret_copy = CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(owner_conv);
1646         int64_t ret_ref = tag_ptr(ret_copy, true);
1647         return ret_ref;
1648 }
1649
1650 static inline LDKCVec_SpendableOutputDescriptorZ CVec_SpendableOutputDescriptorZ_clone(const LDKCVec_SpendableOutputDescriptorZ *orig) {
1651         LDKCVec_SpendableOutputDescriptorZ ret = { .data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * orig->datalen, "LDKCVec_SpendableOutputDescriptorZ clone bytes"), .datalen = orig->datalen };
1652         for (size_t i = 0; i < ret.datalen; i++) {
1653                 ret.data[i] = SpendableOutputDescriptor_clone(&orig->data[i]);
1654         }
1655         return ret;
1656 }
1657 static inline LDKCVec_TxOutZ CVec_TxOutZ_clone(const LDKCVec_TxOutZ *orig) {
1658         LDKCVec_TxOutZ ret = { .data = MALLOC(sizeof(LDKTxOut) * orig->datalen, "LDKCVec_TxOutZ clone bytes"), .datalen = orig->datalen };
1659         for (size_t i = 0; i < ret.datalen; i++) {
1660                 ret.data[i] = TxOut_clone(&orig->data[i]);
1661         }
1662         return ret;
1663 }
1664 uint32_t CS_LDK_LDKCOption_u32Z_ty_from_ptr(int64_t ptr) {
1665         LDKCOption_u32Z *obj = (LDKCOption_u32Z*)untag_ptr(ptr);
1666         switch(obj->tag) {
1667                 case LDKCOption_u32Z_Some: return 0;
1668                 case LDKCOption_u32Z_None: return 1;
1669                 default: abort();
1670         }
1671 }
1672 int32_t CS_LDK_LDKCOption_u32Z_Some_get_some(int64_t ptr) {
1673         LDKCOption_u32Z *obj = (LDKCOption_u32Z*)untag_ptr(ptr);
1674         CHECK(obj->tag == LDKCOption_u32Z_Some);
1675         int32_t some_conv = obj->some;
1676         return some_conv;
1677 }
1678 static inline struct LDKCVec_u8Z C2Tuple_CVec_u8Zu64Z_get_a(LDKC2Tuple_CVec_u8Zu64Z *NONNULL_PTR owner){
1679         return CVec_u8Z_clone(&owner->a);
1680 }
1681 int8_tArray  CS_LDK_C2Tuple_CVec_u8Zu64Z_get_a(int64_t owner) {
1682         LDKC2Tuple_CVec_u8Zu64Z* owner_conv = (LDKC2Tuple_CVec_u8Zu64Z*)untag_ptr(owner);
1683         LDKCVec_u8Z ret_var = C2Tuple_CVec_u8Zu64Z_get_a(owner_conv);
1684         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
1685         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
1686         CVec_u8Z_free(ret_var);
1687         return ret_arr;
1688 }
1689
1690 static inline uint64_t C2Tuple_CVec_u8Zu64Z_get_b(LDKC2Tuple_CVec_u8Zu64Z *NONNULL_PTR owner){
1691         return owner->b;
1692 }
1693 int64_t  CS_LDK_C2Tuple_CVec_u8Zu64Z_get_b(int64_t owner) {
1694         LDKC2Tuple_CVec_u8Zu64Z* owner_conv = (LDKC2Tuple_CVec_u8Zu64Z*)untag_ptr(owner);
1695         int64_t ret_conv = C2Tuple_CVec_u8Zu64Z_get_b(owner_conv);
1696         return ret_conv;
1697 }
1698
1699 static inline struct LDKC2Tuple_CVec_u8Zu64Z CResult_C2Tuple_CVec_u8Zu64ZNoneZ_get_ok(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ *NONNULL_PTR owner){
1700 CHECK(owner->result_ok);
1701         return C2Tuple_CVec_u8Zu64Z_clone(&*owner->contents.result);
1702 }
1703 int64_t  CS_LDK_CResult_C2Tuple_CVec_u8Zu64ZNoneZ_get_ok(int64_t owner) {
1704         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* owner_conv = (LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ*)untag_ptr(owner);
1705         LDKC2Tuple_CVec_u8Zu64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_CVec_u8Zu64Z), "LDKC2Tuple_CVec_u8Zu64Z");
1706         *ret_conv = CResult_C2Tuple_CVec_u8Zu64ZNoneZ_get_ok(owner_conv);
1707         return tag_ptr(ret_conv, true);
1708 }
1709
1710 static inline void CResult_C2Tuple_CVec_u8Zu64ZNoneZ_get_err(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ *NONNULL_PTR owner){
1711 CHECK(!owner->result_ok);
1712         return *owner->contents.err;
1713 }
1714 void  CS_LDK_CResult_C2Tuple_CVec_u8Zu64ZNoneZ_get_err(int64_t owner) {
1715         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* owner_conv = (LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ*)untag_ptr(owner);
1716         CResult_C2Tuple_CVec_u8Zu64ZNoneZ_get_err(owner_conv);
1717 }
1718
1719 static inline struct LDKChannelDerivationParameters CResult_ChannelDerivationParametersDecodeErrorZ_get_ok(LDKCResult_ChannelDerivationParametersDecodeErrorZ *NONNULL_PTR owner){
1720         LDKChannelDerivationParameters ret = *owner->contents.result;
1721         ret.is_owned = false;
1722         return ret;
1723 }
1724 int64_t  CS_LDK_CResult_ChannelDerivationParametersDecodeErrorZ_get_ok(int64_t owner) {
1725         LDKCResult_ChannelDerivationParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(owner);
1726         LDKChannelDerivationParameters ret_var = CResult_ChannelDerivationParametersDecodeErrorZ_get_ok(owner_conv);
1727         int64_t ret_ref = 0;
1728         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1729         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1730         return ret_ref;
1731 }
1732
1733 static inline struct LDKDecodeError CResult_ChannelDerivationParametersDecodeErrorZ_get_err(LDKCResult_ChannelDerivationParametersDecodeErrorZ *NONNULL_PTR owner){
1734 CHECK(!owner->result_ok);
1735         return DecodeError_clone(&*owner->contents.err);
1736 }
1737 int64_t  CS_LDK_CResult_ChannelDerivationParametersDecodeErrorZ_get_err(int64_t owner) {
1738         LDKCResult_ChannelDerivationParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(owner);
1739         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1740         *ret_copy = CResult_ChannelDerivationParametersDecodeErrorZ_get_err(owner_conv);
1741         int64_t ret_ref = tag_ptr(ret_copy, true);
1742         return ret_ref;
1743 }
1744
1745 static inline struct LDKHTLCDescriptor CResult_HTLCDescriptorDecodeErrorZ_get_ok(LDKCResult_HTLCDescriptorDecodeErrorZ *NONNULL_PTR owner){
1746         LDKHTLCDescriptor ret = *owner->contents.result;
1747         ret.is_owned = false;
1748         return ret;
1749 }
1750 int64_t  CS_LDK_CResult_HTLCDescriptorDecodeErrorZ_get_ok(int64_t owner) {
1751         LDKCResult_HTLCDescriptorDecodeErrorZ* owner_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(owner);
1752         LDKHTLCDescriptor ret_var = CResult_HTLCDescriptorDecodeErrorZ_get_ok(owner_conv);
1753         int64_t ret_ref = 0;
1754         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1755         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1756         return ret_ref;
1757 }
1758
1759 static inline struct LDKDecodeError CResult_HTLCDescriptorDecodeErrorZ_get_err(LDKCResult_HTLCDescriptorDecodeErrorZ *NONNULL_PTR owner){
1760 CHECK(!owner->result_ok);
1761         return DecodeError_clone(&*owner->contents.err);
1762 }
1763 int64_t  CS_LDK_CResult_HTLCDescriptorDecodeErrorZ_get_err(int64_t owner) {
1764         LDKCResult_HTLCDescriptorDecodeErrorZ* owner_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(owner);
1765         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1766         *ret_copy = CResult_HTLCDescriptorDecodeErrorZ_get_err(owner_conv);
1767         int64_t ret_ref = tag_ptr(ret_copy, true);
1768         return ret_ref;
1769 }
1770
1771 static inline void CResult_NoneNoneZ_get_ok(LDKCResult_NoneNoneZ *NONNULL_PTR owner){
1772 CHECK(owner->result_ok);
1773         return *owner->contents.result;
1774 }
1775 void  CS_LDK_CResult_NoneNoneZ_get_ok(int64_t owner) {
1776         LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)untag_ptr(owner);
1777         CResult_NoneNoneZ_get_ok(owner_conv);
1778 }
1779
1780 static inline void CResult_NoneNoneZ_get_err(LDKCResult_NoneNoneZ *NONNULL_PTR owner){
1781 CHECK(!owner->result_ok);
1782         return *owner->contents.err;
1783 }
1784 void  CS_LDK_CResult_NoneNoneZ_get_err(int64_t owner) {
1785         LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)untag_ptr(owner);
1786         CResult_NoneNoneZ_get_err(owner_conv);
1787 }
1788
1789 static inline struct LDKPublicKey CResult_PublicKeyNoneZ_get_ok(LDKCResult_PublicKeyNoneZ *NONNULL_PTR owner){
1790 CHECK(owner->result_ok);
1791         return *owner->contents.result;
1792 }
1793 int8_tArray  CS_LDK_CResult_PublicKeyNoneZ_get_ok(int64_t owner) {
1794         LDKCResult_PublicKeyNoneZ* owner_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(owner);
1795         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
1796         memcpy(ret_arr->elems, CResult_PublicKeyNoneZ_get_ok(owner_conv).compressed_form, 33);
1797         return ret_arr;
1798 }
1799
1800 static inline void CResult_PublicKeyNoneZ_get_err(LDKCResult_PublicKeyNoneZ *NONNULL_PTR owner){
1801 CHECK(!owner->result_ok);
1802         return *owner->contents.err;
1803 }
1804 void  CS_LDK_CResult_PublicKeyNoneZ_get_err(int64_t owner) {
1805         LDKCResult_PublicKeyNoneZ* owner_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(owner);
1806         CResult_PublicKeyNoneZ_get_err(owner_conv);
1807 }
1808
1809 uint32_t CS_LDK_LDKCOption_BigEndianScalarZ_ty_from_ptr(int64_t ptr) {
1810         LDKCOption_BigEndianScalarZ *obj = (LDKCOption_BigEndianScalarZ*)untag_ptr(ptr);
1811         switch(obj->tag) {
1812                 case LDKCOption_BigEndianScalarZ_Some: return 0;
1813                 case LDKCOption_BigEndianScalarZ_None: return 1;
1814                 default: abort();
1815         }
1816 }
1817 int64_t CS_LDK_LDKCOption_BigEndianScalarZ_Some_get_some(int64_t ptr) {
1818         LDKCOption_BigEndianScalarZ *obj = (LDKCOption_BigEndianScalarZ*)untag_ptr(ptr);
1819         CHECK(obj->tag == LDKCOption_BigEndianScalarZ_Some);
1820         LDKBigEndianScalar* some_ref = &obj->some;
1821         return tag_ptr(some_ref, false);
1822 }
1823 static inline struct LDKRecoverableSignature CResult_RecoverableSignatureNoneZ_get_ok(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
1824 CHECK(owner->result_ok);
1825         return *owner->contents.result;
1826 }
1827 int8_tArray  CS_LDK_CResult_RecoverableSignatureNoneZ_get_ok(int64_t owner) {
1828         LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(owner);
1829         int8_tArray ret_arr = init_int8_tArray(68, __LINE__);
1830         memcpy(ret_arr->elems, CResult_RecoverableSignatureNoneZ_get_ok(owner_conv).serialized_form, 68);
1831         return ret_arr;
1832 }
1833
1834 static inline void CResult_RecoverableSignatureNoneZ_get_err(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
1835 CHECK(!owner->result_ok);
1836         return *owner->contents.err;
1837 }
1838 void  CS_LDK_CResult_RecoverableSignatureNoneZ_get_err(int64_t owner) {
1839         LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(owner);
1840         CResult_RecoverableSignatureNoneZ_get_err(owner_conv);
1841 }
1842
1843 static inline struct LDKECDSASignature CResult_ECDSASignatureNoneZ_get_ok(LDKCResult_ECDSASignatureNoneZ *NONNULL_PTR owner){
1844 CHECK(owner->result_ok);
1845         return *owner->contents.result;
1846 }
1847 int8_tArray  CS_LDK_CResult_ECDSASignatureNoneZ_get_ok(int64_t owner) {
1848         LDKCResult_ECDSASignatureNoneZ* owner_conv = (LDKCResult_ECDSASignatureNoneZ*)untag_ptr(owner);
1849         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
1850         memcpy(ret_arr->elems, CResult_ECDSASignatureNoneZ_get_ok(owner_conv).compact_form, 64);
1851         return ret_arr;
1852 }
1853
1854 static inline void CResult_ECDSASignatureNoneZ_get_err(LDKCResult_ECDSASignatureNoneZ *NONNULL_PTR owner){
1855 CHECK(!owner->result_ok);
1856         return *owner->contents.err;
1857 }
1858 void  CS_LDK_CResult_ECDSASignatureNoneZ_get_err(int64_t owner) {
1859         LDKCResult_ECDSASignatureNoneZ* owner_conv = (LDKCResult_ECDSASignatureNoneZ*)untag_ptr(owner);
1860         CResult_ECDSASignatureNoneZ_get_err(owner_conv);
1861 }
1862
1863 static inline struct LDKTransaction CResult_TransactionNoneZ_get_ok(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
1864 CHECK(owner->result_ok);
1865         return *owner->contents.result;
1866 }
1867 int8_tArray  CS_LDK_CResult_TransactionNoneZ_get_ok(int64_t owner) {
1868         LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(owner);
1869         LDKTransaction ret_var = CResult_TransactionNoneZ_get_ok(owner_conv);
1870         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
1871         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
1872         return ret_arr;
1873 }
1874
1875 static inline void CResult_TransactionNoneZ_get_err(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
1876 CHECK(!owner->result_ok);
1877         return *owner->contents.err;
1878 }
1879 void  CS_LDK_CResult_TransactionNoneZ_get_err(int64_t owner) {
1880         LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(owner);
1881         CResult_TransactionNoneZ_get_err(owner_conv);
1882 }
1883
1884 static inline struct LDKECDSASignature C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_a(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ *NONNULL_PTR owner){
1885         return owner->a;
1886 }
1887 int8_tArray  CS_LDK_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_a(int64_t owner) {
1888         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* owner_conv = (LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)untag_ptr(owner);
1889         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
1890         memcpy(ret_arr->elems, C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_a(owner_conv).compact_form, 64);
1891         return ret_arr;
1892 }
1893
1894 static inline struct LDKCVec_ECDSASignatureZ C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_b(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ *NONNULL_PTR owner){
1895         return owner->b;
1896 }
1897 ptrArray  CS_LDK_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_b(int64_t owner) {
1898         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* owner_conv = (LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)untag_ptr(owner);
1899         LDKCVec_ECDSASignatureZ ret_var = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_b(owner_conv);
1900         ptrArray ret_arr = NULL;
1901         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
1902         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
1903         for (size_t i = 0; i < ret_var.datalen; i++) {
1904                 int8_tArray ret_conv_8_arr = init_int8_tArray(64, __LINE__);
1905                 memcpy(ret_conv_8_arr->elems, ret_var.data[i].compact_form, 64);
1906                 ret_arr_ptr[i] = ret_conv_8_arr;
1907         }
1908         
1909         return ret_arr;
1910 }
1911
1912 static inline struct LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_ok(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ *NONNULL_PTR owner){
1913 CHECK(owner->result_ok);
1914         return C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone(&*owner->contents.result);
1915 }
1916 int64_t  CS_LDK_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_ok(int64_t owner) {
1917         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)untag_ptr(owner);
1918         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ), "LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ");
1919         *ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_ok(owner_conv);
1920         return tag_ptr(ret_conv, true);
1921 }
1922
1923 static inline void CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_err(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ *NONNULL_PTR owner){
1924 CHECK(!owner->result_ok);
1925         return *owner->contents.err;
1926 }
1927 void  CS_LDK_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_err(int64_t owner) {
1928         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)untag_ptr(owner);
1929         CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_err(owner_conv);
1930 }
1931
1932 typedef struct LDKChannelSigner_JCalls {
1933         atomic_size_t refcnt;
1934         uint32_t instance_ptr;
1935 } LDKChannelSigner_JCalls;
1936 static void LDKChannelSigner_JCalls_free(void* this_arg) {
1937         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
1938         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1939                 FREE(j_calls);
1940         }
1941 }
1942 LDKPublicKey get_per_commitment_point_LDKChannelSigner_jcall(const void* this_arg, uint64_t idx) {
1943         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
1944         int64_t idx_conv = idx;
1945         int8_tArray ret = (int8_tArray)js_invoke_function_l_l(j_calls->instance_ptr, 0, idx_conv);
1946         LDKPublicKey ret_ref;
1947         CHECK(ret->arr_len == 33);
1948         memcpy(ret_ref.compressed_form, ret->elems, 33); FREE(ret);
1949         return ret_ref;
1950 }
1951 LDKThirtyTwoBytes release_commitment_secret_LDKChannelSigner_jcall(const void* this_arg, uint64_t idx) {
1952         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
1953         int64_t idx_conv = idx;
1954         int8_tArray ret = (int8_tArray)js_invoke_function_l_l(j_calls->instance_ptr, 1, idx_conv);
1955         LDKThirtyTwoBytes ret_ref;
1956         CHECK(ret->arr_len == 32);
1957         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
1958         return ret_ref;
1959 }
1960 LDKCResult_NoneNoneZ validate_holder_commitment_LDKChannelSigner_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * holder_tx, LDKCVec_ThirtyTwoBytesZ outbound_htlc_preimages) {
1961         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
1962         LDKHolderCommitmentTransaction holder_tx_var = *holder_tx;
1963         int64_t holder_tx_ref = 0;
1964         holder_tx_var = HolderCommitmentTransaction_clone(&holder_tx_var);
1965         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_var);
1966         holder_tx_ref = tag_ptr(holder_tx_var.inner, holder_tx_var.is_owned);
1967         LDKCVec_ThirtyTwoBytesZ outbound_htlc_preimages_var = outbound_htlc_preimages;
1968         ptrArray outbound_htlc_preimages_arr = NULL;
1969         outbound_htlc_preimages_arr = init_ptrArray(outbound_htlc_preimages_var.datalen, __LINE__);
1970         int8_tArray *outbound_htlc_preimages_arr_ptr = (int8_tArray*)(((uint8_t*)outbound_htlc_preimages_arr) + 8);
1971         for (size_t i = 0; i < outbound_htlc_preimages_var.datalen; i++) {
1972                 int8_tArray outbound_htlc_preimages_conv_8_arr = init_int8_tArray(32, __LINE__);
1973                 memcpy(outbound_htlc_preimages_conv_8_arr->elems, outbound_htlc_preimages_var.data[i].data, 32);
1974                 outbound_htlc_preimages_arr_ptr[i] = outbound_htlc_preimages_conv_8_arr;
1975         }
1976         
1977         FREE(outbound_htlc_preimages_var.data);
1978         uint64_t ret = js_invoke_function_l_ll(j_calls->instance_ptr, 2, holder_tx_ref, (int64_t)outbound_htlc_preimages_arr);
1979         void* ret_ptr = untag_ptr(ret);
1980         CHECK_ACCESS(ret_ptr);
1981         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
1982         FREE(untag_ptr(ret));
1983         return ret_conv;
1984 }
1985 LDKCResult_NoneNoneZ validate_counterparty_revocation_LDKChannelSigner_jcall(const void* this_arg, uint64_t idx, const uint8_t (* secret)[32]) {
1986         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
1987         int64_t idx_conv = idx;
1988         int8_tArray secret_arr = init_int8_tArray(32, __LINE__);
1989         memcpy(secret_arr->elems, *secret, 32);
1990         uint64_t ret = js_invoke_function_l_ll(j_calls->instance_ptr, 3, idx_conv, (int64_t)secret_arr);
1991         void* ret_ptr = untag_ptr(ret);
1992         CHECK_ACCESS(ret_ptr);
1993         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
1994         FREE(untag_ptr(ret));
1995         return ret_conv;
1996 }
1997 LDKThirtyTwoBytes channel_keys_id_LDKChannelSigner_jcall(const void* this_arg) {
1998         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
1999         int8_tArray ret = (int8_tArray)js_invoke_function_l_(j_calls->instance_ptr, 4);
2000         LDKThirtyTwoBytes ret_ref;
2001         CHECK(ret->arr_len == 32);
2002         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
2003         return ret_ref;
2004 }
2005 void provide_channel_parameters_LDKChannelSigner_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) {
2006         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
2007         LDKChannelTransactionParameters channel_parameters_var = *channel_parameters;
2008         int64_t channel_parameters_ref = 0;
2009         channel_parameters_var = ChannelTransactionParameters_clone(&channel_parameters_var);
2010         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_var);
2011         channel_parameters_ref = tag_ptr(channel_parameters_var.inner, channel_parameters_var.is_owned);
2012         js_invoke_function_void_l(j_calls->instance_ptr, 5, channel_parameters_ref);
2013 }
2014 static void LDKChannelSigner_JCalls_cloned(LDKChannelSigner* new_obj) {
2015         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) new_obj->this_arg;
2016         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2017 }
2018 static inline LDKChannelSigner LDKChannelSigner_init (int64_t o, int64_t pubkeys) {
2019         LDKChannelSigner_JCalls *calls = MALLOC(sizeof(LDKChannelSigner_JCalls), "LDKChannelSigner_JCalls");
2020         atomic_init(&calls->refcnt, 1);
2021         calls->instance_ptr = o;
2022
2023         LDKChannelPublicKeys pubkeys_conv;
2024         pubkeys_conv.inner = untag_ptr(pubkeys);
2025         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
2026         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
2027
2028         LDKChannelSigner ret = {
2029                 .this_arg = (void*) calls,
2030                 .get_per_commitment_point = get_per_commitment_point_LDKChannelSigner_jcall,
2031                 .release_commitment_secret = release_commitment_secret_LDKChannelSigner_jcall,
2032                 .validate_holder_commitment = validate_holder_commitment_LDKChannelSigner_jcall,
2033                 .validate_counterparty_revocation = validate_counterparty_revocation_LDKChannelSigner_jcall,
2034                 .channel_keys_id = channel_keys_id_LDKChannelSigner_jcall,
2035                 .provide_channel_parameters = provide_channel_parameters_LDKChannelSigner_jcall,
2036                 .free = LDKChannelSigner_JCalls_free,
2037                 .pubkeys = pubkeys_conv,
2038                 .set_pubkeys = NULL,
2039         };
2040         return ret;
2041 }
2042 uint64_t  CS_LDK_LDKChannelSigner_new(int32_t o, int64_t pubkeys) {
2043         LDKChannelSigner *res_ptr = MALLOC(sizeof(LDKChannelSigner), "LDKChannelSigner");
2044         *res_ptr = LDKChannelSigner_init(o, pubkeys);
2045         return tag_ptr(res_ptr, true);
2046 }
2047 int8_tArray  CS_LDK_ChannelSigner_get_per_commitment_point(int64_t this_arg, int64_t idx) {
2048         void* this_arg_ptr = untag_ptr(this_arg);
2049         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2050         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
2051         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
2052         memcpy(ret_arr->elems, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form, 33);
2053         return ret_arr;
2054 }
2055
2056 int8_tArray  CS_LDK_ChannelSigner_release_commitment_secret(int64_t this_arg, int64_t idx) {
2057         void* this_arg_ptr = untag_ptr(this_arg);
2058         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2059         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
2060         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
2061         memcpy(ret_arr->elems, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data, 32);
2062         return ret_arr;
2063 }
2064
2065 int64_t  CS_LDK_ChannelSigner_validate_holder_commitment(int64_t this_arg, int64_t holder_tx, ptrArray outbound_htlc_preimages) {
2066         void* this_arg_ptr = untag_ptr(this_arg);
2067         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2068         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
2069         LDKHolderCommitmentTransaction holder_tx_conv;
2070         holder_tx_conv.inner = untag_ptr(holder_tx);
2071         holder_tx_conv.is_owned = ptr_is_owned(holder_tx);
2072         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_conv);
2073         holder_tx_conv.is_owned = false;
2074         LDKCVec_ThirtyTwoBytesZ outbound_htlc_preimages_constr;
2075         outbound_htlc_preimages_constr.datalen = outbound_htlc_preimages->arr_len;
2076         if (outbound_htlc_preimages_constr.datalen > 0)
2077                 outbound_htlc_preimages_constr.data = MALLOC(outbound_htlc_preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
2078         else
2079                 outbound_htlc_preimages_constr.data = NULL;
2080         int8_tArray* outbound_htlc_preimages_vals = (void*) outbound_htlc_preimages->elems;
2081         for (size_t i = 0; i < outbound_htlc_preimages_constr.datalen; i++) {
2082                 int8_tArray outbound_htlc_preimages_conv_8 = outbound_htlc_preimages_vals[i];
2083                 LDKThirtyTwoBytes outbound_htlc_preimages_conv_8_ref;
2084                 CHECK(outbound_htlc_preimages_conv_8->arr_len == 32);
2085                 memcpy(outbound_htlc_preimages_conv_8_ref.data, outbound_htlc_preimages_conv_8->elems, 32); FREE(outbound_htlc_preimages_conv_8);
2086                 outbound_htlc_preimages_constr.data[i] = outbound_htlc_preimages_conv_8_ref;
2087         }
2088         FREE(outbound_htlc_preimages);
2089         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
2090         *ret_conv = (this_arg_conv->validate_holder_commitment)(this_arg_conv->this_arg, &holder_tx_conv, outbound_htlc_preimages_constr);
2091         return tag_ptr(ret_conv, true);
2092 }
2093
2094 int64_t  CS_LDK_ChannelSigner_validate_counterparty_revocation(int64_t this_arg, int64_t idx, int8_tArray secret) {
2095         void* this_arg_ptr = untag_ptr(this_arg);
2096         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2097         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
2098         uint8_t secret_arr[32];
2099         CHECK(secret->arr_len == 32);
2100         memcpy(secret_arr, secret->elems, 32); FREE(secret);
2101         uint8_t (*secret_ref)[32] = &secret_arr;
2102         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
2103         *ret_conv = (this_arg_conv->validate_counterparty_revocation)(this_arg_conv->this_arg, idx, secret_ref);
2104         return tag_ptr(ret_conv, true);
2105 }
2106
2107 int8_tArray  CS_LDK_ChannelSigner_channel_keys_id(int64_t this_arg) {
2108         void* this_arg_ptr = untag_ptr(this_arg);
2109         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2110         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
2111         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
2112         memcpy(ret_arr->elems, (this_arg_conv->channel_keys_id)(this_arg_conv->this_arg).data, 32);
2113         return ret_arr;
2114 }
2115
2116 void  CS_LDK_ChannelSigner_provide_channel_parameters(int64_t this_arg, int64_t channel_parameters) {
2117         void* this_arg_ptr = untag_ptr(this_arg);
2118         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2119         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
2120         LDKChannelTransactionParameters channel_parameters_conv;
2121         channel_parameters_conv.inner = untag_ptr(channel_parameters);
2122         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
2123         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
2124         channel_parameters_conv.is_owned = false;
2125         (this_arg_conv->provide_channel_parameters)(this_arg_conv->this_arg, &channel_parameters_conv);
2126 }
2127
2128 LDKChannelPublicKeys LDKChannelSigner_set_get_pubkeys(LDKChannelSigner* this_arg) {
2129         if (this_arg->set_pubkeys != NULL)
2130                 this_arg->set_pubkeys(this_arg);
2131         return this_arg->pubkeys;
2132 }
2133 int64_t  CS_LDK_ChannelSigner_get_pubkeys(int64_t this_arg) {
2134         void* this_arg_ptr = untag_ptr(this_arg);
2135         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2136         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
2137         LDKChannelPublicKeys ret_var = LDKChannelSigner_set_get_pubkeys(this_arg_conv);
2138         int64_t ret_ref = 0;
2139         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2140         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2141         return ret_ref;
2142 }
2143
2144 typedef struct LDKEcdsaChannelSigner_JCalls {
2145         atomic_size_t refcnt;
2146         uint32_t instance_ptr;
2147         LDKChannelSigner_JCalls* ChannelSigner;
2148 } LDKEcdsaChannelSigner_JCalls;
2149 static void LDKEcdsaChannelSigner_JCalls_free(void* this_arg) {
2150         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
2151         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2152                 FREE(j_calls);
2153         }
2154 }
2155 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) {
2156         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
2157         LDKCommitmentTransaction commitment_tx_var = *commitment_tx;
2158         int64_t commitment_tx_ref = 0;
2159         commitment_tx_var = CommitmentTransaction_clone(&commitment_tx_var);
2160         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
2161         commitment_tx_ref = tag_ptr(commitment_tx_var.inner, commitment_tx_var.is_owned);
2162         LDKCVec_ThirtyTwoBytesZ inbound_htlc_preimages_var = inbound_htlc_preimages;
2163         ptrArray inbound_htlc_preimages_arr = NULL;
2164         inbound_htlc_preimages_arr = init_ptrArray(inbound_htlc_preimages_var.datalen, __LINE__);
2165         int8_tArray *inbound_htlc_preimages_arr_ptr = (int8_tArray*)(((uint8_t*)inbound_htlc_preimages_arr) + 8);
2166         for (size_t i = 0; i < inbound_htlc_preimages_var.datalen; i++) {
2167                 int8_tArray inbound_htlc_preimages_conv_8_arr = init_int8_tArray(32, __LINE__);
2168                 memcpy(inbound_htlc_preimages_conv_8_arr->elems, inbound_htlc_preimages_var.data[i].data, 32);
2169                 inbound_htlc_preimages_arr_ptr[i] = inbound_htlc_preimages_conv_8_arr;
2170         }
2171         
2172         FREE(inbound_htlc_preimages_var.data);
2173         LDKCVec_ThirtyTwoBytesZ outbound_htlc_preimages_var = outbound_htlc_preimages;
2174         ptrArray outbound_htlc_preimages_arr = NULL;
2175         outbound_htlc_preimages_arr = init_ptrArray(outbound_htlc_preimages_var.datalen, __LINE__);
2176         int8_tArray *outbound_htlc_preimages_arr_ptr = (int8_tArray*)(((uint8_t*)outbound_htlc_preimages_arr) + 8);
2177         for (size_t i = 0; i < outbound_htlc_preimages_var.datalen; i++) {
2178                 int8_tArray outbound_htlc_preimages_conv_8_arr = init_int8_tArray(32, __LINE__);
2179                 memcpy(outbound_htlc_preimages_conv_8_arr->elems, outbound_htlc_preimages_var.data[i].data, 32);
2180                 outbound_htlc_preimages_arr_ptr[i] = outbound_htlc_preimages_conv_8_arr;
2181         }
2182         
2183         FREE(outbound_htlc_preimages_var.data);
2184         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);
2185         void* ret_ptr = untag_ptr(ret);
2186         CHECK_ACCESS(ret_ptr);
2187         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)(ret_ptr);
2188         FREE(untag_ptr(ret));
2189         return ret_conv;
2190 }
2191 LDKCResult_ECDSASignatureNoneZ sign_holder_commitment_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
2192         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
2193         LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
2194         int64_t commitment_tx_ref = 0;
2195         commitment_tx_var = HolderCommitmentTransaction_clone(&commitment_tx_var);
2196         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
2197         commitment_tx_ref = tag_ptr(commitment_tx_var.inner, commitment_tx_var.is_owned);
2198         uint64_t ret = js_invoke_function_l_l(j_calls->instance_ptr, 7, commitment_tx_ref);
2199         void* ret_ptr = untag_ptr(ret);
2200         CHECK_ACCESS(ret_ptr);
2201         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
2202         FREE(untag_ptr(ret));
2203         return ret_conv;
2204 }
2205 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]) {
2206         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
2207         LDKTransaction justice_tx_var = justice_tx;
2208         int8_tArray justice_tx_arr = init_int8_tArray(justice_tx_var.datalen, __LINE__);
2209         memcpy(justice_tx_arr->elems, justice_tx_var.data, justice_tx_var.datalen);
2210         Transaction_free(justice_tx_var);
2211         int64_t input_conv = input;
2212         int64_t amount_conv = amount;
2213         int8_tArray per_commitment_key_arr = init_int8_tArray(32, __LINE__);
2214         memcpy(per_commitment_key_arr->elems, *per_commitment_key, 32);
2215         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);
2216         void* ret_ptr = untag_ptr(ret);
2217         CHECK_ACCESS(ret_ptr);
2218         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
2219         FREE(untag_ptr(ret));
2220         return ret_conv;
2221 }
2222 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) {
2223         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
2224         LDKTransaction justice_tx_var = justice_tx;
2225         int8_tArray justice_tx_arr = init_int8_tArray(justice_tx_var.datalen, __LINE__);
2226         memcpy(justice_tx_arr->elems, justice_tx_var.data, justice_tx_var.datalen);
2227         Transaction_free(justice_tx_var);
2228         int64_t input_conv = input;
2229         int64_t amount_conv = amount;
2230         int8_tArray per_commitment_key_arr = init_int8_tArray(32, __LINE__);
2231         memcpy(per_commitment_key_arr->elems, *per_commitment_key, 32);
2232         LDKHTLCOutputInCommitment htlc_var = *htlc;
2233         int64_t htlc_ref = 0;
2234         htlc_var = HTLCOutputInCommitment_clone(&htlc_var);
2235         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
2236         htlc_ref = tag_ptr(htlc_var.inner, htlc_var.is_owned);
2237         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);
2238         void* ret_ptr = untag_ptr(ret);
2239         CHECK_ACCESS(ret_ptr);
2240         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
2241         FREE(untag_ptr(ret));
2242         return ret_conv;
2243 }
2244 LDKCResult_ECDSASignatureNoneZ sign_holder_htlc_transaction_LDKEcdsaChannelSigner_jcall(const void* this_arg, LDKTransaction htlc_tx, uintptr_t input, const LDKHTLCDescriptor * htlc_descriptor) {
2245         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
2246         LDKTransaction htlc_tx_var = htlc_tx;
2247         int8_tArray htlc_tx_arr = init_int8_tArray(htlc_tx_var.datalen, __LINE__);
2248         memcpy(htlc_tx_arr->elems, htlc_tx_var.data, htlc_tx_var.datalen);
2249         Transaction_free(htlc_tx_var);
2250         int64_t input_conv = input;
2251         LDKHTLCDescriptor htlc_descriptor_var = *htlc_descriptor;
2252         int64_t htlc_descriptor_ref = 0;
2253         htlc_descriptor_var = HTLCDescriptor_clone(&htlc_descriptor_var);
2254         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_descriptor_var);
2255         htlc_descriptor_ref = tag_ptr(htlc_descriptor_var.inner, htlc_descriptor_var.is_owned);
2256         uint64_t ret = js_invoke_function_l_lll(j_calls->instance_ptr, 10, (int64_t)htlc_tx_arr, input_conv, htlc_descriptor_ref);
2257         void* ret_ptr = untag_ptr(ret);
2258         CHECK_ACCESS(ret_ptr);
2259         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
2260         FREE(untag_ptr(ret));
2261         return ret_conv;
2262 }
2263 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) {
2264         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
2265         LDKTransaction htlc_tx_var = htlc_tx;
2266         int8_tArray htlc_tx_arr = init_int8_tArray(htlc_tx_var.datalen, __LINE__);
2267         memcpy(htlc_tx_arr->elems, htlc_tx_var.data, htlc_tx_var.datalen);
2268         Transaction_free(htlc_tx_var);
2269         int64_t input_conv = input;
2270         int64_t amount_conv = amount;
2271         int8_tArray per_commitment_point_arr = init_int8_tArray(33, __LINE__);
2272         memcpy(per_commitment_point_arr->elems, per_commitment_point.compressed_form, 33);
2273         LDKHTLCOutputInCommitment htlc_var = *htlc;
2274         int64_t htlc_ref = 0;
2275         htlc_var = HTLCOutputInCommitment_clone(&htlc_var);
2276         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
2277         htlc_ref = tag_ptr(htlc_var.inner, htlc_var.is_owned);
2278         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);
2279         void* ret_ptr = untag_ptr(ret);
2280         CHECK_ACCESS(ret_ptr);
2281         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
2282         FREE(untag_ptr(ret));
2283         return ret_conv;
2284 }
2285 LDKCResult_ECDSASignatureNoneZ sign_closing_transaction_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKClosingTransaction * closing_tx) {
2286         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
2287         LDKClosingTransaction closing_tx_var = *closing_tx;
2288         int64_t closing_tx_ref = 0;
2289         closing_tx_var = ClosingTransaction_clone(&closing_tx_var);
2290         CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_var);
2291         closing_tx_ref = tag_ptr(closing_tx_var.inner, closing_tx_var.is_owned);
2292         uint64_t ret = js_invoke_function_l_l(j_calls->instance_ptr, 12, closing_tx_ref);
2293         void* ret_ptr = untag_ptr(ret);
2294         CHECK_ACCESS(ret_ptr);
2295         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
2296         FREE(untag_ptr(ret));
2297         return ret_conv;
2298 }
2299 LDKCResult_ECDSASignatureNoneZ sign_holder_anchor_input_LDKEcdsaChannelSigner_jcall(const void* this_arg, LDKTransaction anchor_tx, uintptr_t input) {
2300         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
2301         LDKTransaction anchor_tx_var = anchor_tx;
2302         int8_tArray anchor_tx_arr = init_int8_tArray(anchor_tx_var.datalen, __LINE__);
2303         memcpy(anchor_tx_arr->elems, anchor_tx_var.data, anchor_tx_var.datalen);
2304         Transaction_free(anchor_tx_var);
2305         int64_t input_conv = input;
2306         uint64_t ret = js_invoke_function_l_ll(j_calls->instance_ptr, 13, (int64_t)anchor_tx_arr, input_conv);
2307         void* ret_ptr = untag_ptr(ret);
2308         CHECK_ACCESS(ret_ptr);
2309         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
2310         FREE(untag_ptr(ret));
2311         return ret_conv;
2312 }
2313 LDKCResult_ECDSASignatureNoneZ sign_channel_announcement_with_funding_key_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) {
2314         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
2315         LDKUnsignedChannelAnnouncement msg_var = *msg;
2316         int64_t msg_ref = 0;
2317         msg_var = UnsignedChannelAnnouncement_clone(&msg_var);
2318         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2319         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
2320         uint64_t ret = js_invoke_function_l_l(j_calls->instance_ptr, 14, msg_ref);
2321         void* ret_ptr = untag_ptr(ret);
2322         CHECK_ACCESS(ret_ptr);
2323         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
2324         FREE(untag_ptr(ret));
2325         return ret_conv;
2326 }
2327 static void LDKEcdsaChannelSigner_JCalls_cloned(LDKEcdsaChannelSigner* new_obj) {
2328         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) new_obj->this_arg;
2329         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2330         atomic_fetch_add_explicit(&j_calls->ChannelSigner->refcnt, 1, memory_order_release);
2331 }
2332 static inline LDKEcdsaChannelSigner LDKEcdsaChannelSigner_init (int64_t o, int64_t ChannelSigner, int64_t pubkeys) {
2333         LDKEcdsaChannelSigner_JCalls *calls = MALLOC(sizeof(LDKEcdsaChannelSigner_JCalls), "LDKEcdsaChannelSigner_JCalls");
2334         atomic_init(&calls->refcnt, 1);
2335         calls->instance_ptr = o;
2336
2337         LDKChannelPublicKeys pubkeys_conv;
2338         pubkeys_conv.inner = untag_ptr(pubkeys);
2339         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
2340         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
2341
2342         LDKEcdsaChannelSigner ret = {
2343                 .this_arg = (void*) calls,
2344                 .sign_counterparty_commitment = sign_counterparty_commitment_LDKEcdsaChannelSigner_jcall,
2345                 .sign_holder_commitment = sign_holder_commitment_LDKEcdsaChannelSigner_jcall,
2346                 .sign_justice_revoked_output = sign_justice_revoked_output_LDKEcdsaChannelSigner_jcall,
2347                 .sign_justice_revoked_htlc = sign_justice_revoked_htlc_LDKEcdsaChannelSigner_jcall,
2348                 .sign_holder_htlc_transaction = sign_holder_htlc_transaction_LDKEcdsaChannelSigner_jcall,
2349                 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_LDKEcdsaChannelSigner_jcall,
2350                 .sign_closing_transaction = sign_closing_transaction_LDKEcdsaChannelSigner_jcall,
2351                 .sign_holder_anchor_input = sign_holder_anchor_input_LDKEcdsaChannelSigner_jcall,
2352                 .sign_channel_announcement_with_funding_key = sign_channel_announcement_with_funding_key_LDKEcdsaChannelSigner_jcall,
2353                 .free = LDKEcdsaChannelSigner_JCalls_free,
2354                 .ChannelSigner = LDKChannelSigner_init(ChannelSigner, pubkeys),
2355         };
2356         calls->ChannelSigner = ret.ChannelSigner.this_arg;
2357         return ret;
2358 }
2359 uint64_t  CS_LDK_LDKEcdsaChannelSigner_new(int32_t o, int32_t ChannelSigner, int64_t pubkeys) {
2360         LDKEcdsaChannelSigner *res_ptr = MALLOC(sizeof(LDKEcdsaChannelSigner), "LDKEcdsaChannelSigner");
2361         *res_ptr = LDKEcdsaChannelSigner_init(o, ChannelSigner, pubkeys);
2362         return tag_ptr(res_ptr, true);
2363 }
2364 int64_t  CS_LDK_EcdsaChannelSigner_sign_counterparty_commitment(int64_t this_arg, int64_t commitment_tx, ptrArray inbound_htlc_preimages, ptrArray outbound_htlc_preimages) {
2365         void* this_arg_ptr = untag_ptr(this_arg);
2366         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2367         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
2368         LDKCommitmentTransaction commitment_tx_conv;
2369         commitment_tx_conv.inner = untag_ptr(commitment_tx);
2370         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
2371         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
2372         commitment_tx_conv.is_owned = false;
2373         LDKCVec_ThirtyTwoBytesZ inbound_htlc_preimages_constr;
2374         inbound_htlc_preimages_constr.datalen = inbound_htlc_preimages->arr_len;
2375         if (inbound_htlc_preimages_constr.datalen > 0)
2376                 inbound_htlc_preimages_constr.data = MALLOC(inbound_htlc_preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
2377         else
2378                 inbound_htlc_preimages_constr.data = NULL;
2379         int8_tArray* inbound_htlc_preimages_vals = (void*) inbound_htlc_preimages->elems;
2380         for (size_t i = 0; i < inbound_htlc_preimages_constr.datalen; i++) {
2381                 int8_tArray inbound_htlc_preimages_conv_8 = inbound_htlc_preimages_vals[i];
2382                 LDKThirtyTwoBytes inbound_htlc_preimages_conv_8_ref;
2383                 CHECK(inbound_htlc_preimages_conv_8->arr_len == 32);
2384                 memcpy(inbound_htlc_preimages_conv_8_ref.data, inbound_htlc_preimages_conv_8->elems, 32); FREE(inbound_htlc_preimages_conv_8);
2385                 inbound_htlc_preimages_constr.data[i] = inbound_htlc_preimages_conv_8_ref;
2386         }
2387         FREE(inbound_htlc_preimages);
2388         LDKCVec_ThirtyTwoBytesZ outbound_htlc_preimages_constr;
2389         outbound_htlc_preimages_constr.datalen = outbound_htlc_preimages->arr_len;
2390         if (outbound_htlc_preimages_constr.datalen > 0)
2391                 outbound_htlc_preimages_constr.data = MALLOC(outbound_htlc_preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
2392         else
2393                 outbound_htlc_preimages_constr.data = NULL;
2394         int8_tArray* outbound_htlc_preimages_vals = (void*) outbound_htlc_preimages->elems;
2395         for (size_t i = 0; i < outbound_htlc_preimages_constr.datalen; i++) {
2396                 int8_tArray outbound_htlc_preimages_conv_8 = outbound_htlc_preimages_vals[i];
2397                 LDKThirtyTwoBytes outbound_htlc_preimages_conv_8_ref;
2398                 CHECK(outbound_htlc_preimages_conv_8->arr_len == 32);
2399                 memcpy(outbound_htlc_preimages_conv_8_ref.data, outbound_htlc_preimages_conv_8->elems, 32); FREE(outbound_htlc_preimages_conv_8);
2400                 outbound_htlc_preimages_constr.data[i] = outbound_htlc_preimages_conv_8_ref;
2401         }
2402         FREE(outbound_htlc_preimages);
2403         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
2404         *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, &commitment_tx_conv, inbound_htlc_preimages_constr, outbound_htlc_preimages_constr);
2405         return tag_ptr(ret_conv, true);
2406 }
2407
2408 int64_t  CS_LDK_EcdsaChannelSigner_sign_holder_commitment(int64_t this_arg, int64_t commitment_tx) {
2409         void* this_arg_ptr = untag_ptr(this_arg);
2410         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2411         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
2412         LDKHolderCommitmentTransaction commitment_tx_conv;
2413         commitment_tx_conv.inner = untag_ptr(commitment_tx);
2414         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
2415         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
2416         commitment_tx_conv.is_owned = false;
2417         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
2418         *ret_conv = (this_arg_conv->sign_holder_commitment)(this_arg_conv->this_arg, &commitment_tx_conv);
2419         return tag_ptr(ret_conv, true);
2420 }
2421
2422 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) {
2423         void* this_arg_ptr = untag_ptr(this_arg);
2424         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2425         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
2426         LDKTransaction justice_tx_ref;
2427         justice_tx_ref.datalen = justice_tx->arr_len;
2428         justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
2429         memcpy(justice_tx_ref.data, justice_tx->elems, justice_tx_ref.datalen); FREE(justice_tx);
2430         justice_tx_ref.data_is_owned = true;
2431         uint8_t per_commitment_key_arr[32];
2432         CHECK(per_commitment_key->arr_len == 32);
2433         memcpy(per_commitment_key_arr, per_commitment_key->elems, 32); FREE(per_commitment_key);
2434         uint8_t (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
2435         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
2436         *ret_conv = (this_arg_conv->sign_justice_revoked_output)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref);
2437         return tag_ptr(ret_conv, true);
2438 }
2439
2440 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) {
2441         void* this_arg_ptr = untag_ptr(this_arg);
2442         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2443         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
2444         LDKTransaction justice_tx_ref;
2445         justice_tx_ref.datalen = justice_tx->arr_len;
2446         justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
2447         memcpy(justice_tx_ref.data, justice_tx->elems, justice_tx_ref.datalen); FREE(justice_tx);
2448         justice_tx_ref.data_is_owned = true;
2449         uint8_t per_commitment_key_arr[32];
2450         CHECK(per_commitment_key->arr_len == 32);
2451         memcpy(per_commitment_key_arr, per_commitment_key->elems, 32); FREE(per_commitment_key);
2452         uint8_t (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
2453         LDKHTLCOutputInCommitment htlc_conv;
2454         htlc_conv.inner = untag_ptr(htlc);
2455         htlc_conv.is_owned = ptr_is_owned(htlc);
2456         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
2457         htlc_conv.is_owned = false;
2458         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
2459         *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);
2460         return tag_ptr(ret_conv, true);
2461 }
2462
2463 int64_t  CS_LDK_EcdsaChannelSigner_sign_holder_htlc_transaction(int64_t this_arg, int8_tArray htlc_tx, int64_t input, int64_t htlc_descriptor) {
2464         void* this_arg_ptr = untag_ptr(this_arg);
2465         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2466         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
2467         LDKTransaction htlc_tx_ref;
2468         htlc_tx_ref.datalen = htlc_tx->arr_len;
2469         htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
2470         memcpy(htlc_tx_ref.data, htlc_tx->elems, htlc_tx_ref.datalen); FREE(htlc_tx);
2471         htlc_tx_ref.data_is_owned = true;
2472         LDKHTLCDescriptor htlc_descriptor_conv;
2473         htlc_descriptor_conv.inner = untag_ptr(htlc_descriptor);
2474         htlc_descriptor_conv.is_owned = ptr_is_owned(htlc_descriptor);
2475         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_descriptor_conv);
2476         htlc_descriptor_conv.is_owned = false;
2477         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
2478         *ret_conv = (this_arg_conv->sign_holder_htlc_transaction)(this_arg_conv->this_arg, htlc_tx_ref, input, &htlc_descriptor_conv);
2479         return tag_ptr(ret_conv, true);
2480 }
2481
2482 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) {
2483         void* this_arg_ptr = untag_ptr(this_arg);
2484         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2485         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
2486         LDKTransaction htlc_tx_ref;
2487         htlc_tx_ref.datalen = htlc_tx->arr_len;
2488         htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
2489         memcpy(htlc_tx_ref.data, htlc_tx->elems, htlc_tx_ref.datalen); FREE(htlc_tx);
2490         htlc_tx_ref.data_is_owned = true;
2491         LDKPublicKey per_commitment_point_ref;
2492         CHECK(per_commitment_point->arr_len == 33);
2493         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
2494         LDKHTLCOutputInCommitment htlc_conv;
2495         htlc_conv.inner = untag_ptr(htlc);
2496         htlc_conv.is_owned = ptr_is_owned(htlc);
2497         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
2498         htlc_conv.is_owned = false;
2499         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
2500         *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);
2501         return tag_ptr(ret_conv, true);
2502 }
2503
2504 int64_t  CS_LDK_EcdsaChannelSigner_sign_closing_transaction(int64_t this_arg, int64_t closing_tx) {
2505         void* this_arg_ptr = untag_ptr(this_arg);
2506         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2507         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
2508         LDKClosingTransaction closing_tx_conv;
2509         closing_tx_conv.inner = untag_ptr(closing_tx);
2510         closing_tx_conv.is_owned = ptr_is_owned(closing_tx);
2511         CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_conv);
2512         closing_tx_conv.is_owned = false;
2513         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
2514         *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, &closing_tx_conv);
2515         return tag_ptr(ret_conv, true);
2516 }
2517
2518 int64_t  CS_LDK_EcdsaChannelSigner_sign_holder_anchor_input(int64_t this_arg, int8_tArray anchor_tx, int64_t input) {
2519         void* this_arg_ptr = untag_ptr(this_arg);
2520         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2521         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
2522         LDKTransaction anchor_tx_ref;
2523         anchor_tx_ref.datalen = anchor_tx->arr_len;
2524         anchor_tx_ref.data = MALLOC(anchor_tx_ref.datalen, "LDKTransaction Bytes");
2525         memcpy(anchor_tx_ref.data, anchor_tx->elems, anchor_tx_ref.datalen); FREE(anchor_tx);
2526         anchor_tx_ref.data_is_owned = true;
2527         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
2528         *ret_conv = (this_arg_conv->sign_holder_anchor_input)(this_arg_conv->this_arg, anchor_tx_ref, input);
2529         return tag_ptr(ret_conv, true);
2530 }
2531
2532 int64_t  CS_LDK_EcdsaChannelSigner_sign_channel_announcement_with_funding_key(int64_t this_arg, int64_t msg) {
2533         void* this_arg_ptr = untag_ptr(this_arg);
2534         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2535         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
2536         LDKUnsignedChannelAnnouncement msg_conv;
2537         msg_conv.inner = untag_ptr(msg);
2538         msg_conv.is_owned = ptr_is_owned(msg);
2539         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
2540         msg_conv.is_owned = false;
2541         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
2542         *ret_conv = (this_arg_conv->sign_channel_announcement_with_funding_key)(this_arg_conv->this_arg, &msg_conv);
2543         return tag_ptr(ret_conv, true);
2544 }
2545
2546 typedef struct LDKWriteableEcdsaChannelSigner_JCalls {
2547         atomic_size_t refcnt;
2548         uint32_t instance_ptr;
2549         LDKEcdsaChannelSigner_JCalls* EcdsaChannelSigner;
2550         LDKChannelSigner_JCalls* ChannelSigner;
2551 } LDKWriteableEcdsaChannelSigner_JCalls;
2552 static void LDKWriteableEcdsaChannelSigner_JCalls_free(void* this_arg) {
2553         LDKWriteableEcdsaChannelSigner_JCalls *j_calls = (LDKWriteableEcdsaChannelSigner_JCalls*) this_arg;
2554         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2555                 FREE(j_calls);
2556         }
2557 }
2558 LDKCVec_u8Z write_LDKWriteableEcdsaChannelSigner_jcall(const void* this_arg) {
2559         LDKWriteableEcdsaChannelSigner_JCalls *j_calls = (LDKWriteableEcdsaChannelSigner_JCalls*) this_arg;
2560         int8_tArray ret = (int8_tArray)js_invoke_function_l_(j_calls->instance_ptr, 15);
2561         LDKCVec_u8Z ret_ref;
2562         ret_ref.datalen = ret->arr_len;
2563         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
2564         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
2565         return ret_ref;
2566 }
2567 static void LDKWriteableEcdsaChannelSigner_JCalls_cloned(LDKWriteableEcdsaChannelSigner* new_obj) {
2568         LDKWriteableEcdsaChannelSigner_JCalls *j_calls = (LDKWriteableEcdsaChannelSigner_JCalls*) new_obj->this_arg;
2569         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2570         atomic_fetch_add_explicit(&j_calls->EcdsaChannelSigner->refcnt, 1, memory_order_release);
2571         atomic_fetch_add_explicit(&j_calls->EcdsaChannelSigner->ChannelSigner->refcnt, 1, memory_order_release);
2572 }
2573 static inline LDKWriteableEcdsaChannelSigner LDKWriteableEcdsaChannelSigner_init (int64_t o, int64_t EcdsaChannelSigner, int64_t ChannelSigner, int64_t pubkeys) {
2574         LDKWriteableEcdsaChannelSigner_JCalls *calls = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner_JCalls), "LDKWriteableEcdsaChannelSigner_JCalls");
2575         atomic_init(&calls->refcnt, 1);
2576         calls->instance_ptr = o;
2577
2578         LDKChannelPublicKeys pubkeys_conv;
2579         pubkeys_conv.inner = untag_ptr(pubkeys);
2580         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
2581         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
2582
2583         LDKWriteableEcdsaChannelSigner ret = {
2584                 .this_arg = (void*) calls,
2585                 .write = write_LDKWriteableEcdsaChannelSigner_jcall,
2586                 .cloned = LDKWriteableEcdsaChannelSigner_JCalls_cloned,
2587                 .free = LDKWriteableEcdsaChannelSigner_JCalls_free,
2588                 .EcdsaChannelSigner = LDKEcdsaChannelSigner_init(EcdsaChannelSigner, ChannelSigner, pubkeys),
2589         };
2590         calls->EcdsaChannelSigner = ret.EcdsaChannelSigner.this_arg;
2591         calls->ChannelSigner = ret.EcdsaChannelSigner.ChannelSigner.this_arg;
2592         return ret;
2593 }
2594 uint64_t  CS_LDK_LDKWriteableEcdsaChannelSigner_new(int32_t o, int32_t EcdsaChannelSigner, int32_t ChannelSigner, int64_t pubkeys) {
2595         LDKWriteableEcdsaChannelSigner *res_ptr = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
2596         *res_ptr = LDKWriteableEcdsaChannelSigner_init(o, EcdsaChannelSigner, ChannelSigner, pubkeys);
2597         return tag_ptr(res_ptr, true);
2598 }
2599 int8_tArray  CS_LDK_WriteableEcdsaChannelSigner_write(int64_t this_arg) {
2600         void* this_arg_ptr = untag_ptr(this_arg);
2601         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2602         LDKWriteableEcdsaChannelSigner* this_arg_conv = (LDKWriteableEcdsaChannelSigner*)this_arg_ptr;
2603         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
2604         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
2605         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
2606         CVec_u8Z_free(ret_var);
2607         return ret_arr;
2608 }
2609
2610 static inline struct LDKWriteableEcdsaChannelSigner CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_ok(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR owner){
2611 CHECK(owner->result_ok);
2612         return WriteableEcdsaChannelSigner_clone(&*owner->contents.result);
2613 }
2614 int64_t  CS_LDK_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_ok(int64_t owner) {
2615         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* owner_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(owner);
2616         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
2617         *ret_ret = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_ok(owner_conv);
2618         return tag_ptr(ret_ret, true);
2619 }
2620
2621 static inline struct LDKDecodeError CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_err(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR owner){
2622 CHECK(!owner->result_ok);
2623         return DecodeError_clone(&*owner->contents.err);
2624 }
2625 int64_t  CS_LDK_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_err(int64_t owner) {
2626         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* owner_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(owner);
2627         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2628         *ret_copy = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_err(owner_conv);
2629         int64_t ret_ref = tag_ptr(ret_copy, true);
2630         return ret_ref;
2631 }
2632
2633 static inline struct LDKCVec_u8Z CResult_CVec_u8ZNoneZ_get_ok(LDKCResult_CVec_u8ZNoneZ *NONNULL_PTR owner){
2634 CHECK(owner->result_ok);
2635         return CVec_u8Z_clone(&*owner->contents.result);
2636 }
2637 int8_tArray  CS_LDK_CResult_CVec_u8ZNoneZ_get_ok(int64_t owner) {
2638         LDKCResult_CVec_u8ZNoneZ* owner_conv = (LDKCResult_CVec_u8ZNoneZ*)untag_ptr(owner);
2639         LDKCVec_u8Z ret_var = CResult_CVec_u8ZNoneZ_get_ok(owner_conv);
2640         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
2641         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
2642         CVec_u8Z_free(ret_var);
2643         return ret_arr;
2644 }
2645
2646 static inline void CResult_CVec_u8ZNoneZ_get_err(LDKCResult_CVec_u8ZNoneZ *NONNULL_PTR owner){
2647 CHECK(!owner->result_ok);
2648         return *owner->contents.err;
2649 }
2650 void  CS_LDK_CResult_CVec_u8ZNoneZ_get_err(int64_t owner) {
2651         LDKCResult_CVec_u8ZNoneZ* owner_conv = (LDKCResult_CVec_u8ZNoneZ*)untag_ptr(owner);
2652         CResult_CVec_u8ZNoneZ_get_err(owner_conv);
2653 }
2654
2655 static inline struct LDKShutdownScript CResult_ShutdownScriptNoneZ_get_ok(LDKCResult_ShutdownScriptNoneZ *NONNULL_PTR owner){
2656         LDKShutdownScript ret = *owner->contents.result;
2657         ret.is_owned = false;
2658         return ret;
2659 }
2660 int64_t  CS_LDK_CResult_ShutdownScriptNoneZ_get_ok(int64_t owner) {
2661         LDKCResult_ShutdownScriptNoneZ* owner_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(owner);
2662         LDKShutdownScript ret_var = CResult_ShutdownScriptNoneZ_get_ok(owner_conv);
2663         int64_t ret_ref = 0;
2664         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2665         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2666         return ret_ref;
2667 }
2668
2669 static inline void CResult_ShutdownScriptNoneZ_get_err(LDKCResult_ShutdownScriptNoneZ *NONNULL_PTR owner){
2670 CHECK(!owner->result_ok);
2671         return *owner->contents.err;
2672 }
2673 void  CS_LDK_CResult_ShutdownScriptNoneZ_get_err(int64_t owner) {
2674         LDKCResult_ShutdownScriptNoneZ* owner_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(owner);
2675         CResult_ShutdownScriptNoneZ_get_err(owner_conv);
2676 }
2677
2678 uint32_t CS_LDK_LDKCOption_u16Z_ty_from_ptr(int64_t ptr) {
2679         LDKCOption_u16Z *obj = (LDKCOption_u16Z*)untag_ptr(ptr);
2680         switch(obj->tag) {
2681                 case LDKCOption_u16Z_Some: return 0;
2682                 case LDKCOption_u16Z_None: return 1;
2683                 default: abort();
2684         }
2685 }
2686 int16_t CS_LDK_LDKCOption_u16Z_Some_get_some(int64_t ptr) {
2687         LDKCOption_u16Z *obj = (LDKCOption_u16Z*)untag_ptr(ptr);
2688         CHECK(obj->tag == LDKCOption_u16Z_Some);
2689         int16_t some_conv = obj->some;
2690         return some_conv;
2691 }
2692 uint32_t CS_LDK_LDKCOption_boolZ_ty_from_ptr(int64_t ptr) {
2693         LDKCOption_boolZ *obj = (LDKCOption_boolZ*)untag_ptr(ptr);
2694         switch(obj->tag) {
2695                 case LDKCOption_boolZ_Some: return 0;
2696                 case LDKCOption_boolZ_None: return 1;
2697                 default: abort();
2698         }
2699 }
2700 jboolean CS_LDK_LDKCOption_boolZ_Some_get_some(int64_t ptr) {
2701         LDKCOption_boolZ *obj = (LDKCOption_boolZ*)untag_ptr(ptr);
2702         CHECK(obj->tag == LDKCOption_boolZ_Some);
2703         jboolean some_conv = obj->some;
2704         return some_conv;
2705 }
2706 static inline struct LDKWitness CResult_WitnessNoneZ_get_ok(LDKCResult_WitnessNoneZ *NONNULL_PTR owner){
2707 CHECK(owner->result_ok);
2708         return Witness_clone(&*owner->contents.result);
2709 }
2710 int8_tArray  CS_LDK_CResult_WitnessNoneZ_get_ok(int64_t owner) {
2711         LDKCResult_WitnessNoneZ* owner_conv = (LDKCResult_WitnessNoneZ*)untag_ptr(owner);
2712         LDKWitness ret_var = CResult_WitnessNoneZ_get_ok(owner_conv);
2713         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
2714         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
2715         Witness_free(ret_var);
2716         return ret_arr;
2717 }
2718
2719 static inline void CResult_WitnessNoneZ_get_err(LDKCResult_WitnessNoneZ *NONNULL_PTR owner){
2720 CHECK(!owner->result_ok);
2721         return *owner->contents.err;
2722 }
2723 void  CS_LDK_CResult_WitnessNoneZ_get_err(int64_t owner) {
2724         LDKCResult_WitnessNoneZ* owner_conv = (LDKCResult_WitnessNoneZ*)untag_ptr(owner);
2725         CResult_WitnessNoneZ_get_err(owner_conv);
2726 }
2727
2728 static inline struct LDKInMemorySigner CResult_InMemorySignerDecodeErrorZ_get_ok(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
2729         LDKInMemorySigner ret = *owner->contents.result;
2730         ret.is_owned = false;
2731         return ret;
2732 }
2733 int64_t  CS_LDK_CResult_InMemorySignerDecodeErrorZ_get_ok(int64_t owner) {
2734         LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(owner);
2735         LDKInMemorySigner ret_var = CResult_InMemorySignerDecodeErrorZ_get_ok(owner_conv);
2736         int64_t ret_ref = 0;
2737         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2738         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2739         return ret_ref;
2740 }
2741
2742 static inline struct LDKDecodeError CResult_InMemorySignerDecodeErrorZ_get_err(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
2743 CHECK(!owner->result_ok);
2744         return DecodeError_clone(&*owner->contents.err);
2745 }
2746 int64_t  CS_LDK_CResult_InMemorySignerDecodeErrorZ_get_err(int64_t owner) {
2747         LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(owner);
2748         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2749         *ret_copy = CResult_InMemorySignerDecodeErrorZ_get_err(owner_conv);
2750         int64_t ret_ref = tag_ptr(ret_copy, true);
2751         return ret_ref;
2752 }
2753
2754 uint32_t CS_LDK_LDKCandidateRouteHop_ty_from_ptr(int64_t ptr) {
2755         LDKCandidateRouteHop *obj = (LDKCandidateRouteHop*)untag_ptr(ptr);
2756         switch(obj->tag) {
2757                 case LDKCandidateRouteHop_FirstHop: return 0;
2758                 case LDKCandidateRouteHop_PublicHop: return 1;
2759                 case LDKCandidateRouteHop_PrivateHop: return 2;
2760                 case LDKCandidateRouteHop_Blinded: return 3;
2761                 case LDKCandidateRouteHop_OneHopBlinded: return 4;
2762                 default: abort();
2763         }
2764 }
2765 int64_t CS_LDK_LDKCandidateRouteHop_FirstHop_get_first_hop(int64_t ptr) {
2766         LDKCandidateRouteHop *obj = (LDKCandidateRouteHop*)untag_ptr(ptr);
2767         CHECK(obj->tag == LDKCandidateRouteHop_FirstHop);
2768         LDKFirstHopCandidate first_hop_var = obj->first_hop;
2769                         int64_t first_hop_ref = 0;
2770                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hop_var);
2771                         first_hop_ref = tag_ptr(first_hop_var.inner, false);
2772         return first_hop_ref;
2773 }
2774 int64_t CS_LDK_LDKCandidateRouteHop_PublicHop_get_public_hop(int64_t ptr) {
2775         LDKCandidateRouteHop *obj = (LDKCandidateRouteHop*)untag_ptr(ptr);
2776         CHECK(obj->tag == LDKCandidateRouteHop_PublicHop);
2777         LDKPublicHopCandidate public_hop_var = obj->public_hop;
2778                         int64_t public_hop_ref = 0;
2779                         CHECK_INNER_FIELD_ACCESS_OR_NULL(public_hop_var);
2780                         public_hop_ref = tag_ptr(public_hop_var.inner, false);
2781         return public_hop_ref;
2782 }
2783 int64_t CS_LDK_LDKCandidateRouteHop_PrivateHop_get_private_hop(int64_t ptr) {
2784         LDKCandidateRouteHop *obj = (LDKCandidateRouteHop*)untag_ptr(ptr);
2785         CHECK(obj->tag == LDKCandidateRouteHop_PrivateHop);
2786         LDKPrivateHopCandidate private_hop_var = obj->private_hop;
2787                         int64_t private_hop_ref = 0;
2788                         CHECK_INNER_FIELD_ACCESS_OR_NULL(private_hop_var);
2789                         private_hop_ref = tag_ptr(private_hop_var.inner, false);
2790         return private_hop_ref;
2791 }
2792 int64_t CS_LDK_LDKCandidateRouteHop_Blinded_get_blinded(int64_t ptr) {
2793         LDKCandidateRouteHop *obj = (LDKCandidateRouteHop*)untag_ptr(ptr);
2794         CHECK(obj->tag == LDKCandidateRouteHop_Blinded);
2795         LDKBlindedPathCandidate blinded_var = obj->blinded;
2796                         int64_t blinded_ref = 0;
2797                         CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_var);
2798                         blinded_ref = tag_ptr(blinded_var.inner, false);
2799         return blinded_ref;
2800 }
2801 int64_t CS_LDK_LDKCandidateRouteHop_OneHopBlinded_get_one_hop_blinded(int64_t ptr) {
2802         LDKCandidateRouteHop *obj = (LDKCandidateRouteHop*)untag_ptr(ptr);
2803         CHECK(obj->tag == LDKCandidateRouteHop_OneHopBlinded);
2804         LDKOneHopBlindedPathCandidate one_hop_blinded_var = obj->one_hop_blinded;
2805                         int64_t one_hop_blinded_ref = 0;
2806                         CHECK_INNER_FIELD_ACCESS_OR_NULL(one_hop_blinded_var);
2807                         one_hop_blinded_ref = tag_ptr(one_hop_blinded_var.inner, false);
2808         return one_hop_blinded_ref;
2809 }
2810 typedef struct LDKScoreLookUp_JCalls {
2811         atomic_size_t refcnt;
2812         uint32_t instance_ptr;
2813 } LDKScoreLookUp_JCalls;
2814 static void LDKScoreLookUp_JCalls_free(void* this_arg) {
2815         LDKScoreLookUp_JCalls *j_calls = (LDKScoreLookUp_JCalls*) this_arg;
2816         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2817                 FREE(j_calls);
2818         }
2819 }
2820 uint64_t channel_penalty_msat_LDKScoreLookUp_jcall(const void* this_arg, const LDKCandidateRouteHop * candidate, LDKChannelUsage usage, const LDKProbabilisticScoringFeeParameters * score_params) {
2821         LDKScoreLookUp_JCalls *j_calls = (LDKScoreLookUp_JCalls*) this_arg;
2822         LDKCandidateRouteHop *ret_candidate = MALLOC(sizeof(LDKCandidateRouteHop), "LDKCandidateRouteHop ret conversion");
2823         *ret_candidate = CandidateRouteHop_clone(candidate);
2824         int64_t ref_candidate = tag_ptr(ret_candidate, true);
2825         LDKChannelUsage usage_var = usage;
2826         int64_t usage_ref = 0;
2827         CHECK_INNER_FIELD_ACCESS_OR_NULL(usage_var);
2828         usage_ref = tag_ptr(usage_var.inner, usage_var.is_owned);
2829         LDKProbabilisticScoringFeeParameters score_params_var = *score_params;
2830         int64_t score_params_ref = 0;
2831         score_params_var = ProbabilisticScoringFeeParameters_clone(&score_params_var);
2832         CHECK_INNER_FIELD_ACCESS_OR_NULL(score_params_var);
2833         score_params_ref = tag_ptr(score_params_var.inner, score_params_var.is_owned);
2834         return js_invoke_function_l_lll(j_calls->instance_ptr, 16, ref_candidate, usage_ref, score_params_ref);
2835 }
2836 static void LDKScoreLookUp_JCalls_cloned(LDKScoreLookUp* new_obj) {
2837         LDKScoreLookUp_JCalls *j_calls = (LDKScoreLookUp_JCalls*) new_obj->this_arg;
2838         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2839 }
2840 static inline LDKScoreLookUp LDKScoreLookUp_init (int64_t o) {
2841         LDKScoreLookUp_JCalls *calls = MALLOC(sizeof(LDKScoreLookUp_JCalls), "LDKScoreLookUp_JCalls");
2842         atomic_init(&calls->refcnt, 1);
2843         calls->instance_ptr = o;
2844
2845         LDKScoreLookUp ret = {
2846                 .this_arg = (void*) calls,
2847                 .channel_penalty_msat = channel_penalty_msat_LDKScoreLookUp_jcall,
2848                 .free = LDKScoreLookUp_JCalls_free,
2849         };
2850         return ret;
2851 }
2852 uint64_t  CS_LDK_LDKScoreLookUp_new(int32_t o) {
2853         LDKScoreLookUp *res_ptr = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
2854         *res_ptr = LDKScoreLookUp_init(o);
2855         return tag_ptr(res_ptr, true);
2856 }
2857 int64_t  CS_LDK_ScoreLookUp_channel_penalty_msat(int64_t this_arg, int64_t candidate, int64_t usage, int64_t score_params) {
2858         void* this_arg_ptr = untag_ptr(this_arg);
2859         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2860         LDKScoreLookUp* this_arg_conv = (LDKScoreLookUp*)this_arg_ptr;
2861         LDKCandidateRouteHop* candidate_conv = (LDKCandidateRouteHop*)untag_ptr(candidate);
2862         LDKChannelUsage usage_conv;
2863         usage_conv.inner = untag_ptr(usage);
2864         usage_conv.is_owned = ptr_is_owned(usage);
2865         CHECK_INNER_FIELD_ACCESS_OR_NULL(usage_conv);
2866         usage_conv = ChannelUsage_clone(&usage_conv);
2867         LDKProbabilisticScoringFeeParameters score_params_conv;
2868         score_params_conv.inner = untag_ptr(score_params);
2869         score_params_conv.is_owned = ptr_is_owned(score_params);
2870         CHECK_INNER_FIELD_ACCESS_OR_NULL(score_params_conv);
2871         score_params_conv.is_owned = false;
2872         int64_t ret_conv = (this_arg_conv->channel_penalty_msat)(this_arg_conv->this_arg, candidate_conv, usage_conv, &score_params_conv);
2873         return ret_conv;
2874 }
2875
2876 typedef struct LDKScoreUpdate_JCalls {
2877         atomic_size_t refcnt;
2878         uint32_t instance_ptr;
2879 } LDKScoreUpdate_JCalls;
2880 static void LDKScoreUpdate_JCalls_free(void* this_arg) {
2881         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
2882         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2883                 FREE(j_calls);
2884         }
2885 }
2886 void payment_path_failed_LDKScoreUpdate_jcall(void* this_arg, const LDKPath * path, uint64_t short_channel_id, uint64_t duration_since_epoch) {
2887         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
2888         LDKPath path_var = *path;
2889         int64_t path_ref = 0;
2890         path_var = Path_clone(&path_var);
2891         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
2892         path_ref = tag_ptr(path_var.inner, path_var.is_owned);
2893         int64_t short_channel_id_conv = short_channel_id;
2894         int64_t duration_since_epoch_conv = duration_since_epoch;
2895         js_invoke_function_void_lll(j_calls->instance_ptr, 17, path_ref, short_channel_id_conv, duration_since_epoch_conv);
2896 }
2897 void payment_path_successful_LDKScoreUpdate_jcall(void* this_arg, const LDKPath * path, uint64_t duration_since_epoch) {
2898         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
2899         LDKPath path_var = *path;
2900         int64_t path_ref = 0;
2901         path_var = Path_clone(&path_var);
2902         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
2903         path_ref = tag_ptr(path_var.inner, path_var.is_owned);
2904         int64_t duration_since_epoch_conv = duration_since_epoch;
2905         js_invoke_function_void_ll(j_calls->instance_ptr, 18, path_ref, duration_since_epoch_conv);
2906 }
2907 void probe_failed_LDKScoreUpdate_jcall(void* this_arg, const LDKPath * path, uint64_t short_channel_id, uint64_t duration_since_epoch) {
2908         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
2909         LDKPath path_var = *path;
2910         int64_t path_ref = 0;
2911         path_var = Path_clone(&path_var);
2912         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
2913         path_ref = tag_ptr(path_var.inner, path_var.is_owned);
2914         int64_t short_channel_id_conv = short_channel_id;
2915         int64_t duration_since_epoch_conv = duration_since_epoch;
2916         js_invoke_function_void_lll(j_calls->instance_ptr, 19, path_ref, short_channel_id_conv, duration_since_epoch_conv);
2917 }
2918 void probe_successful_LDKScoreUpdate_jcall(void* this_arg, const LDKPath * path, uint64_t duration_since_epoch) {
2919         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
2920         LDKPath path_var = *path;
2921         int64_t path_ref = 0;
2922         path_var = Path_clone(&path_var);
2923         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
2924         path_ref = tag_ptr(path_var.inner, path_var.is_owned);
2925         int64_t duration_since_epoch_conv = duration_since_epoch;
2926         js_invoke_function_void_ll(j_calls->instance_ptr, 20, path_ref, duration_since_epoch_conv);
2927 }
2928 void time_passed_LDKScoreUpdate_jcall(void* this_arg, uint64_t duration_since_epoch) {
2929         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
2930         int64_t duration_since_epoch_conv = duration_since_epoch;
2931         js_invoke_function_void_l(j_calls->instance_ptr, 21, duration_since_epoch_conv);
2932 }
2933 static void LDKScoreUpdate_JCalls_cloned(LDKScoreUpdate* new_obj) {
2934         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) new_obj->this_arg;
2935         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2936 }
2937 static inline LDKScoreUpdate LDKScoreUpdate_init (int64_t o) {
2938         LDKScoreUpdate_JCalls *calls = MALLOC(sizeof(LDKScoreUpdate_JCalls), "LDKScoreUpdate_JCalls");
2939         atomic_init(&calls->refcnt, 1);
2940         calls->instance_ptr = o;
2941
2942         LDKScoreUpdate ret = {
2943                 .this_arg = (void*) calls,
2944                 .payment_path_failed = payment_path_failed_LDKScoreUpdate_jcall,
2945                 .payment_path_successful = payment_path_successful_LDKScoreUpdate_jcall,
2946                 .probe_failed = probe_failed_LDKScoreUpdate_jcall,
2947                 .probe_successful = probe_successful_LDKScoreUpdate_jcall,
2948                 .time_passed = time_passed_LDKScoreUpdate_jcall,
2949                 .free = LDKScoreUpdate_JCalls_free,
2950         };
2951         return ret;
2952 }
2953 uint64_t  CS_LDK_LDKScoreUpdate_new(int32_t o) {
2954         LDKScoreUpdate *res_ptr = MALLOC(sizeof(LDKScoreUpdate), "LDKScoreUpdate");
2955         *res_ptr = LDKScoreUpdate_init(o);
2956         return tag_ptr(res_ptr, true);
2957 }
2958 void  CS_LDK_ScoreUpdate_payment_path_failed(int64_t this_arg, int64_t path, int64_t short_channel_id, int64_t duration_since_epoch) {
2959         void* this_arg_ptr = untag_ptr(this_arg);
2960         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2961         LDKScoreUpdate* this_arg_conv = (LDKScoreUpdate*)this_arg_ptr;
2962         LDKPath path_conv;
2963         path_conv.inner = untag_ptr(path);
2964         path_conv.is_owned = ptr_is_owned(path);
2965         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
2966         path_conv.is_owned = false;
2967         (this_arg_conv->payment_path_failed)(this_arg_conv->this_arg, &path_conv, short_channel_id, duration_since_epoch);
2968 }
2969
2970 void  CS_LDK_ScoreUpdate_payment_path_successful(int64_t this_arg, int64_t path, int64_t duration_since_epoch) {
2971         void* this_arg_ptr = untag_ptr(this_arg);
2972         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2973         LDKScoreUpdate* this_arg_conv = (LDKScoreUpdate*)this_arg_ptr;
2974         LDKPath path_conv;
2975         path_conv.inner = untag_ptr(path);
2976         path_conv.is_owned = ptr_is_owned(path);
2977         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
2978         path_conv.is_owned = false;
2979         (this_arg_conv->payment_path_successful)(this_arg_conv->this_arg, &path_conv, duration_since_epoch);
2980 }
2981
2982 void  CS_LDK_ScoreUpdate_probe_failed(int64_t this_arg, int64_t path, int64_t short_channel_id, int64_t duration_since_epoch) {
2983         void* this_arg_ptr = untag_ptr(this_arg);
2984         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2985         LDKScoreUpdate* this_arg_conv = (LDKScoreUpdate*)this_arg_ptr;
2986         LDKPath path_conv;
2987         path_conv.inner = untag_ptr(path);
2988         path_conv.is_owned = ptr_is_owned(path);
2989         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
2990         path_conv.is_owned = false;
2991         (this_arg_conv->probe_failed)(this_arg_conv->this_arg, &path_conv, short_channel_id, duration_since_epoch);
2992 }
2993
2994 void  CS_LDK_ScoreUpdate_probe_successful(int64_t this_arg, int64_t path, int64_t duration_since_epoch) {
2995         void* this_arg_ptr = untag_ptr(this_arg);
2996         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2997         LDKScoreUpdate* this_arg_conv = (LDKScoreUpdate*)this_arg_ptr;
2998         LDKPath path_conv;
2999         path_conv.inner = untag_ptr(path);
3000         path_conv.is_owned = ptr_is_owned(path);
3001         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
3002         path_conv.is_owned = false;
3003         (this_arg_conv->probe_successful)(this_arg_conv->this_arg, &path_conv, duration_since_epoch);
3004 }
3005
3006 void  CS_LDK_ScoreUpdate_time_passed(int64_t this_arg, int64_t duration_since_epoch) {
3007         void* this_arg_ptr = untag_ptr(this_arg);
3008         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3009         LDKScoreUpdate* this_arg_conv = (LDKScoreUpdate*)this_arg_ptr;
3010         (this_arg_conv->time_passed)(this_arg_conv->this_arg, duration_since_epoch);
3011 }
3012
3013 typedef struct LDKLockableScore_JCalls {
3014         atomic_size_t refcnt;
3015         uint32_t instance_ptr;
3016 } LDKLockableScore_JCalls;
3017 static void LDKLockableScore_JCalls_free(void* this_arg) {
3018         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
3019         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3020                 FREE(j_calls);
3021         }
3022 }
3023 LDKScoreLookUp read_lock_LDKLockableScore_jcall(const void* this_arg) {
3024         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
3025         uint64_t ret = js_invoke_function_l_(j_calls->instance_ptr, 22);
3026         void* ret_ptr = untag_ptr(ret);
3027         CHECK_ACCESS(ret_ptr);
3028         LDKScoreLookUp ret_conv = *(LDKScoreLookUp*)(ret_ptr);
3029         if (ret_conv.free == LDKScoreLookUp_JCalls_free) {
3030                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
3031                 LDKScoreLookUp_JCalls_cloned(&ret_conv);
3032         }// WARNING: we may need a move here but no clone is available for LDKScoreLookUp
3033         
3034         return ret_conv;
3035 }
3036 LDKScoreUpdate write_lock_LDKLockableScore_jcall(const void* this_arg) {
3037         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
3038         uint64_t ret = js_invoke_function_l_(j_calls->instance_ptr, 23);
3039         void* ret_ptr = untag_ptr(ret);
3040         CHECK_ACCESS(ret_ptr);
3041         LDKScoreUpdate ret_conv = *(LDKScoreUpdate*)(ret_ptr);
3042         if (ret_conv.free == LDKScoreUpdate_JCalls_free) {
3043                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
3044                 LDKScoreUpdate_JCalls_cloned(&ret_conv);
3045         }// WARNING: we may need a move here but no clone is available for LDKScoreUpdate
3046         
3047         return ret_conv;
3048 }
3049 static void LDKLockableScore_JCalls_cloned(LDKLockableScore* new_obj) {
3050         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) new_obj->this_arg;
3051         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3052 }
3053 static inline LDKLockableScore LDKLockableScore_init (int64_t o) {
3054         LDKLockableScore_JCalls *calls = MALLOC(sizeof(LDKLockableScore_JCalls), "LDKLockableScore_JCalls");
3055         atomic_init(&calls->refcnt, 1);
3056         calls->instance_ptr = o;
3057
3058         LDKLockableScore ret = {
3059                 .this_arg = (void*) calls,
3060                 .read_lock = read_lock_LDKLockableScore_jcall,
3061                 .write_lock = write_lock_LDKLockableScore_jcall,
3062                 .free = LDKLockableScore_JCalls_free,
3063         };
3064         return ret;
3065 }
3066 uint64_t  CS_LDK_LDKLockableScore_new(int32_t o) {
3067         LDKLockableScore *res_ptr = MALLOC(sizeof(LDKLockableScore), "LDKLockableScore");
3068         *res_ptr = LDKLockableScore_init(o);
3069         return tag_ptr(res_ptr, true);
3070 }
3071 int64_t  CS_LDK_LockableScore_read_lock(int64_t this_arg) {
3072         void* this_arg_ptr = untag_ptr(this_arg);
3073         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3074         LDKLockableScore* this_arg_conv = (LDKLockableScore*)this_arg_ptr;
3075         LDKScoreLookUp* ret_ret = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
3076         *ret_ret = (this_arg_conv->read_lock)(this_arg_conv->this_arg);
3077         return tag_ptr(ret_ret, true);
3078 }
3079
3080 int64_t  CS_LDK_LockableScore_write_lock(int64_t this_arg) {
3081         void* this_arg_ptr = untag_ptr(this_arg);
3082         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3083         LDKLockableScore* this_arg_conv = (LDKLockableScore*)this_arg_ptr;
3084         LDKScoreUpdate* ret_ret = MALLOC(sizeof(LDKScoreUpdate), "LDKScoreUpdate");
3085         *ret_ret = (this_arg_conv->write_lock)(this_arg_conv->this_arg);
3086         return tag_ptr(ret_ret, true);
3087 }
3088
3089 typedef struct LDKWriteableScore_JCalls {
3090         atomic_size_t refcnt;
3091         uint32_t instance_ptr;
3092         LDKLockableScore_JCalls* LockableScore;
3093 } LDKWriteableScore_JCalls;
3094 static void LDKWriteableScore_JCalls_free(void* this_arg) {
3095         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) this_arg;
3096         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3097                 FREE(j_calls);
3098         }
3099 }
3100 LDKCVec_u8Z write_LDKWriteableScore_jcall(const void* this_arg) {
3101         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) this_arg;
3102         int8_tArray ret = (int8_tArray)js_invoke_function_l_(j_calls->instance_ptr, 24);
3103         LDKCVec_u8Z ret_ref;
3104         ret_ref.datalen = ret->arr_len;
3105         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
3106         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
3107         return ret_ref;
3108 }
3109 static void LDKWriteableScore_JCalls_cloned(LDKWriteableScore* new_obj) {
3110         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) new_obj->this_arg;
3111         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3112         atomic_fetch_add_explicit(&j_calls->LockableScore->refcnt, 1, memory_order_release);
3113 }
3114 static inline LDKWriteableScore LDKWriteableScore_init (int64_t o, int64_t LockableScore) {
3115         LDKWriteableScore_JCalls *calls = MALLOC(sizeof(LDKWriteableScore_JCalls), "LDKWriteableScore_JCalls");
3116         atomic_init(&calls->refcnt, 1);
3117         calls->instance_ptr = o;
3118
3119         LDKWriteableScore ret = {
3120                 .this_arg = (void*) calls,
3121                 .write = write_LDKWriteableScore_jcall,
3122                 .free = LDKWriteableScore_JCalls_free,
3123                 .LockableScore = LDKLockableScore_init(LockableScore),
3124         };
3125         calls->LockableScore = ret.LockableScore.this_arg;
3126         return ret;
3127 }
3128 uint64_t  CS_LDK_LDKWriteableScore_new(int32_t o, int32_t LockableScore) {
3129         LDKWriteableScore *res_ptr = MALLOC(sizeof(LDKWriteableScore), "LDKWriteableScore");
3130         *res_ptr = LDKWriteableScore_init(o, LockableScore);
3131         return tag_ptr(res_ptr, true);
3132 }
3133 int8_tArray  CS_LDK_WriteableScore_write(int64_t this_arg) {
3134         void* this_arg_ptr = untag_ptr(this_arg);
3135         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3136         LDKWriteableScore* this_arg_conv = (LDKWriteableScore*)this_arg_ptr;
3137         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
3138         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
3139         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
3140         CVec_u8Z_free(ret_var);
3141         return ret_arr;
3142 }
3143
3144 uint32_t CS_LDK_LDKCOption_WriteableScoreZ_ty_from_ptr(int64_t ptr) {
3145         LDKCOption_WriteableScoreZ *obj = (LDKCOption_WriteableScoreZ*)untag_ptr(ptr);
3146         switch(obj->tag) {
3147                 case LDKCOption_WriteableScoreZ_Some: return 0;
3148                 case LDKCOption_WriteableScoreZ_None: return 1;
3149                 default: abort();
3150         }
3151 }
3152 int64_t CS_LDK_LDKCOption_WriteableScoreZ_Some_get_some(int64_t ptr) {
3153         LDKCOption_WriteableScoreZ *obj = (LDKCOption_WriteableScoreZ*)untag_ptr(ptr);
3154         CHECK(obj->tag == LDKCOption_WriteableScoreZ_Some);
3155         LDKWriteableScore* some_ret = MALLOC(sizeof(LDKWriteableScore), "LDKWriteableScore");
3156         *some_ret = obj->some;
3157                         // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
3158                         if ((*some_ret).free == LDKWriteableScore_JCalls_free) {
3159                                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
3160                                 LDKWriteableScore_JCalls_cloned(&(*some_ret));
3161                         }
3162         return tag_ptr(some_ret, true);
3163 }
3164 static inline void CResult_NoneIOErrorZ_get_ok(LDKCResult_NoneIOErrorZ *NONNULL_PTR owner){
3165 CHECK(owner->result_ok);
3166         return *owner->contents.result;
3167 }
3168 void  CS_LDK_CResult_NoneIOErrorZ_get_ok(int64_t owner) {
3169         LDKCResult_NoneIOErrorZ* owner_conv = (LDKCResult_NoneIOErrorZ*)untag_ptr(owner);
3170         CResult_NoneIOErrorZ_get_ok(owner_conv);
3171 }
3172
3173 static inline enum LDKIOError CResult_NoneIOErrorZ_get_err(LDKCResult_NoneIOErrorZ *NONNULL_PTR owner){
3174 CHECK(!owner->result_ok);
3175         return *owner->contents.err;
3176 }
3177 int32_t  CS_LDK_CResult_NoneIOErrorZ_get_err(int64_t owner) {
3178         LDKCResult_NoneIOErrorZ* owner_conv = (LDKCResult_NoneIOErrorZ*)untag_ptr(owner);
3179         int32_t ret_conv = LDKIOError_to_cs(CResult_NoneIOErrorZ_get_err(owner_conv));
3180         return ret_conv;
3181 }
3182
3183 static inline LDKCVec_ChannelDetailsZ CVec_ChannelDetailsZ_clone(const LDKCVec_ChannelDetailsZ *orig) {
3184         LDKCVec_ChannelDetailsZ ret = { .data = MALLOC(sizeof(LDKChannelDetails) * orig->datalen, "LDKCVec_ChannelDetailsZ clone bytes"), .datalen = orig->datalen };
3185         for (size_t i = 0; i < ret.datalen; i++) {
3186                 ret.data[i] = ChannelDetails_clone(&orig->data[i]);
3187         }
3188         return ret;
3189 }
3190 static inline struct LDKRoute CResult_RouteLightningErrorZ_get_ok(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
3191         LDKRoute ret = *owner->contents.result;
3192         ret.is_owned = false;
3193         return ret;
3194 }
3195 int64_t  CS_LDK_CResult_RouteLightningErrorZ_get_ok(int64_t owner) {
3196         LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(owner);
3197         LDKRoute ret_var = CResult_RouteLightningErrorZ_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 LDKLightningError CResult_RouteLightningErrorZ_get_err(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
3205         LDKLightningError ret = *owner->contents.err;
3206         ret.is_owned = false;
3207         return ret;
3208 }
3209 int64_t  CS_LDK_CResult_RouteLightningErrorZ_get_err(int64_t owner) {
3210         LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(owner);
3211         LDKLightningError ret_var = CResult_RouteLightningErrorZ_get_err(owner_conv);
3212         int64_t ret_ref = 0;
3213         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3214         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3215         return ret_ref;
3216 }
3217
3218 static inline struct LDKBlindedPayInfo C2Tuple_BlindedPayInfoBlindedPathZ_get_a(LDKC2Tuple_BlindedPayInfoBlindedPathZ *NONNULL_PTR owner){
3219         LDKBlindedPayInfo ret = owner->a;
3220         ret.is_owned = false;
3221         return ret;
3222 }
3223 int64_t  CS_LDK_C2Tuple_BlindedPayInfoBlindedPathZ_get_a(int64_t owner) {
3224         LDKC2Tuple_BlindedPayInfoBlindedPathZ* owner_conv = (LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(owner);
3225         LDKBlindedPayInfo ret_var = C2Tuple_BlindedPayInfoBlindedPathZ_get_a(owner_conv);
3226         int64_t ret_ref = 0;
3227         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3228         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3229         return ret_ref;
3230 }
3231
3232 static inline struct LDKBlindedPath C2Tuple_BlindedPayInfoBlindedPathZ_get_b(LDKC2Tuple_BlindedPayInfoBlindedPathZ *NONNULL_PTR owner){
3233         LDKBlindedPath ret = owner->b;
3234         ret.is_owned = false;
3235         return ret;
3236 }
3237 int64_t  CS_LDK_C2Tuple_BlindedPayInfoBlindedPathZ_get_b(int64_t owner) {
3238         LDKC2Tuple_BlindedPayInfoBlindedPathZ* owner_conv = (LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(owner);
3239         LDKBlindedPath ret_var = C2Tuple_BlindedPayInfoBlindedPathZ_get_b(owner_conv);
3240         int64_t ret_ref = 0;
3241         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3242         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3243         return ret_ref;
3244 }
3245
3246 static inline LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_clone(const LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ *orig) {
3247         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ) * orig->datalen, "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ clone bytes"), .datalen = orig->datalen };
3248         for (size_t i = 0; i < ret.datalen; i++) {
3249                 ret.data[i] = C2Tuple_BlindedPayInfoBlindedPathZ_clone(&orig->data[i]);
3250         }
3251         return ret;
3252 }
3253 static inline struct LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_get_ok(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ *NONNULL_PTR owner){
3254 CHECK(owner->result_ok);
3255         return CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_clone(&*owner->contents.result);
3256 }
3257 int64_tArray  CS_LDK_CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_get_ok(int64_t owner) {
3258         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* owner_conv = (LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ*)untag_ptr(owner);
3259         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ ret_var = CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_get_ok(owner_conv);
3260         int64_tArray ret_arr = NULL;
3261         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
3262         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
3263         for (size_t l = 0; l < ret_var.datalen; l++) {
3264                 LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv_37_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
3265                 *ret_conv_37_conv = ret_var.data[l];
3266                 ret_arr_ptr[l] = tag_ptr(ret_conv_37_conv, true);
3267         }
3268         
3269         FREE(ret_var.data);
3270         return ret_arr;
3271 }
3272
3273 static inline void CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_get_err(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ *NONNULL_PTR owner){
3274 CHECK(!owner->result_ok);
3275         return *owner->contents.err;
3276 }
3277 void  CS_LDK_CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_get_err(int64_t owner) {
3278         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* owner_conv = (LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ*)untag_ptr(owner);
3279         CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_get_err(owner_conv);
3280 }
3281
3282 static inline struct LDKOnionMessagePath CResult_OnionMessagePathNoneZ_get_ok(LDKCResult_OnionMessagePathNoneZ *NONNULL_PTR owner){
3283         LDKOnionMessagePath ret = *owner->contents.result;
3284         ret.is_owned = false;
3285         return ret;
3286 }
3287 int64_t  CS_LDK_CResult_OnionMessagePathNoneZ_get_ok(int64_t owner) {
3288         LDKCResult_OnionMessagePathNoneZ* owner_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(owner);
3289         LDKOnionMessagePath ret_var = CResult_OnionMessagePathNoneZ_get_ok(owner_conv);
3290         int64_t ret_ref = 0;
3291         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3292         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3293         return ret_ref;
3294 }
3295
3296 static inline void CResult_OnionMessagePathNoneZ_get_err(LDKCResult_OnionMessagePathNoneZ *NONNULL_PTR owner){
3297 CHECK(!owner->result_ok);
3298         return *owner->contents.err;
3299 }
3300 void  CS_LDK_CResult_OnionMessagePathNoneZ_get_err(int64_t owner) {
3301         LDKCResult_OnionMessagePathNoneZ* owner_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(owner);
3302         CResult_OnionMessagePathNoneZ_get_err(owner_conv);
3303 }
3304
3305 static inline struct LDKCVec_BlindedPathZ CResult_CVec_BlindedPathZNoneZ_get_ok(LDKCResult_CVec_BlindedPathZNoneZ *NONNULL_PTR owner){
3306 CHECK(owner->result_ok);
3307         return CVec_BlindedPathZ_clone(&*owner->contents.result);
3308 }
3309 int64_tArray  CS_LDK_CResult_CVec_BlindedPathZNoneZ_get_ok(int64_t owner) {
3310         LDKCResult_CVec_BlindedPathZNoneZ* owner_conv = (LDKCResult_CVec_BlindedPathZNoneZ*)untag_ptr(owner);
3311         LDKCVec_BlindedPathZ ret_var = CResult_CVec_BlindedPathZNoneZ_get_ok(owner_conv);
3312         int64_tArray ret_arr = NULL;
3313         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
3314         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
3315         for (size_t n = 0; n < ret_var.datalen; n++) {
3316                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
3317                 int64_t ret_conv_13_ref = 0;
3318                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
3319                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
3320                 ret_arr_ptr[n] = ret_conv_13_ref;
3321         }
3322         
3323         FREE(ret_var.data);
3324         return ret_arr;
3325 }
3326
3327 static inline void CResult_CVec_BlindedPathZNoneZ_get_err(LDKCResult_CVec_BlindedPathZNoneZ *NONNULL_PTR owner){
3328 CHECK(!owner->result_ok);
3329         return *owner->contents.err;
3330 }
3331 void  CS_LDK_CResult_CVec_BlindedPathZNoneZ_get_err(int64_t owner) {
3332         LDKCResult_CVec_BlindedPathZNoneZ* owner_conv = (LDKCResult_CVec_BlindedPathZNoneZ*)untag_ptr(owner);
3333         CResult_CVec_BlindedPathZNoneZ_get_err(owner_conv);
3334 }
3335
3336 static inline struct LDKInFlightHtlcs CResult_InFlightHtlcsDecodeErrorZ_get_ok(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR owner){
3337         LDKInFlightHtlcs ret = *owner->contents.result;
3338         ret.is_owned = false;
3339         return ret;
3340 }
3341 int64_t  CS_LDK_CResult_InFlightHtlcsDecodeErrorZ_get_ok(int64_t owner) {
3342         LDKCResult_InFlightHtlcsDecodeErrorZ* owner_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(owner);
3343         LDKInFlightHtlcs ret_var = CResult_InFlightHtlcsDecodeErrorZ_get_ok(owner_conv);
3344         int64_t ret_ref = 0;
3345         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3346         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3347         return ret_ref;
3348 }
3349
3350 static inline struct LDKDecodeError CResult_InFlightHtlcsDecodeErrorZ_get_err(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR owner){
3351 CHECK(!owner->result_ok);
3352         return DecodeError_clone(&*owner->contents.err);
3353 }
3354 int64_t  CS_LDK_CResult_InFlightHtlcsDecodeErrorZ_get_err(int64_t owner) {
3355         LDKCResult_InFlightHtlcsDecodeErrorZ* owner_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(owner);
3356         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3357         *ret_copy = CResult_InFlightHtlcsDecodeErrorZ_get_err(owner_conv);
3358         int64_t ret_ref = tag_ptr(ret_copy, true);
3359         return ret_ref;
3360 }
3361
3362 static inline struct LDKRouteHop CResult_RouteHopDecodeErrorZ_get_ok(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
3363         LDKRouteHop ret = *owner->contents.result;
3364         ret.is_owned = false;
3365         return ret;
3366 }
3367 int64_t  CS_LDK_CResult_RouteHopDecodeErrorZ_get_ok(int64_t owner) {
3368         LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(owner);
3369         LDKRouteHop ret_var = CResult_RouteHopDecodeErrorZ_get_ok(owner_conv);
3370         int64_t ret_ref = 0;
3371         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3372         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3373         return ret_ref;
3374 }
3375
3376 static inline struct LDKDecodeError CResult_RouteHopDecodeErrorZ_get_err(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
3377 CHECK(!owner->result_ok);
3378         return DecodeError_clone(&*owner->contents.err);
3379 }
3380 int64_t  CS_LDK_CResult_RouteHopDecodeErrorZ_get_err(int64_t owner) {
3381         LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(owner);
3382         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3383         *ret_copy = CResult_RouteHopDecodeErrorZ_get_err(owner_conv);
3384         int64_t ret_ref = tag_ptr(ret_copy, true);
3385         return ret_ref;
3386 }
3387
3388 static inline LDKCVec_BlindedHopZ CVec_BlindedHopZ_clone(const LDKCVec_BlindedHopZ *orig) {
3389         LDKCVec_BlindedHopZ ret = { .data = MALLOC(sizeof(LDKBlindedHop) * orig->datalen, "LDKCVec_BlindedHopZ clone bytes"), .datalen = orig->datalen };
3390         for (size_t i = 0; i < ret.datalen; i++) {
3391                 ret.data[i] = BlindedHop_clone(&orig->data[i]);
3392         }
3393         return ret;
3394 }
3395 static inline struct LDKBlindedTail CResult_BlindedTailDecodeErrorZ_get_ok(LDKCResult_BlindedTailDecodeErrorZ *NONNULL_PTR owner){
3396         LDKBlindedTail ret = *owner->contents.result;
3397         ret.is_owned = false;
3398         return ret;
3399 }
3400 int64_t  CS_LDK_CResult_BlindedTailDecodeErrorZ_get_ok(int64_t owner) {
3401         LDKCResult_BlindedTailDecodeErrorZ* owner_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(owner);
3402         LDKBlindedTail ret_var = CResult_BlindedTailDecodeErrorZ_get_ok(owner_conv);
3403         int64_t ret_ref = 0;
3404         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3405         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3406         return ret_ref;
3407 }
3408
3409 static inline struct LDKDecodeError CResult_BlindedTailDecodeErrorZ_get_err(LDKCResult_BlindedTailDecodeErrorZ *NONNULL_PTR owner){
3410 CHECK(!owner->result_ok);
3411         return DecodeError_clone(&*owner->contents.err);
3412 }
3413 int64_t  CS_LDK_CResult_BlindedTailDecodeErrorZ_get_err(int64_t owner) {
3414         LDKCResult_BlindedTailDecodeErrorZ* owner_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(owner);
3415         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3416         *ret_copy = CResult_BlindedTailDecodeErrorZ_get_err(owner_conv);
3417         int64_t ret_ref = tag_ptr(ret_copy, true);
3418         return ret_ref;
3419 }
3420
3421 static inline LDKCVec_RouteHopZ CVec_RouteHopZ_clone(const LDKCVec_RouteHopZ *orig) {
3422         LDKCVec_RouteHopZ ret = { .data = MALLOC(sizeof(LDKRouteHop) * orig->datalen, "LDKCVec_RouteHopZ clone bytes"), .datalen = orig->datalen };
3423         for (size_t i = 0; i < ret.datalen; i++) {
3424                 ret.data[i] = RouteHop_clone(&orig->data[i]);
3425         }
3426         return ret;
3427 }
3428 static inline LDKCVec_PathZ CVec_PathZ_clone(const LDKCVec_PathZ *orig) {
3429         LDKCVec_PathZ ret = { .data = MALLOC(sizeof(LDKPath) * orig->datalen, "LDKCVec_PathZ clone bytes"), .datalen = orig->datalen };
3430         for (size_t i = 0; i < ret.datalen; i++) {
3431                 ret.data[i] = Path_clone(&orig->data[i]);
3432         }
3433         return ret;
3434 }
3435 static inline struct LDKRoute CResult_RouteDecodeErrorZ_get_ok(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
3436         LDKRoute ret = *owner->contents.result;
3437         ret.is_owned = false;
3438         return ret;
3439 }
3440 int64_t  CS_LDK_CResult_RouteDecodeErrorZ_get_ok(int64_t owner) {
3441         LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(owner);
3442         LDKRoute ret_var = CResult_RouteDecodeErrorZ_get_ok(owner_conv);
3443         int64_t ret_ref = 0;
3444         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3445         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3446         return ret_ref;
3447 }
3448
3449 static inline struct LDKDecodeError CResult_RouteDecodeErrorZ_get_err(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
3450 CHECK(!owner->result_ok);
3451         return DecodeError_clone(&*owner->contents.err);
3452 }
3453 int64_t  CS_LDK_CResult_RouteDecodeErrorZ_get_err(int64_t owner) {
3454         LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(owner);
3455         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3456         *ret_copy = CResult_RouteDecodeErrorZ_get_err(owner_conv);
3457         int64_t ret_ref = tag_ptr(ret_copy, true);
3458         return ret_ref;
3459 }
3460
3461 static inline struct LDKRouteParameters CResult_RouteParametersDecodeErrorZ_get_ok(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
3462         LDKRouteParameters ret = *owner->contents.result;
3463         ret.is_owned = false;
3464         return ret;
3465 }
3466 int64_t  CS_LDK_CResult_RouteParametersDecodeErrorZ_get_ok(int64_t owner) {
3467         LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(owner);
3468         LDKRouteParameters ret_var = CResult_RouteParametersDecodeErrorZ_get_ok(owner_conv);
3469         int64_t ret_ref = 0;
3470         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3471         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3472         return ret_ref;
3473 }
3474
3475 static inline struct LDKDecodeError CResult_RouteParametersDecodeErrorZ_get_err(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
3476 CHECK(!owner->result_ok);
3477         return DecodeError_clone(&*owner->contents.err);
3478 }
3479 int64_t  CS_LDK_CResult_RouteParametersDecodeErrorZ_get_err(int64_t owner) {
3480         LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(owner);
3481         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3482         *ret_copy = CResult_RouteParametersDecodeErrorZ_get_err(owner_conv);
3483         int64_t ret_ref = tag_ptr(ret_copy, true);
3484         return ret_ref;
3485 }
3486
3487 static inline LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) {
3488         LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen };
3489         memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen);
3490         return ret;
3491 }
3492 static inline struct LDKPaymentParameters CResult_PaymentParametersDecodeErrorZ_get_ok(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){
3493         LDKPaymentParameters ret = *owner->contents.result;
3494         ret.is_owned = false;
3495         return ret;
3496 }
3497 int64_t  CS_LDK_CResult_PaymentParametersDecodeErrorZ_get_ok(int64_t owner) {
3498         LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(owner);
3499         LDKPaymentParameters ret_var = CResult_PaymentParametersDecodeErrorZ_get_ok(owner_conv);
3500         int64_t ret_ref = 0;
3501         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3502         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3503         return ret_ref;
3504 }
3505
3506 static inline struct LDKDecodeError CResult_PaymentParametersDecodeErrorZ_get_err(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){
3507 CHECK(!owner->result_ok);
3508         return DecodeError_clone(&*owner->contents.err);
3509 }
3510 int64_t  CS_LDK_CResult_PaymentParametersDecodeErrorZ_get_err(int64_t owner) {
3511         LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(owner);
3512         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3513         *ret_copy = CResult_PaymentParametersDecodeErrorZ_get_err(owner_conv);
3514         int64_t ret_ref = tag_ptr(ret_copy, true);
3515         return ret_ref;
3516 }
3517
3518 static inline LDKCVec_RouteHintZ CVec_RouteHintZ_clone(const LDKCVec_RouteHintZ *orig) {
3519         LDKCVec_RouteHintZ ret = { .data = MALLOC(sizeof(LDKRouteHint) * orig->datalen, "LDKCVec_RouteHintZ clone bytes"), .datalen = orig->datalen };
3520         for (size_t i = 0; i < ret.datalen; i++) {
3521                 ret.data[i] = RouteHint_clone(&orig->data[i]);
3522         }
3523         return ret;
3524 }
3525 static inline LDKCVec_RouteHintHopZ CVec_RouteHintHopZ_clone(const LDKCVec_RouteHintHopZ *orig) {
3526         LDKCVec_RouteHintHopZ ret = { .data = MALLOC(sizeof(LDKRouteHintHop) * orig->datalen, "LDKCVec_RouteHintHopZ clone bytes"), .datalen = orig->datalen };
3527         for (size_t i = 0; i < ret.datalen; i++) {
3528                 ret.data[i] = RouteHintHop_clone(&orig->data[i]);
3529         }
3530         return ret;
3531 }
3532 static inline struct LDKRouteHint CResult_RouteHintDecodeErrorZ_get_ok(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
3533         LDKRouteHint ret = *owner->contents.result;
3534         ret.is_owned = false;
3535         return ret;
3536 }
3537 int64_t  CS_LDK_CResult_RouteHintDecodeErrorZ_get_ok(int64_t owner) {
3538         LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(owner);
3539         LDKRouteHint ret_var = CResult_RouteHintDecodeErrorZ_get_ok(owner_conv);
3540         int64_t ret_ref = 0;
3541         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3542         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3543         return ret_ref;
3544 }
3545
3546 static inline struct LDKDecodeError CResult_RouteHintDecodeErrorZ_get_err(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
3547 CHECK(!owner->result_ok);
3548         return DecodeError_clone(&*owner->contents.err);
3549 }
3550 int64_t  CS_LDK_CResult_RouteHintDecodeErrorZ_get_err(int64_t owner) {
3551         LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(owner);
3552         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3553         *ret_copy = CResult_RouteHintDecodeErrorZ_get_err(owner_conv);
3554         int64_t ret_ref = tag_ptr(ret_copy, true);
3555         return ret_ref;
3556 }
3557
3558 static inline struct LDKRouteHintHop CResult_RouteHintHopDecodeErrorZ_get_ok(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
3559         LDKRouteHintHop ret = *owner->contents.result;
3560         ret.is_owned = false;
3561         return ret;
3562 }
3563 int64_t  CS_LDK_CResult_RouteHintHopDecodeErrorZ_get_ok(int64_t owner) {
3564         LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(owner);
3565         LDKRouteHintHop ret_var = CResult_RouteHintHopDecodeErrorZ_get_ok(owner_conv);
3566         int64_t ret_ref = 0;
3567         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3568         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3569         return ret_ref;
3570 }
3571
3572 static inline struct LDKDecodeError CResult_RouteHintHopDecodeErrorZ_get_err(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
3573 CHECK(!owner->result_ok);
3574         return DecodeError_clone(&*owner->contents.err);
3575 }
3576 int64_t  CS_LDK_CResult_RouteHintHopDecodeErrorZ_get_err(int64_t owner) {
3577         LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(owner);
3578         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3579         *ret_copy = CResult_RouteHintHopDecodeErrorZ_get_err(owner_conv);
3580         int64_t ret_ref = tag_ptr(ret_copy, true);
3581         return ret_ref;
3582 }
3583
3584 static inline struct LDKFixedPenaltyScorer CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){
3585         LDKFixedPenaltyScorer ret = *owner->contents.result;
3586         ret.is_owned = false;
3587         return ret;
3588 }
3589 int64_t  CS_LDK_CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(int64_t owner) {
3590         LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(owner);
3591         LDKFixedPenaltyScorer ret_var = CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(owner_conv);
3592         int64_t ret_ref = 0;
3593         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3594         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3595         return ret_ref;
3596 }
3597
3598 static inline struct LDKDecodeError CResult_FixedPenaltyScorerDecodeErrorZ_get_err(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){
3599 CHECK(!owner->result_ok);
3600         return DecodeError_clone(&*owner->contents.err);
3601 }
3602 int64_t  CS_LDK_CResult_FixedPenaltyScorerDecodeErrorZ_get_err(int64_t owner) {
3603         LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(owner);
3604         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3605         *ret_copy = CResult_FixedPenaltyScorerDecodeErrorZ_get_err(owner_conv);
3606         int64_t ret_ref = tag_ptr(ret_copy, true);
3607         return ret_ref;
3608 }
3609
3610 static inline LDKCVec_NodeIdZ CVec_NodeIdZ_clone(const LDKCVec_NodeIdZ *orig) {
3611         LDKCVec_NodeIdZ ret = { .data = MALLOC(sizeof(LDKNodeId) * orig->datalen, "LDKCVec_NodeIdZ clone bytes"), .datalen = orig->datalen };
3612         for (size_t i = 0; i < ret.datalen; i++) {
3613                 ret.data[i] = NodeId_clone(&orig->data[i]);
3614         }
3615         return ret;
3616 }
3617 static inline uint64_t C2Tuple_u64u64Z_get_a(LDKC2Tuple_u64u64Z *NONNULL_PTR owner){
3618         return owner->a;
3619 }
3620 int64_t  CS_LDK_C2Tuple_u64u64Z_get_a(int64_t owner) {
3621         LDKC2Tuple_u64u64Z* owner_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(owner);
3622         int64_t ret_conv = C2Tuple_u64u64Z_get_a(owner_conv);
3623         return ret_conv;
3624 }
3625
3626 static inline uint64_t C2Tuple_u64u64Z_get_b(LDKC2Tuple_u64u64Z *NONNULL_PTR owner){
3627         return owner->b;
3628 }
3629 int64_t  CS_LDK_C2Tuple_u64u64Z_get_b(int64_t owner) {
3630         LDKC2Tuple_u64u64Z* owner_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(owner);
3631         int64_t ret_conv = C2Tuple_u64u64Z_get_b(owner_conv);
3632         return ret_conv;
3633 }
3634
3635 uint32_t CS_LDK_LDKCOption_C2Tuple_u64u64ZZ_ty_from_ptr(int64_t ptr) {
3636         LDKCOption_C2Tuple_u64u64ZZ *obj = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(ptr);
3637         switch(obj->tag) {
3638                 case LDKCOption_C2Tuple_u64u64ZZ_Some: return 0;
3639                 case LDKCOption_C2Tuple_u64u64ZZ_None: return 1;
3640                 default: abort();
3641         }
3642 }
3643 int64_t CS_LDK_LDKCOption_C2Tuple_u64u64ZZ_Some_get_some(int64_t ptr) {
3644         LDKCOption_C2Tuple_u64u64ZZ *obj = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(ptr);
3645         CHECK(obj->tag == LDKCOption_C2Tuple_u64u64ZZ_Some);
3646         LDKC2Tuple_u64u64Z* some_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
3647         *some_conv = obj->some;
3648                         *some_conv = C2Tuple_u64u64Z_clone(some_conv);
3649         return tag_ptr(some_conv, true);
3650 }
3651 static inline struct LDKThirtyTwoU16s C2Tuple_Z_get_a(LDKC2Tuple_Z *NONNULL_PTR owner){
3652         return owner->a;
3653 }
3654 int16_tArray  CS_LDK_C2Tuple_Z_get_a(int64_t owner) {
3655         LDKC2Tuple_Z* owner_conv = (LDKC2Tuple_Z*)untag_ptr(owner);
3656         int16_tArray ret_arr = init_int16_tArray(32, __LINE__);
3657         memcpy(ret_arr->elems, C2Tuple_Z_get_a(owner_conv).data, 32 * 2);
3658         return ret_arr;
3659 }
3660
3661 static inline struct LDKThirtyTwoU16s C2Tuple_Z_get_b(LDKC2Tuple_Z *NONNULL_PTR owner){
3662         return owner->b;
3663 }
3664 int16_tArray  CS_LDK_C2Tuple_Z_get_b(int64_t owner) {
3665         LDKC2Tuple_Z* owner_conv = (LDKC2Tuple_Z*)untag_ptr(owner);
3666         int16_tArray ret_arr = init_int16_tArray(32, __LINE__);
3667         memcpy(ret_arr->elems, C2Tuple_Z_get_b(owner_conv).data, 32 * 2);
3668         return ret_arr;
3669 }
3670
3671 static inline struct LDKThirtyTwoU16s C2Tuple__u1632_u1632Z_get_a(LDKC2Tuple__u1632_u1632Z *NONNULL_PTR owner){
3672         return owner->a;
3673 }
3674 int16_tArray  CS_LDK_C2Tuple__u1632_u1632Z_get_a(int64_t owner) {
3675         LDKC2Tuple__u1632_u1632Z* owner_conv = (LDKC2Tuple__u1632_u1632Z*)untag_ptr(owner);
3676         int16_tArray ret_arr = init_int16_tArray(32, __LINE__);
3677         memcpy(ret_arr->elems, C2Tuple__u1632_u1632Z_get_a(owner_conv).data, 32 * 2);
3678         return ret_arr;
3679 }
3680
3681 static inline struct LDKThirtyTwoU16s C2Tuple__u1632_u1632Z_get_b(LDKC2Tuple__u1632_u1632Z *NONNULL_PTR owner){
3682         return owner->b;
3683 }
3684 int16_tArray  CS_LDK_C2Tuple__u1632_u1632Z_get_b(int64_t owner) {
3685         LDKC2Tuple__u1632_u1632Z* owner_conv = (LDKC2Tuple__u1632_u1632Z*)untag_ptr(owner);
3686         int16_tArray ret_arr = init_int16_tArray(32, __LINE__);
3687         memcpy(ret_arr->elems, C2Tuple__u1632_u1632Z_get_b(owner_conv).data, 32 * 2);
3688         return ret_arr;
3689 }
3690
3691 uint32_t CS_LDK_LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_ty_from_ptr(int64_t ptr) {
3692         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ *obj = (LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ*)untag_ptr(ptr);
3693         switch(obj->tag) {
3694                 case LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some: return 0;
3695                 case LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_None: return 1;
3696                 default: abort();
3697         }
3698 }
3699 int64_t CS_LDK_LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some_get_some(int64_t ptr) {
3700         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ *obj = (LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ*)untag_ptr(ptr);
3701         CHECK(obj->tag == LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some);
3702         LDKC2Tuple__u1632_u1632Z* some_conv = &obj->some;
3703                         // WARNING: we really need to clone here, but no clone is available for LDKC2Tuple__u1632_u1632Z
3704         return tag_ptr(some_conv, false);
3705 }
3706 uint32_t CS_LDK_LDKCOption_f64Z_ty_from_ptr(int64_t ptr) {
3707         LDKCOption_f64Z *obj = (LDKCOption_f64Z*)untag_ptr(ptr);
3708         switch(obj->tag) {
3709                 case LDKCOption_f64Z_Some: return 0;
3710                 case LDKCOption_f64Z_None: return 1;
3711                 default: abort();
3712         }
3713 }
3714 double CS_LDK_LDKCOption_f64Z_Some_get_some(int64_t ptr) {
3715         LDKCOption_f64Z *obj = (LDKCOption_f64Z*)untag_ptr(ptr);
3716         CHECK(obj->tag == LDKCOption_f64Z_Some);
3717         double some_conv = obj->some;
3718         return some_conv;
3719 }
3720 typedef struct LDKLogger_JCalls {
3721         atomic_size_t refcnt;
3722         uint32_t instance_ptr;
3723 } LDKLogger_JCalls;
3724 static void LDKLogger_JCalls_free(void* this_arg) {
3725         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
3726         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3727                 FREE(j_calls);
3728         }
3729 }
3730 void log_LDKLogger_jcall(const void* this_arg, LDKRecord record) {
3731         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
3732         LDKRecord record_var = record;
3733         int64_t record_ref = 0;
3734         CHECK_INNER_FIELD_ACCESS_OR_NULL(record_var);
3735         record_ref = tag_ptr(record_var.inner, record_var.is_owned);
3736         js_invoke_function_void_l(j_calls->instance_ptr, 25, record_ref);
3737 }
3738 static void LDKLogger_JCalls_cloned(LDKLogger* new_obj) {
3739         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) new_obj->this_arg;
3740         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3741 }
3742 static inline LDKLogger LDKLogger_init (int64_t o) {
3743         LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
3744         atomic_init(&calls->refcnt, 1);
3745         calls->instance_ptr = o;
3746
3747         LDKLogger ret = {
3748                 .this_arg = (void*) calls,
3749                 .log = log_LDKLogger_jcall,
3750                 .free = LDKLogger_JCalls_free,
3751         };
3752         return ret;
3753 }
3754 uint64_t  CS_LDK_LDKLogger_new(int32_t o) {
3755         LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
3756         *res_ptr = LDKLogger_init(o);
3757         return tag_ptr(res_ptr, true);
3758 }
3759 static inline struct LDKProbabilisticScorer CResult_ProbabilisticScorerDecodeErrorZ_get_ok(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){
3760         LDKProbabilisticScorer ret = *owner->contents.result;
3761         ret.is_owned = false;
3762         return ret;
3763 }
3764 int64_t  CS_LDK_CResult_ProbabilisticScorerDecodeErrorZ_get_ok(int64_t owner) {
3765         LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(owner);
3766         LDKProbabilisticScorer ret_var = CResult_ProbabilisticScorerDecodeErrorZ_get_ok(owner_conv);
3767         int64_t ret_ref = 0;
3768         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3769         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3770         return ret_ref;
3771 }
3772
3773 static inline struct LDKDecodeError CResult_ProbabilisticScorerDecodeErrorZ_get_err(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){
3774 CHECK(!owner->result_ok);
3775         return DecodeError_clone(&*owner->contents.err);
3776 }
3777 int64_t  CS_LDK_CResult_ProbabilisticScorerDecodeErrorZ_get_err(int64_t owner) {
3778         LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(owner);
3779         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3780         *ret_copy = CResult_ProbabilisticScorerDecodeErrorZ_get_err(owner_conv);
3781         int64_t ret_ref = tag_ptr(ret_copy, true);
3782         return ret_ref;
3783 }
3784
3785 static inline struct LDKBestBlock CResult_BestBlockDecodeErrorZ_get_ok(LDKCResult_BestBlockDecodeErrorZ *NONNULL_PTR owner){
3786         LDKBestBlock ret = *owner->contents.result;
3787         ret.is_owned = false;
3788         return ret;
3789 }
3790 int64_t  CS_LDK_CResult_BestBlockDecodeErrorZ_get_ok(int64_t owner) {
3791         LDKCResult_BestBlockDecodeErrorZ* owner_conv = (LDKCResult_BestBlockDecodeErrorZ*)untag_ptr(owner);
3792         LDKBestBlock ret_var = CResult_BestBlockDecodeErrorZ_get_ok(owner_conv);
3793         int64_t ret_ref = 0;
3794         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3795         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3796         return ret_ref;
3797 }
3798
3799 static inline struct LDKDecodeError CResult_BestBlockDecodeErrorZ_get_err(LDKCResult_BestBlockDecodeErrorZ *NONNULL_PTR owner){
3800 CHECK(!owner->result_ok);
3801         return DecodeError_clone(&*owner->contents.err);
3802 }
3803 int64_t  CS_LDK_CResult_BestBlockDecodeErrorZ_get_err(int64_t owner) {
3804         LDKCResult_BestBlockDecodeErrorZ* owner_conv = (LDKCResult_BestBlockDecodeErrorZ*)untag_ptr(owner);
3805         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3806         *ret_copy = CResult_BestBlockDecodeErrorZ_get_err(owner_conv);
3807         int64_t ret_ref = tag_ptr(ret_copy, true);
3808         return ret_ref;
3809 }
3810
3811 static inline uintptr_t C2Tuple_usizeTransactionZ_get_a(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
3812         return owner->a;
3813 }
3814 int64_t  CS_LDK_C2Tuple_usizeTransactionZ_get_a(int64_t owner) {
3815         LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(owner);
3816         int64_t ret_conv = C2Tuple_usizeTransactionZ_get_a(owner_conv);
3817         return ret_conv;
3818 }
3819
3820 static inline struct LDKTransaction C2Tuple_usizeTransactionZ_get_b(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
3821         return owner->b;
3822 }
3823 int8_tArray  CS_LDK_C2Tuple_usizeTransactionZ_get_b(int64_t owner) {
3824         LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(owner);
3825         LDKTransaction ret_var = C2Tuple_usizeTransactionZ_get_b(owner_conv);
3826         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
3827         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
3828         return ret_arr;
3829 }
3830
3831 static inline LDKCVec_C2Tuple_usizeTransactionZZ CVec_C2Tuple_usizeTransactionZZ_clone(const LDKCVec_C2Tuple_usizeTransactionZZ *orig) {
3832         LDKCVec_C2Tuple_usizeTransactionZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * orig->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ clone bytes"), .datalen = orig->datalen };
3833         for (size_t i = 0; i < ret.datalen; i++) {
3834                 ret.data[i] = C2Tuple_usizeTransactionZ_clone(&orig->data[i]);
3835         }
3836         return ret;
3837 }
3838 static inline struct LDKThirtyTwoBytes C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_a(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ *NONNULL_PTR owner){
3839         return ThirtyTwoBytes_clone(&owner->a);
3840 }
3841 int8_tArray  CS_LDK_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_a(int64_t owner) {
3842         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* owner_conv = (LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ*)untag_ptr(owner);
3843         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
3844         memcpy(ret_arr->elems, C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_a(owner_conv).data, 32);
3845         return ret_arr;
3846 }
3847
3848 static inline uint32_t C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_b(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ *NONNULL_PTR owner){
3849         return owner->b;
3850 }
3851 int32_t  CS_LDK_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_b(int64_t owner) {
3852         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* owner_conv = (LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ*)untag_ptr(owner);
3853         int32_t ret_conv = C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_b(owner_conv);
3854         return ret_conv;
3855 }
3856
3857 static inline struct LDKCOption_ThirtyTwoBytesZ C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_c(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ *NONNULL_PTR owner){
3858         return COption_ThirtyTwoBytesZ_clone(&owner->c);
3859 }
3860 int64_t  CS_LDK_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_c(int64_t owner) {
3861         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* owner_conv = (LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ*)untag_ptr(owner);
3862         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
3863         *ret_copy = C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_c(owner_conv);
3864         int64_t ret_ref = tag_ptr(ret_copy, true);
3865         return ret_ref;
3866 }
3867
3868 static inline LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ_clone(const LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ *orig) {
3869         LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ) * orig->datalen, "LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ clone bytes"), .datalen = orig->datalen };
3870         for (size_t i = 0; i < ret.datalen; i++) {
3871                 ret.data[i] = C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_clone(&orig->data[i]);
3872         }
3873         return ret;
3874 }
3875 static inline enum LDKChannelMonitorUpdateStatus CResult_ChannelMonitorUpdateStatusNoneZ_get_ok(LDKCResult_ChannelMonitorUpdateStatusNoneZ *NONNULL_PTR owner){
3876 CHECK(owner->result_ok);
3877         return ChannelMonitorUpdateStatus_clone(&*owner->contents.result);
3878 }
3879 int32_t  CS_LDK_CResult_ChannelMonitorUpdateStatusNoneZ_get_ok(int64_t owner) {
3880         LDKCResult_ChannelMonitorUpdateStatusNoneZ* owner_conv = (LDKCResult_ChannelMonitorUpdateStatusNoneZ*)untag_ptr(owner);
3881         int32_t ret_conv = LDKChannelMonitorUpdateStatus_to_cs(CResult_ChannelMonitorUpdateStatusNoneZ_get_ok(owner_conv));
3882         return ret_conv;
3883 }
3884
3885 static inline void CResult_ChannelMonitorUpdateStatusNoneZ_get_err(LDKCResult_ChannelMonitorUpdateStatusNoneZ *NONNULL_PTR owner){
3886 CHECK(!owner->result_ok);
3887         return *owner->contents.err;
3888 }
3889 void  CS_LDK_CResult_ChannelMonitorUpdateStatusNoneZ_get_err(int64_t owner) {
3890         LDKCResult_ChannelMonitorUpdateStatusNoneZ* owner_conv = (LDKCResult_ChannelMonitorUpdateStatusNoneZ*)untag_ptr(owner);
3891         CResult_ChannelMonitorUpdateStatusNoneZ_get_err(owner_conv);
3892 }
3893
3894 uint32_t CS_LDK_LDKClosureReason_ty_from_ptr(int64_t ptr) {
3895         LDKClosureReason *obj = (LDKClosureReason*)untag_ptr(ptr);
3896         switch(obj->tag) {
3897                 case LDKClosureReason_CounterpartyForceClosed: return 0;
3898                 case LDKClosureReason_HolderForceClosed: return 1;
3899                 case LDKClosureReason_LegacyCooperativeClosure: return 2;
3900                 case LDKClosureReason_CounterpartyInitiatedCooperativeClosure: return 3;
3901                 case LDKClosureReason_LocallyInitiatedCooperativeClosure: return 4;
3902                 case LDKClosureReason_CommitmentTxConfirmed: return 5;
3903                 case LDKClosureReason_FundingTimedOut: return 6;
3904                 case LDKClosureReason_ProcessingError: return 7;
3905                 case LDKClosureReason_DisconnectedPeer: return 8;
3906                 case LDKClosureReason_OutdatedChannelManager: return 9;
3907                 case LDKClosureReason_CounterpartyCoopClosedUnfundedChannel: return 10;
3908                 case LDKClosureReason_FundingBatchClosure: return 11;
3909                 case LDKClosureReason_HTLCsTimedOut: return 12;
3910                 default: abort();
3911         }
3912 }
3913 int64_t CS_LDK_LDKClosureReason_CounterpartyForceClosed_get_peer_msg(int64_t ptr) {
3914         LDKClosureReason *obj = (LDKClosureReason*)untag_ptr(ptr);
3915         CHECK(obj->tag == LDKClosureReason_CounterpartyForceClosed);
3916         LDKUntrustedString peer_msg_var = obj->counterparty_force_closed.peer_msg;
3917                         int64_t peer_msg_ref = 0;
3918                         CHECK_INNER_FIELD_ACCESS_OR_NULL(peer_msg_var);
3919                         peer_msg_ref = tag_ptr(peer_msg_var.inner, false);
3920         return peer_msg_ref;
3921 }
3922 jstring CS_LDK_LDKClosureReason_ProcessingError_get_err(int64_t ptr) {
3923         LDKClosureReason *obj = (LDKClosureReason*)untag_ptr(ptr);
3924         CHECK(obj->tag == LDKClosureReason_ProcessingError);
3925         LDKStr err_str = obj->processing_error.err;
3926                         jstring err_conv = str_ref_to_cs(err_str.chars, err_str.len);
3927         return err_conv;
3928 }
3929 uint32_t CS_LDK_LDKMonitorEvent_ty_from_ptr(int64_t ptr) {
3930         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
3931         switch(obj->tag) {
3932                 case LDKMonitorEvent_HTLCEvent: return 0;
3933                 case LDKMonitorEvent_HolderForceClosedWithInfo: return 1;
3934                 case LDKMonitorEvent_HolderForceClosed: return 2;
3935                 case LDKMonitorEvent_Completed: return 3;
3936                 default: abort();
3937         }
3938 }
3939 int64_t CS_LDK_LDKMonitorEvent_HTLCEvent_get_htlc_event(int64_t ptr) {
3940         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
3941         CHECK(obj->tag == LDKMonitorEvent_HTLCEvent);
3942         LDKHTLCUpdate htlc_event_var = obj->htlc_event;
3943                         int64_t htlc_event_ref = 0;
3944                         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_event_var);
3945                         htlc_event_ref = tag_ptr(htlc_event_var.inner, false);
3946         return htlc_event_ref;
3947 }
3948 int64_t CS_LDK_LDKMonitorEvent_HolderForceClosedWithInfo_get_reason(int64_t ptr) {
3949         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
3950         CHECK(obj->tag == LDKMonitorEvent_HolderForceClosedWithInfo);
3951         int64_t reason_ref = tag_ptr(&obj->holder_force_closed_with_info.reason, false);
3952         return reason_ref;
3953 }
3954 int64_t CS_LDK_LDKMonitorEvent_HolderForceClosedWithInfo_get_outpoint(int64_t ptr) {
3955         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
3956         CHECK(obj->tag == LDKMonitorEvent_HolderForceClosedWithInfo);
3957         LDKOutPoint outpoint_var = obj->holder_force_closed_with_info.outpoint;
3958                         int64_t outpoint_ref = 0;
3959                         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_var);
3960                         outpoint_ref = tag_ptr(outpoint_var.inner, false);
3961         return outpoint_ref;
3962 }
3963 int64_t CS_LDK_LDKMonitorEvent_HolderForceClosedWithInfo_get_channel_id(int64_t ptr) {
3964         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
3965         CHECK(obj->tag == LDKMonitorEvent_HolderForceClosedWithInfo);
3966         LDKChannelId channel_id_var = obj->holder_force_closed_with_info.channel_id;
3967                         int64_t channel_id_ref = 0;
3968                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
3969                         channel_id_ref = tag_ptr(channel_id_var.inner, false);
3970         return channel_id_ref;
3971 }
3972 int64_t CS_LDK_LDKMonitorEvent_HolderForceClosed_get_holder_force_closed(int64_t ptr) {
3973         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
3974         CHECK(obj->tag == LDKMonitorEvent_HolderForceClosed);
3975         LDKOutPoint holder_force_closed_var = obj->holder_force_closed;
3976                         int64_t holder_force_closed_ref = 0;
3977                         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_force_closed_var);
3978                         holder_force_closed_ref = tag_ptr(holder_force_closed_var.inner, false);
3979         return holder_force_closed_ref;
3980 }
3981 int64_t CS_LDK_LDKMonitorEvent_Completed_get_funding_txo(int64_t ptr) {
3982         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
3983         CHECK(obj->tag == LDKMonitorEvent_Completed);
3984         LDKOutPoint funding_txo_var = obj->completed.funding_txo;
3985                         int64_t funding_txo_ref = 0;
3986                         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
3987                         funding_txo_ref = tag_ptr(funding_txo_var.inner, false);
3988         return funding_txo_ref;
3989 }
3990 int64_t CS_LDK_LDKMonitorEvent_Completed_get_channel_id(int64_t ptr) {
3991         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
3992         CHECK(obj->tag == LDKMonitorEvent_Completed);
3993         LDKChannelId channel_id_var = obj->completed.channel_id;
3994                         int64_t channel_id_ref = 0;
3995                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
3996                         channel_id_ref = tag_ptr(channel_id_var.inner, false);
3997         return channel_id_ref;
3998 }
3999 int64_t CS_LDK_LDKMonitorEvent_Completed_get_monitor_update_id(int64_t ptr) {
4000         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
4001         CHECK(obj->tag == LDKMonitorEvent_Completed);
4002         int64_t monitor_update_id_conv = obj->completed.monitor_update_id;
4003         return monitor_update_id_conv;
4004 }
4005 static inline LDKCVec_MonitorEventZ CVec_MonitorEventZ_clone(const LDKCVec_MonitorEventZ *orig) {
4006         LDKCVec_MonitorEventZ ret = { .data = MALLOC(sizeof(LDKMonitorEvent) * orig->datalen, "LDKCVec_MonitorEventZ clone bytes"), .datalen = orig->datalen };
4007         for (size_t i = 0; i < ret.datalen; i++) {
4008                 ret.data[i] = MonitorEvent_clone(&orig->data[i]);
4009         }
4010         return ret;
4011 }
4012 static inline struct LDKOutPoint C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_get_a(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
4013         LDKOutPoint ret = owner->a;
4014         ret.is_owned = false;
4015         return ret;
4016 }
4017 int64_t  CS_LDK_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_get_a(int64_t owner) {
4018         LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
4019         LDKOutPoint ret_var = C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_get_a(owner_conv);
4020         int64_t ret_ref = 0;
4021         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4022         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4023         return ret_ref;
4024 }
4025
4026 static inline struct LDKChannelId C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_get_b(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
4027         LDKChannelId ret = owner->b;
4028         ret.is_owned = false;
4029         return ret;
4030 }
4031 int64_t  CS_LDK_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_get_b(int64_t owner) {
4032         LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
4033         LDKChannelId ret_var = C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_get_b(owner_conv);
4034         int64_t ret_ref = 0;
4035         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4036         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4037         return ret_ref;
4038 }
4039
4040 static inline struct LDKCVec_MonitorEventZ C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_get_c(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
4041         return CVec_MonitorEventZ_clone(&owner->c);
4042 }
4043 int64_tArray  CS_LDK_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_get_c(int64_t owner) {
4044         LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
4045         LDKCVec_MonitorEventZ ret_var = C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_get_c(owner_conv);
4046         int64_tArray ret_arr = NULL;
4047         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
4048         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
4049         for (size_t o = 0; o < ret_var.datalen; o++) {
4050                 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
4051                 *ret_conv_14_copy = ret_var.data[o];
4052                 int64_t ret_conv_14_ref = tag_ptr(ret_conv_14_copy, true);
4053                 ret_arr_ptr[o] = ret_conv_14_ref;
4054         }
4055         
4056         FREE(ret_var.data);
4057         return ret_arr;
4058 }
4059
4060 static inline struct LDKPublicKey C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_get_d(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
4061         return owner->d;
4062 }
4063 int8_tArray  CS_LDK_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_get_d(int64_t owner) {
4064         LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
4065         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
4066         memcpy(ret_arr->elems, C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_get_d(owner_conv).compressed_form, 33);
4067         return ret_arr;
4068 }
4069
4070 static inline LDKCVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ CVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ_clone(const LDKCVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ *orig) {
4071         LDKCVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ ret = { .data = MALLOC(sizeof(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ) * orig->datalen, "LDKCVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ clone bytes"), .datalen = orig->datalen };
4072         for (size_t i = 0; i < ret.datalen; i++) {
4073                 ret.data[i] = C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_clone(&orig->data[i]);
4074         }
4075         return ret;
4076 }
4077 static inline struct LDKInitFeatures CResult_InitFeaturesDecodeErrorZ_get_ok(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
4078         LDKInitFeatures ret = *owner->contents.result;
4079         ret.is_owned = false;
4080         return ret;
4081 }
4082 int64_t  CS_LDK_CResult_InitFeaturesDecodeErrorZ_get_ok(int64_t owner) {
4083         LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(owner);
4084         LDKInitFeatures ret_var = CResult_InitFeaturesDecodeErrorZ_get_ok(owner_conv);
4085         int64_t ret_ref = 0;
4086         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4087         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4088         return ret_ref;
4089 }
4090
4091 static inline struct LDKDecodeError CResult_InitFeaturesDecodeErrorZ_get_err(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
4092 CHECK(!owner->result_ok);
4093         return DecodeError_clone(&*owner->contents.err);
4094 }
4095 int64_t  CS_LDK_CResult_InitFeaturesDecodeErrorZ_get_err(int64_t owner) {
4096         LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(owner);
4097         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4098         *ret_copy = CResult_InitFeaturesDecodeErrorZ_get_err(owner_conv);
4099         int64_t ret_ref = tag_ptr(ret_copy, true);
4100         return ret_ref;
4101 }
4102
4103 static inline struct LDKChannelFeatures CResult_ChannelFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
4104         LDKChannelFeatures ret = *owner->contents.result;
4105         ret.is_owned = false;
4106         return ret;
4107 }
4108 int64_t  CS_LDK_CResult_ChannelFeaturesDecodeErrorZ_get_ok(int64_t owner) {
4109         LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(owner);
4110         LDKChannelFeatures ret_var = CResult_ChannelFeaturesDecodeErrorZ_get_ok(owner_conv);
4111         int64_t ret_ref = 0;
4112         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4113         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4114         return ret_ref;
4115 }
4116
4117 static inline struct LDKDecodeError CResult_ChannelFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
4118 CHECK(!owner->result_ok);
4119         return DecodeError_clone(&*owner->contents.err);
4120 }
4121 int64_t  CS_LDK_CResult_ChannelFeaturesDecodeErrorZ_get_err(int64_t owner) {
4122         LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(owner);
4123         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4124         *ret_copy = CResult_ChannelFeaturesDecodeErrorZ_get_err(owner_conv);
4125         int64_t ret_ref = tag_ptr(ret_copy, true);
4126         return ret_ref;
4127 }
4128
4129 static inline struct LDKNodeFeatures CResult_NodeFeaturesDecodeErrorZ_get_ok(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
4130         LDKNodeFeatures ret = *owner->contents.result;
4131         ret.is_owned = false;
4132         return ret;
4133 }
4134 int64_t  CS_LDK_CResult_NodeFeaturesDecodeErrorZ_get_ok(int64_t owner) {
4135         LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(owner);
4136         LDKNodeFeatures ret_var = CResult_NodeFeaturesDecodeErrorZ_get_ok(owner_conv);
4137         int64_t ret_ref = 0;
4138         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4139         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4140         return ret_ref;
4141 }
4142
4143 static inline struct LDKDecodeError CResult_NodeFeaturesDecodeErrorZ_get_err(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
4144 CHECK(!owner->result_ok);
4145         return DecodeError_clone(&*owner->contents.err);
4146 }
4147 int64_t  CS_LDK_CResult_NodeFeaturesDecodeErrorZ_get_err(int64_t owner) {
4148         LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(owner);
4149         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4150         *ret_copy = CResult_NodeFeaturesDecodeErrorZ_get_err(owner_conv);
4151         int64_t ret_ref = tag_ptr(ret_copy, true);
4152         return ret_ref;
4153 }
4154
4155 static inline struct LDKBolt11InvoiceFeatures CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_ok(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
4156         LDKBolt11InvoiceFeatures ret = *owner->contents.result;
4157         ret.is_owned = false;
4158         return ret;
4159 }
4160 int64_t  CS_LDK_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_ok(int64_t owner) {
4161         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
4162         LDKBolt11InvoiceFeatures ret_var = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_ok(owner_conv);
4163         int64_t ret_ref = 0;
4164         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4165         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4166         return ret_ref;
4167 }
4168
4169 static inline struct LDKDecodeError CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_err(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
4170 CHECK(!owner->result_ok);
4171         return DecodeError_clone(&*owner->contents.err);
4172 }
4173 int64_t  CS_LDK_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_err(int64_t owner) {
4174         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
4175         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4176         *ret_copy = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_err(owner_conv);
4177         int64_t ret_ref = tag_ptr(ret_copy, true);
4178         return ret_ref;
4179 }
4180
4181 static inline struct LDKBolt12InvoiceFeatures CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_ok(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
4182         LDKBolt12InvoiceFeatures ret = *owner->contents.result;
4183         ret.is_owned = false;
4184         return ret;
4185 }
4186 int64_t  CS_LDK_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_ok(int64_t owner) {
4187         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
4188         LDKBolt12InvoiceFeatures ret_var = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_ok(owner_conv);
4189         int64_t ret_ref = 0;
4190         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4191         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4192         return ret_ref;
4193 }
4194
4195 static inline struct LDKDecodeError CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_err(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
4196 CHECK(!owner->result_ok);
4197         return DecodeError_clone(&*owner->contents.err);
4198 }
4199 int64_t  CS_LDK_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_err(int64_t owner) {
4200         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
4201         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4202         *ret_copy = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_err(owner_conv);
4203         int64_t ret_ref = tag_ptr(ret_copy, true);
4204         return ret_ref;
4205 }
4206
4207 static inline struct LDKBlindedHopFeatures CResult_BlindedHopFeaturesDecodeErrorZ_get_ok(LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR owner){
4208         LDKBlindedHopFeatures ret = *owner->contents.result;
4209         ret.is_owned = false;
4210         return ret;
4211 }
4212 int64_t  CS_LDK_CResult_BlindedHopFeaturesDecodeErrorZ_get_ok(int64_t owner) {
4213         LDKCResult_BlindedHopFeaturesDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(owner);
4214         LDKBlindedHopFeatures ret_var = CResult_BlindedHopFeaturesDecodeErrorZ_get_ok(owner_conv);
4215         int64_t ret_ref = 0;
4216         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4217         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4218         return ret_ref;
4219 }
4220
4221 static inline struct LDKDecodeError CResult_BlindedHopFeaturesDecodeErrorZ_get_err(LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR owner){
4222 CHECK(!owner->result_ok);
4223         return DecodeError_clone(&*owner->contents.err);
4224 }
4225 int64_t  CS_LDK_CResult_BlindedHopFeaturesDecodeErrorZ_get_err(int64_t owner) {
4226         LDKCResult_BlindedHopFeaturesDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(owner);
4227         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4228         *ret_copy = CResult_BlindedHopFeaturesDecodeErrorZ_get_err(owner_conv);
4229         int64_t ret_ref = tag_ptr(ret_copy, true);
4230         return ret_ref;
4231 }
4232
4233 static inline struct LDKChannelTypeFeatures CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
4234         LDKChannelTypeFeatures ret = *owner->contents.result;
4235         ret.is_owned = false;
4236         return ret;
4237 }
4238 int64_t  CS_LDK_CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(int64_t owner) {
4239         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(owner);
4240         LDKChannelTypeFeatures ret_var = CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(owner_conv);
4241         int64_t ret_ref = 0;
4242         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4243         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4244         return ret_ref;
4245 }
4246
4247 static inline struct LDKDecodeError CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
4248 CHECK(!owner->result_ok);
4249         return DecodeError_clone(&*owner->contents.err);
4250 }
4251 int64_t  CS_LDK_CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(int64_t owner) {
4252         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(owner);
4253         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4254         *ret_copy = CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(owner_conv);
4255         int64_t ret_ref = tag_ptr(ret_copy, true);
4256         return ret_ref;
4257 }
4258
4259 static inline struct LDKOfferId CResult_OfferIdDecodeErrorZ_get_ok(LDKCResult_OfferIdDecodeErrorZ *NONNULL_PTR owner){
4260         LDKOfferId ret = *owner->contents.result;
4261         ret.is_owned = false;
4262         return ret;
4263 }
4264 int64_t  CS_LDK_CResult_OfferIdDecodeErrorZ_get_ok(int64_t owner) {
4265         LDKCResult_OfferIdDecodeErrorZ* owner_conv = (LDKCResult_OfferIdDecodeErrorZ*)untag_ptr(owner);
4266         LDKOfferId ret_var = CResult_OfferIdDecodeErrorZ_get_ok(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 static inline struct LDKDecodeError CResult_OfferIdDecodeErrorZ_get_err(LDKCResult_OfferIdDecodeErrorZ *NONNULL_PTR owner){
4274 CHECK(!owner->result_ok);
4275         return DecodeError_clone(&*owner->contents.err);
4276 }
4277 int64_t  CS_LDK_CResult_OfferIdDecodeErrorZ_get_err(int64_t owner) {
4278         LDKCResult_OfferIdDecodeErrorZ* owner_conv = (LDKCResult_OfferIdDecodeErrorZ*)untag_ptr(owner);
4279         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4280         *ret_copy = CResult_OfferIdDecodeErrorZ_get_err(owner_conv);
4281         int64_t ret_ref = tag_ptr(ret_copy, true);
4282         return ret_ref;
4283 }
4284
4285 static inline void CResult_NoneBolt12SemanticErrorZ_get_ok(LDKCResult_NoneBolt12SemanticErrorZ *NONNULL_PTR owner){
4286 CHECK(owner->result_ok);
4287         return *owner->contents.result;
4288 }
4289 void  CS_LDK_CResult_NoneBolt12SemanticErrorZ_get_ok(int64_t owner) {
4290         LDKCResult_NoneBolt12SemanticErrorZ* owner_conv = (LDKCResult_NoneBolt12SemanticErrorZ*)untag_ptr(owner);
4291         CResult_NoneBolt12SemanticErrorZ_get_ok(owner_conv);
4292 }
4293
4294 static inline enum LDKBolt12SemanticError CResult_NoneBolt12SemanticErrorZ_get_err(LDKCResult_NoneBolt12SemanticErrorZ *NONNULL_PTR owner){
4295 CHECK(!owner->result_ok);
4296         return Bolt12SemanticError_clone(&*owner->contents.err);
4297 }
4298 int32_t  CS_LDK_CResult_NoneBolt12SemanticErrorZ_get_err(int64_t owner) {
4299         LDKCResult_NoneBolt12SemanticErrorZ* owner_conv = (LDKCResult_NoneBolt12SemanticErrorZ*)untag_ptr(owner);
4300         int32_t ret_conv = LDKBolt12SemanticError_to_cs(CResult_NoneBolt12SemanticErrorZ_get_err(owner_conv));
4301         return ret_conv;
4302 }
4303
4304 static inline struct LDKOffer CResult_OfferBolt12SemanticErrorZ_get_ok(LDKCResult_OfferBolt12SemanticErrorZ *NONNULL_PTR owner){
4305         LDKOffer ret = *owner->contents.result;
4306         ret.is_owned = false;
4307         return ret;
4308 }
4309 int64_t  CS_LDK_CResult_OfferBolt12SemanticErrorZ_get_ok(int64_t owner) {
4310         LDKCResult_OfferBolt12SemanticErrorZ* owner_conv = (LDKCResult_OfferBolt12SemanticErrorZ*)untag_ptr(owner);
4311         LDKOffer ret_var = CResult_OfferBolt12SemanticErrorZ_get_ok(owner_conv);
4312         int64_t ret_ref = 0;
4313         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4314         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4315         return ret_ref;
4316 }
4317
4318 static inline enum LDKBolt12SemanticError CResult_OfferBolt12SemanticErrorZ_get_err(LDKCResult_OfferBolt12SemanticErrorZ *NONNULL_PTR owner){
4319 CHECK(!owner->result_ok);
4320         return Bolt12SemanticError_clone(&*owner->contents.err);
4321 }
4322 int32_t  CS_LDK_CResult_OfferBolt12SemanticErrorZ_get_err(int64_t owner) {
4323         LDKCResult_OfferBolt12SemanticErrorZ* owner_conv = (LDKCResult_OfferBolt12SemanticErrorZ*)untag_ptr(owner);
4324         int32_t ret_conv = LDKBolt12SemanticError_to_cs(CResult_OfferBolt12SemanticErrorZ_get_err(owner_conv));
4325         return ret_conv;
4326 }
4327
4328 static inline struct LDKInvoiceRequestWithDerivedPayerIdBuilder CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_get_ok(LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ *NONNULL_PTR owner){
4329         LDKInvoiceRequestWithDerivedPayerIdBuilder ret = *owner->contents.result;
4330         ret.is_owned = false;
4331         return ret;
4332 }
4333 int64_t  CS_LDK_CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_get_ok(int64_t owner) {
4334         LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ* owner_conv = (LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ*)untag_ptr(owner);
4335         LDKInvoiceRequestWithDerivedPayerIdBuilder ret_var = CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_get_ok(owner_conv);
4336         int64_t ret_ref = 0;
4337         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4338         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4339         return ret_ref;
4340 }
4341
4342 static inline enum LDKBolt12SemanticError CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_get_err(LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ *NONNULL_PTR owner){
4343 CHECK(!owner->result_ok);
4344         return Bolt12SemanticError_clone(&*owner->contents.err);
4345 }
4346 int32_t  CS_LDK_CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_get_err(int64_t owner) {
4347         LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ* owner_conv = (LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ*)untag_ptr(owner);
4348         int32_t ret_conv = LDKBolt12SemanticError_to_cs(CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_get_err(owner_conv));
4349         return ret_conv;
4350 }
4351
4352 static inline struct LDKInvoiceRequestWithExplicitPayerIdBuilder CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_get_ok(LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ *NONNULL_PTR owner){
4353         LDKInvoiceRequestWithExplicitPayerIdBuilder ret = *owner->contents.result;
4354         ret.is_owned = false;
4355         return ret;
4356 }
4357 int64_t  CS_LDK_CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_get_ok(int64_t owner) {
4358         LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ* owner_conv = (LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ*)untag_ptr(owner);
4359         LDKInvoiceRequestWithExplicitPayerIdBuilder ret_var = CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_get_ok(owner_conv);
4360         int64_t ret_ref = 0;
4361         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4362         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4363         return ret_ref;
4364 }
4365
4366 static inline enum LDKBolt12SemanticError CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_get_err(LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ *NONNULL_PTR owner){
4367 CHECK(!owner->result_ok);
4368         return Bolt12SemanticError_clone(&*owner->contents.err);
4369 }
4370 int32_t  CS_LDK_CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_get_err(int64_t owner) {
4371         LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ* owner_conv = (LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ*)untag_ptr(owner);
4372         int32_t ret_conv = LDKBolt12SemanticError_to_cs(CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_get_err(owner_conv));
4373         return ret_conv;
4374 }
4375
4376 static inline struct LDKOffer CResult_OfferBolt12ParseErrorZ_get_ok(LDKCResult_OfferBolt12ParseErrorZ *NONNULL_PTR owner){
4377         LDKOffer ret = *owner->contents.result;
4378         ret.is_owned = false;
4379         return ret;
4380 }
4381 int64_t  CS_LDK_CResult_OfferBolt12ParseErrorZ_get_ok(int64_t owner) {
4382         LDKCResult_OfferBolt12ParseErrorZ* owner_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(owner);
4383         LDKOffer ret_var = CResult_OfferBolt12ParseErrorZ_get_ok(owner_conv);
4384         int64_t ret_ref = 0;
4385         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4386         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4387         return ret_ref;
4388 }
4389
4390 static inline struct LDKBolt12ParseError CResult_OfferBolt12ParseErrorZ_get_err(LDKCResult_OfferBolt12ParseErrorZ *NONNULL_PTR owner){
4391         LDKBolt12ParseError ret = *owner->contents.err;
4392         ret.is_owned = false;
4393         return ret;
4394 }
4395 int64_t  CS_LDK_CResult_OfferBolt12ParseErrorZ_get_err(int64_t owner) {
4396         LDKCResult_OfferBolt12ParseErrorZ* owner_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(owner);
4397         LDKBolt12ParseError ret_var = CResult_OfferBolt12ParseErrorZ_get_err(owner_conv);
4398         int64_t ret_ref = 0;
4399         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4400         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4401         return ret_ref;
4402 }
4403
4404 static inline struct LDKNodeId CResult_NodeIdDecodeErrorZ_get_ok(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
4405         LDKNodeId ret = *owner->contents.result;
4406         ret.is_owned = false;
4407         return ret;
4408 }
4409 int64_t  CS_LDK_CResult_NodeIdDecodeErrorZ_get_ok(int64_t owner) {
4410         LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(owner);
4411         LDKNodeId ret_var = CResult_NodeIdDecodeErrorZ_get_ok(owner_conv);
4412         int64_t ret_ref = 0;
4413         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4414         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4415         return ret_ref;
4416 }
4417
4418 static inline struct LDKDecodeError CResult_NodeIdDecodeErrorZ_get_err(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
4419 CHECK(!owner->result_ok);
4420         return DecodeError_clone(&*owner->contents.err);
4421 }
4422 int64_t  CS_LDK_CResult_NodeIdDecodeErrorZ_get_err(int64_t owner) {
4423         LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(owner);
4424         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4425         *ret_copy = CResult_NodeIdDecodeErrorZ_get_err(owner_conv);
4426         int64_t ret_ref = tag_ptr(ret_copy, true);
4427         return ret_ref;
4428 }
4429
4430 static inline struct LDKPublicKey CResult_PublicKeySecp256k1ErrorZ_get_ok(LDKCResult_PublicKeySecp256k1ErrorZ *NONNULL_PTR owner){
4431 CHECK(owner->result_ok);
4432         return *owner->contents.result;
4433 }
4434 int8_tArray  CS_LDK_CResult_PublicKeySecp256k1ErrorZ_get_ok(int64_t owner) {
4435         LDKCResult_PublicKeySecp256k1ErrorZ* owner_conv = (LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(owner);
4436         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
4437         memcpy(ret_arr->elems, CResult_PublicKeySecp256k1ErrorZ_get_ok(owner_conv).compressed_form, 33);
4438         return ret_arr;
4439 }
4440
4441 static inline enum LDKSecp256k1Error CResult_PublicKeySecp256k1ErrorZ_get_err(LDKCResult_PublicKeySecp256k1ErrorZ *NONNULL_PTR owner){
4442 CHECK(!owner->result_ok);
4443         return *owner->contents.err;
4444 }
4445 int32_t  CS_LDK_CResult_PublicKeySecp256k1ErrorZ_get_err(int64_t owner) {
4446         LDKCResult_PublicKeySecp256k1ErrorZ* owner_conv = (LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(owner);
4447         int32_t ret_conv = LDKSecp256k1Error_to_cs(CResult_PublicKeySecp256k1ErrorZ_get_err(owner_conv));
4448         return ret_conv;
4449 }
4450
4451 uint32_t CS_LDK_LDKNetworkUpdate_ty_from_ptr(int64_t ptr) {
4452         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
4453         switch(obj->tag) {
4454                 case LDKNetworkUpdate_ChannelUpdateMessage: return 0;
4455                 case LDKNetworkUpdate_ChannelFailure: return 1;
4456                 case LDKNetworkUpdate_NodeFailure: return 2;
4457                 default: abort();
4458         }
4459 }
4460 int64_t CS_LDK_LDKNetworkUpdate_ChannelUpdateMessage_get_msg(int64_t ptr) {
4461         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
4462         CHECK(obj->tag == LDKNetworkUpdate_ChannelUpdateMessage);
4463         LDKChannelUpdate msg_var = obj->channel_update_message.msg;
4464                         int64_t msg_ref = 0;
4465                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4466                         msg_ref = tag_ptr(msg_var.inner, false);
4467         return msg_ref;
4468 }
4469 int64_t CS_LDK_LDKNetworkUpdate_ChannelFailure_get_short_channel_id(int64_t ptr) {
4470         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
4471         CHECK(obj->tag == LDKNetworkUpdate_ChannelFailure);
4472         int64_t short_channel_id_conv = obj->channel_failure.short_channel_id;
4473         return short_channel_id_conv;
4474 }
4475 jboolean CS_LDK_LDKNetworkUpdate_ChannelFailure_get_is_permanent(int64_t ptr) {
4476         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
4477         CHECK(obj->tag == LDKNetworkUpdate_ChannelFailure);
4478         jboolean is_permanent_conv = obj->channel_failure.is_permanent;
4479         return is_permanent_conv;
4480 }
4481 int8_tArray CS_LDK_LDKNetworkUpdate_NodeFailure_get_node_id(int64_t ptr) {
4482         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
4483         CHECK(obj->tag == LDKNetworkUpdate_NodeFailure);
4484         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4485         memcpy(node_id_arr->elems, obj->node_failure.node_id.compressed_form, 33);
4486         return node_id_arr;
4487 }
4488 jboolean CS_LDK_LDKNetworkUpdate_NodeFailure_get_is_permanent(int64_t ptr) {
4489         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
4490         CHECK(obj->tag == LDKNetworkUpdate_NodeFailure);
4491         jboolean is_permanent_conv = obj->node_failure.is_permanent;
4492         return is_permanent_conv;
4493 }
4494 uint32_t CS_LDK_LDKCOption_NetworkUpdateZ_ty_from_ptr(int64_t ptr) {
4495         LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)untag_ptr(ptr);
4496         switch(obj->tag) {
4497                 case LDKCOption_NetworkUpdateZ_Some: return 0;
4498                 case LDKCOption_NetworkUpdateZ_None: return 1;
4499                 default: abort();
4500         }
4501 }
4502 int64_t CS_LDK_LDKCOption_NetworkUpdateZ_Some_get_some(int64_t ptr) {
4503         LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)untag_ptr(ptr);
4504         CHECK(obj->tag == LDKCOption_NetworkUpdateZ_Some);
4505         int64_t some_ref = tag_ptr(&obj->some, false);
4506         return some_ref;
4507 }
4508 static inline struct LDKCOption_NetworkUpdateZ CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
4509 CHECK(owner->result_ok);
4510         return COption_NetworkUpdateZ_clone(&*owner->contents.result);
4511 }
4512 int64_t  CS_LDK_CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(int64_t owner) {
4513         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(owner);
4514         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
4515         *ret_copy = CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(owner_conv);
4516         int64_t ret_ref = tag_ptr(ret_copy, true);
4517         return ret_ref;
4518 }
4519
4520 static inline struct LDKDecodeError CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
4521 CHECK(!owner->result_ok);
4522         return DecodeError_clone(&*owner->contents.err);
4523 }
4524 int64_t  CS_LDK_CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(int64_t owner) {
4525         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(owner);
4526         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4527         *ret_copy = CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(owner_conv);
4528         int64_t ret_ref = tag_ptr(ret_copy, true);
4529         return ret_ref;
4530 }
4531
4532 static inline struct LDKTxOut CResult_TxOutUtxoLookupErrorZ_get_ok(LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR owner){
4533 CHECK(owner->result_ok);
4534         return TxOut_clone(&*owner->contents.result);
4535 }
4536 int64_t  CS_LDK_CResult_TxOutUtxoLookupErrorZ_get_ok(int64_t owner) {
4537         LDKCResult_TxOutUtxoLookupErrorZ* owner_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(owner);
4538         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
4539         *ret_ref = CResult_TxOutUtxoLookupErrorZ_get_ok(owner_conv);
4540         return tag_ptr(ret_ref, true);
4541 }
4542
4543 static inline enum LDKUtxoLookupError CResult_TxOutUtxoLookupErrorZ_get_err(LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR owner){
4544 CHECK(!owner->result_ok);
4545         return UtxoLookupError_clone(&*owner->contents.err);
4546 }
4547 int32_t  CS_LDK_CResult_TxOutUtxoLookupErrorZ_get_err(int64_t owner) {
4548         LDKCResult_TxOutUtxoLookupErrorZ* owner_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(owner);
4549         int32_t ret_conv = LDKUtxoLookupError_to_cs(CResult_TxOutUtxoLookupErrorZ_get_err(owner_conv));
4550         return ret_conv;
4551 }
4552
4553 uint32_t CS_LDK_LDKUtxoResult_ty_from_ptr(int64_t ptr) {
4554         LDKUtxoResult *obj = (LDKUtxoResult*)untag_ptr(ptr);
4555         switch(obj->tag) {
4556                 case LDKUtxoResult_Sync: return 0;
4557                 case LDKUtxoResult_Async: return 1;
4558                 default: abort();
4559         }
4560 }
4561 int64_t CS_LDK_LDKUtxoResult_Sync_get_sync(int64_t ptr) {
4562         LDKUtxoResult *obj = (LDKUtxoResult*)untag_ptr(ptr);
4563         CHECK(obj->tag == LDKUtxoResult_Sync);
4564         LDKCResult_TxOutUtxoLookupErrorZ* sync_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
4565         *sync_conv = obj->sync;
4566                         *sync_conv = CResult_TxOutUtxoLookupErrorZ_clone(sync_conv);
4567         return tag_ptr(sync_conv, true);
4568 }
4569 int64_t CS_LDK_LDKUtxoResult_Async_get_async(int64_t ptr) {
4570         LDKUtxoResult *obj = (LDKUtxoResult*)untag_ptr(ptr);
4571         CHECK(obj->tag == LDKUtxoResult_Async);
4572         LDKUtxoFuture async_var = obj->async;
4573                         int64_t async_ref = 0;
4574                         CHECK_INNER_FIELD_ACCESS_OR_NULL(async_var);
4575                         async_ref = tag_ptr(async_var.inner, false);
4576         return async_ref;
4577 }
4578 typedef struct LDKUtxoLookup_JCalls {
4579         atomic_size_t refcnt;
4580         uint32_t instance_ptr;
4581 } LDKUtxoLookup_JCalls;
4582 static void LDKUtxoLookup_JCalls_free(void* this_arg) {
4583         LDKUtxoLookup_JCalls *j_calls = (LDKUtxoLookup_JCalls*) this_arg;
4584         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4585                 FREE(j_calls);
4586         }
4587 }
4588 LDKUtxoResult get_utxo_LDKUtxoLookup_jcall(const void* this_arg, const uint8_t (* chain_hash)[32], uint64_t short_channel_id) {
4589         LDKUtxoLookup_JCalls *j_calls = (LDKUtxoLookup_JCalls*) this_arg;
4590         int8_tArray chain_hash_arr = init_int8_tArray(32, __LINE__);
4591         memcpy(chain_hash_arr->elems, *chain_hash, 32);
4592         int64_t short_channel_id_conv = short_channel_id;
4593         uint64_t ret = js_invoke_function_l_ll(j_calls->instance_ptr, 26, (int64_t)chain_hash_arr, short_channel_id_conv);
4594         void* ret_ptr = untag_ptr(ret);
4595         CHECK_ACCESS(ret_ptr);
4596         LDKUtxoResult ret_conv = *(LDKUtxoResult*)(ret_ptr);
4597         FREE(untag_ptr(ret));
4598         return ret_conv;
4599 }
4600 static void LDKUtxoLookup_JCalls_cloned(LDKUtxoLookup* new_obj) {
4601         LDKUtxoLookup_JCalls *j_calls = (LDKUtxoLookup_JCalls*) new_obj->this_arg;
4602         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4603 }
4604 static inline LDKUtxoLookup LDKUtxoLookup_init (int64_t o) {
4605         LDKUtxoLookup_JCalls *calls = MALLOC(sizeof(LDKUtxoLookup_JCalls), "LDKUtxoLookup_JCalls");
4606         atomic_init(&calls->refcnt, 1);
4607         calls->instance_ptr = o;
4608
4609         LDKUtxoLookup ret = {
4610                 .this_arg = (void*) calls,
4611                 .get_utxo = get_utxo_LDKUtxoLookup_jcall,
4612                 .free = LDKUtxoLookup_JCalls_free,
4613         };
4614         return ret;
4615 }
4616 uint64_t  CS_LDK_LDKUtxoLookup_new(int32_t o) {
4617         LDKUtxoLookup *res_ptr = MALLOC(sizeof(LDKUtxoLookup), "LDKUtxoLookup");
4618         *res_ptr = LDKUtxoLookup_init(o);
4619         return tag_ptr(res_ptr, true);
4620 }
4621 int64_t  CS_LDK_UtxoLookup_get_utxo(int64_t this_arg, int8_tArray chain_hash, int64_t short_channel_id) {
4622         void* this_arg_ptr = untag_ptr(this_arg);
4623         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4624         LDKUtxoLookup* this_arg_conv = (LDKUtxoLookup*)this_arg_ptr;
4625         uint8_t chain_hash_arr[32];
4626         CHECK(chain_hash->arr_len == 32);
4627         memcpy(chain_hash_arr, chain_hash->elems, 32); FREE(chain_hash);
4628         uint8_t (*chain_hash_ref)[32] = &chain_hash_arr;
4629         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
4630         *ret_copy = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, chain_hash_ref, short_channel_id);
4631         int64_t ret_ref = tag_ptr(ret_copy, true);
4632         return ret_ref;
4633 }
4634
4635 uint32_t CS_LDK_LDKCOption_UtxoLookupZ_ty_from_ptr(int64_t ptr) {
4636         LDKCOption_UtxoLookupZ *obj = (LDKCOption_UtxoLookupZ*)untag_ptr(ptr);
4637         switch(obj->tag) {
4638                 case LDKCOption_UtxoLookupZ_Some: return 0;
4639                 case LDKCOption_UtxoLookupZ_None: return 1;
4640                 default: abort();
4641         }
4642 }
4643 int64_t CS_LDK_LDKCOption_UtxoLookupZ_Some_get_some(int64_t ptr) {
4644         LDKCOption_UtxoLookupZ *obj = (LDKCOption_UtxoLookupZ*)untag_ptr(ptr);
4645         CHECK(obj->tag == LDKCOption_UtxoLookupZ_Some);
4646         LDKUtxoLookup* some_ret = MALLOC(sizeof(LDKUtxoLookup), "LDKUtxoLookup");
4647         *some_ret = obj->some;
4648                         // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
4649                         if ((*some_ret).free == LDKUtxoLookup_JCalls_free) {
4650                                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
4651                                 LDKUtxoLookup_JCalls_cloned(&(*some_ret));
4652                         }
4653         return tag_ptr(some_ret, true);
4654 }
4655 static inline void CResult_NoneLightningErrorZ_get_ok(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
4656 CHECK(owner->result_ok);
4657         return *owner->contents.result;
4658 }
4659 void  CS_LDK_CResult_NoneLightningErrorZ_get_ok(int64_t owner) {
4660         LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(owner);
4661         CResult_NoneLightningErrorZ_get_ok(owner_conv);
4662 }
4663
4664 static inline struct LDKLightningError CResult_NoneLightningErrorZ_get_err(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
4665         LDKLightningError ret = *owner->contents.err;
4666         ret.is_owned = false;
4667         return ret;
4668 }
4669 int64_t  CS_LDK_CResult_NoneLightningErrorZ_get_err(int64_t owner) {
4670         LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(owner);
4671         LDKLightningError ret_var = CResult_NoneLightningErrorZ_get_err(owner_conv);
4672         int64_t ret_ref = 0;
4673         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4674         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4675         return ret_ref;
4676 }
4677
4678 static inline bool CResult_boolLightningErrorZ_get_ok(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
4679 CHECK(owner->result_ok);
4680         return *owner->contents.result;
4681 }
4682 jboolean  CS_LDK_CResult_boolLightningErrorZ_get_ok(int64_t owner) {
4683         LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(owner);
4684         jboolean ret_conv = CResult_boolLightningErrorZ_get_ok(owner_conv);
4685         return ret_conv;
4686 }
4687
4688 static inline struct LDKLightningError CResult_boolLightningErrorZ_get_err(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
4689         LDKLightningError ret = *owner->contents.err;
4690         ret.is_owned = false;
4691         return ret;
4692 }
4693 int64_t  CS_LDK_CResult_boolLightningErrorZ_get_err(int64_t owner) {
4694         LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(owner);
4695         LDKLightningError ret_var = CResult_boolLightningErrorZ_get_err(owner_conv);
4696         int64_t ret_ref = 0;
4697         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4698         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4699         return ret_ref;
4700 }
4701
4702 static inline struct LDKChannelAnnouncement C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
4703         LDKChannelAnnouncement ret = owner->a;
4704         ret.is_owned = false;
4705         return ret;
4706 }
4707 int64_t  CS_LDK_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(int64_t owner) {
4708         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
4709         LDKChannelAnnouncement ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(owner_conv);
4710         int64_t ret_ref = 0;
4711         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4712         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4713         return ret_ref;
4714 }
4715
4716 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
4717         LDKChannelUpdate ret = owner->b;
4718         ret.is_owned = false;
4719         return ret;
4720 }
4721 int64_t  CS_LDK_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(int64_t owner) {
4722         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
4723         LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(owner_conv);
4724         int64_t ret_ref = 0;
4725         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4726         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4727         return ret_ref;
4728 }
4729
4730 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
4731         LDKChannelUpdate ret = owner->c;
4732         ret.is_owned = false;
4733         return ret;
4734 }
4735 int64_t  CS_LDK_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(int64_t owner) {
4736         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
4737         LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(owner_conv);
4738         int64_t ret_ref = 0;
4739         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4740         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4741         return ret_ref;
4742 }
4743
4744 uint32_t CS_LDK_LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_ty_from_ptr(int64_t ptr) {
4745         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *obj = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(ptr);
4746         switch(obj->tag) {
4747                 case LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some: return 0;
4748                 case LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None: return 1;
4749                 default: abort();
4750         }
4751 }
4752 int64_t CS_LDK_LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_get_some(int64_t ptr) {
4753         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *obj = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(ptr);
4754         CHECK(obj->tag == LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some);
4755         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* some_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
4756         *some_conv = obj->some;
4757                         *some_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(some_conv);
4758         return tag_ptr(some_conv, true);
4759 }
4760 uint32_t CS_LDK_LDKErrorAction_ty_from_ptr(int64_t ptr) {
4761         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
4762         switch(obj->tag) {
4763                 case LDKErrorAction_DisconnectPeer: return 0;
4764                 case LDKErrorAction_DisconnectPeerWithWarning: return 1;
4765                 case LDKErrorAction_IgnoreError: return 2;
4766                 case LDKErrorAction_IgnoreAndLog: return 3;
4767                 case LDKErrorAction_IgnoreDuplicateGossip: return 4;
4768                 case LDKErrorAction_SendErrorMessage: return 5;
4769                 case LDKErrorAction_SendWarningMessage: return 6;
4770                 default: abort();
4771         }
4772 }
4773 int64_t CS_LDK_LDKErrorAction_DisconnectPeer_get_msg(int64_t ptr) {
4774         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
4775         CHECK(obj->tag == LDKErrorAction_DisconnectPeer);
4776         LDKErrorMessage msg_var = obj->disconnect_peer.msg;
4777                         int64_t msg_ref = 0;
4778                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4779                         msg_ref = tag_ptr(msg_var.inner, false);
4780         return msg_ref;
4781 }
4782 int64_t CS_LDK_LDKErrorAction_DisconnectPeerWithWarning_get_msg(int64_t ptr) {
4783         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
4784         CHECK(obj->tag == LDKErrorAction_DisconnectPeerWithWarning);
4785         LDKWarningMessage msg_var = obj->disconnect_peer_with_warning.msg;
4786                         int64_t msg_ref = 0;
4787                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4788                         msg_ref = tag_ptr(msg_var.inner, false);
4789         return msg_ref;
4790 }
4791 int32_t CS_LDK_LDKErrorAction_IgnoreAndLog_get_ignore_and_log(int64_t ptr) {
4792         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
4793         CHECK(obj->tag == LDKErrorAction_IgnoreAndLog);
4794         int32_t ignore_and_log_conv = LDKLevel_to_cs(obj->ignore_and_log);
4795         return ignore_and_log_conv;
4796 }
4797 int64_t CS_LDK_LDKErrorAction_SendErrorMessage_get_msg(int64_t ptr) {
4798         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
4799         CHECK(obj->tag == LDKErrorAction_SendErrorMessage);
4800         LDKErrorMessage msg_var = obj->send_error_message.msg;
4801                         int64_t msg_ref = 0;
4802                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4803                         msg_ref = tag_ptr(msg_var.inner, false);
4804         return msg_ref;
4805 }
4806 int64_t CS_LDK_LDKErrorAction_SendWarningMessage_get_msg(int64_t ptr) {
4807         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
4808         CHECK(obj->tag == LDKErrorAction_SendWarningMessage);
4809         LDKWarningMessage msg_var = obj->send_warning_message.msg;
4810                         int64_t msg_ref = 0;
4811                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4812                         msg_ref = tag_ptr(msg_var.inner, false);
4813         return msg_ref;
4814 }
4815 int32_t CS_LDK_LDKErrorAction_SendWarningMessage_get_log_level(int64_t ptr) {
4816         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
4817         CHECK(obj->tag == LDKErrorAction_SendWarningMessage);
4818         int32_t log_level_conv = LDKLevel_to_cs(obj->send_warning_message.log_level);
4819         return log_level_conv;
4820 }
4821 uint32_t CS_LDK_LDKMessageSendEvent_ty_from_ptr(int64_t ptr) {
4822         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4823         switch(obj->tag) {
4824                 case LDKMessageSendEvent_SendAcceptChannel: return 0;
4825                 case LDKMessageSendEvent_SendAcceptChannelV2: return 1;
4826                 case LDKMessageSendEvent_SendOpenChannel: return 2;
4827                 case LDKMessageSendEvent_SendOpenChannelV2: return 3;
4828                 case LDKMessageSendEvent_SendFundingCreated: return 4;
4829                 case LDKMessageSendEvent_SendFundingSigned: return 5;
4830                 case LDKMessageSendEvent_SendStfu: return 6;
4831                 case LDKMessageSendEvent_SendSplice: return 7;
4832                 case LDKMessageSendEvent_SendSpliceAck: return 8;
4833                 case LDKMessageSendEvent_SendSpliceLocked: return 9;
4834                 case LDKMessageSendEvent_SendTxAddInput: return 10;
4835                 case LDKMessageSendEvent_SendTxAddOutput: return 11;
4836                 case LDKMessageSendEvent_SendTxRemoveInput: return 12;
4837                 case LDKMessageSendEvent_SendTxRemoveOutput: return 13;
4838                 case LDKMessageSendEvent_SendTxComplete: return 14;
4839                 case LDKMessageSendEvent_SendTxSignatures: return 15;
4840                 case LDKMessageSendEvent_SendTxInitRbf: return 16;
4841                 case LDKMessageSendEvent_SendTxAckRbf: return 17;
4842                 case LDKMessageSendEvent_SendTxAbort: return 18;
4843                 case LDKMessageSendEvent_SendChannelReady: return 19;
4844                 case LDKMessageSendEvent_SendAnnouncementSignatures: return 20;
4845                 case LDKMessageSendEvent_UpdateHTLCs: return 21;
4846                 case LDKMessageSendEvent_SendRevokeAndACK: return 22;
4847                 case LDKMessageSendEvent_SendClosingSigned: return 23;
4848                 case LDKMessageSendEvent_SendShutdown: return 24;
4849                 case LDKMessageSendEvent_SendChannelReestablish: return 25;
4850                 case LDKMessageSendEvent_SendChannelAnnouncement: return 26;
4851                 case LDKMessageSendEvent_BroadcastChannelAnnouncement: return 27;
4852                 case LDKMessageSendEvent_BroadcastChannelUpdate: return 28;
4853                 case LDKMessageSendEvent_BroadcastNodeAnnouncement: return 29;
4854                 case LDKMessageSendEvent_SendChannelUpdate: return 30;
4855                 case LDKMessageSendEvent_HandleError: return 31;
4856                 case LDKMessageSendEvent_SendChannelRangeQuery: return 32;
4857                 case LDKMessageSendEvent_SendShortIdsQuery: return 33;
4858                 case LDKMessageSendEvent_SendReplyChannelRange: return 34;
4859                 case LDKMessageSendEvent_SendGossipTimestampFilter: return 35;
4860                 default: abort();
4861         }
4862 }
4863 int8_tArray CS_LDK_LDKMessageSendEvent_SendAcceptChannel_get_node_id(int64_t ptr) {
4864         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4865         CHECK(obj->tag == LDKMessageSendEvent_SendAcceptChannel);
4866         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4867         memcpy(node_id_arr->elems, obj->send_accept_channel.node_id.compressed_form, 33);
4868         return node_id_arr;
4869 }
4870 int64_t CS_LDK_LDKMessageSendEvent_SendAcceptChannel_get_msg(int64_t ptr) {
4871         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4872         CHECK(obj->tag == LDKMessageSendEvent_SendAcceptChannel);
4873         LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
4874                         int64_t msg_ref = 0;
4875                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4876                         msg_ref = tag_ptr(msg_var.inner, false);
4877         return msg_ref;
4878 }
4879 int8_tArray CS_LDK_LDKMessageSendEvent_SendAcceptChannelV2_get_node_id(int64_t ptr) {
4880         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4881         CHECK(obj->tag == LDKMessageSendEvent_SendAcceptChannelV2);
4882         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4883         memcpy(node_id_arr->elems, obj->send_accept_channel_v2.node_id.compressed_form, 33);
4884         return node_id_arr;
4885 }
4886 int64_t CS_LDK_LDKMessageSendEvent_SendAcceptChannelV2_get_msg(int64_t ptr) {
4887         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4888         CHECK(obj->tag == LDKMessageSendEvent_SendAcceptChannelV2);
4889         LDKAcceptChannelV2 msg_var = obj->send_accept_channel_v2.msg;
4890                         int64_t msg_ref = 0;
4891                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4892                         msg_ref = tag_ptr(msg_var.inner, false);
4893         return msg_ref;
4894 }
4895 int8_tArray CS_LDK_LDKMessageSendEvent_SendOpenChannel_get_node_id(int64_t ptr) {
4896         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4897         CHECK(obj->tag == LDKMessageSendEvent_SendOpenChannel);
4898         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4899         memcpy(node_id_arr->elems, obj->send_open_channel.node_id.compressed_form, 33);
4900         return node_id_arr;
4901 }
4902 int64_t CS_LDK_LDKMessageSendEvent_SendOpenChannel_get_msg(int64_t ptr) {
4903         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4904         CHECK(obj->tag == LDKMessageSendEvent_SendOpenChannel);
4905         LDKOpenChannel msg_var = obj->send_open_channel.msg;
4906                         int64_t msg_ref = 0;
4907                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4908                         msg_ref = tag_ptr(msg_var.inner, false);
4909         return msg_ref;
4910 }
4911 int8_tArray CS_LDK_LDKMessageSendEvent_SendOpenChannelV2_get_node_id(int64_t ptr) {
4912         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4913         CHECK(obj->tag == LDKMessageSendEvent_SendOpenChannelV2);
4914         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4915         memcpy(node_id_arr->elems, obj->send_open_channel_v2.node_id.compressed_form, 33);
4916         return node_id_arr;
4917 }
4918 int64_t CS_LDK_LDKMessageSendEvent_SendOpenChannelV2_get_msg(int64_t ptr) {
4919         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4920         CHECK(obj->tag == LDKMessageSendEvent_SendOpenChannelV2);
4921         LDKOpenChannelV2 msg_var = obj->send_open_channel_v2.msg;
4922                         int64_t msg_ref = 0;
4923                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4924                         msg_ref = tag_ptr(msg_var.inner, false);
4925         return msg_ref;
4926 }
4927 int8_tArray CS_LDK_LDKMessageSendEvent_SendFundingCreated_get_node_id(int64_t ptr) {
4928         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4929         CHECK(obj->tag == LDKMessageSendEvent_SendFundingCreated);
4930         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4931         memcpy(node_id_arr->elems, obj->send_funding_created.node_id.compressed_form, 33);
4932         return node_id_arr;
4933 }
4934 int64_t CS_LDK_LDKMessageSendEvent_SendFundingCreated_get_msg(int64_t ptr) {
4935         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4936         CHECK(obj->tag == LDKMessageSendEvent_SendFundingCreated);
4937         LDKFundingCreated msg_var = obj->send_funding_created.msg;
4938                         int64_t msg_ref = 0;
4939                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4940                         msg_ref = tag_ptr(msg_var.inner, false);
4941         return msg_ref;
4942 }
4943 int8_tArray CS_LDK_LDKMessageSendEvent_SendFundingSigned_get_node_id(int64_t ptr) {
4944         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4945         CHECK(obj->tag == LDKMessageSendEvent_SendFundingSigned);
4946         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4947         memcpy(node_id_arr->elems, obj->send_funding_signed.node_id.compressed_form, 33);
4948         return node_id_arr;
4949 }
4950 int64_t CS_LDK_LDKMessageSendEvent_SendFundingSigned_get_msg(int64_t ptr) {
4951         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4952         CHECK(obj->tag == LDKMessageSendEvent_SendFundingSigned);
4953         LDKFundingSigned msg_var = obj->send_funding_signed.msg;
4954                         int64_t msg_ref = 0;
4955                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4956                         msg_ref = tag_ptr(msg_var.inner, false);
4957         return msg_ref;
4958 }
4959 int8_tArray CS_LDK_LDKMessageSendEvent_SendStfu_get_node_id(int64_t ptr) {
4960         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4961         CHECK(obj->tag == LDKMessageSendEvent_SendStfu);
4962         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4963         memcpy(node_id_arr->elems, obj->send_stfu.node_id.compressed_form, 33);
4964         return node_id_arr;
4965 }
4966 int64_t CS_LDK_LDKMessageSendEvent_SendStfu_get_msg(int64_t ptr) {
4967         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4968         CHECK(obj->tag == LDKMessageSendEvent_SendStfu);
4969         LDKStfu msg_var = obj->send_stfu.msg;
4970                         int64_t msg_ref = 0;
4971                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4972                         msg_ref = tag_ptr(msg_var.inner, false);
4973         return msg_ref;
4974 }
4975 int8_tArray CS_LDK_LDKMessageSendEvent_SendSplice_get_node_id(int64_t ptr) {
4976         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4977         CHECK(obj->tag == LDKMessageSendEvent_SendSplice);
4978         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4979         memcpy(node_id_arr->elems, obj->send_splice.node_id.compressed_form, 33);
4980         return node_id_arr;
4981 }
4982 int64_t CS_LDK_LDKMessageSendEvent_SendSplice_get_msg(int64_t ptr) {
4983         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4984         CHECK(obj->tag == LDKMessageSendEvent_SendSplice);
4985         LDKSplice msg_var = obj->send_splice.msg;
4986                         int64_t msg_ref = 0;
4987                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4988                         msg_ref = tag_ptr(msg_var.inner, false);
4989         return msg_ref;
4990 }
4991 int8_tArray CS_LDK_LDKMessageSendEvent_SendSpliceAck_get_node_id(int64_t ptr) {
4992         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4993         CHECK(obj->tag == LDKMessageSendEvent_SendSpliceAck);
4994         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4995         memcpy(node_id_arr->elems, obj->send_splice_ack.node_id.compressed_form, 33);
4996         return node_id_arr;
4997 }
4998 int64_t CS_LDK_LDKMessageSendEvent_SendSpliceAck_get_msg(int64_t ptr) {
4999         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5000         CHECK(obj->tag == LDKMessageSendEvent_SendSpliceAck);
5001         LDKSpliceAck msg_var = obj->send_splice_ack.msg;
5002                         int64_t msg_ref = 0;
5003                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5004                         msg_ref = tag_ptr(msg_var.inner, false);
5005         return msg_ref;
5006 }
5007 int8_tArray CS_LDK_LDKMessageSendEvent_SendSpliceLocked_get_node_id(int64_t ptr) {
5008         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5009         CHECK(obj->tag == LDKMessageSendEvent_SendSpliceLocked);
5010         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
5011         memcpy(node_id_arr->elems, obj->send_splice_locked.node_id.compressed_form, 33);
5012         return node_id_arr;
5013 }
5014 int64_t CS_LDK_LDKMessageSendEvent_SendSpliceLocked_get_msg(int64_t ptr) {
5015         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5016         CHECK(obj->tag == LDKMessageSendEvent_SendSpliceLocked);
5017         LDKSpliceLocked msg_var = obj->send_splice_locked.msg;
5018                         int64_t msg_ref = 0;
5019                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5020                         msg_ref = tag_ptr(msg_var.inner, false);
5021         return msg_ref;
5022 }
5023 int8_tArray CS_LDK_LDKMessageSendEvent_SendTxAddInput_get_node_id(int64_t ptr) {
5024         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5025         CHECK(obj->tag == LDKMessageSendEvent_SendTxAddInput);
5026         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
5027         memcpy(node_id_arr->elems, obj->send_tx_add_input.node_id.compressed_form, 33);
5028         return node_id_arr;
5029 }
5030 int64_t CS_LDK_LDKMessageSendEvent_SendTxAddInput_get_msg(int64_t ptr) {
5031         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5032         CHECK(obj->tag == LDKMessageSendEvent_SendTxAddInput);
5033         LDKTxAddInput msg_var = obj->send_tx_add_input.msg;
5034                         int64_t msg_ref = 0;
5035                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5036                         msg_ref = tag_ptr(msg_var.inner, false);
5037         return msg_ref;
5038 }
5039 int8_tArray CS_LDK_LDKMessageSendEvent_SendTxAddOutput_get_node_id(int64_t ptr) {
5040         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5041         CHECK(obj->tag == LDKMessageSendEvent_SendTxAddOutput);
5042         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
5043         memcpy(node_id_arr->elems, obj->send_tx_add_output.node_id.compressed_form, 33);
5044         return node_id_arr;
5045 }
5046 int64_t CS_LDK_LDKMessageSendEvent_SendTxAddOutput_get_msg(int64_t ptr) {
5047         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5048         CHECK(obj->tag == LDKMessageSendEvent_SendTxAddOutput);
5049         LDKTxAddOutput msg_var = obj->send_tx_add_output.msg;
5050                         int64_t msg_ref = 0;
5051                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5052                         msg_ref = tag_ptr(msg_var.inner, false);
5053         return msg_ref;
5054 }
5055 int8_tArray CS_LDK_LDKMessageSendEvent_SendTxRemoveInput_get_node_id(int64_t ptr) {
5056         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5057         CHECK(obj->tag == LDKMessageSendEvent_SendTxRemoveInput);
5058         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
5059         memcpy(node_id_arr->elems, obj->send_tx_remove_input.node_id.compressed_form, 33);
5060         return node_id_arr;
5061 }
5062 int64_t CS_LDK_LDKMessageSendEvent_SendTxRemoveInput_get_msg(int64_t ptr) {
5063         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5064         CHECK(obj->tag == LDKMessageSendEvent_SendTxRemoveInput);
5065         LDKTxRemoveInput msg_var = obj->send_tx_remove_input.msg;
5066                         int64_t msg_ref = 0;
5067                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5068                         msg_ref = tag_ptr(msg_var.inner, false);
5069         return msg_ref;
5070 }
5071 int8_tArray CS_LDK_LDKMessageSendEvent_SendTxRemoveOutput_get_node_id(int64_t ptr) {
5072         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5073         CHECK(obj->tag == LDKMessageSendEvent_SendTxRemoveOutput);
5074         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
5075         memcpy(node_id_arr->elems, obj->send_tx_remove_output.node_id.compressed_form, 33);
5076         return node_id_arr;
5077 }
5078 int64_t CS_LDK_LDKMessageSendEvent_SendTxRemoveOutput_get_msg(int64_t ptr) {
5079         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5080         CHECK(obj->tag == LDKMessageSendEvent_SendTxRemoveOutput);
5081         LDKTxRemoveOutput msg_var = obj->send_tx_remove_output.msg;
5082                         int64_t msg_ref = 0;
5083                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5084                         msg_ref = tag_ptr(msg_var.inner, false);
5085         return msg_ref;
5086 }
5087 int8_tArray CS_LDK_LDKMessageSendEvent_SendTxComplete_get_node_id(int64_t ptr) {
5088         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5089         CHECK(obj->tag == LDKMessageSendEvent_SendTxComplete);
5090         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
5091         memcpy(node_id_arr->elems, obj->send_tx_complete.node_id.compressed_form, 33);
5092         return node_id_arr;
5093 }
5094 int64_t CS_LDK_LDKMessageSendEvent_SendTxComplete_get_msg(int64_t ptr) {
5095         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5096         CHECK(obj->tag == LDKMessageSendEvent_SendTxComplete);
5097         LDKTxComplete msg_var = obj->send_tx_complete.msg;
5098                         int64_t msg_ref = 0;
5099                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5100                         msg_ref = tag_ptr(msg_var.inner, false);
5101         return msg_ref;
5102 }
5103 int8_tArray CS_LDK_LDKMessageSendEvent_SendTxSignatures_get_node_id(int64_t ptr) {
5104         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5105         CHECK(obj->tag == LDKMessageSendEvent_SendTxSignatures);
5106         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
5107         memcpy(node_id_arr->elems, obj->send_tx_signatures.node_id.compressed_form, 33);
5108         return node_id_arr;
5109 }
5110 int64_t CS_LDK_LDKMessageSendEvent_SendTxSignatures_get_msg(int64_t ptr) {
5111         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5112         CHECK(obj->tag == LDKMessageSendEvent_SendTxSignatures);
5113         LDKTxSignatures msg_var = obj->send_tx_signatures.msg;
5114                         int64_t msg_ref = 0;
5115                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5116                         msg_ref = tag_ptr(msg_var.inner, false);
5117         return msg_ref;
5118 }
5119 int8_tArray CS_LDK_LDKMessageSendEvent_SendTxInitRbf_get_node_id(int64_t ptr) {
5120         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5121         CHECK(obj->tag == LDKMessageSendEvent_SendTxInitRbf);
5122         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
5123         memcpy(node_id_arr->elems, obj->send_tx_init_rbf.node_id.compressed_form, 33);
5124         return node_id_arr;
5125 }
5126 int64_t CS_LDK_LDKMessageSendEvent_SendTxInitRbf_get_msg(int64_t ptr) {
5127         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5128         CHECK(obj->tag == LDKMessageSendEvent_SendTxInitRbf);
5129         LDKTxInitRbf msg_var = obj->send_tx_init_rbf.msg;
5130                         int64_t msg_ref = 0;
5131                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5132                         msg_ref = tag_ptr(msg_var.inner, false);
5133         return msg_ref;
5134 }
5135 int8_tArray CS_LDK_LDKMessageSendEvent_SendTxAckRbf_get_node_id(int64_t ptr) {
5136         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5137         CHECK(obj->tag == LDKMessageSendEvent_SendTxAckRbf);
5138         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
5139         memcpy(node_id_arr->elems, obj->send_tx_ack_rbf.node_id.compressed_form, 33);
5140         return node_id_arr;
5141 }
5142 int64_t CS_LDK_LDKMessageSendEvent_SendTxAckRbf_get_msg(int64_t ptr) {
5143         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5144         CHECK(obj->tag == LDKMessageSendEvent_SendTxAckRbf);
5145         LDKTxAckRbf msg_var = obj->send_tx_ack_rbf.msg;
5146                         int64_t msg_ref = 0;
5147                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5148                         msg_ref = tag_ptr(msg_var.inner, false);
5149         return msg_ref;
5150 }
5151 int8_tArray CS_LDK_LDKMessageSendEvent_SendTxAbort_get_node_id(int64_t ptr) {
5152         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5153         CHECK(obj->tag == LDKMessageSendEvent_SendTxAbort);
5154         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
5155         memcpy(node_id_arr->elems, obj->send_tx_abort.node_id.compressed_form, 33);
5156         return node_id_arr;
5157 }
5158 int64_t CS_LDK_LDKMessageSendEvent_SendTxAbort_get_msg(int64_t ptr) {
5159         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5160         CHECK(obj->tag == LDKMessageSendEvent_SendTxAbort);
5161         LDKTxAbort msg_var = obj->send_tx_abort.msg;
5162                         int64_t msg_ref = 0;
5163                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5164                         msg_ref = tag_ptr(msg_var.inner, false);
5165         return msg_ref;
5166 }
5167 int8_tArray CS_LDK_LDKMessageSendEvent_SendChannelReady_get_node_id(int64_t ptr) {
5168         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5169         CHECK(obj->tag == LDKMessageSendEvent_SendChannelReady);
5170         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
5171         memcpy(node_id_arr->elems, obj->send_channel_ready.node_id.compressed_form, 33);
5172         return node_id_arr;
5173 }
5174 int64_t CS_LDK_LDKMessageSendEvent_SendChannelReady_get_msg(int64_t ptr) {
5175         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5176         CHECK(obj->tag == LDKMessageSendEvent_SendChannelReady);
5177         LDKChannelReady msg_var = obj->send_channel_ready.msg;
5178                         int64_t msg_ref = 0;
5179                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5180                         msg_ref = tag_ptr(msg_var.inner, false);
5181         return msg_ref;
5182 }
5183 int8_tArray CS_LDK_LDKMessageSendEvent_SendAnnouncementSignatures_get_node_id(int64_t ptr) {
5184         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5185         CHECK(obj->tag == LDKMessageSendEvent_SendAnnouncementSignatures);
5186         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
5187         memcpy(node_id_arr->elems, obj->send_announcement_signatures.node_id.compressed_form, 33);
5188         return node_id_arr;
5189 }
5190 int64_t CS_LDK_LDKMessageSendEvent_SendAnnouncementSignatures_get_msg(int64_t ptr) {
5191         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5192         CHECK(obj->tag == LDKMessageSendEvent_SendAnnouncementSignatures);
5193         LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
5194                         int64_t msg_ref = 0;
5195                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5196                         msg_ref = tag_ptr(msg_var.inner, false);
5197         return msg_ref;
5198 }
5199 int8_tArray CS_LDK_LDKMessageSendEvent_UpdateHTLCs_get_node_id(int64_t ptr) {
5200         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5201         CHECK(obj->tag == LDKMessageSendEvent_UpdateHTLCs);
5202         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
5203         memcpy(node_id_arr->elems, obj->update_htl_cs.node_id.compressed_form, 33);
5204         return node_id_arr;
5205 }
5206 int64_t CS_LDK_LDKMessageSendEvent_UpdateHTLCs_get_updates(int64_t ptr) {
5207         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5208         CHECK(obj->tag == LDKMessageSendEvent_UpdateHTLCs);
5209         LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
5210                         int64_t updates_ref = 0;
5211                         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_var);
5212                         updates_ref = tag_ptr(updates_var.inner, false);
5213         return updates_ref;
5214 }
5215 int8_tArray CS_LDK_LDKMessageSendEvent_SendRevokeAndACK_get_node_id(int64_t ptr) {
5216         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5217         CHECK(obj->tag == LDKMessageSendEvent_SendRevokeAndACK);
5218         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
5219         memcpy(node_id_arr->elems, obj->send_revoke_and_ack.node_id.compressed_form, 33);
5220         return node_id_arr;
5221 }
5222 int64_t CS_LDK_LDKMessageSendEvent_SendRevokeAndACK_get_msg(int64_t ptr) {
5223         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5224         CHECK(obj->tag == LDKMessageSendEvent_SendRevokeAndACK);
5225         LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
5226                         int64_t msg_ref = 0;
5227                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5228                         msg_ref = tag_ptr(msg_var.inner, false);
5229         return msg_ref;
5230 }
5231 int8_tArray CS_LDK_LDKMessageSendEvent_SendClosingSigned_get_node_id(int64_t ptr) {
5232         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5233         CHECK(obj->tag == LDKMessageSendEvent_SendClosingSigned);
5234         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
5235         memcpy(node_id_arr->elems, obj->send_closing_signed.node_id.compressed_form, 33);
5236         return node_id_arr;
5237 }
5238 int64_t CS_LDK_LDKMessageSendEvent_SendClosingSigned_get_msg(int64_t ptr) {
5239         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5240         CHECK(obj->tag == LDKMessageSendEvent_SendClosingSigned);
5241         LDKClosingSigned msg_var = obj->send_closing_signed.msg;
5242                         int64_t msg_ref = 0;
5243                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5244                         msg_ref = tag_ptr(msg_var.inner, false);
5245         return msg_ref;
5246 }
5247 int8_tArray CS_LDK_LDKMessageSendEvent_SendShutdown_get_node_id(int64_t ptr) {
5248         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5249         CHECK(obj->tag == LDKMessageSendEvent_SendShutdown);
5250         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
5251         memcpy(node_id_arr->elems, obj->send_shutdown.node_id.compressed_form, 33);
5252         return node_id_arr;
5253 }
5254 int64_t CS_LDK_LDKMessageSendEvent_SendShutdown_get_msg(int64_t ptr) {
5255         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5256         CHECK(obj->tag == LDKMessageSendEvent_SendShutdown);
5257         LDKShutdown msg_var = obj->send_shutdown.msg;
5258                         int64_t msg_ref = 0;
5259                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5260                         msg_ref = tag_ptr(msg_var.inner, false);
5261         return msg_ref;
5262 }
5263 int8_tArray CS_LDK_LDKMessageSendEvent_SendChannelReestablish_get_node_id(int64_t ptr) {
5264         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5265         CHECK(obj->tag == LDKMessageSendEvent_SendChannelReestablish);
5266         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
5267         memcpy(node_id_arr->elems, obj->send_channel_reestablish.node_id.compressed_form, 33);
5268         return node_id_arr;
5269 }
5270 int64_t CS_LDK_LDKMessageSendEvent_SendChannelReestablish_get_msg(int64_t ptr) {
5271         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5272         CHECK(obj->tag == LDKMessageSendEvent_SendChannelReestablish);
5273         LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
5274                         int64_t msg_ref = 0;
5275                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5276                         msg_ref = tag_ptr(msg_var.inner, false);
5277         return msg_ref;
5278 }
5279 int8_tArray CS_LDK_LDKMessageSendEvent_SendChannelAnnouncement_get_node_id(int64_t ptr) {
5280         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5281         CHECK(obj->tag == LDKMessageSendEvent_SendChannelAnnouncement);
5282         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
5283         memcpy(node_id_arr->elems, obj->send_channel_announcement.node_id.compressed_form, 33);
5284         return node_id_arr;
5285 }
5286 int64_t CS_LDK_LDKMessageSendEvent_SendChannelAnnouncement_get_msg(int64_t ptr) {
5287         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5288         CHECK(obj->tag == LDKMessageSendEvent_SendChannelAnnouncement);
5289         LDKChannelAnnouncement msg_var = obj->send_channel_announcement.msg;
5290                         int64_t msg_ref = 0;
5291                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5292                         msg_ref = tag_ptr(msg_var.inner, false);
5293         return msg_ref;
5294 }
5295 int64_t CS_LDK_LDKMessageSendEvent_SendChannelAnnouncement_get_update_msg(int64_t ptr) {
5296         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5297         CHECK(obj->tag == LDKMessageSendEvent_SendChannelAnnouncement);
5298         LDKChannelUpdate update_msg_var = obj->send_channel_announcement.update_msg;
5299                         int64_t update_msg_ref = 0;
5300                         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_var);
5301                         update_msg_ref = tag_ptr(update_msg_var.inner, false);
5302         return update_msg_ref;
5303 }
5304 int64_t CS_LDK_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_msg(int64_t ptr) {
5305         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5306         CHECK(obj->tag == LDKMessageSendEvent_BroadcastChannelAnnouncement);
5307         LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
5308                         int64_t msg_ref = 0;
5309                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5310                         msg_ref = tag_ptr(msg_var.inner, false);
5311         return msg_ref;
5312 }
5313 int64_t CS_LDK_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_update_msg(int64_t ptr) {
5314         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5315         CHECK(obj->tag == LDKMessageSendEvent_BroadcastChannelAnnouncement);
5316         LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
5317                         int64_t update_msg_ref = 0;
5318                         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_var);
5319                         update_msg_ref = tag_ptr(update_msg_var.inner, false);
5320         return update_msg_ref;
5321 }
5322 int64_t CS_LDK_LDKMessageSendEvent_BroadcastChannelUpdate_get_msg(int64_t ptr) {
5323         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5324         CHECK(obj->tag == LDKMessageSendEvent_BroadcastChannelUpdate);
5325         LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
5326                         int64_t msg_ref = 0;
5327                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5328                         msg_ref = tag_ptr(msg_var.inner, false);
5329         return msg_ref;
5330 }
5331 int64_t CS_LDK_LDKMessageSendEvent_BroadcastNodeAnnouncement_get_msg(int64_t ptr) {
5332         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5333         CHECK(obj->tag == LDKMessageSendEvent_BroadcastNodeAnnouncement);
5334         LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
5335                         int64_t msg_ref = 0;
5336                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5337                         msg_ref = tag_ptr(msg_var.inner, false);
5338         return msg_ref;
5339 }
5340 int8_tArray CS_LDK_LDKMessageSendEvent_SendChannelUpdate_get_node_id(int64_t ptr) {
5341         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5342         CHECK(obj->tag == LDKMessageSendEvent_SendChannelUpdate);
5343         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
5344         memcpy(node_id_arr->elems, obj->send_channel_update.node_id.compressed_form, 33);
5345         return node_id_arr;
5346 }
5347 int64_t CS_LDK_LDKMessageSendEvent_SendChannelUpdate_get_msg(int64_t ptr) {
5348         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5349         CHECK(obj->tag == LDKMessageSendEvent_SendChannelUpdate);
5350         LDKChannelUpdate msg_var = obj->send_channel_update.msg;
5351                         int64_t msg_ref = 0;
5352                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5353                         msg_ref = tag_ptr(msg_var.inner, false);
5354         return msg_ref;
5355 }
5356 int8_tArray CS_LDK_LDKMessageSendEvent_HandleError_get_node_id(int64_t ptr) {
5357         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5358         CHECK(obj->tag == LDKMessageSendEvent_HandleError);
5359         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
5360         memcpy(node_id_arr->elems, obj->handle_error.node_id.compressed_form, 33);
5361         return node_id_arr;
5362 }
5363 int64_t CS_LDK_LDKMessageSendEvent_HandleError_get_action(int64_t ptr) {
5364         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5365         CHECK(obj->tag == LDKMessageSendEvent_HandleError);
5366         int64_t action_ref = tag_ptr(&obj->handle_error.action, false);
5367         return action_ref;
5368 }
5369 int8_tArray CS_LDK_LDKMessageSendEvent_SendChannelRangeQuery_get_node_id(int64_t ptr) {
5370         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5371         CHECK(obj->tag == LDKMessageSendEvent_SendChannelRangeQuery);
5372         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
5373         memcpy(node_id_arr->elems, obj->send_channel_range_query.node_id.compressed_form, 33);
5374         return node_id_arr;
5375 }
5376 int64_t CS_LDK_LDKMessageSendEvent_SendChannelRangeQuery_get_msg(int64_t ptr) {
5377         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5378         CHECK(obj->tag == LDKMessageSendEvent_SendChannelRangeQuery);
5379         LDKQueryChannelRange msg_var = obj->send_channel_range_query.msg;
5380                         int64_t msg_ref = 0;
5381                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5382                         msg_ref = tag_ptr(msg_var.inner, false);
5383         return msg_ref;
5384 }
5385 int8_tArray CS_LDK_LDKMessageSendEvent_SendShortIdsQuery_get_node_id(int64_t ptr) {
5386         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5387         CHECK(obj->tag == LDKMessageSendEvent_SendShortIdsQuery);
5388         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
5389         memcpy(node_id_arr->elems, obj->send_short_ids_query.node_id.compressed_form, 33);
5390         return node_id_arr;
5391 }
5392 int64_t CS_LDK_LDKMessageSendEvent_SendShortIdsQuery_get_msg(int64_t ptr) {
5393         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5394         CHECK(obj->tag == LDKMessageSendEvent_SendShortIdsQuery);
5395         LDKQueryShortChannelIds msg_var = obj->send_short_ids_query.msg;
5396                         int64_t msg_ref = 0;
5397                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5398                         msg_ref = tag_ptr(msg_var.inner, false);
5399         return msg_ref;
5400 }
5401 int8_tArray CS_LDK_LDKMessageSendEvent_SendReplyChannelRange_get_node_id(int64_t ptr) {
5402         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5403         CHECK(obj->tag == LDKMessageSendEvent_SendReplyChannelRange);
5404         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
5405         memcpy(node_id_arr->elems, obj->send_reply_channel_range.node_id.compressed_form, 33);
5406         return node_id_arr;
5407 }
5408 int64_t CS_LDK_LDKMessageSendEvent_SendReplyChannelRange_get_msg(int64_t ptr) {
5409         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5410         CHECK(obj->tag == LDKMessageSendEvent_SendReplyChannelRange);
5411         LDKReplyChannelRange msg_var = obj->send_reply_channel_range.msg;
5412                         int64_t msg_ref = 0;
5413                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5414                         msg_ref = tag_ptr(msg_var.inner, false);
5415         return msg_ref;
5416 }
5417 int8_tArray CS_LDK_LDKMessageSendEvent_SendGossipTimestampFilter_get_node_id(int64_t ptr) {
5418         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5419         CHECK(obj->tag == LDKMessageSendEvent_SendGossipTimestampFilter);
5420         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
5421         memcpy(node_id_arr->elems, obj->send_gossip_timestamp_filter.node_id.compressed_form, 33);
5422         return node_id_arr;
5423 }
5424 int64_t CS_LDK_LDKMessageSendEvent_SendGossipTimestampFilter_get_msg(int64_t ptr) {
5425         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5426         CHECK(obj->tag == LDKMessageSendEvent_SendGossipTimestampFilter);
5427         LDKGossipTimestampFilter msg_var = obj->send_gossip_timestamp_filter.msg;
5428                         int64_t msg_ref = 0;
5429                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5430                         msg_ref = tag_ptr(msg_var.inner, false);
5431         return msg_ref;
5432 }
5433 static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCVec_MessageSendEventZ *orig) {
5434         LDKCVec_MessageSendEventZ ret = { .data = MALLOC(sizeof(LDKMessageSendEvent) * orig->datalen, "LDKCVec_MessageSendEventZ clone bytes"), .datalen = orig->datalen };
5435         for (size_t i = 0; i < ret.datalen; i++) {
5436                 ret.data[i] = MessageSendEvent_clone(&orig->data[i]);
5437         }
5438         return ret;
5439 }
5440 static inline struct LDKChannelUpdateInfo CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){
5441         LDKChannelUpdateInfo ret = *owner->contents.result;
5442         ret.is_owned = false;
5443         return ret;
5444 }
5445 int64_t  CS_LDK_CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(int64_t owner) {
5446         LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(owner);
5447         LDKChannelUpdateInfo ret_var = CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(owner_conv);
5448         int64_t ret_ref = 0;
5449         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5450         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5451         return ret_ref;
5452 }
5453
5454 static inline struct LDKDecodeError CResult_ChannelUpdateInfoDecodeErrorZ_get_err(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){
5455 CHECK(!owner->result_ok);
5456         return DecodeError_clone(&*owner->contents.err);
5457 }
5458 int64_t  CS_LDK_CResult_ChannelUpdateInfoDecodeErrorZ_get_err(int64_t owner) {
5459         LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(owner);
5460         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5461         *ret_copy = CResult_ChannelUpdateInfoDecodeErrorZ_get_err(owner_conv);
5462         int64_t ret_ref = tag_ptr(ret_copy, true);
5463         return ret_ref;
5464 }
5465
5466 static inline struct LDKChannelInfo CResult_ChannelInfoDecodeErrorZ_get_ok(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
5467         LDKChannelInfo ret = *owner->contents.result;
5468         ret.is_owned = false;
5469         return ret;
5470 }
5471 int64_t  CS_LDK_CResult_ChannelInfoDecodeErrorZ_get_ok(int64_t owner) {
5472         LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(owner);
5473         LDKChannelInfo ret_var = CResult_ChannelInfoDecodeErrorZ_get_ok(owner_conv);
5474         int64_t ret_ref = 0;
5475         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5476         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5477         return ret_ref;
5478 }
5479
5480 static inline struct LDKDecodeError CResult_ChannelInfoDecodeErrorZ_get_err(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
5481 CHECK(!owner->result_ok);
5482         return DecodeError_clone(&*owner->contents.err);
5483 }
5484 int64_t  CS_LDK_CResult_ChannelInfoDecodeErrorZ_get_err(int64_t owner) {
5485         LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(owner);
5486         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5487         *ret_copy = CResult_ChannelInfoDecodeErrorZ_get_err(owner_conv);
5488         int64_t ret_ref = tag_ptr(ret_copy, true);
5489         return ret_ref;
5490 }
5491
5492 static inline struct LDKRoutingFees CResult_RoutingFeesDecodeErrorZ_get_ok(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
5493         LDKRoutingFees ret = *owner->contents.result;
5494         ret.is_owned = false;
5495         return ret;
5496 }
5497 int64_t  CS_LDK_CResult_RoutingFeesDecodeErrorZ_get_ok(int64_t owner) {
5498         LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(owner);
5499         LDKRoutingFees ret_var = CResult_RoutingFeesDecodeErrorZ_get_ok(owner_conv);
5500         int64_t ret_ref = 0;
5501         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5502         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5503         return ret_ref;
5504 }
5505
5506 static inline struct LDKDecodeError CResult_RoutingFeesDecodeErrorZ_get_err(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
5507 CHECK(!owner->result_ok);
5508         return DecodeError_clone(&*owner->contents.err);
5509 }
5510 int64_t  CS_LDK_CResult_RoutingFeesDecodeErrorZ_get_err(int64_t owner) {
5511         LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(owner);
5512         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5513         *ret_copy = CResult_RoutingFeesDecodeErrorZ_get_err(owner_conv);
5514         int64_t ret_ref = tag_ptr(ret_copy, true);
5515         return ret_ref;
5516 }
5517
5518 uint32_t CS_LDK_LDKSocketAddress_ty_from_ptr(int64_t ptr) {
5519         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
5520         switch(obj->tag) {
5521                 case LDKSocketAddress_TcpIpV4: return 0;
5522                 case LDKSocketAddress_TcpIpV6: return 1;
5523                 case LDKSocketAddress_OnionV2: return 2;
5524                 case LDKSocketAddress_OnionV3: return 3;
5525                 case LDKSocketAddress_Hostname: return 4;
5526                 default: abort();
5527         }
5528 }
5529 int8_tArray CS_LDK_LDKSocketAddress_TcpIpV4_get_addr(int64_t ptr) {
5530         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
5531         CHECK(obj->tag == LDKSocketAddress_TcpIpV4);
5532         int8_tArray addr_arr = init_int8_tArray(4, __LINE__);
5533         memcpy(addr_arr->elems, obj->tcp_ip_v4.addr.data, 4);
5534         return addr_arr;
5535 }
5536 int16_t CS_LDK_LDKSocketAddress_TcpIpV4_get_port(int64_t ptr) {
5537         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
5538         CHECK(obj->tag == LDKSocketAddress_TcpIpV4);
5539         int16_t port_conv = obj->tcp_ip_v4.port;
5540         return port_conv;
5541 }
5542 int8_tArray CS_LDK_LDKSocketAddress_TcpIpV6_get_addr(int64_t ptr) {
5543         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
5544         CHECK(obj->tag == LDKSocketAddress_TcpIpV6);
5545         int8_tArray addr_arr = init_int8_tArray(16, __LINE__);
5546         memcpy(addr_arr->elems, obj->tcp_ip_v6.addr.data, 16);
5547         return addr_arr;
5548 }
5549 int16_t CS_LDK_LDKSocketAddress_TcpIpV6_get_port(int64_t ptr) {
5550         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
5551         CHECK(obj->tag == LDKSocketAddress_TcpIpV6);
5552         int16_t port_conv = obj->tcp_ip_v6.port;
5553         return port_conv;
5554 }
5555 int8_tArray CS_LDK_LDKSocketAddress_OnionV2_get_onion_v2(int64_t ptr) {
5556         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
5557         CHECK(obj->tag == LDKSocketAddress_OnionV2);
5558         int8_tArray onion_v2_arr = init_int8_tArray(12, __LINE__);
5559         memcpy(onion_v2_arr->elems, obj->onion_v2.data, 12);
5560         return onion_v2_arr;
5561 }
5562 int8_tArray CS_LDK_LDKSocketAddress_OnionV3_get_ed25519_pubkey(int64_t ptr) {
5563         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
5564         CHECK(obj->tag == LDKSocketAddress_OnionV3);
5565         int8_tArray ed25519_pubkey_arr = init_int8_tArray(32, __LINE__);
5566         memcpy(ed25519_pubkey_arr->elems, obj->onion_v3.ed25519_pubkey.data, 32);
5567         return ed25519_pubkey_arr;
5568 }
5569 int16_t CS_LDK_LDKSocketAddress_OnionV3_get_checksum(int64_t ptr) {
5570         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
5571         CHECK(obj->tag == LDKSocketAddress_OnionV3);
5572         int16_t checksum_conv = obj->onion_v3.checksum;
5573         return checksum_conv;
5574 }
5575 int8_t CS_LDK_LDKSocketAddress_OnionV3_get_version(int64_t ptr) {
5576         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
5577         CHECK(obj->tag == LDKSocketAddress_OnionV3);
5578         int8_t version_conv = obj->onion_v3.version;
5579         return version_conv;
5580 }
5581 int16_t CS_LDK_LDKSocketAddress_OnionV3_get_port(int64_t ptr) {
5582         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
5583         CHECK(obj->tag == LDKSocketAddress_OnionV3);
5584         int16_t port_conv = obj->onion_v3.port;
5585         return port_conv;
5586 }
5587 int64_t CS_LDK_LDKSocketAddress_Hostname_get_hostname(int64_t ptr) {
5588         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
5589         CHECK(obj->tag == LDKSocketAddress_Hostname);
5590         LDKHostname hostname_var = obj->hostname.hostname;
5591                         int64_t hostname_ref = 0;
5592                         CHECK_INNER_FIELD_ACCESS_OR_NULL(hostname_var);
5593                         hostname_ref = tag_ptr(hostname_var.inner, false);
5594         return hostname_ref;
5595 }
5596 int16_t CS_LDK_LDKSocketAddress_Hostname_get_port(int64_t ptr) {
5597         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
5598         CHECK(obj->tag == LDKSocketAddress_Hostname);
5599         int16_t port_conv = obj->hostname.port;
5600         return port_conv;
5601 }
5602 static inline LDKCVec_SocketAddressZ CVec_SocketAddressZ_clone(const LDKCVec_SocketAddressZ *orig) {
5603         LDKCVec_SocketAddressZ ret = { .data = MALLOC(sizeof(LDKSocketAddress) * orig->datalen, "LDKCVec_SocketAddressZ clone bytes"), .datalen = orig->datalen };
5604         for (size_t i = 0; i < ret.datalen; i++) {
5605                 ret.data[i] = SocketAddress_clone(&orig->data[i]);
5606         }
5607         return ret;
5608 }
5609 static inline struct LDKNodeAnnouncementInfo CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
5610         LDKNodeAnnouncementInfo ret = *owner->contents.result;
5611         ret.is_owned = false;
5612         return ret;
5613 }
5614 int64_t  CS_LDK_CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(int64_t owner) {
5615         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(owner);
5616         LDKNodeAnnouncementInfo ret_var = CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(owner_conv);
5617         int64_t ret_ref = 0;
5618         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5619         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5620         return ret_ref;
5621 }
5622
5623 static inline struct LDKDecodeError CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
5624 CHECK(!owner->result_ok);
5625         return DecodeError_clone(&*owner->contents.err);
5626 }
5627 int64_t  CS_LDK_CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(int64_t owner) {
5628         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(owner);
5629         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5630         *ret_copy = CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(owner_conv);
5631         int64_t ret_ref = tag_ptr(ret_copy, true);
5632         return ret_ref;
5633 }
5634
5635 static inline struct LDKNodeAlias CResult_NodeAliasDecodeErrorZ_get_ok(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR owner){
5636         LDKNodeAlias ret = *owner->contents.result;
5637         ret.is_owned = false;
5638         return ret;
5639 }
5640 int64_t  CS_LDK_CResult_NodeAliasDecodeErrorZ_get_ok(int64_t owner) {
5641         LDKCResult_NodeAliasDecodeErrorZ* owner_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(owner);
5642         LDKNodeAlias ret_var = CResult_NodeAliasDecodeErrorZ_get_ok(owner_conv);
5643         int64_t ret_ref = 0;
5644         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5645         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5646         return ret_ref;
5647 }
5648
5649 static inline struct LDKDecodeError CResult_NodeAliasDecodeErrorZ_get_err(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR owner){
5650 CHECK(!owner->result_ok);
5651         return DecodeError_clone(&*owner->contents.err);
5652 }
5653 int64_t  CS_LDK_CResult_NodeAliasDecodeErrorZ_get_err(int64_t owner) {
5654         LDKCResult_NodeAliasDecodeErrorZ* owner_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(owner);
5655         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5656         *ret_copy = CResult_NodeAliasDecodeErrorZ_get_err(owner_conv);
5657         int64_t ret_ref = tag_ptr(ret_copy, true);
5658         return ret_ref;
5659 }
5660
5661 static inline struct LDKNodeInfo CResult_NodeInfoDecodeErrorZ_get_ok(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
5662         LDKNodeInfo ret = *owner->contents.result;
5663         ret.is_owned = false;
5664         return ret;
5665 }
5666 int64_t  CS_LDK_CResult_NodeInfoDecodeErrorZ_get_ok(int64_t owner) {
5667         LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(owner);
5668         LDKNodeInfo ret_var = CResult_NodeInfoDecodeErrorZ_get_ok(owner_conv);
5669         int64_t ret_ref = 0;
5670         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5671         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5672         return ret_ref;
5673 }
5674
5675 static inline struct LDKDecodeError CResult_NodeInfoDecodeErrorZ_get_err(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
5676 CHECK(!owner->result_ok);
5677         return DecodeError_clone(&*owner->contents.err);
5678 }
5679 int64_t  CS_LDK_CResult_NodeInfoDecodeErrorZ_get_err(int64_t owner) {
5680         LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(owner);
5681         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5682         *ret_copy = CResult_NodeInfoDecodeErrorZ_get_err(owner_conv);
5683         int64_t ret_ref = tag_ptr(ret_copy, true);
5684         return ret_ref;
5685 }
5686
5687 static inline struct LDKNetworkGraph CResult_NetworkGraphDecodeErrorZ_get_ok(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
5688         LDKNetworkGraph ret = *owner->contents.result;
5689         ret.is_owned = false;
5690         return ret;
5691 }
5692 int64_t  CS_LDK_CResult_NetworkGraphDecodeErrorZ_get_ok(int64_t owner) {
5693         LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(owner);
5694         LDKNetworkGraph ret_var = CResult_NetworkGraphDecodeErrorZ_get_ok(owner_conv);
5695         int64_t ret_ref = 0;
5696         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5697         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5698         return ret_ref;
5699 }
5700
5701 static inline struct LDKDecodeError CResult_NetworkGraphDecodeErrorZ_get_err(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
5702 CHECK(!owner->result_ok);
5703         return DecodeError_clone(&*owner->contents.err);
5704 }
5705 int64_t  CS_LDK_CResult_NetworkGraphDecodeErrorZ_get_err(int64_t owner) {
5706         LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(owner);
5707         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5708         *ret_copy = CResult_NetworkGraphDecodeErrorZ_get_err(owner_conv);
5709         int64_t ret_ref = tag_ptr(ret_copy, true);
5710         return ret_ref;
5711 }
5712
5713 uint32_t CS_LDK_LDKCOption_CVec_SocketAddressZZ_ty_from_ptr(int64_t ptr) {
5714         LDKCOption_CVec_SocketAddressZZ *obj = (LDKCOption_CVec_SocketAddressZZ*)untag_ptr(ptr);
5715         switch(obj->tag) {
5716                 case LDKCOption_CVec_SocketAddressZZ_Some: return 0;
5717                 case LDKCOption_CVec_SocketAddressZZ_None: return 1;
5718                 default: abort();
5719         }
5720 }
5721 int64_tArray CS_LDK_LDKCOption_CVec_SocketAddressZZ_Some_get_some(int64_t ptr) {
5722         LDKCOption_CVec_SocketAddressZZ *obj = (LDKCOption_CVec_SocketAddressZZ*)untag_ptr(ptr);
5723         CHECK(obj->tag == LDKCOption_CVec_SocketAddressZZ_Some);
5724         LDKCVec_SocketAddressZ some_var = obj->some;
5725                         int64_tArray some_arr = NULL;
5726                         some_arr = init_int64_tArray(some_var.datalen, __LINE__);
5727                         int64_t *some_arr_ptr = (int64_t*)(((uint8_t*)some_arr) + 8);
5728                         for (size_t p = 0; p < some_var.datalen; p++) {
5729                                 int64_t some_conv_15_ref = tag_ptr(&some_var.data[p], false);
5730                                 some_arr_ptr[p] = some_conv_15_ref;
5731                         }
5732                         
5733         return some_arr;
5734 }
5735 static inline uint64_t CResult_u64ShortChannelIdErrorZ_get_ok(LDKCResult_u64ShortChannelIdErrorZ *NONNULL_PTR owner){
5736 CHECK(owner->result_ok);
5737         return *owner->contents.result;
5738 }
5739 int64_t  CS_LDK_CResult_u64ShortChannelIdErrorZ_get_ok(int64_t owner) {
5740         LDKCResult_u64ShortChannelIdErrorZ* owner_conv = (LDKCResult_u64ShortChannelIdErrorZ*)untag_ptr(owner);
5741         int64_t ret_conv = CResult_u64ShortChannelIdErrorZ_get_ok(owner_conv);
5742         return ret_conv;
5743 }
5744
5745 static inline enum LDKShortChannelIdError CResult_u64ShortChannelIdErrorZ_get_err(LDKCResult_u64ShortChannelIdErrorZ *NONNULL_PTR owner){
5746 CHECK(!owner->result_ok);
5747         return ShortChannelIdError_clone(&*owner->contents.err);
5748 }
5749 int32_t  CS_LDK_CResult_u64ShortChannelIdErrorZ_get_err(int64_t owner) {
5750         LDKCResult_u64ShortChannelIdErrorZ* owner_conv = (LDKCResult_u64ShortChannelIdErrorZ*)untag_ptr(owner);
5751         int32_t ret_conv = LDKShortChannelIdError_to_cs(CResult_u64ShortChannelIdErrorZ_get_err(owner_conv));
5752         return ret_conv;
5753 }
5754
5755 static inline struct LDKPendingHTLCInfo CResult_PendingHTLCInfoInboundHTLCErrZ_get_ok(LDKCResult_PendingHTLCInfoInboundHTLCErrZ *NONNULL_PTR owner){
5756         LDKPendingHTLCInfo ret = *owner->contents.result;
5757         ret.is_owned = false;
5758         return ret;
5759 }
5760 int64_t  CS_LDK_CResult_PendingHTLCInfoInboundHTLCErrZ_get_ok(int64_t owner) {
5761         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* owner_conv = (LDKCResult_PendingHTLCInfoInboundHTLCErrZ*)untag_ptr(owner);
5762         LDKPendingHTLCInfo ret_var = CResult_PendingHTLCInfoInboundHTLCErrZ_get_ok(owner_conv);
5763         int64_t ret_ref = 0;
5764         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5765         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5766         return ret_ref;
5767 }
5768
5769 static inline struct LDKInboundHTLCErr CResult_PendingHTLCInfoInboundHTLCErrZ_get_err(LDKCResult_PendingHTLCInfoInboundHTLCErrZ *NONNULL_PTR owner){
5770         LDKInboundHTLCErr ret = *owner->contents.err;
5771         ret.is_owned = false;
5772         return ret;
5773 }
5774 int64_t  CS_LDK_CResult_PendingHTLCInfoInboundHTLCErrZ_get_err(int64_t owner) {
5775         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* owner_conv = (LDKCResult_PendingHTLCInfoInboundHTLCErrZ*)untag_ptr(owner);
5776         LDKInboundHTLCErr ret_var = CResult_PendingHTLCInfoInboundHTLCErrZ_get_err(owner_conv);
5777         int64_t ret_ref = 0;
5778         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5779         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5780         return ret_ref;
5781 }
5782
5783 static inline LDKCVec_HTLCOutputInCommitmentZ CVec_HTLCOutputInCommitmentZ_clone(const LDKCVec_HTLCOutputInCommitmentZ *orig) {
5784         LDKCVec_HTLCOutputInCommitmentZ ret = { .data = MALLOC(sizeof(LDKHTLCOutputInCommitment) * orig->datalen, "LDKCVec_HTLCOutputInCommitmentZ clone bytes"), .datalen = orig->datalen };
5785         for (size_t i = 0; i < ret.datalen; i++) {
5786                 ret.data[i] = HTLCOutputInCommitment_clone(&orig->data[i]);
5787         }
5788         return ret;
5789 }
5790 static inline LDKCVec_HTLCDescriptorZ CVec_HTLCDescriptorZ_clone(const LDKCVec_HTLCDescriptorZ *orig) {
5791         LDKCVec_HTLCDescriptorZ ret = { .data = MALLOC(sizeof(LDKHTLCDescriptor) * orig->datalen, "LDKCVec_HTLCDescriptorZ clone bytes"), .datalen = orig->datalen };
5792         for (size_t i = 0; i < ret.datalen; i++) {
5793                 ret.data[i] = HTLCDescriptor_clone(&orig->data[i]);
5794         }
5795         return ret;
5796 }
5797 static inline LDKCVec_UtxoZ CVec_UtxoZ_clone(const LDKCVec_UtxoZ *orig) {
5798         LDKCVec_UtxoZ ret = { .data = MALLOC(sizeof(LDKUtxo) * orig->datalen, "LDKCVec_UtxoZ clone bytes"), .datalen = orig->datalen };
5799         for (size_t i = 0; i < ret.datalen; i++) {
5800                 ret.data[i] = Utxo_clone(&orig->data[i]);
5801         }
5802         return ret;
5803 }
5804 uint32_t CS_LDK_LDKCOption_TxOutZ_ty_from_ptr(int64_t ptr) {
5805         LDKCOption_TxOutZ *obj = (LDKCOption_TxOutZ*)untag_ptr(ptr);
5806         switch(obj->tag) {
5807                 case LDKCOption_TxOutZ_Some: return 0;
5808                 case LDKCOption_TxOutZ_None: return 1;
5809                 default: abort();
5810         }
5811 }
5812 int64_t CS_LDK_LDKCOption_TxOutZ_Some_get_some(int64_t ptr) {
5813         LDKCOption_TxOutZ *obj = (LDKCOption_TxOutZ*)untag_ptr(ptr);
5814         CHECK(obj->tag == LDKCOption_TxOutZ_Some);
5815         LDKTxOut* some_ref = &obj->some;
5816         return tag_ptr(some_ref, false);
5817 }
5818 static inline LDKCVec_InputZ CVec_InputZ_clone(const LDKCVec_InputZ *orig) {
5819         LDKCVec_InputZ ret = { .data = MALLOC(sizeof(LDKInput) * orig->datalen, "LDKCVec_InputZ clone bytes"), .datalen = orig->datalen };
5820         for (size_t i = 0; i < ret.datalen; i++) {
5821                 ret.data[i] = Input_clone(&orig->data[i]);
5822         }
5823         return ret;
5824 }
5825 static inline struct LDKCoinSelection CResult_CoinSelectionNoneZ_get_ok(LDKCResult_CoinSelectionNoneZ *NONNULL_PTR owner){
5826         LDKCoinSelection ret = *owner->contents.result;
5827         ret.is_owned = false;
5828         return ret;
5829 }
5830 int64_t  CS_LDK_CResult_CoinSelectionNoneZ_get_ok(int64_t owner) {
5831         LDKCResult_CoinSelectionNoneZ* owner_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(owner);
5832         LDKCoinSelection ret_var = CResult_CoinSelectionNoneZ_get_ok(owner_conv);
5833         int64_t ret_ref = 0;
5834         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5835         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5836         return ret_ref;
5837 }
5838
5839 static inline void CResult_CoinSelectionNoneZ_get_err(LDKCResult_CoinSelectionNoneZ *NONNULL_PTR owner){
5840 CHECK(!owner->result_ok);
5841         return *owner->contents.err;
5842 }
5843 void  CS_LDK_CResult_CoinSelectionNoneZ_get_err(int64_t owner) {
5844         LDKCResult_CoinSelectionNoneZ* owner_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(owner);
5845         CResult_CoinSelectionNoneZ_get_err(owner_conv);
5846 }
5847
5848 static inline struct LDKCVec_UtxoZ CResult_CVec_UtxoZNoneZ_get_ok(LDKCResult_CVec_UtxoZNoneZ *NONNULL_PTR owner){
5849 CHECK(owner->result_ok);
5850         return CVec_UtxoZ_clone(&*owner->contents.result);
5851 }
5852 int64_tArray  CS_LDK_CResult_CVec_UtxoZNoneZ_get_ok(int64_t owner) {
5853         LDKCResult_CVec_UtxoZNoneZ* owner_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(owner);
5854         LDKCVec_UtxoZ ret_var = CResult_CVec_UtxoZNoneZ_get_ok(owner_conv);
5855         int64_tArray ret_arr = NULL;
5856         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
5857         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
5858         for (size_t g = 0; g < ret_var.datalen; g++) {
5859                 LDKUtxo ret_conv_6_var = ret_var.data[g];
5860                 int64_t ret_conv_6_ref = 0;
5861                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_6_var);
5862                 ret_conv_6_ref = tag_ptr(ret_conv_6_var.inner, ret_conv_6_var.is_owned);
5863                 ret_arr_ptr[g] = ret_conv_6_ref;
5864         }
5865         
5866         FREE(ret_var.data);
5867         return ret_arr;
5868 }
5869
5870 static inline void CResult_CVec_UtxoZNoneZ_get_err(LDKCResult_CVec_UtxoZNoneZ *NONNULL_PTR owner){
5871 CHECK(!owner->result_ok);
5872         return *owner->contents.err;
5873 }
5874 void  CS_LDK_CResult_CVec_UtxoZNoneZ_get_err(int64_t owner) {
5875         LDKCResult_CVec_UtxoZNoneZ* owner_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(owner);
5876         CResult_CVec_UtxoZNoneZ_get_err(owner_conv);
5877 }
5878
5879 uint32_t CS_LDK_LDKPaymentContext_ty_from_ptr(int64_t ptr) {
5880         LDKPaymentContext *obj = (LDKPaymentContext*)untag_ptr(ptr);
5881         switch(obj->tag) {
5882                 case LDKPaymentContext_Unknown: return 0;
5883                 case LDKPaymentContext_Bolt12Offer: return 1;
5884                 case LDKPaymentContext_Bolt12Refund: return 2;
5885                 default: abort();
5886         }
5887 }
5888 int64_t CS_LDK_LDKPaymentContext_Unknown_get_unknown(int64_t ptr) {
5889         LDKPaymentContext *obj = (LDKPaymentContext*)untag_ptr(ptr);
5890         CHECK(obj->tag == LDKPaymentContext_Unknown);
5891         LDKUnknownPaymentContext unknown_var = obj->unknown;
5892                         int64_t unknown_ref = 0;
5893                         CHECK_INNER_FIELD_ACCESS_OR_NULL(unknown_var);
5894                         unknown_ref = tag_ptr(unknown_var.inner, false);
5895         return unknown_ref;
5896 }
5897 int64_t CS_LDK_LDKPaymentContext_Bolt12Offer_get_bolt12_offer(int64_t ptr) {
5898         LDKPaymentContext *obj = (LDKPaymentContext*)untag_ptr(ptr);
5899         CHECK(obj->tag == LDKPaymentContext_Bolt12Offer);
5900         LDKBolt12OfferContext bolt12_offer_var = obj->bolt12_offer;
5901                         int64_t bolt12_offer_ref = 0;
5902                         CHECK_INNER_FIELD_ACCESS_OR_NULL(bolt12_offer_var);
5903                         bolt12_offer_ref = tag_ptr(bolt12_offer_var.inner, false);
5904         return bolt12_offer_ref;
5905 }
5906 int64_t CS_LDK_LDKPaymentContext_Bolt12Refund_get_bolt12_refund(int64_t ptr) {
5907         LDKPaymentContext *obj = (LDKPaymentContext*)untag_ptr(ptr);
5908         CHECK(obj->tag == LDKPaymentContext_Bolt12Refund);
5909         LDKBolt12RefundContext bolt12_refund_var = obj->bolt12_refund;
5910                         int64_t bolt12_refund_ref = 0;
5911                         CHECK_INNER_FIELD_ACCESS_OR_NULL(bolt12_refund_var);
5912                         bolt12_refund_ref = tag_ptr(bolt12_refund_var.inner, false);
5913         return bolt12_refund_ref;
5914 }
5915 uint32_t CS_LDK_LDKCOption_PaymentContextZ_ty_from_ptr(int64_t ptr) {
5916         LDKCOption_PaymentContextZ *obj = (LDKCOption_PaymentContextZ*)untag_ptr(ptr);
5917         switch(obj->tag) {
5918                 case LDKCOption_PaymentContextZ_Some: return 0;
5919                 case LDKCOption_PaymentContextZ_None: return 1;
5920                 default: abort();
5921         }
5922 }
5923 int64_t CS_LDK_LDKCOption_PaymentContextZ_Some_get_some(int64_t ptr) {
5924         LDKCOption_PaymentContextZ *obj = (LDKCOption_PaymentContextZ*)untag_ptr(ptr);
5925         CHECK(obj->tag == LDKCOption_PaymentContextZ_Some);
5926         int64_t some_ref = tag_ptr(&obj->some, false);
5927         return some_ref;
5928 }
5929 static inline uint64_t C2Tuple_u64u16Z_get_a(LDKC2Tuple_u64u16Z *NONNULL_PTR owner){
5930         return owner->a;
5931 }
5932 int64_t  CS_LDK_C2Tuple_u64u16Z_get_a(int64_t owner) {
5933         LDKC2Tuple_u64u16Z* owner_conv = (LDKC2Tuple_u64u16Z*)untag_ptr(owner);
5934         int64_t ret_conv = C2Tuple_u64u16Z_get_a(owner_conv);
5935         return ret_conv;
5936 }
5937
5938 static inline uint16_t C2Tuple_u64u16Z_get_b(LDKC2Tuple_u64u16Z *NONNULL_PTR owner){
5939         return owner->b;
5940 }
5941 int16_t  CS_LDK_C2Tuple_u64u16Z_get_b(int64_t owner) {
5942         LDKC2Tuple_u64u16Z* owner_conv = (LDKC2Tuple_u64u16Z*)untag_ptr(owner);
5943         int16_t ret_conv = C2Tuple_u64u16Z_get_b(owner_conv);
5944         return ret_conv;
5945 }
5946
5947 uint32_t CS_LDK_LDKCOption_C2Tuple_u64u16ZZ_ty_from_ptr(int64_t ptr) {
5948         LDKCOption_C2Tuple_u64u16ZZ *obj = (LDKCOption_C2Tuple_u64u16ZZ*)untag_ptr(ptr);
5949         switch(obj->tag) {
5950                 case LDKCOption_C2Tuple_u64u16ZZ_Some: return 0;
5951                 case LDKCOption_C2Tuple_u64u16ZZ_None: return 1;
5952                 default: abort();
5953         }
5954 }
5955 int64_t CS_LDK_LDKCOption_C2Tuple_u64u16ZZ_Some_get_some(int64_t ptr) {
5956         LDKCOption_C2Tuple_u64u16ZZ *obj = (LDKCOption_C2Tuple_u64u16ZZ*)untag_ptr(ptr);
5957         CHECK(obj->tag == LDKCOption_C2Tuple_u64u16ZZ_Some);
5958         LDKC2Tuple_u64u16Z* some_conv = MALLOC(sizeof(LDKC2Tuple_u64u16Z), "LDKC2Tuple_u64u16Z");
5959         *some_conv = obj->some;
5960                         *some_conv = C2Tuple_u64u16Z_clone(some_conv);
5961         return tag_ptr(some_conv, true);
5962 }
5963 static inline struct LDKChannelId CResult_ChannelIdAPIErrorZ_get_ok(LDKCResult_ChannelIdAPIErrorZ *NONNULL_PTR owner){
5964         LDKChannelId ret = *owner->contents.result;
5965         ret.is_owned = false;
5966         return ret;
5967 }
5968 int64_t  CS_LDK_CResult_ChannelIdAPIErrorZ_get_ok(int64_t owner) {
5969         LDKCResult_ChannelIdAPIErrorZ* owner_conv = (LDKCResult_ChannelIdAPIErrorZ*)untag_ptr(owner);
5970         LDKChannelId ret_var = CResult_ChannelIdAPIErrorZ_get_ok(owner_conv);
5971         int64_t ret_ref = 0;
5972         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5973         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5974         return ret_ref;
5975 }
5976
5977 static inline struct LDKAPIError CResult_ChannelIdAPIErrorZ_get_err(LDKCResult_ChannelIdAPIErrorZ *NONNULL_PTR owner){
5978 CHECK(!owner->result_ok);
5979         return APIError_clone(&*owner->contents.err);
5980 }
5981 int64_t  CS_LDK_CResult_ChannelIdAPIErrorZ_get_err(int64_t owner) {
5982         LDKCResult_ChannelIdAPIErrorZ* owner_conv = (LDKCResult_ChannelIdAPIErrorZ*)untag_ptr(owner);
5983         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
5984         *ret_copy = CResult_ChannelIdAPIErrorZ_get_err(owner_conv);
5985         int64_t ret_ref = tag_ptr(ret_copy, true);
5986         return ret_ref;
5987 }
5988
5989 uint32_t CS_LDK_LDKRecentPaymentDetails_ty_from_ptr(int64_t ptr) {
5990         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
5991         switch(obj->tag) {
5992                 case LDKRecentPaymentDetails_AwaitingInvoice: return 0;
5993                 case LDKRecentPaymentDetails_Pending: return 1;
5994                 case LDKRecentPaymentDetails_Fulfilled: return 2;
5995                 case LDKRecentPaymentDetails_Abandoned: return 3;
5996                 default: abort();
5997         }
5998 }
5999 int8_tArray CS_LDK_LDKRecentPaymentDetails_AwaitingInvoice_get_payment_id(int64_t ptr) {
6000         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
6001         CHECK(obj->tag == LDKRecentPaymentDetails_AwaitingInvoice);
6002         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
6003         memcpy(payment_id_arr->elems, obj->awaiting_invoice.payment_id.data, 32);
6004         return payment_id_arr;
6005 }
6006 int8_tArray CS_LDK_LDKRecentPaymentDetails_Pending_get_payment_id(int64_t ptr) {
6007         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
6008         CHECK(obj->tag == LDKRecentPaymentDetails_Pending);
6009         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
6010         memcpy(payment_id_arr->elems, obj->pending.payment_id.data, 32);
6011         return payment_id_arr;
6012 }
6013 int8_tArray CS_LDK_LDKRecentPaymentDetails_Pending_get_payment_hash(int64_t ptr) {
6014         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
6015         CHECK(obj->tag == LDKRecentPaymentDetails_Pending);
6016         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
6017         memcpy(payment_hash_arr->elems, obj->pending.payment_hash.data, 32);
6018         return payment_hash_arr;
6019 }
6020 int64_t CS_LDK_LDKRecentPaymentDetails_Pending_get_total_msat(int64_t ptr) {
6021         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
6022         CHECK(obj->tag == LDKRecentPaymentDetails_Pending);
6023         int64_t total_msat_conv = obj->pending.total_msat;
6024         return total_msat_conv;
6025 }
6026 int8_tArray CS_LDK_LDKRecentPaymentDetails_Fulfilled_get_payment_id(int64_t ptr) {
6027         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
6028         CHECK(obj->tag == LDKRecentPaymentDetails_Fulfilled);
6029         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
6030         memcpy(payment_id_arr->elems, obj->fulfilled.payment_id.data, 32);
6031         return payment_id_arr;
6032 }
6033 int64_t CS_LDK_LDKRecentPaymentDetails_Fulfilled_get_payment_hash(int64_t ptr) {
6034         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
6035         CHECK(obj->tag == LDKRecentPaymentDetails_Fulfilled);
6036         int64_t payment_hash_ref = tag_ptr(&obj->fulfilled.payment_hash, false);
6037         return payment_hash_ref;
6038 }
6039 int8_tArray CS_LDK_LDKRecentPaymentDetails_Abandoned_get_payment_id(int64_t ptr) {
6040         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
6041         CHECK(obj->tag == LDKRecentPaymentDetails_Abandoned);
6042         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
6043         memcpy(payment_id_arr->elems, obj->abandoned.payment_id.data, 32);
6044         return payment_id_arr;
6045 }
6046 int8_tArray CS_LDK_LDKRecentPaymentDetails_Abandoned_get_payment_hash(int64_t ptr) {
6047         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
6048         CHECK(obj->tag == LDKRecentPaymentDetails_Abandoned);
6049         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
6050         memcpy(payment_hash_arr->elems, obj->abandoned.payment_hash.data, 32);
6051         return payment_hash_arr;
6052 }
6053 static inline LDKCVec_RecentPaymentDetailsZ CVec_RecentPaymentDetailsZ_clone(const LDKCVec_RecentPaymentDetailsZ *orig) {
6054         LDKCVec_RecentPaymentDetailsZ ret = { .data = MALLOC(sizeof(LDKRecentPaymentDetails) * orig->datalen, "LDKCVec_RecentPaymentDetailsZ clone bytes"), .datalen = orig->datalen };
6055         for (size_t i = 0; i < ret.datalen; i++) {
6056                 ret.data[i] = RecentPaymentDetails_clone(&orig->data[i]);
6057         }
6058         return ret;
6059 }
6060 uint32_t CS_LDK_LDKPaymentSendFailure_ty_from_ptr(int64_t ptr) {
6061         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
6062         switch(obj->tag) {
6063                 case LDKPaymentSendFailure_ParameterError: return 0;
6064                 case LDKPaymentSendFailure_PathParameterError: return 1;
6065                 case LDKPaymentSendFailure_AllFailedResendSafe: return 2;
6066                 case LDKPaymentSendFailure_DuplicatePayment: return 3;
6067                 case LDKPaymentSendFailure_PartialFailure: return 4;
6068                 default: abort();
6069         }
6070 }
6071 int64_t CS_LDK_LDKPaymentSendFailure_ParameterError_get_parameter_error(int64_t ptr) {
6072         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
6073         CHECK(obj->tag == LDKPaymentSendFailure_ParameterError);
6074         int64_t parameter_error_ref = tag_ptr(&obj->parameter_error, false);
6075         return parameter_error_ref;
6076 }
6077 int64_tArray CS_LDK_LDKPaymentSendFailure_PathParameterError_get_path_parameter_error(int64_t ptr) {
6078         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
6079         CHECK(obj->tag == LDKPaymentSendFailure_PathParameterError);
6080         LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error_var = obj->path_parameter_error;
6081                         int64_tArray path_parameter_error_arr = NULL;
6082                         path_parameter_error_arr = init_int64_tArray(path_parameter_error_var.datalen, __LINE__);
6083                         int64_t *path_parameter_error_arr_ptr = (int64_t*)(((uint8_t*)path_parameter_error_arr) + 8);
6084                         for (size_t w = 0; w < path_parameter_error_var.datalen; w++) {
6085                                 LDKCResult_NoneAPIErrorZ* path_parameter_error_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
6086                                 *path_parameter_error_conv_22_conv = path_parameter_error_var.data[w];
6087                                 *path_parameter_error_conv_22_conv = CResult_NoneAPIErrorZ_clone(path_parameter_error_conv_22_conv);
6088                                 path_parameter_error_arr_ptr[w] = tag_ptr(path_parameter_error_conv_22_conv, true);
6089                         }
6090                         
6091         return path_parameter_error_arr;
6092 }
6093 int64_tArray CS_LDK_LDKPaymentSendFailure_AllFailedResendSafe_get_all_failed_resend_safe(int64_t ptr) {
6094         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
6095         CHECK(obj->tag == LDKPaymentSendFailure_AllFailedResendSafe);
6096         LDKCVec_APIErrorZ all_failed_resend_safe_var = obj->all_failed_resend_safe;
6097                         int64_tArray all_failed_resend_safe_arr = NULL;
6098                         all_failed_resend_safe_arr = init_int64_tArray(all_failed_resend_safe_var.datalen, __LINE__);
6099                         int64_t *all_failed_resend_safe_arr_ptr = (int64_t*)(((uint8_t*)all_failed_resend_safe_arr) + 8);
6100                         for (size_t k = 0; k < all_failed_resend_safe_var.datalen; k++) {
6101                                 int64_t all_failed_resend_safe_conv_10_ref = tag_ptr(&all_failed_resend_safe_var.data[k], false);
6102                                 all_failed_resend_safe_arr_ptr[k] = all_failed_resend_safe_conv_10_ref;
6103                         }
6104                         
6105         return all_failed_resend_safe_arr;
6106 }
6107 int64_tArray CS_LDK_LDKPaymentSendFailure_PartialFailure_get_results(int64_t ptr) {
6108         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
6109         CHECK(obj->tag == LDKPaymentSendFailure_PartialFailure);
6110         LDKCVec_CResult_NoneAPIErrorZZ results_var = obj->partial_failure.results;
6111                         int64_tArray results_arr = NULL;
6112                         results_arr = init_int64_tArray(results_var.datalen, __LINE__);
6113                         int64_t *results_arr_ptr = (int64_t*)(((uint8_t*)results_arr) + 8);
6114                         for (size_t w = 0; w < results_var.datalen; w++) {
6115                                 LDKCResult_NoneAPIErrorZ* results_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
6116                                 *results_conv_22_conv = results_var.data[w];
6117                                 *results_conv_22_conv = CResult_NoneAPIErrorZ_clone(results_conv_22_conv);
6118                                 results_arr_ptr[w] = tag_ptr(results_conv_22_conv, true);
6119                         }
6120                         
6121         return results_arr;
6122 }
6123 int64_t CS_LDK_LDKPaymentSendFailure_PartialFailure_get_failed_paths_retry(int64_t ptr) {
6124         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
6125         CHECK(obj->tag == LDKPaymentSendFailure_PartialFailure);
6126         LDKRouteParameters failed_paths_retry_var = obj->partial_failure.failed_paths_retry;
6127                         int64_t failed_paths_retry_ref = 0;
6128                         CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_var);
6129                         failed_paths_retry_ref = tag_ptr(failed_paths_retry_var.inner, false);
6130         return failed_paths_retry_ref;
6131 }
6132 int8_tArray CS_LDK_LDKPaymentSendFailure_PartialFailure_get_payment_id(int64_t ptr) {
6133         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
6134         CHECK(obj->tag == LDKPaymentSendFailure_PartialFailure);
6135         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
6136         memcpy(payment_id_arr->elems, obj->partial_failure.payment_id.data, 32);
6137         return payment_id_arr;
6138 }
6139 static inline void CResult_NonePaymentSendFailureZ_get_ok(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
6140 CHECK(owner->result_ok);
6141         return *owner->contents.result;
6142 }
6143 void  CS_LDK_CResult_NonePaymentSendFailureZ_get_ok(int64_t owner) {
6144         LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(owner);
6145         CResult_NonePaymentSendFailureZ_get_ok(owner_conv);
6146 }
6147
6148 static inline struct LDKPaymentSendFailure CResult_NonePaymentSendFailureZ_get_err(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
6149 CHECK(!owner->result_ok);
6150         return PaymentSendFailure_clone(&*owner->contents.err);
6151 }
6152 int64_t  CS_LDK_CResult_NonePaymentSendFailureZ_get_err(int64_t owner) {
6153         LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(owner);
6154         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
6155         *ret_copy = CResult_NonePaymentSendFailureZ_get_err(owner_conv);
6156         int64_t ret_ref = tag_ptr(ret_copy, true);
6157         return ret_ref;
6158 }
6159
6160 static inline void CResult_NoneRetryableSendFailureZ_get_ok(LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR owner){
6161 CHECK(owner->result_ok);
6162         return *owner->contents.result;
6163 }
6164 void  CS_LDK_CResult_NoneRetryableSendFailureZ_get_ok(int64_t owner) {
6165         LDKCResult_NoneRetryableSendFailureZ* owner_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(owner);
6166         CResult_NoneRetryableSendFailureZ_get_ok(owner_conv);
6167 }
6168
6169 static inline enum LDKRetryableSendFailure CResult_NoneRetryableSendFailureZ_get_err(LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR owner){
6170 CHECK(!owner->result_ok);
6171         return RetryableSendFailure_clone(&*owner->contents.err);
6172 }
6173 int32_t  CS_LDK_CResult_NoneRetryableSendFailureZ_get_err(int64_t owner) {
6174         LDKCResult_NoneRetryableSendFailureZ* owner_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(owner);
6175         int32_t ret_conv = LDKRetryableSendFailure_to_cs(CResult_NoneRetryableSendFailureZ_get_err(owner_conv));
6176         return ret_conv;
6177 }
6178
6179 static inline struct LDKThirtyTwoBytes CResult_ThirtyTwoBytesPaymentSendFailureZ_get_ok(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ *NONNULL_PTR owner){
6180 CHECK(owner->result_ok);
6181         return ThirtyTwoBytes_clone(&*owner->contents.result);
6182 }
6183 int8_tArray  CS_LDK_CResult_ThirtyTwoBytesPaymentSendFailureZ_get_ok(int64_t owner) {
6184         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* owner_conv = (LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)untag_ptr(owner);
6185         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6186         memcpy(ret_arr->elems, CResult_ThirtyTwoBytesPaymentSendFailureZ_get_ok(owner_conv).data, 32);
6187         return ret_arr;
6188 }
6189
6190 static inline struct LDKPaymentSendFailure CResult_ThirtyTwoBytesPaymentSendFailureZ_get_err(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ *NONNULL_PTR owner){
6191 CHECK(!owner->result_ok);
6192         return PaymentSendFailure_clone(&*owner->contents.err);
6193 }
6194 int64_t  CS_LDK_CResult_ThirtyTwoBytesPaymentSendFailureZ_get_err(int64_t owner) {
6195         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* owner_conv = (LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)untag_ptr(owner);
6196         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
6197         *ret_copy = CResult_ThirtyTwoBytesPaymentSendFailureZ_get_err(owner_conv);
6198         int64_t ret_ref = tag_ptr(ret_copy, true);
6199         return ret_ref;
6200 }
6201
6202 static inline struct LDKThirtyTwoBytes CResult_ThirtyTwoBytesRetryableSendFailureZ_get_ok(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ *NONNULL_PTR owner){
6203 CHECK(owner->result_ok);
6204         return ThirtyTwoBytes_clone(&*owner->contents.result);
6205 }
6206 int8_tArray  CS_LDK_CResult_ThirtyTwoBytesRetryableSendFailureZ_get_ok(int64_t owner) {
6207         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* owner_conv = (LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)untag_ptr(owner);
6208         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6209         memcpy(ret_arr->elems, CResult_ThirtyTwoBytesRetryableSendFailureZ_get_ok(owner_conv).data, 32);
6210         return ret_arr;
6211 }
6212
6213 static inline enum LDKRetryableSendFailure CResult_ThirtyTwoBytesRetryableSendFailureZ_get_err(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ *NONNULL_PTR owner){
6214 CHECK(!owner->result_ok);
6215         return RetryableSendFailure_clone(&*owner->contents.err);
6216 }
6217 int32_t  CS_LDK_CResult_ThirtyTwoBytesRetryableSendFailureZ_get_err(int64_t owner) {
6218         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* owner_conv = (LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)untag_ptr(owner);
6219         int32_t ret_conv = LDKRetryableSendFailure_to_cs(CResult_ThirtyTwoBytesRetryableSendFailureZ_get_err(owner_conv));
6220         return ret_conv;
6221 }
6222
6223 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_a(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ *NONNULL_PTR owner){
6224         return ThirtyTwoBytes_clone(&owner->a);
6225 }
6226 int8_tArray  CS_LDK_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_a(int64_t owner) {
6227         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(owner);
6228         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6229         memcpy(ret_arr->elems, C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_a(owner_conv).data, 32);
6230         return ret_arr;
6231 }
6232
6233 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_b(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ *NONNULL_PTR owner){
6234         return ThirtyTwoBytes_clone(&owner->b);
6235 }
6236 int8_tArray  CS_LDK_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_b(int64_t owner) {
6237         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(owner);
6238         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6239         memcpy(ret_arr->elems, C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_b(owner_conv).data, 32);
6240         return ret_arr;
6241 }
6242
6243 static inline struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_ok(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ *NONNULL_PTR owner){
6244 CHECK(owner->result_ok);
6245         return C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(&*owner->contents.result);
6246 }
6247 int64_t  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_ok(int64_t owner) {
6248         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)untag_ptr(owner);
6249         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
6250         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_ok(owner_conv);
6251         return tag_ptr(ret_conv, true);
6252 }
6253
6254 static inline struct LDKPaymentSendFailure CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_err(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ *NONNULL_PTR owner){
6255 CHECK(!owner->result_ok);
6256         return PaymentSendFailure_clone(&*owner->contents.err);
6257 }
6258 int64_t  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_err(int64_t owner) {
6259         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)untag_ptr(owner);
6260         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
6261         *ret_copy = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_err(owner_conv);
6262         int64_t ret_ref = tag_ptr(ret_copy, true);
6263         return ret_ref;
6264 }
6265
6266 static inline LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_clone(const LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ *orig) {
6267         LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ) * orig->datalen, "LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ clone bytes"), .datalen = orig->datalen };
6268         for (size_t i = 0; i < ret.datalen; i++) {
6269                 ret.data[i] = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(&orig->data[i]);
6270         }
6271         return ret;
6272 }
6273 uint32_t CS_LDK_LDKProbeSendFailure_ty_from_ptr(int64_t ptr) {
6274         LDKProbeSendFailure *obj = (LDKProbeSendFailure*)untag_ptr(ptr);
6275         switch(obj->tag) {
6276                 case LDKProbeSendFailure_RouteNotFound: return 0;
6277                 case LDKProbeSendFailure_SendingFailed: return 1;
6278                 default: abort();
6279         }
6280 }
6281 int64_t CS_LDK_LDKProbeSendFailure_SendingFailed_get_sending_failed(int64_t ptr) {
6282         LDKProbeSendFailure *obj = (LDKProbeSendFailure*)untag_ptr(ptr);
6283         CHECK(obj->tag == LDKProbeSendFailure_SendingFailed);
6284         int64_t sending_failed_ref = tag_ptr(&obj->sending_failed, false);
6285         return sending_failed_ref;
6286 }
6287 static inline struct LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_ok(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ *NONNULL_PTR owner){
6288 CHECK(owner->result_ok);
6289         return CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_clone(&*owner->contents.result);
6290 }
6291 int64_tArray  CS_LDK_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_ok(int64_t owner) {
6292         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* owner_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)untag_ptr(owner);
6293         LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ ret_var = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_ok(owner_conv);
6294         int64_tArray ret_arr = NULL;
6295         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
6296         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
6297         for (size_t o = 0; o < ret_var.datalen; o++) {
6298                 LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
6299                 *ret_conv_40_conv = ret_var.data[o];
6300                 ret_arr_ptr[o] = tag_ptr(ret_conv_40_conv, true);
6301         }
6302         
6303         FREE(ret_var.data);
6304         return ret_arr;
6305 }
6306
6307 static inline struct LDKProbeSendFailure CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_err(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ *NONNULL_PTR owner){
6308 CHECK(!owner->result_ok);
6309         return ProbeSendFailure_clone(&*owner->contents.err);
6310 }
6311 int64_t  CS_LDK_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_err(int64_t owner) {
6312         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* owner_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)untag_ptr(owner);
6313         LDKProbeSendFailure *ret_copy = MALLOC(sizeof(LDKProbeSendFailure), "LDKProbeSendFailure");
6314         *ret_copy = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_err(owner_conv);
6315         int64_t ret_ref = tag_ptr(ret_copy, true);
6316         return ret_ref;
6317 }
6318
6319 static inline struct LDKChannelId C2Tuple_ChannelIdPublicKeyZ_get_a(LDKC2Tuple_ChannelIdPublicKeyZ *NONNULL_PTR owner){
6320         LDKChannelId ret = owner->a;
6321         ret.is_owned = false;
6322         return ret;
6323 }
6324 int64_t  CS_LDK_C2Tuple_ChannelIdPublicKeyZ_get_a(int64_t owner) {
6325         LDKC2Tuple_ChannelIdPublicKeyZ* owner_conv = (LDKC2Tuple_ChannelIdPublicKeyZ*)untag_ptr(owner);
6326         LDKChannelId ret_var = C2Tuple_ChannelIdPublicKeyZ_get_a(owner_conv);
6327         int64_t ret_ref = 0;
6328         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6329         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6330         return ret_ref;
6331 }
6332
6333 static inline struct LDKPublicKey C2Tuple_ChannelIdPublicKeyZ_get_b(LDKC2Tuple_ChannelIdPublicKeyZ *NONNULL_PTR owner){
6334         return owner->b;
6335 }
6336 int8_tArray  CS_LDK_C2Tuple_ChannelIdPublicKeyZ_get_b(int64_t owner) {
6337         LDKC2Tuple_ChannelIdPublicKeyZ* owner_conv = (LDKC2Tuple_ChannelIdPublicKeyZ*)untag_ptr(owner);
6338         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
6339         memcpy(ret_arr->elems, C2Tuple_ChannelIdPublicKeyZ_get_b(owner_conv).compressed_form, 33);
6340         return ret_arr;
6341 }
6342
6343 static inline LDKCVec_C2Tuple_ChannelIdPublicKeyZZ CVec_C2Tuple_ChannelIdPublicKeyZZ_clone(const LDKCVec_C2Tuple_ChannelIdPublicKeyZZ *orig) {
6344         LDKCVec_C2Tuple_ChannelIdPublicKeyZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_ChannelIdPublicKeyZ) * orig->datalen, "LDKCVec_C2Tuple_ChannelIdPublicKeyZZ clone bytes"), .datalen = orig->datalen };
6345         for (size_t i = 0; i < ret.datalen; i++) {
6346                 ret.data[i] = C2Tuple_ChannelIdPublicKeyZ_clone(&orig->data[i]);
6347         }
6348         return ret;
6349 }
6350 static inline LDKCVec_ChannelIdZ CVec_ChannelIdZ_clone(const LDKCVec_ChannelIdZ *orig) {
6351         LDKCVec_ChannelIdZ ret = { .data = MALLOC(sizeof(LDKChannelId) * orig->datalen, "LDKCVec_ChannelIdZ clone bytes"), .datalen = orig->datalen };
6352         for (size_t i = 0; i < ret.datalen; i++) {
6353                 ret.data[i] = ChannelId_clone(&orig->data[i]);
6354         }
6355         return ret;
6356 }
6357 static inline struct LDKOfferWithDerivedMetadataBuilder CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_get_ok(LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ *NONNULL_PTR owner){
6358         LDKOfferWithDerivedMetadataBuilder ret = *owner->contents.result;
6359         ret.is_owned = false;
6360         return ret;
6361 }
6362 int64_t  CS_LDK_CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_get_ok(int64_t owner) {
6363         LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ* owner_conv = (LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ*)untag_ptr(owner);
6364         LDKOfferWithDerivedMetadataBuilder ret_var = CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_get_ok(owner_conv);
6365         int64_t ret_ref = 0;
6366         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6367         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6368         return ret_ref;
6369 }
6370
6371 static inline enum LDKBolt12SemanticError CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_get_err(LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ *NONNULL_PTR owner){
6372 CHECK(!owner->result_ok);
6373         return Bolt12SemanticError_clone(&*owner->contents.err);
6374 }
6375 int32_t  CS_LDK_CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_get_err(int64_t owner) {
6376         LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ* owner_conv = (LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ*)untag_ptr(owner);
6377         int32_t ret_conv = LDKBolt12SemanticError_to_cs(CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_get_err(owner_conv));
6378         return ret_conv;
6379 }
6380
6381 uint32_t CS_LDK_LDKCOption_StrZ_ty_from_ptr(int64_t ptr) {
6382         LDKCOption_StrZ *obj = (LDKCOption_StrZ*)untag_ptr(ptr);
6383         switch(obj->tag) {
6384                 case LDKCOption_StrZ_Some: return 0;
6385                 case LDKCOption_StrZ_None: return 1;
6386                 default: abort();
6387         }
6388 }
6389 jstring CS_LDK_LDKCOption_StrZ_Some_get_some(int64_t ptr) {
6390         LDKCOption_StrZ *obj = (LDKCOption_StrZ*)untag_ptr(ptr);
6391         CHECK(obj->tag == LDKCOption_StrZ_Some);
6392         LDKStr some_str = obj->some;
6393                         jstring some_conv = str_ref_to_cs(some_str.chars, some_str.len);
6394         return some_conv;
6395 }
6396 static inline struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_ok(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ *NONNULL_PTR owner){
6397 CHECK(owner->result_ok);
6398         return C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(&*owner->contents.result);
6399 }
6400 int64_t  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_ok(int64_t owner) {
6401         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)untag_ptr(owner);
6402         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
6403         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_ok(owner_conv);
6404         return tag_ptr(ret_conv, true);
6405 }
6406
6407 static inline void CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_err(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ *NONNULL_PTR owner){
6408 CHECK(!owner->result_ok);
6409         return *owner->contents.err;
6410 }
6411 void  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_err(int64_t owner) {
6412         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)untag_ptr(owner);
6413         CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_err(owner_conv);
6414 }
6415
6416 static inline struct LDKThirtyTwoBytes CResult_ThirtyTwoBytesAPIErrorZ_get_ok(LDKCResult_ThirtyTwoBytesAPIErrorZ *NONNULL_PTR owner){
6417 CHECK(owner->result_ok);
6418         return ThirtyTwoBytes_clone(&*owner->contents.result);
6419 }
6420 int8_tArray  CS_LDK_CResult_ThirtyTwoBytesAPIErrorZ_get_ok(int64_t owner) {
6421         LDKCResult_ThirtyTwoBytesAPIErrorZ* owner_conv = (LDKCResult_ThirtyTwoBytesAPIErrorZ*)untag_ptr(owner);
6422         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6423         memcpy(ret_arr->elems, CResult_ThirtyTwoBytesAPIErrorZ_get_ok(owner_conv).data, 32);
6424         return ret_arr;
6425 }
6426
6427 static inline struct LDKAPIError CResult_ThirtyTwoBytesAPIErrorZ_get_err(LDKCResult_ThirtyTwoBytesAPIErrorZ *NONNULL_PTR owner){
6428 CHECK(!owner->result_ok);
6429         return APIError_clone(&*owner->contents.err);
6430 }
6431 int64_t  CS_LDK_CResult_ThirtyTwoBytesAPIErrorZ_get_err(int64_t owner) {
6432         LDKCResult_ThirtyTwoBytesAPIErrorZ* owner_conv = (LDKCResult_ThirtyTwoBytesAPIErrorZ*)untag_ptr(owner);
6433         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
6434         *ret_copy = CResult_ThirtyTwoBytesAPIErrorZ_get_err(owner_conv);
6435         int64_t ret_ref = tag_ptr(ret_copy, true);
6436         return ret_ref;
6437 }
6438
6439 uint32_t CS_LDK_LDKOffersMessage_ty_from_ptr(int64_t ptr) {
6440         LDKOffersMessage *obj = (LDKOffersMessage*)untag_ptr(ptr);
6441         switch(obj->tag) {
6442                 case LDKOffersMessage_InvoiceRequest: return 0;
6443                 case LDKOffersMessage_Invoice: return 1;
6444                 case LDKOffersMessage_InvoiceError: return 2;
6445                 default: abort();
6446         }
6447 }
6448 int64_t CS_LDK_LDKOffersMessage_InvoiceRequest_get_invoice_request(int64_t ptr) {
6449         LDKOffersMessage *obj = (LDKOffersMessage*)untag_ptr(ptr);
6450         CHECK(obj->tag == LDKOffersMessage_InvoiceRequest);
6451         LDKInvoiceRequest invoice_request_var = obj->invoice_request;
6452                         int64_t invoice_request_ref = 0;
6453                         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_request_var);
6454                         invoice_request_ref = tag_ptr(invoice_request_var.inner, false);
6455         return invoice_request_ref;
6456 }
6457 int64_t CS_LDK_LDKOffersMessage_Invoice_get_invoice(int64_t ptr) {
6458         LDKOffersMessage *obj = (LDKOffersMessage*)untag_ptr(ptr);
6459         CHECK(obj->tag == LDKOffersMessage_Invoice);
6460         LDKBolt12Invoice invoice_var = obj->invoice;
6461                         int64_t invoice_ref = 0;
6462                         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_var);
6463                         invoice_ref = tag_ptr(invoice_var.inner, false);
6464         return invoice_ref;
6465 }
6466 int64_t CS_LDK_LDKOffersMessage_InvoiceError_get_invoice_error(int64_t ptr) {
6467         LDKOffersMessage *obj = (LDKOffersMessage*)untag_ptr(ptr);
6468         CHECK(obj->tag == LDKOffersMessage_InvoiceError);
6469         LDKInvoiceError invoice_error_var = obj->invoice_error;
6470                         int64_t invoice_error_ref = 0;
6471                         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_error_var);
6472                         invoice_error_ref = tag_ptr(invoice_error_var.inner, false);
6473         return invoice_error_ref;
6474 }
6475 uint32_t CS_LDK_LDKCOption_OffersMessageZ_ty_from_ptr(int64_t ptr) {
6476         LDKCOption_OffersMessageZ *obj = (LDKCOption_OffersMessageZ*)untag_ptr(ptr);
6477         switch(obj->tag) {
6478                 case LDKCOption_OffersMessageZ_Some: return 0;
6479                 case LDKCOption_OffersMessageZ_None: return 1;
6480                 default: abort();
6481         }
6482 }
6483 int64_t CS_LDK_LDKCOption_OffersMessageZ_Some_get_some(int64_t ptr) {
6484         LDKCOption_OffersMessageZ *obj = (LDKCOption_OffersMessageZ*)untag_ptr(ptr);
6485         CHECK(obj->tag == LDKCOption_OffersMessageZ_Some);
6486         int64_t some_ref = tag_ptr(&obj->some, false);
6487         return some_ref;
6488 }
6489 uint32_t CS_LDK_LDKDestination_ty_from_ptr(int64_t ptr) {
6490         LDKDestination *obj = (LDKDestination*)untag_ptr(ptr);
6491         switch(obj->tag) {
6492                 case LDKDestination_Node: return 0;
6493                 case LDKDestination_BlindedPath: return 1;
6494                 default: abort();
6495         }
6496 }
6497 int8_tArray CS_LDK_LDKDestination_Node_get_node(int64_t ptr) {
6498         LDKDestination *obj = (LDKDestination*)untag_ptr(ptr);
6499         CHECK(obj->tag == LDKDestination_Node);
6500         int8_tArray node_arr = init_int8_tArray(33, __LINE__);
6501         memcpy(node_arr->elems, obj->node.compressed_form, 33);
6502         return node_arr;
6503 }
6504 int64_t CS_LDK_LDKDestination_BlindedPath_get_blinded_path(int64_t ptr) {
6505         LDKDestination *obj = (LDKDestination*)untag_ptr(ptr);
6506         CHECK(obj->tag == LDKDestination_BlindedPath);
6507         LDKBlindedPath blinded_path_var = obj->blinded_path;
6508                         int64_t blinded_path_ref = 0;
6509                         CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_path_var);
6510                         blinded_path_ref = tag_ptr(blinded_path_var.inner, false);
6511         return blinded_path_ref;
6512 }
6513 static inline struct LDKOffersMessage C3Tuple_OffersMessageDestinationBlindedPathZ_get_a(LDKC3Tuple_OffersMessageDestinationBlindedPathZ *NONNULL_PTR owner){
6514         return OffersMessage_clone(&owner->a);
6515 }
6516 int64_t  CS_LDK_C3Tuple_OffersMessageDestinationBlindedPathZ_get_a(int64_t owner) {
6517         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)untag_ptr(owner);
6518         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
6519         *ret_copy = C3Tuple_OffersMessageDestinationBlindedPathZ_get_a(owner_conv);
6520         int64_t ret_ref = tag_ptr(ret_copy, true);
6521         return ret_ref;
6522 }
6523
6524 static inline struct LDKDestination C3Tuple_OffersMessageDestinationBlindedPathZ_get_b(LDKC3Tuple_OffersMessageDestinationBlindedPathZ *NONNULL_PTR owner){
6525         return Destination_clone(&owner->b);
6526 }
6527 int64_t  CS_LDK_C3Tuple_OffersMessageDestinationBlindedPathZ_get_b(int64_t owner) {
6528         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)untag_ptr(owner);
6529         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
6530         *ret_copy = C3Tuple_OffersMessageDestinationBlindedPathZ_get_b(owner_conv);
6531         int64_t ret_ref = tag_ptr(ret_copy, true);
6532         return ret_ref;
6533 }
6534
6535 static inline struct LDKBlindedPath C3Tuple_OffersMessageDestinationBlindedPathZ_get_c(LDKC3Tuple_OffersMessageDestinationBlindedPathZ *NONNULL_PTR owner){
6536         LDKBlindedPath ret = owner->c;
6537         ret.is_owned = false;
6538         return ret;
6539 }
6540 int64_t  CS_LDK_C3Tuple_OffersMessageDestinationBlindedPathZ_get_c(int64_t owner) {
6541         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)untag_ptr(owner);
6542         LDKBlindedPath ret_var = C3Tuple_OffersMessageDestinationBlindedPathZ_get_c(owner_conv);
6543         int64_t ret_ref = 0;
6544         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6545         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6546         return ret_ref;
6547 }
6548
6549 static inline LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ_clone(const LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ *orig) {
6550         LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ) * orig->datalen, "LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ clone bytes"), .datalen = orig->datalen };
6551         for (size_t i = 0; i < ret.datalen; i++) {
6552                 ret.data[i] = C3Tuple_OffersMessageDestinationBlindedPathZ_clone(&orig->data[i]);
6553         }
6554         return ret;
6555 }
6556 static inline struct LDKPhantomRouteHints CResult_PhantomRouteHintsDecodeErrorZ_get_ok(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){
6557         LDKPhantomRouteHints ret = *owner->contents.result;
6558         ret.is_owned = false;
6559         return ret;
6560 }
6561 int64_t  CS_LDK_CResult_PhantomRouteHintsDecodeErrorZ_get_ok(int64_t owner) {
6562         LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(owner);
6563         LDKPhantomRouteHints ret_var = CResult_PhantomRouteHintsDecodeErrorZ_get_ok(owner_conv);
6564         int64_t ret_ref = 0;
6565         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6566         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6567         return ret_ref;
6568 }
6569
6570 static inline struct LDKDecodeError CResult_PhantomRouteHintsDecodeErrorZ_get_err(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){
6571 CHECK(!owner->result_ok);
6572         return DecodeError_clone(&*owner->contents.err);
6573 }
6574 int64_t  CS_LDK_CResult_PhantomRouteHintsDecodeErrorZ_get_err(int64_t owner) {
6575         LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(owner);
6576         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6577         *ret_copy = CResult_PhantomRouteHintsDecodeErrorZ_get_err(owner_conv);
6578         int64_t ret_ref = tag_ptr(ret_copy, true);
6579         return ret_ref;
6580 }
6581
6582 static inline struct LDKBlindedForward CResult_BlindedForwardDecodeErrorZ_get_ok(LDKCResult_BlindedForwardDecodeErrorZ *NONNULL_PTR owner){
6583         LDKBlindedForward ret = *owner->contents.result;
6584         ret.is_owned = false;
6585         return ret;
6586 }
6587 int64_t  CS_LDK_CResult_BlindedForwardDecodeErrorZ_get_ok(int64_t owner) {
6588         LDKCResult_BlindedForwardDecodeErrorZ* owner_conv = (LDKCResult_BlindedForwardDecodeErrorZ*)untag_ptr(owner);
6589         LDKBlindedForward ret_var = CResult_BlindedForwardDecodeErrorZ_get_ok(owner_conv);
6590         int64_t ret_ref = 0;
6591         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6592         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6593         return ret_ref;
6594 }
6595
6596 static inline struct LDKDecodeError CResult_BlindedForwardDecodeErrorZ_get_err(LDKCResult_BlindedForwardDecodeErrorZ *NONNULL_PTR owner){
6597 CHECK(!owner->result_ok);
6598         return DecodeError_clone(&*owner->contents.err);
6599 }
6600 int64_t  CS_LDK_CResult_BlindedForwardDecodeErrorZ_get_err(int64_t owner) {
6601         LDKCResult_BlindedForwardDecodeErrorZ* owner_conv = (LDKCResult_BlindedForwardDecodeErrorZ*)untag_ptr(owner);
6602         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6603         *ret_copy = CResult_BlindedForwardDecodeErrorZ_get_err(owner_conv);
6604         int64_t ret_ref = tag_ptr(ret_copy, true);
6605         return ret_ref;
6606 }
6607
6608 uint32_t CS_LDK_LDKPendingHTLCRouting_ty_from_ptr(int64_t ptr) {
6609         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
6610         switch(obj->tag) {
6611                 case LDKPendingHTLCRouting_Forward: return 0;
6612                 case LDKPendingHTLCRouting_Receive: return 1;
6613                 case LDKPendingHTLCRouting_ReceiveKeysend: return 2;
6614                 default: abort();
6615         }
6616 }
6617 int64_t CS_LDK_LDKPendingHTLCRouting_Forward_get_onion_packet(int64_t ptr) {
6618         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
6619         CHECK(obj->tag == LDKPendingHTLCRouting_Forward);
6620         LDKOnionPacket onion_packet_var = obj->forward.onion_packet;
6621                         int64_t onion_packet_ref = 0;
6622                         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_packet_var);
6623                         onion_packet_ref = tag_ptr(onion_packet_var.inner, false);
6624         return onion_packet_ref;
6625 }
6626 int64_t CS_LDK_LDKPendingHTLCRouting_Forward_get_short_channel_id(int64_t ptr) {
6627         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
6628         CHECK(obj->tag == LDKPendingHTLCRouting_Forward);
6629         int64_t short_channel_id_conv = obj->forward.short_channel_id;
6630         return short_channel_id_conv;
6631 }
6632 int64_t CS_LDK_LDKPendingHTLCRouting_Forward_get_blinded(int64_t ptr) {
6633         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
6634         CHECK(obj->tag == LDKPendingHTLCRouting_Forward);
6635         LDKBlindedForward blinded_var = obj->forward.blinded;
6636                         int64_t blinded_ref = 0;
6637                         CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_var);
6638                         blinded_ref = tag_ptr(blinded_var.inner, false);
6639         return blinded_ref;
6640 }
6641 int64_t CS_LDK_LDKPendingHTLCRouting_Receive_get_payment_data(int64_t ptr) {
6642         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
6643         CHECK(obj->tag == LDKPendingHTLCRouting_Receive);
6644         LDKFinalOnionHopData payment_data_var = obj->receive.payment_data;
6645                         int64_t payment_data_ref = 0;
6646                         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_data_var);
6647                         payment_data_ref = tag_ptr(payment_data_var.inner, false);
6648         return payment_data_ref;
6649 }
6650 int64_t CS_LDK_LDKPendingHTLCRouting_Receive_get_payment_metadata(int64_t ptr) {
6651         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
6652         CHECK(obj->tag == LDKPendingHTLCRouting_Receive);
6653         int64_t payment_metadata_ref = tag_ptr(&obj->receive.payment_metadata, false);
6654         return payment_metadata_ref;
6655 }
6656 int64_t CS_LDK_LDKPendingHTLCRouting_Receive_get_payment_context(int64_t ptr) {
6657         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
6658         CHECK(obj->tag == LDKPendingHTLCRouting_Receive);
6659         int64_t payment_context_ref = tag_ptr(&obj->receive.payment_context, false);
6660         return payment_context_ref;
6661 }
6662 int32_t CS_LDK_LDKPendingHTLCRouting_Receive_get_incoming_cltv_expiry(int64_t ptr) {
6663         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
6664         CHECK(obj->tag == LDKPendingHTLCRouting_Receive);
6665         int32_t incoming_cltv_expiry_conv = obj->receive.incoming_cltv_expiry;
6666         return incoming_cltv_expiry_conv;
6667 }
6668 int8_tArray CS_LDK_LDKPendingHTLCRouting_Receive_get_phantom_shared_secret(int64_t ptr) {
6669         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
6670         CHECK(obj->tag == LDKPendingHTLCRouting_Receive);
6671         int8_tArray phantom_shared_secret_arr = init_int8_tArray(32, __LINE__);
6672         memcpy(phantom_shared_secret_arr->elems, obj->receive.phantom_shared_secret.data, 32);
6673         return phantom_shared_secret_arr;
6674 }
6675 int64_tArray CS_LDK_LDKPendingHTLCRouting_Receive_get_custom_tlvs(int64_t ptr) {
6676         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
6677         CHECK(obj->tag == LDKPendingHTLCRouting_Receive);
6678         LDKCVec_C2Tuple_u64CVec_u8ZZZ custom_tlvs_var = obj->receive.custom_tlvs;
6679                         int64_tArray custom_tlvs_arr = NULL;
6680                         custom_tlvs_arr = init_int64_tArray(custom_tlvs_var.datalen, __LINE__);
6681                         int64_t *custom_tlvs_arr_ptr = (int64_t*)(((uint8_t*)custom_tlvs_arr) + 8);
6682                         for (size_t x = 0; x < custom_tlvs_var.datalen; x++) {
6683                                 LDKC2Tuple_u64CVec_u8ZZ* custom_tlvs_conv_23_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
6684                                 *custom_tlvs_conv_23_conv = custom_tlvs_var.data[x];
6685                                 *custom_tlvs_conv_23_conv = C2Tuple_u64CVec_u8ZZ_clone(custom_tlvs_conv_23_conv);
6686                                 custom_tlvs_arr_ptr[x] = tag_ptr(custom_tlvs_conv_23_conv, true);
6687                         }
6688                         
6689         return custom_tlvs_arr;
6690 }
6691 jboolean CS_LDK_LDKPendingHTLCRouting_Receive_get_requires_blinded_error(int64_t ptr) {
6692         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
6693         CHECK(obj->tag == LDKPendingHTLCRouting_Receive);
6694         jboolean requires_blinded_error_conv = obj->receive.requires_blinded_error;
6695         return requires_blinded_error_conv;
6696 }
6697 int64_t CS_LDK_LDKPendingHTLCRouting_ReceiveKeysend_get_payment_data(int64_t ptr) {
6698         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
6699         CHECK(obj->tag == LDKPendingHTLCRouting_ReceiveKeysend);
6700         LDKFinalOnionHopData payment_data_var = obj->receive_keysend.payment_data;
6701                         int64_t payment_data_ref = 0;
6702                         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_data_var);
6703                         payment_data_ref = tag_ptr(payment_data_var.inner, false);
6704         return payment_data_ref;
6705 }
6706 int8_tArray CS_LDK_LDKPendingHTLCRouting_ReceiveKeysend_get_payment_preimage(int64_t ptr) {
6707         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
6708         CHECK(obj->tag == LDKPendingHTLCRouting_ReceiveKeysend);
6709         int8_tArray payment_preimage_arr = init_int8_tArray(32, __LINE__);
6710         memcpy(payment_preimage_arr->elems, obj->receive_keysend.payment_preimage.data, 32);
6711         return payment_preimage_arr;
6712 }
6713 int64_t CS_LDK_LDKPendingHTLCRouting_ReceiveKeysend_get_payment_metadata(int64_t ptr) {
6714         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
6715         CHECK(obj->tag == LDKPendingHTLCRouting_ReceiveKeysend);
6716         int64_t payment_metadata_ref = tag_ptr(&obj->receive_keysend.payment_metadata, false);
6717         return payment_metadata_ref;
6718 }
6719 int32_t CS_LDK_LDKPendingHTLCRouting_ReceiveKeysend_get_incoming_cltv_expiry(int64_t ptr) {
6720         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
6721         CHECK(obj->tag == LDKPendingHTLCRouting_ReceiveKeysend);
6722         int32_t incoming_cltv_expiry_conv = obj->receive_keysend.incoming_cltv_expiry;
6723         return incoming_cltv_expiry_conv;
6724 }
6725 int64_tArray CS_LDK_LDKPendingHTLCRouting_ReceiveKeysend_get_custom_tlvs(int64_t ptr) {
6726         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
6727         CHECK(obj->tag == LDKPendingHTLCRouting_ReceiveKeysend);
6728         LDKCVec_C2Tuple_u64CVec_u8ZZZ custom_tlvs_var = obj->receive_keysend.custom_tlvs;
6729                         int64_tArray custom_tlvs_arr = NULL;
6730                         custom_tlvs_arr = init_int64_tArray(custom_tlvs_var.datalen, __LINE__);
6731                         int64_t *custom_tlvs_arr_ptr = (int64_t*)(((uint8_t*)custom_tlvs_arr) + 8);
6732                         for (size_t x = 0; x < custom_tlvs_var.datalen; x++) {
6733                                 LDKC2Tuple_u64CVec_u8ZZ* custom_tlvs_conv_23_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
6734                                 *custom_tlvs_conv_23_conv = custom_tlvs_var.data[x];
6735                                 *custom_tlvs_conv_23_conv = C2Tuple_u64CVec_u8ZZ_clone(custom_tlvs_conv_23_conv);
6736                                 custom_tlvs_arr_ptr[x] = tag_ptr(custom_tlvs_conv_23_conv, true);
6737                         }
6738                         
6739         return custom_tlvs_arr;
6740 }
6741 jboolean CS_LDK_LDKPendingHTLCRouting_ReceiveKeysend_get_requires_blinded_error(int64_t ptr) {
6742         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
6743         CHECK(obj->tag == LDKPendingHTLCRouting_ReceiveKeysend);
6744         jboolean requires_blinded_error_conv = obj->receive_keysend.requires_blinded_error;
6745         return requires_blinded_error_conv;
6746 }
6747 static inline struct LDKPendingHTLCRouting CResult_PendingHTLCRoutingDecodeErrorZ_get_ok(LDKCResult_PendingHTLCRoutingDecodeErrorZ *NONNULL_PTR owner){
6748 CHECK(owner->result_ok);
6749         return PendingHTLCRouting_clone(&*owner->contents.result);
6750 }
6751 int64_t  CS_LDK_CResult_PendingHTLCRoutingDecodeErrorZ_get_ok(int64_t owner) {
6752         LDKCResult_PendingHTLCRoutingDecodeErrorZ* owner_conv = (LDKCResult_PendingHTLCRoutingDecodeErrorZ*)untag_ptr(owner);
6753         LDKPendingHTLCRouting *ret_copy = MALLOC(sizeof(LDKPendingHTLCRouting), "LDKPendingHTLCRouting");
6754         *ret_copy = CResult_PendingHTLCRoutingDecodeErrorZ_get_ok(owner_conv);
6755         int64_t ret_ref = tag_ptr(ret_copy, true);
6756         return ret_ref;
6757 }
6758
6759 static inline struct LDKDecodeError CResult_PendingHTLCRoutingDecodeErrorZ_get_err(LDKCResult_PendingHTLCRoutingDecodeErrorZ *NONNULL_PTR owner){
6760 CHECK(!owner->result_ok);
6761         return DecodeError_clone(&*owner->contents.err);
6762 }
6763 int64_t  CS_LDK_CResult_PendingHTLCRoutingDecodeErrorZ_get_err(int64_t owner) {
6764         LDKCResult_PendingHTLCRoutingDecodeErrorZ* owner_conv = (LDKCResult_PendingHTLCRoutingDecodeErrorZ*)untag_ptr(owner);
6765         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6766         *ret_copy = CResult_PendingHTLCRoutingDecodeErrorZ_get_err(owner_conv);
6767         int64_t ret_ref = tag_ptr(ret_copy, true);
6768         return ret_ref;
6769 }
6770
6771 static inline struct LDKPendingHTLCInfo CResult_PendingHTLCInfoDecodeErrorZ_get_ok(LDKCResult_PendingHTLCInfoDecodeErrorZ *NONNULL_PTR owner){
6772         LDKPendingHTLCInfo ret = *owner->contents.result;
6773         ret.is_owned = false;
6774         return ret;
6775 }
6776 int64_t  CS_LDK_CResult_PendingHTLCInfoDecodeErrorZ_get_ok(int64_t owner) {
6777         LDKCResult_PendingHTLCInfoDecodeErrorZ* owner_conv = (LDKCResult_PendingHTLCInfoDecodeErrorZ*)untag_ptr(owner);
6778         LDKPendingHTLCInfo ret_var = CResult_PendingHTLCInfoDecodeErrorZ_get_ok(owner_conv);
6779         int64_t ret_ref = 0;
6780         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6781         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6782         return ret_ref;
6783 }
6784
6785 static inline struct LDKDecodeError CResult_PendingHTLCInfoDecodeErrorZ_get_err(LDKCResult_PendingHTLCInfoDecodeErrorZ *NONNULL_PTR owner){
6786 CHECK(!owner->result_ok);
6787         return DecodeError_clone(&*owner->contents.err);
6788 }
6789 int64_t  CS_LDK_CResult_PendingHTLCInfoDecodeErrorZ_get_err(int64_t owner) {
6790         LDKCResult_PendingHTLCInfoDecodeErrorZ* owner_conv = (LDKCResult_PendingHTLCInfoDecodeErrorZ*)untag_ptr(owner);
6791         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6792         *ret_copy = CResult_PendingHTLCInfoDecodeErrorZ_get_err(owner_conv);
6793         int64_t ret_ref = tag_ptr(ret_copy, true);
6794         return ret_ref;
6795 }
6796
6797 static inline enum LDKBlindedFailure CResult_BlindedFailureDecodeErrorZ_get_ok(LDKCResult_BlindedFailureDecodeErrorZ *NONNULL_PTR owner){
6798 CHECK(owner->result_ok);
6799         return BlindedFailure_clone(&*owner->contents.result);
6800 }
6801 int32_t  CS_LDK_CResult_BlindedFailureDecodeErrorZ_get_ok(int64_t owner) {
6802         LDKCResult_BlindedFailureDecodeErrorZ* owner_conv = (LDKCResult_BlindedFailureDecodeErrorZ*)untag_ptr(owner);
6803         int32_t ret_conv = LDKBlindedFailure_to_cs(CResult_BlindedFailureDecodeErrorZ_get_ok(owner_conv));
6804         return ret_conv;
6805 }
6806
6807 static inline struct LDKDecodeError CResult_BlindedFailureDecodeErrorZ_get_err(LDKCResult_BlindedFailureDecodeErrorZ *NONNULL_PTR owner){
6808 CHECK(!owner->result_ok);
6809         return DecodeError_clone(&*owner->contents.err);
6810 }
6811 int64_t  CS_LDK_CResult_BlindedFailureDecodeErrorZ_get_err(int64_t owner) {
6812         LDKCResult_BlindedFailureDecodeErrorZ* owner_conv = (LDKCResult_BlindedFailureDecodeErrorZ*)untag_ptr(owner);
6813         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6814         *ret_copy = CResult_BlindedFailureDecodeErrorZ_get_err(owner_conv);
6815         int64_t ret_ref = tag_ptr(ret_copy, true);
6816         return ret_ref;
6817 }
6818
6819 static inline LDKCVec_ChannelMonitorZ CVec_ChannelMonitorZ_clone(const LDKCVec_ChannelMonitorZ *orig) {
6820         LDKCVec_ChannelMonitorZ ret = { .data = MALLOC(sizeof(LDKChannelMonitor) * orig->datalen, "LDKCVec_ChannelMonitorZ clone bytes"), .datalen = orig->datalen };
6821         for (size_t i = 0; i < ret.datalen; i++) {
6822                 ret.data[i] = ChannelMonitor_clone(&orig->data[i]);
6823         }
6824         return ret;
6825 }
6826 typedef struct LDKWatch_JCalls {
6827         atomic_size_t refcnt;
6828         uint32_t instance_ptr;
6829 } LDKWatch_JCalls;
6830 static void LDKWatch_JCalls_free(void* this_arg) {
6831         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
6832         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6833                 FREE(j_calls);
6834         }
6835 }
6836 LDKCResult_ChannelMonitorUpdateStatusNoneZ watch_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
6837         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
6838         LDKOutPoint funding_txo_var = funding_txo;
6839         int64_t funding_txo_ref = 0;
6840         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
6841         funding_txo_ref = tag_ptr(funding_txo_var.inner, funding_txo_var.is_owned);
6842         LDKChannelMonitor monitor_var = monitor;
6843         int64_t monitor_ref = 0;
6844         CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_var);
6845         monitor_ref = tag_ptr(monitor_var.inner, monitor_var.is_owned);
6846         uint64_t ret = js_invoke_function_l_ll(j_calls->instance_ptr, 27, funding_txo_ref, monitor_ref);
6847         void* ret_ptr = untag_ptr(ret);
6848         CHECK_ACCESS(ret_ptr);
6849         LDKCResult_ChannelMonitorUpdateStatusNoneZ ret_conv = *(LDKCResult_ChannelMonitorUpdateStatusNoneZ*)(ret_ptr);
6850         FREE(untag_ptr(ret));
6851         return ret_conv;
6852 }
6853 LDKChannelMonitorUpdateStatus update_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, const LDKChannelMonitorUpdate * update) {
6854         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
6855         LDKOutPoint funding_txo_var = funding_txo;
6856         int64_t funding_txo_ref = 0;
6857         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
6858         funding_txo_ref = tag_ptr(funding_txo_var.inner, funding_txo_var.is_owned);
6859         LDKChannelMonitorUpdate update_var = *update;
6860         int64_t update_ref = 0;
6861         update_var = ChannelMonitorUpdate_clone(&update_var);
6862         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
6863         update_ref = tag_ptr(update_var.inner, update_var.is_owned);
6864         uint64_t ret = js_invoke_function_ChannelMonitorUpdateStatus_ll(j_calls->instance_ptr, 28, funding_txo_ref, update_ref);
6865         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_cs(ret);
6866         return ret_conv;
6867 }
6868 LDKCVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ release_pending_monitor_events_LDKWatch_jcall(const void* this_arg) {
6869         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
6870         int64_tArray ret = (int64_tArray)js_invoke_function_l_(j_calls->instance_ptr, 29);
6871         LDKCVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ ret_constr;
6872         ret_constr.datalen = ret->arr_len;
6873         if (ret_constr.datalen > 0)
6874                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ), "LDKCVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ Elements");
6875         else
6876                 ret_constr.data = NULL;
6877         int64_t* ret_vals = ret->elems;
6878         for (size_t f = 0; f < ret_constr.datalen; f++) {
6879                 int64_t ret_conv_57 = ret_vals[f];
6880                 void* ret_conv_57_ptr = untag_ptr(ret_conv_57);
6881                 CHECK_ACCESS(ret_conv_57_ptr);
6882                 LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ ret_conv_57_conv = *(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ*)(ret_conv_57_ptr);
6883                 FREE(untag_ptr(ret_conv_57));
6884                 ret_constr.data[f] = ret_conv_57_conv;
6885         }
6886         FREE(ret);
6887         return ret_constr;
6888 }
6889 static void LDKWatch_JCalls_cloned(LDKWatch* new_obj) {
6890         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) new_obj->this_arg;
6891         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6892 }
6893 static inline LDKWatch LDKWatch_init (int64_t o) {
6894         LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
6895         atomic_init(&calls->refcnt, 1);
6896         calls->instance_ptr = o;
6897
6898         LDKWatch ret = {
6899                 .this_arg = (void*) calls,
6900                 .watch_channel = watch_channel_LDKWatch_jcall,
6901                 .update_channel = update_channel_LDKWatch_jcall,
6902                 .release_pending_monitor_events = release_pending_monitor_events_LDKWatch_jcall,
6903                 .free = LDKWatch_JCalls_free,
6904         };
6905         return ret;
6906 }
6907 uint64_t  CS_LDK_LDKWatch_new(int32_t o) {
6908         LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
6909         *res_ptr = LDKWatch_init(o);
6910         return tag_ptr(res_ptr, true);
6911 }
6912 int64_t  CS_LDK_Watch_watch_channel(int64_t this_arg, int64_t funding_txo, int64_t monitor) {
6913         void* this_arg_ptr = untag_ptr(this_arg);
6914         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6915         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
6916         LDKOutPoint funding_txo_conv;
6917         funding_txo_conv.inner = untag_ptr(funding_txo);
6918         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
6919         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
6920         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
6921         LDKChannelMonitor monitor_conv;
6922         monitor_conv.inner = untag_ptr(monitor);
6923         monitor_conv.is_owned = ptr_is_owned(monitor);
6924         CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_conv);
6925         monitor_conv = ChannelMonitor_clone(&monitor_conv);
6926         LDKCResult_ChannelMonitorUpdateStatusNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateStatusNoneZ), "LDKCResult_ChannelMonitorUpdateStatusNoneZ");
6927         *ret_conv = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
6928         return tag_ptr(ret_conv, true);
6929 }
6930
6931 int32_t  CS_LDK_Watch_update_channel(int64_t this_arg, int64_t funding_txo, int64_t update) {
6932         void* this_arg_ptr = untag_ptr(this_arg);
6933         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6934         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
6935         LDKOutPoint funding_txo_conv;
6936         funding_txo_conv.inner = untag_ptr(funding_txo);
6937         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
6938         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
6939         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
6940         LDKChannelMonitorUpdate update_conv;
6941         update_conv.inner = untag_ptr(update);
6942         update_conv.is_owned = ptr_is_owned(update);
6943         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
6944         update_conv.is_owned = false;
6945         int32_t ret_conv = LDKChannelMonitorUpdateStatus_to_cs((this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, &update_conv));
6946         return ret_conv;
6947 }
6948
6949 int64_tArray  CS_LDK_Watch_release_pending_monitor_events(int64_t this_arg) {
6950         void* this_arg_ptr = untag_ptr(this_arg);
6951         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6952         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
6953         LDKCVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
6954         int64_tArray ret_arr = NULL;
6955         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
6956         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
6957         for (size_t f = 0; f < ret_var.datalen; f++) {
6958                 LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ* ret_conv_57_conv = MALLOC(sizeof(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ), "LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ");
6959                 *ret_conv_57_conv = ret_var.data[f];
6960                 ret_arr_ptr[f] = tag_ptr(ret_conv_57_conv, true);
6961         }
6962         
6963         FREE(ret_var.data);
6964         return ret_arr;
6965 }
6966
6967 typedef struct LDKBroadcasterInterface_JCalls {
6968         atomic_size_t refcnt;
6969         uint32_t instance_ptr;
6970 } LDKBroadcasterInterface_JCalls;
6971 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
6972         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
6973         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6974                 FREE(j_calls);
6975         }
6976 }
6977 void broadcast_transactions_LDKBroadcasterInterface_jcall(const void* this_arg, LDKCVec_TransactionZ txs) {
6978         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
6979         LDKCVec_TransactionZ txs_var = txs;
6980         ptrArray txs_arr = NULL;
6981         txs_arr = init_ptrArray(txs_var.datalen, __LINE__);
6982         int8_tArray *txs_arr_ptr = (int8_tArray*)(((uint8_t*)txs_arr) + 8);
6983         for (size_t i = 0; i < txs_var.datalen; i++) {
6984                 LDKTransaction txs_conv_8_var = txs_var.data[i];
6985                 int8_tArray txs_conv_8_arr = init_int8_tArray(txs_conv_8_var.datalen, __LINE__);
6986                 memcpy(txs_conv_8_arr->elems, txs_conv_8_var.data, txs_conv_8_var.datalen);
6987                 Transaction_free(txs_conv_8_var);
6988                 txs_arr_ptr[i] = txs_conv_8_arr;
6989         }
6990         
6991         FREE(txs_var.data);
6992         js_invoke_function_void_l(j_calls->instance_ptr, 30, (int64_t)txs_arr);
6993 }
6994 static void LDKBroadcasterInterface_JCalls_cloned(LDKBroadcasterInterface* new_obj) {
6995         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) new_obj->this_arg;
6996         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6997 }
6998 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (int64_t o) {
6999         LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
7000         atomic_init(&calls->refcnt, 1);
7001         calls->instance_ptr = o;
7002
7003         LDKBroadcasterInterface ret = {
7004                 .this_arg = (void*) calls,
7005                 .broadcast_transactions = broadcast_transactions_LDKBroadcasterInterface_jcall,
7006                 .free = LDKBroadcasterInterface_JCalls_free,
7007         };
7008         return ret;
7009 }
7010 uint64_t  CS_LDK_LDKBroadcasterInterface_new(int32_t o) {
7011         LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
7012         *res_ptr = LDKBroadcasterInterface_init(o);
7013         return tag_ptr(res_ptr, true);
7014 }
7015 void  CS_LDK_BroadcasterInterface_broadcast_transactions(int64_t this_arg, ptrArray txs) {
7016         void* this_arg_ptr = untag_ptr(this_arg);
7017         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7018         LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)this_arg_ptr;
7019         LDKCVec_TransactionZ txs_constr;
7020         txs_constr.datalen = txs->arr_len;
7021         if (txs_constr.datalen > 0)
7022                 txs_constr.data = MALLOC(txs_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
7023         else
7024                 txs_constr.data = NULL;
7025         int8_tArray* txs_vals = (void*) txs->elems;
7026         for (size_t i = 0; i < txs_constr.datalen; i++) {
7027                 int8_tArray txs_conv_8 = txs_vals[i];
7028                 LDKTransaction txs_conv_8_ref;
7029                 txs_conv_8_ref.datalen = txs_conv_8->arr_len;
7030                 txs_conv_8_ref.data = MALLOC(txs_conv_8_ref.datalen, "LDKTransaction Bytes");
7031                 memcpy(txs_conv_8_ref.data, txs_conv_8->elems, txs_conv_8_ref.datalen); FREE(txs_conv_8);
7032                 txs_conv_8_ref.data_is_owned = true;
7033                 txs_constr.data[i] = txs_conv_8_ref;
7034         }
7035         FREE(txs);
7036         (this_arg_conv->broadcast_transactions)(this_arg_conv->this_arg, txs_constr);
7037 }
7038
7039 typedef struct LDKEntropySource_JCalls {
7040         atomic_size_t refcnt;
7041         uint32_t instance_ptr;
7042 } LDKEntropySource_JCalls;
7043 static void LDKEntropySource_JCalls_free(void* this_arg) {
7044         LDKEntropySource_JCalls *j_calls = (LDKEntropySource_JCalls*) this_arg;
7045         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7046                 FREE(j_calls);
7047         }
7048 }
7049 LDKThirtyTwoBytes get_secure_random_bytes_LDKEntropySource_jcall(const void* this_arg) {
7050         LDKEntropySource_JCalls *j_calls = (LDKEntropySource_JCalls*) this_arg;
7051         int8_tArray ret = (int8_tArray)js_invoke_function_l_(j_calls->instance_ptr, 31);
7052         LDKThirtyTwoBytes ret_ref;
7053         CHECK(ret->arr_len == 32);
7054         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
7055         return ret_ref;
7056 }
7057 static void LDKEntropySource_JCalls_cloned(LDKEntropySource* new_obj) {
7058         LDKEntropySource_JCalls *j_calls = (LDKEntropySource_JCalls*) new_obj->this_arg;
7059         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7060 }
7061 static inline LDKEntropySource LDKEntropySource_init (int64_t o) {
7062         LDKEntropySource_JCalls *calls = MALLOC(sizeof(LDKEntropySource_JCalls), "LDKEntropySource_JCalls");
7063         atomic_init(&calls->refcnt, 1);
7064         calls->instance_ptr = o;
7065
7066         LDKEntropySource ret = {
7067                 .this_arg = (void*) calls,
7068                 .get_secure_random_bytes = get_secure_random_bytes_LDKEntropySource_jcall,
7069                 .free = LDKEntropySource_JCalls_free,
7070         };
7071         return ret;
7072 }
7073 uint64_t  CS_LDK_LDKEntropySource_new(int32_t o) {
7074         LDKEntropySource *res_ptr = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
7075         *res_ptr = LDKEntropySource_init(o);
7076         return tag_ptr(res_ptr, true);
7077 }
7078 int8_tArray  CS_LDK_EntropySource_get_secure_random_bytes(int64_t this_arg) {
7079         void* this_arg_ptr = untag_ptr(this_arg);
7080         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7081         LDKEntropySource* this_arg_conv = (LDKEntropySource*)this_arg_ptr;
7082         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
7083         memcpy(ret_arr->elems, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data, 32);
7084         return ret_arr;
7085 }
7086
7087 uint32_t CS_LDK_LDKUnsignedGossipMessage_ty_from_ptr(int64_t ptr) {
7088         LDKUnsignedGossipMessage *obj = (LDKUnsignedGossipMessage*)untag_ptr(ptr);
7089         switch(obj->tag) {
7090                 case LDKUnsignedGossipMessage_ChannelAnnouncement: return 0;
7091                 case LDKUnsignedGossipMessage_ChannelUpdate: return 1;
7092                 case LDKUnsignedGossipMessage_NodeAnnouncement: return 2;
7093                 default: abort();
7094         }
7095 }
7096 int64_t CS_LDK_LDKUnsignedGossipMessage_ChannelAnnouncement_get_channel_announcement(int64_t ptr) {
7097         LDKUnsignedGossipMessage *obj = (LDKUnsignedGossipMessage*)untag_ptr(ptr);
7098         CHECK(obj->tag == LDKUnsignedGossipMessage_ChannelAnnouncement);
7099         LDKUnsignedChannelAnnouncement channel_announcement_var = obj->channel_announcement;
7100                         int64_t channel_announcement_ref = 0;
7101                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_announcement_var);
7102                         channel_announcement_ref = tag_ptr(channel_announcement_var.inner, false);
7103         return channel_announcement_ref;
7104 }
7105 int64_t CS_LDK_LDKUnsignedGossipMessage_ChannelUpdate_get_channel_update(int64_t ptr) {
7106         LDKUnsignedGossipMessage *obj = (LDKUnsignedGossipMessage*)untag_ptr(ptr);
7107         CHECK(obj->tag == LDKUnsignedGossipMessage_ChannelUpdate);
7108         LDKUnsignedChannelUpdate channel_update_var = obj->channel_update;
7109                         int64_t channel_update_ref = 0;
7110                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_update_var);
7111                         channel_update_ref = tag_ptr(channel_update_var.inner, false);
7112         return channel_update_ref;
7113 }
7114 int64_t CS_LDK_LDKUnsignedGossipMessage_NodeAnnouncement_get_node_announcement(int64_t ptr) {
7115         LDKUnsignedGossipMessage *obj = (LDKUnsignedGossipMessage*)untag_ptr(ptr);
7116         CHECK(obj->tag == LDKUnsignedGossipMessage_NodeAnnouncement);
7117         LDKUnsignedNodeAnnouncement node_announcement_var = obj->node_announcement;
7118                         int64_t node_announcement_ref = 0;
7119                         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_announcement_var);
7120                         node_announcement_ref = tag_ptr(node_announcement_var.inner, false);
7121         return node_announcement_ref;
7122 }
7123 typedef struct LDKNodeSigner_JCalls {
7124         atomic_size_t refcnt;
7125         uint32_t instance_ptr;
7126 } LDKNodeSigner_JCalls;
7127 static void LDKNodeSigner_JCalls_free(void* this_arg) {
7128         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
7129         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7130                 FREE(j_calls);
7131         }
7132 }
7133 LDKThirtyTwoBytes get_inbound_payment_key_material_LDKNodeSigner_jcall(const void* this_arg) {
7134         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
7135         int8_tArray ret = (int8_tArray)js_invoke_function_l_(j_calls->instance_ptr, 32);
7136         LDKThirtyTwoBytes ret_ref;
7137         CHECK(ret->arr_len == 32);
7138         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
7139         return ret_ref;
7140 }
7141 LDKCResult_PublicKeyNoneZ get_node_id_LDKNodeSigner_jcall(const void* this_arg, LDKRecipient recipient) {
7142         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
7143         int32_t recipient_conv = LDKRecipient_to_cs(recipient);
7144         uint64_t ret = js_invoke_function_l_Recipient(j_calls->instance_ptr, 33, recipient_conv);
7145         void* ret_ptr = untag_ptr(ret);
7146         CHECK_ACCESS(ret_ptr);
7147         LDKCResult_PublicKeyNoneZ ret_conv = *(LDKCResult_PublicKeyNoneZ*)(ret_ptr);
7148         FREE(untag_ptr(ret));
7149         return ret_conv;
7150 }
7151 LDKCResult_ThirtyTwoBytesNoneZ ecdh_LDKNodeSigner_jcall(const void* this_arg, LDKRecipient recipient, LDKPublicKey other_key, LDKCOption_BigEndianScalarZ tweak) {
7152         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
7153         int32_t recipient_conv = LDKRecipient_to_cs(recipient);
7154         int8_tArray other_key_arr = init_int8_tArray(33, __LINE__);
7155         memcpy(other_key_arr->elems, other_key.compressed_form, 33);
7156         LDKCOption_BigEndianScalarZ *tweak_copy = MALLOC(sizeof(LDKCOption_BigEndianScalarZ), "LDKCOption_BigEndianScalarZ");
7157         *tweak_copy = tweak;
7158         int64_t tweak_ref = tag_ptr(tweak_copy, true);
7159         uint64_t ret = js_invoke_function_l_Recipientll(j_calls->instance_ptr, 34, recipient_conv, (int64_t)other_key_arr, tweak_ref);
7160         void* ret_ptr = untag_ptr(ret);
7161         CHECK_ACCESS(ret_ptr);
7162         LDKCResult_ThirtyTwoBytesNoneZ ret_conv = *(LDKCResult_ThirtyTwoBytesNoneZ*)(ret_ptr);
7163         FREE(untag_ptr(ret));
7164         return ret_conv;
7165 }
7166 LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKNodeSigner_jcall(const void* this_arg, LDKu8slice hrp_bytes, LDKCVec_U5Z invoice_data, LDKRecipient recipient) {
7167         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
7168         LDKu8slice hrp_bytes_var = hrp_bytes;
7169         int8_tArray hrp_bytes_arr = init_int8_tArray(hrp_bytes_var.datalen, __LINE__);
7170         memcpy(hrp_bytes_arr->elems, hrp_bytes_var.data, hrp_bytes_var.datalen);
7171         LDKCVec_U5Z invoice_data_var = invoice_data;
7172         ptrArray invoice_data_arr = NULL;
7173         invoice_data_arr = init_ptrArray(invoice_data_var.datalen, __LINE__);
7174         int8_t *invoice_data_arr_ptr = (int8_t*)(((uint8_t*)invoice_data_arr) + 8);
7175         for (size_t h = 0; h < invoice_data_var.datalen; h++) {
7176                 uint8_t invoice_data_conv_7_val = invoice_data_var.data[h]._0;
7177                 invoice_data_arr_ptr[h] = invoice_data_conv_7_val;
7178         }
7179         
7180         FREE(invoice_data_var.data);
7181         int32_t recipient_conv = LDKRecipient_to_cs(recipient);
7182         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);
7183         void* ret_ptr = untag_ptr(ret);
7184         CHECK_ACCESS(ret_ptr);
7185         LDKCResult_RecoverableSignatureNoneZ ret_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(ret_ptr);
7186         FREE(untag_ptr(ret));
7187         return ret_conv;
7188 }
7189 LDKCResult_SchnorrSignatureNoneZ sign_bolt12_invoice_request_LDKNodeSigner_jcall(const void* this_arg, const LDKUnsignedInvoiceRequest * invoice_request) {
7190         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
7191         LDKUnsignedInvoiceRequest invoice_request_var = *invoice_request;
7192         int64_t invoice_request_ref = 0;
7193         invoice_request_var = UnsignedInvoiceRequest_clone(&invoice_request_var);
7194         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_request_var);
7195         invoice_request_ref = tag_ptr(invoice_request_var.inner, invoice_request_var.is_owned);
7196         uint64_t ret = js_invoke_function_l_l(j_calls->instance_ptr, 36, invoice_request_ref);
7197         void* ret_ptr = untag_ptr(ret);
7198         CHECK_ACCESS(ret_ptr);
7199         LDKCResult_SchnorrSignatureNoneZ ret_conv = *(LDKCResult_SchnorrSignatureNoneZ*)(ret_ptr);
7200         FREE(untag_ptr(ret));
7201         return ret_conv;
7202 }
7203 LDKCResult_SchnorrSignatureNoneZ sign_bolt12_invoice_LDKNodeSigner_jcall(const void* this_arg, const LDKUnsignedBolt12Invoice * invoice) {
7204         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
7205         LDKUnsignedBolt12Invoice invoice_var = *invoice;
7206         int64_t invoice_ref = 0;
7207         invoice_var = UnsignedBolt12Invoice_clone(&invoice_var);
7208         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_var);
7209         invoice_ref = tag_ptr(invoice_var.inner, invoice_var.is_owned);
7210         uint64_t ret = js_invoke_function_l_l(j_calls->instance_ptr, 37, invoice_ref);
7211         void* ret_ptr = untag_ptr(ret);
7212         CHECK_ACCESS(ret_ptr);
7213         LDKCResult_SchnorrSignatureNoneZ ret_conv = *(LDKCResult_SchnorrSignatureNoneZ*)(ret_ptr);
7214         FREE(untag_ptr(ret));
7215         return ret_conv;
7216 }
7217 LDKCResult_ECDSASignatureNoneZ sign_gossip_message_LDKNodeSigner_jcall(const void* this_arg, LDKUnsignedGossipMessage msg) {
7218         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
7219         LDKUnsignedGossipMessage *msg_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
7220         *msg_copy = msg;
7221         int64_t msg_ref = tag_ptr(msg_copy, true);
7222         uint64_t ret = js_invoke_function_l_l(j_calls->instance_ptr, 38, msg_ref);
7223         void* ret_ptr = untag_ptr(ret);
7224         CHECK_ACCESS(ret_ptr);
7225         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
7226         FREE(untag_ptr(ret));
7227         return ret_conv;
7228 }
7229 static void LDKNodeSigner_JCalls_cloned(LDKNodeSigner* new_obj) {
7230         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) new_obj->this_arg;
7231         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7232 }
7233 static inline LDKNodeSigner LDKNodeSigner_init (int64_t o) {
7234         LDKNodeSigner_JCalls *calls = MALLOC(sizeof(LDKNodeSigner_JCalls), "LDKNodeSigner_JCalls");
7235         atomic_init(&calls->refcnt, 1);
7236         calls->instance_ptr = o;
7237
7238         LDKNodeSigner ret = {
7239                 .this_arg = (void*) calls,
7240                 .get_inbound_payment_key_material = get_inbound_payment_key_material_LDKNodeSigner_jcall,
7241                 .get_node_id = get_node_id_LDKNodeSigner_jcall,
7242                 .ecdh = ecdh_LDKNodeSigner_jcall,
7243                 .sign_invoice = sign_invoice_LDKNodeSigner_jcall,
7244                 .sign_bolt12_invoice_request = sign_bolt12_invoice_request_LDKNodeSigner_jcall,
7245                 .sign_bolt12_invoice = sign_bolt12_invoice_LDKNodeSigner_jcall,
7246                 .sign_gossip_message = sign_gossip_message_LDKNodeSigner_jcall,
7247                 .free = LDKNodeSigner_JCalls_free,
7248         };
7249         return ret;
7250 }
7251 uint64_t  CS_LDK_LDKNodeSigner_new(int32_t o) {
7252         LDKNodeSigner *res_ptr = MALLOC(sizeof(LDKNodeSigner), "LDKNodeSigner");
7253         *res_ptr = LDKNodeSigner_init(o);
7254         return tag_ptr(res_ptr, true);
7255 }
7256 int8_tArray  CS_LDK_NodeSigner_get_inbound_payment_key_material(int64_t this_arg) {
7257         void* this_arg_ptr = untag_ptr(this_arg);
7258         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7259         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
7260         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
7261         memcpy(ret_arr->elems, (this_arg_conv->get_inbound_payment_key_material)(this_arg_conv->this_arg).data, 32);
7262         return ret_arr;
7263 }
7264
7265 int64_t  CS_LDK_NodeSigner_get_node_id(int64_t this_arg, int32_t recipient) {
7266         void* this_arg_ptr = untag_ptr(this_arg);
7267         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7268         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
7269         LDKRecipient recipient_conv = LDKRecipient_from_cs(recipient);
7270         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
7271         *ret_conv = (this_arg_conv->get_node_id)(this_arg_conv->this_arg, recipient_conv);
7272         return tag_ptr(ret_conv, true);
7273 }
7274
7275 int64_t  CS_LDK_NodeSigner_ecdh(int64_t this_arg, int32_t recipient, int8_tArray other_key, int64_t tweak) {
7276         void* this_arg_ptr = untag_ptr(this_arg);
7277         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7278         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
7279         LDKRecipient recipient_conv = LDKRecipient_from_cs(recipient);
7280         LDKPublicKey other_key_ref;
7281         CHECK(other_key->arr_len == 33);
7282         memcpy(other_key_ref.compressed_form, other_key->elems, 33); FREE(other_key);
7283         void* tweak_ptr = untag_ptr(tweak);
7284         CHECK_ACCESS(tweak_ptr);
7285         LDKCOption_BigEndianScalarZ tweak_conv = *(LDKCOption_BigEndianScalarZ*)(tweak_ptr);
7286         tweak_conv = COption_BigEndianScalarZ_clone((LDKCOption_BigEndianScalarZ*)untag_ptr(tweak));
7287         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
7288         *ret_conv = (this_arg_conv->ecdh)(this_arg_conv->this_arg, recipient_conv, other_key_ref, tweak_conv);
7289         return tag_ptr(ret_conv, true);
7290 }
7291
7292 int64_t  CS_LDK_NodeSigner_sign_invoice(int64_t this_arg, int8_tArray hrp_bytes, ptrArray invoice_data, int32_t recipient) {
7293         void* this_arg_ptr = untag_ptr(this_arg);
7294         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7295         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
7296         LDKu8slice hrp_bytes_ref;
7297         hrp_bytes_ref.datalen = hrp_bytes->arr_len;
7298         hrp_bytes_ref.data = hrp_bytes->elems;
7299         LDKCVec_U5Z invoice_data_constr;
7300         invoice_data_constr.datalen = invoice_data->arr_len;
7301         if (invoice_data_constr.datalen > 0)
7302                 invoice_data_constr.data = MALLOC(invoice_data_constr.datalen * sizeof(LDKU5), "LDKCVec_U5Z Elements");
7303         else
7304                 invoice_data_constr.data = NULL;
7305         int8_t* invoice_data_vals = (void*) invoice_data->elems;
7306         for (size_t h = 0; h < invoice_data_constr.datalen; h++) {
7307                 int8_t invoice_data_conv_7 = invoice_data_vals[h];
7308                 
7309                 invoice_data_constr.data[h] = (LDKU5){ ._0 = invoice_data_conv_7 };
7310         }
7311         FREE(invoice_data);
7312         LDKRecipient recipient_conv = LDKRecipient_from_cs(recipient);
7313         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
7314         *ret_conv = (this_arg_conv->sign_invoice)(this_arg_conv->this_arg, hrp_bytes_ref, invoice_data_constr, recipient_conv);
7315         FREE(hrp_bytes);
7316         return tag_ptr(ret_conv, true);
7317 }
7318
7319 int64_t  CS_LDK_NodeSigner_sign_bolt12_invoice_request(int64_t this_arg, int64_t invoice_request) {
7320         void* this_arg_ptr = untag_ptr(this_arg);
7321         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7322         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
7323         LDKUnsignedInvoiceRequest invoice_request_conv;
7324         invoice_request_conv.inner = untag_ptr(invoice_request);
7325         invoice_request_conv.is_owned = ptr_is_owned(invoice_request);
7326         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_request_conv);
7327         invoice_request_conv.is_owned = false;
7328         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
7329         *ret_conv = (this_arg_conv->sign_bolt12_invoice_request)(this_arg_conv->this_arg, &invoice_request_conv);
7330         return tag_ptr(ret_conv, true);
7331 }
7332
7333 int64_t  CS_LDK_NodeSigner_sign_bolt12_invoice(int64_t this_arg, int64_t invoice) {
7334         void* this_arg_ptr = untag_ptr(this_arg);
7335         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7336         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
7337         LDKUnsignedBolt12Invoice invoice_conv;
7338         invoice_conv.inner = untag_ptr(invoice);
7339         invoice_conv.is_owned = ptr_is_owned(invoice);
7340         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
7341         invoice_conv.is_owned = false;
7342         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
7343         *ret_conv = (this_arg_conv->sign_bolt12_invoice)(this_arg_conv->this_arg, &invoice_conv);
7344         return tag_ptr(ret_conv, true);
7345 }
7346
7347 int64_t  CS_LDK_NodeSigner_sign_gossip_message(int64_t this_arg, int64_t msg) {
7348         void* this_arg_ptr = untag_ptr(this_arg);
7349         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7350         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
7351         void* msg_ptr = untag_ptr(msg);
7352         CHECK_ACCESS(msg_ptr);
7353         LDKUnsignedGossipMessage msg_conv = *(LDKUnsignedGossipMessage*)(msg_ptr);
7354         msg_conv = UnsignedGossipMessage_clone((LDKUnsignedGossipMessage*)untag_ptr(msg));
7355         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
7356         *ret_conv = (this_arg_conv->sign_gossip_message)(this_arg_conv->this_arg, msg_conv);
7357         return tag_ptr(ret_conv, true);
7358 }
7359
7360 typedef struct LDKSignerProvider_JCalls {
7361         atomic_size_t refcnt;
7362         uint32_t instance_ptr;
7363 } LDKSignerProvider_JCalls;
7364 static void LDKSignerProvider_JCalls_free(void* this_arg) {
7365         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
7366         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7367                 FREE(j_calls);
7368         }
7369 }
7370 LDKThirtyTwoBytes generate_channel_keys_id_LDKSignerProvider_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis, LDKU128 user_channel_id) {
7371         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
7372         jboolean inbound_conv = inbound;
7373         int64_t channel_value_satoshis_conv = channel_value_satoshis;
7374         int8_tArray user_channel_id_arr = init_int8_tArray(16, __LINE__);
7375         memcpy(user_channel_id_arr->elems, user_channel_id.le_bytes, 16);
7376         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);
7377         LDKThirtyTwoBytes ret_ref;
7378         CHECK(ret->arr_len == 32);
7379         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
7380         return ret_ref;
7381 }
7382 LDKWriteableEcdsaChannelSigner derive_channel_signer_LDKSignerProvider_jcall(const void* this_arg, uint64_t channel_value_satoshis, LDKThirtyTwoBytes channel_keys_id) {
7383         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
7384         int64_t channel_value_satoshis_conv = channel_value_satoshis;
7385         int8_tArray channel_keys_id_arr = init_int8_tArray(32, __LINE__);
7386         memcpy(channel_keys_id_arr->elems, channel_keys_id.data, 32);
7387         uint64_t ret = js_invoke_function_l_ll(j_calls->instance_ptr, 40, channel_value_satoshis_conv, (int64_t)channel_keys_id_arr);
7388         void* ret_ptr = untag_ptr(ret);
7389         CHECK_ACCESS(ret_ptr);
7390         LDKWriteableEcdsaChannelSigner ret_conv = *(LDKWriteableEcdsaChannelSigner*)(ret_ptr);
7391         FREE(untag_ptr(ret));
7392         return ret_conv;
7393 }
7394 LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ read_chan_signer_LDKSignerProvider_jcall(const void* this_arg, LDKu8slice reader) {
7395         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
7396         LDKu8slice reader_var = reader;
7397         int8_tArray reader_arr = init_int8_tArray(reader_var.datalen, __LINE__);
7398         memcpy(reader_arr->elems, reader_var.data, reader_var.datalen);
7399         uint64_t ret = js_invoke_function_l_l(j_calls->instance_ptr, 41, (int64_t)reader_arr);
7400         void* ret_ptr = untag_ptr(ret);
7401         CHECK_ACCESS(ret_ptr);
7402         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ ret_conv = *(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)(ret_ptr);
7403         FREE(untag_ptr(ret));
7404         return ret_conv;
7405 }
7406 LDKCResult_CVec_u8ZNoneZ get_destination_script_LDKSignerProvider_jcall(const void* this_arg, LDKThirtyTwoBytes channel_keys_id) {
7407         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
7408         int8_tArray channel_keys_id_arr = init_int8_tArray(32, __LINE__);
7409         memcpy(channel_keys_id_arr->elems, channel_keys_id.data, 32);
7410         uint64_t ret = js_invoke_function_l_l(j_calls->instance_ptr, 42, (int64_t)channel_keys_id_arr);
7411         void* ret_ptr = untag_ptr(ret);
7412         CHECK_ACCESS(ret_ptr);
7413         LDKCResult_CVec_u8ZNoneZ ret_conv = *(LDKCResult_CVec_u8ZNoneZ*)(ret_ptr);
7414         FREE(untag_ptr(ret));
7415         return ret_conv;
7416 }
7417 LDKCResult_ShutdownScriptNoneZ get_shutdown_scriptpubkey_LDKSignerProvider_jcall(const void* this_arg) {
7418         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
7419         uint64_t ret = js_invoke_function_l_(j_calls->instance_ptr, 43);
7420         void* ret_ptr = untag_ptr(ret);
7421         CHECK_ACCESS(ret_ptr);
7422         LDKCResult_ShutdownScriptNoneZ ret_conv = *(LDKCResult_ShutdownScriptNoneZ*)(ret_ptr);
7423         FREE(untag_ptr(ret));
7424         return ret_conv;
7425 }
7426 static void LDKSignerProvider_JCalls_cloned(LDKSignerProvider* new_obj) {
7427         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) new_obj->this_arg;
7428         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7429 }
7430 static inline LDKSignerProvider LDKSignerProvider_init (int64_t o) {
7431         LDKSignerProvider_JCalls *calls = MALLOC(sizeof(LDKSignerProvider_JCalls), "LDKSignerProvider_JCalls");
7432         atomic_init(&calls->refcnt, 1);
7433         calls->instance_ptr = o;
7434
7435         LDKSignerProvider ret = {
7436                 .this_arg = (void*) calls,
7437                 .generate_channel_keys_id = generate_channel_keys_id_LDKSignerProvider_jcall,
7438                 .derive_channel_signer = derive_channel_signer_LDKSignerProvider_jcall,
7439                 .read_chan_signer = read_chan_signer_LDKSignerProvider_jcall,
7440                 .get_destination_script = get_destination_script_LDKSignerProvider_jcall,
7441                 .get_shutdown_scriptpubkey = get_shutdown_scriptpubkey_LDKSignerProvider_jcall,
7442                 .free = LDKSignerProvider_JCalls_free,
7443         };
7444         return ret;
7445 }
7446 uint64_t  CS_LDK_LDKSignerProvider_new(int32_t o) {
7447         LDKSignerProvider *res_ptr = MALLOC(sizeof(LDKSignerProvider), "LDKSignerProvider");
7448         *res_ptr = LDKSignerProvider_init(o);
7449         return tag_ptr(res_ptr, true);
7450 }
7451 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) {
7452         void* this_arg_ptr = untag_ptr(this_arg);
7453         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7454         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
7455         LDKU128 user_channel_id_ref;
7456         CHECK(user_channel_id->arr_len == 16);
7457         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
7458         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
7459         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);
7460         return ret_arr;
7461 }
7462
7463 int64_t  CS_LDK_SignerProvider_derive_channel_signer(int64_t this_arg, int64_t channel_value_satoshis, int8_tArray channel_keys_id) {
7464         void* this_arg_ptr = untag_ptr(this_arg);
7465         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7466         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
7467         LDKThirtyTwoBytes channel_keys_id_ref;
7468         CHECK(channel_keys_id->arr_len == 32);
7469         memcpy(channel_keys_id_ref.data, channel_keys_id->elems, 32); FREE(channel_keys_id);
7470         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
7471         *ret_ret = (this_arg_conv->derive_channel_signer)(this_arg_conv->this_arg, channel_value_satoshis, channel_keys_id_ref);
7472         return tag_ptr(ret_ret, true);
7473 }
7474
7475 int64_t  CS_LDK_SignerProvider_read_chan_signer(int64_t this_arg, int8_tArray reader) {
7476         void* this_arg_ptr = untag_ptr(this_arg);
7477         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7478         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
7479         LDKu8slice reader_ref;
7480         reader_ref.datalen = reader->arr_len;
7481         reader_ref.data = reader->elems;
7482         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
7483         *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref);
7484         FREE(reader);
7485         return tag_ptr(ret_conv, true);
7486 }
7487
7488 int64_t  CS_LDK_SignerProvider_get_destination_script(int64_t this_arg, int8_tArray channel_keys_id) {
7489         void* this_arg_ptr = untag_ptr(this_arg);
7490         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7491         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
7492         LDKThirtyTwoBytes channel_keys_id_ref;
7493         CHECK(channel_keys_id->arr_len == 32);
7494         memcpy(channel_keys_id_ref.data, channel_keys_id->elems, 32); FREE(channel_keys_id);
7495         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
7496         *ret_conv = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg, channel_keys_id_ref);
7497         return tag_ptr(ret_conv, true);
7498 }
7499
7500 int64_t  CS_LDK_SignerProvider_get_shutdown_scriptpubkey(int64_t this_arg) {
7501         void* this_arg_ptr = untag_ptr(this_arg);
7502         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7503         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
7504         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
7505         *ret_conv = (this_arg_conv->get_shutdown_scriptpubkey)(this_arg_conv->this_arg);
7506         return tag_ptr(ret_conv, true);
7507 }
7508
7509 typedef struct LDKFeeEstimator_JCalls {
7510         atomic_size_t refcnt;
7511         uint32_t instance_ptr;
7512 } LDKFeeEstimator_JCalls;
7513 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
7514         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
7515         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7516                 FREE(j_calls);
7517         }
7518 }
7519 uint32_t get_est_sat_per_1000_weight_LDKFeeEstimator_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
7520         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
7521         int32_t confirmation_target_conv = LDKConfirmationTarget_to_cs(confirmation_target);
7522         return js_invoke_function_i_ConfirmationTarget(j_calls->instance_ptr, 44, confirmation_target_conv);
7523 }
7524 static void LDKFeeEstimator_JCalls_cloned(LDKFeeEstimator* new_obj) {
7525         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) new_obj->this_arg;
7526         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7527 }
7528 static inline LDKFeeEstimator LDKFeeEstimator_init (int64_t o) {
7529         LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
7530         atomic_init(&calls->refcnt, 1);
7531         calls->instance_ptr = o;
7532
7533         LDKFeeEstimator ret = {
7534                 .this_arg = (void*) calls,
7535                 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_LDKFeeEstimator_jcall,
7536                 .free = LDKFeeEstimator_JCalls_free,
7537         };
7538         return ret;
7539 }
7540 uint64_t  CS_LDK_LDKFeeEstimator_new(int32_t o) {
7541         LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
7542         *res_ptr = LDKFeeEstimator_init(o);
7543         return tag_ptr(res_ptr, true);
7544 }
7545 int32_t  CS_LDK_FeeEstimator_get_est_sat_per_1000_weight(int64_t this_arg, int32_t confirmation_target) {
7546         void* this_arg_ptr = untag_ptr(this_arg);
7547         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7548         LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)this_arg_ptr;
7549         LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_cs(confirmation_target);
7550         int32_t ret_conv = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
7551         return ret_conv;
7552 }
7553
7554 typedef struct LDKMessageRouter_JCalls {
7555         atomic_size_t refcnt;
7556         uint32_t instance_ptr;
7557 } LDKMessageRouter_JCalls;
7558 static void LDKMessageRouter_JCalls_free(void* this_arg) {
7559         LDKMessageRouter_JCalls *j_calls = (LDKMessageRouter_JCalls*) this_arg;
7560         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7561                 FREE(j_calls);
7562         }
7563 }
7564 LDKCResult_OnionMessagePathNoneZ find_path_LDKMessageRouter_jcall(const void* this_arg, LDKPublicKey sender, LDKCVec_PublicKeyZ peers, LDKDestination destination) {
7565         LDKMessageRouter_JCalls *j_calls = (LDKMessageRouter_JCalls*) this_arg;
7566         int8_tArray sender_arr = init_int8_tArray(33, __LINE__);
7567         memcpy(sender_arr->elems, sender.compressed_form, 33);
7568         LDKCVec_PublicKeyZ peers_var = peers;
7569         ptrArray peers_arr = NULL;
7570         peers_arr = init_ptrArray(peers_var.datalen, __LINE__);
7571         int8_tArray *peers_arr_ptr = (int8_tArray*)(((uint8_t*)peers_arr) + 8);
7572         for (size_t i = 0; i < peers_var.datalen; i++) {
7573                 int8_tArray peers_conv_8_arr = init_int8_tArray(33, __LINE__);
7574                 memcpy(peers_conv_8_arr->elems, peers_var.data[i].compressed_form, 33);
7575                 peers_arr_ptr[i] = peers_conv_8_arr;
7576         }
7577         
7578         FREE(peers_var.data);
7579         LDKDestination *destination_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
7580         *destination_copy = destination;
7581         int64_t destination_ref = tag_ptr(destination_copy, true);
7582         uint64_t ret = js_invoke_function_l_lll(j_calls->instance_ptr, 45, (int64_t)sender_arr, (int64_t)peers_arr, destination_ref);
7583         void* ret_ptr = untag_ptr(ret);
7584         CHECK_ACCESS(ret_ptr);
7585         LDKCResult_OnionMessagePathNoneZ ret_conv = *(LDKCResult_OnionMessagePathNoneZ*)(ret_ptr);
7586         FREE(untag_ptr(ret));
7587         return ret_conv;
7588 }
7589 LDKCResult_CVec_BlindedPathZNoneZ create_blinded_paths_LDKMessageRouter_jcall(const void* this_arg, LDKPublicKey recipient, LDKCVec_PublicKeyZ peers) {
7590         LDKMessageRouter_JCalls *j_calls = (LDKMessageRouter_JCalls*) this_arg;
7591         int8_tArray recipient_arr = init_int8_tArray(33, __LINE__);
7592         memcpy(recipient_arr->elems, recipient.compressed_form, 33);
7593         LDKCVec_PublicKeyZ peers_var = peers;
7594         ptrArray peers_arr = NULL;
7595         peers_arr = init_ptrArray(peers_var.datalen, __LINE__);
7596         int8_tArray *peers_arr_ptr = (int8_tArray*)(((uint8_t*)peers_arr) + 8);
7597         for (size_t i = 0; i < peers_var.datalen; i++) {
7598                 int8_tArray peers_conv_8_arr = init_int8_tArray(33, __LINE__);
7599                 memcpy(peers_conv_8_arr->elems, peers_var.data[i].compressed_form, 33);
7600                 peers_arr_ptr[i] = peers_conv_8_arr;
7601         }
7602         
7603         FREE(peers_var.data);
7604         uint64_t ret = js_invoke_function_l_ll(j_calls->instance_ptr, 46, (int64_t)recipient_arr, (int64_t)peers_arr);
7605         void* ret_ptr = untag_ptr(ret);
7606         CHECK_ACCESS(ret_ptr);
7607         LDKCResult_CVec_BlindedPathZNoneZ ret_conv = *(LDKCResult_CVec_BlindedPathZNoneZ*)(ret_ptr);
7608         FREE(untag_ptr(ret));
7609         return ret_conv;
7610 }
7611 static void LDKMessageRouter_JCalls_cloned(LDKMessageRouter* new_obj) {
7612         LDKMessageRouter_JCalls *j_calls = (LDKMessageRouter_JCalls*) new_obj->this_arg;
7613         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7614 }
7615 static inline LDKMessageRouter LDKMessageRouter_init (int64_t o) {
7616         LDKMessageRouter_JCalls *calls = MALLOC(sizeof(LDKMessageRouter_JCalls), "LDKMessageRouter_JCalls");
7617         atomic_init(&calls->refcnt, 1);
7618         calls->instance_ptr = o;
7619
7620         LDKMessageRouter ret = {
7621                 .this_arg = (void*) calls,
7622                 .find_path = find_path_LDKMessageRouter_jcall,
7623                 .create_blinded_paths = create_blinded_paths_LDKMessageRouter_jcall,
7624                 .free = LDKMessageRouter_JCalls_free,
7625         };
7626         return ret;
7627 }
7628 uint64_t  CS_LDK_LDKMessageRouter_new(int32_t o) {
7629         LDKMessageRouter *res_ptr = MALLOC(sizeof(LDKMessageRouter), "LDKMessageRouter");
7630         *res_ptr = LDKMessageRouter_init(o);
7631         return tag_ptr(res_ptr, true);
7632 }
7633 int64_t  CS_LDK_MessageRouter_find_path(int64_t this_arg, int8_tArray sender, ptrArray peers, int64_t destination) {
7634         void* this_arg_ptr = untag_ptr(this_arg);
7635         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7636         LDKMessageRouter* this_arg_conv = (LDKMessageRouter*)this_arg_ptr;
7637         LDKPublicKey sender_ref;
7638         CHECK(sender->arr_len == 33);
7639         memcpy(sender_ref.compressed_form, sender->elems, 33); FREE(sender);
7640         LDKCVec_PublicKeyZ peers_constr;
7641         peers_constr.datalen = peers->arr_len;
7642         if (peers_constr.datalen > 0)
7643                 peers_constr.data = MALLOC(peers_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
7644         else
7645                 peers_constr.data = NULL;
7646         int8_tArray* peers_vals = (void*) peers->elems;
7647         for (size_t i = 0; i < peers_constr.datalen; i++) {
7648                 int8_tArray peers_conv_8 = peers_vals[i];
7649                 LDKPublicKey peers_conv_8_ref;
7650                 CHECK(peers_conv_8->arr_len == 33);
7651                 memcpy(peers_conv_8_ref.compressed_form, peers_conv_8->elems, 33); FREE(peers_conv_8);
7652                 peers_constr.data[i] = peers_conv_8_ref;
7653         }
7654         FREE(peers);
7655         void* destination_ptr = untag_ptr(destination);
7656         CHECK_ACCESS(destination_ptr);
7657         LDKDestination destination_conv = *(LDKDestination*)(destination_ptr);
7658         destination_conv = Destination_clone((LDKDestination*)untag_ptr(destination));
7659         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
7660         *ret_conv = (this_arg_conv->find_path)(this_arg_conv->this_arg, sender_ref, peers_constr, destination_conv);
7661         return tag_ptr(ret_conv, true);
7662 }
7663
7664 int64_t  CS_LDK_MessageRouter_create_blinded_paths(int64_t this_arg, int8_tArray recipient, ptrArray peers) {
7665         void* this_arg_ptr = untag_ptr(this_arg);
7666         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7667         LDKMessageRouter* this_arg_conv = (LDKMessageRouter*)this_arg_ptr;
7668         LDKPublicKey recipient_ref;
7669         CHECK(recipient->arr_len == 33);
7670         memcpy(recipient_ref.compressed_form, recipient->elems, 33); FREE(recipient);
7671         LDKCVec_PublicKeyZ peers_constr;
7672         peers_constr.datalen = peers->arr_len;
7673         if (peers_constr.datalen > 0)
7674                 peers_constr.data = MALLOC(peers_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
7675         else
7676                 peers_constr.data = NULL;
7677         int8_tArray* peers_vals = (void*) peers->elems;
7678         for (size_t i = 0; i < peers_constr.datalen; i++) {
7679                 int8_tArray peers_conv_8 = peers_vals[i];
7680                 LDKPublicKey peers_conv_8_ref;
7681                 CHECK(peers_conv_8->arr_len == 33);
7682                 memcpy(peers_conv_8_ref.compressed_form, peers_conv_8->elems, 33); FREE(peers_conv_8);
7683                 peers_constr.data[i] = peers_conv_8_ref;
7684         }
7685         FREE(peers);
7686         LDKCResult_CVec_BlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_BlindedPathZNoneZ), "LDKCResult_CVec_BlindedPathZNoneZ");
7687         *ret_conv = (this_arg_conv->create_blinded_paths)(this_arg_conv->this_arg, recipient_ref, peers_constr);
7688         return tag_ptr(ret_conv, true);
7689 }
7690
7691 typedef struct LDKRouter_JCalls {
7692         atomic_size_t refcnt;
7693         uint32_t instance_ptr;
7694         LDKMessageRouter_JCalls* MessageRouter;
7695 } LDKRouter_JCalls;
7696 static void LDKRouter_JCalls_free(void* this_arg) {
7697         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
7698         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7699                 FREE(j_calls);
7700         }
7701 }
7702 LDKCResult_RouteLightningErrorZ find_route_LDKRouter_jcall(const void* this_arg, LDKPublicKey payer, const LDKRouteParameters * route_params, LDKCVec_ChannelDetailsZ * first_hops, LDKInFlightHtlcs inflight_htlcs) {
7703         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
7704         int8_tArray payer_arr = init_int8_tArray(33, __LINE__);
7705         memcpy(payer_arr->elems, payer.compressed_form, 33);
7706         LDKRouteParameters route_params_var = *route_params;
7707         int64_t route_params_ref = 0;
7708         route_params_var = RouteParameters_clone(&route_params_var);
7709         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_var);
7710         route_params_ref = tag_ptr(route_params_var.inner, route_params_var.is_owned);
7711         LDKCVec_ChannelDetailsZ *first_hops_var_ptr = first_hops;
7712         int64_tArray first_hops_arr = NULL;
7713         if (first_hops != NULL) {
7714                 LDKCVec_ChannelDetailsZ first_hops_var = *first_hops_var_ptr;
7715                 first_hops_arr = init_int64_tArray(first_hops_var.datalen, __LINE__);
7716                 int64_t *first_hops_arr_ptr = (int64_t*)(((uint8_t*)first_hops_arr) + 8);
7717                 for (size_t q = 0; q < first_hops_var.datalen; q++) {
7718                         LDKChannelDetails first_hops_conv_16_var =      first_hops_var.data[q];
7719                         int64_t first_hops_conv_16_ref = 0;
7720                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var);
7721                         first_hops_conv_16_ref = tag_ptr(first_hops_conv_16_var.inner, first_hops_conv_16_var.is_owned);
7722                         first_hops_arr_ptr[q] = first_hops_conv_16_ref;
7723                 }
7724         
7725         }
7726         LDKInFlightHtlcs inflight_htlcs_var = inflight_htlcs;
7727         int64_t inflight_htlcs_ref = 0;
7728         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_var);
7729         inflight_htlcs_ref = tag_ptr(inflight_htlcs_var.inner, inflight_htlcs_var.is_owned);
7730         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);
7731         void* ret_ptr = untag_ptr(ret);
7732         CHECK_ACCESS(ret_ptr);
7733         LDKCResult_RouteLightningErrorZ ret_conv = *(LDKCResult_RouteLightningErrorZ*)(ret_ptr);
7734         FREE(untag_ptr(ret));
7735         return ret_conv;
7736 }
7737 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) {
7738         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
7739         int8_tArray payer_arr = init_int8_tArray(33, __LINE__);
7740         memcpy(payer_arr->elems, payer.compressed_form, 33);
7741         LDKRouteParameters route_params_var = *route_params;
7742         int64_t route_params_ref = 0;
7743         route_params_var = RouteParameters_clone(&route_params_var);
7744         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_var);
7745         route_params_ref = tag_ptr(route_params_var.inner, route_params_var.is_owned);
7746         LDKCVec_ChannelDetailsZ *first_hops_var_ptr = first_hops;
7747         int64_tArray first_hops_arr = NULL;
7748         if (first_hops != NULL) {
7749                 LDKCVec_ChannelDetailsZ first_hops_var = *first_hops_var_ptr;
7750                 first_hops_arr = init_int64_tArray(first_hops_var.datalen, __LINE__);
7751                 int64_t *first_hops_arr_ptr = (int64_t*)(((uint8_t*)first_hops_arr) + 8);
7752                 for (size_t q = 0; q < first_hops_var.datalen; q++) {
7753                         LDKChannelDetails first_hops_conv_16_var =      first_hops_var.data[q];
7754                         int64_t first_hops_conv_16_ref = 0;
7755                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var);
7756                         first_hops_conv_16_ref = tag_ptr(first_hops_conv_16_var.inner, first_hops_conv_16_var.is_owned);
7757                         first_hops_arr_ptr[q] = first_hops_conv_16_ref;
7758                 }
7759         
7760         }
7761         LDKInFlightHtlcs inflight_htlcs_var = inflight_htlcs;
7762         int64_t inflight_htlcs_ref = 0;
7763         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_var);
7764         inflight_htlcs_ref = tag_ptr(inflight_htlcs_var.inner, inflight_htlcs_var.is_owned);
7765         int8_tArray _payment_hash_arr = init_int8_tArray(32, __LINE__);
7766         memcpy(_payment_hash_arr->elems, _payment_hash.data, 32);
7767         int8_tArray _payment_id_arr = init_int8_tArray(32, __LINE__);
7768         memcpy(_payment_id_arr->elems, _payment_id.data, 32);
7769         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);
7770         void* ret_ptr = untag_ptr(ret);
7771         CHECK_ACCESS(ret_ptr);
7772         LDKCResult_RouteLightningErrorZ ret_conv = *(LDKCResult_RouteLightningErrorZ*)(ret_ptr);
7773         FREE(untag_ptr(ret));
7774         return ret_conv;
7775 }
7776 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) {
7777         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
7778         int8_tArray recipient_arr = init_int8_tArray(33, __LINE__);
7779         memcpy(recipient_arr->elems, recipient.compressed_form, 33);
7780         LDKCVec_ChannelDetailsZ first_hops_var = first_hops;
7781         int64_tArray first_hops_arr = NULL;
7782         first_hops_arr = init_int64_tArray(first_hops_var.datalen, __LINE__);
7783         int64_t *first_hops_arr_ptr = (int64_t*)(((uint8_t*)first_hops_arr) + 8);
7784         for (size_t q = 0; q < first_hops_var.datalen; q++) {
7785                 LDKChannelDetails first_hops_conv_16_var = first_hops_var.data[q];
7786                 int64_t first_hops_conv_16_ref = 0;
7787                 CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var);
7788                 first_hops_conv_16_ref = tag_ptr(first_hops_conv_16_var.inner, first_hops_conv_16_var.is_owned);
7789                 first_hops_arr_ptr[q] = first_hops_conv_16_ref;
7790         }
7791         
7792         FREE(first_hops_var.data);
7793         LDKReceiveTlvs tlvs_var = tlvs;
7794         int64_t tlvs_ref = 0;
7795         CHECK_INNER_FIELD_ACCESS_OR_NULL(tlvs_var);
7796         tlvs_ref = tag_ptr(tlvs_var.inner, tlvs_var.is_owned);
7797         int64_t amount_msats_conv = amount_msats;
7798         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);
7799         void* ret_ptr = untag_ptr(ret);
7800         CHECK_ACCESS(ret_ptr);
7801         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ ret_conv = *(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ*)(ret_ptr);
7802         FREE(untag_ptr(ret));
7803         return ret_conv;
7804 }
7805 static void LDKRouter_JCalls_cloned(LDKRouter* new_obj) {
7806         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) new_obj->this_arg;
7807         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7808         atomic_fetch_add_explicit(&j_calls->MessageRouter->refcnt, 1, memory_order_release);
7809 }
7810 static inline LDKRouter LDKRouter_init (int64_t o, int64_t MessageRouter) {
7811         LDKRouter_JCalls *calls = MALLOC(sizeof(LDKRouter_JCalls), "LDKRouter_JCalls");
7812         atomic_init(&calls->refcnt, 1);
7813         calls->instance_ptr = o;
7814
7815         LDKRouter ret = {
7816                 .this_arg = (void*) calls,
7817                 .find_route = find_route_LDKRouter_jcall,
7818                 .find_route_with_id = find_route_with_id_LDKRouter_jcall,
7819                 .create_blinded_payment_paths = create_blinded_payment_paths_LDKRouter_jcall,
7820                 .free = LDKRouter_JCalls_free,
7821                 .MessageRouter = LDKMessageRouter_init(MessageRouter),
7822         };
7823         calls->MessageRouter = ret.MessageRouter.this_arg;
7824         return ret;
7825 }
7826 uint64_t  CS_LDK_LDKRouter_new(int32_t o, int32_t MessageRouter) {
7827         LDKRouter *res_ptr = MALLOC(sizeof(LDKRouter), "LDKRouter");
7828         *res_ptr = LDKRouter_init(o, MessageRouter);
7829         return tag_ptr(res_ptr, true);
7830 }
7831 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) {
7832         void* this_arg_ptr = untag_ptr(this_arg);
7833         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7834         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
7835         LDKPublicKey payer_ref;
7836         CHECK(payer->arr_len == 33);
7837         memcpy(payer_ref.compressed_form, payer->elems, 33); FREE(payer);
7838         LDKRouteParameters route_params_conv;
7839         route_params_conv.inner = untag_ptr(route_params);
7840         route_params_conv.is_owned = ptr_is_owned(route_params);
7841         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
7842         route_params_conv.is_owned = false;
7843         LDKCVec_ChannelDetailsZ first_hops_constr;
7844         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
7845         if (first_hops != NULL) {
7846                 first_hops_constr.datalen = first_hops->arr_len;
7847                 if (first_hops_constr.datalen > 0)
7848                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
7849                 else
7850                         first_hops_constr.data = NULL;
7851                 int64_t* first_hops_vals = first_hops->elems;
7852                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
7853                         int64_t first_hops_conv_16 = first_hops_vals[q];
7854                         LDKChannelDetails first_hops_conv_16_conv;
7855                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
7856                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
7857                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
7858                         first_hops_conv_16_conv.is_owned = false;
7859                         first_hops_constr.data[q] = first_hops_conv_16_conv;
7860                 }
7861                 FREE(first_hops);
7862                 first_hops_ptr = &first_hops_constr;
7863         }
7864         LDKInFlightHtlcs inflight_htlcs_conv;
7865         inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs);
7866         inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs);
7867         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv);
7868         inflight_htlcs_conv = InFlightHtlcs_clone(&inflight_htlcs_conv);
7869         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
7870         *ret_conv = (this_arg_conv->find_route)(this_arg_conv->this_arg, payer_ref, &route_params_conv, first_hops_ptr, inflight_htlcs_conv);
7871         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
7872         return tag_ptr(ret_conv, true);
7873 }
7874
7875 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) {
7876         void* this_arg_ptr = untag_ptr(this_arg);
7877         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7878         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
7879         LDKPublicKey payer_ref;
7880         CHECK(payer->arr_len == 33);
7881         memcpy(payer_ref.compressed_form, payer->elems, 33); FREE(payer);
7882         LDKRouteParameters route_params_conv;
7883         route_params_conv.inner = untag_ptr(route_params);
7884         route_params_conv.is_owned = ptr_is_owned(route_params);
7885         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
7886         route_params_conv.is_owned = false;
7887         LDKCVec_ChannelDetailsZ first_hops_constr;
7888         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
7889         if (first_hops != NULL) {
7890                 first_hops_constr.datalen = first_hops->arr_len;
7891                 if (first_hops_constr.datalen > 0)
7892                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
7893                 else
7894                         first_hops_constr.data = NULL;
7895                 int64_t* first_hops_vals = first_hops->elems;
7896                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
7897                         int64_t first_hops_conv_16 = first_hops_vals[q];
7898                         LDKChannelDetails first_hops_conv_16_conv;
7899                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
7900                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
7901                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
7902                         first_hops_conv_16_conv.is_owned = false;
7903                         first_hops_constr.data[q] = first_hops_conv_16_conv;
7904                 }
7905                 FREE(first_hops);
7906                 first_hops_ptr = &first_hops_constr;
7907         }
7908         LDKInFlightHtlcs inflight_htlcs_conv;
7909         inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs);
7910         inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs);
7911         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv);
7912         inflight_htlcs_conv = InFlightHtlcs_clone(&inflight_htlcs_conv);
7913         LDKThirtyTwoBytes _payment_hash_ref;
7914         CHECK(_payment_hash->arr_len == 32);
7915         memcpy(_payment_hash_ref.data, _payment_hash->elems, 32); FREE(_payment_hash);
7916         LDKThirtyTwoBytes _payment_id_ref;
7917         CHECK(_payment_id->arr_len == 32);
7918         memcpy(_payment_id_ref.data, _payment_id->elems, 32); FREE(_payment_id);
7919         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
7920         *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);
7921         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
7922         return tag_ptr(ret_conv, true);
7923 }
7924
7925 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) {
7926         void* this_arg_ptr = untag_ptr(this_arg);
7927         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7928         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
7929         LDKPublicKey recipient_ref;
7930         CHECK(recipient->arr_len == 33);
7931         memcpy(recipient_ref.compressed_form, recipient->elems, 33); FREE(recipient);
7932         LDKCVec_ChannelDetailsZ first_hops_constr;
7933         first_hops_constr.datalen = first_hops->arr_len;
7934         if (first_hops_constr.datalen > 0)
7935                 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
7936         else
7937                 first_hops_constr.data = NULL;
7938         int64_t* first_hops_vals = first_hops->elems;
7939         for (size_t q = 0; q < first_hops_constr.datalen; q++) {
7940                 int64_t first_hops_conv_16 = first_hops_vals[q];
7941                 LDKChannelDetails first_hops_conv_16_conv;
7942                 first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
7943                 first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
7944                 CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
7945                 first_hops_conv_16_conv = ChannelDetails_clone(&first_hops_conv_16_conv);
7946                 first_hops_constr.data[q] = first_hops_conv_16_conv;
7947         }
7948         FREE(first_hops);
7949         LDKReceiveTlvs tlvs_conv;
7950         tlvs_conv.inner = untag_ptr(tlvs);
7951         tlvs_conv.is_owned = ptr_is_owned(tlvs);
7952         CHECK_INNER_FIELD_ACCESS_OR_NULL(tlvs_conv);
7953         tlvs_conv = ReceiveTlvs_clone(&tlvs_conv);
7954         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ), "LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ");
7955         *ret_conv = (this_arg_conv->create_blinded_payment_paths)(this_arg_conv->this_arg, recipient_ref, first_hops_constr, tlvs_conv, amount_msats);
7956         return tag_ptr(ret_conv, true);
7957 }
7958
7959 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesChannelManagerZ_get_a(LDKC2Tuple_ThirtyTwoBytesChannelManagerZ *NONNULL_PTR owner){
7960         return ThirtyTwoBytes_clone(&owner->a);
7961 }
7962 int8_tArray  CS_LDK_C2Tuple_ThirtyTwoBytesChannelManagerZ_get_a(int64_t owner) {
7963         LDKC2Tuple_ThirtyTwoBytesChannelManagerZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesChannelManagerZ*)untag_ptr(owner);
7964         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
7965         memcpy(ret_arr->elems, C2Tuple_ThirtyTwoBytesChannelManagerZ_get_a(owner_conv).data, 32);
7966         return ret_arr;
7967 }
7968
7969 static inline struct LDKChannelManager C2Tuple_ThirtyTwoBytesChannelManagerZ_get_b(LDKC2Tuple_ThirtyTwoBytesChannelManagerZ *NONNULL_PTR owner){
7970         LDKChannelManager ret = owner->b;
7971         ret.is_owned = false;
7972         return ret;
7973 }
7974 int64_t  CS_LDK_C2Tuple_ThirtyTwoBytesChannelManagerZ_get_b(int64_t owner) {
7975         LDKC2Tuple_ThirtyTwoBytesChannelManagerZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesChannelManagerZ*)untag_ptr(owner);
7976         LDKChannelManager ret_var = C2Tuple_ThirtyTwoBytesChannelManagerZ_get_b(owner_conv);
7977         int64_t ret_ref = 0;
7978         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7979         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7980         return ret_ref;
7981 }
7982
7983 static inline struct LDKC2Tuple_ThirtyTwoBytesChannelManagerZ *CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
7984 CHECK(owner->result_ok);
7985         return &*owner->contents.result;
7986 }
7987 int64_t  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_ok(int64_t owner) {
7988         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ*)untag_ptr(owner);
7989         int64_t ret_ret = tag_ptr(CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_ok(owner_conv), false);
7990         return ret_ret;
7991 }
7992
7993 static inline struct LDKDecodeError CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_err(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
7994 CHECK(!owner->result_ok);
7995         return DecodeError_clone(&*owner->contents.err);
7996 }
7997 int64_t  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_err(int64_t owner) {
7998         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ*)untag_ptr(owner);
7999         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8000         *ret_copy = CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_err(owner_conv);
8001         int64_t ret_ref = tag_ptr(ret_copy, true);
8002         return ret_ref;
8003 }
8004
8005 uint32_t CS_LDK_LDKMaxDustHTLCExposure_ty_from_ptr(int64_t ptr) {
8006         LDKMaxDustHTLCExposure *obj = (LDKMaxDustHTLCExposure*)untag_ptr(ptr);
8007         switch(obj->tag) {
8008                 case LDKMaxDustHTLCExposure_FixedLimitMsat: return 0;
8009                 case LDKMaxDustHTLCExposure_FeeRateMultiplier: return 1;
8010                 default: abort();
8011         }
8012 }
8013 int64_t CS_LDK_LDKMaxDustHTLCExposure_FixedLimitMsat_get_fixed_limit_msat(int64_t ptr) {
8014         LDKMaxDustHTLCExposure *obj = (LDKMaxDustHTLCExposure*)untag_ptr(ptr);
8015         CHECK(obj->tag == LDKMaxDustHTLCExposure_FixedLimitMsat);
8016         int64_t fixed_limit_msat_conv = obj->fixed_limit_msat;
8017         return fixed_limit_msat_conv;
8018 }
8019 int64_t CS_LDK_LDKMaxDustHTLCExposure_FeeRateMultiplier_get_fee_rate_multiplier(int64_t ptr) {
8020         LDKMaxDustHTLCExposure *obj = (LDKMaxDustHTLCExposure*)untag_ptr(ptr);
8021         CHECK(obj->tag == LDKMaxDustHTLCExposure_FeeRateMultiplier);
8022         int64_t fee_rate_multiplier_conv = obj->fee_rate_multiplier;
8023         return fee_rate_multiplier_conv;
8024 }
8025 static inline struct LDKMaxDustHTLCExposure CResult_MaxDustHTLCExposureDecodeErrorZ_get_ok(LDKCResult_MaxDustHTLCExposureDecodeErrorZ *NONNULL_PTR owner){
8026 CHECK(owner->result_ok);
8027         return MaxDustHTLCExposure_clone(&*owner->contents.result);
8028 }
8029 int64_t  CS_LDK_CResult_MaxDustHTLCExposureDecodeErrorZ_get_ok(int64_t owner) {
8030         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* owner_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(owner);
8031         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
8032         *ret_copy = CResult_MaxDustHTLCExposureDecodeErrorZ_get_ok(owner_conv);
8033         int64_t ret_ref = tag_ptr(ret_copy, true);
8034         return ret_ref;
8035 }
8036
8037 static inline struct LDKDecodeError CResult_MaxDustHTLCExposureDecodeErrorZ_get_err(LDKCResult_MaxDustHTLCExposureDecodeErrorZ *NONNULL_PTR owner){
8038 CHECK(!owner->result_ok);
8039         return DecodeError_clone(&*owner->contents.err);
8040 }
8041 int64_t  CS_LDK_CResult_MaxDustHTLCExposureDecodeErrorZ_get_err(int64_t owner) {
8042         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* owner_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(owner);
8043         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8044         *ret_copy = CResult_MaxDustHTLCExposureDecodeErrorZ_get_err(owner_conv);
8045         int64_t ret_ref = tag_ptr(ret_copy, true);
8046         return ret_ref;
8047 }
8048
8049 static inline struct LDKChannelConfig CResult_ChannelConfigDecodeErrorZ_get_ok(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
8050         LDKChannelConfig ret = *owner->contents.result;
8051         ret.is_owned = false;
8052         return ret;
8053 }
8054 int64_t  CS_LDK_CResult_ChannelConfigDecodeErrorZ_get_ok(int64_t owner) {
8055         LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(owner);
8056         LDKChannelConfig ret_var = CResult_ChannelConfigDecodeErrorZ_get_ok(owner_conv);
8057         int64_t ret_ref = 0;
8058         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8059         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8060         return ret_ref;
8061 }
8062
8063 static inline struct LDKDecodeError CResult_ChannelConfigDecodeErrorZ_get_err(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
8064 CHECK(!owner->result_ok);
8065         return DecodeError_clone(&*owner->contents.err);
8066 }
8067 int64_t  CS_LDK_CResult_ChannelConfigDecodeErrorZ_get_err(int64_t owner) {
8068         LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(owner);
8069         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8070         *ret_copy = CResult_ChannelConfigDecodeErrorZ_get_err(owner_conv);
8071         int64_t ret_ref = tag_ptr(ret_copy, true);
8072         return ret_ref;
8073 }
8074
8075 uint32_t CS_LDK_LDKCOption_MaxDustHTLCExposureZ_ty_from_ptr(int64_t ptr) {
8076         LDKCOption_MaxDustHTLCExposureZ *obj = (LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(ptr);
8077         switch(obj->tag) {
8078                 case LDKCOption_MaxDustHTLCExposureZ_Some: return 0;
8079                 case LDKCOption_MaxDustHTLCExposureZ_None: return 1;
8080                 default: abort();
8081         }
8082 }
8083 int64_t CS_LDK_LDKCOption_MaxDustHTLCExposureZ_Some_get_some(int64_t ptr) {
8084         LDKCOption_MaxDustHTLCExposureZ *obj = (LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(ptr);
8085         CHECK(obj->tag == LDKCOption_MaxDustHTLCExposureZ_Some);
8086         int64_t some_ref = tag_ptr(&obj->some, false);
8087         return some_ref;
8088 }
8089 uint32_t CS_LDK_LDKCOption_APIErrorZ_ty_from_ptr(int64_t ptr) {
8090         LDKCOption_APIErrorZ *obj = (LDKCOption_APIErrorZ*)untag_ptr(ptr);
8091         switch(obj->tag) {
8092                 case LDKCOption_APIErrorZ_Some: return 0;
8093                 case LDKCOption_APIErrorZ_None: return 1;
8094                 default: abort();
8095         }
8096 }
8097 int64_t CS_LDK_LDKCOption_APIErrorZ_Some_get_some(int64_t ptr) {
8098         LDKCOption_APIErrorZ *obj = (LDKCOption_APIErrorZ*)untag_ptr(ptr);
8099         CHECK(obj->tag == LDKCOption_APIErrorZ_Some);
8100         int64_t some_ref = tag_ptr(&obj->some, false);
8101         return some_ref;
8102 }
8103 static inline struct LDKCOption_APIErrorZ CResult_COption_APIErrorZDecodeErrorZ_get_ok(LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR owner){
8104 CHECK(owner->result_ok);
8105         return COption_APIErrorZ_clone(&*owner->contents.result);
8106 }
8107 int64_t  CS_LDK_CResult_COption_APIErrorZDecodeErrorZ_get_ok(int64_t owner) {
8108         LDKCResult_COption_APIErrorZDecodeErrorZ* owner_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(owner);
8109         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
8110         *ret_copy = CResult_COption_APIErrorZDecodeErrorZ_get_ok(owner_conv);
8111         int64_t ret_ref = tag_ptr(ret_copy, true);
8112         return ret_ref;
8113 }
8114
8115 static inline struct LDKDecodeError CResult_COption_APIErrorZDecodeErrorZ_get_err(LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR owner){
8116 CHECK(!owner->result_ok);
8117         return DecodeError_clone(&*owner->contents.err);
8118 }
8119 int64_t  CS_LDK_CResult_COption_APIErrorZDecodeErrorZ_get_err(int64_t owner) {
8120         LDKCResult_COption_APIErrorZDecodeErrorZ* owner_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(owner);
8121         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8122         *ret_copy = CResult_COption_APIErrorZDecodeErrorZ_get_err(owner_conv);
8123         int64_t ret_ref = tag_ptr(ret_copy, true);
8124         return ret_ref;
8125 }
8126
8127 static inline struct LDKChannelMonitorUpdate CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
8128         LDKChannelMonitorUpdate ret = *owner->contents.result;
8129         ret.is_owned = false;
8130         return ret;
8131 }
8132 int64_t  CS_LDK_CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(int64_t owner) {
8133         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(owner);
8134         LDKChannelMonitorUpdate ret_var = CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(owner_conv);
8135         int64_t ret_ref = 0;
8136         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8137         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8138         return ret_ref;
8139 }
8140
8141 static inline struct LDKDecodeError CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
8142 CHECK(!owner->result_ok);
8143         return DecodeError_clone(&*owner->contents.err);
8144 }
8145 int64_t  CS_LDK_CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(int64_t owner) {
8146         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(owner);
8147         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8148         *ret_copy = CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(owner_conv);
8149         int64_t ret_ref = tag_ptr(ret_copy, true);
8150         return ret_ref;
8151 }
8152
8153 uint32_t CS_LDK_LDKCOption_MonitorEventZ_ty_from_ptr(int64_t ptr) {
8154         LDKCOption_MonitorEventZ *obj = (LDKCOption_MonitorEventZ*)untag_ptr(ptr);
8155         switch(obj->tag) {
8156                 case LDKCOption_MonitorEventZ_Some: return 0;
8157                 case LDKCOption_MonitorEventZ_None: return 1;
8158                 default: abort();
8159         }
8160 }
8161 int64_t CS_LDK_LDKCOption_MonitorEventZ_Some_get_some(int64_t ptr) {
8162         LDKCOption_MonitorEventZ *obj = (LDKCOption_MonitorEventZ*)untag_ptr(ptr);
8163         CHECK(obj->tag == LDKCOption_MonitorEventZ_Some);
8164         int64_t some_ref = tag_ptr(&obj->some, false);
8165         return some_ref;
8166 }
8167 static inline struct LDKCOption_MonitorEventZ CResult_COption_MonitorEventZDecodeErrorZ_get_ok(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
8168 CHECK(owner->result_ok);
8169         return COption_MonitorEventZ_clone(&*owner->contents.result);
8170 }
8171 int64_t  CS_LDK_CResult_COption_MonitorEventZDecodeErrorZ_get_ok(int64_t owner) {
8172         LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(owner);
8173         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
8174         *ret_copy = CResult_COption_MonitorEventZDecodeErrorZ_get_ok(owner_conv);
8175         int64_t ret_ref = tag_ptr(ret_copy, true);
8176         return ret_ref;
8177 }
8178
8179 static inline struct LDKDecodeError CResult_COption_MonitorEventZDecodeErrorZ_get_err(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
8180 CHECK(!owner->result_ok);
8181         return DecodeError_clone(&*owner->contents.err);
8182 }
8183 int64_t  CS_LDK_CResult_COption_MonitorEventZDecodeErrorZ_get_err(int64_t owner) {
8184         LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(owner);
8185         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8186         *ret_copy = CResult_COption_MonitorEventZDecodeErrorZ_get_err(owner_conv);
8187         int64_t ret_ref = tag_ptr(ret_copy, true);
8188         return ret_ref;
8189 }
8190
8191 static inline struct LDKHTLCUpdate CResult_HTLCUpdateDecodeErrorZ_get_ok(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
8192         LDKHTLCUpdate ret = *owner->contents.result;
8193         ret.is_owned = false;
8194         return ret;
8195 }
8196 int64_t  CS_LDK_CResult_HTLCUpdateDecodeErrorZ_get_ok(int64_t owner) {
8197         LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(owner);
8198         LDKHTLCUpdate ret_var = CResult_HTLCUpdateDecodeErrorZ_get_ok(owner_conv);
8199         int64_t ret_ref = 0;
8200         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8201         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8202         return ret_ref;
8203 }
8204
8205 static inline struct LDKDecodeError CResult_HTLCUpdateDecodeErrorZ_get_err(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
8206 CHECK(!owner->result_ok);
8207         return DecodeError_clone(&*owner->contents.err);
8208 }
8209 int64_t  CS_LDK_CResult_HTLCUpdateDecodeErrorZ_get_err(int64_t owner) {
8210         LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(owner);
8211         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8212         *ret_copy = CResult_HTLCUpdateDecodeErrorZ_get_err(owner_conv);
8213         int64_t ret_ref = tag_ptr(ret_copy, true);
8214         return ret_ref;
8215 }
8216
8217 static inline struct LDKOutPoint C2Tuple_OutPointCVec_u8ZZ_get_a(LDKC2Tuple_OutPointCVec_u8ZZ *NONNULL_PTR owner){
8218         LDKOutPoint ret = owner->a;
8219         ret.is_owned = false;
8220         return ret;
8221 }
8222 int64_t  CS_LDK_C2Tuple_OutPointCVec_u8ZZ_get_a(int64_t owner) {
8223         LDKC2Tuple_OutPointCVec_u8ZZ* owner_conv = (LDKC2Tuple_OutPointCVec_u8ZZ*)untag_ptr(owner);
8224         LDKOutPoint ret_var = C2Tuple_OutPointCVec_u8ZZ_get_a(owner_conv);
8225         int64_t ret_ref = 0;
8226         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8227         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8228         return ret_ref;
8229 }
8230
8231 static inline struct LDKCVec_u8Z C2Tuple_OutPointCVec_u8ZZ_get_b(LDKC2Tuple_OutPointCVec_u8ZZ *NONNULL_PTR owner){
8232         return CVec_u8Z_clone(&owner->b);
8233 }
8234 int8_tArray  CS_LDK_C2Tuple_OutPointCVec_u8ZZ_get_b(int64_t owner) {
8235         LDKC2Tuple_OutPointCVec_u8ZZ* owner_conv = (LDKC2Tuple_OutPointCVec_u8ZZ*)untag_ptr(owner);
8236         LDKCVec_u8Z ret_var = C2Tuple_OutPointCVec_u8ZZ_get_b(owner_conv);
8237         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
8238         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
8239         CVec_u8Z_free(ret_var);
8240         return ret_arr;
8241 }
8242
8243 static inline uint32_t C2Tuple_u32CVec_u8ZZ_get_a(LDKC2Tuple_u32CVec_u8ZZ *NONNULL_PTR owner){
8244         return owner->a;
8245 }
8246 int32_t  CS_LDK_C2Tuple_u32CVec_u8ZZ_get_a(int64_t owner) {
8247         LDKC2Tuple_u32CVec_u8ZZ* owner_conv = (LDKC2Tuple_u32CVec_u8ZZ*)untag_ptr(owner);
8248         int32_t ret_conv = C2Tuple_u32CVec_u8ZZ_get_a(owner_conv);
8249         return ret_conv;
8250 }
8251
8252 static inline struct LDKCVec_u8Z C2Tuple_u32CVec_u8ZZ_get_b(LDKC2Tuple_u32CVec_u8ZZ *NONNULL_PTR owner){
8253         return CVec_u8Z_clone(&owner->b);
8254 }
8255 int8_tArray  CS_LDK_C2Tuple_u32CVec_u8ZZ_get_b(int64_t owner) {
8256         LDKC2Tuple_u32CVec_u8ZZ* owner_conv = (LDKC2Tuple_u32CVec_u8ZZ*)untag_ptr(owner);
8257         LDKCVec_u8Z ret_var = C2Tuple_u32CVec_u8ZZ_get_b(owner_conv);
8258         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
8259         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
8260         CVec_u8Z_free(ret_var);
8261         return ret_arr;
8262 }
8263
8264 static inline LDKCVec_C2Tuple_u32CVec_u8ZZZ CVec_C2Tuple_u32CVec_u8ZZZ_clone(const LDKCVec_C2Tuple_u32CVec_u8ZZZ *orig) {
8265         LDKCVec_C2Tuple_u32CVec_u8ZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32CVec_u8ZZ) * orig->datalen, "LDKCVec_C2Tuple_u32CVec_u8ZZZ clone bytes"), .datalen = orig->datalen };
8266         for (size_t i = 0; i < ret.datalen; i++) {
8267                 ret.data[i] = C2Tuple_u32CVec_u8ZZ_clone(&orig->data[i]);
8268         }
8269         return ret;
8270 }
8271 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_a(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ *NONNULL_PTR owner){
8272         return ThirtyTwoBytes_clone(&owner->a);
8273 }
8274 int8_tArray  CS_LDK_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_a(int64_t owner) {
8275         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)untag_ptr(owner);
8276         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
8277         memcpy(ret_arr->elems, C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_a(owner_conv).data, 32);
8278         return ret_arr;
8279 }
8280
8281 static inline struct LDKCVec_C2Tuple_u32CVec_u8ZZZ C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_b(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ *NONNULL_PTR owner){
8282         return CVec_C2Tuple_u32CVec_u8ZZZ_clone(&owner->b);
8283 }
8284 int64_tArray  CS_LDK_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_b(int64_t owner) {
8285         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)untag_ptr(owner);
8286         LDKCVec_C2Tuple_u32CVec_u8ZZZ ret_var = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_b(owner_conv);
8287         int64_tArray ret_arr = NULL;
8288         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
8289         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
8290         for (size_t x = 0; x < ret_var.datalen; x++) {
8291                 LDKC2Tuple_u32CVec_u8ZZ* ret_conv_23_conv = MALLOC(sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKC2Tuple_u32CVec_u8ZZ");
8292                 *ret_conv_23_conv = ret_var.data[x];
8293                 ret_arr_ptr[x] = tag_ptr(ret_conv_23_conv, true);
8294         }
8295         
8296         FREE(ret_var.data);
8297         return ret_arr;
8298 }
8299
8300 static inline LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ_clone(const LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ *orig) {
8301         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 };
8302         for (size_t i = 0; i < ret.datalen; i++) {
8303                 ret.data[i] = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone(&orig->data[i]);
8304         }
8305         return ret;
8306 }
8307 static inline LDKCVec_CommitmentTransactionZ CVec_CommitmentTransactionZ_clone(const LDKCVec_CommitmentTransactionZ *orig) {
8308         LDKCVec_CommitmentTransactionZ ret = { .data = MALLOC(sizeof(LDKCommitmentTransaction) * orig->datalen, "LDKCVec_CommitmentTransactionZ clone bytes"), .datalen = orig->datalen };
8309         for (size_t i = 0; i < ret.datalen; i++) {
8310                 ret.data[i] = CommitmentTransaction_clone(&orig->data[i]);
8311         }
8312         return ret;
8313 }
8314 static inline uint32_t C2Tuple_u32TxOutZ_get_a(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
8315         return owner->a;
8316 }
8317 int32_t  CS_LDK_C2Tuple_u32TxOutZ_get_a(int64_t owner) {
8318         LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(owner);
8319         int32_t ret_conv = C2Tuple_u32TxOutZ_get_a(owner_conv);
8320         return ret_conv;
8321 }
8322
8323 static inline struct LDKTxOut C2Tuple_u32TxOutZ_get_b(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
8324         return TxOut_clone(&owner->b);
8325 }
8326 int64_t  CS_LDK_C2Tuple_u32TxOutZ_get_b(int64_t owner) {
8327         LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(owner);
8328         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
8329         *ret_ref = C2Tuple_u32TxOutZ_get_b(owner_conv);
8330         return tag_ptr(ret_ref, true);
8331 }
8332
8333 static inline LDKCVec_C2Tuple_u32TxOutZZ CVec_C2Tuple_u32TxOutZZ_clone(const LDKCVec_C2Tuple_u32TxOutZZ *orig) {
8334         LDKCVec_C2Tuple_u32TxOutZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * orig->datalen, "LDKCVec_C2Tuple_u32TxOutZZ clone bytes"), .datalen = orig->datalen };
8335         for (size_t i = 0; i < ret.datalen; i++) {
8336                 ret.data[i] = C2Tuple_u32TxOutZ_clone(&orig->data[i]);
8337         }
8338         return ret;
8339 }
8340 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_a(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
8341         return ThirtyTwoBytes_clone(&owner->a);
8342 }
8343 int8_tArray  CS_LDK_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_a(int64_t owner) {
8344         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(owner);
8345         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
8346         memcpy(ret_arr->elems, C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_a(owner_conv).data, 32);
8347         return ret_arr;
8348 }
8349
8350 static inline struct LDKCVec_C2Tuple_u32TxOutZZ C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_b(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
8351         return CVec_C2Tuple_u32TxOutZZ_clone(&owner->b);
8352 }
8353 int64_tArray  CS_LDK_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_b(int64_t owner) {
8354         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(owner);
8355         LDKCVec_C2Tuple_u32TxOutZZ ret_var = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_b(owner_conv);
8356         int64_tArray ret_arr = NULL;
8357         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
8358         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
8359         for (size_t u = 0; u < ret_var.datalen; u++) {
8360                 LDKC2Tuple_u32TxOutZ* ret_conv_20_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
8361                 *ret_conv_20_conv = ret_var.data[u];
8362                 ret_arr_ptr[u] = tag_ptr(ret_conv_20_conv, true);
8363         }
8364         
8365         FREE(ret_var.data);
8366         return ret_arr;
8367 }
8368
8369 static inline LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ_clone(const LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ *orig) {
8370         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 };
8371         for (size_t i = 0; i < ret.datalen; i++) {
8372                 ret.data[i] = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone(&orig->data[i]);
8373         }
8374         return ret;
8375 }
8376 uint32_t CS_LDK_LDKBalance_ty_from_ptr(int64_t ptr) {
8377         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
8378         switch(obj->tag) {
8379                 case LDKBalance_ClaimableOnChannelClose: return 0;
8380                 case LDKBalance_ClaimableAwaitingConfirmations: return 1;
8381                 case LDKBalance_ContentiousClaimable: return 2;
8382                 case LDKBalance_MaybeTimeoutClaimableHTLC: return 3;
8383                 case LDKBalance_MaybePreimageClaimableHTLC: return 4;
8384                 case LDKBalance_CounterpartyRevokedOutputClaimable: return 5;
8385                 default: abort();
8386         }
8387 }
8388 int64_t CS_LDK_LDKBalance_ClaimableOnChannelClose_get_amount_satoshis(int64_t ptr) {
8389         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
8390         CHECK(obj->tag == LDKBalance_ClaimableOnChannelClose);
8391         int64_t amount_satoshis_conv = obj->claimable_on_channel_close.amount_satoshis;
8392         return amount_satoshis_conv;
8393 }
8394 int64_t CS_LDK_LDKBalance_ClaimableAwaitingConfirmations_get_amount_satoshis(int64_t ptr) {
8395         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
8396         CHECK(obj->tag == LDKBalance_ClaimableAwaitingConfirmations);
8397         int64_t amount_satoshis_conv = obj->claimable_awaiting_confirmations.amount_satoshis;
8398         return amount_satoshis_conv;
8399 }
8400 int32_t CS_LDK_LDKBalance_ClaimableAwaitingConfirmations_get_confirmation_height(int64_t ptr) {
8401         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
8402         CHECK(obj->tag == LDKBalance_ClaimableAwaitingConfirmations);
8403         int32_t confirmation_height_conv = obj->claimable_awaiting_confirmations.confirmation_height;
8404         return confirmation_height_conv;
8405 }
8406 int64_t CS_LDK_LDKBalance_ContentiousClaimable_get_amount_satoshis(int64_t ptr) {
8407         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
8408         CHECK(obj->tag == LDKBalance_ContentiousClaimable);
8409         int64_t amount_satoshis_conv = obj->contentious_claimable.amount_satoshis;
8410         return amount_satoshis_conv;
8411 }
8412 int32_t CS_LDK_LDKBalance_ContentiousClaimable_get_timeout_height(int64_t ptr) {
8413         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
8414         CHECK(obj->tag == LDKBalance_ContentiousClaimable);
8415         int32_t timeout_height_conv = obj->contentious_claimable.timeout_height;
8416         return timeout_height_conv;
8417 }
8418 int8_tArray CS_LDK_LDKBalance_ContentiousClaimable_get_payment_hash(int64_t ptr) {
8419         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
8420         CHECK(obj->tag == LDKBalance_ContentiousClaimable);
8421         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
8422         memcpy(payment_hash_arr->elems, obj->contentious_claimable.payment_hash.data, 32);
8423         return payment_hash_arr;
8424 }
8425 int8_tArray CS_LDK_LDKBalance_ContentiousClaimable_get_payment_preimage(int64_t ptr) {
8426         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
8427         CHECK(obj->tag == LDKBalance_ContentiousClaimable);
8428         int8_tArray payment_preimage_arr = init_int8_tArray(32, __LINE__);
8429         memcpy(payment_preimage_arr->elems, obj->contentious_claimable.payment_preimage.data, 32);
8430         return payment_preimage_arr;
8431 }
8432 int64_t CS_LDK_LDKBalance_MaybeTimeoutClaimableHTLC_get_amount_satoshis(int64_t ptr) {
8433         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
8434         CHECK(obj->tag == LDKBalance_MaybeTimeoutClaimableHTLC);
8435         int64_t amount_satoshis_conv = obj->maybe_timeout_claimable_htlc.amount_satoshis;
8436         return amount_satoshis_conv;
8437 }
8438 int32_t CS_LDK_LDKBalance_MaybeTimeoutClaimableHTLC_get_claimable_height(int64_t ptr) {
8439         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
8440         CHECK(obj->tag == LDKBalance_MaybeTimeoutClaimableHTLC);
8441         int32_t claimable_height_conv = obj->maybe_timeout_claimable_htlc.claimable_height;
8442         return claimable_height_conv;
8443 }
8444 int8_tArray CS_LDK_LDKBalance_MaybeTimeoutClaimableHTLC_get_payment_hash(int64_t ptr) {
8445         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
8446         CHECK(obj->tag == LDKBalance_MaybeTimeoutClaimableHTLC);
8447         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
8448         memcpy(payment_hash_arr->elems, obj->maybe_timeout_claimable_htlc.payment_hash.data, 32);
8449         return payment_hash_arr;
8450 }
8451 int64_t CS_LDK_LDKBalance_MaybePreimageClaimableHTLC_get_amount_satoshis(int64_t ptr) {
8452         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
8453         CHECK(obj->tag == LDKBalance_MaybePreimageClaimableHTLC);
8454         int64_t amount_satoshis_conv = obj->maybe_preimage_claimable_htlc.amount_satoshis;
8455         return amount_satoshis_conv;
8456 }
8457 int32_t CS_LDK_LDKBalance_MaybePreimageClaimableHTLC_get_expiry_height(int64_t ptr) {
8458         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
8459         CHECK(obj->tag == LDKBalance_MaybePreimageClaimableHTLC);
8460         int32_t expiry_height_conv = obj->maybe_preimage_claimable_htlc.expiry_height;
8461         return expiry_height_conv;
8462 }
8463 int8_tArray CS_LDK_LDKBalance_MaybePreimageClaimableHTLC_get_payment_hash(int64_t ptr) {
8464         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
8465         CHECK(obj->tag == LDKBalance_MaybePreimageClaimableHTLC);
8466         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
8467         memcpy(payment_hash_arr->elems, obj->maybe_preimage_claimable_htlc.payment_hash.data, 32);
8468         return payment_hash_arr;
8469 }
8470 int64_t CS_LDK_LDKBalance_CounterpartyRevokedOutputClaimable_get_amount_satoshis(int64_t ptr) {
8471         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
8472         CHECK(obj->tag == LDKBalance_CounterpartyRevokedOutputClaimable);
8473         int64_t amount_satoshis_conv = obj->counterparty_revoked_output_claimable.amount_satoshis;
8474         return amount_satoshis_conv;
8475 }
8476 static inline LDKCVec_BalanceZ CVec_BalanceZ_clone(const LDKCVec_BalanceZ *orig) {
8477         LDKCVec_BalanceZ ret = { .data = MALLOC(sizeof(LDKBalance) * orig->datalen, "LDKCVec_BalanceZ clone bytes"), .datalen = orig->datalen };
8478         for (size_t i = 0; i < ret.datalen; i++) {
8479                 ret.data[i] = Balance_clone(&orig->data[i]);
8480         }
8481         return ret;
8482 }
8483 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_a(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ *NONNULL_PTR owner){
8484         return ThirtyTwoBytes_clone(&owner->a);
8485 }
8486 int8_tArray  CS_LDK_C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_a(int64_t owner) {
8487         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(owner);
8488         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
8489         memcpy(ret_arr->elems, C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_a(owner_conv).data, 32);
8490         return ret_arr;
8491 }
8492
8493 static inline struct LDKChannelMonitor C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_b(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ *NONNULL_PTR owner){
8494         LDKChannelMonitor ret = owner->b;
8495         ret.is_owned = false;
8496         return ret;
8497 }
8498 int64_t  CS_LDK_C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_b(int64_t owner) {
8499         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(owner);
8500         LDKChannelMonitor ret_var = C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_b(owner_conv);
8501         int64_t ret_ref = 0;
8502         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8503         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8504         return ret_ref;
8505 }
8506
8507 static inline struct LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
8508 CHECK(owner->result_ok);
8509         return C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(&*owner->contents.result);
8510 }
8511 int64_t  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_ok(int64_t owner) {
8512         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)untag_ptr(owner);
8513         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
8514         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_ok(owner_conv);
8515         return tag_ptr(ret_conv, true);
8516 }
8517
8518 static inline struct LDKDecodeError CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_err(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
8519 CHECK(!owner->result_ok);
8520         return DecodeError_clone(&*owner->contents.err);
8521 }
8522 int64_t  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_err(int64_t owner) {
8523         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)untag_ptr(owner);
8524         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8525         *ret_copy = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_err(owner_conv);
8526         int64_t ret_ref = tag_ptr(ret_copy, true);
8527         return ret_ref;
8528 }
8529
8530 typedef struct LDKType_JCalls {
8531         atomic_size_t refcnt;
8532         uint32_t instance_ptr;
8533 } LDKType_JCalls;
8534 static void LDKType_JCalls_free(void* this_arg) {
8535         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
8536         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8537                 FREE(j_calls);
8538         }
8539 }
8540 uint16_t type_id_LDKType_jcall(const void* this_arg) {
8541         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
8542         return js_invoke_function_s_(j_calls->instance_ptr, 50);
8543 }
8544 LDKStr debug_str_LDKType_jcall(const void* this_arg) {
8545         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
8546         jstring ret = (jstring)js_invoke_function_l_(j_calls->instance_ptr, 51);
8547         LDKStr ret_conv = str_ref_to_owned_c(ret);
8548         return ret_conv;
8549 }
8550 LDKCVec_u8Z write_LDKType_jcall(const void* this_arg) {
8551         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
8552         int8_tArray ret = (int8_tArray)js_invoke_function_l_(j_calls->instance_ptr, 52);
8553         LDKCVec_u8Z ret_ref;
8554         ret_ref.datalen = ret->arr_len;
8555         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
8556         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
8557         return ret_ref;
8558 }
8559 static void LDKType_JCalls_cloned(LDKType* new_obj) {
8560         LDKType_JCalls *j_calls = (LDKType_JCalls*) new_obj->this_arg;
8561         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8562 }
8563 static inline LDKType LDKType_init (int64_t o) {
8564         LDKType_JCalls *calls = MALLOC(sizeof(LDKType_JCalls), "LDKType_JCalls");
8565         atomic_init(&calls->refcnt, 1);
8566         calls->instance_ptr = o;
8567
8568         LDKType ret = {
8569                 .this_arg = (void*) calls,
8570                 .type_id = type_id_LDKType_jcall,
8571                 .debug_str = debug_str_LDKType_jcall,
8572                 .write = write_LDKType_jcall,
8573                 .cloned = LDKType_JCalls_cloned,
8574                 .free = LDKType_JCalls_free,
8575         };
8576         return ret;
8577 }
8578 uint64_t  CS_LDK_LDKType_new(int32_t o) {
8579         LDKType *res_ptr = MALLOC(sizeof(LDKType), "LDKType");
8580         *res_ptr = LDKType_init(o);
8581         return tag_ptr(res_ptr, true);
8582 }
8583 int16_t  CS_LDK_Type_type_id(int64_t this_arg) {
8584         void* this_arg_ptr = untag_ptr(this_arg);
8585         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8586         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
8587         int16_t ret_conv = (this_arg_conv->type_id)(this_arg_conv->this_arg);
8588         return ret_conv;
8589 }
8590
8591 jstring  CS_LDK_Type_debug_str(int64_t this_arg) {
8592         void* this_arg_ptr = untag_ptr(this_arg);
8593         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8594         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
8595         LDKStr ret_str = (this_arg_conv->debug_str)(this_arg_conv->this_arg);
8596         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
8597         Str_free(ret_str);
8598         return ret_conv;
8599 }
8600
8601 int8_tArray  CS_LDK_Type_write(int64_t this_arg) {
8602         void* this_arg_ptr = untag_ptr(this_arg);
8603         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8604         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
8605         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
8606         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
8607         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
8608         CVec_u8Z_free(ret_var);
8609         return ret_arr;
8610 }
8611
8612 static inline struct LDKPublicKey C2Tuple_PublicKeyTypeZ_get_a(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
8613         return owner->a;
8614 }
8615 int8_tArray  CS_LDK_C2Tuple_PublicKeyTypeZ_get_a(int64_t owner) {
8616         LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(owner);
8617         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
8618         memcpy(ret_arr->elems, C2Tuple_PublicKeyTypeZ_get_a(owner_conv).compressed_form, 33);
8619         return ret_arr;
8620 }
8621
8622 static inline struct LDKType C2Tuple_PublicKeyTypeZ_get_b(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
8623         return Type_clone(&owner->b);
8624 }
8625 int64_t  CS_LDK_C2Tuple_PublicKeyTypeZ_get_b(int64_t owner) {
8626         LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(owner);
8627         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
8628         *ret_ret = C2Tuple_PublicKeyTypeZ_get_b(owner_conv);
8629         return tag_ptr(ret_ret, true);
8630 }
8631
8632 static inline LDKCVec_C2Tuple_PublicKeyTypeZZ CVec_C2Tuple_PublicKeyTypeZZ_clone(const LDKCVec_C2Tuple_PublicKeyTypeZZ *orig) {
8633         LDKCVec_C2Tuple_PublicKeyTypeZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyTypeZZ clone bytes"), .datalen = orig->datalen };
8634         for (size_t i = 0; i < ret.datalen; i++) {
8635                 ret.data[i] = C2Tuple_PublicKeyTypeZ_clone(&orig->data[i]);
8636         }
8637         return ret;
8638 }
8639 static inline struct LDKPublicKey C2Tuple_PublicKeyCVec_SocketAddressZZ_get_a(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ *NONNULL_PTR owner){
8640         return owner->a;
8641 }
8642 int8_tArray  CS_LDK_C2Tuple_PublicKeyCVec_SocketAddressZZ_get_a(int64_t owner) {
8643         LDKC2Tuple_PublicKeyCVec_SocketAddressZZ* owner_conv = (LDKC2Tuple_PublicKeyCVec_SocketAddressZZ*)untag_ptr(owner);
8644         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
8645         memcpy(ret_arr->elems, C2Tuple_PublicKeyCVec_SocketAddressZZ_get_a(owner_conv).compressed_form, 33);
8646         return ret_arr;
8647 }
8648
8649 static inline struct LDKCVec_SocketAddressZ C2Tuple_PublicKeyCVec_SocketAddressZZ_get_b(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ *NONNULL_PTR owner){
8650         return CVec_SocketAddressZ_clone(&owner->b);
8651 }
8652 int64_tArray  CS_LDK_C2Tuple_PublicKeyCVec_SocketAddressZZ_get_b(int64_t owner) {
8653         LDKC2Tuple_PublicKeyCVec_SocketAddressZZ* owner_conv = (LDKC2Tuple_PublicKeyCVec_SocketAddressZZ*)untag_ptr(owner);
8654         LDKCVec_SocketAddressZ ret_var = C2Tuple_PublicKeyCVec_SocketAddressZZ_get_b(owner_conv);
8655         int64_tArray ret_arr = NULL;
8656         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
8657         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
8658         for (size_t p = 0; p < ret_var.datalen; p++) {
8659                 LDKSocketAddress *ret_conv_15_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
8660                 *ret_conv_15_copy = ret_var.data[p];
8661                 int64_t ret_conv_15_ref = tag_ptr(ret_conv_15_copy, true);
8662                 ret_arr_ptr[p] = ret_conv_15_ref;
8663         }
8664         
8665         FREE(ret_var.data);
8666         return ret_arr;
8667 }
8668
8669 static inline LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ CVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ_clone(const LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ *orig) {
8670         LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ clone bytes"), .datalen = orig->datalen };
8671         for (size_t i = 0; i < ret.datalen; i++) {
8672                 ret.data[i] = C2Tuple_PublicKeyCVec_SocketAddressZZ_clone(&orig->data[i]);
8673         }
8674         return ret;
8675 }
8676 typedef struct LDKOnionMessageContents_JCalls {
8677         atomic_size_t refcnt;
8678         uint32_t instance_ptr;
8679 } LDKOnionMessageContents_JCalls;
8680 static void LDKOnionMessageContents_JCalls_free(void* this_arg) {
8681         LDKOnionMessageContents_JCalls *j_calls = (LDKOnionMessageContents_JCalls*) this_arg;
8682         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8683                 FREE(j_calls);
8684         }
8685 }
8686 uint64_t tlv_type_LDKOnionMessageContents_jcall(const void* this_arg) {
8687         LDKOnionMessageContents_JCalls *j_calls = (LDKOnionMessageContents_JCalls*) this_arg;
8688         return js_invoke_function_l_(j_calls->instance_ptr, 53);
8689 }
8690 LDKCVec_u8Z write_LDKOnionMessageContents_jcall(const void* this_arg) {
8691         LDKOnionMessageContents_JCalls *j_calls = (LDKOnionMessageContents_JCalls*) this_arg;
8692         int8_tArray ret = (int8_tArray)js_invoke_function_l_(j_calls->instance_ptr, 54);
8693         LDKCVec_u8Z ret_ref;
8694         ret_ref.datalen = ret->arr_len;
8695         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
8696         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
8697         return ret_ref;
8698 }
8699 LDKStr debug_str_LDKOnionMessageContents_jcall(const void* this_arg) {
8700         LDKOnionMessageContents_JCalls *j_calls = (LDKOnionMessageContents_JCalls*) this_arg;
8701         jstring ret = (jstring)js_invoke_function_l_(j_calls->instance_ptr, 55);
8702         LDKStr ret_conv = str_ref_to_owned_c(ret);
8703         return ret_conv;
8704 }
8705 static void LDKOnionMessageContents_JCalls_cloned(LDKOnionMessageContents* new_obj) {
8706         LDKOnionMessageContents_JCalls *j_calls = (LDKOnionMessageContents_JCalls*) new_obj->this_arg;
8707         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8708 }
8709 static inline LDKOnionMessageContents LDKOnionMessageContents_init (int64_t o) {
8710         LDKOnionMessageContents_JCalls *calls = MALLOC(sizeof(LDKOnionMessageContents_JCalls), "LDKOnionMessageContents_JCalls");
8711         atomic_init(&calls->refcnt, 1);
8712         calls->instance_ptr = o;
8713
8714         LDKOnionMessageContents ret = {
8715                 .this_arg = (void*) calls,
8716                 .tlv_type = tlv_type_LDKOnionMessageContents_jcall,
8717                 .write = write_LDKOnionMessageContents_jcall,
8718                 .debug_str = debug_str_LDKOnionMessageContents_jcall,
8719                 .cloned = LDKOnionMessageContents_JCalls_cloned,
8720                 .free = LDKOnionMessageContents_JCalls_free,
8721         };
8722         return ret;
8723 }
8724 uint64_t  CS_LDK_LDKOnionMessageContents_new(int32_t o) {
8725         LDKOnionMessageContents *res_ptr = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
8726         *res_ptr = LDKOnionMessageContents_init(o);
8727         return tag_ptr(res_ptr, true);
8728 }
8729 int64_t  CS_LDK_OnionMessageContents_tlv_type(int64_t this_arg) {
8730         void* this_arg_ptr = untag_ptr(this_arg);
8731         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8732         LDKOnionMessageContents* this_arg_conv = (LDKOnionMessageContents*)this_arg_ptr;
8733         int64_t ret_conv = (this_arg_conv->tlv_type)(this_arg_conv->this_arg);
8734         return ret_conv;
8735 }
8736
8737 int8_tArray  CS_LDK_OnionMessageContents_write(int64_t this_arg) {
8738         void* this_arg_ptr = untag_ptr(this_arg);
8739         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8740         LDKOnionMessageContents* this_arg_conv = (LDKOnionMessageContents*)this_arg_ptr;
8741         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
8742         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
8743         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
8744         CVec_u8Z_free(ret_var);
8745         return ret_arr;
8746 }
8747
8748 jstring  CS_LDK_OnionMessageContents_debug_str(int64_t this_arg) {
8749         void* this_arg_ptr = untag_ptr(this_arg);
8750         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8751         LDKOnionMessageContents* this_arg_conv = (LDKOnionMessageContents*)this_arg_ptr;
8752         LDKStr ret_str = (this_arg_conv->debug_str)(this_arg_conv->this_arg);
8753         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
8754         Str_free(ret_str);
8755         return ret_conv;
8756 }
8757
8758 uint32_t CS_LDK_LDKCOption_OnionMessageContentsZ_ty_from_ptr(int64_t ptr) {
8759         LDKCOption_OnionMessageContentsZ *obj = (LDKCOption_OnionMessageContentsZ*)untag_ptr(ptr);
8760         switch(obj->tag) {
8761                 case LDKCOption_OnionMessageContentsZ_Some: return 0;
8762                 case LDKCOption_OnionMessageContentsZ_None: return 1;
8763                 default: abort();
8764         }
8765 }
8766 int64_t CS_LDK_LDKCOption_OnionMessageContentsZ_Some_get_some(int64_t ptr) {
8767         LDKCOption_OnionMessageContentsZ *obj = (LDKCOption_OnionMessageContentsZ*)untag_ptr(ptr);
8768         CHECK(obj->tag == LDKCOption_OnionMessageContentsZ_Some);
8769         LDKOnionMessageContents* some_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
8770         *some_ret = OnionMessageContents_clone(&obj->some);
8771         return tag_ptr(some_ret, true);
8772 }
8773 static inline struct LDKCOption_OnionMessageContentsZ CResult_COption_OnionMessageContentsZDecodeErrorZ_get_ok(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ *NONNULL_PTR owner){
8774 CHECK(owner->result_ok);
8775         return COption_OnionMessageContentsZ_clone(&*owner->contents.result);
8776 }
8777 int64_t  CS_LDK_CResult_COption_OnionMessageContentsZDecodeErrorZ_get_ok(int64_t owner) {
8778         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* owner_conv = (LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)untag_ptr(owner);
8779         LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ");
8780         *ret_copy = CResult_COption_OnionMessageContentsZDecodeErrorZ_get_ok(owner_conv);
8781         int64_t ret_ref = tag_ptr(ret_copy, true);
8782         return ret_ref;
8783 }
8784
8785 static inline struct LDKDecodeError CResult_COption_OnionMessageContentsZDecodeErrorZ_get_err(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ *NONNULL_PTR owner){
8786 CHECK(!owner->result_ok);
8787         return DecodeError_clone(&*owner->contents.err);
8788 }
8789 int64_t  CS_LDK_CResult_COption_OnionMessageContentsZDecodeErrorZ_get_err(int64_t owner) {
8790         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* owner_conv = (LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)untag_ptr(owner);
8791         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8792         *ret_copy = CResult_COption_OnionMessageContentsZDecodeErrorZ_get_err(owner_conv);
8793         int64_t ret_ref = tag_ptr(ret_copy, true);
8794         return ret_ref;
8795 }
8796
8797 static inline struct LDKOnionMessageContents C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_a(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ *NONNULL_PTR owner){
8798         return OnionMessageContents_clone(&owner->a);
8799 }
8800 int64_t  CS_LDK_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_a(int64_t owner) {
8801         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)untag_ptr(owner);
8802         LDKOnionMessageContents* ret_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
8803         *ret_ret = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_a(owner_conv);
8804         return tag_ptr(ret_ret, true);
8805 }
8806
8807 static inline struct LDKDestination C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_b(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ *NONNULL_PTR owner){
8808         return Destination_clone(&owner->b);
8809 }
8810 int64_t  CS_LDK_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_b(int64_t owner) {
8811         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)untag_ptr(owner);
8812         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
8813         *ret_copy = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_b(owner_conv);
8814         int64_t ret_ref = tag_ptr(ret_copy, true);
8815         return ret_ref;
8816 }
8817
8818 static inline struct LDKBlindedPath C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_c(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ *NONNULL_PTR owner){
8819         LDKBlindedPath ret = owner->c;
8820         ret.is_owned = false;
8821         return ret;
8822 }
8823 int64_t  CS_LDK_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_c(int64_t owner) {
8824         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)untag_ptr(owner);
8825         LDKBlindedPath ret_var = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_c(owner_conv);
8826         int64_t ret_ref = 0;
8827         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8828         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8829         return ret_ref;
8830 }
8831
8832 static inline LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ_clone(const LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ *orig) {
8833         LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ) * orig->datalen, "LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ clone bytes"), .datalen = orig->datalen };
8834         for (size_t i = 0; i < ret.datalen; i++) {
8835                 ret.data[i] = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone(&orig->data[i]);
8836         }
8837         return ret;
8838 }
8839 uint32_t CS_LDK_LDKCOption_TypeZ_ty_from_ptr(int64_t ptr) {
8840         LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)untag_ptr(ptr);
8841         switch(obj->tag) {
8842                 case LDKCOption_TypeZ_Some: return 0;
8843                 case LDKCOption_TypeZ_None: return 1;
8844                 default: abort();
8845         }
8846 }
8847 int64_t CS_LDK_LDKCOption_TypeZ_Some_get_some(int64_t ptr) {
8848         LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)untag_ptr(ptr);
8849         CHECK(obj->tag == LDKCOption_TypeZ_Some);
8850         LDKType* some_ret = MALLOC(sizeof(LDKType), "LDKType");
8851         *some_ret = Type_clone(&obj->some);
8852         return tag_ptr(some_ret, true);
8853 }
8854 static inline struct LDKCOption_TypeZ CResult_COption_TypeZDecodeErrorZ_get_ok(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
8855 CHECK(owner->result_ok);
8856         return COption_TypeZ_clone(&*owner->contents.result);
8857 }
8858 int64_t  CS_LDK_CResult_COption_TypeZDecodeErrorZ_get_ok(int64_t owner) {
8859         LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(owner);
8860         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
8861         *ret_copy = CResult_COption_TypeZDecodeErrorZ_get_ok(owner_conv);
8862         int64_t ret_ref = tag_ptr(ret_copy, true);
8863         return ret_ref;
8864 }
8865
8866 static inline struct LDKDecodeError CResult_COption_TypeZDecodeErrorZ_get_err(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
8867 CHECK(!owner->result_ok);
8868         return DecodeError_clone(&*owner->contents.err);
8869 }
8870 int64_t  CS_LDK_CResult_COption_TypeZDecodeErrorZ_get_err(int64_t owner) {
8871         LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(owner);
8872         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8873         *ret_copy = CResult_COption_TypeZDecodeErrorZ_get_err(owner_conv);
8874         int64_t ret_ref = tag_ptr(ret_copy, true);
8875         return ret_ref;
8876 }
8877
8878 uint32_t CS_LDK_LDKCOption_SocketAddressZ_ty_from_ptr(int64_t ptr) {
8879         LDKCOption_SocketAddressZ *obj = (LDKCOption_SocketAddressZ*)untag_ptr(ptr);
8880         switch(obj->tag) {
8881                 case LDKCOption_SocketAddressZ_Some: return 0;
8882                 case LDKCOption_SocketAddressZ_None: return 1;
8883                 default: abort();
8884         }
8885 }
8886 int64_t CS_LDK_LDKCOption_SocketAddressZ_Some_get_some(int64_t ptr) {
8887         LDKCOption_SocketAddressZ *obj = (LDKCOption_SocketAddressZ*)untag_ptr(ptr);
8888         CHECK(obj->tag == LDKCOption_SocketAddressZ_Some);
8889         int64_t some_ref = tag_ptr(&obj->some, false);
8890         return some_ref;
8891 }
8892 static inline struct LDKCVec_u8Z CResult_CVec_u8ZPeerHandleErrorZ_get_ok(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
8893 CHECK(owner->result_ok);
8894         return CVec_u8Z_clone(&*owner->contents.result);
8895 }
8896 int8_tArray  CS_LDK_CResult_CVec_u8ZPeerHandleErrorZ_get_ok(int64_t owner) {
8897         LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(owner);
8898         LDKCVec_u8Z ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_ok(owner_conv);
8899         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
8900         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
8901         CVec_u8Z_free(ret_var);
8902         return ret_arr;
8903 }
8904
8905 static inline struct LDKPeerHandleError CResult_CVec_u8ZPeerHandleErrorZ_get_err(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
8906         LDKPeerHandleError ret = *owner->contents.err;
8907         ret.is_owned = false;
8908         return ret;
8909 }
8910 int64_t  CS_LDK_CResult_CVec_u8ZPeerHandleErrorZ_get_err(int64_t owner) {
8911         LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(owner);
8912         LDKPeerHandleError ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_err(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 void CResult_NonePeerHandleErrorZ_get_ok(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
8920 CHECK(owner->result_ok);
8921         return *owner->contents.result;
8922 }
8923 void  CS_LDK_CResult_NonePeerHandleErrorZ_get_ok(int64_t owner) {
8924         LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(owner);
8925         CResult_NonePeerHandleErrorZ_get_ok(owner_conv);
8926 }
8927
8928 static inline struct LDKPeerHandleError CResult_NonePeerHandleErrorZ_get_err(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
8929         LDKPeerHandleError ret = *owner->contents.err;
8930         ret.is_owned = false;
8931         return ret;
8932 }
8933 int64_t  CS_LDK_CResult_NonePeerHandleErrorZ_get_err(int64_t owner) {
8934         LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(owner);
8935         LDKPeerHandleError ret_var = CResult_NonePeerHandleErrorZ_get_err(owner_conv);
8936         int64_t ret_ref = 0;
8937         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8938         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8939         return ret_ref;
8940 }
8941
8942 static inline bool CResult_boolPeerHandleErrorZ_get_ok(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
8943 CHECK(owner->result_ok);
8944         return *owner->contents.result;
8945 }
8946 jboolean  CS_LDK_CResult_boolPeerHandleErrorZ_get_ok(int64_t owner) {
8947         LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(owner);
8948         jboolean ret_conv = CResult_boolPeerHandleErrorZ_get_ok(owner_conv);
8949         return ret_conv;
8950 }
8951
8952 static inline struct LDKPeerHandleError CResult_boolPeerHandleErrorZ_get_err(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
8953         LDKPeerHandleError ret = *owner->contents.err;
8954         ret.is_owned = false;
8955         return ret;
8956 }
8957 int64_t  CS_LDK_CResult_boolPeerHandleErrorZ_get_err(int64_t owner) {
8958         LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(owner);
8959         LDKPeerHandleError ret_var = CResult_boolPeerHandleErrorZ_get_err(owner_conv);
8960         int64_t ret_ref = 0;
8961         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8962         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8963         return ret_ref;
8964 }
8965
8966 uint32_t CS_LDK_LDKGraphSyncError_ty_from_ptr(int64_t ptr) {
8967         LDKGraphSyncError *obj = (LDKGraphSyncError*)untag_ptr(ptr);
8968         switch(obj->tag) {
8969                 case LDKGraphSyncError_DecodeError: return 0;
8970                 case LDKGraphSyncError_LightningError: return 1;
8971                 default: abort();
8972         }
8973 }
8974 int64_t CS_LDK_LDKGraphSyncError_DecodeError_get_decode_error(int64_t ptr) {
8975         LDKGraphSyncError *obj = (LDKGraphSyncError*)untag_ptr(ptr);
8976         CHECK(obj->tag == LDKGraphSyncError_DecodeError);
8977         int64_t decode_error_ref = tag_ptr(&obj->decode_error, false);
8978         return decode_error_ref;
8979 }
8980 int64_t CS_LDK_LDKGraphSyncError_LightningError_get_lightning_error(int64_t ptr) {
8981         LDKGraphSyncError *obj = (LDKGraphSyncError*)untag_ptr(ptr);
8982         CHECK(obj->tag == LDKGraphSyncError_LightningError);
8983         LDKLightningError lightning_error_var = obj->lightning_error;
8984                         int64_t lightning_error_ref = 0;
8985                         CHECK_INNER_FIELD_ACCESS_OR_NULL(lightning_error_var);
8986                         lightning_error_ref = tag_ptr(lightning_error_var.inner, false);
8987         return lightning_error_ref;
8988 }
8989 static inline uint32_t CResult_u32GraphSyncErrorZ_get_ok(LDKCResult_u32GraphSyncErrorZ *NONNULL_PTR owner){
8990 CHECK(owner->result_ok);
8991         return *owner->contents.result;
8992 }
8993 int32_t  CS_LDK_CResult_u32GraphSyncErrorZ_get_ok(int64_t owner) {
8994         LDKCResult_u32GraphSyncErrorZ* owner_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(owner);
8995         int32_t ret_conv = CResult_u32GraphSyncErrorZ_get_ok(owner_conv);
8996         return ret_conv;
8997 }
8998
8999 static inline struct LDKGraphSyncError CResult_u32GraphSyncErrorZ_get_err(LDKCResult_u32GraphSyncErrorZ *NONNULL_PTR owner){
9000 CHECK(!owner->result_ok);
9001         return GraphSyncError_clone(&*owner->contents.err);
9002 }
9003 int64_t  CS_LDK_CResult_u32GraphSyncErrorZ_get_err(int64_t owner) {
9004         LDKCResult_u32GraphSyncErrorZ* owner_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(owner);
9005         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
9006         *ret_copy = CResult_u32GraphSyncErrorZ_get_err(owner_conv);
9007         int64_t ret_ref = tag_ptr(ret_copy, true);
9008         return ret_ref;
9009 }
9010
9011 static inline struct LDKCVec_u8Z CResult_CVec_u8ZIOErrorZ_get_ok(LDKCResult_CVec_u8ZIOErrorZ *NONNULL_PTR owner){
9012 CHECK(owner->result_ok);
9013         return CVec_u8Z_clone(&*owner->contents.result);
9014 }
9015 int8_tArray  CS_LDK_CResult_CVec_u8ZIOErrorZ_get_ok(int64_t owner) {
9016         LDKCResult_CVec_u8ZIOErrorZ* owner_conv = (LDKCResult_CVec_u8ZIOErrorZ*)untag_ptr(owner);
9017         LDKCVec_u8Z ret_var = CResult_CVec_u8ZIOErrorZ_get_ok(owner_conv);
9018         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
9019         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
9020         CVec_u8Z_free(ret_var);
9021         return ret_arr;
9022 }
9023
9024 static inline enum LDKIOError CResult_CVec_u8ZIOErrorZ_get_err(LDKCResult_CVec_u8ZIOErrorZ *NONNULL_PTR owner){
9025 CHECK(!owner->result_ok);
9026         return *owner->contents.err;
9027 }
9028 int32_t  CS_LDK_CResult_CVec_u8ZIOErrorZ_get_err(int64_t owner) {
9029         LDKCResult_CVec_u8ZIOErrorZ* owner_conv = (LDKCResult_CVec_u8ZIOErrorZ*)untag_ptr(owner);
9030         int32_t ret_conv = LDKIOError_to_cs(CResult_CVec_u8ZIOErrorZ_get_err(owner_conv));
9031         return ret_conv;
9032 }
9033
9034 static inline struct LDKCVec_StrZ CResult_CVec_StrZIOErrorZ_get_ok(LDKCResult_CVec_StrZIOErrorZ *NONNULL_PTR owner){
9035 CHECK(owner->result_ok);
9036         return *owner->contents.result;
9037 }
9038 ptrArray  CS_LDK_CResult_CVec_StrZIOErrorZ_get_ok(int64_t owner) {
9039         LDKCResult_CVec_StrZIOErrorZ* owner_conv = (LDKCResult_CVec_StrZIOErrorZ*)untag_ptr(owner);
9040         LDKCVec_StrZ ret_var = CResult_CVec_StrZIOErrorZ_get_ok(owner_conv);
9041         ptrArray ret_arr = NULL;
9042         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
9043         jstring *ret_arr_ptr = (jstring*)(((uint8_t*)ret_arr) + 8);
9044         for (size_t i = 0; i < ret_var.datalen; i++) {
9045                 LDKStr ret_conv_8_str = ret_var.data[i];
9046                 jstring ret_conv_8_conv = str_ref_to_cs(ret_conv_8_str.chars, ret_conv_8_str.len);
9047                 ret_arr_ptr[i] = ret_conv_8_conv;
9048         }
9049         
9050         return ret_arr;
9051 }
9052
9053 static inline enum LDKIOError CResult_CVec_StrZIOErrorZ_get_err(LDKCResult_CVec_StrZIOErrorZ *NONNULL_PTR owner){
9054 CHECK(!owner->result_ok);
9055         return *owner->contents.err;
9056 }
9057 int32_t  CS_LDK_CResult_CVec_StrZIOErrorZ_get_err(int64_t owner) {
9058         LDKCResult_CVec_StrZIOErrorZ* owner_conv = (LDKCResult_CVec_StrZIOErrorZ*)untag_ptr(owner);
9059         int32_t ret_conv = LDKIOError_to_cs(CResult_CVec_StrZIOErrorZ_get_err(owner_conv));
9060         return ret_conv;
9061 }
9062
9063 static inline LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ_clone(const LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ *orig) {
9064         LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ) * orig->datalen, "LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ clone bytes"), .datalen = orig->datalen };
9065         for (size_t i = 0; i < ret.datalen; i++) {
9066                 ret.data[i] = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(&orig->data[i]);
9067         }
9068         return ret;
9069 }
9070 static inline struct LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_ok(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ *NONNULL_PTR owner){
9071 CHECK(owner->result_ok);
9072         return CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ_clone(&*owner->contents.result);
9073 }
9074 int64_tArray  CS_LDK_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_ok(int64_t owner) {
9075         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* owner_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)untag_ptr(owner);
9076         LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ ret_var = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_ok(owner_conv);
9077         int64_tArray ret_arr = NULL;
9078         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
9079         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
9080         for (size_t o = 0; o < ret_var.datalen; o++) {
9081                 LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
9082                 *ret_conv_40_conv = ret_var.data[o];
9083                 ret_arr_ptr[o] = tag_ptr(ret_conv_40_conv, true);
9084         }
9085         
9086         FREE(ret_var.data);
9087         return ret_arr;
9088 }
9089
9090 static inline enum LDKIOError CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_err(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ *NONNULL_PTR owner){
9091 CHECK(!owner->result_ok);
9092         return *owner->contents.err;
9093 }
9094 int32_t  CS_LDK_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_err(int64_t owner) {
9095         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* owner_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)untag_ptr(owner);
9096         int32_t ret_conv = LDKIOError_to_cs(CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_err(owner_conv));
9097         return ret_conv;
9098 }
9099
9100 static inline struct LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_ok(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ *NONNULL_PTR owner){
9101 CHECK(owner->result_ok);
9102         return C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(&*owner->contents.result);
9103 }
9104 int64_t  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_ok(int64_t owner) {
9105         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)untag_ptr(owner);
9106         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
9107         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_ok(owner_conv);
9108         return tag_ptr(ret_conv, true);
9109 }
9110
9111 static inline enum LDKIOError CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_err(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ *NONNULL_PTR owner){
9112 CHECK(!owner->result_ok);
9113         return *owner->contents.err;
9114 }
9115 int32_t  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_err(int64_t owner) {
9116         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)untag_ptr(owner);
9117         int32_t ret_conv = LDKIOError_to_cs(CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_err(owner_conv));
9118         return ret_conv;
9119 }
9120
9121 static inline struct LDKUnsignedInvoiceRequest CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_get_ok(LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ *NONNULL_PTR owner){
9122         LDKUnsignedInvoiceRequest ret = *owner->contents.result;
9123         ret.is_owned = false;
9124         return ret;
9125 }
9126 int64_t  CS_LDK_CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_get_ok(int64_t owner) {
9127         LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ* owner_conv = (LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ*)untag_ptr(owner);
9128         LDKUnsignedInvoiceRequest ret_var = CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_get_ok(owner_conv);
9129         int64_t ret_ref = 0;
9130         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9131         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9132         return ret_ref;
9133 }
9134
9135 static inline enum LDKBolt12SemanticError CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_get_err(LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ *NONNULL_PTR owner){
9136 CHECK(!owner->result_ok);
9137         return Bolt12SemanticError_clone(&*owner->contents.err);
9138 }
9139 int32_t  CS_LDK_CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_get_err(int64_t owner) {
9140         LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ* owner_conv = (LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ*)untag_ptr(owner);
9141         int32_t ret_conv = LDKBolt12SemanticError_to_cs(CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_get_err(owner_conv));
9142         return ret_conv;
9143 }
9144
9145 static inline struct LDKInvoiceRequest CResult_InvoiceRequestBolt12SemanticErrorZ_get_ok(LDKCResult_InvoiceRequestBolt12SemanticErrorZ *NONNULL_PTR owner){
9146         LDKInvoiceRequest ret = *owner->contents.result;
9147         ret.is_owned = false;
9148         return ret;
9149 }
9150 int64_t  CS_LDK_CResult_InvoiceRequestBolt12SemanticErrorZ_get_ok(int64_t owner) {
9151         LDKCResult_InvoiceRequestBolt12SemanticErrorZ* owner_conv = (LDKCResult_InvoiceRequestBolt12SemanticErrorZ*)untag_ptr(owner);
9152         LDKInvoiceRequest ret_var = CResult_InvoiceRequestBolt12SemanticErrorZ_get_ok(owner_conv);
9153         int64_t ret_ref = 0;
9154         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9155         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9156         return ret_ref;
9157 }
9158
9159 static inline enum LDKBolt12SemanticError CResult_InvoiceRequestBolt12SemanticErrorZ_get_err(LDKCResult_InvoiceRequestBolt12SemanticErrorZ *NONNULL_PTR owner){
9160 CHECK(!owner->result_ok);
9161         return Bolt12SemanticError_clone(&*owner->contents.err);
9162 }
9163 int32_t  CS_LDK_CResult_InvoiceRequestBolt12SemanticErrorZ_get_err(int64_t owner) {
9164         LDKCResult_InvoiceRequestBolt12SemanticErrorZ* owner_conv = (LDKCResult_InvoiceRequestBolt12SemanticErrorZ*)untag_ptr(owner);
9165         int32_t ret_conv = LDKBolt12SemanticError_to_cs(CResult_InvoiceRequestBolt12SemanticErrorZ_get_err(owner_conv));
9166         return ret_conv;
9167 }
9168
9169 uint32_t CS_LDK_LDKCOption_SecretKeyZ_ty_from_ptr(int64_t ptr) {
9170         LDKCOption_SecretKeyZ *obj = (LDKCOption_SecretKeyZ*)untag_ptr(ptr);
9171         switch(obj->tag) {
9172                 case LDKCOption_SecretKeyZ_Some: return 0;
9173                 case LDKCOption_SecretKeyZ_None: return 1;
9174                 default: abort();
9175         }
9176 }
9177 int8_tArray CS_LDK_LDKCOption_SecretKeyZ_Some_get_some(int64_t ptr) {
9178         LDKCOption_SecretKeyZ *obj = (LDKCOption_SecretKeyZ*)untag_ptr(ptr);
9179         CHECK(obj->tag == LDKCOption_SecretKeyZ_Some);
9180         int8_tArray some_arr = init_int8_tArray(32, __LINE__);
9181         memcpy(some_arr->elems, obj->some.bytes, 32);
9182         return some_arr;
9183 }
9184 static inline struct LDKInvoiceWithExplicitSigningPubkeyBuilder CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_get_ok(LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ *NONNULL_PTR owner){
9185         LDKInvoiceWithExplicitSigningPubkeyBuilder ret = *owner->contents.result;
9186         ret.is_owned = false;
9187         return ret;
9188 }
9189 int64_t  CS_LDK_CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_get_ok(int64_t owner) {
9190         LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ* owner_conv = (LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ*)untag_ptr(owner);
9191         LDKInvoiceWithExplicitSigningPubkeyBuilder ret_var = CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_get_ok(owner_conv);
9192         int64_t ret_ref = 0;
9193         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9194         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9195         return ret_ref;
9196 }
9197
9198 static inline enum LDKBolt12SemanticError CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_get_err(LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ *NONNULL_PTR owner){
9199 CHECK(!owner->result_ok);
9200         return Bolt12SemanticError_clone(&*owner->contents.err);
9201 }
9202 int32_t  CS_LDK_CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_get_err(int64_t owner) {
9203         LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ* owner_conv = (LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ*)untag_ptr(owner);
9204         int32_t ret_conv = LDKBolt12SemanticError_to_cs(CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_get_err(owner_conv));
9205         return ret_conv;
9206 }
9207
9208 static inline struct LDKVerifiedInvoiceRequest CResult_VerifiedInvoiceRequestNoneZ_get_ok(LDKCResult_VerifiedInvoiceRequestNoneZ *NONNULL_PTR owner){
9209         LDKVerifiedInvoiceRequest ret = *owner->contents.result;
9210         ret.is_owned = false;
9211         return ret;
9212 }
9213 int64_t  CS_LDK_CResult_VerifiedInvoiceRequestNoneZ_get_ok(int64_t owner) {
9214         LDKCResult_VerifiedInvoiceRequestNoneZ* owner_conv = (LDKCResult_VerifiedInvoiceRequestNoneZ*)untag_ptr(owner);
9215         LDKVerifiedInvoiceRequest ret_var = CResult_VerifiedInvoiceRequestNoneZ_get_ok(owner_conv);
9216         int64_t ret_ref = 0;
9217         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9218         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9219         return ret_ref;
9220 }
9221
9222 static inline void CResult_VerifiedInvoiceRequestNoneZ_get_err(LDKCResult_VerifiedInvoiceRequestNoneZ *NONNULL_PTR owner){
9223 CHECK(!owner->result_ok);
9224         return *owner->contents.err;
9225 }
9226 void  CS_LDK_CResult_VerifiedInvoiceRequestNoneZ_get_err(int64_t owner) {
9227         LDKCResult_VerifiedInvoiceRequestNoneZ* owner_conv = (LDKCResult_VerifiedInvoiceRequestNoneZ*)untag_ptr(owner);
9228         CResult_VerifiedInvoiceRequestNoneZ_get_err(owner_conv);
9229 }
9230
9231 static inline struct LDKInvoiceWithDerivedSigningPubkeyBuilder CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_get_ok(LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ *NONNULL_PTR owner){
9232         LDKInvoiceWithDerivedSigningPubkeyBuilder ret = *owner->contents.result;
9233         ret.is_owned = false;
9234         return ret;
9235 }
9236 int64_t  CS_LDK_CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_get_ok(int64_t owner) {
9237         LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ* owner_conv = (LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ*)untag_ptr(owner);
9238         LDKInvoiceWithDerivedSigningPubkeyBuilder ret_var = CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_get_ok(owner_conv);
9239         int64_t ret_ref = 0;
9240         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9241         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9242         return ret_ref;
9243 }
9244
9245 static inline enum LDKBolt12SemanticError CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_get_err(LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ *NONNULL_PTR owner){
9246 CHECK(!owner->result_ok);
9247         return Bolt12SemanticError_clone(&*owner->contents.err);
9248 }
9249 int32_t  CS_LDK_CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_get_err(int64_t owner) {
9250         LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ* owner_conv = (LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ*)untag_ptr(owner);
9251         int32_t ret_conv = LDKBolt12SemanticError_to_cs(CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_get_err(owner_conv));
9252         return ret_conv;
9253 }
9254
9255 static inline struct LDKInvoiceRequestFields CResult_InvoiceRequestFieldsDecodeErrorZ_get_ok(LDKCResult_InvoiceRequestFieldsDecodeErrorZ *NONNULL_PTR owner){
9256         LDKInvoiceRequestFields ret = *owner->contents.result;
9257         ret.is_owned = false;
9258         return ret;
9259 }
9260 int64_t  CS_LDK_CResult_InvoiceRequestFieldsDecodeErrorZ_get_ok(int64_t owner) {
9261         LDKCResult_InvoiceRequestFieldsDecodeErrorZ* owner_conv = (LDKCResult_InvoiceRequestFieldsDecodeErrorZ*)untag_ptr(owner);
9262         LDKInvoiceRequestFields ret_var = CResult_InvoiceRequestFieldsDecodeErrorZ_get_ok(owner_conv);
9263         int64_t ret_ref = 0;
9264         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9265         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9266         return ret_ref;
9267 }
9268
9269 static inline struct LDKDecodeError CResult_InvoiceRequestFieldsDecodeErrorZ_get_err(LDKCResult_InvoiceRequestFieldsDecodeErrorZ *NONNULL_PTR owner){
9270 CHECK(!owner->result_ok);
9271         return DecodeError_clone(&*owner->contents.err);
9272 }
9273 int64_t  CS_LDK_CResult_InvoiceRequestFieldsDecodeErrorZ_get_err(int64_t owner) {
9274         LDKCResult_InvoiceRequestFieldsDecodeErrorZ* owner_conv = (LDKCResult_InvoiceRequestFieldsDecodeErrorZ*)untag_ptr(owner);
9275         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9276         *ret_copy = CResult_InvoiceRequestFieldsDecodeErrorZ_get_err(owner_conv);
9277         int64_t ret_ref = tag_ptr(ret_copy, true);
9278         return ret_ref;
9279 }
9280
9281 static inline LDKCVec_WitnessZ CVec_WitnessZ_clone(const LDKCVec_WitnessZ *orig) {
9282         LDKCVec_WitnessZ ret = { .data = MALLOC(sizeof(LDKWitness) * orig->datalen, "LDKCVec_WitnessZ clone bytes"), .datalen = orig->datalen };
9283         for (size_t i = 0; i < ret.datalen; i++) {
9284                 ret.data[i] = Witness_clone(&orig->data[i]);
9285         }
9286         return ret;
9287 }
9288 uint32_t CS_LDK_LDKCOption_ECDSASignatureZ_ty_from_ptr(int64_t ptr) {
9289         LDKCOption_ECDSASignatureZ *obj = (LDKCOption_ECDSASignatureZ*)untag_ptr(ptr);
9290         switch(obj->tag) {
9291                 case LDKCOption_ECDSASignatureZ_Some: return 0;
9292                 case LDKCOption_ECDSASignatureZ_None: return 1;
9293                 default: abort();
9294         }
9295 }
9296 int8_tArray CS_LDK_LDKCOption_ECDSASignatureZ_Some_get_some(int64_t ptr) {
9297         LDKCOption_ECDSASignatureZ *obj = (LDKCOption_ECDSASignatureZ*)untag_ptr(ptr);
9298         CHECK(obj->tag == LDKCOption_ECDSASignatureZ_Some);
9299         int8_tArray some_arr = init_int8_tArray(64, __LINE__);
9300         memcpy(some_arr->elems, obj->some.compact_form, 64);
9301         return some_arr;
9302 }
9303 uint32_t CS_LDK_LDKCOption_i64Z_ty_from_ptr(int64_t ptr) {
9304         LDKCOption_i64Z *obj = (LDKCOption_i64Z*)untag_ptr(ptr);
9305         switch(obj->tag) {
9306                 case LDKCOption_i64Z_Some: return 0;
9307                 case LDKCOption_i64Z_None: return 1;
9308                 default: abort();
9309         }
9310 }
9311 int64_t CS_LDK_LDKCOption_i64Z_Some_get_some(int64_t ptr) {
9312         LDKCOption_i64Z *obj = (LDKCOption_i64Z*)untag_ptr(ptr);
9313         CHECK(obj->tag == LDKCOption_i64Z_Some);
9314         int64_t some_conv = obj->some;
9315         return some_conv;
9316 }
9317 static inline struct LDKSocketAddress CResult_SocketAddressDecodeErrorZ_get_ok(LDKCResult_SocketAddressDecodeErrorZ *NONNULL_PTR owner){
9318 CHECK(owner->result_ok);
9319         return SocketAddress_clone(&*owner->contents.result);
9320 }
9321 int64_t  CS_LDK_CResult_SocketAddressDecodeErrorZ_get_ok(int64_t owner) {
9322         LDKCResult_SocketAddressDecodeErrorZ* owner_conv = (LDKCResult_SocketAddressDecodeErrorZ*)untag_ptr(owner);
9323         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
9324         *ret_copy = CResult_SocketAddressDecodeErrorZ_get_ok(owner_conv);
9325         int64_t ret_ref = tag_ptr(ret_copy, true);
9326         return ret_ref;
9327 }
9328
9329 static inline struct LDKDecodeError CResult_SocketAddressDecodeErrorZ_get_err(LDKCResult_SocketAddressDecodeErrorZ *NONNULL_PTR owner){
9330 CHECK(!owner->result_ok);
9331         return DecodeError_clone(&*owner->contents.err);
9332 }
9333 int64_t  CS_LDK_CResult_SocketAddressDecodeErrorZ_get_err(int64_t owner) {
9334         LDKCResult_SocketAddressDecodeErrorZ* owner_conv = (LDKCResult_SocketAddressDecodeErrorZ*)untag_ptr(owner);
9335         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9336         *ret_copy = CResult_SocketAddressDecodeErrorZ_get_err(owner_conv);
9337         int64_t ret_ref = tag_ptr(ret_copy, true);
9338         return ret_ref;
9339 }
9340
9341 static inline struct LDKSocketAddress CResult_SocketAddressSocketAddressParseErrorZ_get_ok(LDKCResult_SocketAddressSocketAddressParseErrorZ *NONNULL_PTR owner){
9342 CHECK(owner->result_ok);
9343         return SocketAddress_clone(&*owner->contents.result);
9344 }
9345 int64_t  CS_LDK_CResult_SocketAddressSocketAddressParseErrorZ_get_ok(int64_t owner) {
9346         LDKCResult_SocketAddressSocketAddressParseErrorZ* owner_conv = (LDKCResult_SocketAddressSocketAddressParseErrorZ*)untag_ptr(owner);
9347         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
9348         *ret_copy = CResult_SocketAddressSocketAddressParseErrorZ_get_ok(owner_conv);
9349         int64_t ret_ref = tag_ptr(ret_copy, true);
9350         return ret_ref;
9351 }
9352
9353 static inline enum LDKSocketAddressParseError CResult_SocketAddressSocketAddressParseErrorZ_get_err(LDKCResult_SocketAddressSocketAddressParseErrorZ *NONNULL_PTR owner){
9354 CHECK(!owner->result_ok);
9355         return SocketAddressParseError_clone(&*owner->contents.err);
9356 }
9357 int32_t  CS_LDK_CResult_SocketAddressSocketAddressParseErrorZ_get_err(int64_t owner) {
9358         LDKCResult_SocketAddressSocketAddressParseErrorZ* owner_conv = (LDKCResult_SocketAddressSocketAddressParseErrorZ*)untag_ptr(owner);
9359         int32_t ret_conv = LDKSocketAddressParseError_to_cs(CResult_SocketAddressSocketAddressParseErrorZ_get_err(owner_conv));
9360         return ret_conv;
9361 }
9362
9363 static inline LDKCVec_UpdateAddHTLCZ CVec_UpdateAddHTLCZ_clone(const LDKCVec_UpdateAddHTLCZ *orig) {
9364         LDKCVec_UpdateAddHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateAddHTLC) * orig->datalen, "LDKCVec_UpdateAddHTLCZ clone bytes"), .datalen = orig->datalen };
9365         for (size_t i = 0; i < ret.datalen; i++) {
9366                 ret.data[i] = UpdateAddHTLC_clone(&orig->data[i]);
9367         }
9368         return ret;
9369 }
9370 static inline LDKCVec_UpdateFulfillHTLCZ CVec_UpdateFulfillHTLCZ_clone(const LDKCVec_UpdateFulfillHTLCZ *orig) {
9371         LDKCVec_UpdateFulfillHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * orig->datalen, "LDKCVec_UpdateFulfillHTLCZ clone bytes"), .datalen = orig->datalen };
9372         for (size_t i = 0; i < ret.datalen; i++) {
9373                 ret.data[i] = UpdateFulfillHTLC_clone(&orig->data[i]);
9374         }
9375         return ret;
9376 }
9377 static inline LDKCVec_UpdateFailHTLCZ CVec_UpdateFailHTLCZ_clone(const LDKCVec_UpdateFailHTLCZ *orig) {
9378         LDKCVec_UpdateFailHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailHTLC) * orig->datalen, "LDKCVec_UpdateFailHTLCZ clone bytes"), .datalen = orig->datalen };
9379         for (size_t i = 0; i < ret.datalen; i++) {
9380                 ret.data[i] = UpdateFailHTLC_clone(&orig->data[i]);
9381         }
9382         return ret;
9383 }
9384 static inline LDKCVec_UpdateFailMalformedHTLCZ CVec_UpdateFailMalformedHTLCZ_clone(const LDKCVec_UpdateFailMalformedHTLCZ *orig) {
9385         LDKCVec_UpdateFailMalformedHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * orig->datalen, "LDKCVec_UpdateFailMalformedHTLCZ clone bytes"), .datalen = orig->datalen };
9386         for (size_t i = 0; i < ret.datalen; i++) {
9387                 ret.data[i] = UpdateFailMalformedHTLC_clone(&orig->data[i]);
9388         }
9389         return ret;
9390 }
9391 static inline struct LDKAcceptChannel CResult_AcceptChannelDecodeErrorZ_get_ok(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
9392         LDKAcceptChannel ret = *owner->contents.result;
9393         ret.is_owned = false;
9394         return ret;
9395 }
9396 int64_t  CS_LDK_CResult_AcceptChannelDecodeErrorZ_get_ok(int64_t owner) {
9397         LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(owner);
9398         LDKAcceptChannel ret_var = CResult_AcceptChannelDecodeErrorZ_get_ok(owner_conv);
9399         int64_t ret_ref = 0;
9400         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9401         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9402         return ret_ref;
9403 }
9404
9405 static inline struct LDKDecodeError CResult_AcceptChannelDecodeErrorZ_get_err(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
9406 CHECK(!owner->result_ok);
9407         return DecodeError_clone(&*owner->contents.err);
9408 }
9409 int64_t  CS_LDK_CResult_AcceptChannelDecodeErrorZ_get_err(int64_t owner) {
9410         LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(owner);
9411         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9412         *ret_copy = CResult_AcceptChannelDecodeErrorZ_get_err(owner_conv);
9413         int64_t ret_ref = tag_ptr(ret_copy, true);
9414         return ret_ref;
9415 }
9416
9417 static inline struct LDKAcceptChannelV2 CResult_AcceptChannelV2DecodeErrorZ_get_ok(LDKCResult_AcceptChannelV2DecodeErrorZ *NONNULL_PTR owner){
9418         LDKAcceptChannelV2 ret = *owner->contents.result;
9419         ret.is_owned = false;
9420         return ret;
9421 }
9422 int64_t  CS_LDK_CResult_AcceptChannelV2DecodeErrorZ_get_ok(int64_t owner) {
9423         LDKCResult_AcceptChannelV2DecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(owner);
9424         LDKAcceptChannelV2 ret_var = CResult_AcceptChannelV2DecodeErrorZ_get_ok(owner_conv);
9425         int64_t ret_ref = 0;
9426         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9427         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9428         return ret_ref;
9429 }
9430
9431 static inline struct LDKDecodeError CResult_AcceptChannelV2DecodeErrorZ_get_err(LDKCResult_AcceptChannelV2DecodeErrorZ *NONNULL_PTR owner){
9432 CHECK(!owner->result_ok);
9433         return DecodeError_clone(&*owner->contents.err);
9434 }
9435 int64_t  CS_LDK_CResult_AcceptChannelV2DecodeErrorZ_get_err(int64_t owner) {
9436         LDKCResult_AcceptChannelV2DecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(owner);
9437         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9438         *ret_copy = CResult_AcceptChannelV2DecodeErrorZ_get_err(owner_conv);
9439         int64_t ret_ref = tag_ptr(ret_copy, true);
9440         return ret_ref;
9441 }
9442
9443 static inline struct LDKStfu CResult_StfuDecodeErrorZ_get_ok(LDKCResult_StfuDecodeErrorZ *NONNULL_PTR owner){
9444         LDKStfu ret = *owner->contents.result;
9445         ret.is_owned = false;
9446         return ret;
9447 }
9448 int64_t  CS_LDK_CResult_StfuDecodeErrorZ_get_ok(int64_t owner) {
9449         LDKCResult_StfuDecodeErrorZ* owner_conv = (LDKCResult_StfuDecodeErrorZ*)untag_ptr(owner);
9450         LDKStfu ret_var = CResult_StfuDecodeErrorZ_get_ok(owner_conv);
9451         int64_t ret_ref = 0;
9452         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9453         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9454         return ret_ref;
9455 }
9456
9457 static inline struct LDKDecodeError CResult_StfuDecodeErrorZ_get_err(LDKCResult_StfuDecodeErrorZ *NONNULL_PTR owner){
9458 CHECK(!owner->result_ok);
9459         return DecodeError_clone(&*owner->contents.err);
9460 }
9461 int64_t  CS_LDK_CResult_StfuDecodeErrorZ_get_err(int64_t owner) {
9462         LDKCResult_StfuDecodeErrorZ* owner_conv = (LDKCResult_StfuDecodeErrorZ*)untag_ptr(owner);
9463         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9464         *ret_copy = CResult_StfuDecodeErrorZ_get_err(owner_conv);
9465         int64_t ret_ref = tag_ptr(ret_copy, true);
9466         return ret_ref;
9467 }
9468
9469 static inline struct LDKSplice CResult_SpliceDecodeErrorZ_get_ok(LDKCResult_SpliceDecodeErrorZ *NONNULL_PTR owner){
9470         LDKSplice ret = *owner->contents.result;
9471         ret.is_owned = false;
9472         return ret;
9473 }
9474 int64_t  CS_LDK_CResult_SpliceDecodeErrorZ_get_ok(int64_t owner) {
9475         LDKCResult_SpliceDecodeErrorZ* owner_conv = (LDKCResult_SpliceDecodeErrorZ*)untag_ptr(owner);
9476         LDKSplice ret_var = CResult_SpliceDecodeErrorZ_get_ok(owner_conv);
9477         int64_t ret_ref = 0;
9478         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9479         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9480         return ret_ref;
9481 }
9482
9483 static inline struct LDKDecodeError CResult_SpliceDecodeErrorZ_get_err(LDKCResult_SpliceDecodeErrorZ *NONNULL_PTR owner){
9484 CHECK(!owner->result_ok);
9485         return DecodeError_clone(&*owner->contents.err);
9486 }
9487 int64_t  CS_LDK_CResult_SpliceDecodeErrorZ_get_err(int64_t owner) {
9488         LDKCResult_SpliceDecodeErrorZ* owner_conv = (LDKCResult_SpliceDecodeErrorZ*)untag_ptr(owner);
9489         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9490         *ret_copy = CResult_SpliceDecodeErrorZ_get_err(owner_conv);
9491         int64_t ret_ref = tag_ptr(ret_copy, true);
9492         return ret_ref;
9493 }
9494
9495 static inline struct LDKSpliceAck CResult_SpliceAckDecodeErrorZ_get_ok(LDKCResult_SpliceAckDecodeErrorZ *NONNULL_PTR owner){
9496         LDKSpliceAck ret = *owner->contents.result;
9497         ret.is_owned = false;
9498         return ret;
9499 }
9500 int64_t  CS_LDK_CResult_SpliceAckDecodeErrorZ_get_ok(int64_t owner) {
9501         LDKCResult_SpliceAckDecodeErrorZ* owner_conv = (LDKCResult_SpliceAckDecodeErrorZ*)untag_ptr(owner);
9502         LDKSpliceAck ret_var = CResult_SpliceAckDecodeErrorZ_get_ok(owner_conv);
9503         int64_t ret_ref = 0;
9504         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9505         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9506         return ret_ref;
9507 }
9508
9509 static inline struct LDKDecodeError CResult_SpliceAckDecodeErrorZ_get_err(LDKCResult_SpliceAckDecodeErrorZ *NONNULL_PTR owner){
9510 CHECK(!owner->result_ok);
9511         return DecodeError_clone(&*owner->contents.err);
9512 }
9513 int64_t  CS_LDK_CResult_SpliceAckDecodeErrorZ_get_err(int64_t owner) {
9514         LDKCResult_SpliceAckDecodeErrorZ* owner_conv = (LDKCResult_SpliceAckDecodeErrorZ*)untag_ptr(owner);
9515         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9516         *ret_copy = CResult_SpliceAckDecodeErrorZ_get_err(owner_conv);
9517         int64_t ret_ref = tag_ptr(ret_copy, true);
9518         return ret_ref;
9519 }
9520
9521 static inline struct LDKSpliceLocked CResult_SpliceLockedDecodeErrorZ_get_ok(LDKCResult_SpliceLockedDecodeErrorZ *NONNULL_PTR owner){
9522         LDKSpliceLocked ret = *owner->contents.result;
9523         ret.is_owned = false;
9524         return ret;
9525 }
9526 int64_t  CS_LDK_CResult_SpliceLockedDecodeErrorZ_get_ok(int64_t owner) {
9527         LDKCResult_SpliceLockedDecodeErrorZ* owner_conv = (LDKCResult_SpliceLockedDecodeErrorZ*)untag_ptr(owner);
9528         LDKSpliceLocked ret_var = CResult_SpliceLockedDecodeErrorZ_get_ok(owner_conv);
9529         int64_t ret_ref = 0;
9530         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9531         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9532         return ret_ref;
9533 }
9534
9535 static inline struct LDKDecodeError CResult_SpliceLockedDecodeErrorZ_get_err(LDKCResult_SpliceLockedDecodeErrorZ *NONNULL_PTR owner){
9536 CHECK(!owner->result_ok);
9537         return DecodeError_clone(&*owner->contents.err);
9538 }
9539 int64_t  CS_LDK_CResult_SpliceLockedDecodeErrorZ_get_err(int64_t owner) {
9540         LDKCResult_SpliceLockedDecodeErrorZ* owner_conv = (LDKCResult_SpliceLockedDecodeErrorZ*)untag_ptr(owner);
9541         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9542         *ret_copy = CResult_SpliceLockedDecodeErrorZ_get_err(owner_conv);
9543         int64_t ret_ref = tag_ptr(ret_copy, true);
9544         return ret_ref;
9545 }
9546
9547 static inline struct LDKTxAddInput CResult_TxAddInputDecodeErrorZ_get_ok(LDKCResult_TxAddInputDecodeErrorZ *NONNULL_PTR owner){
9548         LDKTxAddInput ret = *owner->contents.result;
9549         ret.is_owned = false;
9550         return ret;
9551 }
9552 int64_t  CS_LDK_CResult_TxAddInputDecodeErrorZ_get_ok(int64_t owner) {
9553         LDKCResult_TxAddInputDecodeErrorZ* owner_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(owner);
9554         LDKTxAddInput ret_var = CResult_TxAddInputDecodeErrorZ_get_ok(owner_conv);
9555         int64_t ret_ref = 0;
9556         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9557         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9558         return ret_ref;
9559 }
9560
9561 static inline struct LDKDecodeError CResult_TxAddInputDecodeErrorZ_get_err(LDKCResult_TxAddInputDecodeErrorZ *NONNULL_PTR owner){
9562 CHECK(!owner->result_ok);
9563         return DecodeError_clone(&*owner->contents.err);
9564 }
9565 int64_t  CS_LDK_CResult_TxAddInputDecodeErrorZ_get_err(int64_t owner) {
9566         LDKCResult_TxAddInputDecodeErrorZ* owner_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(owner);
9567         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9568         *ret_copy = CResult_TxAddInputDecodeErrorZ_get_err(owner_conv);
9569         int64_t ret_ref = tag_ptr(ret_copy, true);
9570         return ret_ref;
9571 }
9572
9573 static inline struct LDKTxAddOutput CResult_TxAddOutputDecodeErrorZ_get_ok(LDKCResult_TxAddOutputDecodeErrorZ *NONNULL_PTR owner){
9574         LDKTxAddOutput ret = *owner->contents.result;
9575         ret.is_owned = false;
9576         return ret;
9577 }
9578 int64_t  CS_LDK_CResult_TxAddOutputDecodeErrorZ_get_ok(int64_t owner) {
9579         LDKCResult_TxAddOutputDecodeErrorZ* owner_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(owner);
9580         LDKTxAddOutput ret_var = CResult_TxAddOutputDecodeErrorZ_get_ok(owner_conv);
9581         int64_t ret_ref = 0;
9582         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9583         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9584         return ret_ref;
9585 }
9586
9587 static inline struct LDKDecodeError CResult_TxAddOutputDecodeErrorZ_get_err(LDKCResult_TxAddOutputDecodeErrorZ *NONNULL_PTR owner){
9588 CHECK(!owner->result_ok);
9589         return DecodeError_clone(&*owner->contents.err);
9590 }
9591 int64_t  CS_LDK_CResult_TxAddOutputDecodeErrorZ_get_err(int64_t owner) {
9592         LDKCResult_TxAddOutputDecodeErrorZ* owner_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(owner);
9593         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9594         *ret_copy = CResult_TxAddOutputDecodeErrorZ_get_err(owner_conv);
9595         int64_t ret_ref = tag_ptr(ret_copy, true);
9596         return ret_ref;
9597 }
9598
9599 static inline struct LDKTxRemoveInput CResult_TxRemoveInputDecodeErrorZ_get_ok(LDKCResult_TxRemoveInputDecodeErrorZ *NONNULL_PTR owner){
9600         LDKTxRemoveInput ret = *owner->contents.result;
9601         ret.is_owned = false;
9602         return ret;
9603 }
9604 int64_t  CS_LDK_CResult_TxRemoveInputDecodeErrorZ_get_ok(int64_t owner) {
9605         LDKCResult_TxRemoveInputDecodeErrorZ* owner_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(owner);
9606         LDKTxRemoveInput ret_var = CResult_TxRemoveInputDecodeErrorZ_get_ok(owner_conv);
9607         int64_t ret_ref = 0;
9608         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9609         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9610         return ret_ref;
9611 }
9612
9613 static inline struct LDKDecodeError CResult_TxRemoveInputDecodeErrorZ_get_err(LDKCResult_TxRemoveInputDecodeErrorZ *NONNULL_PTR owner){
9614 CHECK(!owner->result_ok);
9615         return DecodeError_clone(&*owner->contents.err);
9616 }
9617 int64_t  CS_LDK_CResult_TxRemoveInputDecodeErrorZ_get_err(int64_t owner) {
9618         LDKCResult_TxRemoveInputDecodeErrorZ* owner_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(owner);
9619         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9620         *ret_copy = CResult_TxRemoveInputDecodeErrorZ_get_err(owner_conv);
9621         int64_t ret_ref = tag_ptr(ret_copy, true);
9622         return ret_ref;
9623 }
9624
9625 static inline struct LDKTxRemoveOutput CResult_TxRemoveOutputDecodeErrorZ_get_ok(LDKCResult_TxRemoveOutputDecodeErrorZ *NONNULL_PTR owner){
9626         LDKTxRemoveOutput ret = *owner->contents.result;
9627         ret.is_owned = false;
9628         return ret;
9629 }
9630 int64_t  CS_LDK_CResult_TxRemoveOutputDecodeErrorZ_get_ok(int64_t owner) {
9631         LDKCResult_TxRemoveOutputDecodeErrorZ* owner_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(owner);
9632         LDKTxRemoveOutput ret_var = CResult_TxRemoveOutputDecodeErrorZ_get_ok(owner_conv);
9633         int64_t ret_ref = 0;
9634         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9635         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9636         return ret_ref;
9637 }
9638
9639 static inline struct LDKDecodeError CResult_TxRemoveOutputDecodeErrorZ_get_err(LDKCResult_TxRemoveOutputDecodeErrorZ *NONNULL_PTR owner){
9640 CHECK(!owner->result_ok);
9641         return DecodeError_clone(&*owner->contents.err);
9642 }
9643 int64_t  CS_LDK_CResult_TxRemoveOutputDecodeErrorZ_get_err(int64_t owner) {
9644         LDKCResult_TxRemoveOutputDecodeErrorZ* owner_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(owner);
9645         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9646         *ret_copy = CResult_TxRemoveOutputDecodeErrorZ_get_err(owner_conv);
9647         int64_t ret_ref = tag_ptr(ret_copy, true);
9648         return ret_ref;
9649 }
9650
9651 static inline struct LDKTxComplete CResult_TxCompleteDecodeErrorZ_get_ok(LDKCResult_TxCompleteDecodeErrorZ *NONNULL_PTR owner){
9652         LDKTxComplete ret = *owner->contents.result;
9653         ret.is_owned = false;
9654         return ret;
9655 }
9656 int64_t  CS_LDK_CResult_TxCompleteDecodeErrorZ_get_ok(int64_t owner) {
9657         LDKCResult_TxCompleteDecodeErrorZ* owner_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(owner);
9658         LDKTxComplete ret_var = CResult_TxCompleteDecodeErrorZ_get_ok(owner_conv);
9659         int64_t ret_ref = 0;
9660         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9661         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9662         return ret_ref;
9663 }
9664
9665 static inline struct LDKDecodeError CResult_TxCompleteDecodeErrorZ_get_err(LDKCResult_TxCompleteDecodeErrorZ *NONNULL_PTR owner){
9666 CHECK(!owner->result_ok);
9667         return DecodeError_clone(&*owner->contents.err);
9668 }
9669 int64_t  CS_LDK_CResult_TxCompleteDecodeErrorZ_get_err(int64_t owner) {
9670         LDKCResult_TxCompleteDecodeErrorZ* owner_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(owner);
9671         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9672         *ret_copy = CResult_TxCompleteDecodeErrorZ_get_err(owner_conv);
9673         int64_t ret_ref = tag_ptr(ret_copy, true);
9674         return ret_ref;
9675 }
9676
9677 static inline struct LDKTxSignatures CResult_TxSignaturesDecodeErrorZ_get_ok(LDKCResult_TxSignaturesDecodeErrorZ *NONNULL_PTR owner){
9678         LDKTxSignatures ret = *owner->contents.result;
9679         ret.is_owned = false;
9680         return ret;
9681 }
9682 int64_t  CS_LDK_CResult_TxSignaturesDecodeErrorZ_get_ok(int64_t owner) {
9683         LDKCResult_TxSignaturesDecodeErrorZ* owner_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(owner);
9684         LDKTxSignatures ret_var = CResult_TxSignaturesDecodeErrorZ_get_ok(owner_conv);
9685         int64_t ret_ref = 0;
9686         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9687         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9688         return ret_ref;
9689 }
9690
9691 static inline struct LDKDecodeError CResult_TxSignaturesDecodeErrorZ_get_err(LDKCResult_TxSignaturesDecodeErrorZ *NONNULL_PTR owner){
9692 CHECK(!owner->result_ok);
9693         return DecodeError_clone(&*owner->contents.err);
9694 }
9695 int64_t  CS_LDK_CResult_TxSignaturesDecodeErrorZ_get_err(int64_t owner) {
9696         LDKCResult_TxSignaturesDecodeErrorZ* owner_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(owner);
9697         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9698         *ret_copy = CResult_TxSignaturesDecodeErrorZ_get_err(owner_conv);
9699         int64_t ret_ref = tag_ptr(ret_copy, true);
9700         return ret_ref;
9701 }
9702
9703 static inline struct LDKTxInitRbf CResult_TxInitRbfDecodeErrorZ_get_ok(LDKCResult_TxInitRbfDecodeErrorZ *NONNULL_PTR owner){
9704         LDKTxInitRbf ret = *owner->contents.result;
9705         ret.is_owned = false;
9706         return ret;
9707 }
9708 int64_t  CS_LDK_CResult_TxInitRbfDecodeErrorZ_get_ok(int64_t owner) {
9709         LDKCResult_TxInitRbfDecodeErrorZ* owner_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(owner);
9710         LDKTxInitRbf ret_var = CResult_TxInitRbfDecodeErrorZ_get_ok(owner_conv);
9711         int64_t ret_ref = 0;
9712         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9713         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9714         return ret_ref;
9715 }
9716
9717 static inline struct LDKDecodeError CResult_TxInitRbfDecodeErrorZ_get_err(LDKCResult_TxInitRbfDecodeErrorZ *NONNULL_PTR owner){
9718 CHECK(!owner->result_ok);
9719         return DecodeError_clone(&*owner->contents.err);
9720 }
9721 int64_t  CS_LDK_CResult_TxInitRbfDecodeErrorZ_get_err(int64_t owner) {
9722         LDKCResult_TxInitRbfDecodeErrorZ* owner_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(owner);
9723         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9724         *ret_copy = CResult_TxInitRbfDecodeErrorZ_get_err(owner_conv);
9725         int64_t ret_ref = tag_ptr(ret_copy, true);
9726         return ret_ref;
9727 }
9728
9729 static inline struct LDKTxAckRbf CResult_TxAckRbfDecodeErrorZ_get_ok(LDKCResult_TxAckRbfDecodeErrorZ *NONNULL_PTR owner){
9730         LDKTxAckRbf ret = *owner->contents.result;
9731         ret.is_owned = false;
9732         return ret;
9733 }
9734 int64_t  CS_LDK_CResult_TxAckRbfDecodeErrorZ_get_ok(int64_t owner) {
9735         LDKCResult_TxAckRbfDecodeErrorZ* owner_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(owner);
9736         LDKTxAckRbf ret_var = CResult_TxAckRbfDecodeErrorZ_get_ok(owner_conv);
9737         int64_t ret_ref = 0;
9738         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9739         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9740         return ret_ref;
9741 }
9742
9743 static inline struct LDKDecodeError CResult_TxAckRbfDecodeErrorZ_get_err(LDKCResult_TxAckRbfDecodeErrorZ *NONNULL_PTR owner){
9744 CHECK(!owner->result_ok);
9745         return DecodeError_clone(&*owner->contents.err);
9746 }
9747 int64_t  CS_LDK_CResult_TxAckRbfDecodeErrorZ_get_err(int64_t owner) {
9748         LDKCResult_TxAckRbfDecodeErrorZ* owner_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(owner);
9749         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9750         *ret_copy = CResult_TxAckRbfDecodeErrorZ_get_err(owner_conv);
9751         int64_t ret_ref = tag_ptr(ret_copy, true);
9752         return ret_ref;
9753 }
9754
9755 static inline struct LDKTxAbort CResult_TxAbortDecodeErrorZ_get_ok(LDKCResult_TxAbortDecodeErrorZ *NONNULL_PTR owner){
9756         LDKTxAbort ret = *owner->contents.result;
9757         ret.is_owned = false;
9758         return ret;
9759 }
9760 int64_t  CS_LDK_CResult_TxAbortDecodeErrorZ_get_ok(int64_t owner) {
9761         LDKCResult_TxAbortDecodeErrorZ* owner_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(owner);
9762         LDKTxAbort ret_var = CResult_TxAbortDecodeErrorZ_get_ok(owner_conv);
9763         int64_t ret_ref = 0;
9764         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9765         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9766         return ret_ref;
9767 }
9768
9769 static inline struct LDKDecodeError CResult_TxAbortDecodeErrorZ_get_err(LDKCResult_TxAbortDecodeErrorZ *NONNULL_PTR owner){
9770 CHECK(!owner->result_ok);
9771         return DecodeError_clone(&*owner->contents.err);
9772 }
9773 int64_t  CS_LDK_CResult_TxAbortDecodeErrorZ_get_err(int64_t owner) {
9774         LDKCResult_TxAbortDecodeErrorZ* owner_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(owner);
9775         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9776         *ret_copy = CResult_TxAbortDecodeErrorZ_get_err(owner_conv);
9777         int64_t ret_ref = tag_ptr(ret_copy, true);
9778         return ret_ref;
9779 }
9780
9781 static inline struct LDKAnnouncementSignatures CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
9782         LDKAnnouncementSignatures ret = *owner->contents.result;
9783         ret.is_owned = false;
9784         return ret;
9785 }
9786 int64_t  CS_LDK_CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(int64_t owner) {
9787         LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(owner);
9788         LDKAnnouncementSignatures ret_var = CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(owner_conv);
9789         int64_t ret_ref = 0;
9790         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9791         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9792         return ret_ref;
9793 }
9794
9795 static inline struct LDKDecodeError CResult_AnnouncementSignaturesDecodeErrorZ_get_err(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
9796 CHECK(!owner->result_ok);
9797         return DecodeError_clone(&*owner->contents.err);
9798 }
9799 int64_t  CS_LDK_CResult_AnnouncementSignaturesDecodeErrorZ_get_err(int64_t owner) {
9800         LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(owner);
9801         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9802         *ret_copy = CResult_AnnouncementSignaturesDecodeErrorZ_get_err(owner_conv);
9803         int64_t ret_ref = tag_ptr(ret_copy, true);
9804         return ret_ref;
9805 }
9806
9807 static inline struct LDKChannelReestablish CResult_ChannelReestablishDecodeErrorZ_get_ok(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
9808         LDKChannelReestablish ret = *owner->contents.result;
9809         ret.is_owned = false;
9810         return ret;
9811 }
9812 int64_t  CS_LDK_CResult_ChannelReestablishDecodeErrorZ_get_ok(int64_t owner) {
9813         LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(owner);
9814         LDKChannelReestablish ret_var = CResult_ChannelReestablishDecodeErrorZ_get_ok(owner_conv);
9815         int64_t ret_ref = 0;
9816         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9817         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9818         return ret_ref;
9819 }
9820
9821 static inline struct LDKDecodeError CResult_ChannelReestablishDecodeErrorZ_get_err(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
9822 CHECK(!owner->result_ok);
9823         return DecodeError_clone(&*owner->contents.err);
9824 }
9825 int64_t  CS_LDK_CResult_ChannelReestablishDecodeErrorZ_get_err(int64_t owner) {
9826         LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(owner);
9827         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9828         *ret_copy = CResult_ChannelReestablishDecodeErrorZ_get_err(owner_conv);
9829         int64_t ret_ref = tag_ptr(ret_copy, true);
9830         return ret_ref;
9831 }
9832
9833 static inline struct LDKClosingSigned CResult_ClosingSignedDecodeErrorZ_get_ok(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
9834         LDKClosingSigned ret = *owner->contents.result;
9835         ret.is_owned = false;
9836         return ret;
9837 }
9838 int64_t  CS_LDK_CResult_ClosingSignedDecodeErrorZ_get_ok(int64_t owner) {
9839         LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(owner);
9840         LDKClosingSigned ret_var = CResult_ClosingSignedDecodeErrorZ_get_ok(owner_conv);
9841         int64_t ret_ref = 0;
9842         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9843         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9844         return ret_ref;
9845 }
9846
9847 static inline struct LDKDecodeError CResult_ClosingSignedDecodeErrorZ_get_err(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
9848 CHECK(!owner->result_ok);
9849         return DecodeError_clone(&*owner->contents.err);
9850 }
9851 int64_t  CS_LDK_CResult_ClosingSignedDecodeErrorZ_get_err(int64_t owner) {
9852         LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(owner);
9853         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9854         *ret_copy = CResult_ClosingSignedDecodeErrorZ_get_err(owner_conv);
9855         int64_t ret_ref = tag_ptr(ret_copy, true);
9856         return ret_ref;
9857 }
9858
9859 static inline struct LDKClosingSignedFeeRange CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
9860         LDKClosingSignedFeeRange ret = *owner->contents.result;
9861         ret.is_owned = false;
9862         return ret;
9863 }
9864 int64_t  CS_LDK_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(int64_t owner) {
9865         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(owner);
9866         LDKClosingSignedFeeRange ret_var = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(owner_conv);
9867         int64_t ret_ref = 0;
9868         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9869         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9870         return ret_ref;
9871 }
9872
9873 static inline struct LDKDecodeError CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
9874 CHECK(!owner->result_ok);
9875         return DecodeError_clone(&*owner->contents.err);
9876 }
9877 int64_t  CS_LDK_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(int64_t owner) {
9878         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(owner);
9879         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9880         *ret_copy = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(owner_conv);
9881         int64_t ret_ref = tag_ptr(ret_copy, true);
9882         return ret_ref;
9883 }
9884
9885 static inline struct LDKCommitmentSigned CResult_CommitmentSignedDecodeErrorZ_get_ok(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
9886         LDKCommitmentSigned ret = *owner->contents.result;
9887         ret.is_owned = false;
9888         return ret;
9889 }
9890 int64_t  CS_LDK_CResult_CommitmentSignedDecodeErrorZ_get_ok(int64_t owner) {
9891         LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(owner);
9892         LDKCommitmentSigned ret_var = CResult_CommitmentSignedDecodeErrorZ_get_ok(owner_conv);
9893         int64_t ret_ref = 0;
9894         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9895         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9896         return ret_ref;
9897 }
9898
9899 static inline struct LDKDecodeError CResult_CommitmentSignedDecodeErrorZ_get_err(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
9900 CHECK(!owner->result_ok);
9901         return DecodeError_clone(&*owner->contents.err);
9902 }
9903 int64_t  CS_LDK_CResult_CommitmentSignedDecodeErrorZ_get_err(int64_t owner) {
9904         LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(owner);
9905         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9906         *ret_copy = CResult_CommitmentSignedDecodeErrorZ_get_err(owner_conv);
9907         int64_t ret_ref = tag_ptr(ret_copy, true);
9908         return ret_ref;
9909 }
9910
9911 static inline struct LDKFundingCreated CResult_FundingCreatedDecodeErrorZ_get_ok(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
9912         LDKFundingCreated ret = *owner->contents.result;
9913         ret.is_owned = false;
9914         return ret;
9915 }
9916 int64_t  CS_LDK_CResult_FundingCreatedDecodeErrorZ_get_ok(int64_t owner) {
9917         LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(owner);
9918         LDKFundingCreated ret_var = CResult_FundingCreatedDecodeErrorZ_get_ok(owner_conv);
9919         int64_t ret_ref = 0;
9920         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9921         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9922         return ret_ref;
9923 }
9924
9925 static inline struct LDKDecodeError CResult_FundingCreatedDecodeErrorZ_get_err(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
9926 CHECK(!owner->result_ok);
9927         return DecodeError_clone(&*owner->contents.err);
9928 }
9929 int64_t  CS_LDK_CResult_FundingCreatedDecodeErrorZ_get_err(int64_t owner) {
9930         LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(owner);
9931         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9932         *ret_copy = CResult_FundingCreatedDecodeErrorZ_get_err(owner_conv);
9933         int64_t ret_ref = tag_ptr(ret_copy, true);
9934         return ret_ref;
9935 }
9936
9937 static inline struct LDKFundingSigned CResult_FundingSignedDecodeErrorZ_get_ok(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
9938         LDKFundingSigned ret = *owner->contents.result;
9939         ret.is_owned = false;
9940         return ret;
9941 }
9942 int64_t  CS_LDK_CResult_FundingSignedDecodeErrorZ_get_ok(int64_t owner) {
9943         LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(owner);
9944         LDKFundingSigned ret_var = CResult_FundingSignedDecodeErrorZ_get_ok(owner_conv);
9945         int64_t ret_ref = 0;
9946         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9947         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9948         return ret_ref;
9949 }
9950
9951 static inline struct LDKDecodeError CResult_FundingSignedDecodeErrorZ_get_err(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
9952 CHECK(!owner->result_ok);
9953         return DecodeError_clone(&*owner->contents.err);
9954 }
9955 int64_t  CS_LDK_CResult_FundingSignedDecodeErrorZ_get_err(int64_t owner) {
9956         LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(owner);
9957         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9958         *ret_copy = CResult_FundingSignedDecodeErrorZ_get_err(owner_conv);
9959         int64_t ret_ref = tag_ptr(ret_copy, true);
9960         return ret_ref;
9961 }
9962
9963 static inline struct LDKChannelReady CResult_ChannelReadyDecodeErrorZ_get_ok(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR owner){
9964         LDKChannelReady ret = *owner->contents.result;
9965         ret.is_owned = false;
9966         return ret;
9967 }
9968 int64_t  CS_LDK_CResult_ChannelReadyDecodeErrorZ_get_ok(int64_t owner) {
9969         LDKCResult_ChannelReadyDecodeErrorZ* owner_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(owner);
9970         LDKChannelReady ret_var = CResult_ChannelReadyDecodeErrorZ_get_ok(owner_conv);
9971         int64_t ret_ref = 0;
9972         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9973         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9974         return ret_ref;
9975 }
9976
9977 static inline struct LDKDecodeError CResult_ChannelReadyDecodeErrorZ_get_err(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR owner){
9978 CHECK(!owner->result_ok);
9979         return DecodeError_clone(&*owner->contents.err);
9980 }
9981 int64_t  CS_LDK_CResult_ChannelReadyDecodeErrorZ_get_err(int64_t owner) {
9982         LDKCResult_ChannelReadyDecodeErrorZ* owner_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(owner);
9983         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9984         *ret_copy = CResult_ChannelReadyDecodeErrorZ_get_err(owner_conv);
9985         int64_t ret_ref = tag_ptr(ret_copy, true);
9986         return ret_ref;
9987 }
9988
9989 static inline struct LDKInit CResult_InitDecodeErrorZ_get_ok(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
9990         LDKInit ret = *owner->contents.result;
9991         ret.is_owned = false;
9992         return ret;
9993 }
9994 int64_t  CS_LDK_CResult_InitDecodeErrorZ_get_ok(int64_t owner) {
9995         LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(owner);
9996         LDKInit ret_var = CResult_InitDecodeErrorZ_get_ok(owner_conv);
9997         int64_t ret_ref = 0;
9998         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9999         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10000         return ret_ref;
10001 }
10002
10003 static inline struct LDKDecodeError CResult_InitDecodeErrorZ_get_err(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
10004 CHECK(!owner->result_ok);
10005         return DecodeError_clone(&*owner->contents.err);
10006 }
10007 int64_t  CS_LDK_CResult_InitDecodeErrorZ_get_err(int64_t owner) {
10008         LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(owner);
10009         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10010         *ret_copy = CResult_InitDecodeErrorZ_get_err(owner_conv);
10011         int64_t ret_ref = tag_ptr(ret_copy, true);
10012         return ret_ref;
10013 }
10014
10015 static inline struct LDKOpenChannel CResult_OpenChannelDecodeErrorZ_get_ok(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
10016         LDKOpenChannel ret = *owner->contents.result;
10017         ret.is_owned = false;
10018         return ret;
10019 }
10020 int64_t  CS_LDK_CResult_OpenChannelDecodeErrorZ_get_ok(int64_t owner) {
10021         LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(owner);
10022         LDKOpenChannel ret_var = CResult_OpenChannelDecodeErrorZ_get_ok(owner_conv);
10023         int64_t ret_ref = 0;
10024         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10025         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10026         return ret_ref;
10027 }
10028
10029 static inline struct LDKDecodeError CResult_OpenChannelDecodeErrorZ_get_err(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
10030 CHECK(!owner->result_ok);
10031         return DecodeError_clone(&*owner->contents.err);
10032 }
10033 int64_t  CS_LDK_CResult_OpenChannelDecodeErrorZ_get_err(int64_t owner) {
10034         LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(owner);
10035         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10036         *ret_copy = CResult_OpenChannelDecodeErrorZ_get_err(owner_conv);
10037         int64_t ret_ref = tag_ptr(ret_copy, true);
10038         return ret_ref;
10039 }
10040
10041 static inline struct LDKOpenChannelV2 CResult_OpenChannelV2DecodeErrorZ_get_ok(LDKCResult_OpenChannelV2DecodeErrorZ *NONNULL_PTR owner){
10042         LDKOpenChannelV2 ret = *owner->contents.result;
10043         ret.is_owned = false;
10044         return ret;
10045 }
10046 int64_t  CS_LDK_CResult_OpenChannelV2DecodeErrorZ_get_ok(int64_t owner) {
10047         LDKCResult_OpenChannelV2DecodeErrorZ* owner_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(owner);
10048         LDKOpenChannelV2 ret_var = CResult_OpenChannelV2DecodeErrorZ_get_ok(owner_conv);
10049         int64_t ret_ref = 0;
10050         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10051         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10052         return ret_ref;
10053 }
10054
10055 static inline struct LDKDecodeError CResult_OpenChannelV2DecodeErrorZ_get_err(LDKCResult_OpenChannelV2DecodeErrorZ *NONNULL_PTR owner){
10056 CHECK(!owner->result_ok);
10057         return DecodeError_clone(&*owner->contents.err);
10058 }
10059 int64_t  CS_LDK_CResult_OpenChannelV2DecodeErrorZ_get_err(int64_t owner) {
10060         LDKCResult_OpenChannelV2DecodeErrorZ* owner_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(owner);
10061         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10062         *ret_copy = CResult_OpenChannelV2DecodeErrorZ_get_err(owner_conv);
10063         int64_t ret_ref = tag_ptr(ret_copy, true);
10064         return ret_ref;
10065 }
10066
10067 static inline struct LDKRevokeAndACK CResult_RevokeAndACKDecodeErrorZ_get_ok(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
10068         LDKRevokeAndACK ret = *owner->contents.result;
10069         ret.is_owned = false;
10070         return ret;
10071 }
10072 int64_t  CS_LDK_CResult_RevokeAndACKDecodeErrorZ_get_ok(int64_t owner) {
10073         LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(owner);
10074         LDKRevokeAndACK ret_var = CResult_RevokeAndACKDecodeErrorZ_get_ok(owner_conv);
10075         int64_t ret_ref = 0;
10076         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10077         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10078         return ret_ref;
10079 }
10080
10081 static inline struct LDKDecodeError CResult_RevokeAndACKDecodeErrorZ_get_err(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
10082 CHECK(!owner->result_ok);
10083         return DecodeError_clone(&*owner->contents.err);
10084 }
10085 int64_t  CS_LDK_CResult_RevokeAndACKDecodeErrorZ_get_err(int64_t owner) {
10086         LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(owner);
10087         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10088         *ret_copy = CResult_RevokeAndACKDecodeErrorZ_get_err(owner_conv);
10089         int64_t ret_ref = tag_ptr(ret_copy, true);
10090         return ret_ref;
10091 }
10092
10093 static inline struct LDKShutdown CResult_ShutdownDecodeErrorZ_get_ok(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
10094         LDKShutdown ret = *owner->contents.result;
10095         ret.is_owned = false;
10096         return ret;
10097 }
10098 int64_t  CS_LDK_CResult_ShutdownDecodeErrorZ_get_ok(int64_t owner) {
10099         LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(owner);
10100         LDKShutdown ret_var = CResult_ShutdownDecodeErrorZ_get_ok(owner_conv);
10101         int64_t ret_ref = 0;
10102         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10103         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10104         return ret_ref;
10105 }
10106
10107 static inline struct LDKDecodeError CResult_ShutdownDecodeErrorZ_get_err(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
10108 CHECK(!owner->result_ok);
10109         return DecodeError_clone(&*owner->contents.err);
10110 }
10111 int64_t  CS_LDK_CResult_ShutdownDecodeErrorZ_get_err(int64_t owner) {
10112         LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(owner);
10113         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10114         *ret_copy = CResult_ShutdownDecodeErrorZ_get_err(owner_conv);
10115         int64_t ret_ref = tag_ptr(ret_copy, true);
10116         return ret_ref;
10117 }
10118
10119 static inline struct LDKUpdateFailHTLC CResult_UpdateFailHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
10120         LDKUpdateFailHTLC ret = *owner->contents.result;
10121         ret.is_owned = false;
10122         return ret;
10123 }
10124 int64_t  CS_LDK_CResult_UpdateFailHTLCDecodeErrorZ_get_ok(int64_t owner) {
10125         LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(owner);
10126         LDKUpdateFailHTLC ret_var = CResult_UpdateFailHTLCDecodeErrorZ_get_ok(owner_conv);
10127         int64_t ret_ref = 0;
10128         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10129         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10130         return ret_ref;
10131 }
10132
10133 static inline struct LDKDecodeError CResult_UpdateFailHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
10134 CHECK(!owner->result_ok);
10135         return DecodeError_clone(&*owner->contents.err);
10136 }
10137 int64_t  CS_LDK_CResult_UpdateFailHTLCDecodeErrorZ_get_err(int64_t owner) {
10138         LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(owner);
10139         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10140         *ret_copy = CResult_UpdateFailHTLCDecodeErrorZ_get_err(owner_conv);
10141         int64_t ret_ref = tag_ptr(ret_copy, true);
10142         return ret_ref;
10143 }
10144
10145 static inline struct LDKUpdateFailMalformedHTLC CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
10146         LDKUpdateFailMalformedHTLC ret = *owner->contents.result;
10147         ret.is_owned = false;
10148         return ret;
10149 }
10150 int64_t  CS_LDK_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(int64_t owner) {
10151         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(owner);
10152         LDKUpdateFailMalformedHTLC ret_var = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(owner_conv);
10153         int64_t ret_ref = 0;
10154         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10155         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10156         return ret_ref;
10157 }
10158
10159 static inline struct LDKDecodeError CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
10160 CHECK(!owner->result_ok);
10161         return DecodeError_clone(&*owner->contents.err);
10162 }
10163 int64_t  CS_LDK_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(int64_t owner) {
10164         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(owner);
10165         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10166         *ret_copy = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(owner_conv);
10167         int64_t ret_ref = tag_ptr(ret_copy, true);
10168         return ret_ref;
10169 }
10170
10171 static inline struct LDKUpdateFee CResult_UpdateFeeDecodeErrorZ_get_ok(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
10172         LDKUpdateFee ret = *owner->contents.result;
10173         ret.is_owned = false;
10174         return ret;
10175 }
10176 int64_t  CS_LDK_CResult_UpdateFeeDecodeErrorZ_get_ok(int64_t owner) {
10177         LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(owner);
10178         LDKUpdateFee ret_var = CResult_UpdateFeeDecodeErrorZ_get_ok(owner_conv);
10179         int64_t ret_ref = 0;
10180         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10181         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10182         return ret_ref;
10183 }
10184
10185 static inline struct LDKDecodeError CResult_UpdateFeeDecodeErrorZ_get_err(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
10186 CHECK(!owner->result_ok);
10187         return DecodeError_clone(&*owner->contents.err);
10188 }
10189 int64_t  CS_LDK_CResult_UpdateFeeDecodeErrorZ_get_err(int64_t owner) {
10190         LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(owner);
10191         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10192         *ret_copy = CResult_UpdateFeeDecodeErrorZ_get_err(owner_conv);
10193         int64_t ret_ref = tag_ptr(ret_copy, true);
10194         return ret_ref;
10195 }
10196
10197 static inline struct LDKUpdateFulfillHTLC CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
10198         LDKUpdateFulfillHTLC ret = *owner->contents.result;
10199         ret.is_owned = false;
10200         return ret;
10201 }
10202 int64_t  CS_LDK_CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(int64_t owner) {
10203         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(owner);
10204         LDKUpdateFulfillHTLC ret_var = CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(owner_conv);
10205         int64_t ret_ref = 0;
10206         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10207         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10208         return ret_ref;
10209 }
10210
10211 static inline struct LDKDecodeError CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
10212 CHECK(!owner->result_ok);
10213         return DecodeError_clone(&*owner->contents.err);
10214 }
10215 int64_t  CS_LDK_CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(int64_t owner) {
10216         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(owner);
10217         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10218         *ret_copy = CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(owner_conv);
10219         int64_t ret_ref = tag_ptr(ret_copy, true);
10220         return ret_ref;
10221 }
10222
10223 static inline struct LDKOnionPacket CResult_OnionPacketDecodeErrorZ_get_ok(LDKCResult_OnionPacketDecodeErrorZ *NONNULL_PTR owner){
10224         LDKOnionPacket ret = *owner->contents.result;
10225         ret.is_owned = false;
10226         return ret;
10227 }
10228 int64_t  CS_LDK_CResult_OnionPacketDecodeErrorZ_get_ok(int64_t owner) {
10229         LDKCResult_OnionPacketDecodeErrorZ* owner_conv = (LDKCResult_OnionPacketDecodeErrorZ*)untag_ptr(owner);
10230         LDKOnionPacket ret_var = CResult_OnionPacketDecodeErrorZ_get_ok(owner_conv);
10231         int64_t ret_ref = 0;
10232         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10233         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10234         return ret_ref;
10235 }
10236
10237 static inline struct LDKDecodeError CResult_OnionPacketDecodeErrorZ_get_err(LDKCResult_OnionPacketDecodeErrorZ *NONNULL_PTR owner){
10238 CHECK(!owner->result_ok);
10239         return DecodeError_clone(&*owner->contents.err);
10240 }
10241 int64_t  CS_LDK_CResult_OnionPacketDecodeErrorZ_get_err(int64_t owner) {
10242         LDKCResult_OnionPacketDecodeErrorZ* owner_conv = (LDKCResult_OnionPacketDecodeErrorZ*)untag_ptr(owner);
10243         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10244         *ret_copy = CResult_OnionPacketDecodeErrorZ_get_err(owner_conv);
10245         int64_t ret_ref = tag_ptr(ret_copy, true);
10246         return ret_ref;
10247 }
10248
10249 static inline struct LDKUpdateAddHTLC CResult_UpdateAddHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
10250         LDKUpdateAddHTLC ret = *owner->contents.result;
10251         ret.is_owned = false;
10252         return ret;
10253 }
10254 int64_t  CS_LDK_CResult_UpdateAddHTLCDecodeErrorZ_get_ok(int64_t owner) {
10255         LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(owner);
10256         LDKUpdateAddHTLC ret_var = CResult_UpdateAddHTLCDecodeErrorZ_get_ok(owner_conv);
10257         int64_t ret_ref = 0;
10258         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10259         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10260         return ret_ref;
10261 }
10262
10263 static inline struct LDKDecodeError CResult_UpdateAddHTLCDecodeErrorZ_get_err(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
10264 CHECK(!owner->result_ok);
10265         return DecodeError_clone(&*owner->contents.err);
10266 }
10267 int64_t  CS_LDK_CResult_UpdateAddHTLCDecodeErrorZ_get_err(int64_t owner) {
10268         LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(owner);
10269         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10270         *ret_copy = CResult_UpdateAddHTLCDecodeErrorZ_get_err(owner_conv);
10271         int64_t ret_ref = tag_ptr(ret_copy, true);
10272         return ret_ref;
10273 }
10274
10275 static inline struct LDKOnionMessage CResult_OnionMessageDecodeErrorZ_get_ok(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR owner){
10276         LDKOnionMessage ret = *owner->contents.result;
10277         ret.is_owned = false;
10278         return ret;
10279 }
10280 int64_t  CS_LDK_CResult_OnionMessageDecodeErrorZ_get_ok(int64_t owner) {
10281         LDKCResult_OnionMessageDecodeErrorZ* owner_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(owner);
10282         LDKOnionMessage ret_var = CResult_OnionMessageDecodeErrorZ_get_ok(owner_conv);
10283         int64_t ret_ref = 0;
10284         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10285         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10286         return ret_ref;
10287 }
10288
10289 static inline struct LDKDecodeError CResult_OnionMessageDecodeErrorZ_get_err(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR owner){
10290 CHECK(!owner->result_ok);
10291         return DecodeError_clone(&*owner->contents.err);
10292 }
10293 int64_t  CS_LDK_CResult_OnionMessageDecodeErrorZ_get_err(int64_t owner) {
10294         LDKCResult_OnionMessageDecodeErrorZ* owner_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(owner);
10295         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10296         *ret_copy = CResult_OnionMessageDecodeErrorZ_get_err(owner_conv);
10297         int64_t ret_ref = tag_ptr(ret_copy, true);
10298         return ret_ref;
10299 }
10300
10301 static inline struct LDKFinalOnionHopData CResult_FinalOnionHopDataDecodeErrorZ_get_ok(LDKCResult_FinalOnionHopDataDecodeErrorZ *NONNULL_PTR owner){
10302         LDKFinalOnionHopData ret = *owner->contents.result;
10303         ret.is_owned = false;
10304         return ret;
10305 }
10306 int64_t  CS_LDK_CResult_FinalOnionHopDataDecodeErrorZ_get_ok(int64_t owner) {
10307         LDKCResult_FinalOnionHopDataDecodeErrorZ* owner_conv = (LDKCResult_FinalOnionHopDataDecodeErrorZ*)untag_ptr(owner);
10308         LDKFinalOnionHopData ret_var = CResult_FinalOnionHopDataDecodeErrorZ_get_ok(owner_conv);
10309         int64_t ret_ref = 0;
10310         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10311         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10312         return ret_ref;
10313 }
10314
10315 static inline struct LDKDecodeError CResult_FinalOnionHopDataDecodeErrorZ_get_err(LDKCResult_FinalOnionHopDataDecodeErrorZ *NONNULL_PTR owner){
10316 CHECK(!owner->result_ok);
10317         return DecodeError_clone(&*owner->contents.err);
10318 }
10319 int64_t  CS_LDK_CResult_FinalOnionHopDataDecodeErrorZ_get_err(int64_t owner) {
10320         LDKCResult_FinalOnionHopDataDecodeErrorZ* owner_conv = (LDKCResult_FinalOnionHopDataDecodeErrorZ*)untag_ptr(owner);
10321         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10322         *ret_copy = CResult_FinalOnionHopDataDecodeErrorZ_get_err(owner_conv);
10323         int64_t ret_ref = tag_ptr(ret_copy, true);
10324         return ret_ref;
10325 }
10326
10327 static inline struct LDKPing CResult_PingDecodeErrorZ_get_ok(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
10328         LDKPing ret = *owner->contents.result;
10329         ret.is_owned = false;
10330         return ret;
10331 }
10332 int64_t  CS_LDK_CResult_PingDecodeErrorZ_get_ok(int64_t owner) {
10333         LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(owner);
10334         LDKPing ret_var = CResult_PingDecodeErrorZ_get_ok(owner_conv);
10335         int64_t ret_ref = 0;
10336         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10337         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10338         return ret_ref;
10339 }
10340
10341 static inline struct LDKDecodeError CResult_PingDecodeErrorZ_get_err(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
10342 CHECK(!owner->result_ok);
10343         return DecodeError_clone(&*owner->contents.err);
10344 }
10345 int64_t  CS_LDK_CResult_PingDecodeErrorZ_get_err(int64_t owner) {
10346         LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(owner);
10347         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10348         *ret_copy = CResult_PingDecodeErrorZ_get_err(owner_conv);
10349         int64_t ret_ref = tag_ptr(ret_copy, true);
10350         return ret_ref;
10351 }
10352
10353 static inline struct LDKPong CResult_PongDecodeErrorZ_get_ok(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
10354         LDKPong ret = *owner->contents.result;
10355         ret.is_owned = false;
10356         return ret;
10357 }
10358 int64_t  CS_LDK_CResult_PongDecodeErrorZ_get_ok(int64_t owner) {
10359         LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(owner);
10360         LDKPong ret_var = CResult_PongDecodeErrorZ_get_ok(owner_conv);
10361         int64_t ret_ref = 0;
10362         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10363         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10364         return ret_ref;
10365 }
10366
10367 static inline struct LDKDecodeError CResult_PongDecodeErrorZ_get_err(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
10368 CHECK(!owner->result_ok);
10369         return DecodeError_clone(&*owner->contents.err);
10370 }
10371 int64_t  CS_LDK_CResult_PongDecodeErrorZ_get_err(int64_t owner) {
10372         LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(owner);
10373         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10374         *ret_copy = CResult_PongDecodeErrorZ_get_err(owner_conv);
10375         int64_t ret_ref = tag_ptr(ret_copy, true);
10376         return ret_ref;
10377 }
10378
10379 static inline struct LDKUnsignedChannelAnnouncement CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
10380         LDKUnsignedChannelAnnouncement ret = *owner->contents.result;
10381         ret.is_owned = false;
10382         return ret;
10383 }
10384 int64_t  CS_LDK_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(int64_t owner) {
10385         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
10386         LDKUnsignedChannelAnnouncement ret_var = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
10387         int64_t ret_ref = 0;
10388         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10389         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10390         return ret_ref;
10391 }
10392
10393 static inline struct LDKDecodeError CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
10394 CHECK(!owner->result_ok);
10395         return DecodeError_clone(&*owner->contents.err);
10396 }
10397 int64_t  CS_LDK_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(int64_t owner) {
10398         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
10399         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10400         *ret_copy = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
10401         int64_t ret_ref = tag_ptr(ret_copy, true);
10402         return ret_ref;
10403 }
10404
10405 static inline struct LDKChannelAnnouncement CResult_ChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
10406         LDKChannelAnnouncement ret = *owner->contents.result;
10407         ret.is_owned = false;
10408         return ret;
10409 }
10410 int64_t  CS_LDK_CResult_ChannelAnnouncementDecodeErrorZ_get_ok(int64_t owner) {
10411         LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
10412         LDKChannelAnnouncement ret_var = CResult_ChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
10413         int64_t ret_ref = 0;
10414         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10415         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10416         return ret_ref;
10417 }
10418
10419 static inline struct LDKDecodeError CResult_ChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
10420 CHECK(!owner->result_ok);
10421         return DecodeError_clone(&*owner->contents.err);
10422 }
10423 int64_t  CS_LDK_CResult_ChannelAnnouncementDecodeErrorZ_get_err(int64_t owner) {
10424         LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
10425         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10426         *ret_copy = CResult_ChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
10427         int64_t ret_ref = tag_ptr(ret_copy, true);
10428         return ret_ref;
10429 }
10430
10431 static inline struct LDKUnsignedChannelUpdate CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
10432         LDKUnsignedChannelUpdate ret = *owner->contents.result;
10433         ret.is_owned = false;
10434         return ret;
10435 }
10436 int64_t  CS_LDK_CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(int64_t owner) {
10437         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(owner);
10438         LDKUnsignedChannelUpdate ret_var = CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(owner_conv);
10439         int64_t ret_ref = 0;
10440         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10441         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10442         return ret_ref;
10443 }
10444
10445 static inline struct LDKDecodeError CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
10446 CHECK(!owner->result_ok);
10447         return DecodeError_clone(&*owner->contents.err);
10448 }
10449 int64_t  CS_LDK_CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(int64_t owner) {
10450         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(owner);
10451         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10452         *ret_copy = CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(owner_conv);
10453         int64_t ret_ref = tag_ptr(ret_copy, true);
10454         return ret_ref;
10455 }
10456
10457 static inline struct LDKChannelUpdate CResult_ChannelUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
10458         LDKChannelUpdate ret = *owner->contents.result;
10459         ret.is_owned = false;
10460         return ret;
10461 }
10462 int64_t  CS_LDK_CResult_ChannelUpdateDecodeErrorZ_get_ok(int64_t owner) {
10463         LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(owner);
10464         LDKChannelUpdate ret_var = CResult_ChannelUpdateDecodeErrorZ_get_ok(owner_conv);
10465         int64_t ret_ref = 0;
10466         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10467         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10468         return ret_ref;
10469 }
10470
10471 static inline struct LDKDecodeError CResult_ChannelUpdateDecodeErrorZ_get_err(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
10472 CHECK(!owner->result_ok);
10473         return DecodeError_clone(&*owner->contents.err);
10474 }
10475 int64_t  CS_LDK_CResult_ChannelUpdateDecodeErrorZ_get_err(int64_t owner) {
10476         LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(owner);
10477         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10478         *ret_copy = CResult_ChannelUpdateDecodeErrorZ_get_err(owner_conv);
10479         int64_t ret_ref = tag_ptr(ret_copy, true);
10480         return ret_ref;
10481 }
10482
10483 static inline struct LDKErrorMessage CResult_ErrorMessageDecodeErrorZ_get_ok(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
10484         LDKErrorMessage ret = *owner->contents.result;
10485         ret.is_owned = false;
10486         return ret;
10487 }
10488 int64_t  CS_LDK_CResult_ErrorMessageDecodeErrorZ_get_ok(int64_t owner) {
10489         LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(owner);
10490         LDKErrorMessage ret_var = CResult_ErrorMessageDecodeErrorZ_get_ok(owner_conv);
10491         int64_t ret_ref = 0;
10492         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10493         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10494         return ret_ref;
10495 }
10496
10497 static inline struct LDKDecodeError CResult_ErrorMessageDecodeErrorZ_get_err(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
10498 CHECK(!owner->result_ok);
10499         return DecodeError_clone(&*owner->contents.err);
10500 }
10501 int64_t  CS_LDK_CResult_ErrorMessageDecodeErrorZ_get_err(int64_t owner) {
10502         LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(owner);
10503         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10504         *ret_copy = CResult_ErrorMessageDecodeErrorZ_get_err(owner_conv);
10505         int64_t ret_ref = tag_ptr(ret_copy, true);
10506         return ret_ref;
10507 }
10508
10509 static inline struct LDKWarningMessage CResult_WarningMessageDecodeErrorZ_get_ok(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
10510         LDKWarningMessage ret = *owner->contents.result;
10511         ret.is_owned = false;
10512         return ret;
10513 }
10514 int64_t  CS_LDK_CResult_WarningMessageDecodeErrorZ_get_ok(int64_t owner) {
10515         LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(owner);
10516         LDKWarningMessage ret_var = CResult_WarningMessageDecodeErrorZ_get_ok(owner_conv);
10517         int64_t ret_ref = 0;
10518         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10519         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10520         return ret_ref;
10521 }
10522
10523 static inline struct LDKDecodeError CResult_WarningMessageDecodeErrorZ_get_err(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
10524 CHECK(!owner->result_ok);
10525         return DecodeError_clone(&*owner->contents.err);
10526 }
10527 int64_t  CS_LDK_CResult_WarningMessageDecodeErrorZ_get_err(int64_t owner) {
10528         LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(owner);
10529         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10530         *ret_copy = CResult_WarningMessageDecodeErrorZ_get_err(owner_conv);
10531         int64_t ret_ref = tag_ptr(ret_copy, true);
10532         return ret_ref;
10533 }
10534
10535 static inline struct LDKUnsignedNodeAnnouncement CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
10536         LDKUnsignedNodeAnnouncement ret = *owner->contents.result;
10537         ret.is_owned = false;
10538         return ret;
10539 }
10540 int64_t  CS_LDK_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(int64_t owner) {
10541         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
10542         LDKUnsignedNodeAnnouncement ret_var = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
10543         int64_t ret_ref = 0;
10544         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10545         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10546         return ret_ref;
10547 }
10548
10549 static inline struct LDKDecodeError CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
10550 CHECK(!owner->result_ok);
10551         return DecodeError_clone(&*owner->contents.err);
10552 }
10553 int64_t  CS_LDK_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(int64_t owner) {
10554         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
10555         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10556         *ret_copy = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(owner_conv);
10557         int64_t ret_ref = tag_ptr(ret_copy, true);
10558         return ret_ref;
10559 }
10560
10561 static inline struct LDKNodeAnnouncement CResult_NodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
10562         LDKNodeAnnouncement ret = *owner->contents.result;
10563         ret.is_owned = false;
10564         return ret;
10565 }
10566 int64_t  CS_LDK_CResult_NodeAnnouncementDecodeErrorZ_get_ok(int64_t owner) {
10567         LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
10568         LDKNodeAnnouncement ret_var = CResult_NodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
10569         int64_t ret_ref = 0;
10570         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10571         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10572         return ret_ref;
10573 }
10574
10575 static inline struct LDKDecodeError CResult_NodeAnnouncementDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
10576 CHECK(!owner->result_ok);
10577         return DecodeError_clone(&*owner->contents.err);
10578 }
10579 int64_t  CS_LDK_CResult_NodeAnnouncementDecodeErrorZ_get_err(int64_t owner) {
10580         LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
10581         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10582         *ret_copy = CResult_NodeAnnouncementDecodeErrorZ_get_err(owner_conv);
10583         int64_t ret_ref = tag_ptr(ret_copy, true);
10584         return ret_ref;
10585 }
10586
10587 static inline struct LDKQueryShortChannelIds CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
10588         LDKQueryShortChannelIds ret = *owner->contents.result;
10589         ret.is_owned = false;
10590         return ret;
10591 }
10592 int64_t  CS_LDK_CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(int64_t owner) {
10593         LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(owner);
10594         LDKQueryShortChannelIds ret_var = CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(owner_conv);
10595         int64_t ret_ref = 0;
10596         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10597         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10598         return ret_ref;
10599 }
10600
10601 static inline struct LDKDecodeError CResult_QueryShortChannelIdsDecodeErrorZ_get_err(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
10602 CHECK(!owner->result_ok);
10603         return DecodeError_clone(&*owner->contents.err);
10604 }
10605 int64_t  CS_LDK_CResult_QueryShortChannelIdsDecodeErrorZ_get_err(int64_t owner) {
10606         LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(owner);
10607         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10608         *ret_copy = CResult_QueryShortChannelIdsDecodeErrorZ_get_err(owner_conv);
10609         int64_t ret_ref = tag_ptr(ret_copy, true);
10610         return ret_ref;
10611 }
10612
10613 static inline struct LDKReplyShortChannelIdsEnd CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
10614         LDKReplyShortChannelIdsEnd ret = *owner->contents.result;
10615         ret.is_owned = false;
10616         return ret;
10617 }
10618 int64_t  CS_LDK_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(int64_t owner) {
10619         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(owner);
10620         LDKReplyShortChannelIdsEnd ret_var = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(owner_conv);
10621         int64_t ret_ref = 0;
10622         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10623         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10624         return ret_ref;
10625 }
10626
10627 static inline struct LDKDecodeError CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
10628 CHECK(!owner->result_ok);
10629         return DecodeError_clone(&*owner->contents.err);
10630 }
10631 int64_t  CS_LDK_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(int64_t owner) {
10632         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(owner);
10633         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10634         *ret_copy = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(owner_conv);
10635         int64_t ret_ref = tag_ptr(ret_copy, true);
10636         return ret_ref;
10637 }
10638
10639 static inline struct LDKQueryChannelRange CResult_QueryChannelRangeDecodeErrorZ_get_ok(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
10640         LDKQueryChannelRange ret = *owner->contents.result;
10641         ret.is_owned = false;
10642         return ret;
10643 }
10644 int64_t  CS_LDK_CResult_QueryChannelRangeDecodeErrorZ_get_ok(int64_t owner) {
10645         LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(owner);
10646         LDKQueryChannelRange ret_var = CResult_QueryChannelRangeDecodeErrorZ_get_ok(owner_conv);
10647         int64_t ret_ref = 0;
10648         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10649         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10650         return ret_ref;
10651 }
10652
10653 static inline struct LDKDecodeError CResult_QueryChannelRangeDecodeErrorZ_get_err(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
10654 CHECK(!owner->result_ok);
10655         return DecodeError_clone(&*owner->contents.err);
10656 }
10657 int64_t  CS_LDK_CResult_QueryChannelRangeDecodeErrorZ_get_err(int64_t owner) {
10658         LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(owner);
10659         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10660         *ret_copy = CResult_QueryChannelRangeDecodeErrorZ_get_err(owner_conv);
10661         int64_t ret_ref = tag_ptr(ret_copy, true);
10662         return ret_ref;
10663 }
10664
10665 static inline struct LDKReplyChannelRange CResult_ReplyChannelRangeDecodeErrorZ_get_ok(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
10666         LDKReplyChannelRange ret = *owner->contents.result;
10667         ret.is_owned = false;
10668         return ret;
10669 }
10670 int64_t  CS_LDK_CResult_ReplyChannelRangeDecodeErrorZ_get_ok(int64_t owner) {
10671         LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(owner);
10672         LDKReplyChannelRange ret_var = CResult_ReplyChannelRangeDecodeErrorZ_get_ok(owner_conv);
10673         int64_t ret_ref = 0;
10674         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10675         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10676         return ret_ref;
10677 }
10678
10679 static inline struct LDKDecodeError CResult_ReplyChannelRangeDecodeErrorZ_get_err(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
10680 CHECK(!owner->result_ok);
10681         return DecodeError_clone(&*owner->contents.err);
10682 }
10683 int64_t  CS_LDK_CResult_ReplyChannelRangeDecodeErrorZ_get_err(int64_t owner) {
10684         LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(owner);
10685         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10686         *ret_copy = CResult_ReplyChannelRangeDecodeErrorZ_get_err(owner_conv);
10687         int64_t ret_ref = tag_ptr(ret_copy, true);
10688         return ret_ref;
10689 }
10690
10691 static inline struct LDKGossipTimestampFilter CResult_GossipTimestampFilterDecodeErrorZ_get_ok(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
10692         LDKGossipTimestampFilter ret = *owner->contents.result;
10693         ret.is_owned = false;
10694         return ret;
10695 }
10696 int64_t  CS_LDK_CResult_GossipTimestampFilterDecodeErrorZ_get_ok(int64_t owner) {
10697         LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(owner);
10698         LDKGossipTimestampFilter ret_var = CResult_GossipTimestampFilterDecodeErrorZ_get_ok(owner_conv);
10699         int64_t ret_ref = 0;
10700         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10701         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10702         return ret_ref;
10703 }
10704
10705 static inline struct LDKDecodeError CResult_GossipTimestampFilterDecodeErrorZ_get_err(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
10706 CHECK(!owner->result_ok);
10707         return DecodeError_clone(&*owner->contents.err);
10708 }
10709 int64_t  CS_LDK_CResult_GossipTimestampFilterDecodeErrorZ_get_err(int64_t owner) {
10710         LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(owner);
10711         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10712         *ret_copy = CResult_GossipTimestampFilterDecodeErrorZ_get_err(owner_conv);
10713         int64_t ret_ref = tag_ptr(ret_copy, true);
10714         return ret_ref;
10715 }
10716
10717 static inline LDKCVec_PhantomRouteHintsZ CVec_PhantomRouteHintsZ_clone(const LDKCVec_PhantomRouteHintsZ *orig) {
10718         LDKCVec_PhantomRouteHintsZ ret = { .data = MALLOC(sizeof(LDKPhantomRouteHints) * orig->datalen, "LDKCVec_PhantomRouteHintsZ clone bytes"), .datalen = orig->datalen };
10719         for (size_t i = 0; i < ret.datalen; i++) {
10720                 ret.data[i] = PhantomRouteHints_clone(&orig->data[i]);
10721         }
10722         return ret;
10723 }
10724 uint32_t CS_LDK_LDKSignOrCreationError_ty_from_ptr(int64_t ptr) {
10725         LDKSignOrCreationError *obj = (LDKSignOrCreationError*)untag_ptr(ptr);
10726         switch(obj->tag) {
10727                 case LDKSignOrCreationError_SignError: return 0;
10728                 case LDKSignOrCreationError_CreationError: return 1;
10729                 default: abort();
10730         }
10731 }
10732 int32_t CS_LDK_LDKSignOrCreationError_CreationError_get_creation_error(int64_t ptr) {
10733         LDKSignOrCreationError *obj = (LDKSignOrCreationError*)untag_ptr(ptr);
10734         CHECK(obj->tag == LDKSignOrCreationError_CreationError);
10735         int32_t creation_error_conv = LDKCreationError_to_cs(obj->creation_error);
10736         return creation_error_conv;
10737 }
10738 static inline struct LDKBolt11Invoice CResult_Bolt11InvoiceSignOrCreationErrorZ_get_ok(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
10739         LDKBolt11Invoice ret = *owner->contents.result;
10740         ret.is_owned = false;
10741         return ret;
10742 }
10743 int64_t  CS_LDK_CResult_Bolt11InvoiceSignOrCreationErrorZ_get_ok(int64_t owner) {
10744         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(owner);
10745         LDKBolt11Invoice ret_var = CResult_Bolt11InvoiceSignOrCreationErrorZ_get_ok(owner_conv);
10746         int64_t ret_ref = 0;
10747         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10748         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10749         return ret_ref;
10750 }
10751
10752 static inline struct LDKSignOrCreationError CResult_Bolt11InvoiceSignOrCreationErrorZ_get_err(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
10753 CHECK(!owner->result_ok);
10754         return SignOrCreationError_clone(&*owner->contents.err);
10755 }
10756 int64_t  CS_LDK_CResult_Bolt11InvoiceSignOrCreationErrorZ_get_err(int64_t owner) {
10757         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(owner);
10758         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
10759         *ret_copy = CResult_Bolt11InvoiceSignOrCreationErrorZ_get_err(owner_conv);
10760         int64_t ret_ref = tag_ptr(ret_copy, true);
10761         return ret_ref;
10762 }
10763
10764 uint32_t CS_LDK_LDKCOption_InboundHTLCStateDetailsZ_ty_from_ptr(int64_t ptr) {
10765         LDKCOption_InboundHTLCStateDetailsZ *obj = (LDKCOption_InboundHTLCStateDetailsZ*)untag_ptr(ptr);
10766         switch(obj->tag) {
10767                 case LDKCOption_InboundHTLCStateDetailsZ_Some: return 0;
10768                 case LDKCOption_InboundHTLCStateDetailsZ_None: return 1;
10769                 default: abort();
10770         }
10771 }
10772 int32_t CS_LDK_LDKCOption_InboundHTLCStateDetailsZ_Some_get_some(int64_t ptr) {
10773         LDKCOption_InboundHTLCStateDetailsZ *obj = (LDKCOption_InboundHTLCStateDetailsZ*)untag_ptr(ptr);
10774         CHECK(obj->tag == LDKCOption_InboundHTLCStateDetailsZ_Some);
10775         int32_t some_conv = LDKInboundHTLCStateDetails_to_cs(obj->some);
10776         return some_conv;
10777 }
10778 static inline struct LDKCOption_InboundHTLCStateDetailsZ CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_get_ok(LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ *NONNULL_PTR owner){
10779 CHECK(owner->result_ok);
10780         return COption_InboundHTLCStateDetailsZ_clone(&*owner->contents.result);
10781 }
10782 int64_t  CS_LDK_CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_get_ok(int64_t owner) {
10783         LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ* owner_conv = (LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ*)untag_ptr(owner);
10784         LDKCOption_InboundHTLCStateDetailsZ *ret_copy = MALLOC(sizeof(LDKCOption_InboundHTLCStateDetailsZ), "LDKCOption_InboundHTLCStateDetailsZ");
10785         *ret_copy = CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_get_ok(owner_conv);
10786         int64_t ret_ref = tag_ptr(ret_copy, true);
10787         return ret_ref;
10788 }
10789
10790 static inline struct LDKDecodeError CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_get_err(LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ *NONNULL_PTR owner){
10791 CHECK(!owner->result_ok);
10792         return DecodeError_clone(&*owner->contents.err);
10793 }
10794 int64_t  CS_LDK_CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_get_err(int64_t owner) {
10795         LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ* owner_conv = (LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ*)untag_ptr(owner);
10796         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10797         *ret_copy = CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_get_err(owner_conv);
10798         int64_t ret_ref = tag_ptr(ret_copy, true);
10799         return ret_ref;
10800 }
10801
10802 static inline struct LDKInboundHTLCDetails CResult_InboundHTLCDetailsDecodeErrorZ_get_ok(LDKCResult_InboundHTLCDetailsDecodeErrorZ *NONNULL_PTR owner){
10803         LDKInboundHTLCDetails ret = *owner->contents.result;
10804         ret.is_owned = false;
10805         return ret;
10806 }
10807 int64_t  CS_LDK_CResult_InboundHTLCDetailsDecodeErrorZ_get_ok(int64_t owner) {
10808         LDKCResult_InboundHTLCDetailsDecodeErrorZ* owner_conv = (LDKCResult_InboundHTLCDetailsDecodeErrorZ*)untag_ptr(owner);
10809         LDKInboundHTLCDetails ret_var = CResult_InboundHTLCDetailsDecodeErrorZ_get_ok(owner_conv);
10810         int64_t ret_ref = 0;
10811         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10812         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10813         return ret_ref;
10814 }
10815
10816 static inline struct LDKDecodeError CResult_InboundHTLCDetailsDecodeErrorZ_get_err(LDKCResult_InboundHTLCDetailsDecodeErrorZ *NONNULL_PTR owner){
10817 CHECK(!owner->result_ok);
10818         return DecodeError_clone(&*owner->contents.err);
10819 }
10820 int64_t  CS_LDK_CResult_InboundHTLCDetailsDecodeErrorZ_get_err(int64_t owner) {
10821         LDKCResult_InboundHTLCDetailsDecodeErrorZ* owner_conv = (LDKCResult_InboundHTLCDetailsDecodeErrorZ*)untag_ptr(owner);
10822         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10823         *ret_copy = CResult_InboundHTLCDetailsDecodeErrorZ_get_err(owner_conv);
10824         int64_t ret_ref = tag_ptr(ret_copy, true);
10825         return ret_ref;
10826 }
10827
10828 uint32_t CS_LDK_LDKCOption_OutboundHTLCStateDetailsZ_ty_from_ptr(int64_t ptr) {
10829         LDKCOption_OutboundHTLCStateDetailsZ *obj = (LDKCOption_OutboundHTLCStateDetailsZ*)untag_ptr(ptr);
10830         switch(obj->tag) {
10831                 case LDKCOption_OutboundHTLCStateDetailsZ_Some: return 0;
10832                 case LDKCOption_OutboundHTLCStateDetailsZ_None: return 1;
10833                 default: abort();
10834         }
10835 }
10836 int32_t CS_LDK_LDKCOption_OutboundHTLCStateDetailsZ_Some_get_some(int64_t ptr) {
10837         LDKCOption_OutboundHTLCStateDetailsZ *obj = (LDKCOption_OutboundHTLCStateDetailsZ*)untag_ptr(ptr);
10838         CHECK(obj->tag == LDKCOption_OutboundHTLCStateDetailsZ_Some);
10839         int32_t some_conv = LDKOutboundHTLCStateDetails_to_cs(obj->some);
10840         return some_conv;
10841 }
10842 static inline struct LDKCOption_OutboundHTLCStateDetailsZ CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_get_ok(LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ *NONNULL_PTR owner){
10843 CHECK(owner->result_ok);
10844         return COption_OutboundHTLCStateDetailsZ_clone(&*owner->contents.result);
10845 }
10846 int64_t  CS_LDK_CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_get_ok(int64_t owner) {
10847         LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ* owner_conv = (LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ*)untag_ptr(owner);
10848         LDKCOption_OutboundHTLCStateDetailsZ *ret_copy = MALLOC(sizeof(LDKCOption_OutboundHTLCStateDetailsZ), "LDKCOption_OutboundHTLCStateDetailsZ");
10849         *ret_copy = CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_get_ok(owner_conv);
10850         int64_t ret_ref = tag_ptr(ret_copy, true);
10851         return ret_ref;
10852 }
10853
10854 static inline struct LDKDecodeError CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_get_err(LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ *NONNULL_PTR owner){
10855 CHECK(!owner->result_ok);
10856         return DecodeError_clone(&*owner->contents.err);
10857 }
10858 int64_t  CS_LDK_CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_get_err(int64_t owner) {
10859         LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ* owner_conv = (LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ*)untag_ptr(owner);
10860         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10861         *ret_copy = CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_get_err(owner_conv);
10862         int64_t ret_ref = tag_ptr(ret_copy, true);
10863         return ret_ref;
10864 }
10865
10866 static inline struct LDKOutboundHTLCDetails CResult_OutboundHTLCDetailsDecodeErrorZ_get_ok(LDKCResult_OutboundHTLCDetailsDecodeErrorZ *NONNULL_PTR owner){
10867         LDKOutboundHTLCDetails ret = *owner->contents.result;
10868         ret.is_owned = false;
10869         return ret;
10870 }
10871 int64_t  CS_LDK_CResult_OutboundHTLCDetailsDecodeErrorZ_get_ok(int64_t owner) {
10872         LDKCResult_OutboundHTLCDetailsDecodeErrorZ* owner_conv = (LDKCResult_OutboundHTLCDetailsDecodeErrorZ*)untag_ptr(owner);
10873         LDKOutboundHTLCDetails ret_var = CResult_OutboundHTLCDetailsDecodeErrorZ_get_ok(owner_conv);
10874         int64_t ret_ref = 0;
10875         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10876         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10877         return ret_ref;
10878 }
10879
10880 static inline struct LDKDecodeError CResult_OutboundHTLCDetailsDecodeErrorZ_get_err(LDKCResult_OutboundHTLCDetailsDecodeErrorZ *NONNULL_PTR owner){
10881 CHECK(!owner->result_ok);
10882         return DecodeError_clone(&*owner->contents.err);
10883 }
10884 int64_t  CS_LDK_CResult_OutboundHTLCDetailsDecodeErrorZ_get_err(int64_t owner) {
10885         LDKCResult_OutboundHTLCDetailsDecodeErrorZ* owner_conv = (LDKCResult_OutboundHTLCDetailsDecodeErrorZ*)untag_ptr(owner);
10886         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10887         *ret_copy = CResult_OutboundHTLCDetailsDecodeErrorZ_get_err(owner_conv);
10888         int64_t ret_ref = tag_ptr(ret_copy, true);
10889         return ret_ref;
10890 }
10891
10892 static inline struct LDKCounterpartyForwardingInfo CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){
10893         LDKCounterpartyForwardingInfo ret = *owner->contents.result;
10894         ret.is_owned = false;
10895         return ret;
10896 }
10897 int64_t  CS_LDK_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(int64_t owner) {
10898         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(owner);
10899         LDKCounterpartyForwardingInfo ret_var = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(owner_conv);
10900         int64_t ret_ref = 0;
10901         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10902         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10903         return ret_ref;
10904 }
10905
10906 static inline struct LDKDecodeError CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){
10907 CHECK(!owner->result_ok);
10908         return DecodeError_clone(&*owner->contents.err);
10909 }
10910 int64_t  CS_LDK_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(int64_t owner) {
10911         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(owner);
10912         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10913         *ret_copy = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(owner_conv);
10914         int64_t ret_ref = tag_ptr(ret_copy, true);
10915         return ret_ref;
10916 }
10917
10918 static inline struct LDKChannelCounterparty CResult_ChannelCounterpartyDecodeErrorZ_get_ok(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){
10919         LDKChannelCounterparty ret = *owner->contents.result;
10920         ret.is_owned = false;
10921         return ret;
10922 }
10923 int64_t  CS_LDK_CResult_ChannelCounterpartyDecodeErrorZ_get_ok(int64_t owner) {
10924         LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(owner);
10925         LDKChannelCounterparty ret_var = CResult_ChannelCounterpartyDecodeErrorZ_get_ok(owner_conv);
10926         int64_t ret_ref = 0;
10927         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10928         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10929         return ret_ref;
10930 }
10931
10932 static inline struct LDKDecodeError CResult_ChannelCounterpartyDecodeErrorZ_get_err(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){
10933 CHECK(!owner->result_ok);
10934         return DecodeError_clone(&*owner->contents.err);
10935 }
10936 int64_t  CS_LDK_CResult_ChannelCounterpartyDecodeErrorZ_get_err(int64_t owner) {
10937         LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(owner);
10938         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10939         *ret_copy = CResult_ChannelCounterpartyDecodeErrorZ_get_err(owner_conv);
10940         int64_t ret_ref = tag_ptr(ret_copy, true);
10941         return ret_ref;
10942 }
10943
10944 uint32_t CS_LDK_LDKCOption_ChannelShutdownStateZ_ty_from_ptr(int64_t ptr) {
10945         LDKCOption_ChannelShutdownStateZ *obj = (LDKCOption_ChannelShutdownStateZ*)untag_ptr(ptr);
10946         switch(obj->tag) {
10947                 case LDKCOption_ChannelShutdownStateZ_Some: return 0;
10948                 case LDKCOption_ChannelShutdownStateZ_None: return 1;
10949                 default: abort();
10950         }
10951 }
10952 int32_t CS_LDK_LDKCOption_ChannelShutdownStateZ_Some_get_some(int64_t ptr) {
10953         LDKCOption_ChannelShutdownStateZ *obj = (LDKCOption_ChannelShutdownStateZ*)untag_ptr(ptr);
10954         CHECK(obj->tag == LDKCOption_ChannelShutdownStateZ_Some);
10955         int32_t some_conv = LDKChannelShutdownState_to_cs(obj->some);
10956         return some_conv;
10957 }
10958 static inline LDKCVec_InboundHTLCDetailsZ CVec_InboundHTLCDetailsZ_clone(const LDKCVec_InboundHTLCDetailsZ *orig) {
10959         LDKCVec_InboundHTLCDetailsZ ret = { .data = MALLOC(sizeof(LDKInboundHTLCDetails) * orig->datalen, "LDKCVec_InboundHTLCDetailsZ clone bytes"), .datalen = orig->datalen };
10960         for (size_t i = 0; i < ret.datalen; i++) {
10961                 ret.data[i] = InboundHTLCDetails_clone(&orig->data[i]);
10962         }
10963         return ret;
10964 }
10965 static inline LDKCVec_OutboundHTLCDetailsZ CVec_OutboundHTLCDetailsZ_clone(const LDKCVec_OutboundHTLCDetailsZ *orig) {
10966         LDKCVec_OutboundHTLCDetailsZ ret = { .data = MALLOC(sizeof(LDKOutboundHTLCDetails) * orig->datalen, "LDKCVec_OutboundHTLCDetailsZ clone bytes"), .datalen = orig->datalen };
10967         for (size_t i = 0; i < ret.datalen; i++) {
10968                 ret.data[i] = OutboundHTLCDetails_clone(&orig->data[i]);
10969         }
10970         return ret;
10971 }
10972 static inline struct LDKChannelDetails CResult_ChannelDetailsDecodeErrorZ_get_ok(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){
10973         LDKChannelDetails ret = *owner->contents.result;
10974         ret.is_owned = false;
10975         return ret;
10976 }
10977 int64_t  CS_LDK_CResult_ChannelDetailsDecodeErrorZ_get_ok(int64_t owner) {
10978         LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(owner);
10979         LDKChannelDetails ret_var = CResult_ChannelDetailsDecodeErrorZ_get_ok(owner_conv);
10980         int64_t ret_ref = 0;
10981         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10982         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10983         return ret_ref;
10984 }
10985
10986 static inline struct LDKDecodeError CResult_ChannelDetailsDecodeErrorZ_get_err(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){
10987 CHECK(!owner->result_ok);
10988         return DecodeError_clone(&*owner->contents.err);
10989 }
10990 int64_t  CS_LDK_CResult_ChannelDetailsDecodeErrorZ_get_err(int64_t owner) {
10991         LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(owner);
10992         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10993         *ret_copy = CResult_ChannelDetailsDecodeErrorZ_get_err(owner_conv);
10994         int64_t ret_ref = tag_ptr(ret_copy, true);
10995         return ret_ref;
10996 }
10997
10998 static inline enum LDKChannelShutdownState CResult_ChannelShutdownStateDecodeErrorZ_get_ok(LDKCResult_ChannelShutdownStateDecodeErrorZ *NONNULL_PTR owner){
10999 CHECK(owner->result_ok);
11000         return ChannelShutdownState_clone(&*owner->contents.result);
11001 }
11002 int32_t  CS_LDK_CResult_ChannelShutdownStateDecodeErrorZ_get_ok(int64_t owner) {
11003         LDKCResult_ChannelShutdownStateDecodeErrorZ* owner_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(owner);
11004         int32_t ret_conv = LDKChannelShutdownState_to_cs(CResult_ChannelShutdownStateDecodeErrorZ_get_ok(owner_conv));
11005         return ret_conv;
11006 }
11007
11008 static inline struct LDKDecodeError CResult_ChannelShutdownStateDecodeErrorZ_get_err(LDKCResult_ChannelShutdownStateDecodeErrorZ *NONNULL_PTR owner){
11009 CHECK(!owner->result_ok);
11010         return DecodeError_clone(&*owner->contents.err);
11011 }
11012 int64_t  CS_LDK_CResult_ChannelShutdownStateDecodeErrorZ_get_err(int64_t owner) {
11013         LDKCResult_ChannelShutdownStateDecodeErrorZ* owner_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(owner);
11014         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11015         *ret_copy = CResult_ChannelShutdownStateDecodeErrorZ_get_err(owner_conv);
11016         int64_t ret_ref = tag_ptr(ret_copy, true);
11017         return ret_ref;
11018 }
11019
11020 static inline struct LDKOffersMessage CResult_OffersMessageDecodeErrorZ_get_ok(LDKCResult_OffersMessageDecodeErrorZ *NONNULL_PTR owner){
11021 CHECK(owner->result_ok);
11022         return OffersMessage_clone(&*owner->contents.result);
11023 }
11024 int64_t  CS_LDK_CResult_OffersMessageDecodeErrorZ_get_ok(int64_t owner) {
11025         LDKCResult_OffersMessageDecodeErrorZ* owner_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(owner);
11026         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
11027         *ret_copy = CResult_OffersMessageDecodeErrorZ_get_ok(owner_conv);
11028         int64_t ret_ref = tag_ptr(ret_copy, true);
11029         return ret_ref;
11030 }
11031
11032 static inline struct LDKDecodeError CResult_OffersMessageDecodeErrorZ_get_err(LDKCResult_OffersMessageDecodeErrorZ *NONNULL_PTR owner){
11033 CHECK(!owner->result_ok);
11034         return DecodeError_clone(&*owner->contents.err);
11035 }
11036 int64_t  CS_LDK_CResult_OffersMessageDecodeErrorZ_get_err(int64_t owner) {
11037         LDKCResult_OffersMessageDecodeErrorZ* owner_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(owner);
11038         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11039         *ret_copy = CResult_OffersMessageDecodeErrorZ_get_err(owner_conv);
11040         int64_t ret_ref = tag_ptr(ret_copy, true);
11041         return ret_ref;
11042 }
11043
11044 uint32_t CS_LDK_LDKCOption_HTLCClaimZ_ty_from_ptr(int64_t ptr) {
11045         LDKCOption_HTLCClaimZ *obj = (LDKCOption_HTLCClaimZ*)untag_ptr(ptr);
11046         switch(obj->tag) {
11047                 case LDKCOption_HTLCClaimZ_Some: return 0;
11048                 case LDKCOption_HTLCClaimZ_None: return 1;
11049                 default: abort();
11050         }
11051 }
11052 int32_t CS_LDK_LDKCOption_HTLCClaimZ_Some_get_some(int64_t ptr) {
11053         LDKCOption_HTLCClaimZ *obj = (LDKCOption_HTLCClaimZ*)untag_ptr(ptr);
11054         CHECK(obj->tag == LDKCOption_HTLCClaimZ_Some);
11055         int32_t some_conv = LDKHTLCClaim_to_cs(obj->some);
11056         return some_conv;
11057 }
11058 static inline struct LDKCounterpartyCommitmentSecrets CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR owner){
11059         LDKCounterpartyCommitmentSecrets ret = *owner->contents.result;
11060         ret.is_owned = false;
11061         return ret;
11062 }
11063 int64_t  CS_LDK_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(int64_t owner) {
11064         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(owner);
11065         LDKCounterpartyCommitmentSecrets ret_var = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(owner_conv);
11066         int64_t ret_ref = 0;
11067         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11068         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11069         return ret_ref;
11070 }
11071
11072 static inline struct LDKDecodeError CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR owner){
11073 CHECK(!owner->result_ok);
11074         return DecodeError_clone(&*owner->contents.err);
11075 }
11076 int64_t  CS_LDK_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(int64_t owner) {
11077         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(owner);
11078         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11079         *ret_copy = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(owner_conv);
11080         int64_t ret_ref = tag_ptr(ret_copy, true);
11081         return ret_ref;
11082 }
11083
11084 static inline struct LDKTxCreationKeys CResult_TxCreationKeysDecodeErrorZ_get_ok(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
11085         LDKTxCreationKeys ret = *owner->contents.result;
11086         ret.is_owned = false;
11087         return ret;
11088 }
11089 int64_t  CS_LDK_CResult_TxCreationKeysDecodeErrorZ_get_ok(int64_t owner) {
11090         LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(owner);
11091         LDKTxCreationKeys ret_var = CResult_TxCreationKeysDecodeErrorZ_get_ok(owner_conv);
11092         int64_t ret_ref = 0;
11093         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11094         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11095         return ret_ref;
11096 }
11097
11098 static inline struct LDKDecodeError CResult_TxCreationKeysDecodeErrorZ_get_err(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
11099 CHECK(!owner->result_ok);
11100         return DecodeError_clone(&*owner->contents.err);
11101 }
11102 int64_t  CS_LDK_CResult_TxCreationKeysDecodeErrorZ_get_err(int64_t owner) {
11103         LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(owner);
11104         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11105         *ret_copy = CResult_TxCreationKeysDecodeErrorZ_get_err(owner_conv);
11106         int64_t ret_ref = tag_ptr(ret_copy, true);
11107         return ret_ref;
11108 }
11109
11110 static inline struct LDKChannelPublicKeys CResult_ChannelPublicKeysDecodeErrorZ_get_ok(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
11111         LDKChannelPublicKeys ret = *owner->contents.result;
11112         ret.is_owned = false;
11113         return ret;
11114 }
11115 int64_t  CS_LDK_CResult_ChannelPublicKeysDecodeErrorZ_get_ok(int64_t owner) {
11116         LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(owner);
11117         LDKChannelPublicKeys ret_var = CResult_ChannelPublicKeysDecodeErrorZ_get_ok(owner_conv);
11118         int64_t ret_ref = 0;
11119         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11120         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11121         return ret_ref;
11122 }
11123
11124 static inline struct LDKDecodeError CResult_ChannelPublicKeysDecodeErrorZ_get_err(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
11125 CHECK(!owner->result_ok);
11126         return DecodeError_clone(&*owner->contents.err);
11127 }
11128 int64_t  CS_LDK_CResult_ChannelPublicKeysDecodeErrorZ_get_err(int64_t owner) {
11129         LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(owner);
11130         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11131         *ret_copy = CResult_ChannelPublicKeysDecodeErrorZ_get_err(owner_conv);
11132         int64_t ret_ref = tag_ptr(ret_copy, true);
11133         return ret_ref;
11134 }
11135
11136 static inline struct LDKHTLCOutputInCommitment CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
11137         LDKHTLCOutputInCommitment ret = *owner->contents.result;
11138         ret.is_owned = false;
11139         return ret;
11140 }
11141 int64_t  CS_LDK_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(int64_t owner) {
11142         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(owner);
11143         LDKHTLCOutputInCommitment ret_var = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(owner_conv);
11144         int64_t ret_ref = 0;
11145         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11146         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11147         return ret_ref;
11148 }
11149
11150 static inline struct LDKDecodeError CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
11151 CHECK(!owner->result_ok);
11152         return DecodeError_clone(&*owner->contents.err);
11153 }
11154 int64_t  CS_LDK_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(int64_t owner) {
11155         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(owner);
11156         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11157         *ret_copy = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(owner_conv);
11158         int64_t ret_ref = tag_ptr(ret_copy, true);
11159         return ret_ref;
11160 }
11161
11162 static inline struct LDKCounterpartyChannelTransactionParameters CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
11163         LDKCounterpartyChannelTransactionParameters ret = *owner->contents.result;
11164         ret.is_owned = false;
11165         return ret;
11166 }
11167 int64_t  CS_LDK_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(int64_t owner) {
11168         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
11169         LDKCounterpartyChannelTransactionParameters ret_var = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(owner_conv);
11170         int64_t ret_ref = 0;
11171         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11172         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11173         return ret_ref;
11174 }
11175
11176 static inline struct LDKDecodeError CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
11177 CHECK(!owner->result_ok);
11178         return DecodeError_clone(&*owner->contents.err);
11179 }
11180 int64_t  CS_LDK_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(int64_t owner) {
11181         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
11182         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11183         *ret_copy = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
11184         int64_t ret_ref = tag_ptr(ret_copy, true);
11185         return ret_ref;
11186 }
11187
11188 static inline struct LDKChannelTransactionParameters CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
11189         LDKChannelTransactionParameters ret = *owner->contents.result;
11190         ret.is_owned = false;
11191         return ret;
11192 }
11193 int64_t  CS_LDK_CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(int64_t owner) {
11194         LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
11195         LDKChannelTransactionParameters ret_var = CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(owner_conv);
11196         int64_t ret_ref = 0;
11197         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11198         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11199         return ret_ref;
11200 }
11201
11202 static inline struct LDKDecodeError CResult_ChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
11203 CHECK(!owner->result_ok);
11204         return DecodeError_clone(&*owner->contents.err);
11205 }
11206 int64_t  CS_LDK_CResult_ChannelTransactionParametersDecodeErrorZ_get_err(int64_t owner) {
11207         LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
11208         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11209         *ret_copy = CResult_ChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
11210         int64_t ret_ref = tag_ptr(ret_copy, true);
11211         return ret_ref;
11212 }
11213
11214 static inline struct LDKHolderCommitmentTransaction CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
11215         LDKHolderCommitmentTransaction ret = *owner->contents.result;
11216         ret.is_owned = false;
11217         return ret;
11218 }
11219 int64_t  CS_LDK_CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(int64_t owner) {
11220         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
11221         LDKHolderCommitmentTransaction ret_var = CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
11222         int64_t ret_ref = 0;
11223         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11224         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11225         return ret_ref;
11226 }
11227
11228 static inline struct LDKDecodeError CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
11229 CHECK(!owner->result_ok);
11230         return DecodeError_clone(&*owner->contents.err);
11231 }
11232 int64_t  CS_LDK_CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(int64_t owner) {
11233         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
11234         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11235         *ret_copy = CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
11236         int64_t ret_ref = tag_ptr(ret_copy, true);
11237         return ret_ref;
11238 }
11239
11240 static inline struct LDKBuiltCommitmentTransaction CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
11241         LDKBuiltCommitmentTransaction ret = *owner->contents.result;
11242         ret.is_owned = false;
11243         return ret;
11244 }
11245 int64_t  CS_LDK_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(int64_t owner) {
11246         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
11247         LDKBuiltCommitmentTransaction ret_var = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
11248         int64_t ret_ref = 0;
11249         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11250         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11251         return ret_ref;
11252 }
11253
11254 static inline struct LDKDecodeError CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
11255 CHECK(!owner->result_ok);
11256         return DecodeError_clone(&*owner->contents.err);
11257 }
11258 int64_t  CS_LDK_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(int64_t owner) {
11259         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
11260         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11261         *ret_copy = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
11262         int64_t ret_ref = tag_ptr(ret_copy, true);
11263         return ret_ref;
11264 }
11265
11266 static inline struct LDKTrustedClosingTransaction CResult_TrustedClosingTransactionNoneZ_get_ok(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
11267         LDKTrustedClosingTransaction ret = *owner->contents.result;
11268         ret.is_owned = false;
11269         return ret;
11270 }
11271 int64_t  CS_LDK_CResult_TrustedClosingTransactionNoneZ_get_ok(int64_t owner) {
11272         LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(owner);
11273         LDKTrustedClosingTransaction ret_var = CResult_TrustedClosingTransactionNoneZ_get_ok(owner_conv);
11274         int64_t ret_ref = 0;
11275         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11276         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11277         return ret_ref;
11278 }
11279
11280 static inline void CResult_TrustedClosingTransactionNoneZ_get_err(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
11281 CHECK(!owner->result_ok);
11282         return *owner->contents.err;
11283 }
11284 void  CS_LDK_CResult_TrustedClosingTransactionNoneZ_get_err(int64_t owner) {
11285         LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(owner);
11286         CResult_TrustedClosingTransactionNoneZ_get_err(owner_conv);
11287 }
11288
11289 static inline struct LDKCommitmentTransaction CResult_CommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
11290         LDKCommitmentTransaction ret = *owner->contents.result;
11291         ret.is_owned = false;
11292         return ret;
11293 }
11294 int64_t  CS_LDK_CResult_CommitmentTransactionDecodeErrorZ_get_ok(int64_t owner) {
11295         LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
11296         LDKCommitmentTransaction ret_var = CResult_CommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
11297         int64_t ret_ref = 0;
11298         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11299         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11300         return ret_ref;
11301 }
11302
11303 static inline struct LDKDecodeError CResult_CommitmentTransactionDecodeErrorZ_get_err(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
11304 CHECK(!owner->result_ok);
11305         return DecodeError_clone(&*owner->contents.err);
11306 }
11307 int64_t  CS_LDK_CResult_CommitmentTransactionDecodeErrorZ_get_err(int64_t owner) {
11308         LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
11309         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11310         *ret_copy = CResult_CommitmentTransactionDecodeErrorZ_get_err(owner_conv);
11311         int64_t ret_ref = tag_ptr(ret_copy, true);
11312         return ret_ref;
11313 }
11314
11315 static inline struct LDKTrustedCommitmentTransaction CResult_TrustedCommitmentTransactionNoneZ_get_ok(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
11316         LDKTrustedCommitmentTransaction ret = *owner->contents.result;
11317         ret.is_owned = false;
11318         return ret;
11319 }
11320 int64_t  CS_LDK_CResult_TrustedCommitmentTransactionNoneZ_get_ok(int64_t owner) {
11321         LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(owner);
11322         LDKTrustedCommitmentTransaction ret_var = CResult_TrustedCommitmentTransactionNoneZ_get_ok(owner_conv);
11323         int64_t ret_ref = 0;
11324         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11325         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11326         return ret_ref;
11327 }
11328
11329 static inline void CResult_TrustedCommitmentTransactionNoneZ_get_err(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
11330 CHECK(!owner->result_ok);
11331         return *owner->contents.err;
11332 }
11333 void  CS_LDK_CResult_TrustedCommitmentTransactionNoneZ_get_err(int64_t owner) {
11334         LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(owner);
11335         CResult_TrustedCommitmentTransactionNoneZ_get_err(owner_conv);
11336 }
11337
11338 static inline struct LDKCVec_ECDSASignatureZ CResult_CVec_ECDSASignatureZNoneZ_get_ok(LDKCResult_CVec_ECDSASignatureZNoneZ *NONNULL_PTR owner){
11339 CHECK(owner->result_ok);
11340         return *owner->contents.result;
11341 }
11342 ptrArray  CS_LDK_CResult_CVec_ECDSASignatureZNoneZ_get_ok(int64_t owner) {
11343         LDKCResult_CVec_ECDSASignatureZNoneZ* owner_conv = (LDKCResult_CVec_ECDSASignatureZNoneZ*)untag_ptr(owner);
11344         LDKCVec_ECDSASignatureZ ret_var = CResult_CVec_ECDSASignatureZNoneZ_get_ok(owner_conv);
11345         ptrArray ret_arr = NULL;
11346         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
11347         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
11348         for (size_t i = 0; i < ret_var.datalen; i++) {
11349                 int8_tArray ret_conv_8_arr = init_int8_tArray(64, __LINE__);
11350                 memcpy(ret_conv_8_arr->elems, ret_var.data[i].compact_form, 64);
11351                 ret_arr_ptr[i] = ret_conv_8_arr;
11352         }
11353         
11354         return ret_arr;
11355 }
11356
11357 static inline void CResult_CVec_ECDSASignatureZNoneZ_get_err(LDKCResult_CVec_ECDSASignatureZNoneZ *NONNULL_PTR owner){
11358 CHECK(!owner->result_ok);
11359         return *owner->contents.err;
11360 }
11361 void  CS_LDK_CResult_CVec_ECDSASignatureZNoneZ_get_err(int64_t owner) {
11362         LDKCResult_CVec_ECDSASignatureZNoneZ* owner_conv = (LDKCResult_CVec_ECDSASignatureZNoneZ*)untag_ptr(owner);
11363         CResult_CVec_ECDSASignatureZNoneZ_get_err(owner_conv);
11364 }
11365
11366 uint32_t CS_LDK_LDKCOption_usizeZ_ty_from_ptr(int64_t ptr) {
11367         LDKCOption_usizeZ *obj = (LDKCOption_usizeZ*)untag_ptr(ptr);
11368         switch(obj->tag) {
11369                 case LDKCOption_usizeZ_Some: return 0;
11370                 case LDKCOption_usizeZ_None: return 1;
11371                 default: abort();
11372         }
11373 }
11374 int64_t CS_LDK_LDKCOption_usizeZ_Some_get_some(int64_t ptr) {
11375         LDKCOption_usizeZ *obj = (LDKCOption_usizeZ*)untag_ptr(ptr);
11376         CHECK(obj->tag == LDKCOption_usizeZ_Some);
11377         int64_t some_conv = obj->some;
11378         return some_conv;
11379 }
11380 static inline struct LDKShutdownScript CResult_ShutdownScriptDecodeErrorZ_get_ok(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
11381         LDKShutdownScript ret = *owner->contents.result;
11382         ret.is_owned = false;
11383         return ret;
11384 }
11385 int64_t  CS_LDK_CResult_ShutdownScriptDecodeErrorZ_get_ok(int64_t owner) {
11386         LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(owner);
11387         LDKShutdownScript ret_var = CResult_ShutdownScriptDecodeErrorZ_get_ok(owner_conv);
11388         int64_t ret_ref = 0;
11389         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11390         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11391         return ret_ref;
11392 }
11393
11394 static inline struct LDKDecodeError CResult_ShutdownScriptDecodeErrorZ_get_err(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
11395 CHECK(!owner->result_ok);
11396         return DecodeError_clone(&*owner->contents.err);
11397 }
11398 int64_t  CS_LDK_CResult_ShutdownScriptDecodeErrorZ_get_err(int64_t owner) {
11399         LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(owner);
11400         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11401         *ret_copy = CResult_ShutdownScriptDecodeErrorZ_get_err(owner_conv);
11402         int64_t ret_ref = tag_ptr(ret_copy, true);
11403         return ret_ref;
11404 }
11405
11406 static inline struct LDKShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
11407         LDKShutdownScript ret = *owner->contents.result;
11408         ret.is_owned = false;
11409         return ret;
11410 }
11411 int64_t  CS_LDK_CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(int64_t owner) {
11412         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(owner);
11413         LDKShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(owner_conv);
11414         int64_t ret_ref = 0;
11415         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11416         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11417         return ret_ref;
11418 }
11419
11420 static inline struct LDKInvalidShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
11421         LDKInvalidShutdownScript ret = *owner->contents.err;
11422         ret.is_owned = false;
11423         return ret;
11424 }
11425 int64_t  CS_LDK_CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(int64_t owner) {
11426         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(owner);
11427         LDKInvalidShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(owner_conv);
11428         int64_t ret_ref = 0;
11429         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11430         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11431         return ret_ref;
11432 }
11433
11434 uint32_t CS_LDK_LDKPaymentPurpose_ty_from_ptr(int64_t ptr) {
11435         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
11436         switch(obj->tag) {
11437                 case LDKPaymentPurpose_Bolt11InvoicePayment: return 0;
11438                 case LDKPaymentPurpose_Bolt12OfferPayment: return 1;
11439                 case LDKPaymentPurpose_Bolt12RefundPayment: return 2;
11440                 case LDKPaymentPurpose_SpontaneousPayment: return 3;
11441                 default: abort();
11442         }
11443 }
11444 int64_t CS_LDK_LDKPaymentPurpose_Bolt11InvoicePayment_get_payment_preimage(int64_t ptr) {
11445         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
11446         CHECK(obj->tag == LDKPaymentPurpose_Bolt11InvoicePayment);
11447         int64_t payment_preimage_ref = tag_ptr(&obj->bolt11_invoice_payment.payment_preimage, false);
11448         return payment_preimage_ref;
11449 }
11450 int8_tArray CS_LDK_LDKPaymentPurpose_Bolt11InvoicePayment_get_payment_secret(int64_t ptr) {
11451         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
11452         CHECK(obj->tag == LDKPaymentPurpose_Bolt11InvoicePayment);
11453         int8_tArray payment_secret_arr = init_int8_tArray(32, __LINE__);
11454         memcpy(payment_secret_arr->elems, obj->bolt11_invoice_payment.payment_secret.data, 32);
11455         return payment_secret_arr;
11456 }
11457 int64_t CS_LDK_LDKPaymentPurpose_Bolt12OfferPayment_get_payment_preimage(int64_t ptr) {
11458         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
11459         CHECK(obj->tag == LDKPaymentPurpose_Bolt12OfferPayment);
11460         int64_t payment_preimage_ref = tag_ptr(&obj->bolt12_offer_payment.payment_preimage, false);
11461         return payment_preimage_ref;
11462 }
11463 int8_tArray CS_LDK_LDKPaymentPurpose_Bolt12OfferPayment_get_payment_secret(int64_t ptr) {
11464         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
11465         CHECK(obj->tag == LDKPaymentPurpose_Bolt12OfferPayment);
11466         int8_tArray payment_secret_arr = init_int8_tArray(32, __LINE__);
11467         memcpy(payment_secret_arr->elems, obj->bolt12_offer_payment.payment_secret.data, 32);
11468         return payment_secret_arr;
11469 }
11470 int64_t CS_LDK_LDKPaymentPurpose_Bolt12OfferPayment_get_payment_context(int64_t ptr) {
11471         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
11472         CHECK(obj->tag == LDKPaymentPurpose_Bolt12OfferPayment);
11473         LDKBolt12OfferContext payment_context_var = obj->bolt12_offer_payment.payment_context;
11474                         int64_t payment_context_ref = 0;
11475                         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_context_var);
11476                         payment_context_ref = tag_ptr(payment_context_var.inner, false);
11477         return payment_context_ref;
11478 }
11479 int64_t CS_LDK_LDKPaymentPurpose_Bolt12RefundPayment_get_payment_preimage(int64_t ptr) {
11480         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
11481         CHECK(obj->tag == LDKPaymentPurpose_Bolt12RefundPayment);
11482         int64_t payment_preimage_ref = tag_ptr(&obj->bolt12_refund_payment.payment_preimage, false);
11483         return payment_preimage_ref;
11484 }
11485 int8_tArray CS_LDK_LDKPaymentPurpose_Bolt12RefundPayment_get_payment_secret(int64_t ptr) {
11486         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
11487         CHECK(obj->tag == LDKPaymentPurpose_Bolt12RefundPayment);
11488         int8_tArray payment_secret_arr = init_int8_tArray(32, __LINE__);
11489         memcpy(payment_secret_arr->elems, obj->bolt12_refund_payment.payment_secret.data, 32);
11490         return payment_secret_arr;
11491 }
11492 int64_t CS_LDK_LDKPaymentPurpose_Bolt12RefundPayment_get_payment_context(int64_t ptr) {
11493         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
11494         CHECK(obj->tag == LDKPaymentPurpose_Bolt12RefundPayment);
11495         LDKBolt12RefundContext payment_context_var = obj->bolt12_refund_payment.payment_context;
11496                         int64_t payment_context_ref = 0;
11497                         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_context_var);
11498                         payment_context_ref = tag_ptr(payment_context_var.inner, false);
11499         return payment_context_ref;
11500 }
11501 int8_tArray CS_LDK_LDKPaymentPurpose_SpontaneousPayment_get_spontaneous_payment(int64_t ptr) {
11502         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
11503         CHECK(obj->tag == LDKPaymentPurpose_SpontaneousPayment);
11504         int8_tArray spontaneous_payment_arr = init_int8_tArray(32, __LINE__);
11505         memcpy(spontaneous_payment_arr->elems, obj->spontaneous_payment.data, 32);
11506         return spontaneous_payment_arr;
11507 }
11508 static inline struct LDKPaymentPurpose CResult_PaymentPurposeDecodeErrorZ_get_ok(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR owner){
11509 CHECK(owner->result_ok);
11510         return PaymentPurpose_clone(&*owner->contents.result);
11511 }
11512 int64_t  CS_LDK_CResult_PaymentPurposeDecodeErrorZ_get_ok(int64_t owner) {
11513         LDKCResult_PaymentPurposeDecodeErrorZ* owner_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(owner);
11514         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
11515         *ret_copy = CResult_PaymentPurposeDecodeErrorZ_get_ok(owner_conv);
11516         int64_t ret_ref = tag_ptr(ret_copy, true);
11517         return ret_ref;
11518 }
11519
11520 static inline struct LDKDecodeError CResult_PaymentPurposeDecodeErrorZ_get_err(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR owner){
11521 CHECK(!owner->result_ok);
11522         return DecodeError_clone(&*owner->contents.err);
11523 }
11524 int64_t  CS_LDK_CResult_PaymentPurposeDecodeErrorZ_get_err(int64_t owner) {
11525         LDKCResult_PaymentPurposeDecodeErrorZ* owner_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(owner);
11526         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11527         *ret_copy = CResult_PaymentPurposeDecodeErrorZ_get_err(owner_conv);
11528         int64_t ret_ref = tag_ptr(ret_copy, true);
11529         return ret_ref;
11530 }
11531
11532 static inline struct LDKClaimedHTLC CResult_ClaimedHTLCDecodeErrorZ_get_ok(LDKCResult_ClaimedHTLCDecodeErrorZ *NONNULL_PTR owner){
11533         LDKClaimedHTLC ret = *owner->contents.result;
11534         ret.is_owned = false;
11535         return ret;
11536 }
11537 int64_t  CS_LDK_CResult_ClaimedHTLCDecodeErrorZ_get_ok(int64_t owner) {
11538         LDKCResult_ClaimedHTLCDecodeErrorZ* owner_conv = (LDKCResult_ClaimedHTLCDecodeErrorZ*)untag_ptr(owner);
11539         LDKClaimedHTLC ret_var = CResult_ClaimedHTLCDecodeErrorZ_get_ok(owner_conv);
11540         int64_t ret_ref = 0;
11541         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11542         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11543         return ret_ref;
11544 }
11545
11546 static inline struct LDKDecodeError CResult_ClaimedHTLCDecodeErrorZ_get_err(LDKCResult_ClaimedHTLCDecodeErrorZ *NONNULL_PTR owner){
11547 CHECK(!owner->result_ok);
11548         return DecodeError_clone(&*owner->contents.err);
11549 }
11550 int64_t  CS_LDK_CResult_ClaimedHTLCDecodeErrorZ_get_err(int64_t owner) {
11551         LDKCResult_ClaimedHTLCDecodeErrorZ* owner_conv = (LDKCResult_ClaimedHTLCDecodeErrorZ*)untag_ptr(owner);
11552         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11553         *ret_copy = CResult_ClaimedHTLCDecodeErrorZ_get_err(owner_conv);
11554         int64_t ret_ref = tag_ptr(ret_copy, true);
11555         return ret_ref;
11556 }
11557
11558 uint32_t CS_LDK_LDKPathFailure_ty_from_ptr(int64_t ptr) {
11559         LDKPathFailure *obj = (LDKPathFailure*)untag_ptr(ptr);
11560         switch(obj->tag) {
11561                 case LDKPathFailure_InitialSend: return 0;
11562                 case LDKPathFailure_OnPath: return 1;
11563                 default: abort();
11564         }
11565 }
11566 int64_t CS_LDK_LDKPathFailure_InitialSend_get_err(int64_t ptr) {
11567         LDKPathFailure *obj = (LDKPathFailure*)untag_ptr(ptr);
11568         CHECK(obj->tag == LDKPathFailure_InitialSend);
11569         int64_t err_ref = tag_ptr(&obj->initial_send.err, false);
11570         return err_ref;
11571 }
11572 int64_t CS_LDK_LDKPathFailure_OnPath_get_network_update(int64_t ptr) {
11573         LDKPathFailure *obj = (LDKPathFailure*)untag_ptr(ptr);
11574         CHECK(obj->tag == LDKPathFailure_OnPath);
11575         int64_t network_update_ref = tag_ptr(&obj->on_path.network_update, false);
11576         return network_update_ref;
11577 }
11578 uint32_t CS_LDK_LDKCOption_PathFailureZ_ty_from_ptr(int64_t ptr) {
11579         LDKCOption_PathFailureZ *obj = (LDKCOption_PathFailureZ*)untag_ptr(ptr);
11580         switch(obj->tag) {
11581                 case LDKCOption_PathFailureZ_Some: return 0;
11582                 case LDKCOption_PathFailureZ_None: return 1;
11583                 default: abort();
11584         }
11585 }
11586 int64_t CS_LDK_LDKCOption_PathFailureZ_Some_get_some(int64_t ptr) {
11587         LDKCOption_PathFailureZ *obj = (LDKCOption_PathFailureZ*)untag_ptr(ptr);
11588         CHECK(obj->tag == LDKCOption_PathFailureZ_Some);
11589         int64_t some_ref = tag_ptr(&obj->some, false);
11590         return some_ref;
11591 }
11592 static inline struct LDKCOption_PathFailureZ CResult_COption_PathFailureZDecodeErrorZ_get_ok(LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR owner){
11593 CHECK(owner->result_ok);
11594         return COption_PathFailureZ_clone(&*owner->contents.result);
11595 }
11596 int64_t  CS_LDK_CResult_COption_PathFailureZDecodeErrorZ_get_ok(int64_t owner) {
11597         LDKCResult_COption_PathFailureZDecodeErrorZ* owner_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(owner);
11598         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
11599         *ret_copy = CResult_COption_PathFailureZDecodeErrorZ_get_ok(owner_conv);
11600         int64_t ret_ref = tag_ptr(ret_copy, true);
11601         return ret_ref;
11602 }
11603
11604 static inline struct LDKDecodeError CResult_COption_PathFailureZDecodeErrorZ_get_err(LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR owner){
11605 CHECK(!owner->result_ok);
11606         return DecodeError_clone(&*owner->contents.err);
11607 }
11608 int64_t  CS_LDK_CResult_COption_PathFailureZDecodeErrorZ_get_err(int64_t owner) {
11609         LDKCResult_COption_PathFailureZDecodeErrorZ* owner_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(owner);
11610         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11611         *ret_copy = CResult_COption_PathFailureZDecodeErrorZ_get_err(owner_conv);
11612         int64_t ret_ref = tag_ptr(ret_copy, true);
11613         return ret_ref;
11614 }
11615
11616 uint32_t CS_LDK_LDKCOption_ClosureReasonZ_ty_from_ptr(int64_t ptr) {
11617         LDKCOption_ClosureReasonZ *obj = (LDKCOption_ClosureReasonZ*)untag_ptr(ptr);
11618         switch(obj->tag) {
11619                 case LDKCOption_ClosureReasonZ_Some: return 0;
11620                 case LDKCOption_ClosureReasonZ_None: return 1;
11621                 default: abort();
11622         }
11623 }
11624 int64_t CS_LDK_LDKCOption_ClosureReasonZ_Some_get_some(int64_t ptr) {
11625         LDKCOption_ClosureReasonZ *obj = (LDKCOption_ClosureReasonZ*)untag_ptr(ptr);
11626         CHECK(obj->tag == LDKCOption_ClosureReasonZ_Some);
11627         int64_t some_ref = tag_ptr(&obj->some, false);
11628         return some_ref;
11629 }
11630 static inline struct LDKCOption_ClosureReasonZ CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
11631 CHECK(owner->result_ok);
11632         return COption_ClosureReasonZ_clone(&*owner->contents.result);
11633 }
11634 int64_t  CS_LDK_CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(int64_t owner) {
11635         LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(owner);
11636         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
11637         *ret_copy = CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(owner_conv);
11638         int64_t ret_ref = tag_ptr(ret_copy, true);
11639         return ret_ref;
11640 }
11641
11642 static inline struct LDKDecodeError CResult_COption_ClosureReasonZDecodeErrorZ_get_err(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
11643 CHECK(!owner->result_ok);
11644         return DecodeError_clone(&*owner->contents.err);
11645 }
11646 int64_t  CS_LDK_CResult_COption_ClosureReasonZDecodeErrorZ_get_err(int64_t owner) {
11647         LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(owner);
11648         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11649         *ret_copy = CResult_COption_ClosureReasonZDecodeErrorZ_get_err(owner_conv);
11650         int64_t ret_ref = tag_ptr(ret_copy, true);
11651         return ret_ref;
11652 }
11653
11654 uint32_t CS_LDK_LDKHTLCDestination_ty_from_ptr(int64_t ptr) {
11655         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
11656         switch(obj->tag) {
11657                 case LDKHTLCDestination_NextHopChannel: return 0;
11658                 case LDKHTLCDestination_UnknownNextHop: return 1;
11659                 case LDKHTLCDestination_InvalidForward: return 2;
11660                 case LDKHTLCDestination_InvalidOnion: return 3;
11661                 case LDKHTLCDestination_FailedPayment: return 4;
11662                 default: abort();
11663         }
11664 }
11665 int8_tArray CS_LDK_LDKHTLCDestination_NextHopChannel_get_node_id(int64_t ptr) {
11666         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
11667         CHECK(obj->tag == LDKHTLCDestination_NextHopChannel);
11668         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
11669         memcpy(node_id_arr->elems, obj->next_hop_channel.node_id.compressed_form, 33);
11670         return node_id_arr;
11671 }
11672 int64_t CS_LDK_LDKHTLCDestination_NextHopChannel_get_channel_id(int64_t ptr) {
11673         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
11674         CHECK(obj->tag == LDKHTLCDestination_NextHopChannel);
11675         LDKChannelId channel_id_var = obj->next_hop_channel.channel_id;
11676                         int64_t channel_id_ref = 0;
11677                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
11678                         channel_id_ref = tag_ptr(channel_id_var.inner, false);
11679         return channel_id_ref;
11680 }
11681 int64_t CS_LDK_LDKHTLCDestination_UnknownNextHop_get_requested_forward_scid(int64_t ptr) {
11682         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
11683         CHECK(obj->tag == LDKHTLCDestination_UnknownNextHop);
11684         int64_t requested_forward_scid_conv = obj->unknown_next_hop.requested_forward_scid;
11685         return requested_forward_scid_conv;
11686 }
11687 int64_t CS_LDK_LDKHTLCDestination_InvalidForward_get_requested_forward_scid(int64_t ptr) {
11688         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
11689         CHECK(obj->tag == LDKHTLCDestination_InvalidForward);
11690         int64_t requested_forward_scid_conv = obj->invalid_forward.requested_forward_scid;
11691         return requested_forward_scid_conv;
11692 }
11693 int8_tArray CS_LDK_LDKHTLCDestination_FailedPayment_get_payment_hash(int64_t ptr) {
11694         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
11695         CHECK(obj->tag == LDKHTLCDestination_FailedPayment);
11696         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
11697         memcpy(payment_hash_arr->elems, obj->failed_payment.payment_hash.data, 32);
11698         return payment_hash_arr;
11699 }
11700 uint32_t CS_LDK_LDKCOption_HTLCDestinationZ_ty_from_ptr(int64_t ptr) {
11701         LDKCOption_HTLCDestinationZ *obj = (LDKCOption_HTLCDestinationZ*)untag_ptr(ptr);
11702         switch(obj->tag) {
11703                 case LDKCOption_HTLCDestinationZ_Some: return 0;
11704                 case LDKCOption_HTLCDestinationZ_None: return 1;
11705                 default: abort();
11706         }
11707 }
11708 int64_t CS_LDK_LDKCOption_HTLCDestinationZ_Some_get_some(int64_t ptr) {
11709         LDKCOption_HTLCDestinationZ *obj = (LDKCOption_HTLCDestinationZ*)untag_ptr(ptr);
11710         CHECK(obj->tag == LDKCOption_HTLCDestinationZ_Some);
11711         int64_t some_ref = tag_ptr(&obj->some, false);
11712         return some_ref;
11713 }
11714 static inline struct LDKCOption_HTLCDestinationZ CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR owner){
11715 CHECK(owner->result_ok);
11716         return COption_HTLCDestinationZ_clone(&*owner->contents.result);
11717 }
11718 int64_t  CS_LDK_CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(int64_t owner) {
11719         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* owner_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(owner);
11720         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
11721         *ret_copy = CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(owner_conv);
11722         int64_t ret_ref = tag_ptr(ret_copy, true);
11723         return ret_ref;
11724 }
11725
11726 static inline struct LDKDecodeError CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR owner){
11727 CHECK(!owner->result_ok);
11728         return DecodeError_clone(&*owner->contents.err);
11729 }
11730 int64_t  CS_LDK_CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(int64_t owner) {
11731         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* owner_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(owner);
11732         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11733         *ret_copy = CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(owner_conv);
11734         int64_t ret_ref = tag_ptr(ret_copy, true);
11735         return ret_ref;
11736 }
11737
11738 static inline enum LDKPaymentFailureReason CResult_PaymentFailureReasonDecodeErrorZ_get_ok(LDKCResult_PaymentFailureReasonDecodeErrorZ *NONNULL_PTR owner){
11739 CHECK(owner->result_ok);
11740         return PaymentFailureReason_clone(&*owner->contents.result);
11741 }
11742 int32_t  CS_LDK_CResult_PaymentFailureReasonDecodeErrorZ_get_ok(int64_t owner) {
11743         LDKCResult_PaymentFailureReasonDecodeErrorZ* owner_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(owner);
11744         int32_t ret_conv = LDKPaymentFailureReason_to_cs(CResult_PaymentFailureReasonDecodeErrorZ_get_ok(owner_conv));
11745         return ret_conv;
11746 }
11747
11748 static inline struct LDKDecodeError CResult_PaymentFailureReasonDecodeErrorZ_get_err(LDKCResult_PaymentFailureReasonDecodeErrorZ *NONNULL_PTR owner){
11749 CHECK(!owner->result_ok);
11750         return DecodeError_clone(&*owner->contents.err);
11751 }
11752 int64_t  CS_LDK_CResult_PaymentFailureReasonDecodeErrorZ_get_err(int64_t owner) {
11753         LDKCResult_PaymentFailureReasonDecodeErrorZ* owner_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(owner);
11754         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11755         *ret_copy = CResult_PaymentFailureReasonDecodeErrorZ_get_err(owner_conv);
11756         int64_t ret_ref = tag_ptr(ret_copy, true);
11757         return ret_ref;
11758 }
11759
11760 uint32_t CS_LDK_LDKCOption_U128Z_ty_from_ptr(int64_t ptr) {
11761         LDKCOption_U128Z *obj = (LDKCOption_U128Z*)untag_ptr(ptr);
11762         switch(obj->tag) {
11763                 case LDKCOption_U128Z_Some: return 0;
11764                 case LDKCOption_U128Z_None: return 1;
11765                 default: abort();
11766         }
11767 }
11768 int8_tArray CS_LDK_LDKCOption_U128Z_Some_get_some(int64_t ptr) {
11769         LDKCOption_U128Z *obj = (LDKCOption_U128Z*)untag_ptr(ptr);
11770         CHECK(obj->tag == LDKCOption_U128Z_Some);
11771         int8_tArray some_arr = init_int8_tArray(16, __LINE__);
11772         memcpy(some_arr->elems, obj->some.le_bytes, 16);
11773         return some_arr;
11774 }
11775 static inline LDKCVec_ClaimedHTLCZ CVec_ClaimedHTLCZ_clone(const LDKCVec_ClaimedHTLCZ *orig) {
11776         LDKCVec_ClaimedHTLCZ ret = { .data = MALLOC(sizeof(LDKClaimedHTLC) * orig->datalen, "LDKCVec_ClaimedHTLCZ clone bytes"), .datalen = orig->datalen };
11777         for (size_t i = 0; i < ret.datalen; i++) {
11778                 ret.data[i] = ClaimedHTLC_clone(&orig->data[i]);
11779         }
11780         return ret;
11781 }
11782 uint32_t CS_LDK_LDKCOption_PaymentFailureReasonZ_ty_from_ptr(int64_t ptr) {
11783         LDKCOption_PaymentFailureReasonZ *obj = (LDKCOption_PaymentFailureReasonZ*)untag_ptr(ptr);
11784         switch(obj->tag) {
11785                 case LDKCOption_PaymentFailureReasonZ_Some: return 0;
11786                 case LDKCOption_PaymentFailureReasonZ_None: return 1;
11787                 default: abort();
11788         }
11789 }
11790 int32_t CS_LDK_LDKCOption_PaymentFailureReasonZ_Some_get_some(int64_t ptr) {
11791         LDKCOption_PaymentFailureReasonZ *obj = (LDKCOption_PaymentFailureReasonZ*)untag_ptr(ptr);
11792         CHECK(obj->tag == LDKCOption_PaymentFailureReasonZ_Some);
11793         int32_t some_conv = LDKPaymentFailureReason_to_cs(obj->some);
11794         return some_conv;
11795 }
11796 uint32_t CS_LDK_LDKBumpTransactionEvent_ty_from_ptr(int64_t ptr) {
11797         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
11798         switch(obj->tag) {
11799                 case LDKBumpTransactionEvent_ChannelClose: return 0;
11800                 case LDKBumpTransactionEvent_HTLCResolution: return 1;
11801                 default: abort();
11802         }
11803 }
11804 int64_t CS_LDK_LDKBumpTransactionEvent_ChannelClose_get_channel_id(int64_t ptr) {
11805         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
11806         CHECK(obj->tag == LDKBumpTransactionEvent_ChannelClose);
11807         LDKChannelId channel_id_var = obj->channel_close.channel_id;
11808                         int64_t channel_id_ref = 0;
11809                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
11810                         channel_id_ref = tag_ptr(channel_id_var.inner, false);
11811         return channel_id_ref;
11812 }
11813 int8_tArray CS_LDK_LDKBumpTransactionEvent_ChannelClose_get_counterparty_node_id(int64_t ptr) {
11814         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
11815         CHECK(obj->tag == LDKBumpTransactionEvent_ChannelClose);
11816         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
11817         memcpy(counterparty_node_id_arr->elems, obj->channel_close.counterparty_node_id.compressed_form, 33);
11818         return counterparty_node_id_arr;
11819 }
11820 int8_tArray CS_LDK_LDKBumpTransactionEvent_ChannelClose_get_claim_id(int64_t ptr) {
11821         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
11822         CHECK(obj->tag == LDKBumpTransactionEvent_ChannelClose);
11823         int8_tArray claim_id_arr = init_int8_tArray(32, __LINE__);
11824         memcpy(claim_id_arr->elems, obj->channel_close.claim_id.data, 32);
11825         return claim_id_arr;
11826 }
11827 int32_t CS_LDK_LDKBumpTransactionEvent_ChannelClose_get_package_target_feerate_sat_per_1000_weight(int64_t ptr) {
11828         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
11829         CHECK(obj->tag == LDKBumpTransactionEvent_ChannelClose);
11830         int32_t package_target_feerate_sat_per_1000_weight_conv = obj->channel_close.package_target_feerate_sat_per_1000_weight;
11831         return package_target_feerate_sat_per_1000_weight_conv;
11832 }
11833 int8_tArray CS_LDK_LDKBumpTransactionEvent_ChannelClose_get_commitment_tx(int64_t ptr) {
11834         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
11835         CHECK(obj->tag == LDKBumpTransactionEvent_ChannelClose);
11836         LDKTransaction commitment_tx_var = obj->channel_close.commitment_tx;
11837                         int8_tArray commitment_tx_arr = init_int8_tArray(commitment_tx_var.datalen, __LINE__);
11838                         memcpy(commitment_tx_arr->elems, commitment_tx_var.data, commitment_tx_var.datalen);
11839         return commitment_tx_arr;
11840 }
11841 int64_t CS_LDK_LDKBumpTransactionEvent_ChannelClose_get_commitment_tx_fee_satoshis(int64_t ptr) {
11842         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
11843         CHECK(obj->tag == LDKBumpTransactionEvent_ChannelClose);
11844         int64_t commitment_tx_fee_satoshis_conv = obj->channel_close.commitment_tx_fee_satoshis;
11845         return commitment_tx_fee_satoshis_conv;
11846 }
11847 int64_t CS_LDK_LDKBumpTransactionEvent_ChannelClose_get_anchor_descriptor(int64_t ptr) {
11848         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
11849         CHECK(obj->tag == LDKBumpTransactionEvent_ChannelClose);
11850         LDKAnchorDescriptor anchor_descriptor_var = obj->channel_close.anchor_descriptor;
11851                         int64_t anchor_descriptor_ref = 0;
11852                         CHECK_INNER_FIELD_ACCESS_OR_NULL(anchor_descriptor_var);
11853                         anchor_descriptor_ref = tag_ptr(anchor_descriptor_var.inner, false);
11854         return anchor_descriptor_ref;
11855 }
11856 int64_tArray CS_LDK_LDKBumpTransactionEvent_ChannelClose_get_pending_htlcs(int64_t ptr) {
11857         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
11858         CHECK(obj->tag == LDKBumpTransactionEvent_ChannelClose);
11859         LDKCVec_HTLCOutputInCommitmentZ pending_htlcs_var = obj->channel_close.pending_htlcs;
11860                         int64_tArray pending_htlcs_arr = NULL;
11861                         pending_htlcs_arr = init_int64_tArray(pending_htlcs_var.datalen, __LINE__);
11862                         int64_t *pending_htlcs_arr_ptr = (int64_t*)(((uint8_t*)pending_htlcs_arr) + 8);
11863                         for (size_t y = 0; y < pending_htlcs_var.datalen; y++) {
11864                                 LDKHTLCOutputInCommitment pending_htlcs_conv_24_var = pending_htlcs_var.data[y];
11865                                 int64_t pending_htlcs_conv_24_ref = 0;
11866                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(pending_htlcs_conv_24_var);
11867                                 pending_htlcs_conv_24_ref = tag_ptr(pending_htlcs_conv_24_var.inner, false);
11868                                 pending_htlcs_arr_ptr[y] = pending_htlcs_conv_24_ref;
11869                         }
11870                         
11871         return pending_htlcs_arr;
11872 }
11873 int64_t CS_LDK_LDKBumpTransactionEvent_HTLCResolution_get_channel_id(int64_t ptr) {
11874         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
11875         CHECK(obj->tag == LDKBumpTransactionEvent_HTLCResolution);
11876         LDKChannelId channel_id_var = obj->htlc_resolution.channel_id;
11877                         int64_t channel_id_ref = 0;
11878                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
11879                         channel_id_ref = tag_ptr(channel_id_var.inner, false);
11880         return channel_id_ref;
11881 }
11882 int8_tArray CS_LDK_LDKBumpTransactionEvent_HTLCResolution_get_counterparty_node_id(int64_t ptr) {
11883         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
11884         CHECK(obj->tag == LDKBumpTransactionEvent_HTLCResolution);
11885         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
11886         memcpy(counterparty_node_id_arr->elems, obj->htlc_resolution.counterparty_node_id.compressed_form, 33);
11887         return counterparty_node_id_arr;
11888 }
11889 int8_tArray CS_LDK_LDKBumpTransactionEvent_HTLCResolution_get_claim_id(int64_t ptr) {
11890         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
11891         CHECK(obj->tag == LDKBumpTransactionEvent_HTLCResolution);
11892         int8_tArray claim_id_arr = init_int8_tArray(32, __LINE__);
11893         memcpy(claim_id_arr->elems, obj->htlc_resolution.claim_id.data, 32);
11894         return claim_id_arr;
11895 }
11896 int32_t CS_LDK_LDKBumpTransactionEvent_HTLCResolution_get_target_feerate_sat_per_1000_weight(int64_t ptr) {
11897         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
11898         CHECK(obj->tag == LDKBumpTransactionEvent_HTLCResolution);
11899         int32_t target_feerate_sat_per_1000_weight_conv = obj->htlc_resolution.target_feerate_sat_per_1000_weight;
11900         return target_feerate_sat_per_1000_weight_conv;
11901 }
11902 int64_tArray CS_LDK_LDKBumpTransactionEvent_HTLCResolution_get_htlc_descriptors(int64_t ptr) {
11903         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
11904         CHECK(obj->tag == LDKBumpTransactionEvent_HTLCResolution);
11905         LDKCVec_HTLCDescriptorZ htlc_descriptors_var = obj->htlc_resolution.htlc_descriptors;
11906                         int64_tArray htlc_descriptors_arr = NULL;
11907                         htlc_descriptors_arr = init_int64_tArray(htlc_descriptors_var.datalen, __LINE__);
11908                         int64_t *htlc_descriptors_arr_ptr = (int64_t*)(((uint8_t*)htlc_descriptors_arr) + 8);
11909                         for (size_t q = 0; q < htlc_descriptors_var.datalen; q++) {
11910                                 LDKHTLCDescriptor htlc_descriptors_conv_16_var = htlc_descriptors_var.data[q];
11911                                 int64_t htlc_descriptors_conv_16_ref = 0;
11912                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_descriptors_conv_16_var);
11913                                 htlc_descriptors_conv_16_ref = tag_ptr(htlc_descriptors_conv_16_var.inner, false);
11914                                 htlc_descriptors_arr_ptr[q] = htlc_descriptors_conv_16_ref;
11915                         }
11916                         
11917         return htlc_descriptors_arr;
11918 }
11919 int32_t CS_LDK_LDKBumpTransactionEvent_HTLCResolution_get_tx_lock_time(int64_t ptr) {
11920         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
11921         CHECK(obj->tag == LDKBumpTransactionEvent_HTLCResolution);
11922         int32_t tx_lock_time_conv = obj->htlc_resolution.tx_lock_time;
11923         return tx_lock_time_conv;
11924 }
11925 uint32_t CS_LDK_LDKEvent_ty_from_ptr(int64_t ptr) {
11926         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11927         switch(obj->tag) {
11928                 case LDKEvent_FundingGenerationReady: return 0;
11929                 case LDKEvent_PaymentClaimable: return 1;
11930                 case LDKEvent_PaymentClaimed: return 2;
11931                 case LDKEvent_ConnectionNeeded: return 3;
11932                 case LDKEvent_InvoiceRequestFailed: return 4;
11933                 case LDKEvent_PaymentSent: return 5;
11934                 case LDKEvent_PaymentFailed: return 6;
11935                 case LDKEvent_PaymentPathSuccessful: return 7;
11936                 case LDKEvent_PaymentPathFailed: return 8;
11937                 case LDKEvent_ProbeSuccessful: return 9;
11938                 case LDKEvent_ProbeFailed: return 10;
11939                 case LDKEvent_PendingHTLCsForwardable: return 11;
11940                 case LDKEvent_HTLCIntercepted: return 12;
11941                 case LDKEvent_SpendableOutputs: return 13;
11942                 case LDKEvent_PaymentForwarded: return 14;
11943                 case LDKEvent_ChannelPending: return 15;
11944                 case LDKEvent_ChannelReady: return 16;
11945                 case LDKEvent_ChannelClosed: return 17;
11946                 case LDKEvent_DiscardFunding: return 18;
11947                 case LDKEvent_OpenChannelRequest: return 19;
11948                 case LDKEvent_HTLCHandlingFailed: return 20;
11949                 case LDKEvent_BumpTransaction: return 21;
11950                 default: abort();
11951         }
11952 }
11953 int64_t CS_LDK_LDKEvent_FundingGenerationReady_get_temporary_channel_id(int64_t ptr) {
11954         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11955         CHECK(obj->tag == LDKEvent_FundingGenerationReady);
11956         LDKChannelId temporary_channel_id_var = obj->funding_generation_ready.temporary_channel_id;
11957                         int64_t temporary_channel_id_ref = 0;
11958                         CHECK_INNER_FIELD_ACCESS_OR_NULL(temporary_channel_id_var);
11959                         temporary_channel_id_ref = tag_ptr(temporary_channel_id_var.inner, false);
11960         return temporary_channel_id_ref;
11961 }
11962 int8_tArray CS_LDK_LDKEvent_FundingGenerationReady_get_counterparty_node_id(int64_t ptr) {
11963         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11964         CHECK(obj->tag == LDKEvent_FundingGenerationReady);
11965         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
11966         memcpy(counterparty_node_id_arr->elems, obj->funding_generation_ready.counterparty_node_id.compressed_form, 33);
11967         return counterparty_node_id_arr;
11968 }
11969 int64_t CS_LDK_LDKEvent_FundingGenerationReady_get_channel_value_satoshis(int64_t ptr) {
11970         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11971         CHECK(obj->tag == LDKEvent_FundingGenerationReady);
11972         int64_t channel_value_satoshis_conv = obj->funding_generation_ready.channel_value_satoshis;
11973         return channel_value_satoshis_conv;
11974 }
11975 int8_tArray CS_LDK_LDKEvent_FundingGenerationReady_get_output_script(int64_t ptr) {
11976         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11977         CHECK(obj->tag == LDKEvent_FundingGenerationReady);
11978         LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
11979                         int8_tArray output_script_arr = init_int8_tArray(output_script_var.datalen, __LINE__);
11980                         memcpy(output_script_arr->elems, output_script_var.data, output_script_var.datalen);
11981         return output_script_arr;
11982 }
11983 int8_tArray CS_LDK_LDKEvent_FundingGenerationReady_get_user_channel_id(int64_t ptr) {
11984         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11985         CHECK(obj->tag == LDKEvent_FundingGenerationReady);
11986         int8_tArray user_channel_id_arr = init_int8_tArray(16, __LINE__);
11987         memcpy(user_channel_id_arr->elems, obj->funding_generation_ready.user_channel_id.le_bytes, 16);
11988         return user_channel_id_arr;
11989 }
11990 int8_tArray CS_LDK_LDKEvent_PaymentClaimable_get_receiver_node_id(int64_t ptr) {
11991         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11992         CHECK(obj->tag == LDKEvent_PaymentClaimable);
11993         int8_tArray receiver_node_id_arr = init_int8_tArray(33, __LINE__);
11994         memcpy(receiver_node_id_arr->elems, obj->payment_claimable.receiver_node_id.compressed_form, 33);
11995         return receiver_node_id_arr;
11996 }
11997 int8_tArray CS_LDK_LDKEvent_PaymentClaimable_get_payment_hash(int64_t ptr) {
11998         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
11999         CHECK(obj->tag == LDKEvent_PaymentClaimable);
12000         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
12001         memcpy(payment_hash_arr->elems, obj->payment_claimable.payment_hash.data, 32);
12002         return payment_hash_arr;
12003 }
12004 int64_t CS_LDK_LDKEvent_PaymentClaimable_get_onion_fields(int64_t ptr) {
12005         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12006         CHECK(obj->tag == LDKEvent_PaymentClaimable);
12007         LDKRecipientOnionFields onion_fields_var = obj->payment_claimable.onion_fields;
12008                         int64_t onion_fields_ref = 0;
12009                         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_fields_var);
12010                         onion_fields_ref = tag_ptr(onion_fields_var.inner, false);
12011         return onion_fields_ref;
12012 }
12013 int64_t CS_LDK_LDKEvent_PaymentClaimable_get_amount_msat(int64_t ptr) {
12014         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12015         CHECK(obj->tag == LDKEvent_PaymentClaimable);
12016         int64_t amount_msat_conv = obj->payment_claimable.amount_msat;
12017         return amount_msat_conv;
12018 }
12019 int64_t CS_LDK_LDKEvent_PaymentClaimable_get_counterparty_skimmed_fee_msat(int64_t ptr) {
12020         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12021         CHECK(obj->tag == LDKEvent_PaymentClaimable);
12022         int64_t counterparty_skimmed_fee_msat_conv = obj->payment_claimable.counterparty_skimmed_fee_msat;
12023         return counterparty_skimmed_fee_msat_conv;
12024 }
12025 int64_t CS_LDK_LDKEvent_PaymentClaimable_get_purpose(int64_t ptr) {
12026         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12027         CHECK(obj->tag == LDKEvent_PaymentClaimable);
12028         int64_t purpose_ref = tag_ptr(&obj->payment_claimable.purpose, false);
12029         return purpose_ref;
12030 }
12031 int64_t CS_LDK_LDKEvent_PaymentClaimable_get_via_channel_id(int64_t ptr) {
12032         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12033         CHECK(obj->tag == LDKEvent_PaymentClaimable);
12034         LDKChannelId via_channel_id_var = obj->payment_claimable.via_channel_id;
12035                         int64_t via_channel_id_ref = 0;
12036                         CHECK_INNER_FIELD_ACCESS_OR_NULL(via_channel_id_var);
12037                         via_channel_id_ref = tag_ptr(via_channel_id_var.inner, false);
12038         return via_channel_id_ref;
12039 }
12040 int64_t CS_LDK_LDKEvent_PaymentClaimable_get_via_user_channel_id(int64_t ptr) {
12041         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12042         CHECK(obj->tag == LDKEvent_PaymentClaimable);
12043         int64_t via_user_channel_id_ref = tag_ptr(&obj->payment_claimable.via_user_channel_id, false);
12044         return via_user_channel_id_ref;
12045 }
12046 int64_t CS_LDK_LDKEvent_PaymentClaimable_get_claim_deadline(int64_t ptr) {
12047         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12048         CHECK(obj->tag == LDKEvent_PaymentClaimable);
12049         int64_t claim_deadline_ref = tag_ptr(&obj->payment_claimable.claim_deadline, false);
12050         return claim_deadline_ref;
12051 }
12052 int8_tArray CS_LDK_LDKEvent_PaymentClaimed_get_receiver_node_id(int64_t ptr) {
12053         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12054         CHECK(obj->tag == LDKEvent_PaymentClaimed);
12055         int8_tArray receiver_node_id_arr = init_int8_tArray(33, __LINE__);
12056         memcpy(receiver_node_id_arr->elems, obj->payment_claimed.receiver_node_id.compressed_form, 33);
12057         return receiver_node_id_arr;
12058 }
12059 int8_tArray CS_LDK_LDKEvent_PaymentClaimed_get_payment_hash(int64_t ptr) {
12060         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12061         CHECK(obj->tag == LDKEvent_PaymentClaimed);
12062         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
12063         memcpy(payment_hash_arr->elems, obj->payment_claimed.payment_hash.data, 32);
12064         return payment_hash_arr;
12065 }
12066 int64_t CS_LDK_LDKEvent_PaymentClaimed_get_amount_msat(int64_t ptr) {
12067         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12068         CHECK(obj->tag == LDKEvent_PaymentClaimed);
12069         int64_t amount_msat_conv = obj->payment_claimed.amount_msat;
12070         return amount_msat_conv;
12071 }
12072 int64_t CS_LDK_LDKEvent_PaymentClaimed_get_purpose(int64_t ptr) {
12073         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12074         CHECK(obj->tag == LDKEvent_PaymentClaimed);
12075         int64_t purpose_ref = tag_ptr(&obj->payment_claimed.purpose, false);
12076         return purpose_ref;
12077 }
12078 int64_tArray CS_LDK_LDKEvent_PaymentClaimed_get_htlcs(int64_t ptr) {
12079         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12080         CHECK(obj->tag == LDKEvent_PaymentClaimed);
12081         LDKCVec_ClaimedHTLCZ htlcs_var = obj->payment_claimed.htlcs;
12082                         int64_tArray htlcs_arr = NULL;
12083                         htlcs_arr = init_int64_tArray(htlcs_var.datalen, __LINE__);
12084                         int64_t *htlcs_arr_ptr = (int64_t*)(((uint8_t*)htlcs_arr) + 8);
12085                         for (size_t n = 0; n < htlcs_var.datalen; n++) {
12086                                 LDKClaimedHTLC htlcs_conv_13_var = htlcs_var.data[n];
12087                                 int64_t htlcs_conv_13_ref = 0;
12088                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlcs_conv_13_var);
12089                                 htlcs_conv_13_ref = tag_ptr(htlcs_conv_13_var.inner, false);
12090                                 htlcs_arr_ptr[n] = htlcs_conv_13_ref;
12091                         }
12092                         
12093         return htlcs_arr;
12094 }
12095 int64_t CS_LDK_LDKEvent_PaymentClaimed_get_sender_intended_total_msat(int64_t ptr) {
12096         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12097         CHECK(obj->tag == LDKEvent_PaymentClaimed);
12098         int64_t sender_intended_total_msat_ref = tag_ptr(&obj->payment_claimed.sender_intended_total_msat, false);
12099         return sender_intended_total_msat_ref;
12100 }
12101 int8_tArray CS_LDK_LDKEvent_ConnectionNeeded_get_node_id(int64_t ptr) {
12102         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12103         CHECK(obj->tag == LDKEvent_ConnectionNeeded);
12104         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
12105         memcpy(node_id_arr->elems, obj->connection_needed.node_id.compressed_form, 33);
12106         return node_id_arr;
12107 }
12108 int64_tArray CS_LDK_LDKEvent_ConnectionNeeded_get_addresses(int64_t ptr) {
12109         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12110         CHECK(obj->tag == LDKEvent_ConnectionNeeded);
12111         LDKCVec_SocketAddressZ addresses_var = obj->connection_needed.addresses;
12112                         int64_tArray addresses_arr = NULL;
12113                         addresses_arr = init_int64_tArray(addresses_var.datalen, __LINE__);
12114                         int64_t *addresses_arr_ptr = (int64_t*)(((uint8_t*)addresses_arr) + 8);
12115                         for (size_t p = 0; p < addresses_var.datalen; p++) {
12116                                 int64_t addresses_conv_15_ref = tag_ptr(&addresses_var.data[p], false);
12117                                 addresses_arr_ptr[p] = addresses_conv_15_ref;
12118                         }
12119                         
12120         return addresses_arr;
12121 }
12122 int8_tArray CS_LDK_LDKEvent_InvoiceRequestFailed_get_payment_id(int64_t ptr) {
12123         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12124         CHECK(obj->tag == LDKEvent_InvoiceRequestFailed);
12125         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
12126         memcpy(payment_id_arr->elems, obj->invoice_request_failed.payment_id.data, 32);
12127         return payment_id_arr;
12128 }
12129 int64_t CS_LDK_LDKEvent_PaymentSent_get_payment_id(int64_t ptr) {
12130         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12131         CHECK(obj->tag == LDKEvent_PaymentSent);
12132         int64_t payment_id_ref = tag_ptr(&obj->payment_sent.payment_id, false);
12133         return payment_id_ref;
12134 }
12135 int8_tArray CS_LDK_LDKEvent_PaymentSent_get_payment_preimage(int64_t ptr) {
12136         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12137         CHECK(obj->tag == LDKEvent_PaymentSent);
12138         int8_tArray payment_preimage_arr = init_int8_tArray(32, __LINE__);
12139         memcpy(payment_preimage_arr->elems, obj->payment_sent.payment_preimage.data, 32);
12140         return payment_preimage_arr;
12141 }
12142 int8_tArray CS_LDK_LDKEvent_PaymentSent_get_payment_hash(int64_t ptr) {
12143         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12144         CHECK(obj->tag == LDKEvent_PaymentSent);
12145         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
12146         memcpy(payment_hash_arr->elems, obj->payment_sent.payment_hash.data, 32);
12147         return payment_hash_arr;
12148 }
12149 int64_t CS_LDK_LDKEvent_PaymentSent_get_fee_paid_msat(int64_t ptr) {
12150         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12151         CHECK(obj->tag == LDKEvent_PaymentSent);
12152         int64_t fee_paid_msat_ref = tag_ptr(&obj->payment_sent.fee_paid_msat, false);
12153         return fee_paid_msat_ref;
12154 }
12155 int8_tArray CS_LDK_LDKEvent_PaymentFailed_get_payment_id(int64_t ptr) {
12156         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12157         CHECK(obj->tag == LDKEvent_PaymentFailed);
12158         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
12159         memcpy(payment_id_arr->elems, obj->payment_failed.payment_id.data, 32);
12160         return payment_id_arr;
12161 }
12162 int8_tArray CS_LDK_LDKEvent_PaymentFailed_get_payment_hash(int64_t ptr) {
12163         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12164         CHECK(obj->tag == LDKEvent_PaymentFailed);
12165         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
12166         memcpy(payment_hash_arr->elems, obj->payment_failed.payment_hash.data, 32);
12167         return payment_hash_arr;
12168 }
12169 int64_t CS_LDK_LDKEvent_PaymentFailed_get_reason(int64_t ptr) {
12170         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12171         CHECK(obj->tag == LDKEvent_PaymentFailed);
12172         int64_t reason_ref = tag_ptr(&obj->payment_failed.reason, false);
12173         return reason_ref;
12174 }
12175 int8_tArray CS_LDK_LDKEvent_PaymentPathSuccessful_get_payment_id(int64_t ptr) {
12176         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12177         CHECK(obj->tag == LDKEvent_PaymentPathSuccessful);
12178         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
12179         memcpy(payment_id_arr->elems, obj->payment_path_successful.payment_id.data, 32);
12180         return payment_id_arr;
12181 }
12182 int64_t CS_LDK_LDKEvent_PaymentPathSuccessful_get_payment_hash(int64_t ptr) {
12183         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12184         CHECK(obj->tag == LDKEvent_PaymentPathSuccessful);
12185         int64_t payment_hash_ref = tag_ptr(&obj->payment_path_successful.payment_hash, false);
12186         return payment_hash_ref;
12187 }
12188 int64_t CS_LDK_LDKEvent_PaymentPathSuccessful_get_path(int64_t ptr) {
12189         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12190         CHECK(obj->tag == LDKEvent_PaymentPathSuccessful);
12191         LDKPath path_var = obj->payment_path_successful.path;
12192                         int64_t path_ref = 0;
12193                         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
12194                         path_ref = tag_ptr(path_var.inner, false);
12195         return path_ref;
12196 }
12197 int64_t CS_LDK_LDKEvent_PaymentPathFailed_get_payment_id(int64_t ptr) {
12198         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12199         CHECK(obj->tag == LDKEvent_PaymentPathFailed);
12200         int64_t payment_id_ref = tag_ptr(&obj->payment_path_failed.payment_id, false);
12201         return payment_id_ref;
12202 }
12203 int8_tArray CS_LDK_LDKEvent_PaymentPathFailed_get_payment_hash(int64_t ptr) {
12204         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12205         CHECK(obj->tag == LDKEvent_PaymentPathFailed);
12206         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
12207         memcpy(payment_hash_arr->elems, obj->payment_path_failed.payment_hash.data, 32);
12208         return payment_hash_arr;
12209 }
12210 jboolean CS_LDK_LDKEvent_PaymentPathFailed_get_payment_failed_permanently(int64_t ptr) {
12211         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12212         CHECK(obj->tag == LDKEvent_PaymentPathFailed);
12213         jboolean payment_failed_permanently_conv = obj->payment_path_failed.payment_failed_permanently;
12214         return payment_failed_permanently_conv;
12215 }
12216 int64_t CS_LDK_LDKEvent_PaymentPathFailed_get_failure(int64_t ptr) {
12217         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12218         CHECK(obj->tag == LDKEvent_PaymentPathFailed);
12219         int64_t failure_ref = tag_ptr(&obj->payment_path_failed.failure, false);
12220         return failure_ref;
12221 }
12222 int64_t CS_LDK_LDKEvent_PaymentPathFailed_get_path(int64_t ptr) {
12223         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12224         CHECK(obj->tag == LDKEvent_PaymentPathFailed);
12225         LDKPath path_var = obj->payment_path_failed.path;
12226                         int64_t path_ref = 0;
12227                         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
12228                         path_ref = tag_ptr(path_var.inner, false);
12229         return path_ref;
12230 }
12231 int64_t CS_LDK_LDKEvent_PaymentPathFailed_get_short_channel_id(int64_t ptr) {
12232         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12233         CHECK(obj->tag == LDKEvent_PaymentPathFailed);
12234         int64_t short_channel_id_ref = tag_ptr(&obj->payment_path_failed.short_channel_id, false);
12235         return short_channel_id_ref;
12236 }
12237 int8_tArray CS_LDK_LDKEvent_ProbeSuccessful_get_payment_id(int64_t ptr) {
12238         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12239         CHECK(obj->tag == LDKEvent_ProbeSuccessful);
12240         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
12241         memcpy(payment_id_arr->elems, obj->probe_successful.payment_id.data, 32);
12242         return payment_id_arr;
12243 }
12244 int8_tArray CS_LDK_LDKEvent_ProbeSuccessful_get_payment_hash(int64_t ptr) {
12245         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12246         CHECK(obj->tag == LDKEvent_ProbeSuccessful);
12247         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
12248         memcpy(payment_hash_arr->elems, obj->probe_successful.payment_hash.data, 32);
12249         return payment_hash_arr;
12250 }
12251 int64_t CS_LDK_LDKEvent_ProbeSuccessful_get_path(int64_t ptr) {
12252         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12253         CHECK(obj->tag == LDKEvent_ProbeSuccessful);
12254         LDKPath path_var = obj->probe_successful.path;
12255                         int64_t path_ref = 0;
12256                         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
12257                         path_ref = tag_ptr(path_var.inner, false);
12258         return path_ref;
12259 }
12260 int8_tArray CS_LDK_LDKEvent_ProbeFailed_get_payment_id(int64_t ptr) {
12261         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12262         CHECK(obj->tag == LDKEvent_ProbeFailed);
12263         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
12264         memcpy(payment_id_arr->elems, obj->probe_failed.payment_id.data, 32);
12265         return payment_id_arr;
12266 }
12267 int8_tArray CS_LDK_LDKEvent_ProbeFailed_get_payment_hash(int64_t ptr) {
12268         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12269         CHECK(obj->tag == LDKEvent_ProbeFailed);
12270         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
12271         memcpy(payment_hash_arr->elems, obj->probe_failed.payment_hash.data, 32);
12272         return payment_hash_arr;
12273 }
12274 int64_t CS_LDK_LDKEvent_ProbeFailed_get_path(int64_t ptr) {
12275         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12276         CHECK(obj->tag == LDKEvent_ProbeFailed);
12277         LDKPath path_var = obj->probe_failed.path;
12278                         int64_t path_ref = 0;
12279                         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
12280                         path_ref = tag_ptr(path_var.inner, false);
12281         return path_ref;
12282 }
12283 int64_t CS_LDK_LDKEvent_ProbeFailed_get_short_channel_id(int64_t ptr) {
12284         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12285         CHECK(obj->tag == LDKEvent_ProbeFailed);
12286         int64_t short_channel_id_ref = tag_ptr(&obj->probe_failed.short_channel_id, false);
12287         return short_channel_id_ref;
12288 }
12289 int64_t CS_LDK_LDKEvent_PendingHTLCsForwardable_get_time_forwardable(int64_t ptr) {
12290         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12291         CHECK(obj->tag == LDKEvent_PendingHTLCsForwardable);
12292         int64_t time_forwardable_conv = obj->pending_htl_cs_forwardable.time_forwardable;
12293         return time_forwardable_conv;
12294 }
12295 int8_tArray CS_LDK_LDKEvent_HTLCIntercepted_get_intercept_id(int64_t ptr) {
12296         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12297         CHECK(obj->tag == LDKEvent_HTLCIntercepted);
12298         int8_tArray intercept_id_arr = init_int8_tArray(32, __LINE__);
12299         memcpy(intercept_id_arr->elems, obj->htlc_intercepted.intercept_id.data, 32);
12300         return intercept_id_arr;
12301 }
12302 int64_t CS_LDK_LDKEvent_HTLCIntercepted_get_requested_next_hop_scid(int64_t ptr) {
12303         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12304         CHECK(obj->tag == LDKEvent_HTLCIntercepted);
12305         int64_t requested_next_hop_scid_conv = obj->htlc_intercepted.requested_next_hop_scid;
12306         return requested_next_hop_scid_conv;
12307 }
12308 int8_tArray CS_LDK_LDKEvent_HTLCIntercepted_get_payment_hash(int64_t ptr) {
12309         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12310         CHECK(obj->tag == LDKEvent_HTLCIntercepted);
12311         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
12312         memcpy(payment_hash_arr->elems, obj->htlc_intercepted.payment_hash.data, 32);
12313         return payment_hash_arr;
12314 }
12315 int64_t CS_LDK_LDKEvent_HTLCIntercepted_get_inbound_amount_msat(int64_t ptr) {
12316         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12317         CHECK(obj->tag == LDKEvent_HTLCIntercepted);
12318         int64_t inbound_amount_msat_conv = obj->htlc_intercepted.inbound_amount_msat;
12319         return inbound_amount_msat_conv;
12320 }
12321 int64_t CS_LDK_LDKEvent_HTLCIntercepted_get_expected_outbound_amount_msat(int64_t ptr) {
12322         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12323         CHECK(obj->tag == LDKEvent_HTLCIntercepted);
12324         int64_t expected_outbound_amount_msat_conv = obj->htlc_intercepted.expected_outbound_amount_msat;
12325         return expected_outbound_amount_msat_conv;
12326 }
12327 int64_tArray CS_LDK_LDKEvent_SpendableOutputs_get_outputs(int64_t ptr) {
12328         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12329         CHECK(obj->tag == LDKEvent_SpendableOutputs);
12330         LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
12331                         int64_tArray outputs_arr = NULL;
12332                         outputs_arr = init_int64_tArray(outputs_var.datalen, __LINE__);
12333                         int64_t *outputs_arr_ptr = (int64_t*)(((uint8_t*)outputs_arr) + 8);
12334                         for (size_t b = 0; b < outputs_var.datalen; b++) {
12335                                 int64_t outputs_conv_27_ref = tag_ptr(&outputs_var.data[b], false);
12336                                 outputs_arr_ptr[b] = outputs_conv_27_ref;
12337                         }
12338                         
12339         return outputs_arr;
12340 }
12341 int64_t CS_LDK_LDKEvent_SpendableOutputs_get_channel_id(int64_t ptr) {
12342         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12343         CHECK(obj->tag == LDKEvent_SpendableOutputs);
12344         LDKChannelId channel_id_var = obj->spendable_outputs.channel_id;
12345                         int64_t channel_id_ref = 0;
12346                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
12347                         channel_id_ref = tag_ptr(channel_id_var.inner, false);
12348         return channel_id_ref;
12349 }
12350 int64_t CS_LDK_LDKEvent_PaymentForwarded_get_prev_channel_id(int64_t ptr) {
12351         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12352         CHECK(obj->tag == LDKEvent_PaymentForwarded);
12353         LDKChannelId prev_channel_id_var = obj->payment_forwarded.prev_channel_id;
12354                         int64_t prev_channel_id_ref = 0;
12355                         CHECK_INNER_FIELD_ACCESS_OR_NULL(prev_channel_id_var);
12356                         prev_channel_id_ref = tag_ptr(prev_channel_id_var.inner, false);
12357         return prev_channel_id_ref;
12358 }
12359 int64_t CS_LDK_LDKEvent_PaymentForwarded_get_next_channel_id(int64_t ptr) {
12360         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12361         CHECK(obj->tag == LDKEvent_PaymentForwarded);
12362         LDKChannelId next_channel_id_var = obj->payment_forwarded.next_channel_id;
12363                         int64_t next_channel_id_ref = 0;
12364                         CHECK_INNER_FIELD_ACCESS_OR_NULL(next_channel_id_var);
12365                         next_channel_id_ref = tag_ptr(next_channel_id_var.inner, false);
12366         return next_channel_id_ref;
12367 }
12368 int64_t CS_LDK_LDKEvent_PaymentForwarded_get_prev_user_channel_id(int64_t ptr) {
12369         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12370         CHECK(obj->tag == LDKEvent_PaymentForwarded);
12371         int64_t prev_user_channel_id_ref = tag_ptr(&obj->payment_forwarded.prev_user_channel_id, false);
12372         return prev_user_channel_id_ref;
12373 }
12374 int64_t CS_LDK_LDKEvent_PaymentForwarded_get_next_user_channel_id(int64_t ptr) {
12375         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12376         CHECK(obj->tag == LDKEvent_PaymentForwarded);
12377         int64_t next_user_channel_id_ref = tag_ptr(&obj->payment_forwarded.next_user_channel_id, false);
12378         return next_user_channel_id_ref;
12379 }
12380 int64_t CS_LDK_LDKEvent_PaymentForwarded_get_total_fee_earned_msat(int64_t ptr) {
12381         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12382         CHECK(obj->tag == LDKEvent_PaymentForwarded);
12383         int64_t total_fee_earned_msat_ref = tag_ptr(&obj->payment_forwarded.total_fee_earned_msat, false);
12384         return total_fee_earned_msat_ref;
12385 }
12386 int64_t CS_LDK_LDKEvent_PaymentForwarded_get_skimmed_fee_msat(int64_t ptr) {
12387         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12388         CHECK(obj->tag == LDKEvent_PaymentForwarded);
12389         int64_t skimmed_fee_msat_ref = tag_ptr(&obj->payment_forwarded.skimmed_fee_msat, false);
12390         return skimmed_fee_msat_ref;
12391 }
12392 jboolean CS_LDK_LDKEvent_PaymentForwarded_get_claim_from_onchain_tx(int64_t ptr) {
12393         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12394         CHECK(obj->tag == LDKEvent_PaymentForwarded);
12395         jboolean claim_from_onchain_tx_conv = obj->payment_forwarded.claim_from_onchain_tx;
12396         return claim_from_onchain_tx_conv;
12397 }
12398 int64_t CS_LDK_LDKEvent_PaymentForwarded_get_outbound_amount_forwarded_msat(int64_t ptr) {
12399         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12400         CHECK(obj->tag == LDKEvent_PaymentForwarded);
12401         int64_t outbound_amount_forwarded_msat_ref = tag_ptr(&obj->payment_forwarded.outbound_amount_forwarded_msat, false);
12402         return outbound_amount_forwarded_msat_ref;
12403 }
12404 int64_t CS_LDK_LDKEvent_ChannelPending_get_channel_id(int64_t ptr) {
12405         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12406         CHECK(obj->tag == LDKEvent_ChannelPending);
12407         LDKChannelId channel_id_var = obj->channel_pending.channel_id;
12408                         int64_t channel_id_ref = 0;
12409                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
12410                         channel_id_ref = tag_ptr(channel_id_var.inner, false);
12411         return channel_id_ref;
12412 }
12413 int8_tArray CS_LDK_LDKEvent_ChannelPending_get_user_channel_id(int64_t ptr) {
12414         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12415         CHECK(obj->tag == LDKEvent_ChannelPending);
12416         int8_tArray user_channel_id_arr = init_int8_tArray(16, __LINE__);
12417         memcpy(user_channel_id_arr->elems, obj->channel_pending.user_channel_id.le_bytes, 16);
12418         return user_channel_id_arr;
12419 }
12420 int64_t CS_LDK_LDKEvent_ChannelPending_get_former_temporary_channel_id(int64_t ptr) {
12421         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12422         CHECK(obj->tag == LDKEvent_ChannelPending);
12423         LDKChannelId former_temporary_channel_id_var = obj->channel_pending.former_temporary_channel_id;
12424                         int64_t former_temporary_channel_id_ref = 0;
12425                         CHECK_INNER_FIELD_ACCESS_OR_NULL(former_temporary_channel_id_var);
12426                         former_temporary_channel_id_ref = tag_ptr(former_temporary_channel_id_var.inner, false);
12427         return former_temporary_channel_id_ref;
12428 }
12429 int8_tArray CS_LDK_LDKEvent_ChannelPending_get_counterparty_node_id(int64_t ptr) {
12430         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12431         CHECK(obj->tag == LDKEvent_ChannelPending);
12432         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
12433         memcpy(counterparty_node_id_arr->elems, obj->channel_pending.counterparty_node_id.compressed_form, 33);
12434         return counterparty_node_id_arr;
12435 }
12436 int64_t CS_LDK_LDKEvent_ChannelPending_get_funding_txo(int64_t ptr) {
12437         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12438         CHECK(obj->tag == LDKEvent_ChannelPending);
12439         LDKOutPoint funding_txo_var = obj->channel_pending.funding_txo;
12440                         int64_t funding_txo_ref = 0;
12441                         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
12442                         funding_txo_ref = tag_ptr(funding_txo_var.inner, false);
12443         return funding_txo_ref;
12444 }
12445 int64_t CS_LDK_LDKEvent_ChannelPending_get_channel_type(int64_t ptr) {
12446         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12447         CHECK(obj->tag == LDKEvent_ChannelPending);
12448         LDKChannelTypeFeatures channel_type_var = obj->channel_pending.channel_type;
12449                         int64_t channel_type_ref = 0;
12450                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_var);
12451                         channel_type_ref = tag_ptr(channel_type_var.inner, false);
12452         return channel_type_ref;
12453 }
12454 int64_t CS_LDK_LDKEvent_ChannelReady_get_channel_id(int64_t ptr) {
12455         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12456         CHECK(obj->tag == LDKEvent_ChannelReady);
12457         LDKChannelId channel_id_var = obj->channel_ready.channel_id;
12458                         int64_t channel_id_ref = 0;
12459                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
12460                         channel_id_ref = tag_ptr(channel_id_var.inner, false);
12461         return channel_id_ref;
12462 }
12463 int8_tArray CS_LDK_LDKEvent_ChannelReady_get_user_channel_id(int64_t ptr) {
12464         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12465         CHECK(obj->tag == LDKEvent_ChannelReady);
12466         int8_tArray user_channel_id_arr = init_int8_tArray(16, __LINE__);
12467         memcpy(user_channel_id_arr->elems, obj->channel_ready.user_channel_id.le_bytes, 16);
12468         return user_channel_id_arr;
12469 }
12470 int8_tArray CS_LDK_LDKEvent_ChannelReady_get_counterparty_node_id(int64_t ptr) {
12471         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12472         CHECK(obj->tag == LDKEvent_ChannelReady);
12473         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
12474         memcpy(counterparty_node_id_arr->elems, obj->channel_ready.counterparty_node_id.compressed_form, 33);
12475         return counterparty_node_id_arr;
12476 }
12477 int64_t CS_LDK_LDKEvent_ChannelReady_get_channel_type(int64_t ptr) {
12478         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12479         CHECK(obj->tag == LDKEvent_ChannelReady);
12480         LDKChannelTypeFeatures channel_type_var = obj->channel_ready.channel_type;
12481                         int64_t channel_type_ref = 0;
12482                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_var);
12483                         channel_type_ref = tag_ptr(channel_type_var.inner, false);
12484         return channel_type_ref;
12485 }
12486 int64_t CS_LDK_LDKEvent_ChannelClosed_get_channel_id(int64_t ptr) {
12487         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12488         CHECK(obj->tag == LDKEvent_ChannelClosed);
12489         LDKChannelId channel_id_var = obj->channel_closed.channel_id;
12490                         int64_t channel_id_ref = 0;
12491                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
12492                         channel_id_ref = tag_ptr(channel_id_var.inner, false);
12493         return channel_id_ref;
12494 }
12495 int8_tArray CS_LDK_LDKEvent_ChannelClosed_get_user_channel_id(int64_t ptr) {
12496         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12497         CHECK(obj->tag == LDKEvent_ChannelClosed);
12498         int8_tArray user_channel_id_arr = init_int8_tArray(16, __LINE__);
12499         memcpy(user_channel_id_arr->elems, obj->channel_closed.user_channel_id.le_bytes, 16);
12500         return user_channel_id_arr;
12501 }
12502 int64_t CS_LDK_LDKEvent_ChannelClosed_get_reason(int64_t ptr) {
12503         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12504         CHECK(obj->tag == LDKEvent_ChannelClosed);
12505         int64_t reason_ref = tag_ptr(&obj->channel_closed.reason, false);
12506         return reason_ref;
12507 }
12508 int8_tArray CS_LDK_LDKEvent_ChannelClosed_get_counterparty_node_id(int64_t ptr) {
12509         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12510         CHECK(obj->tag == LDKEvent_ChannelClosed);
12511         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
12512         memcpy(counterparty_node_id_arr->elems, obj->channel_closed.counterparty_node_id.compressed_form, 33);
12513         return counterparty_node_id_arr;
12514 }
12515 int64_t CS_LDK_LDKEvent_ChannelClosed_get_channel_capacity_sats(int64_t ptr) {
12516         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12517         CHECK(obj->tag == LDKEvent_ChannelClosed);
12518         int64_t channel_capacity_sats_ref = tag_ptr(&obj->channel_closed.channel_capacity_sats, false);
12519         return channel_capacity_sats_ref;
12520 }
12521 int64_t CS_LDK_LDKEvent_ChannelClosed_get_channel_funding_txo(int64_t ptr) {
12522         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12523         CHECK(obj->tag == LDKEvent_ChannelClosed);
12524         LDKOutPoint channel_funding_txo_var = obj->channel_closed.channel_funding_txo;
12525                         int64_t channel_funding_txo_ref = 0;
12526                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_funding_txo_var);
12527                         channel_funding_txo_ref = tag_ptr(channel_funding_txo_var.inner, false);
12528         return channel_funding_txo_ref;
12529 }
12530 int64_t CS_LDK_LDKEvent_DiscardFunding_get_channel_id(int64_t ptr) {
12531         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12532         CHECK(obj->tag == LDKEvent_DiscardFunding);
12533         LDKChannelId channel_id_var = obj->discard_funding.channel_id;
12534                         int64_t channel_id_ref = 0;
12535                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
12536                         channel_id_ref = tag_ptr(channel_id_var.inner, false);
12537         return channel_id_ref;
12538 }
12539 int8_tArray CS_LDK_LDKEvent_DiscardFunding_get_transaction(int64_t ptr) {
12540         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12541         CHECK(obj->tag == LDKEvent_DiscardFunding);
12542         LDKTransaction transaction_var = obj->discard_funding.transaction;
12543                         int8_tArray transaction_arr = init_int8_tArray(transaction_var.datalen, __LINE__);
12544                         memcpy(transaction_arr->elems, transaction_var.data, transaction_var.datalen);
12545         return transaction_arr;
12546 }
12547 int64_t CS_LDK_LDKEvent_OpenChannelRequest_get_temporary_channel_id(int64_t ptr) {
12548         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12549         CHECK(obj->tag == LDKEvent_OpenChannelRequest);
12550         LDKChannelId temporary_channel_id_var = obj->open_channel_request.temporary_channel_id;
12551                         int64_t temporary_channel_id_ref = 0;
12552                         CHECK_INNER_FIELD_ACCESS_OR_NULL(temporary_channel_id_var);
12553                         temporary_channel_id_ref = tag_ptr(temporary_channel_id_var.inner, false);
12554         return temporary_channel_id_ref;
12555 }
12556 int8_tArray CS_LDK_LDKEvent_OpenChannelRequest_get_counterparty_node_id(int64_t ptr) {
12557         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12558         CHECK(obj->tag == LDKEvent_OpenChannelRequest);
12559         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
12560         memcpy(counterparty_node_id_arr->elems, obj->open_channel_request.counterparty_node_id.compressed_form, 33);
12561         return counterparty_node_id_arr;
12562 }
12563 int64_t CS_LDK_LDKEvent_OpenChannelRequest_get_funding_satoshis(int64_t ptr) {
12564         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12565         CHECK(obj->tag == LDKEvent_OpenChannelRequest);
12566         int64_t funding_satoshis_conv = obj->open_channel_request.funding_satoshis;
12567         return funding_satoshis_conv;
12568 }
12569 int64_t CS_LDK_LDKEvent_OpenChannelRequest_get_push_msat(int64_t ptr) {
12570         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12571         CHECK(obj->tag == LDKEvent_OpenChannelRequest);
12572         int64_t push_msat_conv = obj->open_channel_request.push_msat;
12573         return push_msat_conv;
12574 }
12575 int64_t CS_LDK_LDKEvent_OpenChannelRequest_get_channel_type(int64_t ptr) {
12576         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12577         CHECK(obj->tag == LDKEvent_OpenChannelRequest);
12578         LDKChannelTypeFeatures channel_type_var = obj->open_channel_request.channel_type;
12579                         int64_t channel_type_ref = 0;
12580                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_var);
12581                         channel_type_ref = tag_ptr(channel_type_var.inner, false);
12582         return channel_type_ref;
12583 }
12584 int64_t CS_LDK_LDKEvent_HTLCHandlingFailed_get_prev_channel_id(int64_t ptr) {
12585         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12586         CHECK(obj->tag == LDKEvent_HTLCHandlingFailed);
12587         LDKChannelId prev_channel_id_var = obj->htlc_handling_failed.prev_channel_id;
12588                         int64_t prev_channel_id_ref = 0;
12589                         CHECK_INNER_FIELD_ACCESS_OR_NULL(prev_channel_id_var);
12590                         prev_channel_id_ref = tag_ptr(prev_channel_id_var.inner, false);
12591         return prev_channel_id_ref;
12592 }
12593 int64_t CS_LDK_LDKEvent_HTLCHandlingFailed_get_failed_next_destination(int64_t ptr) {
12594         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12595         CHECK(obj->tag == LDKEvent_HTLCHandlingFailed);
12596         int64_t failed_next_destination_ref = tag_ptr(&obj->htlc_handling_failed.failed_next_destination, false);
12597         return failed_next_destination_ref;
12598 }
12599 int64_t CS_LDK_LDKEvent_BumpTransaction_get_bump_transaction(int64_t ptr) {
12600         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12601         CHECK(obj->tag == LDKEvent_BumpTransaction);
12602         int64_t bump_transaction_ref = tag_ptr(&obj->bump_transaction, false);
12603         return bump_transaction_ref;
12604 }
12605 uint32_t CS_LDK_LDKCOption_EventZ_ty_from_ptr(int64_t ptr) {
12606         LDKCOption_EventZ *obj = (LDKCOption_EventZ*)untag_ptr(ptr);
12607         switch(obj->tag) {
12608                 case LDKCOption_EventZ_Some: return 0;
12609                 case LDKCOption_EventZ_None: return 1;
12610                 default: abort();
12611         }
12612 }
12613 int64_t CS_LDK_LDKCOption_EventZ_Some_get_some(int64_t ptr) {
12614         LDKCOption_EventZ *obj = (LDKCOption_EventZ*)untag_ptr(ptr);
12615         CHECK(obj->tag == LDKCOption_EventZ_Some);
12616         int64_t some_ref = tag_ptr(&obj->some, false);
12617         return some_ref;
12618 }
12619 static inline struct LDKCOption_EventZ CResult_COption_EventZDecodeErrorZ_get_ok(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
12620 CHECK(owner->result_ok);
12621         return COption_EventZ_clone(&*owner->contents.result);
12622 }
12623 int64_t  CS_LDK_CResult_COption_EventZDecodeErrorZ_get_ok(int64_t owner) {
12624         LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(owner);
12625         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
12626         *ret_copy = CResult_COption_EventZDecodeErrorZ_get_ok(owner_conv);
12627         int64_t ret_ref = tag_ptr(ret_copy, true);
12628         return ret_ref;
12629 }
12630
12631 static inline struct LDKDecodeError CResult_COption_EventZDecodeErrorZ_get_err(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
12632 CHECK(!owner->result_ok);
12633         return DecodeError_clone(&*owner->contents.err);
12634 }
12635 int64_t  CS_LDK_CResult_COption_EventZDecodeErrorZ_get_err(int64_t owner) {
12636         LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(owner);
12637         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12638         *ret_copy = CResult_COption_EventZDecodeErrorZ_get_err(owner_conv);
12639         int64_t ret_ref = tag_ptr(ret_copy, true);
12640         return ret_ref;
12641 }
12642
12643 uint32_t CS_LDK_LDKBolt11ParseError_ty_from_ptr(int64_t ptr) {
12644         LDKBolt11ParseError *obj = (LDKBolt11ParseError*)untag_ptr(ptr);
12645         switch(obj->tag) {
12646                 case LDKBolt11ParseError_Bech32Error: return 0;
12647                 case LDKBolt11ParseError_ParseAmountError: return 1;
12648                 case LDKBolt11ParseError_MalformedSignature: return 2;
12649                 case LDKBolt11ParseError_BadPrefix: return 3;
12650                 case LDKBolt11ParseError_UnknownCurrency: return 4;
12651                 case LDKBolt11ParseError_UnknownSiPrefix: return 5;
12652                 case LDKBolt11ParseError_MalformedHRP: return 6;
12653                 case LDKBolt11ParseError_TooShortDataPart: return 7;
12654                 case LDKBolt11ParseError_UnexpectedEndOfTaggedFields: return 8;
12655                 case LDKBolt11ParseError_DescriptionDecodeError: return 9;
12656                 case LDKBolt11ParseError_PaddingError: return 10;
12657                 case LDKBolt11ParseError_IntegerOverflowError: return 11;
12658                 case LDKBolt11ParseError_InvalidSegWitProgramLength: return 12;
12659                 case LDKBolt11ParseError_InvalidPubKeyHashLength: return 13;
12660                 case LDKBolt11ParseError_InvalidScriptHashLength: return 14;
12661                 case LDKBolt11ParseError_InvalidRecoveryId: return 15;
12662                 case LDKBolt11ParseError_InvalidSliceLength: return 16;
12663                 case LDKBolt11ParseError_Skip: return 17;
12664                 default: abort();
12665         }
12666 }
12667 int64_t CS_LDK_LDKBolt11ParseError_Bech32Error_get_bech32_error(int64_t ptr) {
12668         LDKBolt11ParseError *obj = (LDKBolt11ParseError*)untag_ptr(ptr);
12669         CHECK(obj->tag == LDKBolt11ParseError_Bech32Error);
12670         int64_t bech32_error_ref = tag_ptr(&obj->bech32_error, false);
12671         return bech32_error_ref;
12672 }
12673 int32_t CS_LDK_LDKBolt11ParseError_ParseAmountError_get_parse_amount_error(int64_t ptr) {
12674         LDKBolt11ParseError *obj = (LDKBolt11ParseError*)untag_ptr(ptr);
12675         CHECK(obj->tag == LDKBolt11ParseError_ParseAmountError);
12676         /*obj->parse_amount_error*/
12677         return 0;
12678 }
12679 int32_t CS_LDK_LDKBolt11ParseError_MalformedSignature_get_malformed_signature(int64_t ptr) {
12680         LDKBolt11ParseError *obj = (LDKBolt11ParseError*)untag_ptr(ptr);
12681         CHECK(obj->tag == LDKBolt11ParseError_MalformedSignature);
12682         int32_t malformed_signature_conv = LDKSecp256k1Error_to_cs(obj->malformed_signature);
12683         return malformed_signature_conv;
12684 }
12685 int32_t CS_LDK_LDKBolt11ParseError_DescriptionDecodeError_get_description_decode_error(int64_t ptr) {
12686         LDKBolt11ParseError *obj = (LDKBolt11ParseError*)untag_ptr(ptr);
12687         CHECK(obj->tag == LDKBolt11ParseError_DescriptionDecodeError);
12688         /*obj->description_decode_error*/
12689         return 0;
12690 }
12691 jstring CS_LDK_LDKBolt11ParseError_InvalidSliceLength_get_invalid_slice_length(int64_t ptr) {
12692         LDKBolt11ParseError *obj = (LDKBolt11ParseError*)untag_ptr(ptr);
12693         CHECK(obj->tag == LDKBolt11ParseError_InvalidSliceLength);
12694         LDKStr invalid_slice_length_str = obj->invalid_slice_length;
12695                         jstring invalid_slice_length_conv = str_ref_to_cs(invalid_slice_length_str.chars, invalid_slice_length_str.len);
12696         return invalid_slice_length_conv;
12697 }
12698 static inline enum LDKSiPrefix CResult_SiPrefixBolt11ParseErrorZ_get_ok(LDKCResult_SiPrefixBolt11ParseErrorZ *NONNULL_PTR owner){
12699 CHECK(owner->result_ok);
12700         return SiPrefix_clone(&*owner->contents.result);
12701 }
12702 int32_t  CS_LDK_CResult_SiPrefixBolt11ParseErrorZ_get_ok(int64_t owner) {
12703         LDKCResult_SiPrefixBolt11ParseErrorZ* owner_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(owner);
12704         int32_t ret_conv = LDKSiPrefix_to_cs(CResult_SiPrefixBolt11ParseErrorZ_get_ok(owner_conv));
12705         return ret_conv;
12706 }
12707
12708 static inline struct LDKBolt11ParseError CResult_SiPrefixBolt11ParseErrorZ_get_err(LDKCResult_SiPrefixBolt11ParseErrorZ *NONNULL_PTR owner){
12709 CHECK(!owner->result_ok);
12710         return Bolt11ParseError_clone(&*owner->contents.err);
12711 }
12712 int64_t  CS_LDK_CResult_SiPrefixBolt11ParseErrorZ_get_err(int64_t owner) {
12713         LDKCResult_SiPrefixBolt11ParseErrorZ* owner_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(owner);
12714         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
12715         *ret_copy = CResult_SiPrefixBolt11ParseErrorZ_get_err(owner_conv);
12716         int64_t ret_ref = tag_ptr(ret_copy, true);
12717         return ret_ref;
12718 }
12719
12720 uint32_t CS_LDK_LDKParseOrSemanticError_ty_from_ptr(int64_t ptr) {
12721         LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)untag_ptr(ptr);
12722         switch(obj->tag) {
12723                 case LDKParseOrSemanticError_ParseError: return 0;
12724                 case LDKParseOrSemanticError_SemanticError: return 1;
12725                 default: abort();
12726         }
12727 }
12728 int64_t CS_LDK_LDKParseOrSemanticError_ParseError_get_parse_error(int64_t ptr) {
12729         LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)untag_ptr(ptr);
12730         CHECK(obj->tag == LDKParseOrSemanticError_ParseError);
12731         int64_t parse_error_ref = tag_ptr(&obj->parse_error, false);
12732         return parse_error_ref;
12733 }
12734 int32_t CS_LDK_LDKParseOrSemanticError_SemanticError_get_semantic_error(int64_t ptr) {
12735         LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)untag_ptr(ptr);
12736         CHECK(obj->tag == LDKParseOrSemanticError_SemanticError);
12737         int32_t semantic_error_conv = LDKBolt11SemanticError_to_cs(obj->semantic_error);
12738         return semantic_error_conv;
12739 }
12740 static inline struct LDKBolt11Invoice CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_ok(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){
12741         LDKBolt11Invoice ret = *owner->contents.result;
12742         ret.is_owned = false;
12743         return ret;
12744 }
12745 int64_t  CS_LDK_CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_ok(int64_t owner) {
12746         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(owner);
12747         LDKBolt11Invoice ret_var = CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_ok(owner_conv);
12748         int64_t ret_ref = 0;
12749         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12750         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12751         return ret_ref;
12752 }
12753
12754 static inline struct LDKParseOrSemanticError CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_err(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){
12755 CHECK(!owner->result_ok);
12756         return ParseOrSemanticError_clone(&*owner->contents.err);
12757 }
12758 int64_t  CS_LDK_CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_err(int64_t owner) {
12759         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(owner);
12760         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
12761         *ret_copy = CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_err(owner_conv);
12762         int64_t ret_ref = tag_ptr(ret_copy, true);
12763         return ret_ref;
12764 }
12765
12766 static inline struct LDKSignedRawBolt11Invoice CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_ok(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ *NONNULL_PTR owner){
12767         LDKSignedRawBolt11Invoice ret = *owner->contents.result;
12768         ret.is_owned = false;
12769         return ret;
12770 }
12771 int64_t  CS_LDK_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_ok(int64_t owner) {
12772         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* owner_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(owner);
12773         LDKSignedRawBolt11Invoice ret_var = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_ok(owner_conv);
12774         int64_t ret_ref = 0;
12775         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12776         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12777         return ret_ref;
12778 }
12779
12780 static inline struct LDKBolt11ParseError CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_err(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ *NONNULL_PTR owner){
12781 CHECK(!owner->result_ok);
12782         return Bolt11ParseError_clone(&*owner->contents.err);
12783 }
12784 int64_t  CS_LDK_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_err(int64_t owner) {
12785         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* owner_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(owner);
12786         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
12787         *ret_copy = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_err(owner_conv);
12788         int64_t ret_ref = tag_ptr(ret_copy, true);
12789         return ret_ref;
12790 }
12791
12792 static inline struct LDKRawBolt11Invoice C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_a(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ *NONNULL_PTR owner){
12793         LDKRawBolt11Invoice ret = owner->a;
12794         ret.is_owned = false;
12795         return ret;
12796 }
12797 int64_t  CS_LDK_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_a(int64_t owner) {
12798         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(owner);
12799         LDKRawBolt11Invoice ret_var = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_a(owner_conv);
12800         int64_t ret_ref = 0;
12801         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12802         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12803         return ret_ref;
12804 }
12805
12806 static inline struct LDKThirtyTwoBytes C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_b(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ *NONNULL_PTR owner){
12807         return ThirtyTwoBytes_clone(&owner->b);
12808 }
12809 int8_tArray  CS_LDK_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_b(int64_t owner) {
12810         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(owner);
12811         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
12812         memcpy(ret_arr->elems, C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_b(owner_conv).data, 32);
12813         return ret_arr;
12814 }
12815
12816 static inline struct LDKBolt11InvoiceSignature C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_c(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ *NONNULL_PTR owner){
12817         LDKBolt11InvoiceSignature ret = owner->c;
12818         ret.is_owned = false;
12819         return ret;
12820 }
12821 int64_t  CS_LDK_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_c(int64_t owner) {
12822         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(owner);
12823         LDKBolt11InvoiceSignature ret_var = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_c(owner_conv);
12824         int64_t ret_ref = 0;
12825         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12826         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12827         return ret_ref;
12828 }
12829
12830 static inline struct LDKPayeePubKey CResult_PayeePubKeySecp256k1ErrorZ_get_ok(LDKCResult_PayeePubKeySecp256k1ErrorZ *NONNULL_PTR owner){
12831         LDKPayeePubKey ret = *owner->contents.result;
12832         ret.is_owned = false;
12833         return ret;
12834 }
12835 int64_t  CS_LDK_CResult_PayeePubKeySecp256k1ErrorZ_get_ok(int64_t owner) {
12836         LDKCResult_PayeePubKeySecp256k1ErrorZ* owner_conv = (LDKCResult_PayeePubKeySecp256k1ErrorZ*)untag_ptr(owner);
12837         LDKPayeePubKey ret_var = CResult_PayeePubKeySecp256k1ErrorZ_get_ok(owner_conv);
12838         int64_t ret_ref = 0;
12839         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12840         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12841         return ret_ref;
12842 }
12843
12844 static inline enum LDKSecp256k1Error CResult_PayeePubKeySecp256k1ErrorZ_get_err(LDKCResult_PayeePubKeySecp256k1ErrorZ *NONNULL_PTR owner){
12845 CHECK(!owner->result_ok);
12846         return *owner->contents.err;
12847 }
12848 int32_t  CS_LDK_CResult_PayeePubKeySecp256k1ErrorZ_get_err(int64_t owner) {
12849         LDKCResult_PayeePubKeySecp256k1ErrorZ* owner_conv = (LDKCResult_PayeePubKeySecp256k1ErrorZ*)untag_ptr(owner);
12850         int32_t ret_conv = LDKSecp256k1Error_to_cs(CResult_PayeePubKeySecp256k1ErrorZ_get_err(owner_conv));
12851         return ret_conv;
12852 }
12853
12854 static inline LDKCVec_PrivateRouteZ CVec_PrivateRouteZ_clone(const LDKCVec_PrivateRouteZ *orig) {
12855         LDKCVec_PrivateRouteZ ret = { .data = MALLOC(sizeof(LDKPrivateRoute) * orig->datalen, "LDKCVec_PrivateRouteZ clone bytes"), .datalen = orig->datalen };
12856         for (size_t i = 0; i < ret.datalen; i++) {
12857                 ret.data[i] = PrivateRoute_clone(&orig->data[i]);
12858         }
12859         return ret;
12860 }
12861 static inline struct LDKPositiveTimestamp CResult_PositiveTimestampCreationErrorZ_get_ok(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
12862         LDKPositiveTimestamp ret = *owner->contents.result;
12863         ret.is_owned = false;
12864         return ret;
12865 }
12866 int64_t  CS_LDK_CResult_PositiveTimestampCreationErrorZ_get_ok(int64_t owner) {
12867         LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(owner);
12868         LDKPositiveTimestamp ret_var = CResult_PositiveTimestampCreationErrorZ_get_ok(owner_conv);
12869         int64_t ret_ref = 0;
12870         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12871         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12872         return ret_ref;
12873 }
12874
12875 static inline enum LDKCreationError CResult_PositiveTimestampCreationErrorZ_get_err(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
12876 CHECK(!owner->result_ok);
12877         return CreationError_clone(&*owner->contents.err);
12878 }
12879 int32_t  CS_LDK_CResult_PositiveTimestampCreationErrorZ_get_err(int64_t owner) {
12880         LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(owner);
12881         int32_t ret_conv = LDKCreationError_to_cs(CResult_PositiveTimestampCreationErrorZ_get_err(owner_conv));
12882         return ret_conv;
12883 }
12884
12885 static inline void CResult_NoneBolt11SemanticErrorZ_get_ok(LDKCResult_NoneBolt11SemanticErrorZ *NONNULL_PTR owner){
12886 CHECK(owner->result_ok);
12887         return *owner->contents.result;
12888 }
12889 void  CS_LDK_CResult_NoneBolt11SemanticErrorZ_get_ok(int64_t owner) {
12890         LDKCResult_NoneBolt11SemanticErrorZ* owner_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(owner);
12891         CResult_NoneBolt11SemanticErrorZ_get_ok(owner_conv);
12892 }
12893
12894 static inline enum LDKBolt11SemanticError CResult_NoneBolt11SemanticErrorZ_get_err(LDKCResult_NoneBolt11SemanticErrorZ *NONNULL_PTR owner){
12895 CHECK(!owner->result_ok);
12896         return Bolt11SemanticError_clone(&*owner->contents.err);
12897 }
12898 int32_t  CS_LDK_CResult_NoneBolt11SemanticErrorZ_get_err(int64_t owner) {
12899         LDKCResult_NoneBolt11SemanticErrorZ* owner_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(owner);
12900         int32_t ret_conv = LDKBolt11SemanticError_to_cs(CResult_NoneBolt11SemanticErrorZ_get_err(owner_conv));
12901         return ret_conv;
12902 }
12903
12904 static inline struct LDKBolt11Invoice CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_ok(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ *NONNULL_PTR owner){
12905         LDKBolt11Invoice ret = *owner->contents.result;
12906         ret.is_owned = false;
12907         return ret;
12908 }
12909 int64_t  CS_LDK_CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_ok(int64_t owner) {
12910         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(owner);
12911         LDKBolt11Invoice ret_var = CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_ok(owner_conv);
12912         int64_t ret_ref = 0;
12913         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12914         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12915         return ret_ref;
12916 }
12917
12918 static inline enum LDKBolt11SemanticError CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_err(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ *NONNULL_PTR owner){
12919 CHECK(!owner->result_ok);
12920         return Bolt11SemanticError_clone(&*owner->contents.err);
12921 }
12922 int32_t  CS_LDK_CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_err(int64_t owner) {
12923         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(owner);
12924         int32_t ret_conv = LDKBolt11SemanticError_to_cs(CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_err(owner_conv));
12925         return ret_conv;
12926 }
12927
12928 static inline struct LDKDescription CResult_DescriptionCreationErrorZ_get_ok(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
12929         LDKDescription ret = *owner->contents.result;
12930         ret.is_owned = false;
12931         return ret;
12932 }
12933 int64_t  CS_LDK_CResult_DescriptionCreationErrorZ_get_ok(int64_t owner) {
12934         LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(owner);
12935         LDKDescription ret_var = CResult_DescriptionCreationErrorZ_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 enum LDKCreationError CResult_DescriptionCreationErrorZ_get_err(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
12943 CHECK(!owner->result_ok);
12944         return CreationError_clone(&*owner->contents.err);
12945 }
12946 int32_t  CS_LDK_CResult_DescriptionCreationErrorZ_get_err(int64_t owner) {
12947         LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(owner);
12948         int32_t ret_conv = LDKCreationError_to_cs(CResult_DescriptionCreationErrorZ_get_err(owner_conv));
12949         return ret_conv;
12950 }
12951
12952 static inline struct LDKPrivateRoute CResult_PrivateRouteCreationErrorZ_get_ok(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
12953         LDKPrivateRoute ret = *owner->contents.result;
12954         ret.is_owned = false;
12955         return ret;
12956 }
12957 int64_t  CS_LDK_CResult_PrivateRouteCreationErrorZ_get_ok(int64_t owner) {
12958         LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(owner);
12959         LDKPrivateRoute ret_var = CResult_PrivateRouteCreationErrorZ_get_ok(owner_conv);
12960         int64_t ret_ref = 0;
12961         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12962         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12963         return ret_ref;
12964 }
12965
12966 static inline enum LDKCreationError CResult_PrivateRouteCreationErrorZ_get_err(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
12967 CHECK(!owner->result_ok);
12968         return CreationError_clone(&*owner->contents.err);
12969 }
12970 int32_t  CS_LDK_CResult_PrivateRouteCreationErrorZ_get_err(int64_t owner) {
12971         LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(owner);
12972         int32_t ret_conv = LDKCreationError_to_cs(CResult_PrivateRouteCreationErrorZ_get_err(owner_conv));
12973         return ret_conv;
12974 }
12975
12976 static inline struct LDKOutPoint CResult_OutPointDecodeErrorZ_get_ok(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
12977         LDKOutPoint ret = *owner->contents.result;
12978         ret.is_owned = false;
12979         return ret;
12980 }
12981 int64_t  CS_LDK_CResult_OutPointDecodeErrorZ_get_ok(int64_t owner) {
12982         LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(owner);
12983         LDKOutPoint ret_var = CResult_OutPointDecodeErrorZ_get_ok(owner_conv);
12984         int64_t ret_ref = 0;
12985         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12986         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12987         return ret_ref;
12988 }
12989
12990 static inline struct LDKDecodeError CResult_OutPointDecodeErrorZ_get_err(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
12991 CHECK(!owner->result_ok);
12992         return DecodeError_clone(&*owner->contents.err);
12993 }
12994 int64_t  CS_LDK_CResult_OutPointDecodeErrorZ_get_err(int64_t owner) {
12995         LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(owner);
12996         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12997         *ret_copy = CResult_OutPointDecodeErrorZ_get_err(owner_conv);
12998         int64_t ret_ref = tag_ptr(ret_copy, true);
12999         return ret_ref;
13000 }
13001
13002 static inline struct LDKBigSize CResult_BigSizeDecodeErrorZ_get_ok(LDKCResult_BigSizeDecodeErrorZ *NONNULL_PTR owner){
13003         LDKBigSize ret = *owner->contents.result;
13004         ret.is_owned = false;
13005         return ret;
13006 }
13007 int64_t  CS_LDK_CResult_BigSizeDecodeErrorZ_get_ok(int64_t owner) {
13008         LDKCResult_BigSizeDecodeErrorZ* owner_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(owner);
13009         LDKBigSize ret_var = CResult_BigSizeDecodeErrorZ_get_ok(owner_conv);
13010         int64_t ret_ref = 0;
13011         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13012         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13013         return ret_ref;
13014 }
13015
13016 static inline struct LDKDecodeError CResult_BigSizeDecodeErrorZ_get_err(LDKCResult_BigSizeDecodeErrorZ *NONNULL_PTR owner){
13017 CHECK(!owner->result_ok);
13018         return DecodeError_clone(&*owner->contents.err);
13019 }
13020 int64_t  CS_LDK_CResult_BigSizeDecodeErrorZ_get_err(int64_t owner) {
13021         LDKCResult_BigSizeDecodeErrorZ* owner_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(owner);
13022         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13023         *ret_copy = CResult_BigSizeDecodeErrorZ_get_err(owner_conv);
13024         int64_t ret_ref = tag_ptr(ret_copy, true);
13025         return ret_ref;
13026 }
13027
13028 static inline struct LDKHostname CResult_HostnameDecodeErrorZ_get_ok(LDKCResult_HostnameDecodeErrorZ *NONNULL_PTR owner){
13029         LDKHostname ret = *owner->contents.result;
13030         ret.is_owned = false;
13031         return ret;
13032 }
13033 int64_t  CS_LDK_CResult_HostnameDecodeErrorZ_get_ok(int64_t owner) {
13034         LDKCResult_HostnameDecodeErrorZ* owner_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(owner);
13035         LDKHostname ret_var = CResult_HostnameDecodeErrorZ_get_ok(owner_conv);
13036         int64_t ret_ref = 0;
13037         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13038         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13039         return ret_ref;
13040 }
13041
13042 static inline struct LDKDecodeError CResult_HostnameDecodeErrorZ_get_err(LDKCResult_HostnameDecodeErrorZ *NONNULL_PTR owner){
13043 CHECK(!owner->result_ok);
13044         return DecodeError_clone(&*owner->contents.err);
13045 }
13046 int64_t  CS_LDK_CResult_HostnameDecodeErrorZ_get_err(int64_t owner) {
13047         LDKCResult_HostnameDecodeErrorZ* owner_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(owner);
13048         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13049         *ret_copy = CResult_HostnameDecodeErrorZ_get_err(owner_conv);
13050         int64_t ret_ref = tag_ptr(ret_copy, true);
13051         return ret_ref;
13052 }
13053
13054 static inline struct LDKTransactionU16LenLimited CResult_TransactionU16LenLimitedNoneZ_get_ok(LDKCResult_TransactionU16LenLimitedNoneZ *NONNULL_PTR owner){
13055         LDKTransactionU16LenLimited ret = *owner->contents.result;
13056         ret.is_owned = false;
13057         return ret;
13058 }
13059 int64_t  CS_LDK_CResult_TransactionU16LenLimitedNoneZ_get_ok(int64_t owner) {
13060         LDKCResult_TransactionU16LenLimitedNoneZ* owner_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(owner);
13061         LDKTransactionU16LenLimited ret_var = CResult_TransactionU16LenLimitedNoneZ_get_ok(owner_conv);
13062         int64_t ret_ref = 0;
13063         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13064         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13065         return ret_ref;
13066 }
13067
13068 static inline void CResult_TransactionU16LenLimitedNoneZ_get_err(LDKCResult_TransactionU16LenLimitedNoneZ *NONNULL_PTR owner){
13069 CHECK(!owner->result_ok);
13070         return *owner->contents.err;
13071 }
13072 void  CS_LDK_CResult_TransactionU16LenLimitedNoneZ_get_err(int64_t owner) {
13073         LDKCResult_TransactionU16LenLimitedNoneZ* owner_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(owner);
13074         CResult_TransactionU16LenLimitedNoneZ_get_err(owner_conv);
13075 }
13076
13077 static inline struct LDKTransactionU16LenLimited CResult_TransactionU16LenLimitedDecodeErrorZ_get_ok(LDKCResult_TransactionU16LenLimitedDecodeErrorZ *NONNULL_PTR owner){
13078         LDKTransactionU16LenLimited ret = *owner->contents.result;
13079         ret.is_owned = false;
13080         return ret;
13081 }
13082 int64_t  CS_LDK_CResult_TransactionU16LenLimitedDecodeErrorZ_get_ok(int64_t owner) {
13083         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* owner_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(owner);
13084         LDKTransactionU16LenLimited ret_var = CResult_TransactionU16LenLimitedDecodeErrorZ_get_ok(owner_conv);
13085         int64_t ret_ref = 0;
13086         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13087         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13088         return ret_ref;
13089 }
13090
13091 static inline struct LDKDecodeError CResult_TransactionU16LenLimitedDecodeErrorZ_get_err(LDKCResult_TransactionU16LenLimitedDecodeErrorZ *NONNULL_PTR owner){
13092 CHECK(!owner->result_ok);
13093         return DecodeError_clone(&*owner->contents.err);
13094 }
13095 int64_t  CS_LDK_CResult_TransactionU16LenLimitedDecodeErrorZ_get_err(int64_t owner) {
13096         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* owner_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(owner);
13097         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13098         *ret_copy = CResult_TransactionU16LenLimitedDecodeErrorZ_get_err(owner_conv);
13099         int64_t ret_ref = tag_ptr(ret_copy, true);
13100         return ret_ref;
13101 }
13102
13103 static inline struct LDKUntrustedString CResult_UntrustedStringDecodeErrorZ_get_ok(LDKCResult_UntrustedStringDecodeErrorZ *NONNULL_PTR owner){
13104         LDKUntrustedString ret = *owner->contents.result;
13105         ret.is_owned = false;
13106         return ret;
13107 }
13108 int64_t  CS_LDK_CResult_UntrustedStringDecodeErrorZ_get_ok(int64_t owner) {
13109         LDKCResult_UntrustedStringDecodeErrorZ* owner_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(owner);
13110         LDKUntrustedString ret_var = CResult_UntrustedStringDecodeErrorZ_get_ok(owner_conv);
13111         int64_t ret_ref = 0;
13112         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13113         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13114         return ret_ref;
13115 }
13116
13117 static inline struct LDKDecodeError CResult_UntrustedStringDecodeErrorZ_get_err(LDKCResult_UntrustedStringDecodeErrorZ *NONNULL_PTR owner){
13118 CHECK(!owner->result_ok);
13119         return DecodeError_clone(&*owner->contents.err);
13120 }
13121 int64_t  CS_LDK_CResult_UntrustedStringDecodeErrorZ_get_err(int64_t owner) {
13122         LDKCResult_UntrustedStringDecodeErrorZ* owner_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(owner);
13123         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13124         *ret_copy = CResult_UntrustedStringDecodeErrorZ_get_err(owner_conv);
13125         int64_t ret_ref = tag_ptr(ret_copy, true);
13126         return ret_ref;
13127 }
13128
13129 static inline struct LDKChannelId CResult_ChannelIdDecodeErrorZ_get_ok(LDKCResult_ChannelIdDecodeErrorZ *NONNULL_PTR owner){
13130         LDKChannelId ret = *owner->contents.result;
13131         ret.is_owned = false;
13132         return ret;
13133 }
13134 int64_t  CS_LDK_CResult_ChannelIdDecodeErrorZ_get_ok(int64_t owner) {
13135         LDKCResult_ChannelIdDecodeErrorZ* owner_conv = (LDKCResult_ChannelIdDecodeErrorZ*)untag_ptr(owner);
13136         LDKChannelId ret_var = CResult_ChannelIdDecodeErrorZ_get_ok(owner_conv);
13137         int64_t ret_ref = 0;
13138         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13139         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13140         return ret_ref;
13141 }
13142
13143 static inline struct LDKDecodeError CResult_ChannelIdDecodeErrorZ_get_err(LDKCResult_ChannelIdDecodeErrorZ *NONNULL_PTR owner){
13144 CHECK(!owner->result_ok);
13145         return DecodeError_clone(&*owner->contents.err);
13146 }
13147 int64_t  CS_LDK_CResult_ChannelIdDecodeErrorZ_get_err(int64_t owner) {
13148         LDKCResult_ChannelIdDecodeErrorZ* owner_conv = (LDKCResult_ChannelIdDecodeErrorZ*)untag_ptr(owner);
13149         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13150         *ret_copy = CResult_ChannelIdDecodeErrorZ_get_err(owner_conv);
13151         int64_t ret_ref = tag_ptr(ret_copy, true);
13152         return ret_ref;
13153 }
13154
13155 static inline struct LDKThirtyTwoBytes C2Tuple__u832u16Z_get_a(LDKC2Tuple__u832u16Z *NONNULL_PTR owner){
13156         return ThirtyTwoBytes_clone(&owner->a);
13157 }
13158 int8_tArray  CS_LDK_C2Tuple__u832u16Z_get_a(int64_t owner) {
13159         LDKC2Tuple__u832u16Z* owner_conv = (LDKC2Tuple__u832u16Z*)untag_ptr(owner);
13160         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
13161         memcpy(ret_arr->elems, C2Tuple__u832u16Z_get_a(owner_conv).data, 32);
13162         return ret_arr;
13163 }
13164
13165 static inline uint16_t C2Tuple__u832u16Z_get_b(LDKC2Tuple__u832u16Z *NONNULL_PTR owner){
13166         return owner->b;
13167 }
13168 int16_t  CS_LDK_C2Tuple__u832u16Z_get_b(int64_t owner) {
13169         LDKC2Tuple__u832u16Z* owner_conv = (LDKC2Tuple__u832u16Z*)untag_ptr(owner);
13170         int16_t ret_conv = C2Tuple__u832u16Z_get_b(owner_conv);
13171         return ret_conv;
13172 }
13173
13174 static inline struct LDKPaymentRelay CResult_PaymentRelayDecodeErrorZ_get_ok(LDKCResult_PaymentRelayDecodeErrorZ *NONNULL_PTR owner){
13175         LDKPaymentRelay ret = *owner->contents.result;
13176         ret.is_owned = false;
13177         return ret;
13178 }
13179 int64_t  CS_LDK_CResult_PaymentRelayDecodeErrorZ_get_ok(int64_t owner) {
13180         LDKCResult_PaymentRelayDecodeErrorZ* owner_conv = (LDKCResult_PaymentRelayDecodeErrorZ*)untag_ptr(owner);
13181         LDKPaymentRelay ret_var = CResult_PaymentRelayDecodeErrorZ_get_ok(owner_conv);
13182         int64_t ret_ref = 0;
13183         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13184         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13185         return ret_ref;
13186 }
13187
13188 static inline struct LDKDecodeError CResult_PaymentRelayDecodeErrorZ_get_err(LDKCResult_PaymentRelayDecodeErrorZ *NONNULL_PTR owner){
13189 CHECK(!owner->result_ok);
13190         return DecodeError_clone(&*owner->contents.err);
13191 }
13192 int64_t  CS_LDK_CResult_PaymentRelayDecodeErrorZ_get_err(int64_t owner) {
13193         LDKCResult_PaymentRelayDecodeErrorZ* owner_conv = (LDKCResult_PaymentRelayDecodeErrorZ*)untag_ptr(owner);
13194         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13195         *ret_copy = CResult_PaymentRelayDecodeErrorZ_get_err(owner_conv);
13196         int64_t ret_ref = tag_ptr(ret_copy, true);
13197         return ret_ref;
13198 }
13199
13200 static inline struct LDKPaymentConstraints CResult_PaymentConstraintsDecodeErrorZ_get_ok(LDKCResult_PaymentConstraintsDecodeErrorZ *NONNULL_PTR owner){
13201         LDKPaymentConstraints ret = *owner->contents.result;
13202         ret.is_owned = false;
13203         return ret;
13204 }
13205 int64_t  CS_LDK_CResult_PaymentConstraintsDecodeErrorZ_get_ok(int64_t owner) {
13206         LDKCResult_PaymentConstraintsDecodeErrorZ* owner_conv = (LDKCResult_PaymentConstraintsDecodeErrorZ*)untag_ptr(owner);
13207         LDKPaymentConstraints ret_var = CResult_PaymentConstraintsDecodeErrorZ_get_ok(owner_conv);
13208         int64_t ret_ref = 0;
13209         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13210         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13211         return ret_ref;
13212 }
13213
13214 static inline struct LDKDecodeError CResult_PaymentConstraintsDecodeErrorZ_get_err(LDKCResult_PaymentConstraintsDecodeErrorZ *NONNULL_PTR owner){
13215 CHECK(!owner->result_ok);
13216         return DecodeError_clone(&*owner->contents.err);
13217 }
13218 int64_t  CS_LDK_CResult_PaymentConstraintsDecodeErrorZ_get_err(int64_t owner) {
13219         LDKCResult_PaymentConstraintsDecodeErrorZ* owner_conv = (LDKCResult_PaymentConstraintsDecodeErrorZ*)untag_ptr(owner);
13220         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13221         *ret_copy = CResult_PaymentConstraintsDecodeErrorZ_get_err(owner_conv);
13222         int64_t ret_ref = tag_ptr(ret_copy, true);
13223         return ret_ref;
13224 }
13225
13226 static inline struct LDKPaymentContext CResult_PaymentContextDecodeErrorZ_get_ok(LDKCResult_PaymentContextDecodeErrorZ *NONNULL_PTR owner){
13227 CHECK(owner->result_ok);
13228         return PaymentContext_clone(&*owner->contents.result);
13229 }
13230 int64_t  CS_LDK_CResult_PaymentContextDecodeErrorZ_get_ok(int64_t owner) {
13231         LDKCResult_PaymentContextDecodeErrorZ* owner_conv = (LDKCResult_PaymentContextDecodeErrorZ*)untag_ptr(owner);
13232         LDKPaymentContext *ret_copy = MALLOC(sizeof(LDKPaymentContext), "LDKPaymentContext");
13233         *ret_copy = CResult_PaymentContextDecodeErrorZ_get_ok(owner_conv);
13234         int64_t ret_ref = tag_ptr(ret_copy, true);
13235         return ret_ref;
13236 }
13237
13238 static inline struct LDKDecodeError CResult_PaymentContextDecodeErrorZ_get_err(LDKCResult_PaymentContextDecodeErrorZ *NONNULL_PTR owner){
13239 CHECK(!owner->result_ok);
13240         return DecodeError_clone(&*owner->contents.err);
13241 }
13242 int64_t  CS_LDK_CResult_PaymentContextDecodeErrorZ_get_err(int64_t owner) {
13243         LDKCResult_PaymentContextDecodeErrorZ* owner_conv = (LDKCResult_PaymentContextDecodeErrorZ*)untag_ptr(owner);
13244         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13245         *ret_copy = CResult_PaymentContextDecodeErrorZ_get_err(owner_conv);
13246         int64_t ret_ref = tag_ptr(ret_copy, true);
13247         return ret_ref;
13248 }
13249
13250 static inline struct LDKUnknownPaymentContext CResult_UnknownPaymentContextDecodeErrorZ_get_ok(LDKCResult_UnknownPaymentContextDecodeErrorZ *NONNULL_PTR owner){
13251         LDKUnknownPaymentContext ret = *owner->contents.result;
13252         ret.is_owned = false;
13253         return ret;
13254 }
13255 int64_t  CS_LDK_CResult_UnknownPaymentContextDecodeErrorZ_get_ok(int64_t owner) {
13256         LDKCResult_UnknownPaymentContextDecodeErrorZ* owner_conv = (LDKCResult_UnknownPaymentContextDecodeErrorZ*)untag_ptr(owner);
13257         LDKUnknownPaymentContext ret_var = CResult_UnknownPaymentContextDecodeErrorZ_get_ok(owner_conv);
13258         int64_t ret_ref = 0;
13259         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13260         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13261         return ret_ref;
13262 }
13263
13264 static inline struct LDKDecodeError CResult_UnknownPaymentContextDecodeErrorZ_get_err(LDKCResult_UnknownPaymentContextDecodeErrorZ *NONNULL_PTR owner){
13265 CHECK(!owner->result_ok);
13266         return DecodeError_clone(&*owner->contents.err);
13267 }
13268 int64_t  CS_LDK_CResult_UnknownPaymentContextDecodeErrorZ_get_err(int64_t owner) {
13269         LDKCResult_UnknownPaymentContextDecodeErrorZ* owner_conv = (LDKCResult_UnknownPaymentContextDecodeErrorZ*)untag_ptr(owner);
13270         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13271         *ret_copy = CResult_UnknownPaymentContextDecodeErrorZ_get_err(owner_conv);
13272         int64_t ret_ref = tag_ptr(ret_copy, true);
13273         return ret_ref;
13274 }
13275
13276 static inline struct LDKBolt12OfferContext CResult_Bolt12OfferContextDecodeErrorZ_get_ok(LDKCResult_Bolt12OfferContextDecodeErrorZ *NONNULL_PTR owner){
13277         LDKBolt12OfferContext ret = *owner->contents.result;
13278         ret.is_owned = false;
13279         return ret;
13280 }
13281 int64_t  CS_LDK_CResult_Bolt12OfferContextDecodeErrorZ_get_ok(int64_t owner) {
13282         LDKCResult_Bolt12OfferContextDecodeErrorZ* owner_conv = (LDKCResult_Bolt12OfferContextDecodeErrorZ*)untag_ptr(owner);
13283         LDKBolt12OfferContext ret_var = CResult_Bolt12OfferContextDecodeErrorZ_get_ok(owner_conv);
13284         int64_t ret_ref = 0;
13285         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13286         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13287         return ret_ref;
13288 }
13289
13290 static inline struct LDKDecodeError CResult_Bolt12OfferContextDecodeErrorZ_get_err(LDKCResult_Bolt12OfferContextDecodeErrorZ *NONNULL_PTR owner){
13291 CHECK(!owner->result_ok);
13292         return DecodeError_clone(&*owner->contents.err);
13293 }
13294 int64_t  CS_LDK_CResult_Bolt12OfferContextDecodeErrorZ_get_err(int64_t owner) {
13295         LDKCResult_Bolt12OfferContextDecodeErrorZ* owner_conv = (LDKCResult_Bolt12OfferContextDecodeErrorZ*)untag_ptr(owner);
13296         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13297         *ret_copy = CResult_Bolt12OfferContextDecodeErrorZ_get_err(owner_conv);
13298         int64_t ret_ref = tag_ptr(ret_copy, true);
13299         return ret_ref;
13300 }
13301
13302 static inline struct LDKBolt12RefundContext CResult_Bolt12RefundContextDecodeErrorZ_get_ok(LDKCResult_Bolt12RefundContextDecodeErrorZ *NONNULL_PTR owner){
13303         LDKBolt12RefundContext ret = *owner->contents.result;
13304         ret.is_owned = false;
13305         return ret;
13306 }
13307 int64_t  CS_LDK_CResult_Bolt12RefundContextDecodeErrorZ_get_ok(int64_t owner) {
13308         LDKCResult_Bolt12RefundContextDecodeErrorZ* owner_conv = (LDKCResult_Bolt12RefundContextDecodeErrorZ*)untag_ptr(owner);
13309         LDKBolt12RefundContext ret_var = CResult_Bolt12RefundContextDecodeErrorZ_get_ok(owner_conv);
13310         int64_t ret_ref = 0;
13311         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13312         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13313         return ret_ref;
13314 }
13315
13316 static inline struct LDKDecodeError CResult_Bolt12RefundContextDecodeErrorZ_get_err(LDKCResult_Bolt12RefundContextDecodeErrorZ *NONNULL_PTR owner){
13317 CHECK(!owner->result_ok);
13318         return DecodeError_clone(&*owner->contents.err);
13319 }
13320 int64_t  CS_LDK_CResult_Bolt12RefundContextDecodeErrorZ_get_err(int64_t owner) {
13321         LDKCResult_Bolt12RefundContextDecodeErrorZ* owner_conv = (LDKCResult_Bolt12RefundContextDecodeErrorZ*)untag_ptr(owner);
13322         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13323         *ret_copy = CResult_Bolt12RefundContextDecodeErrorZ_get_err(owner_conv);
13324         int64_t ret_ref = tag_ptr(ret_copy, true);
13325         return ret_ref;
13326 }
13327
13328 static inline struct LDKStr CResult_StrSecp256k1ErrorZ_get_ok(LDKCResult_StrSecp256k1ErrorZ *NONNULL_PTR owner){
13329 CHECK(owner->result_ok);
13330         return *owner->contents.result;
13331 }
13332 jstring  CS_LDK_CResult_StrSecp256k1ErrorZ_get_ok(int64_t owner) {
13333         LDKCResult_StrSecp256k1ErrorZ* owner_conv = (LDKCResult_StrSecp256k1ErrorZ*)untag_ptr(owner);
13334         LDKStr ret_str = CResult_StrSecp256k1ErrorZ_get_ok(owner_conv);
13335         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
13336         return ret_conv;
13337 }
13338
13339 static inline enum LDKSecp256k1Error CResult_StrSecp256k1ErrorZ_get_err(LDKCResult_StrSecp256k1ErrorZ *NONNULL_PTR owner){
13340 CHECK(!owner->result_ok);
13341         return *owner->contents.err;
13342 }
13343 int32_t  CS_LDK_CResult_StrSecp256k1ErrorZ_get_err(int64_t owner) {
13344         LDKCResult_StrSecp256k1ErrorZ* owner_conv = (LDKCResult_StrSecp256k1ErrorZ*)untag_ptr(owner);
13345         int32_t ret_conv = LDKSecp256k1Error_to_cs(CResult_StrSecp256k1ErrorZ_get_err(owner_conv));
13346         return ret_conv;
13347 }
13348
13349 static inline struct LDKThirtyTwoBytes C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_a(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ *NONNULL_PTR owner){
13350         return ThirtyTwoBytes_clone(&owner->a);
13351 }
13352 int8_tArray  CS_LDK_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_a(int64_t owner) {
13353         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* owner_conv = (LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ*)untag_ptr(owner);
13354         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
13355         memcpy(ret_arr->elems, C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_a(owner_conv).data, 32);
13356         return ret_arr;
13357 }
13358
13359 static inline struct LDKRecipientOnionFields C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_b(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ *NONNULL_PTR owner){
13360         LDKRecipientOnionFields ret = owner->b;
13361         ret.is_owned = false;
13362         return ret;
13363 }
13364 int64_t  CS_LDK_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_b(int64_t owner) {
13365         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* owner_conv = (LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ*)untag_ptr(owner);
13366         LDKRecipientOnionFields ret_var = C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_b(owner_conv);
13367         int64_t ret_ref = 0;
13368         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13369         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13370         return ret_ref;
13371 }
13372
13373 static inline struct LDKRouteParameters C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_c(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ *NONNULL_PTR owner){
13374         LDKRouteParameters ret = owner->c;
13375         ret.is_owned = false;
13376         return ret;
13377 }
13378 int64_t  CS_LDK_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_c(int64_t owner) {
13379         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* owner_conv = (LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ*)untag_ptr(owner);
13380         LDKRouteParameters ret_var = C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_c(owner_conv);
13381         int64_t ret_ref = 0;
13382         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13383         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13384         return ret_ref;
13385 }
13386
13387 static inline struct LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_get_ok(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ *NONNULL_PTR owner){
13388 CHECK(owner->result_ok);
13389         return C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone(&*owner->contents.result);
13390 }
13391 int64_t  CS_LDK_CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_get_ok(int64_t owner) {
13392         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* owner_conv = (LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ*)untag_ptr(owner);
13393         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ), "LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ");
13394         *ret_conv = CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_get_ok(owner_conv);
13395         return tag_ptr(ret_conv, true);
13396 }
13397
13398 static inline void CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_get_err(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ *NONNULL_PTR owner){
13399 CHECK(!owner->result_ok);
13400         return *owner->contents.err;
13401 }
13402 void  CS_LDK_CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_get_err(int64_t owner) {
13403         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* owner_conv = (LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ*)untag_ptr(owner);
13404         CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_get_err(owner_conv);
13405 }
13406
13407 static inline struct LDKPublicKey C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_a(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ *NONNULL_PTR owner){
13408         return owner->a;
13409 }
13410 int8_tArray  CS_LDK_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_a(int64_t owner) {
13411         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* owner_conv = (LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ*)untag_ptr(owner);
13412         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
13413         memcpy(ret_arr->elems, C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_a(owner_conv).compressed_form, 33);
13414         return ret_arr;
13415 }
13416
13417 static inline struct LDKOnionMessage C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_b(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ *NONNULL_PTR owner){
13418         LDKOnionMessage ret = owner->b;
13419         ret.is_owned = false;
13420         return ret;
13421 }
13422 int64_t  CS_LDK_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_b(int64_t owner) {
13423         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* owner_conv = (LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ*)untag_ptr(owner);
13424         LDKOnionMessage ret_var = C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_b(owner_conv);
13425         int64_t ret_ref = 0;
13426         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13427         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13428         return ret_ref;
13429 }
13430
13431 static inline struct LDKCOption_CVec_SocketAddressZZ C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_c(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ *NONNULL_PTR owner){
13432         return COption_CVec_SocketAddressZZ_clone(&owner->c);
13433 }
13434 int64_t  CS_LDK_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_c(int64_t owner) {
13435         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* owner_conv = (LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ*)untag_ptr(owner);
13436         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
13437         *ret_copy = C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_c(owner_conv);
13438         int64_t ret_ref = tag_ptr(ret_copy, true);
13439         return ret_ref;
13440 }
13441
13442 uint32_t CS_LDK_LDKSendError_ty_from_ptr(int64_t ptr) {
13443         LDKSendError *obj = (LDKSendError*)untag_ptr(ptr);
13444         switch(obj->tag) {
13445                 case LDKSendError_Secp256k1: return 0;
13446                 case LDKSendError_TooBigPacket: return 1;
13447                 case LDKSendError_TooFewBlindedHops: return 2;
13448                 case LDKSendError_InvalidFirstHop: return 3;
13449                 case LDKSendError_PathNotFound: return 4;
13450                 case LDKSendError_InvalidMessage: return 5;
13451                 case LDKSendError_BufferFull: return 6;
13452                 case LDKSendError_GetNodeIdFailed: return 7;
13453                 case LDKSendError_UnresolvedIntroductionNode: return 8;
13454                 case LDKSendError_BlindedPathAdvanceFailed: return 9;
13455                 default: abort();
13456         }
13457 }
13458 int32_t CS_LDK_LDKSendError_Secp256k1_get_secp256k1(int64_t ptr) {
13459         LDKSendError *obj = (LDKSendError*)untag_ptr(ptr);
13460         CHECK(obj->tag == LDKSendError_Secp256k1);
13461         int32_t secp256k1_conv = LDKSecp256k1Error_to_cs(obj->secp256k1);
13462         return secp256k1_conv;
13463 }
13464 int8_tArray CS_LDK_LDKSendError_InvalidFirstHop_get_invalid_first_hop(int64_t ptr) {
13465         LDKSendError *obj = (LDKSendError*)untag_ptr(ptr);
13466         CHECK(obj->tag == LDKSendError_InvalidFirstHop);
13467         int8_tArray invalid_first_hop_arr = init_int8_tArray(33, __LINE__);
13468         memcpy(invalid_first_hop_arr->elems, obj->invalid_first_hop.compressed_form, 33);
13469         return invalid_first_hop_arr;
13470 }
13471 static inline struct LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_get_ok(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ *NONNULL_PTR owner){
13472 CHECK(owner->result_ok);
13473         return C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone(&*owner->contents.result);
13474 }
13475 int64_t  CS_LDK_CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_get_ok(int64_t owner) {
13476         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* owner_conv = (LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ*)untag_ptr(owner);
13477         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ), "LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ");
13478         *ret_conv = CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_get_ok(owner_conv);
13479         return tag_ptr(ret_conv, true);
13480 }
13481
13482 static inline struct LDKSendError CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_get_err(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ *NONNULL_PTR owner){
13483 CHECK(!owner->result_ok);
13484         return SendError_clone(&*owner->contents.err);
13485 }
13486 int64_t  CS_LDK_CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_get_err(int64_t owner) {
13487         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* owner_conv = (LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ*)untag_ptr(owner);
13488         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
13489         *ret_copy = CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_get_err(owner_conv);
13490         int64_t ret_ref = tag_ptr(ret_copy, true);
13491         return ret_ref;
13492 }
13493
13494 uint32_t CS_LDK_LDKNextMessageHop_ty_from_ptr(int64_t ptr) {
13495         LDKNextMessageHop *obj = (LDKNextMessageHop*)untag_ptr(ptr);
13496         switch(obj->tag) {
13497                 case LDKNextMessageHop_NodeId: return 0;
13498                 case LDKNextMessageHop_ShortChannelId: return 1;
13499                 default: abort();
13500         }
13501 }
13502 int8_tArray CS_LDK_LDKNextMessageHop_NodeId_get_node_id(int64_t ptr) {
13503         LDKNextMessageHop *obj = (LDKNextMessageHop*)untag_ptr(ptr);
13504         CHECK(obj->tag == LDKNextMessageHop_NodeId);
13505         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
13506         memcpy(node_id_arr->elems, obj->node_id.compressed_form, 33);
13507         return node_id_arr;
13508 }
13509 int64_t CS_LDK_LDKNextMessageHop_ShortChannelId_get_short_channel_id(int64_t ptr) {
13510         LDKNextMessageHop *obj = (LDKNextMessageHop*)untag_ptr(ptr);
13511         CHECK(obj->tag == LDKNextMessageHop_ShortChannelId);
13512         int64_t short_channel_id_conv = obj->short_channel_id;
13513         return short_channel_id_conv;
13514 }
13515 uint32_t CS_LDK_LDKParsedOnionMessageContents_ty_from_ptr(int64_t ptr) {
13516         LDKParsedOnionMessageContents *obj = (LDKParsedOnionMessageContents*)untag_ptr(ptr);
13517         switch(obj->tag) {
13518                 case LDKParsedOnionMessageContents_Offers: return 0;
13519                 case LDKParsedOnionMessageContents_Custom: return 1;
13520                 default: abort();
13521         }
13522 }
13523 int64_t CS_LDK_LDKParsedOnionMessageContents_Offers_get_offers(int64_t ptr) {
13524         LDKParsedOnionMessageContents *obj = (LDKParsedOnionMessageContents*)untag_ptr(ptr);
13525         CHECK(obj->tag == LDKParsedOnionMessageContents_Offers);
13526         int64_t offers_ref = tag_ptr(&obj->offers, false);
13527         return offers_ref;
13528 }
13529 int64_t CS_LDK_LDKParsedOnionMessageContents_Custom_get_custom(int64_t ptr) {
13530         LDKParsedOnionMessageContents *obj = (LDKParsedOnionMessageContents*)untag_ptr(ptr);
13531         CHECK(obj->tag == LDKParsedOnionMessageContents_Custom);
13532         LDKOnionMessageContents* custom_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
13533         *custom_ret = OnionMessageContents_clone(&obj->custom);
13534         return tag_ptr(custom_ret, true);
13535 }
13536 uint32_t CS_LDK_LDKPeeledOnion_ty_from_ptr(int64_t ptr) {
13537         LDKPeeledOnion *obj = (LDKPeeledOnion*)untag_ptr(ptr);
13538         switch(obj->tag) {
13539                 case LDKPeeledOnion_Forward: return 0;
13540                 case LDKPeeledOnion_Receive: return 1;
13541                 default: abort();
13542         }
13543 }
13544 int64_t CS_LDK_LDKPeeledOnion_Forward_get__0(int64_t ptr) {
13545         LDKPeeledOnion *obj = (LDKPeeledOnion*)untag_ptr(ptr);
13546         CHECK(obj->tag == LDKPeeledOnion_Forward);
13547         int64_t _0_ref = tag_ptr(&obj->forward._0, false);
13548         return _0_ref;
13549 }
13550 int64_t CS_LDK_LDKPeeledOnion_Forward_get__1(int64_t ptr) {
13551         LDKPeeledOnion *obj = (LDKPeeledOnion*)untag_ptr(ptr);
13552         CHECK(obj->tag == LDKPeeledOnion_Forward);
13553         LDKOnionMessage _1_var = obj->forward._1;
13554                         int64_t _1_ref = 0;
13555                         CHECK_INNER_FIELD_ACCESS_OR_NULL(_1_var);
13556                         _1_ref = tag_ptr(_1_var.inner, false);
13557         return _1_ref;
13558 }
13559 int64_t CS_LDK_LDKPeeledOnion_Receive_get__0(int64_t ptr) {
13560         LDKPeeledOnion *obj = (LDKPeeledOnion*)untag_ptr(ptr);
13561         CHECK(obj->tag == LDKPeeledOnion_Receive);
13562         int64_t _0_ref = tag_ptr(&obj->receive._0, false);
13563         return _0_ref;
13564 }
13565 int8_tArray CS_LDK_LDKPeeledOnion_Receive_get__1(int64_t ptr) {
13566         LDKPeeledOnion *obj = (LDKPeeledOnion*)untag_ptr(ptr);
13567         CHECK(obj->tag == LDKPeeledOnion_Receive);
13568         int8_tArray _1_arr = init_int8_tArray(32, __LINE__);
13569         memcpy(_1_arr->elems, obj->receive._1.data, 32);
13570         return _1_arr;
13571 }
13572 int64_t CS_LDK_LDKPeeledOnion_Receive_get__2(int64_t ptr) {
13573         LDKPeeledOnion *obj = (LDKPeeledOnion*)untag_ptr(ptr);
13574         CHECK(obj->tag == LDKPeeledOnion_Receive);
13575         LDKBlindedPath _2_var = obj->receive._2;
13576                         int64_t _2_ref = 0;
13577                         CHECK_INNER_FIELD_ACCESS_OR_NULL(_2_var);
13578                         _2_ref = tag_ptr(_2_var.inner, false);
13579         return _2_ref;
13580 }
13581 static inline struct LDKPeeledOnion CResult_PeeledOnionNoneZ_get_ok(LDKCResult_PeeledOnionNoneZ *NONNULL_PTR owner){
13582 CHECK(owner->result_ok);
13583         return PeeledOnion_clone(&*owner->contents.result);
13584 }
13585 int64_t  CS_LDK_CResult_PeeledOnionNoneZ_get_ok(int64_t owner) {
13586         LDKCResult_PeeledOnionNoneZ* owner_conv = (LDKCResult_PeeledOnionNoneZ*)untag_ptr(owner);
13587         LDKPeeledOnion *ret_copy = MALLOC(sizeof(LDKPeeledOnion), "LDKPeeledOnion");
13588         *ret_copy = CResult_PeeledOnionNoneZ_get_ok(owner_conv);
13589         int64_t ret_ref = tag_ptr(ret_copy, true);
13590         return ret_ref;
13591 }
13592
13593 static inline void CResult_PeeledOnionNoneZ_get_err(LDKCResult_PeeledOnionNoneZ *NONNULL_PTR owner){
13594 CHECK(!owner->result_ok);
13595         return *owner->contents.err;
13596 }
13597 void  CS_LDK_CResult_PeeledOnionNoneZ_get_err(int64_t owner) {
13598         LDKCResult_PeeledOnionNoneZ* owner_conv = (LDKCResult_PeeledOnionNoneZ*)untag_ptr(owner);
13599         CResult_PeeledOnionNoneZ_get_err(owner_conv);
13600 }
13601
13602 uint32_t CS_LDK_LDKSendSuccess_ty_from_ptr(int64_t ptr) {
13603         LDKSendSuccess *obj = (LDKSendSuccess*)untag_ptr(ptr);
13604         switch(obj->tag) {
13605                 case LDKSendSuccess_Buffered: return 0;
13606                 case LDKSendSuccess_BufferedAwaitingConnection: return 1;
13607                 default: abort();
13608         }
13609 }
13610 int8_tArray CS_LDK_LDKSendSuccess_BufferedAwaitingConnection_get_buffered_awaiting_connection(int64_t ptr) {
13611         LDKSendSuccess *obj = (LDKSendSuccess*)untag_ptr(ptr);
13612         CHECK(obj->tag == LDKSendSuccess_BufferedAwaitingConnection);
13613         int8_tArray buffered_awaiting_connection_arr = init_int8_tArray(33, __LINE__);
13614         memcpy(buffered_awaiting_connection_arr->elems, obj->buffered_awaiting_connection.compressed_form, 33);
13615         return buffered_awaiting_connection_arr;
13616 }
13617 static inline struct LDKSendSuccess CResult_SendSuccessSendErrorZ_get_ok(LDKCResult_SendSuccessSendErrorZ *NONNULL_PTR owner){
13618 CHECK(owner->result_ok);
13619         return SendSuccess_clone(&*owner->contents.result);
13620 }
13621 int64_t  CS_LDK_CResult_SendSuccessSendErrorZ_get_ok(int64_t owner) {
13622         LDKCResult_SendSuccessSendErrorZ* owner_conv = (LDKCResult_SendSuccessSendErrorZ*)untag_ptr(owner);
13623         LDKSendSuccess *ret_copy = MALLOC(sizeof(LDKSendSuccess), "LDKSendSuccess");
13624         *ret_copy = CResult_SendSuccessSendErrorZ_get_ok(owner_conv);
13625         int64_t ret_ref = tag_ptr(ret_copy, true);
13626         return ret_ref;
13627 }
13628
13629 static inline struct LDKSendError CResult_SendSuccessSendErrorZ_get_err(LDKCResult_SendSuccessSendErrorZ *NONNULL_PTR owner){
13630 CHECK(!owner->result_ok);
13631         return SendError_clone(&*owner->contents.err);
13632 }
13633 int64_t  CS_LDK_CResult_SendSuccessSendErrorZ_get_err(int64_t owner) {
13634         LDKCResult_SendSuccessSendErrorZ* owner_conv = (LDKCResult_SendSuccessSendErrorZ*)untag_ptr(owner);
13635         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
13636         *ret_copy = CResult_SendSuccessSendErrorZ_get_err(owner_conv);
13637         int64_t ret_ref = tag_ptr(ret_copy, true);
13638         return ret_ref;
13639 }
13640
13641 static inline struct LDKBlindedPath CResult_BlindedPathNoneZ_get_ok(LDKCResult_BlindedPathNoneZ *NONNULL_PTR owner){
13642         LDKBlindedPath ret = *owner->contents.result;
13643         ret.is_owned = false;
13644         return ret;
13645 }
13646 int64_t  CS_LDK_CResult_BlindedPathNoneZ_get_ok(int64_t owner) {
13647         LDKCResult_BlindedPathNoneZ* owner_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(owner);
13648         LDKBlindedPath ret_var = CResult_BlindedPathNoneZ_get_ok(owner_conv);
13649         int64_t ret_ref = 0;
13650         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13651         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13652         return ret_ref;
13653 }
13654
13655 static inline void CResult_BlindedPathNoneZ_get_err(LDKCResult_BlindedPathNoneZ *NONNULL_PTR owner){
13656 CHECK(!owner->result_ok);
13657         return *owner->contents.err;
13658 }
13659 void  CS_LDK_CResult_BlindedPathNoneZ_get_err(int64_t owner) {
13660         LDKCResult_BlindedPathNoneZ* owner_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(owner);
13661         CResult_BlindedPathNoneZ_get_err(owner_conv);
13662 }
13663
13664 static inline struct LDKC2Tuple_BlindedPayInfoBlindedPathZ CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_ok(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ *NONNULL_PTR owner){
13665 CHECK(owner->result_ok);
13666         return C2Tuple_BlindedPayInfoBlindedPathZ_clone(&*owner->contents.result);
13667 }
13668 int64_t  CS_LDK_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_ok(int64_t owner) {
13669         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* owner_conv = (LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)untag_ptr(owner);
13670         LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
13671         *ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_ok(owner_conv);
13672         return tag_ptr(ret_conv, true);
13673 }
13674
13675 static inline void CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_err(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ *NONNULL_PTR owner){
13676 CHECK(!owner->result_ok);
13677         return *owner->contents.err;
13678 }
13679 void  CS_LDK_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_err(int64_t owner) {
13680         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* owner_conv = (LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)untag_ptr(owner);
13681         CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_err(owner_conv);
13682 }
13683
13684 static inline LDKCVec_ForwardNodeZ CVec_ForwardNodeZ_clone(const LDKCVec_ForwardNodeZ *orig) {
13685         LDKCVec_ForwardNodeZ ret = { .data = MALLOC(sizeof(LDKForwardNode) * orig->datalen, "LDKCVec_ForwardNodeZ clone bytes"), .datalen = orig->datalen };
13686         for (size_t i = 0; i < ret.datalen; i++) {
13687                 ret.data[i] = ForwardNode_clone(&orig->data[i]);
13688         }
13689         return ret;
13690 }
13691 static inline struct LDKBlindedPath CResult_BlindedPathDecodeErrorZ_get_ok(LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR owner){
13692         LDKBlindedPath ret = *owner->contents.result;
13693         ret.is_owned = false;
13694         return ret;
13695 }
13696 int64_t  CS_LDK_CResult_BlindedPathDecodeErrorZ_get_ok(int64_t owner) {
13697         LDKCResult_BlindedPathDecodeErrorZ* owner_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(owner);
13698         LDKBlindedPath ret_var = CResult_BlindedPathDecodeErrorZ_get_ok(owner_conv);
13699         int64_t ret_ref = 0;
13700         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13701         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13702         return ret_ref;
13703 }
13704
13705 static inline struct LDKDecodeError CResult_BlindedPathDecodeErrorZ_get_err(LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR owner){
13706 CHECK(!owner->result_ok);
13707         return DecodeError_clone(&*owner->contents.err);
13708 }
13709 int64_t  CS_LDK_CResult_BlindedPathDecodeErrorZ_get_err(int64_t owner) {
13710         LDKCResult_BlindedPathDecodeErrorZ* owner_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(owner);
13711         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13712         *ret_copy = CResult_BlindedPathDecodeErrorZ_get_err(owner_conv);
13713         int64_t ret_ref = tag_ptr(ret_copy, true);
13714         return ret_ref;
13715 }
13716
13717 static inline struct LDKBlindedHop CResult_BlindedHopDecodeErrorZ_get_ok(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR owner){
13718         LDKBlindedHop ret = *owner->contents.result;
13719         ret.is_owned = false;
13720         return ret;
13721 }
13722 int64_t  CS_LDK_CResult_BlindedHopDecodeErrorZ_get_ok(int64_t owner) {
13723         LDKCResult_BlindedHopDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(owner);
13724         LDKBlindedHop ret_var = CResult_BlindedHopDecodeErrorZ_get_ok(owner_conv);
13725         int64_t ret_ref = 0;
13726         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13727         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13728         return ret_ref;
13729 }
13730
13731 static inline struct LDKDecodeError CResult_BlindedHopDecodeErrorZ_get_err(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR owner){
13732 CHECK(!owner->result_ok);
13733         return DecodeError_clone(&*owner->contents.err);
13734 }
13735 int64_t  CS_LDK_CResult_BlindedHopDecodeErrorZ_get_err(int64_t owner) {
13736         LDKCResult_BlindedHopDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(owner);
13737         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13738         *ret_copy = CResult_BlindedHopDecodeErrorZ_get_err(owner_conv);
13739         int64_t ret_ref = tag_ptr(ret_copy, true);
13740         return ret_ref;
13741 }
13742
13743 static inline struct LDKInvoiceError CResult_InvoiceErrorDecodeErrorZ_get_ok(LDKCResult_InvoiceErrorDecodeErrorZ *NONNULL_PTR owner){
13744         LDKInvoiceError ret = *owner->contents.result;
13745         ret.is_owned = false;
13746         return ret;
13747 }
13748 int64_t  CS_LDK_CResult_InvoiceErrorDecodeErrorZ_get_ok(int64_t owner) {
13749         LDKCResult_InvoiceErrorDecodeErrorZ* owner_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(owner);
13750         LDKInvoiceError ret_var = CResult_InvoiceErrorDecodeErrorZ_get_ok(owner_conv);
13751         int64_t ret_ref = 0;
13752         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13753         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13754         return ret_ref;
13755 }
13756
13757 static inline struct LDKDecodeError CResult_InvoiceErrorDecodeErrorZ_get_err(LDKCResult_InvoiceErrorDecodeErrorZ *NONNULL_PTR owner){
13758 CHECK(!owner->result_ok);
13759         return DecodeError_clone(&*owner->contents.err);
13760 }
13761 int64_t  CS_LDK_CResult_InvoiceErrorDecodeErrorZ_get_err(int64_t owner) {
13762         LDKCResult_InvoiceErrorDecodeErrorZ* owner_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(owner);
13763         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13764         *ret_copy = CResult_InvoiceErrorDecodeErrorZ_get_err(owner_conv);
13765         int64_t ret_ref = tag_ptr(ret_copy, true);
13766         return ret_ref;
13767 }
13768
13769 static inline struct LDKTrackedSpendableOutput CResult_TrackedSpendableOutputDecodeErrorZ_get_ok(LDKCResult_TrackedSpendableOutputDecodeErrorZ *NONNULL_PTR owner){
13770         LDKTrackedSpendableOutput ret = *owner->contents.result;
13771         ret.is_owned = false;
13772         return ret;
13773 }
13774 int64_t  CS_LDK_CResult_TrackedSpendableOutputDecodeErrorZ_get_ok(int64_t owner) {
13775         LDKCResult_TrackedSpendableOutputDecodeErrorZ* owner_conv = (LDKCResult_TrackedSpendableOutputDecodeErrorZ*)untag_ptr(owner);
13776         LDKTrackedSpendableOutput ret_var = CResult_TrackedSpendableOutputDecodeErrorZ_get_ok(owner_conv);
13777         int64_t ret_ref = 0;
13778         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13779         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13780         return ret_ref;
13781 }
13782
13783 static inline struct LDKDecodeError CResult_TrackedSpendableOutputDecodeErrorZ_get_err(LDKCResult_TrackedSpendableOutputDecodeErrorZ *NONNULL_PTR owner){
13784 CHECK(!owner->result_ok);
13785         return DecodeError_clone(&*owner->contents.err);
13786 }
13787 int64_t  CS_LDK_CResult_TrackedSpendableOutputDecodeErrorZ_get_err(int64_t owner) {
13788         LDKCResult_TrackedSpendableOutputDecodeErrorZ* owner_conv = (LDKCResult_TrackedSpendableOutputDecodeErrorZ*)untag_ptr(owner);
13789         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13790         *ret_copy = CResult_TrackedSpendableOutputDecodeErrorZ_get_err(owner_conv);
13791         int64_t ret_ref = tag_ptr(ret_copy, true);
13792         return ret_ref;
13793 }
13794
13795 uint32_t CS_LDK_LDKOutputSpendStatus_ty_from_ptr(int64_t ptr) {
13796         LDKOutputSpendStatus *obj = (LDKOutputSpendStatus*)untag_ptr(ptr);
13797         switch(obj->tag) {
13798                 case LDKOutputSpendStatus_PendingInitialBroadcast: return 0;
13799                 case LDKOutputSpendStatus_PendingFirstConfirmation: return 1;
13800                 case LDKOutputSpendStatus_PendingThresholdConfirmations: return 2;
13801                 default: abort();
13802         }
13803 }
13804 int64_t CS_LDK_LDKOutputSpendStatus_PendingInitialBroadcast_get_delayed_until_height(int64_t ptr) {
13805         LDKOutputSpendStatus *obj = (LDKOutputSpendStatus*)untag_ptr(ptr);
13806         CHECK(obj->tag == LDKOutputSpendStatus_PendingInitialBroadcast);
13807         int64_t delayed_until_height_ref = tag_ptr(&obj->pending_initial_broadcast.delayed_until_height, false);
13808         return delayed_until_height_ref;
13809 }
13810 int8_tArray CS_LDK_LDKOutputSpendStatus_PendingFirstConfirmation_get_first_broadcast_hash(int64_t ptr) {
13811         LDKOutputSpendStatus *obj = (LDKOutputSpendStatus*)untag_ptr(ptr);
13812         CHECK(obj->tag == LDKOutputSpendStatus_PendingFirstConfirmation);
13813         int8_tArray first_broadcast_hash_arr = init_int8_tArray(32, __LINE__);
13814         memcpy(first_broadcast_hash_arr->elems, obj->pending_first_confirmation.first_broadcast_hash.data, 32);
13815         return first_broadcast_hash_arr;
13816 }
13817 int32_t CS_LDK_LDKOutputSpendStatus_PendingFirstConfirmation_get_latest_broadcast_height(int64_t ptr) {
13818         LDKOutputSpendStatus *obj = (LDKOutputSpendStatus*)untag_ptr(ptr);
13819         CHECK(obj->tag == LDKOutputSpendStatus_PendingFirstConfirmation);
13820         int32_t latest_broadcast_height_conv = obj->pending_first_confirmation.latest_broadcast_height;
13821         return latest_broadcast_height_conv;
13822 }
13823 int8_tArray CS_LDK_LDKOutputSpendStatus_PendingFirstConfirmation_get_latest_spending_tx(int64_t ptr) {
13824         LDKOutputSpendStatus *obj = (LDKOutputSpendStatus*)untag_ptr(ptr);
13825         CHECK(obj->tag == LDKOutputSpendStatus_PendingFirstConfirmation);
13826         LDKTransaction latest_spending_tx_var = obj->pending_first_confirmation.latest_spending_tx;
13827                         int8_tArray latest_spending_tx_arr = init_int8_tArray(latest_spending_tx_var.datalen, __LINE__);
13828                         memcpy(latest_spending_tx_arr->elems, latest_spending_tx_var.data, latest_spending_tx_var.datalen);
13829         return latest_spending_tx_arr;
13830 }
13831 int8_tArray CS_LDK_LDKOutputSpendStatus_PendingThresholdConfirmations_get_first_broadcast_hash(int64_t ptr) {
13832         LDKOutputSpendStatus *obj = (LDKOutputSpendStatus*)untag_ptr(ptr);
13833         CHECK(obj->tag == LDKOutputSpendStatus_PendingThresholdConfirmations);
13834         int8_tArray first_broadcast_hash_arr = init_int8_tArray(32, __LINE__);
13835         memcpy(first_broadcast_hash_arr->elems, obj->pending_threshold_confirmations.first_broadcast_hash.data, 32);
13836         return first_broadcast_hash_arr;
13837 }
13838 int32_t CS_LDK_LDKOutputSpendStatus_PendingThresholdConfirmations_get_latest_broadcast_height(int64_t ptr) {
13839         LDKOutputSpendStatus *obj = (LDKOutputSpendStatus*)untag_ptr(ptr);
13840         CHECK(obj->tag == LDKOutputSpendStatus_PendingThresholdConfirmations);
13841         int32_t latest_broadcast_height_conv = obj->pending_threshold_confirmations.latest_broadcast_height;
13842         return latest_broadcast_height_conv;
13843 }
13844 int8_tArray CS_LDK_LDKOutputSpendStatus_PendingThresholdConfirmations_get_latest_spending_tx(int64_t ptr) {
13845         LDKOutputSpendStatus *obj = (LDKOutputSpendStatus*)untag_ptr(ptr);
13846         CHECK(obj->tag == LDKOutputSpendStatus_PendingThresholdConfirmations);
13847         LDKTransaction latest_spending_tx_var = obj->pending_threshold_confirmations.latest_spending_tx;
13848                         int8_tArray latest_spending_tx_arr = init_int8_tArray(latest_spending_tx_var.datalen, __LINE__);
13849                         memcpy(latest_spending_tx_arr->elems, latest_spending_tx_var.data, latest_spending_tx_var.datalen);
13850         return latest_spending_tx_arr;
13851 }
13852 int32_t CS_LDK_LDKOutputSpendStatus_PendingThresholdConfirmations_get_confirmation_height(int64_t ptr) {
13853         LDKOutputSpendStatus *obj = (LDKOutputSpendStatus*)untag_ptr(ptr);
13854         CHECK(obj->tag == LDKOutputSpendStatus_PendingThresholdConfirmations);
13855         int32_t confirmation_height_conv = obj->pending_threshold_confirmations.confirmation_height;
13856         return confirmation_height_conv;
13857 }
13858 int8_tArray CS_LDK_LDKOutputSpendStatus_PendingThresholdConfirmations_get_confirmation_hash(int64_t ptr) {
13859         LDKOutputSpendStatus *obj = (LDKOutputSpendStatus*)untag_ptr(ptr);
13860         CHECK(obj->tag == LDKOutputSpendStatus_PendingThresholdConfirmations);
13861         int8_tArray confirmation_hash_arr = init_int8_tArray(32, __LINE__);
13862         memcpy(confirmation_hash_arr->elems, obj->pending_threshold_confirmations.confirmation_hash.data, 32);
13863         return confirmation_hash_arr;
13864 }
13865 static inline struct LDKOutputSpendStatus CResult_OutputSpendStatusDecodeErrorZ_get_ok(LDKCResult_OutputSpendStatusDecodeErrorZ *NONNULL_PTR owner){
13866 CHECK(owner->result_ok);
13867         return OutputSpendStatus_clone(&*owner->contents.result);
13868 }
13869 int64_t  CS_LDK_CResult_OutputSpendStatusDecodeErrorZ_get_ok(int64_t owner) {
13870         LDKCResult_OutputSpendStatusDecodeErrorZ* owner_conv = (LDKCResult_OutputSpendStatusDecodeErrorZ*)untag_ptr(owner);
13871         LDKOutputSpendStatus *ret_copy = MALLOC(sizeof(LDKOutputSpendStatus), "LDKOutputSpendStatus");
13872         *ret_copy = CResult_OutputSpendStatusDecodeErrorZ_get_ok(owner_conv);
13873         int64_t ret_ref = tag_ptr(ret_copy, true);
13874         return ret_ref;
13875 }
13876
13877 static inline struct LDKDecodeError CResult_OutputSpendStatusDecodeErrorZ_get_err(LDKCResult_OutputSpendStatusDecodeErrorZ *NONNULL_PTR owner){
13878 CHECK(!owner->result_ok);
13879         return DecodeError_clone(&*owner->contents.err);
13880 }
13881 int64_t  CS_LDK_CResult_OutputSpendStatusDecodeErrorZ_get_err(int64_t owner) {
13882         LDKCResult_OutputSpendStatusDecodeErrorZ* owner_conv = (LDKCResult_OutputSpendStatusDecodeErrorZ*)untag_ptr(owner);
13883         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13884         *ret_copy = CResult_OutputSpendStatusDecodeErrorZ_get_err(owner_conv);
13885         int64_t ret_ref = tag_ptr(ret_copy, true);
13886         return ret_ref;
13887 }
13888
13889 typedef struct LDKFilter_JCalls {
13890         atomic_size_t refcnt;
13891         uint32_t instance_ptr;
13892 } LDKFilter_JCalls;
13893 static void LDKFilter_JCalls_free(void* this_arg) {
13894         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
13895         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13896                 FREE(j_calls);
13897         }
13898 }
13899 void register_tx_LDKFilter_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
13900         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
13901         int8_tArray txid_arr = init_int8_tArray(32, __LINE__);
13902         memcpy(txid_arr->elems, *txid, 32);
13903         LDKu8slice script_pubkey_var = script_pubkey;
13904         int8_tArray script_pubkey_arr = init_int8_tArray(script_pubkey_var.datalen, __LINE__);
13905         memcpy(script_pubkey_arr->elems, script_pubkey_var.data, script_pubkey_var.datalen);
13906         js_invoke_function_void_ll(j_calls->instance_ptr, 56, (int64_t)txid_arr, (int64_t)script_pubkey_arr);
13907 }
13908 void register_output_LDKFilter_jcall(const void* this_arg, LDKWatchedOutput output) {
13909         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
13910         LDKWatchedOutput output_var = output;
13911         int64_t output_ref = 0;
13912         CHECK_INNER_FIELD_ACCESS_OR_NULL(output_var);
13913         output_ref = tag_ptr(output_var.inner, output_var.is_owned);
13914         js_invoke_function_void_l(j_calls->instance_ptr, 57, output_ref);
13915 }
13916 static void LDKFilter_JCalls_cloned(LDKFilter* new_obj) {
13917         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) new_obj->this_arg;
13918         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13919 }
13920 static inline LDKFilter LDKFilter_init (int64_t o) {
13921         LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
13922         atomic_init(&calls->refcnt, 1);
13923         calls->instance_ptr = o;
13924
13925         LDKFilter ret = {
13926                 .this_arg = (void*) calls,
13927                 .register_tx = register_tx_LDKFilter_jcall,
13928                 .register_output = register_output_LDKFilter_jcall,
13929                 .free = LDKFilter_JCalls_free,
13930         };
13931         return ret;
13932 }
13933 uint64_t  CS_LDK_LDKFilter_new(int32_t o) {
13934         LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
13935         *res_ptr = LDKFilter_init(o);
13936         return tag_ptr(res_ptr, true);
13937 }
13938 void  CS_LDK_Filter_register_tx(int64_t this_arg, int8_tArray txid, int8_tArray script_pubkey) {
13939         void* this_arg_ptr = untag_ptr(this_arg);
13940         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13941         LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
13942         uint8_t txid_arr[32];
13943         CHECK(txid->arr_len == 32);
13944         memcpy(txid_arr, txid->elems, 32); FREE(txid);
13945         uint8_t (*txid_ref)[32] = &txid_arr;
13946         LDKu8slice script_pubkey_ref;
13947         script_pubkey_ref.datalen = script_pubkey->arr_len;
13948         script_pubkey_ref.data = script_pubkey->elems;
13949         (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
13950         FREE(script_pubkey);
13951 }
13952
13953 void  CS_LDK_Filter_register_output(int64_t this_arg, int64_t output) {
13954         void* this_arg_ptr = untag_ptr(this_arg);
13955         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13956         LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
13957         LDKWatchedOutput output_conv;
13958         output_conv.inner = untag_ptr(output);
13959         output_conv.is_owned = ptr_is_owned(output);
13960         CHECK_INNER_FIELD_ACCESS_OR_NULL(output_conv);
13961         output_conv = WatchedOutput_clone(&output_conv);
13962         (this_arg_conv->register_output)(this_arg_conv->this_arg, output_conv);
13963 }
13964
13965 uint32_t CS_LDK_LDKCOption_FilterZ_ty_from_ptr(int64_t ptr) {
13966         LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)untag_ptr(ptr);
13967         switch(obj->tag) {
13968                 case LDKCOption_FilterZ_Some: return 0;
13969                 case LDKCOption_FilterZ_None: return 1;
13970                 default: abort();
13971         }
13972 }
13973 int64_t CS_LDK_LDKCOption_FilterZ_Some_get_some(int64_t ptr) {
13974         LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)untag_ptr(ptr);
13975         CHECK(obj->tag == LDKCOption_FilterZ_Some);
13976         LDKFilter* some_ret = MALLOC(sizeof(LDKFilter), "LDKFilter");
13977         *some_ret = obj->some;
13978                         // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
13979                         if ((*some_ret).free == LDKFilter_JCalls_free) {
13980                                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
13981                                 LDKFilter_JCalls_cloned(&(*some_ret));
13982                         }
13983         return tag_ptr(some_ret, true);
13984 }
13985 static inline LDKCVec_TrackedSpendableOutputZ CVec_TrackedSpendableOutputZ_clone(const LDKCVec_TrackedSpendableOutputZ *orig) {
13986         LDKCVec_TrackedSpendableOutputZ ret = { .data = MALLOC(sizeof(LDKTrackedSpendableOutput) * orig->datalen, "LDKCVec_TrackedSpendableOutputZ clone bytes"), .datalen = orig->datalen };
13987         for (size_t i = 0; i < ret.datalen; i++) {
13988                 ret.data[i] = TrackedSpendableOutput_clone(&orig->data[i]);
13989         }
13990         return ret;
13991 }
13992 typedef struct LDKChangeDestinationSource_JCalls {
13993         atomic_size_t refcnt;
13994         uint32_t instance_ptr;
13995 } LDKChangeDestinationSource_JCalls;
13996 static void LDKChangeDestinationSource_JCalls_free(void* this_arg) {
13997         LDKChangeDestinationSource_JCalls *j_calls = (LDKChangeDestinationSource_JCalls*) this_arg;
13998         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13999                 FREE(j_calls);
14000         }
14001 }
14002 LDKCResult_CVec_u8ZNoneZ get_change_destination_script_LDKChangeDestinationSource_jcall(const void* this_arg) {
14003         LDKChangeDestinationSource_JCalls *j_calls = (LDKChangeDestinationSource_JCalls*) this_arg;
14004         uint64_t ret = js_invoke_function_l_(j_calls->instance_ptr, 58);
14005         void* ret_ptr = untag_ptr(ret);
14006         CHECK_ACCESS(ret_ptr);
14007         LDKCResult_CVec_u8ZNoneZ ret_conv = *(LDKCResult_CVec_u8ZNoneZ*)(ret_ptr);
14008         FREE(untag_ptr(ret));
14009         return ret_conv;
14010 }
14011 static void LDKChangeDestinationSource_JCalls_cloned(LDKChangeDestinationSource* new_obj) {
14012         LDKChangeDestinationSource_JCalls *j_calls = (LDKChangeDestinationSource_JCalls*) new_obj->this_arg;
14013         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14014 }
14015 static inline LDKChangeDestinationSource LDKChangeDestinationSource_init (int64_t o) {
14016         LDKChangeDestinationSource_JCalls *calls = MALLOC(sizeof(LDKChangeDestinationSource_JCalls), "LDKChangeDestinationSource_JCalls");
14017         atomic_init(&calls->refcnt, 1);
14018         calls->instance_ptr = o;
14019
14020         LDKChangeDestinationSource ret = {
14021                 .this_arg = (void*) calls,
14022                 .get_change_destination_script = get_change_destination_script_LDKChangeDestinationSource_jcall,
14023                 .free = LDKChangeDestinationSource_JCalls_free,
14024         };
14025         return ret;
14026 }
14027 uint64_t  CS_LDK_LDKChangeDestinationSource_new(int32_t o) {
14028         LDKChangeDestinationSource *res_ptr = MALLOC(sizeof(LDKChangeDestinationSource), "LDKChangeDestinationSource");
14029         *res_ptr = LDKChangeDestinationSource_init(o);
14030         return tag_ptr(res_ptr, true);
14031 }
14032 int64_t  CS_LDK_ChangeDestinationSource_get_change_destination_script(int64_t this_arg) {
14033         void* this_arg_ptr = untag_ptr(this_arg);
14034         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14035         LDKChangeDestinationSource* this_arg_conv = (LDKChangeDestinationSource*)this_arg_ptr;
14036         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
14037         *ret_conv = (this_arg_conv->get_change_destination_script)(this_arg_conv->this_arg);
14038         return tag_ptr(ret_conv, true);
14039 }
14040
14041 typedef struct LDKKVStore_JCalls {
14042         atomic_size_t refcnt;
14043         uint32_t instance_ptr;
14044 } LDKKVStore_JCalls;
14045 static void LDKKVStore_JCalls_free(void* this_arg) {
14046         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) this_arg;
14047         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14048                 FREE(j_calls);
14049         }
14050 }
14051 LDKCResult_CVec_u8ZIOErrorZ read_LDKKVStore_jcall(const void* this_arg, LDKStr primary_namespace, LDKStr secondary_namespace, LDKStr key) {
14052         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) this_arg;
14053         LDKStr primary_namespace_str = primary_namespace;
14054         jstring primary_namespace_conv = str_ref_to_cs(primary_namespace_str.chars, primary_namespace_str.len);
14055         Str_free(primary_namespace_str);
14056         LDKStr secondary_namespace_str = secondary_namespace;
14057         jstring secondary_namespace_conv = str_ref_to_cs(secondary_namespace_str.chars, secondary_namespace_str.len);
14058         Str_free(secondary_namespace_str);
14059         LDKStr key_str = key;
14060         jstring key_conv = str_ref_to_cs(key_str.chars, key_str.len);
14061         Str_free(key_str);
14062         uint64_t ret = js_invoke_function_l_lll(j_calls->instance_ptr, 59, (int64_t)primary_namespace_conv, (int64_t)secondary_namespace_conv, (int64_t)key_conv);
14063         void* ret_ptr = untag_ptr(ret);
14064         CHECK_ACCESS(ret_ptr);
14065         LDKCResult_CVec_u8ZIOErrorZ ret_conv = *(LDKCResult_CVec_u8ZIOErrorZ*)(ret_ptr);
14066         FREE(untag_ptr(ret));
14067         return ret_conv;
14068 }
14069 LDKCResult_NoneIOErrorZ write_LDKKVStore_jcall(const void* this_arg, LDKStr primary_namespace, LDKStr secondary_namespace, LDKStr key, LDKu8slice buf) {
14070         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) this_arg;
14071         LDKStr primary_namespace_str = primary_namespace;
14072         jstring primary_namespace_conv = str_ref_to_cs(primary_namespace_str.chars, primary_namespace_str.len);
14073         Str_free(primary_namespace_str);
14074         LDKStr secondary_namespace_str = secondary_namespace;
14075         jstring secondary_namespace_conv = str_ref_to_cs(secondary_namespace_str.chars, secondary_namespace_str.len);
14076         Str_free(secondary_namespace_str);
14077         LDKStr key_str = key;
14078         jstring key_conv = str_ref_to_cs(key_str.chars, key_str.len);
14079         Str_free(key_str);
14080         LDKu8slice buf_var = buf;
14081         int8_tArray buf_arr = init_int8_tArray(buf_var.datalen, __LINE__);
14082         memcpy(buf_arr->elems, buf_var.data, buf_var.datalen);
14083         uint64_t ret = js_invoke_function_l_llll(j_calls->instance_ptr, 60, (int64_t)primary_namespace_conv, (int64_t)secondary_namespace_conv, (int64_t)key_conv, (int64_t)buf_arr);
14084         void* ret_ptr = untag_ptr(ret);
14085         CHECK_ACCESS(ret_ptr);
14086         LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
14087         FREE(untag_ptr(ret));
14088         return ret_conv;
14089 }
14090 LDKCResult_NoneIOErrorZ remove_LDKKVStore_jcall(const void* this_arg, LDKStr primary_namespace, LDKStr secondary_namespace, LDKStr key, bool lazy) {
14091         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) this_arg;
14092         LDKStr primary_namespace_str = primary_namespace;
14093         jstring primary_namespace_conv = str_ref_to_cs(primary_namespace_str.chars, primary_namespace_str.len);
14094         Str_free(primary_namespace_str);
14095         LDKStr secondary_namespace_str = secondary_namespace;
14096         jstring secondary_namespace_conv = str_ref_to_cs(secondary_namespace_str.chars, secondary_namespace_str.len);
14097         Str_free(secondary_namespace_str);
14098         LDKStr key_str = key;
14099         jstring key_conv = str_ref_to_cs(key_str.chars, key_str.len);
14100         Str_free(key_str);
14101         jboolean lazy_conv = lazy;
14102         uint64_t ret = js_invoke_function_l_lllb(j_calls->instance_ptr, 61, (int64_t)primary_namespace_conv, (int64_t)secondary_namespace_conv, (int64_t)key_conv, lazy_conv);
14103         void* ret_ptr = untag_ptr(ret);
14104         CHECK_ACCESS(ret_ptr);
14105         LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
14106         FREE(untag_ptr(ret));
14107         return ret_conv;
14108 }
14109 LDKCResult_CVec_StrZIOErrorZ list_LDKKVStore_jcall(const void* this_arg, LDKStr primary_namespace, LDKStr secondary_namespace) {
14110         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) this_arg;
14111         LDKStr primary_namespace_str = primary_namespace;
14112         jstring primary_namespace_conv = str_ref_to_cs(primary_namespace_str.chars, primary_namespace_str.len);
14113         Str_free(primary_namespace_str);
14114         LDKStr secondary_namespace_str = secondary_namespace;
14115         jstring secondary_namespace_conv = str_ref_to_cs(secondary_namespace_str.chars, secondary_namespace_str.len);
14116         Str_free(secondary_namespace_str);
14117         uint64_t ret = js_invoke_function_l_ll(j_calls->instance_ptr, 62, (int64_t)primary_namespace_conv, (int64_t)secondary_namespace_conv);
14118         void* ret_ptr = untag_ptr(ret);
14119         CHECK_ACCESS(ret_ptr);
14120         LDKCResult_CVec_StrZIOErrorZ ret_conv = *(LDKCResult_CVec_StrZIOErrorZ*)(ret_ptr);
14121         FREE(untag_ptr(ret));
14122         return ret_conv;
14123 }
14124 static void LDKKVStore_JCalls_cloned(LDKKVStore* new_obj) {
14125         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) new_obj->this_arg;
14126         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14127 }
14128 static inline LDKKVStore LDKKVStore_init (int64_t o) {
14129         LDKKVStore_JCalls *calls = MALLOC(sizeof(LDKKVStore_JCalls), "LDKKVStore_JCalls");
14130         atomic_init(&calls->refcnt, 1);
14131         calls->instance_ptr = o;
14132
14133         LDKKVStore ret = {
14134                 .this_arg = (void*) calls,
14135                 .read = read_LDKKVStore_jcall,
14136                 .write = write_LDKKVStore_jcall,
14137                 .remove = remove_LDKKVStore_jcall,
14138                 .list = list_LDKKVStore_jcall,
14139                 .free = LDKKVStore_JCalls_free,
14140         };
14141         return ret;
14142 }
14143 uint64_t  CS_LDK_LDKKVStore_new(int32_t o) {
14144         LDKKVStore *res_ptr = MALLOC(sizeof(LDKKVStore), "LDKKVStore");
14145         *res_ptr = LDKKVStore_init(o);
14146         return tag_ptr(res_ptr, true);
14147 }
14148 int64_t  CS_LDK_KVStore_read(int64_t this_arg, jstring primary_namespace, jstring secondary_namespace, jstring key) {
14149         void* this_arg_ptr = untag_ptr(this_arg);
14150         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14151         LDKKVStore* this_arg_conv = (LDKKVStore*)this_arg_ptr;
14152         LDKStr primary_namespace_conv = str_ref_to_owned_c(primary_namespace);
14153         LDKStr secondary_namespace_conv = str_ref_to_owned_c(secondary_namespace);
14154         LDKStr key_conv = str_ref_to_owned_c(key);
14155         LDKCResult_CVec_u8ZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZIOErrorZ), "LDKCResult_CVec_u8ZIOErrorZ");
14156         *ret_conv = (this_arg_conv->read)(this_arg_conv->this_arg, primary_namespace_conv, secondary_namespace_conv, key_conv);
14157         return tag_ptr(ret_conv, true);
14158 }
14159
14160 int64_t  CS_LDK_KVStore_write(int64_t this_arg, jstring primary_namespace, jstring secondary_namespace, jstring key, int8_tArray buf) {
14161         void* this_arg_ptr = untag_ptr(this_arg);
14162         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14163         LDKKVStore* this_arg_conv = (LDKKVStore*)this_arg_ptr;
14164         LDKStr primary_namespace_conv = str_ref_to_owned_c(primary_namespace);
14165         LDKStr secondary_namespace_conv = str_ref_to_owned_c(secondary_namespace);
14166         LDKStr key_conv = str_ref_to_owned_c(key);
14167         LDKu8slice buf_ref;
14168         buf_ref.datalen = buf->arr_len;
14169         buf_ref.data = buf->elems;
14170         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
14171         *ret_conv = (this_arg_conv->write)(this_arg_conv->this_arg, primary_namespace_conv, secondary_namespace_conv, key_conv, buf_ref);
14172         FREE(buf);
14173         return tag_ptr(ret_conv, true);
14174 }
14175
14176 int64_t  CS_LDK_KVStore_remove(int64_t this_arg, jstring primary_namespace, jstring secondary_namespace, jstring key, jboolean lazy) {
14177         void* this_arg_ptr = untag_ptr(this_arg);
14178         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14179         LDKKVStore* this_arg_conv = (LDKKVStore*)this_arg_ptr;
14180         LDKStr primary_namespace_conv = str_ref_to_owned_c(primary_namespace);
14181         LDKStr secondary_namespace_conv = str_ref_to_owned_c(secondary_namespace);
14182         LDKStr key_conv = str_ref_to_owned_c(key);
14183         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
14184         *ret_conv = (this_arg_conv->remove)(this_arg_conv->this_arg, primary_namespace_conv, secondary_namespace_conv, key_conv, lazy);
14185         return tag_ptr(ret_conv, true);
14186 }
14187
14188 int64_t  CS_LDK_KVStore_list(int64_t this_arg, jstring primary_namespace, jstring secondary_namespace) {
14189         void* this_arg_ptr = untag_ptr(this_arg);
14190         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14191         LDKKVStore* this_arg_conv = (LDKKVStore*)this_arg_ptr;
14192         LDKStr primary_namespace_conv = str_ref_to_owned_c(primary_namespace);
14193         LDKStr secondary_namespace_conv = str_ref_to_owned_c(secondary_namespace);
14194         LDKCResult_CVec_StrZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_StrZIOErrorZ), "LDKCResult_CVec_StrZIOErrorZ");
14195         *ret_conv = (this_arg_conv->list)(this_arg_conv->this_arg, primary_namespace_conv, secondary_namespace_conv);
14196         return tag_ptr(ret_conv, true);
14197 }
14198
14199 typedef struct LDKOutputSpender_JCalls {
14200         atomic_size_t refcnt;
14201         uint32_t instance_ptr;
14202 } LDKOutputSpender_JCalls;
14203 static void LDKOutputSpender_JCalls_free(void* this_arg) {
14204         LDKOutputSpender_JCalls *j_calls = (LDKOutputSpender_JCalls*) this_arg;
14205         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14206                 FREE(j_calls);
14207         }
14208 }
14209 LDKCResult_TransactionNoneZ spend_spendable_outputs_LDKOutputSpender_jcall(const void* this_arg, LDKCVec_SpendableOutputDescriptorZ descriptors, LDKCVec_TxOutZ outputs, LDKCVec_u8Z change_destination_script, uint32_t feerate_sat_per_1000_weight, LDKCOption_u32Z locktime) {
14210         LDKOutputSpender_JCalls *j_calls = (LDKOutputSpender_JCalls*) this_arg;
14211         LDKCVec_SpendableOutputDescriptorZ descriptors_var = descriptors;
14212         int64_tArray descriptors_arr = NULL;
14213         descriptors_arr = init_int64_tArray(descriptors_var.datalen, __LINE__);
14214         int64_t *descriptors_arr_ptr = (int64_t*)(((uint8_t*)descriptors_arr) + 8);
14215         for (size_t b = 0; b < descriptors_var.datalen; b++) {
14216                 LDKSpendableOutputDescriptor *descriptors_conv_27_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
14217                 *descriptors_conv_27_copy = descriptors_var.data[b];
14218                 int64_t descriptors_conv_27_ref = tag_ptr(descriptors_conv_27_copy, true);
14219                 descriptors_arr_ptr[b] = descriptors_conv_27_ref;
14220         }
14221         
14222         FREE(descriptors_var.data);
14223         LDKCVec_TxOutZ outputs_var = outputs;
14224         int64_tArray outputs_arr = NULL;
14225         outputs_arr = init_int64_tArray(outputs_var.datalen, __LINE__);
14226         int64_t *outputs_arr_ptr = (int64_t*)(((uint8_t*)outputs_arr) + 8);
14227         for (size_t h = 0; h < outputs_var.datalen; h++) {
14228                 LDKTxOut* outputs_conv_7_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
14229                 *outputs_conv_7_ref = outputs_var.data[h];
14230                 outputs_arr_ptr[h] = tag_ptr(outputs_conv_7_ref, true);
14231         }
14232         
14233         FREE(outputs_var.data);
14234         LDKCVec_u8Z change_destination_script_var = change_destination_script;
14235         int8_tArray change_destination_script_arr = init_int8_tArray(change_destination_script_var.datalen, __LINE__);
14236         memcpy(change_destination_script_arr->elems, change_destination_script_var.data, change_destination_script_var.datalen);
14237         CVec_u8Z_free(change_destination_script_var);
14238         int32_t feerate_sat_per_1000_weight_conv = feerate_sat_per_1000_weight;
14239         LDKCOption_u32Z *locktime_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
14240         *locktime_copy = locktime;
14241         int64_t locktime_ref = tag_ptr(locktime_copy, true);
14242         uint64_t ret = js_invoke_function_l_lllil(j_calls->instance_ptr, 63, (int64_t)descriptors_arr, (int64_t)outputs_arr, (int64_t)change_destination_script_arr, feerate_sat_per_1000_weight_conv, locktime_ref);
14243         void* ret_ptr = untag_ptr(ret);
14244         CHECK_ACCESS(ret_ptr);
14245         LDKCResult_TransactionNoneZ ret_conv = *(LDKCResult_TransactionNoneZ*)(ret_ptr);
14246         FREE(untag_ptr(ret));
14247         return ret_conv;
14248 }
14249 static void LDKOutputSpender_JCalls_cloned(LDKOutputSpender* new_obj) {
14250         LDKOutputSpender_JCalls *j_calls = (LDKOutputSpender_JCalls*) new_obj->this_arg;
14251         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14252 }
14253 static inline LDKOutputSpender LDKOutputSpender_init (int64_t o) {
14254         LDKOutputSpender_JCalls *calls = MALLOC(sizeof(LDKOutputSpender_JCalls), "LDKOutputSpender_JCalls");
14255         atomic_init(&calls->refcnt, 1);
14256         calls->instance_ptr = o;
14257
14258         LDKOutputSpender ret = {
14259                 .this_arg = (void*) calls,
14260                 .spend_spendable_outputs = spend_spendable_outputs_LDKOutputSpender_jcall,
14261                 .free = LDKOutputSpender_JCalls_free,
14262         };
14263         return ret;
14264 }
14265 uint64_t  CS_LDK_LDKOutputSpender_new(int32_t o) {
14266         LDKOutputSpender *res_ptr = MALLOC(sizeof(LDKOutputSpender), "LDKOutputSpender");
14267         *res_ptr = LDKOutputSpender_init(o);
14268         return tag_ptr(res_ptr, true);
14269 }
14270 int64_t  CS_LDK_OutputSpender_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) {
14271         void* this_arg_ptr = untag_ptr(this_arg);
14272         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14273         LDKOutputSpender* this_arg_conv = (LDKOutputSpender*)this_arg_ptr;
14274         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
14275         descriptors_constr.datalen = descriptors->arr_len;
14276         if (descriptors_constr.datalen > 0)
14277                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
14278         else
14279                 descriptors_constr.data = NULL;
14280         int64_t* descriptors_vals = descriptors->elems;
14281         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
14282                 int64_t descriptors_conv_27 = descriptors_vals[b];
14283                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
14284                 CHECK_ACCESS(descriptors_conv_27_ptr);
14285                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
14286                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
14287                 descriptors_constr.data[b] = descriptors_conv_27_conv;
14288         }
14289         FREE(descriptors);
14290         LDKCVec_TxOutZ outputs_constr;
14291         outputs_constr.datalen = outputs->arr_len;
14292         if (outputs_constr.datalen > 0)
14293                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
14294         else
14295                 outputs_constr.data = NULL;
14296         int64_t* outputs_vals = outputs->elems;
14297         for (size_t h = 0; h < outputs_constr.datalen; h++) {
14298                 int64_t outputs_conv_7 = outputs_vals[h];
14299                 void* outputs_conv_7_ptr = untag_ptr(outputs_conv_7);
14300                 CHECK_ACCESS(outputs_conv_7_ptr);
14301                 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
14302                 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(outputs_conv_7));
14303                 outputs_constr.data[h] = outputs_conv_7_conv;
14304         }
14305         FREE(outputs);
14306         LDKCVec_u8Z change_destination_script_ref;
14307         change_destination_script_ref.datalen = change_destination_script->arr_len;
14308         change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
14309         memcpy(change_destination_script_ref.data, change_destination_script->elems, change_destination_script_ref.datalen); FREE(change_destination_script);
14310         void* locktime_ptr = untag_ptr(locktime);
14311         CHECK_ACCESS(locktime_ptr);
14312         LDKCOption_u32Z locktime_conv = *(LDKCOption_u32Z*)(locktime_ptr);
14313         locktime_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(locktime));
14314         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
14315         *ret_conv = (this_arg_conv->spend_spendable_outputs)(this_arg_conv->this_arg, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight, locktime_conv);
14316         return tag_ptr(ret_conv, true);
14317 }
14318
14319 static inline struct LDKOutputSweeper CResult_OutputSweeperDecodeErrorZ_get_ok(LDKCResult_OutputSweeperDecodeErrorZ *NONNULL_PTR owner){
14320         LDKOutputSweeper ret = *owner->contents.result;
14321         ret.is_owned = false;
14322         return ret;
14323 }
14324 int64_t  CS_LDK_CResult_OutputSweeperDecodeErrorZ_get_ok(int64_t owner) {
14325         LDKCResult_OutputSweeperDecodeErrorZ* owner_conv = (LDKCResult_OutputSweeperDecodeErrorZ*)untag_ptr(owner);
14326         LDKOutputSweeper ret_var = CResult_OutputSweeperDecodeErrorZ_get_ok(owner_conv);
14327         int64_t ret_ref = 0;
14328         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14329         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14330         return ret_ref;
14331 }
14332
14333 static inline struct LDKDecodeError CResult_OutputSweeperDecodeErrorZ_get_err(LDKCResult_OutputSweeperDecodeErrorZ *NONNULL_PTR owner){
14334 CHECK(!owner->result_ok);
14335         return DecodeError_clone(&*owner->contents.err);
14336 }
14337 int64_t  CS_LDK_CResult_OutputSweeperDecodeErrorZ_get_err(int64_t owner) {
14338         LDKCResult_OutputSweeperDecodeErrorZ* owner_conv = (LDKCResult_OutputSweeperDecodeErrorZ*)untag_ptr(owner);
14339         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
14340         *ret_copy = CResult_OutputSweeperDecodeErrorZ_get_err(owner_conv);
14341         int64_t ret_ref = tag_ptr(ret_copy, true);
14342         return ret_ref;
14343 }
14344
14345 static inline struct LDKBestBlock C2Tuple_BestBlockOutputSweeperZ_get_a(LDKC2Tuple_BestBlockOutputSweeperZ *NONNULL_PTR owner){
14346         LDKBestBlock ret = owner->a;
14347         ret.is_owned = false;
14348         return ret;
14349 }
14350 int64_t  CS_LDK_C2Tuple_BestBlockOutputSweeperZ_get_a(int64_t owner) {
14351         LDKC2Tuple_BestBlockOutputSweeperZ* owner_conv = (LDKC2Tuple_BestBlockOutputSweeperZ*)untag_ptr(owner);
14352         LDKBestBlock ret_var = C2Tuple_BestBlockOutputSweeperZ_get_a(owner_conv);
14353         int64_t ret_ref = 0;
14354         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14355         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14356         return ret_ref;
14357 }
14358
14359 static inline struct LDKOutputSweeper C2Tuple_BestBlockOutputSweeperZ_get_b(LDKC2Tuple_BestBlockOutputSweeperZ *NONNULL_PTR owner){
14360         LDKOutputSweeper ret = owner->b;
14361         ret.is_owned = false;
14362         return ret;
14363 }
14364 int64_t  CS_LDK_C2Tuple_BestBlockOutputSweeperZ_get_b(int64_t owner) {
14365         LDKC2Tuple_BestBlockOutputSweeperZ* owner_conv = (LDKC2Tuple_BestBlockOutputSweeperZ*)untag_ptr(owner);
14366         LDKOutputSweeper ret_var = C2Tuple_BestBlockOutputSweeperZ_get_b(owner_conv);
14367         int64_t ret_ref = 0;
14368         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14369         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14370         return ret_ref;
14371 }
14372
14373 static inline struct LDKC2Tuple_BestBlockOutputSweeperZ *CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ *NONNULL_PTR owner){
14374 CHECK(owner->result_ok);
14375         return &*owner->contents.result;
14376 }
14377 int64_t  CS_LDK_CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_get_ok(int64_t owner) {
14378         LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ*)untag_ptr(owner);
14379         int64_t ret_ret = tag_ptr(CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_get_ok(owner_conv), false);
14380         return ret_ret;
14381 }
14382
14383 static inline struct LDKDecodeError CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_get_err(LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ *NONNULL_PTR owner){
14384 CHECK(!owner->result_ok);
14385         return DecodeError_clone(&*owner->contents.err);
14386 }
14387 int64_t  CS_LDK_CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_get_err(int64_t owner) {
14388         LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ*)untag_ptr(owner);
14389         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
14390         *ret_copy = CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_get_err(owner_conv);
14391         int64_t ret_ref = tag_ptr(ret_copy, true);
14392         return ret_ref;
14393 }
14394
14395 static inline struct LDKDelayedPaymentBasepoint CResult_DelayedPaymentBasepointDecodeErrorZ_get_ok(LDKCResult_DelayedPaymentBasepointDecodeErrorZ *NONNULL_PTR owner){
14396         LDKDelayedPaymentBasepoint ret = *owner->contents.result;
14397         ret.is_owned = false;
14398         return ret;
14399 }
14400 int64_t  CS_LDK_CResult_DelayedPaymentBasepointDecodeErrorZ_get_ok(int64_t owner) {
14401         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentBasepointDecodeErrorZ*)untag_ptr(owner);
14402         LDKDelayedPaymentBasepoint ret_var = CResult_DelayedPaymentBasepointDecodeErrorZ_get_ok(owner_conv);
14403         int64_t ret_ref = 0;
14404         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14405         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14406         return ret_ref;
14407 }
14408
14409 static inline struct LDKDecodeError CResult_DelayedPaymentBasepointDecodeErrorZ_get_err(LDKCResult_DelayedPaymentBasepointDecodeErrorZ *NONNULL_PTR owner){
14410 CHECK(!owner->result_ok);
14411         return DecodeError_clone(&*owner->contents.err);
14412 }
14413 int64_t  CS_LDK_CResult_DelayedPaymentBasepointDecodeErrorZ_get_err(int64_t owner) {
14414         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentBasepointDecodeErrorZ*)untag_ptr(owner);
14415         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
14416         *ret_copy = CResult_DelayedPaymentBasepointDecodeErrorZ_get_err(owner_conv);
14417         int64_t ret_ref = tag_ptr(ret_copy, true);
14418         return ret_ref;
14419 }
14420
14421 static inline struct LDKDelayedPaymentKey CResult_DelayedPaymentKeyDecodeErrorZ_get_ok(LDKCResult_DelayedPaymentKeyDecodeErrorZ *NONNULL_PTR owner){
14422         LDKDelayedPaymentKey ret = *owner->contents.result;
14423         ret.is_owned = false;
14424         return ret;
14425 }
14426 int64_t  CS_LDK_CResult_DelayedPaymentKeyDecodeErrorZ_get_ok(int64_t owner) {
14427         LDKCResult_DelayedPaymentKeyDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentKeyDecodeErrorZ*)untag_ptr(owner);
14428         LDKDelayedPaymentKey ret_var = CResult_DelayedPaymentKeyDecodeErrorZ_get_ok(owner_conv);
14429         int64_t ret_ref = 0;
14430         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14431         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14432         return ret_ref;
14433 }
14434
14435 static inline struct LDKDecodeError CResult_DelayedPaymentKeyDecodeErrorZ_get_err(LDKCResult_DelayedPaymentKeyDecodeErrorZ *NONNULL_PTR owner){
14436 CHECK(!owner->result_ok);
14437         return DecodeError_clone(&*owner->contents.err);
14438 }
14439 int64_t  CS_LDK_CResult_DelayedPaymentKeyDecodeErrorZ_get_err(int64_t owner) {
14440         LDKCResult_DelayedPaymentKeyDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentKeyDecodeErrorZ*)untag_ptr(owner);
14441         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
14442         *ret_copy = CResult_DelayedPaymentKeyDecodeErrorZ_get_err(owner_conv);
14443         int64_t ret_ref = tag_ptr(ret_copy, true);
14444         return ret_ref;
14445 }
14446
14447 static inline struct LDKHtlcBasepoint CResult_HtlcBasepointDecodeErrorZ_get_ok(LDKCResult_HtlcBasepointDecodeErrorZ *NONNULL_PTR owner){
14448         LDKHtlcBasepoint ret = *owner->contents.result;
14449         ret.is_owned = false;
14450         return ret;
14451 }
14452 int64_t  CS_LDK_CResult_HtlcBasepointDecodeErrorZ_get_ok(int64_t owner) {
14453         LDKCResult_HtlcBasepointDecodeErrorZ* owner_conv = (LDKCResult_HtlcBasepointDecodeErrorZ*)untag_ptr(owner);
14454         LDKHtlcBasepoint ret_var = CResult_HtlcBasepointDecodeErrorZ_get_ok(owner_conv);
14455         int64_t ret_ref = 0;
14456         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14457         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14458         return ret_ref;
14459 }
14460
14461 static inline struct LDKDecodeError CResult_HtlcBasepointDecodeErrorZ_get_err(LDKCResult_HtlcBasepointDecodeErrorZ *NONNULL_PTR owner){
14462 CHECK(!owner->result_ok);
14463         return DecodeError_clone(&*owner->contents.err);
14464 }
14465 int64_t  CS_LDK_CResult_HtlcBasepointDecodeErrorZ_get_err(int64_t owner) {
14466         LDKCResult_HtlcBasepointDecodeErrorZ* owner_conv = (LDKCResult_HtlcBasepointDecodeErrorZ*)untag_ptr(owner);
14467         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
14468         *ret_copy = CResult_HtlcBasepointDecodeErrorZ_get_err(owner_conv);
14469         int64_t ret_ref = tag_ptr(ret_copy, true);
14470         return ret_ref;
14471 }
14472
14473 static inline struct LDKHtlcKey CResult_HtlcKeyDecodeErrorZ_get_ok(LDKCResult_HtlcKeyDecodeErrorZ *NONNULL_PTR owner){
14474         LDKHtlcKey ret = *owner->contents.result;
14475         ret.is_owned = false;
14476         return ret;
14477 }
14478 int64_t  CS_LDK_CResult_HtlcKeyDecodeErrorZ_get_ok(int64_t owner) {
14479         LDKCResult_HtlcKeyDecodeErrorZ* owner_conv = (LDKCResult_HtlcKeyDecodeErrorZ*)untag_ptr(owner);
14480         LDKHtlcKey ret_var = CResult_HtlcKeyDecodeErrorZ_get_ok(owner_conv);
14481         int64_t ret_ref = 0;
14482         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14483         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14484         return ret_ref;
14485 }
14486
14487 static inline struct LDKDecodeError CResult_HtlcKeyDecodeErrorZ_get_err(LDKCResult_HtlcKeyDecodeErrorZ *NONNULL_PTR owner){
14488 CHECK(!owner->result_ok);
14489         return DecodeError_clone(&*owner->contents.err);
14490 }
14491 int64_t  CS_LDK_CResult_HtlcKeyDecodeErrorZ_get_err(int64_t owner) {
14492         LDKCResult_HtlcKeyDecodeErrorZ* owner_conv = (LDKCResult_HtlcKeyDecodeErrorZ*)untag_ptr(owner);
14493         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
14494         *ret_copy = CResult_HtlcKeyDecodeErrorZ_get_err(owner_conv);
14495         int64_t ret_ref = tag_ptr(ret_copy, true);
14496         return ret_ref;
14497 }
14498
14499 static inline struct LDKRevocationBasepoint CResult_RevocationBasepointDecodeErrorZ_get_ok(LDKCResult_RevocationBasepointDecodeErrorZ *NONNULL_PTR owner){
14500         LDKRevocationBasepoint ret = *owner->contents.result;
14501         ret.is_owned = false;
14502         return ret;
14503 }
14504 int64_t  CS_LDK_CResult_RevocationBasepointDecodeErrorZ_get_ok(int64_t owner) {
14505         LDKCResult_RevocationBasepointDecodeErrorZ* owner_conv = (LDKCResult_RevocationBasepointDecodeErrorZ*)untag_ptr(owner);
14506         LDKRevocationBasepoint ret_var = CResult_RevocationBasepointDecodeErrorZ_get_ok(owner_conv);
14507         int64_t ret_ref = 0;
14508         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14509         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14510         return ret_ref;
14511 }
14512
14513 static inline struct LDKDecodeError CResult_RevocationBasepointDecodeErrorZ_get_err(LDKCResult_RevocationBasepointDecodeErrorZ *NONNULL_PTR owner){
14514 CHECK(!owner->result_ok);
14515         return DecodeError_clone(&*owner->contents.err);
14516 }
14517 int64_t  CS_LDK_CResult_RevocationBasepointDecodeErrorZ_get_err(int64_t owner) {
14518         LDKCResult_RevocationBasepointDecodeErrorZ* owner_conv = (LDKCResult_RevocationBasepointDecodeErrorZ*)untag_ptr(owner);
14519         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
14520         *ret_copy = CResult_RevocationBasepointDecodeErrorZ_get_err(owner_conv);
14521         int64_t ret_ref = tag_ptr(ret_copy, true);
14522         return ret_ref;
14523 }
14524
14525 static inline struct LDKRevocationKey CResult_RevocationKeyDecodeErrorZ_get_ok(LDKCResult_RevocationKeyDecodeErrorZ *NONNULL_PTR owner){
14526         LDKRevocationKey ret = *owner->contents.result;
14527         ret.is_owned = false;
14528         return ret;
14529 }
14530 int64_t  CS_LDK_CResult_RevocationKeyDecodeErrorZ_get_ok(int64_t owner) {
14531         LDKCResult_RevocationKeyDecodeErrorZ* owner_conv = (LDKCResult_RevocationKeyDecodeErrorZ*)untag_ptr(owner);
14532         LDKRevocationKey ret_var = CResult_RevocationKeyDecodeErrorZ_get_ok(owner_conv);
14533         int64_t ret_ref = 0;
14534         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14535         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14536         return ret_ref;
14537 }
14538
14539 static inline struct LDKDecodeError CResult_RevocationKeyDecodeErrorZ_get_err(LDKCResult_RevocationKeyDecodeErrorZ *NONNULL_PTR owner){
14540 CHECK(!owner->result_ok);
14541         return DecodeError_clone(&*owner->contents.err);
14542 }
14543 int64_t  CS_LDK_CResult_RevocationKeyDecodeErrorZ_get_err(int64_t owner) {
14544         LDKCResult_RevocationKeyDecodeErrorZ* owner_conv = (LDKCResult_RevocationKeyDecodeErrorZ*)untag_ptr(owner);
14545         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
14546         *ret_copy = CResult_RevocationKeyDecodeErrorZ_get_err(owner_conv);
14547         int64_t ret_ref = tag_ptr(ret_copy, true);
14548         return ret_ref;
14549 }
14550
14551 static inline struct LDKLockedChannelMonitor CResult_LockedChannelMonitorNoneZ_get_ok(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
14552         LDKLockedChannelMonitor ret = *owner->contents.result;
14553         ret.is_owned = false;
14554         return ret;
14555 }
14556 int64_t  CS_LDK_CResult_LockedChannelMonitorNoneZ_get_ok(int64_t owner) {
14557         LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(owner);
14558         LDKLockedChannelMonitor ret_var = CResult_LockedChannelMonitorNoneZ_get_ok(owner_conv);
14559         int64_t ret_ref = 0;
14560         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14561         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14562         return ret_ref;
14563 }
14564
14565 static inline void CResult_LockedChannelMonitorNoneZ_get_err(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
14566 CHECK(!owner->result_ok);
14567         return *owner->contents.err;
14568 }
14569 void  CS_LDK_CResult_LockedChannelMonitorNoneZ_get_err(int64_t owner) {
14570         LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(owner);
14571         CResult_LockedChannelMonitorNoneZ_get_err(owner_conv);
14572 }
14573
14574 static inline struct LDKOutPoint C2Tuple_OutPointChannelIdZ_get_a(LDKC2Tuple_OutPointChannelIdZ *NONNULL_PTR owner){
14575         LDKOutPoint ret = owner->a;
14576         ret.is_owned = false;
14577         return ret;
14578 }
14579 int64_t  CS_LDK_C2Tuple_OutPointChannelIdZ_get_a(int64_t owner) {
14580         LDKC2Tuple_OutPointChannelIdZ* owner_conv = (LDKC2Tuple_OutPointChannelIdZ*)untag_ptr(owner);
14581         LDKOutPoint ret_var = C2Tuple_OutPointChannelIdZ_get_a(owner_conv);
14582         int64_t ret_ref = 0;
14583         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14584         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14585         return ret_ref;
14586 }
14587
14588 static inline struct LDKChannelId C2Tuple_OutPointChannelIdZ_get_b(LDKC2Tuple_OutPointChannelIdZ *NONNULL_PTR owner){
14589         LDKChannelId ret = owner->b;
14590         ret.is_owned = false;
14591         return ret;
14592 }
14593 int64_t  CS_LDK_C2Tuple_OutPointChannelIdZ_get_b(int64_t owner) {
14594         LDKC2Tuple_OutPointChannelIdZ* owner_conv = (LDKC2Tuple_OutPointChannelIdZ*)untag_ptr(owner);
14595         LDKChannelId ret_var = C2Tuple_OutPointChannelIdZ_get_b(owner_conv);
14596         int64_t ret_ref = 0;
14597         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14598         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14599         return ret_ref;
14600 }
14601
14602 static inline LDKCVec_C2Tuple_OutPointChannelIdZZ CVec_C2Tuple_OutPointChannelIdZZ_clone(const LDKCVec_C2Tuple_OutPointChannelIdZZ *orig) {
14603         LDKCVec_C2Tuple_OutPointChannelIdZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_OutPointChannelIdZ) * orig->datalen, "LDKCVec_C2Tuple_OutPointChannelIdZZ clone bytes"), .datalen = orig->datalen };
14604         for (size_t i = 0; i < ret.datalen; i++) {
14605                 ret.data[i] = C2Tuple_OutPointChannelIdZ_clone(&orig->data[i]);
14606         }
14607         return ret;
14608 }
14609 static inline LDKCVec_MonitorUpdateIdZ CVec_MonitorUpdateIdZ_clone(const LDKCVec_MonitorUpdateIdZ *orig) {
14610         LDKCVec_MonitorUpdateIdZ ret = { .data = MALLOC(sizeof(LDKMonitorUpdateId) * orig->datalen, "LDKCVec_MonitorUpdateIdZ clone bytes"), .datalen = orig->datalen };
14611         for (size_t i = 0; i < ret.datalen; i++) {
14612                 ret.data[i] = MonitorUpdateId_clone(&orig->data[i]);
14613         }
14614         return ret;
14615 }
14616 static inline struct LDKOutPoint C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_a(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR owner){
14617         LDKOutPoint ret = owner->a;
14618         ret.is_owned = false;
14619         return ret;
14620 }
14621 int64_t  CS_LDK_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_a(int64_t owner) {
14622         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* owner_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(owner);
14623         LDKOutPoint ret_var = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_a(owner_conv);
14624         int64_t ret_ref = 0;
14625         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14626         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14627         return ret_ref;
14628 }
14629
14630 static inline struct LDKCVec_MonitorUpdateIdZ C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_b(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR owner){
14631         return CVec_MonitorUpdateIdZ_clone(&owner->b);
14632 }
14633 int64_tArray  CS_LDK_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_b(int64_t owner) {
14634         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* owner_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(owner);
14635         LDKCVec_MonitorUpdateIdZ ret_var = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_b(owner_conv);
14636         int64_tArray ret_arr = NULL;
14637         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
14638         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
14639         for (size_t r = 0; r < ret_var.datalen; r++) {
14640                 LDKMonitorUpdateId ret_conv_17_var = ret_var.data[r];
14641                 int64_t ret_conv_17_ref = 0;
14642                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_17_var);
14643                 ret_conv_17_ref = tag_ptr(ret_conv_17_var.inner, ret_conv_17_var.is_owned);
14644                 ret_arr_ptr[r] = ret_conv_17_ref;
14645         }
14646         
14647         FREE(ret_var.data);
14648         return ret_arr;
14649 }
14650
14651 static inline LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_clone(const LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ *orig) {
14652         LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ) * orig->datalen, "LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ clone bytes"), .datalen = orig->datalen };
14653         for (size_t i = 0; i < ret.datalen; i++) {
14654                 ret.data[i] = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(&orig->data[i]);
14655         }
14656         return ret;
14657 }
14658 typedef struct LDKPersister_JCalls {
14659         atomic_size_t refcnt;
14660         uint32_t instance_ptr;
14661 } LDKPersister_JCalls;
14662 static void LDKPersister_JCalls_free(void* this_arg) {
14663         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
14664         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14665                 FREE(j_calls);
14666         }
14667 }
14668 LDKCResult_NoneIOErrorZ persist_manager_LDKPersister_jcall(const void* this_arg, const LDKChannelManager * channel_manager) {
14669         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
14670         LDKChannelManager channel_manager_var = *channel_manager;
14671         int64_t channel_manager_ref = 0;
14672         // WARNING: we may need a move here but no clone is available for LDKChannelManager
14673         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_var);
14674         channel_manager_ref = tag_ptr(channel_manager_var.inner, channel_manager_var.is_owned);
14675         uint64_t ret = js_invoke_function_l_l(j_calls->instance_ptr, 64, channel_manager_ref);
14676         void* ret_ptr = untag_ptr(ret);
14677         CHECK_ACCESS(ret_ptr);
14678         LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
14679         FREE(untag_ptr(ret));
14680         return ret_conv;
14681 }
14682 LDKCResult_NoneIOErrorZ persist_graph_LDKPersister_jcall(const void* this_arg, const LDKNetworkGraph * network_graph) {
14683         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
14684         LDKNetworkGraph network_graph_var = *network_graph;
14685         int64_t network_graph_ref = 0;
14686         // WARNING: we may need a move here but no clone is available for LDKNetworkGraph
14687         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_var);
14688         network_graph_ref = tag_ptr(network_graph_var.inner, network_graph_var.is_owned);
14689         uint64_t ret = js_invoke_function_l_l(j_calls->instance_ptr, 65, network_graph_ref);
14690         void* ret_ptr = untag_ptr(ret);
14691         CHECK_ACCESS(ret_ptr);
14692         LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
14693         FREE(untag_ptr(ret));
14694         return ret_conv;
14695 }
14696 LDKCResult_NoneIOErrorZ persist_scorer_LDKPersister_jcall(const void* this_arg, const LDKWriteableScore * scorer) {
14697         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
14698         // WARNING: This object doesn't live past this scope, needs clone!
14699         int64_t ret_scorer = tag_ptr(scorer, false);
14700         uint64_t ret = js_invoke_function_l_l(j_calls->instance_ptr, 66, ret_scorer);
14701         void* ret_ptr = untag_ptr(ret);
14702         CHECK_ACCESS(ret_ptr);
14703         LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
14704         FREE(untag_ptr(ret));
14705         return ret_conv;
14706 }
14707 static void LDKPersister_JCalls_cloned(LDKPersister* new_obj) {
14708         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) new_obj->this_arg;
14709         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14710 }
14711 static inline LDKPersister LDKPersister_init (int64_t o) {
14712         LDKPersister_JCalls *calls = MALLOC(sizeof(LDKPersister_JCalls), "LDKPersister_JCalls");
14713         atomic_init(&calls->refcnt, 1);
14714         calls->instance_ptr = o;
14715
14716         LDKPersister ret = {
14717                 .this_arg = (void*) calls,
14718                 .persist_manager = persist_manager_LDKPersister_jcall,
14719                 .persist_graph = persist_graph_LDKPersister_jcall,
14720                 .persist_scorer = persist_scorer_LDKPersister_jcall,
14721                 .free = LDKPersister_JCalls_free,
14722         };
14723         return ret;
14724 }
14725 uint64_t  CS_LDK_LDKPersister_new(int32_t o) {
14726         LDKPersister *res_ptr = MALLOC(sizeof(LDKPersister), "LDKPersister");
14727         *res_ptr = LDKPersister_init(o);
14728         return tag_ptr(res_ptr, true);
14729 }
14730 int64_t  CS_LDK_Persister_persist_manager(int64_t this_arg, int64_t channel_manager) {
14731         void* this_arg_ptr = untag_ptr(this_arg);
14732         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14733         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
14734         LDKChannelManager channel_manager_conv;
14735         channel_manager_conv.inner = untag_ptr(channel_manager);
14736         channel_manager_conv.is_owned = ptr_is_owned(channel_manager);
14737         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_conv);
14738         channel_manager_conv.is_owned = false;
14739         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
14740         *ret_conv = (this_arg_conv->persist_manager)(this_arg_conv->this_arg, &channel_manager_conv);
14741         return tag_ptr(ret_conv, true);
14742 }
14743
14744 int64_t  CS_LDK_Persister_persist_graph(int64_t this_arg, int64_t network_graph) {
14745         void* this_arg_ptr = untag_ptr(this_arg);
14746         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14747         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
14748         LDKNetworkGraph network_graph_conv;
14749         network_graph_conv.inner = untag_ptr(network_graph);
14750         network_graph_conv.is_owned = ptr_is_owned(network_graph);
14751         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
14752         network_graph_conv.is_owned = false;
14753         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
14754         *ret_conv = (this_arg_conv->persist_graph)(this_arg_conv->this_arg, &network_graph_conv);
14755         return tag_ptr(ret_conv, true);
14756 }
14757
14758 int64_t  CS_LDK_Persister_persist_scorer(int64_t this_arg, int64_t scorer) {
14759         void* this_arg_ptr = untag_ptr(this_arg);
14760         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14761         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
14762         void* scorer_ptr = untag_ptr(scorer);
14763         if (ptr_is_owned(scorer)) { CHECK_ACCESS(scorer_ptr); }
14764         LDKWriteableScore* scorer_conv = (LDKWriteableScore*)scorer_ptr;
14765         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
14766         *ret_conv = (this_arg_conv->persist_scorer)(this_arg_conv->this_arg, scorer_conv);
14767         return tag_ptr(ret_conv, true);
14768 }
14769
14770 typedef struct LDKPersist_JCalls {
14771         atomic_size_t refcnt;
14772         uint32_t instance_ptr;
14773 } LDKPersist_JCalls;
14774 static void LDKPersist_JCalls_free(void* this_arg) {
14775         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
14776         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14777                 FREE(j_calls);
14778         }
14779 }
14780 LDKChannelMonitorUpdateStatus persist_new_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_funding_outpoint, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
14781         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
14782         LDKOutPoint channel_funding_outpoint_var = channel_funding_outpoint;
14783         int64_t channel_funding_outpoint_ref = 0;
14784         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_funding_outpoint_var);
14785         channel_funding_outpoint_ref = tag_ptr(channel_funding_outpoint_var.inner, channel_funding_outpoint_var.is_owned);
14786         LDKChannelMonitor data_var = *data;
14787         int64_t data_ref = 0;
14788         data_var = ChannelMonitor_clone(&data_var);
14789         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
14790         data_ref = tag_ptr(data_var.inner, data_var.is_owned);
14791         LDKMonitorUpdateId update_id_var = update_id;
14792         int64_t update_id_ref = 0;
14793         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
14794         update_id_ref = tag_ptr(update_id_var.inner, update_id_var.is_owned);
14795         uint64_t ret = js_invoke_function_ChannelMonitorUpdateStatus_lll(j_calls->instance_ptr, 67, channel_funding_outpoint_ref, data_ref, update_id_ref);
14796         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_cs(ret);
14797         return ret_conv;
14798 }
14799 LDKChannelMonitorUpdateStatus update_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_funding_outpoint, LDKChannelMonitorUpdate update, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
14800         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
14801         LDKOutPoint channel_funding_outpoint_var = channel_funding_outpoint;
14802         int64_t channel_funding_outpoint_ref = 0;
14803         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_funding_outpoint_var);
14804         channel_funding_outpoint_ref = tag_ptr(channel_funding_outpoint_var.inner, channel_funding_outpoint_var.is_owned);
14805         LDKChannelMonitorUpdate update_var = update;
14806         int64_t update_ref = 0;
14807         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
14808         update_ref = tag_ptr(update_var.inner, update_var.is_owned);
14809         LDKChannelMonitor data_var = *data;
14810         int64_t data_ref = 0;
14811         data_var = ChannelMonitor_clone(&data_var);
14812         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
14813         data_ref = tag_ptr(data_var.inner, data_var.is_owned);
14814         LDKMonitorUpdateId update_id_var = update_id;
14815         int64_t update_id_ref = 0;
14816         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
14817         update_id_ref = tag_ptr(update_id_var.inner, update_id_var.is_owned);
14818         uint64_t ret = js_invoke_function_ChannelMonitorUpdateStatus_llll(j_calls->instance_ptr, 68, channel_funding_outpoint_ref, update_ref, data_ref, update_id_ref);
14819         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_cs(ret);
14820         return ret_conv;
14821 }
14822 void archive_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_funding_outpoint) {
14823         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
14824         LDKOutPoint channel_funding_outpoint_var = channel_funding_outpoint;
14825         int64_t channel_funding_outpoint_ref = 0;
14826         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_funding_outpoint_var);
14827         channel_funding_outpoint_ref = tag_ptr(channel_funding_outpoint_var.inner, channel_funding_outpoint_var.is_owned);
14828         js_invoke_function_void_l(j_calls->instance_ptr, 69, channel_funding_outpoint_ref);
14829 }
14830 static void LDKPersist_JCalls_cloned(LDKPersist* new_obj) {
14831         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) new_obj->this_arg;
14832         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14833 }
14834 static inline LDKPersist LDKPersist_init (int64_t o) {
14835         LDKPersist_JCalls *calls = MALLOC(sizeof(LDKPersist_JCalls), "LDKPersist_JCalls");
14836         atomic_init(&calls->refcnt, 1);
14837         calls->instance_ptr = o;
14838
14839         LDKPersist ret = {
14840                 .this_arg = (void*) calls,
14841                 .persist_new_channel = persist_new_channel_LDKPersist_jcall,
14842                 .update_persisted_channel = update_persisted_channel_LDKPersist_jcall,
14843                 .archive_persisted_channel = archive_persisted_channel_LDKPersist_jcall,
14844                 .free = LDKPersist_JCalls_free,
14845         };
14846         return ret;
14847 }
14848 uint64_t  CS_LDK_LDKPersist_new(int32_t o) {
14849         LDKPersist *res_ptr = MALLOC(sizeof(LDKPersist), "LDKPersist");
14850         *res_ptr = LDKPersist_init(o);
14851         return tag_ptr(res_ptr, true);
14852 }
14853 int32_t  CS_LDK_Persist_persist_new_channel(int64_t this_arg, int64_t channel_funding_outpoint, int64_t data, int64_t update_id) {
14854         void* this_arg_ptr = untag_ptr(this_arg);
14855         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14856         LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
14857         LDKOutPoint channel_funding_outpoint_conv;
14858         channel_funding_outpoint_conv.inner = untag_ptr(channel_funding_outpoint);
14859         channel_funding_outpoint_conv.is_owned = ptr_is_owned(channel_funding_outpoint);
14860         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_funding_outpoint_conv);
14861         channel_funding_outpoint_conv = OutPoint_clone(&channel_funding_outpoint_conv);
14862         LDKChannelMonitor data_conv;
14863         data_conv.inner = untag_ptr(data);
14864         data_conv.is_owned = ptr_is_owned(data);
14865         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
14866         data_conv.is_owned = false;
14867         LDKMonitorUpdateId update_id_conv;
14868         update_id_conv.inner = untag_ptr(update_id);
14869         update_id_conv.is_owned = ptr_is_owned(update_id);
14870         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
14871         update_id_conv = MonitorUpdateId_clone(&update_id_conv);
14872         int32_t ret_conv = LDKChannelMonitorUpdateStatus_to_cs((this_arg_conv->persist_new_channel)(this_arg_conv->this_arg, channel_funding_outpoint_conv, &data_conv, update_id_conv));
14873         return ret_conv;
14874 }
14875
14876 int32_t  CS_LDK_Persist_update_persisted_channel(int64_t this_arg, int64_t channel_funding_outpoint, int64_t update, int64_t data, int64_t update_id) {
14877         void* this_arg_ptr = untag_ptr(this_arg);
14878         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14879         LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
14880         LDKOutPoint channel_funding_outpoint_conv;
14881         channel_funding_outpoint_conv.inner = untag_ptr(channel_funding_outpoint);
14882         channel_funding_outpoint_conv.is_owned = ptr_is_owned(channel_funding_outpoint);
14883         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_funding_outpoint_conv);
14884         channel_funding_outpoint_conv = OutPoint_clone(&channel_funding_outpoint_conv);
14885         LDKChannelMonitorUpdate update_conv;
14886         update_conv.inner = untag_ptr(update);
14887         update_conv.is_owned = ptr_is_owned(update);
14888         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
14889         update_conv = ChannelMonitorUpdate_clone(&update_conv);
14890         LDKChannelMonitor data_conv;
14891         data_conv.inner = untag_ptr(data);
14892         data_conv.is_owned = ptr_is_owned(data);
14893         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
14894         data_conv.is_owned = false;
14895         LDKMonitorUpdateId update_id_conv;
14896         update_id_conv.inner = untag_ptr(update_id);
14897         update_id_conv.is_owned = ptr_is_owned(update_id);
14898         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
14899         update_id_conv = MonitorUpdateId_clone(&update_id_conv);
14900         int32_t ret_conv = LDKChannelMonitorUpdateStatus_to_cs((this_arg_conv->update_persisted_channel)(this_arg_conv->this_arg, channel_funding_outpoint_conv, update_conv, &data_conv, update_id_conv));
14901         return ret_conv;
14902 }
14903
14904 void  CS_LDK_Persist_archive_persisted_channel(int64_t this_arg, int64_t channel_funding_outpoint) {
14905         void* this_arg_ptr = untag_ptr(this_arg);
14906         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14907         LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
14908         LDKOutPoint channel_funding_outpoint_conv;
14909         channel_funding_outpoint_conv.inner = untag_ptr(channel_funding_outpoint);
14910         channel_funding_outpoint_conv.is_owned = ptr_is_owned(channel_funding_outpoint);
14911         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_funding_outpoint_conv);
14912         channel_funding_outpoint_conv = OutPoint_clone(&channel_funding_outpoint_conv);
14913         (this_arg_conv->archive_persisted_channel)(this_arg_conv->this_arg, channel_funding_outpoint_conv);
14914 }
14915
14916 typedef struct LDKListen_JCalls {
14917         atomic_size_t refcnt;
14918         uint32_t instance_ptr;
14919 } LDKListen_JCalls;
14920 static void LDKListen_JCalls_free(void* this_arg) {
14921         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
14922         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14923                 FREE(j_calls);
14924         }
14925 }
14926 void filtered_block_connected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
14927         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
14928         int8_tArray header_arr = init_int8_tArray(80, __LINE__);
14929         memcpy(header_arr->elems, *header, 80);
14930         LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
14931         int64_tArray txdata_arr = NULL;
14932         txdata_arr = init_int64_tArray(txdata_var.datalen, __LINE__);
14933         int64_t *txdata_arr_ptr = (int64_t*)(((uint8_t*)txdata_arr) + 8);
14934         for (size_t c = 0; c < txdata_var.datalen; c++) {
14935                 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
14936                 *txdata_conv_28_conv = txdata_var.data[c];
14937                 txdata_arr_ptr[c] = tag_ptr(txdata_conv_28_conv, true);
14938         }
14939         
14940         FREE(txdata_var.data);
14941         int32_t height_conv = height;
14942         js_invoke_function_void_lli(j_calls->instance_ptr, 70, (int64_t)header_arr, (int64_t)txdata_arr, height_conv);
14943 }
14944 void block_connected_LDKListen_jcall(const void* this_arg, LDKu8slice block, uint32_t height) {
14945         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
14946         LDKu8slice block_var = block;
14947         int8_tArray block_arr = init_int8_tArray(block_var.datalen, __LINE__);
14948         memcpy(block_arr->elems, block_var.data, block_var.datalen);
14949         int32_t height_conv = height;
14950         js_invoke_function_void_li(j_calls->instance_ptr, 71, (int64_t)block_arr, height_conv);
14951 }
14952 void block_disconnected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
14953         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
14954         int8_tArray header_arr = init_int8_tArray(80, __LINE__);
14955         memcpy(header_arr->elems, *header, 80);
14956         int32_t height_conv = height;
14957         js_invoke_function_void_li(j_calls->instance_ptr, 72, (int64_t)header_arr, height_conv);
14958 }
14959 static void LDKListen_JCalls_cloned(LDKListen* new_obj) {
14960         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) new_obj->this_arg;
14961         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14962 }
14963 static inline LDKListen LDKListen_init (int64_t o) {
14964         LDKListen_JCalls *calls = MALLOC(sizeof(LDKListen_JCalls), "LDKListen_JCalls");
14965         atomic_init(&calls->refcnt, 1);
14966         calls->instance_ptr = o;
14967
14968         LDKListen ret = {
14969                 .this_arg = (void*) calls,
14970                 .filtered_block_connected = filtered_block_connected_LDKListen_jcall,
14971                 .block_connected = block_connected_LDKListen_jcall,
14972                 .block_disconnected = block_disconnected_LDKListen_jcall,
14973                 .free = LDKListen_JCalls_free,
14974         };
14975         return ret;
14976 }
14977 uint64_t  CS_LDK_LDKListen_new(int32_t o) {
14978         LDKListen *res_ptr = MALLOC(sizeof(LDKListen), "LDKListen");
14979         *res_ptr = LDKListen_init(o);
14980         return tag_ptr(res_ptr, true);
14981 }
14982 void  CS_LDK_Listen_filtered_block_connected(int64_t this_arg, int8_tArray header, int64_tArray txdata, int32_t height) {
14983         void* this_arg_ptr = untag_ptr(this_arg);
14984         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14985         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
14986         uint8_t header_arr[80];
14987         CHECK(header->arr_len == 80);
14988         memcpy(header_arr, header->elems, 80); FREE(header);
14989         uint8_t (*header_ref)[80] = &header_arr;
14990         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
14991         txdata_constr.datalen = txdata->arr_len;
14992         if (txdata_constr.datalen > 0)
14993                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
14994         else
14995                 txdata_constr.data = NULL;
14996         int64_t* txdata_vals = txdata->elems;
14997         for (size_t c = 0; c < txdata_constr.datalen; c++) {
14998                 int64_t txdata_conv_28 = txdata_vals[c];
14999                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
15000                 CHECK_ACCESS(txdata_conv_28_ptr);
15001                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
15002                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
15003                 txdata_constr.data[c] = txdata_conv_28_conv;
15004         }
15005         FREE(txdata);
15006         (this_arg_conv->filtered_block_connected)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
15007 }
15008
15009 void  CS_LDK_Listen_block_connected(int64_t this_arg, int8_tArray block, int32_t height) {
15010         void* this_arg_ptr = untag_ptr(this_arg);
15011         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15012         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
15013         LDKu8slice block_ref;
15014         block_ref.datalen = block->arr_len;
15015         block_ref.data = block->elems;
15016         (this_arg_conv->block_connected)(this_arg_conv->this_arg, block_ref, height);
15017         FREE(block);
15018 }
15019
15020 void  CS_LDK_Listen_block_disconnected(int64_t this_arg, int8_tArray header, int32_t height) {
15021         void* this_arg_ptr = untag_ptr(this_arg);
15022         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15023         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
15024         uint8_t header_arr[80];
15025         CHECK(header->arr_len == 80);
15026         memcpy(header_arr, header->elems, 80); FREE(header);
15027         uint8_t (*header_ref)[80] = &header_arr;
15028         (this_arg_conv->block_disconnected)(this_arg_conv->this_arg, header_ref, height);
15029 }
15030
15031 typedef struct LDKConfirm_JCalls {
15032         atomic_size_t refcnt;
15033         uint32_t instance_ptr;
15034 } LDKConfirm_JCalls;
15035 static void LDKConfirm_JCalls_free(void* this_arg) {
15036         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
15037         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
15038                 FREE(j_calls);
15039         }
15040 }
15041 void transactions_confirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
15042         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
15043         int8_tArray header_arr = init_int8_tArray(80, __LINE__);
15044         memcpy(header_arr->elems, *header, 80);
15045         LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
15046         int64_tArray txdata_arr = NULL;
15047         txdata_arr = init_int64_tArray(txdata_var.datalen, __LINE__);
15048         int64_t *txdata_arr_ptr = (int64_t*)(((uint8_t*)txdata_arr) + 8);
15049         for (size_t c = 0; c < txdata_var.datalen; c++) {
15050                 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
15051                 *txdata_conv_28_conv = txdata_var.data[c];
15052                 txdata_arr_ptr[c] = tag_ptr(txdata_conv_28_conv, true);
15053         }
15054         
15055         FREE(txdata_var.data);
15056         int32_t height_conv = height;
15057         js_invoke_function_void_lli(j_calls->instance_ptr, 73, (int64_t)header_arr, (int64_t)txdata_arr, height_conv);
15058 }
15059 void transaction_unconfirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* txid)[32]) {
15060         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
15061         int8_tArray txid_arr = init_int8_tArray(32, __LINE__);
15062         memcpy(txid_arr->elems, *txid, 32);
15063         js_invoke_function_void_l(j_calls->instance_ptr, 74, (int64_t)txid_arr);
15064 }
15065 void best_block_updated_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
15066         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
15067         int8_tArray header_arr = init_int8_tArray(80, __LINE__);
15068         memcpy(header_arr->elems, *header, 80);
15069         int32_t height_conv = height;
15070         js_invoke_function_void_li(j_calls->instance_ptr, 75, (int64_t)header_arr, height_conv);
15071 }
15072 LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ get_relevant_txids_LDKConfirm_jcall(const void* this_arg) {
15073         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
15074         int64_tArray ret = (int64_tArray)js_invoke_function_l_(j_calls->instance_ptr, 76);
15075         LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ ret_constr;
15076         ret_constr.datalen = ret->arr_len;
15077         if (ret_constr.datalen > 0)
15078                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ), "LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ Elements");
15079         else
15080                 ret_constr.data = NULL;
15081         int64_t* ret_vals = ret->elems;
15082         for (size_t c = 0; c < ret_constr.datalen; c++) {
15083                 int64_t ret_conv_54 = ret_vals[c];
15084                 void* ret_conv_54_ptr = untag_ptr(ret_conv_54);
15085                 CHECK_ACCESS(ret_conv_54_ptr);
15086                 LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ ret_conv_54_conv = *(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ*)(ret_conv_54_ptr);
15087                 FREE(untag_ptr(ret_conv_54));
15088                 ret_constr.data[c] = ret_conv_54_conv;
15089         }
15090         FREE(ret);
15091         return ret_constr;
15092 }
15093 static void LDKConfirm_JCalls_cloned(LDKConfirm* new_obj) {
15094         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) new_obj->this_arg;
15095         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
15096 }
15097 static inline LDKConfirm LDKConfirm_init (int64_t o) {
15098         LDKConfirm_JCalls *calls = MALLOC(sizeof(LDKConfirm_JCalls), "LDKConfirm_JCalls");
15099         atomic_init(&calls->refcnt, 1);
15100         calls->instance_ptr = o;
15101
15102         LDKConfirm ret = {
15103                 .this_arg = (void*) calls,
15104                 .transactions_confirmed = transactions_confirmed_LDKConfirm_jcall,
15105                 .transaction_unconfirmed = transaction_unconfirmed_LDKConfirm_jcall,
15106                 .best_block_updated = best_block_updated_LDKConfirm_jcall,
15107                 .get_relevant_txids = get_relevant_txids_LDKConfirm_jcall,
15108                 .free = LDKConfirm_JCalls_free,
15109         };
15110         return ret;
15111 }
15112 uint64_t  CS_LDK_LDKConfirm_new(int32_t o) {
15113         LDKConfirm *res_ptr = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
15114         *res_ptr = LDKConfirm_init(o);
15115         return tag_ptr(res_ptr, true);
15116 }
15117 void  CS_LDK_Confirm_transactions_confirmed(int64_t this_arg, int8_tArray header, int64_tArray txdata, int32_t height) {
15118         void* this_arg_ptr = untag_ptr(this_arg);
15119         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15120         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
15121         uint8_t header_arr[80];
15122         CHECK(header->arr_len == 80);
15123         memcpy(header_arr, header->elems, 80); FREE(header);
15124         uint8_t (*header_ref)[80] = &header_arr;
15125         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
15126         txdata_constr.datalen = txdata->arr_len;
15127         if (txdata_constr.datalen > 0)
15128                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
15129         else
15130                 txdata_constr.data = NULL;
15131         int64_t* txdata_vals = txdata->elems;
15132         for (size_t c = 0; c < txdata_constr.datalen; c++) {
15133                 int64_t txdata_conv_28 = txdata_vals[c];
15134                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
15135                 CHECK_ACCESS(txdata_conv_28_ptr);
15136                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
15137                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
15138                 txdata_constr.data[c] = txdata_conv_28_conv;
15139         }
15140         FREE(txdata);
15141         (this_arg_conv->transactions_confirmed)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
15142 }
15143
15144 void  CS_LDK_Confirm_transaction_unconfirmed(int64_t this_arg, int8_tArray txid) {
15145         void* this_arg_ptr = untag_ptr(this_arg);
15146         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15147         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
15148         uint8_t txid_arr[32];
15149         CHECK(txid->arr_len == 32);
15150         memcpy(txid_arr, txid->elems, 32); FREE(txid);
15151         uint8_t (*txid_ref)[32] = &txid_arr;
15152         (this_arg_conv->transaction_unconfirmed)(this_arg_conv->this_arg, txid_ref);
15153 }
15154
15155 void  CS_LDK_Confirm_best_block_updated(int64_t this_arg, int8_tArray header, int32_t height) {
15156         void* this_arg_ptr = untag_ptr(this_arg);
15157         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15158         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
15159         uint8_t header_arr[80];
15160         CHECK(header->arr_len == 80);
15161         memcpy(header_arr, header->elems, 80); FREE(header);
15162         uint8_t (*header_ref)[80] = &header_arr;
15163         (this_arg_conv->best_block_updated)(this_arg_conv->this_arg, header_ref, height);
15164 }
15165
15166 int64_tArray  CS_LDK_Confirm_get_relevant_txids(int64_t this_arg) {
15167         void* this_arg_ptr = untag_ptr(this_arg);
15168         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15169         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
15170         LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ ret_var = (this_arg_conv->get_relevant_txids)(this_arg_conv->this_arg);
15171         int64_tArray ret_arr = NULL;
15172         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
15173         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
15174         for (size_t c = 0; c < ret_var.datalen; c++) {
15175                 LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* ret_conv_54_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ), "LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ");
15176                 *ret_conv_54_conv = ret_var.data[c];
15177                 ret_arr_ptr[c] = tag_ptr(ret_conv_54_conv, true);
15178         }
15179         
15180         FREE(ret_var.data);
15181         return ret_arr;
15182 }
15183
15184 uint32_t CS_LDK_LDKSpendingDelay_ty_from_ptr(int64_t ptr) {
15185         LDKSpendingDelay *obj = (LDKSpendingDelay*)untag_ptr(ptr);
15186         switch(obj->tag) {
15187                 case LDKSpendingDelay_Relative: return 0;
15188                 case LDKSpendingDelay_Absolute: return 1;
15189                 default: abort();
15190         }
15191 }
15192 int32_t CS_LDK_LDKSpendingDelay_Relative_get_num_blocks(int64_t ptr) {
15193         LDKSpendingDelay *obj = (LDKSpendingDelay*)untag_ptr(ptr);
15194         CHECK(obj->tag == LDKSpendingDelay_Relative);
15195         int32_t num_blocks_conv = obj->relative.num_blocks;
15196         return num_blocks_conv;
15197 }
15198 int32_t CS_LDK_LDKSpendingDelay_Absolute_get_height(int64_t ptr) {
15199         LDKSpendingDelay *obj = (LDKSpendingDelay*)untag_ptr(ptr);
15200         CHECK(obj->tag == LDKSpendingDelay_Absolute);
15201         int32_t height_conv = obj->absolute.height;
15202         return height_conv;
15203 }
15204 typedef struct LDKFutureCallback_JCalls {
15205         atomic_size_t refcnt;
15206         uint32_t instance_ptr;
15207 } LDKFutureCallback_JCalls;
15208 static void LDKFutureCallback_JCalls_free(void* this_arg) {
15209         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) this_arg;
15210         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
15211                 FREE(j_calls);
15212         }
15213 }
15214 void call_LDKFutureCallback_jcall(const void* this_arg) {
15215         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) this_arg;
15216         js_invoke_function_void_(j_calls->instance_ptr, 77);
15217 }
15218 static void LDKFutureCallback_JCalls_cloned(LDKFutureCallback* new_obj) {
15219         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) new_obj->this_arg;
15220         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
15221 }
15222 static inline LDKFutureCallback LDKFutureCallback_init (int64_t o) {
15223         LDKFutureCallback_JCalls *calls = MALLOC(sizeof(LDKFutureCallback_JCalls), "LDKFutureCallback_JCalls");
15224         atomic_init(&calls->refcnt, 1);
15225         calls->instance_ptr = o;
15226
15227         LDKFutureCallback ret = {
15228                 .this_arg = (void*) calls,
15229                 .call = call_LDKFutureCallback_jcall,
15230                 .free = LDKFutureCallback_JCalls_free,
15231         };
15232         return ret;
15233 }
15234 uint64_t  CS_LDK_LDKFutureCallback_new(int32_t o) {
15235         LDKFutureCallback *res_ptr = MALLOC(sizeof(LDKFutureCallback), "LDKFutureCallback");
15236         *res_ptr = LDKFutureCallback_init(o);
15237         return tag_ptr(res_ptr, true);
15238 }
15239 void  CS_LDK_FutureCallback_call(int64_t this_arg) {
15240         void* this_arg_ptr = untag_ptr(this_arg);
15241         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15242         LDKFutureCallback* this_arg_conv = (LDKFutureCallback*)this_arg_ptr;
15243         (this_arg_conv->call)(this_arg_conv->this_arg);
15244 }
15245
15246 typedef struct LDKEventHandler_JCalls {
15247         atomic_size_t refcnt;
15248         uint32_t instance_ptr;
15249 } LDKEventHandler_JCalls;
15250 static void LDKEventHandler_JCalls_free(void* this_arg) {
15251         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
15252         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
15253                 FREE(j_calls);
15254         }
15255 }
15256 void handle_event_LDKEventHandler_jcall(const void* this_arg, LDKEvent event) {
15257         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
15258         LDKEvent *event_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
15259         *event_copy = event;
15260         int64_t event_ref = tag_ptr(event_copy, true);
15261         js_invoke_function_void_l(j_calls->instance_ptr, 78, event_ref);
15262 }
15263 static void LDKEventHandler_JCalls_cloned(LDKEventHandler* new_obj) {
15264         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) new_obj->this_arg;
15265         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
15266 }
15267 static inline LDKEventHandler LDKEventHandler_init (int64_t o) {
15268         LDKEventHandler_JCalls *calls = MALLOC(sizeof(LDKEventHandler_JCalls), "LDKEventHandler_JCalls");
15269         atomic_init(&calls->refcnt, 1);
15270         calls->instance_ptr = o;
15271
15272         LDKEventHandler ret = {
15273                 .this_arg = (void*) calls,
15274                 .handle_event = handle_event_LDKEventHandler_jcall,
15275                 .free = LDKEventHandler_JCalls_free,
15276         };
15277         return ret;
15278 }
15279 uint64_t  CS_LDK_LDKEventHandler_new(int32_t o) {
15280         LDKEventHandler *res_ptr = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
15281         *res_ptr = LDKEventHandler_init(o);
15282         return tag_ptr(res_ptr, true);
15283 }
15284 void  CS_LDK_EventHandler_handle_event(int64_t this_arg, int64_t event) {
15285         void* this_arg_ptr = untag_ptr(this_arg);
15286         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15287         LDKEventHandler* this_arg_conv = (LDKEventHandler*)this_arg_ptr;
15288         void* event_ptr = untag_ptr(event);
15289         CHECK_ACCESS(event_ptr);
15290         LDKEvent event_conv = *(LDKEvent*)(event_ptr);
15291         event_conv = Event_clone((LDKEvent*)untag_ptr(event));
15292         (this_arg_conv->handle_event)(this_arg_conv->this_arg, event_conv);
15293 }
15294
15295 typedef struct LDKEventsProvider_JCalls {
15296         atomic_size_t refcnt;
15297         uint32_t instance_ptr;
15298 } LDKEventsProvider_JCalls;
15299 static void LDKEventsProvider_JCalls_free(void* this_arg) {
15300         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
15301         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
15302                 FREE(j_calls);
15303         }
15304 }
15305 void process_pending_events_LDKEventsProvider_jcall(const void* this_arg, LDKEventHandler handler) {
15306         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
15307         LDKEventHandler* handler_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
15308         *handler_ret = handler;
15309         js_invoke_function_void_l(j_calls->instance_ptr, 79, tag_ptr(handler_ret, true));
15310 }
15311 static void LDKEventsProvider_JCalls_cloned(LDKEventsProvider* new_obj) {
15312         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) new_obj->this_arg;
15313         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
15314 }
15315 static inline LDKEventsProvider LDKEventsProvider_init (int64_t o) {
15316         LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
15317         atomic_init(&calls->refcnt, 1);
15318         calls->instance_ptr = o;
15319
15320         LDKEventsProvider ret = {
15321                 .this_arg = (void*) calls,
15322                 .process_pending_events = process_pending_events_LDKEventsProvider_jcall,
15323                 .free = LDKEventsProvider_JCalls_free,
15324         };
15325         return ret;
15326 }
15327 uint64_t  CS_LDK_LDKEventsProvider_new(int32_t o) {
15328         LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
15329         *res_ptr = LDKEventsProvider_init(o);
15330         return tag_ptr(res_ptr, true);
15331 }
15332 void  CS_LDK_EventsProvider_process_pending_events(int64_t this_arg, int64_t handler) {
15333         void* this_arg_ptr = untag_ptr(this_arg);
15334         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15335         LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)this_arg_ptr;
15336         void* handler_ptr = untag_ptr(handler);
15337         CHECK_ACCESS(handler_ptr);
15338         LDKEventHandler handler_conv = *(LDKEventHandler*)(handler_ptr);
15339         if (handler_conv.free == LDKEventHandler_JCalls_free) {
15340                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
15341                 LDKEventHandler_JCalls_cloned(&handler_conv);
15342         }
15343         (this_arg_conv->process_pending_events)(this_arg_conv->this_arg, handler_conv);
15344 }
15345
15346 uint32_t CS_LDK_LDKFailureCode_ty_from_ptr(int64_t ptr) {
15347         LDKFailureCode *obj = (LDKFailureCode*)untag_ptr(ptr);
15348         switch(obj->tag) {
15349                 case LDKFailureCode_TemporaryNodeFailure: return 0;
15350                 case LDKFailureCode_RequiredNodeFeatureMissing: return 1;
15351                 case LDKFailureCode_IncorrectOrUnknownPaymentDetails: return 2;
15352                 case LDKFailureCode_InvalidOnionPayload: return 3;
15353                 default: abort();
15354         }
15355 }
15356 int64_t CS_LDK_LDKFailureCode_InvalidOnionPayload_get_invalid_onion_payload(int64_t ptr) {
15357         LDKFailureCode *obj = (LDKFailureCode*)untag_ptr(ptr);
15358         CHECK(obj->tag == LDKFailureCode_InvalidOnionPayload);
15359         int64_t invalid_onion_payload_ref = tag_ptr(&obj->invalid_onion_payload, false);
15360         return invalid_onion_payload_ref;
15361 }
15362 typedef struct LDKMessageSendEventsProvider_JCalls {
15363         atomic_size_t refcnt;
15364         uint32_t instance_ptr;
15365 } LDKMessageSendEventsProvider_JCalls;
15366 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
15367         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
15368         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
15369                 FREE(j_calls);
15370         }
15371 }
15372 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall(const void* this_arg) {
15373         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
15374         int64_tArray ret = (int64_tArray)js_invoke_function_l_(j_calls->instance_ptr, 80);
15375         LDKCVec_MessageSendEventZ ret_constr;
15376         ret_constr.datalen = ret->arr_len;
15377         if (ret_constr.datalen > 0)
15378                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
15379         else
15380                 ret_constr.data = NULL;
15381         int64_t* ret_vals = ret->elems;
15382         for (size_t s = 0; s < ret_constr.datalen; s++) {
15383                 int64_t ret_conv_18 = ret_vals[s];
15384                 void* ret_conv_18_ptr = untag_ptr(ret_conv_18);
15385                 CHECK_ACCESS(ret_conv_18_ptr);
15386                 LDKMessageSendEvent ret_conv_18_conv = *(LDKMessageSendEvent*)(ret_conv_18_ptr);
15387                 FREE(untag_ptr(ret_conv_18));
15388                 ret_constr.data[s] = ret_conv_18_conv;
15389         }
15390         FREE(ret);
15391         return ret_constr;
15392 }
15393 static void LDKMessageSendEventsProvider_JCalls_cloned(LDKMessageSendEventsProvider* new_obj) {
15394         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) new_obj->this_arg;
15395         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
15396 }
15397 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (int64_t o) {
15398         LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
15399         atomic_init(&calls->refcnt, 1);
15400         calls->instance_ptr = o;
15401
15402         LDKMessageSendEventsProvider ret = {
15403                 .this_arg = (void*) calls,
15404                 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall,
15405                 .free = LDKMessageSendEventsProvider_JCalls_free,
15406         };
15407         return ret;
15408 }
15409 uint64_t  CS_LDK_LDKMessageSendEventsProvider_new(int32_t o) {
15410         LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
15411         *res_ptr = LDKMessageSendEventsProvider_init(o);
15412         return tag_ptr(res_ptr, true);
15413 }
15414 int64_tArray  CS_LDK_MessageSendEventsProvider_get_and_clear_pending_msg_events(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         LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)this_arg_ptr;
15418         LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
15419         int64_tArray ret_arr = NULL;
15420         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
15421         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
15422         for (size_t s = 0; s < ret_var.datalen; s++) {
15423                 LDKMessageSendEvent *ret_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
15424                 *ret_conv_18_copy = ret_var.data[s];
15425                 int64_t ret_conv_18_ref = tag_ptr(ret_conv_18_copy, true);
15426                 ret_arr_ptr[s] = ret_conv_18_ref;
15427         }
15428         
15429         FREE(ret_var.data);
15430         return ret_arr;
15431 }
15432
15433 typedef struct LDKChannelMessageHandler_JCalls {
15434         atomic_size_t refcnt;
15435         uint32_t instance_ptr;
15436         LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
15437 } LDKChannelMessageHandler_JCalls;
15438 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
15439         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15440         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
15441                 FREE(j_calls);
15442         }
15443 }
15444 void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKOpenChannel * msg) {
15445         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15446         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15447         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15448         LDKOpenChannel msg_var = *msg;
15449         int64_t msg_ref = 0;
15450         msg_var = OpenChannel_clone(&msg_var);
15451         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15452         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15453         js_invoke_function_void_ll(j_calls->instance_ptr, 81, (int64_t)their_node_id_arr, msg_ref);
15454 }
15455 void handle_open_channel_v2_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKOpenChannelV2 * msg) {
15456         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15457         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15458         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15459         LDKOpenChannelV2 msg_var = *msg;
15460         int64_t msg_ref = 0;
15461         msg_var = OpenChannelV2_clone(&msg_var);
15462         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15463         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15464         js_invoke_function_void_ll(j_calls->instance_ptr, 82, (int64_t)their_node_id_arr, msg_ref);
15465 }
15466 void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAcceptChannel * msg) {
15467         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15468         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15469         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15470         LDKAcceptChannel msg_var = *msg;
15471         int64_t msg_ref = 0;
15472         msg_var = AcceptChannel_clone(&msg_var);
15473         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15474         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15475         js_invoke_function_void_ll(j_calls->instance_ptr, 83, (int64_t)their_node_id_arr, msg_ref);
15476 }
15477 void handle_accept_channel_v2_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAcceptChannelV2 * msg) {
15478         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15479         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15480         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15481         LDKAcceptChannelV2 msg_var = *msg;
15482         int64_t msg_ref = 0;
15483         msg_var = AcceptChannelV2_clone(&msg_var);
15484         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15485         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15486         js_invoke_function_void_ll(j_calls->instance_ptr, 84, (int64_t)their_node_id_arr, msg_ref);
15487 }
15488 void handle_funding_created_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) {
15489         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15490         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15491         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15492         LDKFundingCreated msg_var = *msg;
15493         int64_t msg_ref = 0;
15494         msg_var = FundingCreated_clone(&msg_var);
15495         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15496         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15497         js_invoke_function_void_ll(j_calls->instance_ptr, 85, (int64_t)their_node_id_arr, msg_ref);
15498 }
15499 void handle_funding_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) {
15500         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15501         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15502         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15503         LDKFundingSigned msg_var = *msg;
15504         int64_t msg_ref = 0;
15505         msg_var = FundingSigned_clone(&msg_var);
15506         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15507         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15508         js_invoke_function_void_ll(j_calls->instance_ptr, 86, (int64_t)their_node_id_arr, msg_ref);
15509 }
15510 void handle_channel_ready_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReady * msg) {
15511         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15512         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15513         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15514         LDKChannelReady msg_var = *msg;
15515         int64_t msg_ref = 0;
15516         msg_var = ChannelReady_clone(&msg_var);
15517         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15518         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15519         js_invoke_function_void_ll(j_calls->instance_ptr, 87, (int64_t)their_node_id_arr, msg_ref);
15520 }
15521 void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKShutdown * msg) {
15522         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15523         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15524         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15525         LDKShutdown msg_var = *msg;
15526         int64_t msg_ref = 0;
15527         msg_var = Shutdown_clone(&msg_var);
15528         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15529         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15530         js_invoke_function_void_ll(j_calls->instance_ptr, 88, (int64_t)their_node_id_arr, msg_ref);
15531 }
15532 void handle_closing_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) {
15533         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15534         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15535         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15536         LDKClosingSigned msg_var = *msg;
15537         int64_t msg_ref = 0;
15538         msg_var = ClosingSigned_clone(&msg_var);
15539         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15540         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15541         js_invoke_function_void_ll(j_calls->instance_ptr, 89, (int64_t)their_node_id_arr, msg_ref);
15542 }
15543 void handle_stfu_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKStfu * msg) {
15544         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15545         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15546         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15547         LDKStfu msg_var = *msg;
15548         int64_t msg_ref = 0;
15549         msg_var = Stfu_clone(&msg_var);
15550         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15551         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15552         js_invoke_function_void_ll(j_calls->instance_ptr, 90, (int64_t)their_node_id_arr, msg_ref);
15553 }
15554 void handle_tx_add_input_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxAddInput * msg) {
15555         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15556         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15557         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15558         LDKTxAddInput msg_var = *msg;
15559         int64_t msg_ref = 0;
15560         msg_var = TxAddInput_clone(&msg_var);
15561         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15562         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15563         js_invoke_function_void_ll(j_calls->instance_ptr, 91, (int64_t)their_node_id_arr, msg_ref);
15564 }
15565 void handle_tx_add_output_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxAddOutput * msg) {
15566         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15567         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15568         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15569         LDKTxAddOutput msg_var = *msg;
15570         int64_t msg_ref = 0;
15571         msg_var = TxAddOutput_clone(&msg_var);
15572         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15573         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15574         js_invoke_function_void_ll(j_calls->instance_ptr, 92, (int64_t)their_node_id_arr, msg_ref);
15575 }
15576 void handle_tx_remove_input_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxRemoveInput * msg) {
15577         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15578         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15579         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15580         LDKTxRemoveInput msg_var = *msg;
15581         int64_t msg_ref = 0;
15582         msg_var = TxRemoveInput_clone(&msg_var);
15583         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15584         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15585         js_invoke_function_void_ll(j_calls->instance_ptr, 93, (int64_t)their_node_id_arr, msg_ref);
15586 }
15587 void handle_tx_remove_output_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxRemoveOutput * msg) {
15588         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15589         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15590         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15591         LDKTxRemoveOutput msg_var = *msg;
15592         int64_t msg_ref = 0;
15593         msg_var = TxRemoveOutput_clone(&msg_var);
15594         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15595         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15596         js_invoke_function_void_ll(j_calls->instance_ptr, 94, (int64_t)their_node_id_arr, msg_ref);
15597 }
15598 void handle_tx_complete_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxComplete * msg) {
15599         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15600         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15601         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15602         LDKTxComplete msg_var = *msg;
15603         int64_t msg_ref = 0;
15604         msg_var = TxComplete_clone(&msg_var);
15605         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15606         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15607         js_invoke_function_void_ll(j_calls->instance_ptr, 95, (int64_t)their_node_id_arr, msg_ref);
15608 }
15609 void handle_tx_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxSignatures * msg) {
15610         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15611         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15612         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15613         LDKTxSignatures msg_var = *msg;
15614         int64_t msg_ref = 0;
15615         msg_var = TxSignatures_clone(&msg_var);
15616         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15617         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15618         js_invoke_function_void_ll(j_calls->instance_ptr, 96, (int64_t)their_node_id_arr, msg_ref);
15619 }
15620 void handle_tx_init_rbf_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxInitRbf * msg) {
15621         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15622         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15623         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15624         LDKTxInitRbf msg_var = *msg;
15625         int64_t msg_ref = 0;
15626         msg_var = TxInitRbf_clone(&msg_var);
15627         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15628         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15629         js_invoke_function_void_ll(j_calls->instance_ptr, 97, (int64_t)their_node_id_arr, msg_ref);
15630 }
15631 void handle_tx_ack_rbf_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxAckRbf * msg) {
15632         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15633         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15634         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15635         LDKTxAckRbf msg_var = *msg;
15636         int64_t msg_ref = 0;
15637         msg_var = TxAckRbf_clone(&msg_var);
15638         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15639         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15640         js_invoke_function_void_ll(j_calls->instance_ptr, 98, (int64_t)their_node_id_arr, msg_ref);
15641 }
15642 void handle_tx_abort_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxAbort * msg) {
15643         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15644         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15645         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15646         LDKTxAbort msg_var = *msg;
15647         int64_t msg_ref = 0;
15648         msg_var = TxAbort_clone(&msg_var);
15649         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15650         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15651         js_invoke_function_void_ll(j_calls->instance_ptr, 99, (int64_t)their_node_id_arr, msg_ref);
15652 }
15653 void handle_update_add_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) {
15654         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15655         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15656         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15657         LDKUpdateAddHTLC msg_var = *msg;
15658         int64_t msg_ref = 0;
15659         msg_var = UpdateAddHTLC_clone(&msg_var);
15660         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15661         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15662         js_invoke_function_void_ll(j_calls->instance_ptr, 100, (int64_t)their_node_id_arr, msg_ref);
15663 }
15664 void handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) {
15665         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15666         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15667         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15668         LDKUpdateFulfillHTLC msg_var = *msg;
15669         int64_t msg_ref = 0;
15670         msg_var = UpdateFulfillHTLC_clone(&msg_var);
15671         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15672         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15673         js_invoke_function_void_ll(j_calls->instance_ptr, 101, (int64_t)their_node_id_arr, msg_ref);
15674 }
15675 void handle_update_fail_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) {
15676         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15677         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15678         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15679         LDKUpdateFailHTLC msg_var = *msg;
15680         int64_t msg_ref = 0;
15681         msg_var = UpdateFailHTLC_clone(&msg_var);
15682         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15683         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15684         js_invoke_function_void_ll(j_calls->instance_ptr, 102, (int64_t)their_node_id_arr, msg_ref);
15685 }
15686 void handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) {
15687         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15688         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15689         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15690         LDKUpdateFailMalformedHTLC msg_var = *msg;
15691         int64_t msg_ref = 0;
15692         msg_var = UpdateFailMalformedHTLC_clone(&msg_var);
15693         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15694         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15695         js_invoke_function_void_ll(j_calls->instance_ptr, 103, (int64_t)their_node_id_arr, msg_ref);
15696 }
15697 void handle_commitment_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) {
15698         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15699         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15700         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15701         LDKCommitmentSigned msg_var = *msg;
15702         int64_t msg_ref = 0;
15703         msg_var = CommitmentSigned_clone(&msg_var);
15704         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15705         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15706         js_invoke_function_void_ll(j_calls->instance_ptr, 104, (int64_t)their_node_id_arr, msg_ref);
15707 }
15708 void handle_revoke_and_ack_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) {
15709         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15710         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15711         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15712         LDKRevokeAndACK msg_var = *msg;
15713         int64_t msg_ref = 0;
15714         msg_var = RevokeAndACK_clone(&msg_var);
15715         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15716         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15717         js_invoke_function_void_ll(j_calls->instance_ptr, 105, (int64_t)their_node_id_arr, msg_ref);
15718 }
15719 void handle_update_fee_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) {
15720         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15721         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15722         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15723         LDKUpdateFee msg_var = *msg;
15724         int64_t msg_ref = 0;
15725         msg_var = UpdateFee_clone(&msg_var);
15726         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15727         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15728         js_invoke_function_void_ll(j_calls->instance_ptr, 106, (int64_t)their_node_id_arr, msg_ref);
15729 }
15730 void handle_announcement_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) {
15731         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15732         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15733         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15734         LDKAnnouncementSignatures msg_var = *msg;
15735         int64_t msg_ref = 0;
15736         msg_var = AnnouncementSignatures_clone(&msg_var);
15737         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15738         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15739         js_invoke_function_void_ll(j_calls->instance_ptr, 107, (int64_t)their_node_id_arr, msg_ref);
15740 }
15741 void peer_disconnected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
15742         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15743         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15744         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15745         js_invoke_function_void_l(j_calls->instance_ptr, 108, (int64_t)their_node_id_arr);
15746 }
15747 LDKCResult_NoneNoneZ peer_connected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg, bool inbound) {
15748         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15749         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15750         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15751         LDKInit msg_var = *msg;
15752         int64_t msg_ref = 0;
15753         msg_var = Init_clone(&msg_var);
15754         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15755         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15756         jboolean inbound_conv = inbound;
15757         uint64_t ret = js_invoke_function_l_llb(j_calls->instance_ptr, 109, (int64_t)their_node_id_arr, msg_ref, inbound_conv);
15758         void* ret_ptr = untag_ptr(ret);
15759         CHECK_ACCESS(ret_ptr);
15760         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
15761         FREE(untag_ptr(ret));
15762         return ret_conv;
15763 }
15764 void handle_channel_reestablish_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * msg) {
15765         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15766         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15767         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15768         LDKChannelReestablish msg_var = *msg;
15769         int64_t msg_ref = 0;
15770         msg_var = ChannelReestablish_clone(&msg_var);
15771         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15772         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15773         js_invoke_function_void_ll(j_calls->instance_ptr, 110, (int64_t)their_node_id_arr, msg_ref);
15774 }
15775 void handle_channel_update_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelUpdate * msg) {
15776         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15777         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15778         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15779         LDKChannelUpdate msg_var = *msg;
15780         int64_t msg_ref = 0;
15781         msg_var = ChannelUpdate_clone(&msg_var);
15782         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15783         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15784         js_invoke_function_void_ll(j_calls->instance_ptr, 111, (int64_t)their_node_id_arr, msg_ref);
15785 }
15786 void handle_error_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) {
15787         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15788         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15789         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15790         LDKErrorMessage msg_var = *msg;
15791         int64_t msg_ref = 0;
15792         msg_var = ErrorMessage_clone(&msg_var);
15793         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15794         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15795         js_invoke_function_void_ll(j_calls->instance_ptr, 112, (int64_t)their_node_id_arr, msg_ref);
15796 }
15797 LDKNodeFeatures provided_node_features_LDKChannelMessageHandler_jcall(const void* this_arg) {
15798         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15799         uint64_t ret = js_invoke_function_l_(j_calls->instance_ptr, 113);
15800         LDKNodeFeatures ret_conv;
15801         ret_conv.inner = untag_ptr(ret);
15802         ret_conv.is_owned = ptr_is_owned(ret);
15803         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
15804         return ret_conv;
15805 }
15806 LDKInitFeatures provided_init_features_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
15807         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15808         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
15809         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
15810         uint64_t ret = js_invoke_function_l_l(j_calls->instance_ptr, 114, (int64_t)their_node_id_arr);
15811         LDKInitFeatures ret_conv;
15812         ret_conv.inner = untag_ptr(ret);
15813         ret_conv.is_owned = ptr_is_owned(ret);
15814         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
15815         return ret_conv;
15816 }
15817 LDKCOption_CVec_ThirtyTwoBytesZZ get_chain_hashes_LDKChannelMessageHandler_jcall(const void* this_arg) {
15818         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15819         uint64_t ret = js_invoke_function_l_(j_calls->instance_ptr, 115);
15820         void* ret_ptr = untag_ptr(ret);
15821         CHECK_ACCESS(ret_ptr);
15822         LDKCOption_CVec_ThirtyTwoBytesZZ ret_conv = *(LDKCOption_CVec_ThirtyTwoBytesZZ*)(ret_ptr);
15823         FREE(untag_ptr(ret));
15824         return ret_conv;
15825 }
15826 static void LDKChannelMessageHandler_JCalls_cloned(LDKChannelMessageHandler* new_obj) {
15827         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) new_obj->this_arg;
15828         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
15829         atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
15830 }
15831 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (int64_t o, int64_t MessageSendEventsProvider) {
15832         LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
15833         atomic_init(&calls->refcnt, 1);
15834         calls->instance_ptr = o;
15835
15836         LDKChannelMessageHandler ret = {
15837                 .this_arg = (void*) calls,
15838                 .handle_open_channel = handle_open_channel_LDKChannelMessageHandler_jcall,
15839                 .handle_open_channel_v2 = handle_open_channel_v2_LDKChannelMessageHandler_jcall,
15840                 .handle_accept_channel = handle_accept_channel_LDKChannelMessageHandler_jcall,
15841                 .handle_accept_channel_v2 = handle_accept_channel_v2_LDKChannelMessageHandler_jcall,
15842                 .handle_funding_created = handle_funding_created_LDKChannelMessageHandler_jcall,
15843                 .handle_funding_signed = handle_funding_signed_LDKChannelMessageHandler_jcall,
15844                 .handle_channel_ready = handle_channel_ready_LDKChannelMessageHandler_jcall,
15845                 .handle_shutdown = handle_shutdown_LDKChannelMessageHandler_jcall,
15846                 .handle_closing_signed = handle_closing_signed_LDKChannelMessageHandler_jcall,
15847                 .handle_stfu = handle_stfu_LDKChannelMessageHandler_jcall,
15848                 .handle_tx_add_input = handle_tx_add_input_LDKChannelMessageHandler_jcall,
15849                 .handle_tx_add_output = handle_tx_add_output_LDKChannelMessageHandler_jcall,
15850                 .handle_tx_remove_input = handle_tx_remove_input_LDKChannelMessageHandler_jcall,
15851                 .handle_tx_remove_output = handle_tx_remove_output_LDKChannelMessageHandler_jcall,
15852                 .handle_tx_complete = handle_tx_complete_LDKChannelMessageHandler_jcall,
15853                 .handle_tx_signatures = handle_tx_signatures_LDKChannelMessageHandler_jcall,
15854                 .handle_tx_init_rbf = handle_tx_init_rbf_LDKChannelMessageHandler_jcall,
15855                 .handle_tx_ack_rbf = handle_tx_ack_rbf_LDKChannelMessageHandler_jcall,
15856                 .handle_tx_abort = handle_tx_abort_LDKChannelMessageHandler_jcall,
15857                 .handle_update_add_htlc = handle_update_add_htlc_LDKChannelMessageHandler_jcall,
15858                 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall,
15859                 .handle_update_fail_htlc = handle_update_fail_htlc_LDKChannelMessageHandler_jcall,
15860                 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall,
15861                 .handle_commitment_signed = handle_commitment_signed_LDKChannelMessageHandler_jcall,
15862                 .handle_revoke_and_ack = handle_revoke_and_ack_LDKChannelMessageHandler_jcall,
15863                 .handle_update_fee = handle_update_fee_LDKChannelMessageHandler_jcall,
15864                 .handle_announcement_signatures = handle_announcement_signatures_LDKChannelMessageHandler_jcall,
15865                 .peer_disconnected = peer_disconnected_LDKChannelMessageHandler_jcall,
15866                 .peer_connected = peer_connected_LDKChannelMessageHandler_jcall,
15867                 .handle_channel_reestablish = handle_channel_reestablish_LDKChannelMessageHandler_jcall,
15868                 .handle_channel_update = handle_channel_update_LDKChannelMessageHandler_jcall,
15869                 .handle_error = handle_error_LDKChannelMessageHandler_jcall,
15870                 .provided_node_features = provided_node_features_LDKChannelMessageHandler_jcall,
15871                 .provided_init_features = provided_init_features_LDKChannelMessageHandler_jcall,
15872                 .get_chain_hashes = get_chain_hashes_LDKChannelMessageHandler_jcall,
15873                 .free = LDKChannelMessageHandler_JCalls_free,
15874                 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
15875         };
15876         calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
15877         return ret;
15878 }
15879 uint64_t  CS_LDK_LDKChannelMessageHandler_new(int32_t o, int32_t MessageSendEventsProvider) {
15880         LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
15881         *res_ptr = LDKChannelMessageHandler_init(o, MessageSendEventsProvider);
15882         return tag_ptr(res_ptr, true);
15883 }
15884 void  CS_LDK_ChannelMessageHandler_handle_open_channel(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
15885         void* this_arg_ptr = untag_ptr(this_arg);
15886         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15887         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
15888         LDKPublicKey their_node_id_ref;
15889         CHECK(their_node_id->arr_len == 33);
15890         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15891         LDKOpenChannel msg_conv;
15892         msg_conv.inner = untag_ptr(msg);
15893         msg_conv.is_owned = ptr_is_owned(msg);
15894         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15895         msg_conv.is_owned = false;
15896         (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
15897 }
15898
15899 void  CS_LDK_ChannelMessageHandler_handle_open_channel_v2(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
15900         void* this_arg_ptr = untag_ptr(this_arg);
15901         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15902         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
15903         LDKPublicKey their_node_id_ref;
15904         CHECK(their_node_id->arr_len == 33);
15905         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15906         LDKOpenChannelV2 msg_conv;
15907         msg_conv.inner = untag_ptr(msg);
15908         msg_conv.is_owned = ptr_is_owned(msg);
15909         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15910         msg_conv.is_owned = false;
15911         (this_arg_conv->handle_open_channel_v2)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
15912 }
15913
15914 void  CS_LDK_ChannelMessageHandler_handle_accept_channel(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
15915         void* this_arg_ptr = untag_ptr(this_arg);
15916         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15917         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
15918         LDKPublicKey their_node_id_ref;
15919         CHECK(their_node_id->arr_len == 33);
15920         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15921         LDKAcceptChannel msg_conv;
15922         msg_conv.inner = untag_ptr(msg);
15923         msg_conv.is_owned = ptr_is_owned(msg);
15924         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15925         msg_conv.is_owned = false;
15926         (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
15927 }
15928
15929 void  CS_LDK_ChannelMessageHandler_handle_accept_channel_v2(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
15930         void* this_arg_ptr = untag_ptr(this_arg);
15931         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15932         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
15933         LDKPublicKey their_node_id_ref;
15934         CHECK(their_node_id->arr_len == 33);
15935         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15936         LDKAcceptChannelV2 msg_conv;
15937         msg_conv.inner = untag_ptr(msg);
15938         msg_conv.is_owned = ptr_is_owned(msg);
15939         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15940         msg_conv.is_owned = false;
15941         (this_arg_conv->handle_accept_channel_v2)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
15942 }
15943
15944 void  CS_LDK_ChannelMessageHandler_handle_funding_created(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
15945         void* this_arg_ptr = untag_ptr(this_arg);
15946         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15947         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
15948         LDKPublicKey their_node_id_ref;
15949         CHECK(their_node_id->arr_len == 33);
15950         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15951         LDKFundingCreated msg_conv;
15952         msg_conv.inner = untag_ptr(msg);
15953         msg_conv.is_owned = ptr_is_owned(msg);
15954         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15955         msg_conv.is_owned = false;
15956         (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
15957 }
15958
15959 void  CS_LDK_ChannelMessageHandler_handle_funding_signed(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
15960         void* this_arg_ptr = untag_ptr(this_arg);
15961         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15962         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
15963         LDKPublicKey their_node_id_ref;
15964         CHECK(their_node_id->arr_len == 33);
15965         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15966         LDKFundingSigned msg_conv;
15967         msg_conv.inner = untag_ptr(msg);
15968         msg_conv.is_owned = ptr_is_owned(msg);
15969         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15970         msg_conv.is_owned = false;
15971         (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
15972 }
15973
15974 void  CS_LDK_ChannelMessageHandler_handle_channel_ready(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
15975         void* this_arg_ptr = untag_ptr(this_arg);
15976         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15977         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
15978         LDKPublicKey their_node_id_ref;
15979         CHECK(their_node_id->arr_len == 33);
15980         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15981         LDKChannelReady msg_conv;
15982         msg_conv.inner = untag_ptr(msg);
15983         msg_conv.is_owned = ptr_is_owned(msg);
15984         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
15985         msg_conv.is_owned = false;
15986         (this_arg_conv->handle_channel_ready)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
15987 }
15988
15989 void  CS_LDK_ChannelMessageHandler_handle_shutdown(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
15990         void* this_arg_ptr = untag_ptr(this_arg);
15991         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15992         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
15993         LDKPublicKey their_node_id_ref;
15994         CHECK(their_node_id->arr_len == 33);
15995         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
15996         LDKShutdown msg_conv;
15997         msg_conv.inner = untag_ptr(msg);
15998         msg_conv.is_owned = ptr_is_owned(msg);
15999         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16000         msg_conv.is_owned = false;
16001         (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
16002 }
16003
16004 void  CS_LDK_ChannelMessageHandler_handle_closing_signed(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
16005         void* this_arg_ptr = untag_ptr(this_arg);
16006         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16007         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16008         LDKPublicKey their_node_id_ref;
16009         CHECK(their_node_id->arr_len == 33);
16010         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
16011         LDKClosingSigned msg_conv;
16012         msg_conv.inner = untag_ptr(msg);
16013         msg_conv.is_owned = ptr_is_owned(msg);
16014         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16015         msg_conv.is_owned = false;
16016         (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
16017 }
16018
16019 void  CS_LDK_ChannelMessageHandler_handle_stfu(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
16020         void* this_arg_ptr = untag_ptr(this_arg);
16021         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16022         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16023         LDKPublicKey their_node_id_ref;
16024         CHECK(their_node_id->arr_len == 33);
16025         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
16026         LDKStfu msg_conv;
16027         msg_conv.inner = untag_ptr(msg);
16028         msg_conv.is_owned = ptr_is_owned(msg);
16029         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16030         msg_conv.is_owned = false;
16031         (this_arg_conv->handle_stfu)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
16032 }
16033
16034 void  CS_LDK_ChannelMessageHandler_handle_tx_add_input(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
16035         void* this_arg_ptr = untag_ptr(this_arg);
16036         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16037         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16038         LDKPublicKey their_node_id_ref;
16039         CHECK(their_node_id->arr_len == 33);
16040         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
16041         LDKTxAddInput msg_conv;
16042         msg_conv.inner = untag_ptr(msg);
16043         msg_conv.is_owned = ptr_is_owned(msg);
16044         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16045         msg_conv.is_owned = false;
16046         (this_arg_conv->handle_tx_add_input)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
16047 }
16048
16049 void  CS_LDK_ChannelMessageHandler_handle_tx_add_output(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
16050         void* this_arg_ptr = untag_ptr(this_arg);
16051         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16052         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16053         LDKPublicKey their_node_id_ref;
16054         CHECK(their_node_id->arr_len == 33);
16055         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
16056         LDKTxAddOutput msg_conv;
16057         msg_conv.inner = untag_ptr(msg);
16058         msg_conv.is_owned = ptr_is_owned(msg);
16059         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16060         msg_conv.is_owned = false;
16061         (this_arg_conv->handle_tx_add_output)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
16062 }
16063
16064 void  CS_LDK_ChannelMessageHandler_handle_tx_remove_input(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
16065         void* this_arg_ptr = untag_ptr(this_arg);
16066         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16067         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16068         LDKPublicKey their_node_id_ref;
16069         CHECK(their_node_id->arr_len == 33);
16070         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
16071         LDKTxRemoveInput msg_conv;
16072         msg_conv.inner = untag_ptr(msg);
16073         msg_conv.is_owned = ptr_is_owned(msg);
16074         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16075         msg_conv.is_owned = false;
16076         (this_arg_conv->handle_tx_remove_input)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
16077 }
16078
16079 void  CS_LDK_ChannelMessageHandler_handle_tx_remove_output(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
16080         void* this_arg_ptr = untag_ptr(this_arg);
16081         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16082         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16083         LDKPublicKey their_node_id_ref;
16084         CHECK(their_node_id->arr_len == 33);
16085         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
16086         LDKTxRemoveOutput msg_conv;
16087         msg_conv.inner = untag_ptr(msg);
16088         msg_conv.is_owned = ptr_is_owned(msg);
16089         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16090         msg_conv.is_owned = false;
16091         (this_arg_conv->handle_tx_remove_output)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
16092 }
16093
16094 void  CS_LDK_ChannelMessageHandler_handle_tx_complete(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
16095         void* this_arg_ptr = untag_ptr(this_arg);
16096         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16097         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16098         LDKPublicKey their_node_id_ref;
16099         CHECK(their_node_id->arr_len == 33);
16100         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
16101         LDKTxComplete msg_conv;
16102         msg_conv.inner = untag_ptr(msg);
16103         msg_conv.is_owned = ptr_is_owned(msg);
16104         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16105         msg_conv.is_owned = false;
16106         (this_arg_conv->handle_tx_complete)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
16107 }
16108
16109 void  CS_LDK_ChannelMessageHandler_handle_tx_signatures(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
16110         void* this_arg_ptr = untag_ptr(this_arg);
16111         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16112         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16113         LDKPublicKey their_node_id_ref;
16114         CHECK(their_node_id->arr_len == 33);
16115         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
16116         LDKTxSignatures msg_conv;
16117         msg_conv.inner = untag_ptr(msg);
16118         msg_conv.is_owned = ptr_is_owned(msg);
16119         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16120         msg_conv.is_owned = false;
16121         (this_arg_conv->handle_tx_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
16122 }
16123
16124 void  CS_LDK_ChannelMessageHandler_handle_tx_init_rbf(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
16125         void* this_arg_ptr = untag_ptr(this_arg);
16126         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16127         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16128         LDKPublicKey their_node_id_ref;
16129         CHECK(their_node_id->arr_len == 33);
16130         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
16131         LDKTxInitRbf msg_conv;
16132         msg_conv.inner = untag_ptr(msg);
16133         msg_conv.is_owned = ptr_is_owned(msg);
16134         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16135         msg_conv.is_owned = false;
16136         (this_arg_conv->handle_tx_init_rbf)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
16137 }
16138
16139 void  CS_LDK_ChannelMessageHandler_handle_tx_ack_rbf(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
16140         void* this_arg_ptr = untag_ptr(this_arg);
16141         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16142         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16143         LDKPublicKey their_node_id_ref;
16144         CHECK(their_node_id->arr_len == 33);
16145         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
16146         LDKTxAckRbf msg_conv;
16147         msg_conv.inner = untag_ptr(msg);
16148         msg_conv.is_owned = ptr_is_owned(msg);
16149         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16150         msg_conv.is_owned = false;
16151         (this_arg_conv->handle_tx_ack_rbf)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
16152 }
16153
16154 void  CS_LDK_ChannelMessageHandler_handle_tx_abort(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
16155         void* this_arg_ptr = untag_ptr(this_arg);
16156         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16157         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16158         LDKPublicKey their_node_id_ref;
16159         CHECK(their_node_id->arr_len == 33);
16160         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
16161         LDKTxAbort msg_conv;
16162         msg_conv.inner = untag_ptr(msg);
16163         msg_conv.is_owned = ptr_is_owned(msg);
16164         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16165         msg_conv.is_owned = false;
16166         (this_arg_conv->handle_tx_abort)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
16167 }
16168
16169 void  CS_LDK_ChannelMessageHandler_handle_update_add_htlc(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
16170         void* this_arg_ptr = untag_ptr(this_arg);
16171         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16172         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16173         LDKPublicKey their_node_id_ref;
16174         CHECK(their_node_id->arr_len == 33);
16175         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
16176         LDKUpdateAddHTLC msg_conv;
16177         msg_conv.inner = untag_ptr(msg);
16178         msg_conv.is_owned = ptr_is_owned(msg);
16179         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16180         msg_conv.is_owned = false;
16181         (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
16182 }
16183
16184 void  CS_LDK_ChannelMessageHandler_handle_update_fulfill_htlc(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
16185         void* this_arg_ptr = untag_ptr(this_arg);
16186         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16187         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16188         LDKPublicKey their_node_id_ref;
16189         CHECK(their_node_id->arr_len == 33);
16190         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
16191         LDKUpdateFulfillHTLC msg_conv;
16192         msg_conv.inner = untag_ptr(msg);
16193         msg_conv.is_owned = ptr_is_owned(msg);
16194         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16195         msg_conv.is_owned = false;
16196         (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
16197 }
16198
16199 void  CS_LDK_ChannelMessageHandler_handle_update_fail_htlc(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
16200         void* this_arg_ptr = untag_ptr(this_arg);
16201         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16202         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16203         LDKPublicKey their_node_id_ref;
16204         CHECK(their_node_id->arr_len == 33);
16205         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
16206         LDKUpdateFailHTLC msg_conv;
16207         msg_conv.inner = untag_ptr(msg);
16208         msg_conv.is_owned = ptr_is_owned(msg);
16209         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16210         msg_conv.is_owned = false;
16211         (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
16212 }
16213
16214 void  CS_LDK_ChannelMessageHandler_handle_update_fail_malformed_htlc(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
16215         void* this_arg_ptr = untag_ptr(this_arg);
16216         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16217         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16218         LDKPublicKey their_node_id_ref;
16219         CHECK(their_node_id->arr_len == 33);
16220         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
16221         LDKUpdateFailMalformedHTLC msg_conv;
16222         msg_conv.inner = untag_ptr(msg);
16223         msg_conv.is_owned = ptr_is_owned(msg);
16224         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16225         msg_conv.is_owned = false;
16226         (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
16227 }
16228
16229 void  CS_LDK_ChannelMessageHandler_handle_commitment_signed(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
16230         void* this_arg_ptr = untag_ptr(this_arg);
16231         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16232         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16233         LDKPublicKey their_node_id_ref;
16234         CHECK(their_node_id->arr_len == 33);
16235         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
16236         LDKCommitmentSigned msg_conv;
16237         msg_conv.inner = untag_ptr(msg);
16238         msg_conv.is_owned = ptr_is_owned(msg);
16239         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16240         msg_conv.is_owned = false;
16241         (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
16242 }
16243
16244 void  CS_LDK_ChannelMessageHandler_handle_revoke_and_ack(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
16245         void* this_arg_ptr = untag_ptr(this_arg);
16246         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16247         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16248         LDKPublicKey their_node_id_ref;
16249         CHECK(their_node_id->arr_len == 33);
16250         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
16251         LDKRevokeAndACK msg_conv;
16252         msg_conv.inner = untag_ptr(msg);
16253         msg_conv.is_owned = ptr_is_owned(msg);
16254         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16255         msg_conv.is_owned = false;
16256         (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
16257 }
16258
16259 void  CS_LDK_ChannelMessageHandler_handle_update_fee(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
16260         void* this_arg_ptr = untag_ptr(this_arg);
16261         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16262         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16263         LDKPublicKey their_node_id_ref;
16264         CHECK(their_node_id->arr_len == 33);
16265         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
16266         LDKUpdateFee msg_conv;
16267         msg_conv.inner = untag_ptr(msg);
16268         msg_conv.is_owned = ptr_is_owned(msg);
16269         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16270         msg_conv.is_owned = false;
16271         (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
16272 }
16273
16274 void  CS_LDK_ChannelMessageHandler_handle_announcement_signatures(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
16275         void* this_arg_ptr = untag_ptr(this_arg);
16276         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16277         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16278         LDKPublicKey their_node_id_ref;
16279         CHECK(their_node_id->arr_len == 33);
16280         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
16281         LDKAnnouncementSignatures msg_conv;
16282         msg_conv.inner = untag_ptr(msg);
16283         msg_conv.is_owned = ptr_is_owned(msg);
16284         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16285         msg_conv.is_owned = false;
16286         (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
16287 }
16288
16289 void  CS_LDK_ChannelMessageHandler_peer_disconnected(int64_t this_arg, int8_tArray their_node_id) {
16290         void* this_arg_ptr = untag_ptr(this_arg);
16291         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16292         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16293         LDKPublicKey their_node_id_ref;
16294         CHECK(their_node_id->arr_len == 33);
16295         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
16296         (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref);
16297 }
16298
16299 int64_t  CS_LDK_ChannelMessageHandler_peer_connected(int64_t this_arg, int8_tArray their_node_id, int64_t msg, jboolean inbound) {
16300         void* this_arg_ptr = untag_ptr(this_arg);
16301         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16302         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16303         LDKPublicKey their_node_id_ref;
16304         CHECK(their_node_id->arr_len == 33);
16305         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
16306         LDKInit msg_conv;
16307         msg_conv.inner = untag_ptr(msg);
16308         msg_conv.is_owned = ptr_is_owned(msg);
16309         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16310         msg_conv.is_owned = false;
16311         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
16312         *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv, inbound);
16313         return tag_ptr(ret_conv, true);
16314 }
16315
16316 void  CS_LDK_ChannelMessageHandler_handle_channel_reestablish(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
16317         void* this_arg_ptr = untag_ptr(this_arg);
16318         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16319         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16320         LDKPublicKey their_node_id_ref;
16321         CHECK(their_node_id->arr_len == 33);
16322         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
16323         LDKChannelReestablish msg_conv;
16324         msg_conv.inner = untag_ptr(msg);
16325         msg_conv.is_owned = ptr_is_owned(msg);
16326         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16327         msg_conv.is_owned = false;
16328         (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
16329 }
16330
16331 void  CS_LDK_ChannelMessageHandler_handle_channel_update(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
16332         void* this_arg_ptr = untag_ptr(this_arg);
16333         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16334         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16335         LDKPublicKey their_node_id_ref;
16336         CHECK(their_node_id->arr_len == 33);
16337         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
16338         LDKChannelUpdate msg_conv;
16339         msg_conv.inner = untag_ptr(msg);
16340         msg_conv.is_owned = ptr_is_owned(msg);
16341         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16342         msg_conv.is_owned = false;
16343         (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
16344 }
16345
16346 void  CS_LDK_ChannelMessageHandler_handle_error(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
16347         void* this_arg_ptr = untag_ptr(this_arg);
16348         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16349         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16350         LDKPublicKey their_node_id_ref;
16351         CHECK(their_node_id->arr_len == 33);
16352         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
16353         LDKErrorMessage msg_conv;
16354         msg_conv.inner = untag_ptr(msg);
16355         msg_conv.is_owned = ptr_is_owned(msg);
16356         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16357         msg_conv.is_owned = false;
16358         (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
16359 }
16360
16361 int64_t  CS_LDK_ChannelMessageHandler_provided_node_features(int64_t this_arg) {
16362         void* this_arg_ptr = untag_ptr(this_arg);
16363         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16364         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16365         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
16366         int64_t ret_ref = 0;
16367         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
16368         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
16369         return ret_ref;
16370 }
16371
16372 int64_t  CS_LDK_ChannelMessageHandler_provided_init_features(int64_t this_arg, int8_tArray their_node_id) {
16373         void* this_arg_ptr = untag_ptr(this_arg);
16374         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16375         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16376         LDKPublicKey their_node_id_ref;
16377         CHECK(their_node_id->arr_len == 33);
16378         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
16379         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
16380         int64_t ret_ref = 0;
16381         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
16382         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
16383         return ret_ref;
16384 }
16385
16386 int64_t  CS_LDK_ChannelMessageHandler_get_chain_hashes(int64_t this_arg) {
16387         void* this_arg_ptr = untag_ptr(this_arg);
16388         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16389         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16390         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
16391         *ret_copy = (this_arg_conv->get_chain_hashes)(this_arg_conv->this_arg);
16392         int64_t ret_ref = tag_ptr(ret_copy, true);
16393         return ret_ref;
16394 }
16395
16396 typedef struct LDKOffersMessageHandler_JCalls {
16397         atomic_size_t refcnt;
16398         uint32_t instance_ptr;
16399 } LDKOffersMessageHandler_JCalls;
16400 static void LDKOffersMessageHandler_JCalls_free(void* this_arg) {
16401         LDKOffersMessageHandler_JCalls *j_calls = (LDKOffersMessageHandler_JCalls*) this_arg;
16402         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
16403                 FREE(j_calls);
16404         }
16405 }
16406 LDKCOption_OffersMessageZ handle_message_LDKOffersMessageHandler_jcall(const void* this_arg, LDKOffersMessage message) {
16407         LDKOffersMessageHandler_JCalls *j_calls = (LDKOffersMessageHandler_JCalls*) this_arg;
16408         LDKOffersMessage *message_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
16409         *message_copy = message;
16410         int64_t message_ref = tag_ptr(message_copy, true);
16411         uint64_t ret = js_invoke_function_l_l(j_calls->instance_ptr, 116, message_ref);
16412         void* ret_ptr = untag_ptr(ret);
16413         CHECK_ACCESS(ret_ptr);
16414         LDKCOption_OffersMessageZ ret_conv = *(LDKCOption_OffersMessageZ*)(ret_ptr);
16415         FREE(untag_ptr(ret));
16416         return ret_conv;
16417 }
16418 LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ release_pending_messages_LDKOffersMessageHandler_jcall(const void* this_arg) {
16419         LDKOffersMessageHandler_JCalls *j_calls = (LDKOffersMessageHandler_JCalls*) this_arg;
16420         int64_tArray ret = (int64_tArray)js_invoke_function_l_(j_calls->instance_ptr, 117);
16421         LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ ret_constr;
16422         ret_constr.datalen = ret->arr_len;
16423         if (ret_constr.datalen > 0)
16424                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ Elements");
16425         else
16426                 ret_constr.data = NULL;
16427         int64_t* ret_vals = ret->elems;
16428         for (size_t x = 0; x < ret_constr.datalen; x++) {
16429                 int64_t ret_conv_49 = ret_vals[x];
16430                 void* ret_conv_49_ptr = untag_ptr(ret_conv_49);
16431                 CHECK_ACCESS(ret_conv_49_ptr);
16432                 LDKC3Tuple_OffersMessageDestinationBlindedPathZ ret_conv_49_conv = *(LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)(ret_conv_49_ptr);
16433                 FREE(untag_ptr(ret_conv_49));
16434                 ret_constr.data[x] = ret_conv_49_conv;
16435         }
16436         FREE(ret);
16437         return ret_constr;
16438 }
16439 static void LDKOffersMessageHandler_JCalls_cloned(LDKOffersMessageHandler* new_obj) {
16440         LDKOffersMessageHandler_JCalls *j_calls = (LDKOffersMessageHandler_JCalls*) new_obj->this_arg;
16441         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
16442 }
16443 static inline LDKOffersMessageHandler LDKOffersMessageHandler_init (int64_t o) {
16444         LDKOffersMessageHandler_JCalls *calls = MALLOC(sizeof(LDKOffersMessageHandler_JCalls), "LDKOffersMessageHandler_JCalls");
16445         atomic_init(&calls->refcnt, 1);
16446         calls->instance_ptr = o;
16447
16448         LDKOffersMessageHandler ret = {
16449                 .this_arg = (void*) calls,
16450                 .handle_message = handle_message_LDKOffersMessageHandler_jcall,
16451                 .release_pending_messages = release_pending_messages_LDKOffersMessageHandler_jcall,
16452                 .free = LDKOffersMessageHandler_JCalls_free,
16453         };
16454         return ret;
16455 }
16456 uint64_t  CS_LDK_LDKOffersMessageHandler_new(int32_t o) {
16457         LDKOffersMessageHandler *res_ptr = MALLOC(sizeof(LDKOffersMessageHandler), "LDKOffersMessageHandler");
16458         *res_ptr = LDKOffersMessageHandler_init(o);
16459         return tag_ptr(res_ptr, true);
16460 }
16461 int64_t  CS_LDK_OffersMessageHandler_handle_message(int64_t this_arg, int64_t message) {
16462         void* this_arg_ptr = untag_ptr(this_arg);
16463         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16464         LDKOffersMessageHandler* this_arg_conv = (LDKOffersMessageHandler*)this_arg_ptr;
16465         void* message_ptr = untag_ptr(message);
16466         CHECK_ACCESS(message_ptr);
16467         LDKOffersMessage message_conv = *(LDKOffersMessage*)(message_ptr);
16468         message_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(message));
16469         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
16470         *ret_copy = (this_arg_conv->handle_message)(this_arg_conv->this_arg, message_conv);
16471         int64_t ret_ref = tag_ptr(ret_copy, true);
16472         return ret_ref;
16473 }
16474
16475 int64_tArray  CS_LDK_OffersMessageHandler_release_pending_messages(int64_t this_arg) {
16476         void* this_arg_ptr = untag_ptr(this_arg);
16477         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16478         LDKOffersMessageHandler* this_arg_conv = (LDKOffersMessageHandler*)this_arg_ptr;
16479         LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ ret_var = (this_arg_conv->release_pending_messages)(this_arg_conv->this_arg);
16480         int64_tArray ret_arr = NULL;
16481         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
16482         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
16483         for (size_t x = 0; x < ret_var.datalen; x++) {
16484                 LDKC3Tuple_OffersMessageDestinationBlindedPathZ* ret_conv_49_conv = MALLOC(sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKC3Tuple_OffersMessageDestinationBlindedPathZ");
16485                 *ret_conv_49_conv = ret_var.data[x];
16486                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
16487         }
16488         
16489         FREE(ret_var.data);
16490         return ret_arr;
16491 }
16492
16493 typedef struct LDKNodeIdLookUp_JCalls {
16494         atomic_size_t refcnt;
16495         uint32_t instance_ptr;
16496 } LDKNodeIdLookUp_JCalls;
16497 static void LDKNodeIdLookUp_JCalls_free(void* this_arg) {
16498         LDKNodeIdLookUp_JCalls *j_calls = (LDKNodeIdLookUp_JCalls*) this_arg;
16499         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
16500                 FREE(j_calls);
16501         }
16502 }
16503 LDKPublicKey next_node_id_LDKNodeIdLookUp_jcall(const void* this_arg, uint64_t short_channel_id) {
16504         LDKNodeIdLookUp_JCalls *j_calls = (LDKNodeIdLookUp_JCalls*) this_arg;
16505         int64_t short_channel_id_conv = short_channel_id;
16506         int8_tArray ret = (int8_tArray)js_invoke_function_l_l(j_calls->instance_ptr, 118, short_channel_id_conv);
16507         LDKPublicKey ret_ref;
16508         CHECK(ret->arr_len == 33);
16509         memcpy(ret_ref.compressed_form, ret->elems, 33); FREE(ret);
16510         return ret_ref;
16511 }
16512 static void LDKNodeIdLookUp_JCalls_cloned(LDKNodeIdLookUp* new_obj) {
16513         LDKNodeIdLookUp_JCalls *j_calls = (LDKNodeIdLookUp_JCalls*) new_obj->this_arg;
16514         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
16515 }
16516 static inline LDKNodeIdLookUp LDKNodeIdLookUp_init (int64_t o) {
16517         LDKNodeIdLookUp_JCalls *calls = MALLOC(sizeof(LDKNodeIdLookUp_JCalls), "LDKNodeIdLookUp_JCalls");
16518         atomic_init(&calls->refcnt, 1);
16519         calls->instance_ptr = o;
16520
16521         LDKNodeIdLookUp ret = {
16522                 .this_arg = (void*) calls,
16523                 .next_node_id = next_node_id_LDKNodeIdLookUp_jcall,
16524                 .free = LDKNodeIdLookUp_JCalls_free,
16525         };
16526         return ret;
16527 }
16528 uint64_t  CS_LDK_LDKNodeIdLookUp_new(int32_t o) {
16529         LDKNodeIdLookUp *res_ptr = MALLOC(sizeof(LDKNodeIdLookUp), "LDKNodeIdLookUp");
16530         *res_ptr = LDKNodeIdLookUp_init(o);
16531         return tag_ptr(res_ptr, true);
16532 }
16533 int8_tArray  CS_LDK_NodeIdLookUp_next_node_id(int64_t this_arg, int64_t short_channel_id) {
16534         void* this_arg_ptr = untag_ptr(this_arg);
16535         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16536         LDKNodeIdLookUp* this_arg_conv = (LDKNodeIdLookUp*)this_arg_ptr;
16537         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
16538         memcpy(ret_arr->elems, (this_arg_conv->next_node_id)(this_arg_conv->this_arg, short_channel_id).compressed_form, 33);
16539         return ret_arr;
16540 }
16541
16542 typedef struct LDKRoutingMessageHandler_JCalls {
16543         atomic_size_t refcnt;
16544         uint32_t instance_ptr;
16545         LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
16546 } LDKRoutingMessageHandler_JCalls;
16547 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
16548         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
16549         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
16550                 FREE(j_calls);
16551         }
16552 }
16553 LDKCResult_boolLightningErrorZ handle_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKNodeAnnouncement * msg) {
16554         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
16555         LDKNodeAnnouncement msg_var = *msg;
16556         int64_t msg_ref = 0;
16557         msg_var = NodeAnnouncement_clone(&msg_var);
16558         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16559         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16560         uint64_t ret = js_invoke_function_l_l(j_calls->instance_ptr, 119, msg_ref);
16561         void* ret_ptr = untag_ptr(ret);
16562         CHECK_ACCESS(ret_ptr);
16563         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
16564         FREE(untag_ptr(ret));
16565         return ret_conv;
16566 }
16567 LDKCResult_boolLightningErrorZ handle_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelAnnouncement * msg) {
16568         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
16569         LDKChannelAnnouncement msg_var = *msg;
16570         int64_t msg_ref = 0;
16571         msg_var = ChannelAnnouncement_clone(&msg_var);
16572         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16573         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16574         uint64_t ret = js_invoke_function_l_l(j_calls->instance_ptr, 120, msg_ref);
16575         void* ret_ptr = untag_ptr(ret);
16576         CHECK_ACCESS(ret_ptr);
16577         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
16578         FREE(untag_ptr(ret));
16579         return ret_conv;
16580 }
16581 LDKCResult_boolLightningErrorZ handle_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelUpdate * msg) {
16582         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
16583         LDKChannelUpdate msg_var = *msg;
16584         int64_t msg_ref = 0;
16585         msg_var = ChannelUpdate_clone(&msg_var);
16586         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16587         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16588         uint64_t ret = js_invoke_function_l_l(j_calls->instance_ptr, 121, msg_ref);
16589         void* ret_ptr = untag_ptr(ret);
16590         CHECK_ACCESS(ret_ptr);
16591         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
16592         FREE(untag_ptr(ret));
16593         return ret_conv;
16594 }
16595 LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, uint64_t starting_point) {
16596         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
16597         int64_t starting_point_conv = starting_point;
16598         uint64_t ret = js_invoke_function_l_l(j_calls->instance_ptr, 122, starting_point_conv);
16599         void* ret_ptr = untag_ptr(ret);
16600         CHECK_ACCESS(ret_ptr);
16601         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_conv = *(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)(ret_ptr);
16602         FREE(untag_ptr(ret));
16603         return ret_conv;
16604 }
16605 LDKNodeAnnouncement get_next_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKNodeId starting_point) {
16606         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
16607         LDKNodeId starting_point_var = starting_point;
16608         int64_t starting_point_ref = 0;
16609         CHECK_INNER_FIELD_ACCESS_OR_NULL(starting_point_var);
16610         starting_point_ref = tag_ptr(starting_point_var.inner, starting_point_var.is_owned);
16611         uint64_t ret = js_invoke_function_l_l(j_calls->instance_ptr, 123, starting_point_ref);
16612         LDKNodeAnnouncement ret_conv;
16613         ret_conv.inner = untag_ptr(ret);
16614         ret_conv.is_owned = ptr_is_owned(ret);
16615         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
16616         return ret_conv;
16617 }
16618 LDKCResult_NoneNoneZ peer_connected_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init, bool inbound) {
16619         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
16620         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
16621         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
16622         LDKInit init_var = *init;
16623         int64_t init_ref = 0;
16624         init_var = Init_clone(&init_var);
16625         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_var);
16626         init_ref = tag_ptr(init_var.inner, init_var.is_owned);
16627         jboolean inbound_conv = inbound;
16628         uint64_t ret = js_invoke_function_l_llb(j_calls->instance_ptr, 124, (int64_t)their_node_id_arr, init_ref, inbound_conv);
16629         void* ret_ptr = untag_ptr(ret);
16630         CHECK_ACCESS(ret_ptr);
16631         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
16632         FREE(untag_ptr(ret));
16633         return ret_conv;
16634 }
16635 LDKCResult_NoneLightningErrorZ handle_reply_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) {
16636         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
16637         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
16638         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
16639         LDKReplyChannelRange msg_var = msg;
16640         int64_t msg_ref = 0;
16641         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16642         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16643         uint64_t ret = js_invoke_function_l_ll(j_calls->instance_ptr, 125, (int64_t)their_node_id_arr, msg_ref);
16644         void* ret_ptr = untag_ptr(ret);
16645         CHECK_ACCESS(ret_ptr);
16646         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
16647         FREE(untag_ptr(ret));
16648         return ret_conv;
16649 }
16650 LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) {
16651         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
16652         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
16653         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
16654         LDKReplyShortChannelIdsEnd msg_var = msg;
16655         int64_t msg_ref = 0;
16656         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16657         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16658         uint64_t ret = js_invoke_function_l_ll(j_calls->instance_ptr, 126, (int64_t)their_node_id_arr, msg_ref);
16659         void* ret_ptr = untag_ptr(ret);
16660         CHECK_ACCESS(ret_ptr);
16661         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
16662         FREE(untag_ptr(ret));
16663         return ret_conv;
16664 }
16665 LDKCResult_NoneLightningErrorZ handle_query_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) {
16666         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
16667         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
16668         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
16669         LDKQueryChannelRange msg_var = msg;
16670         int64_t msg_ref = 0;
16671         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16672         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16673         uint64_t ret = js_invoke_function_l_ll(j_calls->instance_ptr, 127, (int64_t)their_node_id_arr, msg_ref);
16674         void* ret_ptr = untag_ptr(ret);
16675         CHECK_ACCESS(ret_ptr);
16676         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
16677         FREE(untag_ptr(ret));
16678         return ret_conv;
16679 }
16680 LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) {
16681         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
16682         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
16683         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
16684         LDKQueryShortChannelIds msg_var = msg;
16685         int64_t msg_ref = 0;
16686         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16687         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16688         uint64_t ret = js_invoke_function_l_ll(j_calls->instance_ptr, 128, (int64_t)their_node_id_arr, msg_ref);
16689         void* ret_ptr = untag_ptr(ret);
16690         CHECK_ACCESS(ret_ptr);
16691         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
16692         FREE(untag_ptr(ret));
16693         return ret_conv;
16694 }
16695 bool processing_queue_high_LDKRoutingMessageHandler_jcall(const void* this_arg) {
16696         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
16697         return js_invoke_function_b_(j_calls->instance_ptr, 129);
16698 }
16699 LDKNodeFeatures provided_node_features_LDKRoutingMessageHandler_jcall(const void* this_arg) {
16700         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
16701         uint64_t ret = js_invoke_function_l_(j_calls->instance_ptr, 130);
16702         LDKNodeFeatures ret_conv;
16703         ret_conv.inner = untag_ptr(ret);
16704         ret_conv.is_owned = ptr_is_owned(ret);
16705         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
16706         return ret_conv;
16707 }
16708 LDKInitFeatures provided_init_features_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
16709         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
16710         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
16711         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
16712         uint64_t ret = js_invoke_function_l_l(j_calls->instance_ptr, 131, (int64_t)their_node_id_arr);
16713         LDKInitFeatures ret_conv;
16714         ret_conv.inner = untag_ptr(ret);
16715         ret_conv.is_owned = ptr_is_owned(ret);
16716         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
16717         return ret_conv;
16718 }
16719 static void LDKRoutingMessageHandler_JCalls_cloned(LDKRoutingMessageHandler* new_obj) {
16720         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) new_obj->this_arg;
16721         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
16722         atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
16723 }
16724 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (int64_t o, int64_t MessageSendEventsProvider) {
16725         LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
16726         atomic_init(&calls->refcnt, 1);
16727         calls->instance_ptr = o;
16728
16729         LDKRoutingMessageHandler ret = {
16730                 .this_arg = (void*) calls,
16731                 .handle_node_announcement = handle_node_announcement_LDKRoutingMessageHandler_jcall,
16732                 .handle_channel_announcement = handle_channel_announcement_LDKRoutingMessageHandler_jcall,
16733                 .handle_channel_update = handle_channel_update_LDKRoutingMessageHandler_jcall,
16734                 .get_next_channel_announcement = get_next_channel_announcement_LDKRoutingMessageHandler_jcall,
16735                 .get_next_node_announcement = get_next_node_announcement_LDKRoutingMessageHandler_jcall,
16736                 .peer_connected = peer_connected_LDKRoutingMessageHandler_jcall,
16737                 .handle_reply_channel_range = handle_reply_channel_range_LDKRoutingMessageHandler_jcall,
16738                 .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall,
16739                 .handle_query_channel_range = handle_query_channel_range_LDKRoutingMessageHandler_jcall,
16740                 .handle_query_short_channel_ids = handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall,
16741                 .processing_queue_high = processing_queue_high_LDKRoutingMessageHandler_jcall,
16742                 .provided_node_features = provided_node_features_LDKRoutingMessageHandler_jcall,
16743                 .provided_init_features = provided_init_features_LDKRoutingMessageHandler_jcall,
16744                 .free = LDKRoutingMessageHandler_JCalls_free,
16745                 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
16746         };
16747         calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
16748         return ret;
16749 }
16750 uint64_t  CS_LDK_LDKRoutingMessageHandler_new(int32_t o, int32_t MessageSendEventsProvider) {
16751         LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
16752         *res_ptr = LDKRoutingMessageHandler_init(o, MessageSendEventsProvider);
16753         return tag_ptr(res_ptr, true);
16754 }
16755 int64_t  CS_LDK_RoutingMessageHandler_handle_node_announcement(int64_t this_arg, int64_t msg) {
16756         void* this_arg_ptr = untag_ptr(this_arg);
16757         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16758         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
16759         LDKNodeAnnouncement msg_conv;
16760         msg_conv.inner = untag_ptr(msg);
16761         msg_conv.is_owned = ptr_is_owned(msg);
16762         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16763         msg_conv.is_owned = false;
16764         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
16765         *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
16766         return tag_ptr(ret_conv, true);
16767 }
16768
16769 int64_t  CS_LDK_RoutingMessageHandler_handle_channel_announcement(int64_t this_arg, int64_t msg) {
16770         void* this_arg_ptr = untag_ptr(this_arg);
16771         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16772         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
16773         LDKChannelAnnouncement msg_conv;
16774         msg_conv.inner = untag_ptr(msg);
16775         msg_conv.is_owned = ptr_is_owned(msg);
16776         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16777         msg_conv.is_owned = false;
16778         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
16779         *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
16780         return tag_ptr(ret_conv, true);
16781 }
16782
16783 int64_t  CS_LDK_RoutingMessageHandler_handle_channel_update(int64_t this_arg, int64_t msg) {
16784         void* this_arg_ptr = untag_ptr(this_arg);
16785         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16786         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
16787         LDKChannelUpdate msg_conv;
16788         msg_conv.inner = untag_ptr(msg);
16789         msg_conv.is_owned = ptr_is_owned(msg);
16790         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16791         msg_conv.is_owned = false;
16792         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
16793         *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
16794         return tag_ptr(ret_conv, true);
16795 }
16796
16797 int64_t  CS_LDK_RoutingMessageHandler_get_next_channel_announcement(int64_t this_arg, int64_t starting_point) {
16798         void* this_arg_ptr = untag_ptr(this_arg);
16799         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16800         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
16801         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
16802         *ret_copy = (this_arg_conv->get_next_channel_announcement)(this_arg_conv->this_arg, starting_point);
16803         int64_t ret_ref = tag_ptr(ret_copy, true);
16804         return ret_ref;
16805 }
16806
16807 int64_t  CS_LDK_RoutingMessageHandler_get_next_node_announcement(int64_t this_arg, int64_t starting_point) {
16808         void* this_arg_ptr = untag_ptr(this_arg);
16809         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16810         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
16811         LDKNodeId starting_point_conv;
16812         starting_point_conv.inner = untag_ptr(starting_point);
16813         starting_point_conv.is_owned = ptr_is_owned(starting_point);
16814         CHECK_INNER_FIELD_ACCESS_OR_NULL(starting_point_conv);
16815         starting_point_conv = NodeId_clone(&starting_point_conv);
16816         LDKNodeAnnouncement ret_var = (this_arg_conv->get_next_node_announcement)(this_arg_conv->this_arg, starting_point_conv);
16817         int64_t ret_ref = 0;
16818         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
16819         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
16820         return ret_ref;
16821 }
16822
16823 int64_t  CS_LDK_RoutingMessageHandler_peer_connected(int64_t this_arg, int8_tArray their_node_id, int64_t init, jboolean inbound) {
16824         void* this_arg_ptr = untag_ptr(this_arg);
16825         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16826         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
16827         LDKPublicKey their_node_id_ref;
16828         CHECK(their_node_id->arr_len == 33);
16829         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
16830         LDKInit init_conv;
16831         init_conv.inner = untag_ptr(init);
16832         init_conv.is_owned = ptr_is_owned(init);
16833         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_conv);
16834         init_conv.is_owned = false;
16835         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
16836         *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &init_conv, inbound);
16837         return tag_ptr(ret_conv, true);
16838 }
16839
16840 int64_t  CS_LDK_RoutingMessageHandler_handle_reply_channel_range(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
16841         void* this_arg_ptr = untag_ptr(this_arg);
16842         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16843         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
16844         LDKPublicKey their_node_id_ref;
16845         CHECK(their_node_id->arr_len == 33);
16846         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
16847         LDKReplyChannelRange msg_conv;
16848         msg_conv.inner = untag_ptr(msg);
16849         msg_conv.is_owned = ptr_is_owned(msg);
16850         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16851         msg_conv = ReplyChannelRange_clone(&msg_conv);
16852         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
16853         *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
16854         return tag_ptr(ret_conv, true);
16855 }
16856
16857 int64_t  CS_LDK_RoutingMessageHandler_handle_reply_short_channel_ids_end(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
16858         void* this_arg_ptr = untag_ptr(this_arg);
16859         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16860         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
16861         LDKPublicKey their_node_id_ref;
16862         CHECK(their_node_id->arr_len == 33);
16863         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
16864         LDKReplyShortChannelIdsEnd msg_conv;
16865         msg_conv.inner = untag_ptr(msg);
16866         msg_conv.is_owned = ptr_is_owned(msg);
16867         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16868         msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
16869         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
16870         *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
16871         return tag_ptr(ret_conv, true);
16872 }
16873
16874 int64_t  CS_LDK_RoutingMessageHandler_handle_query_channel_range(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
16875         void* this_arg_ptr = untag_ptr(this_arg);
16876         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16877         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
16878         LDKPublicKey their_node_id_ref;
16879         CHECK(their_node_id->arr_len == 33);
16880         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
16881         LDKQueryChannelRange msg_conv;
16882         msg_conv.inner = untag_ptr(msg);
16883         msg_conv.is_owned = ptr_is_owned(msg);
16884         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16885         msg_conv = QueryChannelRange_clone(&msg_conv);
16886         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
16887         *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
16888         return tag_ptr(ret_conv, true);
16889 }
16890
16891 int64_t  CS_LDK_RoutingMessageHandler_handle_query_short_channel_ids(int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
16892         void* this_arg_ptr = untag_ptr(this_arg);
16893         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16894         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
16895         LDKPublicKey their_node_id_ref;
16896         CHECK(their_node_id->arr_len == 33);
16897         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
16898         LDKQueryShortChannelIds msg_conv;
16899         msg_conv.inner = untag_ptr(msg);
16900         msg_conv.is_owned = ptr_is_owned(msg);
16901         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16902         msg_conv = QueryShortChannelIds_clone(&msg_conv);
16903         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
16904         *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
16905         return tag_ptr(ret_conv, true);
16906 }
16907
16908 jboolean  CS_LDK_RoutingMessageHandler_processing_queue_high(int64_t this_arg) {
16909         void* this_arg_ptr = untag_ptr(this_arg);
16910         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16911         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
16912         jboolean ret_conv = (this_arg_conv->processing_queue_high)(this_arg_conv->this_arg);
16913         return ret_conv;
16914 }
16915
16916 int64_t  CS_LDK_RoutingMessageHandler_provided_node_features(int64_t this_arg) {
16917         void* this_arg_ptr = untag_ptr(this_arg);
16918         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16919         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
16920         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
16921         int64_t ret_ref = 0;
16922         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
16923         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
16924         return ret_ref;
16925 }
16926
16927 int64_t  CS_LDK_RoutingMessageHandler_provided_init_features(int64_t this_arg, int8_tArray their_node_id) {
16928         void* this_arg_ptr = untag_ptr(this_arg);
16929         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16930         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
16931         LDKPublicKey their_node_id_ref;
16932         CHECK(their_node_id->arr_len == 33);
16933         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
16934         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
16935         int64_t ret_ref = 0;
16936         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
16937         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
16938         return ret_ref;
16939 }
16940
16941 typedef struct LDKOnionMessageHandler_JCalls {
16942         atomic_size_t refcnt;
16943         uint32_t instance_ptr;
16944 } LDKOnionMessageHandler_JCalls;
16945 static void LDKOnionMessageHandler_JCalls_free(void* this_arg) {
16946         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
16947         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
16948                 FREE(j_calls);
16949         }
16950 }
16951 LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ get_and_clear_connections_needed_LDKOnionMessageHandler_jcall(const void* this_arg) {
16952         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
16953         int64_tArray ret = (int64_tArray)js_invoke_function_l_(j_calls->instance_ptr, 132);
16954         LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ ret_constr;
16955         ret_constr.datalen = ret->arr_len;
16956         if (ret_constr.datalen > 0)
16957                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ), "LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ Elements");
16958         else
16959                 ret_constr.data = NULL;
16960         int64_t* ret_vals = ret->elems;
16961         for (size_t o = 0; o < ret_constr.datalen; o++) {
16962                 int64_t ret_conv_40 = ret_vals[o];
16963                 void* ret_conv_40_ptr = untag_ptr(ret_conv_40);
16964                 CHECK_ACCESS(ret_conv_40_ptr);
16965                 LDKC2Tuple_PublicKeyCVec_SocketAddressZZ ret_conv_40_conv = *(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ*)(ret_conv_40_ptr);
16966                 FREE(untag_ptr(ret_conv_40));
16967                 ret_constr.data[o] = ret_conv_40_conv;
16968         }
16969         FREE(ret);
16970         return ret_constr;
16971 }
16972 void handle_onion_message_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey peer_node_id, const LDKOnionMessage * msg) {
16973         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
16974         int8_tArray peer_node_id_arr = init_int8_tArray(33, __LINE__);
16975         memcpy(peer_node_id_arr->elems, peer_node_id.compressed_form, 33);
16976         LDKOnionMessage msg_var = *msg;
16977         int64_t msg_ref = 0;
16978         msg_var = OnionMessage_clone(&msg_var);
16979         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16980         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16981         js_invoke_function_void_ll(j_calls->instance_ptr, 133, (int64_t)peer_node_id_arr, msg_ref);
16982 }
16983 LDKOnionMessage next_onion_message_for_peer_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey peer_node_id) {
16984         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
16985         int8_tArray peer_node_id_arr = init_int8_tArray(33, __LINE__);
16986         memcpy(peer_node_id_arr->elems, peer_node_id.compressed_form, 33);
16987         uint64_t ret = js_invoke_function_l_l(j_calls->instance_ptr, 134, (int64_t)peer_node_id_arr);
16988         LDKOnionMessage ret_conv;
16989         ret_conv.inner = untag_ptr(ret);
16990         ret_conv.is_owned = ptr_is_owned(ret);
16991         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
16992         return ret_conv;
16993 }
16994 LDKCResult_NoneNoneZ peer_connected_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init, bool inbound) {
16995         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
16996         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
16997         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
16998         LDKInit init_var = *init;
16999         int64_t init_ref = 0;
17000         init_var = Init_clone(&init_var);
17001         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_var);
17002         init_ref = tag_ptr(init_var.inner, init_var.is_owned);
17003         jboolean inbound_conv = inbound;
17004         uint64_t ret = js_invoke_function_l_llb(j_calls->instance_ptr, 135, (int64_t)their_node_id_arr, init_ref, inbound_conv);
17005         void* ret_ptr = untag_ptr(ret);
17006         CHECK_ACCESS(ret_ptr);
17007         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
17008         FREE(untag_ptr(ret));
17009         return ret_conv;
17010 }
17011 void peer_disconnected_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
17012         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
17013         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
17014         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
17015         js_invoke_function_void_l(j_calls->instance_ptr, 136, (int64_t)their_node_id_arr);
17016 }
17017 void timer_tick_occurred_LDKOnionMessageHandler_jcall(const void* this_arg) {
17018         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
17019         js_invoke_function_void_(j_calls->instance_ptr, 137);
17020 }
17021 LDKNodeFeatures provided_node_features_LDKOnionMessageHandler_jcall(const void* this_arg) {
17022         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
17023         uint64_t ret = js_invoke_function_l_(j_calls->instance_ptr, 138);
17024         LDKNodeFeatures ret_conv;
17025         ret_conv.inner = untag_ptr(ret);
17026         ret_conv.is_owned = ptr_is_owned(ret);
17027         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
17028         return ret_conv;
17029 }
17030 LDKInitFeatures provided_init_features_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
17031         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
17032         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
17033         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
17034         uint64_t ret = js_invoke_function_l_l(j_calls->instance_ptr, 139, (int64_t)their_node_id_arr);
17035         LDKInitFeatures ret_conv;
17036         ret_conv.inner = untag_ptr(ret);
17037         ret_conv.is_owned = ptr_is_owned(ret);
17038         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
17039         return ret_conv;
17040 }
17041 static void LDKOnionMessageHandler_JCalls_cloned(LDKOnionMessageHandler* new_obj) {
17042         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) new_obj->this_arg;
17043         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
17044 }
17045 static inline LDKOnionMessageHandler LDKOnionMessageHandler_init (int64_t o) {
17046         LDKOnionMessageHandler_JCalls *calls = MALLOC(sizeof(LDKOnionMessageHandler_JCalls), "LDKOnionMessageHandler_JCalls");
17047         atomic_init(&calls->refcnt, 1);
17048         calls->instance_ptr = o;
17049
17050         LDKOnionMessageHandler ret = {
17051                 .this_arg = (void*) calls,
17052                 .get_and_clear_connections_needed = get_and_clear_connections_needed_LDKOnionMessageHandler_jcall,
17053                 .handle_onion_message = handle_onion_message_LDKOnionMessageHandler_jcall,
17054                 .next_onion_message_for_peer = next_onion_message_for_peer_LDKOnionMessageHandler_jcall,
17055                 .peer_connected = peer_connected_LDKOnionMessageHandler_jcall,
17056                 .peer_disconnected = peer_disconnected_LDKOnionMessageHandler_jcall,
17057                 .timer_tick_occurred = timer_tick_occurred_LDKOnionMessageHandler_jcall,
17058                 .provided_node_features = provided_node_features_LDKOnionMessageHandler_jcall,
17059                 .provided_init_features = provided_init_features_LDKOnionMessageHandler_jcall,
17060                 .free = LDKOnionMessageHandler_JCalls_free,
17061         };
17062         return ret;
17063 }
17064 uint64_t  CS_LDK_LDKOnionMessageHandler_new(int32_t o) {
17065         LDKOnionMessageHandler *res_ptr = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
17066         *res_ptr = LDKOnionMessageHandler_init(o);
17067         return tag_ptr(res_ptr, true);
17068 }
17069 int64_tArray  CS_LDK_OnionMessageHandler_get_and_clear_connections_needed(int64_t this_arg) {
17070         void* this_arg_ptr = untag_ptr(this_arg);
17071         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17072         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
17073         LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ ret_var = (this_arg_conv->get_and_clear_connections_needed)(this_arg_conv->this_arg);
17074         int64_tArray ret_arr = NULL;
17075         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
17076         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
17077         for (size_t o = 0; o < ret_var.datalen; o++) {
17078                 LDKC2Tuple_PublicKeyCVec_SocketAddressZZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ), "LDKC2Tuple_PublicKeyCVec_SocketAddressZZ");
17079                 *ret_conv_40_conv = ret_var.data[o];
17080                 ret_arr_ptr[o] = tag_ptr(ret_conv_40_conv, true);
17081         }
17082         
17083         FREE(ret_var.data);
17084         return ret_arr;
17085 }
17086
17087 void  CS_LDK_OnionMessageHandler_handle_onion_message(int64_t this_arg, int8_tArray peer_node_id, int64_t msg) {
17088         void* this_arg_ptr = untag_ptr(this_arg);
17089         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17090         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
17091         LDKPublicKey peer_node_id_ref;
17092         CHECK(peer_node_id->arr_len == 33);
17093         memcpy(peer_node_id_ref.compressed_form, peer_node_id->elems, 33); FREE(peer_node_id);
17094         LDKOnionMessage msg_conv;
17095         msg_conv.inner = untag_ptr(msg);
17096         msg_conv.is_owned = ptr_is_owned(msg);
17097         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17098         msg_conv.is_owned = false;
17099         (this_arg_conv->handle_onion_message)(this_arg_conv->this_arg, peer_node_id_ref, &msg_conv);
17100 }
17101
17102 int64_t  CS_LDK_OnionMessageHandler_next_onion_message_for_peer(int64_t this_arg, int8_tArray peer_node_id) {
17103         void* this_arg_ptr = untag_ptr(this_arg);
17104         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17105         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
17106         LDKPublicKey peer_node_id_ref;
17107         CHECK(peer_node_id->arr_len == 33);
17108         memcpy(peer_node_id_ref.compressed_form, peer_node_id->elems, 33); FREE(peer_node_id);
17109         LDKOnionMessage ret_var = (this_arg_conv->next_onion_message_for_peer)(this_arg_conv->this_arg, peer_node_id_ref);
17110         int64_t ret_ref = 0;
17111         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17112         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
17113         return ret_ref;
17114 }
17115
17116 int64_t  CS_LDK_OnionMessageHandler_peer_connected(int64_t this_arg, int8_tArray their_node_id, int64_t init, jboolean inbound) {
17117         void* this_arg_ptr = untag_ptr(this_arg);
17118         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17119         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
17120         LDKPublicKey their_node_id_ref;
17121         CHECK(their_node_id->arr_len == 33);
17122         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
17123         LDKInit init_conv;
17124         init_conv.inner = untag_ptr(init);
17125         init_conv.is_owned = ptr_is_owned(init);
17126         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_conv);
17127         init_conv.is_owned = false;
17128         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
17129         *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &init_conv, inbound);
17130         return tag_ptr(ret_conv, true);
17131 }
17132
17133 void  CS_LDK_OnionMessageHandler_peer_disconnected(int64_t this_arg, int8_tArray their_node_id) {
17134         void* this_arg_ptr = untag_ptr(this_arg);
17135         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17136         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
17137         LDKPublicKey their_node_id_ref;
17138         CHECK(their_node_id->arr_len == 33);
17139         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
17140         (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref);
17141 }
17142
17143 void  CS_LDK_OnionMessageHandler_timer_tick_occurred(int64_t this_arg) {
17144         void* this_arg_ptr = untag_ptr(this_arg);
17145         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17146         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
17147         (this_arg_conv->timer_tick_occurred)(this_arg_conv->this_arg);
17148 }
17149
17150 int64_t  CS_LDK_OnionMessageHandler_provided_node_features(int64_t this_arg) {
17151         void* this_arg_ptr = untag_ptr(this_arg);
17152         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17153         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
17154         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
17155         int64_t ret_ref = 0;
17156         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17157         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
17158         return ret_ref;
17159 }
17160
17161 int64_t  CS_LDK_OnionMessageHandler_provided_init_features(int64_t this_arg, int8_tArray their_node_id) {
17162         void* this_arg_ptr = untag_ptr(this_arg);
17163         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17164         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
17165         LDKPublicKey their_node_id_ref;
17166         CHECK(their_node_id->arr_len == 33);
17167         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
17168         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
17169         int64_t ret_ref = 0;
17170         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17171         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
17172         return ret_ref;
17173 }
17174
17175 typedef struct LDKCustomMessageReader_JCalls {
17176         atomic_size_t refcnt;
17177         uint32_t instance_ptr;
17178 } LDKCustomMessageReader_JCalls;
17179 static void LDKCustomMessageReader_JCalls_free(void* this_arg) {
17180         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
17181         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
17182                 FREE(j_calls);
17183         }
17184 }
17185 LDKCResult_COption_TypeZDecodeErrorZ read_LDKCustomMessageReader_jcall(const void* this_arg, uint16_t message_type, LDKu8slice buffer) {
17186         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
17187         int16_t message_type_conv = message_type;
17188         LDKu8slice buffer_var = buffer;
17189         int8_tArray buffer_arr = init_int8_tArray(buffer_var.datalen, __LINE__);
17190         memcpy(buffer_arr->elems, buffer_var.data, buffer_var.datalen);
17191         uint64_t ret = js_invoke_function_l_sl(j_calls->instance_ptr, 140, message_type_conv, (int64_t)buffer_arr);
17192         void* ret_ptr = untag_ptr(ret);
17193         CHECK_ACCESS(ret_ptr);
17194         LDKCResult_COption_TypeZDecodeErrorZ ret_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(ret_ptr);
17195         FREE(untag_ptr(ret));
17196         return ret_conv;
17197 }
17198 static void LDKCustomMessageReader_JCalls_cloned(LDKCustomMessageReader* new_obj) {
17199         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) new_obj->this_arg;
17200         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
17201 }
17202 static inline LDKCustomMessageReader LDKCustomMessageReader_init (int64_t o) {
17203         LDKCustomMessageReader_JCalls *calls = MALLOC(sizeof(LDKCustomMessageReader_JCalls), "LDKCustomMessageReader_JCalls");
17204         atomic_init(&calls->refcnt, 1);
17205         calls->instance_ptr = o;
17206
17207         LDKCustomMessageReader ret = {
17208                 .this_arg = (void*) calls,
17209                 .read = read_LDKCustomMessageReader_jcall,
17210                 .free = LDKCustomMessageReader_JCalls_free,
17211         };
17212         return ret;
17213 }
17214 uint64_t  CS_LDK_LDKCustomMessageReader_new(int32_t o) {
17215         LDKCustomMessageReader *res_ptr = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
17216         *res_ptr = LDKCustomMessageReader_init(o);
17217         return tag_ptr(res_ptr, true);
17218 }
17219 int64_t  CS_LDK_CustomMessageReader_read(int64_t this_arg, int16_t message_type, int8_tArray buffer) {
17220         void* this_arg_ptr = untag_ptr(this_arg);
17221         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17222         LDKCustomMessageReader* this_arg_conv = (LDKCustomMessageReader*)this_arg_ptr;
17223         LDKu8slice buffer_ref;
17224         buffer_ref.datalen = buffer->arr_len;
17225         buffer_ref.data = buffer->elems;
17226         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
17227         *ret_conv = (this_arg_conv->read)(this_arg_conv->this_arg, message_type, buffer_ref);
17228         FREE(buffer);
17229         return tag_ptr(ret_conv, true);
17230 }
17231
17232 typedef struct LDKCustomMessageHandler_JCalls {
17233         atomic_size_t refcnt;
17234         uint32_t instance_ptr;
17235         LDKCustomMessageReader_JCalls* CustomMessageReader;
17236 } LDKCustomMessageHandler_JCalls;
17237 static void LDKCustomMessageHandler_JCalls_free(void* this_arg) {
17238         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
17239         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
17240                 FREE(j_calls);
17241         }
17242 }
17243 LDKCResult_NoneLightningErrorZ handle_custom_message_LDKCustomMessageHandler_jcall(const void* this_arg, LDKType msg, LDKPublicKey sender_node_id) {
17244         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
17245         LDKType* msg_ret = MALLOC(sizeof(LDKType), "LDKType");
17246         *msg_ret = msg;
17247         int8_tArray sender_node_id_arr = init_int8_tArray(33, __LINE__);
17248         memcpy(sender_node_id_arr->elems, sender_node_id.compressed_form, 33);
17249         uint64_t ret = js_invoke_function_l_ll(j_calls->instance_ptr, 141, tag_ptr(msg_ret, true), (int64_t)sender_node_id_arr);
17250         void* ret_ptr = untag_ptr(ret);
17251         CHECK_ACCESS(ret_ptr);
17252         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
17253         FREE(untag_ptr(ret));
17254         return ret_conv;
17255 }
17256 LDKCVec_C2Tuple_PublicKeyTypeZZ get_and_clear_pending_msg_LDKCustomMessageHandler_jcall(const void* this_arg) {
17257         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
17258         int64_tArray ret = (int64_tArray)js_invoke_function_l_(j_calls->instance_ptr, 142);
17259         LDKCVec_C2Tuple_PublicKeyTypeZZ ret_constr;
17260         ret_constr.datalen = ret->arr_len;
17261         if (ret_constr.datalen > 0)
17262                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
17263         else
17264                 ret_constr.data = NULL;
17265         int64_t* ret_vals = ret->elems;
17266         for (size_t z = 0; z < ret_constr.datalen; z++) {
17267                 int64_t ret_conv_25 = ret_vals[z];
17268                 void* ret_conv_25_ptr = untag_ptr(ret_conv_25);
17269                 CHECK_ACCESS(ret_conv_25_ptr);
17270                 LDKC2Tuple_PublicKeyTypeZ ret_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(ret_conv_25_ptr);
17271                 FREE(untag_ptr(ret_conv_25));
17272                 ret_constr.data[z] = ret_conv_25_conv;
17273         }
17274         FREE(ret);
17275         return ret_constr;
17276 }
17277 LDKNodeFeatures provided_node_features_LDKCustomMessageHandler_jcall(const void* this_arg) {
17278         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
17279         uint64_t ret = js_invoke_function_l_(j_calls->instance_ptr, 143);
17280         LDKNodeFeatures ret_conv;
17281         ret_conv.inner = untag_ptr(ret);
17282         ret_conv.is_owned = ptr_is_owned(ret);
17283         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
17284         return ret_conv;
17285 }
17286 LDKInitFeatures provided_init_features_LDKCustomMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
17287         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
17288         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
17289         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
17290         uint64_t ret = js_invoke_function_l_l(j_calls->instance_ptr, 144, (int64_t)their_node_id_arr);
17291         LDKInitFeatures ret_conv;
17292         ret_conv.inner = untag_ptr(ret);
17293         ret_conv.is_owned = ptr_is_owned(ret);
17294         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
17295         return ret_conv;
17296 }
17297 static void LDKCustomMessageHandler_JCalls_cloned(LDKCustomMessageHandler* new_obj) {
17298         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) new_obj->this_arg;
17299         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
17300         atomic_fetch_add_explicit(&j_calls->CustomMessageReader->refcnt, 1, memory_order_release);
17301 }
17302 static inline LDKCustomMessageHandler LDKCustomMessageHandler_init (int64_t o, int64_t CustomMessageReader) {
17303         LDKCustomMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomMessageHandler_JCalls), "LDKCustomMessageHandler_JCalls");
17304         atomic_init(&calls->refcnt, 1);
17305         calls->instance_ptr = o;
17306
17307         LDKCustomMessageHandler ret = {
17308                 .this_arg = (void*) calls,
17309                 .handle_custom_message = handle_custom_message_LDKCustomMessageHandler_jcall,
17310                 .get_and_clear_pending_msg = get_and_clear_pending_msg_LDKCustomMessageHandler_jcall,
17311                 .provided_node_features = provided_node_features_LDKCustomMessageHandler_jcall,
17312                 .provided_init_features = provided_init_features_LDKCustomMessageHandler_jcall,
17313                 .free = LDKCustomMessageHandler_JCalls_free,
17314                 .CustomMessageReader = LDKCustomMessageReader_init(CustomMessageReader),
17315         };
17316         calls->CustomMessageReader = ret.CustomMessageReader.this_arg;
17317         return ret;
17318 }
17319 uint64_t  CS_LDK_LDKCustomMessageHandler_new(int32_t o, int32_t CustomMessageReader) {
17320         LDKCustomMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
17321         *res_ptr = LDKCustomMessageHandler_init(o, CustomMessageReader);
17322         return tag_ptr(res_ptr, true);
17323 }
17324 int64_t  CS_LDK_CustomMessageHandler_handle_custom_message(int64_t this_arg, int64_t msg, int8_tArray sender_node_id) {
17325         void* this_arg_ptr = untag_ptr(this_arg);
17326         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17327         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
17328         void* msg_ptr = untag_ptr(msg);
17329         CHECK_ACCESS(msg_ptr);
17330         LDKType msg_conv = *(LDKType*)(msg_ptr);
17331         if (msg_conv.free == LDKType_JCalls_free) {
17332                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
17333                 LDKType_JCalls_cloned(&msg_conv);
17334         }
17335         LDKPublicKey sender_node_id_ref;
17336         CHECK(sender_node_id->arr_len == 33);
17337         memcpy(sender_node_id_ref.compressed_form, sender_node_id->elems, 33); FREE(sender_node_id);
17338         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
17339         *ret_conv = (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv, sender_node_id_ref);
17340         return tag_ptr(ret_conv, true);
17341 }
17342
17343 int64_tArray  CS_LDK_CustomMessageHandler_get_and_clear_pending_msg(int64_t this_arg) {
17344         void* this_arg_ptr = untag_ptr(this_arg);
17345         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17346         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
17347         LDKCVec_C2Tuple_PublicKeyTypeZZ ret_var = (this_arg_conv->get_and_clear_pending_msg)(this_arg_conv->this_arg);
17348         int64_tArray ret_arr = NULL;
17349         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
17350         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
17351         for (size_t z = 0; z < ret_var.datalen; z++) {
17352                 LDKC2Tuple_PublicKeyTypeZ* ret_conv_25_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
17353                 *ret_conv_25_conv = ret_var.data[z];
17354                 ret_arr_ptr[z] = tag_ptr(ret_conv_25_conv, true);
17355         }
17356         
17357         FREE(ret_var.data);
17358         return ret_arr;
17359 }
17360
17361 int64_t  CS_LDK_CustomMessageHandler_provided_node_features(int64_t this_arg) {
17362         void* this_arg_ptr = untag_ptr(this_arg);
17363         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17364         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
17365         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
17366         int64_t ret_ref = 0;
17367         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17368         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
17369         return ret_ref;
17370 }
17371
17372 int64_t  CS_LDK_CustomMessageHandler_provided_init_features(int64_t this_arg, int8_tArray their_node_id) {
17373         void* this_arg_ptr = untag_ptr(this_arg);
17374         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17375         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
17376         LDKPublicKey their_node_id_ref;
17377         CHECK(their_node_id->arr_len == 33);
17378         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
17379         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
17380         int64_t ret_ref = 0;
17381         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17382         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
17383         return ret_ref;
17384 }
17385
17386 typedef struct LDKCustomOnionMessageHandler_JCalls {
17387         atomic_size_t refcnt;
17388         uint32_t instance_ptr;
17389 } LDKCustomOnionMessageHandler_JCalls;
17390 static void LDKCustomOnionMessageHandler_JCalls_free(void* this_arg) {
17391         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
17392         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
17393                 FREE(j_calls);
17394         }
17395 }
17396 LDKCOption_OnionMessageContentsZ handle_custom_message_LDKCustomOnionMessageHandler_jcall(const void* this_arg, LDKOnionMessageContents msg) {
17397         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
17398         LDKOnionMessageContents* msg_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
17399         *msg_ret = msg;
17400         uint64_t ret = js_invoke_function_l_l(j_calls->instance_ptr, 145, tag_ptr(msg_ret, true));
17401         void* ret_ptr = untag_ptr(ret);
17402         CHECK_ACCESS(ret_ptr);
17403         LDKCOption_OnionMessageContentsZ ret_conv = *(LDKCOption_OnionMessageContentsZ*)(ret_ptr);
17404         FREE(untag_ptr(ret));
17405         return ret_conv;
17406 }
17407 LDKCResult_COption_OnionMessageContentsZDecodeErrorZ read_custom_message_LDKCustomOnionMessageHandler_jcall(const void* this_arg, uint64_t message_type, LDKu8slice buffer) {
17408         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
17409         int64_t message_type_conv = message_type;
17410         LDKu8slice buffer_var = buffer;
17411         int8_tArray buffer_arr = init_int8_tArray(buffer_var.datalen, __LINE__);
17412         memcpy(buffer_arr->elems, buffer_var.data, buffer_var.datalen);
17413         uint64_t ret = js_invoke_function_l_ll(j_calls->instance_ptr, 146, message_type_conv, (int64_t)buffer_arr);
17414         void* ret_ptr = untag_ptr(ret);
17415         CHECK_ACCESS(ret_ptr);
17416         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ ret_conv = *(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)(ret_ptr);
17417         FREE(untag_ptr(ret));
17418         return ret_conv;
17419 }
17420 LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ release_pending_custom_messages_LDKCustomOnionMessageHandler_jcall(const void* this_arg) {
17421         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
17422         int64_tArray ret = (int64_tArray)js_invoke_function_l_(j_calls->instance_ptr, 147);
17423         LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ ret_constr;
17424         ret_constr.datalen = ret->arr_len;
17425         if (ret_constr.datalen > 0)
17426                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ Elements");
17427         else
17428                 ret_constr.data = NULL;
17429         int64_t* ret_vals = ret->elems;
17430         for (size_t e = 0; e < ret_constr.datalen; e++) {
17431                 int64_t ret_conv_56 = ret_vals[e];
17432                 void* ret_conv_56_ptr = untag_ptr(ret_conv_56);
17433                 CHECK_ACCESS(ret_conv_56_ptr);
17434                 LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ ret_conv_56_conv = *(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)(ret_conv_56_ptr);
17435                 FREE(untag_ptr(ret_conv_56));
17436                 ret_constr.data[e] = ret_conv_56_conv;
17437         }
17438         FREE(ret);
17439         return ret_constr;
17440 }
17441 static void LDKCustomOnionMessageHandler_JCalls_cloned(LDKCustomOnionMessageHandler* new_obj) {
17442         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) new_obj->this_arg;
17443         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
17444 }
17445 static inline LDKCustomOnionMessageHandler LDKCustomOnionMessageHandler_init (int64_t o) {
17446         LDKCustomOnionMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomOnionMessageHandler_JCalls), "LDKCustomOnionMessageHandler_JCalls");
17447         atomic_init(&calls->refcnt, 1);
17448         calls->instance_ptr = o;
17449
17450         LDKCustomOnionMessageHandler ret = {
17451                 .this_arg = (void*) calls,
17452                 .handle_custom_message = handle_custom_message_LDKCustomOnionMessageHandler_jcall,
17453                 .read_custom_message = read_custom_message_LDKCustomOnionMessageHandler_jcall,
17454                 .release_pending_custom_messages = release_pending_custom_messages_LDKCustomOnionMessageHandler_jcall,
17455                 .free = LDKCustomOnionMessageHandler_JCalls_free,
17456         };
17457         return ret;
17458 }
17459 uint64_t  CS_LDK_LDKCustomOnionMessageHandler_new(int32_t o) {
17460         LDKCustomOnionMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomOnionMessageHandler), "LDKCustomOnionMessageHandler");
17461         *res_ptr = LDKCustomOnionMessageHandler_init(o);
17462         return tag_ptr(res_ptr, true);
17463 }
17464 int64_t  CS_LDK_CustomOnionMessageHandler_handle_custom_message(int64_t this_arg, int64_t msg) {
17465         void* this_arg_ptr = untag_ptr(this_arg);
17466         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17467         LDKCustomOnionMessageHandler* this_arg_conv = (LDKCustomOnionMessageHandler*)this_arg_ptr;
17468         void* msg_ptr = untag_ptr(msg);
17469         CHECK_ACCESS(msg_ptr);
17470         LDKOnionMessageContents msg_conv = *(LDKOnionMessageContents*)(msg_ptr);
17471         if (msg_conv.free == LDKOnionMessageContents_JCalls_free) {
17472                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
17473                 LDKOnionMessageContents_JCalls_cloned(&msg_conv);
17474         }
17475         LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ");
17476         *ret_copy = (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv);
17477         int64_t ret_ref = tag_ptr(ret_copy, true);
17478         return ret_ref;
17479 }
17480
17481 int64_t  CS_LDK_CustomOnionMessageHandler_read_custom_message(int64_t this_arg, int64_t message_type, int8_tArray buffer) {
17482         void* this_arg_ptr = untag_ptr(this_arg);
17483         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17484         LDKCustomOnionMessageHandler* this_arg_conv = (LDKCustomOnionMessageHandler*)this_arg_ptr;
17485         LDKu8slice buffer_ref;
17486         buffer_ref.datalen = buffer->arr_len;
17487         buffer_ref.data = buffer->elems;
17488         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_OnionMessageContentsZDecodeErrorZ");
17489         *ret_conv = (this_arg_conv->read_custom_message)(this_arg_conv->this_arg, message_type, buffer_ref);
17490         FREE(buffer);
17491         return tag_ptr(ret_conv, true);
17492 }
17493
17494 int64_tArray  CS_LDK_CustomOnionMessageHandler_release_pending_custom_messages(int64_t this_arg) {
17495         void* this_arg_ptr = untag_ptr(this_arg);
17496         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17497         LDKCustomOnionMessageHandler* this_arg_conv = (LDKCustomOnionMessageHandler*)this_arg_ptr;
17498         LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ ret_var = (this_arg_conv->release_pending_custom_messages)(this_arg_conv->this_arg);
17499         int64_tArray ret_arr = NULL;
17500         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
17501         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
17502         for (size_t e = 0; e < ret_var.datalen; e++) {
17503                 LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* ret_conv_56_conv = MALLOC(sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ");
17504                 *ret_conv_56_conv = ret_var.data[e];
17505                 ret_arr_ptr[e] = tag_ptr(ret_conv_56_conv, true);
17506         }
17507         
17508         FREE(ret_var.data);
17509         return ret_arr;
17510 }
17511
17512 typedef struct LDKSocketDescriptor_JCalls {
17513         atomic_size_t refcnt;
17514         uint32_t instance_ptr;
17515 } LDKSocketDescriptor_JCalls;
17516 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
17517         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
17518         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
17519                 FREE(j_calls);
17520         }
17521 }
17522 uintptr_t send_data_LDKSocketDescriptor_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
17523         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
17524         LDKu8slice data_var = data;
17525         int8_tArray data_arr = init_int8_tArray(data_var.datalen, __LINE__);
17526         memcpy(data_arr->elems, data_var.data, data_var.datalen);
17527         jboolean resume_read_conv = resume_read;
17528         return js_invoke_function_l_lb(j_calls->instance_ptr, 148, (int64_t)data_arr, resume_read_conv);
17529 }
17530 void disconnect_socket_LDKSocketDescriptor_jcall(void* this_arg) {
17531         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
17532         js_invoke_function_void_(j_calls->instance_ptr, 149);
17533 }
17534 bool eq_LDKSocketDescriptor_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) {
17535         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
17536         LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
17537         *other_arg_clone = SocketDescriptor_clone(other_arg);
17538         return js_invoke_function_b_l(j_calls->instance_ptr, 150, tag_ptr(other_arg_clone, true));
17539 }
17540 uint64_t hash_LDKSocketDescriptor_jcall(const void* this_arg) {
17541         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
17542         return js_invoke_function_l_(j_calls->instance_ptr, 151);
17543 }
17544 static void LDKSocketDescriptor_JCalls_cloned(LDKSocketDescriptor* new_obj) {
17545         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) new_obj->this_arg;
17546         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
17547 }
17548 static inline LDKSocketDescriptor LDKSocketDescriptor_init (int64_t o) {
17549         LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
17550         atomic_init(&calls->refcnt, 1);
17551         calls->instance_ptr = o;
17552
17553         LDKSocketDescriptor ret = {
17554                 .this_arg = (void*) calls,
17555                 .send_data = send_data_LDKSocketDescriptor_jcall,
17556                 .disconnect_socket = disconnect_socket_LDKSocketDescriptor_jcall,
17557                 .eq = eq_LDKSocketDescriptor_jcall,
17558                 .hash = hash_LDKSocketDescriptor_jcall,
17559                 .cloned = LDKSocketDescriptor_JCalls_cloned,
17560                 .free = LDKSocketDescriptor_JCalls_free,
17561         };
17562         return ret;
17563 }
17564 uint64_t  CS_LDK_LDKSocketDescriptor_new(int32_t o) {
17565         LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
17566         *res_ptr = LDKSocketDescriptor_init(o);
17567         return tag_ptr(res_ptr, true);
17568 }
17569 int64_t  CS_LDK_SocketDescriptor_send_data(int64_t this_arg, int8_tArray data, jboolean resume_read) {
17570         void* this_arg_ptr = untag_ptr(this_arg);
17571         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17572         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
17573         LDKu8slice data_ref;
17574         data_ref.datalen = data->arr_len;
17575         data_ref.data = data->elems;
17576         int64_t ret_conv = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
17577         FREE(data);
17578         return ret_conv;
17579 }
17580
17581 void  CS_LDK_SocketDescriptor_disconnect_socket(int64_t this_arg) {
17582         void* this_arg_ptr = untag_ptr(this_arg);
17583         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17584         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
17585         (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
17586 }
17587
17588 int64_t  CS_LDK_SocketDescriptor_hash(int64_t this_arg) {
17589         void* this_arg_ptr = untag_ptr(this_arg);
17590         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17591         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
17592         int64_t ret_conv = (this_arg_conv->hash)(this_arg_conv->this_arg);
17593         return ret_conv;
17594 }
17595
17596 typedef struct LDKSignBolt12InvoiceFn_JCalls {
17597         atomic_size_t refcnt;
17598         uint32_t instance_ptr;
17599 } LDKSignBolt12InvoiceFn_JCalls;
17600 static void LDKSignBolt12InvoiceFn_JCalls_free(void* this_arg) {
17601         LDKSignBolt12InvoiceFn_JCalls *j_calls = (LDKSignBolt12InvoiceFn_JCalls*) this_arg;
17602         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
17603                 FREE(j_calls);
17604         }
17605 }
17606 LDKCResult_SchnorrSignatureNoneZ sign_invoice_LDKSignBolt12InvoiceFn_jcall(const void* this_arg, const LDKUnsignedBolt12Invoice * message) {
17607         LDKSignBolt12InvoiceFn_JCalls *j_calls = (LDKSignBolt12InvoiceFn_JCalls*) this_arg;
17608         LDKUnsignedBolt12Invoice message_var = *message;
17609         int64_t message_ref = 0;
17610         message_var = UnsignedBolt12Invoice_clone(&message_var);
17611         CHECK_INNER_FIELD_ACCESS_OR_NULL(message_var);
17612         message_ref = tag_ptr(message_var.inner, message_var.is_owned);
17613         uint64_t ret = js_invoke_function_l_l(j_calls->instance_ptr, 152, message_ref);
17614         void* ret_ptr = untag_ptr(ret);
17615         CHECK_ACCESS(ret_ptr);
17616         LDKCResult_SchnorrSignatureNoneZ ret_conv = *(LDKCResult_SchnorrSignatureNoneZ*)(ret_ptr);
17617         FREE(untag_ptr(ret));
17618         return ret_conv;
17619 }
17620 static void LDKSignBolt12InvoiceFn_JCalls_cloned(LDKSignBolt12InvoiceFn* new_obj) {
17621         LDKSignBolt12InvoiceFn_JCalls *j_calls = (LDKSignBolt12InvoiceFn_JCalls*) new_obj->this_arg;
17622         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
17623 }
17624 static inline LDKSignBolt12InvoiceFn LDKSignBolt12InvoiceFn_init (int64_t o) {
17625         LDKSignBolt12InvoiceFn_JCalls *calls = MALLOC(sizeof(LDKSignBolt12InvoiceFn_JCalls), "LDKSignBolt12InvoiceFn_JCalls");
17626         atomic_init(&calls->refcnt, 1);
17627         calls->instance_ptr = o;
17628
17629         LDKSignBolt12InvoiceFn ret = {
17630                 .this_arg = (void*) calls,
17631                 .sign_invoice = sign_invoice_LDKSignBolt12InvoiceFn_jcall,
17632                 .free = LDKSignBolt12InvoiceFn_JCalls_free,
17633         };
17634         return ret;
17635 }
17636 uint64_t  CS_LDK_LDKSignBolt12InvoiceFn_new(int32_t o) {
17637         LDKSignBolt12InvoiceFn *res_ptr = MALLOC(sizeof(LDKSignBolt12InvoiceFn), "LDKSignBolt12InvoiceFn");
17638         *res_ptr = LDKSignBolt12InvoiceFn_init(o);
17639         return tag_ptr(res_ptr, true);
17640 }
17641 int64_t  CS_LDK_SignBolt12InvoiceFn_sign_invoice(int64_t this_arg, int64_t message) {
17642         void* this_arg_ptr = untag_ptr(this_arg);
17643         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17644         LDKSignBolt12InvoiceFn* this_arg_conv = (LDKSignBolt12InvoiceFn*)this_arg_ptr;
17645         LDKUnsignedBolt12Invoice message_conv;
17646         message_conv.inner = untag_ptr(message);
17647         message_conv.is_owned = ptr_is_owned(message);
17648         CHECK_INNER_FIELD_ACCESS_OR_NULL(message_conv);
17649         message_conv.is_owned = false;
17650         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
17651         *ret_conv = (this_arg_conv->sign_invoice)(this_arg_conv->this_arg, &message_conv);
17652         return tag_ptr(ret_conv, true);
17653 }
17654
17655 typedef struct LDKSignInvoiceRequestFn_JCalls {
17656         atomic_size_t refcnt;
17657         uint32_t instance_ptr;
17658 } LDKSignInvoiceRequestFn_JCalls;
17659 static void LDKSignInvoiceRequestFn_JCalls_free(void* this_arg) {
17660         LDKSignInvoiceRequestFn_JCalls *j_calls = (LDKSignInvoiceRequestFn_JCalls*) this_arg;
17661         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
17662                 FREE(j_calls);
17663         }
17664 }
17665 LDKCResult_SchnorrSignatureNoneZ sign_invoice_request_LDKSignInvoiceRequestFn_jcall(const void* this_arg, const LDKUnsignedInvoiceRequest * message) {
17666         LDKSignInvoiceRequestFn_JCalls *j_calls = (LDKSignInvoiceRequestFn_JCalls*) this_arg;
17667         LDKUnsignedInvoiceRequest message_var = *message;
17668         int64_t message_ref = 0;
17669         message_var = UnsignedInvoiceRequest_clone(&message_var);
17670         CHECK_INNER_FIELD_ACCESS_OR_NULL(message_var);
17671         message_ref = tag_ptr(message_var.inner, message_var.is_owned);
17672         uint64_t ret = js_invoke_function_l_l(j_calls->instance_ptr, 153, message_ref);
17673         void* ret_ptr = untag_ptr(ret);
17674         CHECK_ACCESS(ret_ptr);
17675         LDKCResult_SchnorrSignatureNoneZ ret_conv = *(LDKCResult_SchnorrSignatureNoneZ*)(ret_ptr);
17676         FREE(untag_ptr(ret));
17677         return ret_conv;
17678 }
17679 static void LDKSignInvoiceRequestFn_JCalls_cloned(LDKSignInvoiceRequestFn* new_obj) {
17680         LDKSignInvoiceRequestFn_JCalls *j_calls = (LDKSignInvoiceRequestFn_JCalls*) new_obj->this_arg;
17681         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
17682 }
17683 static inline LDKSignInvoiceRequestFn LDKSignInvoiceRequestFn_init (int64_t o) {
17684         LDKSignInvoiceRequestFn_JCalls *calls = MALLOC(sizeof(LDKSignInvoiceRequestFn_JCalls), "LDKSignInvoiceRequestFn_JCalls");
17685         atomic_init(&calls->refcnt, 1);
17686         calls->instance_ptr = o;
17687
17688         LDKSignInvoiceRequestFn ret = {
17689                 .this_arg = (void*) calls,
17690                 .sign_invoice_request = sign_invoice_request_LDKSignInvoiceRequestFn_jcall,
17691                 .free = LDKSignInvoiceRequestFn_JCalls_free,
17692         };
17693         return ret;
17694 }
17695 uint64_t  CS_LDK_LDKSignInvoiceRequestFn_new(int32_t o) {
17696         LDKSignInvoiceRequestFn *res_ptr = MALLOC(sizeof(LDKSignInvoiceRequestFn), "LDKSignInvoiceRequestFn");
17697         *res_ptr = LDKSignInvoiceRequestFn_init(o);
17698         return tag_ptr(res_ptr, true);
17699 }
17700 int64_t  CS_LDK_SignInvoiceRequestFn_sign_invoice_request(int64_t this_arg, int64_t message) {
17701         void* this_arg_ptr = untag_ptr(this_arg);
17702         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17703         LDKSignInvoiceRequestFn* this_arg_conv = (LDKSignInvoiceRequestFn*)this_arg_ptr;
17704         LDKUnsignedInvoiceRequest message_conv;
17705         message_conv.inner = untag_ptr(message);
17706         message_conv.is_owned = ptr_is_owned(message);
17707         CHECK_INNER_FIELD_ACCESS_OR_NULL(message_conv);
17708         message_conv.is_owned = false;
17709         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
17710         *ret_conv = (this_arg_conv->sign_invoice_request)(this_arg_conv->this_arg, &message_conv);
17711         return tag_ptr(ret_conv, true);
17712 }
17713
17714 uint32_t CS_LDK_LDKSignError_ty_from_ptr(int64_t ptr) {
17715         LDKSignError *obj = (LDKSignError*)untag_ptr(ptr);
17716         switch(obj->tag) {
17717                 case LDKSignError_Signing: return 0;
17718                 case LDKSignError_Verification: return 1;
17719                 default: abort();
17720         }
17721 }
17722 int32_t CS_LDK_LDKSignError_Verification_get_verification(int64_t ptr) {
17723         LDKSignError *obj = (LDKSignError*)untag_ptr(ptr);
17724         CHECK(obj->tag == LDKSignError_Verification);
17725         int32_t verification_conv = LDKSecp256k1Error_to_cs(obj->verification);
17726         return verification_conv;
17727 }
17728 uint32_t CS_LDK_LDKEffectiveCapacity_ty_from_ptr(int64_t ptr) {
17729         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
17730         switch(obj->tag) {
17731                 case LDKEffectiveCapacity_ExactLiquidity: return 0;
17732                 case LDKEffectiveCapacity_AdvertisedMaxHTLC: return 1;
17733                 case LDKEffectiveCapacity_Total: return 2;
17734                 case LDKEffectiveCapacity_Infinite: return 3;
17735                 case LDKEffectiveCapacity_HintMaxHTLC: return 4;
17736                 case LDKEffectiveCapacity_Unknown: return 5;
17737                 default: abort();
17738         }
17739 }
17740 int64_t CS_LDK_LDKEffectiveCapacity_ExactLiquidity_get_liquidity_msat(int64_t ptr) {
17741         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
17742         CHECK(obj->tag == LDKEffectiveCapacity_ExactLiquidity);
17743         int64_t liquidity_msat_conv = obj->exact_liquidity.liquidity_msat;
17744         return liquidity_msat_conv;
17745 }
17746 int64_t CS_LDK_LDKEffectiveCapacity_AdvertisedMaxHTLC_get_amount_msat(int64_t ptr) {
17747         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
17748         CHECK(obj->tag == LDKEffectiveCapacity_AdvertisedMaxHTLC);
17749         int64_t amount_msat_conv = obj->advertised_max_htlc.amount_msat;
17750         return amount_msat_conv;
17751 }
17752 int64_t CS_LDK_LDKEffectiveCapacity_Total_get_capacity_msat(int64_t ptr) {
17753         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
17754         CHECK(obj->tag == LDKEffectiveCapacity_Total);
17755         int64_t capacity_msat_conv = obj->total.capacity_msat;
17756         return capacity_msat_conv;
17757 }
17758 int64_t CS_LDK_LDKEffectiveCapacity_Total_get_htlc_maximum_msat(int64_t ptr) {
17759         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
17760         CHECK(obj->tag == LDKEffectiveCapacity_Total);
17761         int64_t htlc_maximum_msat_conv = obj->total.htlc_maximum_msat;
17762         return htlc_maximum_msat_conv;
17763 }
17764 int64_t CS_LDK_LDKEffectiveCapacity_HintMaxHTLC_get_amount_msat(int64_t ptr) {
17765         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
17766         CHECK(obj->tag == LDKEffectiveCapacity_HintMaxHTLC);
17767         int64_t amount_msat_conv = obj->hint_max_htlc.amount_msat;
17768         return amount_msat_conv;
17769 }
17770 uint32_t CS_LDK_LDKPayee_ty_from_ptr(int64_t ptr) {
17771         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
17772         switch(obj->tag) {
17773                 case LDKPayee_Blinded: return 0;
17774                 case LDKPayee_Clear: return 1;
17775                 default: abort();
17776         }
17777 }
17778 int64_tArray CS_LDK_LDKPayee_Blinded_get_route_hints(int64_t ptr) {
17779         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
17780         CHECK(obj->tag == LDKPayee_Blinded);
17781         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ route_hints_var = obj->blinded.route_hints;
17782                         int64_tArray route_hints_arr = NULL;
17783                         route_hints_arr = init_int64_tArray(route_hints_var.datalen, __LINE__);
17784                         int64_t *route_hints_arr_ptr = (int64_t*)(((uint8_t*)route_hints_arr) + 8);
17785                         for (size_t l = 0; l < route_hints_var.datalen; l++) {
17786                                 LDKC2Tuple_BlindedPayInfoBlindedPathZ* route_hints_conv_37_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
17787                                 *route_hints_conv_37_conv = route_hints_var.data[l];
17788                                 *route_hints_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone(route_hints_conv_37_conv);
17789                                 route_hints_arr_ptr[l] = tag_ptr(route_hints_conv_37_conv, true);
17790                         }
17791                         
17792         return route_hints_arr;
17793 }
17794 int64_t CS_LDK_LDKPayee_Blinded_get_features(int64_t ptr) {
17795         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
17796         CHECK(obj->tag == LDKPayee_Blinded);
17797         LDKBolt12InvoiceFeatures features_var = obj->blinded.features;
17798                         int64_t features_ref = 0;
17799                         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_var);
17800                         features_ref = tag_ptr(features_var.inner, false);
17801         return features_ref;
17802 }
17803 int8_tArray CS_LDK_LDKPayee_Clear_get_node_id(int64_t ptr) {
17804         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
17805         CHECK(obj->tag == LDKPayee_Clear);
17806         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
17807         memcpy(node_id_arr->elems, obj->clear.node_id.compressed_form, 33);
17808         return node_id_arr;
17809 }
17810 int64_tArray CS_LDK_LDKPayee_Clear_get_route_hints(int64_t ptr) {
17811         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
17812         CHECK(obj->tag == LDKPayee_Clear);
17813         LDKCVec_RouteHintZ route_hints_var = obj->clear.route_hints;
17814                         int64_tArray route_hints_arr = NULL;
17815                         route_hints_arr = init_int64_tArray(route_hints_var.datalen, __LINE__);
17816                         int64_t *route_hints_arr_ptr = (int64_t*)(((uint8_t*)route_hints_arr) + 8);
17817                         for (size_t l = 0; l < route_hints_var.datalen; l++) {
17818                                 LDKRouteHint route_hints_conv_11_var = route_hints_var.data[l];
17819                                 int64_t route_hints_conv_11_ref = 0;
17820                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_hints_conv_11_var);
17821                                 route_hints_conv_11_ref = tag_ptr(route_hints_conv_11_var.inner, false);
17822                                 route_hints_arr_ptr[l] = route_hints_conv_11_ref;
17823                         }
17824                         
17825         return route_hints_arr;
17826 }
17827 int64_t CS_LDK_LDKPayee_Clear_get_features(int64_t ptr) {
17828         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
17829         CHECK(obj->tag == LDKPayee_Clear);
17830         LDKBolt11InvoiceFeatures features_var = obj->clear.features;
17831                         int64_t features_ref = 0;
17832                         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_var);
17833                         features_ref = tag_ptr(features_var.inner, false);
17834         return features_ref;
17835 }
17836 int32_t CS_LDK_LDKPayee_Clear_get_final_cltv_expiry_delta(int64_t ptr) {
17837         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
17838         CHECK(obj->tag == LDKPayee_Clear);
17839         int32_t final_cltv_expiry_delta_conv = obj->clear.final_cltv_expiry_delta;
17840         return final_cltv_expiry_delta_conv;
17841 }
17842 typedef struct LDKScore_JCalls {
17843         atomic_size_t refcnt;
17844         uint32_t instance_ptr;
17845         LDKScoreLookUp_JCalls* ScoreLookUp;
17846         LDKScoreUpdate_JCalls* ScoreUpdate;
17847 } LDKScore_JCalls;
17848 static void LDKScore_JCalls_free(void* this_arg) {
17849         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
17850         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
17851                 FREE(j_calls);
17852         }
17853 }
17854 LDKCVec_u8Z write_LDKScore_jcall(const void* this_arg) {
17855         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
17856         int8_tArray ret = (int8_tArray)js_invoke_function_l_(j_calls->instance_ptr, 154);
17857         LDKCVec_u8Z ret_ref;
17858         ret_ref.datalen = ret->arr_len;
17859         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
17860         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
17861         return ret_ref;
17862 }
17863 static void LDKScore_JCalls_cloned(LDKScore* new_obj) {
17864         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) new_obj->this_arg;
17865         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
17866         atomic_fetch_add_explicit(&j_calls->ScoreLookUp->refcnt, 1, memory_order_release);
17867         atomic_fetch_add_explicit(&j_calls->ScoreUpdate->refcnt, 1, memory_order_release);
17868 }
17869 static inline LDKScore LDKScore_init (int64_t o, int64_t ScoreLookUp, int64_t ScoreUpdate) {
17870         LDKScore_JCalls *calls = MALLOC(sizeof(LDKScore_JCalls), "LDKScore_JCalls");
17871         atomic_init(&calls->refcnt, 1);
17872         calls->instance_ptr = o;
17873
17874         LDKScore ret = {
17875                 .this_arg = (void*) calls,
17876                 .write = write_LDKScore_jcall,
17877                 .free = LDKScore_JCalls_free,
17878                 .ScoreLookUp = LDKScoreLookUp_init(ScoreLookUp),
17879                 .ScoreUpdate = LDKScoreUpdate_init(ScoreUpdate),
17880         };
17881         calls->ScoreLookUp = ret.ScoreLookUp.this_arg;
17882         calls->ScoreUpdate = ret.ScoreUpdate.this_arg;
17883         return ret;
17884 }
17885 uint64_t  CS_LDK_LDKScore_new(int32_t o, int32_t ScoreLookUp, int32_t ScoreUpdate) {
17886         LDKScore *res_ptr = MALLOC(sizeof(LDKScore), "LDKScore");
17887         *res_ptr = LDKScore_init(o, ScoreLookUp, ScoreUpdate);
17888         return tag_ptr(res_ptr, true);
17889 }
17890 int8_tArray  CS_LDK_Score_write(int64_t this_arg) {
17891         void* this_arg_ptr = untag_ptr(this_arg);
17892         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17893         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
17894         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
17895         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
17896         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
17897         CVec_u8Z_free(ret_var);
17898         return ret_arr;
17899 }
17900
17901 uint32_t CS_LDK_LDKIntroductionNode_ty_from_ptr(int64_t ptr) {
17902         LDKIntroductionNode *obj = (LDKIntroductionNode*)untag_ptr(ptr);
17903         switch(obj->tag) {
17904                 case LDKIntroductionNode_NodeId: return 0;
17905                 case LDKIntroductionNode_DirectedShortChannelId: return 1;
17906                 default: abort();
17907         }
17908 }
17909 int8_tArray CS_LDK_LDKIntroductionNode_NodeId_get_node_id(int64_t ptr) {
17910         LDKIntroductionNode *obj = (LDKIntroductionNode*)untag_ptr(ptr);
17911         CHECK(obj->tag == LDKIntroductionNode_NodeId);
17912         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
17913         memcpy(node_id_arr->elems, obj->node_id.compressed_form, 33);
17914         return node_id_arr;
17915 }
17916 int32_t CS_LDK_LDKIntroductionNode_DirectedShortChannelId_get__0(int64_t ptr) {
17917         LDKIntroductionNode *obj = (LDKIntroductionNode*)untag_ptr(ptr);
17918         CHECK(obj->tag == LDKIntroductionNode_DirectedShortChannelId);
17919         int32_t _0_conv = LDKDirection_to_cs(obj->directed_short_channel_id._0);
17920         return _0_conv;
17921 }
17922 int64_t CS_LDK_LDKIntroductionNode_DirectedShortChannelId_get__1(int64_t ptr) {
17923         LDKIntroductionNode *obj = (LDKIntroductionNode*)untag_ptr(ptr);
17924         CHECK(obj->tag == LDKIntroductionNode_DirectedShortChannelId);
17925         int64_t _1_conv = obj->directed_short_channel_id._1;
17926         return _1_conv;
17927 }
17928 typedef struct LDKCoinSelectionSource_JCalls {
17929         atomic_size_t refcnt;
17930         uint32_t instance_ptr;
17931 } LDKCoinSelectionSource_JCalls;
17932 static void LDKCoinSelectionSource_JCalls_free(void* this_arg) {
17933         LDKCoinSelectionSource_JCalls *j_calls = (LDKCoinSelectionSource_JCalls*) this_arg;
17934         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
17935                 FREE(j_calls);
17936         }
17937 }
17938 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) {
17939         LDKCoinSelectionSource_JCalls *j_calls = (LDKCoinSelectionSource_JCalls*) this_arg;
17940         int8_tArray claim_id_arr = init_int8_tArray(32, __LINE__);
17941         memcpy(claim_id_arr->elems, claim_id.data, 32);
17942         LDKCVec_InputZ must_spend_var = must_spend;
17943         int64_tArray must_spend_arr = NULL;
17944         must_spend_arr = init_int64_tArray(must_spend_var.datalen, __LINE__);
17945         int64_t *must_spend_arr_ptr = (int64_t*)(((uint8_t*)must_spend_arr) + 8);
17946         for (size_t h = 0; h < must_spend_var.datalen; h++) {
17947                 LDKInput must_spend_conv_7_var = must_spend_var.data[h];
17948                 int64_t must_spend_conv_7_ref = 0;
17949                 CHECK_INNER_FIELD_ACCESS_OR_NULL(must_spend_conv_7_var);
17950                 must_spend_conv_7_ref = tag_ptr(must_spend_conv_7_var.inner, must_spend_conv_7_var.is_owned);
17951                 must_spend_arr_ptr[h] = must_spend_conv_7_ref;
17952         }
17953         
17954         FREE(must_spend_var.data);
17955         LDKCVec_TxOutZ must_pay_to_var = must_pay_to;
17956         int64_tArray must_pay_to_arr = NULL;
17957         must_pay_to_arr = init_int64_tArray(must_pay_to_var.datalen, __LINE__);
17958         int64_t *must_pay_to_arr_ptr = (int64_t*)(((uint8_t*)must_pay_to_arr) + 8);
17959         for (size_t h = 0; h < must_pay_to_var.datalen; h++) {
17960                 LDKTxOut* must_pay_to_conv_7_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
17961                 *must_pay_to_conv_7_ref = must_pay_to_var.data[h];
17962                 must_pay_to_arr_ptr[h] = tag_ptr(must_pay_to_conv_7_ref, true);
17963         }
17964         
17965         FREE(must_pay_to_var.data);
17966         int32_t target_feerate_sat_per_1000_weight_conv = target_feerate_sat_per_1000_weight;
17967         uint64_t ret = js_invoke_function_l_llli(j_calls->instance_ptr, 155, (int64_t)claim_id_arr, (int64_t)must_spend_arr, (int64_t)must_pay_to_arr, target_feerate_sat_per_1000_weight_conv);
17968         void* ret_ptr = untag_ptr(ret);
17969         CHECK_ACCESS(ret_ptr);
17970         LDKCResult_CoinSelectionNoneZ ret_conv = *(LDKCResult_CoinSelectionNoneZ*)(ret_ptr);
17971         FREE(untag_ptr(ret));
17972         return ret_conv;
17973 }
17974 LDKCResult_TransactionNoneZ sign_psbt_LDKCoinSelectionSource_jcall(const void* this_arg, LDKCVec_u8Z psbt) {
17975         LDKCoinSelectionSource_JCalls *j_calls = (LDKCoinSelectionSource_JCalls*) this_arg;
17976         LDKCVec_u8Z psbt_var = psbt;
17977         int8_tArray psbt_arr = init_int8_tArray(psbt_var.datalen, __LINE__);
17978         memcpy(psbt_arr->elems, psbt_var.data, psbt_var.datalen);
17979         CVec_u8Z_free(psbt_var);
17980         uint64_t ret = js_invoke_function_l_l(j_calls->instance_ptr, 156, (int64_t)psbt_arr);
17981         void* ret_ptr = untag_ptr(ret);
17982         CHECK_ACCESS(ret_ptr);
17983         LDKCResult_TransactionNoneZ ret_conv = *(LDKCResult_TransactionNoneZ*)(ret_ptr);
17984         FREE(untag_ptr(ret));
17985         return ret_conv;
17986 }
17987 static void LDKCoinSelectionSource_JCalls_cloned(LDKCoinSelectionSource* new_obj) {
17988         LDKCoinSelectionSource_JCalls *j_calls = (LDKCoinSelectionSource_JCalls*) new_obj->this_arg;
17989         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
17990 }
17991 static inline LDKCoinSelectionSource LDKCoinSelectionSource_init (int64_t o) {
17992         LDKCoinSelectionSource_JCalls *calls = MALLOC(sizeof(LDKCoinSelectionSource_JCalls), "LDKCoinSelectionSource_JCalls");
17993         atomic_init(&calls->refcnt, 1);
17994         calls->instance_ptr = o;
17995
17996         LDKCoinSelectionSource ret = {
17997                 .this_arg = (void*) calls,
17998                 .select_confirmed_utxos = select_confirmed_utxos_LDKCoinSelectionSource_jcall,
17999                 .sign_psbt = sign_psbt_LDKCoinSelectionSource_jcall,
18000                 .free = LDKCoinSelectionSource_JCalls_free,
18001         };
18002         return ret;
18003 }
18004 uint64_t  CS_LDK_LDKCoinSelectionSource_new(int32_t o) {
18005         LDKCoinSelectionSource *res_ptr = MALLOC(sizeof(LDKCoinSelectionSource), "LDKCoinSelectionSource");
18006         *res_ptr = LDKCoinSelectionSource_init(o);
18007         return tag_ptr(res_ptr, true);
18008 }
18009 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) {
18010         void* this_arg_ptr = untag_ptr(this_arg);
18011         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18012         LDKCoinSelectionSource* this_arg_conv = (LDKCoinSelectionSource*)this_arg_ptr;
18013         LDKThirtyTwoBytes claim_id_ref;
18014         CHECK(claim_id->arr_len == 32);
18015         memcpy(claim_id_ref.data, claim_id->elems, 32); FREE(claim_id);
18016         LDKCVec_InputZ must_spend_constr;
18017         must_spend_constr.datalen = must_spend->arr_len;
18018         if (must_spend_constr.datalen > 0)
18019                 must_spend_constr.data = MALLOC(must_spend_constr.datalen * sizeof(LDKInput), "LDKCVec_InputZ Elements");
18020         else
18021                 must_spend_constr.data = NULL;
18022         int64_t* must_spend_vals = must_spend->elems;
18023         for (size_t h = 0; h < must_spend_constr.datalen; h++) {
18024                 int64_t must_spend_conv_7 = must_spend_vals[h];
18025                 LDKInput must_spend_conv_7_conv;
18026                 must_spend_conv_7_conv.inner = untag_ptr(must_spend_conv_7);
18027                 must_spend_conv_7_conv.is_owned = ptr_is_owned(must_spend_conv_7);
18028                 CHECK_INNER_FIELD_ACCESS_OR_NULL(must_spend_conv_7_conv);
18029                 must_spend_conv_7_conv = Input_clone(&must_spend_conv_7_conv);
18030                 must_spend_constr.data[h] = must_spend_conv_7_conv;
18031         }
18032         FREE(must_spend);
18033         LDKCVec_TxOutZ must_pay_to_constr;
18034         must_pay_to_constr.datalen = must_pay_to->arr_len;
18035         if (must_pay_to_constr.datalen > 0)
18036                 must_pay_to_constr.data = MALLOC(must_pay_to_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
18037         else
18038                 must_pay_to_constr.data = NULL;
18039         int64_t* must_pay_to_vals = must_pay_to->elems;
18040         for (size_t h = 0; h < must_pay_to_constr.datalen; h++) {
18041                 int64_t must_pay_to_conv_7 = must_pay_to_vals[h];
18042                 void* must_pay_to_conv_7_ptr = untag_ptr(must_pay_to_conv_7);
18043                 CHECK_ACCESS(must_pay_to_conv_7_ptr);
18044                 LDKTxOut must_pay_to_conv_7_conv = *(LDKTxOut*)(must_pay_to_conv_7_ptr);
18045                 must_pay_to_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(must_pay_to_conv_7));
18046                 must_pay_to_constr.data[h] = must_pay_to_conv_7_conv;
18047         }
18048         FREE(must_pay_to);
18049         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
18050         *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);
18051         return tag_ptr(ret_conv, true);
18052 }
18053
18054 int64_t  CS_LDK_CoinSelectionSource_sign_psbt(int64_t this_arg, int8_tArray psbt) {
18055         void* this_arg_ptr = untag_ptr(this_arg);
18056         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18057         LDKCoinSelectionSource* this_arg_conv = (LDKCoinSelectionSource*)this_arg_ptr;
18058         LDKCVec_u8Z psbt_ref;
18059         psbt_ref.datalen = psbt->arr_len;
18060         psbt_ref.data = MALLOC(psbt_ref.datalen, "LDKCVec_u8Z Bytes");
18061         memcpy(psbt_ref.data, psbt->elems, psbt_ref.datalen); FREE(psbt);
18062         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
18063         *ret_conv = (this_arg_conv->sign_psbt)(this_arg_conv->this_arg, psbt_ref);
18064         return tag_ptr(ret_conv, true);
18065 }
18066
18067 typedef struct LDKWalletSource_JCalls {
18068         atomic_size_t refcnt;
18069         uint32_t instance_ptr;
18070 } LDKWalletSource_JCalls;
18071 static void LDKWalletSource_JCalls_free(void* this_arg) {
18072         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) this_arg;
18073         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
18074                 FREE(j_calls);
18075         }
18076 }
18077 LDKCResult_CVec_UtxoZNoneZ list_confirmed_utxos_LDKWalletSource_jcall(const void* this_arg) {
18078         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) this_arg;
18079         uint64_t ret = js_invoke_function_l_(j_calls->instance_ptr, 157);
18080         void* ret_ptr = untag_ptr(ret);
18081         CHECK_ACCESS(ret_ptr);
18082         LDKCResult_CVec_UtxoZNoneZ ret_conv = *(LDKCResult_CVec_UtxoZNoneZ*)(ret_ptr);
18083         FREE(untag_ptr(ret));
18084         return ret_conv;
18085 }
18086 LDKCResult_CVec_u8ZNoneZ get_change_script_LDKWalletSource_jcall(const void* this_arg) {
18087         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) this_arg;
18088         uint64_t ret = js_invoke_function_l_(j_calls->instance_ptr, 158);
18089         void* ret_ptr = untag_ptr(ret);
18090         CHECK_ACCESS(ret_ptr);
18091         LDKCResult_CVec_u8ZNoneZ ret_conv = *(LDKCResult_CVec_u8ZNoneZ*)(ret_ptr);
18092         FREE(untag_ptr(ret));
18093         return ret_conv;
18094 }
18095 LDKCResult_TransactionNoneZ sign_psbt_LDKWalletSource_jcall(const void* this_arg, LDKCVec_u8Z psbt) {
18096         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) this_arg;
18097         LDKCVec_u8Z psbt_var = psbt;
18098         int8_tArray psbt_arr = init_int8_tArray(psbt_var.datalen, __LINE__);
18099         memcpy(psbt_arr->elems, psbt_var.data, psbt_var.datalen);
18100         CVec_u8Z_free(psbt_var);
18101         uint64_t ret = js_invoke_function_l_l(j_calls->instance_ptr, 159, (int64_t)psbt_arr);
18102         void* ret_ptr = untag_ptr(ret);
18103         CHECK_ACCESS(ret_ptr);
18104         LDKCResult_TransactionNoneZ ret_conv = *(LDKCResult_TransactionNoneZ*)(ret_ptr);
18105         FREE(untag_ptr(ret));
18106         return ret_conv;
18107 }
18108 static void LDKWalletSource_JCalls_cloned(LDKWalletSource* new_obj) {
18109         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) new_obj->this_arg;
18110         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
18111 }
18112 static inline LDKWalletSource LDKWalletSource_init (int64_t o) {
18113         LDKWalletSource_JCalls *calls = MALLOC(sizeof(LDKWalletSource_JCalls), "LDKWalletSource_JCalls");
18114         atomic_init(&calls->refcnt, 1);
18115         calls->instance_ptr = o;
18116
18117         LDKWalletSource ret = {
18118                 .this_arg = (void*) calls,
18119                 .list_confirmed_utxos = list_confirmed_utxos_LDKWalletSource_jcall,
18120                 .get_change_script = get_change_script_LDKWalletSource_jcall,
18121                 .sign_psbt = sign_psbt_LDKWalletSource_jcall,
18122                 .free = LDKWalletSource_JCalls_free,
18123         };
18124         return ret;
18125 }
18126 uint64_t  CS_LDK_LDKWalletSource_new(int32_t o) {
18127         LDKWalletSource *res_ptr = MALLOC(sizeof(LDKWalletSource), "LDKWalletSource");
18128         *res_ptr = LDKWalletSource_init(o);
18129         return tag_ptr(res_ptr, true);
18130 }
18131 int64_t  CS_LDK_WalletSource_list_confirmed_utxos(int64_t this_arg) {
18132         void* this_arg_ptr = untag_ptr(this_arg);
18133         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18134         LDKWalletSource* this_arg_conv = (LDKWalletSource*)this_arg_ptr;
18135         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
18136         *ret_conv = (this_arg_conv->list_confirmed_utxos)(this_arg_conv->this_arg);
18137         return tag_ptr(ret_conv, true);
18138 }
18139
18140 int64_t  CS_LDK_WalletSource_get_change_script(int64_t this_arg) {
18141         void* this_arg_ptr = untag_ptr(this_arg);
18142         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18143         LDKWalletSource* this_arg_conv = (LDKWalletSource*)this_arg_ptr;
18144         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
18145         *ret_conv = (this_arg_conv->get_change_script)(this_arg_conv->this_arg);
18146         return tag_ptr(ret_conv, true);
18147 }
18148
18149 int64_t  CS_LDK_WalletSource_sign_psbt(int64_t this_arg, int8_tArray psbt) {
18150         void* this_arg_ptr = untag_ptr(this_arg);
18151         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18152         LDKWalletSource* this_arg_conv = (LDKWalletSource*)this_arg_ptr;
18153         LDKCVec_u8Z psbt_ref;
18154         psbt_ref.datalen = psbt->arr_len;
18155         psbt_ref.data = MALLOC(psbt_ref.datalen, "LDKCVec_u8Z Bytes");
18156         memcpy(psbt_ref.data, psbt->elems, psbt_ref.datalen); FREE(psbt);
18157         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
18158         *ret_conv = (this_arg_conv->sign_psbt)(this_arg_conv->this_arg, psbt_ref);
18159         return tag_ptr(ret_conv, true);
18160 }
18161
18162 uint32_t CS_LDK_LDKGossipSync_ty_from_ptr(int64_t ptr) {
18163         LDKGossipSync *obj = (LDKGossipSync*)untag_ptr(ptr);
18164         switch(obj->tag) {
18165                 case LDKGossipSync_P2P: return 0;
18166                 case LDKGossipSync_Rapid: return 1;
18167                 case LDKGossipSync_None: return 2;
18168                 default: abort();
18169         }
18170 }
18171 int64_t CS_LDK_LDKGossipSync_P2P_get_p2p(int64_t ptr) {
18172         LDKGossipSync *obj = (LDKGossipSync*)untag_ptr(ptr);
18173         CHECK(obj->tag == LDKGossipSync_P2P);
18174         LDKP2PGossipSync p2p_var = obj->p2p;
18175                         int64_t p2p_ref = 0;
18176                         CHECK_INNER_FIELD_ACCESS_OR_NULL(p2p_var);
18177                         p2p_ref = tag_ptr(p2p_var.inner, false);
18178         return p2p_ref;
18179 }
18180 int64_t CS_LDK_LDKGossipSync_Rapid_get_rapid(int64_t ptr) {
18181         LDKGossipSync *obj = (LDKGossipSync*)untag_ptr(ptr);
18182         CHECK(obj->tag == LDKGossipSync_Rapid);
18183         LDKRapidGossipSync rapid_var = obj->rapid;
18184                         int64_t rapid_ref = 0;
18185                         CHECK_INNER_FIELD_ACCESS_OR_NULL(rapid_var);
18186                         rapid_ref = tag_ptr(rapid_var.inner, false);
18187         return rapid_ref;
18188 }
18189 uint32_t CS_LDK_LDKFallback_ty_from_ptr(int64_t ptr) {
18190         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
18191         switch(obj->tag) {
18192                 case LDKFallback_SegWitProgram: return 0;
18193                 case LDKFallback_PubKeyHash: return 1;
18194                 case LDKFallback_ScriptHash: return 2;
18195                 default: abort();
18196         }
18197 }
18198 int8_t CS_LDK_LDKFallback_SegWitProgram_get_version(int64_t ptr) {
18199         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
18200         CHECK(obj->tag == LDKFallback_SegWitProgram);
18201         uint8_t version_val = obj->seg_wit_program.version._0;
18202         return version_val;
18203 }
18204 int8_tArray CS_LDK_LDKFallback_SegWitProgram_get_program(int64_t ptr) {
18205         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
18206         CHECK(obj->tag == LDKFallback_SegWitProgram);
18207         LDKCVec_u8Z program_var = obj->seg_wit_program.program;
18208                         int8_tArray program_arr = init_int8_tArray(program_var.datalen, __LINE__);
18209                         memcpy(program_arr->elems, program_var.data, program_var.datalen);
18210         return program_arr;
18211 }
18212 int8_tArray CS_LDK_LDKFallback_PubKeyHash_get_pub_key_hash(int64_t ptr) {
18213         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
18214         CHECK(obj->tag == LDKFallback_PubKeyHash);
18215         int8_tArray pub_key_hash_arr = init_int8_tArray(20, __LINE__);
18216         memcpy(pub_key_hash_arr->elems, obj->pub_key_hash.data, 20);
18217         return pub_key_hash_arr;
18218 }
18219 int8_tArray CS_LDK_LDKFallback_ScriptHash_get_script_hash(int64_t ptr) {
18220         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
18221         CHECK(obj->tag == LDKFallback_ScriptHash);
18222         int8_tArray script_hash_arr = init_int8_tArray(20, __LINE__);
18223         memcpy(script_hash_arr->elems, obj->script_hash.data, 20);
18224         return script_hash_arr;
18225 }
18226 jstring  CS_LDK__ldk_get_compiled_version() {
18227         LDKStr ret_str = _ldk_get_compiled_version();
18228         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
18229         Str_free(ret_str);
18230         return ret_conv;
18231 }
18232
18233 jstring  CS_LDK__ldk_c_bindings_get_compiled_version() {
18234         LDKStr ret_str = _ldk_c_bindings_get_compiled_version();
18235         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
18236         Str_free(ret_str);
18237         return ret_conv;
18238 }
18239
18240 int8_tArray  CS_LDK_U128_le_bytes(int8_tArray val) {
18241         LDKU128 val_ref;
18242         CHECK(val->arr_len == 16);
18243         memcpy(val_ref.le_bytes, val->elems, 16); FREE(val);
18244         int8_tArray ret_arr = init_int8_tArray(16, __LINE__);
18245         memcpy(ret_arr->elems, U128_le_bytes(val_ref).data, 16);
18246         return ret_arr;
18247 }
18248
18249 int8_tArray  CS_LDK_U128_new(int8_tArray le_bytes) {
18250         LDKSixteenBytes le_bytes_ref;
18251         CHECK(le_bytes->arr_len == 16);
18252         memcpy(le_bytes_ref.data, le_bytes->elems, 16); FREE(le_bytes);
18253         int8_tArray ret_arr = init_int8_tArray(16, __LINE__);
18254         memcpy(ret_arr->elems, U128_new(le_bytes_ref).le_bytes, 16);
18255         return ret_arr;
18256 }
18257
18258 int64_t  CS_LDK_WitnessProgram_new(int8_t version, int8_tArray program) {
18259         
18260         LDKCVec_u8Z program_ref;
18261         program_ref.datalen = program->arr_len;
18262         program_ref.data = MALLOC(program_ref.datalen, "LDKCVec_u8Z Bytes");
18263         memcpy(program_ref.data, program->elems, program_ref.datalen); FREE(program);
18264         LDKWitnessProgram* ret_ref = MALLOC(sizeof(LDKWitnessProgram), "LDKWitnessProgram");
18265         *ret_ref = WitnessProgram_new((LDKWitnessVersion){ ._0 = version }, program_ref);
18266         return tag_ptr(ret_ref, true);
18267 }
18268
18269 int8_t  CS_LDK_WitnessProgram_get_version(int64_t prog) {
18270         LDKWitnessProgram* prog_conv = (LDKWitnessProgram*)untag_ptr(prog);
18271         uint8_t ret_val = WitnessProgram_get_version(prog_conv)._0;
18272         return ret_val;
18273 }
18274
18275 int8_tArray  CS_LDK_WitnessProgram_get_program(int64_t prog) {
18276         LDKWitnessProgram* prog_conv = (LDKWitnessProgram*)untag_ptr(prog);
18277         LDKu8slice ret_var = WitnessProgram_get_program(prog_conv);
18278         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
18279         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
18280         return ret_arr;
18281 }
18282
18283 static inline uint64_t WitnessProgram_clone_ptr(LDKWitnessProgram *NONNULL_PTR arg) {
18284         LDKWitnessProgram* ret_ref = MALLOC(sizeof(LDKWitnessProgram), "LDKWitnessProgram");
18285         *ret_ref = WitnessProgram_clone(arg);
18286         return tag_ptr(ret_ref, true);
18287 }
18288 int64_t  CS_LDK_WitnessProgram_clone_ptr(int64_t arg) {
18289         LDKWitnessProgram* arg_conv = (LDKWitnessProgram*)untag_ptr(arg);
18290         int64_t ret_conv = WitnessProgram_clone_ptr(arg_conv);
18291         return ret_conv;
18292 }
18293
18294 int64_t  CS_LDK_WitnessProgram_clone(int64_t orig) {
18295         LDKWitnessProgram* orig_conv = (LDKWitnessProgram*)untag_ptr(orig);
18296         LDKWitnessProgram* ret_ref = MALLOC(sizeof(LDKWitnessProgram), "LDKWitnessProgram");
18297         *ret_ref = WitnessProgram_clone(orig_conv);
18298         return tag_ptr(ret_ref, true);
18299 }
18300
18301 void  CS_LDK_WitnessProgram_free(int64_t o) {
18302         if (!ptr_is_owned(o)) return;
18303         void* o_ptr = untag_ptr(o);
18304         CHECK_ACCESS(o_ptr);
18305         LDKWitnessProgram o_conv = *(LDKWitnessProgram*)(o_ptr);
18306         FREE(untag_ptr(o));
18307         WitnessProgram_free(o_conv);
18308 }
18309
18310 int64_t  CS_LDK_BigEndianScalar_new(int8_tArray big_endian_bytes) {
18311         LDKThirtyTwoBytes big_endian_bytes_ref;
18312         CHECK(big_endian_bytes->arr_len == 32);
18313         memcpy(big_endian_bytes_ref.data, big_endian_bytes->elems, 32); FREE(big_endian_bytes);
18314         LDKBigEndianScalar* ret_ref = MALLOC(sizeof(LDKBigEndianScalar), "LDKBigEndianScalar");
18315         *ret_ref = BigEndianScalar_new(big_endian_bytes_ref);
18316         return tag_ptr(ret_ref, true);
18317 }
18318
18319 static inline uint64_t BigEndianScalar_clone_ptr(LDKBigEndianScalar *NONNULL_PTR arg) {
18320         LDKBigEndianScalar* ret_ref = MALLOC(sizeof(LDKBigEndianScalar), "LDKBigEndianScalar");
18321         *ret_ref = BigEndianScalar_clone(arg);
18322         return tag_ptr(ret_ref, true);
18323 }
18324 int64_t  CS_LDK_BigEndianScalar_clone_ptr(int64_t arg) {
18325         LDKBigEndianScalar* arg_conv = (LDKBigEndianScalar*)untag_ptr(arg);
18326         int64_t ret_conv = BigEndianScalar_clone_ptr(arg_conv);
18327         return ret_conv;
18328 }
18329
18330 int64_t  CS_LDK_BigEndianScalar_clone(int64_t orig) {
18331         LDKBigEndianScalar* orig_conv = (LDKBigEndianScalar*)untag_ptr(orig);
18332         LDKBigEndianScalar* ret_ref = MALLOC(sizeof(LDKBigEndianScalar), "LDKBigEndianScalar");
18333         *ret_ref = BigEndianScalar_clone(orig_conv);
18334         return tag_ptr(ret_ref, true);
18335 }
18336
18337 static inline uint64_t Bech32Error_clone_ptr(LDKBech32Error *NONNULL_PTR arg) {
18338         LDKBech32Error *ret_copy = MALLOC(sizeof(LDKBech32Error), "LDKBech32Error");
18339         *ret_copy = Bech32Error_clone(arg);
18340         int64_t ret_ref = tag_ptr(ret_copy, true);
18341         return ret_ref;
18342 }
18343 int64_t  CS_LDK_Bech32Error_clone_ptr(int64_t arg) {
18344         LDKBech32Error* arg_conv = (LDKBech32Error*)untag_ptr(arg);
18345         int64_t ret_conv = Bech32Error_clone_ptr(arg_conv);
18346         return ret_conv;
18347 }
18348
18349 int64_t  CS_LDK_Bech32Error_clone(int64_t orig) {
18350         LDKBech32Error* orig_conv = (LDKBech32Error*)untag_ptr(orig);
18351         LDKBech32Error *ret_copy = MALLOC(sizeof(LDKBech32Error), "LDKBech32Error");
18352         *ret_copy = Bech32Error_clone(orig_conv);
18353         int64_t ret_ref = tag_ptr(ret_copy, true);
18354         return ret_ref;
18355 }
18356
18357 void  CS_LDK_Bech32Error_free(int64_t o) {
18358         if (!ptr_is_owned(o)) return;
18359         void* o_ptr = untag_ptr(o);
18360         CHECK_ACCESS(o_ptr);
18361         LDKBech32Error o_conv = *(LDKBech32Error*)(o_ptr);
18362         FREE(untag_ptr(o));
18363         Bech32Error_free(o_conv);
18364 }
18365
18366 void  CS_LDK_Transaction_free(int8_tArray _res) {
18367         LDKTransaction _res_ref;
18368         _res_ref.datalen = _res->arr_len;
18369         _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
18370         memcpy(_res_ref.data, _res->elems, _res_ref.datalen); FREE(_res);
18371         _res_ref.data_is_owned = true;
18372         Transaction_free(_res_ref);
18373 }
18374
18375 void  CS_LDK_Witness_free(int8_tArray _res) {
18376         LDKWitness _res_ref;
18377         _res_ref.datalen = _res->arr_len;
18378         _res_ref.data = MALLOC(_res_ref.datalen, "LDKWitness Bytes");
18379         memcpy(_res_ref.data, _res->elems, _res_ref.datalen); FREE(_res);
18380         _res_ref.data_is_owned = true;
18381         Witness_free(_res_ref);
18382 }
18383
18384 int64_t  CS_LDK_TxIn_new(int8_tArray witness, int8_tArray script_sig, int32_t sequence, int8_tArray previous_txid, int32_t previous_vout) {
18385         LDKWitness witness_ref;
18386         witness_ref.datalen = witness->arr_len;
18387         witness_ref.data = MALLOC(witness_ref.datalen, "LDKWitness Bytes");
18388         memcpy(witness_ref.data, witness->elems, witness_ref.datalen); FREE(witness);
18389         witness_ref.data_is_owned = true;
18390         LDKCVec_u8Z script_sig_ref;
18391         script_sig_ref.datalen = script_sig->arr_len;
18392         script_sig_ref.data = MALLOC(script_sig_ref.datalen, "LDKCVec_u8Z Bytes");
18393         memcpy(script_sig_ref.data, script_sig->elems, script_sig_ref.datalen); FREE(script_sig);
18394         LDKThirtyTwoBytes previous_txid_ref;
18395         CHECK(previous_txid->arr_len == 32);
18396         memcpy(previous_txid_ref.data, previous_txid->elems, 32); FREE(previous_txid);
18397         LDKTxIn* ret_ref = MALLOC(sizeof(LDKTxIn), "LDKTxIn");
18398         *ret_ref = TxIn_new(witness_ref, script_sig_ref, sequence, previous_txid_ref, previous_vout);
18399         return tag_ptr(ret_ref, true);
18400 }
18401
18402 int8_tArray  CS_LDK_TxIn_get_witness(int64_t txin) {
18403         LDKTxIn* txin_conv = (LDKTxIn*)untag_ptr(txin);
18404         LDKWitness ret_var = TxIn_get_witness(txin_conv);
18405         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
18406         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
18407         Witness_free(ret_var);
18408         return ret_arr;
18409 }
18410
18411 int8_tArray  CS_LDK_TxIn_get_script_sig(int64_t txin) {
18412         LDKTxIn* txin_conv = (LDKTxIn*)untag_ptr(txin);
18413         LDKu8slice ret_var = TxIn_get_script_sig(txin_conv);
18414         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
18415         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
18416         return ret_arr;
18417 }
18418
18419 int32_t  CS_LDK_TxIn_get_sequence(int64_t txin) {
18420         LDKTxIn* txin_conv = (LDKTxIn*)untag_ptr(txin);
18421         int32_t ret_conv = TxIn_get_sequence(txin_conv);
18422         return ret_conv;
18423 }
18424
18425 int8_tArray  CS_LDK_TxIn_get_previous_txid(int64_t txin) {
18426         LDKTxIn* txin_conv = (LDKTxIn*)untag_ptr(txin);
18427         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
18428         memcpy(ret_arr->elems, TxIn_get_previous_txid(txin_conv).data, 32);
18429         return ret_arr;
18430 }
18431
18432 int32_t  CS_LDK_TxIn_get_previous_vout(int64_t txin) {
18433         LDKTxIn* txin_conv = (LDKTxIn*)untag_ptr(txin);
18434         int32_t ret_conv = TxIn_get_previous_vout(txin_conv);
18435         return ret_conv;
18436 }
18437
18438 void  CS_LDK_TxIn_free(int64_t _res) {
18439         if (!ptr_is_owned(_res)) return;
18440         void* _res_ptr = untag_ptr(_res);
18441         CHECK_ACCESS(_res_ptr);
18442         LDKTxIn _res_conv = *(LDKTxIn*)(_res_ptr);
18443         FREE(untag_ptr(_res));
18444         TxIn_free(_res_conv);
18445 }
18446
18447 int64_t  CS_LDK_TxOut_new(int8_tArray script_pubkey, int64_t value) {
18448         LDKCVec_u8Z script_pubkey_ref;
18449         script_pubkey_ref.datalen = script_pubkey->arr_len;
18450         script_pubkey_ref.data = MALLOC(script_pubkey_ref.datalen, "LDKCVec_u8Z Bytes");
18451         memcpy(script_pubkey_ref.data, script_pubkey->elems, script_pubkey_ref.datalen); FREE(script_pubkey);
18452         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
18453         *ret_ref = TxOut_new(script_pubkey_ref, value);
18454         return tag_ptr(ret_ref, true);
18455 }
18456
18457 int8_tArray  CS_LDK_TxOut_get_script_pubkey(int64_t txout) {
18458         LDKTxOut* txout_conv = (LDKTxOut*)untag_ptr(txout);
18459         LDKu8slice ret_var = TxOut_get_script_pubkey(txout_conv);
18460         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
18461         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
18462         return ret_arr;
18463 }
18464
18465 int64_t  CS_LDK_TxOut_get_value(int64_t txout) {
18466         LDKTxOut* txout_conv = (LDKTxOut*)untag_ptr(txout);
18467         int64_t ret_conv = TxOut_get_value(txout_conv);
18468         return ret_conv;
18469 }
18470
18471 void  CS_LDK_TxOut_free(int64_t _res) {
18472         if (!ptr_is_owned(_res)) return;
18473         void* _res_ptr = untag_ptr(_res);
18474         CHECK_ACCESS(_res_ptr);
18475         LDKTxOut _res_conv = *(LDKTxOut*)(_res_ptr);
18476         FREE(untag_ptr(_res));
18477         TxOut_free(_res_conv);
18478 }
18479
18480 static inline uint64_t TxOut_clone_ptr(LDKTxOut *NONNULL_PTR arg) {
18481         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
18482         *ret_ref = TxOut_clone(arg);
18483         return tag_ptr(ret_ref, true);
18484 }
18485 int64_t  CS_LDK_TxOut_clone_ptr(int64_t arg) {
18486         LDKTxOut* arg_conv = (LDKTxOut*)untag_ptr(arg);
18487         int64_t ret_conv = TxOut_clone_ptr(arg_conv);
18488         return ret_conv;
18489 }
18490
18491 int64_t  CS_LDK_TxOut_clone(int64_t orig) {
18492         LDKTxOut* orig_conv = (LDKTxOut*)untag_ptr(orig);
18493         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
18494         *ret_ref = TxOut_clone(orig_conv);
18495         return tag_ptr(ret_ref, true);
18496 }
18497
18498 void  CS_LDK_Str_free(jstring _res) {
18499         LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
18500         Str_free(dummy);
18501 }
18502
18503 void  CS_LDK_CVec_u8Z_free(int8_tArray _res) {
18504         LDKCVec_u8Z _res_ref;
18505         _res_ref.datalen = _res->arr_len;
18506         _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes");
18507         memcpy(_res_ref.data, _res->elems, _res_ref.datalen); FREE(_res);
18508         CVec_u8Z_free(_res_ref);
18509 }
18510
18511 int64_t  CS_LDK_CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_ok(int64_t o) {
18512         LDKRefundMaybeWithDerivedMetadataBuilder o_conv;
18513         o_conv.inner = untag_ptr(o);
18514         o_conv.is_owned = ptr_is_owned(o);
18515         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18516         o_conv = RefundMaybeWithDerivedMetadataBuilder_clone(&o_conv);
18517         LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ), "LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ");
18518         *ret_conv = CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_ok(o_conv);
18519         return tag_ptr(ret_conv, true);
18520 }
18521
18522 int64_t  CS_LDK_CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_err(int32_t e) {
18523         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_cs(e);
18524         LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ), "LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ");
18525         *ret_conv = CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_err(e_conv);
18526         return tag_ptr(ret_conv, true);
18527 }
18528
18529 jboolean  CS_LDK_CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_is_ok(int64_t o) {
18530         LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ* o_conv = (LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ*)untag_ptr(o);
18531         jboolean ret_conv = CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_is_ok(o_conv);
18532         return ret_conv;
18533 }
18534
18535 void  CS_LDK_CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_free(int64_t _res) {
18536         if (!ptr_is_owned(_res)) return;
18537         void* _res_ptr = untag_ptr(_res);
18538         CHECK_ACCESS(_res_ptr);
18539         LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ _res_conv = *(LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ*)(_res_ptr);
18540         FREE(untag_ptr(_res));
18541         CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_free(_res_conv);
18542 }
18543
18544 static inline uint64_t CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone_ptr(LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ *NONNULL_PTR arg) {
18545         LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ), "LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ");
18546         *ret_conv = CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone(arg);
18547         return tag_ptr(ret_conv, true);
18548 }
18549 int64_t  CS_LDK_CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone_ptr(int64_t arg) {
18550         LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ* arg_conv = (LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ*)untag_ptr(arg);
18551         int64_t ret_conv = CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone_ptr(arg_conv);
18552         return ret_conv;
18553 }
18554
18555 int64_t  CS_LDK_CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone(int64_t orig) {
18556         LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ* orig_conv = (LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ*)untag_ptr(orig);
18557         LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ), "LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ");
18558         *ret_conv = CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone(orig_conv);
18559         return tag_ptr(ret_conv, true);
18560 }
18561
18562 int64_t  CS_LDK_CResult_RefundBolt12SemanticErrorZ_ok(int64_t o) {
18563         LDKRefund o_conv;
18564         o_conv.inner = untag_ptr(o);
18565         o_conv.is_owned = ptr_is_owned(o);
18566         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18567         o_conv = Refund_clone(&o_conv);
18568         LDKCResult_RefundBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12SemanticErrorZ), "LDKCResult_RefundBolt12SemanticErrorZ");
18569         *ret_conv = CResult_RefundBolt12SemanticErrorZ_ok(o_conv);
18570         return tag_ptr(ret_conv, true);
18571 }
18572
18573 int64_t  CS_LDK_CResult_RefundBolt12SemanticErrorZ_err(int32_t e) {
18574         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_cs(e);
18575         LDKCResult_RefundBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12SemanticErrorZ), "LDKCResult_RefundBolt12SemanticErrorZ");
18576         *ret_conv = CResult_RefundBolt12SemanticErrorZ_err(e_conv);
18577         return tag_ptr(ret_conv, true);
18578 }
18579
18580 jboolean  CS_LDK_CResult_RefundBolt12SemanticErrorZ_is_ok(int64_t o) {
18581         LDKCResult_RefundBolt12SemanticErrorZ* o_conv = (LDKCResult_RefundBolt12SemanticErrorZ*)untag_ptr(o);
18582         jboolean ret_conv = CResult_RefundBolt12SemanticErrorZ_is_ok(o_conv);
18583         return ret_conv;
18584 }
18585
18586 void  CS_LDK_CResult_RefundBolt12SemanticErrorZ_free(int64_t _res) {
18587         if (!ptr_is_owned(_res)) return;
18588         void* _res_ptr = untag_ptr(_res);
18589         CHECK_ACCESS(_res_ptr);
18590         LDKCResult_RefundBolt12SemanticErrorZ _res_conv = *(LDKCResult_RefundBolt12SemanticErrorZ*)(_res_ptr);
18591         FREE(untag_ptr(_res));
18592         CResult_RefundBolt12SemanticErrorZ_free(_res_conv);
18593 }
18594
18595 static inline uint64_t CResult_RefundBolt12SemanticErrorZ_clone_ptr(LDKCResult_RefundBolt12SemanticErrorZ *NONNULL_PTR arg) {
18596         LDKCResult_RefundBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12SemanticErrorZ), "LDKCResult_RefundBolt12SemanticErrorZ");
18597         *ret_conv = CResult_RefundBolt12SemanticErrorZ_clone(arg);
18598         return tag_ptr(ret_conv, true);
18599 }
18600 int64_t  CS_LDK_CResult_RefundBolt12SemanticErrorZ_clone_ptr(int64_t arg) {
18601         LDKCResult_RefundBolt12SemanticErrorZ* arg_conv = (LDKCResult_RefundBolt12SemanticErrorZ*)untag_ptr(arg);
18602         int64_t ret_conv = CResult_RefundBolt12SemanticErrorZ_clone_ptr(arg_conv);
18603         return ret_conv;
18604 }
18605
18606 int64_t  CS_LDK_CResult_RefundBolt12SemanticErrorZ_clone(int64_t orig) {
18607         LDKCResult_RefundBolt12SemanticErrorZ* orig_conv = (LDKCResult_RefundBolt12SemanticErrorZ*)untag_ptr(orig);
18608         LDKCResult_RefundBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12SemanticErrorZ), "LDKCResult_RefundBolt12SemanticErrorZ");
18609         *ret_conv = CResult_RefundBolt12SemanticErrorZ_clone(orig_conv);
18610         return tag_ptr(ret_conv, true);
18611 }
18612
18613 int64_t  CS_LDK_COption_u64Z_some(int64_t o) {
18614         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
18615         *ret_copy = COption_u64Z_some(o);
18616         int64_t ret_ref = tag_ptr(ret_copy, true);
18617         return ret_ref;
18618 }
18619
18620 int64_t  CS_LDK_COption_u64Z_none() {
18621         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
18622         *ret_copy = COption_u64Z_none();
18623         int64_t ret_ref = tag_ptr(ret_copy, true);
18624         return ret_ref;
18625 }
18626
18627 void  CS_LDK_COption_u64Z_free(int64_t _res) {
18628         if (!ptr_is_owned(_res)) return;
18629         void* _res_ptr = untag_ptr(_res);
18630         CHECK_ACCESS(_res_ptr);
18631         LDKCOption_u64Z _res_conv = *(LDKCOption_u64Z*)(_res_ptr);
18632         FREE(untag_ptr(_res));
18633         COption_u64Z_free(_res_conv);
18634 }
18635
18636 static inline uint64_t COption_u64Z_clone_ptr(LDKCOption_u64Z *NONNULL_PTR arg) {
18637         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
18638         *ret_copy = COption_u64Z_clone(arg);
18639         int64_t ret_ref = tag_ptr(ret_copy, true);
18640         return ret_ref;
18641 }
18642 int64_t  CS_LDK_COption_u64Z_clone_ptr(int64_t arg) {
18643         LDKCOption_u64Z* arg_conv = (LDKCOption_u64Z*)untag_ptr(arg);
18644         int64_t ret_conv = COption_u64Z_clone_ptr(arg_conv);
18645         return ret_conv;
18646 }
18647
18648 int64_t  CS_LDK_COption_u64Z_clone(int64_t orig) {
18649         LDKCOption_u64Z* orig_conv = (LDKCOption_u64Z*)untag_ptr(orig);
18650         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
18651         *ret_copy = COption_u64Z_clone(orig_conv);
18652         int64_t ret_ref = tag_ptr(ret_copy, true);
18653         return ret_ref;
18654 }
18655
18656 void  CS_LDK_CVec_BlindedPathZ_free(int64_tArray _res) {
18657         LDKCVec_BlindedPathZ _res_constr;
18658         _res_constr.datalen = _res->arr_len;
18659         if (_res_constr.datalen > 0)
18660                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBlindedPath), "LDKCVec_BlindedPathZ Elements");
18661         else
18662                 _res_constr.data = NULL;
18663         int64_t* _res_vals = _res->elems;
18664         for (size_t n = 0; n < _res_constr.datalen; n++) {
18665                 int64_t _res_conv_13 = _res_vals[n];
18666                 LDKBlindedPath _res_conv_13_conv;
18667                 _res_conv_13_conv.inner = untag_ptr(_res_conv_13);
18668                 _res_conv_13_conv.is_owned = ptr_is_owned(_res_conv_13);
18669                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_13_conv);
18670                 _res_constr.data[n] = _res_conv_13_conv;
18671         }
18672         FREE(_res);
18673         CVec_BlindedPathZ_free(_res_constr);
18674 }
18675
18676 int64_t  CS_LDK_CResult_RefundBolt12ParseErrorZ_ok(int64_t o) {
18677         LDKRefund o_conv;
18678         o_conv.inner = untag_ptr(o);
18679         o_conv.is_owned = ptr_is_owned(o);
18680         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18681         o_conv = Refund_clone(&o_conv);
18682         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
18683         *ret_conv = CResult_RefundBolt12ParseErrorZ_ok(o_conv);
18684         return tag_ptr(ret_conv, true);
18685 }
18686
18687 int64_t  CS_LDK_CResult_RefundBolt12ParseErrorZ_err(int64_t e) {
18688         LDKBolt12ParseError e_conv;
18689         e_conv.inner = untag_ptr(e);
18690         e_conv.is_owned = ptr_is_owned(e);
18691         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18692         e_conv = Bolt12ParseError_clone(&e_conv);
18693         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
18694         *ret_conv = CResult_RefundBolt12ParseErrorZ_err(e_conv);
18695         return tag_ptr(ret_conv, true);
18696 }
18697
18698 jboolean  CS_LDK_CResult_RefundBolt12ParseErrorZ_is_ok(int64_t o) {
18699         LDKCResult_RefundBolt12ParseErrorZ* o_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(o);
18700         jboolean ret_conv = CResult_RefundBolt12ParseErrorZ_is_ok(o_conv);
18701         return ret_conv;
18702 }
18703
18704 void  CS_LDK_CResult_RefundBolt12ParseErrorZ_free(int64_t _res) {
18705         if (!ptr_is_owned(_res)) return;
18706         void* _res_ptr = untag_ptr(_res);
18707         CHECK_ACCESS(_res_ptr);
18708         LDKCResult_RefundBolt12ParseErrorZ _res_conv = *(LDKCResult_RefundBolt12ParseErrorZ*)(_res_ptr);
18709         FREE(untag_ptr(_res));
18710         CResult_RefundBolt12ParseErrorZ_free(_res_conv);
18711 }
18712
18713 static inline uint64_t CResult_RefundBolt12ParseErrorZ_clone_ptr(LDKCResult_RefundBolt12ParseErrorZ *NONNULL_PTR arg) {
18714         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
18715         *ret_conv = CResult_RefundBolt12ParseErrorZ_clone(arg);
18716         return tag_ptr(ret_conv, true);
18717 }
18718 int64_t  CS_LDK_CResult_RefundBolt12ParseErrorZ_clone_ptr(int64_t arg) {
18719         LDKCResult_RefundBolt12ParseErrorZ* arg_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(arg);
18720         int64_t ret_conv = CResult_RefundBolt12ParseErrorZ_clone_ptr(arg_conv);
18721         return ret_conv;
18722 }
18723
18724 int64_t  CS_LDK_CResult_RefundBolt12ParseErrorZ_clone(int64_t orig) {
18725         LDKCResult_RefundBolt12ParseErrorZ* orig_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(orig);
18726         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
18727         *ret_conv = CResult_RefundBolt12ParseErrorZ_clone(orig_conv);
18728         return tag_ptr(ret_conv, true);
18729 }
18730
18731 int64_t  CS_LDK_CResult_RetryDecodeErrorZ_ok(int64_t o) {
18732         void* o_ptr = untag_ptr(o);
18733         CHECK_ACCESS(o_ptr);
18734         LDKRetry o_conv = *(LDKRetry*)(o_ptr);
18735         o_conv = Retry_clone((LDKRetry*)untag_ptr(o));
18736         LDKCResult_RetryDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RetryDecodeErrorZ), "LDKCResult_RetryDecodeErrorZ");
18737         *ret_conv = CResult_RetryDecodeErrorZ_ok(o_conv);
18738         return tag_ptr(ret_conv, true);
18739 }
18740
18741 int64_t  CS_LDK_CResult_RetryDecodeErrorZ_err(int64_t e) {
18742         void* e_ptr = untag_ptr(e);
18743         CHECK_ACCESS(e_ptr);
18744         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18745         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18746         LDKCResult_RetryDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RetryDecodeErrorZ), "LDKCResult_RetryDecodeErrorZ");
18747         *ret_conv = CResult_RetryDecodeErrorZ_err(e_conv);
18748         return tag_ptr(ret_conv, true);
18749 }
18750
18751 jboolean  CS_LDK_CResult_RetryDecodeErrorZ_is_ok(int64_t o) {
18752         LDKCResult_RetryDecodeErrorZ* o_conv = (LDKCResult_RetryDecodeErrorZ*)untag_ptr(o);
18753         jboolean ret_conv = CResult_RetryDecodeErrorZ_is_ok(o_conv);
18754         return ret_conv;
18755 }
18756
18757 void  CS_LDK_CResult_RetryDecodeErrorZ_free(int64_t _res) {
18758         if (!ptr_is_owned(_res)) return;
18759         void* _res_ptr = untag_ptr(_res);
18760         CHECK_ACCESS(_res_ptr);
18761         LDKCResult_RetryDecodeErrorZ _res_conv = *(LDKCResult_RetryDecodeErrorZ*)(_res_ptr);
18762         FREE(untag_ptr(_res));
18763         CResult_RetryDecodeErrorZ_free(_res_conv);
18764 }
18765
18766 static inline uint64_t CResult_RetryDecodeErrorZ_clone_ptr(LDKCResult_RetryDecodeErrorZ *NONNULL_PTR arg) {
18767         LDKCResult_RetryDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RetryDecodeErrorZ), "LDKCResult_RetryDecodeErrorZ");
18768         *ret_conv = CResult_RetryDecodeErrorZ_clone(arg);
18769         return tag_ptr(ret_conv, true);
18770 }
18771 int64_t  CS_LDK_CResult_RetryDecodeErrorZ_clone_ptr(int64_t arg) {
18772         LDKCResult_RetryDecodeErrorZ* arg_conv = (LDKCResult_RetryDecodeErrorZ*)untag_ptr(arg);
18773         int64_t ret_conv = CResult_RetryDecodeErrorZ_clone_ptr(arg_conv);
18774         return ret_conv;
18775 }
18776
18777 int64_t  CS_LDK_CResult_RetryDecodeErrorZ_clone(int64_t orig) {
18778         LDKCResult_RetryDecodeErrorZ* orig_conv = (LDKCResult_RetryDecodeErrorZ*)untag_ptr(orig);
18779         LDKCResult_RetryDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RetryDecodeErrorZ), "LDKCResult_RetryDecodeErrorZ");
18780         *ret_conv = CResult_RetryDecodeErrorZ_clone(orig_conv);
18781         return tag_ptr(ret_conv, true);
18782 }
18783
18784 int64_t  CS_LDK_CResult_NoneAPIErrorZ_ok() {
18785         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
18786         *ret_conv = CResult_NoneAPIErrorZ_ok();
18787         return tag_ptr(ret_conv, true);
18788 }
18789
18790 int64_t  CS_LDK_CResult_NoneAPIErrorZ_err(int64_t e) {
18791         void* e_ptr = untag_ptr(e);
18792         CHECK_ACCESS(e_ptr);
18793         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
18794         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
18795         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
18796         *ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
18797         return tag_ptr(ret_conv, true);
18798 }
18799
18800 jboolean  CS_LDK_CResult_NoneAPIErrorZ_is_ok(int64_t o) {
18801         LDKCResult_NoneAPIErrorZ* o_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(o);
18802         jboolean ret_conv = CResult_NoneAPIErrorZ_is_ok(o_conv);
18803         return ret_conv;
18804 }
18805
18806 void  CS_LDK_CResult_NoneAPIErrorZ_free(int64_t _res) {
18807         if (!ptr_is_owned(_res)) return;
18808         void* _res_ptr = untag_ptr(_res);
18809         CHECK_ACCESS(_res_ptr);
18810         LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_ptr);
18811         FREE(untag_ptr(_res));
18812         CResult_NoneAPIErrorZ_free(_res_conv);
18813 }
18814
18815 static inline uint64_t CResult_NoneAPIErrorZ_clone_ptr(LDKCResult_NoneAPIErrorZ *NONNULL_PTR arg) {
18816         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
18817         *ret_conv = CResult_NoneAPIErrorZ_clone(arg);
18818         return tag_ptr(ret_conv, true);
18819 }
18820 int64_t  CS_LDK_CResult_NoneAPIErrorZ_clone_ptr(int64_t arg) {
18821         LDKCResult_NoneAPIErrorZ* arg_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(arg);
18822         int64_t ret_conv = CResult_NoneAPIErrorZ_clone_ptr(arg_conv);
18823         return ret_conv;
18824 }
18825
18826 int64_t  CS_LDK_CResult_NoneAPIErrorZ_clone(int64_t orig) {
18827         LDKCResult_NoneAPIErrorZ* orig_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(orig);
18828         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
18829         *ret_conv = CResult_NoneAPIErrorZ_clone(orig_conv);
18830         return tag_ptr(ret_conv, true);
18831 }
18832
18833 void  CS_LDK_CVec_CResult_NoneAPIErrorZZ_free(int64_tArray _res) {
18834         LDKCVec_CResult_NoneAPIErrorZZ _res_constr;
18835         _res_constr.datalen = _res->arr_len;
18836         if (_res_constr.datalen > 0)
18837                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
18838         else
18839                 _res_constr.data = NULL;
18840         int64_t* _res_vals = _res->elems;
18841         for (size_t w = 0; w < _res_constr.datalen; w++) {
18842                 int64_t _res_conv_22 = _res_vals[w];
18843                 void* _res_conv_22_ptr = untag_ptr(_res_conv_22);
18844                 CHECK_ACCESS(_res_conv_22_ptr);
18845                 LDKCResult_NoneAPIErrorZ _res_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_conv_22_ptr);
18846                 FREE(untag_ptr(_res_conv_22));
18847                 _res_constr.data[w] = _res_conv_22_conv;
18848         }
18849         FREE(_res);
18850         CVec_CResult_NoneAPIErrorZZ_free(_res_constr);
18851 }
18852
18853 void  CS_LDK_CVec_APIErrorZ_free(int64_tArray _res) {
18854         LDKCVec_APIErrorZ _res_constr;
18855         _res_constr.datalen = _res->arr_len;
18856         if (_res_constr.datalen > 0)
18857                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
18858         else
18859                 _res_constr.data = NULL;
18860         int64_t* _res_vals = _res->elems;
18861         for (size_t k = 0; k < _res_constr.datalen; k++) {
18862                 int64_t _res_conv_10 = _res_vals[k];
18863                 void* _res_conv_10_ptr = untag_ptr(_res_conv_10);
18864                 CHECK_ACCESS(_res_conv_10_ptr);
18865                 LDKAPIError _res_conv_10_conv = *(LDKAPIError*)(_res_conv_10_ptr);
18866                 FREE(untag_ptr(_res_conv_10));
18867                 _res_constr.data[k] = _res_conv_10_conv;
18868         }
18869         FREE(_res);
18870         CVec_APIErrorZ_free(_res_constr);
18871 }
18872
18873 int64_t  CS_LDK_COption_ThirtyTwoBytesZ_some(int8_tArray o) {
18874         LDKThirtyTwoBytes o_ref;
18875         CHECK(o->arr_len == 32);
18876         memcpy(o_ref.data, o->elems, 32); FREE(o);
18877         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
18878         *ret_copy = COption_ThirtyTwoBytesZ_some(o_ref);
18879         int64_t ret_ref = tag_ptr(ret_copy, true);
18880         return ret_ref;
18881 }
18882
18883 int64_t  CS_LDK_COption_ThirtyTwoBytesZ_none() {
18884         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
18885         *ret_copy = COption_ThirtyTwoBytesZ_none();
18886         int64_t ret_ref = tag_ptr(ret_copy, true);
18887         return ret_ref;
18888 }
18889
18890 void  CS_LDK_COption_ThirtyTwoBytesZ_free(int64_t _res) {
18891         if (!ptr_is_owned(_res)) return;
18892         void* _res_ptr = untag_ptr(_res);
18893         CHECK_ACCESS(_res_ptr);
18894         LDKCOption_ThirtyTwoBytesZ _res_conv = *(LDKCOption_ThirtyTwoBytesZ*)(_res_ptr);
18895         FREE(untag_ptr(_res));
18896         COption_ThirtyTwoBytesZ_free(_res_conv);
18897 }
18898
18899 static inline uint64_t COption_ThirtyTwoBytesZ_clone_ptr(LDKCOption_ThirtyTwoBytesZ *NONNULL_PTR arg) {
18900         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
18901         *ret_copy = COption_ThirtyTwoBytesZ_clone(arg);
18902         int64_t ret_ref = tag_ptr(ret_copy, true);
18903         return ret_ref;
18904 }
18905 int64_t  CS_LDK_COption_ThirtyTwoBytesZ_clone_ptr(int64_t arg) {
18906         LDKCOption_ThirtyTwoBytesZ* arg_conv = (LDKCOption_ThirtyTwoBytesZ*)untag_ptr(arg);
18907         int64_t ret_conv = COption_ThirtyTwoBytesZ_clone_ptr(arg_conv);
18908         return ret_conv;
18909 }
18910
18911 int64_t  CS_LDK_COption_ThirtyTwoBytesZ_clone(int64_t orig) {
18912         LDKCOption_ThirtyTwoBytesZ* orig_conv = (LDKCOption_ThirtyTwoBytesZ*)untag_ptr(orig);
18913         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
18914         *ret_copy = COption_ThirtyTwoBytesZ_clone(orig_conv);
18915         int64_t ret_ref = tag_ptr(ret_copy, true);
18916         return ret_ref;
18917 }
18918
18919 int64_t  CS_LDK_COption_CVec_u8ZZ_some(int8_tArray o) {
18920         LDKCVec_u8Z o_ref;
18921         o_ref.datalen = o->arr_len;
18922         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
18923         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
18924         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
18925         *ret_copy = COption_CVec_u8ZZ_some(o_ref);
18926         int64_t ret_ref = tag_ptr(ret_copy, true);
18927         return ret_ref;
18928 }
18929
18930 int64_t  CS_LDK_COption_CVec_u8ZZ_none() {
18931         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
18932         *ret_copy = COption_CVec_u8ZZ_none();
18933         int64_t ret_ref = tag_ptr(ret_copy, true);
18934         return ret_ref;
18935 }
18936
18937 void  CS_LDK_COption_CVec_u8ZZ_free(int64_t _res) {
18938         if (!ptr_is_owned(_res)) return;
18939         void* _res_ptr = untag_ptr(_res);
18940         CHECK_ACCESS(_res_ptr);
18941         LDKCOption_CVec_u8ZZ _res_conv = *(LDKCOption_CVec_u8ZZ*)(_res_ptr);
18942         FREE(untag_ptr(_res));
18943         COption_CVec_u8ZZ_free(_res_conv);
18944 }
18945
18946 static inline uint64_t COption_CVec_u8ZZ_clone_ptr(LDKCOption_CVec_u8ZZ *NONNULL_PTR arg) {
18947         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
18948         *ret_copy = COption_CVec_u8ZZ_clone(arg);
18949         int64_t ret_ref = tag_ptr(ret_copy, true);
18950         return ret_ref;
18951 }
18952 int64_t  CS_LDK_COption_CVec_u8ZZ_clone_ptr(int64_t arg) {
18953         LDKCOption_CVec_u8ZZ* arg_conv = (LDKCOption_CVec_u8ZZ*)untag_ptr(arg);
18954         int64_t ret_conv = COption_CVec_u8ZZ_clone_ptr(arg_conv);
18955         return ret_conv;
18956 }
18957
18958 int64_t  CS_LDK_COption_CVec_u8ZZ_clone(int64_t orig) {
18959         LDKCOption_CVec_u8ZZ* orig_conv = (LDKCOption_CVec_u8ZZ*)untag_ptr(orig);
18960         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
18961         *ret_copy = COption_CVec_u8ZZ_clone(orig_conv);
18962         int64_t ret_ref = tag_ptr(ret_copy, true);
18963         return ret_ref;
18964 }
18965
18966 int64_t  CS_LDK_CResult_RecipientOnionFieldsDecodeErrorZ_ok(int64_t o) {
18967         LDKRecipientOnionFields o_conv;
18968         o_conv.inner = untag_ptr(o);
18969         o_conv.is_owned = ptr_is_owned(o);
18970         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18971         o_conv = RecipientOnionFields_clone(&o_conv);
18972         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
18973         *ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_ok(o_conv);
18974         return tag_ptr(ret_conv, true);
18975 }
18976
18977 int64_t  CS_LDK_CResult_RecipientOnionFieldsDecodeErrorZ_err(int64_t e) {
18978         void* e_ptr = untag_ptr(e);
18979         CHECK_ACCESS(e_ptr);
18980         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18981         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18982         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
18983         *ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_err(e_conv);
18984         return tag_ptr(ret_conv, true);
18985 }
18986
18987 jboolean  CS_LDK_CResult_RecipientOnionFieldsDecodeErrorZ_is_ok(int64_t o) {
18988         LDKCResult_RecipientOnionFieldsDecodeErrorZ* o_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(o);
18989         jboolean ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_is_ok(o_conv);
18990         return ret_conv;
18991 }
18992
18993 void  CS_LDK_CResult_RecipientOnionFieldsDecodeErrorZ_free(int64_t _res) {
18994         if (!ptr_is_owned(_res)) return;
18995         void* _res_ptr = untag_ptr(_res);
18996         CHECK_ACCESS(_res_ptr);
18997         LDKCResult_RecipientOnionFieldsDecodeErrorZ _res_conv = *(LDKCResult_RecipientOnionFieldsDecodeErrorZ*)(_res_ptr);
18998         FREE(untag_ptr(_res));
18999         CResult_RecipientOnionFieldsDecodeErrorZ_free(_res_conv);
19000 }
19001
19002 static inline uint64_t CResult_RecipientOnionFieldsDecodeErrorZ_clone_ptr(LDKCResult_RecipientOnionFieldsDecodeErrorZ *NONNULL_PTR arg) {
19003         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
19004         *ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_clone(arg);
19005         return tag_ptr(ret_conv, true);
19006 }
19007 int64_t  CS_LDK_CResult_RecipientOnionFieldsDecodeErrorZ_clone_ptr(int64_t arg) {
19008         LDKCResult_RecipientOnionFieldsDecodeErrorZ* arg_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(arg);
19009         int64_t ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_clone_ptr(arg_conv);
19010         return ret_conv;
19011 }
19012
19013 int64_t  CS_LDK_CResult_RecipientOnionFieldsDecodeErrorZ_clone(int64_t orig) {
19014         LDKCResult_RecipientOnionFieldsDecodeErrorZ* orig_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(orig);
19015         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
19016         *ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_clone(orig_conv);
19017         return tag_ptr(ret_conv, true);
19018 }
19019
19020 static inline uint64_t C2Tuple_u64CVec_u8ZZ_clone_ptr(LDKC2Tuple_u64CVec_u8ZZ *NONNULL_PTR arg) {
19021         LDKC2Tuple_u64CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
19022         *ret_conv = C2Tuple_u64CVec_u8ZZ_clone(arg);
19023         return tag_ptr(ret_conv, true);
19024 }
19025 int64_t  CS_LDK_C2Tuple_u64CVec_u8ZZ_clone_ptr(int64_t arg) {
19026         LDKC2Tuple_u64CVec_u8ZZ* arg_conv = (LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(arg);
19027         int64_t ret_conv = C2Tuple_u64CVec_u8ZZ_clone_ptr(arg_conv);
19028         return ret_conv;
19029 }
19030
19031 int64_t  CS_LDK_C2Tuple_u64CVec_u8ZZ_clone(int64_t orig) {
19032         LDKC2Tuple_u64CVec_u8ZZ* orig_conv = (LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(orig);
19033         LDKC2Tuple_u64CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
19034         *ret_conv = C2Tuple_u64CVec_u8ZZ_clone(orig_conv);
19035         return tag_ptr(ret_conv, true);
19036 }
19037
19038 int64_t  CS_LDK_C2Tuple_u64CVec_u8ZZ_new(int64_t a, int8_tArray b) {
19039         LDKCVec_u8Z b_ref;
19040         b_ref.datalen = b->arr_len;
19041         b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
19042         memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
19043         LDKC2Tuple_u64CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
19044         *ret_conv = C2Tuple_u64CVec_u8ZZ_new(a, b_ref);
19045         return tag_ptr(ret_conv, true);
19046 }
19047
19048 void  CS_LDK_C2Tuple_u64CVec_u8ZZ_free(int64_t _res) {
19049         if (!ptr_is_owned(_res)) return;
19050         void* _res_ptr = untag_ptr(_res);
19051         CHECK_ACCESS(_res_ptr);
19052         LDKC2Tuple_u64CVec_u8ZZ _res_conv = *(LDKC2Tuple_u64CVec_u8ZZ*)(_res_ptr);
19053         FREE(untag_ptr(_res));
19054         C2Tuple_u64CVec_u8ZZ_free(_res_conv);
19055 }
19056
19057 void  CS_LDK_CVec_C2Tuple_u64CVec_u8ZZZ_free(int64_tArray _res) {
19058         LDKCVec_C2Tuple_u64CVec_u8ZZZ _res_constr;
19059         _res_constr.datalen = _res->arr_len;
19060         if (_res_constr.datalen > 0)
19061                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKCVec_C2Tuple_u64CVec_u8ZZZ Elements");
19062         else
19063                 _res_constr.data = NULL;
19064         int64_t* _res_vals = _res->elems;
19065         for (size_t x = 0; x < _res_constr.datalen; x++) {
19066                 int64_t _res_conv_23 = _res_vals[x];
19067                 void* _res_conv_23_ptr = untag_ptr(_res_conv_23);
19068                 CHECK_ACCESS(_res_conv_23_ptr);
19069                 LDKC2Tuple_u64CVec_u8ZZ _res_conv_23_conv = *(LDKC2Tuple_u64CVec_u8ZZ*)(_res_conv_23_ptr);
19070                 FREE(untag_ptr(_res_conv_23));
19071                 _res_constr.data[x] = _res_conv_23_conv;
19072         }
19073         FREE(_res);
19074         CVec_C2Tuple_u64CVec_u8ZZZ_free(_res_constr);
19075 }
19076
19077 int64_t  CS_LDK_CResult_RecipientOnionFieldsNoneZ_ok(int64_t o) {
19078         LDKRecipientOnionFields o_conv;
19079         o_conv.inner = untag_ptr(o);
19080         o_conv.is_owned = ptr_is_owned(o);
19081         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19082         o_conv = RecipientOnionFields_clone(&o_conv);
19083         LDKCResult_RecipientOnionFieldsNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsNoneZ), "LDKCResult_RecipientOnionFieldsNoneZ");
19084         *ret_conv = CResult_RecipientOnionFieldsNoneZ_ok(o_conv);
19085         return tag_ptr(ret_conv, true);
19086 }
19087
19088 int64_t  CS_LDK_CResult_RecipientOnionFieldsNoneZ_err() {
19089         LDKCResult_RecipientOnionFieldsNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsNoneZ), "LDKCResult_RecipientOnionFieldsNoneZ");
19090         *ret_conv = CResult_RecipientOnionFieldsNoneZ_err();
19091         return tag_ptr(ret_conv, true);
19092 }
19093
19094 jboolean  CS_LDK_CResult_RecipientOnionFieldsNoneZ_is_ok(int64_t o) {
19095         LDKCResult_RecipientOnionFieldsNoneZ* o_conv = (LDKCResult_RecipientOnionFieldsNoneZ*)untag_ptr(o);
19096         jboolean ret_conv = CResult_RecipientOnionFieldsNoneZ_is_ok(o_conv);
19097         return ret_conv;
19098 }
19099
19100 void  CS_LDK_CResult_RecipientOnionFieldsNoneZ_free(int64_t _res) {
19101         if (!ptr_is_owned(_res)) return;
19102         void* _res_ptr = untag_ptr(_res);
19103         CHECK_ACCESS(_res_ptr);
19104         LDKCResult_RecipientOnionFieldsNoneZ _res_conv = *(LDKCResult_RecipientOnionFieldsNoneZ*)(_res_ptr);
19105         FREE(untag_ptr(_res));
19106         CResult_RecipientOnionFieldsNoneZ_free(_res_conv);
19107 }
19108
19109 static inline uint64_t CResult_RecipientOnionFieldsNoneZ_clone_ptr(LDKCResult_RecipientOnionFieldsNoneZ *NONNULL_PTR arg) {
19110         LDKCResult_RecipientOnionFieldsNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsNoneZ), "LDKCResult_RecipientOnionFieldsNoneZ");
19111         *ret_conv = CResult_RecipientOnionFieldsNoneZ_clone(arg);
19112         return tag_ptr(ret_conv, true);
19113 }
19114 int64_t  CS_LDK_CResult_RecipientOnionFieldsNoneZ_clone_ptr(int64_t arg) {
19115         LDKCResult_RecipientOnionFieldsNoneZ* arg_conv = (LDKCResult_RecipientOnionFieldsNoneZ*)untag_ptr(arg);
19116         int64_t ret_conv = CResult_RecipientOnionFieldsNoneZ_clone_ptr(arg_conv);
19117         return ret_conv;
19118 }
19119
19120 int64_t  CS_LDK_CResult_RecipientOnionFieldsNoneZ_clone(int64_t orig) {
19121         LDKCResult_RecipientOnionFieldsNoneZ* orig_conv = (LDKCResult_RecipientOnionFieldsNoneZ*)untag_ptr(orig);
19122         LDKCResult_RecipientOnionFieldsNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsNoneZ), "LDKCResult_RecipientOnionFieldsNoneZ");
19123         *ret_conv = CResult_RecipientOnionFieldsNoneZ_clone(orig_conv);
19124         return tag_ptr(ret_conv, true);
19125 }
19126
19127 int64_t  CS_LDK_CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_ok(int64_t o) {
19128         LDKUnsignedBolt12Invoice o_conv;
19129         o_conv.inner = untag_ptr(o);
19130         o_conv.is_owned = ptr_is_owned(o);
19131         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19132         o_conv = UnsignedBolt12Invoice_clone(&o_conv);
19133         LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ), "LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ");
19134         *ret_conv = CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_ok(o_conv);
19135         return tag_ptr(ret_conv, true);
19136 }
19137
19138 int64_t  CS_LDK_CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_err(int32_t e) {
19139         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_cs(e);
19140         LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ), "LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ");
19141         *ret_conv = CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_err(e_conv);
19142         return tag_ptr(ret_conv, true);
19143 }
19144
19145 jboolean  CS_LDK_CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_is_ok(int64_t o) {
19146         LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ* o_conv = (LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ*)untag_ptr(o);
19147         jboolean ret_conv = CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_is_ok(o_conv);
19148         return ret_conv;
19149 }
19150
19151 void  CS_LDK_CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_free(int64_t _res) {
19152         if (!ptr_is_owned(_res)) return;
19153         void* _res_ptr = untag_ptr(_res);
19154         CHECK_ACCESS(_res_ptr);
19155         LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ _res_conv = *(LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ*)(_res_ptr);
19156         FREE(untag_ptr(_res));
19157         CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_free(_res_conv);
19158 }
19159
19160 static inline uint64_t CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_clone_ptr(LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ *NONNULL_PTR arg) {
19161         LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ), "LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ");
19162         *ret_conv = CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_clone(arg);
19163         return tag_ptr(ret_conv, true);
19164 }
19165 int64_t  CS_LDK_CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_clone_ptr(int64_t arg) {
19166         LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ* arg_conv = (LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ*)untag_ptr(arg);
19167         int64_t ret_conv = CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_clone_ptr(arg_conv);
19168         return ret_conv;
19169 }
19170
19171 int64_t  CS_LDK_CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_clone(int64_t orig) {
19172         LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ* orig_conv = (LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ*)untag_ptr(orig);
19173         LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ), "LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ");
19174         *ret_conv = CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_clone(orig_conv);
19175         return tag_ptr(ret_conv, true);
19176 }
19177
19178 int64_t  CS_LDK_CResult_Bolt12InvoiceBolt12SemanticErrorZ_ok(int64_t o) {
19179         LDKBolt12Invoice o_conv;
19180         o_conv.inner = untag_ptr(o);
19181         o_conv.is_owned = ptr_is_owned(o);
19182         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19183         o_conv = Bolt12Invoice_clone(&o_conv);
19184         LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ), "LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ");
19185         *ret_conv = CResult_Bolt12InvoiceBolt12SemanticErrorZ_ok(o_conv);
19186         return tag_ptr(ret_conv, true);
19187 }
19188
19189 int64_t  CS_LDK_CResult_Bolt12InvoiceBolt12SemanticErrorZ_err(int32_t e) {
19190         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_cs(e);
19191         LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ), "LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ");
19192         *ret_conv = CResult_Bolt12InvoiceBolt12SemanticErrorZ_err(e_conv);
19193         return tag_ptr(ret_conv, true);
19194 }
19195
19196 jboolean  CS_LDK_CResult_Bolt12InvoiceBolt12SemanticErrorZ_is_ok(int64_t o) {
19197         LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ* o_conv = (LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ*)untag_ptr(o);
19198         jboolean ret_conv = CResult_Bolt12InvoiceBolt12SemanticErrorZ_is_ok(o_conv);
19199         return ret_conv;
19200 }
19201
19202 void  CS_LDK_CResult_Bolt12InvoiceBolt12SemanticErrorZ_free(int64_t _res) {
19203         if (!ptr_is_owned(_res)) return;
19204         void* _res_ptr = untag_ptr(_res);
19205         CHECK_ACCESS(_res_ptr);
19206         LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ _res_conv = *(LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ*)(_res_ptr);
19207         FREE(untag_ptr(_res));
19208         CResult_Bolt12InvoiceBolt12SemanticErrorZ_free(_res_conv);
19209 }
19210
19211 static inline uint64_t CResult_Bolt12InvoiceBolt12SemanticErrorZ_clone_ptr(LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ *NONNULL_PTR arg) {
19212         LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ), "LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ");
19213         *ret_conv = CResult_Bolt12InvoiceBolt12SemanticErrorZ_clone(arg);
19214         return tag_ptr(ret_conv, true);
19215 }
19216 int64_t  CS_LDK_CResult_Bolt12InvoiceBolt12SemanticErrorZ_clone_ptr(int64_t arg) {
19217         LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ* arg_conv = (LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ*)untag_ptr(arg);
19218         int64_t ret_conv = CResult_Bolt12InvoiceBolt12SemanticErrorZ_clone_ptr(arg_conv);
19219         return ret_conv;
19220 }
19221
19222 int64_t  CS_LDK_CResult_Bolt12InvoiceBolt12SemanticErrorZ_clone(int64_t orig) {
19223         LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ* orig_conv = (LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ*)untag_ptr(orig);
19224         LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ), "LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ");
19225         *ret_conv = CResult_Bolt12InvoiceBolt12SemanticErrorZ_clone(orig_conv);
19226         return tag_ptr(ret_conv, true);
19227 }
19228
19229 int64_t  CS_LDK_CResult_SchnorrSignatureNoneZ_ok(int8_tArray o) {
19230         LDKSchnorrSignature o_ref;
19231         CHECK(o->arr_len == 64);
19232         memcpy(o_ref.compact_form, o->elems, 64); FREE(o);
19233         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
19234         *ret_conv = CResult_SchnorrSignatureNoneZ_ok(o_ref);
19235         return tag_ptr(ret_conv, true);
19236 }
19237
19238 int64_t  CS_LDK_CResult_SchnorrSignatureNoneZ_err() {
19239         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
19240         *ret_conv = CResult_SchnorrSignatureNoneZ_err();
19241         return tag_ptr(ret_conv, true);
19242 }
19243
19244 jboolean  CS_LDK_CResult_SchnorrSignatureNoneZ_is_ok(int64_t o) {
19245         LDKCResult_SchnorrSignatureNoneZ* o_conv = (LDKCResult_SchnorrSignatureNoneZ*)untag_ptr(o);
19246         jboolean ret_conv = CResult_SchnorrSignatureNoneZ_is_ok(o_conv);
19247         return ret_conv;
19248 }
19249
19250 void  CS_LDK_CResult_SchnorrSignatureNoneZ_free(int64_t _res) {
19251         if (!ptr_is_owned(_res)) return;
19252         void* _res_ptr = untag_ptr(_res);
19253         CHECK_ACCESS(_res_ptr);
19254         LDKCResult_SchnorrSignatureNoneZ _res_conv = *(LDKCResult_SchnorrSignatureNoneZ*)(_res_ptr);
19255         FREE(untag_ptr(_res));
19256         CResult_SchnorrSignatureNoneZ_free(_res_conv);
19257 }
19258
19259 static inline uint64_t CResult_SchnorrSignatureNoneZ_clone_ptr(LDKCResult_SchnorrSignatureNoneZ *NONNULL_PTR arg) {
19260         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
19261         *ret_conv = CResult_SchnorrSignatureNoneZ_clone(arg);
19262         return tag_ptr(ret_conv, true);
19263 }
19264 int64_t  CS_LDK_CResult_SchnorrSignatureNoneZ_clone_ptr(int64_t arg) {
19265         LDKCResult_SchnorrSignatureNoneZ* arg_conv = (LDKCResult_SchnorrSignatureNoneZ*)untag_ptr(arg);
19266         int64_t ret_conv = CResult_SchnorrSignatureNoneZ_clone_ptr(arg_conv);
19267         return ret_conv;
19268 }
19269
19270 int64_t  CS_LDK_CResult_SchnorrSignatureNoneZ_clone(int64_t orig) {
19271         LDKCResult_SchnorrSignatureNoneZ* orig_conv = (LDKCResult_SchnorrSignatureNoneZ*)untag_ptr(orig);
19272         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
19273         *ret_conv = CResult_SchnorrSignatureNoneZ_clone(orig_conv);
19274         return tag_ptr(ret_conv, true);
19275 }
19276
19277 void  CS_LDK_CVec_ThirtyTwoBytesZ_free(ptrArray _res) {
19278         LDKCVec_ThirtyTwoBytesZ _res_constr;
19279         _res_constr.datalen = _res->arr_len;
19280         if (_res_constr.datalen > 0)
19281                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
19282         else
19283                 _res_constr.data = NULL;
19284         int8_tArray* _res_vals = (void*) _res->elems;
19285         for (size_t i = 0; i < _res_constr.datalen; i++) {
19286                 int8_tArray _res_conv_8 = _res_vals[i];
19287                 LDKThirtyTwoBytes _res_conv_8_ref;
19288                 CHECK(_res_conv_8->arr_len == 32);
19289                 memcpy(_res_conv_8_ref.data, _res_conv_8->elems, 32); FREE(_res_conv_8);
19290                 _res_constr.data[i] = _res_conv_8_ref;
19291         }
19292         FREE(_res);
19293         CVec_ThirtyTwoBytesZ_free(_res_constr);
19294 }
19295
19296 int64_t  CS_LDK_COption_CVec_ThirtyTwoBytesZZ_some(ptrArray o) {
19297         LDKCVec_ThirtyTwoBytesZ o_constr;
19298         o_constr.datalen = o->arr_len;
19299         if (o_constr.datalen > 0)
19300                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
19301         else
19302                 o_constr.data = NULL;
19303         int8_tArray* o_vals = (void*) o->elems;
19304         for (size_t i = 0; i < o_constr.datalen; i++) {
19305                 int8_tArray o_conv_8 = o_vals[i];
19306                 LDKThirtyTwoBytes o_conv_8_ref;
19307                 CHECK(o_conv_8->arr_len == 32);
19308                 memcpy(o_conv_8_ref.data, o_conv_8->elems, 32); FREE(o_conv_8);
19309                 o_constr.data[i] = o_conv_8_ref;
19310         }
19311         FREE(o);
19312         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
19313         *ret_copy = COption_CVec_ThirtyTwoBytesZZ_some(o_constr);
19314         int64_t ret_ref = tag_ptr(ret_copy, true);
19315         return ret_ref;
19316 }
19317
19318 int64_t  CS_LDK_COption_CVec_ThirtyTwoBytesZZ_none() {
19319         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
19320         *ret_copy = COption_CVec_ThirtyTwoBytesZZ_none();
19321         int64_t ret_ref = tag_ptr(ret_copy, true);
19322         return ret_ref;
19323 }
19324
19325 void  CS_LDK_COption_CVec_ThirtyTwoBytesZZ_free(int64_t _res) {
19326         if (!ptr_is_owned(_res)) return;
19327         void* _res_ptr = untag_ptr(_res);
19328         CHECK_ACCESS(_res_ptr);
19329         LDKCOption_CVec_ThirtyTwoBytesZZ _res_conv = *(LDKCOption_CVec_ThirtyTwoBytesZZ*)(_res_ptr);
19330         FREE(untag_ptr(_res));
19331         COption_CVec_ThirtyTwoBytesZZ_free(_res_conv);
19332 }
19333
19334 static inline uint64_t COption_CVec_ThirtyTwoBytesZZ_clone_ptr(LDKCOption_CVec_ThirtyTwoBytesZZ *NONNULL_PTR arg) {
19335         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
19336         *ret_copy = COption_CVec_ThirtyTwoBytesZZ_clone(arg);
19337         int64_t ret_ref = tag_ptr(ret_copy, true);
19338         return ret_ref;
19339 }
19340 int64_t  CS_LDK_COption_CVec_ThirtyTwoBytesZZ_clone_ptr(int64_t arg) {
19341         LDKCOption_CVec_ThirtyTwoBytesZZ* arg_conv = (LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(arg);
19342         int64_t ret_conv = COption_CVec_ThirtyTwoBytesZZ_clone_ptr(arg_conv);
19343         return ret_conv;
19344 }
19345
19346 int64_t  CS_LDK_COption_CVec_ThirtyTwoBytesZZ_clone(int64_t orig) {
19347         LDKCOption_CVec_ThirtyTwoBytesZZ* orig_conv = (LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(orig);
19348         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
19349         *ret_copy = COption_CVec_ThirtyTwoBytesZZ_clone(orig_conv);
19350         int64_t ret_ref = tag_ptr(ret_copy, true);
19351         return ret_ref;
19352 }
19353
19354 int64_t  CS_LDK_COption_AmountZ_some(int64_t o) {
19355         void* o_ptr = untag_ptr(o);
19356         CHECK_ACCESS(o_ptr);
19357         LDKAmount o_conv = *(LDKAmount*)(o_ptr);
19358         o_conv = Amount_clone((LDKAmount*)untag_ptr(o));
19359         LDKCOption_AmountZ *ret_copy = MALLOC(sizeof(LDKCOption_AmountZ), "LDKCOption_AmountZ");
19360         *ret_copy = COption_AmountZ_some(o_conv);
19361         int64_t ret_ref = tag_ptr(ret_copy, true);
19362         return ret_ref;
19363 }
19364
19365 int64_t  CS_LDK_COption_AmountZ_none() {
19366         LDKCOption_AmountZ *ret_copy = MALLOC(sizeof(LDKCOption_AmountZ), "LDKCOption_AmountZ");
19367         *ret_copy = COption_AmountZ_none();
19368         int64_t ret_ref = tag_ptr(ret_copy, true);
19369         return ret_ref;
19370 }
19371
19372 void  CS_LDK_COption_AmountZ_free(int64_t _res) {
19373         if (!ptr_is_owned(_res)) return;
19374         void* _res_ptr = untag_ptr(_res);
19375         CHECK_ACCESS(_res_ptr);
19376         LDKCOption_AmountZ _res_conv = *(LDKCOption_AmountZ*)(_res_ptr);
19377         FREE(untag_ptr(_res));
19378         COption_AmountZ_free(_res_conv);
19379 }
19380
19381 static inline uint64_t COption_AmountZ_clone_ptr(LDKCOption_AmountZ *NONNULL_PTR arg) {
19382         LDKCOption_AmountZ *ret_copy = MALLOC(sizeof(LDKCOption_AmountZ), "LDKCOption_AmountZ");
19383         *ret_copy = COption_AmountZ_clone(arg);
19384         int64_t ret_ref = tag_ptr(ret_copy, true);
19385         return ret_ref;
19386 }
19387 int64_t  CS_LDK_COption_AmountZ_clone_ptr(int64_t arg) {
19388         LDKCOption_AmountZ* arg_conv = (LDKCOption_AmountZ*)untag_ptr(arg);
19389         int64_t ret_conv = COption_AmountZ_clone_ptr(arg_conv);
19390         return ret_conv;
19391 }
19392
19393 int64_t  CS_LDK_COption_AmountZ_clone(int64_t orig) {
19394         LDKCOption_AmountZ* orig_conv = (LDKCOption_AmountZ*)untag_ptr(orig);
19395         LDKCOption_AmountZ *ret_copy = MALLOC(sizeof(LDKCOption_AmountZ), "LDKCOption_AmountZ");
19396         *ret_copy = COption_AmountZ_clone(orig_conv);
19397         int64_t ret_ref = tag_ptr(ret_copy, true);
19398         return ret_ref;
19399 }
19400
19401 int64_t  CS_LDK_COption_QuantityZ_some(int64_t o) {
19402         void* o_ptr = untag_ptr(o);
19403         CHECK_ACCESS(o_ptr);
19404         LDKQuantity o_conv = *(LDKQuantity*)(o_ptr);
19405         o_conv = Quantity_clone((LDKQuantity*)untag_ptr(o));
19406         LDKCOption_QuantityZ *ret_copy = MALLOC(sizeof(LDKCOption_QuantityZ), "LDKCOption_QuantityZ");
19407         *ret_copy = COption_QuantityZ_some(o_conv);
19408         int64_t ret_ref = tag_ptr(ret_copy, true);
19409         return ret_ref;
19410 }
19411
19412 int64_t  CS_LDK_COption_QuantityZ_none() {
19413         LDKCOption_QuantityZ *ret_copy = MALLOC(sizeof(LDKCOption_QuantityZ), "LDKCOption_QuantityZ");
19414         *ret_copy = COption_QuantityZ_none();
19415         int64_t ret_ref = tag_ptr(ret_copy, true);
19416         return ret_ref;
19417 }
19418
19419 void  CS_LDK_COption_QuantityZ_free(int64_t _res) {
19420         if (!ptr_is_owned(_res)) return;
19421         void* _res_ptr = untag_ptr(_res);
19422         CHECK_ACCESS(_res_ptr);
19423         LDKCOption_QuantityZ _res_conv = *(LDKCOption_QuantityZ*)(_res_ptr);
19424         FREE(untag_ptr(_res));
19425         COption_QuantityZ_free(_res_conv);
19426 }
19427
19428 static inline uint64_t COption_QuantityZ_clone_ptr(LDKCOption_QuantityZ *NONNULL_PTR arg) {
19429         LDKCOption_QuantityZ *ret_copy = MALLOC(sizeof(LDKCOption_QuantityZ), "LDKCOption_QuantityZ");
19430         *ret_copy = COption_QuantityZ_clone(arg);
19431         int64_t ret_ref = tag_ptr(ret_copy, true);
19432         return ret_ref;
19433 }
19434 int64_t  CS_LDK_COption_QuantityZ_clone_ptr(int64_t arg) {
19435         LDKCOption_QuantityZ* arg_conv = (LDKCOption_QuantityZ*)untag_ptr(arg);
19436         int64_t ret_conv = COption_QuantityZ_clone_ptr(arg_conv);
19437         return ret_conv;
19438 }
19439
19440 int64_t  CS_LDK_COption_QuantityZ_clone(int64_t orig) {
19441         LDKCOption_QuantityZ* orig_conv = (LDKCOption_QuantityZ*)untag_ptr(orig);
19442         LDKCOption_QuantityZ *ret_copy = MALLOC(sizeof(LDKCOption_QuantityZ), "LDKCOption_QuantityZ");
19443         *ret_copy = COption_QuantityZ_clone(orig_conv);
19444         int64_t ret_ref = tag_ptr(ret_copy, true);
19445         return ret_ref;
19446 }
19447
19448 int64_t  CS_LDK_CResult_ThirtyTwoBytesNoneZ_ok(int8_tArray o) {
19449         LDKThirtyTwoBytes o_ref;
19450         CHECK(o->arr_len == 32);
19451         memcpy(o_ref.data, o->elems, 32); FREE(o);
19452         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
19453         *ret_conv = CResult_ThirtyTwoBytesNoneZ_ok(o_ref);
19454         return tag_ptr(ret_conv, true);
19455 }
19456
19457 int64_t  CS_LDK_CResult_ThirtyTwoBytesNoneZ_err() {
19458         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
19459         *ret_conv = CResult_ThirtyTwoBytesNoneZ_err();
19460         return tag_ptr(ret_conv, true);
19461 }
19462
19463 jboolean  CS_LDK_CResult_ThirtyTwoBytesNoneZ_is_ok(int64_t o) {
19464         LDKCResult_ThirtyTwoBytesNoneZ* o_conv = (LDKCResult_ThirtyTwoBytesNoneZ*)untag_ptr(o);
19465         jboolean ret_conv = CResult_ThirtyTwoBytesNoneZ_is_ok(o_conv);
19466         return ret_conv;
19467 }
19468
19469 void  CS_LDK_CResult_ThirtyTwoBytesNoneZ_free(int64_t _res) {
19470         if (!ptr_is_owned(_res)) return;
19471         void* _res_ptr = untag_ptr(_res);
19472         CHECK_ACCESS(_res_ptr);
19473         LDKCResult_ThirtyTwoBytesNoneZ _res_conv = *(LDKCResult_ThirtyTwoBytesNoneZ*)(_res_ptr);
19474         FREE(untag_ptr(_res));
19475         CResult_ThirtyTwoBytesNoneZ_free(_res_conv);
19476 }
19477
19478 static inline uint64_t CResult_ThirtyTwoBytesNoneZ_clone_ptr(LDKCResult_ThirtyTwoBytesNoneZ *NONNULL_PTR arg) {
19479         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
19480         *ret_conv = CResult_ThirtyTwoBytesNoneZ_clone(arg);
19481         return tag_ptr(ret_conv, true);
19482 }
19483 int64_t  CS_LDK_CResult_ThirtyTwoBytesNoneZ_clone_ptr(int64_t arg) {
19484         LDKCResult_ThirtyTwoBytesNoneZ* arg_conv = (LDKCResult_ThirtyTwoBytesNoneZ*)untag_ptr(arg);
19485         int64_t ret_conv = CResult_ThirtyTwoBytesNoneZ_clone_ptr(arg_conv);
19486         return ret_conv;
19487 }
19488
19489 int64_t  CS_LDK_CResult_ThirtyTwoBytesNoneZ_clone(int64_t orig) {
19490         LDKCResult_ThirtyTwoBytesNoneZ* orig_conv = (LDKCResult_ThirtyTwoBytesNoneZ*)untag_ptr(orig);
19491         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
19492         *ret_conv = CResult_ThirtyTwoBytesNoneZ_clone(orig_conv);
19493         return tag_ptr(ret_conv, true);
19494 }
19495
19496 int64_t  CS_LDK_CResult_BlindedPayInfoDecodeErrorZ_ok(int64_t o) {
19497         LDKBlindedPayInfo o_conv;
19498         o_conv.inner = untag_ptr(o);
19499         o_conv.is_owned = ptr_is_owned(o);
19500         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19501         o_conv = BlindedPayInfo_clone(&o_conv);
19502         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
19503         *ret_conv = CResult_BlindedPayInfoDecodeErrorZ_ok(o_conv);
19504         return tag_ptr(ret_conv, true);
19505 }
19506
19507 int64_t  CS_LDK_CResult_BlindedPayInfoDecodeErrorZ_err(int64_t e) {
19508         void* e_ptr = untag_ptr(e);
19509         CHECK_ACCESS(e_ptr);
19510         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19511         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19512         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
19513         *ret_conv = CResult_BlindedPayInfoDecodeErrorZ_err(e_conv);
19514         return tag_ptr(ret_conv, true);
19515 }
19516
19517 jboolean  CS_LDK_CResult_BlindedPayInfoDecodeErrorZ_is_ok(int64_t o) {
19518         LDKCResult_BlindedPayInfoDecodeErrorZ* o_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(o);
19519         jboolean ret_conv = CResult_BlindedPayInfoDecodeErrorZ_is_ok(o_conv);
19520         return ret_conv;
19521 }
19522
19523 void  CS_LDK_CResult_BlindedPayInfoDecodeErrorZ_free(int64_t _res) {
19524         if (!ptr_is_owned(_res)) return;
19525         void* _res_ptr = untag_ptr(_res);
19526         CHECK_ACCESS(_res_ptr);
19527         LDKCResult_BlindedPayInfoDecodeErrorZ _res_conv = *(LDKCResult_BlindedPayInfoDecodeErrorZ*)(_res_ptr);
19528         FREE(untag_ptr(_res));
19529         CResult_BlindedPayInfoDecodeErrorZ_free(_res_conv);
19530 }
19531
19532 static inline uint64_t CResult_BlindedPayInfoDecodeErrorZ_clone_ptr(LDKCResult_BlindedPayInfoDecodeErrorZ *NONNULL_PTR arg) {
19533         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
19534         *ret_conv = CResult_BlindedPayInfoDecodeErrorZ_clone(arg);
19535         return tag_ptr(ret_conv, true);
19536 }
19537 int64_t  CS_LDK_CResult_BlindedPayInfoDecodeErrorZ_clone_ptr(int64_t arg) {
19538         LDKCResult_BlindedPayInfoDecodeErrorZ* arg_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(arg);
19539         int64_t ret_conv = CResult_BlindedPayInfoDecodeErrorZ_clone_ptr(arg_conv);
19540         return ret_conv;
19541 }
19542
19543 int64_t  CS_LDK_CResult_BlindedPayInfoDecodeErrorZ_clone(int64_t orig) {
19544         LDKCResult_BlindedPayInfoDecodeErrorZ* orig_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(orig);
19545         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
19546         *ret_conv = CResult_BlindedPayInfoDecodeErrorZ_clone(orig_conv);
19547         return tag_ptr(ret_conv, true);
19548 }
19549
19550 int64_t  CS_LDK_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(int64_t o) {
19551         LDKDelayedPaymentOutputDescriptor o_conv;
19552         o_conv.inner = untag_ptr(o);
19553         o_conv.is_owned = ptr_is_owned(o);
19554         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19555         o_conv = DelayedPaymentOutputDescriptor_clone(&o_conv);
19556         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
19557         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
19558         return tag_ptr(ret_conv, true);
19559 }
19560
19561 int64_t  CS_LDK_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(int64_t e) {
19562         void* e_ptr = untag_ptr(e);
19563         CHECK_ACCESS(e_ptr);
19564         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19565         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19566         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
19567         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
19568         return tag_ptr(ret_conv, true);
19569 }
19570
19571 jboolean  CS_LDK_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(int64_t o) {
19572         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(o);
19573         jboolean ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
19574         return ret_conv;
19575 }
19576
19577 void  CS_LDK_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(int64_t _res) {
19578         if (!ptr_is_owned(_res)) return;
19579         void* _res_ptr = untag_ptr(_res);
19580         CHECK_ACCESS(_res_ptr);
19581         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
19582         FREE(untag_ptr(_res));
19583         CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
19584 }
19585
19586 static inline uint64_t CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
19587         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
19588         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(arg);
19589         return tag_ptr(ret_conv, true);
19590 }
19591 int64_t  CS_LDK_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(int64_t arg) {
19592         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
19593         int64_t ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
19594         return ret_conv;
19595 }
19596
19597 int64_t  CS_LDK_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(int64_t orig) {
19598         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
19599         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
19600         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
19601         return tag_ptr(ret_conv, true);
19602 }
19603
19604 int64_t  CS_LDK_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(int64_t o) {
19605         LDKStaticPaymentOutputDescriptor o_conv;
19606         o_conv.inner = untag_ptr(o);
19607         o_conv.is_owned = ptr_is_owned(o);
19608         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19609         o_conv = StaticPaymentOutputDescriptor_clone(&o_conv);
19610         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
19611         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
19612         return tag_ptr(ret_conv, true);
19613 }
19614
19615 int64_t  CS_LDK_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(int64_t e) {
19616         void* e_ptr = untag_ptr(e);
19617         CHECK_ACCESS(e_ptr);
19618         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19619         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19620         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
19621         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
19622         return tag_ptr(ret_conv, true);
19623 }
19624
19625 jboolean  CS_LDK_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(int64_t o) {
19626         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(o);
19627         jboolean ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
19628         return ret_conv;
19629 }
19630
19631 void  CS_LDK_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(int64_t _res) {
19632         if (!ptr_is_owned(_res)) return;
19633         void* _res_ptr = untag_ptr(_res);
19634         CHECK_ACCESS(_res_ptr);
19635         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
19636         FREE(untag_ptr(_res));
19637         CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
19638 }
19639
19640 static inline uint64_t CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
19641         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
19642         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(arg);
19643         return tag_ptr(ret_conv, true);
19644 }
19645 int64_t  CS_LDK_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(int64_t arg) {
19646         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
19647         int64_t ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
19648         return ret_conv;
19649 }
19650
19651 int64_t  CS_LDK_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(int64_t orig) {
19652         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
19653         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
19654         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
19655         return tag_ptr(ret_conv, true);
19656 }
19657
19658 int64_t  CS_LDK_CResult_SpendableOutputDescriptorDecodeErrorZ_ok(int64_t o) {
19659         void* o_ptr = untag_ptr(o);
19660         CHECK_ACCESS(o_ptr);
19661         LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)(o_ptr);
19662         o_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(o));
19663         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
19664         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
19665         return tag_ptr(ret_conv, true);
19666 }
19667
19668 int64_t  CS_LDK_CResult_SpendableOutputDescriptorDecodeErrorZ_err(int64_t e) {
19669         void* e_ptr = untag_ptr(e);
19670         CHECK_ACCESS(e_ptr);
19671         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19672         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19673         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
19674         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_err(e_conv);
19675         return tag_ptr(ret_conv, true);
19676 }
19677
19678 jboolean  CS_LDK_CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(int64_t o) {
19679         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(o);
19680         jboolean ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o_conv);
19681         return ret_conv;
19682 }
19683
19684 void  CS_LDK_CResult_SpendableOutputDescriptorDecodeErrorZ_free(int64_t _res) {
19685         if (!ptr_is_owned(_res)) return;
19686         void* _res_ptr = untag_ptr(_res);
19687         CHECK_ACCESS(_res_ptr);
19688         LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(_res_ptr);
19689         FREE(untag_ptr(_res));
19690         CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res_conv);
19691 }
19692
19693 static inline uint64_t CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
19694         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
19695         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(arg);
19696         return tag_ptr(ret_conv, true);
19697 }
19698 int64_t  CS_LDK_CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(int64_t arg) {
19699         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
19700         int64_t ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
19701         return ret_conv;
19702 }
19703
19704 int64_t  CS_LDK_CResult_SpendableOutputDescriptorDecodeErrorZ_clone(int64_t orig) {
19705         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
19706         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
19707         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig_conv);
19708         return tag_ptr(ret_conv, true);
19709 }
19710
19711 void  CS_LDK_CVec_SpendableOutputDescriptorZ_free(int64_tArray _res) {
19712         LDKCVec_SpendableOutputDescriptorZ _res_constr;
19713         _res_constr.datalen = _res->arr_len;
19714         if (_res_constr.datalen > 0)
19715                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
19716         else
19717                 _res_constr.data = NULL;
19718         int64_t* _res_vals = _res->elems;
19719         for (size_t b = 0; b < _res_constr.datalen; b++) {
19720                 int64_t _res_conv_27 = _res_vals[b];
19721                 void* _res_conv_27_ptr = untag_ptr(_res_conv_27);
19722                 CHECK_ACCESS(_res_conv_27_ptr);
19723                 LDKSpendableOutputDescriptor _res_conv_27_conv = *(LDKSpendableOutputDescriptor*)(_res_conv_27_ptr);
19724                 FREE(untag_ptr(_res_conv_27));
19725                 _res_constr.data[b] = _res_conv_27_conv;
19726         }
19727         FREE(_res);
19728         CVec_SpendableOutputDescriptorZ_free(_res_constr);
19729 }
19730
19731 void  CS_LDK_CVec_TxOutZ_free(int64_tArray _res) {
19732         LDKCVec_TxOutZ _res_constr;
19733         _res_constr.datalen = _res->arr_len;
19734         if (_res_constr.datalen > 0)
19735                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
19736         else
19737                 _res_constr.data = NULL;
19738         int64_t* _res_vals = _res->elems;
19739         for (size_t h = 0; h < _res_constr.datalen; h++) {
19740                 int64_t _res_conv_7 = _res_vals[h];
19741                 void* _res_conv_7_ptr = untag_ptr(_res_conv_7);
19742                 CHECK_ACCESS(_res_conv_7_ptr);
19743                 LDKTxOut _res_conv_7_conv = *(LDKTxOut*)(_res_conv_7_ptr);
19744                 FREE(untag_ptr(_res_conv_7));
19745                 _res_constr.data[h] = _res_conv_7_conv;
19746         }
19747         FREE(_res);
19748         CVec_TxOutZ_free(_res_constr);
19749 }
19750
19751 int64_t  CS_LDK_COption_u32Z_some(int32_t o) {
19752         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
19753         *ret_copy = COption_u32Z_some(o);
19754         int64_t ret_ref = tag_ptr(ret_copy, true);
19755         return ret_ref;
19756 }
19757
19758 int64_t  CS_LDK_COption_u32Z_none() {
19759         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
19760         *ret_copy = COption_u32Z_none();
19761         int64_t ret_ref = tag_ptr(ret_copy, true);
19762         return ret_ref;
19763 }
19764
19765 void  CS_LDK_COption_u32Z_free(int64_t _res) {
19766         if (!ptr_is_owned(_res)) return;
19767         void* _res_ptr = untag_ptr(_res);
19768         CHECK_ACCESS(_res_ptr);
19769         LDKCOption_u32Z _res_conv = *(LDKCOption_u32Z*)(_res_ptr);
19770         FREE(untag_ptr(_res));
19771         COption_u32Z_free(_res_conv);
19772 }
19773
19774 static inline uint64_t COption_u32Z_clone_ptr(LDKCOption_u32Z *NONNULL_PTR arg) {
19775         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
19776         *ret_copy = COption_u32Z_clone(arg);
19777         int64_t ret_ref = tag_ptr(ret_copy, true);
19778         return ret_ref;
19779 }
19780 int64_t  CS_LDK_COption_u32Z_clone_ptr(int64_t arg) {
19781         LDKCOption_u32Z* arg_conv = (LDKCOption_u32Z*)untag_ptr(arg);
19782         int64_t ret_conv = COption_u32Z_clone_ptr(arg_conv);
19783         return ret_conv;
19784 }
19785
19786 int64_t  CS_LDK_COption_u32Z_clone(int64_t orig) {
19787         LDKCOption_u32Z* orig_conv = (LDKCOption_u32Z*)untag_ptr(orig);
19788         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
19789         *ret_copy = COption_u32Z_clone(orig_conv);
19790         int64_t ret_ref = tag_ptr(ret_copy, true);
19791         return ret_ref;
19792 }
19793
19794 static inline uint64_t C2Tuple_CVec_u8Zu64Z_clone_ptr(LDKC2Tuple_CVec_u8Zu64Z *NONNULL_PTR arg) {
19795         LDKC2Tuple_CVec_u8Zu64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_CVec_u8Zu64Z), "LDKC2Tuple_CVec_u8Zu64Z");
19796         *ret_conv = C2Tuple_CVec_u8Zu64Z_clone(arg);
19797         return tag_ptr(ret_conv, true);
19798 }
19799 int64_t  CS_LDK_C2Tuple_CVec_u8Zu64Z_clone_ptr(int64_t arg) {
19800         LDKC2Tuple_CVec_u8Zu64Z* arg_conv = (LDKC2Tuple_CVec_u8Zu64Z*)untag_ptr(arg);
19801         int64_t ret_conv = C2Tuple_CVec_u8Zu64Z_clone_ptr(arg_conv);
19802         return ret_conv;
19803 }
19804
19805 int64_t  CS_LDK_C2Tuple_CVec_u8Zu64Z_clone(int64_t orig) {
19806         LDKC2Tuple_CVec_u8Zu64Z* orig_conv = (LDKC2Tuple_CVec_u8Zu64Z*)untag_ptr(orig);
19807         LDKC2Tuple_CVec_u8Zu64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_CVec_u8Zu64Z), "LDKC2Tuple_CVec_u8Zu64Z");
19808         *ret_conv = C2Tuple_CVec_u8Zu64Z_clone(orig_conv);
19809         return tag_ptr(ret_conv, true);
19810 }
19811
19812 int64_t  CS_LDK_C2Tuple_CVec_u8Zu64Z_new(int8_tArray a, int64_t b) {
19813         LDKCVec_u8Z a_ref;
19814         a_ref.datalen = a->arr_len;
19815         a_ref.data = MALLOC(a_ref.datalen, "LDKCVec_u8Z Bytes");
19816         memcpy(a_ref.data, a->elems, a_ref.datalen); FREE(a);
19817         LDKC2Tuple_CVec_u8Zu64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_CVec_u8Zu64Z), "LDKC2Tuple_CVec_u8Zu64Z");
19818         *ret_conv = C2Tuple_CVec_u8Zu64Z_new(a_ref, b);
19819         return tag_ptr(ret_conv, true);
19820 }
19821
19822 void  CS_LDK_C2Tuple_CVec_u8Zu64Z_free(int64_t _res) {
19823         if (!ptr_is_owned(_res)) return;
19824         void* _res_ptr = untag_ptr(_res);
19825         CHECK_ACCESS(_res_ptr);
19826         LDKC2Tuple_CVec_u8Zu64Z _res_conv = *(LDKC2Tuple_CVec_u8Zu64Z*)(_res_ptr);
19827         FREE(untag_ptr(_res));
19828         C2Tuple_CVec_u8Zu64Z_free(_res_conv);
19829 }
19830
19831 int64_t  CS_LDK_CResult_C2Tuple_CVec_u8Zu64ZNoneZ_ok(int64_t o) {
19832         void* o_ptr = untag_ptr(o);
19833         CHECK_ACCESS(o_ptr);
19834         LDKC2Tuple_CVec_u8Zu64Z o_conv = *(LDKC2Tuple_CVec_u8Zu64Z*)(o_ptr);
19835         o_conv = C2Tuple_CVec_u8Zu64Z_clone((LDKC2Tuple_CVec_u8Zu64Z*)untag_ptr(o));
19836         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ), "LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ");
19837         *ret_conv = CResult_C2Tuple_CVec_u8Zu64ZNoneZ_ok(o_conv);
19838         return tag_ptr(ret_conv, true);
19839 }
19840
19841 int64_t  CS_LDK_CResult_C2Tuple_CVec_u8Zu64ZNoneZ_err() {
19842         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ), "LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ");
19843         *ret_conv = CResult_C2Tuple_CVec_u8Zu64ZNoneZ_err();
19844         return tag_ptr(ret_conv, true);
19845 }
19846
19847 jboolean  CS_LDK_CResult_C2Tuple_CVec_u8Zu64ZNoneZ_is_ok(int64_t o) {
19848         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* o_conv = (LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ*)untag_ptr(o);
19849         jboolean ret_conv = CResult_C2Tuple_CVec_u8Zu64ZNoneZ_is_ok(o_conv);
19850         return ret_conv;
19851 }
19852
19853 void  CS_LDK_CResult_C2Tuple_CVec_u8Zu64ZNoneZ_free(int64_t _res) {
19854         if (!ptr_is_owned(_res)) return;
19855         void* _res_ptr = untag_ptr(_res);
19856         CHECK_ACCESS(_res_ptr);
19857         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ _res_conv = *(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ*)(_res_ptr);
19858         FREE(untag_ptr(_res));
19859         CResult_C2Tuple_CVec_u8Zu64ZNoneZ_free(_res_conv);
19860 }
19861
19862 static inline uint64_t CResult_C2Tuple_CVec_u8Zu64ZNoneZ_clone_ptr(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ *NONNULL_PTR arg) {
19863         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ), "LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ");
19864         *ret_conv = CResult_C2Tuple_CVec_u8Zu64ZNoneZ_clone(arg);
19865         return tag_ptr(ret_conv, true);
19866 }
19867 int64_t  CS_LDK_CResult_C2Tuple_CVec_u8Zu64ZNoneZ_clone_ptr(int64_t arg) {
19868         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* arg_conv = (LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ*)untag_ptr(arg);
19869         int64_t ret_conv = CResult_C2Tuple_CVec_u8Zu64ZNoneZ_clone_ptr(arg_conv);
19870         return ret_conv;
19871 }
19872
19873 int64_t  CS_LDK_CResult_C2Tuple_CVec_u8Zu64ZNoneZ_clone(int64_t orig) {
19874         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* orig_conv = (LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ*)untag_ptr(orig);
19875         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ), "LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ");
19876         *ret_conv = CResult_C2Tuple_CVec_u8Zu64ZNoneZ_clone(orig_conv);
19877         return tag_ptr(ret_conv, true);
19878 }
19879
19880 int64_t  CS_LDK_CResult_ChannelDerivationParametersDecodeErrorZ_ok(int64_t o) {
19881         LDKChannelDerivationParameters o_conv;
19882         o_conv.inner = untag_ptr(o);
19883         o_conv.is_owned = ptr_is_owned(o);
19884         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19885         o_conv = ChannelDerivationParameters_clone(&o_conv);
19886         LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ");
19887         *ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_ok(o_conv);
19888         return tag_ptr(ret_conv, true);
19889 }
19890
19891 int64_t  CS_LDK_CResult_ChannelDerivationParametersDecodeErrorZ_err(int64_t e) {
19892         void* e_ptr = untag_ptr(e);
19893         CHECK_ACCESS(e_ptr);
19894         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19895         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19896         LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ");
19897         *ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_err(e_conv);
19898         return tag_ptr(ret_conv, true);
19899 }
19900
19901 jboolean  CS_LDK_CResult_ChannelDerivationParametersDecodeErrorZ_is_ok(int64_t o) {
19902         LDKCResult_ChannelDerivationParametersDecodeErrorZ* o_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(o);
19903         jboolean ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_is_ok(o_conv);
19904         return ret_conv;
19905 }
19906
19907 void  CS_LDK_CResult_ChannelDerivationParametersDecodeErrorZ_free(int64_t _res) {
19908         if (!ptr_is_owned(_res)) return;
19909         void* _res_ptr = untag_ptr(_res);
19910         CHECK_ACCESS(_res_ptr);
19911         LDKCResult_ChannelDerivationParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelDerivationParametersDecodeErrorZ*)(_res_ptr);
19912         FREE(untag_ptr(_res));
19913         CResult_ChannelDerivationParametersDecodeErrorZ_free(_res_conv);
19914 }
19915
19916 static inline uint64_t CResult_ChannelDerivationParametersDecodeErrorZ_clone_ptr(LDKCResult_ChannelDerivationParametersDecodeErrorZ *NONNULL_PTR arg) {
19917         LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ");
19918         *ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_clone(arg);
19919         return tag_ptr(ret_conv, true);
19920 }
19921 int64_t  CS_LDK_CResult_ChannelDerivationParametersDecodeErrorZ_clone_ptr(int64_t arg) {
19922         LDKCResult_ChannelDerivationParametersDecodeErrorZ* arg_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(arg);
19923         int64_t ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_clone_ptr(arg_conv);
19924         return ret_conv;
19925 }
19926
19927 int64_t  CS_LDK_CResult_ChannelDerivationParametersDecodeErrorZ_clone(int64_t orig) {
19928         LDKCResult_ChannelDerivationParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(orig);
19929         LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ");
19930         *ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_clone(orig_conv);
19931         return tag_ptr(ret_conv, true);
19932 }
19933
19934 int64_t  CS_LDK_CResult_HTLCDescriptorDecodeErrorZ_ok(int64_t o) {
19935         LDKHTLCDescriptor o_conv;
19936         o_conv.inner = untag_ptr(o);
19937         o_conv.is_owned = ptr_is_owned(o);
19938         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19939         o_conv = HTLCDescriptor_clone(&o_conv);
19940         LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ");
19941         *ret_conv = CResult_HTLCDescriptorDecodeErrorZ_ok(o_conv);
19942         return tag_ptr(ret_conv, true);
19943 }
19944
19945 int64_t  CS_LDK_CResult_HTLCDescriptorDecodeErrorZ_err(int64_t e) {
19946         void* e_ptr = untag_ptr(e);
19947         CHECK_ACCESS(e_ptr);
19948         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19949         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19950         LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ");
19951         *ret_conv = CResult_HTLCDescriptorDecodeErrorZ_err(e_conv);
19952         return tag_ptr(ret_conv, true);
19953 }
19954
19955 jboolean  CS_LDK_CResult_HTLCDescriptorDecodeErrorZ_is_ok(int64_t o) {
19956         LDKCResult_HTLCDescriptorDecodeErrorZ* o_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(o);
19957         jboolean ret_conv = CResult_HTLCDescriptorDecodeErrorZ_is_ok(o_conv);
19958         return ret_conv;
19959 }
19960
19961 void  CS_LDK_CResult_HTLCDescriptorDecodeErrorZ_free(int64_t _res) {
19962         if (!ptr_is_owned(_res)) return;
19963         void* _res_ptr = untag_ptr(_res);
19964         CHECK_ACCESS(_res_ptr);
19965         LDKCResult_HTLCDescriptorDecodeErrorZ _res_conv = *(LDKCResult_HTLCDescriptorDecodeErrorZ*)(_res_ptr);
19966         FREE(untag_ptr(_res));
19967         CResult_HTLCDescriptorDecodeErrorZ_free(_res_conv);
19968 }
19969
19970 static inline uint64_t CResult_HTLCDescriptorDecodeErrorZ_clone_ptr(LDKCResult_HTLCDescriptorDecodeErrorZ *NONNULL_PTR arg) {
19971         LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ");
19972         *ret_conv = CResult_HTLCDescriptorDecodeErrorZ_clone(arg);
19973         return tag_ptr(ret_conv, true);
19974 }
19975 int64_t  CS_LDK_CResult_HTLCDescriptorDecodeErrorZ_clone_ptr(int64_t arg) {
19976         LDKCResult_HTLCDescriptorDecodeErrorZ* arg_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(arg);
19977         int64_t ret_conv = CResult_HTLCDescriptorDecodeErrorZ_clone_ptr(arg_conv);
19978         return ret_conv;
19979 }
19980
19981 int64_t  CS_LDK_CResult_HTLCDescriptorDecodeErrorZ_clone(int64_t orig) {
19982         LDKCResult_HTLCDescriptorDecodeErrorZ* orig_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(orig);
19983         LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ");
19984         *ret_conv = CResult_HTLCDescriptorDecodeErrorZ_clone(orig_conv);
19985         return tag_ptr(ret_conv, true);
19986 }
19987
19988 int64_t  CS_LDK_CResult_NoneNoneZ_ok() {
19989         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
19990         *ret_conv = CResult_NoneNoneZ_ok();
19991         return tag_ptr(ret_conv, true);
19992 }
19993
19994 int64_t  CS_LDK_CResult_NoneNoneZ_err() {
19995         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
19996         *ret_conv = CResult_NoneNoneZ_err();
19997         return tag_ptr(ret_conv, true);
19998 }
19999
20000 jboolean  CS_LDK_CResult_NoneNoneZ_is_ok(int64_t o) {
20001         LDKCResult_NoneNoneZ* o_conv = (LDKCResult_NoneNoneZ*)untag_ptr(o);
20002         jboolean ret_conv = CResult_NoneNoneZ_is_ok(o_conv);
20003         return ret_conv;
20004 }
20005
20006 void  CS_LDK_CResult_NoneNoneZ_free(int64_t _res) {
20007         if (!ptr_is_owned(_res)) return;
20008         void* _res_ptr = untag_ptr(_res);
20009         CHECK_ACCESS(_res_ptr);
20010         LDKCResult_NoneNoneZ _res_conv = *(LDKCResult_NoneNoneZ*)(_res_ptr);
20011         FREE(untag_ptr(_res));
20012         CResult_NoneNoneZ_free(_res_conv);
20013 }
20014
20015 static inline uint64_t CResult_NoneNoneZ_clone_ptr(LDKCResult_NoneNoneZ *NONNULL_PTR arg) {
20016         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
20017         *ret_conv = CResult_NoneNoneZ_clone(arg);
20018         return tag_ptr(ret_conv, true);
20019 }
20020 int64_t  CS_LDK_CResult_NoneNoneZ_clone_ptr(int64_t arg) {
20021         LDKCResult_NoneNoneZ* arg_conv = (LDKCResult_NoneNoneZ*)untag_ptr(arg);
20022         int64_t ret_conv = CResult_NoneNoneZ_clone_ptr(arg_conv);
20023         return ret_conv;
20024 }
20025
20026 int64_t  CS_LDK_CResult_NoneNoneZ_clone(int64_t orig) {
20027         LDKCResult_NoneNoneZ* orig_conv = (LDKCResult_NoneNoneZ*)untag_ptr(orig);
20028         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
20029         *ret_conv = CResult_NoneNoneZ_clone(orig_conv);
20030         return tag_ptr(ret_conv, true);
20031 }
20032
20033 int64_t  CS_LDK_CResult_PublicKeyNoneZ_ok(int8_tArray o) {
20034         LDKPublicKey o_ref;
20035         CHECK(o->arr_len == 33);
20036         memcpy(o_ref.compressed_form, o->elems, 33); FREE(o);
20037         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
20038         *ret_conv = CResult_PublicKeyNoneZ_ok(o_ref);
20039         return tag_ptr(ret_conv, true);
20040 }
20041
20042 int64_t  CS_LDK_CResult_PublicKeyNoneZ_err() {
20043         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
20044         *ret_conv = CResult_PublicKeyNoneZ_err();
20045         return tag_ptr(ret_conv, true);
20046 }
20047
20048 jboolean  CS_LDK_CResult_PublicKeyNoneZ_is_ok(int64_t o) {
20049         LDKCResult_PublicKeyNoneZ* o_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(o);
20050         jboolean ret_conv = CResult_PublicKeyNoneZ_is_ok(o_conv);
20051         return ret_conv;
20052 }
20053
20054 void  CS_LDK_CResult_PublicKeyNoneZ_free(int64_t _res) {
20055         if (!ptr_is_owned(_res)) return;
20056         void* _res_ptr = untag_ptr(_res);
20057         CHECK_ACCESS(_res_ptr);
20058         LDKCResult_PublicKeyNoneZ _res_conv = *(LDKCResult_PublicKeyNoneZ*)(_res_ptr);
20059         FREE(untag_ptr(_res));
20060         CResult_PublicKeyNoneZ_free(_res_conv);
20061 }
20062
20063 static inline uint64_t CResult_PublicKeyNoneZ_clone_ptr(LDKCResult_PublicKeyNoneZ *NONNULL_PTR arg) {
20064         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
20065         *ret_conv = CResult_PublicKeyNoneZ_clone(arg);
20066         return tag_ptr(ret_conv, true);
20067 }
20068 int64_t  CS_LDK_CResult_PublicKeyNoneZ_clone_ptr(int64_t arg) {
20069         LDKCResult_PublicKeyNoneZ* arg_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(arg);
20070         int64_t ret_conv = CResult_PublicKeyNoneZ_clone_ptr(arg_conv);
20071         return ret_conv;
20072 }
20073
20074 int64_t  CS_LDK_CResult_PublicKeyNoneZ_clone(int64_t orig) {
20075         LDKCResult_PublicKeyNoneZ* orig_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(orig);
20076         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
20077         *ret_conv = CResult_PublicKeyNoneZ_clone(orig_conv);
20078         return tag_ptr(ret_conv, true);
20079 }
20080
20081 int64_t  CS_LDK_COption_BigEndianScalarZ_some(int64_t o) {
20082         void* o_ptr = untag_ptr(o);
20083         CHECK_ACCESS(o_ptr);
20084         LDKBigEndianScalar o_conv = *(LDKBigEndianScalar*)(o_ptr);
20085         o_conv = BigEndianScalar_clone((LDKBigEndianScalar*)untag_ptr(o));
20086         LDKCOption_BigEndianScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_BigEndianScalarZ), "LDKCOption_BigEndianScalarZ");
20087         *ret_copy = COption_BigEndianScalarZ_some(o_conv);
20088         int64_t ret_ref = tag_ptr(ret_copy, true);
20089         return ret_ref;
20090 }
20091
20092 int64_t  CS_LDK_COption_BigEndianScalarZ_none() {
20093         LDKCOption_BigEndianScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_BigEndianScalarZ), "LDKCOption_BigEndianScalarZ");
20094         *ret_copy = COption_BigEndianScalarZ_none();
20095         int64_t ret_ref = tag_ptr(ret_copy, true);
20096         return ret_ref;
20097 }
20098
20099 void  CS_LDK_COption_BigEndianScalarZ_free(int64_t _res) {
20100         if (!ptr_is_owned(_res)) return;
20101         void* _res_ptr = untag_ptr(_res);
20102         CHECK_ACCESS(_res_ptr);
20103         LDKCOption_BigEndianScalarZ _res_conv = *(LDKCOption_BigEndianScalarZ*)(_res_ptr);
20104         FREE(untag_ptr(_res));
20105         COption_BigEndianScalarZ_free(_res_conv);
20106 }
20107
20108 static inline uint64_t COption_BigEndianScalarZ_clone_ptr(LDKCOption_BigEndianScalarZ *NONNULL_PTR arg) {
20109         LDKCOption_BigEndianScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_BigEndianScalarZ), "LDKCOption_BigEndianScalarZ");
20110         *ret_copy = COption_BigEndianScalarZ_clone(arg);
20111         int64_t ret_ref = tag_ptr(ret_copy, true);
20112         return ret_ref;
20113 }
20114 int64_t  CS_LDK_COption_BigEndianScalarZ_clone_ptr(int64_t arg) {
20115         LDKCOption_BigEndianScalarZ* arg_conv = (LDKCOption_BigEndianScalarZ*)untag_ptr(arg);
20116         int64_t ret_conv = COption_BigEndianScalarZ_clone_ptr(arg_conv);
20117         return ret_conv;
20118 }
20119
20120 int64_t  CS_LDK_COption_BigEndianScalarZ_clone(int64_t orig) {
20121         LDKCOption_BigEndianScalarZ* orig_conv = (LDKCOption_BigEndianScalarZ*)untag_ptr(orig);
20122         LDKCOption_BigEndianScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_BigEndianScalarZ), "LDKCOption_BigEndianScalarZ");
20123         *ret_copy = COption_BigEndianScalarZ_clone(orig_conv);
20124         int64_t ret_ref = tag_ptr(ret_copy, true);
20125         return ret_ref;
20126 }
20127
20128 void  CS_LDK_CVec_U5Z_free(ptrArray _res) {
20129         LDKCVec_U5Z _res_constr;
20130         _res_constr.datalen = _res->arr_len;
20131         if (_res_constr.datalen > 0)
20132                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKU5), "LDKCVec_U5Z Elements");
20133         else
20134                 _res_constr.data = NULL;
20135         int8_t* _res_vals = (void*) _res->elems;
20136         for (size_t h = 0; h < _res_constr.datalen; h++) {
20137                 int8_t _res_conv_7 = _res_vals[h];
20138                 
20139                 _res_constr.data[h] = (LDKU5){ ._0 = _res_conv_7 };
20140         }
20141         FREE(_res);
20142         CVec_U5Z_free(_res_constr);
20143 }
20144
20145 int64_t  CS_LDK_CResult_RecoverableSignatureNoneZ_ok(int8_tArray o) {
20146         LDKRecoverableSignature o_ref;
20147         CHECK(o->arr_len == 68);
20148         memcpy(o_ref.serialized_form, o->elems, 68); FREE(o);
20149         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
20150         *ret_conv = CResult_RecoverableSignatureNoneZ_ok(o_ref);
20151         return tag_ptr(ret_conv, true);
20152 }
20153
20154 int64_t  CS_LDK_CResult_RecoverableSignatureNoneZ_err() {
20155         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
20156         *ret_conv = CResult_RecoverableSignatureNoneZ_err();
20157         return tag_ptr(ret_conv, true);
20158 }
20159
20160 jboolean  CS_LDK_CResult_RecoverableSignatureNoneZ_is_ok(int64_t o) {
20161         LDKCResult_RecoverableSignatureNoneZ* o_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(o);
20162         jboolean ret_conv = CResult_RecoverableSignatureNoneZ_is_ok(o_conv);
20163         return ret_conv;
20164 }
20165
20166 void  CS_LDK_CResult_RecoverableSignatureNoneZ_free(int64_t _res) {
20167         if (!ptr_is_owned(_res)) return;
20168         void* _res_ptr = untag_ptr(_res);
20169         CHECK_ACCESS(_res_ptr);
20170         LDKCResult_RecoverableSignatureNoneZ _res_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(_res_ptr);
20171         FREE(untag_ptr(_res));
20172         CResult_RecoverableSignatureNoneZ_free(_res_conv);
20173 }
20174
20175 static inline uint64_t CResult_RecoverableSignatureNoneZ_clone_ptr(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR arg) {
20176         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
20177         *ret_conv = CResult_RecoverableSignatureNoneZ_clone(arg);
20178         return tag_ptr(ret_conv, true);
20179 }
20180 int64_t  CS_LDK_CResult_RecoverableSignatureNoneZ_clone_ptr(int64_t arg) {
20181         LDKCResult_RecoverableSignatureNoneZ* arg_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(arg);
20182         int64_t ret_conv = CResult_RecoverableSignatureNoneZ_clone_ptr(arg_conv);
20183         return ret_conv;
20184 }
20185
20186 int64_t  CS_LDK_CResult_RecoverableSignatureNoneZ_clone(int64_t orig) {
20187         LDKCResult_RecoverableSignatureNoneZ* orig_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(orig);
20188         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
20189         *ret_conv = CResult_RecoverableSignatureNoneZ_clone(orig_conv);
20190         return tag_ptr(ret_conv, true);
20191 }
20192
20193 int64_t  CS_LDK_CResult_ECDSASignatureNoneZ_ok(int8_tArray o) {
20194         LDKECDSASignature o_ref;
20195         CHECK(o->arr_len == 64);
20196         memcpy(o_ref.compact_form, o->elems, 64); FREE(o);
20197         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
20198         *ret_conv = CResult_ECDSASignatureNoneZ_ok(o_ref);
20199         return tag_ptr(ret_conv, true);
20200 }
20201
20202 int64_t  CS_LDK_CResult_ECDSASignatureNoneZ_err() {
20203         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
20204         *ret_conv = CResult_ECDSASignatureNoneZ_err();
20205         return tag_ptr(ret_conv, true);
20206 }
20207
20208 jboolean  CS_LDK_CResult_ECDSASignatureNoneZ_is_ok(int64_t o) {
20209         LDKCResult_ECDSASignatureNoneZ* o_conv = (LDKCResult_ECDSASignatureNoneZ*)untag_ptr(o);
20210         jboolean ret_conv = CResult_ECDSASignatureNoneZ_is_ok(o_conv);
20211         return ret_conv;
20212 }
20213
20214 void  CS_LDK_CResult_ECDSASignatureNoneZ_free(int64_t _res) {
20215         if (!ptr_is_owned(_res)) return;
20216         void* _res_ptr = untag_ptr(_res);
20217         CHECK_ACCESS(_res_ptr);
20218         LDKCResult_ECDSASignatureNoneZ _res_conv = *(LDKCResult_ECDSASignatureNoneZ*)(_res_ptr);
20219         FREE(untag_ptr(_res));
20220         CResult_ECDSASignatureNoneZ_free(_res_conv);
20221 }
20222
20223 static inline uint64_t CResult_ECDSASignatureNoneZ_clone_ptr(LDKCResult_ECDSASignatureNoneZ *NONNULL_PTR arg) {
20224         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
20225         *ret_conv = CResult_ECDSASignatureNoneZ_clone(arg);
20226         return tag_ptr(ret_conv, true);
20227 }
20228 int64_t  CS_LDK_CResult_ECDSASignatureNoneZ_clone_ptr(int64_t arg) {
20229         LDKCResult_ECDSASignatureNoneZ* arg_conv = (LDKCResult_ECDSASignatureNoneZ*)untag_ptr(arg);
20230         int64_t ret_conv = CResult_ECDSASignatureNoneZ_clone_ptr(arg_conv);
20231         return ret_conv;
20232 }
20233
20234 int64_t  CS_LDK_CResult_ECDSASignatureNoneZ_clone(int64_t orig) {
20235         LDKCResult_ECDSASignatureNoneZ* orig_conv = (LDKCResult_ECDSASignatureNoneZ*)untag_ptr(orig);
20236         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
20237         *ret_conv = CResult_ECDSASignatureNoneZ_clone(orig_conv);
20238         return tag_ptr(ret_conv, true);
20239 }
20240
20241 int64_t  CS_LDK_CResult_TransactionNoneZ_ok(int8_tArray o) {
20242         LDKTransaction o_ref;
20243         o_ref.datalen = o->arr_len;
20244         o_ref.data = MALLOC(o_ref.datalen, "LDKTransaction Bytes");
20245         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
20246         o_ref.data_is_owned = true;
20247         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
20248         *ret_conv = CResult_TransactionNoneZ_ok(o_ref);
20249         return tag_ptr(ret_conv, true);
20250 }
20251
20252 int64_t  CS_LDK_CResult_TransactionNoneZ_err() {
20253         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
20254         *ret_conv = CResult_TransactionNoneZ_err();
20255         return tag_ptr(ret_conv, true);
20256 }
20257
20258 jboolean  CS_LDK_CResult_TransactionNoneZ_is_ok(int64_t o) {
20259         LDKCResult_TransactionNoneZ* o_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(o);
20260         jboolean ret_conv = CResult_TransactionNoneZ_is_ok(o_conv);
20261         return ret_conv;
20262 }
20263
20264 void  CS_LDK_CResult_TransactionNoneZ_free(int64_t _res) {
20265         if (!ptr_is_owned(_res)) return;
20266         void* _res_ptr = untag_ptr(_res);
20267         CHECK_ACCESS(_res_ptr);
20268         LDKCResult_TransactionNoneZ _res_conv = *(LDKCResult_TransactionNoneZ*)(_res_ptr);
20269         FREE(untag_ptr(_res));
20270         CResult_TransactionNoneZ_free(_res_conv);
20271 }
20272
20273 static inline uint64_t CResult_TransactionNoneZ_clone_ptr(LDKCResult_TransactionNoneZ *NONNULL_PTR arg) {
20274         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
20275         *ret_conv = CResult_TransactionNoneZ_clone(arg);
20276         return tag_ptr(ret_conv, true);
20277 }
20278 int64_t  CS_LDK_CResult_TransactionNoneZ_clone_ptr(int64_t arg) {
20279         LDKCResult_TransactionNoneZ* arg_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(arg);
20280         int64_t ret_conv = CResult_TransactionNoneZ_clone_ptr(arg_conv);
20281         return ret_conv;
20282 }
20283
20284 int64_t  CS_LDK_CResult_TransactionNoneZ_clone(int64_t orig) {
20285         LDKCResult_TransactionNoneZ* orig_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(orig);
20286         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
20287         *ret_conv = CResult_TransactionNoneZ_clone(orig_conv);
20288         return tag_ptr(ret_conv, true);
20289 }
20290
20291 int64_t  CS_LDK_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_ok(int64_t o) {
20292         void* o_ptr = untag_ptr(o);
20293         CHECK_ACCESS(o_ptr);
20294         LDKWriteableEcdsaChannelSigner o_conv = *(LDKWriteableEcdsaChannelSigner*)(o_ptr);
20295         if (o_conv.free == LDKWriteableEcdsaChannelSigner_JCalls_free) {
20296                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
20297                 LDKWriteableEcdsaChannelSigner_JCalls_cloned(&o_conv);
20298         }
20299         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
20300         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_ok(o_conv);
20301         return tag_ptr(ret_conv, true);
20302 }
20303
20304 int64_t  CS_LDK_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_err(int64_t e) {
20305         void* e_ptr = untag_ptr(e);
20306         CHECK_ACCESS(e_ptr);
20307         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20308         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20309         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
20310         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_err(e_conv);
20311         return tag_ptr(ret_conv, true);
20312 }
20313
20314 jboolean  CS_LDK_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_is_ok(int64_t o) {
20315         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* o_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(o);
20316         jboolean ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_is_ok(o_conv);
20317         return ret_conv;
20318 }
20319
20320 void  CS_LDK_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_free(int64_t _res) {
20321         if (!ptr_is_owned(_res)) return;
20322         void* _res_ptr = untag_ptr(_res);
20323         CHECK_ACCESS(_res_ptr);
20324         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ _res_conv = *(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)(_res_ptr);
20325         FREE(untag_ptr(_res));
20326         CResult_WriteableEcdsaChannelSignerDecodeErrorZ_free(_res_conv);
20327 }
20328
20329 static inline uint64_t CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR arg) {
20330         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
20331         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone(arg);
20332         return tag_ptr(ret_conv, true);
20333 }
20334 int64_t  CS_LDK_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr(int64_t arg) {
20335         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* arg_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(arg);
20336         int64_t ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr(arg_conv);
20337         return ret_conv;
20338 }
20339
20340 int64_t  CS_LDK_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone(int64_t orig) {
20341         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* orig_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(orig);
20342         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
20343         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone(orig_conv);
20344         return tag_ptr(ret_conv, true);
20345 }
20346
20347 int64_t  CS_LDK_CResult_CVec_u8ZNoneZ_ok(int8_tArray o) {
20348         LDKCVec_u8Z o_ref;
20349         o_ref.datalen = o->arr_len;
20350         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
20351         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
20352         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
20353         *ret_conv = CResult_CVec_u8ZNoneZ_ok(o_ref);
20354         return tag_ptr(ret_conv, true);
20355 }
20356
20357 int64_t  CS_LDK_CResult_CVec_u8ZNoneZ_err() {
20358         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
20359         *ret_conv = CResult_CVec_u8ZNoneZ_err();
20360         return tag_ptr(ret_conv, true);
20361 }
20362
20363 jboolean  CS_LDK_CResult_CVec_u8ZNoneZ_is_ok(int64_t o) {
20364         LDKCResult_CVec_u8ZNoneZ* o_conv = (LDKCResult_CVec_u8ZNoneZ*)untag_ptr(o);
20365         jboolean ret_conv = CResult_CVec_u8ZNoneZ_is_ok(o_conv);
20366         return ret_conv;
20367 }
20368
20369 void  CS_LDK_CResult_CVec_u8ZNoneZ_free(int64_t _res) {
20370         if (!ptr_is_owned(_res)) return;
20371         void* _res_ptr = untag_ptr(_res);
20372         CHECK_ACCESS(_res_ptr);
20373         LDKCResult_CVec_u8ZNoneZ _res_conv = *(LDKCResult_CVec_u8ZNoneZ*)(_res_ptr);
20374         FREE(untag_ptr(_res));
20375         CResult_CVec_u8ZNoneZ_free(_res_conv);
20376 }
20377
20378 static inline uint64_t CResult_CVec_u8ZNoneZ_clone_ptr(LDKCResult_CVec_u8ZNoneZ *NONNULL_PTR arg) {
20379         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
20380         *ret_conv = CResult_CVec_u8ZNoneZ_clone(arg);
20381         return tag_ptr(ret_conv, true);
20382 }
20383 int64_t  CS_LDK_CResult_CVec_u8ZNoneZ_clone_ptr(int64_t arg) {
20384         LDKCResult_CVec_u8ZNoneZ* arg_conv = (LDKCResult_CVec_u8ZNoneZ*)untag_ptr(arg);
20385         int64_t ret_conv = CResult_CVec_u8ZNoneZ_clone_ptr(arg_conv);
20386         return ret_conv;
20387 }
20388
20389 int64_t  CS_LDK_CResult_CVec_u8ZNoneZ_clone(int64_t orig) {
20390         LDKCResult_CVec_u8ZNoneZ* orig_conv = (LDKCResult_CVec_u8ZNoneZ*)untag_ptr(orig);
20391         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
20392         *ret_conv = CResult_CVec_u8ZNoneZ_clone(orig_conv);
20393         return tag_ptr(ret_conv, true);
20394 }
20395
20396 int64_t  CS_LDK_CResult_ShutdownScriptNoneZ_ok(int64_t o) {
20397         LDKShutdownScript o_conv;
20398         o_conv.inner = untag_ptr(o);
20399         o_conv.is_owned = ptr_is_owned(o);
20400         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20401         o_conv = ShutdownScript_clone(&o_conv);
20402         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
20403         *ret_conv = CResult_ShutdownScriptNoneZ_ok(o_conv);
20404         return tag_ptr(ret_conv, true);
20405 }
20406
20407 int64_t  CS_LDK_CResult_ShutdownScriptNoneZ_err() {
20408         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
20409         *ret_conv = CResult_ShutdownScriptNoneZ_err();
20410         return tag_ptr(ret_conv, true);
20411 }
20412
20413 jboolean  CS_LDK_CResult_ShutdownScriptNoneZ_is_ok(int64_t o) {
20414         LDKCResult_ShutdownScriptNoneZ* o_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(o);
20415         jboolean ret_conv = CResult_ShutdownScriptNoneZ_is_ok(o_conv);
20416         return ret_conv;
20417 }
20418
20419 void  CS_LDK_CResult_ShutdownScriptNoneZ_free(int64_t _res) {
20420         if (!ptr_is_owned(_res)) return;
20421         void* _res_ptr = untag_ptr(_res);
20422         CHECK_ACCESS(_res_ptr);
20423         LDKCResult_ShutdownScriptNoneZ _res_conv = *(LDKCResult_ShutdownScriptNoneZ*)(_res_ptr);
20424         FREE(untag_ptr(_res));
20425         CResult_ShutdownScriptNoneZ_free(_res_conv);
20426 }
20427
20428 static inline uint64_t CResult_ShutdownScriptNoneZ_clone_ptr(LDKCResult_ShutdownScriptNoneZ *NONNULL_PTR arg) {
20429         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
20430         *ret_conv = CResult_ShutdownScriptNoneZ_clone(arg);
20431         return tag_ptr(ret_conv, true);
20432 }
20433 int64_t  CS_LDK_CResult_ShutdownScriptNoneZ_clone_ptr(int64_t arg) {
20434         LDKCResult_ShutdownScriptNoneZ* arg_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(arg);
20435         int64_t ret_conv = CResult_ShutdownScriptNoneZ_clone_ptr(arg_conv);
20436         return ret_conv;
20437 }
20438
20439 int64_t  CS_LDK_CResult_ShutdownScriptNoneZ_clone(int64_t orig) {
20440         LDKCResult_ShutdownScriptNoneZ* orig_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(orig);
20441         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
20442         *ret_conv = CResult_ShutdownScriptNoneZ_clone(orig_conv);
20443         return tag_ptr(ret_conv, true);
20444 }
20445
20446 int64_t  CS_LDK_COption_u16Z_some(int16_t o) {
20447         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
20448         *ret_copy = COption_u16Z_some(o);
20449         int64_t ret_ref = tag_ptr(ret_copy, true);
20450         return ret_ref;
20451 }
20452
20453 int64_t  CS_LDK_COption_u16Z_none() {
20454         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
20455         *ret_copy = COption_u16Z_none();
20456         int64_t ret_ref = tag_ptr(ret_copy, true);
20457         return ret_ref;
20458 }
20459
20460 void  CS_LDK_COption_u16Z_free(int64_t _res) {
20461         if (!ptr_is_owned(_res)) return;
20462         void* _res_ptr = untag_ptr(_res);
20463         CHECK_ACCESS(_res_ptr);
20464         LDKCOption_u16Z _res_conv = *(LDKCOption_u16Z*)(_res_ptr);
20465         FREE(untag_ptr(_res));
20466         COption_u16Z_free(_res_conv);
20467 }
20468
20469 static inline uint64_t COption_u16Z_clone_ptr(LDKCOption_u16Z *NONNULL_PTR arg) {
20470         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
20471         *ret_copy = COption_u16Z_clone(arg);
20472         int64_t ret_ref = tag_ptr(ret_copy, true);
20473         return ret_ref;
20474 }
20475 int64_t  CS_LDK_COption_u16Z_clone_ptr(int64_t arg) {
20476         LDKCOption_u16Z* arg_conv = (LDKCOption_u16Z*)untag_ptr(arg);
20477         int64_t ret_conv = COption_u16Z_clone_ptr(arg_conv);
20478         return ret_conv;
20479 }
20480
20481 int64_t  CS_LDK_COption_u16Z_clone(int64_t orig) {
20482         LDKCOption_u16Z* orig_conv = (LDKCOption_u16Z*)untag_ptr(orig);
20483         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
20484         *ret_copy = COption_u16Z_clone(orig_conv);
20485         int64_t ret_ref = tag_ptr(ret_copy, true);
20486         return ret_ref;
20487 }
20488
20489 int64_t  CS_LDK_COption_boolZ_some(jboolean o) {
20490         LDKCOption_boolZ *ret_copy = MALLOC(sizeof(LDKCOption_boolZ), "LDKCOption_boolZ");
20491         *ret_copy = COption_boolZ_some(o);
20492         int64_t ret_ref = tag_ptr(ret_copy, true);
20493         return ret_ref;
20494 }
20495
20496 int64_t  CS_LDK_COption_boolZ_none() {
20497         LDKCOption_boolZ *ret_copy = MALLOC(sizeof(LDKCOption_boolZ), "LDKCOption_boolZ");
20498         *ret_copy = COption_boolZ_none();
20499         int64_t ret_ref = tag_ptr(ret_copy, true);
20500         return ret_ref;
20501 }
20502
20503 void  CS_LDK_COption_boolZ_free(int64_t _res) {
20504         if (!ptr_is_owned(_res)) return;
20505         void* _res_ptr = untag_ptr(_res);
20506         CHECK_ACCESS(_res_ptr);
20507         LDKCOption_boolZ _res_conv = *(LDKCOption_boolZ*)(_res_ptr);
20508         FREE(untag_ptr(_res));
20509         COption_boolZ_free(_res_conv);
20510 }
20511
20512 static inline uint64_t COption_boolZ_clone_ptr(LDKCOption_boolZ *NONNULL_PTR arg) {
20513         LDKCOption_boolZ *ret_copy = MALLOC(sizeof(LDKCOption_boolZ), "LDKCOption_boolZ");
20514         *ret_copy = COption_boolZ_clone(arg);
20515         int64_t ret_ref = tag_ptr(ret_copy, true);
20516         return ret_ref;
20517 }
20518 int64_t  CS_LDK_COption_boolZ_clone_ptr(int64_t arg) {
20519         LDKCOption_boolZ* arg_conv = (LDKCOption_boolZ*)untag_ptr(arg);
20520         int64_t ret_conv = COption_boolZ_clone_ptr(arg_conv);
20521         return ret_conv;
20522 }
20523
20524 int64_t  CS_LDK_COption_boolZ_clone(int64_t orig) {
20525         LDKCOption_boolZ* orig_conv = (LDKCOption_boolZ*)untag_ptr(orig);
20526         LDKCOption_boolZ *ret_copy = MALLOC(sizeof(LDKCOption_boolZ), "LDKCOption_boolZ");
20527         *ret_copy = COption_boolZ_clone(orig_conv);
20528         int64_t ret_ref = tag_ptr(ret_copy, true);
20529         return ret_ref;
20530 }
20531
20532 int64_t  CS_LDK_CResult_WitnessNoneZ_ok(int8_tArray o) {
20533         LDKWitness o_ref;
20534         o_ref.datalen = o->arr_len;
20535         o_ref.data = MALLOC(o_ref.datalen, "LDKWitness Bytes");
20536         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
20537         o_ref.data_is_owned = true;
20538         LDKCResult_WitnessNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_WitnessNoneZ), "LDKCResult_WitnessNoneZ");
20539         *ret_conv = CResult_WitnessNoneZ_ok(o_ref);
20540         return tag_ptr(ret_conv, true);
20541 }
20542
20543 int64_t  CS_LDK_CResult_WitnessNoneZ_err() {
20544         LDKCResult_WitnessNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_WitnessNoneZ), "LDKCResult_WitnessNoneZ");
20545         *ret_conv = CResult_WitnessNoneZ_err();
20546         return tag_ptr(ret_conv, true);
20547 }
20548
20549 jboolean  CS_LDK_CResult_WitnessNoneZ_is_ok(int64_t o) {
20550         LDKCResult_WitnessNoneZ* o_conv = (LDKCResult_WitnessNoneZ*)untag_ptr(o);
20551         jboolean ret_conv = CResult_WitnessNoneZ_is_ok(o_conv);
20552         return ret_conv;
20553 }
20554
20555 void  CS_LDK_CResult_WitnessNoneZ_free(int64_t _res) {
20556         if (!ptr_is_owned(_res)) return;
20557         void* _res_ptr = untag_ptr(_res);
20558         CHECK_ACCESS(_res_ptr);
20559         LDKCResult_WitnessNoneZ _res_conv = *(LDKCResult_WitnessNoneZ*)(_res_ptr);
20560         FREE(untag_ptr(_res));
20561         CResult_WitnessNoneZ_free(_res_conv);
20562 }
20563
20564 static inline uint64_t CResult_WitnessNoneZ_clone_ptr(LDKCResult_WitnessNoneZ *NONNULL_PTR arg) {
20565         LDKCResult_WitnessNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_WitnessNoneZ), "LDKCResult_WitnessNoneZ");
20566         *ret_conv = CResult_WitnessNoneZ_clone(arg);
20567         return tag_ptr(ret_conv, true);
20568 }
20569 int64_t  CS_LDK_CResult_WitnessNoneZ_clone_ptr(int64_t arg) {
20570         LDKCResult_WitnessNoneZ* arg_conv = (LDKCResult_WitnessNoneZ*)untag_ptr(arg);
20571         int64_t ret_conv = CResult_WitnessNoneZ_clone_ptr(arg_conv);
20572         return ret_conv;
20573 }
20574
20575 int64_t  CS_LDK_CResult_WitnessNoneZ_clone(int64_t orig) {
20576         LDKCResult_WitnessNoneZ* orig_conv = (LDKCResult_WitnessNoneZ*)untag_ptr(orig);
20577         LDKCResult_WitnessNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_WitnessNoneZ), "LDKCResult_WitnessNoneZ");
20578         *ret_conv = CResult_WitnessNoneZ_clone(orig_conv);
20579         return tag_ptr(ret_conv, true);
20580 }
20581
20582 void  CS_LDK_CVec_ECDSASignatureZ_free(ptrArray _res) {
20583         LDKCVec_ECDSASignatureZ _res_constr;
20584         _res_constr.datalen = _res->arr_len;
20585         if (_res_constr.datalen > 0)
20586                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
20587         else
20588                 _res_constr.data = NULL;
20589         int8_tArray* _res_vals = (void*) _res->elems;
20590         for (size_t i = 0; i < _res_constr.datalen; i++) {
20591                 int8_tArray _res_conv_8 = _res_vals[i];
20592                 LDKECDSASignature _res_conv_8_ref;
20593                 CHECK(_res_conv_8->arr_len == 64);
20594                 memcpy(_res_conv_8_ref.compact_form, _res_conv_8->elems, 64); FREE(_res_conv_8);
20595                 _res_constr.data[i] = _res_conv_8_ref;
20596         }
20597         FREE(_res);
20598         CVec_ECDSASignatureZ_free(_res_constr);
20599 }
20600
20601 static inline uint64_t C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone_ptr(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ *NONNULL_PTR arg) {
20602         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ), "LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ");
20603         *ret_conv = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone(arg);
20604         return tag_ptr(ret_conv, true);
20605 }
20606 int64_t  CS_LDK_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone_ptr(int64_t arg) {
20607         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* arg_conv = (LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)untag_ptr(arg);
20608         int64_t ret_conv = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone_ptr(arg_conv);
20609         return ret_conv;
20610 }
20611
20612 int64_t  CS_LDK_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone(int64_t orig) {
20613         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* orig_conv = (LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)untag_ptr(orig);
20614         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ), "LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ");
20615         *ret_conv = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone(orig_conv);
20616         return tag_ptr(ret_conv, true);
20617 }
20618
20619 int64_t  CS_LDK_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_new(int8_tArray a, ptrArray b) {
20620         LDKECDSASignature a_ref;
20621         CHECK(a->arr_len == 64);
20622         memcpy(a_ref.compact_form, a->elems, 64); FREE(a);
20623         LDKCVec_ECDSASignatureZ b_constr;
20624         b_constr.datalen = b->arr_len;
20625         if (b_constr.datalen > 0)
20626                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
20627         else
20628                 b_constr.data = NULL;
20629         int8_tArray* b_vals = (void*) b->elems;
20630         for (size_t i = 0; i < b_constr.datalen; i++) {
20631                 int8_tArray b_conv_8 = b_vals[i];
20632                 LDKECDSASignature b_conv_8_ref;
20633                 CHECK(b_conv_8->arr_len == 64);
20634                 memcpy(b_conv_8_ref.compact_form, b_conv_8->elems, 64); FREE(b_conv_8);
20635                 b_constr.data[i] = b_conv_8_ref;
20636         }
20637         FREE(b);
20638         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ), "LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ");
20639         *ret_conv = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_new(a_ref, b_constr);
20640         return tag_ptr(ret_conv, true);
20641 }
20642
20643 void  CS_LDK_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_free(int64_t _res) {
20644         if (!ptr_is_owned(_res)) return;
20645         void* _res_ptr = untag_ptr(_res);
20646         CHECK_ACCESS(_res_ptr);
20647         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ _res_conv = *(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)(_res_ptr);
20648         FREE(untag_ptr(_res));
20649         C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_free(_res_conv);
20650 }
20651
20652 int64_t  CS_LDK_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_ok(int64_t o) {
20653         void* o_ptr = untag_ptr(o);
20654         CHECK_ACCESS(o_ptr);
20655         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ o_conv = *(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)(o_ptr);
20656         o_conv = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone((LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)untag_ptr(o));
20657         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
20658         *ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_ok(o_conv);
20659         return tag_ptr(ret_conv, true);
20660 }
20661
20662 int64_t  CS_LDK_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_err() {
20663         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
20664         *ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_err();
20665         return tag_ptr(ret_conv, true);
20666 }
20667
20668 jboolean  CS_LDK_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_is_ok(int64_t o) {
20669         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* o_conv = (LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)untag_ptr(o);
20670         jboolean ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_is_ok(o_conv);
20671         return ret_conv;
20672 }
20673
20674 void  CS_LDK_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_free(int64_t _res) {
20675         if (!ptr_is_owned(_res)) return;
20676         void* _res_ptr = untag_ptr(_res);
20677         CHECK_ACCESS(_res_ptr);
20678         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ _res_conv = *(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)(_res_ptr);
20679         FREE(untag_ptr(_res));
20680         CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_free(_res_conv);
20681 }
20682
20683 static inline uint64_t CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone_ptr(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ *NONNULL_PTR arg) {
20684         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
20685         *ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone(arg);
20686         return tag_ptr(ret_conv, true);
20687 }
20688 int64_t  CS_LDK_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone_ptr(int64_t arg) {
20689         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* arg_conv = (LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)untag_ptr(arg);
20690         int64_t ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone_ptr(arg_conv);
20691         return ret_conv;
20692 }
20693
20694 int64_t  CS_LDK_CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone(int64_t orig) {
20695         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* orig_conv = (LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)untag_ptr(orig);
20696         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
20697         *ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone(orig_conv);
20698         return tag_ptr(ret_conv, true);
20699 }
20700
20701 int64_t  CS_LDK_CResult_InMemorySignerDecodeErrorZ_ok(int64_t o) {
20702         LDKInMemorySigner o_conv;
20703         o_conv.inner = untag_ptr(o);
20704         o_conv.is_owned = ptr_is_owned(o);
20705         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20706         o_conv = InMemorySigner_clone(&o_conv);
20707         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
20708         *ret_conv = CResult_InMemorySignerDecodeErrorZ_ok(o_conv);
20709         return tag_ptr(ret_conv, true);
20710 }
20711
20712 int64_t  CS_LDK_CResult_InMemorySignerDecodeErrorZ_err(int64_t e) {
20713         void* e_ptr = untag_ptr(e);
20714         CHECK_ACCESS(e_ptr);
20715         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20716         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20717         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
20718         *ret_conv = CResult_InMemorySignerDecodeErrorZ_err(e_conv);
20719         return tag_ptr(ret_conv, true);
20720 }
20721
20722 jboolean  CS_LDK_CResult_InMemorySignerDecodeErrorZ_is_ok(int64_t o) {
20723         LDKCResult_InMemorySignerDecodeErrorZ* o_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(o);
20724         jboolean ret_conv = CResult_InMemorySignerDecodeErrorZ_is_ok(o_conv);
20725         return ret_conv;
20726 }
20727
20728 void  CS_LDK_CResult_InMemorySignerDecodeErrorZ_free(int64_t _res) {
20729         if (!ptr_is_owned(_res)) return;
20730         void* _res_ptr = untag_ptr(_res);
20731         CHECK_ACCESS(_res_ptr);
20732         LDKCResult_InMemorySignerDecodeErrorZ _res_conv = *(LDKCResult_InMemorySignerDecodeErrorZ*)(_res_ptr);
20733         FREE(untag_ptr(_res));
20734         CResult_InMemorySignerDecodeErrorZ_free(_res_conv);
20735 }
20736
20737 static inline uint64_t CResult_InMemorySignerDecodeErrorZ_clone_ptr(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR arg) {
20738         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
20739         *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(arg);
20740         return tag_ptr(ret_conv, true);
20741 }
20742 int64_t  CS_LDK_CResult_InMemorySignerDecodeErrorZ_clone_ptr(int64_t arg) {
20743         LDKCResult_InMemorySignerDecodeErrorZ* arg_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(arg);
20744         int64_t ret_conv = CResult_InMemorySignerDecodeErrorZ_clone_ptr(arg_conv);
20745         return ret_conv;
20746 }
20747
20748 int64_t  CS_LDK_CResult_InMemorySignerDecodeErrorZ_clone(int64_t orig) {
20749         LDKCResult_InMemorySignerDecodeErrorZ* orig_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(orig);
20750         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
20751         *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(orig_conv);
20752         return tag_ptr(ret_conv, true);
20753 }
20754
20755 int64_t  CS_LDK_COption_WriteableScoreZ_some(int64_t o) {
20756         void* o_ptr = untag_ptr(o);
20757         CHECK_ACCESS(o_ptr);
20758         LDKWriteableScore o_conv = *(LDKWriteableScore*)(o_ptr);
20759         if (o_conv.free == LDKWriteableScore_JCalls_free) {
20760                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
20761                 LDKWriteableScore_JCalls_cloned(&o_conv);
20762         }
20763         LDKCOption_WriteableScoreZ *ret_copy = MALLOC(sizeof(LDKCOption_WriteableScoreZ), "LDKCOption_WriteableScoreZ");
20764         *ret_copy = COption_WriteableScoreZ_some(o_conv);
20765         int64_t ret_ref = tag_ptr(ret_copy, true);
20766         return ret_ref;
20767 }
20768
20769 int64_t  CS_LDK_COption_WriteableScoreZ_none() {
20770         LDKCOption_WriteableScoreZ *ret_copy = MALLOC(sizeof(LDKCOption_WriteableScoreZ), "LDKCOption_WriteableScoreZ");
20771         *ret_copy = COption_WriteableScoreZ_none();
20772         int64_t ret_ref = tag_ptr(ret_copy, true);
20773         return ret_ref;
20774 }
20775
20776 void  CS_LDK_COption_WriteableScoreZ_free(int64_t _res) {
20777         if (!ptr_is_owned(_res)) return;
20778         void* _res_ptr = untag_ptr(_res);
20779         CHECK_ACCESS(_res_ptr);
20780         LDKCOption_WriteableScoreZ _res_conv = *(LDKCOption_WriteableScoreZ*)(_res_ptr);
20781         FREE(untag_ptr(_res));
20782         COption_WriteableScoreZ_free(_res_conv);
20783 }
20784
20785 int64_t  CS_LDK_CResult_NoneIOErrorZ_ok() {
20786         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
20787         *ret_conv = CResult_NoneIOErrorZ_ok();
20788         return tag_ptr(ret_conv, true);
20789 }
20790
20791 int64_t  CS_LDK_CResult_NoneIOErrorZ_err(int32_t e) {
20792         LDKIOError e_conv = LDKIOError_from_cs(e);
20793         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
20794         *ret_conv = CResult_NoneIOErrorZ_err(e_conv);
20795         return tag_ptr(ret_conv, true);
20796 }
20797
20798 jboolean  CS_LDK_CResult_NoneIOErrorZ_is_ok(int64_t o) {
20799         LDKCResult_NoneIOErrorZ* o_conv = (LDKCResult_NoneIOErrorZ*)untag_ptr(o);
20800         jboolean ret_conv = CResult_NoneIOErrorZ_is_ok(o_conv);
20801         return ret_conv;
20802 }
20803
20804 void  CS_LDK_CResult_NoneIOErrorZ_free(int64_t _res) {
20805         if (!ptr_is_owned(_res)) return;
20806         void* _res_ptr = untag_ptr(_res);
20807         CHECK_ACCESS(_res_ptr);
20808         LDKCResult_NoneIOErrorZ _res_conv = *(LDKCResult_NoneIOErrorZ*)(_res_ptr);
20809         FREE(untag_ptr(_res));
20810         CResult_NoneIOErrorZ_free(_res_conv);
20811 }
20812
20813 static inline uint64_t CResult_NoneIOErrorZ_clone_ptr(LDKCResult_NoneIOErrorZ *NONNULL_PTR arg) {
20814         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
20815         *ret_conv = CResult_NoneIOErrorZ_clone(arg);
20816         return tag_ptr(ret_conv, true);
20817 }
20818 int64_t  CS_LDK_CResult_NoneIOErrorZ_clone_ptr(int64_t arg) {
20819         LDKCResult_NoneIOErrorZ* arg_conv = (LDKCResult_NoneIOErrorZ*)untag_ptr(arg);
20820         int64_t ret_conv = CResult_NoneIOErrorZ_clone_ptr(arg_conv);
20821         return ret_conv;
20822 }
20823
20824 int64_t  CS_LDK_CResult_NoneIOErrorZ_clone(int64_t orig) {
20825         LDKCResult_NoneIOErrorZ* orig_conv = (LDKCResult_NoneIOErrorZ*)untag_ptr(orig);
20826         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
20827         *ret_conv = CResult_NoneIOErrorZ_clone(orig_conv);
20828         return tag_ptr(ret_conv, true);
20829 }
20830
20831 void  CS_LDK_CVec_ChannelDetailsZ_free(int64_tArray _res) {
20832         LDKCVec_ChannelDetailsZ _res_constr;
20833         _res_constr.datalen = _res->arr_len;
20834         if (_res_constr.datalen > 0)
20835                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
20836         else
20837                 _res_constr.data = NULL;
20838         int64_t* _res_vals = _res->elems;
20839         for (size_t q = 0; q < _res_constr.datalen; q++) {
20840                 int64_t _res_conv_16 = _res_vals[q];
20841                 LDKChannelDetails _res_conv_16_conv;
20842                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
20843                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
20844                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
20845                 _res_constr.data[q] = _res_conv_16_conv;
20846         }
20847         FREE(_res);
20848         CVec_ChannelDetailsZ_free(_res_constr);
20849 }
20850
20851 int64_t  CS_LDK_CResult_RouteLightningErrorZ_ok(int64_t o) {
20852         LDKRoute o_conv;
20853         o_conv.inner = untag_ptr(o);
20854         o_conv.is_owned = ptr_is_owned(o);
20855         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20856         o_conv = Route_clone(&o_conv);
20857         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
20858         *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv);
20859         return tag_ptr(ret_conv, true);
20860 }
20861
20862 int64_t  CS_LDK_CResult_RouteLightningErrorZ_err(int64_t e) {
20863         LDKLightningError e_conv;
20864         e_conv.inner = untag_ptr(e);
20865         e_conv.is_owned = ptr_is_owned(e);
20866         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20867         e_conv = LightningError_clone(&e_conv);
20868         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
20869         *ret_conv = CResult_RouteLightningErrorZ_err(e_conv);
20870         return tag_ptr(ret_conv, true);
20871 }
20872
20873 jboolean  CS_LDK_CResult_RouteLightningErrorZ_is_ok(int64_t o) {
20874         LDKCResult_RouteLightningErrorZ* o_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(o);
20875         jboolean ret_conv = CResult_RouteLightningErrorZ_is_ok(o_conv);
20876         return ret_conv;
20877 }
20878
20879 void  CS_LDK_CResult_RouteLightningErrorZ_free(int64_t _res) {
20880         if (!ptr_is_owned(_res)) return;
20881         void* _res_ptr = untag_ptr(_res);
20882         CHECK_ACCESS(_res_ptr);
20883         LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)(_res_ptr);
20884         FREE(untag_ptr(_res));
20885         CResult_RouteLightningErrorZ_free(_res_conv);
20886 }
20887
20888 static inline uint64_t CResult_RouteLightningErrorZ_clone_ptr(LDKCResult_RouteLightningErrorZ *NONNULL_PTR arg) {
20889         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
20890         *ret_conv = CResult_RouteLightningErrorZ_clone(arg);
20891         return tag_ptr(ret_conv, true);
20892 }
20893 int64_t  CS_LDK_CResult_RouteLightningErrorZ_clone_ptr(int64_t arg) {
20894         LDKCResult_RouteLightningErrorZ* arg_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(arg);
20895         int64_t ret_conv = CResult_RouteLightningErrorZ_clone_ptr(arg_conv);
20896         return ret_conv;
20897 }
20898
20899 int64_t  CS_LDK_CResult_RouteLightningErrorZ_clone(int64_t orig) {
20900         LDKCResult_RouteLightningErrorZ* orig_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(orig);
20901         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
20902         *ret_conv = CResult_RouteLightningErrorZ_clone(orig_conv);
20903         return tag_ptr(ret_conv, true);
20904 }
20905
20906 static inline uint64_t C2Tuple_BlindedPayInfoBlindedPathZ_clone_ptr(LDKC2Tuple_BlindedPayInfoBlindedPathZ *NONNULL_PTR arg) {
20907         LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
20908         *ret_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone(arg);
20909         return tag_ptr(ret_conv, true);
20910 }
20911 int64_t  CS_LDK_C2Tuple_BlindedPayInfoBlindedPathZ_clone_ptr(int64_t arg) {
20912         LDKC2Tuple_BlindedPayInfoBlindedPathZ* arg_conv = (LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(arg);
20913         int64_t ret_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone_ptr(arg_conv);
20914         return ret_conv;
20915 }
20916
20917 int64_t  CS_LDK_C2Tuple_BlindedPayInfoBlindedPathZ_clone(int64_t orig) {
20918         LDKC2Tuple_BlindedPayInfoBlindedPathZ* orig_conv = (LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(orig);
20919         LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
20920         *ret_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone(orig_conv);
20921         return tag_ptr(ret_conv, true);
20922 }
20923
20924 int64_t  CS_LDK_C2Tuple_BlindedPayInfoBlindedPathZ_new(int64_t a, int64_t b) {
20925         LDKBlindedPayInfo a_conv;
20926         a_conv.inner = untag_ptr(a);
20927         a_conv.is_owned = ptr_is_owned(a);
20928         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
20929         a_conv = BlindedPayInfo_clone(&a_conv);
20930         LDKBlindedPath b_conv;
20931         b_conv.inner = untag_ptr(b);
20932         b_conv.is_owned = ptr_is_owned(b);
20933         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
20934         b_conv = BlindedPath_clone(&b_conv);
20935         LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
20936         *ret_conv = C2Tuple_BlindedPayInfoBlindedPathZ_new(a_conv, b_conv);
20937         return tag_ptr(ret_conv, true);
20938 }
20939
20940 void  CS_LDK_C2Tuple_BlindedPayInfoBlindedPathZ_free(int64_t _res) {
20941         if (!ptr_is_owned(_res)) return;
20942         void* _res_ptr = untag_ptr(_res);
20943         CHECK_ACCESS(_res_ptr);
20944         LDKC2Tuple_BlindedPayInfoBlindedPathZ _res_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(_res_ptr);
20945         FREE(untag_ptr(_res));
20946         C2Tuple_BlindedPayInfoBlindedPathZ_free(_res_conv);
20947 }
20948
20949 void  CS_LDK_CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_free(int64_tArray _res) {
20950         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ _res_constr;
20951         _res_constr.datalen = _res->arr_len;
20952         if (_res_constr.datalen > 0)
20953                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
20954         else
20955                 _res_constr.data = NULL;
20956         int64_t* _res_vals = _res->elems;
20957         for (size_t l = 0; l < _res_constr.datalen; l++) {
20958                 int64_t _res_conv_37 = _res_vals[l];
20959                 void* _res_conv_37_ptr = untag_ptr(_res_conv_37);
20960                 CHECK_ACCESS(_res_conv_37_ptr);
20961                 LDKC2Tuple_BlindedPayInfoBlindedPathZ _res_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(_res_conv_37_ptr);
20962                 FREE(untag_ptr(_res_conv_37));
20963                 _res_constr.data[l] = _res_conv_37_conv;
20964         }
20965         FREE(_res);
20966         CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_free(_res_constr);
20967 }
20968
20969 int64_t  CS_LDK_CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_ok(int64_tArray o) {
20970         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ o_constr;
20971         o_constr.datalen = o->arr_len;
20972         if (o_constr.datalen > 0)
20973                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
20974         else
20975                 o_constr.data = NULL;
20976         int64_t* o_vals = o->elems;
20977         for (size_t l = 0; l < o_constr.datalen; l++) {
20978                 int64_t o_conv_37 = o_vals[l];
20979                 void* o_conv_37_ptr = untag_ptr(o_conv_37);
20980                 CHECK_ACCESS(o_conv_37_ptr);
20981                 LDKC2Tuple_BlindedPayInfoBlindedPathZ o_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(o_conv_37_ptr);
20982                 o_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(o_conv_37));
20983                 o_constr.data[l] = o_conv_37_conv;
20984         }
20985         FREE(o);
20986         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ), "LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ");
20987         *ret_conv = CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_ok(o_constr);
20988         return tag_ptr(ret_conv, true);
20989 }
20990
20991 int64_t  CS_LDK_CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_err() {
20992         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ), "LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ");
20993         *ret_conv = CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_err();
20994         return tag_ptr(ret_conv, true);
20995 }
20996
20997 jboolean  CS_LDK_CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_is_ok(int64_t o) {
20998         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* o_conv = (LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ*)untag_ptr(o);
20999         jboolean ret_conv = CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_is_ok(o_conv);
21000         return ret_conv;
21001 }
21002
21003 void  CS_LDK_CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_free(int64_t _res) {
21004         if (!ptr_is_owned(_res)) return;
21005         void* _res_ptr = untag_ptr(_res);
21006         CHECK_ACCESS(_res_ptr);
21007         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ _res_conv = *(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ*)(_res_ptr);
21008         FREE(untag_ptr(_res));
21009         CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_free(_res_conv);
21010 }
21011
21012 static inline uint64_t CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_clone_ptr(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ *NONNULL_PTR arg) {
21013         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ), "LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ");
21014         *ret_conv = CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_clone(arg);
21015         return tag_ptr(ret_conv, true);
21016 }
21017 int64_t  CS_LDK_CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_clone_ptr(int64_t arg) {
21018         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* arg_conv = (LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ*)untag_ptr(arg);
21019         int64_t ret_conv = CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_clone_ptr(arg_conv);
21020         return ret_conv;
21021 }
21022
21023 int64_t  CS_LDK_CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_clone(int64_t orig) {
21024         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* orig_conv = (LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ*)untag_ptr(orig);
21025         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ), "LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ");
21026         *ret_conv = CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_clone(orig_conv);
21027         return tag_ptr(ret_conv, true);
21028 }
21029
21030 void  CS_LDK_CVec_PublicKeyZ_free(ptrArray _res) {
21031         LDKCVec_PublicKeyZ _res_constr;
21032         _res_constr.datalen = _res->arr_len;
21033         if (_res_constr.datalen > 0)
21034                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
21035         else
21036                 _res_constr.data = NULL;
21037         int8_tArray* _res_vals = (void*) _res->elems;
21038         for (size_t i = 0; i < _res_constr.datalen; i++) {
21039                 int8_tArray _res_conv_8 = _res_vals[i];
21040                 LDKPublicKey _res_conv_8_ref;
21041                 CHECK(_res_conv_8->arr_len == 33);
21042                 memcpy(_res_conv_8_ref.compressed_form, _res_conv_8->elems, 33); FREE(_res_conv_8);
21043                 _res_constr.data[i] = _res_conv_8_ref;
21044         }
21045         FREE(_res);
21046         CVec_PublicKeyZ_free(_res_constr);
21047 }
21048
21049 int64_t  CS_LDK_CResult_OnionMessagePathNoneZ_ok(int64_t o) {
21050         LDKOnionMessagePath o_conv;
21051         o_conv.inner = untag_ptr(o);
21052         o_conv.is_owned = ptr_is_owned(o);
21053         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21054         o_conv = OnionMessagePath_clone(&o_conv);
21055         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
21056         *ret_conv = CResult_OnionMessagePathNoneZ_ok(o_conv);
21057         return tag_ptr(ret_conv, true);
21058 }
21059
21060 int64_t  CS_LDK_CResult_OnionMessagePathNoneZ_err() {
21061         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
21062         *ret_conv = CResult_OnionMessagePathNoneZ_err();
21063         return tag_ptr(ret_conv, true);
21064 }
21065
21066 jboolean  CS_LDK_CResult_OnionMessagePathNoneZ_is_ok(int64_t o) {
21067         LDKCResult_OnionMessagePathNoneZ* o_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(o);
21068         jboolean ret_conv = CResult_OnionMessagePathNoneZ_is_ok(o_conv);
21069         return ret_conv;
21070 }
21071
21072 void  CS_LDK_CResult_OnionMessagePathNoneZ_free(int64_t _res) {
21073         if (!ptr_is_owned(_res)) return;
21074         void* _res_ptr = untag_ptr(_res);
21075         CHECK_ACCESS(_res_ptr);
21076         LDKCResult_OnionMessagePathNoneZ _res_conv = *(LDKCResult_OnionMessagePathNoneZ*)(_res_ptr);
21077         FREE(untag_ptr(_res));
21078         CResult_OnionMessagePathNoneZ_free(_res_conv);
21079 }
21080
21081 static inline uint64_t CResult_OnionMessagePathNoneZ_clone_ptr(LDKCResult_OnionMessagePathNoneZ *NONNULL_PTR arg) {
21082         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
21083         *ret_conv = CResult_OnionMessagePathNoneZ_clone(arg);
21084         return tag_ptr(ret_conv, true);
21085 }
21086 int64_t  CS_LDK_CResult_OnionMessagePathNoneZ_clone_ptr(int64_t arg) {
21087         LDKCResult_OnionMessagePathNoneZ* arg_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(arg);
21088         int64_t ret_conv = CResult_OnionMessagePathNoneZ_clone_ptr(arg_conv);
21089         return ret_conv;
21090 }
21091
21092 int64_t  CS_LDK_CResult_OnionMessagePathNoneZ_clone(int64_t orig) {
21093         LDKCResult_OnionMessagePathNoneZ* orig_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(orig);
21094         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
21095         *ret_conv = CResult_OnionMessagePathNoneZ_clone(orig_conv);
21096         return tag_ptr(ret_conv, true);
21097 }
21098
21099 int64_t  CS_LDK_CResult_CVec_BlindedPathZNoneZ_ok(int64_tArray o) {
21100         LDKCVec_BlindedPathZ o_constr;
21101         o_constr.datalen = o->arr_len;
21102         if (o_constr.datalen > 0)
21103                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKBlindedPath), "LDKCVec_BlindedPathZ Elements");
21104         else
21105                 o_constr.data = NULL;
21106         int64_t* o_vals = o->elems;
21107         for (size_t n = 0; n < o_constr.datalen; n++) {
21108                 int64_t o_conv_13 = o_vals[n];
21109                 LDKBlindedPath o_conv_13_conv;
21110                 o_conv_13_conv.inner = untag_ptr(o_conv_13);
21111                 o_conv_13_conv.is_owned = ptr_is_owned(o_conv_13);
21112                 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv_13_conv);
21113                 o_conv_13_conv = BlindedPath_clone(&o_conv_13_conv);
21114                 o_constr.data[n] = o_conv_13_conv;
21115         }
21116         FREE(o);
21117         LDKCResult_CVec_BlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_BlindedPathZNoneZ), "LDKCResult_CVec_BlindedPathZNoneZ");
21118         *ret_conv = CResult_CVec_BlindedPathZNoneZ_ok(o_constr);
21119         return tag_ptr(ret_conv, true);
21120 }
21121
21122 int64_t  CS_LDK_CResult_CVec_BlindedPathZNoneZ_err() {
21123         LDKCResult_CVec_BlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_BlindedPathZNoneZ), "LDKCResult_CVec_BlindedPathZNoneZ");
21124         *ret_conv = CResult_CVec_BlindedPathZNoneZ_err();
21125         return tag_ptr(ret_conv, true);
21126 }
21127
21128 jboolean  CS_LDK_CResult_CVec_BlindedPathZNoneZ_is_ok(int64_t o) {
21129         LDKCResult_CVec_BlindedPathZNoneZ* o_conv = (LDKCResult_CVec_BlindedPathZNoneZ*)untag_ptr(o);
21130         jboolean ret_conv = CResult_CVec_BlindedPathZNoneZ_is_ok(o_conv);
21131         return ret_conv;
21132 }
21133
21134 void  CS_LDK_CResult_CVec_BlindedPathZNoneZ_free(int64_t _res) {
21135         if (!ptr_is_owned(_res)) return;
21136         void* _res_ptr = untag_ptr(_res);
21137         CHECK_ACCESS(_res_ptr);
21138         LDKCResult_CVec_BlindedPathZNoneZ _res_conv = *(LDKCResult_CVec_BlindedPathZNoneZ*)(_res_ptr);
21139         FREE(untag_ptr(_res));
21140         CResult_CVec_BlindedPathZNoneZ_free(_res_conv);
21141 }
21142
21143 static inline uint64_t CResult_CVec_BlindedPathZNoneZ_clone_ptr(LDKCResult_CVec_BlindedPathZNoneZ *NONNULL_PTR arg) {
21144         LDKCResult_CVec_BlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_BlindedPathZNoneZ), "LDKCResult_CVec_BlindedPathZNoneZ");
21145         *ret_conv = CResult_CVec_BlindedPathZNoneZ_clone(arg);
21146         return tag_ptr(ret_conv, true);
21147 }
21148 int64_t  CS_LDK_CResult_CVec_BlindedPathZNoneZ_clone_ptr(int64_t arg) {
21149         LDKCResult_CVec_BlindedPathZNoneZ* arg_conv = (LDKCResult_CVec_BlindedPathZNoneZ*)untag_ptr(arg);
21150         int64_t ret_conv = CResult_CVec_BlindedPathZNoneZ_clone_ptr(arg_conv);
21151         return ret_conv;
21152 }
21153
21154 int64_t  CS_LDK_CResult_CVec_BlindedPathZNoneZ_clone(int64_t orig) {
21155         LDKCResult_CVec_BlindedPathZNoneZ* orig_conv = (LDKCResult_CVec_BlindedPathZNoneZ*)untag_ptr(orig);
21156         LDKCResult_CVec_BlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_BlindedPathZNoneZ), "LDKCResult_CVec_BlindedPathZNoneZ");
21157         *ret_conv = CResult_CVec_BlindedPathZNoneZ_clone(orig_conv);
21158         return tag_ptr(ret_conv, true);
21159 }
21160
21161 int64_t  CS_LDK_CResult_InFlightHtlcsDecodeErrorZ_ok(int64_t o) {
21162         LDKInFlightHtlcs o_conv;
21163         o_conv.inner = untag_ptr(o);
21164         o_conv.is_owned = ptr_is_owned(o);
21165         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21166         o_conv = InFlightHtlcs_clone(&o_conv);
21167         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
21168         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_ok(o_conv);
21169         return tag_ptr(ret_conv, true);
21170 }
21171
21172 int64_t  CS_LDK_CResult_InFlightHtlcsDecodeErrorZ_err(int64_t e) {
21173         void* e_ptr = untag_ptr(e);
21174         CHECK_ACCESS(e_ptr);
21175         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21176         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21177         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
21178         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_err(e_conv);
21179         return tag_ptr(ret_conv, true);
21180 }
21181
21182 jboolean  CS_LDK_CResult_InFlightHtlcsDecodeErrorZ_is_ok(int64_t o) {
21183         LDKCResult_InFlightHtlcsDecodeErrorZ* o_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(o);
21184         jboolean ret_conv = CResult_InFlightHtlcsDecodeErrorZ_is_ok(o_conv);
21185         return ret_conv;
21186 }
21187
21188 void  CS_LDK_CResult_InFlightHtlcsDecodeErrorZ_free(int64_t _res) {
21189         if (!ptr_is_owned(_res)) return;
21190         void* _res_ptr = untag_ptr(_res);
21191         CHECK_ACCESS(_res_ptr);
21192         LDKCResult_InFlightHtlcsDecodeErrorZ _res_conv = *(LDKCResult_InFlightHtlcsDecodeErrorZ*)(_res_ptr);
21193         FREE(untag_ptr(_res));
21194         CResult_InFlightHtlcsDecodeErrorZ_free(_res_conv);
21195 }
21196
21197 static inline uint64_t CResult_InFlightHtlcsDecodeErrorZ_clone_ptr(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR arg) {
21198         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
21199         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_clone(arg);
21200         return tag_ptr(ret_conv, true);
21201 }
21202 int64_t  CS_LDK_CResult_InFlightHtlcsDecodeErrorZ_clone_ptr(int64_t arg) {
21203         LDKCResult_InFlightHtlcsDecodeErrorZ* arg_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(arg);
21204         int64_t ret_conv = CResult_InFlightHtlcsDecodeErrorZ_clone_ptr(arg_conv);
21205         return ret_conv;
21206 }
21207
21208 int64_t  CS_LDK_CResult_InFlightHtlcsDecodeErrorZ_clone(int64_t orig) {
21209         LDKCResult_InFlightHtlcsDecodeErrorZ* orig_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(orig);
21210         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
21211         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_clone(orig_conv);
21212         return tag_ptr(ret_conv, true);
21213 }
21214
21215 int64_t  CS_LDK_CResult_RouteHopDecodeErrorZ_ok(int64_t o) {
21216         LDKRouteHop o_conv;
21217         o_conv.inner = untag_ptr(o);
21218         o_conv.is_owned = ptr_is_owned(o);
21219         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21220         o_conv = RouteHop_clone(&o_conv);
21221         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
21222         *ret_conv = CResult_RouteHopDecodeErrorZ_ok(o_conv);
21223         return tag_ptr(ret_conv, true);
21224 }
21225
21226 int64_t  CS_LDK_CResult_RouteHopDecodeErrorZ_err(int64_t e) {
21227         void* e_ptr = untag_ptr(e);
21228         CHECK_ACCESS(e_ptr);
21229         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21230         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21231         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
21232         *ret_conv = CResult_RouteHopDecodeErrorZ_err(e_conv);
21233         return tag_ptr(ret_conv, true);
21234 }
21235
21236 jboolean  CS_LDK_CResult_RouteHopDecodeErrorZ_is_ok(int64_t o) {
21237         LDKCResult_RouteHopDecodeErrorZ* o_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(o);
21238         jboolean ret_conv = CResult_RouteHopDecodeErrorZ_is_ok(o_conv);
21239         return ret_conv;
21240 }
21241
21242 void  CS_LDK_CResult_RouteHopDecodeErrorZ_free(int64_t _res) {
21243         if (!ptr_is_owned(_res)) return;
21244         void* _res_ptr = untag_ptr(_res);
21245         CHECK_ACCESS(_res_ptr);
21246         LDKCResult_RouteHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHopDecodeErrorZ*)(_res_ptr);
21247         FREE(untag_ptr(_res));
21248         CResult_RouteHopDecodeErrorZ_free(_res_conv);
21249 }
21250
21251 static inline uint64_t CResult_RouteHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR arg) {
21252         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
21253         *ret_conv = CResult_RouteHopDecodeErrorZ_clone(arg);
21254         return tag_ptr(ret_conv, true);
21255 }
21256 int64_t  CS_LDK_CResult_RouteHopDecodeErrorZ_clone_ptr(int64_t arg) {
21257         LDKCResult_RouteHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(arg);
21258         int64_t ret_conv = CResult_RouteHopDecodeErrorZ_clone_ptr(arg_conv);
21259         return ret_conv;
21260 }
21261
21262 int64_t  CS_LDK_CResult_RouteHopDecodeErrorZ_clone(int64_t orig) {
21263         LDKCResult_RouteHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(orig);
21264         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
21265         *ret_conv = CResult_RouteHopDecodeErrorZ_clone(orig_conv);
21266         return tag_ptr(ret_conv, true);
21267 }
21268
21269 void  CS_LDK_CVec_BlindedHopZ_free(int64_tArray _res) {
21270         LDKCVec_BlindedHopZ _res_constr;
21271         _res_constr.datalen = _res->arr_len;
21272         if (_res_constr.datalen > 0)
21273                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
21274         else
21275                 _res_constr.data = NULL;
21276         int64_t* _res_vals = _res->elems;
21277         for (size_t m = 0; m < _res_constr.datalen; m++) {
21278                 int64_t _res_conv_12 = _res_vals[m];
21279                 LDKBlindedHop _res_conv_12_conv;
21280                 _res_conv_12_conv.inner = untag_ptr(_res_conv_12);
21281                 _res_conv_12_conv.is_owned = ptr_is_owned(_res_conv_12);
21282                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_12_conv);
21283                 _res_constr.data[m] = _res_conv_12_conv;
21284         }
21285         FREE(_res);
21286         CVec_BlindedHopZ_free(_res_constr);
21287 }
21288
21289 int64_t  CS_LDK_CResult_BlindedTailDecodeErrorZ_ok(int64_t o) {
21290         LDKBlindedTail o_conv;
21291         o_conv.inner = untag_ptr(o);
21292         o_conv.is_owned = ptr_is_owned(o);
21293         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21294         o_conv = BlindedTail_clone(&o_conv);
21295         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
21296         *ret_conv = CResult_BlindedTailDecodeErrorZ_ok(o_conv);
21297         return tag_ptr(ret_conv, true);
21298 }
21299
21300 int64_t  CS_LDK_CResult_BlindedTailDecodeErrorZ_err(int64_t e) {
21301         void* e_ptr = untag_ptr(e);
21302         CHECK_ACCESS(e_ptr);
21303         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21304         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21305         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
21306         *ret_conv = CResult_BlindedTailDecodeErrorZ_err(e_conv);
21307         return tag_ptr(ret_conv, true);
21308 }
21309
21310 jboolean  CS_LDK_CResult_BlindedTailDecodeErrorZ_is_ok(int64_t o) {
21311         LDKCResult_BlindedTailDecodeErrorZ* o_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(o);
21312         jboolean ret_conv = CResult_BlindedTailDecodeErrorZ_is_ok(o_conv);
21313         return ret_conv;
21314 }
21315
21316 void  CS_LDK_CResult_BlindedTailDecodeErrorZ_free(int64_t _res) {
21317         if (!ptr_is_owned(_res)) return;
21318         void* _res_ptr = untag_ptr(_res);
21319         CHECK_ACCESS(_res_ptr);
21320         LDKCResult_BlindedTailDecodeErrorZ _res_conv = *(LDKCResult_BlindedTailDecodeErrorZ*)(_res_ptr);
21321         FREE(untag_ptr(_res));
21322         CResult_BlindedTailDecodeErrorZ_free(_res_conv);
21323 }
21324
21325 static inline uint64_t CResult_BlindedTailDecodeErrorZ_clone_ptr(LDKCResult_BlindedTailDecodeErrorZ *NONNULL_PTR arg) {
21326         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
21327         *ret_conv = CResult_BlindedTailDecodeErrorZ_clone(arg);
21328         return tag_ptr(ret_conv, true);
21329 }
21330 int64_t  CS_LDK_CResult_BlindedTailDecodeErrorZ_clone_ptr(int64_t arg) {
21331         LDKCResult_BlindedTailDecodeErrorZ* arg_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(arg);
21332         int64_t ret_conv = CResult_BlindedTailDecodeErrorZ_clone_ptr(arg_conv);
21333         return ret_conv;
21334 }
21335
21336 int64_t  CS_LDK_CResult_BlindedTailDecodeErrorZ_clone(int64_t orig) {
21337         LDKCResult_BlindedTailDecodeErrorZ* orig_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(orig);
21338         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
21339         *ret_conv = CResult_BlindedTailDecodeErrorZ_clone(orig_conv);
21340         return tag_ptr(ret_conv, true);
21341 }
21342
21343 void  CS_LDK_CVec_RouteHopZ_free(int64_tArray _res) {
21344         LDKCVec_RouteHopZ _res_constr;
21345         _res_constr.datalen = _res->arr_len;
21346         if (_res_constr.datalen > 0)
21347                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
21348         else
21349                 _res_constr.data = NULL;
21350         int64_t* _res_vals = _res->elems;
21351         for (size_t k = 0; k < _res_constr.datalen; k++) {
21352                 int64_t _res_conv_10 = _res_vals[k];
21353                 LDKRouteHop _res_conv_10_conv;
21354                 _res_conv_10_conv.inner = untag_ptr(_res_conv_10);
21355                 _res_conv_10_conv.is_owned = ptr_is_owned(_res_conv_10);
21356                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
21357                 _res_constr.data[k] = _res_conv_10_conv;
21358         }
21359         FREE(_res);
21360         CVec_RouteHopZ_free(_res_constr);
21361 }
21362
21363 void  CS_LDK_CVec_PathZ_free(int64_tArray _res) {
21364         LDKCVec_PathZ _res_constr;
21365         _res_constr.datalen = _res->arr_len;
21366         if (_res_constr.datalen > 0)
21367                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPath), "LDKCVec_PathZ Elements");
21368         else
21369                 _res_constr.data = NULL;
21370         int64_t* _res_vals = _res->elems;
21371         for (size_t g = 0; g < _res_constr.datalen; g++) {
21372                 int64_t _res_conv_6 = _res_vals[g];
21373                 LDKPath _res_conv_6_conv;
21374                 _res_conv_6_conv.inner = untag_ptr(_res_conv_6);
21375                 _res_conv_6_conv.is_owned = ptr_is_owned(_res_conv_6);
21376                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_6_conv);
21377                 _res_constr.data[g] = _res_conv_6_conv;
21378         }
21379         FREE(_res);
21380         CVec_PathZ_free(_res_constr);
21381 }
21382
21383 int64_t  CS_LDK_CResult_RouteDecodeErrorZ_ok(int64_t o) {
21384         LDKRoute o_conv;
21385         o_conv.inner = untag_ptr(o);
21386         o_conv.is_owned = ptr_is_owned(o);
21387         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21388         o_conv = Route_clone(&o_conv);
21389         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
21390         *ret_conv = CResult_RouteDecodeErrorZ_ok(o_conv);
21391         return tag_ptr(ret_conv, true);
21392 }
21393
21394 int64_t  CS_LDK_CResult_RouteDecodeErrorZ_err(int64_t e) {
21395         void* e_ptr = untag_ptr(e);
21396         CHECK_ACCESS(e_ptr);
21397         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21398         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21399         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
21400         *ret_conv = CResult_RouteDecodeErrorZ_err(e_conv);
21401         return tag_ptr(ret_conv, true);
21402 }
21403
21404 jboolean  CS_LDK_CResult_RouteDecodeErrorZ_is_ok(int64_t o) {
21405         LDKCResult_RouteDecodeErrorZ* o_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(o);
21406         jboolean ret_conv = CResult_RouteDecodeErrorZ_is_ok(o_conv);
21407         return ret_conv;
21408 }
21409
21410 void  CS_LDK_CResult_RouteDecodeErrorZ_free(int64_t _res) {
21411         if (!ptr_is_owned(_res)) return;
21412         void* _res_ptr = untag_ptr(_res);
21413         CHECK_ACCESS(_res_ptr);
21414         LDKCResult_RouteDecodeErrorZ _res_conv = *(LDKCResult_RouteDecodeErrorZ*)(_res_ptr);
21415         FREE(untag_ptr(_res));
21416         CResult_RouteDecodeErrorZ_free(_res_conv);
21417 }
21418
21419 static inline uint64_t CResult_RouteDecodeErrorZ_clone_ptr(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR arg) {
21420         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
21421         *ret_conv = CResult_RouteDecodeErrorZ_clone(arg);
21422         return tag_ptr(ret_conv, true);
21423 }
21424 int64_t  CS_LDK_CResult_RouteDecodeErrorZ_clone_ptr(int64_t arg) {
21425         LDKCResult_RouteDecodeErrorZ* arg_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(arg);
21426         int64_t ret_conv = CResult_RouteDecodeErrorZ_clone_ptr(arg_conv);
21427         return ret_conv;
21428 }
21429
21430 int64_t  CS_LDK_CResult_RouteDecodeErrorZ_clone(int64_t orig) {
21431         LDKCResult_RouteDecodeErrorZ* orig_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(orig);
21432         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
21433         *ret_conv = CResult_RouteDecodeErrorZ_clone(orig_conv);
21434         return tag_ptr(ret_conv, true);
21435 }
21436
21437 int64_t  CS_LDK_CResult_RouteParametersDecodeErrorZ_ok(int64_t o) {
21438         LDKRouteParameters o_conv;
21439         o_conv.inner = untag_ptr(o);
21440         o_conv.is_owned = ptr_is_owned(o);
21441         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21442         o_conv = RouteParameters_clone(&o_conv);
21443         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
21444         *ret_conv = CResult_RouteParametersDecodeErrorZ_ok(o_conv);
21445         return tag_ptr(ret_conv, true);
21446 }
21447
21448 int64_t  CS_LDK_CResult_RouteParametersDecodeErrorZ_err(int64_t e) {
21449         void* e_ptr = untag_ptr(e);
21450         CHECK_ACCESS(e_ptr);
21451         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21452         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21453         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
21454         *ret_conv = CResult_RouteParametersDecodeErrorZ_err(e_conv);
21455         return tag_ptr(ret_conv, true);
21456 }
21457
21458 jboolean  CS_LDK_CResult_RouteParametersDecodeErrorZ_is_ok(int64_t o) {
21459         LDKCResult_RouteParametersDecodeErrorZ* o_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(o);
21460         jboolean ret_conv = CResult_RouteParametersDecodeErrorZ_is_ok(o_conv);
21461         return ret_conv;
21462 }
21463
21464 void  CS_LDK_CResult_RouteParametersDecodeErrorZ_free(int64_t _res) {
21465         if (!ptr_is_owned(_res)) return;
21466         void* _res_ptr = untag_ptr(_res);
21467         CHECK_ACCESS(_res_ptr);
21468         LDKCResult_RouteParametersDecodeErrorZ _res_conv = *(LDKCResult_RouteParametersDecodeErrorZ*)(_res_ptr);
21469         FREE(untag_ptr(_res));
21470         CResult_RouteParametersDecodeErrorZ_free(_res_conv);
21471 }
21472
21473 static inline uint64_t CResult_RouteParametersDecodeErrorZ_clone_ptr(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR arg) {
21474         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
21475         *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(arg);
21476         return tag_ptr(ret_conv, true);
21477 }
21478 int64_t  CS_LDK_CResult_RouteParametersDecodeErrorZ_clone_ptr(int64_t arg) {
21479         LDKCResult_RouteParametersDecodeErrorZ* arg_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(arg);
21480         int64_t ret_conv = CResult_RouteParametersDecodeErrorZ_clone_ptr(arg_conv);
21481         return ret_conv;
21482 }
21483
21484 int64_t  CS_LDK_CResult_RouteParametersDecodeErrorZ_clone(int64_t orig) {
21485         LDKCResult_RouteParametersDecodeErrorZ* orig_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(orig);
21486         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
21487         *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(orig_conv);
21488         return tag_ptr(ret_conv, true);
21489 }
21490
21491 void  CS_LDK_CVec_u64Z_free(int64_tArray _res) {
21492         LDKCVec_u64Z _res_constr;
21493         _res_constr.datalen = _res->arr_len;
21494         if (_res_constr.datalen > 0)
21495                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
21496         else
21497                 _res_constr.data = NULL;
21498         int64_t* _res_vals = _res->elems;
21499         for (size_t g = 0; g < _res_constr.datalen; g++) {
21500                 int64_t _res_conv_6 = _res_vals[g];
21501                 _res_constr.data[g] = _res_conv_6;
21502         }
21503         FREE(_res);
21504         CVec_u64Z_free(_res_constr);
21505 }
21506
21507 int64_t  CS_LDK_CResult_PaymentParametersDecodeErrorZ_ok(int64_t o) {
21508         LDKPaymentParameters o_conv;
21509         o_conv.inner = untag_ptr(o);
21510         o_conv.is_owned = ptr_is_owned(o);
21511         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21512         o_conv = PaymentParameters_clone(&o_conv);
21513         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
21514         *ret_conv = CResult_PaymentParametersDecodeErrorZ_ok(o_conv);
21515         return tag_ptr(ret_conv, true);
21516 }
21517
21518 int64_t  CS_LDK_CResult_PaymentParametersDecodeErrorZ_err(int64_t e) {
21519         void* e_ptr = untag_ptr(e);
21520         CHECK_ACCESS(e_ptr);
21521         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21522         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21523         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
21524         *ret_conv = CResult_PaymentParametersDecodeErrorZ_err(e_conv);
21525         return tag_ptr(ret_conv, true);
21526 }
21527
21528 jboolean  CS_LDK_CResult_PaymentParametersDecodeErrorZ_is_ok(int64_t o) {
21529         LDKCResult_PaymentParametersDecodeErrorZ* o_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(o);
21530         jboolean ret_conv = CResult_PaymentParametersDecodeErrorZ_is_ok(o_conv);
21531         return ret_conv;
21532 }
21533
21534 void  CS_LDK_CResult_PaymentParametersDecodeErrorZ_free(int64_t _res) {
21535         if (!ptr_is_owned(_res)) return;
21536         void* _res_ptr = untag_ptr(_res);
21537         CHECK_ACCESS(_res_ptr);
21538         LDKCResult_PaymentParametersDecodeErrorZ _res_conv = *(LDKCResult_PaymentParametersDecodeErrorZ*)(_res_ptr);
21539         FREE(untag_ptr(_res));
21540         CResult_PaymentParametersDecodeErrorZ_free(_res_conv);
21541 }
21542
21543 static inline uint64_t CResult_PaymentParametersDecodeErrorZ_clone_ptr(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR arg) {
21544         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
21545         *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(arg);
21546         return tag_ptr(ret_conv, true);
21547 }
21548 int64_t  CS_LDK_CResult_PaymentParametersDecodeErrorZ_clone_ptr(int64_t arg) {
21549         LDKCResult_PaymentParametersDecodeErrorZ* arg_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(arg);
21550         int64_t ret_conv = CResult_PaymentParametersDecodeErrorZ_clone_ptr(arg_conv);
21551         return ret_conv;
21552 }
21553
21554 int64_t  CS_LDK_CResult_PaymentParametersDecodeErrorZ_clone(int64_t orig) {
21555         LDKCResult_PaymentParametersDecodeErrorZ* orig_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(orig);
21556         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
21557         *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(orig_conv);
21558         return tag_ptr(ret_conv, true);
21559 }
21560
21561 void  CS_LDK_CVec_RouteHintZ_free(int64_tArray _res) {
21562         LDKCVec_RouteHintZ _res_constr;
21563         _res_constr.datalen = _res->arr_len;
21564         if (_res_constr.datalen > 0)
21565                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
21566         else
21567                 _res_constr.data = NULL;
21568         int64_t* _res_vals = _res->elems;
21569         for (size_t l = 0; l < _res_constr.datalen; l++) {
21570                 int64_t _res_conv_11 = _res_vals[l];
21571                 LDKRouteHint _res_conv_11_conv;
21572                 _res_conv_11_conv.inner = untag_ptr(_res_conv_11);
21573                 _res_conv_11_conv.is_owned = ptr_is_owned(_res_conv_11);
21574                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_11_conv);
21575                 _res_constr.data[l] = _res_conv_11_conv;
21576         }
21577         FREE(_res);
21578         CVec_RouteHintZ_free(_res_constr);
21579 }
21580
21581 void  CS_LDK_CVec_RouteHintHopZ_free(int64_tArray _res) {
21582         LDKCVec_RouteHintHopZ _res_constr;
21583         _res_constr.datalen = _res->arr_len;
21584         if (_res_constr.datalen > 0)
21585                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
21586         else
21587                 _res_constr.data = NULL;
21588         int64_t* _res_vals = _res->elems;
21589         for (size_t o = 0; o < _res_constr.datalen; o++) {
21590                 int64_t _res_conv_14 = _res_vals[o];
21591                 LDKRouteHintHop _res_conv_14_conv;
21592                 _res_conv_14_conv.inner = untag_ptr(_res_conv_14);
21593                 _res_conv_14_conv.is_owned = ptr_is_owned(_res_conv_14);
21594                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
21595                 _res_constr.data[o] = _res_conv_14_conv;
21596         }
21597         FREE(_res);
21598         CVec_RouteHintHopZ_free(_res_constr);
21599 }
21600
21601 int64_t  CS_LDK_CResult_RouteHintDecodeErrorZ_ok(int64_t o) {
21602         LDKRouteHint o_conv;
21603         o_conv.inner = untag_ptr(o);
21604         o_conv.is_owned = ptr_is_owned(o);
21605         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21606         o_conv = RouteHint_clone(&o_conv);
21607         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
21608         *ret_conv = CResult_RouteHintDecodeErrorZ_ok(o_conv);
21609         return tag_ptr(ret_conv, true);
21610 }
21611
21612 int64_t  CS_LDK_CResult_RouteHintDecodeErrorZ_err(int64_t e) {
21613         void* e_ptr = untag_ptr(e);
21614         CHECK_ACCESS(e_ptr);
21615         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21616         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21617         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
21618         *ret_conv = CResult_RouteHintDecodeErrorZ_err(e_conv);
21619         return tag_ptr(ret_conv, true);
21620 }
21621
21622 jboolean  CS_LDK_CResult_RouteHintDecodeErrorZ_is_ok(int64_t o) {
21623         LDKCResult_RouteHintDecodeErrorZ* o_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(o);
21624         jboolean ret_conv = CResult_RouteHintDecodeErrorZ_is_ok(o_conv);
21625         return ret_conv;
21626 }
21627
21628 void  CS_LDK_CResult_RouteHintDecodeErrorZ_free(int64_t _res) {
21629         if (!ptr_is_owned(_res)) return;
21630         void* _res_ptr = untag_ptr(_res);
21631         CHECK_ACCESS(_res_ptr);
21632         LDKCResult_RouteHintDecodeErrorZ _res_conv = *(LDKCResult_RouteHintDecodeErrorZ*)(_res_ptr);
21633         FREE(untag_ptr(_res));
21634         CResult_RouteHintDecodeErrorZ_free(_res_conv);
21635 }
21636
21637 static inline uint64_t CResult_RouteHintDecodeErrorZ_clone_ptr(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR arg) {
21638         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
21639         *ret_conv = CResult_RouteHintDecodeErrorZ_clone(arg);
21640         return tag_ptr(ret_conv, true);
21641 }
21642 int64_t  CS_LDK_CResult_RouteHintDecodeErrorZ_clone_ptr(int64_t arg) {
21643         LDKCResult_RouteHintDecodeErrorZ* arg_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(arg);
21644         int64_t ret_conv = CResult_RouteHintDecodeErrorZ_clone_ptr(arg_conv);
21645         return ret_conv;
21646 }
21647
21648 int64_t  CS_LDK_CResult_RouteHintDecodeErrorZ_clone(int64_t orig) {
21649         LDKCResult_RouteHintDecodeErrorZ* orig_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(orig);
21650         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
21651         *ret_conv = CResult_RouteHintDecodeErrorZ_clone(orig_conv);
21652         return tag_ptr(ret_conv, true);
21653 }
21654
21655 int64_t  CS_LDK_CResult_RouteHintHopDecodeErrorZ_ok(int64_t o) {
21656         LDKRouteHintHop o_conv;
21657         o_conv.inner = untag_ptr(o);
21658         o_conv.is_owned = ptr_is_owned(o);
21659         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21660         o_conv = RouteHintHop_clone(&o_conv);
21661         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
21662         *ret_conv = CResult_RouteHintHopDecodeErrorZ_ok(o_conv);
21663         return tag_ptr(ret_conv, true);
21664 }
21665
21666 int64_t  CS_LDK_CResult_RouteHintHopDecodeErrorZ_err(int64_t e) {
21667         void* e_ptr = untag_ptr(e);
21668         CHECK_ACCESS(e_ptr);
21669         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21670         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21671         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
21672         *ret_conv = CResult_RouteHintHopDecodeErrorZ_err(e_conv);
21673         return tag_ptr(ret_conv, true);
21674 }
21675
21676 jboolean  CS_LDK_CResult_RouteHintHopDecodeErrorZ_is_ok(int64_t o) {
21677         LDKCResult_RouteHintHopDecodeErrorZ* o_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(o);
21678         jboolean ret_conv = CResult_RouteHintHopDecodeErrorZ_is_ok(o_conv);
21679         return ret_conv;
21680 }
21681
21682 void  CS_LDK_CResult_RouteHintHopDecodeErrorZ_free(int64_t _res) {
21683         if (!ptr_is_owned(_res)) return;
21684         void* _res_ptr = untag_ptr(_res);
21685         CHECK_ACCESS(_res_ptr);
21686         LDKCResult_RouteHintHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHintHopDecodeErrorZ*)(_res_ptr);
21687         FREE(untag_ptr(_res));
21688         CResult_RouteHintHopDecodeErrorZ_free(_res_conv);
21689 }
21690
21691 static inline uint64_t CResult_RouteHintHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR arg) {
21692         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
21693         *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(arg);
21694         return tag_ptr(ret_conv, true);
21695 }
21696 int64_t  CS_LDK_CResult_RouteHintHopDecodeErrorZ_clone_ptr(int64_t arg) {
21697         LDKCResult_RouteHintHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(arg);
21698         int64_t ret_conv = CResult_RouteHintHopDecodeErrorZ_clone_ptr(arg_conv);
21699         return ret_conv;
21700 }
21701
21702 int64_t  CS_LDK_CResult_RouteHintHopDecodeErrorZ_clone(int64_t orig) {
21703         LDKCResult_RouteHintHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(orig);
21704         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
21705         *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(orig_conv);
21706         return tag_ptr(ret_conv, true);
21707 }
21708
21709 int64_t  CS_LDK_CResult_FixedPenaltyScorerDecodeErrorZ_ok(int64_t o) {
21710         LDKFixedPenaltyScorer o_conv;
21711         o_conv.inner = untag_ptr(o);
21712         o_conv.is_owned = ptr_is_owned(o);
21713         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21714         o_conv = FixedPenaltyScorer_clone(&o_conv);
21715         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
21716         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_ok(o_conv);
21717         return tag_ptr(ret_conv, true);
21718 }
21719
21720 int64_t  CS_LDK_CResult_FixedPenaltyScorerDecodeErrorZ_err(int64_t e) {
21721         void* e_ptr = untag_ptr(e);
21722         CHECK_ACCESS(e_ptr);
21723         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21724         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21725         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
21726         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_err(e_conv);
21727         return tag_ptr(ret_conv, true);
21728 }
21729
21730 jboolean  CS_LDK_CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(int64_t o) {
21731         LDKCResult_FixedPenaltyScorerDecodeErrorZ* o_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(o);
21732         jboolean ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(o_conv);
21733         return ret_conv;
21734 }
21735
21736 void  CS_LDK_CResult_FixedPenaltyScorerDecodeErrorZ_free(int64_t _res) {
21737         if (!ptr_is_owned(_res)) return;
21738         void* _res_ptr = untag_ptr(_res);
21739         CHECK_ACCESS(_res_ptr);
21740         LDKCResult_FixedPenaltyScorerDecodeErrorZ _res_conv = *(LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(_res_ptr);
21741         FREE(untag_ptr(_res));
21742         CResult_FixedPenaltyScorerDecodeErrorZ_free(_res_conv);
21743 }
21744
21745 static inline uint64_t CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR arg) {
21746         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
21747         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(arg);
21748         return tag_ptr(ret_conv, true);
21749 }
21750 int64_t  CS_LDK_CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(int64_t arg) {
21751         LDKCResult_FixedPenaltyScorerDecodeErrorZ* arg_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(arg);
21752         int64_t ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(arg_conv);
21753         return ret_conv;
21754 }
21755
21756 int64_t  CS_LDK_CResult_FixedPenaltyScorerDecodeErrorZ_clone(int64_t orig) {
21757         LDKCResult_FixedPenaltyScorerDecodeErrorZ* orig_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(orig);
21758         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
21759         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(orig_conv);
21760         return tag_ptr(ret_conv, true);
21761 }
21762
21763 void  CS_LDK_CVec_NodeIdZ_free(int64_tArray _res) {
21764         LDKCVec_NodeIdZ _res_constr;
21765         _res_constr.datalen = _res->arr_len;
21766         if (_res_constr.datalen > 0)
21767                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeId), "LDKCVec_NodeIdZ Elements");
21768         else
21769                 _res_constr.data = NULL;
21770         int64_t* _res_vals = _res->elems;
21771         for (size_t i = 0; i < _res_constr.datalen; i++) {
21772                 int64_t _res_conv_8 = _res_vals[i];
21773                 LDKNodeId _res_conv_8_conv;
21774                 _res_conv_8_conv.inner = untag_ptr(_res_conv_8);
21775                 _res_conv_8_conv.is_owned = ptr_is_owned(_res_conv_8);
21776                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_8_conv);
21777                 _res_constr.data[i] = _res_conv_8_conv;
21778         }
21779         FREE(_res);
21780         CVec_NodeIdZ_free(_res_constr);
21781 }
21782
21783 static inline uint64_t C2Tuple_u64u64Z_clone_ptr(LDKC2Tuple_u64u64Z *NONNULL_PTR arg) {
21784         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
21785         *ret_conv = C2Tuple_u64u64Z_clone(arg);
21786         return tag_ptr(ret_conv, true);
21787 }
21788 int64_t  CS_LDK_C2Tuple_u64u64Z_clone_ptr(int64_t arg) {
21789         LDKC2Tuple_u64u64Z* arg_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(arg);
21790         int64_t ret_conv = C2Tuple_u64u64Z_clone_ptr(arg_conv);
21791         return ret_conv;
21792 }
21793
21794 int64_t  CS_LDK_C2Tuple_u64u64Z_clone(int64_t orig) {
21795         LDKC2Tuple_u64u64Z* orig_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(orig);
21796         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
21797         *ret_conv = C2Tuple_u64u64Z_clone(orig_conv);
21798         return tag_ptr(ret_conv, true);
21799 }
21800
21801 int64_t  CS_LDK_C2Tuple_u64u64Z_new(int64_t a, int64_t b) {
21802         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
21803         *ret_conv = C2Tuple_u64u64Z_new(a, b);
21804         return tag_ptr(ret_conv, true);
21805 }
21806
21807 void  CS_LDK_C2Tuple_u64u64Z_free(int64_t _res) {
21808         if (!ptr_is_owned(_res)) return;
21809         void* _res_ptr = untag_ptr(_res);
21810         CHECK_ACCESS(_res_ptr);
21811         LDKC2Tuple_u64u64Z _res_conv = *(LDKC2Tuple_u64u64Z*)(_res_ptr);
21812         FREE(untag_ptr(_res));
21813         C2Tuple_u64u64Z_free(_res_conv);
21814 }
21815
21816 int64_t  CS_LDK_COption_C2Tuple_u64u64ZZ_some(int64_t o) {
21817         void* o_ptr = untag_ptr(o);
21818         CHECK_ACCESS(o_ptr);
21819         LDKC2Tuple_u64u64Z o_conv = *(LDKC2Tuple_u64u64Z*)(o_ptr);
21820         o_conv = C2Tuple_u64u64Z_clone((LDKC2Tuple_u64u64Z*)untag_ptr(o));
21821         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
21822         *ret_copy = COption_C2Tuple_u64u64ZZ_some(o_conv);
21823         int64_t ret_ref = tag_ptr(ret_copy, true);
21824         return ret_ref;
21825 }
21826
21827 int64_t  CS_LDK_COption_C2Tuple_u64u64ZZ_none() {
21828         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
21829         *ret_copy = COption_C2Tuple_u64u64ZZ_none();
21830         int64_t ret_ref = tag_ptr(ret_copy, true);
21831         return ret_ref;
21832 }
21833
21834 void  CS_LDK_COption_C2Tuple_u64u64ZZ_free(int64_t _res) {
21835         if (!ptr_is_owned(_res)) return;
21836         void* _res_ptr = untag_ptr(_res);
21837         CHECK_ACCESS(_res_ptr);
21838         LDKCOption_C2Tuple_u64u64ZZ _res_conv = *(LDKCOption_C2Tuple_u64u64ZZ*)(_res_ptr);
21839         FREE(untag_ptr(_res));
21840         COption_C2Tuple_u64u64ZZ_free(_res_conv);
21841 }
21842
21843 static inline uint64_t COption_C2Tuple_u64u64ZZ_clone_ptr(LDKCOption_C2Tuple_u64u64ZZ *NONNULL_PTR arg) {
21844         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
21845         *ret_copy = COption_C2Tuple_u64u64ZZ_clone(arg);
21846         int64_t ret_ref = tag_ptr(ret_copy, true);
21847         return ret_ref;
21848 }
21849 int64_t  CS_LDK_COption_C2Tuple_u64u64ZZ_clone_ptr(int64_t arg) {
21850         LDKCOption_C2Tuple_u64u64ZZ* arg_conv = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(arg);
21851         int64_t ret_conv = COption_C2Tuple_u64u64ZZ_clone_ptr(arg_conv);
21852         return ret_conv;
21853 }
21854
21855 int64_t  CS_LDK_COption_C2Tuple_u64u64ZZ_clone(int64_t orig) {
21856         LDKCOption_C2Tuple_u64u64ZZ* orig_conv = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(orig);
21857         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
21858         *ret_copy = COption_C2Tuple_u64u64ZZ_clone(orig_conv);
21859         int64_t ret_ref = tag_ptr(ret_copy, true);
21860         return ret_ref;
21861 }
21862
21863 int64_t  CS_LDK_C2Tuple_Z_new(int16_tArray a, int16_tArray b) {
21864         LDKThirtyTwoU16s a_ref;
21865         CHECK(a->arr_len == 32);
21866         memcpy(a_ref.data, a->elems, 32 * 2); FREE(a);
21867         LDKThirtyTwoU16s b_ref;
21868         CHECK(b->arr_len == 32);
21869         memcpy(b_ref.data, b->elems, 32 * 2); FREE(b);
21870         LDKC2Tuple_Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_Z), "LDKC2Tuple_Z");
21871         *ret_conv = C2Tuple_Z_new(a_ref, b_ref);
21872         return tag_ptr(ret_conv, true);
21873 }
21874
21875 void  CS_LDK_C2Tuple_Z_free(int64_t _res) {
21876         if (!ptr_is_owned(_res)) return;
21877         void* _res_ptr = untag_ptr(_res);
21878         CHECK_ACCESS(_res_ptr);
21879         LDKC2Tuple_Z _res_conv = *(LDKC2Tuple_Z*)(_res_ptr);
21880         FREE(untag_ptr(_res));
21881         C2Tuple_Z_free(_res_conv);
21882 }
21883
21884 int64_t  CS_LDK_C2Tuple__u1632_u1632Z_new(int16_tArray a, int16_tArray b) {
21885         LDKThirtyTwoU16s a_ref;
21886         CHECK(a->arr_len == 32);
21887         memcpy(a_ref.data, a->elems, 32 * 2); FREE(a);
21888         LDKThirtyTwoU16s b_ref;
21889         CHECK(b->arr_len == 32);
21890         memcpy(b_ref.data, b->elems, 32 * 2); FREE(b);
21891         LDKC2Tuple__u1632_u1632Z* ret_conv = MALLOC(sizeof(LDKC2Tuple__u1632_u1632Z), "LDKC2Tuple__u1632_u1632Z");
21892         *ret_conv = C2Tuple__u1632_u1632Z_new(a_ref, b_ref);
21893         return tag_ptr(ret_conv, true);
21894 }
21895
21896 void  CS_LDK_C2Tuple__u1632_u1632Z_free(int64_t _res) {
21897         if (!ptr_is_owned(_res)) return;
21898         void* _res_ptr = untag_ptr(_res);
21899         CHECK_ACCESS(_res_ptr);
21900         LDKC2Tuple__u1632_u1632Z _res_conv = *(LDKC2Tuple__u1632_u1632Z*)(_res_ptr);
21901         FREE(untag_ptr(_res));
21902         C2Tuple__u1632_u1632Z_free(_res_conv);
21903 }
21904
21905 int64_t  CS_LDK_COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_some(int64_t o) {
21906         void* o_ptr = untag_ptr(o);
21907         CHECK_ACCESS(o_ptr);
21908         LDKC2Tuple__u1632_u1632Z o_conv = *(LDKC2Tuple__u1632_u1632Z*)(o_ptr);
21909         // WARNING: we may need a move here but no clone is available for LDKC2Tuple__u1632_u1632Z
21910         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ), "LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ");
21911         *ret_copy = COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_some(o_conv);
21912         int64_t ret_ref = tag_ptr(ret_copy, true);
21913         return ret_ref;
21914 }
21915
21916 int64_t  CS_LDK_COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_none() {
21917         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ), "LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ");
21918         *ret_copy = COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_none();
21919         int64_t ret_ref = tag_ptr(ret_copy, true);
21920         return ret_ref;
21921 }
21922
21923 void  CS_LDK_COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_free(int64_t _res) {
21924         if (!ptr_is_owned(_res)) return;
21925         void* _res_ptr = untag_ptr(_res);
21926         CHECK_ACCESS(_res_ptr);
21927         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ _res_conv = *(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ*)(_res_ptr);
21928         FREE(untag_ptr(_res));
21929         COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_free(_res_conv);
21930 }
21931
21932 int64_t  CS_LDK_COption_f64Z_some(double o) {
21933         LDKCOption_f64Z *ret_copy = MALLOC(sizeof(LDKCOption_f64Z), "LDKCOption_f64Z");
21934         *ret_copy = COption_f64Z_some(o);
21935         int64_t ret_ref = tag_ptr(ret_copy, true);
21936         return ret_ref;
21937 }
21938
21939 int64_t  CS_LDK_COption_f64Z_none() {
21940         LDKCOption_f64Z *ret_copy = MALLOC(sizeof(LDKCOption_f64Z), "LDKCOption_f64Z");
21941         *ret_copy = COption_f64Z_none();
21942         int64_t ret_ref = tag_ptr(ret_copy, true);
21943         return ret_ref;
21944 }
21945
21946 void  CS_LDK_COption_f64Z_free(int64_t _res) {
21947         if (!ptr_is_owned(_res)) return;
21948         void* _res_ptr = untag_ptr(_res);
21949         CHECK_ACCESS(_res_ptr);
21950         LDKCOption_f64Z _res_conv = *(LDKCOption_f64Z*)(_res_ptr);
21951         FREE(untag_ptr(_res));
21952         COption_f64Z_free(_res_conv);
21953 }
21954
21955 static inline uint64_t COption_f64Z_clone_ptr(LDKCOption_f64Z *NONNULL_PTR arg) {
21956         LDKCOption_f64Z *ret_copy = MALLOC(sizeof(LDKCOption_f64Z), "LDKCOption_f64Z");
21957         *ret_copy = COption_f64Z_clone(arg);
21958         int64_t ret_ref = tag_ptr(ret_copy, true);
21959         return ret_ref;
21960 }
21961 int64_t  CS_LDK_COption_f64Z_clone_ptr(int64_t arg) {
21962         LDKCOption_f64Z* arg_conv = (LDKCOption_f64Z*)untag_ptr(arg);
21963         int64_t ret_conv = COption_f64Z_clone_ptr(arg_conv);
21964         return ret_conv;
21965 }
21966
21967 int64_t  CS_LDK_COption_f64Z_clone(int64_t orig) {
21968         LDKCOption_f64Z* orig_conv = (LDKCOption_f64Z*)untag_ptr(orig);
21969         LDKCOption_f64Z *ret_copy = MALLOC(sizeof(LDKCOption_f64Z), "LDKCOption_f64Z");
21970         *ret_copy = COption_f64Z_clone(orig_conv);
21971         int64_t ret_ref = tag_ptr(ret_copy, true);
21972         return ret_ref;
21973 }
21974
21975 int64_t  CS_LDK_CResult_ProbabilisticScorerDecodeErrorZ_ok(int64_t o) {
21976         LDKProbabilisticScorer o_conv;
21977         o_conv.inner = untag_ptr(o);
21978         o_conv.is_owned = ptr_is_owned(o);
21979         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21980         // WARNING: we need a move here but no clone is available for LDKProbabilisticScorer
21981         
21982         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
21983         *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_ok(o_conv);
21984         return tag_ptr(ret_conv, true);
21985 }
21986
21987 int64_t  CS_LDK_CResult_ProbabilisticScorerDecodeErrorZ_err(int64_t e) {
21988         void* e_ptr = untag_ptr(e);
21989         CHECK_ACCESS(e_ptr);
21990         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21991         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21992         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
21993         *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_err(e_conv);
21994         return tag_ptr(ret_conv, true);
21995 }
21996
21997 jboolean  CS_LDK_CResult_ProbabilisticScorerDecodeErrorZ_is_ok(int64_t o) {
21998         LDKCResult_ProbabilisticScorerDecodeErrorZ* o_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(o);
21999         jboolean ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_is_ok(o_conv);
22000         return ret_conv;
22001 }
22002
22003 void  CS_LDK_CResult_ProbabilisticScorerDecodeErrorZ_free(int64_t _res) {
22004         if (!ptr_is_owned(_res)) return;
22005         void* _res_ptr = untag_ptr(_res);
22006         CHECK_ACCESS(_res_ptr);
22007         LDKCResult_ProbabilisticScorerDecodeErrorZ _res_conv = *(LDKCResult_ProbabilisticScorerDecodeErrorZ*)(_res_ptr);
22008         FREE(untag_ptr(_res));
22009         CResult_ProbabilisticScorerDecodeErrorZ_free(_res_conv);
22010 }
22011
22012 int64_t  CS_LDK_CResult_BestBlockDecodeErrorZ_ok(int64_t o) {
22013         LDKBestBlock o_conv;
22014         o_conv.inner = untag_ptr(o);
22015         o_conv.is_owned = ptr_is_owned(o);
22016         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22017         o_conv = BestBlock_clone(&o_conv);
22018         LDKCResult_BestBlockDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BestBlockDecodeErrorZ), "LDKCResult_BestBlockDecodeErrorZ");
22019         *ret_conv = CResult_BestBlockDecodeErrorZ_ok(o_conv);
22020         return tag_ptr(ret_conv, true);
22021 }
22022
22023 int64_t  CS_LDK_CResult_BestBlockDecodeErrorZ_err(int64_t e) {
22024         void* e_ptr = untag_ptr(e);
22025         CHECK_ACCESS(e_ptr);
22026         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22027         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22028         LDKCResult_BestBlockDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BestBlockDecodeErrorZ), "LDKCResult_BestBlockDecodeErrorZ");
22029         *ret_conv = CResult_BestBlockDecodeErrorZ_err(e_conv);
22030         return tag_ptr(ret_conv, true);
22031 }
22032
22033 jboolean  CS_LDK_CResult_BestBlockDecodeErrorZ_is_ok(int64_t o) {
22034         LDKCResult_BestBlockDecodeErrorZ* o_conv = (LDKCResult_BestBlockDecodeErrorZ*)untag_ptr(o);
22035         jboolean ret_conv = CResult_BestBlockDecodeErrorZ_is_ok(o_conv);
22036         return ret_conv;
22037 }
22038
22039 void  CS_LDK_CResult_BestBlockDecodeErrorZ_free(int64_t _res) {
22040         if (!ptr_is_owned(_res)) return;
22041         void* _res_ptr = untag_ptr(_res);
22042         CHECK_ACCESS(_res_ptr);
22043         LDKCResult_BestBlockDecodeErrorZ _res_conv = *(LDKCResult_BestBlockDecodeErrorZ*)(_res_ptr);
22044         FREE(untag_ptr(_res));
22045         CResult_BestBlockDecodeErrorZ_free(_res_conv);
22046 }
22047
22048 static inline uint64_t CResult_BestBlockDecodeErrorZ_clone_ptr(LDKCResult_BestBlockDecodeErrorZ *NONNULL_PTR arg) {
22049         LDKCResult_BestBlockDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BestBlockDecodeErrorZ), "LDKCResult_BestBlockDecodeErrorZ");
22050         *ret_conv = CResult_BestBlockDecodeErrorZ_clone(arg);
22051         return tag_ptr(ret_conv, true);
22052 }
22053 int64_t  CS_LDK_CResult_BestBlockDecodeErrorZ_clone_ptr(int64_t arg) {
22054         LDKCResult_BestBlockDecodeErrorZ* arg_conv = (LDKCResult_BestBlockDecodeErrorZ*)untag_ptr(arg);
22055         int64_t ret_conv = CResult_BestBlockDecodeErrorZ_clone_ptr(arg_conv);
22056         return ret_conv;
22057 }
22058
22059 int64_t  CS_LDK_CResult_BestBlockDecodeErrorZ_clone(int64_t orig) {
22060         LDKCResult_BestBlockDecodeErrorZ* orig_conv = (LDKCResult_BestBlockDecodeErrorZ*)untag_ptr(orig);
22061         LDKCResult_BestBlockDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BestBlockDecodeErrorZ), "LDKCResult_BestBlockDecodeErrorZ");
22062         *ret_conv = CResult_BestBlockDecodeErrorZ_clone(orig_conv);
22063         return tag_ptr(ret_conv, true);
22064 }
22065
22066 static inline uint64_t C2Tuple_usizeTransactionZ_clone_ptr(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR arg) {
22067         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
22068         *ret_conv = C2Tuple_usizeTransactionZ_clone(arg);
22069         return tag_ptr(ret_conv, true);
22070 }
22071 int64_t  CS_LDK_C2Tuple_usizeTransactionZ_clone_ptr(int64_t arg) {
22072         LDKC2Tuple_usizeTransactionZ* arg_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(arg);
22073         int64_t ret_conv = C2Tuple_usizeTransactionZ_clone_ptr(arg_conv);
22074         return ret_conv;
22075 }
22076
22077 int64_t  CS_LDK_C2Tuple_usizeTransactionZ_clone(int64_t orig) {
22078         LDKC2Tuple_usizeTransactionZ* orig_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(orig);
22079         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
22080         *ret_conv = C2Tuple_usizeTransactionZ_clone(orig_conv);
22081         return tag_ptr(ret_conv, true);
22082 }
22083
22084 int64_t  CS_LDK_C2Tuple_usizeTransactionZ_new(int64_t a, int8_tArray b) {
22085         LDKTransaction b_ref;
22086         b_ref.datalen = b->arr_len;
22087         b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
22088         memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
22089         b_ref.data_is_owned = true;
22090         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
22091         *ret_conv = C2Tuple_usizeTransactionZ_new(a, b_ref);
22092         return tag_ptr(ret_conv, true);
22093 }
22094
22095 void  CS_LDK_C2Tuple_usizeTransactionZ_free(int64_t _res) {
22096         if (!ptr_is_owned(_res)) return;
22097         void* _res_ptr = untag_ptr(_res);
22098         CHECK_ACCESS(_res_ptr);
22099         LDKC2Tuple_usizeTransactionZ _res_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_ptr);
22100         FREE(untag_ptr(_res));
22101         C2Tuple_usizeTransactionZ_free(_res_conv);
22102 }
22103
22104 void  CS_LDK_CVec_C2Tuple_usizeTransactionZZ_free(int64_tArray _res) {
22105         LDKCVec_C2Tuple_usizeTransactionZZ _res_constr;
22106         _res_constr.datalen = _res->arr_len;
22107         if (_res_constr.datalen > 0)
22108                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
22109         else
22110                 _res_constr.data = NULL;
22111         int64_t* _res_vals = _res->elems;
22112         for (size_t c = 0; c < _res_constr.datalen; c++) {
22113                 int64_t _res_conv_28 = _res_vals[c];
22114                 void* _res_conv_28_ptr = untag_ptr(_res_conv_28);
22115                 CHECK_ACCESS(_res_conv_28_ptr);
22116                 LDKC2Tuple_usizeTransactionZ _res_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_conv_28_ptr);
22117                 FREE(untag_ptr(_res_conv_28));
22118                 _res_constr.data[c] = _res_conv_28_conv;
22119         }
22120         FREE(_res);
22121         CVec_C2Tuple_usizeTransactionZZ_free(_res_constr);
22122 }
22123
22124 static inline uint64_t C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_clone_ptr(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ *NONNULL_PTR arg) {
22125         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ), "LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ");
22126         *ret_conv = C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_clone(arg);
22127         return tag_ptr(ret_conv, true);
22128 }
22129 int64_t  CS_LDK_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_clone_ptr(int64_t arg) {
22130         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* arg_conv = (LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ*)untag_ptr(arg);
22131         int64_t ret_conv = C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_clone_ptr(arg_conv);
22132         return ret_conv;
22133 }
22134
22135 int64_t  CS_LDK_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_clone(int64_t orig) {
22136         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* orig_conv = (LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ*)untag_ptr(orig);
22137         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ), "LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ");
22138         *ret_conv = C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_clone(orig_conv);
22139         return tag_ptr(ret_conv, true);
22140 }
22141
22142 int64_t  CS_LDK_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_new(int8_tArray a, int32_t b, int64_t c) {
22143         LDKThirtyTwoBytes a_ref;
22144         CHECK(a->arr_len == 32);
22145         memcpy(a_ref.data, a->elems, 32); FREE(a);
22146         void* c_ptr = untag_ptr(c);
22147         CHECK_ACCESS(c_ptr);
22148         LDKCOption_ThirtyTwoBytesZ c_conv = *(LDKCOption_ThirtyTwoBytesZ*)(c_ptr);
22149         c_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(c));
22150         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ), "LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ");
22151         *ret_conv = C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_new(a_ref, b, c_conv);
22152         return tag_ptr(ret_conv, true);
22153 }
22154
22155 void  CS_LDK_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_free(int64_t _res) {
22156         if (!ptr_is_owned(_res)) return;
22157         void* _res_ptr = untag_ptr(_res);
22158         CHECK_ACCESS(_res_ptr);
22159         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ _res_conv = *(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ*)(_res_ptr);
22160         FREE(untag_ptr(_res));
22161         C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_free(_res_conv);
22162 }
22163
22164 void  CS_LDK_CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ_free(int64_tArray _res) {
22165         LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ _res_constr;
22166         _res_constr.datalen = _res->arr_len;
22167         if (_res_constr.datalen > 0)
22168                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ), "LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ Elements");
22169         else
22170                 _res_constr.data = NULL;
22171         int64_t* _res_vals = _res->elems;
22172         for (size_t c = 0; c < _res_constr.datalen; c++) {
22173                 int64_t _res_conv_54 = _res_vals[c];
22174                 void* _res_conv_54_ptr = untag_ptr(_res_conv_54);
22175                 CHECK_ACCESS(_res_conv_54_ptr);
22176                 LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ _res_conv_54_conv = *(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ*)(_res_conv_54_ptr);
22177                 FREE(untag_ptr(_res_conv_54));
22178                 _res_constr.data[c] = _res_conv_54_conv;
22179         }
22180         FREE(_res);
22181         CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ_free(_res_constr);
22182 }
22183
22184 int64_t  CS_LDK_CResult_ChannelMonitorUpdateStatusNoneZ_ok(int32_t o) {
22185         LDKChannelMonitorUpdateStatus o_conv = LDKChannelMonitorUpdateStatus_from_cs(o);
22186         LDKCResult_ChannelMonitorUpdateStatusNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateStatusNoneZ), "LDKCResult_ChannelMonitorUpdateStatusNoneZ");
22187         *ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_ok(o_conv);
22188         return tag_ptr(ret_conv, true);
22189 }
22190
22191 int64_t  CS_LDK_CResult_ChannelMonitorUpdateStatusNoneZ_err() {
22192         LDKCResult_ChannelMonitorUpdateStatusNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateStatusNoneZ), "LDKCResult_ChannelMonitorUpdateStatusNoneZ");
22193         *ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_err();
22194         return tag_ptr(ret_conv, true);
22195 }
22196
22197 jboolean  CS_LDK_CResult_ChannelMonitorUpdateStatusNoneZ_is_ok(int64_t o) {
22198         LDKCResult_ChannelMonitorUpdateStatusNoneZ* o_conv = (LDKCResult_ChannelMonitorUpdateStatusNoneZ*)untag_ptr(o);
22199         jboolean ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_is_ok(o_conv);
22200         return ret_conv;
22201 }
22202
22203 void  CS_LDK_CResult_ChannelMonitorUpdateStatusNoneZ_free(int64_t _res) {
22204         if (!ptr_is_owned(_res)) return;
22205         void* _res_ptr = untag_ptr(_res);
22206         CHECK_ACCESS(_res_ptr);
22207         LDKCResult_ChannelMonitorUpdateStatusNoneZ _res_conv = *(LDKCResult_ChannelMonitorUpdateStatusNoneZ*)(_res_ptr);
22208         FREE(untag_ptr(_res));
22209         CResult_ChannelMonitorUpdateStatusNoneZ_free(_res_conv);
22210 }
22211
22212 static inline uint64_t CResult_ChannelMonitorUpdateStatusNoneZ_clone_ptr(LDKCResult_ChannelMonitorUpdateStatusNoneZ *NONNULL_PTR arg) {
22213         LDKCResult_ChannelMonitorUpdateStatusNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateStatusNoneZ), "LDKCResult_ChannelMonitorUpdateStatusNoneZ");
22214         *ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_clone(arg);
22215         return tag_ptr(ret_conv, true);
22216 }
22217 int64_t  CS_LDK_CResult_ChannelMonitorUpdateStatusNoneZ_clone_ptr(int64_t arg) {
22218         LDKCResult_ChannelMonitorUpdateStatusNoneZ* arg_conv = (LDKCResult_ChannelMonitorUpdateStatusNoneZ*)untag_ptr(arg);
22219         int64_t ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_clone_ptr(arg_conv);
22220         return ret_conv;
22221 }
22222
22223 int64_t  CS_LDK_CResult_ChannelMonitorUpdateStatusNoneZ_clone(int64_t orig) {
22224         LDKCResult_ChannelMonitorUpdateStatusNoneZ* orig_conv = (LDKCResult_ChannelMonitorUpdateStatusNoneZ*)untag_ptr(orig);
22225         LDKCResult_ChannelMonitorUpdateStatusNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateStatusNoneZ), "LDKCResult_ChannelMonitorUpdateStatusNoneZ");
22226         *ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_clone(orig_conv);
22227         return tag_ptr(ret_conv, true);
22228 }
22229
22230 void  CS_LDK_CVec_MonitorEventZ_free(int64_tArray _res) {
22231         LDKCVec_MonitorEventZ _res_constr;
22232         _res_constr.datalen = _res->arr_len;
22233         if (_res_constr.datalen > 0)
22234                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
22235         else
22236                 _res_constr.data = NULL;
22237         int64_t* _res_vals = _res->elems;
22238         for (size_t o = 0; o < _res_constr.datalen; o++) {
22239                 int64_t _res_conv_14 = _res_vals[o];
22240                 void* _res_conv_14_ptr = untag_ptr(_res_conv_14);
22241                 CHECK_ACCESS(_res_conv_14_ptr);
22242                 LDKMonitorEvent _res_conv_14_conv = *(LDKMonitorEvent*)(_res_conv_14_ptr);
22243                 FREE(untag_ptr(_res_conv_14));
22244                 _res_constr.data[o] = _res_conv_14_conv;
22245         }
22246         FREE(_res);
22247         CVec_MonitorEventZ_free(_res_constr);
22248 }
22249
22250 static inline uint64_t C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_clone_ptr(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ *NONNULL_PTR arg) {
22251         LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ), "LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ");
22252         *ret_conv = C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_clone(arg);
22253         return tag_ptr(ret_conv, true);
22254 }
22255 int64_t  CS_LDK_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_clone_ptr(int64_t arg) {
22256         LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ* arg_conv = (LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ*)untag_ptr(arg);
22257         int64_t ret_conv = C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_clone_ptr(arg_conv);
22258         return ret_conv;
22259 }
22260
22261 int64_t  CS_LDK_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_clone(int64_t orig) {
22262         LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ* orig_conv = (LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ*)untag_ptr(orig);
22263         LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ), "LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ");
22264         *ret_conv = C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_clone(orig_conv);
22265         return tag_ptr(ret_conv, true);
22266 }
22267
22268 int64_t  CS_LDK_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_new(int64_t a, int64_t b, int64_tArray c, int8_tArray d) {
22269         LDKOutPoint a_conv;
22270         a_conv.inner = untag_ptr(a);
22271         a_conv.is_owned = ptr_is_owned(a);
22272         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
22273         a_conv = OutPoint_clone(&a_conv);
22274         LDKChannelId b_conv;
22275         b_conv.inner = untag_ptr(b);
22276         b_conv.is_owned = ptr_is_owned(b);
22277         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
22278         b_conv = ChannelId_clone(&b_conv);
22279         LDKCVec_MonitorEventZ c_constr;
22280         c_constr.datalen = c->arr_len;
22281         if (c_constr.datalen > 0)
22282                 c_constr.data = MALLOC(c_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
22283         else
22284                 c_constr.data = NULL;
22285         int64_t* c_vals = c->elems;
22286         for (size_t o = 0; o < c_constr.datalen; o++) {
22287                 int64_t c_conv_14 = c_vals[o];
22288                 void* c_conv_14_ptr = untag_ptr(c_conv_14);
22289                 CHECK_ACCESS(c_conv_14_ptr);
22290                 LDKMonitorEvent c_conv_14_conv = *(LDKMonitorEvent*)(c_conv_14_ptr);
22291                 c_conv_14_conv = MonitorEvent_clone((LDKMonitorEvent*)untag_ptr(c_conv_14));
22292                 c_constr.data[o] = c_conv_14_conv;
22293         }
22294         FREE(c);
22295         LDKPublicKey d_ref;
22296         CHECK(d->arr_len == 33);
22297         memcpy(d_ref.compressed_form, d->elems, 33); FREE(d);
22298         LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ), "LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ");
22299         *ret_conv = C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_new(a_conv, b_conv, c_constr, d_ref);
22300         return tag_ptr(ret_conv, true);
22301 }
22302
22303 void  CS_LDK_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_free(int64_t _res) {
22304         if (!ptr_is_owned(_res)) return;
22305         void* _res_ptr = untag_ptr(_res);
22306         CHECK_ACCESS(_res_ptr);
22307         LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ _res_conv = *(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ*)(_res_ptr);
22308         FREE(untag_ptr(_res));
22309         C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_free(_res_conv);
22310 }
22311
22312 void  CS_LDK_CVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ_free(int64_tArray _res) {
22313         LDKCVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ _res_constr;
22314         _res_constr.datalen = _res->arr_len;
22315         if (_res_constr.datalen > 0)
22316                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ), "LDKCVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ Elements");
22317         else
22318                 _res_constr.data = NULL;
22319         int64_t* _res_vals = _res->elems;
22320         for (size_t f = 0; f < _res_constr.datalen; f++) {
22321                 int64_t _res_conv_57 = _res_vals[f];
22322                 void* _res_conv_57_ptr = untag_ptr(_res_conv_57);
22323                 CHECK_ACCESS(_res_conv_57_ptr);
22324                 LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ _res_conv_57_conv = *(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ*)(_res_conv_57_ptr);
22325                 FREE(untag_ptr(_res_conv_57));
22326                 _res_constr.data[f] = _res_conv_57_conv;
22327         }
22328         FREE(_res);
22329         CVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ_free(_res_constr);
22330 }
22331
22332 int64_t  CS_LDK_CResult_InitFeaturesDecodeErrorZ_ok(int64_t o) {
22333         LDKInitFeatures o_conv;
22334         o_conv.inner = untag_ptr(o);
22335         o_conv.is_owned = ptr_is_owned(o);
22336         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22337         o_conv = InitFeatures_clone(&o_conv);
22338         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
22339         *ret_conv = CResult_InitFeaturesDecodeErrorZ_ok(o_conv);
22340         return tag_ptr(ret_conv, true);
22341 }
22342
22343 int64_t  CS_LDK_CResult_InitFeaturesDecodeErrorZ_err(int64_t e) {
22344         void* e_ptr = untag_ptr(e);
22345         CHECK_ACCESS(e_ptr);
22346         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22347         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22348         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
22349         *ret_conv = CResult_InitFeaturesDecodeErrorZ_err(e_conv);
22350         return tag_ptr(ret_conv, true);
22351 }
22352
22353 jboolean  CS_LDK_CResult_InitFeaturesDecodeErrorZ_is_ok(int64_t o) {
22354         LDKCResult_InitFeaturesDecodeErrorZ* o_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(o);
22355         jboolean ret_conv = CResult_InitFeaturesDecodeErrorZ_is_ok(o_conv);
22356         return ret_conv;
22357 }
22358
22359 void  CS_LDK_CResult_InitFeaturesDecodeErrorZ_free(int64_t _res) {
22360         if (!ptr_is_owned(_res)) return;
22361         void* _res_ptr = untag_ptr(_res);
22362         CHECK_ACCESS(_res_ptr);
22363         LDKCResult_InitFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InitFeaturesDecodeErrorZ*)(_res_ptr);
22364         FREE(untag_ptr(_res));
22365         CResult_InitFeaturesDecodeErrorZ_free(_res_conv);
22366 }
22367
22368 static inline uint64_t CResult_InitFeaturesDecodeErrorZ_clone_ptr(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR arg) {
22369         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
22370         *ret_conv = CResult_InitFeaturesDecodeErrorZ_clone(arg);
22371         return tag_ptr(ret_conv, true);
22372 }
22373 int64_t  CS_LDK_CResult_InitFeaturesDecodeErrorZ_clone_ptr(int64_t arg) {
22374         LDKCResult_InitFeaturesDecodeErrorZ* arg_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(arg);
22375         int64_t ret_conv = CResult_InitFeaturesDecodeErrorZ_clone_ptr(arg_conv);
22376         return ret_conv;
22377 }
22378
22379 int64_t  CS_LDK_CResult_InitFeaturesDecodeErrorZ_clone(int64_t orig) {
22380         LDKCResult_InitFeaturesDecodeErrorZ* orig_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(orig);
22381         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
22382         *ret_conv = CResult_InitFeaturesDecodeErrorZ_clone(orig_conv);
22383         return tag_ptr(ret_conv, true);
22384 }
22385
22386 int64_t  CS_LDK_CResult_ChannelFeaturesDecodeErrorZ_ok(int64_t o) {
22387         LDKChannelFeatures o_conv;
22388         o_conv.inner = untag_ptr(o);
22389         o_conv.is_owned = ptr_is_owned(o);
22390         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22391         o_conv = ChannelFeatures_clone(&o_conv);
22392         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
22393         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_ok(o_conv);
22394         return tag_ptr(ret_conv, true);
22395 }
22396
22397 int64_t  CS_LDK_CResult_ChannelFeaturesDecodeErrorZ_err(int64_t e) {
22398         void* e_ptr = untag_ptr(e);
22399         CHECK_ACCESS(e_ptr);
22400         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22401         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22402         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
22403         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_err(e_conv);
22404         return tag_ptr(ret_conv, true);
22405 }
22406
22407 jboolean  CS_LDK_CResult_ChannelFeaturesDecodeErrorZ_is_ok(int64_t o) {
22408         LDKCResult_ChannelFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(o);
22409         jboolean ret_conv = CResult_ChannelFeaturesDecodeErrorZ_is_ok(o_conv);
22410         return ret_conv;
22411 }
22412
22413 void  CS_LDK_CResult_ChannelFeaturesDecodeErrorZ_free(int64_t _res) {
22414         if (!ptr_is_owned(_res)) return;
22415         void* _res_ptr = untag_ptr(_res);
22416         CHECK_ACCESS(_res_ptr);
22417         LDKCResult_ChannelFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelFeaturesDecodeErrorZ*)(_res_ptr);
22418         FREE(untag_ptr(_res));
22419         CResult_ChannelFeaturesDecodeErrorZ_free(_res_conv);
22420 }
22421
22422 static inline uint64_t CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR arg) {
22423         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
22424         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone(arg);
22425         return tag_ptr(ret_conv, true);
22426 }
22427 int64_t  CS_LDK_CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(int64_t arg) {
22428         LDKCResult_ChannelFeaturesDecodeErrorZ* arg_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(arg);
22429         int64_t ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(arg_conv);
22430         return ret_conv;
22431 }
22432
22433 int64_t  CS_LDK_CResult_ChannelFeaturesDecodeErrorZ_clone(int64_t orig) {
22434         LDKCResult_ChannelFeaturesDecodeErrorZ* orig_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(orig);
22435         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
22436         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone(orig_conv);
22437         return tag_ptr(ret_conv, true);
22438 }
22439
22440 int64_t  CS_LDK_CResult_NodeFeaturesDecodeErrorZ_ok(int64_t o) {
22441         LDKNodeFeatures o_conv;
22442         o_conv.inner = untag_ptr(o);
22443         o_conv.is_owned = ptr_is_owned(o);
22444         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22445         o_conv = NodeFeatures_clone(&o_conv);
22446         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
22447         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_ok(o_conv);
22448         return tag_ptr(ret_conv, true);
22449 }
22450
22451 int64_t  CS_LDK_CResult_NodeFeaturesDecodeErrorZ_err(int64_t e) {
22452         void* e_ptr = untag_ptr(e);
22453         CHECK_ACCESS(e_ptr);
22454         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22455         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22456         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
22457         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_err(e_conv);
22458         return tag_ptr(ret_conv, true);
22459 }
22460
22461 jboolean  CS_LDK_CResult_NodeFeaturesDecodeErrorZ_is_ok(int64_t o) {
22462         LDKCResult_NodeFeaturesDecodeErrorZ* o_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(o);
22463         jboolean ret_conv = CResult_NodeFeaturesDecodeErrorZ_is_ok(o_conv);
22464         return ret_conv;
22465 }
22466
22467 void  CS_LDK_CResult_NodeFeaturesDecodeErrorZ_free(int64_t _res) {
22468         if (!ptr_is_owned(_res)) return;
22469         void* _res_ptr = untag_ptr(_res);
22470         CHECK_ACCESS(_res_ptr);
22471         LDKCResult_NodeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_NodeFeaturesDecodeErrorZ*)(_res_ptr);
22472         FREE(untag_ptr(_res));
22473         CResult_NodeFeaturesDecodeErrorZ_free(_res_conv);
22474 }
22475
22476 static inline uint64_t CResult_NodeFeaturesDecodeErrorZ_clone_ptr(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR arg) {
22477         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
22478         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone(arg);
22479         return tag_ptr(ret_conv, true);
22480 }
22481 int64_t  CS_LDK_CResult_NodeFeaturesDecodeErrorZ_clone_ptr(int64_t arg) {
22482         LDKCResult_NodeFeaturesDecodeErrorZ* arg_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(arg);
22483         int64_t ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone_ptr(arg_conv);
22484         return ret_conv;
22485 }
22486
22487 int64_t  CS_LDK_CResult_NodeFeaturesDecodeErrorZ_clone(int64_t orig) {
22488         LDKCResult_NodeFeaturesDecodeErrorZ* orig_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(orig);
22489         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
22490         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone(orig_conv);
22491         return tag_ptr(ret_conv, true);
22492 }
22493
22494 int64_t  CS_LDK_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_ok(int64_t o) {
22495         LDKBolt11InvoiceFeatures o_conv;
22496         o_conv.inner = untag_ptr(o);
22497         o_conv.is_owned = ptr_is_owned(o);
22498         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22499         o_conv = Bolt11InvoiceFeatures_clone(&o_conv);
22500         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
22501         *ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_ok(o_conv);
22502         return tag_ptr(ret_conv, true);
22503 }
22504
22505 int64_t  CS_LDK_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_err(int64_t e) {
22506         void* e_ptr = untag_ptr(e);
22507         CHECK_ACCESS(e_ptr);
22508         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22509         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22510         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
22511         *ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_err(e_conv);
22512         return tag_ptr(ret_conv, true);
22513 }
22514
22515 jboolean  CS_LDK_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_is_ok(int64_t o) {
22516         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* o_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(o);
22517         jboolean ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_is_ok(o_conv);
22518         return ret_conv;
22519 }
22520
22521 void  CS_LDK_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_free(int64_t _res) {
22522         if (!ptr_is_owned(_res)) return;
22523         void* _res_ptr = untag_ptr(_res);
22524         CHECK_ACCESS(_res_ptr);
22525         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)(_res_ptr);
22526         FREE(untag_ptr(_res));
22527         CResult_Bolt11InvoiceFeaturesDecodeErrorZ_free(_res_conv);
22528 }
22529
22530 static inline uint64_t CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone_ptr(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ *NONNULL_PTR arg) {
22531         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
22532         *ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone(arg);
22533         return tag_ptr(ret_conv, true);
22534 }
22535 int64_t  CS_LDK_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone_ptr(int64_t arg) {
22536         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* arg_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(arg);
22537         int64_t ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone_ptr(arg_conv);
22538         return ret_conv;
22539 }
22540
22541 int64_t  CS_LDK_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone(int64_t orig) {
22542         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* orig_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(orig);
22543         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
22544         *ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone(orig_conv);
22545         return tag_ptr(ret_conv, true);
22546 }
22547
22548 int64_t  CS_LDK_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_ok(int64_t o) {
22549         LDKBolt12InvoiceFeatures o_conv;
22550         o_conv.inner = untag_ptr(o);
22551         o_conv.is_owned = ptr_is_owned(o);
22552         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22553         o_conv = Bolt12InvoiceFeatures_clone(&o_conv);
22554         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
22555         *ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_ok(o_conv);
22556         return tag_ptr(ret_conv, true);
22557 }
22558
22559 int64_t  CS_LDK_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_err(int64_t e) {
22560         void* e_ptr = untag_ptr(e);
22561         CHECK_ACCESS(e_ptr);
22562         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22563         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22564         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
22565         *ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_err(e_conv);
22566         return tag_ptr(ret_conv, true);
22567 }
22568
22569 jboolean  CS_LDK_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_is_ok(int64_t o) {
22570         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* o_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(o);
22571         jboolean ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_is_ok(o_conv);
22572         return ret_conv;
22573 }
22574
22575 void  CS_LDK_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_free(int64_t _res) {
22576         if (!ptr_is_owned(_res)) return;
22577         void* _res_ptr = untag_ptr(_res);
22578         CHECK_ACCESS(_res_ptr);
22579         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)(_res_ptr);
22580         FREE(untag_ptr(_res));
22581         CResult_Bolt12InvoiceFeaturesDecodeErrorZ_free(_res_conv);
22582 }
22583
22584 static inline uint64_t CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone_ptr(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ *NONNULL_PTR arg) {
22585         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
22586         *ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone(arg);
22587         return tag_ptr(ret_conv, true);
22588 }
22589 int64_t  CS_LDK_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone_ptr(int64_t arg) {
22590         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* arg_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(arg);
22591         int64_t ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone_ptr(arg_conv);
22592         return ret_conv;
22593 }
22594
22595 int64_t  CS_LDK_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone(int64_t orig) {
22596         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* orig_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(orig);
22597         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
22598         *ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone(orig_conv);
22599         return tag_ptr(ret_conv, true);
22600 }
22601
22602 int64_t  CS_LDK_CResult_BlindedHopFeaturesDecodeErrorZ_ok(int64_t o) {
22603         LDKBlindedHopFeatures o_conv;
22604         o_conv.inner = untag_ptr(o);
22605         o_conv.is_owned = ptr_is_owned(o);
22606         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22607         o_conv = BlindedHopFeatures_clone(&o_conv);
22608         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
22609         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_ok(o_conv);
22610         return tag_ptr(ret_conv, true);
22611 }
22612
22613 int64_t  CS_LDK_CResult_BlindedHopFeaturesDecodeErrorZ_err(int64_t e) {
22614         void* e_ptr = untag_ptr(e);
22615         CHECK_ACCESS(e_ptr);
22616         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22617         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22618         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
22619         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_err(e_conv);
22620         return tag_ptr(ret_conv, true);
22621 }
22622
22623 jboolean  CS_LDK_CResult_BlindedHopFeaturesDecodeErrorZ_is_ok(int64_t o) {
22624         LDKCResult_BlindedHopFeaturesDecodeErrorZ* o_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(o);
22625         jboolean ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_is_ok(o_conv);
22626         return ret_conv;
22627 }
22628
22629 void  CS_LDK_CResult_BlindedHopFeaturesDecodeErrorZ_free(int64_t _res) {
22630         if (!ptr_is_owned(_res)) return;
22631         void* _res_ptr = untag_ptr(_res);
22632         CHECK_ACCESS(_res_ptr);
22633         LDKCResult_BlindedHopFeaturesDecodeErrorZ _res_conv = *(LDKCResult_BlindedHopFeaturesDecodeErrorZ*)(_res_ptr);
22634         FREE(untag_ptr(_res));
22635         CResult_BlindedHopFeaturesDecodeErrorZ_free(_res_conv);
22636 }
22637
22638 static inline uint64_t CResult_BlindedHopFeaturesDecodeErrorZ_clone_ptr(LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR arg) {
22639         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
22640         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_clone(arg);
22641         return tag_ptr(ret_conv, true);
22642 }
22643 int64_t  CS_LDK_CResult_BlindedHopFeaturesDecodeErrorZ_clone_ptr(int64_t arg) {
22644         LDKCResult_BlindedHopFeaturesDecodeErrorZ* arg_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(arg);
22645         int64_t ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_clone_ptr(arg_conv);
22646         return ret_conv;
22647 }
22648
22649 int64_t  CS_LDK_CResult_BlindedHopFeaturesDecodeErrorZ_clone(int64_t orig) {
22650         LDKCResult_BlindedHopFeaturesDecodeErrorZ* orig_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(orig);
22651         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
22652         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_clone(orig_conv);
22653         return tag_ptr(ret_conv, true);
22654 }
22655
22656 int64_t  CS_LDK_CResult_ChannelTypeFeaturesDecodeErrorZ_ok(int64_t o) {
22657         LDKChannelTypeFeatures o_conv;
22658         o_conv.inner = untag_ptr(o);
22659         o_conv.is_owned = ptr_is_owned(o);
22660         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22661         o_conv = ChannelTypeFeatures_clone(&o_conv);
22662         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
22663         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o_conv);
22664         return tag_ptr(ret_conv, true);
22665 }
22666
22667 int64_t  CS_LDK_CResult_ChannelTypeFeaturesDecodeErrorZ_err(int64_t e) {
22668         void* e_ptr = untag_ptr(e);
22669         CHECK_ACCESS(e_ptr);
22670         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22671         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22672         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
22673         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_err(e_conv);
22674         return tag_ptr(ret_conv, true);
22675 }
22676
22677 jboolean  CS_LDK_CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(int64_t o) {
22678         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(o);
22679         jboolean ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o_conv);
22680         return ret_conv;
22681 }
22682
22683 void  CS_LDK_CResult_ChannelTypeFeaturesDecodeErrorZ_free(int64_t _res) {
22684         if (!ptr_is_owned(_res)) return;
22685         void* _res_ptr = untag_ptr(_res);
22686         CHECK_ACCESS(_res_ptr);
22687         LDKCResult_ChannelTypeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(_res_ptr);
22688         FREE(untag_ptr(_res));
22689         CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res_conv);
22690 }
22691
22692 static inline uint64_t CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR arg) {
22693         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
22694         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone(arg);
22695         return tag_ptr(ret_conv, true);
22696 }
22697 int64_t  CS_LDK_CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(int64_t arg) {
22698         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* arg_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(arg);
22699         int64_t ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(arg_conv);
22700         return ret_conv;
22701 }
22702
22703 int64_t  CS_LDK_CResult_ChannelTypeFeaturesDecodeErrorZ_clone(int64_t orig) {
22704         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* orig_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(orig);
22705         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
22706         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone(orig_conv);
22707         return tag_ptr(ret_conv, true);
22708 }
22709
22710 int64_t  CS_LDK_CResult_OfferIdDecodeErrorZ_ok(int64_t o) {
22711         LDKOfferId o_conv;
22712         o_conv.inner = untag_ptr(o);
22713         o_conv.is_owned = ptr_is_owned(o);
22714         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22715         o_conv = OfferId_clone(&o_conv);
22716         LDKCResult_OfferIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferIdDecodeErrorZ), "LDKCResult_OfferIdDecodeErrorZ");
22717         *ret_conv = CResult_OfferIdDecodeErrorZ_ok(o_conv);
22718         return tag_ptr(ret_conv, true);
22719 }
22720
22721 int64_t  CS_LDK_CResult_OfferIdDecodeErrorZ_err(int64_t e) {
22722         void* e_ptr = untag_ptr(e);
22723         CHECK_ACCESS(e_ptr);
22724         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22725         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22726         LDKCResult_OfferIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferIdDecodeErrorZ), "LDKCResult_OfferIdDecodeErrorZ");
22727         *ret_conv = CResult_OfferIdDecodeErrorZ_err(e_conv);
22728         return tag_ptr(ret_conv, true);
22729 }
22730
22731 jboolean  CS_LDK_CResult_OfferIdDecodeErrorZ_is_ok(int64_t o) {
22732         LDKCResult_OfferIdDecodeErrorZ* o_conv = (LDKCResult_OfferIdDecodeErrorZ*)untag_ptr(o);
22733         jboolean ret_conv = CResult_OfferIdDecodeErrorZ_is_ok(o_conv);
22734         return ret_conv;
22735 }
22736
22737 void  CS_LDK_CResult_OfferIdDecodeErrorZ_free(int64_t _res) {
22738         if (!ptr_is_owned(_res)) return;
22739         void* _res_ptr = untag_ptr(_res);
22740         CHECK_ACCESS(_res_ptr);
22741         LDKCResult_OfferIdDecodeErrorZ _res_conv = *(LDKCResult_OfferIdDecodeErrorZ*)(_res_ptr);
22742         FREE(untag_ptr(_res));
22743         CResult_OfferIdDecodeErrorZ_free(_res_conv);
22744 }
22745
22746 static inline uint64_t CResult_OfferIdDecodeErrorZ_clone_ptr(LDKCResult_OfferIdDecodeErrorZ *NONNULL_PTR arg) {
22747         LDKCResult_OfferIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferIdDecodeErrorZ), "LDKCResult_OfferIdDecodeErrorZ");
22748         *ret_conv = CResult_OfferIdDecodeErrorZ_clone(arg);
22749         return tag_ptr(ret_conv, true);
22750 }
22751 int64_t  CS_LDK_CResult_OfferIdDecodeErrorZ_clone_ptr(int64_t arg) {
22752         LDKCResult_OfferIdDecodeErrorZ* arg_conv = (LDKCResult_OfferIdDecodeErrorZ*)untag_ptr(arg);
22753         int64_t ret_conv = CResult_OfferIdDecodeErrorZ_clone_ptr(arg_conv);
22754         return ret_conv;
22755 }
22756
22757 int64_t  CS_LDK_CResult_OfferIdDecodeErrorZ_clone(int64_t orig) {
22758         LDKCResult_OfferIdDecodeErrorZ* orig_conv = (LDKCResult_OfferIdDecodeErrorZ*)untag_ptr(orig);
22759         LDKCResult_OfferIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferIdDecodeErrorZ), "LDKCResult_OfferIdDecodeErrorZ");
22760         *ret_conv = CResult_OfferIdDecodeErrorZ_clone(orig_conv);
22761         return tag_ptr(ret_conv, true);
22762 }
22763
22764 int64_t  CS_LDK_CResult_NoneBolt12SemanticErrorZ_ok() {
22765         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
22766         *ret_conv = CResult_NoneBolt12SemanticErrorZ_ok();
22767         return tag_ptr(ret_conv, true);
22768 }
22769
22770 int64_t  CS_LDK_CResult_NoneBolt12SemanticErrorZ_err(int32_t e) {
22771         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_cs(e);
22772         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
22773         *ret_conv = CResult_NoneBolt12SemanticErrorZ_err(e_conv);
22774         return tag_ptr(ret_conv, true);
22775 }
22776
22777 jboolean  CS_LDK_CResult_NoneBolt12SemanticErrorZ_is_ok(int64_t o) {
22778         LDKCResult_NoneBolt12SemanticErrorZ* o_conv = (LDKCResult_NoneBolt12SemanticErrorZ*)untag_ptr(o);
22779         jboolean ret_conv = CResult_NoneBolt12SemanticErrorZ_is_ok(o_conv);
22780         return ret_conv;
22781 }
22782
22783 void  CS_LDK_CResult_NoneBolt12SemanticErrorZ_free(int64_t _res) {
22784         if (!ptr_is_owned(_res)) return;
22785         void* _res_ptr = untag_ptr(_res);
22786         CHECK_ACCESS(_res_ptr);
22787         LDKCResult_NoneBolt12SemanticErrorZ _res_conv = *(LDKCResult_NoneBolt12SemanticErrorZ*)(_res_ptr);
22788         FREE(untag_ptr(_res));
22789         CResult_NoneBolt12SemanticErrorZ_free(_res_conv);
22790 }
22791
22792 static inline uint64_t CResult_NoneBolt12SemanticErrorZ_clone_ptr(LDKCResult_NoneBolt12SemanticErrorZ *NONNULL_PTR arg) {
22793         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
22794         *ret_conv = CResult_NoneBolt12SemanticErrorZ_clone(arg);
22795         return tag_ptr(ret_conv, true);
22796 }
22797 int64_t  CS_LDK_CResult_NoneBolt12SemanticErrorZ_clone_ptr(int64_t arg) {
22798         LDKCResult_NoneBolt12SemanticErrorZ* arg_conv = (LDKCResult_NoneBolt12SemanticErrorZ*)untag_ptr(arg);
22799         int64_t ret_conv = CResult_NoneBolt12SemanticErrorZ_clone_ptr(arg_conv);
22800         return ret_conv;
22801 }
22802
22803 int64_t  CS_LDK_CResult_NoneBolt12SemanticErrorZ_clone(int64_t orig) {
22804         LDKCResult_NoneBolt12SemanticErrorZ* orig_conv = (LDKCResult_NoneBolt12SemanticErrorZ*)untag_ptr(orig);
22805         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
22806         *ret_conv = CResult_NoneBolt12SemanticErrorZ_clone(orig_conv);
22807         return tag_ptr(ret_conv, true);
22808 }
22809
22810 int64_t  CS_LDK_CResult_OfferBolt12SemanticErrorZ_ok(int64_t o) {
22811         LDKOffer o_conv;
22812         o_conv.inner = untag_ptr(o);
22813         o_conv.is_owned = ptr_is_owned(o);
22814         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22815         o_conv = Offer_clone(&o_conv);
22816         LDKCResult_OfferBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12SemanticErrorZ), "LDKCResult_OfferBolt12SemanticErrorZ");
22817         *ret_conv = CResult_OfferBolt12SemanticErrorZ_ok(o_conv);
22818         return tag_ptr(ret_conv, true);
22819 }
22820
22821 int64_t  CS_LDK_CResult_OfferBolt12SemanticErrorZ_err(int32_t e) {
22822         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_cs(e);
22823         LDKCResult_OfferBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12SemanticErrorZ), "LDKCResult_OfferBolt12SemanticErrorZ");
22824         *ret_conv = CResult_OfferBolt12SemanticErrorZ_err(e_conv);
22825         return tag_ptr(ret_conv, true);
22826 }
22827
22828 jboolean  CS_LDK_CResult_OfferBolt12SemanticErrorZ_is_ok(int64_t o) {
22829         LDKCResult_OfferBolt12SemanticErrorZ* o_conv = (LDKCResult_OfferBolt12SemanticErrorZ*)untag_ptr(o);
22830         jboolean ret_conv = CResult_OfferBolt12SemanticErrorZ_is_ok(o_conv);
22831         return ret_conv;
22832 }
22833
22834 void  CS_LDK_CResult_OfferBolt12SemanticErrorZ_free(int64_t _res) {
22835         if (!ptr_is_owned(_res)) return;
22836         void* _res_ptr = untag_ptr(_res);
22837         CHECK_ACCESS(_res_ptr);
22838         LDKCResult_OfferBolt12SemanticErrorZ _res_conv = *(LDKCResult_OfferBolt12SemanticErrorZ*)(_res_ptr);
22839         FREE(untag_ptr(_res));
22840         CResult_OfferBolt12SemanticErrorZ_free(_res_conv);
22841 }
22842
22843 static inline uint64_t CResult_OfferBolt12SemanticErrorZ_clone_ptr(LDKCResult_OfferBolt12SemanticErrorZ *NONNULL_PTR arg) {
22844         LDKCResult_OfferBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12SemanticErrorZ), "LDKCResult_OfferBolt12SemanticErrorZ");
22845         *ret_conv = CResult_OfferBolt12SemanticErrorZ_clone(arg);
22846         return tag_ptr(ret_conv, true);
22847 }
22848 int64_t  CS_LDK_CResult_OfferBolt12SemanticErrorZ_clone_ptr(int64_t arg) {
22849         LDKCResult_OfferBolt12SemanticErrorZ* arg_conv = (LDKCResult_OfferBolt12SemanticErrorZ*)untag_ptr(arg);
22850         int64_t ret_conv = CResult_OfferBolt12SemanticErrorZ_clone_ptr(arg_conv);
22851         return ret_conv;
22852 }
22853
22854 int64_t  CS_LDK_CResult_OfferBolt12SemanticErrorZ_clone(int64_t orig) {
22855         LDKCResult_OfferBolt12SemanticErrorZ* orig_conv = (LDKCResult_OfferBolt12SemanticErrorZ*)untag_ptr(orig);
22856         LDKCResult_OfferBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12SemanticErrorZ), "LDKCResult_OfferBolt12SemanticErrorZ");
22857         *ret_conv = CResult_OfferBolt12SemanticErrorZ_clone(orig_conv);
22858         return tag_ptr(ret_conv, true);
22859 }
22860
22861 int64_t  CS_LDK_CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_ok(int64_t o) {
22862         LDKInvoiceRequestWithDerivedPayerIdBuilder o_conv;
22863         o_conv.inner = untag_ptr(o);
22864         o_conv.is_owned = ptr_is_owned(o);
22865         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22866         // WARNING: we need a move here but no clone is available for LDKInvoiceRequestWithDerivedPayerIdBuilder
22867         
22868         LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ");
22869         *ret_conv = CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_ok(o_conv);
22870         return tag_ptr(ret_conv, true);
22871 }
22872
22873 int64_t  CS_LDK_CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_err(int32_t e) {
22874         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_cs(e);
22875         LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ");
22876         *ret_conv = CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_err(e_conv);
22877         return tag_ptr(ret_conv, true);
22878 }
22879
22880 jboolean  CS_LDK_CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_is_ok(int64_t o) {
22881         LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ* o_conv = (LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ*)untag_ptr(o);
22882         jboolean ret_conv = CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_is_ok(o_conv);
22883         return ret_conv;
22884 }
22885
22886 void  CS_LDK_CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_free(int64_t _res) {
22887         if (!ptr_is_owned(_res)) return;
22888         void* _res_ptr = untag_ptr(_res);
22889         CHECK_ACCESS(_res_ptr);
22890         LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ _res_conv = *(LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ*)(_res_ptr);
22891         FREE(untag_ptr(_res));
22892         CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_free(_res_conv);
22893 }
22894
22895 int64_t  CS_LDK_CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_ok(int64_t o) {
22896         LDKInvoiceRequestWithExplicitPayerIdBuilder o_conv;
22897         o_conv.inner = untag_ptr(o);
22898         o_conv.is_owned = ptr_is_owned(o);
22899         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22900         // WARNING: we need a move here but no clone is available for LDKInvoiceRequestWithExplicitPayerIdBuilder
22901         
22902         LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ");
22903         *ret_conv = CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_ok(o_conv);
22904         return tag_ptr(ret_conv, true);
22905 }
22906
22907 int64_t  CS_LDK_CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_err(int32_t e) {
22908         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_cs(e);
22909         LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ");
22910         *ret_conv = CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_err(e_conv);
22911         return tag_ptr(ret_conv, true);
22912 }
22913
22914 jboolean  CS_LDK_CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_is_ok(int64_t o) {
22915         LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ* o_conv = (LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ*)untag_ptr(o);
22916         jboolean ret_conv = CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_is_ok(o_conv);
22917         return ret_conv;
22918 }
22919
22920 void  CS_LDK_CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_free(int64_t _res) {
22921         if (!ptr_is_owned(_res)) return;
22922         void* _res_ptr = untag_ptr(_res);
22923         CHECK_ACCESS(_res_ptr);
22924         LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ _res_conv = *(LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ*)(_res_ptr);
22925         FREE(untag_ptr(_res));
22926         CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_free(_res_conv);
22927 }
22928
22929 int64_t  CS_LDK_CResult_OfferBolt12ParseErrorZ_ok(int64_t o) {
22930         LDKOffer o_conv;
22931         o_conv.inner = untag_ptr(o);
22932         o_conv.is_owned = ptr_is_owned(o);
22933         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22934         o_conv = Offer_clone(&o_conv);
22935         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
22936         *ret_conv = CResult_OfferBolt12ParseErrorZ_ok(o_conv);
22937         return tag_ptr(ret_conv, true);
22938 }
22939
22940 int64_t  CS_LDK_CResult_OfferBolt12ParseErrorZ_err(int64_t e) {
22941         LDKBolt12ParseError e_conv;
22942         e_conv.inner = untag_ptr(e);
22943         e_conv.is_owned = ptr_is_owned(e);
22944         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22945         e_conv = Bolt12ParseError_clone(&e_conv);
22946         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
22947         *ret_conv = CResult_OfferBolt12ParseErrorZ_err(e_conv);
22948         return tag_ptr(ret_conv, true);
22949 }
22950
22951 jboolean  CS_LDK_CResult_OfferBolt12ParseErrorZ_is_ok(int64_t o) {
22952         LDKCResult_OfferBolt12ParseErrorZ* o_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(o);
22953         jboolean ret_conv = CResult_OfferBolt12ParseErrorZ_is_ok(o_conv);
22954         return ret_conv;
22955 }
22956
22957 void  CS_LDK_CResult_OfferBolt12ParseErrorZ_free(int64_t _res) {
22958         if (!ptr_is_owned(_res)) return;
22959         void* _res_ptr = untag_ptr(_res);
22960         CHECK_ACCESS(_res_ptr);
22961         LDKCResult_OfferBolt12ParseErrorZ _res_conv = *(LDKCResult_OfferBolt12ParseErrorZ*)(_res_ptr);
22962         FREE(untag_ptr(_res));
22963         CResult_OfferBolt12ParseErrorZ_free(_res_conv);
22964 }
22965
22966 static inline uint64_t CResult_OfferBolt12ParseErrorZ_clone_ptr(LDKCResult_OfferBolt12ParseErrorZ *NONNULL_PTR arg) {
22967         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
22968         *ret_conv = CResult_OfferBolt12ParseErrorZ_clone(arg);
22969         return tag_ptr(ret_conv, true);
22970 }
22971 int64_t  CS_LDK_CResult_OfferBolt12ParseErrorZ_clone_ptr(int64_t arg) {
22972         LDKCResult_OfferBolt12ParseErrorZ* arg_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(arg);
22973         int64_t ret_conv = CResult_OfferBolt12ParseErrorZ_clone_ptr(arg_conv);
22974         return ret_conv;
22975 }
22976
22977 int64_t  CS_LDK_CResult_OfferBolt12ParseErrorZ_clone(int64_t orig) {
22978         LDKCResult_OfferBolt12ParseErrorZ* orig_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(orig);
22979         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
22980         *ret_conv = CResult_OfferBolt12ParseErrorZ_clone(orig_conv);
22981         return tag_ptr(ret_conv, true);
22982 }
22983
22984 int64_t  CS_LDK_CResult_NodeIdDecodeErrorZ_ok(int64_t o) {
22985         LDKNodeId o_conv;
22986         o_conv.inner = untag_ptr(o);
22987         o_conv.is_owned = ptr_is_owned(o);
22988         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22989         o_conv = NodeId_clone(&o_conv);
22990         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
22991         *ret_conv = CResult_NodeIdDecodeErrorZ_ok(o_conv);
22992         return tag_ptr(ret_conv, true);
22993 }
22994
22995 int64_t  CS_LDK_CResult_NodeIdDecodeErrorZ_err(int64_t e) {
22996         void* e_ptr = untag_ptr(e);
22997         CHECK_ACCESS(e_ptr);
22998         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22999         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23000         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
23001         *ret_conv = CResult_NodeIdDecodeErrorZ_err(e_conv);
23002         return tag_ptr(ret_conv, true);
23003 }
23004
23005 jboolean  CS_LDK_CResult_NodeIdDecodeErrorZ_is_ok(int64_t o) {
23006         LDKCResult_NodeIdDecodeErrorZ* o_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(o);
23007         jboolean ret_conv = CResult_NodeIdDecodeErrorZ_is_ok(o_conv);
23008         return ret_conv;
23009 }
23010
23011 void  CS_LDK_CResult_NodeIdDecodeErrorZ_free(int64_t _res) {
23012         if (!ptr_is_owned(_res)) return;
23013         void* _res_ptr = untag_ptr(_res);
23014         CHECK_ACCESS(_res_ptr);
23015         LDKCResult_NodeIdDecodeErrorZ _res_conv = *(LDKCResult_NodeIdDecodeErrorZ*)(_res_ptr);
23016         FREE(untag_ptr(_res));
23017         CResult_NodeIdDecodeErrorZ_free(_res_conv);
23018 }
23019
23020 static inline uint64_t CResult_NodeIdDecodeErrorZ_clone_ptr(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR arg) {
23021         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
23022         *ret_conv = CResult_NodeIdDecodeErrorZ_clone(arg);
23023         return tag_ptr(ret_conv, true);
23024 }
23025 int64_t  CS_LDK_CResult_NodeIdDecodeErrorZ_clone_ptr(int64_t arg) {
23026         LDKCResult_NodeIdDecodeErrorZ* arg_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(arg);
23027         int64_t ret_conv = CResult_NodeIdDecodeErrorZ_clone_ptr(arg_conv);
23028         return ret_conv;
23029 }
23030
23031 int64_t  CS_LDK_CResult_NodeIdDecodeErrorZ_clone(int64_t orig) {
23032         LDKCResult_NodeIdDecodeErrorZ* orig_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(orig);
23033         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
23034         *ret_conv = CResult_NodeIdDecodeErrorZ_clone(orig_conv);
23035         return tag_ptr(ret_conv, true);
23036 }
23037
23038 int64_t  CS_LDK_CResult_PublicKeySecp256k1ErrorZ_ok(int8_tArray o) {
23039         LDKPublicKey o_ref;
23040         CHECK(o->arr_len == 33);
23041         memcpy(o_ref.compressed_form, o->elems, 33); FREE(o);
23042         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
23043         *ret_conv = CResult_PublicKeySecp256k1ErrorZ_ok(o_ref);
23044         return tag_ptr(ret_conv, true);
23045 }
23046
23047 int64_t  CS_LDK_CResult_PublicKeySecp256k1ErrorZ_err(int32_t e) {
23048         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_cs(e);
23049         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
23050         *ret_conv = CResult_PublicKeySecp256k1ErrorZ_err(e_conv);
23051         return tag_ptr(ret_conv, true);
23052 }
23053
23054 jboolean  CS_LDK_CResult_PublicKeySecp256k1ErrorZ_is_ok(int64_t o) {
23055         LDKCResult_PublicKeySecp256k1ErrorZ* o_conv = (LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(o);
23056         jboolean ret_conv = CResult_PublicKeySecp256k1ErrorZ_is_ok(o_conv);
23057         return ret_conv;
23058 }
23059
23060 void  CS_LDK_CResult_PublicKeySecp256k1ErrorZ_free(int64_t _res) {
23061         if (!ptr_is_owned(_res)) return;
23062         void* _res_ptr = untag_ptr(_res);
23063         CHECK_ACCESS(_res_ptr);
23064         LDKCResult_PublicKeySecp256k1ErrorZ _res_conv = *(LDKCResult_PublicKeySecp256k1ErrorZ*)(_res_ptr);
23065         FREE(untag_ptr(_res));
23066         CResult_PublicKeySecp256k1ErrorZ_free(_res_conv);
23067 }
23068
23069 static inline uint64_t CResult_PublicKeySecp256k1ErrorZ_clone_ptr(LDKCResult_PublicKeySecp256k1ErrorZ *NONNULL_PTR arg) {
23070         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
23071         *ret_conv = CResult_PublicKeySecp256k1ErrorZ_clone(arg);
23072         return tag_ptr(ret_conv, true);
23073 }
23074 int64_t  CS_LDK_CResult_PublicKeySecp256k1ErrorZ_clone_ptr(int64_t arg) {
23075         LDKCResult_PublicKeySecp256k1ErrorZ* arg_conv = (LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(arg);
23076         int64_t ret_conv = CResult_PublicKeySecp256k1ErrorZ_clone_ptr(arg_conv);
23077         return ret_conv;
23078 }
23079
23080 int64_t  CS_LDK_CResult_PublicKeySecp256k1ErrorZ_clone(int64_t orig) {
23081         LDKCResult_PublicKeySecp256k1ErrorZ* orig_conv = (LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(orig);
23082         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
23083         *ret_conv = CResult_PublicKeySecp256k1ErrorZ_clone(orig_conv);
23084         return tag_ptr(ret_conv, true);
23085 }
23086
23087 int64_t  CS_LDK_COption_NetworkUpdateZ_some(int64_t o) {
23088         void* o_ptr = untag_ptr(o);
23089         CHECK_ACCESS(o_ptr);
23090         LDKNetworkUpdate o_conv = *(LDKNetworkUpdate*)(o_ptr);
23091         o_conv = NetworkUpdate_clone((LDKNetworkUpdate*)untag_ptr(o));
23092         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
23093         *ret_copy = COption_NetworkUpdateZ_some(o_conv);
23094         int64_t ret_ref = tag_ptr(ret_copy, true);
23095         return ret_ref;
23096 }
23097
23098 int64_t  CS_LDK_COption_NetworkUpdateZ_none() {
23099         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
23100         *ret_copy = COption_NetworkUpdateZ_none();
23101         int64_t ret_ref = tag_ptr(ret_copy, true);
23102         return ret_ref;
23103 }
23104
23105 void  CS_LDK_COption_NetworkUpdateZ_free(int64_t _res) {
23106         if (!ptr_is_owned(_res)) return;
23107         void* _res_ptr = untag_ptr(_res);
23108         CHECK_ACCESS(_res_ptr);
23109         LDKCOption_NetworkUpdateZ _res_conv = *(LDKCOption_NetworkUpdateZ*)(_res_ptr);
23110         FREE(untag_ptr(_res));
23111         COption_NetworkUpdateZ_free(_res_conv);
23112 }
23113
23114 static inline uint64_t COption_NetworkUpdateZ_clone_ptr(LDKCOption_NetworkUpdateZ *NONNULL_PTR arg) {
23115         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
23116         *ret_copy = COption_NetworkUpdateZ_clone(arg);
23117         int64_t ret_ref = tag_ptr(ret_copy, true);
23118         return ret_ref;
23119 }
23120 int64_t  CS_LDK_COption_NetworkUpdateZ_clone_ptr(int64_t arg) {
23121         LDKCOption_NetworkUpdateZ* arg_conv = (LDKCOption_NetworkUpdateZ*)untag_ptr(arg);
23122         int64_t ret_conv = COption_NetworkUpdateZ_clone_ptr(arg_conv);
23123         return ret_conv;
23124 }
23125
23126 int64_t  CS_LDK_COption_NetworkUpdateZ_clone(int64_t orig) {
23127         LDKCOption_NetworkUpdateZ* orig_conv = (LDKCOption_NetworkUpdateZ*)untag_ptr(orig);
23128         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
23129         *ret_copy = COption_NetworkUpdateZ_clone(orig_conv);
23130         int64_t ret_ref = tag_ptr(ret_copy, true);
23131         return ret_ref;
23132 }
23133
23134 int64_t  CS_LDK_CResult_COption_NetworkUpdateZDecodeErrorZ_ok(int64_t o) {
23135         void* o_ptr = untag_ptr(o);
23136         CHECK_ACCESS(o_ptr);
23137         LDKCOption_NetworkUpdateZ o_conv = *(LDKCOption_NetworkUpdateZ*)(o_ptr);
23138         o_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)untag_ptr(o));
23139         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
23140         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o_conv);
23141         return tag_ptr(ret_conv, true);
23142 }
23143
23144 int64_t  CS_LDK_CResult_COption_NetworkUpdateZDecodeErrorZ_err(int64_t e) {
23145         void* e_ptr = untag_ptr(e);
23146         CHECK_ACCESS(e_ptr);
23147         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23148         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23149         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
23150         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_err(e_conv);
23151         return tag_ptr(ret_conv, true);
23152 }
23153
23154 jboolean  CS_LDK_CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(int64_t o) {
23155         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* o_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(o);
23156         jboolean ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o_conv);
23157         return ret_conv;
23158 }
23159
23160 void  CS_LDK_CResult_COption_NetworkUpdateZDecodeErrorZ_free(int64_t _res) {
23161         if (!ptr_is_owned(_res)) return;
23162         void* _res_ptr = untag_ptr(_res);
23163         CHECK_ACCESS(_res_ptr);
23164         LDKCResult_COption_NetworkUpdateZDecodeErrorZ _res_conv = *(LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(_res_ptr);
23165         FREE(untag_ptr(_res));
23166         CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res_conv);
23167 }
23168
23169 static inline uint64_t CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR arg) {
23170         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
23171         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(arg);
23172         return tag_ptr(ret_conv, true);
23173 }
23174 int64_t  CS_LDK_CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(int64_t arg) {
23175         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* arg_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(arg);
23176         int64_t ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(arg_conv);
23177         return ret_conv;
23178 }
23179
23180 int64_t  CS_LDK_CResult_COption_NetworkUpdateZDecodeErrorZ_clone(int64_t orig) {
23181         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* orig_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(orig);
23182         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
23183         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig_conv);
23184         return tag_ptr(ret_conv, true);
23185 }
23186
23187 int64_t  CS_LDK_COption_UtxoLookupZ_some(int64_t o) {
23188         void* o_ptr = untag_ptr(o);
23189         CHECK_ACCESS(o_ptr);
23190         LDKUtxoLookup o_conv = *(LDKUtxoLookup*)(o_ptr);
23191         if (o_conv.free == LDKUtxoLookup_JCalls_free) {
23192                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23193                 LDKUtxoLookup_JCalls_cloned(&o_conv);
23194         }
23195         LDKCOption_UtxoLookupZ *ret_copy = MALLOC(sizeof(LDKCOption_UtxoLookupZ), "LDKCOption_UtxoLookupZ");
23196         *ret_copy = COption_UtxoLookupZ_some(o_conv);
23197         int64_t ret_ref = tag_ptr(ret_copy, true);
23198         return ret_ref;
23199 }
23200
23201 int64_t  CS_LDK_COption_UtxoLookupZ_none() {
23202         LDKCOption_UtxoLookupZ *ret_copy = MALLOC(sizeof(LDKCOption_UtxoLookupZ), "LDKCOption_UtxoLookupZ");
23203         *ret_copy = COption_UtxoLookupZ_none();
23204         int64_t ret_ref = tag_ptr(ret_copy, true);
23205         return ret_ref;
23206 }
23207
23208 void  CS_LDK_COption_UtxoLookupZ_free(int64_t _res) {
23209         if (!ptr_is_owned(_res)) return;
23210         void* _res_ptr = untag_ptr(_res);
23211         CHECK_ACCESS(_res_ptr);
23212         LDKCOption_UtxoLookupZ _res_conv = *(LDKCOption_UtxoLookupZ*)(_res_ptr);
23213         FREE(untag_ptr(_res));
23214         COption_UtxoLookupZ_free(_res_conv);
23215 }
23216
23217 int64_t  CS_LDK_CResult_NoneLightningErrorZ_ok() {
23218         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
23219         *ret_conv = CResult_NoneLightningErrorZ_ok();
23220         return tag_ptr(ret_conv, true);
23221 }
23222
23223 int64_t  CS_LDK_CResult_NoneLightningErrorZ_err(int64_t e) {
23224         LDKLightningError e_conv;
23225         e_conv.inner = untag_ptr(e);
23226         e_conv.is_owned = ptr_is_owned(e);
23227         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
23228         e_conv = LightningError_clone(&e_conv);
23229         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
23230         *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
23231         return tag_ptr(ret_conv, true);
23232 }
23233
23234 jboolean  CS_LDK_CResult_NoneLightningErrorZ_is_ok(int64_t o) {
23235         LDKCResult_NoneLightningErrorZ* o_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(o);
23236         jboolean ret_conv = CResult_NoneLightningErrorZ_is_ok(o_conv);
23237         return ret_conv;
23238 }
23239
23240 void  CS_LDK_CResult_NoneLightningErrorZ_free(int64_t _res) {
23241         if (!ptr_is_owned(_res)) return;
23242         void* _res_ptr = untag_ptr(_res);
23243         CHECK_ACCESS(_res_ptr);
23244         LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)(_res_ptr);
23245         FREE(untag_ptr(_res));
23246         CResult_NoneLightningErrorZ_free(_res_conv);
23247 }
23248
23249 static inline uint64_t CResult_NoneLightningErrorZ_clone_ptr(LDKCResult_NoneLightningErrorZ *NONNULL_PTR arg) {
23250         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
23251         *ret_conv = CResult_NoneLightningErrorZ_clone(arg);
23252         return tag_ptr(ret_conv, true);
23253 }
23254 int64_t  CS_LDK_CResult_NoneLightningErrorZ_clone_ptr(int64_t arg) {
23255         LDKCResult_NoneLightningErrorZ* arg_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(arg);
23256         int64_t ret_conv = CResult_NoneLightningErrorZ_clone_ptr(arg_conv);
23257         return ret_conv;
23258 }
23259
23260 int64_t  CS_LDK_CResult_NoneLightningErrorZ_clone(int64_t orig) {
23261         LDKCResult_NoneLightningErrorZ* orig_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(orig);
23262         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
23263         *ret_conv = CResult_NoneLightningErrorZ_clone(orig_conv);
23264         return tag_ptr(ret_conv, true);
23265 }
23266
23267 int64_t  CS_LDK_CResult_boolLightningErrorZ_ok(jboolean o) {
23268         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
23269         *ret_conv = CResult_boolLightningErrorZ_ok(o);
23270         return tag_ptr(ret_conv, true);
23271 }
23272
23273 int64_t  CS_LDK_CResult_boolLightningErrorZ_err(int64_t e) {
23274         LDKLightningError e_conv;
23275         e_conv.inner = untag_ptr(e);
23276         e_conv.is_owned = ptr_is_owned(e);
23277         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
23278         e_conv = LightningError_clone(&e_conv);
23279         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
23280         *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
23281         return tag_ptr(ret_conv, true);
23282 }
23283
23284 jboolean  CS_LDK_CResult_boolLightningErrorZ_is_ok(int64_t o) {
23285         LDKCResult_boolLightningErrorZ* o_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(o);
23286         jboolean ret_conv = CResult_boolLightningErrorZ_is_ok(o_conv);
23287         return ret_conv;
23288 }
23289
23290 void  CS_LDK_CResult_boolLightningErrorZ_free(int64_t _res) {
23291         if (!ptr_is_owned(_res)) return;
23292         void* _res_ptr = untag_ptr(_res);
23293         CHECK_ACCESS(_res_ptr);
23294         LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)(_res_ptr);
23295         FREE(untag_ptr(_res));
23296         CResult_boolLightningErrorZ_free(_res_conv);
23297 }
23298
23299 static inline uint64_t CResult_boolLightningErrorZ_clone_ptr(LDKCResult_boolLightningErrorZ *NONNULL_PTR arg) {
23300         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
23301         *ret_conv = CResult_boolLightningErrorZ_clone(arg);
23302         return tag_ptr(ret_conv, true);
23303 }
23304 int64_t  CS_LDK_CResult_boolLightningErrorZ_clone_ptr(int64_t arg) {
23305         LDKCResult_boolLightningErrorZ* arg_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(arg);
23306         int64_t ret_conv = CResult_boolLightningErrorZ_clone_ptr(arg_conv);
23307         return ret_conv;
23308 }
23309
23310 int64_t  CS_LDK_CResult_boolLightningErrorZ_clone(int64_t orig) {
23311         LDKCResult_boolLightningErrorZ* orig_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(orig);
23312         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
23313         *ret_conv = CResult_boolLightningErrorZ_clone(orig_conv);
23314         return tag_ptr(ret_conv, true);
23315 }
23316
23317 static inline uint64_t C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR arg) {
23318         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
23319         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(arg);
23320         return tag_ptr(ret_conv, true);
23321 }
23322 int64_t  CS_LDK_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(int64_t arg) {
23323         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* arg_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(arg);
23324         int64_t ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(arg_conv);
23325         return ret_conv;
23326 }
23327
23328 int64_t  CS_LDK_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(int64_t orig) {
23329         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* orig_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(orig);
23330         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
23331         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig_conv);
23332         return tag_ptr(ret_conv, true);
23333 }
23334
23335 int64_t  CS_LDK_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(int64_t a, int64_t b, int64_t c) {
23336         LDKChannelAnnouncement a_conv;
23337         a_conv.inner = untag_ptr(a);
23338         a_conv.is_owned = ptr_is_owned(a);
23339         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
23340         a_conv = ChannelAnnouncement_clone(&a_conv);
23341         LDKChannelUpdate b_conv;
23342         b_conv.inner = untag_ptr(b);
23343         b_conv.is_owned = ptr_is_owned(b);
23344         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
23345         b_conv = ChannelUpdate_clone(&b_conv);
23346         LDKChannelUpdate c_conv;
23347         c_conv.inner = untag_ptr(c);
23348         c_conv.is_owned = ptr_is_owned(c);
23349         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
23350         c_conv = ChannelUpdate_clone(&c_conv);
23351         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
23352         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
23353         return tag_ptr(ret_conv, true);
23354 }
23355
23356 void  CS_LDK_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(int64_t _res) {
23357         if (!ptr_is_owned(_res)) return;
23358         void* _res_ptr = untag_ptr(_res);
23359         CHECK_ACCESS(_res_ptr);
23360         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(_res_ptr);
23361         FREE(untag_ptr(_res));
23362         C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res_conv);
23363 }
23364
23365 int64_t  CS_LDK_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some(int64_t o) {
23366         void* o_ptr = untag_ptr(o);
23367         CHECK_ACCESS(o_ptr);
23368         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ o_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(o_ptr);
23369         o_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone((LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(o));
23370         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
23371         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some(o_conv);
23372         int64_t ret_ref = tag_ptr(ret_copy, true);
23373         return ret_ref;
23374 }
23375
23376 int64_t  CS_LDK_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none() {
23377         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
23378         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none();
23379         int64_t ret_ref = tag_ptr(ret_copy, true);
23380         return ret_ref;
23381 }
23382
23383 void  CS_LDK_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(int64_t _res) {
23384         if (!ptr_is_owned(_res)) return;
23385         void* _res_ptr = untag_ptr(_res);
23386         CHECK_ACCESS(_res_ptr);
23387         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res_conv = *(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)(_res_ptr);
23388         FREE(untag_ptr(_res));
23389         COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res_conv);
23390 }
23391
23392 static inline uint64_t COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *NONNULL_PTR arg) {
23393         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
23394         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(arg);
23395         int64_t ret_ref = tag_ptr(ret_copy, true);
23396         return ret_ref;
23397 }
23398 int64_t  CS_LDK_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr(int64_t arg) {
23399         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* arg_conv = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(arg);
23400         int64_t ret_conv = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr(arg_conv);
23401         return ret_conv;
23402 }
23403
23404 int64_t  CS_LDK_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(int64_t orig) {
23405         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* orig_conv = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(orig);
23406         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
23407         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(orig_conv);
23408         int64_t ret_ref = tag_ptr(ret_copy, true);
23409         return ret_ref;
23410 }
23411
23412 void  CS_LDK_CVec_MessageSendEventZ_free(int64_tArray _res) {
23413         LDKCVec_MessageSendEventZ _res_constr;
23414         _res_constr.datalen = _res->arr_len;
23415         if (_res_constr.datalen > 0)
23416                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
23417         else
23418                 _res_constr.data = NULL;
23419         int64_t* _res_vals = _res->elems;
23420         for (size_t s = 0; s < _res_constr.datalen; s++) {
23421                 int64_t _res_conv_18 = _res_vals[s];
23422                 void* _res_conv_18_ptr = untag_ptr(_res_conv_18);
23423                 CHECK_ACCESS(_res_conv_18_ptr);
23424                 LDKMessageSendEvent _res_conv_18_conv = *(LDKMessageSendEvent*)(_res_conv_18_ptr);
23425                 FREE(untag_ptr(_res_conv_18));
23426                 _res_constr.data[s] = _res_conv_18_conv;
23427         }
23428         FREE(_res);
23429         CVec_MessageSendEventZ_free(_res_constr);
23430 }
23431
23432 int64_t  CS_LDK_CResult_ChannelUpdateInfoDecodeErrorZ_ok(int64_t o) {
23433         LDKChannelUpdateInfo o_conv;
23434         o_conv.inner = untag_ptr(o);
23435         o_conv.is_owned = ptr_is_owned(o);
23436         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23437         o_conv = ChannelUpdateInfo_clone(&o_conv);
23438         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
23439         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_ok(o_conv);
23440         return tag_ptr(ret_conv, true);
23441 }
23442
23443 int64_t  CS_LDK_CResult_ChannelUpdateInfoDecodeErrorZ_err(int64_t e) {
23444         void* e_ptr = untag_ptr(e);
23445         CHECK_ACCESS(e_ptr);
23446         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23447         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23448         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
23449         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_err(e_conv);
23450         return tag_ptr(ret_conv, true);
23451 }
23452
23453 jboolean  CS_LDK_CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(int64_t o) {
23454         LDKCResult_ChannelUpdateInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(o);
23455         jboolean ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(o_conv);
23456         return ret_conv;
23457 }
23458
23459 void  CS_LDK_CResult_ChannelUpdateInfoDecodeErrorZ_free(int64_t _res) {
23460         if (!ptr_is_owned(_res)) return;
23461         void* _res_ptr = untag_ptr(_res);
23462         CHECK_ACCESS(_res_ptr);
23463         LDKCResult_ChannelUpdateInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(_res_ptr);
23464         FREE(untag_ptr(_res));
23465         CResult_ChannelUpdateInfoDecodeErrorZ_free(_res_conv);
23466 }
23467
23468 static inline uint64_t CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR arg) {
23469         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
23470         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(arg);
23471         return tag_ptr(ret_conv, true);
23472 }
23473 int64_t  CS_LDK_CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(int64_t arg) {
23474         LDKCResult_ChannelUpdateInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(arg);
23475         int64_t ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(arg_conv);
23476         return ret_conv;
23477 }
23478
23479 int64_t  CS_LDK_CResult_ChannelUpdateInfoDecodeErrorZ_clone(int64_t orig) {
23480         LDKCResult_ChannelUpdateInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(orig);
23481         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
23482         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(orig_conv);
23483         return tag_ptr(ret_conv, true);
23484 }
23485
23486 int64_t  CS_LDK_CResult_ChannelInfoDecodeErrorZ_ok(int64_t o) {
23487         LDKChannelInfo o_conv;
23488         o_conv.inner = untag_ptr(o);
23489         o_conv.is_owned = ptr_is_owned(o);
23490         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23491         o_conv = ChannelInfo_clone(&o_conv);
23492         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
23493         *ret_conv = CResult_ChannelInfoDecodeErrorZ_ok(o_conv);
23494         return tag_ptr(ret_conv, true);
23495 }
23496
23497 int64_t  CS_LDK_CResult_ChannelInfoDecodeErrorZ_err(int64_t e) {
23498         void* e_ptr = untag_ptr(e);
23499         CHECK_ACCESS(e_ptr);
23500         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23501         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23502         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
23503         *ret_conv = CResult_ChannelInfoDecodeErrorZ_err(e_conv);
23504         return tag_ptr(ret_conv, true);
23505 }
23506
23507 jboolean  CS_LDK_CResult_ChannelInfoDecodeErrorZ_is_ok(int64_t o) {
23508         LDKCResult_ChannelInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(o);
23509         jboolean ret_conv = CResult_ChannelInfoDecodeErrorZ_is_ok(o_conv);
23510         return ret_conv;
23511 }
23512
23513 void  CS_LDK_CResult_ChannelInfoDecodeErrorZ_free(int64_t _res) {
23514         if (!ptr_is_owned(_res)) return;
23515         void* _res_ptr = untag_ptr(_res);
23516         CHECK_ACCESS(_res_ptr);
23517         LDKCResult_ChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelInfoDecodeErrorZ*)(_res_ptr);
23518         FREE(untag_ptr(_res));
23519         CResult_ChannelInfoDecodeErrorZ_free(_res_conv);
23520 }
23521
23522 static inline uint64_t CResult_ChannelInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR arg) {
23523         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
23524         *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(arg);
23525         return tag_ptr(ret_conv, true);
23526 }
23527 int64_t  CS_LDK_CResult_ChannelInfoDecodeErrorZ_clone_ptr(int64_t arg) {
23528         LDKCResult_ChannelInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(arg);
23529         int64_t ret_conv = CResult_ChannelInfoDecodeErrorZ_clone_ptr(arg_conv);
23530         return ret_conv;
23531 }
23532
23533 int64_t  CS_LDK_CResult_ChannelInfoDecodeErrorZ_clone(int64_t orig) {
23534         LDKCResult_ChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(orig);
23535         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
23536         *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(orig_conv);
23537         return tag_ptr(ret_conv, true);
23538 }
23539
23540 int64_t  CS_LDK_CResult_RoutingFeesDecodeErrorZ_ok(int64_t o) {
23541         LDKRoutingFees o_conv;
23542         o_conv.inner = untag_ptr(o);
23543         o_conv.is_owned = ptr_is_owned(o);
23544         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23545         o_conv = RoutingFees_clone(&o_conv);
23546         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
23547         *ret_conv = CResult_RoutingFeesDecodeErrorZ_ok(o_conv);
23548         return tag_ptr(ret_conv, true);
23549 }
23550
23551 int64_t  CS_LDK_CResult_RoutingFeesDecodeErrorZ_err(int64_t e) {
23552         void* e_ptr = untag_ptr(e);
23553         CHECK_ACCESS(e_ptr);
23554         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23555         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23556         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
23557         *ret_conv = CResult_RoutingFeesDecodeErrorZ_err(e_conv);
23558         return tag_ptr(ret_conv, true);
23559 }
23560
23561 jboolean  CS_LDK_CResult_RoutingFeesDecodeErrorZ_is_ok(int64_t o) {
23562         LDKCResult_RoutingFeesDecodeErrorZ* o_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(o);
23563         jboolean ret_conv = CResult_RoutingFeesDecodeErrorZ_is_ok(o_conv);
23564         return ret_conv;
23565 }
23566
23567 void  CS_LDK_CResult_RoutingFeesDecodeErrorZ_free(int64_t _res) {
23568         if (!ptr_is_owned(_res)) return;
23569         void* _res_ptr = untag_ptr(_res);
23570         CHECK_ACCESS(_res_ptr);
23571         LDKCResult_RoutingFeesDecodeErrorZ _res_conv = *(LDKCResult_RoutingFeesDecodeErrorZ*)(_res_ptr);
23572         FREE(untag_ptr(_res));
23573         CResult_RoutingFeesDecodeErrorZ_free(_res_conv);
23574 }
23575
23576 static inline uint64_t CResult_RoutingFeesDecodeErrorZ_clone_ptr(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR arg) {
23577         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
23578         *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(arg);
23579         return tag_ptr(ret_conv, true);
23580 }
23581 int64_t  CS_LDK_CResult_RoutingFeesDecodeErrorZ_clone_ptr(int64_t arg) {
23582         LDKCResult_RoutingFeesDecodeErrorZ* arg_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(arg);
23583         int64_t ret_conv = CResult_RoutingFeesDecodeErrorZ_clone_ptr(arg_conv);
23584         return ret_conv;
23585 }
23586
23587 int64_t  CS_LDK_CResult_RoutingFeesDecodeErrorZ_clone(int64_t orig) {
23588         LDKCResult_RoutingFeesDecodeErrorZ* orig_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(orig);
23589         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
23590         *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(orig_conv);
23591         return tag_ptr(ret_conv, true);
23592 }
23593
23594 void  CS_LDK_CVec_SocketAddressZ_free(int64_tArray _res) {
23595         LDKCVec_SocketAddressZ _res_constr;
23596         _res_constr.datalen = _res->arr_len;
23597         if (_res_constr.datalen > 0)
23598                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
23599         else
23600                 _res_constr.data = NULL;
23601         int64_t* _res_vals = _res->elems;
23602         for (size_t p = 0; p < _res_constr.datalen; p++) {
23603                 int64_t _res_conv_15 = _res_vals[p];
23604                 void* _res_conv_15_ptr = untag_ptr(_res_conv_15);
23605                 CHECK_ACCESS(_res_conv_15_ptr);
23606                 LDKSocketAddress _res_conv_15_conv = *(LDKSocketAddress*)(_res_conv_15_ptr);
23607                 FREE(untag_ptr(_res_conv_15));
23608                 _res_constr.data[p] = _res_conv_15_conv;
23609         }
23610         FREE(_res);
23611         CVec_SocketAddressZ_free(_res_constr);
23612 }
23613
23614 int64_t  CS_LDK_CResult_NodeAnnouncementInfoDecodeErrorZ_ok(int64_t o) {
23615         LDKNodeAnnouncementInfo o_conv;
23616         o_conv.inner = untag_ptr(o);
23617         o_conv.is_owned = ptr_is_owned(o);
23618         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23619         o_conv = NodeAnnouncementInfo_clone(&o_conv);
23620         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
23621         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o_conv);
23622         return tag_ptr(ret_conv, true);
23623 }
23624
23625 int64_t  CS_LDK_CResult_NodeAnnouncementInfoDecodeErrorZ_err(int64_t e) {
23626         void* e_ptr = untag_ptr(e);
23627         CHECK_ACCESS(e_ptr);
23628         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23629         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23630         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
23631         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_err(e_conv);
23632         return tag_ptr(ret_conv, true);
23633 }
23634
23635 jboolean  CS_LDK_CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(int64_t o) {
23636         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(o);
23637         jboolean ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o_conv);
23638         return ret_conv;
23639 }
23640
23641 void  CS_LDK_CResult_NodeAnnouncementInfoDecodeErrorZ_free(int64_t _res) {
23642         if (!ptr_is_owned(_res)) return;
23643         void* _res_ptr = untag_ptr(_res);
23644         CHECK_ACCESS(_res_ptr);
23645         LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(_res_ptr);
23646         FREE(untag_ptr(_res));
23647         CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res_conv);
23648 }
23649
23650 static inline uint64_t CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR arg) {
23651         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
23652         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(arg);
23653         return tag_ptr(ret_conv, true);
23654 }
23655 int64_t  CS_LDK_CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(int64_t arg) {
23656         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(arg);
23657         int64_t ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(arg_conv);
23658         return ret_conv;
23659 }
23660
23661 int64_t  CS_LDK_CResult_NodeAnnouncementInfoDecodeErrorZ_clone(int64_t orig) {
23662         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(orig);
23663         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
23664         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig_conv);
23665         return tag_ptr(ret_conv, true);
23666 }
23667
23668 int64_t  CS_LDK_CResult_NodeAliasDecodeErrorZ_ok(int64_t o) {
23669         LDKNodeAlias o_conv;
23670         o_conv.inner = untag_ptr(o);
23671         o_conv.is_owned = ptr_is_owned(o);
23672         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23673         o_conv = NodeAlias_clone(&o_conv);
23674         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
23675         *ret_conv = CResult_NodeAliasDecodeErrorZ_ok(o_conv);
23676         return tag_ptr(ret_conv, true);
23677 }
23678
23679 int64_t  CS_LDK_CResult_NodeAliasDecodeErrorZ_err(int64_t e) {
23680         void* e_ptr = untag_ptr(e);
23681         CHECK_ACCESS(e_ptr);
23682         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23683         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23684         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
23685         *ret_conv = CResult_NodeAliasDecodeErrorZ_err(e_conv);
23686         return tag_ptr(ret_conv, true);
23687 }
23688
23689 jboolean  CS_LDK_CResult_NodeAliasDecodeErrorZ_is_ok(int64_t o) {
23690         LDKCResult_NodeAliasDecodeErrorZ* o_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(o);
23691         jboolean ret_conv = CResult_NodeAliasDecodeErrorZ_is_ok(o_conv);
23692         return ret_conv;
23693 }
23694
23695 void  CS_LDK_CResult_NodeAliasDecodeErrorZ_free(int64_t _res) {
23696         if (!ptr_is_owned(_res)) return;
23697         void* _res_ptr = untag_ptr(_res);
23698         CHECK_ACCESS(_res_ptr);
23699         LDKCResult_NodeAliasDecodeErrorZ _res_conv = *(LDKCResult_NodeAliasDecodeErrorZ*)(_res_ptr);
23700         FREE(untag_ptr(_res));
23701         CResult_NodeAliasDecodeErrorZ_free(_res_conv);
23702 }
23703
23704 static inline uint64_t CResult_NodeAliasDecodeErrorZ_clone_ptr(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR arg) {
23705         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
23706         *ret_conv = CResult_NodeAliasDecodeErrorZ_clone(arg);
23707         return tag_ptr(ret_conv, true);
23708 }
23709 int64_t  CS_LDK_CResult_NodeAliasDecodeErrorZ_clone_ptr(int64_t arg) {
23710         LDKCResult_NodeAliasDecodeErrorZ* arg_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(arg);
23711         int64_t ret_conv = CResult_NodeAliasDecodeErrorZ_clone_ptr(arg_conv);
23712         return ret_conv;
23713 }
23714
23715 int64_t  CS_LDK_CResult_NodeAliasDecodeErrorZ_clone(int64_t orig) {
23716         LDKCResult_NodeAliasDecodeErrorZ* orig_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(orig);
23717         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
23718         *ret_conv = CResult_NodeAliasDecodeErrorZ_clone(orig_conv);
23719         return tag_ptr(ret_conv, true);
23720 }
23721
23722 int64_t  CS_LDK_CResult_NodeInfoDecodeErrorZ_ok(int64_t o) {
23723         LDKNodeInfo o_conv;
23724         o_conv.inner = untag_ptr(o);
23725         o_conv.is_owned = ptr_is_owned(o);
23726         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23727         o_conv = NodeInfo_clone(&o_conv);
23728         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
23729         *ret_conv = CResult_NodeInfoDecodeErrorZ_ok(o_conv);
23730         return tag_ptr(ret_conv, true);
23731 }
23732
23733 int64_t  CS_LDK_CResult_NodeInfoDecodeErrorZ_err(int64_t e) {
23734         void* e_ptr = untag_ptr(e);
23735         CHECK_ACCESS(e_ptr);
23736         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23737         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23738         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
23739         *ret_conv = CResult_NodeInfoDecodeErrorZ_err(e_conv);
23740         return tag_ptr(ret_conv, true);
23741 }
23742
23743 jboolean  CS_LDK_CResult_NodeInfoDecodeErrorZ_is_ok(int64_t o) {
23744         LDKCResult_NodeInfoDecodeErrorZ* o_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(o);
23745         jboolean ret_conv = CResult_NodeInfoDecodeErrorZ_is_ok(o_conv);
23746         return ret_conv;
23747 }
23748
23749 void  CS_LDK_CResult_NodeInfoDecodeErrorZ_free(int64_t _res) {
23750         if (!ptr_is_owned(_res)) return;
23751         void* _res_ptr = untag_ptr(_res);
23752         CHECK_ACCESS(_res_ptr);
23753         LDKCResult_NodeInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeInfoDecodeErrorZ*)(_res_ptr);
23754         FREE(untag_ptr(_res));
23755         CResult_NodeInfoDecodeErrorZ_free(_res_conv);
23756 }
23757
23758 static inline uint64_t CResult_NodeInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR arg) {
23759         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
23760         *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(arg);
23761         return tag_ptr(ret_conv, true);
23762 }
23763 int64_t  CS_LDK_CResult_NodeInfoDecodeErrorZ_clone_ptr(int64_t arg) {
23764         LDKCResult_NodeInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(arg);
23765         int64_t ret_conv = CResult_NodeInfoDecodeErrorZ_clone_ptr(arg_conv);
23766         return ret_conv;
23767 }
23768
23769 int64_t  CS_LDK_CResult_NodeInfoDecodeErrorZ_clone(int64_t orig) {
23770         LDKCResult_NodeInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(orig);
23771         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
23772         *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(orig_conv);
23773         return tag_ptr(ret_conv, true);
23774 }
23775
23776 int64_t  CS_LDK_CResult_NetworkGraphDecodeErrorZ_ok(int64_t o) {
23777         LDKNetworkGraph o_conv;
23778         o_conv.inner = untag_ptr(o);
23779         o_conv.is_owned = ptr_is_owned(o);
23780         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23781         // WARNING: we need a move here but no clone is available for LDKNetworkGraph
23782         
23783         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
23784         *ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
23785         return tag_ptr(ret_conv, true);
23786 }
23787
23788 int64_t  CS_LDK_CResult_NetworkGraphDecodeErrorZ_err(int64_t e) {
23789         void* e_ptr = untag_ptr(e);
23790         CHECK_ACCESS(e_ptr);
23791         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23792         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23793         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
23794         *ret_conv = CResult_NetworkGraphDecodeErrorZ_err(e_conv);
23795         return tag_ptr(ret_conv, true);
23796 }
23797
23798 jboolean  CS_LDK_CResult_NetworkGraphDecodeErrorZ_is_ok(int64_t o) {
23799         LDKCResult_NetworkGraphDecodeErrorZ* o_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(o);
23800         jboolean ret_conv = CResult_NetworkGraphDecodeErrorZ_is_ok(o_conv);
23801         return ret_conv;
23802 }
23803
23804 void  CS_LDK_CResult_NetworkGraphDecodeErrorZ_free(int64_t _res) {
23805         if (!ptr_is_owned(_res)) return;
23806         void* _res_ptr = untag_ptr(_res);
23807         CHECK_ACCESS(_res_ptr);
23808         LDKCResult_NetworkGraphDecodeErrorZ _res_conv = *(LDKCResult_NetworkGraphDecodeErrorZ*)(_res_ptr);
23809         FREE(untag_ptr(_res));
23810         CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
23811 }
23812
23813 int64_t  CS_LDK_COption_CVec_SocketAddressZZ_some(int64_tArray o) {
23814         LDKCVec_SocketAddressZ o_constr;
23815         o_constr.datalen = o->arr_len;
23816         if (o_constr.datalen > 0)
23817                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
23818         else
23819                 o_constr.data = NULL;
23820         int64_t* o_vals = o->elems;
23821         for (size_t p = 0; p < o_constr.datalen; p++) {
23822                 int64_t o_conv_15 = o_vals[p];
23823                 void* o_conv_15_ptr = untag_ptr(o_conv_15);
23824                 CHECK_ACCESS(o_conv_15_ptr);
23825                 LDKSocketAddress o_conv_15_conv = *(LDKSocketAddress*)(o_conv_15_ptr);
23826                 o_conv_15_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(o_conv_15));
23827                 o_constr.data[p] = o_conv_15_conv;
23828         }
23829         FREE(o);
23830         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
23831         *ret_copy = COption_CVec_SocketAddressZZ_some(o_constr);
23832         int64_t ret_ref = tag_ptr(ret_copy, true);
23833         return ret_ref;
23834 }
23835
23836 int64_t  CS_LDK_COption_CVec_SocketAddressZZ_none() {
23837         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
23838         *ret_copy = COption_CVec_SocketAddressZZ_none();
23839         int64_t ret_ref = tag_ptr(ret_copy, true);
23840         return ret_ref;
23841 }
23842
23843 void  CS_LDK_COption_CVec_SocketAddressZZ_free(int64_t _res) {
23844         if (!ptr_is_owned(_res)) return;
23845         void* _res_ptr = untag_ptr(_res);
23846         CHECK_ACCESS(_res_ptr);
23847         LDKCOption_CVec_SocketAddressZZ _res_conv = *(LDKCOption_CVec_SocketAddressZZ*)(_res_ptr);
23848         FREE(untag_ptr(_res));
23849         COption_CVec_SocketAddressZZ_free(_res_conv);
23850 }
23851
23852 static inline uint64_t COption_CVec_SocketAddressZZ_clone_ptr(LDKCOption_CVec_SocketAddressZZ *NONNULL_PTR arg) {
23853         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
23854         *ret_copy = COption_CVec_SocketAddressZZ_clone(arg);
23855         int64_t ret_ref = tag_ptr(ret_copy, true);
23856         return ret_ref;
23857 }
23858 int64_t  CS_LDK_COption_CVec_SocketAddressZZ_clone_ptr(int64_t arg) {
23859         LDKCOption_CVec_SocketAddressZZ* arg_conv = (LDKCOption_CVec_SocketAddressZZ*)untag_ptr(arg);
23860         int64_t ret_conv = COption_CVec_SocketAddressZZ_clone_ptr(arg_conv);
23861         return ret_conv;
23862 }
23863
23864 int64_t  CS_LDK_COption_CVec_SocketAddressZZ_clone(int64_t orig) {
23865         LDKCOption_CVec_SocketAddressZZ* orig_conv = (LDKCOption_CVec_SocketAddressZZ*)untag_ptr(orig);
23866         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
23867         *ret_copy = COption_CVec_SocketAddressZZ_clone(orig_conv);
23868         int64_t ret_ref = tag_ptr(ret_copy, true);
23869         return ret_ref;
23870 }
23871
23872 int64_t  CS_LDK_CResult_u64ShortChannelIdErrorZ_ok(int64_t o) {
23873         LDKCResult_u64ShortChannelIdErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u64ShortChannelIdErrorZ), "LDKCResult_u64ShortChannelIdErrorZ");
23874         *ret_conv = CResult_u64ShortChannelIdErrorZ_ok(o);
23875         return tag_ptr(ret_conv, true);
23876 }
23877
23878 int64_t  CS_LDK_CResult_u64ShortChannelIdErrorZ_err(int32_t e) {
23879         LDKShortChannelIdError e_conv = LDKShortChannelIdError_from_cs(e);
23880         LDKCResult_u64ShortChannelIdErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u64ShortChannelIdErrorZ), "LDKCResult_u64ShortChannelIdErrorZ");
23881         *ret_conv = CResult_u64ShortChannelIdErrorZ_err(e_conv);
23882         return tag_ptr(ret_conv, true);
23883 }
23884
23885 jboolean  CS_LDK_CResult_u64ShortChannelIdErrorZ_is_ok(int64_t o) {
23886         LDKCResult_u64ShortChannelIdErrorZ* o_conv = (LDKCResult_u64ShortChannelIdErrorZ*)untag_ptr(o);
23887         jboolean ret_conv = CResult_u64ShortChannelIdErrorZ_is_ok(o_conv);
23888         return ret_conv;
23889 }
23890
23891 void  CS_LDK_CResult_u64ShortChannelIdErrorZ_free(int64_t _res) {
23892         if (!ptr_is_owned(_res)) return;
23893         void* _res_ptr = untag_ptr(_res);
23894         CHECK_ACCESS(_res_ptr);
23895         LDKCResult_u64ShortChannelIdErrorZ _res_conv = *(LDKCResult_u64ShortChannelIdErrorZ*)(_res_ptr);
23896         FREE(untag_ptr(_res));
23897         CResult_u64ShortChannelIdErrorZ_free(_res_conv);
23898 }
23899
23900 int64_t  CS_LDK_CResult_PendingHTLCInfoInboundHTLCErrZ_ok(int64_t o) {
23901         LDKPendingHTLCInfo o_conv;
23902         o_conv.inner = untag_ptr(o);
23903         o_conv.is_owned = ptr_is_owned(o);
23904         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23905         o_conv = PendingHTLCInfo_clone(&o_conv);
23906         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoInboundHTLCErrZ), "LDKCResult_PendingHTLCInfoInboundHTLCErrZ");
23907         *ret_conv = CResult_PendingHTLCInfoInboundHTLCErrZ_ok(o_conv);
23908         return tag_ptr(ret_conv, true);
23909 }
23910
23911 int64_t  CS_LDK_CResult_PendingHTLCInfoInboundHTLCErrZ_err(int64_t e) {
23912         LDKInboundHTLCErr e_conv;
23913         e_conv.inner = untag_ptr(e);
23914         e_conv.is_owned = ptr_is_owned(e);
23915         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
23916         e_conv = InboundHTLCErr_clone(&e_conv);
23917         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoInboundHTLCErrZ), "LDKCResult_PendingHTLCInfoInboundHTLCErrZ");
23918         *ret_conv = CResult_PendingHTLCInfoInboundHTLCErrZ_err(e_conv);
23919         return tag_ptr(ret_conv, true);
23920 }
23921
23922 jboolean  CS_LDK_CResult_PendingHTLCInfoInboundHTLCErrZ_is_ok(int64_t o) {
23923         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* o_conv = (LDKCResult_PendingHTLCInfoInboundHTLCErrZ*)untag_ptr(o);
23924         jboolean ret_conv = CResult_PendingHTLCInfoInboundHTLCErrZ_is_ok(o_conv);
23925         return ret_conv;
23926 }
23927
23928 void  CS_LDK_CResult_PendingHTLCInfoInboundHTLCErrZ_free(int64_t _res) {
23929         if (!ptr_is_owned(_res)) return;
23930         void* _res_ptr = untag_ptr(_res);
23931         CHECK_ACCESS(_res_ptr);
23932         LDKCResult_PendingHTLCInfoInboundHTLCErrZ _res_conv = *(LDKCResult_PendingHTLCInfoInboundHTLCErrZ*)(_res_ptr);
23933         FREE(untag_ptr(_res));
23934         CResult_PendingHTLCInfoInboundHTLCErrZ_free(_res_conv);
23935 }
23936
23937 static inline uint64_t CResult_PendingHTLCInfoInboundHTLCErrZ_clone_ptr(LDKCResult_PendingHTLCInfoInboundHTLCErrZ *NONNULL_PTR arg) {
23938         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoInboundHTLCErrZ), "LDKCResult_PendingHTLCInfoInboundHTLCErrZ");
23939         *ret_conv = CResult_PendingHTLCInfoInboundHTLCErrZ_clone(arg);
23940         return tag_ptr(ret_conv, true);
23941 }
23942 int64_t  CS_LDK_CResult_PendingHTLCInfoInboundHTLCErrZ_clone_ptr(int64_t arg) {
23943         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* arg_conv = (LDKCResult_PendingHTLCInfoInboundHTLCErrZ*)untag_ptr(arg);
23944         int64_t ret_conv = CResult_PendingHTLCInfoInboundHTLCErrZ_clone_ptr(arg_conv);
23945         return ret_conv;
23946 }
23947
23948 int64_t  CS_LDK_CResult_PendingHTLCInfoInboundHTLCErrZ_clone(int64_t orig) {
23949         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* orig_conv = (LDKCResult_PendingHTLCInfoInboundHTLCErrZ*)untag_ptr(orig);
23950         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoInboundHTLCErrZ), "LDKCResult_PendingHTLCInfoInboundHTLCErrZ");
23951         *ret_conv = CResult_PendingHTLCInfoInboundHTLCErrZ_clone(orig_conv);
23952         return tag_ptr(ret_conv, true);
23953 }
23954
23955 void  CS_LDK_CVec_HTLCOutputInCommitmentZ_free(int64_tArray _res) {
23956         LDKCVec_HTLCOutputInCommitmentZ _res_constr;
23957         _res_constr.datalen = _res->arr_len;
23958         if (_res_constr.datalen > 0)
23959                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKHTLCOutputInCommitment), "LDKCVec_HTLCOutputInCommitmentZ Elements");
23960         else
23961                 _res_constr.data = NULL;
23962         int64_t* _res_vals = _res->elems;
23963         for (size_t y = 0; y < _res_constr.datalen; y++) {
23964                 int64_t _res_conv_24 = _res_vals[y];
23965                 LDKHTLCOutputInCommitment _res_conv_24_conv;
23966                 _res_conv_24_conv.inner = untag_ptr(_res_conv_24);
23967                 _res_conv_24_conv.is_owned = ptr_is_owned(_res_conv_24);
23968                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_24_conv);
23969                 _res_constr.data[y] = _res_conv_24_conv;
23970         }
23971         FREE(_res);
23972         CVec_HTLCOutputInCommitmentZ_free(_res_constr);
23973 }
23974
23975 void  CS_LDK_CVec_HTLCDescriptorZ_free(int64_tArray _res) {
23976         LDKCVec_HTLCDescriptorZ _res_constr;
23977         _res_constr.datalen = _res->arr_len;
23978         if (_res_constr.datalen > 0)
23979                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKHTLCDescriptor), "LDKCVec_HTLCDescriptorZ Elements");
23980         else
23981                 _res_constr.data = NULL;
23982         int64_t* _res_vals = _res->elems;
23983         for (size_t q = 0; q < _res_constr.datalen; q++) {
23984                 int64_t _res_conv_16 = _res_vals[q];
23985                 LDKHTLCDescriptor _res_conv_16_conv;
23986                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
23987                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
23988                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
23989                 _res_constr.data[q] = _res_conv_16_conv;
23990         }
23991         FREE(_res);
23992         CVec_HTLCDescriptorZ_free(_res_constr);
23993 }
23994
23995 void  CS_LDK_CVec_UtxoZ_free(int64_tArray _res) {
23996         LDKCVec_UtxoZ _res_constr;
23997         _res_constr.datalen = _res->arr_len;
23998         if (_res_constr.datalen > 0)
23999                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUtxo), "LDKCVec_UtxoZ Elements");
24000         else
24001                 _res_constr.data = NULL;
24002         int64_t* _res_vals = _res->elems;
24003         for (size_t g = 0; g < _res_constr.datalen; g++) {
24004                 int64_t _res_conv_6 = _res_vals[g];
24005                 LDKUtxo _res_conv_6_conv;
24006                 _res_conv_6_conv.inner = untag_ptr(_res_conv_6);
24007                 _res_conv_6_conv.is_owned = ptr_is_owned(_res_conv_6);
24008                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_6_conv);
24009                 _res_constr.data[g] = _res_conv_6_conv;
24010         }
24011         FREE(_res);
24012         CVec_UtxoZ_free(_res_constr);
24013 }
24014
24015 int64_t  CS_LDK_COption_TxOutZ_some(int64_t o) {
24016         void* o_ptr = untag_ptr(o);
24017         CHECK_ACCESS(o_ptr);
24018         LDKTxOut o_conv = *(LDKTxOut*)(o_ptr);
24019         o_conv = TxOut_clone((LDKTxOut*)untag_ptr(o));
24020         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
24021         *ret_copy = COption_TxOutZ_some(o_conv);
24022         int64_t ret_ref = tag_ptr(ret_copy, true);
24023         return ret_ref;
24024 }
24025
24026 int64_t  CS_LDK_COption_TxOutZ_none() {
24027         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
24028         *ret_copy = COption_TxOutZ_none();
24029         int64_t ret_ref = tag_ptr(ret_copy, true);
24030         return ret_ref;
24031 }
24032
24033 void  CS_LDK_COption_TxOutZ_free(int64_t _res) {
24034         if (!ptr_is_owned(_res)) return;
24035         void* _res_ptr = untag_ptr(_res);
24036         CHECK_ACCESS(_res_ptr);
24037         LDKCOption_TxOutZ _res_conv = *(LDKCOption_TxOutZ*)(_res_ptr);
24038         FREE(untag_ptr(_res));
24039         COption_TxOutZ_free(_res_conv);
24040 }
24041
24042 static inline uint64_t COption_TxOutZ_clone_ptr(LDKCOption_TxOutZ *NONNULL_PTR arg) {
24043         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
24044         *ret_copy = COption_TxOutZ_clone(arg);
24045         int64_t ret_ref = tag_ptr(ret_copy, true);
24046         return ret_ref;
24047 }
24048 int64_t  CS_LDK_COption_TxOutZ_clone_ptr(int64_t arg) {
24049         LDKCOption_TxOutZ* arg_conv = (LDKCOption_TxOutZ*)untag_ptr(arg);
24050         int64_t ret_conv = COption_TxOutZ_clone_ptr(arg_conv);
24051         return ret_conv;
24052 }
24053
24054 int64_t  CS_LDK_COption_TxOutZ_clone(int64_t orig) {
24055         LDKCOption_TxOutZ* orig_conv = (LDKCOption_TxOutZ*)untag_ptr(orig);
24056         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
24057         *ret_copy = COption_TxOutZ_clone(orig_conv);
24058         int64_t ret_ref = tag_ptr(ret_copy, true);
24059         return ret_ref;
24060 }
24061
24062 void  CS_LDK_CVec_InputZ_free(int64_tArray _res) {
24063         LDKCVec_InputZ _res_constr;
24064         _res_constr.datalen = _res->arr_len;
24065         if (_res_constr.datalen > 0)
24066                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKInput), "LDKCVec_InputZ Elements");
24067         else
24068                 _res_constr.data = NULL;
24069         int64_t* _res_vals = _res->elems;
24070         for (size_t h = 0; h < _res_constr.datalen; h++) {
24071                 int64_t _res_conv_7 = _res_vals[h];
24072                 LDKInput _res_conv_7_conv;
24073                 _res_conv_7_conv.inner = untag_ptr(_res_conv_7);
24074                 _res_conv_7_conv.is_owned = ptr_is_owned(_res_conv_7);
24075                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_7_conv);
24076                 _res_constr.data[h] = _res_conv_7_conv;
24077         }
24078         FREE(_res);
24079         CVec_InputZ_free(_res_constr);
24080 }
24081
24082 int64_t  CS_LDK_CResult_CoinSelectionNoneZ_ok(int64_t o) {
24083         LDKCoinSelection o_conv;
24084         o_conv.inner = untag_ptr(o);
24085         o_conv.is_owned = ptr_is_owned(o);
24086         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24087         o_conv = CoinSelection_clone(&o_conv);
24088         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
24089         *ret_conv = CResult_CoinSelectionNoneZ_ok(o_conv);
24090         return tag_ptr(ret_conv, true);
24091 }
24092
24093 int64_t  CS_LDK_CResult_CoinSelectionNoneZ_err() {
24094         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
24095         *ret_conv = CResult_CoinSelectionNoneZ_err();
24096         return tag_ptr(ret_conv, true);
24097 }
24098
24099 jboolean  CS_LDK_CResult_CoinSelectionNoneZ_is_ok(int64_t o) {
24100         LDKCResult_CoinSelectionNoneZ* o_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(o);
24101         jboolean ret_conv = CResult_CoinSelectionNoneZ_is_ok(o_conv);
24102         return ret_conv;
24103 }
24104
24105 void  CS_LDK_CResult_CoinSelectionNoneZ_free(int64_t _res) {
24106         if (!ptr_is_owned(_res)) return;
24107         void* _res_ptr = untag_ptr(_res);
24108         CHECK_ACCESS(_res_ptr);
24109         LDKCResult_CoinSelectionNoneZ _res_conv = *(LDKCResult_CoinSelectionNoneZ*)(_res_ptr);
24110         FREE(untag_ptr(_res));
24111         CResult_CoinSelectionNoneZ_free(_res_conv);
24112 }
24113
24114 static inline uint64_t CResult_CoinSelectionNoneZ_clone_ptr(LDKCResult_CoinSelectionNoneZ *NONNULL_PTR arg) {
24115         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
24116         *ret_conv = CResult_CoinSelectionNoneZ_clone(arg);
24117         return tag_ptr(ret_conv, true);
24118 }
24119 int64_t  CS_LDK_CResult_CoinSelectionNoneZ_clone_ptr(int64_t arg) {
24120         LDKCResult_CoinSelectionNoneZ* arg_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(arg);
24121         int64_t ret_conv = CResult_CoinSelectionNoneZ_clone_ptr(arg_conv);
24122         return ret_conv;
24123 }
24124
24125 int64_t  CS_LDK_CResult_CoinSelectionNoneZ_clone(int64_t orig) {
24126         LDKCResult_CoinSelectionNoneZ* orig_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(orig);
24127         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
24128         *ret_conv = CResult_CoinSelectionNoneZ_clone(orig_conv);
24129         return tag_ptr(ret_conv, true);
24130 }
24131
24132 int64_t  CS_LDK_CResult_CVec_UtxoZNoneZ_ok(int64_tArray o) {
24133         LDKCVec_UtxoZ o_constr;
24134         o_constr.datalen = o->arr_len;
24135         if (o_constr.datalen > 0)
24136                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKUtxo), "LDKCVec_UtxoZ Elements");
24137         else
24138                 o_constr.data = NULL;
24139         int64_t* o_vals = o->elems;
24140         for (size_t g = 0; g < o_constr.datalen; g++) {
24141                 int64_t o_conv_6 = o_vals[g];
24142                 LDKUtxo o_conv_6_conv;
24143                 o_conv_6_conv.inner = untag_ptr(o_conv_6);
24144                 o_conv_6_conv.is_owned = ptr_is_owned(o_conv_6);
24145                 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv_6_conv);
24146                 o_conv_6_conv = Utxo_clone(&o_conv_6_conv);
24147                 o_constr.data[g] = o_conv_6_conv;
24148         }
24149         FREE(o);
24150         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
24151         *ret_conv = CResult_CVec_UtxoZNoneZ_ok(o_constr);
24152         return tag_ptr(ret_conv, true);
24153 }
24154
24155 int64_t  CS_LDK_CResult_CVec_UtxoZNoneZ_err() {
24156         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
24157         *ret_conv = CResult_CVec_UtxoZNoneZ_err();
24158         return tag_ptr(ret_conv, true);
24159 }
24160
24161 jboolean  CS_LDK_CResult_CVec_UtxoZNoneZ_is_ok(int64_t o) {
24162         LDKCResult_CVec_UtxoZNoneZ* o_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(o);
24163         jboolean ret_conv = CResult_CVec_UtxoZNoneZ_is_ok(o_conv);
24164         return ret_conv;
24165 }
24166
24167 void  CS_LDK_CResult_CVec_UtxoZNoneZ_free(int64_t _res) {
24168         if (!ptr_is_owned(_res)) return;
24169         void* _res_ptr = untag_ptr(_res);
24170         CHECK_ACCESS(_res_ptr);
24171         LDKCResult_CVec_UtxoZNoneZ _res_conv = *(LDKCResult_CVec_UtxoZNoneZ*)(_res_ptr);
24172         FREE(untag_ptr(_res));
24173         CResult_CVec_UtxoZNoneZ_free(_res_conv);
24174 }
24175
24176 static inline uint64_t CResult_CVec_UtxoZNoneZ_clone_ptr(LDKCResult_CVec_UtxoZNoneZ *NONNULL_PTR arg) {
24177         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
24178         *ret_conv = CResult_CVec_UtxoZNoneZ_clone(arg);
24179         return tag_ptr(ret_conv, true);
24180 }
24181 int64_t  CS_LDK_CResult_CVec_UtxoZNoneZ_clone_ptr(int64_t arg) {
24182         LDKCResult_CVec_UtxoZNoneZ* arg_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(arg);
24183         int64_t ret_conv = CResult_CVec_UtxoZNoneZ_clone_ptr(arg_conv);
24184         return ret_conv;
24185 }
24186
24187 int64_t  CS_LDK_CResult_CVec_UtxoZNoneZ_clone(int64_t orig) {
24188         LDKCResult_CVec_UtxoZNoneZ* orig_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(orig);
24189         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
24190         *ret_conv = CResult_CVec_UtxoZNoneZ_clone(orig_conv);
24191         return tag_ptr(ret_conv, true);
24192 }
24193
24194 int64_t  CS_LDK_COption_PaymentContextZ_some(int64_t o) {
24195         void* o_ptr = untag_ptr(o);
24196         CHECK_ACCESS(o_ptr);
24197         LDKPaymentContext o_conv = *(LDKPaymentContext*)(o_ptr);
24198         o_conv = PaymentContext_clone((LDKPaymentContext*)untag_ptr(o));
24199         LDKCOption_PaymentContextZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentContextZ), "LDKCOption_PaymentContextZ");
24200         *ret_copy = COption_PaymentContextZ_some(o_conv);
24201         int64_t ret_ref = tag_ptr(ret_copy, true);
24202         return ret_ref;
24203 }
24204
24205 int64_t  CS_LDK_COption_PaymentContextZ_none() {
24206         LDKCOption_PaymentContextZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentContextZ), "LDKCOption_PaymentContextZ");
24207         *ret_copy = COption_PaymentContextZ_none();
24208         int64_t ret_ref = tag_ptr(ret_copy, true);
24209         return ret_ref;
24210 }
24211
24212 void  CS_LDK_COption_PaymentContextZ_free(int64_t _res) {
24213         if (!ptr_is_owned(_res)) return;
24214         void* _res_ptr = untag_ptr(_res);
24215         CHECK_ACCESS(_res_ptr);
24216         LDKCOption_PaymentContextZ _res_conv = *(LDKCOption_PaymentContextZ*)(_res_ptr);
24217         FREE(untag_ptr(_res));
24218         COption_PaymentContextZ_free(_res_conv);
24219 }
24220
24221 static inline uint64_t COption_PaymentContextZ_clone_ptr(LDKCOption_PaymentContextZ *NONNULL_PTR arg) {
24222         LDKCOption_PaymentContextZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentContextZ), "LDKCOption_PaymentContextZ");
24223         *ret_copy = COption_PaymentContextZ_clone(arg);
24224         int64_t ret_ref = tag_ptr(ret_copy, true);
24225         return ret_ref;
24226 }
24227 int64_t  CS_LDK_COption_PaymentContextZ_clone_ptr(int64_t arg) {
24228         LDKCOption_PaymentContextZ* arg_conv = (LDKCOption_PaymentContextZ*)untag_ptr(arg);
24229         int64_t ret_conv = COption_PaymentContextZ_clone_ptr(arg_conv);
24230         return ret_conv;
24231 }
24232
24233 int64_t  CS_LDK_COption_PaymentContextZ_clone(int64_t orig) {
24234         LDKCOption_PaymentContextZ* orig_conv = (LDKCOption_PaymentContextZ*)untag_ptr(orig);
24235         LDKCOption_PaymentContextZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentContextZ), "LDKCOption_PaymentContextZ");
24236         *ret_copy = COption_PaymentContextZ_clone(orig_conv);
24237         int64_t ret_ref = tag_ptr(ret_copy, true);
24238         return ret_ref;
24239 }
24240
24241 static inline uint64_t C2Tuple_u64u16Z_clone_ptr(LDKC2Tuple_u64u16Z *NONNULL_PTR arg) {
24242         LDKC2Tuple_u64u16Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u16Z), "LDKC2Tuple_u64u16Z");
24243         *ret_conv = C2Tuple_u64u16Z_clone(arg);
24244         return tag_ptr(ret_conv, true);
24245 }
24246 int64_t  CS_LDK_C2Tuple_u64u16Z_clone_ptr(int64_t arg) {
24247         LDKC2Tuple_u64u16Z* arg_conv = (LDKC2Tuple_u64u16Z*)untag_ptr(arg);
24248         int64_t ret_conv = C2Tuple_u64u16Z_clone_ptr(arg_conv);
24249         return ret_conv;
24250 }
24251
24252 int64_t  CS_LDK_C2Tuple_u64u16Z_clone(int64_t orig) {
24253         LDKC2Tuple_u64u16Z* orig_conv = (LDKC2Tuple_u64u16Z*)untag_ptr(orig);
24254         LDKC2Tuple_u64u16Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u16Z), "LDKC2Tuple_u64u16Z");
24255         *ret_conv = C2Tuple_u64u16Z_clone(orig_conv);
24256         return tag_ptr(ret_conv, true);
24257 }
24258
24259 int64_t  CS_LDK_C2Tuple_u64u16Z_new(int64_t a, int16_t b) {
24260         LDKC2Tuple_u64u16Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u16Z), "LDKC2Tuple_u64u16Z");
24261         *ret_conv = C2Tuple_u64u16Z_new(a, b);
24262         return tag_ptr(ret_conv, true);
24263 }
24264
24265 void  CS_LDK_C2Tuple_u64u16Z_free(int64_t _res) {
24266         if (!ptr_is_owned(_res)) return;
24267         void* _res_ptr = untag_ptr(_res);
24268         CHECK_ACCESS(_res_ptr);
24269         LDKC2Tuple_u64u16Z _res_conv = *(LDKC2Tuple_u64u16Z*)(_res_ptr);
24270         FREE(untag_ptr(_res));
24271         C2Tuple_u64u16Z_free(_res_conv);
24272 }
24273
24274 int64_t  CS_LDK_COption_C2Tuple_u64u16ZZ_some(int64_t o) {
24275         void* o_ptr = untag_ptr(o);
24276         CHECK_ACCESS(o_ptr);
24277         LDKC2Tuple_u64u16Z o_conv = *(LDKC2Tuple_u64u16Z*)(o_ptr);
24278         o_conv = C2Tuple_u64u16Z_clone((LDKC2Tuple_u64u16Z*)untag_ptr(o));
24279         LDKCOption_C2Tuple_u64u16ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u16ZZ), "LDKCOption_C2Tuple_u64u16ZZ");
24280         *ret_copy = COption_C2Tuple_u64u16ZZ_some(o_conv);
24281         int64_t ret_ref = tag_ptr(ret_copy, true);
24282         return ret_ref;
24283 }
24284
24285 int64_t  CS_LDK_COption_C2Tuple_u64u16ZZ_none() {
24286         LDKCOption_C2Tuple_u64u16ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u16ZZ), "LDKCOption_C2Tuple_u64u16ZZ");
24287         *ret_copy = COption_C2Tuple_u64u16ZZ_none();
24288         int64_t ret_ref = tag_ptr(ret_copy, true);
24289         return ret_ref;
24290 }
24291
24292 void  CS_LDK_COption_C2Tuple_u64u16ZZ_free(int64_t _res) {
24293         if (!ptr_is_owned(_res)) return;
24294         void* _res_ptr = untag_ptr(_res);
24295         CHECK_ACCESS(_res_ptr);
24296         LDKCOption_C2Tuple_u64u16ZZ _res_conv = *(LDKCOption_C2Tuple_u64u16ZZ*)(_res_ptr);
24297         FREE(untag_ptr(_res));
24298         COption_C2Tuple_u64u16ZZ_free(_res_conv);
24299 }
24300
24301 static inline uint64_t COption_C2Tuple_u64u16ZZ_clone_ptr(LDKCOption_C2Tuple_u64u16ZZ *NONNULL_PTR arg) {
24302         LDKCOption_C2Tuple_u64u16ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u16ZZ), "LDKCOption_C2Tuple_u64u16ZZ");
24303         *ret_copy = COption_C2Tuple_u64u16ZZ_clone(arg);
24304         int64_t ret_ref = tag_ptr(ret_copy, true);
24305         return ret_ref;
24306 }
24307 int64_t  CS_LDK_COption_C2Tuple_u64u16ZZ_clone_ptr(int64_t arg) {
24308         LDKCOption_C2Tuple_u64u16ZZ* arg_conv = (LDKCOption_C2Tuple_u64u16ZZ*)untag_ptr(arg);
24309         int64_t ret_conv = COption_C2Tuple_u64u16ZZ_clone_ptr(arg_conv);
24310         return ret_conv;
24311 }
24312
24313 int64_t  CS_LDK_COption_C2Tuple_u64u16ZZ_clone(int64_t orig) {
24314         LDKCOption_C2Tuple_u64u16ZZ* orig_conv = (LDKCOption_C2Tuple_u64u16ZZ*)untag_ptr(orig);
24315         LDKCOption_C2Tuple_u64u16ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u16ZZ), "LDKCOption_C2Tuple_u64u16ZZ");
24316         *ret_copy = COption_C2Tuple_u64u16ZZ_clone(orig_conv);
24317         int64_t ret_ref = tag_ptr(ret_copy, true);
24318         return ret_ref;
24319 }
24320
24321 int64_t  CS_LDK_CResult_ChannelIdAPIErrorZ_ok(int64_t o) {
24322         LDKChannelId o_conv;
24323         o_conv.inner = untag_ptr(o);
24324         o_conv.is_owned = ptr_is_owned(o);
24325         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24326         o_conv = ChannelId_clone(&o_conv);
24327         LDKCResult_ChannelIdAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelIdAPIErrorZ), "LDKCResult_ChannelIdAPIErrorZ");
24328         *ret_conv = CResult_ChannelIdAPIErrorZ_ok(o_conv);
24329         return tag_ptr(ret_conv, true);
24330 }
24331
24332 int64_t  CS_LDK_CResult_ChannelIdAPIErrorZ_err(int64_t e) {
24333         void* e_ptr = untag_ptr(e);
24334         CHECK_ACCESS(e_ptr);
24335         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
24336         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
24337         LDKCResult_ChannelIdAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelIdAPIErrorZ), "LDKCResult_ChannelIdAPIErrorZ");
24338         *ret_conv = CResult_ChannelIdAPIErrorZ_err(e_conv);
24339         return tag_ptr(ret_conv, true);
24340 }
24341
24342 jboolean  CS_LDK_CResult_ChannelIdAPIErrorZ_is_ok(int64_t o) {
24343         LDKCResult_ChannelIdAPIErrorZ* o_conv = (LDKCResult_ChannelIdAPIErrorZ*)untag_ptr(o);
24344         jboolean ret_conv = CResult_ChannelIdAPIErrorZ_is_ok(o_conv);
24345         return ret_conv;
24346 }
24347
24348 void  CS_LDK_CResult_ChannelIdAPIErrorZ_free(int64_t _res) {
24349         if (!ptr_is_owned(_res)) return;
24350         void* _res_ptr = untag_ptr(_res);
24351         CHECK_ACCESS(_res_ptr);
24352         LDKCResult_ChannelIdAPIErrorZ _res_conv = *(LDKCResult_ChannelIdAPIErrorZ*)(_res_ptr);
24353         FREE(untag_ptr(_res));
24354         CResult_ChannelIdAPIErrorZ_free(_res_conv);
24355 }
24356
24357 static inline uint64_t CResult_ChannelIdAPIErrorZ_clone_ptr(LDKCResult_ChannelIdAPIErrorZ *NONNULL_PTR arg) {
24358         LDKCResult_ChannelIdAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelIdAPIErrorZ), "LDKCResult_ChannelIdAPIErrorZ");
24359         *ret_conv = CResult_ChannelIdAPIErrorZ_clone(arg);
24360         return tag_ptr(ret_conv, true);
24361 }
24362 int64_t  CS_LDK_CResult_ChannelIdAPIErrorZ_clone_ptr(int64_t arg) {
24363         LDKCResult_ChannelIdAPIErrorZ* arg_conv = (LDKCResult_ChannelIdAPIErrorZ*)untag_ptr(arg);
24364         int64_t ret_conv = CResult_ChannelIdAPIErrorZ_clone_ptr(arg_conv);
24365         return ret_conv;
24366 }
24367
24368 int64_t  CS_LDK_CResult_ChannelIdAPIErrorZ_clone(int64_t orig) {
24369         LDKCResult_ChannelIdAPIErrorZ* orig_conv = (LDKCResult_ChannelIdAPIErrorZ*)untag_ptr(orig);
24370         LDKCResult_ChannelIdAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelIdAPIErrorZ), "LDKCResult_ChannelIdAPIErrorZ");
24371         *ret_conv = CResult_ChannelIdAPIErrorZ_clone(orig_conv);
24372         return tag_ptr(ret_conv, true);
24373 }
24374
24375 void  CS_LDK_CVec_RecentPaymentDetailsZ_free(int64_tArray _res) {
24376         LDKCVec_RecentPaymentDetailsZ _res_constr;
24377         _res_constr.datalen = _res->arr_len;
24378         if (_res_constr.datalen > 0)
24379                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRecentPaymentDetails), "LDKCVec_RecentPaymentDetailsZ Elements");
24380         else
24381                 _res_constr.data = NULL;
24382         int64_t* _res_vals = _res->elems;
24383         for (size_t w = 0; w < _res_constr.datalen; w++) {
24384                 int64_t _res_conv_22 = _res_vals[w];
24385                 void* _res_conv_22_ptr = untag_ptr(_res_conv_22);
24386                 CHECK_ACCESS(_res_conv_22_ptr);
24387                 LDKRecentPaymentDetails _res_conv_22_conv = *(LDKRecentPaymentDetails*)(_res_conv_22_ptr);
24388                 FREE(untag_ptr(_res_conv_22));
24389                 _res_constr.data[w] = _res_conv_22_conv;
24390         }
24391         FREE(_res);
24392         CVec_RecentPaymentDetailsZ_free(_res_constr);
24393 }
24394
24395 int64_t  CS_LDK_CResult_NonePaymentSendFailureZ_ok() {
24396         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
24397         *ret_conv = CResult_NonePaymentSendFailureZ_ok();
24398         return tag_ptr(ret_conv, true);
24399 }
24400
24401 int64_t  CS_LDK_CResult_NonePaymentSendFailureZ_err(int64_t e) {
24402         void* e_ptr = untag_ptr(e);
24403         CHECK_ACCESS(e_ptr);
24404         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
24405         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
24406         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
24407         *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
24408         return tag_ptr(ret_conv, true);
24409 }
24410
24411 jboolean  CS_LDK_CResult_NonePaymentSendFailureZ_is_ok(int64_t o) {
24412         LDKCResult_NonePaymentSendFailureZ* o_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(o);
24413         jboolean ret_conv = CResult_NonePaymentSendFailureZ_is_ok(o_conv);
24414         return ret_conv;
24415 }
24416
24417 void  CS_LDK_CResult_NonePaymentSendFailureZ_free(int64_t _res) {
24418         if (!ptr_is_owned(_res)) return;
24419         void* _res_ptr = untag_ptr(_res);
24420         CHECK_ACCESS(_res_ptr);
24421         LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)(_res_ptr);
24422         FREE(untag_ptr(_res));
24423         CResult_NonePaymentSendFailureZ_free(_res_conv);
24424 }
24425
24426 static inline uint64_t CResult_NonePaymentSendFailureZ_clone_ptr(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR arg) {
24427         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
24428         *ret_conv = CResult_NonePaymentSendFailureZ_clone(arg);
24429         return tag_ptr(ret_conv, true);
24430 }
24431 int64_t  CS_LDK_CResult_NonePaymentSendFailureZ_clone_ptr(int64_t arg) {
24432         LDKCResult_NonePaymentSendFailureZ* arg_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(arg);
24433         int64_t ret_conv = CResult_NonePaymentSendFailureZ_clone_ptr(arg_conv);
24434         return ret_conv;
24435 }
24436
24437 int64_t  CS_LDK_CResult_NonePaymentSendFailureZ_clone(int64_t orig) {
24438         LDKCResult_NonePaymentSendFailureZ* orig_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(orig);
24439         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
24440         *ret_conv = CResult_NonePaymentSendFailureZ_clone(orig_conv);
24441         return tag_ptr(ret_conv, true);
24442 }
24443
24444 int64_t  CS_LDK_CResult_NoneRetryableSendFailureZ_ok() {
24445         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
24446         *ret_conv = CResult_NoneRetryableSendFailureZ_ok();
24447         return tag_ptr(ret_conv, true);
24448 }
24449
24450 int64_t  CS_LDK_CResult_NoneRetryableSendFailureZ_err(int32_t e) {
24451         LDKRetryableSendFailure e_conv = LDKRetryableSendFailure_from_cs(e);
24452         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
24453         *ret_conv = CResult_NoneRetryableSendFailureZ_err(e_conv);
24454         return tag_ptr(ret_conv, true);
24455 }
24456
24457 jboolean  CS_LDK_CResult_NoneRetryableSendFailureZ_is_ok(int64_t o) {
24458         LDKCResult_NoneRetryableSendFailureZ* o_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(o);
24459         jboolean ret_conv = CResult_NoneRetryableSendFailureZ_is_ok(o_conv);
24460         return ret_conv;
24461 }
24462
24463 void  CS_LDK_CResult_NoneRetryableSendFailureZ_free(int64_t _res) {
24464         if (!ptr_is_owned(_res)) return;
24465         void* _res_ptr = untag_ptr(_res);
24466         CHECK_ACCESS(_res_ptr);
24467         LDKCResult_NoneRetryableSendFailureZ _res_conv = *(LDKCResult_NoneRetryableSendFailureZ*)(_res_ptr);
24468         FREE(untag_ptr(_res));
24469         CResult_NoneRetryableSendFailureZ_free(_res_conv);
24470 }
24471
24472 static inline uint64_t CResult_NoneRetryableSendFailureZ_clone_ptr(LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR arg) {
24473         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
24474         *ret_conv = CResult_NoneRetryableSendFailureZ_clone(arg);
24475         return tag_ptr(ret_conv, true);
24476 }
24477 int64_t  CS_LDK_CResult_NoneRetryableSendFailureZ_clone_ptr(int64_t arg) {
24478         LDKCResult_NoneRetryableSendFailureZ* arg_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(arg);
24479         int64_t ret_conv = CResult_NoneRetryableSendFailureZ_clone_ptr(arg_conv);
24480         return ret_conv;
24481 }
24482
24483 int64_t  CS_LDK_CResult_NoneRetryableSendFailureZ_clone(int64_t orig) {
24484         LDKCResult_NoneRetryableSendFailureZ* orig_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(orig);
24485         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
24486         *ret_conv = CResult_NoneRetryableSendFailureZ_clone(orig_conv);
24487         return tag_ptr(ret_conv, true);
24488 }
24489
24490 int64_t  CS_LDK_CResult_ThirtyTwoBytesPaymentSendFailureZ_ok(int8_tArray o) {
24491         LDKThirtyTwoBytes o_ref;
24492         CHECK(o->arr_len == 32);
24493         memcpy(o_ref.data, o->elems, 32); FREE(o);
24494         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ), "LDKCResult_ThirtyTwoBytesPaymentSendFailureZ");
24495         *ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_ok(o_ref);
24496         return tag_ptr(ret_conv, true);
24497 }
24498
24499 int64_t  CS_LDK_CResult_ThirtyTwoBytesPaymentSendFailureZ_err(int64_t e) {
24500         void* e_ptr = untag_ptr(e);
24501         CHECK_ACCESS(e_ptr);
24502         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
24503         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
24504         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ), "LDKCResult_ThirtyTwoBytesPaymentSendFailureZ");
24505         *ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_err(e_conv);
24506         return tag_ptr(ret_conv, true);
24507 }
24508
24509 jboolean  CS_LDK_CResult_ThirtyTwoBytesPaymentSendFailureZ_is_ok(int64_t o) {
24510         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* o_conv = (LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)untag_ptr(o);
24511         jboolean ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_is_ok(o_conv);
24512         return ret_conv;
24513 }
24514
24515 void  CS_LDK_CResult_ThirtyTwoBytesPaymentSendFailureZ_free(int64_t _res) {
24516         if (!ptr_is_owned(_res)) return;
24517         void* _res_ptr = untag_ptr(_res);
24518         CHECK_ACCESS(_res_ptr);
24519         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ _res_conv = *(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)(_res_ptr);
24520         FREE(untag_ptr(_res));
24521         CResult_ThirtyTwoBytesPaymentSendFailureZ_free(_res_conv);
24522 }
24523
24524 static inline uint64_t CResult_ThirtyTwoBytesPaymentSendFailureZ_clone_ptr(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ *NONNULL_PTR arg) {
24525         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ), "LDKCResult_ThirtyTwoBytesPaymentSendFailureZ");
24526         *ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_clone(arg);
24527         return tag_ptr(ret_conv, true);
24528 }
24529 int64_t  CS_LDK_CResult_ThirtyTwoBytesPaymentSendFailureZ_clone_ptr(int64_t arg) {
24530         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* arg_conv = (LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)untag_ptr(arg);
24531         int64_t ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_clone_ptr(arg_conv);
24532         return ret_conv;
24533 }
24534
24535 int64_t  CS_LDK_CResult_ThirtyTwoBytesPaymentSendFailureZ_clone(int64_t orig) {
24536         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* orig_conv = (LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)untag_ptr(orig);
24537         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ), "LDKCResult_ThirtyTwoBytesPaymentSendFailureZ");
24538         *ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_clone(orig_conv);
24539         return tag_ptr(ret_conv, true);
24540 }
24541
24542 int64_t  CS_LDK_CResult_ThirtyTwoBytesRetryableSendFailureZ_ok(int8_tArray o) {
24543         LDKThirtyTwoBytes o_ref;
24544         CHECK(o->arr_len == 32);
24545         memcpy(o_ref.data, o->elems, 32); FREE(o);
24546         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ), "LDKCResult_ThirtyTwoBytesRetryableSendFailureZ");
24547         *ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_ok(o_ref);
24548         return tag_ptr(ret_conv, true);
24549 }
24550
24551 int64_t  CS_LDK_CResult_ThirtyTwoBytesRetryableSendFailureZ_err(int32_t e) {
24552         LDKRetryableSendFailure e_conv = LDKRetryableSendFailure_from_cs(e);
24553         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ), "LDKCResult_ThirtyTwoBytesRetryableSendFailureZ");
24554         *ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_err(e_conv);
24555         return tag_ptr(ret_conv, true);
24556 }
24557
24558 jboolean  CS_LDK_CResult_ThirtyTwoBytesRetryableSendFailureZ_is_ok(int64_t o) {
24559         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* o_conv = (LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)untag_ptr(o);
24560         jboolean ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_is_ok(o_conv);
24561         return ret_conv;
24562 }
24563
24564 void  CS_LDK_CResult_ThirtyTwoBytesRetryableSendFailureZ_free(int64_t _res) {
24565         if (!ptr_is_owned(_res)) return;
24566         void* _res_ptr = untag_ptr(_res);
24567         CHECK_ACCESS(_res_ptr);
24568         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ _res_conv = *(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)(_res_ptr);
24569         FREE(untag_ptr(_res));
24570         CResult_ThirtyTwoBytesRetryableSendFailureZ_free(_res_conv);
24571 }
24572
24573 static inline uint64_t CResult_ThirtyTwoBytesRetryableSendFailureZ_clone_ptr(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ *NONNULL_PTR arg) {
24574         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ), "LDKCResult_ThirtyTwoBytesRetryableSendFailureZ");
24575         *ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_clone(arg);
24576         return tag_ptr(ret_conv, true);
24577 }
24578 int64_t  CS_LDK_CResult_ThirtyTwoBytesRetryableSendFailureZ_clone_ptr(int64_t arg) {
24579         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* arg_conv = (LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)untag_ptr(arg);
24580         int64_t ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_clone_ptr(arg_conv);
24581         return ret_conv;
24582 }
24583
24584 int64_t  CS_LDK_CResult_ThirtyTwoBytesRetryableSendFailureZ_clone(int64_t orig) {
24585         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* orig_conv = (LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)untag_ptr(orig);
24586         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ), "LDKCResult_ThirtyTwoBytesRetryableSendFailureZ");
24587         *ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_clone(orig_conv);
24588         return tag_ptr(ret_conv, true);
24589 }
24590
24591 static inline uint64_t C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone_ptr(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ *NONNULL_PTR arg) {
24592         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
24593         *ret_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(arg);
24594         return tag_ptr(ret_conv, true);
24595 }
24596 int64_t  CS_LDK_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone_ptr(int64_t arg) {
24597         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* arg_conv = (LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(arg);
24598         int64_t ret_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone_ptr(arg_conv);
24599         return ret_conv;
24600 }
24601
24602 int64_t  CS_LDK_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(int64_t orig) {
24603         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* orig_conv = (LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(orig);
24604         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
24605         *ret_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(orig_conv);
24606         return tag_ptr(ret_conv, true);
24607 }
24608
24609 int64_t  CS_LDK_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_new(int8_tArray a, int8_tArray b) {
24610         LDKThirtyTwoBytes a_ref;
24611         CHECK(a->arr_len == 32);
24612         memcpy(a_ref.data, a->elems, 32); FREE(a);
24613         LDKThirtyTwoBytes b_ref;
24614         CHECK(b->arr_len == 32);
24615         memcpy(b_ref.data, b->elems, 32); FREE(b);
24616         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
24617         *ret_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_new(a_ref, b_ref);
24618         return tag_ptr(ret_conv, true);
24619 }
24620
24621 void  CS_LDK_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_free(int64_t _res) {
24622         if (!ptr_is_owned(_res)) return;
24623         void* _res_ptr = untag_ptr(_res);
24624         CHECK_ACCESS(_res_ptr);
24625         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(_res_ptr);
24626         FREE(untag_ptr(_res));
24627         C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_free(_res_conv);
24628 }
24629
24630 int64_t  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_ok(int64_t o) {
24631         void* o_ptr = untag_ptr(o);
24632         CHECK_ACCESS(o_ptr);
24633         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ o_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(o_ptr);
24634         o_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone((LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(o));
24635         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ");
24636         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_ok(o_conv);
24637         return tag_ptr(ret_conv, true);
24638 }
24639
24640 int64_t  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_err(int64_t e) {
24641         void* e_ptr = untag_ptr(e);
24642         CHECK_ACCESS(e_ptr);
24643         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
24644         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
24645         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ");
24646         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_err(e_conv);
24647         return tag_ptr(ret_conv, true);
24648 }
24649
24650 jboolean  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_is_ok(int64_t o) {
24651         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* o_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)untag_ptr(o);
24652         jboolean ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_is_ok(o_conv);
24653         return ret_conv;
24654 }
24655
24656 void  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_free(int64_t _res) {
24657         if (!ptr_is_owned(_res)) return;
24658         void* _res_ptr = untag_ptr(_res);
24659         CHECK_ACCESS(_res_ptr);
24660         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ _res_conv = *(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)(_res_ptr);
24661         FREE(untag_ptr(_res));
24662         CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_free(_res_conv);
24663 }
24664
24665 static inline uint64_t CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone_ptr(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ *NONNULL_PTR arg) {
24666         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ");
24667         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone(arg);
24668         return tag_ptr(ret_conv, true);
24669 }
24670 int64_t  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone_ptr(int64_t arg) {
24671         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* arg_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)untag_ptr(arg);
24672         int64_t ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone_ptr(arg_conv);
24673         return ret_conv;
24674 }
24675
24676 int64_t  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone(int64_t orig) {
24677         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* orig_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)untag_ptr(orig);
24678         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ");
24679         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone(orig_conv);
24680         return tag_ptr(ret_conv, true);
24681 }
24682
24683 void  CS_LDK_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_free(int64_tArray _res) {
24684         LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ _res_constr;
24685         _res_constr.datalen = _res->arr_len;
24686         if (_res_constr.datalen > 0)
24687                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ Elements");
24688         else
24689                 _res_constr.data = NULL;
24690         int64_t* _res_vals = _res->elems;
24691         for (size_t o = 0; o < _res_constr.datalen; o++) {
24692                 int64_t _res_conv_40 = _res_vals[o];
24693                 void* _res_conv_40_ptr = untag_ptr(_res_conv_40);
24694                 CHECK_ACCESS(_res_conv_40_ptr);
24695                 LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ _res_conv_40_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(_res_conv_40_ptr);
24696                 FREE(untag_ptr(_res_conv_40));
24697                 _res_constr.data[o] = _res_conv_40_conv;
24698         }
24699         FREE(_res);
24700         CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_free(_res_constr);
24701 }
24702
24703 int64_t  CS_LDK_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_ok(int64_tArray o) {
24704         LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ o_constr;
24705         o_constr.datalen = o->arr_len;
24706         if (o_constr.datalen > 0)
24707                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ Elements");
24708         else
24709                 o_constr.data = NULL;
24710         int64_t* o_vals = o->elems;
24711         for (size_t o = 0; o < o_constr.datalen; o++) {
24712                 int64_t o_conv_40 = o_vals[o];
24713                 void* o_conv_40_ptr = untag_ptr(o_conv_40);
24714                 CHECK_ACCESS(o_conv_40_ptr);
24715                 LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ o_conv_40_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(o_conv_40_ptr);
24716                 o_conv_40_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone((LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(o_conv_40));
24717                 o_constr.data[o] = o_conv_40_conv;
24718         }
24719         FREE(o);
24720         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
24721         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_ok(o_constr);
24722         return tag_ptr(ret_conv, true);
24723 }
24724
24725 int64_t  CS_LDK_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_err(int64_t e) {
24726         void* e_ptr = untag_ptr(e);
24727         CHECK_ACCESS(e_ptr);
24728         LDKProbeSendFailure e_conv = *(LDKProbeSendFailure*)(e_ptr);
24729         e_conv = ProbeSendFailure_clone((LDKProbeSendFailure*)untag_ptr(e));
24730         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
24731         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_err(e_conv);
24732         return tag_ptr(ret_conv, true);
24733 }
24734
24735 jboolean  CS_LDK_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_is_ok(int64_t o) {
24736         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* o_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)untag_ptr(o);
24737         jboolean ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_is_ok(o_conv);
24738         return ret_conv;
24739 }
24740
24741 void  CS_LDK_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_free(int64_t _res) {
24742         if (!ptr_is_owned(_res)) return;
24743         void* _res_ptr = untag_ptr(_res);
24744         CHECK_ACCESS(_res_ptr);
24745         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ _res_conv = *(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)(_res_ptr);
24746         FREE(untag_ptr(_res));
24747         CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_free(_res_conv);
24748 }
24749
24750 static inline uint64_t CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone_ptr(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ *NONNULL_PTR arg) {
24751         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
24752         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone(arg);
24753         return tag_ptr(ret_conv, true);
24754 }
24755 int64_t  CS_LDK_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone_ptr(int64_t arg) {
24756         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* arg_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)untag_ptr(arg);
24757         int64_t ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone_ptr(arg_conv);
24758         return ret_conv;
24759 }
24760
24761 int64_t  CS_LDK_CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone(int64_t orig) {
24762         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* orig_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)untag_ptr(orig);
24763         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
24764         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone(orig_conv);
24765         return tag_ptr(ret_conv, true);
24766 }
24767
24768 static inline uint64_t C2Tuple_ChannelIdPublicKeyZ_clone_ptr(LDKC2Tuple_ChannelIdPublicKeyZ *NONNULL_PTR arg) {
24769         LDKC2Tuple_ChannelIdPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ChannelIdPublicKeyZ), "LDKC2Tuple_ChannelIdPublicKeyZ");
24770         *ret_conv = C2Tuple_ChannelIdPublicKeyZ_clone(arg);
24771         return tag_ptr(ret_conv, true);
24772 }
24773 int64_t  CS_LDK_C2Tuple_ChannelIdPublicKeyZ_clone_ptr(int64_t arg) {
24774         LDKC2Tuple_ChannelIdPublicKeyZ* arg_conv = (LDKC2Tuple_ChannelIdPublicKeyZ*)untag_ptr(arg);
24775         int64_t ret_conv = C2Tuple_ChannelIdPublicKeyZ_clone_ptr(arg_conv);
24776         return ret_conv;
24777 }
24778
24779 int64_t  CS_LDK_C2Tuple_ChannelIdPublicKeyZ_clone(int64_t orig) {
24780         LDKC2Tuple_ChannelIdPublicKeyZ* orig_conv = (LDKC2Tuple_ChannelIdPublicKeyZ*)untag_ptr(orig);
24781         LDKC2Tuple_ChannelIdPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ChannelIdPublicKeyZ), "LDKC2Tuple_ChannelIdPublicKeyZ");
24782         *ret_conv = C2Tuple_ChannelIdPublicKeyZ_clone(orig_conv);
24783         return tag_ptr(ret_conv, true);
24784 }
24785
24786 int64_t  CS_LDK_C2Tuple_ChannelIdPublicKeyZ_new(int64_t a, int8_tArray b) {
24787         LDKChannelId a_conv;
24788         a_conv.inner = untag_ptr(a);
24789         a_conv.is_owned = ptr_is_owned(a);
24790         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
24791         a_conv = ChannelId_clone(&a_conv);
24792         LDKPublicKey b_ref;
24793         CHECK(b->arr_len == 33);
24794         memcpy(b_ref.compressed_form, b->elems, 33); FREE(b);
24795         LDKC2Tuple_ChannelIdPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ChannelIdPublicKeyZ), "LDKC2Tuple_ChannelIdPublicKeyZ");
24796         *ret_conv = C2Tuple_ChannelIdPublicKeyZ_new(a_conv, b_ref);
24797         return tag_ptr(ret_conv, true);
24798 }
24799
24800 void  CS_LDK_C2Tuple_ChannelIdPublicKeyZ_free(int64_t _res) {
24801         if (!ptr_is_owned(_res)) return;
24802         void* _res_ptr = untag_ptr(_res);
24803         CHECK_ACCESS(_res_ptr);
24804         LDKC2Tuple_ChannelIdPublicKeyZ _res_conv = *(LDKC2Tuple_ChannelIdPublicKeyZ*)(_res_ptr);
24805         FREE(untag_ptr(_res));
24806         C2Tuple_ChannelIdPublicKeyZ_free(_res_conv);
24807 }
24808
24809 void  CS_LDK_CVec_C2Tuple_ChannelIdPublicKeyZZ_free(int64_tArray _res) {
24810         LDKCVec_C2Tuple_ChannelIdPublicKeyZZ _res_constr;
24811         _res_constr.datalen = _res->arr_len;
24812         if (_res_constr.datalen > 0)
24813                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ChannelIdPublicKeyZ), "LDKCVec_C2Tuple_ChannelIdPublicKeyZZ Elements");
24814         else
24815                 _res_constr.data = NULL;
24816         int64_t* _res_vals = _res->elems;
24817         for (size_t e = 0; e < _res_constr.datalen; e++) {
24818                 int64_t _res_conv_30 = _res_vals[e];
24819                 void* _res_conv_30_ptr = untag_ptr(_res_conv_30);
24820                 CHECK_ACCESS(_res_conv_30_ptr);
24821                 LDKC2Tuple_ChannelIdPublicKeyZ _res_conv_30_conv = *(LDKC2Tuple_ChannelIdPublicKeyZ*)(_res_conv_30_ptr);
24822                 FREE(untag_ptr(_res_conv_30));
24823                 _res_constr.data[e] = _res_conv_30_conv;
24824         }
24825         FREE(_res);
24826         CVec_C2Tuple_ChannelIdPublicKeyZZ_free(_res_constr);
24827 }
24828
24829 void  CS_LDK_CVec_ChannelIdZ_free(int64_tArray _res) {
24830         LDKCVec_ChannelIdZ _res_constr;
24831         _res_constr.datalen = _res->arr_len;
24832         if (_res_constr.datalen > 0)
24833                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelId), "LDKCVec_ChannelIdZ Elements");
24834         else
24835                 _res_constr.data = NULL;
24836         int64_t* _res_vals = _res->elems;
24837         for (size_t l = 0; l < _res_constr.datalen; l++) {
24838                 int64_t _res_conv_11 = _res_vals[l];
24839                 LDKChannelId _res_conv_11_conv;
24840                 _res_conv_11_conv.inner = untag_ptr(_res_conv_11);
24841                 _res_conv_11_conv.is_owned = ptr_is_owned(_res_conv_11);
24842                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_11_conv);
24843                 _res_constr.data[l] = _res_conv_11_conv;
24844         }
24845         FREE(_res);
24846         CVec_ChannelIdZ_free(_res_constr);
24847 }
24848
24849 int64_t  CS_LDK_CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_ok(int64_t o) {
24850         LDKOfferWithDerivedMetadataBuilder o_conv;
24851         o_conv.inner = untag_ptr(o);
24852         o_conv.is_owned = ptr_is_owned(o);
24853         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24854         o_conv = OfferWithDerivedMetadataBuilder_clone(&o_conv);
24855         LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ), "LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ");
24856         *ret_conv = CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_ok(o_conv);
24857         return tag_ptr(ret_conv, true);
24858 }
24859
24860 int64_t  CS_LDK_CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_err(int32_t e) {
24861         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_cs(e);
24862         LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ), "LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ");
24863         *ret_conv = CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_err(e_conv);
24864         return tag_ptr(ret_conv, true);
24865 }
24866
24867 jboolean  CS_LDK_CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_is_ok(int64_t o) {
24868         LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ* o_conv = (LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ*)untag_ptr(o);
24869         jboolean ret_conv = CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_is_ok(o_conv);
24870         return ret_conv;
24871 }
24872
24873 void  CS_LDK_CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_free(int64_t _res) {
24874         if (!ptr_is_owned(_res)) return;
24875         void* _res_ptr = untag_ptr(_res);
24876         CHECK_ACCESS(_res_ptr);
24877         LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ _res_conv = *(LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ*)(_res_ptr);
24878         FREE(untag_ptr(_res));
24879         CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_free(_res_conv);
24880 }
24881
24882 static inline uint64_t CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone_ptr(LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ *NONNULL_PTR arg) {
24883         LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ), "LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ");
24884         *ret_conv = CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone(arg);
24885         return tag_ptr(ret_conv, true);
24886 }
24887 int64_t  CS_LDK_CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone_ptr(int64_t arg) {
24888         LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ* arg_conv = (LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ*)untag_ptr(arg);
24889         int64_t ret_conv = CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone_ptr(arg_conv);
24890         return ret_conv;
24891 }
24892
24893 int64_t  CS_LDK_CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone(int64_t orig) {
24894         LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ* orig_conv = (LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ*)untag_ptr(orig);
24895         LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ), "LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ");
24896         *ret_conv = CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone(orig_conv);
24897         return tag_ptr(ret_conv, true);
24898 }
24899
24900 int64_t  CS_LDK_COption_StrZ_some(jstring o) {
24901         LDKStr o_conv = str_ref_to_owned_c(o);
24902         LDKCOption_StrZ *ret_copy = MALLOC(sizeof(LDKCOption_StrZ), "LDKCOption_StrZ");
24903         *ret_copy = COption_StrZ_some(o_conv);
24904         int64_t ret_ref = tag_ptr(ret_copy, true);
24905         return ret_ref;
24906 }
24907
24908 int64_t  CS_LDK_COption_StrZ_none() {
24909         LDKCOption_StrZ *ret_copy = MALLOC(sizeof(LDKCOption_StrZ), "LDKCOption_StrZ");
24910         *ret_copy = COption_StrZ_none();
24911         int64_t ret_ref = tag_ptr(ret_copy, true);
24912         return ret_ref;
24913 }
24914
24915 void  CS_LDK_COption_StrZ_free(int64_t _res) {
24916         if (!ptr_is_owned(_res)) return;
24917         void* _res_ptr = untag_ptr(_res);
24918         CHECK_ACCESS(_res_ptr);
24919         LDKCOption_StrZ _res_conv = *(LDKCOption_StrZ*)(_res_ptr);
24920         FREE(untag_ptr(_res));
24921         COption_StrZ_free(_res_conv);
24922 }
24923
24924 static inline uint64_t COption_StrZ_clone_ptr(LDKCOption_StrZ *NONNULL_PTR arg) {
24925         LDKCOption_StrZ *ret_copy = MALLOC(sizeof(LDKCOption_StrZ), "LDKCOption_StrZ");
24926         *ret_copy = COption_StrZ_clone(arg);
24927         int64_t ret_ref = tag_ptr(ret_copy, true);
24928         return ret_ref;
24929 }
24930 int64_t  CS_LDK_COption_StrZ_clone_ptr(int64_t arg) {
24931         LDKCOption_StrZ* arg_conv = (LDKCOption_StrZ*)untag_ptr(arg);
24932         int64_t ret_conv = COption_StrZ_clone_ptr(arg_conv);
24933         return ret_conv;
24934 }
24935
24936 int64_t  CS_LDK_COption_StrZ_clone(int64_t orig) {
24937         LDKCOption_StrZ* orig_conv = (LDKCOption_StrZ*)untag_ptr(orig);
24938         LDKCOption_StrZ *ret_copy = MALLOC(sizeof(LDKCOption_StrZ), "LDKCOption_StrZ");
24939         *ret_copy = COption_StrZ_clone(orig_conv);
24940         int64_t ret_ref = tag_ptr(ret_copy, true);
24941         return ret_ref;
24942 }
24943
24944 int64_t  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_ok(int64_t o) {
24945         void* o_ptr = untag_ptr(o);
24946         CHECK_ACCESS(o_ptr);
24947         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ o_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(o_ptr);
24948         o_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone((LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(o));
24949         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
24950         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_ok(o_conv);
24951         return tag_ptr(ret_conv, true);
24952 }
24953
24954 int64_t  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_err() {
24955         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
24956         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_err();
24957         return tag_ptr(ret_conv, true);
24958 }
24959
24960 jboolean  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_is_ok(int64_t o) {
24961         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* o_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)untag_ptr(o);
24962         jboolean ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_is_ok(o_conv);
24963         return ret_conv;
24964 }
24965
24966 void  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_free(int64_t _res) {
24967         if (!ptr_is_owned(_res)) return;
24968         void* _res_ptr = untag_ptr(_res);
24969         CHECK_ACCESS(_res_ptr);
24970         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ _res_conv = *(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)(_res_ptr);
24971         FREE(untag_ptr(_res));
24972         CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_free(_res_conv);
24973 }
24974
24975 static inline uint64_t CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone_ptr(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ *NONNULL_PTR arg) {
24976         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
24977         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone(arg);
24978         return tag_ptr(ret_conv, true);
24979 }
24980 int64_t  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone_ptr(int64_t arg) {
24981         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* arg_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)untag_ptr(arg);
24982         int64_t ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone_ptr(arg_conv);
24983         return ret_conv;
24984 }
24985
24986 int64_t  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone(int64_t orig) {
24987         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* orig_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)untag_ptr(orig);
24988         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
24989         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone(orig_conv);
24990         return tag_ptr(ret_conv, true);
24991 }
24992
24993 int64_t  CS_LDK_CResult_ThirtyTwoBytesAPIErrorZ_ok(int8_tArray o) {
24994         LDKThirtyTwoBytes o_ref;
24995         CHECK(o->arr_len == 32);
24996         memcpy(o_ref.data, o->elems, 32); FREE(o);
24997         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
24998         *ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_ok(o_ref);
24999         return tag_ptr(ret_conv, true);
25000 }
25001
25002 int64_t  CS_LDK_CResult_ThirtyTwoBytesAPIErrorZ_err(int64_t e) {
25003         void* e_ptr = untag_ptr(e);
25004         CHECK_ACCESS(e_ptr);
25005         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
25006         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
25007         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
25008         *ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_err(e_conv);
25009         return tag_ptr(ret_conv, true);
25010 }
25011
25012 jboolean  CS_LDK_CResult_ThirtyTwoBytesAPIErrorZ_is_ok(int64_t o) {
25013         LDKCResult_ThirtyTwoBytesAPIErrorZ* o_conv = (LDKCResult_ThirtyTwoBytesAPIErrorZ*)untag_ptr(o);
25014         jboolean ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_is_ok(o_conv);
25015         return ret_conv;
25016 }
25017
25018 void  CS_LDK_CResult_ThirtyTwoBytesAPIErrorZ_free(int64_t _res) {
25019         if (!ptr_is_owned(_res)) return;
25020         void* _res_ptr = untag_ptr(_res);
25021         CHECK_ACCESS(_res_ptr);
25022         LDKCResult_ThirtyTwoBytesAPIErrorZ _res_conv = *(LDKCResult_ThirtyTwoBytesAPIErrorZ*)(_res_ptr);
25023         FREE(untag_ptr(_res));
25024         CResult_ThirtyTwoBytesAPIErrorZ_free(_res_conv);
25025 }
25026
25027 static inline uint64_t CResult_ThirtyTwoBytesAPIErrorZ_clone_ptr(LDKCResult_ThirtyTwoBytesAPIErrorZ *NONNULL_PTR arg) {
25028         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
25029         *ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_clone(arg);
25030         return tag_ptr(ret_conv, true);
25031 }
25032 int64_t  CS_LDK_CResult_ThirtyTwoBytesAPIErrorZ_clone_ptr(int64_t arg) {
25033         LDKCResult_ThirtyTwoBytesAPIErrorZ* arg_conv = (LDKCResult_ThirtyTwoBytesAPIErrorZ*)untag_ptr(arg);
25034         int64_t ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_clone_ptr(arg_conv);
25035         return ret_conv;
25036 }
25037
25038 int64_t  CS_LDK_CResult_ThirtyTwoBytesAPIErrorZ_clone(int64_t orig) {
25039         LDKCResult_ThirtyTwoBytesAPIErrorZ* orig_conv = (LDKCResult_ThirtyTwoBytesAPIErrorZ*)untag_ptr(orig);
25040         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
25041         *ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_clone(orig_conv);
25042         return tag_ptr(ret_conv, true);
25043 }
25044
25045 int64_t  CS_LDK_COption_OffersMessageZ_some(int64_t o) {
25046         void* o_ptr = untag_ptr(o);
25047         CHECK_ACCESS(o_ptr);
25048         LDKOffersMessage o_conv = *(LDKOffersMessage*)(o_ptr);
25049         o_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(o));
25050         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
25051         *ret_copy = COption_OffersMessageZ_some(o_conv);
25052         int64_t ret_ref = tag_ptr(ret_copy, true);
25053         return ret_ref;
25054 }
25055
25056 int64_t  CS_LDK_COption_OffersMessageZ_none() {
25057         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
25058         *ret_copy = COption_OffersMessageZ_none();
25059         int64_t ret_ref = tag_ptr(ret_copy, true);
25060         return ret_ref;
25061 }
25062
25063 void  CS_LDK_COption_OffersMessageZ_free(int64_t _res) {
25064         if (!ptr_is_owned(_res)) return;
25065         void* _res_ptr = untag_ptr(_res);
25066         CHECK_ACCESS(_res_ptr);
25067         LDKCOption_OffersMessageZ _res_conv = *(LDKCOption_OffersMessageZ*)(_res_ptr);
25068         FREE(untag_ptr(_res));
25069         COption_OffersMessageZ_free(_res_conv);
25070 }
25071
25072 static inline uint64_t COption_OffersMessageZ_clone_ptr(LDKCOption_OffersMessageZ *NONNULL_PTR arg) {
25073         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
25074         *ret_copy = COption_OffersMessageZ_clone(arg);
25075         int64_t ret_ref = tag_ptr(ret_copy, true);
25076         return ret_ref;
25077 }
25078 int64_t  CS_LDK_COption_OffersMessageZ_clone_ptr(int64_t arg) {
25079         LDKCOption_OffersMessageZ* arg_conv = (LDKCOption_OffersMessageZ*)untag_ptr(arg);
25080         int64_t ret_conv = COption_OffersMessageZ_clone_ptr(arg_conv);
25081         return ret_conv;
25082 }
25083
25084 int64_t  CS_LDK_COption_OffersMessageZ_clone(int64_t orig) {
25085         LDKCOption_OffersMessageZ* orig_conv = (LDKCOption_OffersMessageZ*)untag_ptr(orig);
25086         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
25087         *ret_copy = COption_OffersMessageZ_clone(orig_conv);
25088         int64_t ret_ref = tag_ptr(ret_copy, true);
25089         return ret_ref;
25090 }
25091
25092 static inline uint64_t C3Tuple_OffersMessageDestinationBlindedPathZ_clone_ptr(LDKC3Tuple_OffersMessageDestinationBlindedPathZ *NONNULL_PTR arg) {
25093         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKC3Tuple_OffersMessageDestinationBlindedPathZ");
25094         *ret_conv = C3Tuple_OffersMessageDestinationBlindedPathZ_clone(arg);
25095         return tag_ptr(ret_conv, true);
25096 }
25097 int64_t  CS_LDK_C3Tuple_OffersMessageDestinationBlindedPathZ_clone_ptr(int64_t arg) {
25098         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* arg_conv = (LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)untag_ptr(arg);
25099         int64_t ret_conv = C3Tuple_OffersMessageDestinationBlindedPathZ_clone_ptr(arg_conv);
25100         return ret_conv;
25101 }
25102
25103 int64_t  CS_LDK_C3Tuple_OffersMessageDestinationBlindedPathZ_clone(int64_t orig) {
25104         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* orig_conv = (LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)untag_ptr(orig);
25105         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKC3Tuple_OffersMessageDestinationBlindedPathZ");
25106         *ret_conv = C3Tuple_OffersMessageDestinationBlindedPathZ_clone(orig_conv);
25107         return tag_ptr(ret_conv, true);
25108 }
25109
25110 int64_t  CS_LDK_C3Tuple_OffersMessageDestinationBlindedPathZ_new(int64_t a, int64_t b, int64_t c) {
25111         void* a_ptr = untag_ptr(a);
25112         CHECK_ACCESS(a_ptr);
25113         LDKOffersMessage a_conv = *(LDKOffersMessage*)(a_ptr);
25114         a_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(a));
25115         void* b_ptr = untag_ptr(b);
25116         CHECK_ACCESS(b_ptr);
25117         LDKDestination b_conv = *(LDKDestination*)(b_ptr);
25118         b_conv = Destination_clone((LDKDestination*)untag_ptr(b));
25119         LDKBlindedPath c_conv;
25120         c_conv.inner = untag_ptr(c);
25121         c_conv.is_owned = ptr_is_owned(c);
25122         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
25123         c_conv = BlindedPath_clone(&c_conv);
25124         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKC3Tuple_OffersMessageDestinationBlindedPathZ");
25125         *ret_conv = C3Tuple_OffersMessageDestinationBlindedPathZ_new(a_conv, b_conv, c_conv);
25126         return tag_ptr(ret_conv, true);
25127 }
25128
25129 void  CS_LDK_C3Tuple_OffersMessageDestinationBlindedPathZ_free(int64_t _res) {
25130         if (!ptr_is_owned(_res)) return;
25131         void* _res_ptr = untag_ptr(_res);
25132         CHECK_ACCESS(_res_ptr);
25133         LDKC3Tuple_OffersMessageDestinationBlindedPathZ _res_conv = *(LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)(_res_ptr);
25134         FREE(untag_ptr(_res));
25135         C3Tuple_OffersMessageDestinationBlindedPathZ_free(_res_conv);
25136 }
25137
25138 void  CS_LDK_CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ_free(int64_tArray _res) {
25139         LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ _res_constr;
25140         _res_constr.datalen = _res->arr_len;
25141         if (_res_constr.datalen > 0)
25142                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ Elements");
25143         else
25144                 _res_constr.data = NULL;
25145         int64_t* _res_vals = _res->elems;
25146         for (size_t x = 0; x < _res_constr.datalen; x++) {
25147                 int64_t _res_conv_49 = _res_vals[x];
25148                 void* _res_conv_49_ptr = untag_ptr(_res_conv_49);
25149                 CHECK_ACCESS(_res_conv_49_ptr);
25150                 LDKC3Tuple_OffersMessageDestinationBlindedPathZ _res_conv_49_conv = *(LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)(_res_conv_49_ptr);
25151                 FREE(untag_ptr(_res_conv_49));
25152                 _res_constr.data[x] = _res_conv_49_conv;
25153         }
25154         FREE(_res);
25155         CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ_free(_res_constr);
25156 }
25157
25158 int64_t  CS_LDK_CResult_PhantomRouteHintsDecodeErrorZ_ok(int64_t o) {
25159         LDKPhantomRouteHints o_conv;
25160         o_conv.inner = untag_ptr(o);
25161         o_conv.is_owned = ptr_is_owned(o);
25162         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25163         o_conv = PhantomRouteHints_clone(&o_conv);
25164         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
25165         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_ok(o_conv);
25166         return tag_ptr(ret_conv, true);
25167 }
25168
25169 int64_t  CS_LDK_CResult_PhantomRouteHintsDecodeErrorZ_err(int64_t e) {
25170         void* e_ptr = untag_ptr(e);
25171         CHECK_ACCESS(e_ptr);
25172         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25173         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25174         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
25175         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_err(e_conv);
25176         return tag_ptr(ret_conv, true);
25177 }
25178
25179 jboolean  CS_LDK_CResult_PhantomRouteHintsDecodeErrorZ_is_ok(int64_t o) {
25180         LDKCResult_PhantomRouteHintsDecodeErrorZ* o_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(o);
25181         jboolean ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_is_ok(o_conv);
25182         return ret_conv;
25183 }
25184
25185 void  CS_LDK_CResult_PhantomRouteHintsDecodeErrorZ_free(int64_t _res) {
25186         if (!ptr_is_owned(_res)) return;
25187         void* _res_ptr = untag_ptr(_res);
25188         CHECK_ACCESS(_res_ptr);
25189         LDKCResult_PhantomRouteHintsDecodeErrorZ _res_conv = *(LDKCResult_PhantomRouteHintsDecodeErrorZ*)(_res_ptr);
25190         FREE(untag_ptr(_res));
25191         CResult_PhantomRouteHintsDecodeErrorZ_free(_res_conv);
25192 }
25193
25194 static inline uint64_t CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR arg) {
25195         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
25196         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(arg);
25197         return tag_ptr(ret_conv, true);
25198 }
25199 int64_t  CS_LDK_CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(int64_t arg) {
25200         LDKCResult_PhantomRouteHintsDecodeErrorZ* arg_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(arg);
25201         int64_t ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(arg_conv);
25202         return ret_conv;
25203 }
25204
25205 int64_t  CS_LDK_CResult_PhantomRouteHintsDecodeErrorZ_clone(int64_t orig) {
25206         LDKCResult_PhantomRouteHintsDecodeErrorZ* orig_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(orig);
25207         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
25208         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(orig_conv);
25209         return tag_ptr(ret_conv, true);
25210 }
25211
25212 int64_t  CS_LDK_CResult_BlindedForwardDecodeErrorZ_ok(int64_t o) {
25213         LDKBlindedForward o_conv;
25214         o_conv.inner = untag_ptr(o);
25215         o_conv.is_owned = ptr_is_owned(o);
25216         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25217         o_conv = BlindedForward_clone(&o_conv);
25218         LDKCResult_BlindedForwardDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedForwardDecodeErrorZ), "LDKCResult_BlindedForwardDecodeErrorZ");
25219         *ret_conv = CResult_BlindedForwardDecodeErrorZ_ok(o_conv);
25220         return tag_ptr(ret_conv, true);
25221 }
25222
25223 int64_t  CS_LDK_CResult_BlindedForwardDecodeErrorZ_err(int64_t e) {
25224         void* e_ptr = untag_ptr(e);
25225         CHECK_ACCESS(e_ptr);
25226         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25227         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25228         LDKCResult_BlindedForwardDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedForwardDecodeErrorZ), "LDKCResult_BlindedForwardDecodeErrorZ");
25229         *ret_conv = CResult_BlindedForwardDecodeErrorZ_err(e_conv);
25230         return tag_ptr(ret_conv, true);
25231 }
25232
25233 jboolean  CS_LDK_CResult_BlindedForwardDecodeErrorZ_is_ok(int64_t o) {
25234         LDKCResult_BlindedForwardDecodeErrorZ* o_conv = (LDKCResult_BlindedForwardDecodeErrorZ*)untag_ptr(o);
25235         jboolean ret_conv = CResult_BlindedForwardDecodeErrorZ_is_ok(o_conv);
25236         return ret_conv;
25237 }
25238
25239 void  CS_LDK_CResult_BlindedForwardDecodeErrorZ_free(int64_t _res) {
25240         if (!ptr_is_owned(_res)) return;
25241         void* _res_ptr = untag_ptr(_res);
25242         CHECK_ACCESS(_res_ptr);
25243         LDKCResult_BlindedForwardDecodeErrorZ _res_conv = *(LDKCResult_BlindedForwardDecodeErrorZ*)(_res_ptr);
25244         FREE(untag_ptr(_res));
25245         CResult_BlindedForwardDecodeErrorZ_free(_res_conv);
25246 }
25247
25248 static inline uint64_t CResult_BlindedForwardDecodeErrorZ_clone_ptr(LDKCResult_BlindedForwardDecodeErrorZ *NONNULL_PTR arg) {
25249         LDKCResult_BlindedForwardDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedForwardDecodeErrorZ), "LDKCResult_BlindedForwardDecodeErrorZ");
25250         *ret_conv = CResult_BlindedForwardDecodeErrorZ_clone(arg);
25251         return tag_ptr(ret_conv, true);
25252 }
25253 int64_t  CS_LDK_CResult_BlindedForwardDecodeErrorZ_clone_ptr(int64_t arg) {
25254         LDKCResult_BlindedForwardDecodeErrorZ* arg_conv = (LDKCResult_BlindedForwardDecodeErrorZ*)untag_ptr(arg);
25255         int64_t ret_conv = CResult_BlindedForwardDecodeErrorZ_clone_ptr(arg_conv);
25256         return ret_conv;
25257 }
25258
25259 int64_t  CS_LDK_CResult_BlindedForwardDecodeErrorZ_clone(int64_t orig) {
25260         LDKCResult_BlindedForwardDecodeErrorZ* orig_conv = (LDKCResult_BlindedForwardDecodeErrorZ*)untag_ptr(orig);
25261         LDKCResult_BlindedForwardDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedForwardDecodeErrorZ), "LDKCResult_BlindedForwardDecodeErrorZ");
25262         *ret_conv = CResult_BlindedForwardDecodeErrorZ_clone(orig_conv);
25263         return tag_ptr(ret_conv, true);
25264 }
25265
25266 int64_t  CS_LDK_CResult_PendingHTLCRoutingDecodeErrorZ_ok(int64_t o) {
25267         void* o_ptr = untag_ptr(o);
25268         CHECK_ACCESS(o_ptr);
25269         LDKPendingHTLCRouting o_conv = *(LDKPendingHTLCRouting*)(o_ptr);
25270         o_conv = PendingHTLCRouting_clone((LDKPendingHTLCRouting*)untag_ptr(o));
25271         LDKCResult_PendingHTLCRoutingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCRoutingDecodeErrorZ), "LDKCResult_PendingHTLCRoutingDecodeErrorZ");
25272         *ret_conv = CResult_PendingHTLCRoutingDecodeErrorZ_ok(o_conv);
25273         return tag_ptr(ret_conv, true);
25274 }
25275
25276 int64_t  CS_LDK_CResult_PendingHTLCRoutingDecodeErrorZ_err(int64_t e) {
25277         void* e_ptr = untag_ptr(e);
25278         CHECK_ACCESS(e_ptr);
25279         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25280         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25281         LDKCResult_PendingHTLCRoutingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCRoutingDecodeErrorZ), "LDKCResult_PendingHTLCRoutingDecodeErrorZ");
25282         *ret_conv = CResult_PendingHTLCRoutingDecodeErrorZ_err(e_conv);
25283         return tag_ptr(ret_conv, true);
25284 }
25285
25286 jboolean  CS_LDK_CResult_PendingHTLCRoutingDecodeErrorZ_is_ok(int64_t o) {
25287         LDKCResult_PendingHTLCRoutingDecodeErrorZ* o_conv = (LDKCResult_PendingHTLCRoutingDecodeErrorZ*)untag_ptr(o);
25288         jboolean ret_conv = CResult_PendingHTLCRoutingDecodeErrorZ_is_ok(o_conv);
25289         return ret_conv;
25290 }
25291
25292 void  CS_LDK_CResult_PendingHTLCRoutingDecodeErrorZ_free(int64_t _res) {
25293         if (!ptr_is_owned(_res)) return;
25294         void* _res_ptr = untag_ptr(_res);
25295         CHECK_ACCESS(_res_ptr);
25296         LDKCResult_PendingHTLCRoutingDecodeErrorZ _res_conv = *(LDKCResult_PendingHTLCRoutingDecodeErrorZ*)(_res_ptr);
25297         FREE(untag_ptr(_res));
25298         CResult_PendingHTLCRoutingDecodeErrorZ_free(_res_conv);
25299 }
25300
25301 static inline uint64_t CResult_PendingHTLCRoutingDecodeErrorZ_clone_ptr(LDKCResult_PendingHTLCRoutingDecodeErrorZ *NONNULL_PTR arg) {
25302         LDKCResult_PendingHTLCRoutingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCRoutingDecodeErrorZ), "LDKCResult_PendingHTLCRoutingDecodeErrorZ");
25303         *ret_conv = CResult_PendingHTLCRoutingDecodeErrorZ_clone(arg);
25304         return tag_ptr(ret_conv, true);
25305 }
25306 int64_t  CS_LDK_CResult_PendingHTLCRoutingDecodeErrorZ_clone_ptr(int64_t arg) {
25307         LDKCResult_PendingHTLCRoutingDecodeErrorZ* arg_conv = (LDKCResult_PendingHTLCRoutingDecodeErrorZ*)untag_ptr(arg);
25308         int64_t ret_conv = CResult_PendingHTLCRoutingDecodeErrorZ_clone_ptr(arg_conv);
25309         return ret_conv;
25310 }
25311
25312 int64_t  CS_LDK_CResult_PendingHTLCRoutingDecodeErrorZ_clone(int64_t orig) {
25313         LDKCResult_PendingHTLCRoutingDecodeErrorZ* orig_conv = (LDKCResult_PendingHTLCRoutingDecodeErrorZ*)untag_ptr(orig);
25314         LDKCResult_PendingHTLCRoutingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCRoutingDecodeErrorZ), "LDKCResult_PendingHTLCRoutingDecodeErrorZ");
25315         *ret_conv = CResult_PendingHTLCRoutingDecodeErrorZ_clone(orig_conv);
25316         return tag_ptr(ret_conv, true);
25317 }
25318
25319 int64_t  CS_LDK_CResult_PendingHTLCInfoDecodeErrorZ_ok(int64_t o) {
25320         LDKPendingHTLCInfo o_conv;
25321         o_conv.inner = untag_ptr(o);
25322         o_conv.is_owned = ptr_is_owned(o);
25323         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25324         o_conv = PendingHTLCInfo_clone(&o_conv);
25325         LDKCResult_PendingHTLCInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoDecodeErrorZ), "LDKCResult_PendingHTLCInfoDecodeErrorZ");
25326         *ret_conv = CResult_PendingHTLCInfoDecodeErrorZ_ok(o_conv);
25327         return tag_ptr(ret_conv, true);
25328 }
25329
25330 int64_t  CS_LDK_CResult_PendingHTLCInfoDecodeErrorZ_err(int64_t e) {
25331         void* e_ptr = untag_ptr(e);
25332         CHECK_ACCESS(e_ptr);
25333         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25334         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25335         LDKCResult_PendingHTLCInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoDecodeErrorZ), "LDKCResult_PendingHTLCInfoDecodeErrorZ");
25336         *ret_conv = CResult_PendingHTLCInfoDecodeErrorZ_err(e_conv);
25337         return tag_ptr(ret_conv, true);
25338 }
25339
25340 jboolean  CS_LDK_CResult_PendingHTLCInfoDecodeErrorZ_is_ok(int64_t o) {
25341         LDKCResult_PendingHTLCInfoDecodeErrorZ* o_conv = (LDKCResult_PendingHTLCInfoDecodeErrorZ*)untag_ptr(o);
25342         jboolean ret_conv = CResult_PendingHTLCInfoDecodeErrorZ_is_ok(o_conv);
25343         return ret_conv;
25344 }
25345
25346 void  CS_LDK_CResult_PendingHTLCInfoDecodeErrorZ_free(int64_t _res) {
25347         if (!ptr_is_owned(_res)) return;
25348         void* _res_ptr = untag_ptr(_res);
25349         CHECK_ACCESS(_res_ptr);
25350         LDKCResult_PendingHTLCInfoDecodeErrorZ _res_conv = *(LDKCResult_PendingHTLCInfoDecodeErrorZ*)(_res_ptr);
25351         FREE(untag_ptr(_res));
25352         CResult_PendingHTLCInfoDecodeErrorZ_free(_res_conv);
25353 }
25354
25355 static inline uint64_t CResult_PendingHTLCInfoDecodeErrorZ_clone_ptr(LDKCResult_PendingHTLCInfoDecodeErrorZ *NONNULL_PTR arg) {
25356         LDKCResult_PendingHTLCInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoDecodeErrorZ), "LDKCResult_PendingHTLCInfoDecodeErrorZ");
25357         *ret_conv = CResult_PendingHTLCInfoDecodeErrorZ_clone(arg);
25358         return tag_ptr(ret_conv, true);
25359 }
25360 int64_t  CS_LDK_CResult_PendingHTLCInfoDecodeErrorZ_clone_ptr(int64_t arg) {
25361         LDKCResult_PendingHTLCInfoDecodeErrorZ* arg_conv = (LDKCResult_PendingHTLCInfoDecodeErrorZ*)untag_ptr(arg);
25362         int64_t ret_conv = CResult_PendingHTLCInfoDecodeErrorZ_clone_ptr(arg_conv);
25363         return ret_conv;
25364 }
25365
25366 int64_t  CS_LDK_CResult_PendingHTLCInfoDecodeErrorZ_clone(int64_t orig) {
25367         LDKCResult_PendingHTLCInfoDecodeErrorZ* orig_conv = (LDKCResult_PendingHTLCInfoDecodeErrorZ*)untag_ptr(orig);
25368         LDKCResult_PendingHTLCInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoDecodeErrorZ), "LDKCResult_PendingHTLCInfoDecodeErrorZ");
25369         *ret_conv = CResult_PendingHTLCInfoDecodeErrorZ_clone(orig_conv);
25370         return tag_ptr(ret_conv, true);
25371 }
25372
25373 int64_t  CS_LDK_CResult_BlindedFailureDecodeErrorZ_ok(int32_t o) {
25374         LDKBlindedFailure o_conv = LDKBlindedFailure_from_cs(o);
25375         LDKCResult_BlindedFailureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedFailureDecodeErrorZ), "LDKCResult_BlindedFailureDecodeErrorZ");
25376         *ret_conv = CResult_BlindedFailureDecodeErrorZ_ok(o_conv);
25377         return tag_ptr(ret_conv, true);
25378 }
25379
25380 int64_t  CS_LDK_CResult_BlindedFailureDecodeErrorZ_err(int64_t e) {
25381         void* e_ptr = untag_ptr(e);
25382         CHECK_ACCESS(e_ptr);
25383         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25384         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25385         LDKCResult_BlindedFailureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedFailureDecodeErrorZ), "LDKCResult_BlindedFailureDecodeErrorZ");
25386         *ret_conv = CResult_BlindedFailureDecodeErrorZ_err(e_conv);
25387         return tag_ptr(ret_conv, true);
25388 }
25389
25390 jboolean  CS_LDK_CResult_BlindedFailureDecodeErrorZ_is_ok(int64_t o) {
25391         LDKCResult_BlindedFailureDecodeErrorZ* o_conv = (LDKCResult_BlindedFailureDecodeErrorZ*)untag_ptr(o);
25392         jboolean ret_conv = CResult_BlindedFailureDecodeErrorZ_is_ok(o_conv);
25393         return ret_conv;
25394 }
25395
25396 void  CS_LDK_CResult_BlindedFailureDecodeErrorZ_free(int64_t _res) {
25397         if (!ptr_is_owned(_res)) return;
25398         void* _res_ptr = untag_ptr(_res);
25399         CHECK_ACCESS(_res_ptr);
25400         LDKCResult_BlindedFailureDecodeErrorZ _res_conv = *(LDKCResult_BlindedFailureDecodeErrorZ*)(_res_ptr);
25401         FREE(untag_ptr(_res));
25402         CResult_BlindedFailureDecodeErrorZ_free(_res_conv);
25403 }
25404
25405 static inline uint64_t CResult_BlindedFailureDecodeErrorZ_clone_ptr(LDKCResult_BlindedFailureDecodeErrorZ *NONNULL_PTR arg) {
25406         LDKCResult_BlindedFailureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedFailureDecodeErrorZ), "LDKCResult_BlindedFailureDecodeErrorZ");
25407         *ret_conv = CResult_BlindedFailureDecodeErrorZ_clone(arg);
25408         return tag_ptr(ret_conv, true);
25409 }
25410 int64_t  CS_LDK_CResult_BlindedFailureDecodeErrorZ_clone_ptr(int64_t arg) {
25411         LDKCResult_BlindedFailureDecodeErrorZ* arg_conv = (LDKCResult_BlindedFailureDecodeErrorZ*)untag_ptr(arg);
25412         int64_t ret_conv = CResult_BlindedFailureDecodeErrorZ_clone_ptr(arg_conv);
25413         return ret_conv;
25414 }
25415
25416 int64_t  CS_LDK_CResult_BlindedFailureDecodeErrorZ_clone(int64_t orig) {
25417         LDKCResult_BlindedFailureDecodeErrorZ* orig_conv = (LDKCResult_BlindedFailureDecodeErrorZ*)untag_ptr(orig);
25418         LDKCResult_BlindedFailureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedFailureDecodeErrorZ), "LDKCResult_BlindedFailureDecodeErrorZ");
25419         *ret_conv = CResult_BlindedFailureDecodeErrorZ_clone(orig_conv);
25420         return tag_ptr(ret_conv, true);
25421 }
25422
25423 void  CS_LDK_CVec_ChannelMonitorZ_free(int64_tArray _res) {
25424         LDKCVec_ChannelMonitorZ _res_constr;
25425         _res_constr.datalen = _res->arr_len;
25426         if (_res_constr.datalen > 0)
25427                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
25428         else
25429                 _res_constr.data = NULL;
25430         int64_t* _res_vals = _res->elems;
25431         for (size_t q = 0; q < _res_constr.datalen; q++) {
25432                 int64_t _res_conv_16 = _res_vals[q];
25433                 LDKChannelMonitor _res_conv_16_conv;
25434                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
25435                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
25436                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
25437                 _res_constr.data[q] = _res_conv_16_conv;
25438         }
25439         FREE(_res);
25440         CVec_ChannelMonitorZ_free(_res_constr);
25441 }
25442
25443 int64_t  CS_LDK_C2Tuple_ThirtyTwoBytesChannelManagerZ_new(int8_tArray a, int64_t b) {
25444         LDKThirtyTwoBytes a_ref;
25445         CHECK(a->arr_len == 32);
25446         memcpy(a_ref.data, a->elems, 32); FREE(a);
25447         LDKChannelManager b_conv;
25448         b_conv.inner = untag_ptr(b);
25449         b_conv.is_owned = ptr_is_owned(b);
25450         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
25451         // WARNING: we need a move here but no clone is available for LDKChannelManager
25452         
25453         LDKC2Tuple_ThirtyTwoBytesChannelManagerZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelManagerZ), "LDKC2Tuple_ThirtyTwoBytesChannelManagerZ");
25454         *ret_conv = C2Tuple_ThirtyTwoBytesChannelManagerZ_new(a_ref, b_conv);
25455         return tag_ptr(ret_conv, true);
25456 }
25457
25458 void  CS_LDK_C2Tuple_ThirtyTwoBytesChannelManagerZ_free(int64_t _res) {
25459         if (!ptr_is_owned(_res)) return;
25460         void* _res_ptr = untag_ptr(_res);
25461         CHECK_ACCESS(_res_ptr);
25462         LDKC2Tuple_ThirtyTwoBytesChannelManagerZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelManagerZ*)(_res_ptr);
25463         FREE(untag_ptr(_res));
25464         C2Tuple_ThirtyTwoBytesChannelManagerZ_free(_res_conv);
25465 }
25466
25467 int64_t  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_ok(int64_t o) {
25468         void* o_ptr = untag_ptr(o);
25469         CHECK_ACCESS(o_ptr);
25470         LDKC2Tuple_ThirtyTwoBytesChannelManagerZ o_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelManagerZ*)(o_ptr);
25471         // WARNING: we may need a move here but no clone is available for LDKC2Tuple_ThirtyTwoBytesChannelManagerZ
25472         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ");
25473         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_ok(o_conv);
25474         return tag_ptr(ret_conv, true);
25475 }
25476
25477 int64_t  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_err(int64_t e) {
25478         void* e_ptr = untag_ptr(e);
25479         CHECK_ACCESS(e_ptr);
25480         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25481         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25482         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ");
25483         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_err(e_conv);
25484         return tag_ptr(ret_conv, true);
25485 }
25486
25487 jboolean  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_is_ok(int64_t o) {
25488         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ*)untag_ptr(o);
25489         jboolean ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_is_ok(o_conv);
25490         return ret_conv;
25491 }
25492
25493 void  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_free(int64_t _res) {
25494         if (!ptr_is_owned(_res)) return;
25495         void* _res_ptr = untag_ptr(_res);
25496         CHECK_ACCESS(_res_ptr);
25497         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ*)(_res_ptr);
25498         FREE(untag_ptr(_res));
25499         CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_free(_res_conv);
25500 }
25501
25502 int64_t  CS_LDK_CResult_MaxDustHTLCExposureDecodeErrorZ_ok(int64_t o) {
25503         void* o_ptr = untag_ptr(o);
25504         CHECK_ACCESS(o_ptr);
25505         LDKMaxDustHTLCExposure o_conv = *(LDKMaxDustHTLCExposure*)(o_ptr);
25506         o_conv = MaxDustHTLCExposure_clone((LDKMaxDustHTLCExposure*)untag_ptr(o));
25507         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
25508         *ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_ok(o_conv);
25509         return tag_ptr(ret_conv, true);
25510 }
25511
25512 int64_t  CS_LDK_CResult_MaxDustHTLCExposureDecodeErrorZ_err(int64_t e) {
25513         void* e_ptr = untag_ptr(e);
25514         CHECK_ACCESS(e_ptr);
25515         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25516         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25517         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
25518         *ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_err(e_conv);
25519         return tag_ptr(ret_conv, true);
25520 }
25521
25522 jboolean  CS_LDK_CResult_MaxDustHTLCExposureDecodeErrorZ_is_ok(int64_t o) {
25523         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* o_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(o);
25524         jboolean ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_is_ok(o_conv);
25525         return ret_conv;
25526 }
25527
25528 void  CS_LDK_CResult_MaxDustHTLCExposureDecodeErrorZ_free(int64_t _res) {
25529         if (!ptr_is_owned(_res)) return;
25530         void* _res_ptr = untag_ptr(_res);
25531         CHECK_ACCESS(_res_ptr);
25532         LDKCResult_MaxDustHTLCExposureDecodeErrorZ _res_conv = *(LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)(_res_ptr);
25533         FREE(untag_ptr(_res));
25534         CResult_MaxDustHTLCExposureDecodeErrorZ_free(_res_conv);
25535 }
25536
25537 static inline uint64_t CResult_MaxDustHTLCExposureDecodeErrorZ_clone_ptr(LDKCResult_MaxDustHTLCExposureDecodeErrorZ *NONNULL_PTR arg) {
25538         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
25539         *ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_clone(arg);
25540         return tag_ptr(ret_conv, true);
25541 }
25542 int64_t  CS_LDK_CResult_MaxDustHTLCExposureDecodeErrorZ_clone_ptr(int64_t arg) {
25543         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* arg_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(arg);
25544         int64_t ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_clone_ptr(arg_conv);
25545         return ret_conv;
25546 }
25547
25548 int64_t  CS_LDK_CResult_MaxDustHTLCExposureDecodeErrorZ_clone(int64_t orig) {
25549         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* orig_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(orig);
25550         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
25551         *ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_clone(orig_conv);
25552         return tag_ptr(ret_conv, true);
25553 }
25554
25555 int64_t  CS_LDK_CResult_ChannelConfigDecodeErrorZ_ok(int64_t o) {
25556         LDKChannelConfig o_conv;
25557         o_conv.inner = untag_ptr(o);
25558         o_conv.is_owned = ptr_is_owned(o);
25559         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25560         o_conv = ChannelConfig_clone(&o_conv);
25561         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
25562         *ret_conv = CResult_ChannelConfigDecodeErrorZ_ok(o_conv);
25563         return tag_ptr(ret_conv, true);
25564 }
25565
25566 int64_t  CS_LDK_CResult_ChannelConfigDecodeErrorZ_err(int64_t e) {
25567         void* e_ptr = untag_ptr(e);
25568         CHECK_ACCESS(e_ptr);
25569         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25570         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25571         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
25572         *ret_conv = CResult_ChannelConfigDecodeErrorZ_err(e_conv);
25573         return tag_ptr(ret_conv, true);
25574 }
25575
25576 jboolean  CS_LDK_CResult_ChannelConfigDecodeErrorZ_is_ok(int64_t o) {
25577         LDKCResult_ChannelConfigDecodeErrorZ* o_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(o);
25578         jboolean ret_conv = CResult_ChannelConfigDecodeErrorZ_is_ok(o_conv);
25579         return ret_conv;
25580 }
25581
25582 void  CS_LDK_CResult_ChannelConfigDecodeErrorZ_free(int64_t _res) {
25583         if (!ptr_is_owned(_res)) return;
25584         void* _res_ptr = untag_ptr(_res);
25585         CHECK_ACCESS(_res_ptr);
25586         LDKCResult_ChannelConfigDecodeErrorZ _res_conv = *(LDKCResult_ChannelConfigDecodeErrorZ*)(_res_ptr);
25587         FREE(untag_ptr(_res));
25588         CResult_ChannelConfigDecodeErrorZ_free(_res_conv);
25589 }
25590
25591 static inline uint64_t CResult_ChannelConfigDecodeErrorZ_clone_ptr(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR arg) {
25592         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
25593         *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(arg);
25594         return tag_ptr(ret_conv, true);
25595 }
25596 int64_t  CS_LDK_CResult_ChannelConfigDecodeErrorZ_clone_ptr(int64_t arg) {
25597         LDKCResult_ChannelConfigDecodeErrorZ* arg_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(arg);
25598         int64_t ret_conv = CResult_ChannelConfigDecodeErrorZ_clone_ptr(arg_conv);
25599         return ret_conv;
25600 }
25601
25602 int64_t  CS_LDK_CResult_ChannelConfigDecodeErrorZ_clone(int64_t orig) {
25603         LDKCResult_ChannelConfigDecodeErrorZ* orig_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(orig);
25604         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
25605         *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(orig_conv);
25606         return tag_ptr(ret_conv, true);
25607 }
25608
25609 int64_t  CS_LDK_COption_MaxDustHTLCExposureZ_some(int64_t o) {
25610         void* o_ptr = untag_ptr(o);
25611         CHECK_ACCESS(o_ptr);
25612         LDKMaxDustHTLCExposure o_conv = *(LDKMaxDustHTLCExposure*)(o_ptr);
25613         o_conv = MaxDustHTLCExposure_clone((LDKMaxDustHTLCExposure*)untag_ptr(o));
25614         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
25615         *ret_copy = COption_MaxDustHTLCExposureZ_some(o_conv);
25616         int64_t ret_ref = tag_ptr(ret_copy, true);
25617         return ret_ref;
25618 }
25619
25620 int64_t  CS_LDK_COption_MaxDustHTLCExposureZ_none() {
25621         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
25622         *ret_copy = COption_MaxDustHTLCExposureZ_none();
25623         int64_t ret_ref = tag_ptr(ret_copy, true);
25624         return ret_ref;
25625 }
25626
25627 void  CS_LDK_COption_MaxDustHTLCExposureZ_free(int64_t _res) {
25628         if (!ptr_is_owned(_res)) return;
25629         void* _res_ptr = untag_ptr(_res);
25630         CHECK_ACCESS(_res_ptr);
25631         LDKCOption_MaxDustHTLCExposureZ _res_conv = *(LDKCOption_MaxDustHTLCExposureZ*)(_res_ptr);
25632         FREE(untag_ptr(_res));
25633         COption_MaxDustHTLCExposureZ_free(_res_conv);
25634 }
25635
25636 static inline uint64_t COption_MaxDustHTLCExposureZ_clone_ptr(LDKCOption_MaxDustHTLCExposureZ *NONNULL_PTR arg) {
25637         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
25638         *ret_copy = COption_MaxDustHTLCExposureZ_clone(arg);
25639         int64_t ret_ref = tag_ptr(ret_copy, true);
25640         return ret_ref;
25641 }
25642 int64_t  CS_LDK_COption_MaxDustHTLCExposureZ_clone_ptr(int64_t arg) {
25643         LDKCOption_MaxDustHTLCExposureZ* arg_conv = (LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(arg);
25644         int64_t ret_conv = COption_MaxDustHTLCExposureZ_clone_ptr(arg_conv);
25645         return ret_conv;
25646 }
25647
25648 int64_t  CS_LDK_COption_MaxDustHTLCExposureZ_clone(int64_t orig) {
25649         LDKCOption_MaxDustHTLCExposureZ* orig_conv = (LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(orig);
25650         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
25651         *ret_copy = COption_MaxDustHTLCExposureZ_clone(orig_conv);
25652         int64_t ret_ref = tag_ptr(ret_copy, true);
25653         return ret_ref;
25654 }
25655
25656 int64_t  CS_LDK_COption_APIErrorZ_some(int64_t o) {
25657         void* o_ptr = untag_ptr(o);
25658         CHECK_ACCESS(o_ptr);
25659         LDKAPIError o_conv = *(LDKAPIError*)(o_ptr);
25660         o_conv = APIError_clone((LDKAPIError*)untag_ptr(o));
25661         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
25662         *ret_copy = COption_APIErrorZ_some(o_conv);
25663         int64_t ret_ref = tag_ptr(ret_copy, true);
25664         return ret_ref;
25665 }
25666
25667 int64_t  CS_LDK_COption_APIErrorZ_none() {
25668         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
25669         *ret_copy = COption_APIErrorZ_none();
25670         int64_t ret_ref = tag_ptr(ret_copy, true);
25671         return ret_ref;
25672 }
25673
25674 void  CS_LDK_COption_APIErrorZ_free(int64_t _res) {
25675         if (!ptr_is_owned(_res)) return;
25676         void* _res_ptr = untag_ptr(_res);
25677         CHECK_ACCESS(_res_ptr);
25678         LDKCOption_APIErrorZ _res_conv = *(LDKCOption_APIErrorZ*)(_res_ptr);
25679         FREE(untag_ptr(_res));
25680         COption_APIErrorZ_free(_res_conv);
25681 }
25682
25683 static inline uint64_t COption_APIErrorZ_clone_ptr(LDKCOption_APIErrorZ *NONNULL_PTR arg) {
25684         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
25685         *ret_copy = COption_APIErrorZ_clone(arg);
25686         int64_t ret_ref = tag_ptr(ret_copy, true);
25687         return ret_ref;
25688 }
25689 int64_t  CS_LDK_COption_APIErrorZ_clone_ptr(int64_t arg) {
25690         LDKCOption_APIErrorZ* arg_conv = (LDKCOption_APIErrorZ*)untag_ptr(arg);
25691         int64_t ret_conv = COption_APIErrorZ_clone_ptr(arg_conv);
25692         return ret_conv;
25693 }
25694
25695 int64_t  CS_LDK_COption_APIErrorZ_clone(int64_t orig) {
25696         LDKCOption_APIErrorZ* orig_conv = (LDKCOption_APIErrorZ*)untag_ptr(orig);
25697         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
25698         *ret_copy = COption_APIErrorZ_clone(orig_conv);
25699         int64_t ret_ref = tag_ptr(ret_copy, true);
25700         return ret_ref;
25701 }
25702
25703 int64_t  CS_LDK_CResult_COption_APIErrorZDecodeErrorZ_ok(int64_t o) {
25704         void* o_ptr = untag_ptr(o);
25705         CHECK_ACCESS(o_ptr);
25706         LDKCOption_APIErrorZ o_conv = *(LDKCOption_APIErrorZ*)(o_ptr);
25707         o_conv = COption_APIErrorZ_clone((LDKCOption_APIErrorZ*)untag_ptr(o));
25708         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
25709         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_ok(o_conv);
25710         return tag_ptr(ret_conv, true);
25711 }
25712
25713 int64_t  CS_LDK_CResult_COption_APIErrorZDecodeErrorZ_err(int64_t e) {
25714         void* e_ptr = untag_ptr(e);
25715         CHECK_ACCESS(e_ptr);
25716         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25717         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25718         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
25719         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_err(e_conv);
25720         return tag_ptr(ret_conv, true);
25721 }
25722
25723 jboolean  CS_LDK_CResult_COption_APIErrorZDecodeErrorZ_is_ok(int64_t o) {
25724         LDKCResult_COption_APIErrorZDecodeErrorZ* o_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(o);
25725         jboolean ret_conv = CResult_COption_APIErrorZDecodeErrorZ_is_ok(o_conv);
25726         return ret_conv;
25727 }
25728
25729 void  CS_LDK_CResult_COption_APIErrorZDecodeErrorZ_free(int64_t _res) {
25730         if (!ptr_is_owned(_res)) return;
25731         void* _res_ptr = untag_ptr(_res);
25732         CHECK_ACCESS(_res_ptr);
25733         LDKCResult_COption_APIErrorZDecodeErrorZ _res_conv = *(LDKCResult_COption_APIErrorZDecodeErrorZ*)(_res_ptr);
25734         FREE(untag_ptr(_res));
25735         CResult_COption_APIErrorZDecodeErrorZ_free(_res_conv);
25736 }
25737
25738 static inline uint64_t CResult_COption_APIErrorZDecodeErrorZ_clone_ptr(LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR arg) {
25739         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
25740         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_clone(arg);
25741         return tag_ptr(ret_conv, true);
25742 }
25743 int64_t  CS_LDK_CResult_COption_APIErrorZDecodeErrorZ_clone_ptr(int64_t arg) {
25744         LDKCResult_COption_APIErrorZDecodeErrorZ* arg_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(arg);
25745         int64_t ret_conv = CResult_COption_APIErrorZDecodeErrorZ_clone_ptr(arg_conv);
25746         return ret_conv;
25747 }
25748
25749 int64_t  CS_LDK_CResult_COption_APIErrorZDecodeErrorZ_clone(int64_t orig) {
25750         LDKCResult_COption_APIErrorZDecodeErrorZ* orig_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(orig);
25751         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
25752         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_clone(orig_conv);
25753         return tag_ptr(ret_conv, true);
25754 }
25755
25756 int64_t  CS_LDK_CResult_ChannelMonitorUpdateDecodeErrorZ_ok(int64_t o) {
25757         LDKChannelMonitorUpdate o_conv;
25758         o_conv.inner = untag_ptr(o);
25759         o_conv.is_owned = ptr_is_owned(o);
25760         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25761         o_conv = ChannelMonitorUpdate_clone(&o_conv);
25762         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
25763         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv);
25764         return tag_ptr(ret_conv, true);
25765 }
25766
25767 int64_t  CS_LDK_CResult_ChannelMonitorUpdateDecodeErrorZ_err(int64_t e) {
25768         void* e_ptr = untag_ptr(e);
25769         CHECK_ACCESS(e_ptr);
25770         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25771         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25772         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
25773         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv);
25774         return tag_ptr(ret_conv, true);
25775 }
25776
25777 jboolean  CS_LDK_CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(int64_t o) {
25778         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(o);
25779         jboolean ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o_conv);
25780         return ret_conv;
25781 }
25782
25783 void  CS_LDK_CResult_ChannelMonitorUpdateDecodeErrorZ_free(int64_t _res) {
25784         if (!ptr_is_owned(_res)) return;
25785         void* _res_ptr = untag_ptr(_res);
25786         CHECK_ACCESS(_res_ptr);
25787         LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(_res_ptr);
25788         FREE(untag_ptr(_res));
25789         CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv);
25790 }
25791
25792 static inline uint64_t CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR arg) {
25793         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
25794         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(arg);
25795         return tag_ptr(ret_conv, true);
25796 }
25797 int64_t  CS_LDK_CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(int64_t arg) {
25798         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(arg);
25799         int64_t ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(arg_conv);
25800         return ret_conv;
25801 }
25802
25803 int64_t  CS_LDK_CResult_ChannelMonitorUpdateDecodeErrorZ_clone(int64_t orig) {
25804         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(orig);
25805         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
25806         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig_conv);
25807         return tag_ptr(ret_conv, true);
25808 }
25809
25810 int64_t  CS_LDK_COption_MonitorEventZ_some(int64_t o) {
25811         void* o_ptr = untag_ptr(o);
25812         CHECK_ACCESS(o_ptr);
25813         LDKMonitorEvent o_conv = *(LDKMonitorEvent*)(o_ptr);
25814         o_conv = MonitorEvent_clone((LDKMonitorEvent*)untag_ptr(o));
25815         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
25816         *ret_copy = COption_MonitorEventZ_some(o_conv);
25817         int64_t ret_ref = tag_ptr(ret_copy, true);
25818         return ret_ref;
25819 }
25820
25821 int64_t  CS_LDK_COption_MonitorEventZ_none() {
25822         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
25823         *ret_copy = COption_MonitorEventZ_none();
25824         int64_t ret_ref = tag_ptr(ret_copy, true);
25825         return ret_ref;
25826 }
25827
25828 void  CS_LDK_COption_MonitorEventZ_free(int64_t _res) {
25829         if (!ptr_is_owned(_res)) return;
25830         void* _res_ptr = untag_ptr(_res);
25831         CHECK_ACCESS(_res_ptr);
25832         LDKCOption_MonitorEventZ _res_conv = *(LDKCOption_MonitorEventZ*)(_res_ptr);
25833         FREE(untag_ptr(_res));
25834         COption_MonitorEventZ_free(_res_conv);
25835 }
25836
25837 static inline uint64_t COption_MonitorEventZ_clone_ptr(LDKCOption_MonitorEventZ *NONNULL_PTR arg) {
25838         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
25839         *ret_copy = COption_MonitorEventZ_clone(arg);
25840         int64_t ret_ref = tag_ptr(ret_copy, true);
25841         return ret_ref;
25842 }
25843 int64_t  CS_LDK_COption_MonitorEventZ_clone_ptr(int64_t arg) {
25844         LDKCOption_MonitorEventZ* arg_conv = (LDKCOption_MonitorEventZ*)untag_ptr(arg);
25845         int64_t ret_conv = COption_MonitorEventZ_clone_ptr(arg_conv);
25846         return ret_conv;
25847 }
25848
25849 int64_t  CS_LDK_COption_MonitorEventZ_clone(int64_t orig) {
25850         LDKCOption_MonitorEventZ* orig_conv = (LDKCOption_MonitorEventZ*)untag_ptr(orig);
25851         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
25852         *ret_copy = COption_MonitorEventZ_clone(orig_conv);
25853         int64_t ret_ref = tag_ptr(ret_copy, true);
25854         return ret_ref;
25855 }
25856
25857 int64_t  CS_LDK_CResult_COption_MonitorEventZDecodeErrorZ_ok(int64_t o) {
25858         void* o_ptr = untag_ptr(o);
25859         CHECK_ACCESS(o_ptr);
25860         LDKCOption_MonitorEventZ o_conv = *(LDKCOption_MonitorEventZ*)(o_ptr);
25861         o_conv = COption_MonitorEventZ_clone((LDKCOption_MonitorEventZ*)untag_ptr(o));
25862         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
25863         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_ok(o_conv);
25864         return tag_ptr(ret_conv, true);
25865 }
25866
25867 int64_t  CS_LDK_CResult_COption_MonitorEventZDecodeErrorZ_err(int64_t e) {
25868         void* e_ptr = untag_ptr(e);
25869         CHECK_ACCESS(e_ptr);
25870         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25871         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25872         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
25873         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_err(e_conv);
25874         return tag_ptr(ret_conv, true);
25875 }
25876
25877 jboolean  CS_LDK_CResult_COption_MonitorEventZDecodeErrorZ_is_ok(int64_t o) {
25878         LDKCResult_COption_MonitorEventZDecodeErrorZ* o_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(o);
25879         jboolean ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o_conv);
25880         return ret_conv;
25881 }
25882
25883 void  CS_LDK_CResult_COption_MonitorEventZDecodeErrorZ_free(int64_t _res) {
25884         if (!ptr_is_owned(_res)) return;
25885         void* _res_ptr = untag_ptr(_res);
25886         CHECK_ACCESS(_res_ptr);
25887         LDKCResult_COption_MonitorEventZDecodeErrorZ _res_conv = *(LDKCResult_COption_MonitorEventZDecodeErrorZ*)(_res_ptr);
25888         FREE(untag_ptr(_res));
25889         CResult_COption_MonitorEventZDecodeErrorZ_free(_res_conv);
25890 }
25891
25892 static inline uint64_t CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR arg) {
25893         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
25894         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(arg);
25895         return tag_ptr(ret_conv, true);
25896 }
25897 int64_t  CS_LDK_CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(int64_t arg) {
25898         LDKCResult_COption_MonitorEventZDecodeErrorZ* arg_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(arg);
25899         int64_t ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(arg_conv);
25900         return ret_conv;
25901 }
25902
25903 int64_t  CS_LDK_CResult_COption_MonitorEventZDecodeErrorZ_clone(int64_t orig) {
25904         LDKCResult_COption_MonitorEventZDecodeErrorZ* orig_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(orig);
25905         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
25906         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(orig_conv);
25907         return tag_ptr(ret_conv, true);
25908 }
25909
25910 int64_t  CS_LDK_CResult_HTLCUpdateDecodeErrorZ_ok(int64_t o) {
25911         LDKHTLCUpdate o_conv;
25912         o_conv.inner = untag_ptr(o);
25913         o_conv.is_owned = ptr_is_owned(o);
25914         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25915         o_conv = HTLCUpdate_clone(&o_conv);
25916         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
25917         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_ok(o_conv);
25918         return tag_ptr(ret_conv, true);
25919 }
25920
25921 int64_t  CS_LDK_CResult_HTLCUpdateDecodeErrorZ_err(int64_t e) {
25922         void* e_ptr = untag_ptr(e);
25923         CHECK_ACCESS(e_ptr);
25924         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25925         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25926         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
25927         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_err(e_conv);
25928         return tag_ptr(ret_conv, true);
25929 }
25930
25931 jboolean  CS_LDK_CResult_HTLCUpdateDecodeErrorZ_is_ok(int64_t o) {
25932         LDKCResult_HTLCUpdateDecodeErrorZ* o_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(o);
25933         jboolean ret_conv = CResult_HTLCUpdateDecodeErrorZ_is_ok(o_conv);
25934         return ret_conv;
25935 }
25936
25937 void  CS_LDK_CResult_HTLCUpdateDecodeErrorZ_free(int64_t _res) {
25938         if (!ptr_is_owned(_res)) return;
25939         void* _res_ptr = untag_ptr(_res);
25940         CHECK_ACCESS(_res_ptr);
25941         LDKCResult_HTLCUpdateDecodeErrorZ _res_conv = *(LDKCResult_HTLCUpdateDecodeErrorZ*)(_res_ptr);
25942         FREE(untag_ptr(_res));
25943         CResult_HTLCUpdateDecodeErrorZ_free(_res_conv);
25944 }
25945
25946 static inline uint64_t CResult_HTLCUpdateDecodeErrorZ_clone_ptr(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR arg) {
25947         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
25948         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(arg);
25949         return tag_ptr(ret_conv, true);
25950 }
25951 int64_t  CS_LDK_CResult_HTLCUpdateDecodeErrorZ_clone_ptr(int64_t arg) {
25952         LDKCResult_HTLCUpdateDecodeErrorZ* arg_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(arg);
25953         int64_t ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone_ptr(arg_conv);
25954         return ret_conv;
25955 }
25956
25957 int64_t  CS_LDK_CResult_HTLCUpdateDecodeErrorZ_clone(int64_t orig) {
25958         LDKCResult_HTLCUpdateDecodeErrorZ* orig_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(orig);
25959         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
25960         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(orig_conv);
25961         return tag_ptr(ret_conv, true);
25962 }
25963
25964 static inline uint64_t C2Tuple_OutPointCVec_u8ZZ_clone_ptr(LDKC2Tuple_OutPointCVec_u8ZZ *NONNULL_PTR arg) {
25965         LDKC2Tuple_OutPointCVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_u8ZZ), "LDKC2Tuple_OutPointCVec_u8ZZ");
25966         *ret_conv = C2Tuple_OutPointCVec_u8ZZ_clone(arg);
25967         return tag_ptr(ret_conv, true);
25968 }
25969 int64_t  CS_LDK_C2Tuple_OutPointCVec_u8ZZ_clone_ptr(int64_t arg) {
25970         LDKC2Tuple_OutPointCVec_u8ZZ* arg_conv = (LDKC2Tuple_OutPointCVec_u8ZZ*)untag_ptr(arg);
25971         int64_t ret_conv = C2Tuple_OutPointCVec_u8ZZ_clone_ptr(arg_conv);
25972         return ret_conv;
25973 }
25974
25975 int64_t  CS_LDK_C2Tuple_OutPointCVec_u8ZZ_clone(int64_t orig) {
25976         LDKC2Tuple_OutPointCVec_u8ZZ* orig_conv = (LDKC2Tuple_OutPointCVec_u8ZZ*)untag_ptr(orig);
25977         LDKC2Tuple_OutPointCVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_u8ZZ), "LDKC2Tuple_OutPointCVec_u8ZZ");
25978         *ret_conv = C2Tuple_OutPointCVec_u8ZZ_clone(orig_conv);
25979         return tag_ptr(ret_conv, true);
25980 }
25981
25982 int64_t  CS_LDK_C2Tuple_OutPointCVec_u8ZZ_new(int64_t a, int8_tArray b) {
25983         LDKOutPoint a_conv;
25984         a_conv.inner = untag_ptr(a);
25985         a_conv.is_owned = ptr_is_owned(a);
25986         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
25987         a_conv = OutPoint_clone(&a_conv);
25988         LDKCVec_u8Z b_ref;
25989         b_ref.datalen = b->arr_len;
25990         b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
25991         memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
25992         LDKC2Tuple_OutPointCVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_u8ZZ), "LDKC2Tuple_OutPointCVec_u8ZZ");
25993         *ret_conv = C2Tuple_OutPointCVec_u8ZZ_new(a_conv, b_ref);
25994         return tag_ptr(ret_conv, true);
25995 }
25996
25997 void  CS_LDK_C2Tuple_OutPointCVec_u8ZZ_free(int64_t _res) {
25998         if (!ptr_is_owned(_res)) return;
25999         void* _res_ptr = untag_ptr(_res);
26000         CHECK_ACCESS(_res_ptr);
26001         LDKC2Tuple_OutPointCVec_u8ZZ _res_conv = *(LDKC2Tuple_OutPointCVec_u8ZZ*)(_res_ptr);
26002         FREE(untag_ptr(_res));
26003         C2Tuple_OutPointCVec_u8ZZ_free(_res_conv);
26004 }
26005
26006 static inline uint64_t C2Tuple_u32CVec_u8ZZ_clone_ptr(LDKC2Tuple_u32CVec_u8ZZ *NONNULL_PTR arg) {
26007         LDKC2Tuple_u32CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKC2Tuple_u32CVec_u8ZZ");
26008         *ret_conv = C2Tuple_u32CVec_u8ZZ_clone(arg);
26009         return tag_ptr(ret_conv, true);
26010 }
26011 int64_t  CS_LDK_C2Tuple_u32CVec_u8ZZ_clone_ptr(int64_t arg) {
26012         LDKC2Tuple_u32CVec_u8ZZ* arg_conv = (LDKC2Tuple_u32CVec_u8ZZ*)untag_ptr(arg);
26013         int64_t ret_conv = C2Tuple_u32CVec_u8ZZ_clone_ptr(arg_conv);
26014         return ret_conv;
26015 }
26016
26017 int64_t  CS_LDK_C2Tuple_u32CVec_u8ZZ_clone(int64_t orig) {
26018         LDKC2Tuple_u32CVec_u8ZZ* orig_conv = (LDKC2Tuple_u32CVec_u8ZZ*)untag_ptr(orig);
26019         LDKC2Tuple_u32CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKC2Tuple_u32CVec_u8ZZ");
26020         *ret_conv = C2Tuple_u32CVec_u8ZZ_clone(orig_conv);
26021         return tag_ptr(ret_conv, true);
26022 }
26023
26024 int64_t  CS_LDK_C2Tuple_u32CVec_u8ZZ_new(int32_t a, int8_tArray b) {
26025         LDKCVec_u8Z b_ref;
26026         b_ref.datalen = b->arr_len;
26027         b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
26028         memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
26029         LDKC2Tuple_u32CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKC2Tuple_u32CVec_u8ZZ");
26030         *ret_conv = C2Tuple_u32CVec_u8ZZ_new(a, b_ref);
26031         return tag_ptr(ret_conv, true);
26032 }
26033
26034 void  CS_LDK_C2Tuple_u32CVec_u8ZZ_free(int64_t _res) {
26035         if (!ptr_is_owned(_res)) return;
26036         void* _res_ptr = untag_ptr(_res);
26037         CHECK_ACCESS(_res_ptr);
26038         LDKC2Tuple_u32CVec_u8ZZ _res_conv = *(LDKC2Tuple_u32CVec_u8ZZ*)(_res_ptr);
26039         FREE(untag_ptr(_res));
26040         C2Tuple_u32CVec_u8ZZ_free(_res_conv);
26041 }
26042
26043 void  CS_LDK_CVec_C2Tuple_u32CVec_u8ZZZ_free(int64_tArray _res) {
26044         LDKCVec_C2Tuple_u32CVec_u8ZZZ _res_constr;
26045         _res_constr.datalen = _res->arr_len;
26046         if (_res_constr.datalen > 0)
26047                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKCVec_C2Tuple_u32CVec_u8ZZZ Elements");
26048         else
26049                 _res_constr.data = NULL;
26050         int64_t* _res_vals = _res->elems;
26051         for (size_t x = 0; x < _res_constr.datalen; x++) {
26052                 int64_t _res_conv_23 = _res_vals[x];
26053                 void* _res_conv_23_ptr = untag_ptr(_res_conv_23);
26054                 CHECK_ACCESS(_res_conv_23_ptr);
26055                 LDKC2Tuple_u32CVec_u8ZZ _res_conv_23_conv = *(LDKC2Tuple_u32CVec_u8ZZ*)(_res_conv_23_ptr);
26056                 FREE(untag_ptr(_res_conv_23));
26057                 _res_constr.data[x] = _res_conv_23_conv;
26058         }
26059         FREE(_res);
26060         CVec_C2Tuple_u32CVec_u8ZZZ_free(_res_constr);
26061 }
26062
26063 static inline uint64_t C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone_ptr(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ *NONNULL_PTR arg) {
26064         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ");
26065         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone(arg);
26066         return tag_ptr(ret_conv, true);
26067 }
26068 int64_t  CS_LDK_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone_ptr(int64_t arg) {
26069         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* arg_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)untag_ptr(arg);
26070         int64_t ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone_ptr(arg_conv);
26071         return ret_conv;
26072 }
26073
26074 int64_t  CS_LDK_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone(int64_t orig) {
26075         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* orig_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)untag_ptr(orig);
26076         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ");
26077         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone(orig_conv);
26078         return tag_ptr(ret_conv, true);
26079 }
26080
26081 int64_t  CS_LDK_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_new(int8_tArray a, int64_tArray b) {
26082         LDKThirtyTwoBytes a_ref;
26083         CHECK(a->arr_len == 32);
26084         memcpy(a_ref.data, a->elems, 32); FREE(a);
26085         LDKCVec_C2Tuple_u32CVec_u8ZZZ b_constr;
26086         b_constr.datalen = b->arr_len;
26087         if (b_constr.datalen > 0)
26088                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKCVec_C2Tuple_u32CVec_u8ZZZ Elements");
26089         else
26090                 b_constr.data = NULL;
26091         int64_t* b_vals = b->elems;
26092         for (size_t x = 0; x < b_constr.datalen; x++) {
26093                 int64_t b_conv_23 = b_vals[x];
26094                 void* b_conv_23_ptr = untag_ptr(b_conv_23);
26095                 CHECK_ACCESS(b_conv_23_ptr);
26096                 LDKC2Tuple_u32CVec_u8ZZ b_conv_23_conv = *(LDKC2Tuple_u32CVec_u8ZZ*)(b_conv_23_ptr);
26097                 b_conv_23_conv = C2Tuple_u32CVec_u8ZZ_clone((LDKC2Tuple_u32CVec_u8ZZ*)untag_ptr(b_conv_23));
26098                 b_constr.data[x] = b_conv_23_conv;
26099         }
26100         FREE(b);
26101         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ");
26102         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_new(a_ref, b_constr);
26103         return tag_ptr(ret_conv, true);
26104 }
26105
26106 void  CS_LDK_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_free(int64_t _res) {
26107         if (!ptr_is_owned(_res)) return;
26108         void* _res_ptr = untag_ptr(_res);
26109         CHECK_ACCESS(_res_ptr);
26110         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)(_res_ptr);
26111         FREE(untag_ptr(_res));
26112         C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_free(_res_conv);
26113 }
26114
26115 void  CS_LDK_CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ_free(int64_tArray _res) {
26116         LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ _res_constr;
26117         _res_constr.datalen = _res->arr_len;
26118         if (_res_constr.datalen > 0)
26119                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ), "LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ Elements");
26120         else
26121                 _res_constr.data = NULL;
26122         int64_t* _res_vals = _res->elems;
26123         for (size_t a = 0; a < _res_constr.datalen; a++) {
26124                 int64_t _res_conv_52 = _res_vals[a];
26125                 void* _res_conv_52_ptr = untag_ptr(_res_conv_52);
26126                 CHECK_ACCESS(_res_conv_52_ptr);
26127                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ _res_conv_52_conv = *(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)(_res_conv_52_ptr);
26128                 FREE(untag_ptr(_res_conv_52));
26129                 _res_constr.data[a] = _res_conv_52_conv;
26130         }
26131         FREE(_res);
26132         CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ_free(_res_constr);
26133 }
26134
26135 void  CS_LDK_CVec_CommitmentTransactionZ_free(int64_tArray _res) {
26136         LDKCVec_CommitmentTransactionZ _res_constr;
26137         _res_constr.datalen = _res->arr_len;
26138         if (_res_constr.datalen > 0)
26139                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCommitmentTransaction), "LDKCVec_CommitmentTransactionZ Elements");
26140         else
26141                 _res_constr.data = NULL;
26142         int64_t* _res_vals = _res->elems;
26143         for (size_t x = 0; x < _res_constr.datalen; x++) {
26144                 int64_t _res_conv_23 = _res_vals[x];
26145                 LDKCommitmentTransaction _res_conv_23_conv;
26146                 _res_conv_23_conv.inner = untag_ptr(_res_conv_23);
26147                 _res_conv_23_conv.is_owned = ptr_is_owned(_res_conv_23);
26148                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_23_conv);
26149                 _res_constr.data[x] = _res_conv_23_conv;
26150         }
26151         FREE(_res);
26152         CVec_CommitmentTransactionZ_free(_res_constr);
26153 }
26154
26155 static inline uint64_t C2Tuple_u32TxOutZ_clone_ptr(LDKC2Tuple_u32TxOutZ *NONNULL_PTR arg) {
26156         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
26157         *ret_conv = C2Tuple_u32TxOutZ_clone(arg);
26158         return tag_ptr(ret_conv, true);
26159 }
26160 int64_t  CS_LDK_C2Tuple_u32TxOutZ_clone_ptr(int64_t arg) {
26161         LDKC2Tuple_u32TxOutZ* arg_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(arg);
26162         int64_t ret_conv = C2Tuple_u32TxOutZ_clone_ptr(arg_conv);
26163         return ret_conv;
26164 }
26165
26166 int64_t  CS_LDK_C2Tuple_u32TxOutZ_clone(int64_t orig) {
26167         LDKC2Tuple_u32TxOutZ* orig_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(orig);
26168         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
26169         *ret_conv = C2Tuple_u32TxOutZ_clone(orig_conv);
26170         return tag_ptr(ret_conv, true);
26171 }
26172
26173 int64_t  CS_LDK_C2Tuple_u32TxOutZ_new(int32_t a, int64_t b) {
26174         void* b_ptr = untag_ptr(b);
26175         CHECK_ACCESS(b_ptr);
26176         LDKTxOut b_conv = *(LDKTxOut*)(b_ptr);
26177         b_conv = TxOut_clone((LDKTxOut*)untag_ptr(b));
26178         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
26179         *ret_conv = C2Tuple_u32TxOutZ_new(a, b_conv);
26180         return tag_ptr(ret_conv, true);
26181 }
26182
26183 void  CS_LDK_C2Tuple_u32TxOutZ_free(int64_t _res) {
26184         if (!ptr_is_owned(_res)) return;
26185         void* _res_ptr = untag_ptr(_res);
26186         CHECK_ACCESS(_res_ptr);
26187         LDKC2Tuple_u32TxOutZ _res_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_ptr);
26188         FREE(untag_ptr(_res));
26189         C2Tuple_u32TxOutZ_free(_res_conv);
26190 }
26191
26192 void  CS_LDK_CVec_C2Tuple_u32TxOutZZ_free(int64_tArray _res) {
26193         LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
26194         _res_constr.datalen = _res->arr_len;
26195         if (_res_constr.datalen > 0)
26196                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
26197         else
26198                 _res_constr.data = NULL;
26199         int64_t* _res_vals = _res->elems;
26200         for (size_t u = 0; u < _res_constr.datalen; u++) {
26201                 int64_t _res_conv_20 = _res_vals[u];
26202                 void* _res_conv_20_ptr = untag_ptr(_res_conv_20);
26203                 CHECK_ACCESS(_res_conv_20_ptr);
26204                 LDKC2Tuple_u32TxOutZ _res_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_conv_20_ptr);
26205                 FREE(untag_ptr(_res_conv_20));
26206                 _res_constr.data[u] = _res_conv_20_conv;
26207         }
26208         FREE(_res);
26209         CVec_C2Tuple_u32TxOutZZ_free(_res_constr);
26210 }
26211
26212 static inline uint64_t C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone_ptr(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR arg) {
26213         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
26214         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone(arg);
26215         return tag_ptr(ret_conv, true);
26216 }
26217 int64_t  CS_LDK_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone_ptr(int64_t arg) {
26218         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* arg_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(arg);
26219         int64_t ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone_ptr(arg_conv);
26220         return ret_conv;
26221 }
26222
26223 int64_t  CS_LDK_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone(int64_t orig) {
26224         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* orig_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(orig);
26225         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
26226         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone(orig_conv);
26227         return tag_ptr(ret_conv, true);
26228 }
26229
26230 int64_t  CS_LDK_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_new(int8_tArray a, int64_tArray b) {
26231         LDKThirtyTwoBytes a_ref;
26232         CHECK(a->arr_len == 32);
26233         memcpy(a_ref.data, a->elems, 32); FREE(a);
26234         LDKCVec_C2Tuple_u32TxOutZZ b_constr;
26235         b_constr.datalen = b->arr_len;
26236         if (b_constr.datalen > 0)
26237                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
26238         else
26239                 b_constr.data = NULL;
26240         int64_t* b_vals = b->elems;
26241         for (size_t u = 0; u < b_constr.datalen; u++) {
26242                 int64_t b_conv_20 = b_vals[u];
26243                 void* b_conv_20_ptr = untag_ptr(b_conv_20);
26244                 CHECK_ACCESS(b_conv_20_ptr);
26245                 LDKC2Tuple_u32TxOutZ b_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(b_conv_20_ptr);
26246                 b_conv_20_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)untag_ptr(b_conv_20));
26247                 b_constr.data[u] = b_conv_20_conv;
26248         }
26249         FREE(b);
26250         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
26251         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr);
26252         return tag_ptr(ret_conv, true);
26253 }
26254
26255 void  CS_LDK_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_free(int64_t _res) {
26256         if (!ptr_is_owned(_res)) return;
26257         void* _res_ptr = untag_ptr(_res);
26258         CHECK_ACCESS(_res_ptr);
26259         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)(_res_ptr);
26260         FREE(untag_ptr(_res));
26261         C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_free(_res_conv);
26262 }
26263
26264 void  CS_LDK_CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ_free(int64_tArray _res) {
26265         LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ _res_constr;
26266         _res_constr.datalen = _res->arr_len;
26267         if (_res_constr.datalen > 0)
26268                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ Elements");
26269         else
26270                 _res_constr.data = NULL;
26271         int64_t* _res_vals = _res->elems;
26272         for (size_t x = 0; x < _res_constr.datalen; x++) {
26273                 int64_t _res_conv_49 = _res_vals[x];
26274                 void* _res_conv_49_ptr = untag_ptr(_res_conv_49);
26275                 CHECK_ACCESS(_res_conv_49_ptr);
26276                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ _res_conv_49_conv = *(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)(_res_conv_49_ptr);
26277                 FREE(untag_ptr(_res_conv_49));
26278                 _res_constr.data[x] = _res_conv_49_conv;
26279         }
26280         FREE(_res);
26281         CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
26282 }
26283
26284 void  CS_LDK_CVec_BalanceZ_free(int64_tArray _res) {
26285         LDKCVec_BalanceZ _res_constr;
26286         _res_constr.datalen = _res->arr_len;
26287         if (_res_constr.datalen > 0)
26288                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBalance), "LDKCVec_BalanceZ Elements");
26289         else
26290                 _res_constr.data = NULL;
26291         int64_t* _res_vals = _res->elems;
26292         for (size_t j = 0; j < _res_constr.datalen; j++) {
26293                 int64_t _res_conv_9 = _res_vals[j];
26294                 void* _res_conv_9_ptr = untag_ptr(_res_conv_9);
26295                 CHECK_ACCESS(_res_conv_9_ptr);
26296                 LDKBalance _res_conv_9_conv = *(LDKBalance*)(_res_conv_9_ptr);
26297                 FREE(untag_ptr(_res_conv_9));
26298                 _res_constr.data[j] = _res_conv_9_conv;
26299         }
26300         FREE(_res);
26301         CVec_BalanceZ_free(_res_constr);
26302 }
26303
26304 static inline uint64_t C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone_ptr(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ *NONNULL_PTR arg) {
26305         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
26306         *ret_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(arg);
26307         return tag_ptr(ret_conv, true);
26308 }
26309 int64_t  CS_LDK_C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone_ptr(int64_t arg) {
26310         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* arg_conv = (LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(arg);
26311         int64_t ret_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone_ptr(arg_conv);
26312         return ret_conv;
26313 }
26314
26315 int64_t  CS_LDK_C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(int64_t orig) {
26316         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* orig_conv = (LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(orig);
26317         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
26318         *ret_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(orig_conv);
26319         return tag_ptr(ret_conv, true);
26320 }
26321
26322 int64_t  CS_LDK_C2Tuple_ThirtyTwoBytesChannelMonitorZ_new(int8_tArray a, int64_t b) {
26323         LDKThirtyTwoBytes a_ref;
26324         CHECK(a->arr_len == 32);
26325         memcpy(a_ref.data, a->elems, 32); FREE(a);
26326         LDKChannelMonitor b_conv;
26327         b_conv.inner = untag_ptr(b);
26328         b_conv.is_owned = ptr_is_owned(b);
26329         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
26330         b_conv = ChannelMonitor_clone(&b_conv);
26331         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
26332         *ret_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_new(a_ref, b_conv);
26333         return tag_ptr(ret_conv, true);
26334 }
26335
26336 void  CS_LDK_C2Tuple_ThirtyTwoBytesChannelMonitorZ_free(int64_t _res) {
26337         if (!ptr_is_owned(_res)) return;
26338         void* _res_ptr = untag_ptr(_res);
26339         CHECK_ACCESS(_res_ptr);
26340         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)(_res_ptr);
26341         FREE(untag_ptr(_res));
26342         C2Tuple_ThirtyTwoBytesChannelMonitorZ_free(_res_conv);
26343 }
26344
26345 int64_t  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_ok(int64_t o) {
26346         void* o_ptr = untag_ptr(o);
26347         CHECK_ACCESS(o_ptr);
26348         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ o_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)(o_ptr);
26349         o_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone((LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(o));
26350         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ");
26351         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_ok(o_conv);
26352         return tag_ptr(ret_conv, true);
26353 }
26354
26355 int64_t  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_err(int64_t e) {
26356         void* e_ptr = untag_ptr(e);
26357         CHECK_ACCESS(e_ptr);
26358         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26359         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26360         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ");
26361         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_err(e_conv);
26362         return tag_ptr(ret_conv, true);
26363 }
26364
26365 jboolean  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_is_ok(int64_t o) {
26366         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)untag_ptr(o);
26367         jboolean ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_is_ok(o_conv);
26368         return ret_conv;
26369 }
26370
26371 void  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_free(int64_t _res) {
26372         if (!ptr_is_owned(_res)) return;
26373         void* _res_ptr = untag_ptr(_res);
26374         CHECK_ACCESS(_res_ptr);
26375         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)(_res_ptr);
26376         FREE(untag_ptr(_res));
26377         CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_free(_res_conv);
26378 }
26379
26380 static inline uint64_t CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone_ptr(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ *NONNULL_PTR arg) {
26381         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ");
26382         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone(arg);
26383         return tag_ptr(ret_conv, true);
26384 }
26385 int64_t  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone_ptr(int64_t arg) {
26386         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* arg_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)untag_ptr(arg);
26387         int64_t ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone_ptr(arg_conv);
26388         return ret_conv;
26389 }
26390
26391 int64_t  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone(int64_t orig) {
26392         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* orig_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)untag_ptr(orig);
26393         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ");
26394         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone(orig_conv);
26395         return tag_ptr(ret_conv, true);
26396 }
26397
26398 static inline uint64_t C2Tuple_PublicKeyTypeZ_clone_ptr(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR arg) {
26399         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
26400         *ret_conv = C2Tuple_PublicKeyTypeZ_clone(arg);
26401         return tag_ptr(ret_conv, true);
26402 }
26403 int64_t  CS_LDK_C2Tuple_PublicKeyTypeZ_clone_ptr(int64_t arg) {
26404         LDKC2Tuple_PublicKeyTypeZ* arg_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(arg);
26405         int64_t ret_conv = C2Tuple_PublicKeyTypeZ_clone_ptr(arg_conv);
26406         return ret_conv;
26407 }
26408
26409 int64_t  CS_LDK_C2Tuple_PublicKeyTypeZ_clone(int64_t orig) {
26410         LDKC2Tuple_PublicKeyTypeZ* orig_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(orig);
26411         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
26412         *ret_conv = C2Tuple_PublicKeyTypeZ_clone(orig_conv);
26413         return tag_ptr(ret_conv, true);
26414 }
26415
26416 int64_t  CS_LDK_C2Tuple_PublicKeyTypeZ_new(int8_tArray a, int64_t b) {
26417         LDKPublicKey a_ref;
26418         CHECK(a->arr_len == 33);
26419         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
26420         void* b_ptr = untag_ptr(b);
26421         CHECK_ACCESS(b_ptr);
26422         LDKType b_conv = *(LDKType*)(b_ptr);
26423         if (b_conv.free == LDKType_JCalls_free) {
26424                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26425                 LDKType_JCalls_cloned(&b_conv);
26426         }
26427         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
26428         *ret_conv = C2Tuple_PublicKeyTypeZ_new(a_ref, b_conv);
26429         return tag_ptr(ret_conv, true);
26430 }
26431
26432 void  CS_LDK_C2Tuple_PublicKeyTypeZ_free(int64_t _res) {
26433         if (!ptr_is_owned(_res)) return;
26434         void* _res_ptr = untag_ptr(_res);
26435         CHECK_ACCESS(_res_ptr);
26436         LDKC2Tuple_PublicKeyTypeZ _res_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_ptr);
26437         FREE(untag_ptr(_res));
26438         C2Tuple_PublicKeyTypeZ_free(_res_conv);
26439 }
26440
26441 void  CS_LDK_CVec_C2Tuple_PublicKeyTypeZZ_free(int64_tArray _res) {
26442         LDKCVec_C2Tuple_PublicKeyTypeZZ _res_constr;
26443         _res_constr.datalen = _res->arr_len;
26444         if (_res_constr.datalen > 0)
26445                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
26446         else
26447                 _res_constr.data = NULL;
26448         int64_t* _res_vals = _res->elems;
26449         for (size_t z = 0; z < _res_constr.datalen; z++) {
26450                 int64_t _res_conv_25 = _res_vals[z];
26451                 void* _res_conv_25_ptr = untag_ptr(_res_conv_25);
26452                 CHECK_ACCESS(_res_conv_25_ptr);
26453                 LDKC2Tuple_PublicKeyTypeZ _res_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_conv_25_ptr);
26454                 FREE(untag_ptr(_res_conv_25));
26455                 _res_constr.data[z] = _res_conv_25_conv;
26456         }
26457         FREE(_res);
26458         CVec_C2Tuple_PublicKeyTypeZZ_free(_res_constr);
26459 }
26460
26461 static inline uint64_t C2Tuple_PublicKeyCVec_SocketAddressZZ_clone_ptr(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ *NONNULL_PTR arg) {
26462         LDKC2Tuple_PublicKeyCVec_SocketAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ), "LDKC2Tuple_PublicKeyCVec_SocketAddressZZ");
26463         *ret_conv = C2Tuple_PublicKeyCVec_SocketAddressZZ_clone(arg);
26464         return tag_ptr(ret_conv, true);
26465 }
26466 int64_t  CS_LDK_C2Tuple_PublicKeyCVec_SocketAddressZZ_clone_ptr(int64_t arg) {
26467         LDKC2Tuple_PublicKeyCVec_SocketAddressZZ* arg_conv = (LDKC2Tuple_PublicKeyCVec_SocketAddressZZ*)untag_ptr(arg);
26468         int64_t ret_conv = C2Tuple_PublicKeyCVec_SocketAddressZZ_clone_ptr(arg_conv);
26469         return ret_conv;
26470 }
26471
26472 int64_t  CS_LDK_C2Tuple_PublicKeyCVec_SocketAddressZZ_clone(int64_t orig) {
26473         LDKC2Tuple_PublicKeyCVec_SocketAddressZZ* orig_conv = (LDKC2Tuple_PublicKeyCVec_SocketAddressZZ*)untag_ptr(orig);
26474         LDKC2Tuple_PublicKeyCVec_SocketAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ), "LDKC2Tuple_PublicKeyCVec_SocketAddressZZ");
26475         *ret_conv = C2Tuple_PublicKeyCVec_SocketAddressZZ_clone(orig_conv);
26476         return tag_ptr(ret_conv, true);
26477 }
26478
26479 int64_t  CS_LDK_C2Tuple_PublicKeyCVec_SocketAddressZZ_new(int8_tArray a, int64_tArray b) {
26480         LDKPublicKey a_ref;
26481         CHECK(a->arr_len == 33);
26482         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
26483         LDKCVec_SocketAddressZ b_constr;
26484         b_constr.datalen = b->arr_len;
26485         if (b_constr.datalen > 0)
26486                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
26487         else
26488                 b_constr.data = NULL;
26489         int64_t* b_vals = b->elems;
26490         for (size_t p = 0; p < b_constr.datalen; p++) {
26491                 int64_t b_conv_15 = b_vals[p];
26492                 void* b_conv_15_ptr = untag_ptr(b_conv_15);
26493                 CHECK_ACCESS(b_conv_15_ptr);
26494                 LDKSocketAddress b_conv_15_conv = *(LDKSocketAddress*)(b_conv_15_ptr);
26495                 b_conv_15_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(b_conv_15));
26496                 b_constr.data[p] = b_conv_15_conv;
26497         }
26498         FREE(b);
26499         LDKC2Tuple_PublicKeyCVec_SocketAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ), "LDKC2Tuple_PublicKeyCVec_SocketAddressZZ");
26500         *ret_conv = C2Tuple_PublicKeyCVec_SocketAddressZZ_new(a_ref, b_constr);
26501         return tag_ptr(ret_conv, true);
26502 }
26503
26504 void  CS_LDK_C2Tuple_PublicKeyCVec_SocketAddressZZ_free(int64_t _res) {
26505         if (!ptr_is_owned(_res)) return;
26506         void* _res_ptr = untag_ptr(_res);
26507         CHECK_ACCESS(_res_ptr);
26508         LDKC2Tuple_PublicKeyCVec_SocketAddressZZ _res_conv = *(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ*)(_res_ptr);
26509         FREE(untag_ptr(_res));
26510         C2Tuple_PublicKeyCVec_SocketAddressZZ_free(_res_conv);
26511 }
26512
26513 void  CS_LDK_CVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ_free(int64_tArray _res) {
26514         LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ _res_constr;
26515         _res_constr.datalen = _res->arr_len;
26516         if (_res_constr.datalen > 0)
26517                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ), "LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ Elements");
26518         else
26519                 _res_constr.data = NULL;
26520         int64_t* _res_vals = _res->elems;
26521         for (size_t o = 0; o < _res_constr.datalen; o++) {
26522                 int64_t _res_conv_40 = _res_vals[o];
26523                 void* _res_conv_40_ptr = untag_ptr(_res_conv_40);
26524                 CHECK_ACCESS(_res_conv_40_ptr);
26525                 LDKC2Tuple_PublicKeyCVec_SocketAddressZZ _res_conv_40_conv = *(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ*)(_res_conv_40_ptr);
26526                 FREE(untag_ptr(_res_conv_40));
26527                 _res_constr.data[o] = _res_conv_40_conv;
26528         }
26529         FREE(_res);
26530         CVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ_free(_res_constr);
26531 }
26532
26533 int64_t  CS_LDK_COption_OnionMessageContentsZ_some(int64_t o) {
26534         void* o_ptr = untag_ptr(o);
26535         CHECK_ACCESS(o_ptr);
26536         LDKOnionMessageContents o_conv = *(LDKOnionMessageContents*)(o_ptr);
26537         if (o_conv.free == LDKOnionMessageContents_JCalls_free) {
26538                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26539                 LDKOnionMessageContents_JCalls_cloned(&o_conv);
26540         }
26541         LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ");
26542         *ret_copy = COption_OnionMessageContentsZ_some(o_conv);
26543         int64_t ret_ref = tag_ptr(ret_copy, true);
26544         return ret_ref;
26545 }
26546
26547 int64_t  CS_LDK_COption_OnionMessageContentsZ_none() {
26548         LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ");
26549         *ret_copy = COption_OnionMessageContentsZ_none();
26550         int64_t ret_ref = tag_ptr(ret_copy, true);
26551         return ret_ref;
26552 }
26553
26554 void  CS_LDK_COption_OnionMessageContentsZ_free(int64_t _res) {
26555         if (!ptr_is_owned(_res)) return;
26556         void* _res_ptr = untag_ptr(_res);
26557         CHECK_ACCESS(_res_ptr);
26558         LDKCOption_OnionMessageContentsZ _res_conv = *(LDKCOption_OnionMessageContentsZ*)(_res_ptr);
26559         FREE(untag_ptr(_res));
26560         COption_OnionMessageContentsZ_free(_res_conv);
26561 }
26562
26563 static inline uint64_t COption_OnionMessageContentsZ_clone_ptr(LDKCOption_OnionMessageContentsZ *NONNULL_PTR arg) {
26564         LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ");
26565         *ret_copy = COption_OnionMessageContentsZ_clone(arg);
26566         int64_t ret_ref = tag_ptr(ret_copy, true);
26567         return ret_ref;
26568 }
26569 int64_t  CS_LDK_COption_OnionMessageContentsZ_clone_ptr(int64_t arg) {
26570         LDKCOption_OnionMessageContentsZ* arg_conv = (LDKCOption_OnionMessageContentsZ*)untag_ptr(arg);
26571         int64_t ret_conv = COption_OnionMessageContentsZ_clone_ptr(arg_conv);
26572         return ret_conv;
26573 }
26574
26575 int64_t  CS_LDK_COption_OnionMessageContentsZ_clone(int64_t orig) {
26576         LDKCOption_OnionMessageContentsZ* orig_conv = (LDKCOption_OnionMessageContentsZ*)untag_ptr(orig);
26577         LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ");
26578         *ret_copy = COption_OnionMessageContentsZ_clone(orig_conv);
26579         int64_t ret_ref = tag_ptr(ret_copy, true);
26580         return ret_ref;
26581 }
26582
26583 int64_t  CS_LDK_CResult_COption_OnionMessageContentsZDecodeErrorZ_ok(int64_t o) {
26584         void* o_ptr = untag_ptr(o);
26585         CHECK_ACCESS(o_ptr);
26586         LDKCOption_OnionMessageContentsZ o_conv = *(LDKCOption_OnionMessageContentsZ*)(o_ptr);
26587         o_conv = COption_OnionMessageContentsZ_clone((LDKCOption_OnionMessageContentsZ*)untag_ptr(o));
26588         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_OnionMessageContentsZDecodeErrorZ");
26589         *ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_ok(o_conv);
26590         return tag_ptr(ret_conv, true);
26591 }
26592
26593 int64_t  CS_LDK_CResult_COption_OnionMessageContentsZDecodeErrorZ_err(int64_t e) {
26594         void* e_ptr = untag_ptr(e);
26595         CHECK_ACCESS(e_ptr);
26596         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26597         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26598         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_OnionMessageContentsZDecodeErrorZ");
26599         *ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_err(e_conv);
26600         return tag_ptr(ret_conv, true);
26601 }
26602
26603 jboolean  CS_LDK_CResult_COption_OnionMessageContentsZDecodeErrorZ_is_ok(int64_t o) {
26604         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* o_conv = (LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)untag_ptr(o);
26605         jboolean ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_is_ok(o_conv);
26606         return ret_conv;
26607 }
26608
26609 void  CS_LDK_CResult_COption_OnionMessageContentsZDecodeErrorZ_free(int64_t _res) {
26610         if (!ptr_is_owned(_res)) return;
26611         void* _res_ptr = untag_ptr(_res);
26612         CHECK_ACCESS(_res_ptr);
26613         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ _res_conv = *(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)(_res_ptr);
26614         FREE(untag_ptr(_res));
26615         CResult_COption_OnionMessageContentsZDecodeErrorZ_free(_res_conv);
26616 }
26617
26618 static inline uint64_t CResult_COption_OnionMessageContentsZDecodeErrorZ_clone_ptr(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ *NONNULL_PTR arg) {
26619         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_OnionMessageContentsZDecodeErrorZ");
26620         *ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_clone(arg);
26621         return tag_ptr(ret_conv, true);
26622 }
26623 int64_t  CS_LDK_CResult_COption_OnionMessageContentsZDecodeErrorZ_clone_ptr(int64_t arg) {
26624         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* arg_conv = (LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)untag_ptr(arg);
26625         int64_t ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_clone_ptr(arg_conv);
26626         return ret_conv;
26627 }
26628
26629 int64_t  CS_LDK_CResult_COption_OnionMessageContentsZDecodeErrorZ_clone(int64_t orig) {
26630         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* orig_conv = (LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)untag_ptr(orig);
26631         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_OnionMessageContentsZDecodeErrorZ");
26632         *ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_clone(orig_conv);
26633         return tag_ptr(ret_conv, true);
26634 }
26635
26636 static inline uint64_t C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone_ptr(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ *NONNULL_PTR arg) {
26637         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ");
26638         *ret_conv = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone(arg);
26639         return tag_ptr(ret_conv, true);
26640 }
26641 int64_t  CS_LDK_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone_ptr(int64_t arg) {
26642         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* arg_conv = (LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)untag_ptr(arg);
26643         int64_t ret_conv = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone_ptr(arg_conv);
26644         return ret_conv;
26645 }
26646
26647 int64_t  CS_LDK_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone(int64_t orig) {
26648         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* orig_conv = (LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)untag_ptr(orig);
26649         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ");
26650         *ret_conv = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone(orig_conv);
26651         return tag_ptr(ret_conv, true);
26652 }
26653
26654 int64_t  CS_LDK_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_new(int64_t a, int64_t b, int64_t c) {
26655         void* a_ptr = untag_ptr(a);
26656         CHECK_ACCESS(a_ptr);
26657         LDKOnionMessageContents a_conv = *(LDKOnionMessageContents*)(a_ptr);
26658         if (a_conv.free == LDKOnionMessageContents_JCalls_free) {
26659                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26660                 LDKOnionMessageContents_JCalls_cloned(&a_conv);
26661         }
26662         void* b_ptr = untag_ptr(b);
26663         CHECK_ACCESS(b_ptr);
26664         LDKDestination b_conv = *(LDKDestination*)(b_ptr);
26665         b_conv = Destination_clone((LDKDestination*)untag_ptr(b));
26666         LDKBlindedPath c_conv;
26667         c_conv.inner = untag_ptr(c);
26668         c_conv.is_owned = ptr_is_owned(c);
26669         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
26670         c_conv = BlindedPath_clone(&c_conv);
26671         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ");
26672         *ret_conv = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_new(a_conv, b_conv, c_conv);
26673         return tag_ptr(ret_conv, true);
26674 }
26675
26676 void  CS_LDK_C3Tuple_OnionMessageContentsDestinationBlindedPathZ_free(int64_t _res) {
26677         if (!ptr_is_owned(_res)) return;
26678         void* _res_ptr = untag_ptr(_res);
26679         CHECK_ACCESS(_res_ptr);
26680         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ _res_conv = *(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)(_res_ptr);
26681         FREE(untag_ptr(_res));
26682         C3Tuple_OnionMessageContentsDestinationBlindedPathZ_free(_res_conv);
26683 }
26684
26685 void  CS_LDK_CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ_free(int64_tArray _res) {
26686         LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ _res_constr;
26687         _res_constr.datalen = _res->arr_len;
26688         if (_res_constr.datalen > 0)
26689                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ Elements");
26690         else
26691                 _res_constr.data = NULL;
26692         int64_t* _res_vals = _res->elems;
26693         for (size_t e = 0; e < _res_constr.datalen; e++) {
26694                 int64_t _res_conv_56 = _res_vals[e];
26695                 void* _res_conv_56_ptr = untag_ptr(_res_conv_56);
26696                 CHECK_ACCESS(_res_conv_56_ptr);
26697                 LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ _res_conv_56_conv = *(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)(_res_conv_56_ptr);
26698                 FREE(untag_ptr(_res_conv_56));
26699                 _res_constr.data[e] = _res_conv_56_conv;
26700         }
26701         FREE(_res);
26702         CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ_free(_res_constr);
26703 }
26704
26705 int64_t  CS_LDK_COption_TypeZ_some(int64_t o) {
26706         void* o_ptr = untag_ptr(o);
26707         CHECK_ACCESS(o_ptr);
26708         LDKType o_conv = *(LDKType*)(o_ptr);
26709         if (o_conv.free == LDKType_JCalls_free) {
26710                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26711                 LDKType_JCalls_cloned(&o_conv);
26712         }
26713         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
26714         *ret_copy = COption_TypeZ_some(o_conv);
26715         int64_t ret_ref = tag_ptr(ret_copy, true);
26716         return ret_ref;
26717 }
26718
26719 int64_t  CS_LDK_COption_TypeZ_none() {
26720         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
26721         *ret_copy = COption_TypeZ_none();
26722         int64_t ret_ref = tag_ptr(ret_copy, true);
26723         return ret_ref;
26724 }
26725
26726 void  CS_LDK_COption_TypeZ_free(int64_t _res) {
26727         if (!ptr_is_owned(_res)) return;
26728         void* _res_ptr = untag_ptr(_res);
26729         CHECK_ACCESS(_res_ptr);
26730         LDKCOption_TypeZ _res_conv = *(LDKCOption_TypeZ*)(_res_ptr);
26731         FREE(untag_ptr(_res));
26732         COption_TypeZ_free(_res_conv);
26733 }
26734
26735 static inline uint64_t COption_TypeZ_clone_ptr(LDKCOption_TypeZ *NONNULL_PTR arg) {
26736         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
26737         *ret_copy = COption_TypeZ_clone(arg);
26738         int64_t ret_ref = tag_ptr(ret_copy, true);
26739         return ret_ref;
26740 }
26741 int64_t  CS_LDK_COption_TypeZ_clone_ptr(int64_t arg) {
26742         LDKCOption_TypeZ* arg_conv = (LDKCOption_TypeZ*)untag_ptr(arg);
26743         int64_t ret_conv = COption_TypeZ_clone_ptr(arg_conv);
26744         return ret_conv;
26745 }
26746
26747 int64_t  CS_LDK_COption_TypeZ_clone(int64_t orig) {
26748         LDKCOption_TypeZ* orig_conv = (LDKCOption_TypeZ*)untag_ptr(orig);
26749         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
26750         *ret_copy = COption_TypeZ_clone(orig_conv);
26751         int64_t ret_ref = tag_ptr(ret_copy, true);
26752         return ret_ref;
26753 }
26754
26755 int64_t  CS_LDK_CResult_COption_TypeZDecodeErrorZ_ok(int64_t o) {
26756         void* o_ptr = untag_ptr(o);
26757         CHECK_ACCESS(o_ptr);
26758         LDKCOption_TypeZ o_conv = *(LDKCOption_TypeZ*)(o_ptr);
26759         o_conv = COption_TypeZ_clone((LDKCOption_TypeZ*)untag_ptr(o));
26760         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
26761         *ret_conv = CResult_COption_TypeZDecodeErrorZ_ok(o_conv);
26762         return tag_ptr(ret_conv, true);
26763 }
26764
26765 int64_t  CS_LDK_CResult_COption_TypeZDecodeErrorZ_err(int64_t e) {
26766         void* e_ptr = untag_ptr(e);
26767         CHECK_ACCESS(e_ptr);
26768         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26769         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26770         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
26771         *ret_conv = CResult_COption_TypeZDecodeErrorZ_err(e_conv);
26772         return tag_ptr(ret_conv, true);
26773 }
26774
26775 jboolean  CS_LDK_CResult_COption_TypeZDecodeErrorZ_is_ok(int64_t o) {
26776         LDKCResult_COption_TypeZDecodeErrorZ* o_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(o);
26777         jboolean ret_conv = CResult_COption_TypeZDecodeErrorZ_is_ok(o_conv);
26778         return ret_conv;
26779 }
26780
26781 void  CS_LDK_CResult_COption_TypeZDecodeErrorZ_free(int64_t _res) {
26782         if (!ptr_is_owned(_res)) return;
26783         void* _res_ptr = untag_ptr(_res);
26784         CHECK_ACCESS(_res_ptr);
26785         LDKCResult_COption_TypeZDecodeErrorZ _res_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(_res_ptr);
26786         FREE(untag_ptr(_res));
26787         CResult_COption_TypeZDecodeErrorZ_free(_res_conv);
26788 }
26789
26790 static inline uint64_t CResult_COption_TypeZDecodeErrorZ_clone_ptr(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR arg) {
26791         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
26792         *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(arg);
26793         return tag_ptr(ret_conv, true);
26794 }
26795 int64_t  CS_LDK_CResult_COption_TypeZDecodeErrorZ_clone_ptr(int64_t arg) {
26796         LDKCResult_COption_TypeZDecodeErrorZ* arg_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(arg);
26797         int64_t ret_conv = CResult_COption_TypeZDecodeErrorZ_clone_ptr(arg_conv);
26798         return ret_conv;
26799 }
26800
26801 int64_t  CS_LDK_CResult_COption_TypeZDecodeErrorZ_clone(int64_t orig) {
26802         LDKCResult_COption_TypeZDecodeErrorZ* orig_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(orig);
26803         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
26804         *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(orig_conv);
26805         return tag_ptr(ret_conv, true);
26806 }
26807
26808 int64_t  CS_LDK_COption_SocketAddressZ_some(int64_t o) {
26809         void* o_ptr = untag_ptr(o);
26810         CHECK_ACCESS(o_ptr);
26811         LDKSocketAddress o_conv = *(LDKSocketAddress*)(o_ptr);
26812         o_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(o));
26813         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
26814         *ret_copy = COption_SocketAddressZ_some(o_conv);
26815         int64_t ret_ref = tag_ptr(ret_copy, true);
26816         return ret_ref;
26817 }
26818
26819 int64_t  CS_LDK_COption_SocketAddressZ_none() {
26820         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
26821         *ret_copy = COption_SocketAddressZ_none();
26822         int64_t ret_ref = tag_ptr(ret_copy, true);
26823         return ret_ref;
26824 }
26825
26826 void  CS_LDK_COption_SocketAddressZ_free(int64_t _res) {
26827         if (!ptr_is_owned(_res)) return;
26828         void* _res_ptr = untag_ptr(_res);
26829         CHECK_ACCESS(_res_ptr);
26830         LDKCOption_SocketAddressZ _res_conv = *(LDKCOption_SocketAddressZ*)(_res_ptr);
26831         FREE(untag_ptr(_res));
26832         COption_SocketAddressZ_free(_res_conv);
26833 }
26834
26835 static inline uint64_t COption_SocketAddressZ_clone_ptr(LDKCOption_SocketAddressZ *NONNULL_PTR arg) {
26836         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
26837         *ret_copy = COption_SocketAddressZ_clone(arg);
26838         int64_t ret_ref = tag_ptr(ret_copy, true);
26839         return ret_ref;
26840 }
26841 int64_t  CS_LDK_COption_SocketAddressZ_clone_ptr(int64_t arg) {
26842         LDKCOption_SocketAddressZ* arg_conv = (LDKCOption_SocketAddressZ*)untag_ptr(arg);
26843         int64_t ret_conv = COption_SocketAddressZ_clone_ptr(arg_conv);
26844         return ret_conv;
26845 }
26846
26847 int64_t  CS_LDK_COption_SocketAddressZ_clone(int64_t orig) {
26848         LDKCOption_SocketAddressZ* orig_conv = (LDKCOption_SocketAddressZ*)untag_ptr(orig);
26849         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
26850         *ret_copy = COption_SocketAddressZ_clone(orig_conv);
26851         int64_t ret_ref = tag_ptr(ret_copy, true);
26852         return ret_ref;
26853 }
26854
26855 void  CS_LDK_CVec_PeerDetailsZ_free(int64_tArray _res) {
26856         LDKCVec_PeerDetailsZ _res_constr;
26857         _res_constr.datalen = _res->arr_len;
26858         if (_res_constr.datalen > 0)
26859                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPeerDetails), "LDKCVec_PeerDetailsZ Elements");
26860         else
26861                 _res_constr.data = NULL;
26862         int64_t* _res_vals = _res->elems;
26863         for (size_t n = 0; n < _res_constr.datalen; n++) {
26864                 int64_t _res_conv_13 = _res_vals[n];
26865                 LDKPeerDetails _res_conv_13_conv;
26866                 _res_conv_13_conv.inner = untag_ptr(_res_conv_13);
26867                 _res_conv_13_conv.is_owned = ptr_is_owned(_res_conv_13);
26868                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_13_conv);
26869                 _res_constr.data[n] = _res_conv_13_conv;
26870         }
26871         FREE(_res);
26872         CVec_PeerDetailsZ_free(_res_constr);
26873 }
26874
26875 int64_t  CS_LDK_CResult_CVec_u8ZPeerHandleErrorZ_ok(int8_tArray o) {
26876         LDKCVec_u8Z o_ref;
26877         o_ref.datalen = o->arr_len;
26878         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
26879         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
26880         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
26881         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
26882         return tag_ptr(ret_conv, true);
26883 }
26884
26885 int64_t  CS_LDK_CResult_CVec_u8ZPeerHandleErrorZ_err(int64_t e) {
26886         LDKPeerHandleError e_conv;
26887         e_conv.inner = untag_ptr(e);
26888         e_conv.is_owned = ptr_is_owned(e);
26889         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
26890         e_conv = PeerHandleError_clone(&e_conv);
26891         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
26892         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv);
26893         return tag_ptr(ret_conv, true);
26894 }
26895
26896 jboolean  CS_LDK_CResult_CVec_u8ZPeerHandleErrorZ_is_ok(int64_t o) {
26897         LDKCResult_CVec_u8ZPeerHandleErrorZ* o_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(o);
26898         jboolean ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o_conv);
26899         return ret_conv;
26900 }
26901
26902 void  CS_LDK_CResult_CVec_u8ZPeerHandleErrorZ_free(int64_t _res) {
26903         if (!ptr_is_owned(_res)) return;
26904         void* _res_ptr = untag_ptr(_res);
26905         CHECK_ACCESS(_res_ptr);
26906         LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)(_res_ptr);
26907         FREE(untag_ptr(_res));
26908         CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv);
26909 }
26910
26911 static inline uint64_t CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR arg) {
26912         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
26913         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(arg);
26914         return tag_ptr(ret_conv, true);
26915 }
26916 int64_t  CS_LDK_CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(int64_t arg) {
26917         LDKCResult_CVec_u8ZPeerHandleErrorZ* arg_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(arg);
26918         int64_t ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(arg_conv);
26919         return ret_conv;
26920 }
26921
26922 int64_t  CS_LDK_CResult_CVec_u8ZPeerHandleErrorZ_clone(int64_t orig) {
26923         LDKCResult_CVec_u8ZPeerHandleErrorZ* orig_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(orig);
26924         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
26925         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(orig_conv);
26926         return tag_ptr(ret_conv, true);
26927 }
26928
26929 int64_t  CS_LDK_CResult_NonePeerHandleErrorZ_ok() {
26930         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
26931         *ret_conv = CResult_NonePeerHandleErrorZ_ok();
26932         return tag_ptr(ret_conv, true);
26933 }
26934
26935 int64_t  CS_LDK_CResult_NonePeerHandleErrorZ_err(int64_t e) {
26936         LDKPeerHandleError e_conv;
26937         e_conv.inner = untag_ptr(e);
26938         e_conv.is_owned = ptr_is_owned(e);
26939         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
26940         e_conv = PeerHandleError_clone(&e_conv);
26941         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
26942         *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv);
26943         return tag_ptr(ret_conv, true);
26944 }
26945
26946 jboolean  CS_LDK_CResult_NonePeerHandleErrorZ_is_ok(int64_t o) {
26947         LDKCResult_NonePeerHandleErrorZ* o_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(o);
26948         jboolean ret_conv = CResult_NonePeerHandleErrorZ_is_ok(o_conv);
26949         return ret_conv;
26950 }
26951
26952 void  CS_LDK_CResult_NonePeerHandleErrorZ_free(int64_t _res) {
26953         if (!ptr_is_owned(_res)) return;
26954         void* _res_ptr = untag_ptr(_res);
26955         CHECK_ACCESS(_res_ptr);
26956         LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)(_res_ptr);
26957         FREE(untag_ptr(_res));
26958         CResult_NonePeerHandleErrorZ_free(_res_conv);
26959 }
26960
26961 static inline uint64_t CResult_NonePeerHandleErrorZ_clone_ptr(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR arg) {
26962         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
26963         *ret_conv = CResult_NonePeerHandleErrorZ_clone(arg);
26964         return tag_ptr(ret_conv, true);
26965 }
26966 int64_t  CS_LDK_CResult_NonePeerHandleErrorZ_clone_ptr(int64_t arg) {
26967         LDKCResult_NonePeerHandleErrorZ* arg_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(arg);
26968         int64_t ret_conv = CResult_NonePeerHandleErrorZ_clone_ptr(arg_conv);
26969         return ret_conv;
26970 }
26971
26972 int64_t  CS_LDK_CResult_NonePeerHandleErrorZ_clone(int64_t orig) {
26973         LDKCResult_NonePeerHandleErrorZ* orig_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(orig);
26974         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
26975         *ret_conv = CResult_NonePeerHandleErrorZ_clone(orig_conv);
26976         return tag_ptr(ret_conv, true);
26977 }
26978
26979 int64_t  CS_LDK_CResult_boolPeerHandleErrorZ_ok(jboolean o) {
26980         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
26981         *ret_conv = CResult_boolPeerHandleErrorZ_ok(o);
26982         return tag_ptr(ret_conv, true);
26983 }
26984
26985 int64_t  CS_LDK_CResult_boolPeerHandleErrorZ_err(int64_t e) {
26986         LDKPeerHandleError e_conv;
26987         e_conv.inner = untag_ptr(e);
26988         e_conv.is_owned = ptr_is_owned(e);
26989         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
26990         e_conv = PeerHandleError_clone(&e_conv);
26991         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
26992         *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv);
26993         return tag_ptr(ret_conv, true);
26994 }
26995
26996 jboolean  CS_LDK_CResult_boolPeerHandleErrorZ_is_ok(int64_t o) {
26997         LDKCResult_boolPeerHandleErrorZ* o_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(o);
26998         jboolean ret_conv = CResult_boolPeerHandleErrorZ_is_ok(o_conv);
26999         return ret_conv;
27000 }
27001
27002 void  CS_LDK_CResult_boolPeerHandleErrorZ_free(int64_t _res) {
27003         if (!ptr_is_owned(_res)) return;
27004         void* _res_ptr = untag_ptr(_res);
27005         CHECK_ACCESS(_res_ptr);
27006         LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)(_res_ptr);
27007         FREE(untag_ptr(_res));
27008         CResult_boolPeerHandleErrorZ_free(_res_conv);
27009 }
27010
27011 static inline uint64_t CResult_boolPeerHandleErrorZ_clone_ptr(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR arg) {
27012         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
27013         *ret_conv = CResult_boolPeerHandleErrorZ_clone(arg);
27014         return tag_ptr(ret_conv, true);
27015 }
27016 int64_t  CS_LDK_CResult_boolPeerHandleErrorZ_clone_ptr(int64_t arg) {
27017         LDKCResult_boolPeerHandleErrorZ* arg_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(arg);
27018         int64_t ret_conv = CResult_boolPeerHandleErrorZ_clone_ptr(arg_conv);
27019         return ret_conv;
27020 }
27021
27022 int64_t  CS_LDK_CResult_boolPeerHandleErrorZ_clone(int64_t orig) {
27023         LDKCResult_boolPeerHandleErrorZ* orig_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(orig);
27024         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
27025         *ret_conv = CResult_boolPeerHandleErrorZ_clone(orig_conv);
27026         return tag_ptr(ret_conv, true);
27027 }
27028
27029 int64_t  CS_LDK_CResult_u32GraphSyncErrorZ_ok(int32_t o) {
27030         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
27031         *ret_conv = CResult_u32GraphSyncErrorZ_ok(o);
27032         return tag_ptr(ret_conv, true);
27033 }
27034
27035 int64_t  CS_LDK_CResult_u32GraphSyncErrorZ_err(int64_t e) {
27036         void* e_ptr = untag_ptr(e);
27037         CHECK_ACCESS(e_ptr);
27038         LDKGraphSyncError e_conv = *(LDKGraphSyncError*)(e_ptr);
27039         e_conv = GraphSyncError_clone((LDKGraphSyncError*)untag_ptr(e));
27040         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
27041         *ret_conv = CResult_u32GraphSyncErrorZ_err(e_conv);
27042         return tag_ptr(ret_conv, true);
27043 }
27044
27045 jboolean  CS_LDK_CResult_u32GraphSyncErrorZ_is_ok(int64_t o) {
27046         LDKCResult_u32GraphSyncErrorZ* o_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(o);
27047         jboolean ret_conv = CResult_u32GraphSyncErrorZ_is_ok(o_conv);
27048         return ret_conv;
27049 }
27050
27051 void  CS_LDK_CResult_u32GraphSyncErrorZ_free(int64_t _res) {
27052         if (!ptr_is_owned(_res)) return;
27053         void* _res_ptr = untag_ptr(_res);
27054         CHECK_ACCESS(_res_ptr);
27055         LDKCResult_u32GraphSyncErrorZ _res_conv = *(LDKCResult_u32GraphSyncErrorZ*)(_res_ptr);
27056         FREE(untag_ptr(_res));
27057         CResult_u32GraphSyncErrorZ_free(_res_conv);
27058 }
27059
27060 int64_t  CS_LDK_CResult_CVec_u8ZIOErrorZ_ok(int8_tArray o) {
27061         LDKCVec_u8Z o_ref;
27062         o_ref.datalen = o->arr_len;
27063         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
27064         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
27065         LDKCResult_CVec_u8ZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZIOErrorZ), "LDKCResult_CVec_u8ZIOErrorZ");
27066         *ret_conv = CResult_CVec_u8ZIOErrorZ_ok(o_ref);
27067         return tag_ptr(ret_conv, true);
27068 }
27069
27070 int64_t  CS_LDK_CResult_CVec_u8ZIOErrorZ_err(int32_t e) {
27071         LDKIOError e_conv = LDKIOError_from_cs(e);
27072         LDKCResult_CVec_u8ZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZIOErrorZ), "LDKCResult_CVec_u8ZIOErrorZ");
27073         *ret_conv = CResult_CVec_u8ZIOErrorZ_err(e_conv);
27074         return tag_ptr(ret_conv, true);
27075 }
27076
27077 jboolean  CS_LDK_CResult_CVec_u8ZIOErrorZ_is_ok(int64_t o) {
27078         LDKCResult_CVec_u8ZIOErrorZ* o_conv = (LDKCResult_CVec_u8ZIOErrorZ*)untag_ptr(o);
27079         jboolean ret_conv = CResult_CVec_u8ZIOErrorZ_is_ok(o_conv);
27080         return ret_conv;
27081 }
27082
27083 void  CS_LDK_CResult_CVec_u8ZIOErrorZ_free(int64_t _res) {
27084         if (!ptr_is_owned(_res)) return;
27085         void* _res_ptr = untag_ptr(_res);
27086         CHECK_ACCESS(_res_ptr);
27087         LDKCResult_CVec_u8ZIOErrorZ _res_conv = *(LDKCResult_CVec_u8ZIOErrorZ*)(_res_ptr);
27088         FREE(untag_ptr(_res));
27089         CResult_CVec_u8ZIOErrorZ_free(_res_conv);
27090 }
27091
27092 static inline uint64_t CResult_CVec_u8ZIOErrorZ_clone_ptr(LDKCResult_CVec_u8ZIOErrorZ *NONNULL_PTR arg) {
27093         LDKCResult_CVec_u8ZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZIOErrorZ), "LDKCResult_CVec_u8ZIOErrorZ");
27094         *ret_conv = CResult_CVec_u8ZIOErrorZ_clone(arg);
27095         return tag_ptr(ret_conv, true);
27096 }
27097 int64_t  CS_LDK_CResult_CVec_u8ZIOErrorZ_clone_ptr(int64_t arg) {
27098         LDKCResult_CVec_u8ZIOErrorZ* arg_conv = (LDKCResult_CVec_u8ZIOErrorZ*)untag_ptr(arg);
27099         int64_t ret_conv = CResult_CVec_u8ZIOErrorZ_clone_ptr(arg_conv);
27100         return ret_conv;
27101 }
27102
27103 int64_t  CS_LDK_CResult_CVec_u8ZIOErrorZ_clone(int64_t orig) {
27104         LDKCResult_CVec_u8ZIOErrorZ* orig_conv = (LDKCResult_CVec_u8ZIOErrorZ*)untag_ptr(orig);
27105         LDKCResult_CVec_u8ZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZIOErrorZ), "LDKCResult_CVec_u8ZIOErrorZ");
27106         *ret_conv = CResult_CVec_u8ZIOErrorZ_clone(orig_conv);
27107         return tag_ptr(ret_conv, true);
27108 }
27109
27110 void  CS_LDK_CVec_StrZ_free(ptrArray _res) {
27111         LDKCVec_StrZ _res_constr;
27112         _res_constr.datalen = _res->arr_len;
27113         if (_res_constr.datalen > 0)
27114                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKStr), "LDKCVec_StrZ Elements");
27115         else
27116                 _res_constr.data = NULL;
27117         jstring* _res_vals = (void*) _res->elems;
27118         for (size_t i = 0; i < _res_constr.datalen; i++) {
27119                 jstring _res_conv_8 = _res_vals[i];
27120                 LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
27121                 _res_constr.data[i] = dummy;
27122         }
27123         FREE(_res);
27124         CVec_StrZ_free(_res_constr);
27125 }
27126
27127 int64_t  CS_LDK_CResult_CVec_StrZIOErrorZ_ok(ptrArray o) {
27128         LDKCVec_StrZ o_constr;
27129         o_constr.datalen = o->arr_len;
27130         if (o_constr.datalen > 0)
27131                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKStr), "LDKCVec_StrZ Elements");
27132         else
27133                 o_constr.data = NULL;
27134         jstring* o_vals = (void*) o->elems;
27135         for (size_t i = 0; i < o_constr.datalen; i++) {
27136                 jstring o_conv_8 = o_vals[i];
27137                 LDKStr o_conv_8_conv = str_ref_to_owned_c(o_conv_8);
27138                 o_constr.data[i] = o_conv_8_conv;
27139         }
27140         FREE(o);
27141         LDKCResult_CVec_StrZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_StrZIOErrorZ), "LDKCResult_CVec_StrZIOErrorZ");
27142         *ret_conv = CResult_CVec_StrZIOErrorZ_ok(o_constr);
27143         return tag_ptr(ret_conv, true);
27144 }
27145
27146 int64_t  CS_LDK_CResult_CVec_StrZIOErrorZ_err(int32_t e) {
27147         LDKIOError e_conv = LDKIOError_from_cs(e);
27148         LDKCResult_CVec_StrZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_StrZIOErrorZ), "LDKCResult_CVec_StrZIOErrorZ");
27149         *ret_conv = CResult_CVec_StrZIOErrorZ_err(e_conv);
27150         return tag_ptr(ret_conv, true);
27151 }
27152
27153 jboolean  CS_LDK_CResult_CVec_StrZIOErrorZ_is_ok(int64_t o) {
27154         LDKCResult_CVec_StrZIOErrorZ* o_conv = (LDKCResult_CVec_StrZIOErrorZ*)untag_ptr(o);
27155         jboolean ret_conv = CResult_CVec_StrZIOErrorZ_is_ok(o_conv);
27156         return ret_conv;
27157 }
27158
27159 void  CS_LDK_CResult_CVec_StrZIOErrorZ_free(int64_t _res) {
27160         if (!ptr_is_owned(_res)) return;
27161         void* _res_ptr = untag_ptr(_res);
27162         CHECK_ACCESS(_res_ptr);
27163         LDKCResult_CVec_StrZIOErrorZ _res_conv = *(LDKCResult_CVec_StrZIOErrorZ*)(_res_ptr);
27164         FREE(untag_ptr(_res));
27165         CResult_CVec_StrZIOErrorZ_free(_res_conv);
27166 }
27167
27168 static inline uint64_t CResult_CVec_StrZIOErrorZ_clone_ptr(LDKCResult_CVec_StrZIOErrorZ *NONNULL_PTR arg) {
27169         LDKCResult_CVec_StrZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_StrZIOErrorZ), "LDKCResult_CVec_StrZIOErrorZ");
27170         *ret_conv = CResult_CVec_StrZIOErrorZ_clone(arg);
27171         return tag_ptr(ret_conv, true);
27172 }
27173 int64_t  CS_LDK_CResult_CVec_StrZIOErrorZ_clone_ptr(int64_t arg) {
27174         LDKCResult_CVec_StrZIOErrorZ* arg_conv = (LDKCResult_CVec_StrZIOErrorZ*)untag_ptr(arg);
27175         int64_t ret_conv = CResult_CVec_StrZIOErrorZ_clone_ptr(arg_conv);
27176         return ret_conv;
27177 }
27178
27179 int64_t  CS_LDK_CResult_CVec_StrZIOErrorZ_clone(int64_t orig) {
27180         LDKCResult_CVec_StrZIOErrorZ* orig_conv = (LDKCResult_CVec_StrZIOErrorZ*)untag_ptr(orig);
27181         LDKCResult_CVec_StrZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_StrZIOErrorZ), "LDKCResult_CVec_StrZIOErrorZ");
27182         *ret_conv = CResult_CVec_StrZIOErrorZ_clone(orig_conv);
27183         return tag_ptr(ret_conv, true);
27184 }
27185
27186 void  CS_LDK_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ_free(int64_tArray _res) {
27187         LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ _res_constr;
27188         _res_constr.datalen = _res->arr_len;
27189         if (_res_constr.datalen > 0)
27190                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ Elements");
27191         else
27192                 _res_constr.data = NULL;
27193         int64_t* _res_vals = _res->elems;
27194         for (size_t o = 0; o < _res_constr.datalen; o++) {
27195                 int64_t _res_conv_40 = _res_vals[o];
27196                 void* _res_conv_40_ptr = untag_ptr(_res_conv_40);
27197                 CHECK_ACCESS(_res_conv_40_ptr);
27198                 LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ _res_conv_40_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)(_res_conv_40_ptr);
27199                 FREE(untag_ptr(_res_conv_40));
27200                 _res_constr.data[o] = _res_conv_40_conv;
27201         }
27202         FREE(_res);
27203         CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ_free(_res_constr);
27204 }
27205
27206 int64_t  CS_LDK_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_ok(int64_tArray o) {
27207         LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ o_constr;
27208         o_constr.datalen = o->arr_len;
27209         if (o_constr.datalen > 0)
27210                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ Elements");
27211         else
27212                 o_constr.data = NULL;
27213         int64_t* o_vals = o->elems;
27214         for (size_t o = 0; o < o_constr.datalen; o++) {
27215                 int64_t o_conv_40 = o_vals[o];
27216                 void* o_conv_40_ptr = untag_ptr(o_conv_40);
27217                 CHECK_ACCESS(o_conv_40_ptr);
27218                 LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ o_conv_40_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)(o_conv_40_ptr);
27219                 o_conv_40_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone((LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(o_conv_40));
27220                 o_constr.data[o] = o_conv_40_conv;
27221         }
27222         FREE(o);
27223         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
27224         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_ok(o_constr);
27225         return tag_ptr(ret_conv, true);
27226 }
27227
27228 int64_t  CS_LDK_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_err(int32_t e) {
27229         LDKIOError e_conv = LDKIOError_from_cs(e);
27230         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
27231         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_err(e_conv);
27232         return tag_ptr(ret_conv, true);
27233 }
27234
27235 jboolean  CS_LDK_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_is_ok(int64_t o) {
27236         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* o_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)untag_ptr(o);
27237         jboolean ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_is_ok(o_conv);
27238         return ret_conv;
27239 }
27240
27241 void  CS_LDK_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_free(int64_t _res) {
27242         if (!ptr_is_owned(_res)) return;
27243         void* _res_ptr = untag_ptr(_res);
27244         CHECK_ACCESS(_res_ptr);
27245         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ _res_conv = *(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)(_res_ptr);
27246         FREE(untag_ptr(_res));
27247         CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_free(_res_conv);
27248 }
27249
27250 static inline uint64_t CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone_ptr(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ *NONNULL_PTR arg) {
27251         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
27252         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone(arg);
27253         return tag_ptr(ret_conv, true);
27254 }
27255 int64_t  CS_LDK_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone_ptr(int64_t arg) {
27256         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* arg_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)untag_ptr(arg);
27257         int64_t ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone_ptr(arg_conv);
27258         return ret_conv;
27259 }
27260
27261 int64_t  CS_LDK_CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone(int64_t orig) {
27262         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* orig_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)untag_ptr(orig);
27263         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
27264         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone(orig_conv);
27265         return tag_ptr(ret_conv, true);
27266 }
27267
27268 int64_t  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_ok(int64_t o) {
27269         void* o_ptr = untag_ptr(o);
27270         CHECK_ACCESS(o_ptr);
27271         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ o_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)(o_ptr);
27272         o_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone((LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(o));
27273         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ");
27274         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_ok(o_conv);
27275         return tag_ptr(ret_conv, true);
27276 }
27277
27278 int64_t  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_err(int32_t e) {
27279         LDKIOError e_conv = LDKIOError_from_cs(e);
27280         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ");
27281         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_err(e_conv);
27282         return tag_ptr(ret_conv, true);
27283 }
27284
27285 jboolean  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_is_ok(int64_t o) {
27286         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* o_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)untag_ptr(o);
27287         jboolean ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_is_ok(o_conv);
27288         return ret_conv;
27289 }
27290
27291 void  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_free(int64_t _res) {
27292         if (!ptr_is_owned(_res)) return;
27293         void* _res_ptr = untag_ptr(_res);
27294         CHECK_ACCESS(_res_ptr);
27295         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ _res_conv = *(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)(_res_ptr);
27296         FREE(untag_ptr(_res));
27297         CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_free(_res_conv);
27298 }
27299
27300 static inline uint64_t CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone_ptr(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ *NONNULL_PTR arg) {
27301         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ");
27302         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone(arg);
27303         return tag_ptr(ret_conv, true);
27304 }
27305 int64_t  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone_ptr(int64_t arg) {
27306         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* arg_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)untag_ptr(arg);
27307         int64_t ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone_ptr(arg_conv);
27308         return ret_conv;
27309 }
27310
27311 int64_t  CS_LDK_CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone(int64_t orig) {
27312         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* orig_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)untag_ptr(orig);
27313         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ");
27314         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone(orig_conv);
27315         return tag_ptr(ret_conv, true);
27316 }
27317
27318 int64_t  CS_LDK_CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_ok(int64_t o) {
27319         LDKUnsignedInvoiceRequest o_conv;
27320         o_conv.inner = untag_ptr(o);
27321         o_conv.is_owned = ptr_is_owned(o);
27322         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27323         o_conv = UnsignedInvoiceRequest_clone(&o_conv);
27324         LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ), "LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ");
27325         *ret_conv = CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_ok(o_conv);
27326         return tag_ptr(ret_conv, true);
27327 }
27328
27329 int64_t  CS_LDK_CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_err(int32_t e) {
27330         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_cs(e);
27331         LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ), "LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ");
27332         *ret_conv = CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_err(e_conv);
27333         return tag_ptr(ret_conv, true);
27334 }
27335
27336 jboolean  CS_LDK_CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_is_ok(int64_t o) {
27337         LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ* o_conv = (LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ*)untag_ptr(o);
27338         jboolean ret_conv = CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_is_ok(o_conv);
27339         return ret_conv;
27340 }
27341
27342 void  CS_LDK_CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_free(int64_t _res) {
27343         if (!ptr_is_owned(_res)) return;
27344         void* _res_ptr = untag_ptr(_res);
27345         CHECK_ACCESS(_res_ptr);
27346         LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ _res_conv = *(LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ*)(_res_ptr);
27347         FREE(untag_ptr(_res));
27348         CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_free(_res_conv);
27349 }
27350
27351 static inline uint64_t CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_clone_ptr(LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ *NONNULL_PTR arg) {
27352         LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ), "LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ");
27353         *ret_conv = CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_clone(arg);
27354         return tag_ptr(ret_conv, true);
27355 }
27356 int64_t  CS_LDK_CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_clone_ptr(int64_t arg) {
27357         LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ* arg_conv = (LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ*)untag_ptr(arg);
27358         int64_t ret_conv = CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_clone_ptr(arg_conv);
27359         return ret_conv;
27360 }
27361
27362 int64_t  CS_LDK_CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_clone(int64_t orig) {
27363         LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ* orig_conv = (LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ*)untag_ptr(orig);
27364         LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ), "LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ");
27365         *ret_conv = CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_clone(orig_conv);
27366         return tag_ptr(ret_conv, true);
27367 }
27368
27369 int64_t  CS_LDK_CResult_InvoiceRequestBolt12SemanticErrorZ_ok(int64_t o) {
27370         LDKInvoiceRequest o_conv;
27371         o_conv.inner = untag_ptr(o);
27372         o_conv.is_owned = ptr_is_owned(o);
27373         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27374         o_conv = InvoiceRequest_clone(&o_conv);
27375         LDKCResult_InvoiceRequestBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestBolt12SemanticErrorZ), "LDKCResult_InvoiceRequestBolt12SemanticErrorZ");
27376         *ret_conv = CResult_InvoiceRequestBolt12SemanticErrorZ_ok(o_conv);
27377         return tag_ptr(ret_conv, true);
27378 }
27379
27380 int64_t  CS_LDK_CResult_InvoiceRequestBolt12SemanticErrorZ_err(int32_t e) {
27381         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_cs(e);
27382         LDKCResult_InvoiceRequestBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestBolt12SemanticErrorZ), "LDKCResult_InvoiceRequestBolt12SemanticErrorZ");
27383         *ret_conv = CResult_InvoiceRequestBolt12SemanticErrorZ_err(e_conv);
27384         return tag_ptr(ret_conv, true);
27385 }
27386
27387 jboolean  CS_LDK_CResult_InvoiceRequestBolt12SemanticErrorZ_is_ok(int64_t o) {
27388         LDKCResult_InvoiceRequestBolt12SemanticErrorZ* o_conv = (LDKCResult_InvoiceRequestBolt12SemanticErrorZ*)untag_ptr(o);
27389         jboolean ret_conv = CResult_InvoiceRequestBolt12SemanticErrorZ_is_ok(o_conv);
27390         return ret_conv;
27391 }
27392
27393 void  CS_LDK_CResult_InvoiceRequestBolt12SemanticErrorZ_free(int64_t _res) {
27394         if (!ptr_is_owned(_res)) return;
27395         void* _res_ptr = untag_ptr(_res);
27396         CHECK_ACCESS(_res_ptr);
27397         LDKCResult_InvoiceRequestBolt12SemanticErrorZ _res_conv = *(LDKCResult_InvoiceRequestBolt12SemanticErrorZ*)(_res_ptr);
27398         FREE(untag_ptr(_res));
27399         CResult_InvoiceRequestBolt12SemanticErrorZ_free(_res_conv);
27400 }
27401
27402 static inline uint64_t CResult_InvoiceRequestBolt12SemanticErrorZ_clone_ptr(LDKCResult_InvoiceRequestBolt12SemanticErrorZ *NONNULL_PTR arg) {
27403         LDKCResult_InvoiceRequestBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestBolt12SemanticErrorZ), "LDKCResult_InvoiceRequestBolt12SemanticErrorZ");
27404         *ret_conv = CResult_InvoiceRequestBolt12SemanticErrorZ_clone(arg);
27405         return tag_ptr(ret_conv, true);
27406 }
27407 int64_t  CS_LDK_CResult_InvoiceRequestBolt12SemanticErrorZ_clone_ptr(int64_t arg) {
27408         LDKCResult_InvoiceRequestBolt12SemanticErrorZ* arg_conv = (LDKCResult_InvoiceRequestBolt12SemanticErrorZ*)untag_ptr(arg);
27409         int64_t ret_conv = CResult_InvoiceRequestBolt12SemanticErrorZ_clone_ptr(arg_conv);
27410         return ret_conv;
27411 }
27412
27413 int64_t  CS_LDK_CResult_InvoiceRequestBolt12SemanticErrorZ_clone(int64_t orig) {
27414         LDKCResult_InvoiceRequestBolt12SemanticErrorZ* orig_conv = (LDKCResult_InvoiceRequestBolt12SemanticErrorZ*)untag_ptr(orig);
27415         LDKCResult_InvoiceRequestBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestBolt12SemanticErrorZ), "LDKCResult_InvoiceRequestBolt12SemanticErrorZ");
27416         *ret_conv = CResult_InvoiceRequestBolt12SemanticErrorZ_clone(orig_conv);
27417         return tag_ptr(ret_conv, true);
27418 }
27419
27420 int64_t  CS_LDK_COption_SecretKeyZ_some(int8_tArray o) {
27421         LDKSecretKey o_ref;
27422         CHECK(o->arr_len == 32);
27423         memcpy(o_ref.bytes, o->elems, 32); FREE(o);
27424         LDKCOption_SecretKeyZ *ret_copy = MALLOC(sizeof(LDKCOption_SecretKeyZ), "LDKCOption_SecretKeyZ");
27425         *ret_copy = COption_SecretKeyZ_some(o_ref);
27426         int64_t ret_ref = tag_ptr(ret_copy, true);
27427         return ret_ref;
27428 }
27429
27430 int64_t  CS_LDK_COption_SecretKeyZ_none() {
27431         LDKCOption_SecretKeyZ *ret_copy = MALLOC(sizeof(LDKCOption_SecretKeyZ), "LDKCOption_SecretKeyZ");
27432         *ret_copy = COption_SecretKeyZ_none();
27433         int64_t ret_ref = tag_ptr(ret_copy, true);
27434         return ret_ref;
27435 }
27436
27437 void  CS_LDK_COption_SecretKeyZ_free(int64_t _res) {
27438         if (!ptr_is_owned(_res)) return;
27439         void* _res_ptr = untag_ptr(_res);
27440         CHECK_ACCESS(_res_ptr);
27441         LDKCOption_SecretKeyZ _res_conv = *(LDKCOption_SecretKeyZ*)(_res_ptr);
27442         FREE(untag_ptr(_res));
27443         COption_SecretKeyZ_free(_res_conv);
27444 }
27445
27446 static inline uint64_t COption_SecretKeyZ_clone_ptr(LDKCOption_SecretKeyZ *NONNULL_PTR arg) {
27447         LDKCOption_SecretKeyZ *ret_copy = MALLOC(sizeof(LDKCOption_SecretKeyZ), "LDKCOption_SecretKeyZ");
27448         *ret_copy = COption_SecretKeyZ_clone(arg);
27449         int64_t ret_ref = tag_ptr(ret_copy, true);
27450         return ret_ref;
27451 }
27452 int64_t  CS_LDK_COption_SecretKeyZ_clone_ptr(int64_t arg) {
27453         LDKCOption_SecretKeyZ* arg_conv = (LDKCOption_SecretKeyZ*)untag_ptr(arg);
27454         int64_t ret_conv = COption_SecretKeyZ_clone_ptr(arg_conv);
27455         return ret_conv;
27456 }
27457
27458 int64_t  CS_LDK_COption_SecretKeyZ_clone(int64_t orig) {
27459         LDKCOption_SecretKeyZ* orig_conv = (LDKCOption_SecretKeyZ*)untag_ptr(orig);
27460         LDKCOption_SecretKeyZ *ret_copy = MALLOC(sizeof(LDKCOption_SecretKeyZ), "LDKCOption_SecretKeyZ");
27461         *ret_copy = COption_SecretKeyZ_clone(orig_conv);
27462         int64_t ret_ref = tag_ptr(ret_copy, true);
27463         return ret_ref;
27464 }
27465
27466 int64_t  CS_LDK_CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_ok(int64_t o) {
27467         LDKInvoiceWithExplicitSigningPubkeyBuilder o_conv;
27468         o_conv.inner = untag_ptr(o);
27469         o_conv.is_owned = ptr_is_owned(o);
27470         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27471         // WARNING: we need a move here but no clone is available for LDKInvoiceWithExplicitSigningPubkeyBuilder
27472         
27473         LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ");
27474         *ret_conv = CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_ok(o_conv);
27475         return tag_ptr(ret_conv, true);
27476 }
27477
27478 int64_t  CS_LDK_CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_err(int32_t e) {
27479         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_cs(e);
27480         LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ");
27481         *ret_conv = CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_err(e_conv);
27482         return tag_ptr(ret_conv, true);
27483 }
27484
27485 jboolean  CS_LDK_CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_is_ok(int64_t o) {
27486         LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ* o_conv = (LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ*)untag_ptr(o);
27487         jboolean ret_conv = CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_is_ok(o_conv);
27488         return ret_conv;
27489 }
27490
27491 void  CS_LDK_CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_free(int64_t _res) {
27492         if (!ptr_is_owned(_res)) return;
27493         void* _res_ptr = untag_ptr(_res);
27494         CHECK_ACCESS(_res_ptr);
27495         LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ _res_conv = *(LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ*)(_res_ptr);
27496         FREE(untag_ptr(_res));
27497         CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_free(_res_conv);
27498 }
27499
27500 int64_t  CS_LDK_CResult_VerifiedInvoiceRequestNoneZ_ok(int64_t o) {
27501         LDKVerifiedInvoiceRequest o_conv;
27502         o_conv.inner = untag_ptr(o);
27503         o_conv.is_owned = ptr_is_owned(o);
27504         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27505         o_conv = VerifiedInvoiceRequest_clone(&o_conv);
27506         LDKCResult_VerifiedInvoiceRequestNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_VerifiedInvoiceRequestNoneZ), "LDKCResult_VerifiedInvoiceRequestNoneZ");
27507         *ret_conv = CResult_VerifiedInvoiceRequestNoneZ_ok(o_conv);
27508         return tag_ptr(ret_conv, true);
27509 }
27510
27511 int64_t  CS_LDK_CResult_VerifiedInvoiceRequestNoneZ_err() {
27512         LDKCResult_VerifiedInvoiceRequestNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_VerifiedInvoiceRequestNoneZ), "LDKCResult_VerifiedInvoiceRequestNoneZ");
27513         *ret_conv = CResult_VerifiedInvoiceRequestNoneZ_err();
27514         return tag_ptr(ret_conv, true);
27515 }
27516
27517 jboolean  CS_LDK_CResult_VerifiedInvoiceRequestNoneZ_is_ok(int64_t o) {
27518         LDKCResult_VerifiedInvoiceRequestNoneZ* o_conv = (LDKCResult_VerifiedInvoiceRequestNoneZ*)untag_ptr(o);
27519         jboolean ret_conv = CResult_VerifiedInvoiceRequestNoneZ_is_ok(o_conv);
27520         return ret_conv;
27521 }
27522
27523 void  CS_LDK_CResult_VerifiedInvoiceRequestNoneZ_free(int64_t _res) {
27524         if (!ptr_is_owned(_res)) return;
27525         void* _res_ptr = untag_ptr(_res);
27526         CHECK_ACCESS(_res_ptr);
27527         LDKCResult_VerifiedInvoiceRequestNoneZ _res_conv = *(LDKCResult_VerifiedInvoiceRequestNoneZ*)(_res_ptr);
27528         FREE(untag_ptr(_res));
27529         CResult_VerifiedInvoiceRequestNoneZ_free(_res_conv);
27530 }
27531
27532 static inline uint64_t CResult_VerifiedInvoiceRequestNoneZ_clone_ptr(LDKCResult_VerifiedInvoiceRequestNoneZ *NONNULL_PTR arg) {
27533         LDKCResult_VerifiedInvoiceRequestNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_VerifiedInvoiceRequestNoneZ), "LDKCResult_VerifiedInvoiceRequestNoneZ");
27534         *ret_conv = CResult_VerifiedInvoiceRequestNoneZ_clone(arg);
27535         return tag_ptr(ret_conv, true);
27536 }
27537 int64_t  CS_LDK_CResult_VerifiedInvoiceRequestNoneZ_clone_ptr(int64_t arg) {
27538         LDKCResult_VerifiedInvoiceRequestNoneZ* arg_conv = (LDKCResult_VerifiedInvoiceRequestNoneZ*)untag_ptr(arg);
27539         int64_t ret_conv = CResult_VerifiedInvoiceRequestNoneZ_clone_ptr(arg_conv);
27540         return ret_conv;
27541 }
27542
27543 int64_t  CS_LDK_CResult_VerifiedInvoiceRequestNoneZ_clone(int64_t orig) {
27544         LDKCResult_VerifiedInvoiceRequestNoneZ* orig_conv = (LDKCResult_VerifiedInvoiceRequestNoneZ*)untag_ptr(orig);
27545         LDKCResult_VerifiedInvoiceRequestNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_VerifiedInvoiceRequestNoneZ), "LDKCResult_VerifiedInvoiceRequestNoneZ");
27546         *ret_conv = CResult_VerifiedInvoiceRequestNoneZ_clone(orig_conv);
27547         return tag_ptr(ret_conv, true);
27548 }
27549
27550 int64_t  CS_LDK_CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_ok(int64_t o) {
27551         LDKInvoiceWithDerivedSigningPubkeyBuilder o_conv;
27552         o_conv.inner = untag_ptr(o);
27553         o_conv.is_owned = ptr_is_owned(o);
27554         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27555         // WARNING: we need a move here but no clone is available for LDKInvoiceWithDerivedSigningPubkeyBuilder
27556         
27557         LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ");
27558         *ret_conv = CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_ok(o_conv);
27559         return tag_ptr(ret_conv, true);
27560 }
27561
27562 int64_t  CS_LDK_CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_err(int32_t e) {
27563         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_cs(e);
27564         LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ");
27565         *ret_conv = CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_err(e_conv);
27566         return tag_ptr(ret_conv, true);
27567 }
27568
27569 jboolean  CS_LDK_CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_is_ok(int64_t o) {
27570         LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ* o_conv = (LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ*)untag_ptr(o);
27571         jboolean ret_conv = CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_is_ok(o_conv);
27572         return ret_conv;
27573 }
27574
27575 void  CS_LDK_CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_free(int64_t _res) {
27576         if (!ptr_is_owned(_res)) return;
27577         void* _res_ptr = untag_ptr(_res);
27578         CHECK_ACCESS(_res_ptr);
27579         LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ _res_conv = *(LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ*)(_res_ptr);
27580         FREE(untag_ptr(_res));
27581         CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_free(_res_conv);
27582 }
27583
27584 int64_t  CS_LDK_CResult_InvoiceRequestFieldsDecodeErrorZ_ok(int64_t o) {
27585         LDKInvoiceRequestFields o_conv;
27586         o_conv.inner = untag_ptr(o);
27587         o_conv.is_owned = ptr_is_owned(o);
27588         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27589         o_conv = InvoiceRequestFields_clone(&o_conv);
27590         LDKCResult_InvoiceRequestFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestFieldsDecodeErrorZ), "LDKCResult_InvoiceRequestFieldsDecodeErrorZ");
27591         *ret_conv = CResult_InvoiceRequestFieldsDecodeErrorZ_ok(o_conv);
27592         return tag_ptr(ret_conv, true);
27593 }
27594
27595 int64_t  CS_LDK_CResult_InvoiceRequestFieldsDecodeErrorZ_err(int64_t e) {
27596         void* e_ptr = untag_ptr(e);
27597         CHECK_ACCESS(e_ptr);
27598         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27599         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27600         LDKCResult_InvoiceRequestFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestFieldsDecodeErrorZ), "LDKCResult_InvoiceRequestFieldsDecodeErrorZ");
27601         *ret_conv = CResult_InvoiceRequestFieldsDecodeErrorZ_err(e_conv);
27602         return tag_ptr(ret_conv, true);
27603 }
27604
27605 jboolean  CS_LDK_CResult_InvoiceRequestFieldsDecodeErrorZ_is_ok(int64_t o) {
27606         LDKCResult_InvoiceRequestFieldsDecodeErrorZ* o_conv = (LDKCResult_InvoiceRequestFieldsDecodeErrorZ*)untag_ptr(o);
27607         jboolean ret_conv = CResult_InvoiceRequestFieldsDecodeErrorZ_is_ok(o_conv);
27608         return ret_conv;
27609 }
27610
27611 void  CS_LDK_CResult_InvoiceRequestFieldsDecodeErrorZ_free(int64_t _res) {
27612         if (!ptr_is_owned(_res)) return;
27613         void* _res_ptr = untag_ptr(_res);
27614         CHECK_ACCESS(_res_ptr);
27615         LDKCResult_InvoiceRequestFieldsDecodeErrorZ _res_conv = *(LDKCResult_InvoiceRequestFieldsDecodeErrorZ*)(_res_ptr);
27616         FREE(untag_ptr(_res));
27617         CResult_InvoiceRequestFieldsDecodeErrorZ_free(_res_conv);
27618 }
27619
27620 static inline uint64_t CResult_InvoiceRequestFieldsDecodeErrorZ_clone_ptr(LDKCResult_InvoiceRequestFieldsDecodeErrorZ *NONNULL_PTR arg) {
27621         LDKCResult_InvoiceRequestFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestFieldsDecodeErrorZ), "LDKCResult_InvoiceRequestFieldsDecodeErrorZ");
27622         *ret_conv = CResult_InvoiceRequestFieldsDecodeErrorZ_clone(arg);
27623         return tag_ptr(ret_conv, true);
27624 }
27625 int64_t  CS_LDK_CResult_InvoiceRequestFieldsDecodeErrorZ_clone_ptr(int64_t arg) {
27626         LDKCResult_InvoiceRequestFieldsDecodeErrorZ* arg_conv = (LDKCResult_InvoiceRequestFieldsDecodeErrorZ*)untag_ptr(arg);
27627         int64_t ret_conv = CResult_InvoiceRequestFieldsDecodeErrorZ_clone_ptr(arg_conv);
27628         return ret_conv;
27629 }
27630
27631 int64_t  CS_LDK_CResult_InvoiceRequestFieldsDecodeErrorZ_clone(int64_t orig) {
27632         LDKCResult_InvoiceRequestFieldsDecodeErrorZ* orig_conv = (LDKCResult_InvoiceRequestFieldsDecodeErrorZ*)untag_ptr(orig);
27633         LDKCResult_InvoiceRequestFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestFieldsDecodeErrorZ), "LDKCResult_InvoiceRequestFieldsDecodeErrorZ");
27634         *ret_conv = CResult_InvoiceRequestFieldsDecodeErrorZ_clone(orig_conv);
27635         return tag_ptr(ret_conv, true);
27636 }
27637
27638 int32_t  CS_LDK_COption_NoneZ_some() {
27639         int32_t ret_conv = LDKCOption_NoneZ_to_cs(COption_NoneZ_some());
27640         return ret_conv;
27641 }
27642
27643 int32_t  CS_LDK_COption_NoneZ_none() {
27644         int32_t ret_conv = LDKCOption_NoneZ_to_cs(COption_NoneZ_none());
27645         return ret_conv;
27646 }
27647
27648 void  CS_LDK_COption_NoneZ_free(int32_t _res) {
27649         LDKCOption_NoneZ _res_conv = LDKCOption_NoneZ_from_cs(_res);
27650         COption_NoneZ_free(_res_conv);
27651 }
27652
27653 void  CS_LDK_CVec_WitnessZ_free(ptrArray _res) {
27654         LDKCVec_WitnessZ _res_constr;
27655         _res_constr.datalen = _res->arr_len;
27656         if (_res_constr.datalen > 0)
27657                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKWitness), "LDKCVec_WitnessZ Elements");
27658         else
27659                 _res_constr.data = NULL;
27660         int8_tArray* _res_vals = (void*) _res->elems;
27661         for (size_t i = 0; i < _res_constr.datalen; i++) {
27662                 int8_tArray _res_conv_8 = _res_vals[i];
27663                 LDKWitness _res_conv_8_ref;
27664                 _res_conv_8_ref.datalen = _res_conv_8->arr_len;
27665                 _res_conv_8_ref.data = MALLOC(_res_conv_8_ref.datalen, "LDKWitness Bytes");
27666                 memcpy(_res_conv_8_ref.data, _res_conv_8->elems, _res_conv_8_ref.datalen); FREE(_res_conv_8);
27667                 _res_conv_8_ref.data_is_owned = true;
27668                 _res_constr.data[i] = _res_conv_8_ref;
27669         }
27670         FREE(_res);
27671         CVec_WitnessZ_free(_res_constr);
27672 }
27673
27674 int64_t  CS_LDK_COption_ECDSASignatureZ_some(int8_tArray o) {
27675         LDKECDSASignature o_ref;
27676         CHECK(o->arr_len == 64);
27677         memcpy(o_ref.compact_form, o->elems, 64); FREE(o);
27678         LDKCOption_ECDSASignatureZ *ret_copy = MALLOC(sizeof(LDKCOption_ECDSASignatureZ), "LDKCOption_ECDSASignatureZ");
27679         *ret_copy = COption_ECDSASignatureZ_some(o_ref);
27680         int64_t ret_ref = tag_ptr(ret_copy, true);
27681         return ret_ref;
27682 }
27683
27684 int64_t  CS_LDK_COption_ECDSASignatureZ_none() {
27685         LDKCOption_ECDSASignatureZ *ret_copy = MALLOC(sizeof(LDKCOption_ECDSASignatureZ), "LDKCOption_ECDSASignatureZ");
27686         *ret_copy = COption_ECDSASignatureZ_none();
27687         int64_t ret_ref = tag_ptr(ret_copy, true);
27688         return ret_ref;
27689 }
27690
27691 void  CS_LDK_COption_ECDSASignatureZ_free(int64_t _res) {
27692         if (!ptr_is_owned(_res)) return;
27693         void* _res_ptr = untag_ptr(_res);
27694         CHECK_ACCESS(_res_ptr);
27695         LDKCOption_ECDSASignatureZ _res_conv = *(LDKCOption_ECDSASignatureZ*)(_res_ptr);
27696         FREE(untag_ptr(_res));
27697         COption_ECDSASignatureZ_free(_res_conv);
27698 }
27699
27700 static inline uint64_t COption_ECDSASignatureZ_clone_ptr(LDKCOption_ECDSASignatureZ *NONNULL_PTR arg) {
27701         LDKCOption_ECDSASignatureZ *ret_copy = MALLOC(sizeof(LDKCOption_ECDSASignatureZ), "LDKCOption_ECDSASignatureZ");
27702         *ret_copy = COption_ECDSASignatureZ_clone(arg);
27703         int64_t ret_ref = tag_ptr(ret_copy, true);
27704         return ret_ref;
27705 }
27706 int64_t  CS_LDK_COption_ECDSASignatureZ_clone_ptr(int64_t arg) {
27707         LDKCOption_ECDSASignatureZ* arg_conv = (LDKCOption_ECDSASignatureZ*)untag_ptr(arg);
27708         int64_t ret_conv = COption_ECDSASignatureZ_clone_ptr(arg_conv);
27709         return ret_conv;
27710 }
27711
27712 int64_t  CS_LDK_COption_ECDSASignatureZ_clone(int64_t orig) {
27713         LDKCOption_ECDSASignatureZ* orig_conv = (LDKCOption_ECDSASignatureZ*)untag_ptr(orig);
27714         LDKCOption_ECDSASignatureZ *ret_copy = MALLOC(sizeof(LDKCOption_ECDSASignatureZ), "LDKCOption_ECDSASignatureZ");
27715         *ret_copy = COption_ECDSASignatureZ_clone(orig_conv);
27716         int64_t ret_ref = tag_ptr(ret_copy, true);
27717         return ret_ref;
27718 }
27719
27720 int64_t  CS_LDK_COption_i64Z_some(int64_t o) {
27721         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
27722         *ret_copy = COption_i64Z_some(o);
27723         int64_t ret_ref = tag_ptr(ret_copy, true);
27724         return ret_ref;
27725 }
27726
27727 int64_t  CS_LDK_COption_i64Z_none() {
27728         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
27729         *ret_copy = COption_i64Z_none();
27730         int64_t ret_ref = tag_ptr(ret_copy, true);
27731         return ret_ref;
27732 }
27733
27734 void  CS_LDK_COption_i64Z_free(int64_t _res) {
27735         if (!ptr_is_owned(_res)) return;
27736         void* _res_ptr = untag_ptr(_res);
27737         CHECK_ACCESS(_res_ptr);
27738         LDKCOption_i64Z _res_conv = *(LDKCOption_i64Z*)(_res_ptr);
27739         FREE(untag_ptr(_res));
27740         COption_i64Z_free(_res_conv);
27741 }
27742
27743 static inline uint64_t COption_i64Z_clone_ptr(LDKCOption_i64Z *NONNULL_PTR arg) {
27744         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
27745         *ret_copy = COption_i64Z_clone(arg);
27746         int64_t ret_ref = tag_ptr(ret_copy, true);
27747         return ret_ref;
27748 }
27749 int64_t  CS_LDK_COption_i64Z_clone_ptr(int64_t arg) {
27750         LDKCOption_i64Z* arg_conv = (LDKCOption_i64Z*)untag_ptr(arg);
27751         int64_t ret_conv = COption_i64Z_clone_ptr(arg_conv);
27752         return ret_conv;
27753 }
27754
27755 int64_t  CS_LDK_COption_i64Z_clone(int64_t orig) {
27756         LDKCOption_i64Z* orig_conv = (LDKCOption_i64Z*)untag_ptr(orig);
27757         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
27758         *ret_copy = COption_i64Z_clone(orig_conv);
27759         int64_t ret_ref = tag_ptr(ret_copy, true);
27760         return ret_ref;
27761 }
27762
27763 int64_t  CS_LDK_CResult_SocketAddressDecodeErrorZ_ok(int64_t o) {
27764         void* o_ptr = untag_ptr(o);
27765         CHECK_ACCESS(o_ptr);
27766         LDKSocketAddress o_conv = *(LDKSocketAddress*)(o_ptr);
27767         o_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(o));
27768         LDKCResult_SocketAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressDecodeErrorZ), "LDKCResult_SocketAddressDecodeErrorZ");
27769         *ret_conv = CResult_SocketAddressDecodeErrorZ_ok(o_conv);
27770         return tag_ptr(ret_conv, true);
27771 }
27772
27773 int64_t  CS_LDK_CResult_SocketAddressDecodeErrorZ_err(int64_t e) {
27774         void* e_ptr = untag_ptr(e);
27775         CHECK_ACCESS(e_ptr);
27776         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27777         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27778         LDKCResult_SocketAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressDecodeErrorZ), "LDKCResult_SocketAddressDecodeErrorZ");
27779         *ret_conv = CResult_SocketAddressDecodeErrorZ_err(e_conv);
27780         return tag_ptr(ret_conv, true);
27781 }
27782
27783 jboolean  CS_LDK_CResult_SocketAddressDecodeErrorZ_is_ok(int64_t o) {
27784         LDKCResult_SocketAddressDecodeErrorZ* o_conv = (LDKCResult_SocketAddressDecodeErrorZ*)untag_ptr(o);
27785         jboolean ret_conv = CResult_SocketAddressDecodeErrorZ_is_ok(o_conv);
27786         return ret_conv;
27787 }
27788
27789 void  CS_LDK_CResult_SocketAddressDecodeErrorZ_free(int64_t _res) {
27790         if (!ptr_is_owned(_res)) return;
27791         void* _res_ptr = untag_ptr(_res);
27792         CHECK_ACCESS(_res_ptr);
27793         LDKCResult_SocketAddressDecodeErrorZ _res_conv = *(LDKCResult_SocketAddressDecodeErrorZ*)(_res_ptr);
27794         FREE(untag_ptr(_res));
27795         CResult_SocketAddressDecodeErrorZ_free(_res_conv);
27796 }
27797
27798 static inline uint64_t CResult_SocketAddressDecodeErrorZ_clone_ptr(LDKCResult_SocketAddressDecodeErrorZ *NONNULL_PTR arg) {
27799         LDKCResult_SocketAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressDecodeErrorZ), "LDKCResult_SocketAddressDecodeErrorZ");
27800         *ret_conv = CResult_SocketAddressDecodeErrorZ_clone(arg);
27801         return tag_ptr(ret_conv, true);
27802 }
27803 int64_t  CS_LDK_CResult_SocketAddressDecodeErrorZ_clone_ptr(int64_t arg) {
27804         LDKCResult_SocketAddressDecodeErrorZ* arg_conv = (LDKCResult_SocketAddressDecodeErrorZ*)untag_ptr(arg);
27805         int64_t ret_conv = CResult_SocketAddressDecodeErrorZ_clone_ptr(arg_conv);
27806         return ret_conv;
27807 }
27808
27809 int64_t  CS_LDK_CResult_SocketAddressDecodeErrorZ_clone(int64_t orig) {
27810         LDKCResult_SocketAddressDecodeErrorZ* orig_conv = (LDKCResult_SocketAddressDecodeErrorZ*)untag_ptr(orig);
27811         LDKCResult_SocketAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressDecodeErrorZ), "LDKCResult_SocketAddressDecodeErrorZ");
27812         *ret_conv = CResult_SocketAddressDecodeErrorZ_clone(orig_conv);
27813         return tag_ptr(ret_conv, true);
27814 }
27815
27816 int64_t  CS_LDK_CResult_SocketAddressSocketAddressParseErrorZ_ok(int64_t o) {
27817         void* o_ptr = untag_ptr(o);
27818         CHECK_ACCESS(o_ptr);
27819         LDKSocketAddress o_conv = *(LDKSocketAddress*)(o_ptr);
27820         o_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(o));
27821         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
27822         *ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_ok(o_conv);
27823         return tag_ptr(ret_conv, true);
27824 }
27825
27826 int64_t  CS_LDK_CResult_SocketAddressSocketAddressParseErrorZ_err(int32_t e) {
27827         LDKSocketAddressParseError e_conv = LDKSocketAddressParseError_from_cs(e);
27828         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
27829         *ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_err(e_conv);
27830         return tag_ptr(ret_conv, true);
27831 }
27832
27833 jboolean  CS_LDK_CResult_SocketAddressSocketAddressParseErrorZ_is_ok(int64_t o) {
27834         LDKCResult_SocketAddressSocketAddressParseErrorZ* o_conv = (LDKCResult_SocketAddressSocketAddressParseErrorZ*)untag_ptr(o);
27835         jboolean ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_is_ok(o_conv);
27836         return ret_conv;
27837 }
27838
27839 void  CS_LDK_CResult_SocketAddressSocketAddressParseErrorZ_free(int64_t _res) {
27840         if (!ptr_is_owned(_res)) return;
27841         void* _res_ptr = untag_ptr(_res);
27842         CHECK_ACCESS(_res_ptr);
27843         LDKCResult_SocketAddressSocketAddressParseErrorZ _res_conv = *(LDKCResult_SocketAddressSocketAddressParseErrorZ*)(_res_ptr);
27844         FREE(untag_ptr(_res));
27845         CResult_SocketAddressSocketAddressParseErrorZ_free(_res_conv);
27846 }
27847
27848 static inline uint64_t CResult_SocketAddressSocketAddressParseErrorZ_clone_ptr(LDKCResult_SocketAddressSocketAddressParseErrorZ *NONNULL_PTR arg) {
27849         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
27850         *ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_clone(arg);
27851         return tag_ptr(ret_conv, true);
27852 }
27853 int64_t  CS_LDK_CResult_SocketAddressSocketAddressParseErrorZ_clone_ptr(int64_t arg) {
27854         LDKCResult_SocketAddressSocketAddressParseErrorZ* arg_conv = (LDKCResult_SocketAddressSocketAddressParseErrorZ*)untag_ptr(arg);
27855         int64_t ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_clone_ptr(arg_conv);
27856         return ret_conv;
27857 }
27858
27859 int64_t  CS_LDK_CResult_SocketAddressSocketAddressParseErrorZ_clone(int64_t orig) {
27860         LDKCResult_SocketAddressSocketAddressParseErrorZ* orig_conv = (LDKCResult_SocketAddressSocketAddressParseErrorZ*)untag_ptr(orig);
27861         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
27862         *ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_clone(orig_conv);
27863         return tag_ptr(ret_conv, true);
27864 }
27865
27866 void  CS_LDK_CVec_UpdateAddHTLCZ_free(int64_tArray _res) {
27867         LDKCVec_UpdateAddHTLCZ _res_constr;
27868         _res_constr.datalen = _res->arr_len;
27869         if (_res_constr.datalen > 0)
27870                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
27871         else
27872                 _res_constr.data = NULL;
27873         int64_t* _res_vals = _res->elems;
27874         for (size_t p = 0; p < _res_constr.datalen; p++) {
27875                 int64_t _res_conv_15 = _res_vals[p];
27876                 LDKUpdateAddHTLC _res_conv_15_conv;
27877                 _res_conv_15_conv.inner = untag_ptr(_res_conv_15);
27878                 _res_conv_15_conv.is_owned = ptr_is_owned(_res_conv_15);
27879                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_15_conv);
27880                 _res_constr.data[p] = _res_conv_15_conv;
27881         }
27882         FREE(_res);
27883         CVec_UpdateAddHTLCZ_free(_res_constr);
27884 }
27885
27886 void  CS_LDK_CVec_UpdateFulfillHTLCZ_free(int64_tArray _res) {
27887         LDKCVec_UpdateFulfillHTLCZ _res_constr;
27888         _res_constr.datalen = _res->arr_len;
27889         if (_res_constr.datalen > 0)
27890                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
27891         else
27892                 _res_constr.data = NULL;
27893         int64_t* _res_vals = _res->elems;
27894         for (size_t t = 0; t < _res_constr.datalen; t++) {
27895                 int64_t _res_conv_19 = _res_vals[t];
27896                 LDKUpdateFulfillHTLC _res_conv_19_conv;
27897                 _res_conv_19_conv.inner = untag_ptr(_res_conv_19);
27898                 _res_conv_19_conv.is_owned = ptr_is_owned(_res_conv_19);
27899                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv);
27900                 _res_constr.data[t] = _res_conv_19_conv;
27901         }
27902         FREE(_res);
27903         CVec_UpdateFulfillHTLCZ_free(_res_constr);
27904 }
27905
27906 void  CS_LDK_CVec_UpdateFailHTLCZ_free(int64_tArray _res) {
27907         LDKCVec_UpdateFailHTLCZ _res_constr;
27908         _res_constr.datalen = _res->arr_len;
27909         if (_res_constr.datalen > 0)
27910                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
27911         else
27912                 _res_constr.data = NULL;
27913         int64_t* _res_vals = _res->elems;
27914         for (size_t q = 0; q < _res_constr.datalen; q++) {
27915                 int64_t _res_conv_16 = _res_vals[q];
27916                 LDKUpdateFailHTLC _res_conv_16_conv;
27917                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
27918                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
27919                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
27920                 _res_constr.data[q] = _res_conv_16_conv;
27921         }
27922         FREE(_res);
27923         CVec_UpdateFailHTLCZ_free(_res_constr);
27924 }
27925
27926 void  CS_LDK_CVec_UpdateFailMalformedHTLCZ_free(int64_tArray _res) {
27927         LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
27928         _res_constr.datalen = _res->arr_len;
27929         if (_res_constr.datalen > 0)
27930                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
27931         else
27932                 _res_constr.data = NULL;
27933         int64_t* _res_vals = _res->elems;
27934         for (size_t z = 0; z < _res_constr.datalen; z++) {
27935                 int64_t _res_conv_25 = _res_vals[z];
27936                 LDKUpdateFailMalformedHTLC _res_conv_25_conv;
27937                 _res_conv_25_conv.inner = untag_ptr(_res_conv_25);
27938                 _res_conv_25_conv.is_owned = ptr_is_owned(_res_conv_25);
27939                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_25_conv);
27940                 _res_constr.data[z] = _res_conv_25_conv;
27941         }
27942         FREE(_res);
27943         CVec_UpdateFailMalformedHTLCZ_free(_res_constr);
27944 }
27945
27946 int64_t  CS_LDK_CResult_AcceptChannelDecodeErrorZ_ok(int64_t o) {
27947         LDKAcceptChannel o_conv;
27948         o_conv.inner = untag_ptr(o);
27949         o_conv.is_owned = ptr_is_owned(o);
27950         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27951         o_conv = AcceptChannel_clone(&o_conv);
27952         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
27953         *ret_conv = CResult_AcceptChannelDecodeErrorZ_ok(o_conv);
27954         return tag_ptr(ret_conv, true);
27955 }
27956
27957 int64_t  CS_LDK_CResult_AcceptChannelDecodeErrorZ_err(int64_t e) {
27958         void* e_ptr = untag_ptr(e);
27959         CHECK_ACCESS(e_ptr);
27960         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27961         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27962         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
27963         *ret_conv = CResult_AcceptChannelDecodeErrorZ_err(e_conv);
27964         return tag_ptr(ret_conv, true);
27965 }
27966
27967 jboolean  CS_LDK_CResult_AcceptChannelDecodeErrorZ_is_ok(int64_t o) {
27968         LDKCResult_AcceptChannelDecodeErrorZ* o_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(o);
27969         jboolean ret_conv = CResult_AcceptChannelDecodeErrorZ_is_ok(o_conv);
27970         return ret_conv;
27971 }
27972
27973 void  CS_LDK_CResult_AcceptChannelDecodeErrorZ_free(int64_t _res) {
27974         if (!ptr_is_owned(_res)) return;
27975         void* _res_ptr = untag_ptr(_res);
27976         CHECK_ACCESS(_res_ptr);
27977         LDKCResult_AcceptChannelDecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelDecodeErrorZ*)(_res_ptr);
27978         FREE(untag_ptr(_res));
27979         CResult_AcceptChannelDecodeErrorZ_free(_res_conv);
27980 }
27981
27982 static inline uint64_t CResult_AcceptChannelDecodeErrorZ_clone_ptr(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR arg) {
27983         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
27984         *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(arg);
27985         return tag_ptr(ret_conv, true);
27986 }
27987 int64_t  CS_LDK_CResult_AcceptChannelDecodeErrorZ_clone_ptr(int64_t arg) {
27988         LDKCResult_AcceptChannelDecodeErrorZ* arg_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(arg);
27989         int64_t ret_conv = CResult_AcceptChannelDecodeErrorZ_clone_ptr(arg_conv);
27990         return ret_conv;
27991 }
27992
27993 int64_t  CS_LDK_CResult_AcceptChannelDecodeErrorZ_clone(int64_t orig) {
27994         LDKCResult_AcceptChannelDecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(orig);
27995         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
27996         *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(orig_conv);
27997         return tag_ptr(ret_conv, true);
27998 }
27999
28000 int64_t  CS_LDK_CResult_AcceptChannelV2DecodeErrorZ_ok(int64_t o) {
28001         LDKAcceptChannelV2 o_conv;
28002         o_conv.inner = untag_ptr(o);
28003         o_conv.is_owned = ptr_is_owned(o);
28004         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28005         o_conv = AcceptChannelV2_clone(&o_conv);
28006         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
28007         *ret_conv = CResult_AcceptChannelV2DecodeErrorZ_ok(o_conv);
28008         return tag_ptr(ret_conv, true);
28009 }
28010
28011 int64_t  CS_LDK_CResult_AcceptChannelV2DecodeErrorZ_err(int64_t e) {
28012         void* e_ptr = untag_ptr(e);
28013         CHECK_ACCESS(e_ptr);
28014         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28015         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28016         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
28017         *ret_conv = CResult_AcceptChannelV2DecodeErrorZ_err(e_conv);
28018         return tag_ptr(ret_conv, true);
28019 }
28020
28021 jboolean  CS_LDK_CResult_AcceptChannelV2DecodeErrorZ_is_ok(int64_t o) {
28022         LDKCResult_AcceptChannelV2DecodeErrorZ* o_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(o);
28023         jboolean ret_conv = CResult_AcceptChannelV2DecodeErrorZ_is_ok(o_conv);
28024         return ret_conv;
28025 }
28026
28027 void  CS_LDK_CResult_AcceptChannelV2DecodeErrorZ_free(int64_t _res) {
28028         if (!ptr_is_owned(_res)) return;
28029         void* _res_ptr = untag_ptr(_res);
28030         CHECK_ACCESS(_res_ptr);
28031         LDKCResult_AcceptChannelV2DecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelV2DecodeErrorZ*)(_res_ptr);
28032         FREE(untag_ptr(_res));
28033         CResult_AcceptChannelV2DecodeErrorZ_free(_res_conv);
28034 }
28035
28036 static inline uint64_t CResult_AcceptChannelV2DecodeErrorZ_clone_ptr(LDKCResult_AcceptChannelV2DecodeErrorZ *NONNULL_PTR arg) {
28037         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
28038         *ret_conv = CResult_AcceptChannelV2DecodeErrorZ_clone(arg);
28039         return tag_ptr(ret_conv, true);
28040 }
28041 int64_t  CS_LDK_CResult_AcceptChannelV2DecodeErrorZ_clone_ptr(int64_t arg) {
28042         LDKCResult_AcceptChannelV2DecodeErrorZ* arg_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(arg);
28043         int64_t ret_conv = CResult_AcceptChannelV2DecodeErrorZ_clone_ptr(arg_conv);
28044         return ret_conv;
28045 }
28046
28047 int64_t  CS_LDK_CResult_AcceptChannelV2DecodeErrorZ_clone(int64_t orig) {
28048         LDKCResult_AcceptChannelV2DecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(orig);
28049         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
28050         *ret_conv = CResult_AcceptChannelV2DecodeErrorZ_clone(orig_conv);
28051         return tag_ptr(ret_conv, true);
28052 }
28053
28054 int64_t  CS_LDK_CResult_StfuDecodeErrorZ_ok(int64_t o) {
28055         LDKStfu o_conv;
28056         o_conv.inner = untag_ptr(o);
28057         o_conv.is_owned = ptr_is_owned(o);
28058         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28059         o_conv = Stfu_clone(&o_conv);
28060         LDKCResult_StfuDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StfuDecodeErrorZ), "LDKCResult_StfuDecodeErrorZ");
28061         *ret_conv = CResult_StfuDecodeErrorZ_ok(o_conv);
28062         return tag_ptr(ret_conv, true);
28063 }
28064
28065 int64_t  CS_LDK_CResult_StfuDecodeErrorZ_err(int64_t e) {
28066         void* e_ptr = untag_ptr(e);
28067         CHECK_ACCESS(e_ptr);
28068         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28069         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28070         LDKCResult_StfuDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StfuDecodeErrorZ), "LDKCResult_StfuDecodeErrorZ");
28071         *ret_conv = CResult_StfuDecodeErrorZ_err(e_conv);
28072         return tag_ptr(ret_conv, true);
28073 }
28074
28075 jboolean  CS_LDK_CResult_StfuDecodeErrorZ_is_ok(int64_t o) {
28076         LDKCResult_StfuDecodeErrorZ* o_conv = (LDKCResult_StfuDecodeErrorZ*)untag_ptr(o);
28077         jboolean ret_conv = CResult_StfuDecodeErrorZ_is_ok(o_conv);
28078         return ret_conv;
28079 }
28080
28081 void  CS_LDK_CResult_StfuDecodeErrorZ_free(int64_t _res) {
28082         if (!ptr_is_owned(_res)) return;
28083         void* _res_ptr = untag_ptr(_res);
28084         CHECK_ACCESS(_res_ptr);
28085         LDKCResult_StfuDecodeErrorZ _res_conv = *(LDKCResult_StfuDecodeErrorZ*)(_res_ptr);
28086         FREE(untag_ptr(_res));
28087         CResult_StfuDecodeErrorZ_free(_res_conv);
28088 }
28089
28090 static inline uint64_t CResult_StfuDecodeErrorZ_clone_ptr(LDKCResult_StfuDecodeErrorZ *NONNULL_PTR arg) {
28091         LDKCResult_StfuDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StfuDecodeErrorZ), "LDKCResult_StfuDecodeErrorZ");
28092         *ret_conv = CResult_StfuDecodeErrorZ_clone(arg);
28093         return tag_ptr(ret_conv, true);
28094 }
28095 int64_t  CS_LDK_CResult_StfuDecodeErrorZ_clone_ptr(int64_t arg) {
28096         LDKCResult_StfuDecodeErrorZ* arg_conv = (LDKCResult_StfuDecodeErrorZ*)untag_ptr(arg);
28097         int64_t ret_conv = CResult_StfuDecodeErrorZ_clone_ptr(arg_conv);
28098         return ret_conv;
28099 }
28100
28101 int64_t  CS_LDK_CResult_StfuDecodeErrorZ_clone(int64_t orig) {
28102         LDKCResult_StfuDecodeErrorZ* orig_conv = (LDKCResult_StfuDecodeErrorZ*)untag_ptr(orig);
28103         LDKCResult_StfuDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StfuDecodeErrorZ), "LDKCResult_StfuDecodeErrorZ");
28104         *ret_conv = CResult_StfuDecodeErrorZ_clone(orig_conv);
28105         return tag_ptr(ret_conv, true);
28106 }
28107
28108 int64_t  CS_LDK_CResult_SpliceDecodeErrorZ_ok(int64_t o) {
28109         LDKSplice o_conv;
28110         o_conv.inner = untag_ptr(o);
28111         o_conv.is_owned = ptr_is_owned(o);
28112         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28113         o_conv = Splice_clone(&o_conv);
28114         LDKCResult_SpliceDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceDecodeErrorZ), "LDKCResult_SpliceDecodeErrorZ");
28115         *ret_conv = CResult_SpliceDecodeErrorZ_ok(o_conv);
28116         return tag_ptr(ret_conv, true);
28117 }
28118
28119 int64_t  CS_LDK_CResult_SpliceDecodeErrorZ_err(int64_t e) {
28120         void* e_ptr = untag_ptr(e);
28121         CHECK_ACCESS(e_ptr);
28122         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28123         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28124         LDKCResult_SpliceDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceDecodeErrorZ), "LDKCResult_SpliceDecodeErrorZ");
28125         *ret_conv = CResult_SpliceDecodeErrorZ_err(e_conv);
28126         return tag_ptr(ret_conv, true);
28127 }
28128
28129 jboolean  CS_LDK_CResult_SpliceDecodeErrorZ_is_ok(int64_t o) {
28130         LDKCResult_SpliceDecodeErrorZ* o_conv = (LDKCResult_SpliceDecodeErrorZ*)untag_ptr(o);
28131         jboolean ret_conv = CResult_SpliceDecodeErrorZ_is_ok(o_conv);
28132         return ret_conv;
28133 }
28134
28135 void  CS_LDK_CResult_SpliceDecodeErrorZ_free(int64_t _res) {
28136         if (!ptr_is_owned(_res)) return;
28137         void* _res_ptr = untag_ptr(_res);
28138         CHECK_ACCESS(_res_ptr);
28139         LDKCResult_SpliceDecodeErrorZ _res_conv = *(LDKCResult_SpliceDecodeErrorZ*)(_res_ptr);
28140         FREE(untag_ptr(_res));
28141         CResult_SpliceDecodeErrorZ_free(_res_conv);
28142 }
28143
28144 static inline uint64_t CResult_SpliceDecodeErrorZ_clone_ptr(LDKCResult_SpliceDecodeErrorZ *NONNULL_PTR arg) {
28145         LDKCResult_SpliceDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceDecodeErrorZ), "LDKCResult_SpliceDecodeErrorZ");
28146         *ret_conv = CResult_SpliceDecodeErrorZ_clone(arg);
28147         return tag_ptr(ret_conv, true);
28148 }
28149 int64_t  CS_LDK_CResult_SpliceDecodeErrorZ_clone_ptr(int64_t arg) {
28150         LDKCResult_SpliceDecodeErrorZ* arg_conv = (LDKCResult_SpliceDecodeErrorZ*)untag_ptr(arg);
28151         int64_t ret_conv = CResult_SpliceDecodeErrorZ_clone_ptr(arg_conv);
28152         return ret_conv;
28153 }
28154
28155 int64_t  CS_LDK_CResult_SpliceDecodeErrorZ_clone(int64_t orig) {
28156         LDKCResult_SpliceDecodeErrorZ* orig_conv = (LDKCResult_SpliceDecodeErrorZ*)untag_ptr(orig);
28157         LDKCResult_SpliceDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceDecodeErrorZ), "LDKCResult_SpliceDecodeErrorZ");
28158         *ret_conv = CResult_SpliceDecodeErrorZ_clone(orig_conv);
28159         return tag_ptr(ret_conv, true);
28160 }
28161
28162 int64_t  CS_LDK_CResult_SpliceAckDecodeErrorZ_ok(int64_t o) {
28163         LDKSpliceAck o_conv;
28164         o_conv.inner = untag_ptr(o);
28165         o_conv.is_owned = ptr_is_owned(o);
28166         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28167         o_conv = SpliceAck_clone(&o_conv);
28168         LDKCResult_SpliceAckDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceAckDecodeErrorZ), "LDKCResult_SpliceAckDecodeErrorZ");
28169         *ret_conv = CResult_SpliceAckDecodeErrorZ_ok(o_conv);
28170         return tag_ptr(ret_conv, true);
28171 }
28172
28173 int64_t  CS_LDK_CResult_SpliceAckDecodeErrorZ_err(int64_t e) {
28174         void* e_ptr = untag_ptr(e);
28175         CHECK_ACCESS(e_ptr);
28176         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28177         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28178         LDKCResult_SpliceAckDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceAckDecodeErrorZ), "LDKCResult_SpliceAckDecodeErrorZ");
28179         *ret_conv = CResult_SpliceAckDecodeErrorZ_err(e_conv);
28180         return tag_ptr(ret_conv, true);
28181 }
28182
28183 jboolean  CS_LDK_CResult_SpliceAckDecodeErrorZ_is_ok(int64_t o) {
28184         LDKCResult_SpliceAckDecodeErrorZ* o_conv = (LDKCResult_SpliceAckDecodeErrorZ*)untag_ptr(o);
28185         jboolean ret_conv = CResult_SpliceAckDecodeErrorZ_is_ok(o_conv);
28186         return ret_conv;
28187 }
28188
28189 void  CS_LDK_CResult_SpliceAckDecodeErrorZ_free(int64_t _res) {
28190         if (!ptr_is_owned(_res)) return;
28191         void* _res_ptr = untag_ptr(_res);
28192         CHECK_ACCESS(_res_ptr);
28193         LDKCResult_SpliceAckDecodeErrorZ _res_conv = *(LDKCResult_SpliceAckDecodeErrorZ*)(_res_ptr);
28194         FREE(untag_ptr(_res));
28195         CResult_SpliceAckDecodeErrorZ_free(_res_conv);
28196 }
28197
28198 static inline uint64_t CResult_SpliceAckDecodeErrorZ_clone_ptr(LDKCResult_SpliceAckDecodeErrorZ *NONNULL_PTR arg) {
28199         LDKCResult_SpliceAckDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceAckDecodeErrorZ), "LDKCResult_SpliceAckDecodeErrorZ");
28200         *ret_conv = CResult_SpliceAckDecodeErrorZ_clone(arg);
28201         return tag_ptr(ret_conv, true);
28202 }
28203 int64_t  CS_LDK_CResult_SpliceAckDecodeErrorZ_clone_ptr(int64_t arg) {
28204         LDKCResult_SpliceAckDecodeErrorZ* arg_conv = (LDKCResult_SpliceAckDecodeErrorZ*)untag_ptr(arg);
28205         int64_t ret_conv = CResult_SpliceAckDecodeErrorZ_clone_ptr(arg_conv);
28206         return ret_conv;
28207 }
28208
28209 int64_t  CS_LDK_CResult_SpliceAckDecodeErrorZ_clone(int64_t orig) {
28210         LDKCResult_SpliceAckDecodeErrorZ* orig_conv = (LDKCResult_SpliceAckDecodeErrorZ*)untag_ptr(orig);
28211         LDKCResult_SpliceAckDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceAckDecodeErrorZ), "LDKCResult_SpliceAckDecodeErrorZ");
28212         *ret_conv = CResult_SpliceAckDecodeErrorZ_clone(orig_conv);
28213         return tag_ptr(ret_conv, true);
28214 }
28215
28216 int64_t  CS_LDK_CResult_SpliceLockedDecodeErrorZ_ok(int64_t o) {
28217         LDKSpliceLocked o_conv;
28218         o_conv.inner = untag_ptr(o);
28219         o_conv.is_owned = ptr_is_owned(o);
28220         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28221         o_conv = SpliceLocked_clone(&o_conv);
28222         LDKCResult_SpliceLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceLockedDecodeErrorZ), "LDKCResult_SpliceLockedDecodeErrorZ");
28223         *ret_conv = CResult_SpliceLockedDecodeErrorZ_ok(o_conv);
28224         return tag_ptr(ret_conv, true);
28225 }
28226
28227 int64_t  CS_LDK_CResult_SpliceLockedDecodeErrorZ_err(int64_t e) {
28228         void* e_ptr = untag_ptr(e);
28229         CHECK_ACCESS(e_ptr);
28230         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28231         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28232         LDKCResult_SpliceLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceLockedDecodeErrorZ), "LDKCResult_SpliceLockedDecodeErrorZ");
28233         *ret_conv = CResult_SpliceLockedDecodeErrorZ_err(e_conv);
28234         return tag_ptr(ret_conv, true);
28235 }
28236
28237 jboolean  CS_LDK_CResult_SpliceLockedDecodeErrorZ_is_ok(int64_t o) {
28238         LDKCResult_SpliceLockedDecodeErrorZ* o_conv = (LDKCResult_SpliceLockedDecodeErrorZ*)untag_ptr(o);
28239         jboolean ret_conv = CResult_SpliceLockedDecodeErrorZ_is_ok(o_conv);
28240         return ret_conv;
28241 }
28242
28243 void  CS_LDK_CResult_SpliceLockedDecodeErrorZ_free(int64_t _res) {
28244         if (!ptr_is_owned(_res)) return;
28245         void* _res_ptr = untag_ptr(_res);
28246         CHECK_ACCESS(_res_ptr);
28247         LDKCResult_SpliceLockedDecodeErrorZ _res_conv = *(LDKCResult_SpliceLockedDecodeErrorZ*)(_res_ptr);
28248         FREE(untag_ptr(_res));
28249         CResult_SpliceLockedDecodeErrorZ_free(_res_conv);
28250 }
28251
28252 static inline uint64_t CResult_SpliceLockedDecodeErrorZ_clone_ptr(LDKCResult_SpliceLockedDecodeErrorZ *NONNULL_PTR arg) {
28253         LDKCResult_SpliceLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceLockedDecodeErrorZ), "LDKCResult_SpliceLockedDecodeErrorZ");
28254         *ret_conv = CResult_SpliceLockedDecodeErrorZ_clone(arg);
28255         return tag_ptr(ret_conv, true);
28256 }
28257 int64_t  CS_LDK_CResult_SpliceLockedDecodeErrorZ_clone_ptr(int64_t arg) {
28258         LDKCResult_SpliceLockedDecodeErrorZ* arg_conv = (LDKCResult_SpliceLockedDecodeErrorZ*)untag_ptr(arg);
28259         int64_t ret_conv = CResult_SpliceLockedDecodeErrorZ_clone_ptr(arg_conv);
28260         return ret_conv;
28261 }
28262
28263 int64_t  CS_LDK_CResult_SpliceLockedDecodeErrorZ_clone(int64_t orig) {
28264         LDKCResult_SpliceLockedDecodeErrorZ* orig_conv = (LDKCResult_SpliceLockedDecodeErrorZ*)untag_ptr(orig);
28265         LDKCResult_SpliceLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceLockedDecodeErrorZ), "LDKCResult_SpliceLockedDecodeErrorZ");
28266         *ret_conv = CResult_SpliceLockedDecodeErrorZ_clone(orig_conv);
28267         return tag_ptr(ret_conv, true);
28268 }
28269
28270 int64_t  CS_LDK_CResult_TxAddInputDecodeErrorZ_ok(int64_t o) {
28271         LDKTxAddInput o_conv;
28272         o_conv.inner = untag_ptr(o);
28273         o_conv.is_owned = ptr_is_owned(o);
28274         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28275         o_conv = TxAddInput_clone(&o_conv);
28276         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
28277         *ret_conv = CResult_TxAddInputDecodeErrorZ_ok(o_conv);
28278         return tag_ptr(ret_conv, true);
28279 }
28280
28281 int64_t  CS_LDK_CResult_TxAddInputDecodeErrorZ_err(int64_t e) {
28282         void* e_ptr = untag_ptr(e);
28283         CHECK_ACCESS(e_ptr);
28284         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28285         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28286         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
28287         *ret_conv = CResult_TxAddInputDecodeErrorZ_err(e_conv);
28288         return tag_ptr(ret_conv, true);
28289 }
28290
28291 jboolean  CS_LDK_CResult_TxAddInputDecodeErrorZ_is_ok(int64_t o) {
28292         LDKCResult_TxAddInputDecodeErrorZ* o_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(o);
28293         jboolean ret_conv = CResult_TxAddInputDecodeErrorZ_is_ok(o_conv);
28294         return ret_conv;
28295 }
28296
28297 void  CS_LDK_CResult_TxAddInputDecodeErrorZ_free(int64_t _res) {
28298         if (!ptr_is_owned(_res)) return;
28299         void* _res_ptr = untag_ptr(_res);
28300         CHECK_ACCESS(_res_ptr);
28301         LDKCResult_TxAddInputDecodeErrorZ _res_conv = *(LDKCResult_TxAddInputDecodeErrorZ*)(_res_ptr);
28302         FREE(untag_ptr(_res));
28303         CResult_TxAddInputDecodeErrorZ_free(_res_conv);
28304 }
28305
28306 static inline uint64_t CResult_TxAddInputDecodeErrorZ_clone_ptr(LDKCResult_TxAddInputDecodeErrorZ *NONNULL_PTR arg) {
28307         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
28308         *ret_conv = CResult_TxAddInputDecodeErrorZ_clone(arg);
28309         return tag_ptr(ret_conv, true);
28310 }
28311 int64_t  CS_LDK_CResult_TxAddInputDecodeErrorZ_clone_ptr(int64_t arg) {
28312         LDKCResult_TxAddInputDecodeErrorZ* arg_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(arg);
28313         int64_t ret_conv = CResult_TxAddInputDecodeErrorZ_clone_ptr(arg_conv);
28314         return ret_conv;
28315 }
28316
28317 int64_t  CS_LDK_CResult_TxAddInputDecodeErrorZ_clone(int64_t orig) {
28318         LDKCResult_TxAddInputDecodeErrorZ* orig_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(orig);
28319         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
28320         *ret_conv = CResult_TxAddInputDecodeErrorZ_clone(orig_conv);
28321         return tag_ptr(ret_conv, true);
28322 }
28323
28324 int64_t  CS_LDK_CResult_TxAddOutputDecodeErrorZ_ok(int64_t o) {
28325         LDKTxAddOutput o_conv;
28326         o_conv.inner = untag_ptr(o);
28327         o_conv.is_owned = ptr_is_owned(o);
28328         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28329         o_conv = TxAddOutput_clone(&o_conv);
28330         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
28331         *ret_conv = CResult_TxAddOutputDecodeErrorZ_ok(o_conv);
28332         return tag_ptr(ret_conv, true);
28333 }
28334
28335 int64_t  CS_LDK_CResult_TxAddOutputDecodeErrorZ_err(int64_t e) {
28336         void* e_ptr = untag_ptr(e);
28337         CHECK_ACCESS(e_ptr);
28338         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28339         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28340         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
28341         *ret_conv = CResult_TxAddOutputDecodeErrorZ_err(e_conv);
28342         return tag_ptr(ret_conv, true);
28343 }
28344
28345 jboolean  CS_LDK_CResult_TxAddOutputDecodeErrorZ_is_ok(int64_t o) {
28346         LDKCResult_TxAddOutputDecodeErrorZ* o_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(o);
28347         jboolean ret_conv = CResult_TxAddOutputDecodeErrorZ_is_ok(o_conv);
28348         return ret_conv;
28349 }
28350
28351 void  CS_LDK_CResult_TxAddOutputDecodeErrorZ_free(int64_t _res) {
28352         if (!ptr_is_owned(_res)) return;
28353         void* _res_ptr = untag_ptr(_res);
28354         CHECK_ACCESS(_res_ptr);
28355         LDKCResult_TxAddOutputDecodeErrorZ _res_conv = *(LDKCResult_TxAddOutputDecodeErrorZ*)(_res_ptr);
28356         FREE(untag_ptr(_res));
28357         CResult_TxAddOutputDecodeErrorZ_free(_res_conv);
28358 }
28359
28360 static inline uint64_t CResult_TxAddOutputDecodeErrorZ_clone_ptr(LDKCResult_TxAddOutputDecodeErrorZ *NONNULL_PTR arg) {
28361         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
28362         *ret_conv = CResult_TxAddOutputDecodeErrorZ_clone(arg);
28363         return tag_ptr(ret_conv, true);
28364 }
28365 int64_t  CS_LDK_CResult_TxAddOutputDecodeErrorZ_clone_ptr(int64_t arg) {
28366         LDKCResult_TxAddOutputDecodeErrorZ* arg_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(arg);
28367         int64_t ret_conv = CResult_TxAddOutputDecodeErrorZ_clone_ptr(arg_conv);
28368         return ret_conv;
28369 }
28370
28371 int64_t  CS_LDK_CResult_TxAddOutputDecodeErrorZ_clone(int64_t orig) {
28372         LDKCResult_TxAddOutputDecodeErrorZ* orig_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(orig);
28373         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
28374         *ret_conv = CResult_TxAddOutputDecodeErrorZ_clone(orig_conv);
28375         return tag_ptr(ret_conv, true);
28376 }
28377
28378 int64_t  CS_LDK_CResult_TxRemoveInputDecodeErrorZ_ok(int64_t o) {
28379         LDKTxRemoveInput o_conv;
28380         o_conv.inner = untag_ptr(o);
28381         o_conv.is_owned = ptr_is_owned(o);
28382         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28383         o_conv = TxRemoveInput_clone(&o_conv);
28384         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
28385         *ret_conv = CResult_TxRemoveInputDecodeErrorZ_ok(o_conv);
28386         return tag_ptr(ret_conv, true);
28387 }
28388
28389 int64_t  CS_LDK_CResult_TxRemoveInputDecodeErrorZ_err(int64_t e) {
28390         void* e_ptr = untag_ptr(e);
28391         CHECK_ACCESS(e_ptr);
28392         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28393         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28394         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
28395         *ret_conv = CResult_TxRemoveInputDecodeErrorZ_err(e_conv);
28396         return tag_ptr(ret_conv, true);
28397 }
28398
28399 jboolean  CS_LDK_CResult_TxRemoveInputDecodeErrorZ_is_ok(int64_t o) {
28400         LDKCResult_TxRemoveInputDecodeErrorZ* o_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(o);
28401         jboolean ret_conv = CResult_TxRemoveInputDecodeErrorZ_is_ok(o_conv);
28402         return ret_conv;
28403 }
28404
28405 void  CS_LDK_CResult_TxRemoveInputDecodeErrorZ_free(int64_t _res) {
28406         if (!ptr_is_owned(_res)) return;
28407         void* _res_ptr = untag_ptr(_res);
28408         CHECK_ACCESS(_res_ptr);
28409         LDKCResult_TxRemoveInputDecodeErrorZ _res_conv = *(LDKCResult_TxRemoveInputDecodeErrorZ*)(_res_ptr);
28410         FREE(untag_ptr(_res));
28411         CResult_TxRemoveInputDecodeErrorZ_free(_res_conv);
28412 }
28413
28414 static inline uint64_t CResult_TxRemoveInputDecodeErrorZ_clone_ptr(LDKCResult_TxRemoveInputDecodeErrorZ *NONNULL_PTR arg) {
28415         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
28416         *ret_conv = CResult_TxRemoveInputDecodeErrorZ_clone(arg);
28417         return tag_ptr(ret_conv, true);
28418 }
28419 int64_t  CS_LDK_CResult_TxRemoveInputDecodeErrorZ_clone_ptr(int64_t arg) {
28420         LDKCResult_TxRemoveInputDecodeErrorZ* arg_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(arg);
28421         int64_t ret_conv = CResult_TxRemoveInputDecodeErrorZ_clone_ptr(arg_conv);
28422         return ret_conv;
28423 }
28424
28425 int64_t  CS_LDK_CResult_TxRemoveInputDecodeErrorZ_clone(int64_t orig) {
28426         LDKCResult_TxRemoveInputDecodeErrorZ* orig_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(orig);
28427         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
28428         *ret_conv = CResult_TxRemoveInputDecodeErrorZ_clone(orig_conv);
28429         return tag_ptr(ret_conv, true);
28430 }
28431
28432 int64_t  CS_LDK_CResult_TxRemoveOutputDecodeErrorZ_ok(int64_t o) {
28433         LDKTxRemoveOutput o_conv;
28434         o_conv.inner = untag_ptr(o);
28435         o_conv.is_owned = ptr_is_owned(o);
28436         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28437         o_conv = TxRemoveOutput_clone(&o_conv);
28438         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
28439         *ret_conv = CResult_TxRemoveOutputDecodeErrorZ_ok(o_conv);
28440         return tag_ptr(ret_conv, true);
28441 }
28442
28443 int64_t  CS_LDK_CResult_TxRemoveOutputDecodeErrorZ_err(int64_t e) {
28444         void* e_ptr = untag_ptr(e);
28445         CHECK_ACCESS(e_ptr);
28446         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28447         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28448         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
28449         *ret_conv = CResult_TxRemoveOutputDecodeErrorZ_err(e_conv);
28450         return tag_ptr(ret_conv, true);
28451 }
28452
28453 jboolean  CS_LDK_CResult_TxRemoveOutputDecodeErrorZ_is_ok(int64_t o) {
28454         LDKCResult_TxRemoveOutputDecodeErrorZ* o_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(o);
28455         jboolean ret_conv = CResult_TxRemoveOutputDecodeErrorZ_is_ok(o_conv);
28456         return ret_conv;
28457 }
28458
28459 void  CS_LDK_CResult_TxRemoveOutputDecodeErrorZ_free(int64_t _res) {
28460         if (!ptr_is_owned(_res)) return;
28461         void* _res_ptr = untag_ptr(_res);
28462         CHECK_ACCESS(_res_ptr);
28463         LDKCResult_TxRemoveOutputDecodeErrorZ _res_conv = *(LDKCResult_TxRemoveOutputDecodeErrorZ*)(_res_ptr);
28464         FREE(untag_ptr(_res));
28465         CResult_TxRemoveOutputDecodeErrorZ_free(_res_conv);
28466 }
28467
28468 static inline uint64_t CResult_TxRemoveOutputDecodeErrorZ_clone_ptr(LDKCResult_TxRemoveOutputDecodeErrorZ *NONNULL_PTR arg) {
28469         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
28470         *ret_conv = CResult_TxRemoveOutputDecodeErrorZ_clone(arg);
28471         return tag_ptr(ret_conv, true);
28472 }
28473 int64_t  CS_LDK_CResult_TxRemoveOutputDecodeErrorZ_clone_ptr(int64_t arg) {
28474         LDKCResult_TxRemoveOutputDecodeErrorZ* arg_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(arg);
28475         int64_t ret_conv = CResult_TxRemoveOutputDecodeErrorZ_clone_ptr(arg_conv);
28476         return ret_conv;
28477 }
28478
28479 int64_t  CS_LDK_CResult_TxRemoveOutputDecodeErrorZ_clone(int64_t orig) {
28480         LDKCResult_TxRemoveOutputDecodeErrorZ* orig_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(orig);
28481         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
28482         *ret_conv = CResult_TxRemoveOutputDecodeErrorZ_clone(orig_conv);
28483         return tag_ptr(ret_conv, true);
28484 }
28485
28486 int64_t  CS_LDK_CResult_TxCompleteDecodeErrorZ_ok(int64_t o) {
28487         LDKTxComplete o_conv;
28488         o_conv.inner = untag_ptr(o);
28489         o_conv.is_owned = ptr_is_owned(o);
28490         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28491         o_conv = TxComplete_clone(&o_conv);
28492         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
28493         *ret_conv = CResult_TxCompleteDecodeErrorZ_ok(o_conv);
28494         return tag_ptr(ret_conv, true);
28495 }
28496
28497 int64_t  CS_LDK_CResult_TxCompleteDecodeErrorZ_err(int64_t e) {
28498         void* e_ptr = untag_ptr(e);
28499         CHECK_ACCESS(e_ptr);
28500         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28501         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28502         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
28503         *ret_conv = CResult_TxCompleteDecodeErrorZ_err(e_conv);
28504         return tag_ptr(ret_conv, true);
28505 }
28506
28507 jboolean  CS_LDK_CResult_TxCompleteDecodeErrorZ_is_ok(int64_t o) {
28508         LDKCResult_TxCompleteDecodeErrorZ* o_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(o);
28509         jboolean ret_conv = CResult_TxCompleteDecodeErrorZ_is_ok(o_conv);
28510         return ret_conv;
28511 }
28512
28513 void  CS_LDK_CResult_TxCompleteDecodeErrorZ_free(int64_t _res) {
28514         if (!ptr_is_owned(_res)) return;
28515         void* _res_ptr = untag_ptr(_res);
28516         CHECK_ACCESS(_res_ptr);
28517         LDKCResult_TxCompleteDecodeErrorZ _res_conv = *(LDKCResult_TxCompleteDecodeErrorZ*)(_res_ptr);
28518         FREE(untag_ptr(_res));
28519         CResult_TxCompleteDecodeErrorZ_free(_res_conv);
28520 }
28521
28522 static inline uint64_t CResult_TxCompleteDecodeErrorZ_clone_ptr(LDKCResult_TxCompleteDecodeErrorZ *NONNULL_PTR arg) {
28523         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
28524         *ret_conv = CResult_TxCompleteDecodeErrorZ_clone(arg);
28525         return tag_ptr(ret_conv, true);
28526 }
28527 int64_t  CS_LDK_CResult_TxCompleteDecodeErrorZ_clone_ptr(int64_t arg) {
28528         LDKCResult_TxCompleteDecodeErrorZ* arg_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(arg);
28529         int64_t ret_conv = CResult_TxCompleteDecodeErrorZ_clone_ptr(arg_conv);
28530         return ret_conv;
28531 }
28532
28533 int64_t  CS_LDK_CResult_TxCompleteDecodeErrorZ_clone(int64_t orig) {
28534         LDKCResult_TxCompleteDecodeErrorZ* orig_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(orig);
28535         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
28536         *ret_conv = CResult_TxCompleteDecodeErrorZ_clone(orig_conv);
28537         return tag_ptr(ret_conv, true);
28538 }
28539
28540 int64_t  CS_LDK_CResult_TxSignaturesDecodeErrorZ_ok(int64_t o) {
28541         LDKTxSignatures o_conv;
28542         o_conv.inner = untag_ptr(o);
28543         o_conv.is_owned = ptr_is_owned(o);
28544         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28545         o_conv = TxSignatures_clone(&o_conv);
28546         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
28547         *ret_conv = CResult_TxSignaturesDecodeErrorZ_ok(o_conv);
28548         return tag_ptr(ret_conv, true);
28549 }
28550
28551 int64_t  CS_LDK_CResult_TxSignaturesDecodeErrorZ_err(int64_t e) {
28552         void* e_ptr = untag_ptr(e);
28553         CHECK_ACCESS(e_ptr);
28554         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28555         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28556         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
28557         *ret_conv = CResult_TxSignaturesDecodeErrorZ_err(e_conv);
28558         return tag_ptr(ret_conv, true);
28559 }
28560
28561 jboolean  CS_LDK_CResult_TxSignaturesDecodeErrorZ_is_ok(int64_t o) {
28562         LDKCResult_TxSignaturesDecodeErrorZ* o_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(o);
28563         jboolean ret_conv = CResult_TxSignaturesDecodeErrorZ_is_ok(o_conv);
28564         return ret_conv;
28565 }
28566
28567 void  CS_LDK_CResult_TxSignaturesDecodeErrorZ_free(int64_t _res) {
28568         if (!ptr_is_owned(_res)) return;
28569         void* _res_ptr = untag_ptr(_res);
28570         CHECK_ACCESS(_res_ptr);
28571         LDKCResult_TxSignaturesDecodeErrorZ _res_conv = *(LDKCResult_TxSignaturesDecodeErrorZ*)(_res_ptr);
28572         FREE(untag_ptr(_res));
28573         CResult_TxSignaturesDecodeErrorZ_free(_res_conv);
28574 }
28575
28576 static inline uint64_t CResult_TxSignaturesDecodeErrorZ_clone_ptr(LDKCResult_TxSignaturesDecodeErrorZ *NONNULL_PTR arg) {
28577         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
28578         *ret_conv = CResult_TxSignaturesDecodeErrorZ_clone(arg);
28579         return tag_ptr(ret_conv, true);
28580 }
28581 int64_t  CS_LDK_CResult_TxSignaturesDecodeErrorZ_clone_ptr(int64_t arg) {
28582         LDKCResult_TxSignaturesDecodeErrorZ* arg_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(arg);
28583         int64_t ret_conv = CResult_TxSignaturesDecodeErrorZ_clone_ptr(arg_conv);
28584         return ret_conv;
28585 }
28586
28587 int64_t  CS_LDK_CResult_TxSignaturesDecodeErrorZ_clone(int64_t orig) {
28588         LDKCResult_TxSignaturesDecodeErrorZ* orig_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(orig);
28589         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
28590         *ret_conv = CResult_TxSignaturesDecodeErrorZ_clone(orig_conv);
28591         return tag_ptr(ret_conv, true);
28592 }
28593
28594 int64_t  CS_LDK_CResult_TxInitRbfDecodeErrorZ_ok(int64_t o) {
28595         LDKTxInitRbf o_conv;
28596         o_conv.inner = untag_ptr(o);
28597         o_conv.is_owned = ptr_is_owned(o);
28598         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28599         o_conv = TxInitRbf_clone(&o_conv);
28600         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
28601         *ret_conv = CResult_TxInitRbfDecodeErrorZ_ok(o_conv);
28602         return tag_ptr(ret_conv, true);
28603 }
28604
28605 int64_t  CS_LDK_CResult_TxInitRbfDecodeErrorZ_err(int64_t e) {
28606         void* e_ptr = untag_ptr(e);
28607         CHECK_ACCESS(e_ptr);
28608         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28609         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28610         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
28611         *ret_conv = CResult_TxInitRbfDecodeErrorZ_err(e_conv);
28612         return tag_ptr(ret_conv, true);
28613 }
28614
28615 jboolean  CS_LDK_CResult_TxInitRbfDecodeErrorZ_is_ok(int64_t o) {
28616         LDKCResult_TxInitRbfDecodeErrorZ* o_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(o);
28617         jboolean ret_conv = CResult_TxInitRbfDecodeErrorZ_is_ok(o_conv);
28618         return ret_conv;
28619 }
28620
28621 void  CS_LDK_CResult_TxInitRbfDecodeErrorZ_free(int64_t _res) {
28622         if (!ptr_is_owned(_res)) return;
28623         void* _res_ptr = untag_ptr(_res);
28624         CHECK_ACCESS(_res_ptr);
28625         LDKCResult_TxInitRbfDecodeErrorZ _res_conv = *(LDKCResult_TxInitRbfDecodeErrorZ*)(_res_ptr);
28626         FREE(untag_ptr(_res));
28627         CResult_TxInitRbfDecodeErrorZ_free(_res_conv);
28628 }
28629
28630 static inline uint64_t CResult_TxInitRbfDecodeErrorZ_clone_ptr(LDKCResult_TxInitRbfDecodeErrorZ *NONNULL_PTR arg) {
28631         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
28632         *ret_conv = CResult_TxInitRbfDecodeErrorZ_clone(arg);
28633         return tag_ptr(ret_conv, true);
28634 }
28635 int64_t  CS_LDK_CResult_TxInitRbfDecodeErrorZ_clone_ptr(int64_t arg) {
28636         LDKCResult_TxInitRbfDecodeErrorZ* arg_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(arg);
28637         int64_t ret_conv = CResult_TxInitRbfDecodeErrorZ_clone_ptr(arg_conv);
28638         return ret_conv;
28639 }
28640
28641 int64_t  CS_LDK_CResult_TxInitRbfDecodeErrorZ_clone(int64_t orig) {
28642         LDKCResult_TxInitRbfDecodeErrorZ* orig_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(orig);
28643         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
28644         *ret_conv = CResult_TxInitRbfDecodeErrorZ_clone(orig_conv);
28645         return tag_ptr(ret_conv, true);
28646 }
28647
28648 int64_t  CS_LDK_CResult_TxAckRbfDecodeErrorZ_ok(int64_t o) {
28649         LDKTxAckRbf o_conv;
28650         o_conv.inner = untag_ptr(o);
28651         o_conv.is_owned = ptr_is_owned(o);
28652         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28653         o_conv = TxAckRbf_clone(&o_conv);
28654         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
28655         *ret_conv = CResult_TxAckRbfDecodeErrorZ_ok(o_conv);
28656         return tag_ptr(ret_conv, true);
28657 }
28658
28659 int64_t  CS_LDK_CResult_TxAckRbfDecodeErrorZ_err(int64_t e) {
28660         void* e_ptr = untag_ptr(e);
28661         CHECK_ACCESS(e_ptr);
28662         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28663         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28664         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
28665         *ret_conv = CResult_TxAckRbfDecodeErrorZ_err(e_conv);
28666         return tag_ptr(ret_conv, true);
28667 }
28668
28669 jboolean  CS_LDK_CResult_TxAckRbfDecodeErrorZ_is_ok(int64_t o) {
28670         LDKCResult_TxAckRbfDecodeErrorZ* o_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(o);
28671         jboolean ret_conv = CResult_TxAckRbfDecodeErrorZ_is_ok(o_conv);
28672         return ret_conv;
28673 }
28674
28675 void  CS_LDK_CResult_TxAckRbfDecodeErrorZ_free(int64_t _res) {
28676         if (!ptr_is_owned(_res)) return;
28677         void* _res_ptr = untag_ptr(_res);
28678         CHECK_ACCESS(_res_ptr);
28679         LDKCResult_TxAckRbfDecodeErrorZ _res_conv = *(LDKCResult_TxAckRbfDecodeErrorZ*)(_res_ptr);
28680         FREE(untag_ptr(_res));
28681         CResult_TxAckRbfDecodeErrorZ_free(_res_conv);
28682 }
28683
28684 static inline uint64_t CResult_TxAckRbfDecodeErrorZ_clone_ptr(LDKCResult_TxAckRbfDecodeErrorZ *NONNULL_PTR arg) {
28685         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
28686         *ret_conv = CResult_TxAckRbfDecodeErrorZ_clone(arg);
28687         return tag_ptr(ret_conv, true);
28688 }
28689 int64_t  CS_LDK_CResult_TxAckRbfDecodeErrorZ_clone_ptr(int64_t arg) {
28690         LDKCResult_TxAckRbfDecodeErrorZ* arg_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(arg);
28691         int64_t ret_conv = CResult_TxAckRbfDecodeErrorZ_clone_ptr(arg_conv);
28692         return ret_conv;
28693 }
28694
28695 int64_t  CS_LDK_CResult_TxAckRbfDecodeErrorZ_clone(int64_t orig) {
28696         LDKCResult_TxAckRbfDecodeErrorZ* orig_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(orig);
28697         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
28698         *ret_conv = CResult_TxAckRbfDecodeErrorZ_clone(orig_conv);
28699         return tag_ptr(ret_conv, true);
28700 }
28701
28702 int64_t  CS_LDK_CResult_TxAbortDecodeErrorZ_ok(int64_t o) {
28703         LDKTxAbort o_conv;
28704         o_conv.inner = untag_ptr(o);
28705         o_conv.is_owned = ptr_is_owned(o);
28706         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28707         o_conv = TxAbort_clone(&o_conv);
28708         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
28709         *ret_conv = CResult_TxAbortDecodeErrorZ_ok(o_conv);
28710         return tag_ptr(ret_conv, true);
28711 }
28712
28713 int64_t  CS_LDK_CResult_TxAbortDecodeErrorZ_err(int64_t e) {
28714         void* e_ptr = untag_ptr(e);
28715         CHECK_ACCESS(e_ptr);
28716         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28717         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28718         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
28719         *ret_conv = CResult_TxAbortDecodeErrorZ_err(e_conv);
28720         return tag_ptr(ret_conv, true);
28721 }
28722
28723 jboolean  CS_LDK_CResult_TxAbortDecodeErrorZ_is_ok(int64_t o) {
28724         LDKCResult_TxAbortDecodeErrorZ* o_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(o);
28725         jboolean ret_conv = CResult_TxAbortDecodeErrorZ_is_ok(o_conv);
28726         return ret_conv;
28727 }
28728
28729 void  CS_LDK_CResult_TxAbortDecodeErrorZ_free(int64_t _res) {
28730         if (!ptr_is_owned(_res)) return;
28731         void* _res_ptr = untag_ptr(_res);
28732         CHECK_ACCESS(_res_ptr);
28733         LDKCResult_TxAbortDecodeErrorZ _res_conv = *(LDKCResult_TxAbortDecodeErrorZ*)(_res_ptr);
28734         FREE(untag_ptr(_res));
28735         CResult_TxAbortDecodeErrorZ_free(_res_conv);
28736 }
28737
28738 static inline uint64_t CResult_TxAbortDecodeErrorZ_clone_ptr(LDKCResult_TxAbortDecodeErrorZ *NONNULL_PTR arg) {
28739         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
28740         *ret_conv = CResult_TxAbortDecodeErrorZ_clone(arg);
28741         return tag_ptr(ret_conv, true);
28742 }
28743 int64_t  CS_LDK_CResult_TxAbortDecodeErrorZ_clone_ptr(int64_t arg) {
28744         LDKCResult_TxAbortDecodeErrorZ* arg_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(arg);
28745         int64_t ret_conv = CResult_TxAbortDecodeErrorZ_clone_ptr(arg_conv);
28746         return ret_conv;
28747 }
28748
28749 int64_t  CS_LDK_CResult_TxAbortDecodeErrorZ_clone(int64_t orig) {
28750         LDKCResult_TxAbortDecodeErrorZ* orig_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(orig);
28751         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
28752         *ret_conv = CResult_TxAbortDecodeErrorZ_clone(orig_conv);
28753         return tag_ptr(ret_conv, true);
28754 }
28755
28756 int64_t  CS_LDK_CResult_AnnouncementSignaturesDecodeErrorZ_ok(int64_t o) {
28757         LDKAnnouncementSignatures o_conv;
28758         o_conv.inner = untag_ptr(o);
28759         o_conv.is_owned = ptr_is_owned(o);
28760         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28761         o_conv = AnnouncementSignatures_clone(&o_conv);
28762         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
28763         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_ok(o_conv);
28764         return tag_ptr(ret_conv, true);
28765 }
28766
28767 int64_t  CS_LDK_CResult_AnnouncementSignaturesDecodeErrorZ_err(int64_t e) {
28768         void* e_ptr = untag_ptr(e);
28769         CHECK_ACCESS(e_ptr);
28770         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28771         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28772         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
28773         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_err(e_conv);
28774         return tag_ptr(ret_conv, true);
28775 }
28776
28777 jboolean  CS_LDK_CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(int64_t o) {
28778         LDKCResult_AnnouncementSignaturesDecodeErrorZ* o_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(o);
28779         jboolean ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o_conv);
28780         return ret_conv;
28781 }
28782
28783 void  CS_LDK_CResult_AnnouncementSignaturesDecodeErrorZ_free(int64_t _res) {
28784         if (!ptr_is_owned(_res)) return;
28785         void* _res_ptr = untag_ptr(_res);
28786         CHECK_ACCESS(_res_ptr);
28787         LDKCResult_AnnouncementSignaturesDecodeErrorZ _res_conv = *(LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(_res_ptr);
28788         FREE(untag_ptr(_res));
28789         CResult_AnnouncementSignaturesDecodeErrorZ_free(_res_conv);
28790 }
28791
28792 static inline uint64_t CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR arg) {
28793         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
28794         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(arg);
28795         return tag_ptr(ret_conv, true);
28796 }
28797 int64_t  CS_LDK_CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(int64_t arg) {
28798         LDKCResult_AnnouncementSignaturesDecodeErrorZ* arg_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(arg);
28799         int64_t ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(arg_conv);
28800         return ret_conv;
28801 }
28802
28803 int64_t  CS_LDK_CResult_AnnouncementSignaturesDecodeErrorZ_clone(int64_t orig) {
28804         LDKCResult_AnnouncementSignaturesDecodeErrorZ* orig_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(orig);
28805         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
28806         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig_conv);
28807         return tag_ptr(ret_conv, true);
28808 }
28809
28810 int64_t  CS_LDK_CResult_ChannelReestablishDecodeErrorZ_ok(int64_t o) {
28811         LDKChannelReestablish o_conv;
28812         o_conv.inner = untag_ptr(o);
28813         o_conv.is_owned = ptr_is_owned(o);
28814         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28815         o_conv = ChannelReestablish_clone(&o_conv);
28816         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
28817         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_ok(o_conv);
28818         return tag_ptr(ret_conv, true);
28819 }
28820
28821 int64_t  CS_LDK_CResult_ChannelReestablishDecodeErrorZ_err(int64_t e) {
28822         void* e_ptr = untag_ptr(e);
28823         CHECK_ACCESS(e_ptr);
28824         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28825         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28826         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
28827         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_err(e_conv);
28828         return tag_ptr(ret_conv, true);
28829 }
28830
28831 jboolean  CS_LDK_CResult_ChannelReestablishDecodeErrorZ_is_ok(int64_t o) {
28832         LDKCResult_ChannelReestablishDecodeErrorZ* o_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(o);
28833         jboolean ret_conv = CResult_ChannelReestablishDecodeErrorZ_is_ok(o_conv);
28834         return ret_conv;
28835 }
28836
28837 void  CS_LDK_CResult_ChannelReestablishDecodeErrorZ_free(int64_t _res) {
28838         if (!ptr_is_owned(_res)) return;
28839         void* _res_ptr = untag_ptr(_res);
28840         CHECK_ACCESS(_res_ptr);
28841         LDKCResult_ChannelReestablishDecodeErrorZ _res_conv = *(LDKCResult_ChannelReestablishDecodeErrorZ*)(_res_ptr);
28842         FREE(untag_ptr(_res));
28843         CResult_ChannelReestablishDecodeErrorZ_free(_res_conv);
28844 }
28845
28846 static inline uint64_t CResult_ChannelReestablishDecodeErrorZ_clone_ptr(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR arg) {
28847         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
28848         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(arg);
28849         return tag_ptr(ret_conv, true);
28850 }
28851 int64_t  CS_LDK_CResult_ChannelReestablishDecodeErrorZ_clone_ptr(int64_t arg) {
28852         LDKCResult_ChannelReestablishDecodeErrorZ* arg_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(arg);
28853         int64_t ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone_ptr(arg_conv);
28854         return ret_conv;
28855 }
28856
28857 int64_t  CS_LDK_CResult_ChannelReestablishDecodeErrorZ_clone(int64_t orig) {
28858         LDKCResult_ChannelReestablishDecodeErrorZ* orig_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(orig);
28859         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
28860         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(orig_conv);
28861         return tag_ptr(ret_conv, true);
28862 }
28863
28864 int64_t  CS_LDK_CResult_ClosingSignedDecodeErrorZ_ok(int64_t o) {
28865         LDKClosingSigned o_conv;
28866         o_conv.inner = untag_ptr(o);
28867         o_conv.is_owned = ptr_is_owned(o);
28868         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28869         o_conv = ClosingSigned_clone(&o_conv);
28870         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
28871         *ret_conv = CResult_ClosingSignedDecodeErrorZ_ok(o_conv);
28872         return tag_ptr(ret_conv, true);
28873 }
28874
28875 int64_t  CS_LDK_CResult_ClosingSignedDecodeErrorZ_err(int64_t e) {
28876         void* e_ptr = untag_ptr(e);
28877         CHECK_ACCESS(e_ptr);
28878         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28879         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28880         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
28881         *ret_conv = CResult_ClosingSignedDecodeErrorZ_err(e_conv);
28882         return tag_ptr(ret_conv, true);
28883 }
28884
28885 jboolean  CS_LDK_CResult_ClosingSignedDecodeErrorZ_is_ok(int64_t o) {
28886         LDKCResult_ClosingSignedDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(o);
28887         jboolean ret_conv = CResult_ClosingSignedDecodeErrorZ_is_ok(o_conv);
28888         return ret_conv;
28889 }
28890
28891 void  CS_LDK_CResult_ClosingSignedDecodeErrorZ_free(int64_t _res) {
28892         if (!ptr_is_owned(_res)) return;
28893         void* _res_ptr = untag_ptr(_res);
28894         CHECK_ACCESS(_res_ptr);
28895         LDKCResult_ClosingSignedDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedDecodeErrorZ*)(_res_ptr);
28896         FREE(untag_ptr(_res));
28897         CResult_ClosingSignedDecodeErrorZ_free(_res_conv);
28898 }
28899
28900 static inline uint64_t CResult_ClosingSignedDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR arg) {
28901         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
28902         *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(arg);
28903         return tag_ptr(ret_conv, true);
28904 }
28905 int64_t  CS_LDK_CResult_ClosingSignedDecodeErrorZ_clone_ptr(int64_t arg) {
28906         LDKCResult_ClosingSignedDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(arg);
28907         int64_t ret_conv = CResult_ClosingSignedDecodeErrorZ_clone_ptr(arg_conv);
28908         return ret_conv;
28909 }
28910
28911 int64_t  CS_LDK_CResult_ClosingSignedDecodeErrorZ_clone(int64_t orig) {
28912         LDKCResult_ClosingSignedDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(orig);
28913         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
28914         *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(orig_conv);
28915         return tag_ptr(ret_conv, true);
28916 }
28917
28918 int64_t  CS_LDK_CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(int64_t o) {
28919         LDKClosingSignedFeeRange o_conv;
28920         o_conv.inner = untag_ptr(o);
28921         o_conv.is_owned = ptr_is_owned(o);
28922         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28923         o_conv = ClosingSignedFeeRange_clone(&o_conv);
28924         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
28925         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o_conv);
28926         return tag_ptr(ret_conv, true);
28927 }
28928
28929 int64_t  CS_LDK_CResult_ClosingSignedFeeRangeDecodeErrorZ_err(int64_t e) {
28930         void* e_ptr = untag_ptr(e);
28931         CHECK_ACCESS(e_ptr);
28932         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28933         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28934         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
28935         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e_conv);
28936         return tag_ptr(ret_conv, true);
28937 }
28938
28939 jboolean  CS_LDK_CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(int64_t o) {
28940         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(o);
28941         jboolean ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o_conv);
28942         return ret_conv;
28943 }
28944
28945 void  CS_LDK_CResult_ClosingSignedFeeRangeDecodeErrorZ_free(int64_t _res) {
28946         if (!ptr_is_owned(_res)) return;
28947         void* _res_ptr = untag_ptr(_res);
28948         CHECK_ACCESS(_res_ptr);
28949         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(_res_ptr);
28950         FREE(untag_ptr(_res));
28951         CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res_conv);
28952 }
28953
28954 static inline uint64_t CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR arg) {
28955         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
28956         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(arg);
28957         return tag_ptr(ret_conv, true);
28958 }
28959 int64_t  CS_LDK_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(int64_t arg) {
28960         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(arg);
28961         int64_t ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(arg_conv);
28962         return ret_conv;
28963 }
28964
28965 int64_t  CS_LDK_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(int64_t orig) {
28966         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(orig);
28967         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
28968         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig_conv);
28969         return tag_ptr(ret_conv, true);
28970 }
28971
28972 int64_t  CS_LDK_CResult_CommitmentSignedDecodeErrorZ_ok(int64_t o) {
28973         LDKCommitmentSigned o_conv;
28974         o_conv.inner = untag_ptr(o);
28975         o_conv.is_owned = ptr_is_owned(o);
28976         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28977         o_conv = CommitmentSigned_clone(&o_conv);
28978         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
28979         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_ok(o_conv);
28980         return tag_ptr(ret_conv, true);
28981 }
28982
28983 int64_t  CS_LDK_CResult_CommitmentSignedDecodeErrorZ_err(int64_t e) {
28984         void* e_ptr = untag_ptr(e);
28985         CHECK_ACCESS(e_ptr);
28986         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28987         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28988         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
28989         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_err(e_conv);
28990         return tag_ptr(ret_conv, true);
28991 }
28992
28993 jboolean  CS_LDK_CResult_CommitmentSignedDecodeErrorZ_is_ok(int64_t o) {
28994         LDKCResult_CommitmentSignedDecodeErrorZ* o_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(o);
28995         jboolean ret_conv = CResult_CommitmentSignedDecodeErrorZ_is_ok(o_conv);
28996         return ret_conv;
28997 }
28998
28999 void  CS_LDK_CResult_CommitmentSignedDecodeErrorZ_free(int64_t _res) {
29000         if (!ptr_is_owned(_res)) return;
29001         void* _res_ptr = untag_ptr(_res);
29002         CHECK_ACCESS(_res_ptr);
29003         LDKCResult_CommitmentSignedDecodeErrorZ _res_conv = *(LDKCResult_CommitmentSignedDecodeErrorZ*)(_res_ptr);
29004         FREE(untag_ptr(_res));
29005         CResult_CommitmentSignedDecodeErrorZ_free(_res_conv);
29006 }
29007
29008 static inline uint64_t CResult_CommitmentSignedDecodeErrorZ_clone_ptr(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR arg) {
29009         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
29010         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(arg);
29011         return tag_ptr(ret_conv, true);
29012 }
29013 int64_t  CS_LDK_CResult_CommitmentSignedDecodeErrorZ_clone_ptr(int64_t arg) {
29014         LDKCResult_CommitmentSignedDecodeErrorZ* arg_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(arg);
29015         int64_t ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone_ptr(arg_conv);
29016         return ret_conv;
29017 }
29018
29019 int64_t  CS_LDK_CResult_CommitmentSignedDecodeErrorZ_clone(int64_t orig) {
29020         LDKCResult_CommitmentSignedDecodeErrorZ* orig_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(orig);
29021         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
29022         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(orig_conv);
29023         return tag_ptr(ret_conv, true);
29024 }
29025
29026 int64_t  CS_LDK_CResult_FundingCreatedDecodeErrorZ_ok(int64_t o) {
29027         LDKFundingCreated o_conv;
29028         o_conv.inner = untag_ptr(o);
29029         o_conv.is_owned = ptr_is_owned(o);
29030         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29031         o_conv = FundingCreated_clone(&o_conv);
29032         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
29033         *ret_conv = CResult_FundingCreatedDecodeErrorZ_ok(o_conv);
29034         return tag_ptr(ret_conv, true);
29035 }
29036
29037 int64_t  CS_LDK_CResult_FundingCreatedDecodeErrorZ_err(int64_t e) {
29038         void* e_ptr = untag_ptr(e);
29039         CHECK_ACCESS(e_ptr);
29040         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29041         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29042         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
29043         *ret_conv = CResult_FundingCreatedDecodeErrorZ_err(e_conv);
29044         return tag_ptr(ret_conv, true);
29045 }
29046
29047 jboolean  CS_LDK_CResult_FundingCreatedDecodeErrorZ_is_ok(int64_t o) {
29048         LDKCResult_FundingCreatedDecodeErrorZ* o_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(o);
29049         jboolean ret_conv = CResult_FundingCreatedDecodeErrorZ_is_ok(o_conv);
29050         return ret_conv;
29051 }
29052
29053 void  CS_LDK_CResult_FundingCreatedDecodeErrorZ_free(int64_t _res) {
29054         if (!ptr_is_owned(_res)) return;
29055         void* _res_ptr = untag_ptr(_res);
29056         CHECK_ACCESS(_res_ptr);
29057         LDKCResult_FundingCreatedDecodeErrorZ _res_conv = *(LDKCResult_FundingCreatedDecodeErrorZ*)(_res_ptr);
29058         FREE(untag_ptr(_res));
29059         CResult_FundingCreatedDecodeErrorZ_free(_res_conv);
29060 }
29061
29062 static inline uint64_t CResult_FundingCreatedDecodeErrorZ_clone_ptr(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR arg) {
29063         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
29064         *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(arg);
29065         return tag_ptr(ret_conv, true);
29066 }
29067 int64_t  CS_LDK_CResult_FundingCreatedDecodeErrorZ_clone_ptr(int64_t arg) {
29068         LDKCResult_FundingCreatedDecodeErrorZ* arg_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(arg);
29069         int64_t ret_conv = CResult_FundingCreatedDecodeErrorZ_clone_ptr(arg_conv);
29070         return ret_conv;
29071 }
29072
29073 int64_t  CS_LDK_CResult_FundingCreatedDecodeErrorZ_clone(int64_t orig) {
29074         LDKCResult_FundingCreatedDecodeErrorZ* orig_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(orig);
29075         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
29076         *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(orig_conv);
29077         return tag_ptr(ret_conv, true);
29078 }
29079
29080 int64_t  CS_LDK_CResult_FundingSignedDecodeErrorZ_ok(int64_t o) {
29081         LDKFundingSigned o_conv;
29082         o_conv.inner = untag_ptr(o);
29083         o_conv.is_owned = ptr_is_owned(o);
29084         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29085         o_conv = FundingSigned_clone(&o_conv);
29086         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
29087         *ret_conv = CResult_FundingSignedDecodeErrorZ_ok(o_conv);
29088         return tag_ptr(ret_conv, true);
29089 }
29090
29091 int64_t  CS_LDK_CResult_FundingSignedDecodeErrorZ_err(int64_t e) {
29092         void* e_ptr = untag_ptr(e);
29093         CHECK_ACCESS(e_ptr);
29094         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29095         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29096         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
29097         *ret_conv = CResult_FundingSignedDecodeErrorZ_err(e_conv);
29098         return tag_ptr(ret_conv, true);
29099 }
29100
29101 jboolean  CS_LDK_CResult_FundingSignedDecodeErrorZ_is_ok(int64_t o) {
29102         LDKCResult_FundingSignedDecodeErrorZ* o_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(o);
29103         jboolean ret_conv = CResult_FundingSignedDecodeErrorZ_is_ok(o_conv);
29104         return ret_conv;
29105 }
29106
29107 void  CS_LDK_CResult_FundingSignedDecodeErrorZ_free(int64_t _res) {
29108         if (!ptr_is_owned(_res)) return;
29109         void* _res_ptr = untag_ptr(_res);
29110         CHECK_ACCESS(_res_ptr);
29111         LDKCResult_FundingSignedDecodeErrorZ _res_conv = *(LDKCResult_FundingSignedDecodeErrorZ*)(_res_ptr);
29112         FREE(untag_ptr(_res));
29113         CResult_FundingSignedDecodeErrorZ_free(_res_conv);
29114 }
29115
29116 static inline uint64_t CResult_FundingSignedDecodeErrorZ_clone_ptr(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR arg) {
29117         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
29118         *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(arg);
29119         return tag_ptr(ret_conv, true);
29120 }
29121 int64_t  CS_LDK_CResult_FundingSignedDecodeErrorZ_clone_ptr(int64_t arg) {
29122         LDKCResult_FundingSignedDecodeErrorZ* arg_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(arg);
29123         int64_t ret_conv = CResult_FundingSignedDecodeErrorZ_clone_ptr(arg_conv);
29124         return ret_conv;
29125 }
29126
29127 int64_t  CS_LDK_CResult_FundingSignedDecodeErrorZ_clone(int64_t orig) {
29128         LDKCResult_FundingSignedDecodeErrorZ* orig_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(orig);
29129         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
29130         *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(orig_conv);
29131         return tag_ptr(ret_conv, true);
29132 }
29133
29134 int64_t  CS_LDK_CResult_ChannelReadyDecodeErrorZ_ok(int64_t o) {
29135         LDKChannelReady o_conv;
29136         o_conv.inner = untag_ptr(o);
29137         o_conv.is_owned = ptr_is_owned(o);
29138         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29139         o_conv = ChannelReady_clone(&o_conv);
29140         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
29141         *ret_conv = CResult_ChannelReadyDecodeErrorZ_ok(o_conv);
29142         return tag_ptr(ret_conv, true);
29143 }
29144
29145 int64_t  CS_LDK_CResult_ChannelReadyDecodeErrorZ_err(int64_t e) {
29146         void* e_ptr = untag_ptr(e);
29147         CHECK_ACCESS(e_ptr);
29148         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29149         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29150         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
29151         *ret_conv = CResult_ChannelReadyDecodeErrorZ_err(e_conv);
29152         return tag_ptr(ret_conv, true);
29153 }
29154
29155 jboolean  CS_LDK_CResult_ChannelReadyDecodeErrorZ_is_ok(int64_t o) {
29156         LDKCResult_ChannelReadyDecodeErrorZ* o_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(o);
29157         jboolean ret_conv = CResult_ChannelReadyDecodeErrorZ_is_ok(o_conv);
29158         return ret_conv;
29159 }
29160
29161 void  CS_LDK_CResult_ChannelReadyDecodeErrorZ_free(int64_t _res) {
29162         if (!ptr_is_owned(_res)) return;
29163         void* _res_ptr = untag_ptr(_res);
29164         CHECK_ACCESS(_res_ptr);
29165         LDKCResult_ChannelReadyDecodeErrorZ _res_conv = *(LDKCResult_ChannelReadyDecodeErrorZ*)(_res_ptr);
29166         FREE(untag_ptr(_res));
29167         CResult_ChannelReadyDecodeErrorZ_free(_res_conv);
29168 }
29169
29170 static inline uint64_t CResult_ChannelReadyDecodeErrorZ_clone_ptr(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR arg) {
29171         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
29172         *ret_conv = CResult_ChannelReadyDecodeErrorZ_clone(arg);
29173         return tag_ptr(ret_conv, true);
29174 }
29175 int64_t  CS_LDK_CResult_ChannelReadyDecodeErrorZ_clone_ptr(int64_t arg) {
29176         LDKCResult_ChannelReadyDecodeErrorZ* arg_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(arg);
29177         int64_t ret_conv = CResult_ChannelReadyDecodeErrorZ_clone_ptr(arg_conv);
29178         return ret_conv;
29179 }
29180
29181 int64_t  CS_LDK_CResult_ChannelReadyDecodeErrorZ_clone(int64_t orig) {
29182         LDKCResult_ChannelReadyDecodeErrorZ* orig_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(orig);
29183         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
29184         *ret_conv = CResult_ChannelReadyDecodeErrorZ_clone(orig_conv);
29185         return tag_ptr(ret_conv, true);
29186 }
29187
29188 int64_t  CS_LDK_CResult_InitDecodeErrorZ_ok(int64_t o) {
29189         LDKInit o_conv;
29190         o_conv.inner = untag_ptr(o);
29191         o_conv.is_owned = ptr_is_owned(o);
29192         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29193         o_conv = Init_clone(&o_conv);
29194         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
29195         *ret_conv = CResult_InitDecodeErrorZ_ok(o_conv);
29196         return tag_ptr(ret_conv, true);
29197 }
29198
29199 int64_t  CS_LDK_CResult_InitDecodeErrorZ_err(int64_t e) {
29200         void* e_ptr = untag_ptr(e);
29201         CHECK_ACCESS(e_ptr);
29202         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29203         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29204         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
29205         *ret_conv = CResult_InitDecodeErrorZ_err(e_conv);
29206         return tag_ptr(ret_conv, true);
29207 }
29208
29209 jboolean  CS_LDK_CResult_InitDecodeErrorZ_is_ok(int64_t o) {
29210         LDKCResult_InitDecodeErrorZ* o_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(o);
29211         jboolean ret_conv = CResult_InitDecodeErrorZ_is_ok(o_conv);
29212         return ret_conv;
29213 }
29214
29215 void  CS_LDK_CResult_InitDecodeErrorZ_free(int64_t _res) {
29216         if (!ptr_is_owned(_res)) return;
29217         void* _res_ptr = untag_ptr(_res);
29218         CHECK_ACCESS(_res_ptr);
29219         LDKCResult_InitDecodeErrorZ _res_conv = *(LDKCResult_InitDecodeErrorZ*)(_res_ptr);
29220         FREE(untag_ptr(_res));
29221         CResult_InitDecodeErrorZ_free(_res_conv);
29222 }
29223
29224 static inline uint64_t CResult_InitDecodeErrorZ_clone_ptr(LDKCResult_InitDecodeErrorZ *NONNULL_PTR arg) {
29225         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
29226         *ret_conv = CResult_InitDecodeErrorZ_clone(arg);
29227         return tag_ptr(ret_conv, true);
29228 }
29229 int64_t  CS_LDK_CResult_InitDecodeErrorZ_clone_ptr(int64_t arg) {
29230         LDKCResult_InitDecodeErrorZ* arg_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(arg);
29231         int64_t ret_conv = CResult_InitDecodeErrorZ_clone_ptr(arg_conv);
29232         return ret_conv;
29233 }
29234
29235 int64_t  CS_LDK_CResult_InitDecodeErrorZ_clone(int64_t orig) {
29236         LDKCResult_InitDecodeErrorZ* orig_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(orig);
29237         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
29238         *ret_conv = CResult_InitDecodeErrorZ_clone(orig_conv);
29239         return tag_ptr(ret_conv, true);
29240 }
29241
29242 int64_t  CS_LDK_CResult_OpenChannelDecodeErrorZ_ok(int64_t o) {
29243         LDKOpenChannel o_conv;
29244         o_conv.inner = untag_ptr(o);
29245         o_conv.is_owned = ptr_is_owned(o);
29246         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29247         o_conv = OpenChannel_clone(&o_conv);
29248         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
29249         *ret_conv = CResult_OpenChannelDecodeErrorZ_ok(o_conv);
29250         return tag_ptr(ret_conv, true);
29251 }
29252
29253 int64_t  CS_LDK_CResult_OpenChannelDecodeErrorZ_err(int64_t e) {
29254         void* e_ptr = untag_ptr(e);
29255         CHECK_ACCESS(e_ptr);
29256         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29257         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29258         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
29259         *ret_conv = CResult_OpenChannelDecodeErrorZ_err(e_conv);
29260         return tag_ptr(ret_conv, true);
29261 }
29262
29263 jboolean  CS_LDK_CResult_OpenChannelDecodeErrorZ_is_ok(int64_t o) {
29264         LDKCResult_OpenChannelDecodeErrorZ* o_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(o);
29265         jboolean ret_conv = CResult_OpenChannelDecodeErrorZ_is_ok(o_conv);
29266         return ret_conv;
29267 }
29268
29269 void  CS_LDK_CResult_OpenChannelDecodeErrorZ_free(int64_t _res) {
29270         if (!ptr_is_owned(_res)) return;
29271         void* _res_ptr = untag_ptr(_res);
29272         CHECK_ACCESS(_res_ptr);
29273         LDKCResult_OpenChannelDecodeErrorZ _res_conv = *(LDKCResult_OpenChannelDecodeErrorZ*)(_res_ptr);
29274         FREE(untag_ptr(_res));
29275         CResult_OpenChannelDecodeErrorZ_free(_res_conv);
29276 }
29277
29278 static inline uint64_t CResult_OpenChannelDecodeErrorZ_clone_ptr(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR arg) {
29279         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
29280         *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(arg);
29281         return tag_ptr(ret_conv, true);
29282 }
29283 int64_t  CS_LDK_CResult_OpenChannelDecodeErrorZ_clone_ptr(int64_t arg) {
29284         LDKCResult_OpenChannelDecodeErrorZ* arg_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(arg);
29285         int64_t ret_conv = CResult_OpenChannelDecodeErrorZ_clone_ptr(arg_conv);
29286         return ret_conv;
29287 }
29288
29289 int64_t  CS_LDK_CResult_OpenChannelDecodeErrorZ_clone(int64_t orig) {
29290         LDKCResult_OpenChannelDecodeErrorZ* orig_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(orig);
29291         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
29292         *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(orig_conv);
29293         return tag_ptr(ret_conv, true);
29294 }
29295
29296 int64_t  CS_LDK_CResult_OpenChannelV2DecodeErrorZ_ok(int64_t o) {
29297         LDKOpenChannelV2 o_conv;
29298         o_conv.inner = untag_ptr(o);
29299         o_conv.is_owned = ptr_is_owned(o);
29300         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29301         o_conv = OpenChannelV2_clone(&o_conv);
29302         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
29303         *ret_conv = CResult_OpenChannelV2DecodeErrorZ_ok(o_conv);
29304         return tag_ptr(ret_conv, true);
29305 }
29306
29307 int64_t  CS_LDK_CResult_OpenChannelV2DecodeErrorZ_err(int64_t e) {
29308         void* e_ptr = untag_ptr(e);
29309         CHECK_ACCESS(e_ptr);
29310         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29311         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29312         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
29313         *ret_conv = CResult_OpenChannelV2DecodeErrorZ_err(e_conv);
29314         return tag_ptr(ret_conv, true);
29315 }
29316
29317 jboolean  CS_LDK_CResult_OpenChannelV2DecodeErrorZ_is_ok(int64_t o) {
29318         LDKCResult_OpenChannelV2DecodeErrorZ* o_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(o);
29319         jboolean ret_conv = CResult_OpenChannelV2DecodeErrorZ_is_ok(o_conv);
29320         return ret_conv;
29321 }
29322
29323 void  CS_LDK_CResult_OpenChannelV2DecodeErrorZ_free(int64_t _res) {
29324         if (!ptr_is_owned(_res)) return;
29325         void* _res_ptr = untag_ptr(_res);
29326         CHECK_ACCESS(_res_ptr);
29327         LDKCResult_OpenChannelV2DecodeErrorZ _res_conv = *(LDKCResult_OpenChannelV2DecodeErrorZ*)(_res_ptr);
29328         FREE(untag_ptr(_res));
29329         CResult_OpenChannelV2DecodeErrorZ_free(_res_conv);
29330 }
29331
29332 static inline uint64_t CResult_OpenChannelV2DecodeErrorZ_clone_ptr(LDKCResult_OpenChannelV2DecodeErrorZ *NONNULL_PTR arg) {
29333         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
29334         *ret_conv = CResult_OpenChannelV2DecodeErrorZ_clone(arg);
29335         return tag_ptr(ret_conv, true);
29336 }
29337 int64_t  CS_LDK_CResult_OpenChannelV2DecodeErrorZ_clone_ptr(int64_t arg) {
29338         LDKCResult_OpenChannelV2DecodeErrorZ* arg_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(arg);
29339         int64_t ret_conv = CResult_OpenChannelV2DecodeErrorZ_clone_ptr(arg_conv);
29340         return ret_conv;
29341 }
29342
29343 int64_t  CS_LDK_CResult_OpenChannelV2DecodeErrorZ_clone(int64_t orig) {
29344         LDKCResult_OpenChannelV2DecodeErrorZ* orig_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(orig);
29345         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
29346         *ret_conv = CResult_OpenChannelV2DecodeErrorZ_clone(orig_conv);
29347         return tag_ptr(ret_conv, true);
29348 }
29349
29350 int64_t  CS_LDK_CResult_RevokeAndACKDecodeErrorZ_ok(int64_t o) {
29351         LDKRevokeAndACK o_conv;
29352         o_conv.inner = untag_ptr(o);
29353         o_conv.is_owned = ptr_is_owned(o);
29354         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29355         o_conv = RevokeAndACK_clone(&o_conv);
29356         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
29357         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_ok(o_conv);
29358         return tag_ptr(ret_conv, true);
29359 }
29360
29361 int64_t  CS_LDK_CResult_RevokeAndACKDecodeErrorZ_err(int64_t e) {
29362         void* e_ptr = untag_ptr(e);
29363         CHECK_ACCESS(e_ptr);
29364         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29365         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29366         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
29367         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_err(e_conv);
29368         return tag_ptr(ret_conv, true);
29369 }
29370
29371 jboolean  CS_LDK_CResult_RevokeAndACKDecodeErrorZ_is_ok(int64_t o) {
29372         LDKCResult_RevokeAndACKDecodeErrorZ* o_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(o);
29373         jboolean ret_conv = CResult_RevokeAndACKDecodeErrorZ_is_ok(o_conv);
29374         return ret_conv;
29375 }
29376
29377 void  CS_LDK_CResult_RevokeAndACKDecodeErrorZ_free(int64_t _res) {
29378         if (!ptr_is_owned(_res)) return;
29379         void* _res_ptr = untag_ptr(_res);
29380         CHECK_ACCESS(_res_ptr);
29381         LDKCResult_RevokeAndACKDecodeErrorZ _res_conv = *(LDKCResult_RevokeAndACKDecodeErrorZ*)(_res_ptr);
29382         FREE(untag_ptr(_res));
29383         CResult_RevokeAndACKDecodeErrorZ_free(_res_conv);
29384 }
29385
29386 static inline uint64_t CResult_RevokeAndACKDecodeErrorZ_clone_ptr(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR arg) {
29387         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
29388         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(arg);
29389         return tag_ptr(ret_conv, true);
29390 }
29391 int64_t  CS_LDK_CResult_RevokeAndACKDecodeErrorZ_clone_ptr(int64_t arg) {
29392         LDKCResult_RevokeAndACKDecodeErrorZ* arg_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(arg);
29393         int64_t ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone_ptr(arg_conv);
29394         return ret_conv;
29395 }
29396
29397 int64_t  CS_LDK_CResult_RevokeAndACKDecodeErrorZ_clone(int64_t orig) {
29398         LDKCResult_RevokeAndACKDecodeErrorZ* orig_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(orig);
29399         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
29400         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(orig_conv);
29401         return tag_ptr(ret_conv, true);
29402 }
29403
29404 int64_t  CS_LDK_CResult_ShutdownDecodeErrorZ_ok(int64_t o) {
29405         LDKShutdown o_conv;
29406         o_conv.inner = untag_ptr(o);
29407         o_conv.is_owned = ptr_is_owned(o);
29408         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29409         o_conv = Shutdown_clone(&o_conv);
29410         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
29411         *ret_conv = CResult_ShutdownDecodeErrorZ_ok(o_conv);
29412         return tag_ptr(ret_conv, true);
29413 }
29414
29415 int64_t  CS_LDK_CResult_ShutdownDecodeErrorZ_err(int64_t e) {
29416         void* e_ptr = untag_ptr(e);
29417         CHECK_ACCESS(e_ptr);
29418         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29419         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29420         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
29421         *ret_conv = CResult_ShutdownDecodeErrorZ_err(e_conv);
29422         return tag_ptr(ret_conv, true);
29423 }
29424
29425 jboolean  CS_LDK_CResult_ShutdownDecodeErrorZ_is_ok(int64_t o) {
29426         LDKCResult_ShutdownDecodeErrorZ* o_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(o);
29427         jboolean ret_conv = CResult_ShutdownDecodeErrorZ_is_ok(o_conv);
29428         return ret_conv;
29429 }
29430
29431 void  CS_LDK_CResult_ShutdownDecodeErrorZ_free(int64_t _res) {
29432         if (!ptr_is_owned(_res)) return;
29433         void* _res_ptr = untag_ptr(_res);
29434         CHECK_ACCESS(_res_ptr);
29435         LDKCResult_ShutdownDecodeErrorZ _res_conv = *(LDKCResult_ShutdownDecodeErrorZ*)(_res_ptr);
29436         FREE(untag_ptr(_res));
29437         CResult_ShutdownDecodeErrorZ_free(_res_conv);
29438 }
29439
29440 static inline uint64_t CResult_ShutdownDecodeErrorZ_clone_ptr(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR arg) {
29441         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
29442         *ret_conv = CResult_ShutdownDecodeErrorZ_clone(arg);
29443         return tag_ptr(ret_conv, true);
29444 }
29445 int64_t  CS_LDK_CResult_ShutdownDecodeErrorZ_clone_ptr(int64_t arg) {
29446         LDKCResult_ShutdownDecodeErrorZ* arg_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(arg);
29447         int64_t ret_conv = CResult_ShutdownDecodeErrorZ_clone_ptr(arg_conv);
29448         return ret_conv;
29449 }
29450
29451 int64_t  CS_LDK_CResult_ShutdownDecodeErrorZ_clone(int64_t orig) {
29452         LDKCResult_ShutdownDecodeErrorZ* orig_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(orig);
29453         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
29454         *ret_conv = CResult_ShutdownDecodeErrorZ_clone(orig_conv);
29455         return tag_ptr(ret_conv, true);
29456 }
29457
29458 int64_t  CS_LDK_CResult_UpdateFailHTLCDecodeErrorZ_ok(int64_t o) {
29459         LDKUpdateFailHTLC o_conv;
29460         o_conv.inner = untag_ptr(o);
29461         o_conv.is_owned = ptr_is_owned(o);
29462         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29463         o_conv = UpdateFailHTLC_clone(&o_conv);
29464         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
29465         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_ok(o_conv);
29466         return tag_ptr(ret_conv, true);
29467 }
29468
29469 int64_t  CS_LDK_CResult_UpdateFailHTLCDecodeErrorZ_err(int64_t e) {
29470         void* e_ptr = untag_ptr(e);
29471         CHECK_ACCESS(e_ptr);
29472         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29473         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29474         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
29475         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_err(e_conv);
29476         return tag_ptr(ret_conv, true);
29477 }
29478
29479 jboolean  CS_LDK_CResult_UpdateFailHTLCDecodeErrorZ_is_ok(int64_t o) {
29480         LDKCResult_UpdateFailHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(o);
29481         jboolean ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o_conv);
29482         return ret_conv;
29483 }
29484
29485 void  CS_LDK_CResult_UpdateFailHTLCDecodeErrorZ_free(int64_t _res) {
29486         if (!ptr_is_owned(_res)) return;
29487         void* _res_ptr = untag_ptr(_res);
29488         CHECK_ACCESS(_res_ptr);
29489         LDKCResult_UpdateFailHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailHTLCDecodeErrorZ*)(_res_ptr);
29490         FREE(untag_ptr(_res));
29491         CResult_UpdateFailHTLCDecodeErrorZ_free(_res_conv);
29492 }
29493
29494 static inline uint64_t CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR arg) {
29495         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
29496         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(arg);
29497         return tag_ptr(ret_conv, true);
29498 }
29499 int64_t  CS_LDK_CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(int64_t arg) {
29500         LDKCResult_UpdateFailHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(arg);
29501         int64_t ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(arg_conv);
29502         return ret_conv;
29503 }
29504
29505 int64_t  CS_LDK_CResult_UpdateFailHTLCDecodeErrorZ_clone(int64_t orig) {
29506         LDKCResult_UpdateFailHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(orig);
29507         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
29508         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(orig_conv);
29509         return tag_ptr(ret_conv, true);
29510 }
29511
29512 int64_t  CS_LDK_CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(int64_t o) {
29513         LDKUpdateFailMalformedHTLC o_conv;
29514         o_conv.inner = untag_ptr(o);
29515         o_conv.is_owned = ptr_is_owned(o);
29516         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29517         o_conv = UpdateFailMalformedHTLC_clone(&o_conv);
29518         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
29519         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o_conv);
29520         return tag_ptr(ret_conv, true);
29521 }
29522
29523 int64_t  CS_LDK_CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(int64_t e) {
29524         void* e_ptr = untag_ptr(e);
29525         CHECK_ACCESS(e_ptr);
29526         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29527         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29528         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
29529         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e_conv);
29530         return tag_ptr(ret_conv, true);
29531 }
29532
29533 jboolean  CS_LDK_CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(int64_t o) {
29534         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(o);
29535         jboolean ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o_conv);
29536         return ret_conv;
29537 }
29538
29539 void  CS_LDK_CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(int64_t _res) {
29540         if (!ptr_is_owned(_res)) return;
29541         void* _res_ptr = untag_ptr(_res);
29542         CHECK_ACCESS(_res_ptr);
29543         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(_res_ptr);
29544         FREE(untag_ptr(_res));
29545         CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res_conv);
29546 }
29547
29548 static inline uint64_t CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR arg) {
29549         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
29550         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(arg);
29551         return tag_ptr(ret_conv, true);
29552 }
29553 int64_t  CS_LDK_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(int64_t arg) {
29554         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(arg);
29555         int64_t ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(arg_conv);
29556         return ret_conv;
29557 }
29558
29559 int64_t  CS_LDK_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(int64_t orig) {
29560         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(orig);
29561         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
29562         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig_conv);
29563         return tag_ptr(ret_conv, true);
29564 }
29565
29566 int64_t  CS_LDK_CResult_UpdateFeeDecodeErrorZ_ok(int64_t o) {
29567         LDKUpdateFee o_conv;
29568         o_conv.inner = untag_ptr(o);
29569         o_conv.is_owned = ptr_is_owned(o);
29570         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29571         o_conv = UpdateFee_clone(&o_conv);
29572         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
29573         *ret_conv = CResult_UpdateFeeDecodeErrorZ_ok(o_conv);
29574         return tag_ptr(ret_conv, true);
29575 }
29576
29577 int64_t  CS_LDK_CResult_UpdateFeeDecodeErrorZ_err(int64_t e) {
29578         void* e_ptr = untag_ptr(e);
29579         CHECK_ACCESS(e_ptr);
29580         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29581         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29582         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
29583         *ret_conv = CResult_UpdateFeeDecodeErrorZ_err(e_conv);
29584         return tag_ptr(ret_conv, true);
29585 }
29586
29587 jboolean  CS_LDK_CResult_UpdateFeeDecodeErrorZ_is_ok(int64_t o) {
29588         LDKCResult_UpdateFeeDecodeErrorZ* o_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(o);
29589         jboolean ret_conv = CResult_UpdateFeeDecodeErrorZ_is_ok(o_conv);
29590         return ret_conv;
29591 }
29592
29593 void  CS_LDK_CResult_UpdateFeeDecodeErrorZ_free(int64_t _res) {
29594         if (!ptr_is_owned(_res)) return;
29595         void* _res_ptr = untag_ptr(_res);
29596         CHECK_ACCESS(_res_ptr);
29597         LDKCResult_UpdateFeeDecodeErrorZ _res_conv = *(LDKCResult_UpdateFeeDecodeErrorZ*)(_res_ptr);
29598         FREE(untag_ptr(_res));
29599         CResult_UpdateFeeDecodeErrorZ_free(_res_conv);
29600 }
29601
29602 static inline uint64_t CResult_UpdateFeeDecodeErrorZ_clone_ptr(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR arg) {
29603         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
29604         *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(arg);
29605         return tag_ptr(ret_conv, true);
29606 }
29607 int64_t  CS_LDK_CResult_UpdateFeeDecodeErrorZ_clone_ptr(int64_t arg) {
29608         LDKCResult_UpdateFeeDecodeErrorZ* arg_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(arg);
29609         int64_t ret_conv = CResult_UpdateFeeDecodeErrorZ_clone_ptr(arg_conv);
29610         return ret_conv;
29611 }
29612
29613 int64_t  CS_LDK_CResult_UpdateFeeDecodeErrorZ_clone(int64_t orig) {
29614         LDKCResult_UpdateFeeDecodeErrorZ* orig_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(orig);
29615         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
29616         *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(orig_conv);
29617         return tag_ptr(ret_conv, true);
29618 }
29619
29620 int64_t  CS_LDK_CResult_UpdateFulfillHTLCDecodeErrorZ_ok(int64_t o) {
29621         LDKUpdateFulfillHTLC o_conv;
29622         o_conv.inner = untag_ptr(o);
29623         o_conv.is_owned = ptr_is_owned(o);
29624         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29625         o_conv = UpdateFulfillHTLC_clone(&o_conv);
29626         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
29627         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o_conv);
29628         return tag_ptr(ret_conv, true);
29629 }
29630
29631 int64_t  CS_LDK_CResult_UpdateFulfillHTLCDecodeErrorZ_err(int64_t e) {
29632         void* e_ptr = untag_ptr(e);
29633         CHECK_ACCESS(e_ptr);
29634         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29635         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29636         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
29637         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_err(e_conv);
29638         return tag_ptr(ret_conv, true);
29639 }
29640
29641 jboolean  CS_LDK_CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(int64_t o) {
29642         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(o);
29643         jboolean ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o_conv);
29644         return ret_conv;
29645 }
29646
29647 void  CS_LDK_CResult_UpdateFulfillHTLCDecodeErrorZ_free(int64_t _res) {
29648         if (!ptr_is_owned(_res)) return;
29649         void* _res_ptr = untag_ptr(_res);
29650         CHECK_ACCESS(_res_ptr);
29651         LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(_res_ptr);
29652         FREE(untag_ptr(_res));
29653         CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res_conv);
29654 }
29655
29656 static inline uint64_t CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR arg) {
29657         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
29658         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(arg);
29659         return tag_ptr(ret_conv, true);
29660 }
29661 int64_t  CS_LDK_CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(int64_t arg) {
29662         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(arg);
29663         int64_t ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(arg_conv);
29664         return ret_conv;
29665 }
29666
29667 int64_t  CS_LDK_CResult_UpdateFulfillHTLCDecodeErrorZ_clone(int64_t orig) {
29668         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(orig);
29669         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
29670         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig_conv);
29671         return tag_ptr(ret_conv, true);
29672 }
29673
29674 int64_t  CS_LDK_CResult_OnionPacketDecodeErrorZ_ok(int64_t o) {
29675         LDKOnionPacket o_conv;
29676         o_conv.inner = untag_ptr(o);
29677         o_conv.is_owned = ptr_is_owned(o);
29678         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29679         o_conv = OnionPacket_clone(&o_conv);
29680         LDKCResult_OnionPacketDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionPacketDecodeErrorZ), "LDKCResult_OnionPacketDecodeErrorZ");
29681         *ret_conv = CResult_OnionPacketDecodeErrorZ_ok(o_conv);
29682         return tag_ptr(ret_conv, true);
29683 }
29684
29685 int64_t  CS_LDK_CResult_OnionPacketDecodeErrorZ_err(int64_t e) {
29686         void* e_ptr = untag_ptr(e);
29687         CHECK_ACCESS(e_ptr);
29688         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29689         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29690         LDKCResult_OnionPacketDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionPacketDecodeErrorZ), "LDKCResult_OnionPacketDecodeErrorZ");
29691         *ret_conv = CResult_OnionPacketDecodeErrorZ_err(e_conv);
29692         return tag_ptr(ret_conv, true);
29693 }
29694
29695 jboolean  CS_LDK_CResult_OnionPacketDecodeErrorZ_is_ok(int64_t o) {
29696         LDKCResult_OnionPacketDecodeErrorZ* o_conv = (LDKCResult_OnionPacketDecodeErrorZ*)untag_ptr(o);
29697         jboolean ret_conv = CResult_OnionPacketDecodeErrorZ_is_ok(o_conv);
29698         return ret_conv;
29699 }
29700
29701 void  CS_LDK_CResult_OnionPacketDecodeErrorZ_free(int64_t _res) {
29702         if (!ptr_is_owned(_res)) return;
29703         void* _res_ptr = untag_ptr(_res);
29704         CHECK_ACCESS(_res_ptr);
29705         LDKCResult_OnionPacketDecodeErrorZ _res_conv = *(LDKCResult_OnionPacketDecodeErrorZ*)(_res_ptr);
29706         FREE(untag_ptr(_res));
29707         CResult_OnionPacketDecodeErrorZ_free(_res_conv);
29708 }
29709
29710 static inline uint64_t CResult_OnionPacketDecodeErrorZ_clone_ptr(LDKCResult_OnionPacketDecodeErrorZ *NONNULL_PTR arg) {
29711         LDKCResult_OnionPacketDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionPacketDecodeErrorZ), "LDKCResult_OnionPacketDecodeErrorZ");
29712         *ret_conv = CResult_OnionPacketDecodeErrorZ_clone(arg);
29713         return tag_ptr(ret_conv, true);
29714 }
29715 int64_t  CS_LDK_CResult_OnionPacketDecodeErrorZ_clone_ptr(int64_t arg) {
29716         LDKCResult_OnionPacketDecodeErrorZ* arg_conv = (LDKCResult_OnionPacketDecodeErrorZ*)untag_ptr(arg);
29717         int64_t ret_conv = CResult_OnionPacketDecodeErrorZ_clone_ptr(arg_conv);
29718         return ret_conv;
29719 }
29720
29721 int64_t  CS_LDK_CResult_OnionPacketDecodeErrorZ_clone(int64_t orig) {
29722         LDKCResult_OnionPacketDecodeErrorZ* orig_conv = (LDKCResult_OnionPacketDecodeErrorZ*)untag_ptr(orig);
29723         LDKCResult_OnionPacketDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionPacketDecodeErrorZ), "LDKCResult_OnionPacketDecodeErrorZ");
29724         *ret_conv = CResult_OnionPacketDecodeErrorZ_clone(orig_conv);
29725         return tag_ptr(ret_conv, true);
29726 }
29727
29728 int64_t  CS_LDK_CResult_UpdateAddHTLCDecodeErrorZ_ok(int64_t o) {
29729         LDKUpdateAddHTLC o_conv;
29730         o_conv.inner = untag_ptr(o);
29731         o_conv.is_owned = ptr_is_owned(o);
29732         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29733         o_conv = UpdateAddHTLC_clone(&o_conv);
29734         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
29735         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_ok(o_conv);
29736         return tag_ptr(ret_conv, true);
29737 }
29738
29739 int64_t  CS_LDK_CResult_UpdateAddHTLCDecodeErrorZ_err(int64_t e) {
29740         void* e_ptr = untag_ptr(e);
29741         CHECK_ACCESS(e_ptr);
29742         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29743         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29744         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
29745         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_err(e_conv);
29746         return tag_ptr(ret_conv, true);
29747 }
29748
29749 jboolean  CS_LDK_CResult_UpdateAddHTLCDecodeErrorZ_is_ok(int64_t o) {
29750         LDKCResult_UpdateAddHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(o);
29751         jboolean ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o_conv);
29752         return ret_conv;
29753 }
29754
29755 void  CS_LDK_CResult_UpdateAddHTLCDecodeErrorZ_free(int64_t _res) {
29756         if (!ptr_is_owned(_res)) return;
29757         void* _res_ptr = untag_ptr(_res);
29758         CHECK_ACCESS(_res_ptr);
29759         LDKCResult_UpdateAddHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateAddHTLCDecodeErrorZ*)(_res_ptr);
29760         FREE(untag_ptr(_res));
29761         CResult_UpdateAddHTLCDecodeErrorZ_free(_res_conv);
29762 }
29763
29764 static inline uint64_t CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR arg) {
29765         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
29766         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(arg);
29767         return tag_ptr(ret_conv, true);
29768 }
29769 int64_t  CS_LDK_CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(int64_t arg) {
29770         LDKCResult_UpdateAddHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(arg);
29771         int64_t ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(arg_conv);
29772         return ret_conv;
29773 }
29774
29775 int64_t  CS_LDK_CResult_UpdateAddHTLCDecodeErrorZ_clone(int64_t orig) {
29776         LDKCResult_UpdateAddHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(orig);
29777         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
29778         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(orig_conv);
29779         return tag_ptr(ret_conv, true);
29780 }
29781
29782 int64_t  CS_LDK_CResult_OnionMessageDecodeErrorZ_ok(int64_t o) {
29783         LDKOnionMessage o_conv;
29784         o_conv.inner = untag_ptr(o);
29785         o_conv.is_owned = ptr_is_owned(o);
29786         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29787         o_conv = OnionMessage_clone(&o_conv);
29788         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
29789         *ret_conv = CResult_OnionMessageDecodeErrorZ_ok(o_conv);
29790         return tag_ptr(ret_conv, true);
29791 }
29792
29793 int64_t  CS_LDK_CResult_OnionMessageDecodeErrorZ_err(int64_t e) {
29794         void* e_ptr = untag_ptr(e);
29795         CHECK_ACCESS(e_ptr);
29796         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29797         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29798         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
29799         *ret_conv = CResult_OnionMessageDecodeErrorZ_err(e_conv);
29800         return tag_ptr(ret_conv, true);
29801 }
29802
29803 jboolean  CS_LDK_CResult_OnionMessageDecodeErrorZ_is_ok(int64_t o) {
29804         LDKCResult_OnionMessageDecodeErrorZ* o_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(o);
29805         jboolean ret_conv = CResult_OnionMessageDecodeErrorZ_is_ok(o_conv);
29806         return ret_conv;
29807 }
29808
29809 void  CS_LDK_CResult_OnionMessageDecodeErrorZ_free(int64_t _res) {
29810         if (!ptr_is_owned(_res)) return;
29811         void* _res_ptr = untag_ptr(_res);
29812         CHECK_ACCESS(_res_ptr);
29813         LDKCResult_OnionMessageDecodeErrorZ _res_conv = *(LDKCResult_OnionMessageDecodeErrorZ*)(_res_ptr);
29814         FREE(untag_ptr(_res));
29815         CResult_OnionMessageDecodeErrorZ_free(_res_conv);
29816 }
29817
29818 static inline uint64_t CResult_OnionMessageDecodeErrorZ_clone_ptr(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR arg) {
29819         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
29820         *ret_conv = CResult_OnionMessageDecodeErrorZ_clone(arg);
29821         return tag_ptr(ret_conv, true);
29822 }
29823 int64_t  CS_LDK_CResult_OnionMessageDecodeErrorZ_clone_ptr(int64_t arg) {
29824         LDKCResult_OnionMessageDecodeErrorZ* arg_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(arg);
29825         int64_t ret_conv = CResult_OnionMessageDecodeErrorZ_clone_ptr(arg_conv);
29826         return ret_conv;
29827 }
29828
29829 int64_t  CS_LDK_CResult_OnionMessageDecodeErrorZ_clone(int64_t orig) {
29830         LDKCResult_OnionMessageDecodeErrorZ* orig_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(orig);
29831         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
29832         *ret_conv = CResult_OnionMessageDecodeErrorZ_clone(orig_conv);
29833         return tag_ptr(ret_conv, true);
29834 }
29835
29836 int64_t  CS_LDK_CResult_FinalOnionHopDataDecodeErrorZ_ok(int64_t o) {
29837         LDKFinalOnionHopData o_conv;
29838         o_conv.inner = untag_ptr(o);
29839         o_conv.is_owned = ptr_is_owned(o);
29840         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29841         o_conv = FinalOnionHopData_clone(&o_conv);
29842         LDKCResult_FinalOnionHopDataDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FinalOnionHopDataDecodeErrorZ), "LDKCResult_FinalOnionHopDataDecodeErrorZ");
29843         *ret_conv = CResult_FinalOnionHopDataDecodeErrorZ_ok(o_conv);
29844         return tag_ptr(ret_conv, true);
29845 }
29846
29847 int64_t  CS_LDK_CResult_FinalOnionHopDataDecodeErrorZ_err(int64_t e) {
29848         void* e_ptr = untag_ptr(e);
29849         CHECK_ACCESS(e_ptr);
29850         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29851         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29852         LDKCResult_FinalOnionHopDataDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FinalOnionHopDataDecodeErrorZ), "LDKCResult_FinalOnionHopDataDecodeErrorZ");
29853         *ret_conv = CResult_FinalOnionHopDataDecodeErrorZ_err(e_conv);
29854         return tag_ptr(ret_conv, true);
29855 }
29856
29857 jboolean  CS_LDK_CResult_FinalOnionHopDataDecodeErrorZ_is_ok(int64_t o) {
29858         LDKCResult_FinalOnionHopDataDecodeErrorZ* o_conv = (LDKCResult_FinalOnionHopDataDecodeErrorZ*)untag_ptr(o);
29859         jboolean ret_conv = CResult_FinalOnionHopDataDecodeErrorZ_is_ok(o_conv);
29860         return ret_conv;
29861 }
29862
29863 void  CS_LDK_CResult_FinalOnionHopDataDecodeErrorZ_free(int64_t _res) {
29864         if (!ptr_is_owned(_res)) return;
29865         void* _res_ptr = untag_ptr(_res);
29866         CHECK_ACCESS(_res_ptr);
29867         LDKCResult_FinalOnionHopDataDecodeErrorZ _res_conv = *(LDKCResult_FinalOnionHopDataDecodeErrorZ*)(_res_ptr);
29868         FREE(untag_ptr(_res));
29869         CResult_FinalOnionHopDataDecodeErrorZ_free(_res_conv);
29870 }
29871
29872 static inline uint64_t CResult_FinalOnionHopDataDecodeErrorZ_clone_ptr(LDKCResult_FinalOnionHopDataDecodeErrorZ *NONNULL_PTR arg) {
29873         LDKCResult_FinalOnionHopDataDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FinalOnionHopDataDecodeErrorZ), "LDKCResult_FinalOnionHopDataDecodeErrorZ");
29874         *ret_conv = CResult_FinalOnionHopDataDecodeErrorZ_clone(arg);
29875         return tag_ptr(ret_conv, true);
29876 }
29877 int64_t  CS_LDK_CResult_FinalOnionHopDataDecodeErrorZ_clone_ptr(int64_t arg) {
29878         LDKCResult_FinalOnionHopDataDecodeErrorZ* arg_conv = (LDKCResult_FinalOnionHopDataDecodeErrorZ*)untag_ptr(arg);
29879         int64_t ret_conv = CResult_FinalOnionHopDataDecodeErrorZ_clone_ptr(arg_conv);
29880         return ret_conv;
29881 }
29882
29883 int64_t  CS_LDK_CResult_FinalOnionHopDataDecodeErrorZ_clone(int64_t orig) {
29884         LDKCResult_FinalOnionHopDataDecodeErrorZ* orig_conv = (LDKCResult_FinalOnionHopDataDecodeErrorZ*)untag_ptr(orig);
29885         LDKCResult_FinalOnionHopDataDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FinalOnionHopDataDecodeErrorZ), "LDKCResult_FinalOnionHopDataDecodeErrorZ");
29886         *ret_conv = CResult_FinalOnionHopDataDecodeErrorZ_clone(orig_conv);
29887         return tag_ptr(ret_conv, true);
29888 }
29889
29890 int64_t  CS_LDK_CResult_PingDecodeErrorZ_ok(int64_t o) {
29891         LDKPing o_conv;
29892         o_conv.inner = untag_ptr(o);
29893         o_conv.is_owned = ptr_is_owned(o);
29894         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29895         o_conv = Ping_clone(&o_conv);
29896         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
29897         *ret_conv = CResult_PingDecodeErrorZ_ok(o_conv);
29898         return tag_ptr(ret_conv, true);
29899 }
29900
29901 int64_t  CS_LDK_CResult_PingDecodeErrorZ_err(int64_t e) {
29902         void* e_ptr = untag_ptr(e);
29903         CHECK_ACCESS(e_ptr);
29904         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29905         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29906         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
29907         *ret_conv = CResult_PingDecodeErrorZ_err(e_conv);
29908         return tag_ptr(ret_conv, true);
29909 }
29910
29911 jboolean  CS_LDK_CResult_PingDecodeErrorZ_is_ok(int64_t o) {
29912         LDKCResult_PingDecodeErrorZ* o_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(o);
29913         jboolean ret_conv = CResult_PingDecodeErrorZ_is_ok(o_conv);
29914         return ret_conv;
29915 }
29916
29917 void  CS_LDK_CResult_PingDecodeErrorZ_free(int64_t _res) {
29918         if (!ptr_is_owned(_res)) return;
29919         void* _res_ptr = untag_ptr(_res);
29920         CHECK_ACCESS(_res_ptr);
29921         LDKCResult_PingDecodeErrorZ _res_conv = *(LDKCResult_PingDecodeErrorZ*)(_res_ptr);
29922         FREE(untag_ptr(_res));
29923         CResult_PingDecodeErrorZ_free(_res_conv);
29924 }
29925
29926 static inline uint64_t CResult_PingDecodeErrorZ_clone_ptr(LDKCResult_PingDecodeErrorZ *NONNULL_PTR arg) {
29927         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
29928         *ret_conv = CResult_PingDecodeErrorZ_clone(arg);
29929         return tag_ptr(ret_conv, true);
29930 }
29931 int64_t  CS_LDK_CResult_PingDecodeErrorZ_clone_ptr(int64_t arg) {
29932         LDKCResult_PingDecodeErrorZ* arg_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(arg);
29933         int64_t ret_conv = CResult_PingDecodeErrorZ_clone_ptr(arg_conv);
29934         return ret_conv;
29935 }
29936
29937 int64_t  CS_LDK_CResult_PingDecodeErrorZ_clone(int64_t orig) {
29938         LDKCResult_PingDecodeErrorZ* orig_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(orig);
29939         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
29940         *ret_conv = CResult_PingDecodeErrorZ_clone(orig_conv);
29941         return tag_ptr(ret_conv, true);
29942 }
29943
29944 int64_t  CS_LDK_CResult_PongDecodeErrorZ_ok(int64_t o) {
29945         LDKPong o_conv;
29946         o_conv.inner = untag_ptr(o);
29947         o_conv.is_owned = ptr_is_owned(o);
29948         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29949         o_conv = Pong_clone(&o_conv);
29950         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
29951         *ret_conv = CResult_PongDecodeErrorZ_ok(o_conv);
29952         return tag_ptr(ret_conv, true);
29953 }
29954
29955 int64_t  CS_LDK_CResult_PongDecodeErrorZ_err(int64_t e) {
29956         void* e_ptr = untag_ptr(e);
29957         CHECK_ACCESS(e_ptr);
29958         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29959         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29960         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
29961         *ret_conv = CResult_PongDecodeErrorZ_err(e_conv);
29962         return tag_ptr(ret_conv, true);
29963 }
29964
29965 jboolean  CS_LDK_CResult_PongDecodeErrorZ_is_ok(int64_t o) {
29966         LDKCResult_PongDecodeErrorZ* o_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(o);
29967         jboolean ret_conv = CResult_PongDecodeErrorZ_is_ok(o_conv);
29968         return ret_conv;
29969 }
29970
29971 void  CS_LDK_CResult_PongDecodeErrorZ_free(int64_t _res) {
29972         if (!ptr_is_owned(_res)) return;
29973         void* _res_ptr = untag_ptr(_res);
29974         CHECK_ACCESS(_res_ptr);
29975         LDKCResult_PongDecodeErrorZ _res_conv = *(LDKCResult_PongDecodeErrorZ*)(_res_ptr);
29976         FREE(untag_ptr(_res));
29977         CResult_PongDecodeErrorZ_free(_res_conv);
29978 }
29979
29980 static inline uint64_t CResult_PongDecodeErrorZ_clone_ptr(LDKCResult_PongDecodeErrorZ *NONNULL_PTR arg) {
29981         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
29982         *ret_conv = CResult_PongDecodeErrorZ_clone(arg);
29983         return tag_ptr(ret_conv, true);
29984 }
29985 int64_t  CS_LDK_CResult_PongDecodeErrorZ_clone_ptr(int64_t arg) {
29986         LDKCResult_PongDecodeErrorZ* arg_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(arg);
29987         int64_t ret_conv = CResult_PongDecodeErrorZ_clone_ptr(arg_conv);
29988         return ret_conv;
29989 }
29990
29991 int64_t  CS_LDK_CResult_PongDecodeErrorZ_clone(int64_t orig) {
29992         LDKCResult_PongDecodeErrorZ* orig_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(orig);
29993         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
29994         *ret_conv = CResult_PongDecodeErrorZ_clone(orig_conv);
29995         return tag_ptr(ret_conv, true);
29996 }
29997
29998 int64_t  CS_LDK_CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(int64_t o) {
29999         LDKUnsignedChannelAnnouncement o_conv;
30000         o_conv.inner = untag_ptr(o);
30001         o_conv.is_owned = ptr_is_owned(o);
30002         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30003         o_conv = UnsignedChannelAnnouncement_clone(&o_conv);
30004         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
30005         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o_conv);
30006         return tag_ptr(ret_conv, true);
30007 }
30008
30009 int64_t  CS_LDK_CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(int64_t e) {
30010         void* e_ptr = untag_ptr(e);
30011         CHECK_ACCESS(e_ptr);
30012         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30013         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30014         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
30015         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e_conv);
30016         return tag_ptr(ret_conv, true);
30017 }
30018
30019 jboolean  CS_LDK_CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(int64_t o) {
30020         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(o);
30021         jboolean ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
30022         return ret_conv;
30023 }
30024
30025 void  CS_LDK_CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(int64_t _res) {
30026         if (!ptr_is_owned(_res)) return;
30027         void* _res_ptr = untag_ptr(_res);
30028         CHECK_ACCESS(_res_ptr);
30029         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(_res_ptr);
30030         FREE(untag_ptr(_res));
30031         CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res_conv);
30032 }
30033
30034 static inline uint64_t CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
30035         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
30036         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(arg);
30037         return tag_ptr(ret_conv, true);
30038 }
30039 int64_t  CS_LDK_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(int64_t arg) {
30040         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(arg);
30041         int64_t ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
30042         return ret_conv;
30043 }
30044
30045 int64_t  CS_LDK_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(int64_t orig) {
30046         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(orig);
30047         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
30048         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig_conv);
30049         return tag_ptr(ret_conv, true);
30050 }
30051
30052 int64_t  CS_LDK_CResult_ChannelAnnouncementDecodeErrorZ_ok(int64_t o) {
30053         LDKChannelAnnouncement o_conv;
30054         o_conv.inner = untag_ptr(o);
30055         o_conv.is_owned = ptr_is_owned(o);
30056         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30057         o_conv = ChannelAnnouncement_clone(&o_conv);
30058         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
30059         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_ok(o_conv);
30060         return tag_ptr(ret_conv, true);
30061 }
30062
30063 int64_t  CS_LDK_CResult_ChannelAnnouncementDecodeErrorZ_err(int64_t e) {
30064         void* e_ptr = untag_ptr(e);
30065         CHECK_ACCESS(e_ptr);
30066         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30067         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30068         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
30069         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_err(e_conv);
30070         return tag_ptr(ret_conv, true);
30071 }
30072
30073 jboolean  CS_LDK_CResult_ChannelAnnouncementDecodeErrorZ_is_ok(int64_t o) {
30074         LDKCResult_ChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(o);
30075         jboolean ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
30076         return ret_conv;
30077 }
30078
30079 void  CS_LDK_CResult_ChannelAnnouncementDecodeErrorZ_free(int64_t _res) {
30080         if (!ptr_is_owned(_res)) return;
30081         void* _res_ptr = untag_ptr(_res);
30082         CHECK_ACCESS(_res_ptr);
30083         LDKCResult_ChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_ChannelAnnouncementDecodeErrorZ*)(_res_ptr);
30084         FREE(untag_ptr(_res));
30085         CResult_ChannelAnnouncementDecodeErrorZ_free(_res_conv);
30086 }
30087
30088 static inline uint64_t CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
30089         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
30090         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(arg);
30091         return tag_ptr(ret_conv, true);
30092 }
30093 int64_t  CS_LDK_CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(int64_t arg) {
30094         LDKCResult_ChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(arg);
30095         int64_t ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
30096         return ret_conv;
30097 }
30098
30099 int64_t  CS_LDK_CResult_ChannelAnnouncementDecodeErrorZ_clone(int64_t orig) {
30100         LDKCResult_ChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(orig);
30101         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
30102         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(orig_conv);
30103         return tag_ptr(ret_conv, true);
30104 }
30105
30106 int64_t  CS_LDK_CResult_UnsignedChannelUpdateDecodeErrorZ_ok(int64_t o) {
30107         LDKUnsignedChannelUpdate o_conv;
30108         o_conv.inner = untag_ptr(o);
30109         o_conv.is_owned = ptr_is_owned(o);
30110         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30111         o_conv = UnsignedChannelUpdate_clone(&o_conv);
30112         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
30113         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o_conv);
30114         return tag_ptr(ret_conv, true);
30115 }
30116
30117 int64_t  CS_LDK_CResult_UnsignedChannelUpdateDecodeErrorZ_err(int64_t e) {
30118         void* e_ptr = untag_ptr(e);
30119         CHECK_ACCESS(e_ptr);
30120         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30121         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30122         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
30123         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_err(e_conv);
30124         return tag_ptr(ret_conv, true);
30125 }
30126
30127 jboolean  CS_LDK_CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(int64_t o) {
30128         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(o);
30129         jboolean ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o_conv);
30130         return ret_conv;
30131 }
30132
30133 void  CS_LDK_CResult_UnsignedChannelUpdateDecodeErrorZ_free(int64_t _res) {
30134         if (!ptr_is_owned(_res)) return;
30135         void* _res_ptr = untag_ptr(_res);
30136         CHECK_ACCESS(_res_ptr);
30137         LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(_res_ptr);
30138         FREE(untag_ptr(_res));
30139         CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res_conv);
30140 }
30141
30142 static inline uint64_t CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
30143         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
30144         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(arg);
30145         return tag_ptr(ret_conv, true);
30146 }
30147 int64_t  CS_LDK_CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(int64_t arg) {
30148         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(arg);
30149         int64_t ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
30150         return ret_conv;
30151 }
30152
30153 int64_t  CS_LDK_CResult_UnsignedChannelUpdateDecodeErrorZ_clone(int64_t orig) {
30154         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(orig);
30155         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
30156         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig_conv);
30157         return tag_ptr(ret_conv, true);
30158 }
30159
30160 int64_t  CS_LDK_CResult_ChannelUpdateDecodeErrorZ_ok(int64_t o) {
30161         LDKChannelUpdate o_conv;
30162         o_conv.inner = untag_ptr(o);
30163         o_conv.is_owned = ptr_is_owned(o);
30164         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30165         o_conv = ChannelUpdate_clone(&o_conv);
30166         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
30167         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_ok(o_conv);
30168         return tag_ptr(ret_conv, true);
30169 }
30170
30171 int64_t  CS_LDK_CResult_ChannelUpdateDecodeErrorZ_err(int64_t e) {
30172         void* e_ptr = untag_ptr(e);
30173         CHECK_ACCESS(e_ptr);
30174         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30175         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30176         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
30177         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_err(e_conv);
30178         return tag_ptr(ret_conv, true);
30179 }
30180
30181 jboolean  CS_LDK_CResult_ChannelUpdateDecodeErrorZ_is_ok(int64_t o) {
30182         LDKCResult_ChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(o);
30183         jboolean ret_conv = CResult_ChannelUpdateDecodeErrorZ_is_ok(o_conv);
30184         return ret_conv;
30185 }
30186
30187 void  CS_LDK_CResult_ChannelUpdateDecodeErrorZ_free(int64_t _res) {
30188         if (!ptr_is_owned(_res)) return;
30189         void* _res_ptr = untag_ptr(_res);
30190         CHECK_ACCESS(_res_ptr);
30191         LDKCResult_ChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateDecodeErrorZ*)(_res_ptr);
30192         FREE(untag_ptr(_res));
30193         CResult_ChannelUpdateDecodeErrorZ_free(_res_conv);
30194 }
30195
30196 static inline uint64_t CResult_ChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
30197         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
30198         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(arg);
30199         return tag_ptr(ret_conv, true);
30200 }
30201 int64_t  CS_LDK_CResult_ChannelUpdateDecodeErrorZ_clone_ptr(int64_t arg) {
30202         LDKCResult_ChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(arg);
30203         int64_t ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
30204         return ret_conv;
30205 }
30206
30207 int64_t  CS_LDK_CResult_ChannelUpdateDecodeErrorZ_clone(int64_t orig) {
30208         LDKCResult_ChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(orig);
30209         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
30210         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(orig_conv);
30211         return tag_ptr(ret_conv, true);
30212 }
30213
30214 int64_t  CS_LDK_CResult_ErrorMessageDecodeErrorZ_ok(int64_t o) {
30215         LDKErrorMessage o_conv;
30216         o_conv.inner = untag_ptr(o);
30217         o_conv.is_owned = ptr_is_owned(o);
30218         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30219         o_conv = ErrorMessage_clone(&o_conv);
30220         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
30221         *ret_conv = CResult_ErrorMessageDecodeErrorZ_ok(o_conv);
30222         return tag_ptr(ret_conv, true);
30223 }
30224
30225 int64_t  CS_LDK_CResult_ErrorMessageDecodeErrorZ_err(int64_t e) {
30226         void* e_ptr = untag_ptr(e);
30227         CHECK_ACCESS(e_ptr);
30228         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30229         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30230         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
30231         *ret_conv = CResult_ErrorMessageDecodeErrorZ_err(e_conv);
30232         return tag_ptr(ret_conv, true);
30233 }
30234
30235 jboolean  CS_LDK_CResult_ErrorMessageDecodeErrorZ_is_ok(int64_t o) {
30236         LDKCResult_ErrorMessageDecodeErrorZ* o_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(o);
30237         jboolean ret_conv = CResult_ErrorMessageDecodeErrorZ_is_ok(o_conv);
30238         return ret_conv;
30239 }
30240
30241 void  CS_LDK_CResult_ErrorMessageDecodeErrorZ_free(int64_t _res) {
30242         if (!ptr_is_owned(_res)) return;
30243         void* _res_ptr = untag_ptr(_res);
30244         CHECK_ACCESS(_res_ptr);
30245         LDKCResult_ErrorMessageDecodeErrorZ _res_conv = *(LDKCResult_ErrorMessageDecodeErrorZ*)(_res_ptr);
30246         FREE(untag_ptr(_res));
30247         CResult_ErrorMessageDecodeErrorZ_free(_res_conv);
30248 }
30249
30250 static inline uint64_t CResult_ErrorMessageDecodeErrorZ_clone_ptr(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR arg) {
30251         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
30252         *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(arg);
30253         return tag_ptr(ret_conv, true);
30254 }
30255 int64_t  CS_LDK_CResult_ErrorMessageDecodeErrorZ_clone_ptr(int64_t arg) {
30256         LDKCResult_ErrorMessageDecodeErrorZ* arg_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(arg);
30257         int64_t ret_conv = CResult_ErrorMessageDecodeErrorZ_clone_ptr(arg_conv);
30258         return ret_conv;
30259 }
30260
30261 int64_t  CS_LDK_CResult_ErrorMessageDecodeErrorZ_clone(int64_t orig) {
30262         LDKCResult_ErrorMessageDecodeErrorZ* orig_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(orig);
30263         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
30264         *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(orig_conv);
30265         return tag_ptr(ret_conv, true);
30266 }
30267
30268 int64_t  CS_LDK_CResult_WarningMessageDecodeErrorZ_ok(int64_t o) {
30269         LDKWarningMessage o_conv;
30270         o_conv.inner = untag_ptr(o);
30271         o_conv.is_owned = ptr_is_owned(o);
30272         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30273         o_conv = WarningMessage_clone(&o_conv);
30274         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
30275         *ret_conv = CResult_WarningMessageDecodeErrorZ_ok(o_conv);
30276         return tag_ptr(ret_conv, true);
30277 }
30278
30279 int64_t  CS_LDK_CResult_WarningMessageDecodeErrorZ_err(int64_t e) {
30280         void* e_ptr = untag_ptr(e);
30281         CHECK_ACCESS(e_ptr);
30282         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30283         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30284         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
30285         *ret_conv = CResult_WarningMessageDecodeErrorZ_err(e_conv);
30286         return tag_ptr(ret_conv, true);
30287 }
30288
30289 jboolean  CS_LDK_CResult_WarningMessageDecodeErrorZ_is_ok(int64_t o) {
30290         LDKCResult_WarningMessageDecodeErrorZ* o_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(o);
30291         jboolean ret_conv = CResult_WarningMessageDecodeErrorZ_is_ok(o_conv);
30292         return ret_conv;
30293 }
30294
30295 void  CS_LDK_CResult_WarningMessageDecodeErrorZ_free(int64_t _res) {
30296         if (!ptr_is_owned(_res)) return;
30297         void* _res_ptr = untag_ptr(_res);
30298         CHECK_ACCESS(_res_ptr);
30299         LDKCResult_WarningMessageDecodeErrorZ _res_conv = *(LDKCResult_WarningMessageDecodeErrorZ*)(_res_ptr);
30300         FREE(untag_ptr(_res));
30301         CResult_WarningMessageDecodeErrorZ_free(_res_conv);
30302 }
30303
30304 static inline uint64_t CResult_WarningMessageDecodeErrorZ_clone_ptr(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR arg) {
30305         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
30306         *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(arg);
30307         return tag_ptr(ret_conv, true);
30308 }
30309 int64_t  CS_LDK_CResult_WarningMessageDecodeErrorZ_clone_ptr(int64_t arg) {
30310         LDKCResult_WarningMessageDecodeErrorZ* arg_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(arg);
30311         int64_t ret_conv = CResult_WarningMessageDecodeErrorZ_clone_ptr(arg_conv);
30312         return ret_conv;
30313 }
30314
30315 int64_t  CS_LDK_CResult_WarningMessageDecodeErrorZ_clone(int64_t orig) {
30316         LDKCResult_WarningMessageDecodeErrorZ* orig_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(orig);
30317         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
30318         *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(orig_conv);
30319         return tag_ptr(ret_conv, true);
30320 }
30321
30322 int64_t  CS_LDK_CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(int64_t o) {
30323         LDKUnsignedNodeAnnouncement o_conv;
30324         o_conv.inner = untag_ptr(o);
30325         o_conv.is_owned = ptr_is_owned(o);
30326         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30327         o_conv = UnsignedNodeAnnouncement_clone(&o_conv);
30328         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
30329         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o_conv);
30330         return tag_ptr(ret_conv, true);
30331 }
30332
30333 int64_t  CS_LDK_CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(int64_t e) {
30334         void* e_ptr = untag_ptr(e);
30335         CHECK_ACCESS(e_ptr);
30336         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30337         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30338         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
30339         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e_conv);
30340         return tag_ptr(ret_conv, true);
30341 }
30342
30343 jboolean  CS_LDK_CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(int64_t o) {
30344         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(o);
30345         jboolean ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o_conv);
30346         return ret_conv;
30347 }
30348
30349 void  CS_LDK_CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(int64_t _res) {
30350         if (!ptr_is_owned(_res)) return;
30351         void* _res_ptr = untag_ptr(_res);
30352         CHECK_ACCESS(_res_ptr);
30353         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(_res_ptr);
30354         FREE(untag_ptr(_res));
30355         CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res_conv);
30356 }
30357
30358 static inline uint64_t CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
30359         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
30360         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(arg);
30361         return tag_ptr(ret_conv, true);
30362 }
30363 int64_t  CS_LDK_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(int64_t arg) {
30364         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(arg);
30365         int64_t ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
30366         return ret_conv;
30367 }
30368
30369 int64_t  CS_LDK_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(int64_t orig) {
30370         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(orig);
30371         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
30372         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig_conv);
30373         return tag_ptr(ret_conv, true);
30374 }
30375
30376 int64_t  CS_LDK_CResult_NodeAnnouncementDecodeErrorZ_ok(int64_t o) {
30377         LDKNodeAnnouncement o_conv;
30378         o_conv.inner = untag_ptr(o);
30379         o_conv.is_owned = ptr_is_owned(o);
30380         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30381         o_conv = NodeAnnouncement_clone(&o_conv);
30382         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
30383         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_ok(o_conv);
30384         return tag_ptr(ret_conv, true);
30385 }
30386
30387 int64_t  CS_LDK_CResult_NodeAnnouncementDecodeErrorZ_err(int64_t e) {
30388         void* e_ptr = untag_ptr(e);
30389         CHECK_ACCESS(e_ptr);
30390         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30391         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30392         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
30393         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_err(e_conv);
30394         return tag_ptr(ret_conv, true);
30395 }
30396
30397 jboolean  CS_LDK_CResult_NodeAnnouncementDecodeErrorZ_is_ok(int64_t o) {
30398         LDKCResult_NodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(o);
30399         jboolean ret_conv = CResult_NodeAnnouncementDecodeErrorZ_is_ok(o_conv);
30400         return ret_conv;
30401 }
30402
30403 void  CS_LDK_CResult_NodeAnnouncementDecodeErrorZ_free(int64_t _res) {
30404         if (!ptr_is_owned(_res)) return;
30405         void* _res_ptr = untag_ptr(_res);
30406         CHECK_ACCESS(_res_ptr);
30407         LDKCResult_NodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementDecodeErrorZ*)(_res_ptr);
30408         FREE(untag_ptr(_res));
30409         CResult_NodeAnnouncementDecodeErrorZ_free(_res_conv);
30410 }
30411
30412 static inline uint64_t CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
30413         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
30414         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(arg);
30415         return tag_ptr(ret_conv, true);
30416 }
30417 int64_t  CS_LDK_CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(int64_t arg) {
30418         LDKCResult_NodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(arg);
30419         int64_t ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
30420         return ret_conv;
30421 }
30422
30423 int64_t  CS_LDK_CResult_NodeAnnouncementDecodeErrorZ_clone(int64_t orig) {
30424         LDKCResult_NodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(orig);
30425         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
30426         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(orig_conv);
30427         return tag_ptr(ret_conv, true);
30428 }
30429
30430 int64_t  CS_LDK_CResult_QueryShortChannelIdsDecodeErrorZ_ok(int64_t o) {
30431         LDKQueryShortChannelIds o_conv;
30432         o_conv.inner = untag_ptr(o);
30433         o_conv.is_owned = ptr_is_owned(o);
30434         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30435         o_conv = QueryShortChannelIds_clone(&o_conv);
30436         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
30437         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_ok(o_conv);
30438         return tag_ptr(ret_conv, true);
30439 }
30440
30441 int64_t  CS_LDK_CResult_QueryShortChannelIdsDecodeErrorZ_err(int64_t e) {
30442         void* e_ptr = untag_ptr(e);
30443         CHECK_ACCESS(e_ptr);
30444         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30445         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30446         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
30447         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_err(e_conv);
30448         return tag_ptr(ret_conv, true);
30449 }
30450
30451 jboolean  CS_LDK_CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(int64_t o) {
30452         LDKCResult_QueryShortChannelIdsDecodeErrorZ* o_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(o);
30453         jboolean ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o_conv);
30454         return ret_conv;
30455 }
30456
30457 void  CS_LDK_CResult_QueryShortChannelIdsDecodeErrorZ_free(int64_t _res) {
30458         if (!ptr_is_owned(_res)) return;
30459         void* _res_ptr = untag_ptr(_res);
30460         CHECK_ACCESS(_res_ptr);
30461         LDKCResult_QueryShortChannelIdsDecodeErrorZ _res_conv = *(LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(_res_ptr);
30462         FREE(untag_ptr(_res));
30463         CResult_QueryShortChannelIdsDecodeErrorZ_free(_res_conv);
30464 }
30465
30466 static inline uint64_t CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR arg) {
30467         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
30468         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(arg);
30469         return tag_ptr(ret_conv, true);
30470 }
30471 int64_t  CS_LDK_CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(int64_t arg) {
30472         LDKCResult_QueryShortChannelIdsDecodeErrorZ* arg_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(arg);
30473         int64_t ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(arg_conv);
30474         return ret_conv;
30475 }
30476
30477 int64_t  CS_LDK_CResult_QueryShortChannelIdsDecodeErrorZ_clone(int64_t orig) {
30478         LDKCResult_QueryShortChannelIdsDecodeErrorZ* orig_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(orig);
30479         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
30480         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig_conv);
30481         return tag_ptr(ret_conv, true);
30482 }
30483
30484 int64_t  CS_LDK_CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(int64_t o) {
30485         LDKReplyShortChannelIdsEnd o_conv;
30486         o_conv.inner = untag_ptr(o);
30487         o_conv.is_owned = ptr_is_owned(o);
30488         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30489         o_conv = ReplyShortChannelIdsEnd_clone(&o_conv);
30490         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
30491         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o_conv);
30492         return tag_ptr(ret_conv, true);
30493 }
30494
30495 int64_t  CS_LDK_CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(int64_t e) {
30496         void* e_ptr = untag_ptr(e);
30497         CHECK_ACCESS(e_ptr);
30498         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30499         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30500         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
30501         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e_conv);
30502         return tag_ptr(ret_conv, true);
30503 }
30504
30505 jboolean  CS_LDK_CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(int64_t o) {
30506         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* o_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(o);
30507         jboolean ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o_conv);
30508         return ret_conv;
30509 }
30510
30511 void  CS_LDK_CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(int64_t _res) {
30512         if (!ptr_is_owned(_res)) return;
30513         void* _res_ptr = untag_ptr(_res);
30514         CHECK_ACCESS(_res_ptr);
30515         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res_conv = *(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(_res_ptr);
30516         FREE(untag_ptr(_res));
30517         CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res_conv);
30518 }
30519
30520 static inline uint64_t CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR arg) {
30521         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
30522         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(arg);
30523         return tag_ptr(ret_conv, true);
30524 }
30525 int64_t  CS_LDK_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(int64_t arg) {
30526         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* arg_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(arg);
30527         int64_t ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(arg_conv);
30528         return ret_conv;
30529 }
30530
30531 int64_t  CS_LDK_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(int64_t orig) {
30532         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* orig_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(orig);
30533         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
30534         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig_conv);
30535         return tag_ptr(ret_conv, true);
30536 }
30537
30538 int64_t  CS_LDK_CResult_QueryChannelRangeDecodeErrorZ_ok(int64_t o) {
30539         LDKQueryChannelRange o_conv;
30540         o_conv.inner = untag_ptr(o);
30541         o_conv.is_owned = ptr_is_owned(o);
30542         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30543         o_conv = QueryChannelRange_clone(&o_conv);
30544         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
30545         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_ok(o_conv);
30546         return tag_ptr(ret_conv, true);
30547 }
30548
30549 int64_t  CS_LDK_CResult_QueryChannelRangeDecodeErrorZ_err(int64_t e) {
30550         void* e_ptr = untag_ptr(e);
30551         CHECK_ACCESS(e_ptr);
30552         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30553         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30554         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
30555         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_err(e_conv);
30556         return tag_ptr(ret_conv, true);
30557 }
30558
30559 jboolean  CS_LDK_CResult_QueryChannelRangeDecodeErrorZ_is_ok(int64_t o) {
30560         LDKCResult_QueryChannelRangeDecodeErrorZ* o_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(o);
30561         jboolean ret_conv = CResult_QueryChannelRangeDecodeErrorZ_is_ok(o_conv);
30562         return ret_conv;
30563 }
30564
30565 void  CS_LDK_CResult_QueryChannelRangeDecodeErrorZ_free(int64_t _res) {
30566         if (!ptr_is_owned(_res)) return;
30567         void* _res_ptr = untag_ptr(_res);
30568         CHECK_ACCESS(_res_ptr);
30569         LDKCResult_QueryChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_QueryChannelRangeDecodeErrorZ*)(_res_ptr);
30570         FREE(untag_ptr(_res));
30571         CResult_QueryChannelRangeDecodeErrorZ_free(_res_conv);
30572 }
30573
30574 static inline uint64_t CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
30575         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
30576         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(arg);
30577         return tag_ptr(ret_conv, true);
30578 }
30579 int64_t  CS_LDK_CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(int64_t arg) {
30580         LDKCResult_QueryChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(arg);
30581         int64_t ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
30582         return ret_conv;
30583 }
30584
30585 int64_t  CS_LDK_CResult_QueryChannelRangeDecodeErrorZ_clone(int64_t orig) {
30586         LDKCResult_QueryChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(orig);
30587         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
30588         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(orig_conv);
30589         return tag_ptr(ret_conv, true);
30590 }
30591
30592 int64_t  CS_LDK_CResult_ReplyChannelRangeDecodeErrorZ_ok(int64_t o) {
30593         LDKReplyChannelRange o_conv;
30594         o_conv.inner = untag_ptr(o);
30595         o_conv.is_owned = ptr_is_owned(o);
30596         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30597         o_conv = ReplyChannelRange_clone(&o_conv);
30598         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
30599         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_ok(o_conv);
30600         return tag_ptr(ret_conv, true);
30601 }
30602
30603 int64_t  CS_LDK_CResult_ReplyChannelRangeDecodeErrorZ_err(int64_t e) {
30604         void* e_ptr = untag_ptr(e);
30605         CHECK_ACCESS(e_ptr);
30606         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30607         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30608         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
30609         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_err(e_conv);
30610         return tag_ptr(ret_conv, true);
30611 }
30612
30613 jboolean  CS_LDK_CResult_ReplyChannelRangeDecodeErrorZ_is_ok(int64_t o) {
30614         LDKCResult_ReplyChannelRangeDecodeErrorZ* o_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(o);
30615         jboolean ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o_conv);
30616         return ret_conv;
30617 }
30618
30619 void  CS_LDK_CResult_ReplyChannelRangeDecodeErrorZ_free(int64_t _res) {
30620         if (!ptr_is_owned(_res)) return;
30621         void* _res_ptr = untag_ptr(_res);
30622         CHECK_ACCESS(_res_ptr);
30623         LDKCResult_ReplyChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_ReplyChannelRangeDecodeErrorZ*)(_res_ptr);
30624         FREE(untag_ptr(_res));
30625         CResult_ReplyChannelRangeDecodeErrorZ_free(_res_conv);
30626 }
30627
30628 static inline uint64_t CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
30629         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
30630         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(arg);
30631         return tag_ptr(ret_conv, true);
30632 }
30633 int64_t  CS_LDK_CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(int64_t arg) {
30634         LDKCResult_ReplyChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(arg);
30635         int64_t ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
30636         return ret_conv;
30637 }
30638
30639 int64_t  CS_LDK_CResult_ReplyChannelRangeDecodeErrorZ_clone(int64_t orig) {
30640         LDKCResult_ReplyChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(orig);
30641         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
30642         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(orig_conv);
30643         return tag_ptr(ret_conv, true);
30644 }
30645
30646 int64_t  CS_LDK_CResult_GossipTimestampFilterDecodeErrorZ_ok(int64_t o) {
30647         LDKGossipTimestampFilter o_conv;
30648         o_conv.inner = untag_ptr(o);
30649         o_conv.is_owned = ptr_is_owned(o);
30650         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30651         o_conv = GossipTimestampFilter_clone(&o_conv);
30652         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
30653         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_ok(o_conv);
30654         return tag_ptr(ret_conv, true);
30655 }
30656
30657 int64_t  CS_LDK_CResult_GossipTimestampFilterDecodeErrorZ_err(int64_t e) {
30658         void* e_ptr = untag_ptr(e);
30659         CHECK_ACCESS(e_ptr);
30660         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30661         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30662         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
30663         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_err(e_conv);
30664         return tag_ptr(ret_conv, true);
30665 }
30666
30667 jboolean  CS_LDK_CResult_GossipTimestampFilterDecodeErrorZ_is_ok(int64_t o) {
30668         LDKCResult_GossipTimestampFilterDecodeErrorZ* o_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(o);
30669         jboolean ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o_conv);
30670         return ret_conv;
30671 }
30672
30673 void  CS_LDK_CResult_GossipTimestampFilterDecodeErrorZ_free(int64_t _res) {
30674         if (!ptr_is_owned(_res)) return;
30675         void* _res_ptr = untag_ptr(_res);
30676         CHECK_ACCESS(_res_ptr);
30677         LDKCResult_GossipTimestampFilterDecodeErrorZ _res_conv = *(LDKCResult_GossipTimestampFilterDecodeErrorZ*)(_res_ptr);
30678         FREE(untag_ptr(_res));
30679         CResult_GossipTimestampFilterDecodeErrorZ_free(_res_conv);
30680 }
30681
30682 static inline uint64_t CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR arg) {
30683         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
30684         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(arg);
30685         return tag_ptr(ret_conv, true);
30686 }
30687 int64_t  CS_LDK_CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(int64_t arg) {
30688         LDKCResult_GossipTimestampFilterDecodeErrorZ* arg_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(arg);
30689         int64_t ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(arg_conv);
30690         return ret_conv;
30691 }
30692
30693 int64_t  CS_LDK_CResult_GossipTimestampFilterDecodeErrorZ_clone(int64_t orig) {
30694         LDKCResult_GossipTimestampFilterDecodeErrorZ* orig_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(orig);
30695         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
30696         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(orig_conv);
30697         return tag_ptr(ret_conv, true);
30698 }
30699
30700 void  CS_LDK_CVec_PhantomRouteHintsZ_free(int64_tArray _res) {
30701         LDKCVec_PhantomRouteHintsZ _res_constr;
30702         _res_constr.datalen = _res->arr_len;
30703         if (_res_constr.datalen > 0)
30704                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
30705         else
30706                 _res_constr.data = NULL;
30707         int64_t* _res_vals = _res->elems;
30708         for (size_t t = 0; t < _res_constr.datalen; t++) {
30709                 int64_t _res_conv_19 = _res_vals[t];
30710                 LDKPhantomRouteHints _res_conv_19_conv;
30711                 _res_conv_19_conv.inner = untag_ptr(_res_conv_19);
30712                 _res_conv_19_conv.is_owned = ptr_is_owned(_res_conv_19);
30713                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv);
30714                 _res_constr.data[t] = _res_conv_19_conv;
30715         }
30716         FREE(_res);
30717         CVec_PhantomRouteHintsZ_free(_res_constr);
30718 }
30719
30720 int64_t  CS_LDK_CResult_Bolt11InvoiceSignOrCreationErrorZ_ok(int64_t o) {
30721         LDKBolt11Invoice o_conv;
30722         o_conv.inner = untag_ptr(o);
30723         o_conv.is_owned = ptr_is_owned(o);
30724         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30725         o_conv = Bolt11Invoice_clone(&o_conv);
30726         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
30727         *ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_ok(o_conv);
30728         return tag_ptr(ret_conv, true);
30729 }
30730
30731 int64_t  CS_LDK_CResult_Bolt11InvoiceSignOrCreationErrorZ_err(int64_t e) {
30732         void* e_ptr = untag_ptr(e);
30733         CHECK_ACCESS(e_ptr);
30734         LDKSignOrCreationError e_conv = *(LDKSignOrCreationError*)(e_ptr);
30735         e_conv = SignOrCreationError_clone((LDKSignOrCreationError*)untag_ptr(e));
30736         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
30737         *ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_err(e_conv);
30738         return tag_ptr(ret_conv, true);
30739 }
30740
30741 jboolean  CS_LDK_CResult_Bolt11InvoiceSignOrCreationErrorZ_is_ok(int64_t o) {
30742         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* o_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(o);
30743         jboolean ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_is_ok(o_conv);
30744         return ret_conv;
30745 }
30746
30747 void  CS_LDK_CResult_Bolt11InvoiceSignOrCreationErrorZ_free(int64_t _res) {
30748         if (!ptr_is_owned(_res)) return;
30749         void* _res_ptr = untag_ptr(_res);
30750         CHECK_ACCESS(_res_ptr);
30751         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ _res_conv = *(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)(_res_ptr);
30752         FREE(untag_ptr(_res));
30753         CResult_Bolt11InvoiceSignOrCreationErrorZ_free(_res_conv);
30754 }
30755
30756 static inline uint64_t CResult_Bolt11InvoiceSignOrCreationErrorZ_clone_ptr(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ *NONNULL_PTR arg) {
30757         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
30758         *ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_clone(arg);
30759         return tag_ptr(ret_conv, true);
30760 }
30761 int64_t  CS_LDK_CResult_Bolt11InvoiceSignOrCreationErrorZ_clone_ptr(int64_t arg) {
30762         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* arg_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(arg);
30763         int64_t ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_clone_ptr(arg_conv);
30764         return ret_conv;
30765 }
30766
30767 int64_t  CS_LDK_CResult_Bolt11InvoiceSignOrCreationErrorZ_clone(int64_t orig) {
30768         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* orig_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(orig);
30769         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
30770         *ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_clone(orig_conv);
30771         return tag_ptr(ret_conv, true);
30772 }
30773
30774 int64_t  CS_LDK_COption_InboundHTLCStateDetailsZ_some(int32_t o) {
30775         LDKInboundHTLCStateDetails o_conv = LDKInboundHTLCStateDetails_from_cs(o);
30776         LDKCOption_InboundHTLCStateDetailsZ *ret_copy = MALLOC(sizeof(LDKCOption_InboundHTLCStateDetailsZ), "LDKCOption_InboundHTLCStateDetailsZ");
30777         *ret_copy = COption_InboundHTLCStateDetailsZ_some(o_conv);
30778         int64_t ret_ref = tag_ptr(ret_copy, true);
30779         return ret_ref;
30780 }
30781
30782 int64_t  CS_LDK_COption_InboundHTLCStateDetailsZ_none() {
30783         LDKCOption_InboundHTLCStateDetailsZ *ret_copy = MALLOC(sizeof(LDKCOption_InboundHTLCStateDetailsZ), "LDKCOption_InboundHTLCStateDetailsZ");
30784         *ret_copy = COption_InboundHTLCStateDetailsZ_none();
30785         int64_t ret_ref = tag_ptr(ret_copy, true);
30786         return ret_ref;
30787 }
30788
30789 void  CS_LDK_COption_InboundHTLCStateDetailsZ_free(int64_t _res) {
30790         if (!ptr_is_owned(_res)) return;
30791         void* _res_ptr = untag_ptr(_res);
30792         CHECK_ACCESS(_res_ptr);
30793         LDKCOption_InboundHTLCStateDetailsZ _res_conv = *(LDKCOption_InboundHTLCStateDetailsZ*)(_res_ptr);
30794         FREE(untag_ptr(_res));
30795         COption_InboundHTLCStateDetailsZ_free(_res_conv);
30796 }
30797
30798 static inline uint64_t COption_InboundHTLCStateDetailsZ_clone_ptr(LDKCOption_InboundHTLCStateDetailsZ *NONNULL_PTR arg) {
30799         LDKCOption_InboundHTLCStateDetailsZ *ret_copy = MALLOC(sizeof(LDKCOption_InboundHTLCStateDetailsZ), "LDKCOption_InboundHTLCStateDetailsZ");
30800         *ret_copy = COption_InboundHTLCStateDetailsZ_clone(arg);
30801         int64_t ret_ref = tag_ptr(ret_copy, true);
30802         return ret_ref;
30803 }
30804 int64_t  CS_LDK_COption_InboundHTLCStateDetailsZ_clone_ptr(int64_t arg) {
30805         LDKCOption_InboundHTLCStateDetailsZ* arg_conv = (LDKCOption_InboundHTLCStateDetailsZ*)untag_ptr(arg);
30806         int64_t ret_conv = COption_InboundHTLCStateDetailsZ_clone_ptr(arg_conv);
30807         return ret_conv;
30808 }
30809
30810 int64_t  CS_LDK_COption_InboundHTLCStateDetailsZ_clone(int64_t orig) {
30811         LDKCOption_InboundHTLCStateDetailsZ* orig_conv = (LDKCOption_InboundHTLCStateDetailsZ*)untag_ptr(orig);
30812         LDKCOption_InboundHTLCStateDetailsZ *ret_copy = MALLOC(sizeof(LDKCOption_InboundHTLCStateDetailsZ), "LDKCOption_InboundHTLCStateDetailsZ");
30813         *ret_copy = COption_InboundHTLCStateDetailsZ_clone(orig_conv);
30814         int64_t ret_ref = tag_ptr(ret_copy, true);
30815         return ret_ref;
30816 }
30817
30818 int64_t  CS_LDK_CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_ok(int64_t o) {
30819         void* o_ptr = untag_ptr(o);
30820         CHECK_ACCESS(o_ptr);
30821         LDKCOption_InboundHTLCStateDetailsZ o_conv = *(LDKCOption_InboundHTLCStateDetailsZ*)(o_ptr);
30822         o_conv = COption_InboundHTLCStateDetailsZ_clone((LDKCOption_InboundHTLCStateDetailsZ*)untag_ptr(o));
30823         LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ), "LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ");
30824         *ret_conv = CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_ok(o_conv);
30825         return tag_ptr(ret_conv, true);
30826 }
30827
30828 int64_t  CS_LDK_CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_err(int64_t e) {
30829         void* e_ptr = untag_ptr(e);
30830         CHECK_ACCESS(e_ptr);
30831         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30832         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30833         LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ), "LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ");
30834         *ret_conv = CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_err(e_conv);
30835         return tag_ptr(ret_conv, true);
30836 }
30837
30838 jboolean  CS_LDK_CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_is_ok(int64_t o) {
30839         LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ* o_conv = (LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ*)untag_ptr(o);
30840         jboolean ret_conv = CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_is_ok(o_conv);
30841         return ret_conv;
30842 }
30843
30844 void  CS_LDK_CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_free(int64_t _res) {
30845         if (!ptr_is_owned(_res)) return;
30846         void* _res_ptr = untag_ptr(_res);
30847         CHECK_ACCESS(_res_ptr);
30848         LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ _res_conv = *(LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ*)(_res_ptr);
30849         FREE(untag_ptr(_res));
30850         CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_free(_res_conv);
30851 }
30852
30853 static inline uint64_t CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_clone_ptr(LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ *NONNULL_PTR arg) {
30854         LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ), "LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ");
30855         *ret_conv = CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_clone(arg);
30856         return tag_ptr(ret_conv, true);
30857 }
30858 int64_t  CS_LDK_CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_clone_ptr(int64_t arg) {
30859         LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ* arg_conv = (LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ*)untag_ptr(arg);
30860         int64_t ret_conv = CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_clone_ptr(arg_conv);
30861         return ret_conv;
30862 }
30863
30864 int64_t  CS_LDK_CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_clone(int64_t orig) {
30865         LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ* orig_conv = (LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ*)untag_ptr(orig);
30866         LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ), "LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ");
30867         *ret_conv = CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_clone(orig_conv);
30868         return tag_ptr(ret_conv, true);
30869 }
30870
30871 int64_t  CS_LDK_CResult_InboundHTLCDetailsDecodeErrorZ_ok(int64_t o) {
30872         LDKInboundHTLCDetails o_conv;
30873         o_conv.inner = untag_ptr(o);
30874         o_conv.is_owned = ptr_is_owned(o);
30875         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30876         o_conv = InboundHTLCDetails_clone(&o_conv);
30877         LDKCResult_InboundHTLCDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InboundHTLCDetailsDecodeErrorZ), "LDKCResult_InboundHTLCDetailsDecodeErrorZ");
30878         *ret_conv = CResult_InboundHTLCDetailsDecodeErrorZ_ok(o_conv);
30879         return tag_ptr(ret_conv, true);
30880 }
30881
30882 int64_t  CS_LDK_CResult_InboundHTLCDetailsDecodeErrorZ_err(int64_t e) {
30883         void* e_ptr = untag_ptr(e);
30884         CHECK_ACCESS(e_ptr);
30885         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30886         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30887         LDKCResult_InboundHTLCDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InboundHTLCDetailsDecodeErrorZ), "LDKCResult_InboundHTLCDetailsDecodeErrorZ");
30888         *ret_conv = CResult_InboundHTLCDetailsDecodeErrorZ_err(e_conv);
30889         return tag_ptr(ret_conv, true);
30890 }
30891
30892 jboolean  CS_LDK_CResult_InboundHTLCDetailsDecodeErrorZ_is_ok(int64_t o) {
30893         LDKCResult_InboundHTLCDetailsDecodeErrorZ* o_conv = (LDKCResult_InboundHTLCDetailsDecodeErrorZ*)untag_ptr(o);
30894         jboolean ret_conv = CResult_InboundHTLCDetailsDecodeErrorZ_is_ok(o_conv);
30895         return ret_conv;
30896 }
30897
30898 void  CS_LDK_CResult_InboundHTLCDetailsDecodeErrorZ_free(int64_t _res) {
30899         if (!ptr_is_owned(_res)) return;
30900         void* _res_ptr = untag_ptr(_res);
30901         CHECK_ACCESS(_res_ptr);
30902         LDKCResult_InboundHTLCDetailsDecodeErrorZ _res_conv = *(LDKCResult_InboundHTLCDetailsDecodeErrorZ*)(_res_ptr);
30903         FREE(untag_ptr(_res));
30904         CResult_InboundHTLCDetailsDecodeErrorZ_free(_res_conv);
30905 }
30906
30907 static inline uint64_t CResult_InboundHTLCDetailsDecodeErrorZ_clone_ptr(LDKCResult_InboundHTLCDetailsDecodeErrorZ *NONNULL_PTR arg) {
30908         LDKCResult_InboundHTLCDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InboundHTLCDetailsDecodeErrorZ), "LDKCResult_InboundHTLCDetailsDecodeErrorZ");
30909         *ret_conv = CResult_InboundHTLCDetailsDecodeErrorZ_clone(arg);
30910         return tag_ptr(ret_conv, true);
30911 }
30912 int64_t  CS_LDK_CResult_InboundHTLCDetailsDecodeErrorZ_clone_ptr(int64_t arg) {
30913         LDKCResult_InboundHTLCDetailsDecodeErrorZ* arg_conv = (LDKCResult_InboundHTLCDetailsDecodeErrorZ*)untag_ptr(arg);
30914         int64_t ret_conv = CResult_InboundHTLCDetailsDecodeErrorZ_clone_ptr(arg_conv);
30915         return ret_conv;
30916 }
30917
30918 int64_t  CS_LDK_CResult_InboundHTLCDetailsDecodeErrorZ_clone(int64_t orig) {
30919         LDKCResult_InboundHTLCDetailsDecodeErrorZ* orig_conv = (LDKCResult_InboundHTLCDetailsDecodeErrorZ*)untag_ptr(orig);
30920         LDKCResult_InboundHTLCDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InboundHTLCDetailsDecodeErrorZ), "LDKCResult_InboundHTLCDetailsDecodeErrorZ");
30921         *ret_conv = CResult_InboundHTLCDetailsDecodeErrorZ_clone(orig_conv);
30922         return tag_ptr(ret_conv, true);
30923 }
30924
30925 int64_t  CS_LDK_COption_OutboundHTLCStateDetailsZ_some(int32_t o) {
30926         LDKOutboundHTLCStateDetails o_conv = LDKOutboundHTLCStateDetails_from_cs(o);
30927         LDKCOption_OutboundHTLCStateDetailsZ *ret_copy = MALLOC(sizeof(LDKCOption_OutboundHTLCStateDetailsZ), "LDKCOption_OutboundHTLCStateDetailsZ");
30928         *ret_copy = COption_OutboundHTLCStateDetailsZ_some(o_conv);
30929         int64_t ret_ref = tag_ptr(ret_copy, true);
30930         return ret_ref;
30931 }
30932
30933 int64_t  CS_LDK_COption_OutboundHTLCStateDetailsZ_none() {
30934         LDKCOption_OutboundHTLCStateDetailsZ *ret_copy = MALLOC(sizeof(LDKCOption_OutboundHTLCStateDetailsZ), "LDKCOption_OutboundHTLCStateDetailsZ");
30935         *ret_copy = COption_OutboundHTLCStateDetailsZ_none();
30936         int64_t ret_ref = tag_ptr(ret_copy, true);
30937         return ret_ref;
30938 }
30939
30940 void  CS_LDK_COption_OutboundHTLCStateDetailsZ_free(int64_t _res) {
30941         if (!ptr_is_owned(_res)) return;
30942         void* _res_ptr = untag_ptr(_res);
30943         CHECK_ACCESS(_res_ptr);
30944         LDKCOption_OutboundHTLCStateDetailsZ _res_conv = *(LDKCOption_OutboundHTLCStateDetailsZ*)(_res_ptr);
30945         FREE(untag_ptr(_res));
30946         COption_OutboundHTLCStateDetailsZ_free(_res_conv);
30947 }
30948
30949 static inline uint64_t COption_OutboundHTLCStateDetailsZ_clone_ptr(LDKCOption_OutboundHTLCStateDetailsZ *NONNULL_PTR arg) {
30950         LDKCOption_OutboundHTLCStateDetailsZ *ret_copy = MALLOC(sizeof(LDKCOption_OutboundHTLCStateDetailsZ), "LDKCOption_OutboundHTLCStateDetailsZ");
30951         *ret_copy = COption_OutboundHTLCStateDetailsZ_clone(arg);
30952         int64_t ret_ref = tag_ptr(ret_copy, true);
30953         return ret_ref;
30954 }
30955 int64_t  CS_LDK_COption_OutboundHTLCStateDetailsZ_clone_ptr(int64_t arg) {
30956         LDKCOption_OutboundHTLCStateDetailsZ* arg_conv = (LDKCOption_OutboundHTLCStateDetailsZ*)untag_ptr(arg);
30957         int64_t ret_conv = COption_OutboundHTLCStateDetailsZ_clone_ptr(arg_conv);
30958         return ret_conv;
30959 }
30960
30961 int64_t  CS_LDK_COption_OutboundHTLCStateDetailsZ_clone(int64_t orig) {
30962         LDKCOption_OutboundHTLCStateDetailsZ* orig_conv = (LDKCOption_OutboundHTLCStateDetailsZ*)untag_ptr(orig);
30963         LDKCOption_OutboundHTLCStateDetailsZ *ret_copy = MALLOC(sizeof(LDKCOption_OutboundHTLCStateDetailsZ), "LDKCOption_OutboundHTLCStateDetailsZ");
30964         *ret_copy = COption_OutboundHTLCStateDetailsZ_clone(orig_conv);
30965         int64_t ret_ref = tag_ptr(ret_copy, true);
30966         return ret_ref;
30967 }
30968
30969 int64_t  CS_LDK_CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_ok(int64_t o) {
30970         void* o_ptr = untag_ptr(o);
30971         CHECK_ACCESS(o_ptr);
30972         LDKCOption_OutboundHTLCStateDetailsZ o_conv = *(LDKCOption_OutboundHTLCStateDetailsZ*)(o_ptr);
30973         o_conv = COption_OutboundHTLCStateDetailsZ_clone((LDKCOption_OutboundHTLCStateDetailsZ*)untag_ptr(o));
30974         LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ), "LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ");
30975         *ret_conv = CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_ok(o_conv);
30976         return tag_ptr(ret_conv, true);
30977 }
30978
30979 int64_t  CS_LDK_CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_err(int64_t e) {
30980         void* e_ptr = untag_ptr(e);
30981         CHECK_ACCESS(e_ptr);
30982         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30983         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30984         LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ), "LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ");
30985         *ret_conv = CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_err(e_conv);
30986         return tag_ptr(ret_conv, true);
30987 }
30988
30989 jboolean  CS_LDK_CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_is_ok(int64_t o) {
30990         LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ* o_conv = (LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ*)untag_ptr(o);
30991         jboolean ret_conv = CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_is_ok(o_conv);
30992         return ret_conv;
30993 }
30994
30995 void  CS_LDK_CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_free(int64_t _res) {
30996         if (!ptr_is_owned(_res)) return;
30997         void* _res_ptr = untag_ptr(_res);
30998         CHECK_ACCESS(_res_ptr);
30999         LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ _res_conv = *(LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ*)(_res_ptr);
31000         FREE(untag_ptr(_res));
31001         CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_free(_res_conv);
31002 }
31003
31004 static inline uint64_t CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_clone_ptr(LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ *NONNULL_PTR arg) {
31005         LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ), "LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ");
31006         *ret_conv = CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_clone(arg);
31007         return tag_ptr(ret_conv, true);
31008 }
31009 int64_t  CS_LDK_CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_clone_ptr(int64_t arg) {
31010         LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ* arg_conv = (LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ*)untag_ptr(arg);
31011         int64_t ret_conv = CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_clone_ptr(arg_conv);
31012         return ret_conv;
31013 }
31014
31015 int64_t  CS_LDK_CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_clone(int64_t orig) {
31016         LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ* orig_conv = (LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ*)untag_ptr(orig);
31017         LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ), "LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ");
31018         *ret_conv = CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_clone(orig_conv);
31019         return tag_ptr(ret_conv, true);
31020 }
31021
31022 int64_t  CS_LDK_CResult_OutboundHTLCDetailsDecodeErrorZ_ok(int64_t o) {
31023         LDKOutboundHTLCDetails o_conv;
31024         o_conv.inner = untag_ptr(o);
31025         o_conv.is_owned = ptr_is_owned(o);
31026         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31027         o_conv = OutboundHTLCDetails_clone(&o_conv);
31028         LDKCResult_OutboundHTLCDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutboundHTLCDetailsDecodeErrorZ), "LDKCResult_OutboundHTLCDetailsDecodeErrorZ");
31029         *ret_conv = CResult_OutboundHTLCDetailsDecodeErrorZ_ok(o_conv);
31030         return tag_ptr(ret_conv, true);
31031 }
31032
31033 int64_t  CS_LDK_CResult_OutboundHTLCDetailsDecodeErrorZ_err(int64_t e) {
31034         void* e_ptr = untag_ptr(e);
31035         CHECK_ACCESS(e_ptr);
31036         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31037         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31038         LDKCResult_OutboundHTLCDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutboundHTLCDetailsDecodeErrorZ), "LDKCResult_OutboundHTLCDetailsDecodeErrorZ");
31039         *ret_conv = CResult_OutboundHTLCDetailsDecodeErrorZ_err(e_conv);
31040         return tag_ptr(ret_conv, true);
31041 }
31042
31043 jboolean  CS_LDK_CResult_OutboundHTLCDetailsDecodeErrorZ_is_ok(int64_t o) {
31044         LDKCResult_OutboundHTLCDetailsDecodeErrorZ* o_conv = (LDKCResult_OutboundHTLCDetailsDecodeErrorZ*)untag_ptr(o);
31045         jboolean ret_conv = CResult_OutboundHTLCDetailsDecodeErrorZ_is_ok(o_conv);
31046         return ret_conv;
31047 }
31048
31049 void  CS_LDK_CResult_OutboundHTLCDetailsDecodeErrorZ_free(int64_t _res) {
31050         if (!ptr_is_owned(_res)) return;
31051         void* _res_ptr = untag_ptr(_res);
31052         CHECK_ACCESS(_res_ptr);
31053         LDKCResult_OutboundHTLCDetailsDecodeErrorZ _res_conv = *(LDKCResult_OutboundHTLCDetailsDecodeErrorZ*)(_res_ptr);
31054         FREE(untag_ptr(_res));
31055         CResult_OutboundHTLCDetailsDecodeErrorZ_free(_res_conv);
31056 }
31057
31058 static inline uint64_t CResult_OutboundHTLCDetailsDecodeErrorZ_clone_ptr(LDKCResult_OutboundHTLCDetailsDecodeErrorZ *NONNULL_PTR arg) {
31059         LDKCResult_OutboundHTLCDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutboundHTLCDetailsDecodeErrorZ), "LDKCResult_OutboundHTLCDetailsDecodeErrorZ");
31060         *ret_conv = CResult_OutboundHTLCDetailsDecodeErrorZ_clone(arg);
31061         return tag_ptr(ret_conv, true);
31062 }
31063 int64_t  CS_LDK_CResult_OutboundHTLCDetailsDecodeErrorZ_clone_ptr(int64_t arg) {
31064         LDKCResult_OutboundHTLCDetailsDecodeErrorZ* arg_conv = (LDKCResult_OutboundHTLCDetailsDecodeErrorZ*)untag_ptr(arg);
31065         int64_t ret_conv = CResult_OutboundHTLCDetailsDecodeErrorZ_clone_ptr(arg_conv);
31066         return ret_conv;
31067 }
31068
31069 int64_t  CS_LDK_CResult_OutboundHTLCDetailsDecodeErrorZ_clone(int64_t orig) {
31070         LDKCResult_OutboundHTLCDetailsDecodeErrorZ* orig_conv = (LDKCResult_OutboundHTLCDetailsDecodeErrorZ*)untag_ptr(orig);
31071         LDKCResult_OutboundHTLCDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutboundHTLCDetailsDecodeErrorZ), "LDKCResult_OutboundHTLCDetailsDecodeErrorZ");
31072         *ret_conv = CResult_OutboundHTLCDetailsDecodeErrorZ_clone(orig_conv);
31073         return tag_ptr(ret_conv, true);
31074 }
31075
31076 int64_t  CS_LDK_CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(int64_t o) {
31077         LDKCounterpartyForwardingInfo o_conv;
31078         o_conv.inner = untag_ptr(o);
31079         o_conv.is_owned = ptr_is_owned(o);
31080         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31081         o_conv = CounterpartyForwardingInfo_clone(&o_conv);
31082         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
31083         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(o_conv);
31084         return tag_ptr(ret_conv, true);
31085 }
31086
31087 int64_t  CS_LDK_CResult_CounterpartyForwardingInfoDecodeErrorZ_err(int64_t e) {
31088         void* e_ptr = untag_ptr(e);
31089         CHECK_ACCESS(e_ptr);
31090         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31091         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31092         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
31093         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e_conv);
31094         return tag_ptr(ret_conv, true);
31095 }
31096
31097 jboolean  CS_LDK_CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(int64_t o) {
31098         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* o_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(o);
31099         jboolean ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(o_conv);
31100         return ret_conv;
31101 }
31102
31103 void  CS_LDK_CResult_CounterpartyForwardingInfoDecodeErrorZ_free(int64_t _res) {
31104         if (!ptr_is_owned(_res)) return;
31105         void* _res_ptr = untag_ptr(_res);
31106         CHECK_ACCESS(_res_ptr);
31107         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(_res_ptr);
31108         FREE(untag_ptr(_res));
31109         CResult_CounterpartyForwardingInfoDecodeErrorZ_free(_res_conv);
31110 }
31111
31112 static inline uint64_t CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR arg) {
31113         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
31114         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(arg);
31115         return tag_ptr(ret_conv, true);
31116 }
31117 int64_t  CS_LDK_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(int64_t arg) {
31118         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(arg);
31119         int64_t ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(arg_conv);
31120         return ret_conv;
31121 }
31122
31123 int64_t  CS_LDK_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(int64_t orig) {
31124         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(orig);
31125         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
31126         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(orig_conv);
31127         return tag_ptr(ret_conv, true);
31128 }
31129
31130 int64_t  CS_LDK_CResult_ChannelCounterpartyDecodeErrorZ_ok(int64_t o) {
31131         LDKChannelCounterparty o_conv;
31132         o_conv.inner = untag_ptr(o);
31133         o_conv.is_owned = ptr_is_owned(o);
31134         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31135         o_conv = ChannelCounterparty_clone(&o_conv);
31136         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
31137         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_ok(o_conv);
31138         return tag_ptr(ret_conv, true);
31139 }
31140
31141 int64_t  CS_LDK_CResult_ChannelCounterpartyDecodeErrorZ_err(int64_t e) {
31142         void* e_ptr = untag_ptr(e);
31143         CHECK_ACCESS(e_ptr);
31144         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31145         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31146         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
31147         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_err(e_conv);
31148         return tag_ptr(ret_conv, true);
31149 }
31150
31151 jboolean  CS_LDK_CResult_ChannelCounterpartyDecodeErrorZ_is_ok(int64_t o) {
31152         LDKCResult_ChannelCounterpartyDecodeErrorZ* o_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(o);
31153         jboolean ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_is_ok(o_conv);
31154         return ret_conv;
31155 }
31156
31157 void  CS_LDK_CResult_ChannelCounterpartyDecodeErrorZ_free(int64_t _res) {
31158         if (!ptr_is_owned(_res)) return;
31159         void* _res_ptr = untag_ptr(_res);
31160         CHECK_ACCESS(_res_ptr);
31161         LDKCResult_ChannelCounterpartyDecodeErrorZ _res_conv = *(LDKCResult_ChannelCounterpartyDecodeErrorZ*)(_res_ptr);
31162         FREE(untag_ptr(_res));
31163         CResult_ChannelCounterpartyDecodeErrorZ_free(_res_conv);
31164 }
31165
31166 static inline uint64_t CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR arg) {
31167         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
31168         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(arg);
31169         return tag_ptr(ret_conv, true);
31170 }
31171 int64_t  CS_LDK_CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(int64_t arg) {
31172         LDKCResult_ChannelCounterpartyDecodeErrorZ* arg_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(arg);
31173         int64_t ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(arg_conv);
31174         return ret_conv;
31175 }
31176
31177 int64_t  CS_LDK_CResult_ChannelCounterpartyDecodeErrorZ_clone(int64_t orig) {
31178         LDKCResult_ChannelCounterpartyDecodeErrorZ* orig_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(orig);
31179         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
31180         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(orig_conv);
31181         return tag_ptr(ret_conv, true);
31182 }
31183
31184 int64_t  CS_LDK_COption_ChannelShutdownStateZ_some(int32_t o) {
31185         LDKChannelShutdownState o_conv = LDKChannelShutdownState_from_cs(o);
31186         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
31187         *ret_copy = COption_ChannelShutdownStateZ_some(o_conv);
31188         int64_t ret_ref = tag_ptr(ret_copy, true);
31189         return ret_ref;
31190 }
31191
31192 int64_t  CS_LDK_COption_ChannelShutdownStateZ_none() {
31193         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
31194         *ret_copy = COption_ChannelShutdownStateZ_none();
31195         int64_t ret_ref = tag_ptr(ret_copy, true);
31196         return ret_ref;
31197 }
31198
31199 void  CS_LDK_COption_ChannelShutdownStateZ_free(int64_t _res) {
31200         if (!ptr_is_owned(_res)) return;
31201         void* _res_ptr = untag_ptr(_res);
31202         CHECK_ACCESS(_res_ptr);
31203         LDKCOption_ChannelShutdownStateZ _res_conv = *(LDKCOption_ChannelShutdownStateZ*)(_res_ptr);
31204         FREE(untag_ptr(_res));
31205         COption_ChannelShutdownStateZ_free(_res_conv);
31206 }
31207
31208 static inline uint64_t COption_ChannelShutdownStateZ_clone_ptr(LDKCOption_ChannelShutdownStateZ *NONNULL_PTR arg) {
31209         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
31210         *ret_copy = COption_ChannelShutdownStateZ_clone(arg);
31211         int64_t ret_ref = tag_ptr(ret_copy, true);
31212         return ret_ref;
31213 }
31214 int64_t  CS_LDK_COption_ChannelShutdownStateZ_clone_ptr(int64_t arg) {
31215         LDKCOption_ChannelShutdownStateZ* arg_conv = (LDKCOption_ChannelShutdownStateZ*)untag_ptr(arg);
31216         int64_t ret_conv = COption_ChannelShutdownStateZ_clone_ptr(arg_conv);
31217         return ret_conv;
31218 }
31219
31220 int64_t  CS_LDK_COption_ChannelShutdownStateZ_clone(int64_t orig) {
31221         LDKCOption_ChannelShutdownStateZ* orig_conv = (LDKCOption_ChannelShutdownStateZ*)untag_ptr(orig);
31222         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
31223         *ret_copy = COption_ChannelShutdownStateZ_clone(orig_conv);
31224         int64_t ret_ref = tag_ptr(ret_copy, true);
31225         return ret_ref;
31226 }
31227
31228 void  CS_LDK_CVec_InboundHTLCDetailsZ_free(int64_tArray _res) {
31229         LDKCVec_InboundHTLCDetailsZ _res_constr;
31230         _res_constr.datalen = _res->arr_len;
31231         if (_res_constr.datalen > 0)
31232                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKInboundHTLCDetails), "LDKCVec_InboundHTLCDetailsZ Elements");
31233         else
31234                 _res_constr.data = NULL;
31235         int64_t* _res_vals = _res->elems;
31236         for (size_t u = 0; u < _res_constr.datalen; u++) {
31237                 int64_t _res_conv_20 = _res_vals[u];
31238                 LDKInboundHTLCDetails _res_conv_20_conv;
31239                 _res_conv_20_conv.inner = untag_ptr(_res_conv_20);
31240                 _res_conv_20_conv.is_owned = ptr_is_owned(_res_conv_20);
31241                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_20_conv);
31242                 _res_constr.data[u] = _res_conv_20_conv;
31243         }
31244         FREE(_res);
31245         CVec_InboundHTLCDetailsZ_free(_res_constr);
31246 }
31247
31248 void  CS_LDK_CVec_OutboundHTLCDetailsZ_free(int64_tArray _res) {
31249         LDKCVec_OutboundHTLCDetailsZ _res_constr;
31250         _res_constr.datalen = _res->arr_len;
31251         if (_res_constr.datalen > 0)
31252                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKOutboundHTLCDetails), "LDKCVec_OutboundHTLCDetailsZ Elements");
31253         else
31254                 _res_constr.data = NULL;
31255         int64_t* _res_vals = _res->elems;
31256         for (size_t v = 0; v < _res_constr.datalen; v++) {
31257                 int64_t _res_conv_21 = _res_vals[v];
31258                 LDKOutboundHTLCDetails _res_conv_21_conv;
31259                 _res_conv_21_conv.inner = untag_ptr(_res_conv_21);
31260                 _res_conv_21_conv.is_owned = ptr_is_owned(_res_conv_21);
31261                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_21_conv);
31262                 _res_constr.data[v] = _res_conv_21_conv;
31263         }
31264         FREE(_res);
31265         CVec_OutboundHTLCDetailsZ_free(_res_constr);
31266 }
31267
31268 int64_t  CS_LDK_CResult_ChannelDetailsDecodeErrorZ_ok(int64_t o) {
31269         LDKChannelDetails o_conv;
31270         o_conv.inner = untag_ptr(o);
31271         o_conv.is_owned = ptr_is_owned(o);
31272         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31273         o_conv = ChannelDetails_clone(&o_conv);
31274         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
31275         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_ok(o_conv);
31276         return tag_ptr(ret_conv, true);
31277 }
31278
31279 int64_t  CS_LDK_CResult_ChannelDetailsDecodeErrorZ_err(int64_t e) {
31280         void* e_ptr = untag_ptr(e);
31281         CHECK_ACCESS(e_ptr);
31282         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31283         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31284         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
31285         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_err(e_conv);
31286         return tag_ptr(ret_conv, true);
31287 }
31288
31289 jboolean  CS_LDK_CResult_ChannelDetailsDecodeErrorZ_is_ok(int64_t o) {
31290         LDKCResult_ChannelDetailsDecodeErrorZ* o_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(o);
31291         jboolean ret_conv = CResult_ChannelDetailsDecodeErrorZ_is_ok(o_conv);
31292         return ret_conv;
31293 }
31294
31295 void  CS_LDK_CResult_ChannelDetailsDecodeErrorZ_free(int64_t _res) {
31296         if (!ptr_is_owned(_res)) return;
31297         void* _res_ptr = untag_ptr(_res);
31298         CHECK_ACCESS(_res_ptr);
31299         LDKCResult_ChannelDetailsDecodeErrorZ _res_conv = *(LDKCResult_ChannelDetailsDecodeErrorZ*)(_res_ptr);
31300         FREE(untag_ptr(_res));
31301         CResult_ChannelDetailsDecodeErrorZ_free(_res_conv);
31302 }
31303
31304 static inline uint64_t CResult_ChannelDetailsDecodeErrorZ_clone_ptr(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR arg) {
31305         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
31306         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(arg);
31307         return tag_ptr(ret_conv, true);
31308 }
31309 int64_t  CS_LDK_CResult_ChannelDetailsDecodeErrorZ_clone_ptr(int64_t arg) {
31310         LDKCResult_ChannelDetailsDecodeErrorZ* arg_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(arg);
31311         int64_t ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone_ptr(arg_conv);
31312         return ret_conv;
31313 }
31314
31315 int64_t  CS_LDK_CResult_ChannelDetailsDecodeErrorZ_clone(int64_t orig) {
31316         LDKCResult_ChannelDetailsDecodeErrorZ* orig_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(orig);
31317         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
31318         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(orig_conv);
31319         return tag_ptr(ret_conv, true);
31320 }
31321
31322 int64_t  CS_LDK_CResult_ChannelShutdownStateDecodeErrorZ_ok(int32_t o) {
31323         LDKChannelShutdownState o_conv = LDKChannelShutdownState_from_cs(o);
31324         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
31325         *ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_ok(o_conv);
31326         return tag_ptr(ret_conv, true);
31327 }
31328
31329 int64_t  CS_LDK_CResult_ChannelShutdownStateDecodeErrorZ_err(int64_t e) {
31330         void* e_ptr = untag_ptr(e);
31331         CHECK_ACCESS(e_ptr);
31332         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31333         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31334         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
31335         *ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_err(e_conv);
31336         return tag_ptr(ret_conv, true);
31337 }
31338
31339 jboolean  CS_LDK_CResult_ChannelShutdownStateDecodeErrorZ_is_ok(int64_t o) {
31340         LDKCResult_ChannelShutdownStateDecodeErrorZ* o_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(o);
31341         jboolean ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_is_ok(o_conv);
31342         return ret_conv;
31343 }
31344
31345 void  CS_LDK_CResult_ChannelShutdownStateDecodeErrorZ_free(int64_t _res) {
31346         if (!ptr_is_owned(_res)) return;
31347         void* _res_ptr = untag_ptr(_res);
31348         CHECK_ACCESS(_res_ptr);
31349         LDKCResult_ChannelShutdownStateDecodeErrorZ _res_conv = *(LDKCResult_ChannelShutdownStateDecodeErrorZ*)(_res_ptr);
31350         FREE(untag_ptr(_res));
31351         CResult_ChannelShutdownStateDecodeErrorZ_free(_res_conv);
31352 }
31353
31354 static inline uint64_t CResult_ChannelShutdownStateDecodeErrorZ_clone_ptr(LDKCResult_ChannelShutdownStateDecodeErrorZ *NONNULL_PTR arg) {
31355         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
31356         *ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_clone(arg);
31357         return tag_ptr(ret_conv, true);
31358 }
31359 int64_t  CS_LDK_CResult_ChannelShutdownStateDecodeErrorZ_clone_ptr(int64_t arg) {
31360         LDKCResult_ChannelShutdownStateDecodeErrorZ* arg_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(arg);
31361         int64_t ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_clone_ptr(arg_conv);
31362         return ret_conv;
31363 }
31364
31365 int64_t  CS_LDK_CResult_ChannelShutdownStateDecodeErrorZ_clone(int64_t orig) {
31366         LDKCResult_ChannelShutdownStateDecodeErrorZ* orig_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(orig);
31367         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
31368         *ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_clone(orig_conv);
31369         return tag_ptr(ret_conv, true);
31370 }
31371
31372 void  CS_LDK_CVec_FutureZ_free(int64_tArray _res) {
31373         LDKCVec_FutureZ _res_constr;
31374         _res_constr.datalen = _res->arr_len;
31375         if (_res_constr.datalen > 0)
31376                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKFuture), "LDKCVec_FutureZ Elements");
31377         else
31378                 _res_constr.data = NULL;
31379         int64_t* _res_vals = _res->elems;
31380         for (size_t i = 0; i < _res_constr.datalen; i++) {
31381                 int64_t _res_conv_8 = _res_vals[i];
31382                 LDKFuture _res_conv_8_conv;
31383                 _res_conv_8_conv.inner = untag_ptr(_res_conv_8);
31384                 _res_conv_8_conv.is_owned = ptr_is_owned(_res_conv_8);
31385                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_8_conv);
31386                 _res_constr.data[i] = _res_conv_8_conv;
31387         }
31388         FREE(_res);
31389         CVec_FutureZ_free(_res_constr);
31390 }
31391
31392 int64_t  CS_LDK_CResult_OffersMessageDecodeErrorZ_ok(int64_t o) {
31393         void* o_ptr = untag_ptr(o);
31394         CHECK_ACCESS(o_ptr);
31395         LDKOffersMessage o_conv = *(LDKOffersMessage*)(o_ptr);
31396         o_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(o));
31397         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
31398         *ret_conv = CResult_OffersMessageDecodeErrorZ_ok(o_conv);
31399         return tag_ptr(ret_conv, true);
31400 }
31401
31402 int64_t  CS_LDK_CResult_OffersMessageDecodeErrorZ_err(int64_t e) {
31403         void* e_ptr = untag_ptr(e);
31404         CHECK_ACCESS(e_ptr);
31405         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31406         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31407         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
31408         *ret_conv = CResult_OffersMessageDecodeErrorZ_err(e_conv);
31409         return tag_ptr(ret_conv, true);
31410 }
31411
31412 jboolean  CS_LDK_CResult_OffersMessageDecodeErrorZ_is_ok(int64_t o) {
31413         LDKCResult_OffersMessageDecodeErrorZ* o_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(o);
31414         jboolean ret_conv = CResult_OffersMessageDecodeErrorZ_is_ok(o_conv);
31415         return ret_conv;
31416 }
31417
31418 void  CS_LDK_CResult_OffersMessageDecodeErrorZ_free(int64_t _res) {
31419         if (!ptr_is_owned(_res)) return;
31420         void* _res_ptr = untag_ptr(_res);
31421         CHECK_ACCESS(_res_ptr);
31422         LDKCResult_OffersMessageDecodeErrorZ _res_conv = *(LDKCResult_OffersMessageDecodeErrorZ*)(_res_ptr);
31423         FREE(untag_ptr(_res));
31424         CResult_OffersMessageDecodeErrorZ_free(_res_conv);
31425 }
31426
31427 static inline uint64_t CResult_OffersMessageDecodeErrorZ_clone_ptr(LDKCResult_OffersMessageDecodeErrorZ *NONNULL_PTR arg) {
31428         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
31429         *ret_conv = CResult_OffersMessageDecodeErrorZ_clone(arg);
31430         return tag_ptr(ret_conv, true);
31431 }
31432 int64_t  CS_LDK_CResult_OffersMessageDecodeErrorZ_clone_ptr(int64_t arg) {
31433         LDKCResult_OffersMessageDecodeErrorZ* arg_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(arg);
31434         int64_t ret_conv = CResult_OffersMessageDecodeErrorZ_clone_ptr(arg_conv);
31435         return ret_conv;
31436 }
31437
31438 int64_t  CS_LDK_CResult_OffersMessageDecodeErrorZ_clone(int64_t orig) {
31439         LDKCResult_OffersMessageDecodeErrorZ* orig_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(orig);
31440         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
31441         *ret_conv = CResult_OffersMessageDecodeErrorZ_clone(orig_conv);
31442         return tag_ptr(ret_conv, true);
31443 }
31444
31445 int64_t  CS_LDK_COption_HTLCClaimZ_some(int32_t o) {
31446         LDKHTLCClaim o_conv = LDKHTLCClaim_from_cs(o);
31447         LDKCOption_HTLCClaimZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCClaimZ), "LDKCOption_HTLCClaimZ");
31448         *ret_copy = COption_HTLCClaimZ_some(o_conv);
31449         int64_t ret_ref = tag_ptr(ret_copy, true);
31450         return ret_ref;
31451 }
31452
31453 int64_t  CS_LDK_COption_HTLCClaimZ_none() {
31454         LDKCOption_HTLCClaimZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCClaimZ), "LDKCOption_HTLCClaimZ");
31455         *ret_copy = COption_HTLCClaimZ_none();
31456         int64_t ret_ref = tag_ptr(ret_copy, true);
31457         return ret_ref;
31458 }
31459
31460 void  CS_LDK_COption_HTLCClaimZ_free(int64_t _res) {
31461         if (!ptr_is_owned(_res)) return;
31462         void* _res_ptr = untag_ptr(_res);
31463         CHECK_ACCESS(_res_ptr);
31464         LDKCOption_HTLCClaimZ _res_conv = *(LDKCOption_HTLCClaimZ*)(_res_ptr);
31465         FREE(untag_ptr(_res));
31466         COption_HTLCClaimZ_free(_res_conv);
31467 }
31468
31469 int64_t  CS_LDK_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(int64_t o) {
31470         LDKCounterpartyCommitmentSecrets o_conv;
31471         o_conv.inner = untag_ptr(o);
31472         o_conv.is_owned = ptr_is_owned(o);
31473         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31474         o_conv = CounterpartyCommitmentSecrets_clone(&o_conv);
31475         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
31476         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(o_conv);
31477         return tag_ptr(ret_conv, true);
31478 }
31479
31480 int64_t  CS_LDK_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(int64_t e) {
31481         void* e_ptr = untag_ptr(e);
31482         CHECK_ACCESS(e_ptr);
31483         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31484         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31485         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
31486         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(e_conv);
31487         return tag_ptr(ret_conv, true);
31488 }
31489
31490 jboolean  CS_LDK_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(int64_t o) {
31491         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* o_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(o);
31492         jboolean ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(o_conv);
31493         return ret_conv;
31494 }
31495
31496 void  CS_LDK_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(int64_t _res) {
31497         if (!ptr_is_owned(_res)) return;
31498         void* _res_ptr = untag_ptr(_res);
31499         CHECK_ACCESS(_res_ptr);
31500         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(_res_ptr);
31501         FREE(untag_ptr(_res));
31502         CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(_res_conv);
31503 }
31504
31505 static inline uint64_t CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR arg) {
31506         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
31507         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(arg);
31508         return tag_ptr(ret_conv, true);
31509 }
31510 int64_t  CS_LDK_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(int64_t arg) {
31511         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(arg);
31512         int64_t ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(arg_conv);
31513         return ret_conv;
31514 }
31515
31516 int64_t  CS_LDK_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(int64_t orig) {
31517         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(orig);
31518         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
31519         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(orig_conv);
31520         return tag_ptr(ret_conv, true);
31521 }
31522
31523 int64_t  CS_LDK_CResult_TxCreationKeysDecodeErrorZ_ok(int64_t o) {
31524         LDKTxCreationKeys o_conv;
31525         o_conv.inner = untag_ptr(o);
31526         o_conv.is_owned = ptr_is_owned(o);
31527         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31528         o_conv = TxCreationKeys_clone(&o_conv);
31529         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
31530         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_ok(o_conv);
31531         return tag_ptr(ret_conv, true);
31532 }
31533
31534 int64_t  CS_LDK_CResult_TxCreationKeysDecodeErrorZ_err(int64_t e) {
31535         void* e_ptr = untag_ptr(e);
31536         CHECK_ACCESS(e_ptr);
31537         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31538         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31539         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
31540         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_err(e_conv);
31541         return tag_ptr(ret_conv, true);
31542 }
31543
31544 jboolean  CS_LDK_CResult_TxCreationKeysDecodeErrorZ_is_ok(int64_t o) {
31545         LDKCResult_TxCreationKeysDecodeErrorZ* o_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(o);
31546         jboolean ret_conv = CResult_TxCreationKeysDecodeErrorZ_is_ok(o_conv);
31547         return ret_conv;
31548 }
31549
31550 void  CS_LDK_CResult_TxCreationKeysDecodeErrorZ_free(int64_t _res) {
31551         if (!ptr_is_owned(_res)) return;
31552         void* _res_ptr = untag_ptr(_res);
31553         CHECK_ACCESS(_res_ptr);
31554         LDKCResult_TxCreationKeysDecodeErrorZ _res_conv = *(LDKCResult_TxCreationKeysDecodeErrorZ*)(_res_ptr);
31555         FREE(untag_ptr(_res));
31556         CResult_TxCreationKeysDecodeErrorZ_free(_res_conv);
31557 }
31558
31559 static inline uint64_t CResult_TxCreationKeysDecodeErrorZ_clone_ptr(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR arg) {
31560         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
31561         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(arg);
31562         return tag_ptr(ret_conv, true);
31563 }
31564 int64_t  CS_LDK_CResult_TxCreationKeysDecodeErrorZ_clone_ptr(int64_t arg) {
31565         LDKCResult_TxCreationKeysDecodeErrorZ* arg_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(arg);
31566         int64_t ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone_ptr(arg_conv);
31567         return ret_conv;
31568 }
31569
31570 int64_t  CS_LDK_CResult_TxCreationKeysDecodeErrorZ_clone(int64_t orig) {
31571         LDKCResult_TxCreationKeysDecodeErrorZ* orig_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(orig);
31572         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
31573         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(orig_conv);
31574         return tag_ptr(ret_conv, true);
31575 }
31576
31577 int64_t  CS_LDK_CResult_ChannelPublicKeysDecodeErrorZ_ok(int64_t o) {
31578         LDKChannelPublicKeys o_conv;
31579         o_conv.inner = untag_ptr(o);
31580         o_conv.is_owned = ptr_is_owned(o);
31581         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31582         o_conv = ChannelPublicKeys_clone(&o_conv);
31583         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
31584         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_ok(o_conv);
31585         return tag_ptr(ret_conv, true);
31586 }
31587
31588 int64_t  CS_LDK_CResult_ChannelPublicKeysDecodeErrorZ_err(int64_t e) {
31589         void* e_ptr = untag_ptr(e);
31590         CHECK_ACCESS(e_ptr);
31591         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31592         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31593         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
31594         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_err(e_conv);
31595         return tag_ptr(ret_conv, true);
31596 }
31597
31598 jboolean  CS_LDK_CResult_ChannelPublicKeysDecodeErrorZ_is_ok(int64_t o) {
31599         LDKCResult_ChannelPublicKeysDecodeErrorZ* o_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(o);
31600         jboolean ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_is_ok(o_conv);
31601         return ret_conv;
31602 }
31603
31604 void  CS_LDK_CResult_ChannelPublicKeysDecodeErrorZ_free(int64_t _res) {
31605         if (!ptr_is_owned(_res)) return;
31606         void* _res_ptr = untag_ptr(_res);
31607         CHECK_ACCESS(_res_ptr);
31608         LDKCResult_ChannelPublicKeysDecodeErrorZ _res_conv = *(LDKCResult_ChannelPublicKeysDecodeErrorZ*)(_res_ptr);
31609         FREE(untag_ptr(_res));
31610         CResult_ChannelPublicKeysDecodeErrorZ_free(_res_conv);
31611 }
31612
31613 static inline uint64_t CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR arg) {
31614         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
31615         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(arg);
31616         return tag_ptr(ret_conv, true);
31617 }
31618 int64_t  CS_LDK_CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(int64_t arg) {
31619         LDKCResult_ChannelPublicKeysDecodeErrorZ* arg_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(arg);
31620         int64_t ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(arg_conv);
31621         return ret_conv;
31622 }
31623
31624 int64_t  CS_LDK_CResult_ChannelPublicKeysDecodeErrorZ_clone(int64_t orig) {
31625         LDKCResult_ChannelPublicKeysDecodeErrorZ* orig_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(orig);
31626         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
31627         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(orig_conv);
31628         return tag_ptr(ret_conv, true);
31629 }
31630
31631 int64_t  CS_LDK_CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(int64_t o) {
31632         LDKHTLCOutputInCommitment o_conv;
31633         o_conv.inner = untag_ptr(o);
31634         o_conv.is_owned = ptr_is_owned(o);
31635         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31636         o_conv = HTLCOutputInCommitment_clone(&o_conv);
31637         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
31638         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o_conv);
31639         return tag_ptr(ret_conv, true);
31640 }
31641
31642 int64_t  CS_LDK_CResult_HTLCOutputInCommitmentDecodeErrorZ_err(int64_t e) {
31643         void* e_ptr = untag_ptr(e);
31644         CHECK_ACCESS(e_ptr);
31645         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31646         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31647         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
31648         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e_conv);
31649         return tag_ptr(ret_conv, true);
31650 }
31651
31652 jboolean  CS_LDK_CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(int64_t o) {
31653         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* o_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(o);
31654         jboolean ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(o_conv);
31655         return ret_conv;
31656 }
31657
31658 void  CS_LDK_CResult_HTLCOutputInCommitmentDecodeErrorZ_free(int64_t _res) {
31659         if (!ptr_is_owned(_res)) return;
31660         void* _res_ptr = untag_ptr(_res);
31661         CHECK_ACCESS(_res_ptr);
31662         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res_conv = *(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(_res_ptr);
31663         FREE(untag_ptr(_res));
31664         CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res_conv);
31665 }
31666
31667 static inline uint64_t CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR arg) {
31668         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
31669         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(arg);
31670         return tag_ptr(ret_conv, true);
31671 }
31672 int64_t  CS_LDK_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(int64_t arg) {
31673         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* arg_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(arg);
31674         int64_t ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(arg_conv);
31675         return ret_conv;
31676 }
31677
31678 int64_t  CS_LDK_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(int64_t orig) {
31679         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* orig_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(orig);
31680         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
31681         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig_conv);
31682         return tag_ptr(ret_conv, true);
31683 }
31684
31685 int64_t  CS_LDK_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(int64_t o) {
31686         LDKCounterpartyChannelTransactionParameters o_conv;
31687         o_conv.inner = untag_ptr(o);
31688         o_conv.is_owned = ptr_is_owned(o);
31689         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31690         o_conv = CounterpartyChannelTransactionParameters_clone(&o_conv);
31691         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
31692         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o_conv);
31693         return tag_ptr(ret_conv, true);
31694 }
31695
31696 int64_t  CS_LDK_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(int64_t e) {
31697         void* e_ptr = untag_ptr(e);
31698         CHECK_ACCESS(e_ptr);
31699         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31700         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31701         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
31702         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e_conv);
31703         return tag_ptr(ret_conv, true);
31704 }
31705
31706 jboolean  CS_LDK_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(int64_t o) {
31707         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(o);
31708         jboolean ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
31709         return ret_conv;
31710 }
31711
31712 void  CS_LDK_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(int64_t _res) {
31713         if (!ptr_is_owned(_res)) return;
31714         void* _res_ptr = untag_ptr(_res);
31715         CHECK_ACCESS(_res_ptr);
31716         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
31717         FREE(untag_ptr(_res));
31718         CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res_conv);
31719 }
31720
31721 static inline uint64_t CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
31722         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
31723         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(arg);
31724         return tag_ptr(ret_conv, true);
31725 }
31726 int64_t  CS_LDK_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(int64_t arg) {
31727         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(arg);
31728         int64_t ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
31729         return ret_conv;
31730 }
31731
31732 int64_t  CS_LDK_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(int64_t orig) {
31733         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(orig);
31734         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
31735         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
31736         return tag_ptr(ret_conv, true);
31737 }
31738
31739 int64_t  CS_LDK_CResult_ChannelTransactionParametersDecodeErrorZ_ok(int64_t o) {
31740         LDKChannelTransactionParameters o_conv;
31741         o_conv.inner = untag_ptr(o);
31742         o_conv.is_owned = ptr_is_owned(o);
31743         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31744         o_conv = ChannelTransactionParameters_clone(&o_conv);
31745         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
31746         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_ok(o_conv);
31747         return tag_ptr(ret_conv, true);
31748 }
31749
31750 int64_t  CS_LDK_CResult_ChannelTransactionParametersDecodeErrorZ_err(int64_t e) {
31751         void* e_ptr = untag_ptr(e);
31752         CHECK_ACCESS(e_ptr);
31753         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31754         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31755         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
31756         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_err(e_conv);
31757         return tag_ptr(ret_conv, true);
31758 }
31759
31760 jboolean  CS_LDK_CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(int64_t o) {
31761         LDKCResult_ChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(o);
31762         jboolean ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
31763         return ret_conv;
31764 }
31765
31766 void  CS_LDK_CResult_ChannelTransactionParametersDecodeErrorZ_free(int64_t _res) {
31767         if (!ptr_is_owned(_res)) return;
31768         void* _res_ptr = untag_ptr(_res);
31769         CHECK_ACCESS(_res_ptr);
31770         LDKCResult_ChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
31771         FREE(untag_ptr(_res));
31772         CResult_ChannelTransactionParametersDecodeErrorZ_free(_res_conv);
31773 }
31774
31775 static inline uint64_t CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
31776         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
31777         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(arg);
31778         return tag_ptr(ret_conv, true);
31779 }
31780 int64_t  CS_LDK_CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(int64_t arg) {
31781         LDKCResult_ChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(arg);
31782         int64_t ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
31783         return ret_conv;
31784 }
31785
31786 int64_t  CS_LDK_CResult_ChannelTransactionParametersDecodeErrorZ_clone(int64_t orig) {
31787         LDKCResult_ChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(orig);
31788         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
31789         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
31790         return tag_ptr(ret_conv, true);
31791 }
31792
31793 int64_t  CS_LDK_CResult_HolderCommitmentTransactionDecodeErrorZ_ok(int64_t o) {
31794         LDKHolderCommitmentTransaction o_conv;
31795         o_conv.inner = untag_ptr(o);
31796         o_conv.is_owned = ptr_is_owned(o);
31797         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31798         o_conv = HolderCommitmentTransaction_clone(&o_conv);
31799         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
31800         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o_conv);
31801         return tag_ptr(ret_conv, true);
31802 }
31803
31804 int64_t  CS_LDK_CResult_HolderCommitmentTransactionDecodeErrorZ_err(int64_t e) {
31805         void* e_ptr = untag_ptr(e);
31806         CHECK_ACCESS(e_ptr);
31807         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31808         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31809         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
31810         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_err(e_conv);
31811         return tag_ptr(ret_conv, true);
31812 }
31813
31814 jboolean  CS_LDK_CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(int64_t o) {
31815         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(o);
31816         jboolean ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
31817         return ret_conv;
31818 }
31819
31820 void  CS_LDK_CResult_HolderCommitmentTransactionDecodeErrorZ_free(int64_t _res) {
31821         if (!ptr_is_owned(_res)) return;
31822         void* _res_ptr = untag_ptr(_res);
31823         CHECK_ACCESS(_res_ptr);
31824         LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(_res_ptr);
31825         FREE(untag_ptr(_res));
31826         CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res_conv);
31827 }
31828
31829 static inline uint64_t CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
31830         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
31831         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(arg);
31832         return tag_ptr(ret_conv, true);
31833 }
31834 int64_t  CS_LDK_CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(int64_t arg) {
31835         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
31836         int64_t ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
31837         return ret_conv;
31838 }
31839
31840 int64_t  CS_LDK_CResult_HolderCommitmentTransactionDecodeErrorZ_clone(int64_t orig) {
31841         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
31842         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
31843         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig_conv);
31844         return tag_ptr(ret_conv, true);
31845 }
31846
31847 int64_t  CS_LDK_CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(int64_t o) {
31848         LDKBuiltCommitmentTransaction o_conv;
31849         o_conv.inner = untag_ptr(o);
31850         o_conv.is_owned = ptr_is_owned(o);
31851         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31852         o_conv = BuiltCommitmentTransaction_clone(&o_conv);
31853         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
31854         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o_conv);
31855         return tag_ptr(ret_conv, true);
31856 }
31857
31858 int64_t  CS_LDK_CResult_BuiltCommitmentTransactionDecodeErrorZ_err(int64_t e) {
31859         void* e_ptr = untag_ptr(e);
31860         CHECK_ACCESS(e_ptr);
31861         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31862         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31863         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
31864         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e_conv);
31865         return tag_ptr(ret_conv, true);
31866 }
31867
31868 jboolean  CS_LDK_CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(int64_t o) {
31869         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(o);
31870         jboolean ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
31871         return ret_conv;
31872 }
31873
31874 void  CS_LDK_CResult_BuiltCommitmentTransactionDecodeErrorZ_free(int64_t _res) {
31875         if (!ptr_is_owned(_res)) return;
31876         void* _res_ptr = untag_ptr(_res);
31877         CHECK_ACCESS(_res_ptr);
31878         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(_res_ptr);
31879         FREE(untag_ptr(_res));
31880         CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res_conv);
31881 }
31882
31883 static inline uint64_t CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
31884         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
31885         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(arg);
31886         return tag_ptr(ret_conv, true);
31887 }
31888 int64_t  CS_LDK_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(int64_t arg) {
31889         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
31890         int64_t ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
31891         return ret_conv;
31892 }
31893
31894 int64_t  CS_LDK_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(int64_t orig) {
31895         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
31896         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
31897         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig_conv);
31898         return tag_ptr(ret_conv, true);
31899 }
31900
31901 int64_t  CS_LDK_CResult_TrustedClosingTransactionNoneZ_ok(int64_t o) {
31902         LDKTrustedClosingTransaction o_conv;
31903         o_conv.inner = untag_ptr(o);
31904         o_conv.is_owned = ptr_is_owned(o);
31905         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31906         // WARNING: we need a move here but no clone is available for LDKTrustedClosingTransaction
31907         
31908         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
31909         *ret_conv = CResult_TrustedClosingTransactionNoneZ_ok(o_conv);
31910         return tag_ptr(ret_conv, true);
31911 }
31912
31913 int64_t  CS_LDK_CResult_TrustedClosingTransactionNoneZ_err() {
31914         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
31915         *ret_conv = CResult_TrustedClosingTransactionNoneZ_err();
31916         return tag_ptr(ret_conv, true);
31917 }
31918
31919 jboolean  CS_LDK_CResult_TrustedClosingTransactionNoneZ_is_ok(int64_t o) {
31920         LDKCResult_TrustedClosingTransactionNoneZ* o_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(o);
31921         jboolean ret_conv = CResult_TrustedClosingTransactionNoneZ_is_ok(o_conv);
31922         return ret_conv;
31923 }
31924
31925 void  CS_LDK_CResult_TrustedClosingTransactionNoneZ_free(int64_t _res) {
31926         if (!ptr_is_owned(_res)) return;
31927         void* _res_ptr = untag_ptr(_res);
31928         CHECK_ACCESS(_res_ptr);
31929         LDKCResult_TrustedClosingTransactionNoneZ _res_conv = *(LDKCResult_TrustedClosingTransactionNoneZ*)(_res_ptr);
31930         FREE(untag_ptr(_res));
31931         CResult_TrustedClosingTransactionNoneZ_free(_res_conv);
31932 }
31933
31934 int64_t  CS_LDK_CResult_CommitmentTransactionDecodeErrorZ_ok(int64_t o) {
31935         LDKCommitmentTransaction o_conv;
31936         o_conv.inner = untag_ptr(o);
31937         o_conv.is_owned = ptr_is_owned(o);
31938         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31939         o_conv = CommitmentTransaction_clone(&o_conv);
31940         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
31941         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_ok(o_conv);
31942         return tag_ptr(ret_conv, true);
31943 }
31944
31945 int64_t  CS_LDK_CResult_CommitmentTransactionDecodeErrorZ_err(int64_t e) {
31946         void* e_ptr = untag_ptr(e);
31947         CHECK_ACCESS(e_ptr);
31948         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31949         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31950         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
31951         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_err(e_conv);
31952         return tag_ptr(ret_conv, true);
31953 }
31954
31955 jboolean  CS_LDK_CResult_CommitmentTransactionDecodeErrorZ_is_ok(int64_t o) {
31956         LDKCResult_CommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(o);
31957         jboolean ret_conv = CResult_CommitmentTransactionDecodeErrorZ_is_ok(o_conv);
31958         return ret_conv;
31959 }
31960
31961 void  CS_LDK_CResult_CommitmentTransactionDecodeErrorZ_free(int64_t _res) {
31962         if (!ptr_is_owned(_res)) return;
31963         void* _res_ptr = untag_ptr(_res);
31964         CHECK_ACCESS(_res_ptr);
31965         LDKCResult_CommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_CommitmentTransactionDecodeErrorZ*)(_res_ptr);
31966         FREE(untag_ptr(_res));
31967         CResult_CommitmentTransactionDecodeErrorZ_free(_res_conv);
31968 }
31969
31970 static inline uint64_t CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
31971         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
31972         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(arg);
31973         return tag_ptr(ret_conv, true);
31974 }
31975 int64_t  CS_LDK_CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(int64_t arg) {
31976         LDKCResult_CommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
31977         int64_t ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
31978         return ret_conv;
31979 }
31980
31981 int64_t  CS_LDK_CResult_CommitmentTransactionDecodeErrorZ_clone(int64_t orig) {
31982         LDKCResult_CommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
31983         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
31984         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(orig_conv);
31985         return tag_ptr(ret_conv, true);
31986 }
31987
31988 int64_t  CS_LDK_CResult_TrustedCommitmentTransactionNoneZ_ok(int64_t o) {
31989         LDKTrustedCommitmentTransaction o_conv;
31990         o_conv.inner = untag_ptr(o);
31991         o_conv.is_owned = ptr_is_owned(o);
31992         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31993         // WARNING: we need a move here but no clone is available for LDKTrustedCommitmentTransaction
31994         
31995         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
31996         *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_ok(o_conv);
31997         return tag_ptr(ret_conv, true);
31998 }
31999
32000 int64_t  CS_LDK_CResult_TrustedCommitmentTransactionNoneZ_err() {
32001         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
32002         *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_err();
32003         return tag_ptr(ret_conv, true);
32004 }
32005
32006 jboolean  CS_LDK_CResult_TrustedCommitmentTransactionNoneZ_is_ok(int64_t o) {
32007         LDKCResult_TrustedCommitmentTransactionNoneZ* o_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(o);
32008         jboolean ret_conv = CResult_TrustedCommitmentTransactionNoneZ_is_ok(o_conv);
32009         return ret_conv;
32010 }
32011
32012 void  CS_LDK_CResult_TrustedCommitmentTransactionNoneZ_free(int64_t _res) {
32013         if (!ptr_is_owned(_res)) return;
32014         void* _res_ptr = untag_ptr(_res);
32015         CHECK_ACCESS(_res_ptr);
32016         LDKCResult_TrustedCommitmentTransactionNoneZ _res_conv = *(LDKCResult_TrustedCommitmentTransactionNoneZ*)(_res_ptr);
32017         FREE(untag_ptr(_res));
32018         CResult_TrustedCommitmentTransactionNoneZ_free(_res_conv);
32019 }
32020
32021 int64_t  CS_LDK_CResult_CVec_ECDSASignatureZNoneZ_ok(ptrArray o) {
32022         LDKCVec_ECDSASignatureZ o_constr;
32023         o_constr.datalen = o->arr_len;
32024         if (o_constr.datalen > 0)
32025                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
32026         else
32027                 o_constr.data = NULL;
32028         int8_tArray* o_vals = (void*) o->elems;
32029         for (size_t i = 0; i < o_constr.datalen; i++) {
32030                 int8_tArray o_conv_8 = o_vals[i];
32031                 LDKECDSASignature o_conv_8_ref;
32032                 CHECK(o_conv_8->arr_len == 64);
32033                 memcpy(o_conv_8_ref.compact_form, o_conv_8->elems, 64); FREE(o_conv_8);
32034                 o_constr.data[i] = o_conv_8_ref;
32035         }
32036         FREE(o);
32037         LDKCResult_CVec_ECDSASignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_ECDSASignatureZNoneZ), "LDKCResult_CVec_ECDSASignatureZNoneZ");
32038         *ret_conv = CResult_CVec_ECDSASignatureZNoneZ_ok(o_constr);
32039         return tag_ptr(ret_conv, true);
32040 }
32041
32042 int64_t  CS_LDK_CResult_CVec_ECDSASignatureZNoneZ_err() {
32043         LDKCResult_CVec_ECDSASignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_ECDSASignatureZNoneZ), "LDKCResult_CVec_ECDSASignatureZNoneZ");
32044         *ret_conv = CResult_CVec_ECDSASignatureZNoneZ_err();
32045         return tag_ptr(ret_conv, true);
32046 }
32047
32048 jboolean  CS_LDK_CResult_CVec_ECDSASignatureZNoneZ_is_ok(int64_t o) {
32049         LDKCResult_CVec_ECDSASignatureZNoneZ* o_conv = (LDKCResult_CVec_ECDSASignatureZNoneZ*)untag_ptr(o);
32050         jboolean ret_conv = CResult_CVec_ECDSASignatureZNoneZ_is_ok(o_conv);
32051         return ret_conv;
32052 }
32053
32054 void  CS_LDK_CResult_CVec_ECDSASignatureZNoneZ_free(int64_t _res) {
32055         if (!ptr_is_owned(_res)) return;
32056         void* _res_ptr = untag_ptr(_res);
32057         CHECK_ACCESS(_res_ptr);
32058         LDKCResult_CVec_ECDSASignatureZNoneZ _res_conv = *(LDKCResult_CVec_ECDSASignatureZNoneZ*)(_res_ptr);
32059         FREE(untag_ptr(_res));
32060         CResult_CVec_ECDSASignatureZNoneZ_free(_res_conv);
32061 }
32062
32063 static inline uint64_t CResult_CVec_ECDSASignatureZNoneZ_clone_ptr(LDKCResult_CVec_ECDSASignatureZNoneZ *NONNULL_PTR arg) {
32064         LDKCResult_CVec_ECDSASignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_ECDSASignatureZNoneZ), "LDKCResult_CVec_ECDSASignatureZNoneZ");
32065         *ret_conv = CResult_CVec_ECDSASignatureZNoneZ_clone(arg);
32066         return tag_ptr(ret_conv, true);
32067 }
32068 int64_t  CS_LDK_CResult_CVec_ECDSASignatureZNoneZ_clone_ptr(int64_t arg) {
32069         LDKCResult_CVec_ECDSASignatureZNoneZ* arg_conv = (LDKCResult_CVec_ECDSASignatureZNoneZ*)untag_ptr(arg);
32070         int64_t ret_conv = CResult_CVec_ECDSASignatureZNoneZ_clone_ptr(arg_conv);
32071         return ret_conv;
32072 }
32073
32074 int64_t  CS_LDK_CResult_CVec_ECDSASignatureZNoneZ_clone(int64_t orig) {
32075         LDKCResult_CVec_ECDSASignatureZNoneZ* orig_conv = (LDKCResult_CVec_ECDSASignatureZNoneZ*)untag_ptr(orig);
32076         LDKCResult_CVec_ECDSASignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_ECDSASignatureZNoneZ), "LDKCResult_CVec_ECDSASignatureZNoneZ");
32077         *ret_conv = CResult_CVec_ECDSASignatureZNoneZ_clone(orig_conv);
32078         return tag_ptr(ret_conv, true);
32079 }
32080
32081 int64_t  CS_LDK_COption_usizeZ_some(int64_t o) {
32082         LDKCOption_usizeZ *ret_copy = MALLOC(sizeof(LDKCOption_usizeZ), "LDKCOption_usizeZ");
32083         *ret_copy = COption_usizeZ_some(o);
32084         int64_t ret_ref = tag_ptr(ret_copy, true);
32085         return ret_ref;
32086 }
32087
32088 int64_t  CS_LDK_COption_usizeZ_none() {
32089         LDKCOption_usizeZ *ret_copy = MALLOC(sizeof(LDKCOption_usizeZ), "LDKCOption_usizeZ");
32090         *ret_copy = COption_usizeZ_none();
32091         int64_t ret_ref = tag_ptr(ret_copy, true);
32092         return ret_ref;
32093 }
32094
32095 void  CS_LDK_COption_usizeZ_free(int64_t _res) {
32096         if (!ptr_is_owned(_res)) return;
32097         void* _res_ptr = untag_ptr(_res);
32098         CHECK_ACCESS(_res_ptr);
32099         LDKCOption_usizeZ _res_conv = *(LDKCOption_usizeZ*)(_res_ptr);
32100         FREE(untag_ptr(_res));
32101         COption_usizeZ_free(_res_conv);
32102 }
32103
32104 static inline uint64_t COption_usizeZ_clone_ptr(LDKCOption_usizeZ *NONNULL_PTR arg) {
32105         LDKCOption_usizeZ *ret_copy = MALLOC(sizeof(LDKCOption_usizeZ), "LDKCOption_usizeZ");
32106         *ret_copy = COption_usizeZ_clone(arg);
32107         int64_t ret_ref = tag_ptr(ret_copy, true);
32108         return ret_ref;
32109 }
32110 int64_t  CS_LDK_COption_usizeZ_clone_ptr(int64_t arg) {
32111         LDKCOption_usizeZ* arg_conv = (LDKCOption_usizeZ*)untag_ptr(arg);
32112         int64_t ret_conv = COption_usizeZ_clone_ptr(arg_conv);
32113         return ret_conv;
32114 }
32115
32116 int64_t  CS_LDK_COption_usizeZ_clone(int64_t orig) {
32117         LDKCOption_usizeZ* orig_conv = (LDKCOption_usizeZ*)untag_ptr(orig);
32118         LDKCOption_usizeZ *ret_copy = MALLOC(sizeof(LDKCOption_usizeZ), "LDKCOption_usizeZ");
32119         *ret_copy = COption_usizeZ_clone(orig_conv);
32120         int64_t ret_ref = tag_ptr(ret_copy, true);
32121         return ret_ref;
32122 }
32123
32124 int64_t  CS_LDK_CResult_ShutdownScriptDecodeErrorZ_ok(int64_t o) {
32125         LDKShutdownScript o_conv;
32126         o_conv.inner = untag_ptr(o);
32127         o_conv.is_owned = ptr_is_owned(o);
32128         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32129         o_conv = ShutdownScript_clone(&o_conv);
32130         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
32131         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_ok(o_conv);
32132         return tag_ptr(ret_conv, true);
32133 }
32134
32135 int64_t  CS_LDK_CResult_ShutdownScriptDecodeErrorZ_err(int64_t e) {
32136         void* e_ptr = untag_ptr(e);
32137         CHECK_ACCESS(e_ptr);
32138         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
32139         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
32140         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
32141         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_err(e_conv);
32142         return tag_ptr(ret_conv, true);
32143 }
32144
32145 jboolean  CS_LDK_CResult_ShutdownScriptDecodeErrorZ_is_ok(int64_t o) {
32146         LDKCResult_ShutdownScriptDecodeErrorZ* o_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(o);
32147         jboolean ret_conv = CResult_ShutdownScriptDecodeErrorZ_is_ok(o_conv);
32148         return ret_conv;
32149 }
32150
32151 void  CS_LDK_CResult_ShutdownScriptDecodeErrorZ_free(int64_t _res) {
32152         if (!ptr_is_owned(_res)) return;
32153         void* _res_ptr = untag_ptr(_res);
32154         CHECK_ACCESS(_res_ptr);
32155         LDKCResult_ShutdownScriptDecodeErrorZ _res_conv = *(LDKCResult_ShutdownScriptDecodeErrorZ*)(_res_ptr);
32156         FREE(untag_ptr(_res));
32157         CResult_ShutdownScriptDecodeErrorZ_free(_res_conv);
32158 }
32159
32160 static inline uint64_t CResult_ShutdownScriptDecodeErrorZ_clone_ptr(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR arg) {
32161         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
32162         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(arg);
32163         return tag_ptr(ret_conv, true);
32164 }
32165 int64_t  CS_LDK_CResult_ShutdownScriptDecodeErrorZ_clone_ptr(int64_t arg) {
32166         LDKCResult_ShutdownScriptDecodeErrorZ* arg_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(arg);
32167         int64_t ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone_ptr(arg_conv);
32168         return ret_conv;
32169 }
32170
32171 int64_t  CS_LDK_CResult_ShutdownScriptDecodeErrorZ_clone(int64_t orig) {
32172         LDKCResult_ShutdownScriptDecodeErrorZ* orig_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(orig);
32173         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
32174         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(orig_conv);
32175         return tag_ptr(ret_conv, true);
32176 }
32177
32178 int64_t  CS_LDK_CResult_ShutdownScriptInvalidShutdownScriptZ_ok(int64_t o) {
32179         LDKShutdownScript o_conv;
32180         o_conv.inner = untag_ptr(o);
32181         o_conv.is_owned = ptr_is_owned(o);
32182         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32183         o_conv = ShutdownScript_clone(&o_conv);
32184         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
32185         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o_conv);
32186         return tag_ptr(ret_conv, true);
32187 }
32188
32189 int64_t  CS_LDK_CResult_ShutdownScriptInvalidShutdownScriptZ_err(int64_t e) {
32190         LDKInvalidShutdownScript e_conv;
32191         e_conv.inner = untag_ptr(e);
32192         e_conv.is_owned = ptr_is_owned(e);
32193         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
32194         e_conv = InvalidShutdownScript_clone(&e_conv);
32195         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
32196         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_err(e_conv);
32197         return tag_ptr(ret_conv, true);
32198 }
32199
32200 jboolean  CS_LDK_CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(int64_t o) {
32201         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* o_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(o);
32202         jboolean ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(o_conv);
32203         return ret_conv;
32204 }
32205
32206 void  CS_LDK_CResult_ShutdownScriptInvalidShutdownScriptZ_free(int64_t _res) {
32207         if (!ptr_is_owned(_res)) return;
32208         void* _res_ptr = untag_ptr(_res);
32209         CHECK_ACCESS(_res_ptr);
32210         LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res_conv = *(LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(_res_ptr);
32211         FREE(untag_ptr(_res));
32212         CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res_conv);
32213 }
32214
32215 static inline uint64_t CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR arg) {
32216         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
32217         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(arg);
32218         return tag_ptr(ret_conv, true);
32219 }
32220 int64_t  CS_LDK_CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(int64_t arg) {
32221         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* arg_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(arg);
32222         int64_t ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(arg_conv);
32223         return ret_conv;
32224 }
32225
32226 int64_t  CS_LDK_CResult_ShutdownScriptInvalidShutdownScriptZ_clone(int64_t orig) {
32227         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* orig_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(orig);
32228         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
32229         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig_conv);
32230         return tag_ptr(ret_conv, true);
32231 }
32232
32233 void  CS_LDK_CVec_TransactionZ_free(ptrArray _res) {
32234         LDKCVec_TransactionZ _res_constr;
32235         _res_constr.datalen = _res->arr_len;
32236         if (_res_constr.datalen > 0)
32237                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
32238         else
32239                 _res_constr.data = NULL;
32240         int8_tArray* _res_vals = (void*) _res->elems;
32241         for (size_t i = 0; i < _res_constr.datalen; i++) {
32242                 int8_tArray _res_conv_8 = _res_vals[i];
32243                 LDKTransaction _res_conv_8_ref;
32244                 _res_conv_8_ref.datalen = _res_conv_8->arr_len;
32245                 _res_conv_8_ref.data = MALLOC(_res_conv_8_ref.datalen, "LDKTransaction Bytes");
32246                 memcpy(_res_conv_8_ref.data, _res_conv_8->elems, _res_conv_8_ref.datalen); FREE(_res_conv_8);
32247                 _res_conv_8_ref.data_is_owned = true;
32248                 _res_constr.data[i] = _res_conv_8_ref;
32249         }
32250         FREE(_res);
32251         CVec_TransactionZ_free(_res_constr);
32252 }
32253
32254 int64_t  CS_LDK_CResult_PaymentPurposeDecodeErrorZ_ok(int64_t o) {
32255         void* o_ptr = untag_ptr(o);
32256         CHECK_ACCESS(o_ptr);
32257         LDKPaymentPurpose o_conv = *(LDKPaymentPurpose*)(o_ptr);
32258         o_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(o));
32259         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
32260         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_ok(o_conv);
32261         return tag_ptr(ret_conv, true);
32262 }
32263
32264 int64_t  CS_LDK_CResult_PaymentPurposeDecodeErrorZ_err(int64_t e) {
32265         void* e_ptr = untag_ptr(e);
32266         CHECK_ACCESS(e_ptr);
32267         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
32268         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
32269         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
32270         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_err(e_conv);
32271         return tag_ptr(ret_conv, true);
32272 }
32273
32274 jboolean  CS_LDK_CResult_PaymentPurposeDecodeErrorZ_is_ok(int64_t o) {
32275         LDKCResult_PaymentPurposeDecodeErrorZ* o_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(o);
32276         jboolean ret_conv = CResult_PaymentPurposeDecodeErrorZ_is_ok(o_conv);
32277         return ret_conv;
32278 }
32279
32280 void  CS_LDK_CResult_PaymentPurposeDecodeErrorZ_free(int64_t _res) {
32281         if (!ptr_is_owned(_res)) return;
32282         void* _res_ptr = untag_ptr(_res);
32283         CHECK_ACCESS(_res_ptr);
32284         LDKCResult_PaymentPurposeDecodeErrorZ _res_conv = *(LDKCResult_PaymentPurposeDecodeErrorZ*)(_res_ptr);
32285         FREE(untag_ptr(_res));
32286         CResult_PaymentPurposeDecodeErrorZ_free(_res_conv);
32287 }
32288
32289 static inline uint64_t CResult_PaymentPurposeDecodeErrorZ_clone_ptr(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR arg) {
32290         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
32291         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone(arg);
32292         return tag_ptr(ret_conv, true);
32293 }
32294 int64_t  CS_LDK_CResult_PaymentPurposeDecodeErrorZ_clone_ptr(int64_t arg) {
32295         LDKCResult_PaymentPurposeDecodeErrorZ* arg_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(arg);
32296         int64_t ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone_ptr(arg_conv);
32297         return ret_conv;
32298 }
32299
32300 int64_t  CS_LDK_CResult_PaymentPurposeDecodeErrorZ_clone(int64_t orig) {
32301         LDKCResult_PaymentPurposeDecodeErrorZ* orig_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(orig);
32302         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
32303         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone(orig_conv);
32304         return tag_ptr(ret_conv, true);
32305 }
32306
32307 int64_t  CS_LDK_CResult_ClaimedHTLCDecodeErrorZ_ok(int64_t o) {
32308         LDKClaimedHTLC o_conv;
32309         o_conv.inner = untag_ptr(o);
32310         o_conv.is_owned = ptr_is_owned(o);
32311         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32312         o_conv = ClaimedHTLC_clone(&o_conv);
32313         LDKCResult_ClaimedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClaimedHTLCDecodeErrorZ), "LDKCResult_ClaimedHTLCDecodeErrorZ");
32314         *ret_conv = CResult_ClaimedHTLCDecodeErrorZ_ok(o_conv);
32315         return tag_ptr(ret_conv, true);
32316 }
32317
32318 int64_t  CS_LDK_CResult_ClaimedHTLCDecodeErrorZ_err(int64_t e) {
32319         void* e_ptr = untag_ptr(e);
32320         CHECK_ACCESS(e_ptr);
32321         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
32322         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
32323         LDKCResult_ClaimedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClaimedHTLCDecodeErrorZ), "LDKCResult_ClaimedHTLCDecodeErrorZ");
32324         *ret_conv = CResult_ClaimedHTLCDecodeErrorZ_err(e_conv);
32325         return tag_ptr(ret_conv, true);
32326 }
32327
32328 jboolean  CS_LDK_CResult_ClaimedHTLCDecodeErrorZ_is_ok(int64_t o) {
32329         LDKCResult_ClaimedHTLCDecodeErrorZ* o_conv = (LDKCResult_ClaimedHTLCDecodeErrorZ*)untag_ptr(o);
32330         jboolean ret_conv = CResult_ClaimedHTLCDecodeErrorZ_is_ok(o_conv);
32331         return ret_conv;
32332 }
32333
32334 void  CS_LDK_CResult_ClaimedHTLCDecodeErrorZ_free(int64_t _res) {
32335         if (!ptr_is_owned(_res)) return;
32336         void* _res_ptr = untag_ptr(_res);
32337         CHECK_ACCESS(_res_ptr);
32338         LDKCResult_ClaimedHTLCDecodeErrorZ _res_conv = *(LDKCResult_ClaimedHTLCDecodeErrorZ*)(_res_ptr);
32339         FREE(untag_ptr(_res));
32340         CResult_ClaimedHTLCDecodeErrorZ_free(_res_conv);
32341 }
32342
32343 static inline uint64_t CResult_ClaimedHTLCDecodeErrorZ_clone_ptr(LDKCResult_ClaimedHTLCDecodeErrorZ *NONNULL_PTR arg) {
32344         LDKCResult_ClaimedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClaimedHTLCDecodeErrorZ), "LDKCResult_ClaimedHTLCDecodeErrorZ");
32345         *ret_conv = CResult_ClaimedHTLCDecodeErrorZ_clone(arg);
32346         return tag_ptr(ret_conv, true);
32347 }
32348 int64_t  CS_LDK_CResult_ClaimedHTLCDecodeErrorZ_clone_ptr(int64_t arg) {
32349         LDKCResult_ClaimedHTLCDecodeErrorZ* arg_conv = (LDKCResult_ClaimedHTLCDecodeErrorZ*)untag_ptr(arg);
32350         int64_t ret_conv = CResult_ClaimedHTLCDecodeErrorZ_clone_ptr(arg_conv);
32351         return ret_conv;
32352 }
32353
32354 int64_t  CS_LDK_CResult_ClaimedHTLCDecodeErrorZ_clone(int64_t orig) {
32355         LDKCResult_ClaimedHTLCDecodeErrorZ* orig_conv = (LDKCResult_ClaimedHTLCDecodeErrorZ*)untag_ptr(orig);
32356         LDKCResult_ClaimedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClaimedHTLCDecodeErrorZ), "LDKCResult_ClaimedHTLCDecodeErrorZ");
32357         *ret_conv = CResult_ClaimedHTLCDecodeErrorZ_clone(orig_conv);
32358         return tag_ptr(ret_conv, true);
32359 }
32360
32361 int64_t  CS_LDK_COption_PathFailureZ_some(int64_t o) {
32362         void* o_ptr = untag_ptr(o);
32363         CHECK_ACCESS(o_ptr);
32364         LDKPathFailure o_conv = *(LDKPathFailure*)(o_ptr);
32365         o_conv = PathFailure_clone((LDKPathFailure*)untag_ptr(o));
32366         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
32367         *ret_copy = COption_PathFailureZ_some(o_conv);
32368         int64_t ret_ref = tag_ptr(ret_copy, true);
32369         return ret_ref;
32370 }
32371
32372 int64_t  CS_LDK_COption_PathFailureZ_none() {
32373         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
32374         *ret_copy = COption_PathFailureZ_none();
32375         int64_t ret_ref = tag_ptr(ret_copy, true);
32376         return ret_ref;
32377 }
32378
32379 void  CS_LDK_COption_PathFailureZ_free(int64_t _res) {
32380         if (!ptr_is_owned(_res)) return;
32381         void* _res_ptr = untag_ptr(_res);
32382         CHECK_ACCESS(_res_ptr);
32383         LDKCOption_PathFailureZ _res_conv = *(LDKCOption_PathFailureZ*)(_res_ptr);
32384         FREE(untag_ptr(_res));
32385         COption_PathFailureZ_free(_res_conv);
32386 }
32387
32388 static inline uint64_t COption_PathFailureZ_clone_ptr(LDKCOption_PathFailureZ *NONNULL_PTR arg) {
32389         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
32390         *ret_copy = COption_PathFailureZ_clone(arg);
32391         int64_t ret_ref = tag_ptr(ret_copy, true);
32392         return ret_ref;
32393 }
32394 int64_t  CS_LDK_COption_PathFailureZ_clone_ptr(int64_t arg) {
32395         LDKCOption_PathFailureZ* arg_conv = (LDKCOption_PathFailureZ*)untag_ptr(arg);
32396         int64_t ret_conv = COption_PathFailureZ_clone_ptr(arg_conv);
32397         return ret_conv;
32398 }
32399
32400 int64_t  CS_LDK_COption_PathFailureZ_clone(int64_t orig) {
32401         LDKCOption_PathFailureZ* orig_conv = (LDKCOption_PathFailureZ*)untag_ptr(orig);
32402         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
32403         *ret_copy = COption_PathFailureZ_clone(orig_conv);
32404         int64_t ret_ref = tag_ptr(ret_copy, true);
32405         return ret_ref;
32406 }
32407
32408 int64_t  CS_LDK_CResult_COption_PathFailureZDecodeErrorZ_ok(int64_t o) {
32409         void* o_ptr = untag_ptr(o);
32410         CHECK_ACCESS(o_ptr);
32411         LDKCOption_PathFailureZ o_conv = *(LDKCOption_PathFailureZ*)(o_ptr);
32412         o_conv = COption_PathFailureZ_clone((LDKCOption_PathFailureZ*)untag_ptr(o));
32413         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
32414         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_ok(o_conv);
32415         return tag_ptr(ret_conv, true);
32416 }
32417
32418 int64_t  CS_LDK_CResult_COption_PathFailureZDecodeErrorZ_err(int64_t e) {
32419         void* e_ptr = untag_ptr(e);
32420         CHECK_ACCESS(e_ptr);
32421         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
32422         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
32423         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
32424         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_err(e_conv);
32425         return tag_ptr(ret_conv, true);
32426 }
32427
32428 jboolean  CS_LDK_CResult_COption_PathFailureZDecodeErrorZ_is_ok(int64_t o) {
32429         LDKCResult_COption_PathFailureZDecodeErrorZ* o_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(o);
32430         jboolean ret_conv = CResult_COption_PathFailureZDecodeErrorZ_is_ok(o_conv);
32431         return ret_conv;
32432 }
32433
32434 void  CS_LDK_CResult_COption_PathFailureZDecodeErrorZ_free(int64_t _res) {
32435         if (!ptr_is_owned(_res)) return;
32436         void* _res_ptr = untag_ptr(_res);
32437         CHECK_ACCESS(_res_ptr);
32438         LDKCResult_COption_PathFailureZDecodeErrorZ _res_conv = *(LDKCResult_COption_PathFailureZDecodeErrorZ*)(_res_ptr);
32439         FREE(untag_ptr(_res));
32440         CResult_COption_PathFailureZDecodeErrorZ_free(_res_conv);
32441 }
32442
32443 static inline uint64_t CResult_COption_PathFailureZDecodeErrorZ_clone_ptr(LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR arg) {
32444         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
32445         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_clone(arg);
32446         return tag_ptr(ret_conv, true);
32447 }
32448 int64_t  CS_LDK_CResult_COption_PathFailureZDecodeErrorZ_clone_ptr(int64_t arg) {
32449         LDKCResult_COption_PathFailureZDecodeErrorZ* arg_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(arg);
32450         int64_t ret_conv = CResult_COption_PathFailureZDecodeErrorZ_clone_ptr(arg_conv);
32451         return ret_conv;
32452 }
32453
32454 int64_t  CS_LDK_CResult_COption_PathFailureZDecodeErrorZ_clone(int64_t orig) {
32455         LDKCResult_COption_PathFailureZDecodeErrorZ* orig_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(orig);
32456         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
32457         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_clone(orig_conv);
32458         return tag_ptr(ret_conv, true);
32459 }
32460
32461 int64_t  CS_LDK_COption_ClosureReasonZ_some(int64_t o) {
32462         void* o_ptr = untag_ptr(o);
32463         CHECK_ACCESS(o_ptr);
32464         LDKClosureReason o_conv = *(LDKClosureReason*)(o_ptr);
32465         o_conv = ClosureReason_clone((LDKClosureReason*)untag_ptr(o));
32466         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
32467         *ret_copy = COption_ClosureReasonZ_some(o_conv);
32468         int64_t ret_ref = tag_ptr(ret_copy, true);
32469         return ret_ref;
32470 }
32471
32472 int64_t  CS_LDK_COption_ClosureReasonZ_none() {
32473         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
32474         *ret_copy = COption_ClosureReasonZ_none();
32475         int64_t ret_ref = tag_ptr(ret_copy, true);
32476         return ret_ref;
32477 }
32478
32479 void  CS_LDK_COption_ClosureReasonZ_free(int64_t _res) {
32480         if (!ptr_is_owned(_res)) return;
32481         void* _res_ptr = untag_ptr(_res);
32482         CHECK_ACCESS(_res_ptr);
32483         LDKCOption_ClosureReasonZ _res_conv = *(LDKCOption_ClosureReasonZ*)(_res_ptr);
32484         FREE(untag_ptr(_res));
32485         COption_ClosureReasonZ_free(_res_conv);
32486 }
32487
32488 static inline uint64_t COption_ClosureReasonZ_clone_ptr(LDKCOption_ClosureReasonZ *NONNULL_PTR arg) {
32489         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
32490         *ret_copy = COption_ClosureReasonZ_clone(arg);
32491         int64_t ret_ref = tag_ptr(ret_copy, true);
32492         return ret_ref;
32493 }
32494 int64_t  CS_LDK_COption_ClosureReasonZ_clone_ptr(int64_t arg) {
32495         LDKCOption_ClosureReasonZ* arg_conv = (LDKCOption_ClosureReasonZ*)untag_ptr(arg);
32496         int64_t ret_conv = COption_ClosureReasonZ_clone_ptr(arg_conv);
32497         return ret_conv;
32498 }
32499
32500 int64_t  CS_LDK_COption_ClosureReasonZ_clone(int64_t orig) {
32501         LDKCOption_ClosureReasonZ* orig_conv = (LDKCOption_ClosureReasonZ*)untag_ptr(orig);
32502         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
32503         *ret_copy = COption_ClosureReasonZ_clone(orig_conv);
32504         int64_t ret_ref = tag_ptr(ret_copy, true);
32505         return ret_ref;
32506 }
32507
32508 int64_t  CS_LDK_CResult_COption_ClosureReasonZDecodeErrorZ_ok(int64_t o) {
32509         void* o_ptr = untag_ptr(o);
32510         CHECK_ACCESS(o_ptr);
32511         LDKCOption_ClosureReasonZ o_conv = *(LDKCOption_ClosureReasonZ*)(o_ptr);
32512         o_conv = COption_ClosureReasonZ_clone((LDKCOption_ClosureReasonZ*)untag_ptr(o));
32513         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
32514         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_ok(o_conv);
32515         return tag_ptr(ret_conv, true);
32516 }
32517
32518 int64_t  CS_LDK_CResult_COption_ClosureReasonZDecodeErrorZ_err(int64_t e) {
32519         void* e_ptr = untag_ptr(e);
32520         CHECK_ACCESS(e_ptr);
32521         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
32522         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
32523         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
32524         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_err(e_conv);
32525         return tag_ptr(ret_conv, true);
32526 }
32527
32528 jboolean  CS_LDK_CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(int64_t o) {
32529         LDKCResult_COption_ClosureReasonZDecodeErrorZ* o_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(o);
32530         jboolean ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o_conv);
32531         return ret_conv;
32532 }
32533
32534 void  CS_LDK_CResult_COption_ClosureReasonZDecodeErrorZ_free(int64_t _res) {
32535         if (!ptr_is_owned(_res)) return;
32536         void* _res_ptr = untag_ptr(_res);
32537         CHECK_ACCESS(_res_ptr);
32538         LDKCResult_COption_ClosureReasonZDecodeErrorZ _res_conv = *(LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(_res_ptr);
32539         FREE(untag_ptr(_res));
32540         CResult_COption_ClosureReasonZDecodeErrorZ_free(_res_conv);
32541 }
32542
32543 static inline uint64_t CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR arg) {
32544         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
32545         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(arg);
32546         return tag_ptr(ret_conv, true);
32547 }
32548 int64_t  CS_LDK_CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(int64_t arg) {
32549         LDKCResult_COption_ClosureReasonZDecodeErrorZ* arg_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(arg);
32550         int64_t ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(arg_conv);
32551         return ret_conv;
32552 }
32553
32554 int64_t  CS_LDK_CResult_COption_ClosureReasonZDecodeErrorZ_clone(int64_t orig) {
32555         LDKCResult_COption_ClosureReasonZDecodeErrorZ* orig_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(orig);
32556         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
32557         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig_conv);
32558         return tag_ptr(ret_conv, true);
32559 }
32560
32561 int64_t  CS_LDK_COption_HTLCDestinationZ_some(int64_t o) {
32562         void* o_ptr = untag_ptr(o);
32563         CHECK_ACCESS(o_ptr);
32564         LDKHTLCDestination o_conv = *(LDKHTLCDestination*)(o_ptr);
32565         o_conv = HTLCDestination_clone((LDKHTLCDestination*)untag_ptr(o));
32566         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
32567         *ret_copy = COption_HTLCDestinationZ_some(o_conv);
32568         int64_t ret_ref = tag_ptr(ret_copy, true);
32569         return ret_ref;
32570 }
32571
32572 int64_t  CS_LDK_COption_HTLCDestinationZ_none() {
32573         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
32574         *ret_copy = COption_HTLCDestinationZ_none();
32575         int64_t ret_ref = tag_ptr(ret_copy, true);
32576         return ret_ref;
32577 }
32578
32579 void  CS_LDK_COption_HTLCDestinationZ_free(int64_t _res) {
32580         if (!ptr_is_owned(_res)) return;
32581         void* _res_ptr = untag_ptr(_res);
32582         CHECK_ACCESS(_res_ptr);
32583         LDKCOption_HTLCDestinationZ _res_conv = *(LDKCOption_HTLCDestinationZ*)(_res_ptr);
32584         FREE(untag_ptr(_res));
32585         COption_HTLCDestinationZ_free(_res_conv);
32586 }
32587
32588 static inline uint64_t COption_HTLCDestinationZ_clone_ptr(LDKCOption_HTLCDestinationZ *NONNULL_PTR arg) {
32589         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
32590         *ret_copy = COption_HTLCDestinationZ_clone(arg);
32591         int64_t ret_ref = tag_ptr(ret_copy, true);
32592         return ret_ref;
32593 }
32594 int64_t  CS_LDK_COption_HTLCDestinationZ_clone_ptr(int64_t arg) {
32595         LDKCOption_HTLCDestinationZ* arg_conv = (LDKCOption_HTLCDestinationZ*)untag_ptr(arg);
32596         int64_t ret_conv = COption_HTLCDestinationZ_clone_ptr(arg_conv);
32597         return ret_conv;
32598 }
32599
32600 int64_t  CS_LDK_COption_HTLCDestinationZ_clone(int64_t orig) {
32601         LDKCOption_HTLCDestinationZ* orig_conv = (LDKCOption_HTLCDestinationZ*)untag_ptr(orig);
32602         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
32603         *ret_copy = COption_HTLCDestinationZ_clone(orig_conv);
32604         int64_t ret_ref = tag_ptr(ret_copy, true);
32605         return ret_ref;
32606 }
32607
32608 int64_t  CS_LDK_CResult_COption_HTLCDestinationZDecodeErrorZ_ok(int64_t o) {
32609         void* o_ptr = untag_ptr(o);
32610         CHECK_ACCESS(o_ptr);
32611         LDKCOption_HTLCDestinationZ o_conv = *(LDKCOption_HTLCDestinationZ*)(o_ptr);
32612         o_conv = COption_HTLCDestinationZ_clone((LDKCOption_HTLCDestinationZ*)untag_ptr(o));
32613         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
32614         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_ok(o_conv);
32615         return tag_ptr(ret_conv, true);
32616 }
32617
32618 int64_t  CS_LDK_CResult_COption_HTLCDestinationZDecodeErrorZ_err(int64_t e) {
32619         void* e_ptr = untag_ptr(e);
32620         CHECK_ACCESS(e_ptr);
32621         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
32622         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
32623         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
32624         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_err(e_conv);
32625         return tag_ptr(ret_conv, true);
32626 }
32627
32628 jboolean  CS_LDK_CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(int64_t o) {
32629         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* o_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(o);
32630         jboolean ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(o_conv);
32631         return ret_conv;
32632 }
32633
32634 void  CS_LDK_CResult_COption_HTLCDestinationZDecodeErrorZ_free(int64_t _res) {
32635         if (!ptr_is_owned(_res)) return;
32636         void* _res_ptr = untag_ptr(_res);
32637         CHECK_ACCESS(_res_ptr);
32638         LDKCResult_COption_HTLCDestinationZDecodeErrorZ _res_conv = *(LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)(_res_ptr);
32639         FREE(untag_ptr(_res));
32640         CResult_COption_HTLCDestinationZDecodeErrorZ_free(_res_conv);
32641 }
32642
32643 static inline uint64_t CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR arg) {
32644         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
32645         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone(arg);
32646         return tag_ptr(ret_conv, true);
32647 }
32648 int64_t  CS_LDK_CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(int64_t arg) {
32649         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* arg_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(arg);
32650         int64_t ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(arg_conv);
32651         return ret_conv;
32652 }
32653
32654 int64_t  CS_LDK_CResult_COption_HTLCDestinationZDecodeErrorZ_clone(int64_t orig) {
32655         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* orig_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(orig);
32656         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
32657         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone(orig_conv);
32658         return tag_ptr(ret_conv, true);
32659 }
32660
32661 int64_t  CS_LDK_CResult_PaymentFailureReasonDecodeErrorZ_ok(int32_t o) {
32662         LDKPaymentFailureReason o_conv = LDKPaymentFailureReason_from_cs(o);
32663         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
32664         *ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_ok(o_conv);
32665         return tag_ptr(ret_conv, true);
32666 }
32667
32668 int64_t  CS_LDK_CResult_PaymentFailureReasonDecodeErrorZ_err(int64_t e) {
32669         void* e_ptr = untag_ptr(e);
32670         CHECK_ACCESS(e_ptr);
32671         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
32672         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
32673         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
32674         *ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_err(e_conv);
32675         return tag_ptr(ret_conv, true);
32676 }
32677
32678 jboolean  CS_LDK_CResult_PaymentFailureReasonDecodeErrorZ_is_ok(int64_t o) {
32679         LDKCResult_PaymentFailureReasonDecodeErrorZ* o_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(o);
32680         jboolean ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_is_ok(o_conv);
32681         return ret_conv;
32682 }
32683
32684 void  CS_LDK_CResult_PaymentFailureReasonDecodeErrorZ_free(int64_t _res) {
32685         if (!ptr_is_owned(_res)) return;
32686         void* _res_ptr = untag_ptr(_res);
32687         CHECK_ACCESS(_res_ptr);
32688         LDKCResult_PaymentFailureReasonDecodeErrorZ _res_conv = *(LDKCResult_PaymentFailureReasonDecodeErrorZ*)(_res_ptr);
32689         FREE(untag_ptr(_res));
32690         CResult_PaymentFailureReasonDecodeErrorZ_free(_res_conv);
32691 }
32692
32693 static inline uint64_t CResult_PaymentFailureReasonDecodeErrorZ_clone_ptr(LDKCResult_PaymentFailureReasonDecodeErrorZ *NONNULL_PTR arg) {
32694         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
32695         *ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_clone(arg);
32696         return tag_ptr(ret_conv, true);
32697 }
32698 int64_t  CS_LDK_CResult_PaymentFailureReasonDecodeErrorZ_clone_ptr(int64_t arg) {
32699         LDKCResult_PaymentFailureReasonDecodeErrorZ* arg_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(arg);
32700         int64_t ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_clone_ptr(arg_conv);
32701         return ret_conv;
32702 }
32703
32704 int64_t  CS_LDK_CResult_PaymentFailureReasonDecodeErrorZ_clone(int64_t orig) {
32705         LDKCResult_PaymentFailureReasonDecodeErrorZ* orig_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(orig);
32706         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
32707         *ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_clone(orig_conv);
32708         return tag_ptr(ret_conv, true);
32709 }
32710
32711 int64_t  CS_LDK_COption_U128Z_some(int8_tArray o) {
32712         LDKU128 o_ref;
32713         CHECK(o->arr_len == 16);
32714         memcpy(o_ref.le_bytes, o->elems, 16); FREE(o);
32715         LDKCOption_U128Z *ret_copy = MALLOC(sizeof(LDKCOption_U128Z), "LDKCOption_U128Z");
32716         *ret_copy = COption_U128Z_some(o_ref);
32717         int64_t ret_ref = tag_ptr(ret_copy, true);
32718         return ret_ref;
32719 }
32720
32721 int64_t  CS_LDK_COption_U128Z_none() {
32722         LDKCOption_U128Z *ret_copy = MALLOC(sizeof(LDKCOption_U128Z), "LDKCOption_U128Z");
32723         *ret_copy = COption_U128Z_none();
32724         int64_t ret_ref = tag_ptr(ret_copy, true);
32725         return ret_ref;
32726 }
32727
32728 void  CS_LDK_COption_U128Z_free(int64_t _res) {
32729         if (!ptr_is_owned(_res)) return;
32730         void* _res_ptr = untag_ptr(_res);
32731         CHECK_ACCESS(_res_ptr);
32732         LDKCOption_U128Z _res_conv = *(LDKCOption_U128Z*)(_res_ptr);
32733         FREE(untag_ptr(_res));
32734         COption_U128Z_free(_res_conv);
32735 }
32736
32737 static inline uint64_t COption_U128Z_clone_ptr(LDKCOption_U128Z *NONNULL_PTR arg) {
32738         LDKCOption_U128Z *ret_copy = MALLOC(sizeof(LDKCOption_U128Z), "LDKCOption_U128Z");
32739         *ret_copy = COption_U128Z_clone(arg);
32740         int64_t ret_ref = tag_ptr(ret_copy, true);
32741         return ret_ref;
32742 }
32743 int64_t  CS_LDK_COption_U128Z_clone_ptr(int64_t arg) {
32744         LDKCOption_U128Z* arg_conv = (LDKCOption_U128Z*)untag_ptr(arg);
32745         int64_t ret_conv = COption_U128Z_clone_ptr(arg_conv);
32746         return ret_conv;
32747 }
32748
32749 int64_t  CS_LDK_COption_U128Z_clone(int64_t orig) {
32750         LDKCOption_U128Z* orig_conv = (LDKCOption_U128Z*)untag_ptr(orig);
32751         LDKCOption_U128Z *ret_copy = MALLOC(sizeof(LDKCOption_U128Z), "LDKCOption_U128Z");
32752         *ret_copy = COption_U128Z_clone(orig_conv);
32753         int64_t ret_ref = tag_ptr(ret_copy, true);
32754         return ret_ref;
32755 }
32756
32757 void  CS_LDK_CVec_ClaimedHTLCZ_free(int64_tArray _res) {
32758         LDKCVec_ClaimedHTLCZ _res_constr;
32759         _res_constr.datalen = _res->arr_len;
32760         if (_res_constr.datalen > 0)
32761                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKClaimedHTLC), "LDKCVec_ClaimedHTLCZ Elements");
32762         else
32763                 _res_constr.data = NULL;
32764         int64_t* _res_vals = _res->elems;
32765         for (size_t n = 0; n < _res_constr.datalen; n++) {
32766                 int64_t _res_conv_13 = _res_vals[n];
32767                 LDKClaimedHTLC _res_conv_13_conv;
32768                 _res_conv_13_conv.inner = untag_ptr(_res_conv_13);
32769                 _res_conv_13_conv.is_owned = ptr_is_owned(_res_conv_13);
32770                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_13_conv);
32771                 _res_constr.data[n] = _res_conv_13_conv;
32772         }
32773         FREE(_res);
32774         CVec_ClaimedHTLCZ_free(_res_constr);
32775 }
32776
32777 int64_t  CS_LDK_COption_PaymentFailureReasonZ_some(int32_t o) {
32778         LDKPaymentFailureReason o_conv = LDKPaymentFailureReason_from_cs(o);
32779         LDKCOption_PaymentFailureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentFailureReasonZ), "LDKCOption_PaymentFailureReasonZ");
32780         *ret_copy = COption_PaymentFailureReasonZ_some(o_conv);
32781         int64_t ret_ref = tag_ptr(ret_copy, true);
32782         return ret_ref;
32783 }
32784
32785 int64_t  CS_LDK_COption_PaymentFailureReasonZ_none() {
32786         LDKCOption_PaymentFailureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentFailureReasonZ), "LDKCOption_PaymentFailureReasonZ");
32787         *ret_copy = COption_PaymentFailureReasonZ_none();
32788         int64_t ret_ref = tag_ptr(ret_copy, true);
32789         return ret_ref;
32790 }
32791
32792 void  CS_LDK_COption_PaymentFailureReasonZ_free(int64_t _res) {
32793         if (!ptr_is_owned(_res)) return;
32794         void* _res_ptr = untag_ptr(_res);
32795         CHECK_ACCESS(_res_ptr);
32796         LDKCOption_PaymentFailureReasonZ _res_conv = *(LDKCOption_PaymentFailureReasonZ*)(_res_ptr);
32797         FREE(untag_ptr(_res));
32798         COption_PaymentFailureReasonZ_free(_res_conv);
32799 }
32800
32801 static inline uint64_t COption_PaymentFailureReasonZ_clone_ptr(LDKCOption_PaymentFailureReasonZ *NONNULL_PTR arg) {
32802         LDKCOption_PaymentFailureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentFailureReasonZ), "LDKCOption_PaymentFailureReasonZ");
32803         *ret_copy = COption_PaymentFailureReasonZ_clone(arg);
32804         int64_t ret_ref = tag_ptr(ret_copy, true);
32805         return ret_ref;
32806 }
32807 int64_t  CS_LDK_COption_PaymentFailureReasonZ_clone_ptr(int64_t arg) {
32808         LDKCOption_PaymentFailureReasonZ* arg_conv = (LDKCOption_PaymentFailureReasonZ*)untag_ptr(arg);
32809         int64_t ret_conv = COption_PaymentFailureReasonZ_clone_ptr(arg_conv);
32810         return ret_conv;
32811 }
32812
32813 int64_t  CS_LDK_COption_PaymentFailureReasonZ_clone(int64_t orig) {
32814         LDKCOption_PaymentFailureReasonZ* orig_conv = (LDKCOption_PaymentFailureReasonZ*)untag_ptr(orig);
32815         LDKCOption_PaymentFailureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentFailureReasonZ), "LDKCOption_PaymentFailureReasonZ");
32816         *ret_copy = COption_PaymentFailureReasonZ_clone(orig_conv);
32817         int64_t ret_ref = tag_ptr(ret_copy, true);
32818         return ret_ref;
32819 }
32820
32821 int64_t  CS_LDK_COption_EventZ_some(int64_t o) {
32822         void* o_ptr = untag_ptr(o);
32823         CHECK_ACCESS(o_ptr);
32824         LDKEvent o_conv = *(LDKEvent*)(o_ptr);
32825         o_conv = Event_clone((LDKEvent*)untag_ptr(o));
32826         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
32827         *ret_copy = COption_EventZ_some(o_conv);
32828         int64_t ret_ref = tag_ptr(ret_copy, true);
32829         return ret_ref;
32830 }
32831
32832 int64_t  CS_LDK_COption_EventZ_none() {
32833         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
32834         *ret_copy = COption_EventZ_none();
32835         int64_t ret_ref = tag_ptr(ret_copy, true);
32836         return ret_ref;
32837 }
32838
32839 void  CS_LDK_COption_EventZ_free(int64_t _res) {
32840         if (!ptr_is_owned(_res)) return;
32841         void* _res_ptr = untag_ptr(_res);
32842         CHECK_ACCESS(_res_ptr);
32843         LDKCOption_EventZ _res_conv = *(LDKCOption_EventZ*)(_res_ptr);
32844         FREE(untag_ptr(_res));
32845         COption_EventZ_free(_res_conv);
32846 }
32847
32848 static inline uint64_t COption_EventZ_clone_ptr(LDKCOption_EventZ *NONNULL_PTR arg) {
32849         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
32850         *ret_copy = COption_EventZ_clone(arg);
32851         int64_t ret_ref = tag_ptr(ret_copy, true);
32852         return ret_ref;
32853 }
32854 int64_t  CS_LDK_COption_EventZ_clone_ptr(int64_t arg) {
32855         LDKCOption_EventZ* arg_conv = (LDKCOption_EventZ*)untag_ptr(arg);
32856         int64_t ret_conv = COption_EventZ_clone_ptr(arg_conv);
32857         return ret_conv;
32858 }
32859
32860 int64_t  CS_LDK_COption_EventZ_clone(int64_t orig) {
32861         LDKCOption_EventZ* orig_conv = (LDKCOption_EventZ*)untag_ptr(orig);
32862         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
32863         *ret_copy = COption_EventZ_clone(orig_conv);
32864         int64_t ret_ref = tag_ptr(ret_copy, true);
32865         return ret_ref;
32866 }
32867
32868 int64_t  CS_LDK_CResult_COption_EventZDecodeErrorZ_ok(int64_t o) {
32869         void* o_ptr = untag_ptr(o);
32870         CHECK_ACCESS(o_ptr);
32871         LDKCOption_EventZ o_conv = *(LDKCOption_EventZ*)(o_ptr);
32872         o_conv = COption_EventZ_clone((LDKCOption_EventZ*)untag_ptr(o));
32873         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
32874         *ret_conv = CResult_COption_EventZDecodeErrorZ_ok(o_conv);
32875         return tag_ptr(ret_conv, true);
32876 }
32877
32878 int64_t  CS_LDK_CResult_COption_EventZDecodeErrorZ_err(int64_t e) {
32879         void* e_ptr = untag_ptr(e);
32880         CHECK_ACCESS(e_ptr);
32881         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
32882         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
32883         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
32884         *ret_conv = CResult_COption_EventZDecodeErrorZ_err(e_conv);
32885         return tag_ptr(ret_conv, true);
32886 }
32887
32888 jboolean  CS_LDK_CResult_COption_EventZDecodeErrorZ_is_ok(int64_t o) {
32889         LDKCResult_COption_EventZDecodeErrorZ* o_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(o);
32890         jboolean ret_conv = CResult_COption_EventZDecodeErrorZ_is_ok(o_conv);
32891         return ret_conv;
32892 }
32893
32894 void  CS_LDK_CResult_COption_EventZDecodeErrorZ_free(int64_t _res) {
32895         if (!ptr_is_owned(_res)) return;
32896         void* _res_ptr = untag_ptr(_res);
32897         CHECK_ACCESS(_res_ptr);
32898         LDKCResult_COption_EventZDecodeErrorZ _res_conv = *(LDKCResult_COption_EventZDecodeErrorZ*)(_res_ptr);
32899         FREE(untag_ptr(_res));
32900         CResult_COption_EventZDecodeErrorZ_free(_res_conv);
32901 }
32902
32903 static inline uint64_t CResult_COption_EventZDecodeErrorZ_clone_ptr(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR arg) {
32904         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
32905         *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(arg);
32906         return tag_ptr(ret_conv, true);
32907 }
32908 int64_t  CS_LDK_CResult_COption_EventZDecodeErrorZ_clone_ptr(int64_t arg) {
32909         LDKCResult_COption_EventZDecodeErrorZ* arg_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(arg);
32910         int64_t ret_conv = CResult_COption_EventZDecodeErrorZ_clone_ptr(arg_conv);
32911         return ret_conv;
32912 }
32913
32914 int64_t  CS_LDK_CResult_COption_EventZDecodeErrorZ_clone(int64_t orig) {
32915         LDKCResult_COption_EventZDecodeErrorZ* orig_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(orig);
32916         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
32917         *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(orig_conv);
32918         return tag_ptr(ret_conv, true);
32919 }
32920
32921 int64_t  CS_LDK_CResult_SiPrefixBolt11ParseErrorZ_ok(int32_t o) {
32922         LDKSiPrefix o_conv = LDKSiPrefix_from_cs(o);
32923         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
32924         *ret_conv = CResult_SiPrefixBolt11ParseErrorZ_ok(o_conv);
32925         return tag_ptr(ret_conv, true);
32926 }
32927
32928 int64_t  CS_LDK_CResult_SiPrefixBolt11ParseErrorZ_err(int64_t e) {
32929         void* e_ptr = untag_ptr(e);
32930         CHECK_ACCESS(e_ptr);
32931         LDKBolt11ParseError e_conv = *(LDKBolt11ParseError*)(e_ptr);
32932         e_conv = Bolt11ParseError_clone((LDKBolt11ParseError*)untag_ptr(e));
32933         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
32934         *ret_conv = CResult_SiPrefixBolt11ParseErrorZ_err(e_conv);
32935         return tag_ptr(ret_conv, true);
32936 }
32937
32938 jboolean  CS_LDK_CResult_SiPrefixBolt11ParseErrorZ_is_ok(int64_t o) {
32939         LDKCResult_SiPrefixBolt11ParseErrorZ* o_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(o);
32940         jboolean ret_conv = CResult_SiPrefixBolt11ParseErrorZ_is_ok(o_conv);
32941         return ret_conv;
32942 }
32943
32944 void  CS_LDK_CResult_SiPrefixBolt11ParseErrorZ_free(int64_t _res) {
32945         if (!ptr_is_owned(_res)) return;
32946         void* _res_ptr = untag_ptr(_res);
32947         CHECK_ACCESS(_res_ptr);
32948         LDKCResult_SiPrefixBolt11ParseErrorZ _res_conv = *(LDKCResult_SiPrefixBolt11ParseErrorZ*)(_res_ptr);
32949         FREE(untag_ptr(_res));
32950         CResult_SiPrefixBolt11ParseErrorZ_free(_res_conv);
32951 }
32952
32953 static inline uint64_t CResult_SiPrefixBolt11ParseErrorZ_clone_ptr(LDKCResult_SiPrefixBolt11ParseErrorZ *NONNULL_PTR arg) {
32954         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
32955         *ret_conv = CResult_SiPrefixBolt11ParseErrorZ_clone(arg);
32956         return tag_ptr(ret_conv, true);
32957 }
32958 int64_t  CS_LDK_CResult_SiPrefixBolt11ParseErrorZ_clone_ptr(int64_t arg) {
32959         LDKCResult_SiPrefixBolt11ParseErrorZ* arg_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(arg);
32960         int64_t ret_conv = CResult_SiPrefixBolt11ParseErrorZ_clone_ptr(arg_conv);
32961         return ret_conv;
32962 }
32963
32964 int64_t  CS_LDK_CResult_SiPrefixBolt11ParseErrorZ_clone(int64_t orig) {
32965         LDKCResult_SiPrefixBolt11ParseErrorZ* orig_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(orig);
32966         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
32967         *ret_conv = CResult_SiPrefixBolt11ParseErrorZ_clone(orig_conv);
32968         return tag_ptr(ret_conv, true);
32969 }
32970
32971 int64_t  CS_LDK_CResult_Bolt11InvoiceParseOrSemanticErrorZ_ok(int64_t o) {
32972         LDKBolt11Invoice o_conv;
32973         o_conv.inner = untag_ptr(o);
32974         o_conv.is_owned = ptr_is_owned(o);
32975         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32976         o_conv = Bolt11Invoice_clone(&o_conv);
32977         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
32978         *ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_ok(o_conv);
32979         return tag_ptr(ret_conv, true);
32980 }
32981
32982 int64_t  CS_LDK_CResult_Bolt11InvoiceParseOrSemanticErrorZ_err(int64_t e) {
32983         void* e_ptr = untag_ptr(e);
32984         CHECK_ACCESS(e_ptr);
32985         LDKParseOrSemanticError e_conv = *(LDKParseOrSemanticError*)(e_ptr);
32986         e_conv = ParseOrSemanticError_clone((LDKParseOrSemanticError*)untag_ptr(e));
32987         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
32988         *ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_err(e_conv);
32989         return tag_ptr(ret_conv, true);
32990 }
32991
32992 jboolean  CS_LDK_CResult_Bolt11InvoiceParseOrSemanticErrorZ_is_ok(int64_t o) {
32993         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* o_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(o);
32994         jboolean ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_is_ok(o_conv);
32995         return ret_conv;
32996 }
32997
32998 void  CS_LDK_CResult_Bolt11InvoiceParseOrSemanticErrorZ_free(int64_t _res) {
32999         if (!ptr_is_owned(_res)) return;
33000         void* _res_ptr = untag_ptr(_res);
33001         CHECK_ACCESS(_res_ptr);
33002         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ _res_conv = *(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)(_res_ptr);
33003         FREE(untag_ptr(_res));
33004         CResult_Bolt11InvoiceParseOrSemanticErrorZ_free(_res_conv);
33005 }
33006
33007 static inline uint64_t CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone_ptr(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ *NONNULL_PTR arg) {
33008         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
33009         *ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone(arg);
33010         return tag_ptr(ret_conv, true);
33011 }
33012 int64_t  CS_LDK_CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone_ptr(int64_t arg) {
33013         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* arg_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(arg);
33014         int64_t ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone_ptr(arg_conv);
33015         return ret_conv;
33016 }
33017
33018 int64_t  CS_LDK_CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone(int64_t orig) {
33019         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* orig_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(orig);
33020         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
33021         *ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone(orig_conv);
33022         return tag_ptr(ret_conv, true);
33023 }
33024
33025 int64_t  CS_LDK_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_ok(int64_t o) {
33026         LDKSignedRawBolt11Invoice o_conv;
33027         o_conv.inner = untag_ptr(o);
33028         o_conv.is_owned = ptr_is_owned(o);
33029         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33030         o_conv = SignedRawBolt11Invoice_clone(&o_conv);
33031         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
33032         *ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_ok(o_conv);
33033         return tag_ptr(ret_conv, true);
33034 }
33035
33036 int64_t  CS_LDK_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_err(int64_t e) {
33037         void* e_ptr = untag_ptr(e);
33038         CHECK_ACCESS(e_ptr);
33039         LDKBolt11ParseError e_conv = *(LDKBolt11ParseError*)(e_ptr);
33040         e_conv = Bolt11ParseError_clone((LDKBolt11ParseError*)untag_ptr(e));
33041         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
33042         *ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_err(e_conv);
33043         return tag_ptr(ret_conv, true);
33044 }
33045
33046 jboolean  CS_LDK_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_is_ok(int64_t o) {
33047         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* o_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(o);
33048         jboolean ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_is_ok(o_conv);
33049         return ret_conv;
33050 }
33051
33052 void  CS_LDK_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_free(int64_t _res) {
33053         if (!ptr_is_owned(_res)) return;
33054         void* _res_ptr = untag_ptr(_res);
33055         CHECK_ACCESS(_res_ptr);
33056         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ _res_conv = *(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)(_res_ptr);
33057         FREE(untag_ptr(_res));
33058         CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_free(_res_conv);
33059 }
33060
33061 static inline uint64_t CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone_ptr(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ *NONNULL_PTR arg) {
33062         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
33063         *ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone(arg);
33064         return tag_ptr(ret_conv, true);
33065 }
33066 int64_t  CS_LDK_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone_ptr(int64_t arg) {
33067         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* arg_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(arg);
33068         int64_t ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone_ptr(arg_conv);
33069         return ret_conv;
33070 }
33071
33072 int64_t  CS_LDK_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone(int64_t orig) {
33073         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* orig_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(orig);
33074         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
33075         *ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone(orig_conv);
33076         return tag_ptr(ret_conv, true);
33077 }
33078
33079 static inline uint64_t C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone_ptr(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ *NONNULL_PTR arg) {
33080         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ), "LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ");
33081         *ret_conv = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone(arg);
33082         return tag_ptr(ret_conv, true);
33083 }
33084 int64_t  CS_LDK_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone_ptr(int64_t arg) {
33085         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* arg_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(arg);
33086         int64_t ret_conv = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone_ptr(arg_conv);
33087         return ret_conv;
33088 }
33089
33090 int64_t  CS_LDK_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone(int64_t orig) {
33091         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* orig_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(orig);
33092         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ), "LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ");
33093         *ret_conv = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone(orig_conv);
33094         return tag_ptr(ret_conv, true);
33095 }
33096
33097 int64_t  CS_LDK_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_new(int64_t a, int8_tArray b, int64_t c) {
33098         LDKRawBolt11Invoice a_conv;
33099         a_conv.inner = untag_ptr(a);
33100         a_conv.is_owned = ptr_is_owned(a);
33101         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
33102         a_conv = RawBolt11Invoice_clone(&a_conv);
33103         LDKThirtyTwoBytes b_ref;
33104         CHECK(b->arr_len == 32);
33105         memcpy(b_ref.data, b->elems, 32); FREE(b);
33106         LDKBolt11InvoiceSignature c_conv;
33107         c_conv.inner = untag_ptr(c);
33108         c_conv.is_owned = ptr_is_owned(c);
33109         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
33110         c_conv = Bolt11InvoiceSignature_clone(&c_conv);
33111         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ), "LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ");
33112         *ret_conv = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_new(a_conv, b_ref, c_conv);
33113         return tag_ptr(ret_conv, true);
33114 }
33115
33116 void  CS_LDK_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_free(int64_t _res) {
33117         if (!ptr_is_owned(_res)) return;
33118         void* _res_ptr = untag_ptr(_res);
33119         CHECK_ACCESS(_res_ptr);
33120         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ _res_conv = *(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)(_res_ptr);
33121         FREE(untag_ptr(_res));
33122         C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_free(_res_conv);
33123 }
33124
33125 int64_t  CS_LDK_CResult_PayeePubKeySecp256k1ErrorZ_ok(int64_t o) {
33126         LDKPayeePubKey o_conv;
33127         o_conv.inner = untag_ptr(o);
33128         o_conv.is_owned = ptr_is_owned(o);
33129         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33130         o_conv = PayeePubKey_clone(&o_conv);
33131         LDKCResult_PayeePubKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeySecp256k1ErrorZ), "LDKCResult_PayeePubKeySecp256k1ErrorZ");
33132         *ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_ok(o_conv);
33133         return tag_ptr(ret_conv, true);
33134 }
33135
33136 int64_t  CS_LDK_CResult_PayeePubKeySecp256k1ErrorZ_err(int32_t e) {
33137         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_cs(e);
33138         LDKCResult_PayeePubKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeySecp256k1ErrorZ), "LDKCResult_PayeePubKeySecp256k1ErrorZ");
33139         *ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_err(e_conv);
33140         return tag_ptr(ret_conv, true);
33141 }
33142
33143 jboolean  CS_LDK_CResult_PayeePubKeySecp256k1ErrorZ_is_ok(int64_t o) {
33144         LDKCResult_PayeePubKeySecp256k1ErrorZ* o_conv = (LDKCResult_PayeePubKeySecp256k1ErrorZ*)untag_ptr(o);
33145         jboolean ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_is_ok(o_conv);
33146         return ret_conv;
33147 }
33148
33149 void  CS_LDK_CResult_PayeePubKeySecp256k1ErrorZ_free(int64_t _res) {
33150         if (!ptr_is_owned(_res)) return;
33151         void* _res_ptr = untag_ptr(_res);
33152         CHECK_ACCESS(_res_ptr);
33153         LDKCResult_PayeePubKeySecp256k1ErrorZ _res_conv = *(LDKCResult_PayeePubKeySecp256k1ErrorZ*)(_res_ptr);
33154         FREE(untag_ptr(_res));
33155         CResult_PayeePubKeySecp256k1ErrorZ_free(_res_conv);
33156 }
33157
33158 static inline uint64_t CResult_PayeePubKeySecp256k1ErrorZ_clone_ptr(LDKCResult_PayeePubKeySecp256k1ErrorZ *NONNULL_PTR arg) {
33159         LDKCResult_PayeePubKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeySecp256k1ErrorZ), "LDKCResult_PayeePubKeySecp256k1ErrorZ");
33160         *ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_clone(arg);
33161         return tag_ptr(ret_conv, true);
33162 }
33163 int64_t  CS_LDK_CResult_PayeePubKeySecp256k1ErrorZ_clone_ptr(int64_t arg) {
33164         LDKCResult_PayeePubKeySecp256k1ErrorZ* arg_conv = (LDKCResult_PayeePubKeySecp256k1ErrorZ*)untag_ptr(arg);
33165         int64_t ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_clone_ptr(arg_conv);
33166         return ret_conv;
33167 }
33168
33169 int64_t  CS_LDK_CResult_PayeePubKeySecp256k1ErrorZ_clone(int64_t orig) {
33170         LDKCResult_PayeePubKeySecp256k1ErrorZ* orig_conv = (LDKCResult_PayeePubKeySecp256k1ErrorZ*)untag_ptr(orig);
33171         LDKCResult_PayeePubKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeySecp256k1ErrorZ), "LDKCResult_PayeePubKeySecp256k1ErrorZ");
33172         *ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_clone(orig_conv);
33173         return tag_ptr(ret_conv, true);
33174 }
33175
33176 void  CS_LDK_CVec_PrivateRouteZ_free(int64_tArray _res) {
33177         LDKCVec_PrivateRouteZ _res_constr;
33178         _res_constr.datalen = _res->arr_len;
33179         if (_res_constr.datalen > 0)
33180                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPrivateRoute), "LDKCVec_PrivateRouteZ Elements");
33181         else
33182                 _res_constr.data = NULL;
33183         int64_t* _res_vals = _res->elems;
33184         for (size_t o = 0; o < _res_constr.datalen; o++) {
33185                 int64_t _res_conv_14 = _res_vals[o];
33186                 LDKPrivateRoute _res_conv_14_conv;
33187                 _res_conv_14_conv.inner = untag_ptr(_res_conv_14);
33188                 _res_conv_14_conv.is_owned = ptr_is_owned(_res_conv_14);
33189                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
33190                 _res_constr.data[o] = _res_conv_14_conv;
33191         }
33192         FREE(_res);
33193         CVec_PrivateRouteZ_free(_res_constr);
33194 }
33195
33196 int64_t  CS_LDK_CResult_PositiveTimestampCreationErrorZ_ok(int64_t o) {
33197         LDKPositiveTimestamp o_conv;
33198         o_conv.inner = untag_ptr(o);
33199         o_conv.is_owned = ptr_is_owned(o);
33200         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33201         o_conv = PositiveTimestamp_clone(&o_conv);
33202         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
33203         *ret_conv = CResult_PositiveTimestampCreationErrorZ_ok(o_conv);
33204         return tag_ptr(ret_conv, true);
33205 }
33206
33207 int64_t  CS_LDK_CResult_PositiveTimestampCreationErrorZ_err(int32_t e) {
33208         LDKCreationError e_conv = LDKCreationError_from_cs(e);
33209         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
33210         *ret_conv = CResult_PositiveTimestampCreationErrorZ_err(e_conv);
33211         return tag_ptr(ret_conv, true);
33212 }
33213
33214 jboolean  CS_LDK_CResult_PositiveTimestampCreationErrorZ_is_ok(int64_t o) {
33215         LDKCResult_PositiveTimestampCreationErrorZ* o_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(o);
33216         jboolean ret_conv = CResult_PositiveTimestampCreationErrorZ_is_ok(o_conv);
33217         return ret_conv;
33218 }
33219
33220 void  CS_LDK_CResult_PositiveTimestampCreationErrorZ_free(int64_t _res) {
33221         if (!ptr_is_owned(_res)) return;
33222         void* _res_ptr = untag_ptr(_res);
33223         CHECK_ACCESS(_res_ptr);
33224         LDKCResult_PositiveTimestampCreationErrorZ _res_conv = *(LDKCResult_PositiveTimestampCreationErrorZ*)(_res_ptr);
33225         FREE(untag_ptr(_res));
33226         CResult_PositiveTimestampCreationErrorZ_free(_res_conv);
33227 }
33228
33229 static inline uint64_t CResult_PositiveTimestampCreationErrorZ_clone_ptr(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR arg) {
33230         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
33231         *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(arg);
33232         return tag_ptr(ret_conv, true);
33233 }
33234 int64_t  CS_LDK_CResult_PositiveTimestampCreationErrorZ_clone_ptr(int64_t arg) {
33235         LDKCResult_PositiveTimestampCreationErrorZ* arg_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(arg);
33236         int64_t ret_conv = CResult_PositiveTimestampCreationErrorZ_clone_ptr(arg_conv);
33237         return ret_conv;
33238 }
33239
33240 int64_t  CS_LDK_CResult_PositiveTimestampCreationErrorZ_clone(int64_t orig) {
33241         LDKCResult_PositiveTimestampCreationErrorZ* orig_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(orig);
33242         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
33243         *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(orig_conv);
33244         return tag_ptr(ret_conv, true);
33245 }
33246
33247 int64_t  CS_LDK_CResult_NoneBolt11SemanticErrorZ_ok() {
33248         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
33249         *ret_conv = CResult_NoneBolt11SemanticErrorZ_ok();
33250         return tag_ptr(ret_conv, true);
33251 }
33252
33253 int64_t  CS_LDK_CResult_NoneBolt11SemanticErrorZ_err(int32_t e) {
33254         LDKBolt11SemanticError e_conv = LDKBolt11SemanticError_from_cs(e);
33255         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
33256         *ret_conv = CResult_NoneBolt11SemanticErrorZ_err(e_conv);
33257         return tag_ptr(ret_conv, true);
33258 }
33259
33260 jboolean  CS_LDK_CResult_NoneBolt11SemanticErrorZ_is_ok(int64_t o) {
33261         LDKCResult_NoneBolt11SemanticErrorZ* o_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(o);
33262         jboolean ret_conv = CResult_NoneBolt11SemanticErrorZ_is_ok(o_conv);
33263         return ret_conv;
33264 }
33265
33266 void  CS_LDK_CResult_NoneBolt11SemanticErrorZ_free(int64_t _res) {
33267         if (!ptr_is_owned(_res)) return;
33268         void* _res_ptr = untag_ptr(_res);
33269         CHECK_ACCESS(_res_ptr);
33270         LDKCResult_NoneBolt11SemanticErrorZ _res_conv = *(LDKCResult_NoneBolt11SemanticErrorZ*)(_res_ptr);
33271         FREE(untag_ptr(_res));
33272         CResult_NoneBolt11SemanticErrorZ_free(_res_conv);
33273 }
33274
33275 static inline uint64_t CResult_NoneBolt11SemanticErrorZ_clone_ptr(LDKCResult_NoneBolt11SemanticErrorZ *NONNULL_PTR arg) {
33276         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
33277         *ret_conv = CResult_NoneBolt11SemanticErrorZ_clone(arg);
33278         return tag_ptr(ret_conv, true);
33279 }
33280 int64_t  CS_LDK_CResult_NoneBolt11SemanticErrorZ_clone_ptr(int64_t arg) {
33281         LDKCResult_NoneBolt11SemanticErrorZ* arg_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(arg);
33282         int64_t ret_conv = CResult_NoneBolt11SemanticErrorZ_clone_ptr(arg_conv);
33283         return ret_conv;
33284 }
33285
33286 int64_t  CS_LDK_CResult_NoneBolt11SemanticErrorZ_clone(int64_t orig) {
33287         LDKCResult_NoneBolt11SemanticErrorZ* orig_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(orig);
33288         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
33289         *ret_conv = CResult_NoneBolt11SemanticErrorZ_clone(orig_conv);
33290         return tag_ptr(ret_conv, true);
33291 }
33292
33293 int64_t  CS_LDK_CResult_Bolt11InvoiceBolt11SemanticErrorZ_ok(int64_t o) {
33294         LDKBolt11Invoice o_conv;
33295         o_conv.inner = untag_ptr(o);
33296         o_conv.is_owned = ptr_is_owned(o);
33297         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33298         o_conv = Bolt11Invoice_clone(&o_conv);
33299         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
33300         *ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_ok(o_conv);
33301         return tag_ptr(ret_conv, true);
33302 }
33303
33304 int64_t  CS_LDK_CResult_Bolt11InvoiceBolt11SemanticErrorZ_err(int32_t e) {
33305         LDKBolt11SemanticError e_conv = LDKBolt11SemanticError_from_cs(e);
33306         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
33307         *ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_err(e_conv);
33308         return tag_ptr(ret_conv, true);
33309 }
33310
33311 jboolean  CS_LDK_CResult_Bolt11InvoiceBolt11SemanticErrorZ_is_ok(int64_t o) {
33312         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* o_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(o);
33313         jboolean ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_is_ok(o_conv);
33314         return ret_conv;
33315 }
33316
33317 void  CS_LDK_CResult_Bolt11InvoiceBolt11SemanticErrorZ_free(int64_t _res) {
33318         if (!ptr_is_owned(_res)) return;
33319         void* _res_ptr = untag_ptr(_res);
33320         CHECK_ACCESS(_res_ptr);
33321         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ _res_conv = *(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)(_res_ptr);
33322         FREE(untag_ptr(_res));
33323         CResult_Bolt11InvoiceBolt11SemanticErrorZ_free(_res_conv);
33324 }
33325
33326 static inline uint64_t CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone_ptr(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ *NONNULL_PTR arg) {
33327         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
33328         *ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone(arg);
33329         return tag_ptr(ret_conv, true);
33330 }
33331 int64_t  CS_LDK_CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone_ptr(int64_t arg) {
33332         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* arg_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(arg);
33333         int64_t ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone_ptr(arg_conv);
33334         return ret_conv;
33335 }
33336
33337 int64_t  CS_LDK_CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone(int64_t orig) {
33338         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* orig_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(orig);
33339         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
33340         *ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone(orig_conv);
33341         return tag_ptr(ret_conv, true);
33342 }
33343
33344 int64_t  CS_LDK_CResult_DescriptionCreationErrorZ_ok(int64_t o) {
33345         LDKDescription o_conv;
33346         o_conv.inner = untag_ptr(o);
33347         o_conv.is_owned = ptr_is_owned(o);
33348         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33349         o_conv = Description_clone(&o_conv);
33350         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
33351         *ret_conv = CResult_DescriptionCreationErrorZ_ok(o_conv);
33352         return tag_ptr(ret_conv, true);
33353 }
33354
33355 int64_t  CS_LDK_CResult_DescriptionCreationErrorZ_err(int32_t e) {
33356         LDKCreationError e_conv = LDKCreationError_from_cs(e);
33357         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
33358         *ret_conv = CResult_DescriptionCreationErrorZ_err(e_conv);
33359         return tag_ptr(ret_conv, true);
33360 }
33361
33362 jboolean  CS_LDK_CResult_DescriptionCreationErrorZ_is_ok(int64_t o) {
33363         LDKCResult_DescriptionCreationErrorZ* o_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(o);
33364         jboolean ret_conv = CResult_DescriptionCreationErrorZ_is_ok(o_conv);
33365         return ret_conv;
33366 }
33367
33368 void  CS_LDK_CResult_DescriptionCreationErrorZ_free(int64_t _res) {
33369         if (!ptr_is_owned(_res)) return;
33370         void* _res_ptr = untag_ptr(_res);
33371         CHECK_ACCESS(_res_ptr);
33372         LDKCResult_DescriptionCreationErrorZ _res_conv = *(LDKCResult_DescriptionCreationErrorZ*)(_res_ptr);
33373         FREE(untag_ptr(_res));
33374         CResult_DescriptionCreationErrorZ_free(_res_conv);
33375 }
33376
33377 static inline uint64_t CResult_DescriptionCreationErrorZ_clone_ptr(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR arg) {
33378         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
33379         *ret_conv = CResult_DescriptionCreationErrorZ_clone(arg);
33380         return tag_ptr(ret_conv, true);
33381 }
33382 int64_t  CS_LDK_CResult_DescriptionCreationErrorZ_clone_ptr(int64_t arg) {
33383         LDKCResult_DescriptionCreationErrorZ* arg_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(arg);
33384         int64_t ret_conv = CResult_DescriptionCreationErrorZ_clone_ptr(arg_conv);
33385         return ret_conv;
33386 }
33387
33388 int64_t  CS_LDK_CResult_DescriptionCreationErrorZ_clone(int64_t orig) {
33389         LDKCResult_DescriptionCreationErrorZ* orig_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(orig);
33390         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
33391         *ret_conv = CResult_DescriptionCreationErrorZ_clone(orig_conv);
33392         return tag_ptr(ret_conv, true);
33393 }
33394
33395 int64_t  CS_LDK_CResult_PrivateRouteCreationErrorZ_ok(int64_t o) {
33396         LDKPrivateRoute o_conv;
33397         o_conv.inner = untag_ptr(o);
33398         o_conv.is_owned = ptr_is_owned(o);
33399         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33400         o_conv = PrivateRoute_clone(&o_conv);
33401         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
33402         *ret_conv = CResult_PrivateRouteCreationErrorZ_ok(o_conv);
33403         return tag_ptr(ret_conv, true);
33404 }
33405
33406 int64_t  CS_LDK_CResult_PrivateRouteCreationErrorZ_err(int32_t e) {
33407         LDKCreationError e_conv = LDKCreationError_from_cs(e);
33408         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
33409         *ret_conv = CResult_PrivateRouteCreationErrorZ_err(e_conv);
33410         return tag_ptr(ret_conv, true);
33411 }
33412
33413 jboolean  CS_LDK_CResult_PrivateRouteCreationErrorZ_is_ok(int64_t o) {
33414         LDKCResult_PrivateRouteCreationErrorZ* o_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(o);
33415         jboolean ret_conv = CResult_PrivateRouteCreationErrorZ_is_ok(o_conv);
33416         return ret_conv;
33417 }
33418
33419 void  CS_LDK_CResult_PrivateRouteCreationErrorZ_free(int64_t _res) {
33420         if (!ptr_is_owned(_res)) return;
33421         void* _res_ptr = untag_ptr(_res);
33422         CHECK_ACCESS(_res_ptr);
33423         LDKCResult_PrivateRouteCreationErrorZ _res_conv = *(LDKCResult_PrivateRouteCreationErrorZ*)(_res_ptr);
33424         FREE(untag_ptr(_res));
33425         CResult_PrivateRouteCreationErrorZ_free(_res_conv);
33426 }
33427
33428 static inline uint64_t CResult_PrivateRouteCreationErrorZ_clone_ptr(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR arg) {
33429         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
33430         *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(arg);
33431         return tag_ptr(ret_conv, true);
33432 }
33433 int64_t  CS_LDK_CResult_PrivateRouteCreationErrorZ_clone_ptr(int64_t arg) {
33434         LDKCResult_PrivateRouteCreationErrorZ* arg_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(arg);
33435         int64_t ret_conv = CResult_PrivateRouteCreationErrorZ_clone_ptr(arg_conv);
33436         return ret_conv;
33437 }
33438
33439 int64_t  CS_LDK_CResult_PrivateRouteCreationErrorZ_clone(int64_t orig) {
33440         LDKCResult_PrivateRouteCreationErrorZ* orig_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(orig);
33441         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
33442         *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(orig_conv);
33443         return tag_ptr(ret_conv, true);
33444 }
33445
33446 int64_t  CS_LDK_CResult_OutPointDecodeErrorZ_ok(int64_t o) {
33447         LDKOutPoint o_conv;
33448         o_conv.inner = untag_ptr(o);
33449         o_conv.is_owned = ptr_is_owned(o);
33450         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33451         o_conv = OutPoint_clone(&o_conv);
33452         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
33453         *ret_conv = CResult_OutPointDecodeErrorZ_ok(o_conv);
33454         return tag_ptr(ret_conv, true);
33455 }
33456
33457 int64_t  CS_LDK_CResult_OutPointDecodeErrorZ_err(int64_t e) {
33458         void* e_ptr = untag_ptr(e);
33459         CHECK_ACCESS(e_ptr);
33460         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33461         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33462         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
33463         *ret_conv = CResult_OutPointDecodeErrorZ_err(e_conv);
33464         return tag_ptr(ret_conv, true);
33465 }
33466
33467 jboolean  CS_LDK_CResult_OutPointDecodeErrorZ_is_ok(int64_t o) {
33468         LDKCResult_OutPointDecodeErrorZ* o_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(o);
33469         jboolean ret_conv = CResult_OutPointDecodeErrorZ_is_ok(o_conv);
33470         return ret_conv;
33471 }
33472
33473 void  CS_LDK_CResult_OutPointDecodeErrorZ_free(int64_t _res) {
33474         if (!ptr_is_owned(_res)) return;
33475         void* _res_ptr = untag_ptr(_res);
33476         CHECK_ACCESS(_res_ptr);
33477         LDKCResult_OutPointDecodeErrorZ _res_conv = *(LDKCResult_OutPointDecodeErrorZ*)(_res_ptr);
33478         FREE(untag_ptr(_res));
33479         CResult_OutPointDecodeErrorZ_free(_res_conv);
33480 }
33481
33482 static inline uint64_t CResult_OutPointDecodeErrorZ_clone_ptr(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR arg) {
33483         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
33484         *ret_conv = CResult_OutPointDecodeErrorZ_clone(arg);
33485         return tag_ptr(ret_conv, true);
33486 }
33487 int64_t  CS_LDK_CResult_OutPointDecodeErrorZ_clone_ptr(int64_t arg) {
33488         LDKCResult_OutPointDecodeErrorZ* arg_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(arg);
33489         int64_t ret_conv = CResult_OutPointDecodeErrorZ_clone_ptr(arg_conv);
33490         return ret_conv;
33491 }
33492
33493 int64_t  CS_LDK_CResult_OutPointDecodeErrorZ_clone(int64_t orig) {
33494         LDKCResult_OutPointDecodeErrorZ* orig_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(orig);
33495         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
33496         *ret_conv = CResult_OutPointDecodeErrorZ_clone(orig_conv);
33497         return tag_ptr(ret_conv, true);
33498 }
33499
33500 int64_t  CS_LDK_CResult_BigSizeDecodeErrorZ_ok(int64_t o) {
33501         LDKBigSize o_conv;
33502         o_conv.inner = untag_ptr(o);
33503         o_conv.is_owned = ptr_is_owned(o);
33504         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33505         o_conv = BigSize_clone(&o_conv);
33506         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
33507         *ret_conv = CResult_BigSizeDecodeErrorZ_ok(o_conv);
33508         return tag_ptr(ret_conv, true);
33509 }
33510
33511 int64_t  CS_LDK_CResult_BigSizeDecodeErrorZ_err(int64_t e) {
33512         void* e_ptr = untag_ptr(e);
33513         CHECK_ACCESS(e_ptr);
33514         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33515         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33516         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
33517         *ret_conv = CResult_BigSizeDecodeErrorZ_err(e_conv);
33518         return tag_ptr(ret_conv, true);
33519 }
33520
33521 jboolean  CS_LDK_CResult_BigSizeDecodeErrorZ_is_ok(int64_t o) {
33522         LDKCResult_BigSizeDecodeErrorZ* o_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(o);
33523         jboolean ret_conv = CResult_BigSizeDecodeErrorZ_is_ok(o_conv);
33524         return ret_conv;
33525 }
33526
33527 void  CS_LDK_CResult_BigSizeDecodeErrorZ_free(int64_t _res) {
33528         if (!ptr_is_owned(_res)) return;
33529         void* _res_ptr = untag_ptr(_res);
33530         CHECK_ACCESS(_res_ptr);
33531         LDKCResult_BigSizeDecodeErrorZ _res_conv = *(LDKCResult_BigSizeDecodeErrorZ*)(_res_ptr);
33532         FREE(untag_ptr(_res));
33533         CResult_BigSizeDecodeErrorZ_free(_res_conv);
33534 }
33535
33536 static inline uint64_t CResult_BigSizeDecodeErrorZ_clone_ptr(LDKCResult_BigSizeDecodeErrorZ *NONNULL_PTR arg) {
33537         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
33538         *ret_conv = CResult_BigSizeDecodeErrorZ_clone(arg);
33539         return tag_ptr(ret_conv, true);
33540 }
33541 int64_t  CS_LDK_CResult_BigSizeDecodeErrorZ_clone_ptr(int64_t arg) {
33542         LDKCResult_BigSizeDecodeErrorZ* arg_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(arg);
33543         int64_t ret_conv = CResult_BigSizeDecodeErrorZ_clone_ptr(arg_conv);
33544         return ret_conv;
33545 }
33546
33547 int64_t  CS_LDK_CResult_BigSizeDecodeErrorZ_clone(int64_t orig) {
33548         LDKCResult_BigSizeDecodeErrorZ* orig_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(orig);
33549         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
33550         *ret_conv = CResult_BigSizeDecodeErrorZ_clone(orig_conv);
33551         return tag_ptr(ret_conv, true);
33552 }
33553
33554 int64_t  CS_LDK_CResult_HostnameDecodeErrorZ_ok(int64_t o) {
33555         LDKHostname o_conv;
33556         o_conv.inner = untag_ptr(o);
33557         o_conv.is_owned = ptr_is_owned(o);
33558         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33559         o_conv = Hostname_clone(&o_conv);
33560         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
33561         *ret_conv = CResult_HostnameDecodeErrorZ_ok(o_conv);
33562         return tag_ptr(ret_conv, true);
33563 }
33564
33565 int64_t  CS_LDK_CResult_HostnameDecodeErrorZ_err(int64_t e) {
33566         void* e_ptr = untag_ptr(e);
33567         CHECK_ACCESS(e_ptr);
33568         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33569         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33570         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
33571         *ret_conv = CResult_HostnameDecodeErrorZ_err(e_conv);
33572         return tag_ptr(ret_conv, true);
33573 }
33574
33575 jboolean  CS_LDK_CResult_HostnameDecodeErrorZ_is_ok(int64_t o) {
33576         LDKCResult_HostnameDecodeErrorZ* o_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(o);
33577         jboolean ret_conv = CResult_HostnameDecodeErrorZ_is_ok(o_conv);
33578         return ret_conv;
33579 }
33580
33581 void  CS_LDK_CResult_HostnameDecodeErrorZ_free(int64_t _res) {
33582         if (!ptr_is_owned(_res)) return;
33583         void* _res_ptr = untag_ptr(_res);
33584         CHECK_ACCESS(_res_ptr);
33585         LDKCResult_HostnameDecodeErrorZ _res_conv = *(LDKCResult_HostnameDecodeErrorZ*)(_res_ptr);
33586         FREE(untag_ptr(_res));
33587         CResult_HostnameDecodeErrorZ_free(_res_conv);
33588 }
33589
33590 static inline uint64_t CResult_HostnameDecodeErrorZ_clone_ptr(LDKCResult_HostnameDecodeErrorZ *NONNULL_PTR arg) {
33591         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
33592         *ret_conv = CResult_HostnameDecodeErrorZ_clone(arg);
33593         return tag_ptr(ret_conv, true);
33594 }
33595 int64_t  CS_LDK_CResult_HostnameDecodeErrorZ_clone_ptr(int64_t arg) {
33596         LDKCResult_HostnameDecodeErrorZ* arg_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(arg);
33597         int64_t ret_conv = CResult_HostnameDecodeErrorZ_clone_ptr(arg_conv);
33598         return ret_conv;
33599 }
33600
33601 int64_t  CS_LDK_CResult_HostnameDecodeErrorZ_clone(int64_t orig) {
33602         LDKCResult_HostnameDecodeErrorZ* orig_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(orig);
33603         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
33604         *ret_conv = CResult_HostnameDecodeErrorZ_clone(orig_conv);
33605         return tag_ptr(ret_conv, true);
33606 }
33607
33608 int64_t  CS_LDK_CResult_TransactionU16LenLimitedNoneZ_ok(int64_t o) {
33609         LDKTransactionU16LenLimited o_conv;
33610         o_conv.inner = untag_ptr(o);
33611         o_conv.is_owned = ptr_is_owned(o);
33612         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33613         o_conv = TransactionU16LenLimited_clone(&o_conv);
33614         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
33615         *ret_conv = CResult_TransactionU16LenLimitedNoneZ_ok(o_conv);
33616         return tag_ptr(ret_conv, true);
33617 }
33618
33619 int64_t  CS_LDK_CResult_TransactionU16LenLimitedNoneZ_err() {
33620         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
33621         *ret_conv = CResult_TransactionU16LenLimitedNoneZ_err();
33622         return tag_ptr(ret_conv, true);
33623 }
33624
33625 jboolean  CS_LDK_CResult_TransactionU16LenLimitedNoneZ_is_ok(int64_t o) {
33626         LDKCResult_TransactionU16LenLimitedNoneZ* o_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(o);
33627         jboolean ret_conv = CResult_TransactionU16LenLimitedNoneZ_is_ok(o_conv);
33628         return ret_conv;
33629 }
33630
33631 void  CS_LDK_CResult_TransactionU16LenLimitedNoneZ_free(int64_t _res) {
33632         if (!ptr_is_owned(_res)) return;
33633         void* _res_ptr = untag_ptr(_res);
33634         CHECK_ACCESS(_res_ptr);
33635         LDKCResult_TransactionU16LenLimitedNoneZ _res_conv = *(LDKCResult_TransactionU16LenLimitedNoneZ*)(_res_ptr);
33636         FREE(untag_ptr(_res));
33637         CResult_TransactionU16LenLimitedNoneZ_free(_res_conv);
33638 }
33639
33640 static inline uint64_t CResult_TransactionU16LenLimitedNoneZ_clone_ptr(LDKCResult_TransactionU16LenLimitedNoneZ *NONNULL_PTR arg) {
33641         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
33642         *ret_conv = CResult_TransactionU16LenLimitedNoneZ_clone(arg);
33643         return tag_ptr(ret_conv, true);
33644 }
33645 int64_t  CS_LDK_CResult_TransactionU16LenLimitedNoneZ_clone_ptr(int64_t arg) {
33646         LDKCResult_TransactionU16LenLimitedNoneZ* arg_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(arg);
33647         int64_t ret_conv = CResult_TransactionU16LenLimitedNoneZ_clone_ptr(arg_conv);
33648         return ret_conv;
33649 }
33650
33651 int64_t  CS_LDK_CResult_TransactionU16LenLimitedNoneZ_clone(int64_t orig) {
33652         LDKCResult_TransactionU16LenLimitedNoneZ* orig_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(orig);
33653         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
33654         *ret_conv = CResult_TransactionU16LenLimitedNoneZ_clone(orig_conv);
33655         return tag_ptr(ret_conv, true);
33656 }
33657
33658 int64_t  CS_LDK_CResult_TransactionU16LenLimitedDecodeErrorZ_ok(int64_t o) {
33659         LDKTransactionU16LenLimited o_conv;
33660         o_conv.inner = untag_ptr(o);
33661         o_conv.is_owned = ptr_is_owned(o);
33662         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33663         o_conv = TransactionU16LenLimited_clone(&o_conv);
33664         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
33665         *ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_ok(o_conv);
33666         return tag_ptr(ret_conv, true);
33667 }
33668
33669 int64_t  CS_LDK_CResult_TransactionU16LenLimitedDecodeErrorZ_err(int64_t e) {
33670         void* e_ptr = untag_ptr(e);
33671         CHECK_ACCESS(e_ptr);
33672         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33673         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33674         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
33675         *ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_err(e_conv);
33676         return tag_ptr(ret_conv, true);
33677 }
33678
33679 jboolean  CS_LDK_CResult_TransactionU16LenLimitedDecodeErrorZ_is_ok(int64_t o) {
33680         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* o_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(o);
33681         jboolean ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_is_ok(o_conv);
33682         return ret_conv;
33683 }
33684
33685 void  CS_LDK_CResult_TransactionU16LenLimitedDecodeErrorZ_free(int64_t _res) {
33686         if (!ptr_is_owned(_res)) return;
33687         void* _res_ptr = untag_ptr(_res);
33688         CHECK_ACCESS(_res_ptr);
33689         LDKCResult_TransactionU16LenLimitedDecodeErrorZ _res_conv = *(LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)(_res_ptr);
33690         FREE(untag_ptr(_res));
33691         CResult_TransactionU16LenLimitedDecodeErrorZ_free(_res_conv);
33692 }
33693
33694 static inline uint64_t CResult_TransactionU16LenLimitedDecodeErrorZ_clone_ptr(LDKCResult_TransactionU16LenLimitedDecodeErrorZ *NONNULL_PTR arg) {
33695         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
33696         *ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_clone(arg);
33697         return tag_ptr(ret_conv, true);
33698 }
33699 int64_t  CS_LDK_CResult_TransactionU16LenLimitedDecodeErrorZ_clone_ptr(int64_t arg) {
33700         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* arg_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(arg);
33701         int64_t ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_clone_ptr(arg_conv);
33702         return ret_conv;
33703 }
33704
33705 int64_t  CS_LDK_CResult_TransactionU16LenLimitedDecodeErrorZ_clone(int64_t orig) {
33706         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* orig_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(orig);
33707         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
33708         *ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_clone(orig_conv);
33709         return tag_ptr(ret_conv, true);
33710 }
33711
33712 int64_t  CS_LDK_CResult_UntrustedStringDecodeErrorZ_ok(int64_t o) {
33713         LDKUntrustedString o_conv;
33714         o_conv.inner = untag_ptr(o);
33715         o_conv.is_owned = ptr_is_owned(o);
33716         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33717         o_conv = UntrustedString_clone(&o_conv);
33718         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
33719         *ret_conv = CResult_UntrustedStringDecodeErrorZ_ok(o_conv);
33720         return tag_ptr(ret_conv, true);
33721 }
33722
33723 int64_t  CS_LDK_CResult_UntrustedStringDecodeErrorZ_err(int64_t e) {
33724         void* e_ptr = untag_ptr(e);
33725         CHECK_ACCESS(e_ptr);
33726         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33727         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33728         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
33729         *ret_conv = CResult_UntrustedStringDecodeErrorZ_err(e_conv);
33730         return tag_ptr(ret_conv, true);
33731 }
33732
33733 jboolean  CS_LDK_CResult_UntrustedStringDecodeErrorZ_is_ok(int64_t o) {
33734         LDKCResult_UntrustedStringDecodeErrorZ* o_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(o);
33735         jboolean ret_conv = CResult_UntrustedStringDecodeErrorZ_is_ok(o_conv);
33736         return ret_conv;
33737 }
33738
33739 void  CS_LDK_CResult_UntrustedStringDecodeErrorZ_free(int64_t _res) {
33740         if (!ptr_is_owned(_res)) return;
33741         void* _res_ptr = untag_ptr(_res);
33742         CHECK_ACCESS(_res_ptr);
33743         LDKCResult_UntrustedStringDecodeErrorZ _res_conv = *(LDKCResult_UntrustedStringDecodeErrorZ*)(_res_ptr);
33744         FREE(untag_ptr(_res));
33745         CResult_UntrustedStringDecodeErrorZ_free(_res_conv);
33746 }
33747
33748 static inline uint64_t CResult_UntrustedStringDecodeErrorZ_clone_ptr(LDKCResult_UntrustedStringDecodeErrorZ *NONNULL_PTR arg) {
33749         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
33750         *ret_conv = CResult_UntrustedStringDecodeErrorZ_clone(arg);
33751         return tag_ptr(ret_conv, true);
33752 }
33753 int64_t  CS_LDK_CResult_UntrustedStringDecodeErrorZ_clone_ptr(int64_t arg) {
33754         LDKCResult_UntrustedStringDecodeErrorZ* arg_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(arg);
33755         int64_t ret_conv = CResult_UntrustedStringDecodeErrorZ_clone_ptr(arg_conv);
33756         return ret_conv;
33757 }
33758
33759 int64_t  CS_LDK_CResult_UntrustedStringDecodeErrorZ_clone(int64_t orig) {
33760         LDKCResult_UntrustedStringDecodeErrorZ* orig_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(orig);
33761         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
33762         *ret_conv = CResult_UntrustedStringDecodeErrorZ_clone(orig_conv);
33763         return tag_ptr(ret_conv, true);
33764 }
33765
33766 int64_t  CS_LDK_CResult_ChannelIdDecodeErrorZ_ok(int64_t o) {
33767         LDKChannelId o_conv;
33768         o_conv.inner = untag_ptr(o);
33769         o_conv.is_owned = ptr_is_owned(o);
33770         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33771         o_conv = ChannelId_clone(&o_conv);
33772         LDKCResult_ChannelIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelIdDecodeErrorZ), "LDKCResult_ChannelIdDecodeErrorZ");
33773         *ret_conv = CResult_ChannelIdDecodeErrorZ_ok(o_conv);
33774         return tag_ptr(ret_conv, true);
33775 }
33776
33777 int64_t  CS_LDK_CResult_ChannelIdDecodeErrorZ_err(int64_t e) {
33778         void* e_ptr = untag_ptr(e);
33779         CHECK_ACCESS(e_ptr);
33780         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33781         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33782         LDKCResult_ChannelIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelIdDecodeErrorZ), "LDKCResult_ChannelIdDecodeErrorZ");
33783         *ret_conv = CResult_ChannelIdDecodeErrorZ_err(e_conv);
33784         return tag_ptr(ret_conv, true);
33785 }
33786
33787 jboolean  CS_LDK_CResult_ChannelIdDecodeErrorZ_is_ok(int64_t o) {
33788         LDKCResult_ChannelIdDecodeErrorZ* o_conv = (LDKCResult_ChannelIdDecodeErrorZ*)untag_ptr(o);
33789         jboolean ret_conv = CResult_ChannelIdDecodeErrorZ_is_ok(o_conv);
33790         return ret_conv;
33791 }
33792
33793 void  CS_LDK_CResult_ChannelIdDecodeErrorZ_free(int64_t _res) {
33794         if (!ptr_is_owned(_res)) return;
33795         void* _res_ptr = untag_ptr(_res);
33796         CHECK_ACCESS(_res_ptr);
33797         LDKCResult_ChannelIdDecodeErrorZ _res_conv = *(LDKCResult_ChannelIdDecodeErrorZ*)(_res_ptr);
33798         FREE(untag_ptr(_res));
33799         CResult_ChannelIdDecodeErrorZ_free(_res_conv);
33800 }
33801
33802 static inline uint64_t CResult_ChannelIdDecodeErrorZ_clone_ptr(LDKCResult_ChannelIdDecodeErrorZ *NONNULL_PTR arg) {
33803         LDKCResult_ChannelIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelIdDecodeErrorZ), "LDKCResult_ChannelIdDecodeErrorZ");
33804         *ret_conv = CResult_ChannelIdDecodeErrorZ_clone(arg);
33805         return tag_ptr(ret_conv, true);
33806 }
33807 int64_t  CS_LDK_CResult_ChannelIdDecodeErrorZ_clone_ptr(int64_t arg) {
33808         LDKCResult_ChannelIdDecodeErrorZ* arg_conv = (LDKCResult_ChannelIdDecodeErrorZ*)untag_ptr(arg);
33809         int64_t ret_conv = CResult_ChannelIdDecodeErrorZ_clone_ptr(arg_conv);
33810         return ret_conv;
33811 }
33812
33813 int64_t  CS_LDK_CResult_ChannelIdDecodeErrorZ_clone(int64_t orig) {
33814         LDKCResult_ChannelIdDecodeErrorZ* orig_conv = (LDKCResult_ChannelIdDecodeErrorZ*)untag_ptr(orig);
33815         LDKCResult_ChannelIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelIdDecodeErrorZ), "LDKCResult_ChannelIdDecodeErrorZ");
33816         *ret_conv = CResult_ChannelIdDecodeErrorZ_clone(orig_conv);
33817         return tag_ptr(ret_conv, true);
33818 }
33819
33820 static inline uint64_t C2Tuple__u832u16Z_clone_ptr(LDKC2Tuple__u832u16Z *NONNULL_PTR arg) {
33821         LDKC2Tuple__u832u16Z* ret_conv = MALLOC(sizeof(LDKC2Tuple__u832u16Z), "LDKC2Tuple__u832u16Z");
33822         *ret_conv = C2Tuple__u832u16Z_clone(arg);
33823         return tag_ptr(ret_conv, true);
33824 }
33825 int64_t  CS_LDK_C2Tuple__u832u16Z_clone_ptr(int64_t arg) {
33826         LDKC2Tuple__u832u16Z* arg_conv = (LDKC2Tuple__u832u16Z*)untag_ptr(arg);
33827         int64_t ret_conv = C2Tuple__u832u16Z_clone_ptr(arg_conv);
33828         return ret_conv;
33829 }
33830
33831 int64_t  CS_LDK_C2Tuple__u832u16Z_clone(int64_t orig) {
33832         LDKC2Tuple__u832u16Z* orig_conv = (LDKC2Tuple__u832u16Z*)untag_ptr(orig);
33833         LDKC2Tuple__u832u16Z* ret_conv = MALLOC(sizeof(LDKC2Tuple__u832u16Z), "LDKC2Tuple__u832u16Z");
33834         *ret_conv = C2Tuple__u832u16Z_clone(orig_conv);
33835         return tag_ptr(ret_conv, true);
33836 }
33837
33838 int64_t  CS_LDK_C2Tuple__u832u16Z_new(int8_tArray a, int16_t b) {
33839         LDKThirtyTwoBytes a_ref;
33840         CHECK(a->arr_len == 32);
33841         memcpy(a_ref.data, a->elems, 32); FREE(a);
33842         LDKC2Tuple__u832u16Z* ret_conv = MALLOC(sizeof(LDKC2Tuple__u832u16Z), "LDKC2Tuple__u832u16Z");
33843         *ret_conv = C2Tuple__u832u16Z_new(a_ref, b);
33844         return tag_ptr(ret_conv, true);
33845 }
33846
33847 void  CS_LDK_C2Tuple__u832u16Z_free(int64_t _res) {
33848         if (!ptr_is_owned(_res)) return;
33849         void* _res_ptr = untag_ptr(_res);
33850         CHECK_ACCESS(_res_ptr);
33851         LDKC2Tuple__u832u16Z _res_conv = *(LDKC2Tuple__u832u16Z*)(_res_ptr);
33852         FREE(untag_ptr(_res));
33853         C2Tuple__u832u16Z_free(_res_conv);
33854 }
33855
33856 int64_t  CS_LDK_CResult_PaymentRelayDecodeErrorZ_ok(int64_t o) {
33857         LDKPaymentRelay o_conv;
33858         o_conv.inner = untag_ptr(o);
33859         o_conv.is_owned = ptr_is_owned(o);
33860         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33861         o_conv = PaymentRelay_clone(&o_conv);
33862         LDKCResult_PaymentRelayDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentRelayDecodeErrorZ), "LDKCResult_PaymentRelayDecodeErrorZ");
33863         *ret_conv = CResult_PaymentRelayDecodeErrorZ_ok(o_conv);
33864         return tag_ptr(ret_conv, true);
33865 }
33866
33867 int64_t  CS_LDK_CResult_PaymentRelayDecodeErrorZ_err(int64_t e) {
33868         void* e_ptr = untag_ptr(e);
33869         CHECK_ACCESS(e_ptr);
33870         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33871         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33872         LDKCResult_PaymentRelayDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentRelayDecodeErrorZ), "LDKCResult_PaymentRelayDecodeErrorZ");
33873         *ret_conv = CResult_PaymentRelayDecodeErrorZ_err(e_conv);
33874         return tag_ptr(ret_conv, true);
33875 }
33876
33877 jboolean  CS_LDK_CResult_PaymentRelayDecodeErrorZ_is_ok(int64_t o) {
33878         LDKCResult_PaymentRelayDecodeErrorZ* o_conv = (LDKCResult_PaymentRelayDecodeErrorZ*)untag_ptr(o);
33879         jboolean ret_conv = CResult_PaymentRelayDecodeErrorZ_is_ok(o_conv);
33880         return ret_conv;
33881 }
33882
33883 void  CS_LDK_CResult_PaymentRelayDecodeErrorZ_free(int64_t _res) {
33884         if (!ptr_is_owned(_res)) return;
33885         void* _res_ptr = untag_ptr(_res);
33886         CHECK_ACCESS(_res_ptr);
33887         LDKCResult_PaymentRelayDecodeErrorZ _res_conv = *(LDKCResult_PaymentRelayDecodeErrorZ*)(_res_ptr);
33888         FREE(untag_ptr(_res));
33889         CResult_PaymentRelayDecodeErrorZ_free(_res_conv);
33890 }
33891
33892 static inline uint64_t CResult_PaymentRelayDecodeErrorZ_clone_ptr(LDKCResult_PaymentRelayDecodeErrorZ *NONNULL_PTR arg) {
33893         LDKCResult_PaymentRelayDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentRelayDecodeErrorZ), "LDKCResult_PaymentRelayDecodeErrorZ");
33894         *ret_conv = CResult_PaymentRelayDecodeErrorZ_clone(arg);
33895         return tag_ptr(ret_conv, true);
33896 }
33897 int64_t  CS_LDK_CResult_PaymentRelayDecodeErrorZ_clone_ptr(int64_t arg) {
33898         LDKCResult_PaymentRelayDecodeErrorZ* arg_conv = (LDKCResult_PaymentRelayDecodeErrorZ*)untag_ptr(arg);
33899         int64_t ret_conv = CResult_PaymentRelayDecodeErrorZ_clone_ptr(arg_conv);
33900         return ret_conv;
33901 }
33902
33903 int64_t  CS_LDK_CResult_PaymentRelayDecodeErrorZ_clone(int64_t orig) {
33904         LDKCResult_PaymentRelayDecodeErrorZ* orig_conv = (LDKCResult_PaymentRelayDecodeErrorZ*)untag_ptr(orig);
33905         LDKCResult_PaymentRelayDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentRelayDecodeErrorZ), "LDKCResult_PaymentRelayDecodeErrorZ");
33906         *ret_conv = CResult_PaymentRelayDecodeErrorZ_clone(orig_conv);
33907         return tag_ptr(ret_conv, true);
33908 }
33909
33910 int64_t  CS_LDK_CResult_PaymentConstraintsDecodeErrorZ_ok(int64_t o) {
33911         LDKPaymentConstraints o_conv;
33912         o_conv.inner = untag_ptr(o);
33913         o_conv.is_owned = ptr_is_owned(o);
33914         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33915         o_conv = PaymentConstraints_clone(&o_conv);
33916         LDKCResult_PaymentConstraintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ), "LDKCResult_PaymentConstraintsDecodeErrorZ");
33917         *ret_conv = CResult_PaymentConstraintsDecodeErrorZ_ok(o_conv);
33918         return tag_ptr(ret_conv, true);
33919 }
33920
33921 int64_t  CS_LDK_CResult_PaymentConstraintsDecodeErrorZ_err(int64_t e) {
33922         void* e_ptr = untag_ptr(e);
33923         CHECK_ACCESS(e_ptr);
33924         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33925         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33926         LDKCResult_PaymentConstraintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ), "LDKCResult_PaymentConstraintsDecodeErrorZ");
33927         *ret_conv = CResult_PaymentConstraintsDecodeErrorZ_err(e_conv);
33928         return tag_ptr(ret_conv, true);
33929 }
33930
33931 jboolean  CS_LDK_CResult_PaymentConstraintsDecodeErrorZ_is_ok(int64_t o) {
33932         LDKCResult_PaymentConstraintsDecodeErrorZ* o_conv = (LDKCResult_PaymentConstraintsDecodeErrorZ*)untag_ptr(o);
33933         jboolean ret_conv = CResult_PaymentConstraintsDecodeErrorZ_is_ok(o_conv);
33934         return ret_conv;
33935 }
33936
33937 void  CS_LDK_CResult_PaymentConstraintsDecodeErrorZ_free(int64_t _res) {
33938         if (!ptr_is_owned(_res)) return;
33939         void* _res_ptr = untag_ptr(_res);
33940         CHECK_ACCESS(_res_ptr);
33941         LDKCResult_PaymentConstraintsDecodeErrorZ _res_conv = *(LDKCResult_PaymentConstraintsDecodeErrorZ*)(_res_ptr);
33942         FREE(untag_ptr(_res));
33943         CResult_PaymentConstraintsDecodeErrorZ_free(_res_conv);
33944 }
33945
33946 static inline uint64_t CResult_PaymentConstraintsDecodeErrorZ_clone_ptr(LDKCResult_PaymentConstraintsDecodeErrorZ *NONNULL_PTR arg) {
33947         LDKCResult_PaymentConstraintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ), "LDKCResult_PaymentConstraintsDecodeErrorZ");
33948         *ret_conv = CResult_PaymentConstraintsDecodeErrorZ_clone(arg);
33949         return tag_ptr(ret_conv, true);
33950 }
33951 int64_t  CS_LDK_CResult_PaymentConstraintsDecodeErrorZ_clone_ptr(int64_t arg) {
33952         LDKCResult_PaymentConstraintsDecodeErrorZ* arg_conv = (LDKCResult_PaymentConstraintsDecodeErrorZ*)untag_ptr(arg);
33953         int64_t ret_conv = CResult_PaymentConstraintsDecodeErrorZ_clone_ptr(arg_conv);
33954         return ret_conv;
33955 }
33956
33957 int64_t  CS_LDK_CResult_PaymentConstraintsDecodeErrorZ_clone(int64_t orig) {
33958         LDKCResult_PaymentConstraintsDecodeErrorZ* orig_conv = (LDKCResult_PaymentConstraintsDecodeErrorZ*)untag_ptr(orig);
33959         LDKCResult_PaymentConstraintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ), "LDKCResult_PaymentConstraintsDecodeErrorZ");
33960         *ret_conv = CResult_PaymentConstraintsDecodeErrorZ_clone(orig_conv);
33961         return tag_ptr(ret_conv, true);
33962 }
33963
33964 int64_t  CS_LDK_CResult_PaymentContextDecodeErrorZ_ok(int64_t o) {
33965         void* o_ptr = untag_ptr(o);
33966         CHECK_ACCESS(o_ptr);
33967         LDKPaymentContext o_conv = *(LDKPaymentContext*)(o_ptr);
33968         o_conv = PaymentContext_clone((LDKPaymentContext*)untag_ptr(o));
33969         LDKCResult_PaymentContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentContextDecodeErrorZ), "LDKCResult_PaymentContextDecodeErrorZ");
33970         *ret_conv = CResult_PaymentContextDecodeErrorZ_ok(o_conv);
33971         return tag_ptr(ret_conv, true);
33972 }
33973
33974 int64_t  CS_LDK_CResult_PaymentContextDecodeErrorZ_err(int64_t e) {
33975         void* e_ptr = untag_ptr(e);
33976         CHECK_ACCESS(e_ptr);
33977         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33978         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33979         LDKCResult_PaymentContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentContextDecodeErrorZ), "LDKCResult_PaymentContextDecodeErrorZ");
33980         *ret_conv = CResult_PaymentContextDecodeErrorZ_err(e_conv);
33981         return tag_ptr(ret_conv, true);
33982 }
33983
33984 jboolean  CS_LDK_CResult_PaymentContextDecodeErrorZ_is_ok(int64_t o) {
33985         LDKCResult_PaymentContextDecodeErrorZ* o_conv = (LDKCResult_PaymentContextDecodeErrorZ*)untag_ptr(o);
33986         jboolean ret_conv = CResult_PaymentContextDecodeErrorZ_is_ok(o_conv);
33987         return ret_conv;
33988 }
33989
33990 void  CS_LDK_CResult_PaymentContextDecodeErrorZ_free(int64_t _res) {
33991         if (!ptr_is_owned(_res)) return;
33992         void* _res_ptr = untag_ptr(_res);
33993         CHECK_ACCESS(_res_ptr);
33994         LDKCResult_PaymentContextDecodeErrorZ _res_conv = *(LDKCResult_PaymentContextDecodeErrorZ*)(_res_ptr);
33995         FREE(untag_ptr(_res));
33996         CResult_PaymentContextDecodeErrorZ_free(_res_conv);
33997 }
33998
33999 static inline uint64_t CResult_PaymentContextDecodeErrorZ_clone_ptr(LDKCResult_PaymentContextDecodeErrorZ *NONNULL_PTR arg) {
34000         LDKCResult_PaymentContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentContextDecodeErrorZ), "LDKCResult_PaymentContextDecodeErrorZ");
34001         *ret_conv = CResult_PaymentContextDecodeErrorZ_clone(arg);
34002         return tag_ptr(ret_conv, true);
34003 }
34004 int64_t  CS_LDK_CResult_PaymentContextDecodeErrorZ_clone_ptr(int64_t arg) {
34005         LDKCResult_PaymentContextDecodeErrorZ* arg_conv = (LDKCResult_PaymentContextDecodeErrorZ*)untag_ptr(arg);
34006         int64_t ret_conv = CResult_PaymentContextDecodeErrorZ_clone_ptr(arg_conv);
34007         return ret_conv;
34008 }
34009
34010 int64_t  CS_LDK_CResult_PaymentContextDecodeErrorZ_clone(int64_t orig) {
34011         LDKCResult_PaymentContextDecodeErrorZ* orig_conv = (LDKCResult_PaymentContextDecodeErrorZ*)untag_ptr(orig);
34012         LDKCResult_PaymentContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentContextDecodeErrorZ), "LDKCResult_PaymentContextDecodeErrorZ");
34013         *ret_conv = CResult_PaymentContextDecodeErrorZ_clone(orig_conv);
34014         return tag_ptr(ret_conv, true);
34015 }
34016
34017 int64_t  CS_LDK_CResult_UnknownPaymentContextDecodeErrorZ_ok(int64_t o) {
34018         LDKUnknownPaymentContext o_conv;
34019         o_conv.inner = untag_ptr(o);
34020         o_conv.is_owned = ptr_is_owned(o);
34021         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34022         o_conv = UnknownPaymentContext_clone(&o_conv);
34023         LDKCResult_UnknownPaymentContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnknownPaymentContextDecodeErrorZ), "LDKCResult_UnknownPaymentContextDecodeErrorZ");
34024         *ret_conv = CResult_UnknownPaymentContextDecodeErrorZ_ok(o_conv);
34025         return tag_ptr(ret_conv, true);
34026 }
34027
34028 int64_t  CS_LDK_CResult_UnknownPaymentContextDecodeErrorZ_err(int64_t e) {
34029         void* e_ptr = untag_ptr(e);
34030         CHECK_ACCESS(e_ptr);
34031         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34032         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34033         LDKCResult_UnknownPaymentContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnknownPaymentContextDecodeErrorZ), "LDKCResult_UnknownPaymentContextDecodeErrorZ");
34034         *ret_conv = CResult_UnknownPaymentContextDecodeErrorZ_err(e_conv);
34035         return tag_ptr(ret_conv, true);
34036 }
34037
34038 jboolean  CS_LDK_CResult_UnknownPaymentContextDecodeErrorZ_is_ok(int64_t o) {
34039         LDKCResult_UnknownPaymentContextDecodeErrorZ* o_conv = (LDKCResult_UnknownPaymentContextDecodeErrorZ*)untag_ptr(o);
34040         jboolean ret_conv = CResult_UnknownPaymentContextDecodeErrorZ_is_ok(o_conv);
34041         return ret_conv;
34042 }
34043
34044 void  CS_LDK_CResult_UnknownPaymentContextDecodeErrorZ_free(int64_t _res) {
34045         if (!ptr_is_owned(_res)) return;
34046         void* _res_ptr = untag_ptr(_res);
34047         CHECK_ACCESS(_res_ptr);
34048         LDKCResult_UnknownPaymentContextDecodeErrorZ _res_conv = *(LDKCResult_UnknownPaymentContextDecodeErrorZ*)(_res_ptr);
34049         FREE(untag_ptr(_res));
34050         CResult_UnknownPaymentContextDecodeErrorZ_free(_res_conv);
34051 }
34052
34053 static inline uint64_t CResult_UnknownPaymentContextDecodeErrorZ_clone_ptr(LDKCResult_UnknownPaymentContextDecodeErrorZ *NONNULL_PTR arg) {
34054         LDKCResult_UnknownPaymentContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnknownPaymentContextDecodeErrorZ), "LDKCResult_UnknownPaymentContextDecodeErrorZ");
34055         *ret_conv = CResult_UnknownPaymentContextDecodeErrorZ_clone(arg);
34056         return tag_ptr(ret_conv, true);
34057 }
34058 int64_t  CS_LDK_CResult_UnknownPaymentContextDecodeErrorZ_clone_ptr(int64_t arg) {
34059         LDKCResult_UnknownPaymentContextDecodeErrorZ* arg_conv = (LDKCResult_UnknownPaymentContextDecodeErrorZ*)untag_ptr(arg);
34060         int64_t ret_conv = CResult_UnknownPaymentContextDecodeErrorZ_clone_ptr(arg_conv);
34061         return ret_conv;
34062 }
34063
34064 int64_t  CS_LDK_CResult_UnknownPaymentContextDecodeErrorZ_clone(int64_t orig) {
34065         LDKCResult_UnknownPaymentContextDecodeErrorZ* orig_conv = (LDKCResult_UnknownPaymentContextDecodeErrorZ*)untag_ptr(orig);
34066         LDKCResult_UnknownPaymentContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnknownPaymentContextDecodeErrorZ), "LDKCResult_UnknownPaymentContextDecodeErrorZ");
34067         *ret_conv = CResult_UnknownPaymentContextDecodeErrorZ_clone(orig_conv);
34068         return tag_ptr(ret_conv, true);
34069 }
34070
34071 int64_t  CS_LDK_CResult_Bolt12OfferContextDecodeErrorZ_ok(int64_t o) {
34072         LDKBolt12OfferContext o_conv;
34073         o_conv.inner = untag_ptr(o);
34074         o_conv.is_owned = ptr_is_owned(o);
34075         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34076         o_conv = Bolt12OfferContext_clone(&o_conv);
34077         LDKCResult_Bolt12OfferContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12OfferContextDecodeErrorZ), "LDKCResult_Bolt12OfferContextDecodeErrorZ");
34078         *ret_conv = CResult_Bolt12OfferContextDecodeErrorZ_ok(o_conv);
34079         return tag_ptr(ret_conv, true);
34080 }
34081
34082 int64_t  CS_LDK_CResult_Bolt12OfferContextDecodeErrorZ_err(int64_t e) {
34083         void* e_ptr = untag_ptr(e);
34084         CHECK_ACCESS(e_ptr);
34085         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34086         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34087         LDKCResult_Bolt12OfferContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12OfferContextDecodeErrorZ), "LDKCResult_Bolt12OfferContextDecodeErrorZ");
34088         *ret_conv = CResult_Bolt12OfferContextDecodeErrorZ_err(e_conv);
34089         return tag_ptr(ret_conv, true);
34090 }
34091
34092 jboolean  CS_LDK_CResult_Bolt12OfferContextDecodeErrorZ_is_ok(int64_t o) {
34093         LDKCResult_Bolt12OfferContextDecodeErrorZ* o_conv = (LDKCResult_Bolt12OfferContextDecodeErrorZ*)untag_ptr(o);
34094         jboolean ret_conv = CResult_Bolt12OfferContextDecodeErrorZ_is_ok(o_conv);
34095         return ret_conv;
34096 }
34097
34098 void  CS_LDK_CResult_Bolt12OfferContextDecodeErrorZ_free(int64_t _res) {
34099         if (!ptr_is_owned(_res)) return;
34100         void* _res_ptr = untag_ptr(_res);
34101         CHECK_ACCESS(_res_ptr);
34102         LDKCResult_Bolt12OfferContextDecodeErrorZ _res_conv = *(LDKCResult_Bolt12OfferContextDecodeErrorZ*)(_res_ptr);
34103         FREE(untag_ptr(_res));
34104         CResult_Bolt12OfferContextDecodeErrorZ_free(_res_conv);
34105 }
34106
34107 static inline uint64_t CResult_Bolt12OfferContextDecodeErrorZ_clone_ptr(LDKCResult_Bolt12OfferContextDecodeErrorZ *NONNULL_PTR arg) {
34108         LDKCResult_Bolt12OfferContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12OfferContextDecodeErrorZ), "LDKCResult_Bolt12OfferContextDecodeErrorZ");
34109         *ret_conv = CResult_Bolt12OfferContextDecodeErrorZ_clone(arg);
34110         return tag_ptr(ret_conv, true);
34111 }
34112 int64_t  CS_LDK_CResult_Bolt12OfferContextDecodeErrorZ_clone_ptr(int64_t arg) {
34113         LDKCResult_Bolt12OfferContextDecodeErrorZ* arg_conv = (LDKCResult_Bolt12OfferContextDecodeErrorZ*)untag_ptr(arg);
34114         int64_t ret_conv = CResult_Bolt12OfferContextDecodeErrorZ_clone_ptr(arg_conv);
34115         return ret_conv;
34116 }
34117
34118 int64_t  CS_LDK_CResult_Bolt12OfferContextDecodeErrorZ_clone(int64_t orig) {
34119         LDKCResult_Bolt12OfferContextDecodeErrorZ* orig_conv = (LDKCResult_Bolt12OfferContextDecodeErrorZ*)untag_ptr(orig);
34120         LDKCResult_Bolt12OfferContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12OfferContextDecodeErrorZ), "LDKCResult_Bolt12OfferContextDecodeErrorZ");
34121         *ret_conv = CResult_Bolt12OfferContextDecodeErrorZ_clone(orig_conv);
34122         return tag_ptr(ret_conv, true);
34123 }
34124
34125 int64_t  CS_LDK_CResult_Bolt12RefundContextDecodeErrorZ_ok(int64_t o) {
34126         LDKBolt12RefundContext o_conv;
34127         o_conv.inner = untag_ptr(o);
34128         o_conv.is_owned = ptr_is_owned(o);
34129         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34130         o_conv = Bolt12RefundContext_clone(&o_conv);
34131         LDKCResult_Bolt12RefundContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12RefundContextDecodeErrorZ), "LDKCResult_Bolt12RefundContextDecodeErrorZ");
34132         *ret_conv = CResult_Bolt12RefundContextDecodeErrorZ_ok(o_conv);
34133         return tag_ptr(ret_conv, true);
34134 }
34135
34136 int64_t  CS_LDK_CResult_Bolt12RefundContextDecodeErrorZ_err(int64_t e) {
34137         void* e_ptr = untag_ptr(e);
34138         CHECK_ACCESS(e_ptr);
34139         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34140         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34141         LDKCResult_Bolt12RefundContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12RefundContextDecodeErrorZ), "LDKCResult_Bolt12RefundContextDecodeErrorZ");
34142         *ret_conv = CResult_Bolt12RefundContextDecodeErrorZ_err(e_conv);
34143         return tag_ptr(ret_conv, true);
34144 }
34145
34146 jboolean  CS_LDK_CResult_Bolt12RefundContextDecodeErrorZ_is_ok(int64_t o) {
34147         LDKCResult_Bolt12RefundContextDecodeErrorZ* o_conv = (LDKCResult_Bolt12RefundContextDecodeErrorZ*)untag_ptr(o);
34148         jboolean ret_conv = CResult_Bolt12RefundContextDecodeErrorZ_is_ok(o_conv);
34149         return ret_conv;
34150 }
34151
34152 void  CS_LDK_CResult_Bolt12RefundContextDecodeErrorZ_free(int64_t _res) {
34153         if (!ptr_is_owned(_res)) return;
34154         void* _res_ptr = untag_ptr(_res);
34155         CHECK_ACCESS(_res_ptr);
34156         LDKCResult_Bolt12RefundContextDecodeErrorZ _res_conv = *(LDKCResult_Bolt12RefundContextDecodeErrorZ*)(_res_ptr);
34157         FREE(untag_ptr(_res));
34158         CResult_Bolt12RefundContextDecodeErrorZ_free(_res_conv);
34159 }
34160
34161 static inline uint64_t CResult_Bolt12RefundContextDecodeErrorZ_clone_ptr(LDKCResult_Bolt12RefundContextDecodeErrorZ *NONNULL_PTR arg) {
34162         LDKCResult_Bolt12RefundContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12RefundContextDecodeErrorZ), "LDKCResult_Bolt12RefundContextDecodeErrorZ");
34163         *ret_conv = CResult_Bolt12RefundContextDecodeErrorZ_clone(arg);
34164         return tag_ptr(ret_conv, true);
34165 }
34166 int64_t  CS_LDK_CResult_Bolt12RefundContextDecodeErrorZ_clone_ptr(int64_t arg) {
34167         LDKCResult_Bolt12RefundContextDecodeErrorZ* arg_conv = (LDKCResult_Bolt12RefundContextDecodeErrorZ*)untag_ptr(arg);
34168         int64_t ret_conv = CResult_Bolt12RefundContextDecodeErrorZ_clone_ptr(arg_conv);
34169         return ret_conv;
34170 }
34171
34172 int64_t  CS_LDK_CResult_Bolt12RefundContextDecodeErrorZ_clone(int64_t orig) {
34173         LDKCResult_Bolt12RefundContextDecodeErrorZ* orig_conv = (LDKCResult_Bolt12RefundContextDecodeErrorZ*)untag_ptr(orig);
34174         LDKCResult_Bolt12RefundContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12RefundContextDecodeErrorZ), "LDKCResult_Bolt12RefundContextDecodeErrorZ");
34175         *ret_conv = CResult_Bolt12RefundContextDecodeErrorZ_clone(orig_conv);
34176         return tag_ptr(ret_conv, true);
34177 }
34178
34179 int64_t  CS_LDK_CResult_StrSecp256k1ErrorZ_ok(jstring o) {
34180         LDKStr o_conv = str_ref_to_owned_c(o);
34181         LDKCResult_StrSecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StrSecp256k1ErrorZ), "LDKCResult_StrSecp256k1ErrorZ");
34182         *ret_conv = CResult_StrSecp256k1ErrorZ_ok(o_conv);
34183         return tag_ptr(ret_conv, true);
34184 }
34185
34186 int64_t  CS_LDK_CResult_StrSecp256k1ErrorZ_err(int32_t e) {
34187         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_cs(e);
34188         LDKCResult_StrSecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StrSecp256k1ErrorZ), "LDKCResult_StrSecp256k1ErrorZ");
34189         *ret_conv = CResult_StrSecp256k1ErrorZ_err(e_conv);
34190         return tag_ptr(ret_conv, true);
34191 }
34192
34193 jboolean  CS_LDK_CResult_StrSecp256k1ErrorZ_is_ok(int64_t o) {
34194         LDKCResult_StrSecp256k1ErrorZ* o_conv = (LDKCResult_StrSecp256k1ErrorZ*)untag_ptr(o);
34195         jboolean ret_conv = CResult_StrSecp256k1ErrorZ_is_ok(o_conv);
34196         return ret_conv;
34197 }
34198
34199 void  CS_LDK_CResult_StrSecp256k1ErrorZ_free(int64_t _res) {
34200         if (!ptr_is_owned(_res)) return;
34201         void* _res_ptr = untag_ptr(_res);
34202         CHECK_ACCESS(_res_ptr);
34203         LDKCResult_StrSecp256k1ErrorZ _res_conv = *(LDKCResult_StrSecp256k1ErrorZ*)(_res_ptr);
34204         FREE(untag_ptr(_res));
34205         CResult_StrSecp256k1ErrorZ_free(_res_conv);
34206 }
34207
34208 static inline uint64_t CResult_StrSecp256k1ErrorZ_clone_ptr(LDKCResult_StrSecp256k1ErrorZ *NONNULL_PTR arg) {
34209         LDKCResult_StrSecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StrSecp256k1ErrorZ), "LDKCResult_StrSecp256k1ErrorZ");
34210         *ret_conv = CResult_StrSecp256k1ErrorZ_clone(arg);
34211         return tag_ptr(ret_conv, true);
34212 }
34213 int64_t  CS_LDK_CResult_StrSecp256k1ErrorZ_clone_ptr(int64_t arg) {
34214         LDKCResult_StrSecp256k1ErrorZ* arg_conv = (LDKCResult_StrSecp256k1ErrorZ*)untag_ptr(arg);
34215         int64_t ret_conv = CResult_StrSecp256k1ErrorZ_clone_ptr(arg_conv);
34216         return ret_conv;
34217 }
34218
34219 int64_t  CS_LDK_CResult_StrSecp256k1ErrorZ_clone(int64_t orig) {
34220         LDKCResult_StrSecp256k1ErrorZ* orig_conv = (LDKCResult_StrSecp256k1ErrorZ*)untag_ptr(orig);
34221         LDKCResult_StrSecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StrSecp256k1ErrorZ), "LDKCResult_StrSecp256k1ErrorZ");
34222         *ret_conv = CResult_StrSecp256k1ErrorZ_clone(orig_conv);
34223         return tag_ptr(ret_conv, true);
34224 }
34225
34226 static inline uint64_t C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone_ptr(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ *NONNULL_PTR arg) {
34227         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ), "LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ");
34228         *ret_conv = C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone(arg);
34229         return tag_ptr(ret_conv, true);
34230 }
34231 int64_t  CS_LDK_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone_ptr(int64_t arg) {
34232         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* arg_conv = (LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ*)untag_ptr(arg);
34233         int64_t ret_conv = C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone_ptr(arg_conv);
34234         return ret_conv;
34235 }
34236
34237 int64_t  CS_LDK_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone(int64_t orig) {
34238         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* orig_conv = (LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ*)untag_ptr(orig);
34239         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ), "LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ");
34240         *ret_conv = C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone(orig_conv);
34241         return tag_ptr(ret_conv, true);
34242 }
34243
34244 int64_t  CS_LDK_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_new(int8_tArray a, int64_t b, int64_t c) {
34245         LDKThirtyTwoBytes a_ref;
34246         CHECK(a->arr_len == 32);
34247         memcpy(a_ref.data, a->elems, 32); FREE(a);
34248         LDKRecipientOnionFields b_conv;
34249         b_conv.inner = untag_ptr(b);
34250         b_conv.is_owned = ptr_is_owned(b);
34251         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34252         b_conv = RecipientOnionFields_clone(&b_conv);
34253         LDKRouteParameters c_conv;
34254         c_conv.inner = untag_ptr(c);
34255         c_conv.is_owned = ptr_is_owned(c);
34256         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
34257         c_conv = RouteParameters_clone(&c_conv);
34258         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ), "LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ");
34259         *ret_conv = C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_new(a_ref, b_conv, c_conv);
34260         return tag_ptr(ret_conv, true);
34261 }
34262
34263 void  CS_LDK_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_free(int64_t _res) {
34264         if (!ptr_is_owned(_res)) return;
34265         void* _res_ptr = untag_ptr(_res);
34266         CHECK_ACCESS(_res_ptr);
34267         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ _res_conv = *(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ*)(_res_ptr);
34268         FREE(untag_ptr(_res));
34269         C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_free(_res_conv);
34270 }
34271
34272 int64_t  CS_LDK_CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_ok(int64_t o) {
34273         void* o_ptr = untag_ptr(o);
34274         CHECK_ACCESS(o_ptr);
34275         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ o_conv = *(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ*)(o_ptr);
34276         o_conv = C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone((LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ*)untag_ptr(o));
34277         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ), "LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ");
34278         *ret_conv = CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_ok(o_conv);
34279         return tag_ptr(ret_conv, true);
34280 }
34281
34282 int64_t  CS_LDK_CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_err() {
34283         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ), "LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ");
34284         *ret_conv = CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_err();
34285         return tag_ptr(ret_conv, true);
34286 }
34287
34288 jboolean  CS_LDK_CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_is_ok(int64_t o) {
34289         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* o_conv = (LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ*)untag_ptr(o);
34290         jboolean ret_conv = CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_is_ok(o_conv);
34291         return ret_conv;
34292 }
34293
34294 void  CS_LDK_CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_free(int64_t _res) {
34295         if (!ptr_is_owned(_res)) return;
34296         void* _res_ptr = untag_ptr(_res);
34297         CHECK_ACCESS(_res_ptr);
34298         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ _res_conv = *(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ*)(_res_ptr);
34299         FREE(untag_ptr(_res));
34300         CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_free(_res_conv);
34301 }
34302
34303 static inline uint64_t CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_clone_ptr(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ *NONNULL_PTR arg) {
34304         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ), "LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ");
34305         *ret_conv = CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_clone(arg);
34306         return tag_ptr(ret_conv, true);
34307 }
34308 int64_t  CS_LDK_CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_clone_ptr(int64_t arg) {
34309         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* arg_conv = (LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ*)untag_ptr(arg);
34310         int64_t ret_conv = CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_clone_ptr(arg_conv);
34311         return ret_conv;
34312 }
34313
34314 int64_t  CS_LDK_CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_clone(int64_t orig) {
34315         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* orig_conv = (LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ*)untag_ptr(orig);
34316         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ), "LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ");
34317         *ret_conv = CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_clone(orig_conv);
34318         return tag_ptr(ret_conv, true);
34319 }
34320
34321 int64_t  CS_LDK_CResult_TxOutUtxoLookupErrorZ_ok(int64_t o) {
34322         void* o_ptr = untag_ptr(o);
34323         CHECK_ACCESS(o_ptr);
34324         LDKTxOut o_conv = *(LDKTxOut*)(o_ptr);
34325         o_conv = TxOut_clone((LDKTxOut*)untag_ptr(o));
34326         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
34327         *ret_conv = CResult_TxOutUtxoLookupErrorZ_ok(o_conv);
34328         return tag_ptr(ret_conv, true);
34329 }
34330
34331 int64_t  CS_LDK_CResult_TxOutUtxoLookupErrorZ_err(int32_t e) {
34332         LDKUtxoLookupError e_conv = LDKUtxoLookupError_from_cs(e);
34333         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
34334         *ret_conv = CResult_TxOutUtxoLookupErrorZ_err(e_conv);
34335         return tag_ptr(ret_conv, true);
34336 }
34337
34338 jboolean  CS_LDK_CResult_TxOutUtxoLookupErrorZ_is_ok(int64_t o) {
34339         LDKCResult_TxOutUtxoLookupErrorZ* o_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(o);
34340         jboolean ret_conv = CResult_TxOutUtxoLookupErrorZ_is_ok(o_conv);
34341         return ret_conv;
34342 }
34343
34344 void  CS_LDK_CResult_TxOutUtxoLookupErrorZ_free(int64_t _res) {
34345         if (!ptr_is_owned(_res)) return;
34346         void* _res_ptr = untag_ptr(_res);
34347         CHECK_ACCESS(_res_ptr);
34348         LDKCResult_TxOutUtxoLookupErrorZ _res_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(_res_ptr);
34349         FREE(untag_ptr(_res));
34350         CResult_TxOutUtxoLookupErrorZ_free(_res_conv);
34351 }
34352
34353 static inline uint64_t CResult_TxOutUtxoLookupErrorZ_clone_ptr(LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR arg) {
34354         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
34355         *ret_conv = CResult_TxOutUtxoLookupErrorZ_clone(arg);
34356         return tag_ptr(ret_conv, true);
34357 }
34358 int64_t  CS_LDK_CResult_TxOutUtxoLookupErrorZ_clone_ptr(int64_t arg) {
34359         LDKCResult_TxOutUtxoLookupErrorZ* arg_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(arg);
34360         int64_t ret_conv = CResult_TxOutUtxoLookupErrorZ_clone_ptr(arg_conv);
34361         return ret_conv;
34362 }
34363
34364 int64_t  CS_LDK_CResult_TxOutUtxoLookupErrorZ_clone(int64_t orig) {
34365         LDKCResult_TxOutUtxoLookupErrorZ* orig_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(orig);
34366         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
34367         *ret_conv = CResult_TxOutUtxoLookupErrorZ_clone(orig_conv);
34368         return tag_ptr(ret_conv, true);
34369 }
34370
34371 static inline uint64_t C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone_ptr(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ *NONNULL_PTR arg) {
34372         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ), "LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ");
34373         *ret_conv = C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone(arg);
34374         return tag_ptr(ret_conv, true);
34375 }
34376 int64_t  CS_LDK_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone_ptr(int64_t arg) {
34377         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* arg_conv = (LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ*)untag_ptr(arg);
34378         int64_t ret_conv = C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone_ptr(arg_conv);
34379         return ret_conv;
34380 }
34381
34382 int64_t  CS_LDK_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone(int64_t orig) {
34383         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* orig_conv = (LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ*)untag_ptr(orig);
34384         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ), "LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ");
34385         *ret_conv = C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone(orig_conv);
34386         return tag_ptr(ret_conv, true);
34387 }
34388
34389 int64_t  CS_LDK_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_new(int8_tArray a, int64_t b, int64_t c) {
34390         LDKPublicKey a_ref;
34391         CHECK(a->arr_len == 33);
34392         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
34393         LDKOnionMessage b_conv;
34394         b_conv.inner = untag_ptr(b);
34395         b_conv.is_owned = ptr_is_owned(b);
34396         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34397         b_conv = OnionMessage_clone(&b_conv);
34398         void* c_ptr = untag_ptr(c);
34399         CHECK_ACCESS(c_ptr);
34400         LDKCOption_CVec_SocketAddressZZ c_conv = *(LDKCOption_CVec_SocketAddressZZ*)(c_ptr);
34401         c_conv = COption_CVec_SocketAddressZZ_clone((LDKCOption_CVec_SocketAddressZZ*)untag_ptr(c));
34402         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ), "LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ");
34403         *ret_conv = C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_new(a_ref, b_conv, c_conv);
34404         return tag_ptr(ret_conv, true);
34405 }
34406
34407 void  CS_LDK_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_free(int64_t _res) {
34408         if (!ptr_is_owned(_res)) return;
34409         void* _res_ptr = untag_ptr(_res);
34410         CHECK_ACCESS(_res_ptr);
34411         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ _res_conv = *(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ*)(_res_ptr);
34412         FREE(untag_ptr(_res));
34413         C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_free(_res_conv);
34414 }
34415
34416 int64_t  CS_LDK_CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_ok(int64_t o) {
34417         void* o_ptr = untag_ptr(o);
34418         CHECK_ACCESS(o_ptr);
34419         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ o_conv = *(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ*)(o_ptr);
34420         o_conv = C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone((LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ*)untag_ptr(o));
34421         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ), "LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ");
34422         *ret_conv = CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_ok(o_conv);
34423         return tag_ptr(ret_conv, true);
34424 }
34425
34426 int64_t  CS_LDK_CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_err(int64_t e) {
34427         void* e_ptr = untag_ptr(e);
34428         CHECK_ACCESS(e_ptr);
34429         LDKSendError e_conv = *(LDKSendError*)(e_ptr);
34430         e_conv = SendError_clone((LDKSendError*)untag_ptr(e));
34431         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ), "LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ");
34432         *ret_conv = CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_err(e_conv);
34433         return tag_ptr(ret_conv, true);
34434 }
34435
34436 jboolean  CS_LDK_CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_is_ok(int64_t o) {
34437         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* o_conv = (LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ*)untag_ptr(o);
34438         jboolean ret_conv = CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_is_ok(o_conv);
34439         return ret_conv;
34440 }
34441
34442 void  CS_LDK_CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_free(int64_t _res) {
34443         if (!ptr_is_owned(_res)) return;
34444         void* _res_ptr = untag_ptr(_res);
34445         CHECK_ACCESS(_res_ptr);
34446         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ _res_conv = *(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ*)(_res_ptr);
34447         FREE(untag_ptr(_res));
34448         CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_free(_res_conv);
34449 }
34450
34451 static inline uint64_t CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_clone_ptr(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ *NONNULL_PTR arg) {
34452         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ), "LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ");
34453         *ret_conv = CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_clone(arg);
34454         return tag_ptr(ret_conv, true);
34455 }
34456 int64_t  CS_LDK_CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_clone_ptr(int64_t arg) {
34457         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* arg_conv = (LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ*)untag_ptr(arg);
34458         int64_t ret_conv = CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_clone_ptr(arg_conv);
34459         return ret_conv;
34460 }
34461
34462 int64_t  CS_LDK_CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_clone(int64_t orig) {
34463         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* orig_conv = (LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ*)untag_ptr(orig);
34464         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ), "LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ");
34465         *ret_conv = CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_clone(orig_conv);
34466         return tag_ptr(ret_conv, true);
34467 }
34468
34469 int64_t  CS_LDK_CResult_PeeledOnionNoneZ_ok(int64_t o) {
34470         void* o_ptr = untag_ptr(o);
34471         CHECK_ACCESS(o_ptr);
34472         LDKPeeledOnion o_conv = *(LDKPeeledOnion*)(o_ptr);
34473         o_conv = PeeledOnion_clone((LDKPeeledOnion*)untag_ptr(o));
34474         LDKCResult_PeeledOnionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PeeledOnionNoneZ), "LDKCResult_PeeledOnionNoneZ");
34475         *ret_conv = CResult_PeeledOnionNoneZ_ok(o_conv);
34476         return tag_ptr(ret_conv, true);
34477 }
34478
34479 int64_t  CS_LDK_CResult_PeeledOnionNoneZ_err() {
34480         LDKCResult_PeeledOnionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PeeledOnionNoneZ), "LDKCResult_PeeledOnionNoneZ");
34481         *ret_conv = CResult_PeeledOnionNoneZ_err();
34482         return tag_ptr(ret_conv, true);
34483 }
34484
34485 jboolean  CS_LDK_CResult_PeeledOnionNoneZ_is_ok(int64_t o) {
34486         LDKCResult_PeeledOnionNoneZ* o_conv = (LDKCResult_PeeledOnionNoneZ*)untag_ptr(o);
34487         jboolean ret_conv = CResult_PeeledOnionNoneZ_is_ok(o_conv);
34488         return ret_conv;
34489 }
34490
34491 void  CS_LDK_CResult_PeeledOnionNoneZ_free(int64_t _res) {
34492         if (!ptr_is_owned(_res)) return;
34493         void* _res_ptr = untag_ptr(_res);
34494         CHECK_ACCESS(_res_ptr);
34495         LDKCResult_PeeledOnionNoneZ _res_conv = *(LDKCResult_PeeledOnionNoneZ*)(_res_ptr);
34496         FREE(untag_ptr(_res));
34497         CResult_PeeledOnionNoneZ_free(_res_conv);
34498 }
34499
34500 static inline uint64_t CResult_PeeledOnionNoneZ_clone_ptr(LDKCResult_PeeledOnionNoneZ *NONNULL_PTR arg) {
34501         LDKCResult_PeeledOnionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PeeledOnionNoneZ), "LDKCResult_PeeledOnionNoneZ");
34502         *ret_conv = CResult_PeeledOnionNoneZ_clone(arg);
34503         return tag_ptr(ret_conv, true);
34504 }
34505 int64_t  CS_LDK_CResult_PeeledOnionNoneZ_clone_ptr(int64_t arg) {
34506         LDKCResult_PeeledOnionNoneZ* arg_conv = (LDKCResult_PeeledOnionNoneZ*)untag_ptr(arg);
34507         int64_t ret_conv = CResult_PeeledOnionNoneZ_clone_ptr(arg_conv);
34508         return ret_conv;
34509 }
34510
34511 int64_t  CS_LDK_CResult_PeeledOnionNoneZ_clone(int64_t orig) {
34512         LDKCResult_PeeledOnionNoneZ* orig_conv = (LDKCResult_PeeledOnionNoneZ*)untag_ptr(orig);
34513         LDKCResult_PeeledOnionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PeeledOnionNoneZ), "LDKCResult_PeeledOnionNoneZ");
34514         *ret_conv = CResult_PeeledOnionNoneZ_clone(orig_conv);
34515         return tag_ptr(ret_conv, true);
34516 }
34517
34518 int64_t  CS_LDK_CResult_SendSuccessSendErrorZ_ok(int64_t o) {
34519         void* o_ptr = untag_ptr(o);
34520         CHECK_ACCESS(o_ptr);
34521         LDKSendSuccess o_conv = *(LDKSendSuccess*)(o_ptr);
34522         o_conv = SendSuccess_clone((LDKSendSuccess*)untag_ptr(o));
34523         LDKCResult_SendSuccessSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SendSuccessSendErrorZ), "LDKCResult_SendSuccessSendErrorZ");
34524         *ret_conv = CResult_SendSuccessSendErrorZ_ok(o_conv);
34525         return tag_ptr(ret_conv, true);
34526 }
34527
34528 int64_t  CS_LDK_CResult_SendSuccessSendErrorZ_err(int64_t e) {
34529         void* e_ptr = untag_ptr(e);
34530         CHECK_ACCESS(e_ptr);
34531         LDKSendError e_conv = *(LDKSendError*)(e_ptr);
34532         e_conv = SendError_clone((LDKSendError*)untag_ptr(e));
34533         LDKCResult_SendSuccessSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SendSuccessSendErrorZ), "LDKCResult_SendSuccessSendErrorZ");
34534         *ret_conv = CResult_SendSuccessSendErrorZ_err(e_conv);
34535         return tag_ptr(ret_conv, true);
34536 }
34537
34538 jboolean  CS_LDK_CResult_SendSuccessSendErrorZ_is_ok(int64_t o) {
34539         LDKCResult_SendSuccessSendErrorZ* o_conv = (LDKCResult_SendSuccessSendErrorZ*)untag_ptr(o);
34540         jboolean ret_conv = CResult_SendSuccessSendErrorZ_is_ok(o_conv);
34541         return ret_conv;
34542 }
34543
34544 void  CS_LDK_CResult_SendSuccessSendErrorZ_free(int64_t _res) {
34545         if (!ptr_is_owned(_res)) return;
34546         void* _res_ptr = untag_ptr(_res);
34547         CHECK_ACCESS(_res_ptr);
34548         LDKCResult_SendSuccessSendErrorZ _res_conv = *(LDKCResult_SendSuccessSendErrorZ*)(_res_ptr);
34549         FREE(untag_ptr(_res));
34550         CResult_SendSuccessSendErrorZ_free(_res_conv);
34551 }
34552
34553 static inline uint64_t CResult_SendSuccessSendErrorZ_clone_ptr(LDKCResult_SendSuccessSendErrorZ *NONNULL_PTR arg) {
34554         LDKCResult_SendSuccessSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SendSuccessSendErrorZ), "LDKCResult_SendSuccessSendErrorZ");
34555         *ret_conv = CResult_SendSuccessSendErrorZ_clone(arg);
34556         return tag_ptr(ret_conv, true);
34557 }
34558 int64_t  CS_LDK_CResult_SendSuccessSendErrorZ_clone_ptr(int64_t arg) {
34559         LDKCResult_SendSuccessSendErrorZ* arg_conv = (LDKCResult_SendSuccessSendErrorZ*)untag_ptr(arg);
34560         int64_t ret_conv = CResult_SendSuccessSendErrorZ_clone_ptr(arg_conv);
34561         return ret_conv;
34562 }
34563
34564 int64_t  CS_LDK_CResult_SendSuccessSendErrorZ_clone(int64_t orig) {
34565         LDKCResult_SendSuccessSendErrorZ* orig_conv = (LDKCResult_SendSuccessSendErrorZ*)untag_ptr(orig);
34566         LDKCResult_SendSuccessSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SendSuccessSendErrorZ), "LDKCResult_SendSuccessSendErrorZ");
34567         *ret_conv = CResult_SendSuccessSendErrorZ_clone(orig_conv);
34568         return tag_ptr(ret_conv, true);
34569 }
34570
34571 int64_t  CS_LDK_CResult_BlindedPathNoneZ_ok(int64_t o) {
34572         LDKBlindedPath o_conv;
34573         o_conv.inner = untag_ptr(o);
34574         o_conv.is_owned = ptr_is_owned(o);
34575         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34576         o_conv = BlindedPath_clone(&o_conv);
34577         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
34578         *ret_conv = CResult_BlindedPathNoneZ_ok(o_conv);
34579         return tag_ptr(ret_conv, true);
34580 }
34581
34582 int64_t  CS_LDK_CResult_BlindedPathNoneZ_err() {
34583         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
34584         *ret_conv = CResult_BlindedPathNoneZ_err();
34585         return tag_ptr(ret_conv, true);
34586 }
34587
34588 jboolean  CS_LDK_CResult_BlindedPathNoneZ_is_ok(int64_t o) {
34589         LDKCResult_BlindedPathNoneZ* o_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(o);
34590         jboolean ret_conv = CResult_BlindedPathNoneZ_is_ok(o_conv);
34591         return ret_conv;
34592 }
34593
34594 void  CS_LDK_CResult_BlindedPathNoneZ_free(int64_t _res) {
34595         if (!ptr_is_owned(_res)) return;
34596         void* _res_ptr = untag_ptr(_res);
34597         CHECK_ACCESS(_res_ptr);
34598         LDKCResult_BlindedPathNoneZ _res_conv = *(LDKCResult_BlindedPathNoneZ*)(_res_ptr);
34599         FREE(untag_ptr(_res));
34600         CResult_BlindedPathNoneZ_free(_res_conv);
34601 }
34602
34603 static inline uint64_t CResult_BlindedPathNoneZ_clone_ptr(LDKCResult_BlindedPathNoneZ *NONNULL_PTR arg) {
34604         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
34605         *ret_conv = CResult_BlindedPathNoneZ_clone(arg);
34606         return tag_ptr(ret_conv, true);
34607 }
34608 int64_t  CS_LDK_CResult_BlindedPathNoneZ_clone_ptr(int64_t arg) {
34609         LDKCResult_BlindedPathNoneZ* arg_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(arg);
34610         int64_t ret_conv = CResult_BlindedPathNoneZ_clone_ptr(arg_conv);
34611         return ret_conv;
34612 }
34613
34614 int64_t  CS_LDK_CResult_BlindedPathNoneZ_clone(int64_t orig) {
34615         LDKCResult_BlindedPathNoneZ* orig_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(orig);
34616         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
34617         *ret_conv = CResult_BlindedPathNoneZ_clone(orig_conv);
34618         return tag_ptr(ret_conv, true);
34619 }
34620
34621 int64_t  CS_LDK_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_ok(int64_t o) {
34622         void* o_ptr = untag_ptr(o);
34623         CHECK_ACCESS(o_ptr);
34624         LDKC2Tuple_BlindedPayInfoBlindedPathZ o_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(o_ptr);
34625         o_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(o));
34626         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
34627         *ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_ok(o_conv);
34628         return tag_ptr(ret_conv, true);
34629 }
34630
34631 int64_t  CS_LDK_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_err() {
34632         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
34633         *ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_err();
34634         return tag_ptr(ret_conv, true);
34635 }
34636
34637 jboolean  CS_LDK_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_is_ok(int64_t o) {
34638         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* o_conv = (LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)untag_ptr(o);
34639         jboolean ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_is_ok(o_conv);
34640         return ret_conv;
34641 }
34642
34643 void  CS_LDK_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_free(int64_t _res) {
34644         if (!ptr_is_owned(_res)) return;
34645         void* _res_ptr = untag_ptr(_res);
34646         CHECK_ACCESS(_res_ptr);
34647         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ _res_conv = *(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)(_res_ptr);
34648         FREE(untag_ptr(_res));
34649         CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_free(_res_conv);
34650 }
34651
34652 static inline uint64_t CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone_ptr(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ *NONNULL_PTR arg) {
34653         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
34654         *ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone(arg);
34655         return tag_ptr(ret_conv, true);
34656 }
34657 int64_t  CS_LDK_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone_ptr(int64_t arg) {
34658         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* arg_conv = (LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)untag_ptr(arg);
34659         int64_t ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone_ptr(arg_conv);
34660         return ret_conv;
34661 }
34662
34663 int64_t  CS_LDK_CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone(int64_t orig) {
34664         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* orig_conv = (LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)untag_ptr(orig);
34665         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
34666         *ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone(orig_conv);
34667         return tag_ptr(ret_conv, true);
34668 }
34669
34670 void  CS_LDK_CVec_ForwardNodeZ_free(int64_tArray _res) {
34671         LDKCVec_ForwardNodeZ _res_constr;
34672         _res_constr.datalen = _res->arr_len;
34673         if (_res_constr.datalen > 0)
34674                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKForwardNode), "LDKCVec_ForwardNodeZ Elements");
34675         else
34676                 _res_constr.data = NULL;
34677         int64_t* _res_vals = _res->elems;
34678         for (size_t n = 0; n < _res_constr.datalen; n++) {
34679                 int64_t _res_conv_13 = _res_vals[n];
34680                 LDKForwardNode _res_conv_13_conv;
34681                 _res_conv_13_conv.inner = untag_ptr(_res_conv_13);
34682                 _res_conv_13_conv.is_owned = ptr_is_owned(_res_conv_13);
34683                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_13_conv);
34684                 _res_constr.data[n] = _res_conv_13_conv;
34685         }
34686         FREE(_res);
34687         CVec_ForwardNodeZ_free(_res_constr);
34688 }
34689
34690 int64_t  CS_LDK_CResult_BlindedPathDecodeErrorZ_ok(int64_t o) {
34691         LDKBlindedPath o_conv;
34692         o_conv.inner = untag_ptr(o);
34693         o_conv.is_owned = ptr_is_owned(o);
34694         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34695         o_conv = BlindedPath_clone(&o_conv);
34696         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
34697         *ret_conv = CResult_BlindedPathDecodeErrorZ_ok(o_conv);
34698         return tag_ptr(ret_conv, true);
34699 }
34700
34701 int64_t  CS_LDK_CResult_BlindedPathDecodeErrorZ_err(int64_t e) {
34702         void* e_ptr = untag_ptr(e);
34703         CHECK_ACCESS(e_ptr);
34704         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34705         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34706         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
34707         *ret_conv = CResult_BlindedPathDecodeErrorZ_err(e_conv);
34708         return tag_ptr(ret_conv, true);
34709 }
34710
34711 jboolean  CS_LDK_CResult_BlindedPathDecodeErrorZ_is_ok(int64_t o) {
34712         LDKCResult_BlindedPathDecodeErrorZ* o_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(o);
34713         jboolean ret_conv = CResult_BlindedPathDecodeErrorZ_is_ok(o_conv);
34714         return ret_conv;
34715 }
34716
34717 void  CS_LDK_CResult_BlindedPathDecodeErrorZ_free(int64_t _res) {
34718         if (!ptr_is_owned(_res)) return;
34719         void* _res_ptr = untag_ptr(_res);
34720         CHECK_ACCESS(_res_ptr);
34721         LDKCResult_BlindedPathDecodeErrorZ _res_conv = *(LDKCResult_BlindedPathDecodeErrorZ*)(_res_ptr);
34722         FREE(untag_ptr(_res));
34723         CResult_BlindedPathDecodeErrorZ_free(_res_conv);
34724 }
34725
34726 static inline uint64_t CResult_BlindedPathDecodeErrorZ_clone_ptr(LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR arg) {
34727         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
34728         *ret_conv = CResult_BlindedPathDecodeErrorZ_clone(arg);
34729         return tag_ptr(ret_conv, true);
34730 }
34731 int64_t  CS_LDK_CResult_BlindedPathDecodeErrorZ_clone_ptr(int64_t arg) {
34732         LDKCResult_BlindedPathDecodeErrorZ* arg_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(arg);
34733         int64_t ret_conv = CResult_BlindedPathDecodeErrorZ_clone_ptr(arg_conv);
34734         return ret_conv;
34735 }
34736
34737 int64_t  CS_LDK_CResult_BlindedPathDecodeErrorZ_clone(int64_t orig) {
34738         LDKCResult_BlindedPathDecodeErrorZ* orig_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(orig);
34739         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
34740         *ret_conv = CResult_BlindedPathDecodeErrorZ_clone(orig_conv);
34741         return tag_ptr(ret_conv, true);
34742 }
34743
34744 int64_t  CS_LDK_CResult_BlindedHopDecodeErrorZ_ok(int64_t o) {
34745         LDKBlindedHop o_conv;
34746         o_conv.inner = untag_ptr(o);
34747         o_conv.is_owned = ptr_is_owned(o);
34748         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34749         o_conv = BlindedHop_clone(&o_conv);
34750         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
34751         *ret_conv = CResult_BlindedHopDecodeErrorZ_ok(o_conv);
34752         return tag_ptr(ret_conv, true);
34753 }
34754
34755 int64_t  CS_LDK_CResult_BlindedHopDecodeErrorZ_err(int64_t e) {
34756         void* e_ptr = untag_ptr(e);
34757         CHECK_ACCESS(e_ptr);
34758         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34759         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34760         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
34761         *ret_conv = CResult_BlindedHopDecodeErrorZ_err(e_conv);
34762         return tag_ptr(ret_conv, true);
34763 }
34764
34765 jboolean  CS_LDK_CResult_BlindedHopDecodeErrorZ_is_ok(int64_t o) {
34766         LDKCResult_BlindedHopDecodeErrorZ* o_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(o);
34767         jboolean ret_conv = CResult_BlindedHopDecodeErrorZ_is_ok(o_conv);
34768         return ret_conv;
34769 }
34770
34771 void  CS_LDK_CResult_BlindedHopDecodeErrorZ_free(int64_t _res) {
34772         if (!ptr_is_owned(_res)) return;
34773         void* _res_ptr = untag_ptr(_res);
34774         CHECK_ACCESS(_res_ptr);
34775         LDKCResult_BlindedHopDecodeErrorZ _res_conv = *(LDKCResult_BlindedHopDecodeErrorZ*)(_res_ptr);
34776         FREE(untag_ptr(_res));
34777         CResult_BlindedHopDecodeErrorZ_free(_res_conv);
34778 }
34779
34780 static inline uint64_t CResult_BlindedHopDecodeErrorZ_clone_ptr(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR arg) {
34781         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
34782         *ret_conv = CResult_BlindedHopDecodeErrorZ_clone(arg);
34783         return tag_ptr(ret_conv, true);
34784 }
34785 int64_t  CS_LDK_CResult_BlindedHopDecodeErrorZ_clone_ptr(int64_t arg) {
34786         LDKCResult_BlindedHopDecodeErrorZ* arg_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(arg);
34787         int64_t ret_conv = CResult_BlindedHopDecodeErrorZ_clone_ptr(arg_conv);
34788         return ret_conv;
34789 }
34790
34791 int64_t  CS_LDK_CResult_BlindedHopDecodeErrorZ_clone(int64_t orig) {
34792         LDKCResult_BlindedHopDecodeErrorZ* orig_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(orig);
34793         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
34794         *ret_conv = CResult_BlindedHopDecodeErrorZ_clone(orig_conv);
34795         return tag_ptr(ret_conv, true);
34796 }
34797
34798 int64_t  CS_LDK_CResult_InvoiceErrorDecodeErrorZ_ok(int64_t o) {
34799         LDKInvoiceError o_conv;
34800         o_conv.inner = untag_ptr(o);
34801         o_conv.is_owned = ptr_is_owned(o);
34802         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34803         o_conv = InvoiceError_clone(&o_conv);
34804         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
34805         *ret_conv = CResult_InvoiceErrorDecodeErrorZ_ok(o_conv);
34806         return tag_ptr(ret_conv, true);
34807 }
34808
34809 int64_t  CS_LDK_CResult_InvoiceErrorDecodeErrorZ_err(int64_t e) {
34810         void* e_ptr = untag_ptr(e);
34811         CHECK_ACCESS(e_ptr);
34812         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34813         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34814         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
34815         *ret_conv = CResult_InvoiceErrorDecodeErrorZ_err(e_conv);
34816         return tag_ptr(ret_conv, true);
34817 }
34818
34819 jboolean  CS_LDK_CResult_InvoiceErrorDecodeErrorZ_is_ok(int64_t o) {
34820         LDKCResult_InvoiceErrorDecodeErrorZ* o_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(o);
34821         jboolean ret_conv = CResult_InvoiceErrorDecodeErrorZ_is_ok(o_conv);
34822         return ret_conv;
34823 }
34824
34825 void  CS_LDK_CResult_InvoiceErrorDecodeErrorZ_free(int64_t _res) {
34826         if (!ptr_is_owned(_res)) return;
34827         void* _res_ptr = untag_ptr(_res);
34828         CHECK_ACCESS(_res_ptr);
34829         LDKCResult_InvoiceErrorDecodeErrorZ _res_conv = *(LDKCResult_InvoiceErrorDecodeErrorZ*)(_res_ptr);
34830         FREE(untag_ptr(_res));
34831         CResult_InvoiceErrorDecodeErrorZ_free(_res_conv);
34832 }
34833
34834 static inline uint64_t CResult_InvoiceErrorDecodeErrorZ_clone_ptr(LDKCResult_InvoiceErrorDecodeErrorZ *NONNULL_PTR arg) {
34835         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
34836         *ret_conv = CResult_InvoiceErrorDecodeErrorZ_clone(arg);
34837         return tag_ptr(ret_conv, true);
34838 }
34839 int64_t  CS_LDK_CResult_InvoiceErrorDecodeErrorZ_clone_ptr(int64_t arg) {
34840         LDKCResult_InvoiceErrorDecodeErrorZ* arg_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(arg);
34841         int64_t ret_conv = CResult_InvoiceErrorDecodeErrorZ_clone_ptr(arg_conv);
34842         return ret_conv;
34843 }
34844
34845 int64_t  CS_LDK_CResult_InvoiceErrorDecodeErrorZ_clone(int64_t orig) {
34846         LDKCResult_InvoiceErrorDecodeErrorZ* orig_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(orig);
34847         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
34848         *ret_conv = CResult_InvoiceErrorDecodeErrorZ_clone(orig_conv);
34849         return tag_ptr(ret_conv, true);
34850 }
34851
34852 int64_t  CS_LDK_CResult_TrackedSpendableOutputDecodeErrorZ_ok(int64_t o) {
34853         LDKTrackedSpendableOutput o_conv;
34854         o_conv.inner = untag_ptr(o);
34855         o_conv.is_owned = ptr_is_owned(o);
34856         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34857         o_conv = TrackedSpendableOutput_clone(&o_conv);
34858         LDKCResult_TrackedSpendableOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TrackedSpendableOutputDecodeErrorZ), "LDKCResult_TrackedSpendableOutputDecodeErrorZ");
34859         *ret_conv = CResult_TrackedSpendableOutputDecodeErrorZ_ok(o_conv);
34860         return tag_ptr(ret_conv, true);
34861 }
34862
34863 int64_t  CS_LDK_CResult_TrackedSpendableOutputDecodeErrorZ_err(int64_t e) {
34864         void* e_ptr = untag_ptr(e);
34865         CHECK_ACCESS(e_ptr);
34866         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34867         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34868         LDKCResult_TrackedSpendableOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TrackedSpendableOutputDecodeErrorZ), "LDKCResult_TrackedSpendableOutputDecodeErrorZ");
34869         *ret_conv = CResult_TrackedSpendableOutputDecodeErrorZ_err(e_conv);
34870         return tag_ptr(ret_conv, true);
34871 }
34872
34873 jboolean  CS_LDK_CResult_TrackedSpendableOutputDecodeErrorZ_is_ok(int64_t o) {
34874         LDKCResult_TrackedSpendableOutputDecodeErrorZ* o_conv = (LDKCResult_TrackedSpendableOutputDecodeErrorZ*)untag_ptr(o);
34875         jboolean ret_conv = CResult_TrackedSpendableOutputDecodeErrorZ_is_ok(o_conv);
34876         return ret_conv;
34877 }
34878
34879 void  CS_LDK_CResult_TrackedSpendableOutputDecodeErrorZ_free(int64_t _res) {
34880         if (!ptr_is_owned(_res)) return;
34881         void* _res_ptr = untag_ptr(_res);
34882         CHECK_ACCESS(_res_ptr);
34883         LDKCResult_TrackedSpendableOutputDecodeErrorZ _res_conv = *(LDKCResult_TrackedSpendableOutputDecodeErrorZ*)(_res_ptr);
34884         FREE(untag_ptr(_res));
34885         CResult_TrackedSpendableOutputDecodeErrorZ_free(_res_conv);
34886 }
34887
34888 static inline uint64_t CResult_TrackedSpendableOutputDecodeErrorZ_clone_ptr(LDKCResult_TrackedSpendableOutputDecodeErrorZ *NONNULL_PTR arg) {
34889         LDKCResult_TrackedSpendableOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TrackedSpendableOutputDecodeErrorZ), "LDKCResult_TrackedSpendableOutputDecodeErrorZ");
34890         *ret_conv = CResult_TrackedSpendableOutputDecodeErrorZ_clone(arg);
34891         return tag_ptr(ret_conv, true);
34892 }
34893 int64_t  CS_LDK_CResult_TrackedSpendableOutputDecodeErrorZ_clone_ptr(int64_t arg) {
34894         LDKCResult_TrackedSpendableOutputDecodeErrorZ* arg_conv = (LDKCResult_TrackedSpendableOutputDecodeErrorZ*)untag_ptr(arg);
34895         int64_t ret_conv = CResult_TrackedSpendableOutputDecodeErrorZ_clone_ptr(arg_conv);
34896         return ret_conv;
34897 }
34898
34899 int64_t  CS_LDK_CResult_TrackedSpendableOutputDecodeErrorZ_clone(int64_t orig) {
34900         LDKCResult_TrackedSpendableOutputDecodeErrorZ* orig_conv = (LDKCResult_TrackedSpendableOutputDecodeErrorZ*)untag_ptr(orig);
34901         LDKCResult_TrackedSpendableOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TrackedSpendableOutputDecodeErrorZ), "LDKCResult_TrackedSpendableOutputDecodeErrorZ");
34902         *ret_conv = CResult_TrackedSpendableOutputDecodeErrorZ_clone(orig_conv);
34903         return tag_ptr(ret_conv, true);
34904 }
34905
34906 int64_t  CS_LDK_CResult_OutputSpendStatusDecodeErrorZ_ok(int64_t o) {
34907         void* o_ptr = untag_ptr(o);
34908         CHECK_ACCESS(o_ptr);
34909         LDKOutputSpendStatus o_conv = *(LDKOutputSpendStatus*)(o_ptr);
34910         o_conv = OutputSpendStatus_clone((LDKOutputSpendStatus*)untag_ptr(o));
34911         LDKCResult_OutputSpendStatusDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutputSpendStatusDecodeErrorZ), "LDKCResult_OutputSpendStatusDecodeErrorZ");
34912         *ret_conv = CResult_OutputSpendStatusDecodeErrorZ_ok(o_conv);
34913         return tag_ptr(ret_conv, true);
34914 }
34915
34916 int64_t  CS_LDK_CResult_OutputSpendStatusDecodeErrorZ_err(int64_t e) {
34917         void* e_ptr = untag_ptr(e);
34918         CHECK_ACCESS(e_ptr);
34919         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34920         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34921         LDKCResult_OutputSpendStatusDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutputSpendStatusDecodeErrorZ), "LDKCResult_OutputSpendStatusDecodeErrorZ");
34922         *ret_conv = CResult_OutputSpendStatusDecodeErrorZ_err(e_conv);
34923         return tag_ptr(ret_conv, true);
34924 }
34925
34926 jboolean  CS_LDK_CResult_OutputSpendStatusDecodeErrorZ_is_ok(int64_t o) {
34927         LDKCResult_OutputSpendStatusDecodeErrorZ* o_conv = (LDKCResult_OutputSpendStatusDecodeErrorZ*)untag_ptr(o);
34928         jboolean ret_conv = CResult_OutputSpendStatusDecodeErrorZ_is_ok(o_conv);
34929         return ret_conv;
34930 }
34931
34932 void  CS_LDK_CResult_OutputSpendStatusDecodeErrorZ_free(int64_t _res) {
34933         if (!ptr_is_owned(_res)) return;
34934         void* _res_ptr = untag_ptr(_res);
34935         CHECK_ACCESS(_res_ptr);
34936         LDKCResult_OutputSpendStatusDecodeErrorZ _res_conv = *(LDKCResult_OutputSpendStatusDecodeErrorZ*)(_res_ptr);
34937         FREE(untag_ptr(_res));
34938         CResult_OutputSpendStatusDecodeErrorZ_free(_res_conv);
34939 }
34940
34941 static inline uint64_t CResult_OutputSpendStatusDecodeErrorZ_clone_ptr(LDKCResult_OutputSpendStatusDecodeErrorZ *NONNULL_PTR arg) {
34942         LDKCResult_OutputSpendStatusDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutputSpendStatusDecodeErrorZ), "LDKCResult_OutputSpendStatusDecodeErrorZ");
34943         *ret_conv = CResult_OutputSpendStatusDecodeErrorZ_clone(arg);
34944         return tag_ptr(ret_conv, true);
34945 }
34946 int64_t  CS_LDK_CResult_OutputSpendStatusDecodeErrorZ_clone_ptr(int64_t arg) {
34947         LDKCResult_OutputSpendStatusDecodeErrorZ* arg_conv = (LDKCResult_OutputSpendStatusDecodeErrorZ*)untag_ptr(arg);
34948         int64_t ret_conv = CResult_OutputSpendStatusDecodeErrorZ_clone_ptr(arg_conv);
34949         return ret_conv;
34950 }
34951
34952 int64_t  CS_LDK_CResult_OutputSpendStatusDecodeErrorZ_clone(int64_t orig) {
34953         LDKCResult_OutputSpendStatusDecodeErrorZ* orig_conv = (LDKCResult_OutputSpendStatusDecodeErrorZ*)untag_ptr(orig);
34954         LDKCResult_OutputSpendStatusDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutputSpendStatusDecodeErrorZ), "LDKCResult_OutputSpendStatusDecodeErrorZ");
34955         *ret_conv = CResult_OutputSpendStatusDecodeErrorZ_clone(orig_conv);
34956         return tag_ptr(ret_conv, true);
34957 }
34958
34959 int64_t  CS_LDK_COption_FilterZ_some(int64_t o) {
34960         void* o_ptr = untag_ptr(o);
34961         CHECK_ACCESS(o_ptr);
34962         LDKFilter o_conv = *(LDKFilter*)(o_ptr);
34963         if (o_conv.free == LDKFilter_JCalls_free) {
34964                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34965                 LDKFilter_JCalls_cloned(&o_conv);
34966         }
34967         LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
34968         *ret_copy = COption_FilterZ_some(o_conv);
34969         int64_t ret_ref = tag_ptr(ret_copy, true);
34970         return ret_ref;
34971 }
34972
34973 int64_t  CS_LDK_COption_FilterZ_none() {
34974         LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
34975         *ret_copy = COption_FilterZ_none();
34976         int64_t ret_ref = tag_ptr(ret_copy, true);
34977         return ret_ref;
34978 }
34979
34980 void  CS_LDK_COption_FilterZ_free(int64_t _res) {
34981         if (!ptr_is_owned(_res)) return;
34982         void* _res_ptr = untag_ptr(_res);
34983         CHECK_ACCESS(_res_ptr);
34984         LDKCOption_FilterZ _res_conv = *(LDKCOption_FilterZ*)(_res_ptr);
34985         FREE(untag_ptr(_res));
34986         COption_FilterZ_free(_res_conv);
34987 }
34988
34989 void  CS_LDK_CVec_TrackedSpendableOutputZ_free(int64_tArray _res) {
34990         LDKCVec_TrackedSpendableOutputZ _res_constr;
34991         _res_constr.datalen = _res->arr_len;
34992         if (_res_constr.datalen > 0)
34993                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTrackedSpendableOutput), "LDKCVec_TrackedSpendableOutputZ Elements");
34994         else
34995                 _res_constr.data = NULL;
34996         int64_t* _res_vals = _res->elems;
34997         for (size_t y = 0; y < _res_constr.datalen; y++) {
34998                 int64_t _res_conv_24 = _res_vals[y];
34999                 LDKTrackedSpendableOutput _res_conv_24_conv;
35000                 _res_conv_24_conv.inner = untag_ptr(_res_conv_24);
35001                 _res_conv_24_conv.is_owned = ptr_is_owned(_res_conv_24);
35002                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_24_conv);
35003                 _res_constr.data[y] = _res_conv_24_conv;
35004         }
35005         FREE(_res);
35006         CVec_TrackedSpendableOutputZ_free(_res_constr);
35007 }
35008
35009 int64_t  CS_LDK_CResult_OutputSweeperDecodeErrorZ_ok(int64_t o) {
35010         LDKOutputSweeper o_conv;
35011         o_conv.inner = untag_ptr(o);
35012         o_conv.is_owned = ptr_is_owned(o);
35013         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35014         // WARNING: we need a move here but no clone is available for LDKOutputSweeper
35015         
35016         LDKCResult_OutputSweeperDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutputSweeperDecodeErrorZ), "LDKCResult_OutputSweeperDecodeErrorZ");
35017         *ret_conv = CResult_OutputSweeperDecodeErrorZ_ok(o_conv);
35018         return tag_ptr(ret_conv, true);
35019 }
35020
35021 int64_t  CS_LDK_CResult_OutputSweeperDecodeErrorZ_err(int64_t e) {
35022         void* e_ptr = untag_ptr(e);
35023         CHECK_ACCESS(e_ptr);
35024         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
35025         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
35026         LDKCResult_OutputSweeperDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutputSweeperDecodeErrorZ), "LDKCResult_OutputSweeperDecodeErrorZ");
35027         *ret_conv = CResult_OutputSweeperDecodeErrorZ_err(e_conv);
35028         return tag_ptr(ret_conv, true);
35029 }
35030
35031 jboolean  CS_LDK_CResult_OutputSweeperDecodeErrorZ_is_ok(int64_t o) {
35032         LDKCResult_OutputSweeperDecodeErrorZ* o_conv = (LDKCResult_OutputSweeperDecodeErrorZ*)untag_ptr(o);
35033         jboolean ret_conv = CResult_OutputSweeperDecodeErrorZ_is_ok(o_conv);
35034         return ret_conv;
35035 }
35036
35037 void  CS_LDK_CResult_OutputSweeperDecodeErrorZ_free(int64_t _res) {
35038         if (!ptr_is_owned(_res)) return;
35039         void* _res_ptr = untag_ptr(_res);
35040         CHECK_ACCESS(_res_ptr);
35041         LDKCResult_OutputSweeperDecodeErrorZ _res_conv = *(LDKCResult_OutputSweeperDecodeErrorZ*)(_res_ptr);
35042         FREE(untag_ptr(_res));
35043         CResult_OutputSweeperDecodeErrorZ_free(_res_conv);
35044 }
35045
35046 int64_t  CS_LDK_C2Tuple_BestBlockOutputSweeperZ_new(int64_t a, int64_t b) {
35047         LDKBestBlock a_conv;
35048         a_conv.inner = untag_ptr(a);
35049         a_conv.is_owned = ptr_is_owned(a);
35050         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35051         a_conv = BestBlock_clone(&a_conv);
35052         LDKOutputSweeper b_conv;
35053         b_conv.inner = untag_ptr(b);
35054         b_conv.is_owned = ptr_is_owned(b);
35055         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35056         // WARNING: we need a move here but no clone is available for LDKOutputSweeper
35057         
35058         LDKC2Tuple_BestBlockOutputSweeperZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BestBlockOutputSweeperZ), "LDKC2Tuple_BestBlockOutputSweeperZ");
35059         *ret_conv = C2Tuple_BestBlockOutputSweeperZ_new(a_conv, b_conv);
35060         return tag_ptr(ret_conv, true);
35061 }
35062
35063 void  CS_LDK_C2Tuple_BestBlockOutputSweeperZ_free(int64_t _res) {
35064         if (!ptr_is_owned(_res)) return;
35065         void* _res_ptr = untag_ptr(_res);
35066         CHECK_ACCESS(_res_ptr);
35067         LDKC2Tuple_BestBlockOutputSweeperZ _res_conv = *(LDKC2Tuple_BestBlockOutputSweeperZ*)(_res_ptr);
35068         FREE(untag_ptr(_res));
35069         C2Tuple_BestBlockOutputSweeperZ_free(_res_conv);
35070 }
35071
35072 int64_t  CS_LDK_CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_ok(int64_t o) {
35073         void* o_ptr = untag_ptr(o);
35074         CHECK_ACCESS(o_ptr);
35075         LDKC2Tuple_BestBlockOutputSweeperZ o_conv = *(LDKC2Tuple_BestBlockOutputSweeperZ*)(o_ptr);
35076         // WARNING: we may need a move here but no clone is available for LDKC2Tuple_BestBlockOutputSweeperZ
35077         LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ), "LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ");
35078         *ret_conv = CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_ok(o_conv);
35079         return tag_ptr(ret_conv, true);
35080 }
35081
35082 int64_t  CS_LDK_CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_err(int64_t e) {
35083         void* e_ptr = untag_ptr(e);
35084         CHECK_ACCESS(e_ptr);
35085         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
35086         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
35087         LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ), "LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ");
35088         *ret_conv = CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_err(e_conv);
35089         return tag_ptr(ret_conv, true);
35090 }
35091
35092 jboolean  CS_LDK_CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_is_ok(int64_t o) {
35093         LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ*)untag_ptr(o);
35094         jboolean ret_conv = CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_is_ok(o_conv);
35095         return ret_conv;
35096 }
35097
35098 void  CS_LDK_CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_free(int64_t _res) {
35099         if (!ptr_is_owned(_res)) return;
35100         void* _res_ptr = untag_ptr(_res);
35101         CHECK_ACCESS(_res_ptr);
35102         LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ*)(_res_ptr);
35103         FREE(untag_ptr(_res));
35104         CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_free(_res_conv);
35105 }
35106
35107 int64_t  CS_LDK_CResult_DelayedPaymentBasepointDecodeErrorZ_ok(int64_t o) {
35108         LDKDelayedPaymentBasepoint o_conv;
35109         o_conv.inner = untag_ptr(o);
35110         o_conv.is_owned = ptr_is_owned(o);
35111         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35112         o_conv = DelayedPaymentBasepoint_clone(&o_conv);
35113         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentBasepointDecodeErrorZ), "LDKCResult_DelayedPaymentBasepointDecodeErrorZ");
35114         *ret_conv = CResult_DelayedPaymentBasepointDecodeErrorZ_ok(o_conv);
35115         return tag_ptr(ret_conv, true);
35116 }
35117
35118 int64_t  CS_LDK_CResult_DelayedPaymentBasepointDecodeErrorZ_err(int64_t e) {
35119         void* e_ptr = untag_ptr(e);
35120         CHECK_ACCESS(e_ptr);
35121         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
35122         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
35123         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentBasepointDecodeErrorZ), "LDKCResult_DelayedPaymentBasepointDecodeErrorZ");
35124         *ret_conv = CResult_DelayedPaymentBasepointDecodeErrorZ_err(e_conv);
35125         return tag_ptr(ret_conv, true);
35126 }
35127
35128 jboolean  CS_LDK_CResult_DelayedPaymentBasepointDecodeErrorZ_is_ok(int64_t o) {
35129         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* o_conv = (LDKCResult_DelayedPaymentBasepointDecodeErrorZ*)untag_ptr(o);
35130         jboolean ret_conv = CResult_DelayedPaymentBasepointDecodeErrorZ_is_ok(o_conv);
35131         return ret_conv;
35132 }
35133
35134 void  CS_LDK_CResult_DelayedPaymentBasepointDecodeErrorZ_free(int64_t _res) {
35135         if (!ptr_is_owned(_res)) return;
35136         void* _res_ptr = untag_ptr(_res);
35137         CHECK_ACCESS(_res_ptr);
35138         LDKCResult_DelayedPaymentBasepointDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentBasepointDecodeErrorZ*)(_res_ptr);
35139         FREE(untag_ptr(_res));
35140         CResult_DelayedPaymentBasepointDecodeErrorZ_free(_res_conv);
35141 }
35142
35143 static inline uint64_t CResult_DelayedPaymentBasepointDecodeErrorZ_clone_ptr(LDKCResult_DelayedPaymentBasepointDecodeErrorZ *NONNULL_PTR arg) {
35144         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentBasepointDecodeErrorZ), "LDKCResult_DelayedPaymentBasepointDecodeErrorZ");
35145         *ret_conv = CResult_DelayedPaymentBasepointDecodeErrorZ_clone(arg);
35146         return tag_ptr(ret_conv, true);
35147 }
35148 int64_t  CS_LDK_CResult_DelayedPaymentBasepointDecodeErrorZ_clone_ptr(int64_t arg) {
35149         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* arg_conv = (LDKCResult_DelayedPaymentBasepointDecodeErrorZ*)untag_ptr(arg);
35150         int64_t ret_conv = CResult_DelayedPaymentBasepointDecodeErrorZ_clone_ptr(arg_conv);
35151         return ret_conv;
35152 }
35153
35154 int64_t  CS_LDK_CResult_DelayedPaymentBasepointDecodeErrorZ_clone(int64_t orig) {
35155         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentBasepointDecodeErrorZ*)untag_ptr(orig);
35156         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentBasepointDecodeErrorZ), "LDKCResult_DelayedPaymentBasepointDecodeErrorZ");
35157         *ret_conv = CResult_DelayedPaymentBasepointDecodeErrorZ_clone(orig_conv);
35158         return tag_ptr(ret_conv, true);
35159 }
35160
35161 int64_t  CS_LDK_CResult_DelayedPaymentKeyDecodeErrorZ_ok(int64_t o) {
35162         LDKDelayedPaymentKey o_conv;
35163         o_conv.inner = untag_ptr(o);
35164         o_conv.is_owned = ptr_is_owned(o);
35165         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35166         o_conv = DelayedPaymentKey_clone(&o_conv);
35167         LDKCResult_DelayedPaymentKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentKeyDecodeErrorZ), "LDKCResult_DelayedPaymentKeyDecodeErrorZ");
35168         *ret_conv = CResult_DelayedPaymentKeyDecodeErrorZ_ok(o_conv);
35169         return tag_ptr(ret_conv, true);
35170 }
35171
35172 int64_t  CS_LDK_CResult_DelayedPaymentKeyDecodeErrorZ_err(int64_t e) {
35173         void* e_ptr = untag_ptr(e);
35174         CHECK_ACCESS(e_ptr);
35175         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
35176         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
35177         LDKCResult_DelayedPaymentKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentKeyDecodeErrorZ), "LDKCResult_DelayedPaymentKeyDecodeErrorZ");
35178         *ret_conv = CResult_DelayedPaymentKeyDecodeErrorZ_err(e_conv);
35179         return tag_ptr(ret_conv, true);
35180 }
35181
35182 jboolean  CS_LDK_CResult_DelayedPaymentKeyDecodeErrorZ_is_ok(int64_t o) {
35183         LDKCResult_DelayedPaymentKeyDecodeErrorZ* o_conv = (LDKCResult_DelayedPaymentKeyDecodeErrorZ*)untag_ptr(o);
35184         jboolean ret_conv = CResult_DelayedPaymentKeyDecodeErrorZ_is_ok(o_conv);
35185         return ret_conv;
35186 }
35187
35188 void  CS_LDK_CResult_DelayedPaymentKeyDecodeErrorZ_free(int64_t _res) {
35189         if (!ptr_is_owned(_res)) return;
35190         void* _res_ptr = untag_ptr(_res);
35191         CHECK_ACCESS(_res_ptr);
35192         LDKCResult_DelayedPaymentKeyDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentKeyDecodeErrorZ*)(_res_ptr);
35193         FREE(untag_ptr(_res));
35194         CResult_DelayedPaymentKeyDecodeErrorZ_free(_res_conv);
35195 }
35196
35197 static inline uint64_t CResult_DelayedPaymentKeyDecodeErrorZ_clone_ptr(LDKCResult_DelayedPaymentKeyDecodeErrorZ *NONNULL_PTR arg) {
35198         LDKCResult_DelayedPaymentKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentKeyDecodeErrorZ), "LDKCResult_DelayedPaymentKeyDecodeErrorZ");
35199         *ret_conv = CResult_DelayedPaymentKeyDecodeErrorZ_clone(arg);
35200         return tag_ptr(ret_conv, true);
35201 }
35202 int64_t  CS_LDK_CResult_DelayedPaymentKeyDecodeErrorZ_clone_ptr(int64_t arg) {
35203         LDKCResult_DelayedPaymentKeyDecodeErrorZ* arg_conv = (LDKCResult_DelayedPaymentKeyDecodeErrorZ*)untag_ptr(arg);
35204         int64_t ret_conv = CResult_DelayedPaymentKeyDecodeErrorZ_clone_ptr(arg_conv);
35205         return ret_conv;
35206 }
35207
35208 int64_t  CS_LDK_CResult_DelayedPaymentKeyDecodeErrorZ_clone(int64_t orig) {
35209         LDKCResult_DelayedPaymentKeyDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentKeyDecodeErrorZ*)untag_ptr(orig);
35210         LDKCResult_DelayedPaymentKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentKeyDecodeErrorZ), "LDKCResult_DelayedPaymentKeyDecodeErrorZ");
35211         *ret_conv = CResult_DelayedPaymentKeyDecodeErrorZ_clone(orig_conv);
35212         return tag_ptr(ret_conv, true);
35213 }
35214
35215 int64_t  CS_LDK_CResult_HtlcBasepointDecodeErrorZ_ok(int64_t o) {
35216         LDKHtlcBasepoint o_conv;
35217         o_conv.inner = untag_ptr(o);
35218         o_conv.is_owned = ptr_is_owned(o);
35219         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35220         o_conv = HtlcBasepoint_clone(&o_conv);
35221         LDKCResult_HtlcBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcBasepointDecodeErrorZ), "LDKCResult_HtlcBasepointDecodeErrorZ");
35222         *ret_conv = CResult_HtlcBasepointDecodeErrorZ_ok(o_conv);
35223         return tag_ptr(ret_conv, true);
35224 }
35225
35226 int64_t  CS_LDK_CResult_HtlcBasepointDecodeErrorZ_err(int64_t e) {
35227         void* e_ptr = untag_ptr(e);
35228         CHECK_ACCESS(e_ptr);
35229         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
35230         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
35231         LDKCResult_HtlcBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcBasepointDecodeErrorZ), "LDKCResult_HtlcBasepointDecodeErrorZ");
35232         *ret_conv = CResult_HtlcBasepointDecodeErrorZ_err(e_conv);
35233         return tag_ptr(ret_conv, true);
35234 }
35235
35236 jboolean  CS_LDK_CResult_HtlcBasepointDecodeErrorZ_is_ok(int64_t o) {
35237         LDKCResult_HtlcBasepointDecodeErrorZ* o_conv = (LDKCResult_HtlcBasepointDecodeErrorZ*)untag_ptr(o);
35238         jboolean ret_conv = CResult_HtlcBasepointDecodeErrorZ_is_ok(o_conv);
35239         return ret_conv;
35240 }
35241
35242 void  CS_LDK_CResult_HtlcBasepointDecodeErrorZ_free(int64_t _res) {
35243         if (!ptr_is_owned(_res)) return;
35244         void* _res_ptr = untag_ptr(_res);
35245         CHECK_ACCESS(_res_ptr);
35246         LDKCResult_HtlcBasepointDecodeErrorZ _res_conv = *(LDKCResult_HtlcBasepointDecodeErrorZ*)(_res_ptr);
35247         FREE(untag_ptr(_res));
35248         CResult_HtlcBasepointDecodeErrorZ_free(_res_conv);
35249 }
35250
35251 static inline uint64_t CResult_HtlcBasepointDecodeErrorZ_clone_ptr(LDKCResult_HtlcBasepointDecodeErrorZ *NONNULL_PTR arg) {
35252         LDKCResult_HtlcBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcBasepointDecodeErrorZ), "LDKCResult_HtlcBasepointDecodeErrorZ");
35253         *ret_conv = CResult_HtlcBasepointDecodeErrorZ_clone(arg);
35254         return tag_ptr(ret_conv, true);
35255 }
35256 int64_t  CS_LDK_CResult_HtlcBasepointDecodeErrorZ_clone_ptr(int64_t arg) {
35257         LDKCResult_HtlcBasepointDecodeErrorZ* arg_conv = (LDKCResult_HtlcBasepointDecodeErrorZ*)untag_ptr(arg);
35258         int64_t ret_conv = CResult_HtlcBasepointDecodeErrorZ_clone_ptr(arg_conv);
35259         return ret_conv;
35260 }
35261
35262 int64_t  CS_LDK_CResult_HtlcBasepointDecodeErrorZ_clone(int64_t orig) {
35263         LDKCResult_HtlcBasepointDecodeErrorZ* orig_conv = (LDKCResult_HtlcBasepointDecodeErrorZ*)untag_ptr(orig);
35264         LDKCResult_HtlcBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcBasepointDecodeErrorZ), "LDKCResult_HtlcBasepointDecodeErrorZ");
35265         *ret_conv = CResult_HtlcBasepointDecodeErrorZ_clone(orig_conv);
35266         return tag_ptr(ret_conv, true);
35267 }
35268
35269 int64_t  CS_LDK_CResult_HtlcKeyDecodeErrorZ_ok(int64_t o) {
35270         LDKHtlcKey o_conv;
35271         o_conv.inner = untag_ptr(o);
35272         o_conv.is_owned = ptr_is_owned(o);
35273         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35274         o_conv = HtlcKey_clone(&o_conv);
35275         LDKCResult_HtlcKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcKeyDecodeErrorZ), "LDKCResult_HtlcKeyDecodeErrorZ");
35276         *ret_conv = CResult_HtlcKeyDecodeErrorZ_ok(o_conv);
35277         return tag_ptr(ret_conv, true);
35278 }
35279
35280 int64_t  CS_LDK_CResult_HtlcKeyDecodeErrorZ_err(int64_t e) {
35281         void* e_ptr = untag_ptr(e);
35282         CHECK_ACCESS(e_ptr);
35283         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
35284         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
35285         LDKCResult_HtlcKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcKeyDecodeErrorZ), "LDKCResult_HtlcKeyDecodeErrorZ");
35286         *ret_conv = CResult_HtlcKeyDecodeErrorZ_err(e_conv);
35287         return tag_ptr(ret_conv, true);
35288 }
35289
35290 jboolean  CS_LDK_CResult_HtlcKeyDecodeErrorZ_is_ok(int64_t o) {
35291         LDKCResult_HtlcKeyDecodeErrorZ* o_conv = (LDKCResult_HtlcKeyDecodeErrorZ*)untag_ptr(o);
35292         jboolean ret_conv = CResult_HtlcKeyDecodeErrorZ_is_ok(o_conv);
35293         return ret_conv;
35294 }
35295
35296 void  CS_LDK_CResult_HtlcKeyDecodeErrorZ_free(int64_t _res) {
35297         if (!ptr_is_owned(_res)) return;
35298         void* _res_ptr = untag_ptr(_res);
35299         CHECK_ACCESS(_res_ptr);
35300         LDKCResult_HtlcKeyDecodeErrorZ _res_conv = *(LDKCResult_HtlcKeyDecodeErrorZ*)(_res_ptr);
35301         FREE(untag_ptr(_res));
35302         CResult_HtlcKeyDecodeErrorZ_free(_res_conv);
35303 }
35304
35305 static inline uint64_t CResult_HtlcKeyDecodeErrorZ_clone_ptr(LDKCResult_HtlcKeyDecodeErrorZ *NONNULL_PTR arg) {
35306         LDKCResult_HtlcKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcKeyDecodeErrorZ), "LDKCResult_HtlcKeyDecodeErrorZ");
35307         *ret_conv = CResult_HtlcKeyDecodeErrorZ_clone(arg);
35308         return tag_ptr(ret_conv, true);
35309 }
35310 int64_t  CS_LDK_CResult_HtlcKeyDecodeErrorZ_clone_ptr(int64_t arg) {
35311         LDKCResult_HtlcKeyDecodeErrorZ* arg_conv = (LDKCResult_HtlcKeyDecodeErrorZ*)untag_ptr(arg);
35312         int64_t ret_conv = CResult_HtlcKeyDecodeErrorZ_clone_ptr(arg_conv);
35313         return ret_conv;
35314 }
35315
35316 int64_t  CS_LDK_CResult_HtlcKeyDecodeErrorZ_clone(int64_t orig) {
35317         LDKCResult_HtlcKeyDecodeErrorZ* orig_conv = (LDKCResult_HtlcKeyDecodeErrorZ*)untag_ptr(orig);
35318         LDKCResult_HtlcKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcKeyDecodeErrorZ), "LDKCResult_HtlcKeyDecodeErrorZ");
35319         *ret_conv = CResult_HtlcKeyDecodeErrorZ_clone(orig_conv);
35320         return tag_ptr(ret_conv, true);
35321 }
35322
35323 int64_t  CS_LDK_CResult_RevocationBasepointDecodeErrorZ_ok(int64_t o) {
35324         LDKRevocationBasepoint o_conv;
35325         o_conv.inner = untag_ptr(o);
35326         o_conv.is_owned = ptr_is_owned(o);
35327         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35328         o_conv = RevocationBasepoint_clone(&o_conv);
35329         LDKCResult_RevocationBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationBasepointDecodeErrorZ), "LDKCResult_RevocationBasepointDecodeErrorZ");
35330         *ret_conv = CResult_RevocationBasepointDecodeErrorZ_ok(o_conv);
35331         return tag_ptr(ret_conv, true);
35332 }
35333
35334 int64_t  CS_LDK_CResult_RevocationBasepointDecodeErrorZ_err(int64_t e) {
35335         void* e_ptr = untag_ptr(e);
35336         CHECK_ACCESS(e_ptr);
35337         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
35338         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
35339         LDKCResult_RevocationBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationBasepointDecodeErrorZ), "LDKCResult_RevocationBasepointDecodeErrorZ");
35340         *ret_conv = CResult_RevocationBasepointDecodeErrorZ_err(e_conv);
35341         return tag_ptr(ret_conv, true);
35342 }
35343
35344 jboolean  CS_LDK_CResult_RevocationBasepointDecodeErrorZ_is_ok(int64_t o) {
35345         LDKCResult_RevocationBasepointDecodeErrorZ* o_conv = (LDKCResult_RevocationBasepointDecodeErrorZ*)untag_ptr(o);
35346         jboolean ret_conv = CResult_RevocationBasepointDecodeErrorZ_is_ok(o_conv);
35347         return ret_conv;
35348 }
35349
35350 void  CS_LDK_CResult_RevocationBasepointDecodeErrorZ_free(int64_t _res) {
35351         if (!ptr_is_owned(_res)) return;
35352         void* _res_ptr = untag_ptr(_res);
35353         CHECK_ACCESS(_res_ptr);
35354         LDKCResult_RevocationBasepointDecodeErrorZ _res_conv = *(LDKCResult_RevocationBasepointDecodeErrorZ*)(_res_ptr);
35355         FREE(untag_ptr(_res));
35356         CResult_RevocationBasepointDecodeErrorZ_free(_res_conv);
35357 }
35358
35359 static inline uint64_t CResult_RevocationBasepointDecodeErrorZ_clone_ptr(LDKCResult_RevocationBasepointDecodeErrorZ *NONNULL_PTR arg) {
35360         LDKCResult_RevocationBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationBasepointDecodeErrorZ), "LDKCResult_RevocationBasepointDecodeErrorZ");
35361         *ret_conv = CResult_RevocationBasepointDecodeErrorZ_clone(arg);
35362         return tag_ptr(ret_conv, true);
35363 }
35364 int64_t  CS_LDK_CResult_RevocationBasepointDecodeErrorZ_clone_ptr(int64_t arg) {
35365         LDKCResult_RevocationBasepointDecodeErrorZ* arg_conv = (LDKCResult_RevocationBasepointDecodeErrorZ*)untag_ptr(arg);
35366         int64_t ret_conv = CResult_RevocationBasepointDecodeErrorZ_clone_ptr(arg_conv);
35367         return ret_conv;
35368 }
35369
35370 int64_t  CS_LDK_CResult_RevocationBasepointDecodeErrorZ_clone(int64_t orig) {
35371         LDKCResult_RevocationBasepointDecodeErrorZ* orig_conv = (LDKCResult_RevocationBasepointDecodeErrorZ*)untag_ptr(orig);
35372         LDKCResult_RevocationBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationBasepointDecodeErrorZ), "LDKCResult_RevocationBasepointDecodeErrorZ");
35373         *ret_conv = CResult_RevocationBasepointDecodeErrorZ_clone(orig_conv);
35374         return tag_ptr(ret_conv, true);
35375 }
35376
35377 int64_t  CS_LDK_CResult_RevocationKeyDecodeErrorZ_ok(int64_t o) {
35378         LDKRevocationKey o_conv;
35379         o_conv.inner = untag_ptr(o);
35380         o_conv.is_owned = ptr_is_owned(o);
35381         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35382         o_conv = RevocationKey_clone(&o_conv);
35383         LDKCResult_RevocationKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationKeyDecodeErrorZ), "LDKCResult_RevocationKeyDecodeErrorZ");
35384         *ret_conv = CResult_RevocationKeyDecodeErrorZ_ok(o_conv);
35385         return tag_ptr(ret_conv, true);
35386 }
35387
35388 int64_t  CS_LDK_CResult_RevocationKeyDecodeErrorZ_err(int64_t e) {
35389         void* e_ptr = untag_ptr(e);
35390         CHECK_ACCESS(e_ptr);
35391         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
35392         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
35393         LDKCResult_RevocationKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationKeyDecodeErrorZ), "LDKCResult_RevocationKeyDecodeErrorZ");
35394         *ret_conv = CResult_RevocationKeyDecodeErrorZ_err(e_conv);
35395         return tag_ptr(ret_conv, true);
35396 }
35397
35398 jboolean  CS_LDK_CResult_RevocationKeyDecodeErrorZ_is_ok(int64_t o) {
35399         LDKCResult_RevocationKeyDecodeErrorZ* o_conv = (LDKCResult_RevocationKeyDecodeErrorZ*)untag_ptr(o);
35400         jboolean ret_conv = CResult_RevocationKeyDecodeErrorZ_is_ok(o_conv);
35401         return ret_conv;
35402 }
35403
35404 void  CS_LDK_CResult_RevocationKeyDecodeErrorZ_free(int64_t _res) {
35405         if (!ptr_is_owned(_res)) return;
35406         void* _res_ptr = untag_ptr(_res);
35407         CHECK_ACCESS(_res_ptr);
35408         LDKCResult_RevocationKeyDecodeErrorZ _res_conv = *(LDKCResult_RevocationKeyDecodeErrorZ*)(_res_ptr);
35409         FREE(untag_ptr(_res));
35410         CResult_RevocationKeyDecodeErrorZ_free(_res_conv);
35411 }
35412
35413 static inline uint64_t CResult_RevocationKeyDecodeErrorZ_clone_ptr(LDKCResult_RevocationKeyDecodeErrorZ *NONNULL_PTR arg) {
35414         LDKCResult_RevocationKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationKeyDecodeErrorZ), "LDKCResult_RevocationKeyDecodeErrorZ");
35415         *ret_conv = CResult_RevocationKeyDecodeErrorZ_clone(arg);
35416         return tag_ptr(ret_conv, true);
35417 }
35418 int64_t  CS_LDK_CResult_RevocationKeyDecodeErrorZ_clone_ptr(int64_t arg) {
35419         LDKCResult_RevocationKeyDecodeErrorZ* arg_conv = (LDKCResult_RevocationKeyDecodeErrorZ*)untag_ptr(arg);
35420         int64_t ret_conv = CResult_RevocationKeyDecodeErrorZ_clone_ptr(arg_conv);
35421         return ret_conv;
35422 }
35423
35424 int64_t  CS_LDK_CResult_RevocationKeyDecodeErrorZ_clone(int64_t orig) {
35425         LDKCResult_RevocationKeyDecodeErrorZ* orig_conv = (LDKCResult_RevocationKeyDecodeErrorZ*)untag_ptr(orig);
35426         LDKCResult_RevocationKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationKeyDecodeErrorZ), "LDKCResult_RevocationKeyDecodeErrorZ");
35427         *ret_conv = CResult_RevocationKeyDecodeErrorZ_clone(orig_conv);
35428         return tag_ptr(ret_conv, true);
35429 }
35430
35431 int64_t  CS_LDK_CResult_LockedChannelMonitorNoneZ_ok(int64_t o) {
35432         LDKLockedChannelMonitor o_conv;
35433         o_conv.inner = untag_ptr(o);
35434         o_conv.is_owned = ptr_is_owned(o);
35435         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35436         // WARNING: we need a move here but no clone is available for LDKLockedChannelMonitor
35437         
35438         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
35439         *ret_conv = CResult_LockedChannelMonitorNoneZ_ok(o_conv);
35440         return tag_ptr(ret_conv, true);
35441 }
35442
35443 int64_t  CS_LDK_CResult_LockedChannelMonitorNoneZ_err() {
35444         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
35445         *ret_conv = CResult_LockedChannelMonitorNoneZ_err();
35446         return tag_ptr(ret_conv, true);
35447 }
35448
35449 jboolean  CS_LDK_CResult_LockedChannelMonitorNoneZ_is_ok(int64_t o) {
35450         LDKCResult_LockedChannelMonitorNoneZ* o_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(o);
35451         jboolean ret_conv = CResult_LockedChannelMonitorNoneZ_is_ok(o_conv);
35452         return ret_conv;
35453 }
35454
35455 void  CS_LDK_CResult_LockedChannelMonitorNoneZ_free(int64_t _res) {
35456         if (!ptr_is_owned(_res)) return;
35457         void* _res_ptr = untag_ptr(_res);
35458         CHECK_ACCESS(_res_ptr);
35459         LDKCResult_LockedChannelMonitorNoneZ _res_conv = *(LDKCResult_LockedChannelMonitorNoneZ*)(_res_ptr);
35460         FREE(untag_ptr(_res));
35461         CResult_LockedChannelMonitorNoneZ_free(_res_conv);
35462 }
35463
35464 static inline uint64_t C2Tuple_OutPointChannelIdZ_clone_ptr(LDKC2Tuple_OutPointChannelIdZ *NONNULL_PTR arg) {
35465         LDKC2Tuple_OutPointChannelIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointChannelIdZ), "LDKC2Tuple_OutPointChannelIdZ");
35466         *ret_conv = C2Tuple_OutPointChannelIdZ_clone(arg);
35467         return tag_ptr(ret_conv, true);
35468 }
35469 int64_t  CS_LDK_C2Tuple_OutPointChannelIdZ_clone_ptr(int64_t arg) {
35470         LDKC2Tuple_OutPointChannelIdZ* arg_conv = (LDKC2Tuple_OutPointChannelIdZ*)untag_ptr(arg);
35471         int64_t ret_conv = C2Tuple_OutPointChannelIdZ_clone_ptr(arg_conv);
35472         return ret_conv;
35473 }
35474
35475 int64_t  CS_LDK_C2Tuple_OutPointChannelIdZ_clone(int64_t orig) {
35476         LDKC2Tuple_OutPointChannelIdZ* orig_conv = (LDKC2Tuple_OutPointChannelIdZ*)untag_ptr(orig);
35477         LDKC2Tuple_OutPointChannelIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointChannelIdZ), "LDKC2Tuple_OutPointChannelIdZ");
35478         *ret_conv = C2Tuple_OutPointChannelIdZ_clone(orig_conv);
35479         return tag_ptr(ret_conv, true);
35480 }
35481
35482 int64_t  CS_LDK_C2Tuple_OutPointChannelIdZ_new(int64_t a, int64_t b) {
35483         LDKOutPoint a_conv;
35484         a_conv.inner = untag_ptr(a);
35485         a_conv.is_owned = ptr_is_owned(a);
35486         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35487         a_conv = OutPoint_clone(&a_conv);
35488         LDKChannelId b_conv;
35489         b_conv.inner = untag_ptr(b);
35490         b_conv.is_owned = ptr_is_owned(b);
35491         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35492         b_conv = ChannelId_clone(&b_conv);
35493         LDKC2Tuple_OutPointChannelIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointChannelIdZ), "LDKC2Tuple_OutPointChannelIdZ");
35494         *ret_conv = C2Tuple_OutPointChannelIdZ_new(a_conv, b_conv);
35495         return tag_ptr(ret_conv, true);
35496 }
35497
35498 void  CS_LDK_C2Tuple_OutPointChannelIdZ_free(int64_t _res) {
35499         if (!ptr_is_owned(_res)) return;
35500         void* _res_ptr = untag_ptr(_res);
35501         CHECK_ACCESS(_res_ptr);
35502         LDKC2Tuple_OutPointChannelIdZ _res_conv = *(LDKC2Tuple_OutPointChannelIdZ*)(_res_ptr);
35503         FREE(untag_ptr(_res));
35504         C2Tuple_OutPointChannelIdZ_free(_res_conv);
35505 }
35506
35507 void  CS_LDK_CVec_C2Tuple_OutPointChannelIdZZ_free(int64_tArray _res) {
35508         LDKCVec_C2Tuple_OutPointChannelIdZZ _res_constr;
35509         _res_constr.datalen = _res->arr_len;
35510         if (_res_constr.datalen > 0)
35511                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_OutPointChannelIdZ), "LDKCVec_C2Tuple_OutPointChannelIdZZ Elements");
35512         else
35513                 _res_constr.data = NULL;
35514         int64_t* _res_vals = _res->elems;
35515         for (size_t d = 0; d < _res_constr.datalen; d++) {
35516                 int64_t _res_conv_29 = _res_vals[d];
35517                 void* _res_conv_29_ptr = untag_ptr(_res_conv_29);
35518                 CHECK_ACCESS(_res_conv_29_ptr);
35519                 LDKC2Tuple_OutPointChannelIdZ _res_conv_29_conv = *(LDKC2Tuple_OutPointChannelIdZ*)(_res_conv_29_ptr);
35520                 FREE(untag_ptr(_res_conv_29));
35521                 _res_constr.data[d] = _res_conv_29_conv;
35522         }
35523         FREE(_res);
35524         CVec_C2Tuple_OutPointChannelIdZZ_free(_res_constr);
35525 }
35526
35527 void  CS_LDK_CVec_MonitorUpdateIdZ_free(int64_tArray _res) {
35528         LDKCVec_MonitorUpdateIdZ _res_constr;
35529         _res_constr.datalen = _res->arr_len;
35530         if (_res_constr.datalen > 0)
35531                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorUpdateId), "LDKCVec_MonitorUpdateIdZ Elements");
35532         else
35533                 _res_constr.data = NULL;
35534         int64_t* _res_vals = _res->elems;
35535         for (size_t r = 0; r < _res_constr.datalen; r++) {
35536                 int64_t _res_conv_17 = _res_vals[r];
35537                 LDKMonitorUpdateId _res_conv_17_conv;
35538                 _res_conv_17_conv.inner = untag_ptr(_res_conv_17);
35539                 _res_conv_17_conv.is_owned = ptr_is_owned(_res_conv_17);
35540                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_17_conv);
35541                 _res_constr.data[r] = _res_conv_17_conv;
35542         }
35543         FREE(_res);
35544         CVec_MonitorUpdateIdZ_free(_res_constr);
35545 }
35546
35547 static inline uint64_t C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR arg) {
35548         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
35549         *ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(arg);
35550         return tag_ptr(ret_conv, true);
35551 }
35552 int64_t  CS_LDK_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr(int64_t arg) {
35553         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* arg_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(arg);
35554         int64_t ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr(arg_conv);
35555         return ret_conv;
35556 }
35557
35558 int64_t  CS_LDK_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(int64_t orig) {
35559         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* orig_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(orig);
35560         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
35561         *ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(orig_conv);
35562         return tag_ptr(ret_conv, true);
35563 }
35564
35565 int64_t  CS_LDK_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new(int64_t a, int64_tArray b) {
35566         LDKOutPoint a_conv;
35567         a_conv.inner = untag_ptr(a);
35568         a_conv.is_owned = ptr_is_owned(a);
35569         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35570         a_conv = OutPoint_clone(&a_conv);
35571         LDKCVec_MonitorUpdateIdZ b_constr;
35572         b_constr.datalen = b->arr_len;
35573         if (b_constr.datalen > 0)
35574                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKMonitorUpdateId), "LDKCVec_MonitorUpdateIdZ Elements");
35575         else
35576                 b_constr.data = NULL;
35577         int64_t* b_vals = b->elems;
35578         for (size_t r = 0; r < b_constr.datalen; r++) {
35579                 int64_t b_conv_17 = b_vals[r];
35580                 LDKMonitorUpdateId b_conv_17_conv;
35581                 b_conv_17_conv.inner = untag_ptr(b_conv_17);
35582                 b_conv_17_conv.is_owned = ptr_is_owned(b_conv_17);
35583                 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv_17_conv);
35584                 b_conv_17_conv = MonitorUpdateId_clone(&b_conv_17_conv);
35585                 b_constr.data[r] = b_conv_17_conv;
35586         }
35587         FREE(b);
35588         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
35589         *ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new(a_conv, b_constr);
35590         return tag_ptr(ret_conv, true);
35591 }
35592
35593 void  CS_LDK_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free(int64_t _res) {
35594         if (!ptr_is_owned(_res)) return;
35595         void* _res_ptr = untag_ptr(_res);
35596         CHECK_ACCESS(_res_ptr);
35597         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ _res_conv = *(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)(_res_ptr);
35598         FREE(untag_ptr(_res));
35599         C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free(_res_conv);
35600 }
35601
35602 void  CS_LDK_CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free(int64_tArray _res) {
35603         LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ _res_constr;
35604         _res_constr.datalen = _res->arr_len;
35605         if (_res_constr.datalen > 0)
35606                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ Elements");
35607         else
35608                 _res_constr.data = NULL;
35609         int64_t* _res_vals = _res->elems;
35610         for (size_t p = 0; p < _res_constr.datalen; p++) {
35611                 int64_t _res_conv_41 = _res_vals[p];
35612                 void* _res_conv_41_ptr = untag_ptr(_res_conv_41);
35613                 CHECK_ACCESS(_res_conv_41_ptr);
35614                 LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ _res_conv_41_conv = *(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)(_res_conv_41_ptr);
35615                 FREE(untag_ptr(_res_conv_41));
35616                 _res_constr.data[p] = _res_conv_41_conv;
35617         }
35618         FREE(_res);
35619         CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free(_res_constr);
35620 }
35621
35622 void  CS_LDK_APIError_free(int64_t this_ptr) {
35623         if (!ptr_is_owned(this_ptr)) return;
35624         void* this_ptr_ptr = untag_ptr(this_ptr);
35625         CHECK_ACCESS(this_ptr_ptr);
35626         LDKAPIError this_ptr_conv = *(LDKAPIError*)(this_ptr_ptr);
35627         FREE(untag_ptr(this_ptr));
35628         APIError_free(this_ptr_conv);
35629 }
35630
35631 static inline uint64_t APIError_clone_ptr(LDKAPIError *NONNULL_PTR arg) {
35632         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
35633         *ret_copy = APIError_clone(arg);
35634         int64_t ret_ref = tag_ptr(ret_copy, true);
35635         return ret_ref;
35636 }
35637 int64_t  CS_LDK_APIError_clone_ptr(int64_t arg) {
35638         LDKAPIError* arg_conv = (LDKAPIError*)untag_ptr(arg);
35639         int64_t ret_conv = APIError_clone_ptr(arg_conv);
35640         return ret_conv;
35641 }
35642
35643 int64_t  CS_LDK_APIError_clone(int64_t orig) {
35644         LDKAPIError* orig_conv = (LDKAPIError*)untag_ptr(orig);
35645         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
35646         *ret_copy = APIError_clone(orig_conv);
35647         int64_t ret_ref = tag_ptr(ret_copy, true);
35648         return ret_ref;
35649 }
35650
35651 int64_t  CS_LDK_APIError_apimisuse_error(jstring err) {
35652         LDKStr err_conv = str_ref_to_owned_c(err);
35653         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
35654         *ret_copy = APIError_apimisuse_error(err_conv);
35655         int64_t ret_ref = tag_ptr(ret_copy, true);
35656         return ret_ref;
35657 }
35658
35659 int64_t  CS_LDK_APIError_fee_rate_too_high(jstring err, int32_t feerate) {
35660         LDKStr err_conv = str_ref_to_owned_c(err);
35661         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
35662         *ret_copy = APIError_fee_rate_too_high(err_conv, feerate);
35663         int64_t ret_ref = tag_ptr(ret_copy, true);
35664         return ret_ref;
35665 }
35666
35667 int64_t  CS_LDK_APIError_invalid_route(jstring err) {
35668         LDKStr err_conv = str_ref_to_owned_c(err);
35669         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
35670         *ret_copy = APIError_invalid_route(err_conv);
35671         int64_t ret_ref = tag_ptr(ret_copy, true);
35672         return ret_ref;
35673 }
35674
35675 int64_t  CS_LDK_APIError_channel_unavailable(jstring err) {
35676         LDKStr err_conv = str_ref_to_owned_c(err);
35677         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
35678         *ret_copy = APIError_channel_unavailable(err_conv);
35679         int64_t ret_ref = tag_ptr(ret_copy, true);
35680         return ret_ref;
35681 }
35682
35683 int64_t  CS_LDK_APIError_monitor_update_in_progress() {
35684         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
35685         *ret_copy = APIError_monitor_update_in_progress();
35686         int64_t ret_ref = tag_ptr(ret_copy, true);
35687         return ret_ref;
35688 }
35689
35690 int64_t  CS_LDK_APIError_incompatible_shutdown_script(int64_t script) {
35691         LDKShutdownScript script_conv;
35692         script_conv.inner = untag_ptr(script);
35693         script_conv.is_owned = ptr_is_owned(script);
35694         CHECK_INNER_FIELD_ACCESS_OR_NULL(script_conv);
35695         script_conv = ShutdownScript_clone(&script_conv);
35696         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
35697         *ret_copy = APIError_incompatible_shutdown_script(script_conv);
35698         int64_t ret_ref = tag_ptr(ret_copy, true);
35699         return ret_ref;
35700 }
35701
35702 jboolean  CS_LDK_APIError_eq(int64_t a, int64_t b) {
35703         LDKAPIError* a_conv = (LDKAPIError*)untag_ptr(a);
35704         LDKAPIError* b_conv = (LDKAPIError*)untag_ptr(b);
35705         jboolean ret_conv = APIError_eq(a_conv, b_conv);
35706         return ret_conv;
35707 }
35708
35709 int8_tArray  CS_LDK_APIError_write(int64_t obj) {
35710         LDKAPIError* obj_conv = (LDKAPIError*)untag_ptr(obj);
35711         LDKCVec_u8Z ret_var = APIError_write(obj_conv);
35712         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35713         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35714         CVec_u8Z_free(ret_var);
35715         return ret_arr;
35716 }
35717
35718 int64_t  CS_LDK_APIError_read(int8_tArray ser) {
35719         LDKu8slice ser_ref;
35720         ser_ref.datalen = ser->arr_len;
35721         ser_ref.data = ser->elems;
35722         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
35723         *ret_conv = APIError_read(ser_ref);
35724         FREE(ser);
35725         return tag_ptr(ret_conv, true);
35726 }
35727
35728 void  CS_LDK_BigSize_free(int64_t this_obj) {
35729         LDKBigSize this_obj_conv;
35730         this_obj_conv.inner = untag_ptr(this_obj);
35731         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35732         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35733         BigSize_free(this_obj_conv);
35734 }
35735
35736 int64_t  CS_LDK_BigSize_get_a(int64_t this_ptr) {
35737         LDKBigSize this_ptr_conv;
35738         this_ptr_conv.inner = untag_ptr(this_ptr);
35739         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35740         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35741         this_ptr_conv.is_owned = false;
35742         int64_t ret_conv = BigSize_get_a(&this_ptr_conv);
35743         return ret_conv;
35744 }
35745
35746 void  CS_LDK_BigSize_set_a(int64_t this_ptr, int64_t val) {
35747         LDKBigSize this_ptr_conv;
35748         this_ptr_conv.inner = untag_ptr(this_ptr);
35749         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35750         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35751         this_ptr_conv.is_owned = false;
35752         BigSize_set_a(&this_ptr_conv, val);
35753 }
35754
35755 int64_t  CS_LDK_BigSize_new(int64_t a_arg) {
35756         LDKBigSize ret_var = BigSize_new(a_arg);
35757         int64_t ret_ref = 0;
35758         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35759         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35760         return ret_ref;
35761 }
35762
35763 static inline uint64_t BigSize_clone_ptr(LDKBigSize *NONNULL_PTR arg) {
35764         LDKBigSize ret_var = BigSize_clone(arg);
35765         int64_t ret_ref = 0;
35766         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35767         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35768         return ret_ref;
35769 }
35770 int64_t  CS_LDK_BigSize_clone_ptr(int64_t arg) {
35771         LDKBigSize arg_conv;
35772         arg_conv.inner = untag_ptr(arg);
35773         arg_conv.is_owned = ptr_is_owned(arg);
35774         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35775         arg_conv.is_owned = false;
35776         int64_t ret_conv = BigSize_clone_ptr(&arg_conv);
35777         return ret_conv;
35778 }
35779
35780 int64_t  CS_LDK_BigSize_clone(int64_t orig) {
35781         LDKBigSize orig_conv;
35782         orig_conv.inner = untag_ptr(orig);
35783         orig_conv.is_owned = ptr_is_owned(orig);
35784         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35785         orig_conv.is_owned = false;
35786         LDKBigSize ret_var = BigSize_clone(&orig_conv);
35787         int64_t ret_ref = 0;
35788         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35789         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35790         return ret_ref;
35791 }
35792
35793 int64_t  CS_LDK_BigSize_hash(int64_t o) {
35794         LDKBigSize o_conv;
35795         o_conv.inner = untag_ptr(o);
35796         o_conv.is_owned = ptr_is_owned(o);
35797         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35798         o_conv.is_owned = false;
35799         int64_t ret_conv = BigSize_hash(&o_conv);
35800         return ret_conv;
35801 }
35802
35803 jboolean  CS_LDK_BigSize_eq(int64_t a, int64_t b) {
35804         LDKBigSize a_conv;
35805         a_conv.inner = untag_ptr(a);
35806         a_conv.is_owned = ptr_is_owned(a);
35807         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35808         a_conv.is_owned = false;
35809         LDKBigSize b_conv;
35810         b_conv.inner = untag_ptr(b);
35811         b_conv.is_owned = ptr_is_owned(b);
35812         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35813         b_conv.is_owned = false;
35814         jboolean ret_conv = BigSize_eq(&a_conv, &b_conv);
35815         return ret_conv;
35816 }
35817
35818 int8_tArray  CS_LDK_BigSize_write(int64_t obj) {
35819         LDKBigSize obj_conv;
35820         obj_conv.inner = untag_ptr(obj);
35821         obj_conv.is_owned = ptr_is_owned(obj);
35822         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35823         obj_conv.is_owned = false;
35824         LDKCVec_u8Z ret_var = BigSize_write(&obj_conv);
35825         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35826         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35827         CVec_u8Z_free(ret_var);
35828         return ret_arr;
35829 }
35830
35831 int64_t  CS_LDK_BigSize_read(int8_tArray ser) {
35832         LDKu8slice ser_ref;
35833         ser_ref.datalen = ser->arr_len;
35834         ser_ref.data = ser->elems;
35835         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
35836         *ret_conv = BigSize_read(ser_ref);
35837         FREE(ser);
35838         return tag_ptr(ret_conv, true);
35839 }
35840
35841 void  CS_LDK_Hostname_free(int64_t this_obj) {
35842         LDKHostname this_obj_conv;
35843         this_obj_conv.inner = untag_ptr(this_obj);
35844         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35845         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35846         Hostname_free(this_obj_conv);
35847 }
35848
35849 static inline uint64_t Hostname_clone_ptr(LDKHostname *NONNULL_PTR arg) {
35850         LDKHostname ret_var = Hostname_clone(arg);
35851         int64_t ret_ref = 0;
35852         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35853         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35854         return ret_ref;
35855 }
35856 int64_t  CS_LDK_Hostname_clone_ptr(int64_t arg) {
35857         LDKHostname arg_conv;
35858         arg_conv.inner = untag_ptr(arg);
35859         arg_conv.is_owned = ptr_is_owned(arg);
35860         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35861         arg_conv.is_owned = false;
35862         int64_t ret_conv = Hostname_clone_ptr(&arg_conv);
35863         return ret_conv;
35864 }
35865
35866 int64_t  CS_LDK_Hostname_clone(int64_t orig) {
35867         LDKHostname orig_conv;
35868         orig_conv.inner = untag_ptr(orig);
35869         orig_conv.is_owned = ptr_is_owned(orig);
35870         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35871         orig_conv.is_owned = false;
35872         LDKHostname ret_var = Hostname_clone(&orig_conv);
35873         int64_t ret_ref = 0;
35874         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35875         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35876         return ret_ref;
35877 }
35878
35879 int64_t  CS_LDK_Hostname_hash(int64_t o) {
35880         LDKHostname o_conv;
35881         o_conv.inner = untag_ptr(o);
35882         o_conv.is_owned = ptr_is_owned(o);
35883         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35884         o_conv.is_owned = false;
35885         int64_t ret_conv = Hostname_hash(&o_conv);
35886         return ret_conv;
35887 }
35888
35889 jboolean  CS_LDK_Hostname_eq(int64_t a, int64_t b) {
35890         LDKHostname a_conv;
35891         a_conv.inner = untag_ptr(a);
35892         a_conv.is_owned = ptr_is_owned(a);
35893         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35894         a_conv.is_owned = false;
35895         LDKHostname b_conv;
35896         b_conv.inner = untag_ptr(b);
35897         b_conv.is_owned = ptr_is_owned(b);
35898         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35899         b_conv.is_owned = false;
35900         jboolean ret_conv = Hostname_eq(&a_conv, &b_conv);
35901         return ret_conv;
35902 }
35903
35904 int8_t  CS_LDK_Hostname_len(int64_t this_arg) {
35905         LDKHostname this_arg_conv;
35906         this_arg_conv.inner = untag_ptr(this_arg);
35907         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35908         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35909         this_arg_conv.is_owned = false;
35910         int8_t ret_conv = Hostname_len(&this_arg_conv);
35911         return ret_conv;
35912 }
35913
35914 jstring  CS_LDK_Hostname_to_str(int64_t o) {
35915         LDKHostname o_conv;
35916         o_conv.inner = untag_ptr(o);
35917         o_conv.is_owned = ptr_is_owned(o);
35918         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35919         o_conv.is_owned = false;
35920         LDKStr ret_str = Hostname_to_str(&o_conv);
35921         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
35922         Str_free(ret_str);
35923         return ret_conv;
35924 }
35925
35926 int8_tArray  CS_LDK_Hostname_write(int64_t obj) {
35927         LDKHostname obj_conv;
35928         obj_conv.inner = untag_ptr(obj);
35929         obj_conv.is_owned = ptr_is_owned(obj);
35930         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35931         obj_conv.is_owned = false;
35932         LDKCVec_u8Z ret_var = Hostname_write(&obj_conv);
35933         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35934         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35935         CVec_u8Z_free(ret_var);
35936         return ret_arr;
35937 }
35938
35939 int64_t  CS_LDK_Hostname_read(int8_tArray ser) {
35940         LDKu8slice ser_ref;
35941         ser_ref.datalen = ser->arr_len;
35942         ser_ref.data = ser->elems;
35943         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
35944         *ret_conv = Hostname_read(ser_ref);
35945         FREE(ser);
35946         return tag_ptr(ret_conv, true);
35947 }
35948
35949 void  CS_LDK_TransactionU16LenLimited_free(int64_t this_obj) {
35950         LDKTransactionU16LenLimited this_obj_conv;
35951         this_obj_conv.inner = untag_ptr(this_obj);
35952         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35953         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35954         TransactionU16LenLimited_free(this_obj_conv);
35955 }
35956
35957 static inline uint64_t TransactionU16LenLimited_clone_ptr(LDKTransactionU16LenLimited *NONNULL_PTR arg) {
35958         LDKTransactionU16LenLimited ret_var = TransactionU16LenLimited_clone(arg);
35959         int64_t ret_ref = 0;
35960         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35961         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35962         return ret_ref;
35963 }
35964 int64_t  CS_LDK_TransactionU16LenLimited_clone_ptr(int64_t arg) {
35965         LDKTransactionU16LenLimited arg_conv;
35966         arg_conv.inner = untag_ptr(arg);
35967         arg_conv.is_owned = ptr_is_owned(arg);
35968         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35969         arg_conv.is_owned = false;
35970         int64_t ret_conv = TransactionU16LenLimited_clone_ptr(&arg_conv);
35971         return ret_conv;
35972 }
35973
35974 int64_t  CS_LDK_TransactionU16LenLimited_clone(int64_t orig) {
35975         LDKTransactionU16LenLimited orig_conv;
35976         orig_conv.inner = untag_ptr(orig);
35977         orig_conv.is_owned = ptr_is_owned(orig);
35978         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35979         orig_conv.is_owned = false;
35980         LDKTransactionU16LenLimited ret_var = TransactionU16LenLimited_clone(&orig_conv);
35981         int64_t ret_ref = 0;
35982         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35983         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35984         return ret_ref;
35985 }
35986
35987 int64_t  CS_LDK_TransactionU16LenLimited_hash(int64_t o) {
35988         LDKTransactionU16LenLimited o_conv;
35989         o_conv.inner = untag_ptr(o);
35990         o_conv.is_owned = ptr_is_owned(o);
35991         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35992         o_conv.is_owned = false;
35993         int64_t ret_conv = TransactionU16LenLimited_hash(&o_conv);
35994         return ret_conv;
35995 }
35996
35997 jboolean  CS_LDK_TransactionU16LenLimited_eq(int64_t a, int64_t b) {
35998         LDKTransactionU16LenLimited a_conv;
35999         a_conv.inner = untag_ptr(a);
36000         a_conv.is_owned = ptr_is_owned(a);
36001         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
36002         a_conv.is_owned = false;
36003         LDKTransactionU16LenLimited b_conv;
36004         b_conv.inner = untag_ptr(b);
36005         b_conv.is_owned = ptr_is_owned(b);
36006         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
36007         b_conv.is_owned = false;
36008         jboolean ret_conv = TransactionU16LenLimited_eq(&a_conv, &b_conv);
36009         return ret_conv;
36010 }
36011
36012 int64_t  CS_LDK_TransactionU16LenLimited_new(int8_tArray transaction) {
36013         LDKTransaction transaction_ref;
36014         transaction_ref.datalen = transaction->arr_len;
36015         transaction_ref.data = MALLOC(transaction_ref.datalen, "LDKTransaction Bytes");
36016         memcpy(transaction_ref.data, transaction->elems, transaction_ref.datalen); FREE(transaction);
36017         transaction_ref.data_is_owned = true;
36018         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
36019         *ret_conv = TransactionU16LenLimited_new(transaction_ref);
36020         return tag_ptr(ret_conv, true);
36021 }
36022
36023 int8_tArray  CS_LDK_TransactionU16LenLimited_into_transaction(int64_t this_arg) {
36024         LDKTransactionU16LenLimited this_arg_conv;
36025         this_arg_conv.inner = untag_ptr(this_arg);
36026         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36027         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36028         this_arg_conv = TransactionU16LenLimited_clone(&this_arg_conv);
36029         LDKTransaction ret_var = TransactionU16LenLimited_into_transaction(this_arg_conv);
36030         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36031         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36032         Transaction_free(ret_var);
36033         return ret_arr;
36034 }
36035
36036 int8_tArray  CS_LDK_TransactionU16LenLimited_as_transaction(int64_t this_arg) {
36037         LDKTransactionU16LenLimited this_arg_conv;
36038         this_arg_conv.inner = untag_ptr(this_arg);
36039         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36040         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36041         this_arg_conv.is_owned = false;
36042         LDKTransaction ret_var = TransactionU16LenLimited_as_transaction(&this_arg_conv);
36043         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36044         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36045         Transaction_free(ret_var);
36046         return ret_arr;
36047 }
36048
36049 int8_tArray  CS_LDK_TransactionU16LenLimited_write(int64_t obj) {
36050         LDKTransactionU16LenLimited obj_conv;
36051         obj_conv.inner = untag_ptr(obj);
36052         obj_conv.is_owned = ptr_is_owned(obj);
36053         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36054         obj_conv.is_owned = false;
36055         LDKCVec_u8Z ret_var = TransactionU16LenLimited_write(&obj_conv);
36056         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36057         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36058         CVec_u8Z_free(ret_var);
36059         return ret_arr;
36060 }
36061
36062 int64_t  CS_LDK_TransactionU16LenLimited_read(int8_tArray ser) {
36063         LDKu8slice ser_ref;
36064         ser_ref.datalen = ser->arr_len;
36065         ser_ref.data = ser->elems;
36066         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
36067         *ret_conv = TransactionU16LenLimited_read(ser_ref);
36068         FREE(ser);
36069         return tag_ptr(ret_conv, true);
36070 }
36071
36072 int64_t  CS_LDK_sign(int8_tArray msg, int8_tArray sk) {
36073         LDKu8slice msg_ref;
36074         msg_ref.datalen = msg->arr_len;
36075         msg_ref.data = msg->elems;
36076         uint8_t sk_arr[32];
36077         CHECK(sk->arr_len == 32);
36078         memcpy(sk_arr, sk->elems, 32); FREE(sk);
36079         uint8_t (*sk_ref)[32] = &sk_arr;
36080         LDKCResult_StrSecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StrSecp256k1ErrorZ), "LDKCResult_StrSecp256k1ErrorZ");
36081         *ret_conv = sign(msg_ref, sk_ref);
36082         FREE(msg);
36083         return tag_ptr(ret_conv, true);
36084 }
36085
36086 int64_t  CS_LDK_recover_pk(int8_tArray msg, jstring sig) {
36087         LDKu8slice msg_ref;
36088         msg_ref.datalen = msg->arr_len;
36089         msg_ref.data = msg->elems;
36090         LDKStr sig_conv = str_ref_to_owned_c(sig);
36091         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
36092         *ret_conv = recover_pk(msg_ref, sig_conv);
36093         FREE(msg);
36094         return tag_ptr(ret_conv, true);
36095 }
36096
36097 jboolean  CS_LDK_verify(int8_tArray msg, jstring sig, int8_tArray pk) {
36098         LDKu8slice msg_ref;
36099         msg_ref.datalen = msg->arr_len;
36100         msg_ref.data = msg->elems;
36101         LDKStr sig_conv = str_ref_to_owned_c(sig);
36102         LDKPublicKey pk_ref;
36103         CHECK(pk->arr_len == 33);
36104         memcpy(pk_ref.compressed_form, pk->elems, 33); FREE(pk);
36105         jboolean ret_conv = verify(msg_ref, sig_conv, pk_ref);
36106         FREE(msg);
36107         return ret_conv;
36108 }
36109
36110 int8_tArray  CS_LDK_construct_invoice_preimage(int8_tArray hrp_bytes, ptrArray data_without_signature) {
36111         LDKu8slice hrp_bytes_ref;
36112         hrp_bytes_ref.datalen = hrp_bytes->arr_len;
36113         hrp_bytes_ref.data = hrp_bytes->elems;
36114         LDKCVec_U5Z data_without_signature_constr;
36115         data_without_signature_constr.datalen = data_without_signature->arr_len;
36116         if (data_without_signature_constr.datalen > 0)
36117                 data_without_signature_constr.data = MALLOC(data_without_signature_constr.datalen * sizeof(LDKU5), "LDKCVec_U5Z Elements");
36118         else
36119                 data_without_signature_constr.data = NULL;
36120         int8_t* data_without_signature_vals = (void*) data_without_signature->elems;
36121         for (size_t h = 0; h < data_without_signature_constr.datalen; h++) {
36122                 int8_t data_without_signature_conv_7 = data_without_signature_vals[h];
36123                 
36124                 data_without_signature_constr.data[h] = (LDKU5){ ._0 = data_without_signature_conv_7 };
36125         }
36126         FREE(data_without_signature);
36127         LDKCVec_u8Z ret_var = construct_invoice_preimage(hrp_bytes_ref, data_without_signature_constr);
36128         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36129         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36130         CVec_u8Z_free(ret_var);
36131         FREE(hrp_bytes);
36132         return ret_arr;
36133 }
36134
36135 void  CS_LDK_KVStore_free(int64_t this_ptr) {
36136         if (!ptr_is_owned(this_ptr)) return;
36137         void* this_ptr_ptr = untag_ptr(this_ptr);
36138         CHECK_ACCESS(this_ptr_ptr);
36139         LDKKVStore this_ptr_conv = *(LDKKVStore*)(this_ptr_ptr);
36140         FREE(untag_ptr(this_ptr));
36141         KVStore_free(this_ptr_conv);
36142 }
36143
36144 void  CS_LDK_Persister_free(int64_t this_ptr) {
36145         if (!ptr_is_owned(this_ptr)) return;
36146         void* this_ptr_ptr = untag_ptr(this_ptr);
36147         CHECK_ACCESS(this_ptr_ptr);
36148         LDKPersister this_ptr_conv = *(LDKPersister*)(this_ptr_ptr);
36149         FREE(untag_ptr(this_ptr));
36150         Persister_free(this_ptr_conv);
36151 }
36152
36153 int64_t  CS_LDK_read_channel_monitors(int64_t kv_store, int64_t entropy_source, int64_t signer_provider) {
36154         void* kv_store_ptr = untag_ptr(kv_store);
36155         CHECK_ACCESS(kv_store_ptr);
36156         LDKKVStore kv_store_conv = *(LDKKVStore*)(kv_store_ptr);
36157         if (kv_store_conv.free == LDKKVStore_JCalls_free) {
36158                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36159                 LDKKVStore_JCalls_cloned(&kv_store_conv);
36160         }
36161         void* entropy_source_ptr = untag_ptr(entropy_source);
36162         CHECK_ACCESS(entropy_source_ptr);
36163         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
36164         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
36165                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36166                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
36167         }
36168         void* signer_provider_ptr = untag_ptr(signer_provider);
36169         CHECK_ACCESS(signer_provider_ptr);
36170         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
36171         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
36172                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36173                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
36174         }
36175         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
36176         *ret_conv = read_channel_monitors(kv_store_conv, entropy_source_conv, signer_provider_conv);
36177         return tag_ptr(ret_conv, true);
36178 }
36179
36180 void  CS_LDK_MonitorUpdatingPersister_free(int64_t this_obj) {
36181         LDKMonitorUpdatingPersister this_obj_conv;
36182         this_obj_conv.inner = untag_ptr(this_obj);
36183         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36184         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36185         MonitorUpdatingPersister_free(this_obj_conv);
36186 }
36187
36188 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) {
36189         void* kv_store_ptr = untag_ptr(kv_store);
36190         CHECK_ACCESS(kv_store_ptr);
36191         LDKKVStore kv_store_conv = *(LDKKVStore*)(kv_store_ptr);
36192         if (kv_store_conv.free == LDKKVStore_JCalls_free) {
36193                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36194                 LDKKVStore_JCalls_cloned(&kv_store_conv);
36195         }
36196         void* logger_ptr = untag_ptr(logger);
36197         CHECK_ACCESS(logger_ptr);
36198         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
36199         if (logger_conv.free == LDKLogger_JCalls_free) {
36200                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36201                 LDKLogger_JCalls_cloned(&logger_conv);
36202         }
36203         void* entropy_source_ptr = untag_ptr(entropy_source);
36204         CHECK_ACCESS(entropy_source_ptr);
36205         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
36206         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
36207                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36208                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
36209         }
36210         void* signer_provider_ptr = untag_ptr(signer_provider);
36211         CHECK_ACCESS(signer_provider_ptr);
36212         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
36213         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
36214                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36215                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
36216         }
36217         LDKMonitorUpdatingPersister ret_var = MonitorUpdatingPersister_new(kv_store_conv, logger_conv, maximum_pending_updates, entropy_source_conv, signer_provider_conv);
36218         int64_t ret_ref = 0;
36219         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36220         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36221         return ret_ref;
36222 }
36223
36224 int64_t  CS_LDK_MonitorUpdatingPersister_read_all_channel_monitors_with_updates(int64_t this_arg, int64_t broadcaster, int64_t fee_estimator) {
36225         LDKMonitorUpdatingPersister this_arg_conv;
36226         this_arg_conv.inner = untag_ptr(this_arg);
36227         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36228         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36229         this_arg_conv.is_owned = false;
36230         void* broadcaster_ptr = untag_ptr(broadcaster);
36231         if (ptr_is_owned(broadcaster)) { CHECK_ACCESS(broadcaster_ptr); }
36232         LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
36233         void* fee_estimator_ptr = untag_ptr(fee_estimator);
36234         if (ptr_is_owned(fee_estimator)) { CHECK_ACCESS(fee_estimator_ptr); }
36235         LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator_ptr;
36236         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
36237         *ret_conv = MonitorUpdatingPersister_read_all_channel_monitors_with_updates(&this_arg_conv, broadcaster_conv, fee_estimator_conv);
36238         return tag_ptr(ret_conv, true);
36239 }
36240
36241 int64_t  CS_LDK_MonitorUpdatingPersister_read_channel_monitor_with_updates(int64_t this_arg, int64_t broadcaster, int64_t fee_estimator, jstring monitor_key) {
36242         LDKMonitorUpdatingPersister this_arg_conv;
36243         this_arg_conv.inner = untag_ptr(this_arg);
36244         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36245         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36246         this_arg_conv.is_owned = false;
36247         void* broadcaster_ptr = untag_ptr(broadcaster);
36248         if (ptr_is_owned(broadcaster)) { CHECK_ACCESS(broadcaster_ptr); }
36249         LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
36250         void* fee_estimator_ptr = untag_ptr(fee_estimator);
36251         if (ptr_is_owned(fee_estimator)) { CHECK_ACCESS(fee_estimator_ptr); }
36252         LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator_ptr;
36253         LDKStr monitor_key_conv = str_ref_to_owned_c(monitor_key);
36254         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ");
36255         *ret_conv = MonitorUpdatingPersister_read_channel_monitor_with_updates(&this_arg_conv, broadcaster_conv, fee_estimator_conv, monitor_key_conv);
36256         return tag_ptr(ret_conv, true);
36257 }
36258
36259 int64_t  CS_LDK_MonitorUpdatingPersister_cleanup_stale_updates(int64_t this_arg, jboolean lazy) {
36260         LDKMonitorUpdatingPersister this_arg_conv;
36261         this_arg_conv.inner = untag_ptr(this_arg);
36262         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36263         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36264         this_arg_conv.is_owned = false;
36265         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
36266         *ret_conv = MonitorUpdatingPersister_cleanup_stale_updates(&this_arg_conv, lazy);
36267         return tag_ptr(ret_conv, true);
36268 }
36269
36270 int64_t  CS_LDK_MonitorUpdatingPersister_as_Persist(int64_t this_arg) {
36271         LDKMonitorUpdatingPersister this_arg_conv;
36272         this_arg_conv.inner = untag_ptr(this_arg);
36273         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36274         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36275         this_arg_conv.is_owned = false;
36276         LDKPersist* ret_ret = MALLOC(sizeof(LDKPersist), "LDKPersist");
36277         *ret_ret = MonitorUpdatingPersister_as_Persist(&this_arg_conv);
36278         return tag_ptr(ret_ret, true);
36279 }
36280
36281 int32_t  CS_LDK_ShortChannelIdError_clone(int64_t orig) {
36282         LDKShortChannelIdError* orig_conv = (LDKShortChannelIdError*)untag_ptr(orig);
36283         int32_t ret_conv = LDKShortChannelIdError_to_cs(ShortChannelIdError_clone(orig_conv));
36284         return ret_conv;
36285 }
36286
36287 int32_t  CS_LDK_ShortChannelIdError_block_overflow() {
36288         int32_t ret_conv = LDKShortChannelIdError_to_cs(ShortChannelIdError_block_overflow());
36289         return ret_conv;
36290 }
36291
36292 int32_t  CS_LDK_ShortChannelIdError_tx_index_overflow() {
36293         int32_t ret_conv = LDKShortChannelIdError_to_cs(ShortChannelIdError_tx_index_overflow());
36294         return ret_conv;
36295 }
36296
36297 int32_t  CS_LDK_ShortChannelIdError_vout_index_overflow() {
36298         int32_t ret_conv = LDKShortChannelIdError_to_cs(ShortChannelIdError_vout_index_overflow());
36299         return ret_conv;
36300 }
36301
36302 jboolean  CS_LDK_ShortChannelIdError_eq(int64_t a, int64_t b) {
36303         LDKShortChannelIdError* a_conv = (LDKShortChannelIdError*)untag_ptr(a);
36304         LDKShortChannelIdError* b_conv = (LDKShortChannelIdError*)untag_ptr(b);
36305         jboolean ret_conv = ShortChannelIdError_eq(a_conv, b_conv);
36306         return ret_conv;
36307 }
36308
36309 int32_t  CS_LDK_block_from_scid(int64_t short_channel_id) {
36310         int32_t ret_conv = block_from_scid(short_channel_id);
36311         return ret_conv;
36312 }
36313
36314 int32_t  CS_LDK_tx_index_from_scid(int64_t short_channel_id) {
36315         int32_t ret_conv = tx_index_from_scid(short_channel_id);
36316         return ret_conv;
36317 }
36318
36319 int16_t  CS_LDK_vout_from_scid(int64_t short_channel_id) {
36320         int16_t ret_conv = vout_from_scid(short_channel_id);
36321         return ret_conv;
36322 }
36323
36324 int64_t  CS_LDK_scid_from_parts(int64_t block, int64_t tx_index, int64_t vout_index) {
36325         LDKCResult_u64ShortChannelIdErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u64ShortChannelIdErrorZ), "LDKCResult_u64ShortChannelIdErrorZ");
36326         *ret_conv = scid_from_parts(block, tx_index, vout_index);
36327         return tag_ptr(ret_conv, true);
36328 }
36329
36330 void  CS_LDK_UntrustedString_free(int64_t this_obj) {
36331         LDKUntrustedString this_obj_conv;
36332         this_obj_conv.inner = untag_ptr(this_obj);
36333         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36334         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36335         UntrustedString_free(this_obj_conv);
36336 }
36337
36338 jstring  CS_LDK_UntrustedString_get_a(int64_t this_ptr) {
36339         LDKUntrustedString this_ptr_conv;
36340         this_ptr_conv.inner = untag_ptr(this_ptr);
36341         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36342         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36343         this_ptr_conv.is_owned = false;
36344         LDKStr ret_str = UntrustedString_get_a(&this_ptr_conv);
36345         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
36346         Str_free(ret_str);
36347         return ret_conv;
36348 }
36349
36350 void  CS_LDK_UntrustedString_set_a(int64_t this_ptr, jstring val) {
36351         LDKUntrustedString this_ptr_conv;
36352         this_ptr_conv.inner = untag_ptr(this_ptr);
36353         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36354         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36355         this_ptr_conv.is_owned = false;
36356         LDKStr val_conv = str_ref_to_owned_c(val);
36357         UntrustedString_set_a(&this_ptr_conv, val_conv);
36358 }
36359
36360 int64_t  CS_LDK_UntrustedString_new(jstring a_arg) {
36361         LDKStr a_arg_conv = str_ref_to_owned_c(a_arg);
36362         LDKUntrustedString ret_var = UntrustedString_new(a_arg_conv);
36363         int64_t ret_ref = 0;
36364         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36365         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36366         return ret_ref;
36367 }
36368
36369 static inline uint64_t UntrustedString_clone_ptr(LDKUntrustedString *NONNULL_PTR arg) {
36370         LDKUntrustedString ret_var = UntrustedString_clone(arg);
36371         int64_t ret_ref = 0;
36372         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36373         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36374         return ret_ref;
36375 }
36376 int64_t  CS_LDK_UntrustedString_clone_ptr(int64_t arg) {
36377         LDKUntrustedString arg_conv;
36378         arg_conv.inner = untag_ptr(arg);
36379         arg_conv.is_owned = ptr_is_owned(arg);
36380         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36381         arg_conv.is_owned = false;
36382         int64_t ret_conv = UntrustedString_clone_ptr(&arg_conv);
36383         return ret_conv;
36384 }
36385
36386 int64_t  CS_LDK_UntrustedString_clone(int64_t orig) {
36387         LDKUntrustedString orig_conv;
36388         orig_conv.inner = untag_ptr(orig);
36389         orig_conv.is_owned = ptr_is_owned(orig);
36390         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36391         orig_conv.is_owned = false;
36392         LDKUntrustedString ret_var = UntrustedString_clone(&orig_conv);
36393         int64_t ret_ref = 0;
36394         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36395         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36396         return ret_ref;
36397 }
36398
36399 jboolean  CS_LDK_UntrustedString_eq(int64_t a, int64_t b) {
36400         LDKUntrustedString a_conv;
36401         a_conv.inner = untag_ptr(a);
36402         a_conv.is_owned = ptr_is_owned(a);
36403         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
36404         a_conv.is_owned = false;
36405         LDKUntrustedString b_conv;
36406         b_conv.inner = untag_ptr(b);
36407         b_conv.is_owned = ptr_is_owned(b);
36408         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
36409         b_conv.is_owned = false;
36410         jboolean ret_conv = UntrustedString_eq(&a_conv, &b_conv);
36411         return ret_conv;
36412 }
36413
36414 int64_t  CS_LDK_UntrustedString_hash(int64_t o) {
36415         LDKUntrustedString o_conv;
36416         o_conv.inner = untag_ptr(o);
36417         o_conv.is_owned = ptr_is_owned(o);
36418         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
36419         o_conv.is_owned = false;
36420         int64_t ret_conv = UntrustedString_hash(&o_conv);
36421         return ret_conv;
36422 }
36423
36424 int8_tArray  CS_LDK_UntrustedString_write(int64_t obj) {
36425         LDKUntrustedString obj_conv;
36426         obj_conv.inner = untag_ptr(obj);
36427         obj_conv.is_owned = ptr_is_owned(obj);
36428         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36429         obj_conv.is_owned = false;
36430         LDKCVec_u8Z ret_var = UntrustedString_write(&obj_conv);
36431         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36432         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36433         CVec_u8Z_free(ret_var);
36434         return ret_arr;
36435 }
36436
36437 int64_t  CS_LDK_UntrustedString_read(int8_tArray ser) {
36438         LDKu8slice ser_ref;
36439         ser_ref.datalen = ser->arr_len;
36440         ser_ref.data = ser->elems;
36441         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
36442         *ret_conv = UntrustedString_read(ser_ref);
36443         FREE(ser);
36444         return tag_ptr(ret_conv, true);
36445 }
36446
36447 jstring  CS_LDK_UntrustedString_to_str(int64_t o) {
36448         LDKUntrustedString o_conv;
36449         o_conv.inner = untag_ptr(o);
36450         o_conv.is_owned = ptr_is_owned(o);
36451         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
36452         o_conv.is_owned = false;
36453         LDKStr ret_str = UntrustedString_to_str(&o_conv);
36454         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
36455         Str_free(ret_str);
36456         return ret_conv;
36457 }
36458
36459 void  CS_LDK_PrintableString_free(int64_t this_obj) {
36460         LDKPrintableString this_obj_conv;
36461         this_obj_conv.inner = untag_ptr(this_obj);
36462         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36463         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36464         PrintableString_free(this_obj_conv);
36465 }
36466
36467 jstring  CS_LDK_PrintableString_get_a(int64_t this_ptr) {
36468         LDKPrintableString this_ptr_conv;
36469         this_ptr_conv.inner = untag_ptr(this_ptr);
36470         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36471         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36472         this_ptr_conv.is_owned = false;
36473         LDKStr ret_str = PrintableString_get_a(&this_ptr_conv);
36474         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
36475         Str_free(ret_str);
36476         return ret_conv;
36477 }
36478
36479 void  CS_LDK_PrintableString_set_a(int64_t this_ptr, jstring val) {
36480         LDKPrintableString this_ptr_conv;
36481         this_ptr_conv.inner = untag_ptr(this_ptr);
36482         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36483         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36484         this_ptr_conv.is_owned = false;
36485         LDKStr val_conv = str_ref_to_owned_c(val);
36486         PrintableString_set_a(&this_ptr_conv, val_conv);
36487 }
36488
36489 int64_t  CS_LDK_PrintableString_new(jstring a_arg) {
36490         LDKStr a_arg_conv = str_ref_to_owned_c(a_arg);
36491         LDKPrintableString ret_var = PrintableString_new(a_arg_conv);
36492         int64_t ret_ref = 0;
36493         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36494         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36495         return ret_ref;
36496 }
36497
36498 jstring  CS_LDK_PrintableString_to_str(int64_t o) {
36499         LDKPrintableString o_conv;
36500         o_conv.inner = untag_ptr(o);
36501         o_conv.is_owned = ptr_is_owned(o);
36502         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
36503         o_conv.is_owned = false;
36504         LDKStr ret_str = PrintableString_to_str(&o_conv);
36505         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
36506         Str_free(ret_str);
36507         return ret_conv;
36508 }
36509
36510 void  CS_LDK_TrackedSpendableOutput_free(int64_t this_obj) {
36511         LDKTrackedSpendableOutput this_obj_conv;
36512         this_obj_conv.inner = untag_ptr(this_obj);
36513         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36514         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36515         TrackedSpendableOutput_free(this_obj_conv);
36516 }
36517
36518 int64_t  CS_LDK_TrackedSpendableOutput_get_descriptor(int64_t this_ptr) {
36519         LDKTrackedSpendableOutput this_ptr_conv;
36520         this_ptr_conv.inner = untag_ptr(this_ptr);
36521         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36522         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36523         this_ptr_conv.is_owned = false;
36524         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
36525         *ret_copy = TrackedSpendableOutput_get_descriptor(&this_ptr_conv);
36526         int64_t ret_ref = tag_ptr(ret_copy, true);
36527         return ret_ref;
36528 }
36529
36530 void  CS_LDK_TrackedSpendableOutput_set_descriptor(int64_t this_ptr, int64_t val) {
36531         LDKTrackedSpendableOutput this_ptr_conv;
36532         this_ptr_conv.inner = untag_ptr(this_ptr);
36533         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36534         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36535         this_ptr_conv.is_owned = false;
36536         void* val_ptr = untag_ptr(val);
36537         CHECK_ACCESS(val_ptr);
36538         LDKSpendableOutputDescriptor val_conv = *(LDKSpendableOutputDescriptor*)(val_ptr);
36539         val_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(val));
36540         TrackedSpendableOutput_set_descriptor(&this_ptr_conv, val_conv);
36541 }
36542
36543 int64_t  CS_LDK_TrackedSpendableOutput_get_channel_id(int64_t this_ptr) {
36544         LDKTrackedSpendableOutput this_ptr_conv;
36545         this_ptr_conv.inner = untag_ptr(this_ptr);
36546         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36547         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36548         this_ptr_conv.is_owned = false;
36549         LDKChannelId ret_var = TrackedSpendableOutput_get_channel_id(&this_ptr_conv);
36550         int64_t ret_ref = 0;
36551         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36552         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36553         return ret_ref;
36554 }
36555
36556 void  CS_LDK_TrackedSpendableOutput_set_channel_id(int64_t this_ptr, int64_t val) {
36557         LDKTrackedSpendableOutput this_ptr_conv;
36558         this_ptr_conv.inner = untag_ptr(this_ptr);
36559         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36560         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36561         this_ptr_conv.is_owned = false;
36562         LDKChannelId val_conv;
36563         val_conv.inner = untag_ptr(val);
36564         val_conv.is_owned = ptr_is_owned(val);
36565         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
36566         val_conv = ChannelId_clone(&val_conv);
36567         TrackedSpendableOutput_set_channel_id(&this_ptr_conv, val_conv);
36568 }
36569
36570 int64_t  CS_LDK_TrackedSpendableOutput_get_status(int64_t this_ptr) {
36571         LDKTrackedSpendableOutput this_ptr_conv;
36572         this_ptr_conv.inner = untag_ptr(this_ptr);
36573         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36574         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36575         this_ptr_conv.is_owned = false;
36576         LDKOutputSpendStatus *ret_copy = MALLOC(sizeof(LDKOutputSpendStatus), "LDKOutputSpendStatus");
36577         *ret_copy = TrackedSpendableOutput_get_status(&this_ptr_conv);
36578         int64_t ret_ref = tag_ptr(ret_copy, true);
36579         return ret_ref;
36580 }
36581
36582 void  CS_LDK_TrackedSpendableOutput_set_status(int64_t this_ptr, int64_t val) {
36583         LDKTrackedSpendableOutput this_ptr_conv;
36584         this_ptr_conv.inner = untag_ptr(this_ptr);
36585         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36586         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36587         this_ptr_conv.is_owned = false;
36588         void* val_ptr = untag_ptr(val);
36589         CHECK_ACCESS(val_ptr);
36590         LDKOutputSpendStatus val_conv = *(LDKOutputSpendStatus*)(val_ptr);
36591         val_conv = OutputSpendStatus_clone((LDKOutputSpendStatus*)untag_ptr(val));
36592         TrackedSpendableOutput_set_status(&this_ptr_conv, val_conv);
36593 }
36594
36595 int64_t  CS_LDK_TrackedSpendableOutput_new(int64_t descriptor_arg, int64_t channel_id_arg, int64_t status_arg) {
36596         void* descriptor_arg_ptr = untag_ptr(descriptor_arg);
36597         CHECK_ACCESS(descriptor_arg_ptr);
36598         LDKSpendableOutputDescriptor descriptor_arg_conv = *(LDKSpendableOutputDescriptor*)(descriptor_arg_ptr);
36599         descriptor_arg_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptor_arg));
36600         LDKChannelId channel_id_arg_conv;
36601         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
36602         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
36603         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
36604         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
36605         void* status_arg_ptr = untag_ptr(status_arg);
36606         CHECK_ACCESS(status_arg_ptr);
36607         LDKOutputSpendStatus status_arg_conv = *(LDKOutputSpendStatus*)(status_arg_ptr);
36608         status_arg_conv = OutputSpendStatus_clone((LDKOutputSpendStatus*)untag_ptr(status_arg));
36609         LDKTrackedSpendableOutput ret_var = TrackedSpendableOutput_new(descriptor_arg_conv, channel_id_arg_conv, status_arg_conv);
36610         int64_t ret_ref = 0;
36611         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36612         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36613         return ret_ref;
36614 }
36615
36616 static inline uint64_t TrackedSpendableOutput_clone_ptr(LDKTrackedSpendableOutput *NONNULL_PTR arg) {
36617         LDKTrackedSpendableOutput ret_var = TrackedSpendableOutput_clone(arg);
36618         int64_t ret_ref = 0;
36619         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36620         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36621         return ret_ref;
36622 }
36623 int64_t  CS_LDK_TrackedSpendableOutput_clone_ptr(int64_t arg) {
36624         LDKTrackedSpendableOutput arg_conv;
36625         arg_conv.inner = untag_ptr(arg);
36626         arg_conv.is_owned = ptr_is_owned(arg);
36627         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36628         arg_conv.is_owned = false;
36629         int64_t ret_conv = TrackedSpendableOutput_clone_ptr(&arg_conv);
36630         return ret_conv;
36631 }
36632
36633 int64_t  CS_LDK_TrackedSpendableOutput_clone(int64_t orig) {
36634         LDKTrackedSpendableOutput orig_conv;
36635         orig_conv.inner = untag_ptr(orig);
36636         orig_conv.is_owned = ptr_is_owned(orig);
36637         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36638         orig_conv.is_owned = false;
36639         LDKTrackedSpendableOutput ret_var = TrackedSpendableOutput_clone(&orig_conv);
36640         int64_t ret_ref = 0;
36641         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36642         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36643         return ret_ref;
36644 }
36645
36646 jboolean  CS_LDK_TrackedSpendableOutput_eq(int64_t a, int64_t b) {
36647         LDKTrackedSpendableOutput a_conv;
36648         a_conv.inner = untag_ptr(a);
36649         a_conv.is_owned = ptr_is_owned(a);
36650         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
36651         a_conv.is_owned = false;
36652         LDKTrackedSpendableOutput b_conv;
36653         b_conv.inner = untag_ptr(b);
36654         b_conv.is_owned = ptr_is_owned(b);
36655         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
36656         b_conv.is_owned = false;
36657         jboolean ret_conv = TrackedSpendableOutput_eq(&a_conv, &b_conv);
36658         return ret_conv;
36659 }
36660
36661 jboolean  CS_LDK_TrackedSpendableOutput_is_spent_in(int64_t this_arg, int8_tArray tx) {
36662         LDKTrackedSpendableOutput this_arg_conv;
36663         this_arg_conv.inner = untag_ptr(this_arg);
36664         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36665         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36666         this_arg_conv.is_owned = false;
36667         LDKTransaction tx_ref;
36668         tx_ref.datalen = tx->arr_len;
36669         tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
36670         memcpy(tx_ref.data, tx->elems, tx_ref.datalen); FREE(tx);
36671         tx_ref.data_is_owned = true;
36672         jboolean ret_conv = TrackedSpendableOutput_is_spent_in(&this_arg_conv, tx_ref);
36673         return ret_conv;
36674 }
36675
36676 int8_tArray  CS_LDK_TrackedSpendableOutput_write(int64_t obj) {
36677         LDKTrackedSpendableOutput obj_conv;
36678         obj_conv.inner = untag_ptr(obj);
36679         obj_conv.is_owned = ptr_is_owned(obj);
36680         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36681         obj_conv.is_owned = false;
36682         LDKCVec_u8Z ret_var = TrackedSpendableOutput_write(&obj_conv);
36683         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36684         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36685         CVec_u8Z_free(ret_var);
36686         return ret_arr;
36687 }
36688
36689 int64_t  CS_LDK_TrackedSpendableOutput_read(int8_tArray ser) {
36690         LDKu8slice ser_ref;
36691         ser_ref.datalen = ser->arr_len;
36692         ser_ref.data = ser->elems;
36693         LDKCResult_TrackedSpendableOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TrackedSpendableOutputDecodeErrorZ), "LDKCResult_TrackedSpendableOutputDecodeErrorZ");
36694         *ret_conv = TrackedSpendableOutput_read(ser_ref);
36695         FREE(ser);
36696         return tag_ptr(ret_conv, true);
36697 }
36698
36699 void  CS_LDK_OutputSpendStatus_free(int64_t this_ptr) {
36700         if (!ptr_is_owned(this_ptr)) return;
36701         void* this_ptr_ptr = untag_ptr(this_ptr);
36702         CHECK_ACCESS(this_ptr_ptr);
36703         LDKOutputSpendStatus this_ptr_conv = *(LDKOutputSpendStatus*)(this_ptr_ptr);
36704         FREE(untag_ptr(this_ptr));
36705         OutputSpendStatus_free(this_ptr_conv);
36706 }
36707
36708 static inline uint64_t OutputSpendStatus_clone_ptr(LDKOutputSpendStatus *NONNULL_PTR arg) {
36709         LDKOutputSpendStatus *ret_copy = MALLOC(sizeof(LDKOutputSpendStatus), "LDKOutputSpendStatus");
36710         *ret_copy = OutputSpendStatus_clone(arg);
36711         int64_t ret_ref = tag_ptr(ret_copy, true);
36712         return ret_ref;
36713 }
36714 int64_t  CS_LDK_OutputSpendStatus_clone_ptr(int64_t arg) {
36715         LDKOutputSpendStatus* arg_conv = (LDKOutputSpendStatus*)untag_ptr(arg);
36716         int64_t ret_conv = OutputSpendStatus_clone_ptr(arg_conv);
36717         return ret_conv;
36718 }
36719
36720 int64_t  CS_LDK_OutputSpendStatus_clone(int64_t orig) {
36721         LDKOutputSpendStatus* orig_conv = (LDKOutputSpendStatus*)untag_ptr(orig);
36722         LDKOutputSpendStatus *ret_copy = MALLOC(sizeof(LDKOutputSpendStatus), "LDKOutputSpendStatus");
36723         *ret_copy = OutputSpendStatus_clone(orig_conv);
36724         int64_t ret_ref = tag_ptr(ret_copy, true);
36725         return ret_ref;
36726 }
36727
36728 int64_t  CS_LDK_OutputSpendStatus_pending_initial_broadcast(int64_t delayed_until_height) {
36729         void* delayed_until_height_ptr = untag_ptr(delayed_until_height);
36730         CHECK_ACCESS(delayed_until_height_ptr);
36731         LDKCOption_u32Z delayed_until_height_conv = *(LDKCOption_u32Z*)(delayed_until_height_ptr);
36732         delayed_until_height_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(delayed_until_height));
36733         LDKOutputSpendStatus *ret_copy = MALLOC(sizeof(LDKOutputSpendStatus), "LDKOutputSpendStatus");
36734         *ret_copy = OutputSpendStatus_pending_initial_broadcast(delayed_until_height_conv);
36735         int64_t ret_ref = tag_ptr(ret_copy, true);
36736         return ret_ref;
36737 }
36738
36739 int64_t  CS_LDK_OutputSpendStatus_pending_first_confirmation(int8_tArray first_broadcast_hash, int32_t latest_broadcast_height, int8_tArray latest_spending_tx) {
36740         LDKThirtyTwoBytes first_broadcast_hash_ref;
36741         CHECK(first_broadcast_hash->arr_len == 32);
36742         memcpy(first_broadcast_hash_ref.data, first_broadcast_hash->elems, 32); FREE(first_broadcast_hash);
36743         LDKTransaction latest_spending_tx_ref;
36744         latest_spending_tx_ref.datalen = latest_spending_tx->arr_len;
36745         latest_spending_tx_ref.data = MALLOC(latest_spending_tx_ref.datalen, "LDKTransaction Bytes");
36746         memcpy(latest_spending_tx_ref.data, latest_spending_tx->elems, latest_spending_tx_ref.datalen); FREE(latest_spending_tx);
36747         latest_spending_tx_ref.data_is_owned = true;
36748         LDKOutputSpendStatus *ret_copy = MALLOC(sizeof(LDKOutputSpendStatus), "LDKOutputSpendStatus");
36749         *ret_copy = OutputSpendStatus_pending_first_confirmation(first_broadcast_hash_ref, latest_broadcast_height, latest_spending_tx_ref);
36750         int64_t ret_ref = tag_ptr(ret_copy, true);
36751         return ret_ref;
36752 }
36753
36754 int64_t  CS_LDK_OutputSpendStatus_pending_threshold_confirmations(int8_tArray first_broadcast_hash, int32_t latest_broadcast_height, int8_tArray latest_spending_tx, int32_t confirmation_height, int8_tArray confirmation_hash) {
36755         LDKThirtyTwoBytes first_broadcast_hash_ref;
36756         CHECK(first_broadcast_hash->arr_len == 32);
36757         memcpy(first_broadcast_hash_ref.data, first_broadcast_hash->elems, 32); FREE(first_broadcast_hash);
36758         LDKTransaction latest_spending_tx_ref;
36759         latest_spending_tx_ref.datalen = latest_spending_tx->arr_len;
36760         latest_spending_tx_ref.data = MALLOC(latest_spending_tx_ref.datalen, "LDKTransaction Bytes");
36761         memcpy(latest_spending_tx_ref.data, latest_spending_tx->elems, latest_spending_tx_ref.datalen); FREE(latest_spending_tx);
36762         latest_spending_tx_ref.data_is_owned = true;
36763         LDKThirtyTwoBytes confirmation_hash_ref;
36764         CHECK(confirmation_hash->arr_len == 32);
36765         memcpy(confirmation_hash_ref.data, confirmation_hash->elems, 32); FREE(confirmation_hash);
36766         LDKOutputSpendStatus *ret_copy = MALLOC(sizeof(LDKOutputSpendStatus), "LDKOutputSpendStatus");
36767         *ret_copy = OutputSpendStatus_pending_threshold_confirmations(first_broadcast_hash_ref, latest_broadcast_height, latest_spending_tx_ref, confirmation_height, confirmation_hash_ref);
36768         int64_t ret_ref = tag_ptr(ret_copy, true);
36769         return ret_ref;
36770 }
36771
36772 jboolean  CS_LDK_OutputSpendStatus_eq(int64_t a, int64_t b) {
36773         LDKOutputSpendStatus* a_conv = (LDKOutputSpendStatus*)untag_ptr(a);
36774         LDKOutputSpendStatus* b_conv = (LDKOutputSpendStatus*)untag_ptr(b);
36775         jboolean ret_conv = OutputSpendStatus_eq(a_conv, b_conv);
36776         return ret_conv;
36777 }
36778
36779 int8_tArray  CS_LDK_OutputSpendStatus_write(int64_t obj) {
36780         LDKOutputSpendStatus* obj_conv = (LDKOutputSpendStatus*)untag_ptr(obj);
36781         LDKCVec_u8Z ret_var = OutputSpendStatus_write(obj_conv);
36782         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36783         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36784         CVec_u8Z_free(ret_var);
36785         return ret_arr;
36786 }
36787
36788 int64_t  CS_LDK_OutputSpendStatus_read(int8_tArray ser) {
36789         LDKu8slice ser_ref;
36790         ser_ref.datalen = ser->arr_len;
36791         ser_ref.data = ser->elems;
36792         LDKCResult_OutputSpendStatusDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutputSpendStatusDecodeErrorZ), "LDKCResult_OutputSpendStatusDecodeErrorZ");
36793         *ret_conv = OutputSpendStatus_read(ser_ref);
36794         FREE(ser);
36795         return tag_ptr(ret_conv, true);
36796 }
36797
36798 void  CS_LDK_OutputSweeper_free(int64_t this_obj) {
36799         LDKOutputSweeper this_obj_conv;
36800         this_obj_conv.inner = untag_ptr(this_obj);
36801         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36802         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36803         OutputSweeper_free(this_obj_conv);
36804 }
36805
36806 int64_t  CS_LDK_OutputSweeper_new(int64_t best_block, int64_t broadcaster, int64_t fee_estimator, int64_t chain_data_source, int64_t output_spender, int64_t change_destination_source, int64_t kv_store, int64_t logger) {
36807         LDKBestBlock best_block_conv;
36808         best_block_conv.inner = untag_ptr(best_block);
36809         best_block_conv.is_owned = ptr_is_owned(best_block);
36810         CHECK_INNER_FIELD_ACCESS_OR_NULL(best_block_conv);
36811         best_block_conv = BestBlock_clone(&best_block_conv);
36812         void* broadcaster_ptr = untag_ptr(broadcaster);
36813         CHECK_ACCESS(broadcaster_ptr);
36814         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
36815         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
36816                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36817                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
36818         }
36819         void* fee_estimator_ptr = untag_ptr(fee_estimator);
36820         CHECK_ACCESS(fee_estimator_ptr);
36821         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
36822         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
36823                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36824                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
36825         }
36826         void* chain_data_source_ptr = untag_ptr(chain_data_source);
36827         CHECK_ACCESS(chain_data_source_ptr);
36828         LDKCOption_FilterZ chain_data_source_conv = *(LDKCOption_FilterZ*)(chain_data_source_ptr);
36829         // WARNING: we may need a move here but no clone is available for LDKCOption_FilterZ
36830         if (chain_data_source_conv.tag == LDKCOption_FilterZ_Some) {
36831                 // Manually implement clone for Java trait instances
36832                 if (chain_data_source_conv.some.free == LDKFilter_JCalls_free) {
36833                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36834                         LDKFilter_JCalls_cloned(&chain_data_source_conv.some);
36835                 }
36836         }
36837         void* output_spender_ptr = untag_ptr(output_spender);
36838         CHECK_ACCESS(output_spender_ptr);
36839         LDKOutputSpender output_spender_conv = *(LDKOutputSpender*)(output_spender_ptr);
36840         if (output_spender_conv.free == LDKOutputSpender_JCalls_free) {
36841                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36842                 LDKOutputSpender_JCalls_cloned(&output_spender_conv);
36843         }
36844         void* change_destination_source_ptr = untag_ptr(change_destination_source);
36845         CHECK_ACCESS(change_destination_source_ptr);
36846         LDKChangeDestinationSource change_destination_source_conv = *(LDKChangeDestinationSource*)(change_destination_source_ptr);
36847         if (change_destination_source_conv.free == LDKChangeDestinationSource_JCalls_free) {
36848                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36849                 LDKChangeDestinationSource_JCalls_cloned(&change_destination_source_conv);
36850         }
36851         void* kv_store_ptr = untag_ptr(kv_store);
36852         CHECK_ACCESS(kv_store_ptr);
36853         LDKKVStore kv_store_conv = *(LDKKVStore*)(kv_store_ptr);
36854         if (kv_store_conv.free == LDKKVStore_JCalls_free) {
36855                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36856                 LDKKVStore_JCalls_cloned(&kv_store_conv);
36857         }
36858         void* logger_ptr = untag_ptr(logger);
36859         CHECK_ACCESS(logger_ptr);
36860         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
36861         if (logger_conv.free == LDKLogger_JCalls_free) {
36862                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36863                 LDKLogger_JCalls_cloned(&logger_conv);
36864         }
36865         LDKOutputSweeper ret_var = OutputSweeper_new(best_block_conv, broadcaster_conv, fee_estimator_conv, chain_data_source_conv, output_spender_conv, change_destination_source_conv, kv_store_conv, logger_conv);
36866         int64_t ret_ref = 0;
36867         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36868         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36869         return ret_ref;
36870 }
36871
36872 int64_t  CS_LDK_OutputSweeper_track_spendable_outputs(int64_t this_arg, int64_tArray output_descriptors, int64_t channel_id, jboolean exclude_static_outputs, int64_t delay_until_height) {
36873         LDKOutputSweeper this_arg_conv;
36874         this_arg_conv.inner = untag_ptr(this_arg);
36875         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36876         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36877         this_arg_conv.is_owned = false;
36878         LDKCVec_SpendableOutputDescriptorZ output_descriptors_constr;
36879         output_descriptors_constr.datalen = output_descriptors->arr_len;
36880         if (output_descriptors_constr.datalen > 0)
36881                 output_descriptors_constr.data = MALLOC(output_descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
36882         else
36883                 output_descriptors_constr.data = NULL;
36884         int64_t* output_descriptors_vals = output_descriptors->elems;
36885         for (size_t b = 0; b < output_descriptors_constr.datalen; b++) {
36886                 int64_t output_descriptors_conv_27 = output_descriptors_vals[b];
36887                 void* output_descriptors_conv_27_ptr = untag_ptr(output_descriptors_conv_27);
36888                 CHECK_ACCESS(output_descriptors_conv_27_ptr);
36889                 LDKSpendableOutputDescriptor output_descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(output_descriptors_conv_27_ptr);
36890                 output_descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(output_descriptors_conv_27));
36891                 output_descriptors_constr.data[b] = output_descriptors_conv_27_conv;
36892         }
36893         FREE(output_descriptors);
36894         LDKChannelId channel_id_conv;
36895         channel_id_conv.inner = untag_ptr(channel_id);
36896         channel_id_conv.is_owned = ptr_is_owned(channel_id);
36897         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
36898         channel_id_conv = ChannelId_clone(&channel_id_conv);
36899         void* delay_until_height_ptr = untag_ptr(delay_until_height);
36900         CHECK_ACCESS(delay_until_height_ptr);
36901         LDKCOption_u32Z delay_until_height_conv = *(LDKCOption_u32Z*)(delay_until_height_ptr);
36902         delay_until_height_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(delay_until_height));
36903         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
36904         *ret_conv = OutputSweeper_track_spendable_outputs(&this_arg_conv, output_descriptors_constr, channel_id_conv, exclude_static_outputs, delay_until_height_conv);
36905         return tag_ptr(ret_conv, true);
36906 }
36907
36908 int64_tArray  CS_LDK_OutputSweeper_tracked_spendable_outputs(int64_t this_arg) {
36909         LDKOutputSweeper this_arg_conv;
36910         this_arg_conv.inner = untag_ptr(this_arg);
36911         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36912         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36913         this_arg_conv.is_owned = false;
36914         LDKCVec_TrackedSpendableOutputZ ret_var = OutputSweeper_tracked_spendable_outputs(&this_arg_conv);
36915         int64_tArray ret_arr = NULL;
36916         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
36917         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
36918         for (size_t y = 0; y < ret_var.datalen; y++) {
36919                 LDKTrackedSpendableOutput ret_conv_24_var = ret_var.data[y];
36920                 int64_t ret_conv_24_ref = 0;
36921                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_24_var);
36922                 ret_conv_24_ref = tag_ptr(ret_conv_24_var.inner, ret_conv_24_var.is_owned);
36923                 ret_arr_ptr[y] = ret_conv_24_ref;
36924         }
36925         
36926         FREE(ret_var.data);
36927         return ret_arr;
36928 }
36929
36930 int64_t  CS_LDK_OutputSweeper_current_best_block(int64_t this_arg) {
36931         LDKOutputSweeper this_arg_conv;
36932         this_arg_conv.inner = untag_ptr(this_arg);
36933         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36934         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36935         this_arg_conv.is_owned = false;
36936         LDKBestBlock ret_var = OutputSweeper_current_best_block(&this_arg_conv);
36937         int64_t ret_ref = 0;
36938         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36939         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36940         return ret_ref;
36941 }
36942
36943 int64_t  CS_LDK_OutputSweeper_as_Listen(int64_t this_arg) {
36944         LDKOutputSweeper this_arg_conv;
36945         this_arg_conv.inner = untag_ptr(this_arg);
36946         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36947         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36948         this_arg_conv.is_owned = false;
36949         LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
36950         *ret_ret = OutputSweeper_as_Listen(&this_arg_conv);
36951         return tag_ptr(ret_ret, true);
36952 }
36953
36954 int64_t  CS_LDK_OutputSweeper_as_Confirm(int64_t this_arg) {
36955         LDKOutputSweeper this_arg_conv;
36956         this_arg_conv.inner = untag_ptr(this_arg);
36957         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36958         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36959         this_arg_conv.is_owned = false;
36960         LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
36961         *ret_ret = OutputSweeper_as_Confirm(&this_arg_conv);
36962         return tag_ptr(ret_ret, true);
36963 }
36964
36965 void  CS_LDK_SpendingDelay_free(int64_t this_ptr) {
36966         if (!ptr_is_owned(this_ptr)) return;
36967         void* this_ptr_ptr = untag_ptr(this_ptr);
36968         CHECK_ACCESS(this_ptr_ptr);
36969         LDKSpendingDelay this_ptr_conv = *(LDKSpendingDelay*)(this_ptr_ptr);
36970         FREE(untag_ptr(this_ptr));
36971         SpendingDelay_free(this_ptr_conv);
36972 }
36973
36974 static inline uint64_t SpendingDelay_clone_ptr(LDKSpendingDelay *NONNULL_PTR arg) {
36975         LDKSpendingDelay *ret_copy = MALLOC(sizeof(LDKSpendingDelay), "LDKSpendingDelay");
36976         *ret_copy = SpendingDelay_clone(arg);
36977         int64_t ret_ref = tag_ptr(ret_copy, true);
36978         return ret_ref;
36979 }
36980 int64_t  CS_LDK_SpendingDelay_clone_ptr(int64_t arg) {
36981         LDKSpendingDelay* arg_conv = (LDKSpendingDelay*)untag_ptr(arg);
36982         int64_t ret_conv = SpendingDelay_clone_ptr(arg_conv);
36983         return ret_conv;
36984 }
36985
36986 int64_t  CS_LDK_SpendingDelay_clone(int64_t orig) {
36987         LDKSpendingDelay* orig_conv = (LDKSpendingDelay*)untag_ptr(orig);
36988         LDKSpendingDelay *ret_copy = MALLOC(sizeof(LDKSpendingDelay), "LDKSpendingDelay");
36989         *ret_copy = SpendingDelay_clone(orig_conv);
36990         int64_t ret_ref = tag_ptr(ret_copy, true);
36991         return ret_ref;
36992 }
36993
36994 int64_t  CS_LDK_SpendingDelay_relative(int32_t num_blocks) {
36995         LDKSpendingDelay *ret_copy = MALLOC(sizeof(LDKSpendingDelay), "LDKSpendingDelay");
36996         *ret_copy = SpendingDelay_relative(num_blocks);
36997         int64_t ret_ref = tag_ptr(ret_copy, true);
36998         return ret_ref;
36999 }
37000
37001 int64_t  CS_LDK_SpendingDelay_absolute(int32_t height) {
37002         LDKSpendingDelay *ret_copy = MALLOC(sizeof(LDKSpendingDelay), "LDKSpendingDelay");
37003         *ret_copy = SpendingDelay_absolute(height);
37004         int64_t ret_ref = tag_ptr(ret_copy, true);
37005         return ret_ref;
37006 }
37007
37008 int64_t  CS_LDK_OutputSweeper_read(int8_tArray ser, int64_t arg_a, int64_t arg_b, int64_t arg_c, int64_t arg_d, int64_t arg_e, int64_t arg_f, int64_t arg_g) {
37009         LDKu8slice ser_ref;
37010         ser_ref.datalen = ser->arr_len;
37011         ser_ref.data = ser->elems;
37012         void* arg_a_ptr = untag_ptr(arg_a);
37013         CHECK_ACCESS(arg_a_ptr);
37014         LDKBroadcasterInterface arg_a_conv = *(LDKBroadcasterInterface*)(arg_a_ptr);
37015         if (arg_a_conv.free == LDKBroadcasterInterface_JCalls_free) {
37016                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37017                 LDKBroadcasterInterface_JCalls_cloned(&arg_a_conv);
37018         }
37019         void* arg_b_ptr = untag_ptr(arg_b);
37020         CHECK_ACCESS(arg_b_ptr);
37021         LDKFeeEstimator arg_b_conv = *(LDKFeeEstimator*)(arg_b_ptr);
37022         if (arg_b_conv.free == LDKFeeEstimator_JCalls_free) {
37023                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37024                 LDKFeeEstimator_JCalls_cloned(&arg_b_conv);
37025         }
37026         void* arg_c_ptr = untag_ptr(arg_c);
37027         CHECK_ACCESS(arg_c_ptr);
37028         LDKCOption_FilterZ arg_c_conv = *(LDKCOption_FilterZ*)(arg_c_ptr);
37029         // WARNING: we may need a move here but no clone is available for LDKCOption_FilterZ
37030         if (arg_c_conv.tag == LDKCOption_FilterZ_Some) {
37031                 // Manually implement clone for Java trait instances
37032                 if (arg_c_conv.some.free == LDKFilter_JCalls_free) {
37033                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37034                         LDKFilter_JCalls_cloned(&arg_c_conv.some);
37035                 }
37036         }
37037         void* arg_d_ptr = untag_ptr(arg_d);
37038         CHECK_ACCESS(arg_d_ptr);
37039         LDKOutputSpender arg_d_conv = *(LDKOutputSpender*)(arg_d_ptr);
37040         if (arg_d_conv.free == LDKOutputSpender_JCalls_free) {
37041                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37042                 LDKOutputSpender_JCalls_cloned(&arg_d_conv);
37043         }
37044         void* arg_e_ptr = untag_ptr(arg_e);
37045         CHECK_ACCESS(arg_e_ptr);
37046         LDKChangeDestinationSource arg_e_conv = *(LDKChangeDestinationSource*)(arg_e_ptr);
37047         if (arg_e_conv.free == LDKChangeDestinationSource_JCalls_free) {
37048                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37049                 LDKChangeDestinationSource_JCalls_cloned(&arg_e_conv);
37050         }
37051         void* arg_f_ptr = untag_ptr(arg_f);
37052         CHECK_ACCESS(arg_f_ptr);
37053         LDKKVStore arg_f_conv = *(LDKKVStore*)(arg_f_ptr);
37054         if (arg_f_conv.free == LDKKVStore_JCalls_free) {
37055                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37056                 LDKKVStore_JCalls_cloned(&arg_f_conv);
37057         }
37058         void* arg_g_ptr = untag_ptr(arg_g);
37059         CHECK_ACCESS(arg_g_ptr);
37060         LDKLogger arg_g_conv = *(LDKLogger*)(arg_g_ptr);
37061         if (arg_g_conv.free == LDKLogger_JCalls_free) {
37062                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37063                 LDKLogger_JCalls_cloned(&arg_g_conv);
37064         }
37065         LDKCResult_OutputSweeperDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutputSweeperDecodeErrorZ), "LDKCResult_OutputSweeperDecodeErrorZ");
37066         *ret_conv = OutputSweeper_read(ser_ref, arg_a_conv, arg_b_conv, arg_c_conv, arg_d_conv, arg_e_conv, arg_f_conv, arg_g_conv);
37067         FREE(ser);
37068         return tag_ptr(ret_conv, true);
37069 }
37070
37071 int64_t  CS_LDK_C2Tuple_BestBlockOutputSweeperZ_read(int8_tArray ser, int64_t arg_a, int64_t arg_b, int64_t arg_c, int64_t arg_d, int64_t arg_e, int64_t arg_f, int64_t arg_g) {
37072         LDKu8slice ser_ref;
37073         ser_ref.datalen = ser->arr_len;
37074         ser_ref.data = ser->elems;
37075         void* arg_a_ptr = untag_ptr(arg_a);
37076         CHECK_ACCESS(arg_a_ptr);
37077         LDKBroadcasterInterface arg_a_conv = *(LDKBroadcasterInterface*)(arg_a_ptr);
37078         if (arg_a_conv.free == LDKBroadcasterInterface_JCalls_free) {
37079                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37080                 LDKBroadcasterInterface_JCalls_cloned(&arg_a_conv);
37081         }
37082         void* arg_b_ptr = untag_ptr(arg_b);
37083         CHECK_ACCESS(arg_b_ptr);
37084         LDKFeeEstimator arg_b_conv = *(LDKFeeEstimator*)(arg_b_ptr);
37085         if (arg_b_conv.free == LDKFeeEstimator_JCalls_free) {
37086                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37087                 LDKFeeEstimator_JCalls_cloned(&arg_b_conv);
37088         }
37089         void* arg_c_ptr = untag_ptr(arg_c);
37090         CHECK_ACCESS(arg_c_ptr);
37091         LDKCOption_FilterZ arg_c_conv = *(LDKCOption_FilterZ*)(arg_c_ptr);
37092         // WARNING: we may need a move here but no clone is available for LDKCOption_FilterZ
37093         if (arg_c_conv.tag == LDKCOption_FilterZ_Some) {
37094                 // Manually implement clone for Java trait instances
37095                 if (arg_c_conv.some.free == LDKFilter_JCalls_free) {
37096                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37097                         LDKFilter_JCalls_cloned(&arg_c_conv.some);
37098                 }
37099         }
37100         void* arg_d_ptr = untag_ptr(arg_d);
37101         CHECK_ACCESS(arg_d_ptr);
37102         LDKOutputSpender arg_d_conv = *(LDKOutputSpender*)(arg_d_ptr);
37103         if (arg_d_conv.free == LDKOutputSpender_JCalls_free) {
37104                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37105                 LDKOutputSpender_JCalls_cloned(&arg_d_conv);
37106         }
37107         void* arg_e_ptr = untag_ptr(arg_e);
37108         CHECK_ACCESS(arg_e_ptr);
37109         LDKChangeDestinationSource arg_e_conv = *(LDKChangeDestinationSource*)(arg_e_ptr);
37110         if (arg_e_conv.free == LDKChangeDestinationSource_JCalls_free) {
37111                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37112                 LDKChangeDestinationSource_JCalls_cloned(&arg_e_conv);
37113         }
37114         void* arg_f_ptr = untag_ptr(arg_f);
37115         CHECK_ACCESS(arg_f_ptr);
37116         LDKKVStore arg_f_conv = *(LDKKVStore*)(arg_f_ptr);
37117         if (arg_f_conv.free == LDKKVStore_JCalls_free) {
37118                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37119                 LDKKVStore_JCalls_cloned(&arg_f_conv);
37120         }
37121         void* arg_g_ptr = untag_ptr(arg_g);
37122         CHECK_ACCESS(arg_g_ptr);
37123         LDKLogger arg_g_conv = *(LDKLogger*)(arg_g_ptr);
37124         if (arg_g_conv.free == LDKLogger_JCalls_free) {
37125                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37126                 LDKLogger_JCalls_cloned(&arg_g_conv);
37127         }
37128         LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ), "LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ");
37129         *ret_conv = C2Tuple_BestBlockOutputSweeperZ_read(ser_ref, arg_a_conv, arg_b_conv, arg_c_conv, arg_d_conv, arg_e_conv, arg_f_conv, arg_g_conv);
37130         FREE(ser);
37131         return tag_ptr(ret_conv, true);
37132 }
37133
37134 void  CS_LDK_FutureCallback_free(int64_t this_ptr) {
37135         if (!ptr_is_owned(this_ptr)) return;
37136         void* this_ptr_ptr = untag_ptr(this_ptr);
37137         CHECK_ACCESS(this_ptr_ptr);
37138         LDKFutureCallback this_ptr_conv = *(LDKFutureCallback*)(this_ptr_ptr);
37139         FREE(untag_ptr(this_ptr));
37140         FutureCallback_free(this_ptr_conv);
37141 }
37142
37143 void  CS_LDK_Future_free(int64_t this_obj) {
37144         LDKFuture this_obj_conv;
37145         this_obj_conv.inner = untag_ptr(this_obj);
37146         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37147         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37148         Future_free(this_obj_conv);
37149 }
37150
37151 void  CS_LDK_Future_register_callback_fn(int64_t this_arg, int64_t callback) {
37152         LDKFuture this_arg_conv;
37153         this_arg_conv.inner = untag_ptr(this_arg);
37154         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37155         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37156         this_arg_conv.is_owned = false;
37157         void* callback_ptr = untag_ptr(callback);
37158         CHECK_ACCESS(callback_ptr);
37159         LDKFutureCallback callback_conv = *(LDKFutureCallback*)(callback_ptr);
37160         if (callback_conv.free == LDKFutureCallback_JCalls_free) {
37161                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37162                 LDKFutureCallback_JCalls_cloned(&callback_conv);
37163         }
37164         Future_register_callback_fn(&this_arg_conv, callback_conv);
37165 }
37166
37167 void  CS_LDK_Future_wait(int64_t this_arg) {
37168         LDKFuture this_arg_conv;
37169         this_arg_conv.inner = untag_ptr(this_arg);
37170         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37171         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37172         this_arg_conv.is_owned = false;
37173         Future_wait(&this_arg_conv);
37174 }
37175
37176 jboolean  CS_LDK_Future_wait_timeout(int64_t this_arg, int64_t max_wait) {
37177         LDKFuture this_arg_conv;
37178         this_arg_conv.inner = untag_ptr(this_arg);
37179         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37180         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37181         this_arg_conv.is_owned = false;
37182         jboolean ret_conv = Future_wait_timeout(&this_arg_conv, max_wait);
37183         return ret_conv;
37184 }
37185
37186 void  CS_LDK_Sleeper_free(int64_t this_obj) {
37187         LDKSleeper this_obj_conv;
37188         this_obj_conv.inner = untag_ptr(this_obj);
37189         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37190         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37191         Sleeper_free(this_obj_conv);
37192 }
37193
37194 int64_t  CS_LDK_Sleeper_from_single_future(int64_t future) {
37195         LDKFuture future_conv;
37196         future_conv.inner = untag_ptr(future);
37197         future_conv.is_owned = ptr_is_owned(future);
37198         CHECK_INNER_FIELD_ACCESS_OR_NULL(future_conv);
37199         future_conv.is_owned = false;
37200         LDKSleeper ret_var = Sleeper_from_single_future(&future_conv);
37201         int64_t ret_ref = 0;
37202         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37203         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37204         return ret_ref;
37205 }
37206
37207 int64_t  CS_LDK_Sleeper_from_two_futures(int64_t fut_a, int64_t fut_b) {
37208         LDKFuture fut_a_conv;
37209         fut_a_conv.inner = untag_ptr(fut_a);
37210         fut_a_conv.is_owned = ptr_is_owned(fut_a);
37211         CHECK_INNER_FIELD_ACCESS_OR_NULL(fut_a_conv);
37212         fut_a_conv.is_owned = false;
37213         LDKFuture fut_b_conv;
37214         fut_b_conv.inner = untag_ptr(fut_b);
37215         fut_b_conv.is_owned = ptr_is_owned(fut_b);
37216         CHECK_INNER_FIELD_ACCESS_OR_NULL(fut_b_conv);
37217         fut_b_conv.is_owned = false;
37218         LDKSleeper ret_var = Sleeper_from_two_futures(&fut_a_conv, &fut_b_conv);
37219         int64_t ret_ref = 0;
37220         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37221         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37222         return ret_ref;
37223 }
37224
37225 int64_t  CS_LDK_Sleeper_new(int64_tArray futures) {
37226         LDKCVec_FutureZ futures_constr;
37227         futures_constr.datalen = futures->arr_len;
37228         if (futures_constr.datalen > 0)
37229                 futures_constr.data = MALLOC(futures_constr.datalen * sizeof(LDKFuture), "LDKCVec_FutureZ Elements");
37230         else
37231                 futures_constr.data = NULL;
37232         int64_t* futures_vals = futures->elems;
37233         for (size_t i = 0; i < futures_constr.datalen; i++) {
37234                 int64_t futures_conv_8 = futures_vals[i];
37235                 LDKFuture futures_conv_8_conv;
37236                 futures_conv_8_conv.inner = untag_ptr(futures_conv_8);
37237                 futures_conv_8_conv.is_owned = ptr_is_owned(futures_conv_8);
37238                 CHECK_INNER_FIELD_ACCESS_OR_NULL(futures_conv_8_conv);
37239                 // WARNING: we need a move here but no clone is available for LDKFuture
37240                 
37241                 futures_constr.data[i] = futures_conv_8_conv;
37242         }
37243         FREE(futures);
37244         LDKSleeper ret_var = Sleeper_new(futures_constr);
37245         int64_t ret_ref = 0;
37246         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37247         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37248         return ret_ref;
37249 }
37250
37251 void  CS_LDK_Sleeper_wait(int64_t this_arg) {
37252         LDKSleeper this_arg_conv;
37253         this_arg_conv.inner = untag_ptr(this_arg);
37254         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37255         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37256         this_arg_conv.is_owned = false;
37257         Sleeper_wait(&this_arg_conv);
37258 }
37259
37260 jboolean  CS_LDK_Sleeper_wait_timeout(int64_t this_arg, int64_t max_wait) {
37261         LDKSleeper this_arg_conv;
37262         this_arg_conv.inner = untag_ptr(this_arg);
37263         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37264         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37265         this_arg_conv.is_owned = false;
37266         jboolean ret_conv = Sleeper_wait_timeout(&this_arg_conv, max_wait);
37267         return ret_conv;
37268 }
37269
37270 int32_t  CS_LDK_Level_clone(int64_t orig) {
37271         LDKLevel* orig_conv = (LDKLevel*)untag_ptr(orig);
37272         int32_t ret_conv = LDKLevel_to_cs(Level_clone(orig_conv));
37273         return ret_conv;
37274 }
37275
37276 int32_t  CS_LDK_Level_gossip() {
37277         int32_t ret_conv = LDKLevel_to_cs(Level_gossip());
37278         return ret_conv;
37279 }
37280
37281 int32_t  CS_LDK_Level_trace() {
37282         int32_t ret_conv = LDKLevel_to_cs(Level_trace());
37283         return ret_conv;
37284 }
37285
37286 int32_t  CS_LDK_Level_debug() {
37287         int32_t ret_conv = LDKLevel_to_cs(Level_debug());
37288         return ret_conv;
37289 }
37290
37291 int32_t  CS_LDK_Level_info() {
37292         int32_t ret_conv = LDKLevel_to_cs(Level_info());
37293         return ret_conv;
37294 }
37295
37296 int32_t  CS_LDK_Level_warn() {
37297         int32_t ret_conv = LDKLevel_to_cs(Level_warn());
37298         return ret_conv;
37299 }
37300
37301 int32_t  CS_LDK_Level_error() {
37302         int32_t ret_conv = LDKLevel_to_cs(Level_error());
37303         return ret_conv;
37304 }
37305
37306 jboolean  CS_LDK_Level_eq(int64_t a, int64_t b) {
37307         LDKLevel* a_conv = (LDKLevel*)untag_ptr(a);
37308         LDKLevel* b_conv = (LDKLevel*)untag_ptr(b);
37309         jboolean ret_conv = Level_eq(a_conv, b_conv);
37310         return ret_conv;
37311 }
37312
37313 int64_t  CS_LDK_Level_hash(int64_t o) {
37314         LDKLevel* o_conv = (LDKLevel*)untag_ptr(o);
37315         int64_t ret_conv = Level_hash(o_conv);
37316         return ret_conv;
37317 }
37318
37319 jstring  CS_LDK_Level_to_str(int64_t o) {
37320         LDKLevel* o_conv = (LDKLevel*)untag_ptr(o);
37321         LDKStr ret_str = Level_to_str(o_conv);
37322         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
37323         Str_free(ret_str);
37324         return ret_conv;
37325 }
37326
37327 int32_t  CS_LDK_Level_max() {
37328         int32_t ret_conv = LDKLevel_to_cs(Level_max());
37329         return ret_conv;
37330 }
37331
37332 void  CS_LDK_Record_free(int64_t this_obj) {
37333         LDKRecord this_obj_conv;
37334         this_obj_conv.inner = untag_ptr(this_obj);
37335         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37336         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37337         Record_free(this_obj_conv);
37338 }
37339
37340 int32_t  CS_LDK_Record_get_level(int64_t this_ptr) {
37341         LDKRecord this_ptr_conv;
37342         this_ptr_conv.inner = untag_ptr(this_ptr);
37343         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37344         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37345         this_ptr_conv.is_owned = false;
37346         int32_t ret_conv = LDKLevel_to_cs(Record_get_level(&this_ptr_conv));
37347         return ret_conv;
37348 }
37349
37350 void  CS_LDK_Record_set_level(int64_t this_ptr, int32_t val) {
37351         LDKRecord 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         LDKLevel val_conv = LDKLevel_from_cs(val);
37357         Record_set_level(&this_ptr_conv, val_conv);
37358 }
37359
37360 int8_tArray  CS_LDK_Record_get_peer_id(int64_t this_ptr) {
37361         LDKRecord this_ptr_conv;
37362         this_ptr_conv.inner = untag_ptr(this_ptr);
37363         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37364         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37365         this_ptr_conv.is_owned = false;
37366         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
37367         memcpy(ret_arr->elems, Record_get_peer_id(&this_ptr_conv).compressed_form, 33);
37368         return ret_arr;
37369 }
37370
37371 void  CS_LDK_Record_set_peer_id(int64_t this_ptr, int8_tArray val) {
37372         LDKRecord this_ptr_conv;
37373         this_ptr_conv.inner = untag_ptr(this_ptr);
37374         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37375         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37376         this_ptr_conv.is_owned = false;
37377         LDKPublicKey val_ref;
37378         CHECK(val->arr_len == 33);
37379         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
37380         Record_set_peer_id(&this_ptr_conv, val_ref);
37381 }
37382
37383 int64_t  CS_LDK_Record_get_channel_id(int64_t this_ptr) {
37384         LDKRecord this_ptr_conv;
37385         this_ptr_conv.inner = untag_ptr(this_ptr);
37386         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37387         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37388         this_ptr_conv.is_owned = false;
37389         LDKChannelId ret_var = Record_get_channel_id(&this_ptr_conv);
37390         int64_t ret_ref = 0;
37391         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37392         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37393         return ret_ref;
37394 }
37395
37396 void  CS_LDK_Record_set_channel_id(int64_t this_ptr, int64_t val) {
37397         LDKRecord this_ptr_conv;
37398         this_ptr_conv.inner = untag_ptr(this_ptr);
37399         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37400         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37401         this_ptr_conv.is_owned = false;
37402         LDKChannelId val_conv;
37403         val_conv.inner = untag_ptr(val);
37404         val_conv.is_owned = ptr_is_owned(val);
37405         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
37406         val_conv = ChannelId_clone(&val_conv);
37407         Record_set_channel_id(&this_ptr_conv, val_conv);
37408 }
37409
37410 jstring  CS_LDK_Record_get_args(int64_t this_ptr) {
37411         LDKRecord this_ptr_conv;
37412         this_ptr_conv.inner = untag_ptr(this_ptr);
37413         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37414         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37415         this_ptr_conv.is_owned = false;
37416         LDKStr ret_str = Record_get_args(&this_ptr_conv);
37417         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
37418         Str_free(ret_str);
37419         return ret_conv;
37420 }
37421
37422 void  CS_LDK_Record_set_args(int64_t this_ptr, jstring val) {
37423         LDKRecord this_ptr_conv;
37424         this_ptr_conv.inner = untag_ptr(this_ptr);
37425         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37426         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37427         this_ptr_conv.is_owned = false;
37428         LDKStr val_conv = str_ref_to_owned_c(val);
37429         Record_set_args(&this_ptr_conv, val_conv);
37430 }
37431
37432 jstring  CS_LDK_Record_get_module_path(int64_t this_ptr) {
37433         LDKRecord this_ptr_conv;
37434         this_ptr_conv.inner = untag_ptr(this_ptr);
37435         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37436         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37437         this_ptr_conv.is_owned = false;
37438         LDKStr ret_str = Record_get_module_path(&this_ptr_conv);
37439         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
37440         Str_free(ret_str);
37441         return ret_conv;
37442 }
37443
37444 void  CS_LDK_Record_set_module_path(int64_t this_ptr, jstring val) {
37445         LDKRecord this_ptr_conv;
37446         this_ptr_conv.inner = untag_ptr(this_ptr);
37447         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37448         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37449         this_ptr_conv.is_owned = false;
37450         LDKStr val_conv = str_ref_to_owned_c(val);
37451         Record_set_module_path(&this_ptr_conv, val_conv);
37452 }
37453
37454 jstring  CS_LDK_Record_get_file(int64_t this_ptr) {
37455         LDKRecord 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         LDKStr ret_str = Record_get_file(&this_ptr_conv);
37461         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
37462         Str_free(ret_str);
37463         return ret_conv;
37464 }
37465
37466 void  CS_LDK_Record_set_file(int64_t this_ptr, jstring val) {
37467         LDKRecord 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         LDKStr val_conv = str_ref_to_owned_c(val);
37473         Record_set_file(&this_ptr_conv, val_conv);
37474 }
37475
37476 int32_t  CS_LDK_Record_get_line(int64_t this_ptr) {
37477         LDKRecord this_ptr_conv;
37478         this_ptr_conv.inner = untag_ptr(this_ptr);
37479         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37480         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37481         this_ptr_conv.is_owned = false;
37482         int32_t ret_conv = Record_get_line(&this_ptr_conv);
37483         return ret_conv;
37484 }
37485
37486 void  CS_LDK_Record_set_line(int64_t this_ptr, int32_t val) {
37487         LDKRecord this_ptr_conv;
37488         this_ptr_conv.inner = untag_ptr(this_ptr);
37489         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37490         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37491         this_ptr_conv.is_owned = false;
37492         Record_set_line(&this_ptr_conv, val);
37493 }
37494
37495 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) {
37496         LDKLevel level_arg_conv = LDKLevel_from_cs(level_arg);
37497         LDKPublicKey peer_id_arg_ref;
37498         CHECK(peer_id_arg->arr_len == 33);
37499         memcpy(peer_id_arg_ref.compressed_form, peer_id_arg->elems, 33); FREE(peer_id_arg);
37500         LDKChannelId channel_id_arg_conv;
37501         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
37502         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
37503         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
37504         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
37505         LDKStr args_arg_conv = str_ref_to_owned_c(args_arg);
37506         LDKStr module_path_arg_conv = str_ref_to_owned_c(module_path_arg);
37507         LDKStr file_arg_conv = str_ref_to_owned_c(file_arg);
37508         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);
37509         int64_t ret_ref = 0;
37510         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37511         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37512         return ret_ref;
37513 }
37514
37515 static inline uint64_t Record_clone_ptr(LDKRecord *NONNULL_PTR arg) {
37516         LDKRecord ret_var = Record_clone(arg);
37517         int64_t ret_ref = 0;
37518         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37519         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37520         return ret_ref;
37521 }
37522 int64_t  CS_LDK_Record_clone_ptr(int64_t arg) {
37523         LDKRecord arg_conv;
37524         arg_conv.inner = untag_ptr(arg);
37525         arg_conv.is_owned = ptr_is_owned(arg);
37526         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37527         arg_conv.is_owned = false;
37528         int64_t ret_conv = Record_clone_ptr(&arg_conv);
37529         return ret_conv;
37530 }
37531
37532 int64_t  CS_LDK_Record_clone(int64_t orig) {
37533         LDKRecord orig_conv;
37534         orig_conv.inner = untag_ptr(orig);
37535         orig_conv.is_owned = ptr_is_owned(orig);
37536         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37537         orig_conv.is_owned = false;
37538         LDKRecord ret_var = Record_clone(&orig_conv);
37539         int64_t ret_ref = 0;
37540         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37541         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37542         return ret_ref;
37543 }
37544
37545 void  CS_LDK_Logger_free(int64_t this_ptr) {
37546         if (!ptr_is_owned(this_ptr)) return;
37547         void* this_ptr_ptr = untag_ptr(this_ptr);
37548         CHECK_ACCESS(this_ptr_ptr);
37549         LDKLogger this_ptr_conv = *(LDKLogger*)(this_ptr_ptr);
37550         FREE(untag_ptr(this_ptr));
37551         Logger_free(this_ptr_conv);
37552 }
37553
37554 void  CS_LDK_ChannelHandshakeConfig_free(int64_t this_obj) {
37555         LDKChannelHandshakeConfig this_obj_conv;
37556         this_obj_conv.inner = untag_ptr(this_obj);
37557         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37558         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37559         ChannelHandshakeConfig_free(this_obj_conv);
37560 }
37561
37562 int32_t  CS_LDK_ChannelHandshakeConfig_get_minimum_depth(int64_t this_ptr) {
37563         LDKChannelHandshakeConfig this_ptr_conv;
37564         this_ptr_conv.inner = untag_ptr(this_ptr);
37565         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37566         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37567         this_ptr_conv.is_owned = false;
37568         int32_t ret_conv = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
37569         return ret_conv;
37570 }
37571
37572 void  CS_LDK_ChannelHandshakeConfig_set_minimum_depth(int64_t this_ptr, int32_t val) {
37573         LDKChannelHandshakeConfig this_ptr_conv;
37574         this_ptr_conv.inner = untag_ptr(this_ptr);
37575         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37576         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37577         this_ptr_conv.is_owned = false;
37578         ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
37579 }
37580
37581 int16_t  CS_LDK_ChannelHandshakeConfig_get_our_to_self_delay(int64_t this_ptr) {
37582         LDKChannelHandshakeConfig this_ptr_conv;
37583         this_ptr_conv.inner = untag_ptr(this_ptr);
37584         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37585         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37586         this_ptr_conv.is_owned = false;
37587         int16_t ret_conv = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
37588         return ret_conv;
37589 }
37590
37591 void  CS_LDK_ChannelHandshakeConfig_set_our_to_self_delay(int64_t this_ptr, int16_t val) {
37592         LDKChannelHandshakeConfig this_ptr_conv;
37593         this_ptr_conv.inner = untag_ptr(this_ptr);
37594         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37595         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37596         this_ptr_conv.is_owned = false;
37597         ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
37598 }
37599
37600 int64_t  CS_LDK_ChannelHandshakeConfig_get_our_htlc_minimum_msat(int64_t this_ptr) {
37601         LDKChannelHandshakeConfig this_ptr_conv;
37602         this_ptr_conv.inner = untag_ptr(this_ptr);
37603         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37604         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37605         this_ptr_conv.is_owned = false;
37606         int64_t ret_conv = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
37607         return ret_conv;
37608 }
37609
37610 void  CS_LDK_ChannelHandshakeConfig_set_our_htlc_minimum_msat(int64_t this_ptr, int64_t val) {
37611         LDKChannelHandshakeConfig this_ptr_conv;
37612         this_ptr_conv.inner = untag_ptr(this_ptr);
37613         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37614         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37615         this_ptr_conv.is_owned = false;
37616         ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
37617 }
37618
37619 int8_t  CS_LDK_ChannelHandshakeConfig_get_max_inbound_htlc_value_in_flight_percent_of_channel(int64_t this_ptr) {
37620         LDKChannelHandshakeConfig this_ptr_conv;
37621         this_ptr_conv.inner = untag_ptr(this_ptr);
37622         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37623         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37624         this_ptr_conv.is_owned = false;
37625         int8_t ret_conv = ChannelHandshakeConfig_get_max_inbound_htlc_value_in_flight_percent_of_channel(&this_ptr_conv);
37626         return ret_conv;
37627 }
37628
37629 void  CS_LDK_ChannelHandshakeConfig_set_max_inbound_htlc_value_in_flight_percent_of_channel(int64_t this_ptr, int8_t val) {
37630         LDKChannelHandshakeConfig this_ptr_conv;
37631         this_ptr_conv.inner = untag_ptr(this_ptr);
37632         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37633         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37634         this_ptr_conv.is_owned = false;
37635         ChannelHandshakeConfig_set_max_inbound_htlc_value_in_flight_percent_of_channel(&this_ptr_conv, val);
37636 }
37637
37638 jboolean  CS_LDK_ChannelHandshakeConfig_get_negotiate_scid_privacy(int64_t this_ptr) {
37639         LDKChannelHandshakeConfig this_ptr_conv;
37640         this_ptr_conv.inner = untag_ptr(this_ptr);
37641         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37642         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37643         this_ptr_conv.is_owned = false;
37644         jboolean ret_conv = ChannelHandshakeConfig_get_negotiate_scid_privacy(&this_ptr_conv);
37645         return ret_conv;
37646 }
37647
37648 void  CS_LDK_ChannelHandshakeConfig_set_negotiate_scid_privacy(int64_t this_ptr, jboolean val) {
37649         LDKChannelHandshakeConfig this_ptr_conv;
37650         this_ptr_conv.inner = untag_ptr(this_ptr);
37651         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37652         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37653         this_ptr_conv.is_owned = false;
37654         ChannelHandshakeConfig_set_negotiate_scid_privacy(&this_ptr_conv, val);
37655 }
37656
37657 jboolean  CS_LDK_ChannelHandshakeConfig_get_announced_channel(int64_t this_ptr) {
37658         LDKChannelHandshakeConfig this_ptr_conv;
37659         this_ptr_conv.inner = untag_ptr(this_ptr);
37660         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37661         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37662         this_ptr_conv.is_owned = false;
37663         jboolean ret_conv = ChannelHandshakeConfig_get_announced_channel(&this_ptr_conv);
37664         return ret_conv;
37665 }
37666
37667 void  CS_LDK_ChannelHandshakeConfig_set_announced_channel(int64_t this_ptr, jboolean val) {
37668         LDKChannelHandshakeConfig this_ptr_conv;
37669         this_ptr_conv.inner = untag_ptr(this_ptr);
37670         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37671         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37672         this_ptr_conv.is_owned = false;
37673         ChannelHandshakeConfig_set_announced_channel(&this_ptr_conv, val);
37674 }
37675
37676 jboolean  CS_LDK_ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey(int64_t this_ptr) {
37677         LDKChannelHandshakeConfig this_ptr_conv;
37678         this_ptr_conv.inner = untag_ptr(this_ptr);
37679         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37680         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37681         this_ptr_conv.is_owned = false;
37682         jboolean ret_conv = ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
37683         return ret_conv;
37684 }
37685
37686 void  CS_LDK_ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey(int64_t this_ptr, jboolean val) {
37687         LDKChannelHandshakeConfig this_ptr_conv;
37688         this_ptr_conv.inner = untag_ptr(this_ptr);
37689         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37690         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37691         this_ptr_conv.is_owned = false;
37692         ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
37693 }
37694
37695 int32_t  CS_LDK_ChannelHandshakeConfig_get_their_channel_reserve_proportional_millionths(int64_t this_ptr) {
37696         LDKChannelHandshakeConfig this_ptr_conv;
37697         this_ptr_conv.inner = untag_ptr(this_ptr);
37698         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37699         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37700         this_ptr_conv.is_owned = false;
37701         int32_t ret_conv = ChannelHandshakeConfig_get_their_channel_reserve_proportional_millionths(&this_ptr_conv);
37702         return ret_conv;
37703 }
37704
37705 void  CS_LDK_ChannelHandshakeConfig_set_their_channel_reserve_proportional_millionths(int64_t this_ptr, int32_t val) {
37706         LDKChannelHandshakeConfig this_ptr_conv;
37707         this_ptr_conv.inner = untag_ptr(this_ptr);
37708         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37709         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37710         this_ptr_conv.is_owned = false;
37711         ChannelHandshakeConfig_set_their_channel_reserve_proportional_millionths(&this_ptr_conv, val);
37712 }
37713
37714 jboolean  CS_LDK_ChannelHandshakeConfig_get_negotiate_anchors_zero_fee_htlc_tx(int64_t this_ptr) {
37715         LDKChannelHandshakeConfig this_ptr_conv;
37716         this_ptr_conv.inner = untag_ptr(this_ptr);
37717         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37718         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37719         this_ptr_conv.is_owned = false;
37720         jboolean ret_conv = ChannelHandshakeConfig_get_negotiate_anchors_zero_fee_htlc_tx(&this_ptr_conv);
37721         return ret_conv;
37722 }
37723
37724 void  CS_LDK_ChannelHandshakeConfig_set_negotiate_anchors_zero_fee_htlc_tx(int64_t this_ptr, jboolean val) {
37725         LDKChannelHandshakeConfig this_ptr_conv;
37726         this_ptr_conv.inner = untag_ptr(this_ptr);
37727         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37728         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37729         this_ptr_conv.is_owned = false;
37730         ChannelHandshakeConfig_set_negotiate_anchors_zero_fee_htlc_tx(&this_ptr_conv, val);
37731 }
37732
37733 int16_t  CS_LDK_ChannelHandshakeConfig_get_our_max_accepted_htlcs(int64_t this_ptr) {
37734         LDKChannelHandshakeConfig this_ptr_conv;
37735         this_ptr_conv.inner = untag_ptr(this_ptr);
37736         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37737         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37738         this_ptr_conv.is_owned = false;
37739         int16_t ret_conv = ChannelHandshakeConfig_get_our_max_accepted_htlcs(&this_ptr_conv);
37740         return ret_conv;
37741 }
37742
37743 void  CS_LDK_ChannelHandshakeConfig_set_our_max_accepted_htlcs(int64_t this_ptr, int16_t val) {
37744         LDKChannelHandshakeConfig this_ptr_conv;
37745         this_ptr_conv.inner = untag_ptr(this_ptr);
37746         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37747         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37748         this_ptr_conv.is_owned = false;
37749         ChannelHandshakeConfig_set_our_max_accepted_htlcs(&this_ptr_conv, val);
37750 }
37751
37752 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) {
37753         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);
37754         int64_t ret_ref = 0;
37755         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37756         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37757         return ret_ref;
37758 }
37759
37760 static inline uint64_t ChannelHandshakeConfig_clone_ptr(LDKChannelHandshakeConfig *NONNULL_PTR arg) {
37761         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(arg);
37762         int64_t ret_ref = 0;
37763         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37764         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37765         return ret_ref;
37766 }
37767 int64_t  CS_LDK_ChannelHandshakeConfig_clone_ptr(int64_t arg) {
37768         LDKChannelHandshakeConfig arg_conv;
37769         arg_conv.inner = untag_ptr(arg);
37770         arg_conv.is_owned = ptr_is_owned(arg);
37771         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37772         arg_conv.is_owned = false;
37773         int64_t ret_conv = ChannelHandshakeConfig_clone_ptr(&arg_conv);
37774         return ret_conv;
37775 }
37776
37777 int64_t  CS_LDK_ChannelHandshakeConfig_clone(int64_t orig) {
37778         LDKChannelHandshakeConfig orig_conv;
37779         orig_conv.inner = untag_ptr(orig);
37780         orig_conv.is_owned = ptr_is_owned(orig);
37781         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37782         orig_conv.is_owned = false;
37783         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
37784         int64_t ret_ref = 0;
37785         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37786         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37787         return ret_ref;
37788 }
37789
37790 int64_t  CS_LDK_ChannelHandshakeConfig_default() {
37791         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
37792         int64_t ret_ref = 0;
37793         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37794         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37795         return ret_ref;
37796 }
37797
37798 void  CS_LDK_ChannelHandshakeLimits_free(int64_t this_obj) {
37799         LDKChannelHandshakeLimits this_obj_conv;
37800         this_obj_conv.inner = untag_ptr(this_obj);
37801         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37802         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37803         ChannelHandshakeLimits_free(this_obj_conv);
37804 }
37805
37806 int64_t  CS_LDK_ChannelHandshakeLimits_get_min_funding_satoshis(int64_t this_ptr) {
37807         LDKChannelHandshakeLimits this_ptr_conv;
37808         this_ptr_conv.inner = untag_ptr(this_ptr);
37809         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37810         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37811         this_ptr_conv.is_owned = false;
37812         int64_t ret_conv = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
37813         return ret_conv;
37814 }
37815
37816 void  CS_LDK_ChannelHandshakeLimits_set_min_funding_satoshis(int64_t this_ptr, int64_t val) {
37817         LDKChannelHandshakeLimits this_ptr_conv;
37818         this_ptr_conv.inner = untag_ptr(this_ptr);
37819         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37820         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37821         this_ptr_conv.is_owned = false;
37822         ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
37823 }
37824
37825 int64_t  CS_LDK_ChannelHandshakeLimits_get_max_funding_satoshis(int64_t this_ptr) {
37826         LDKChannelHandshakeLimits this_ptr_conv;
37827         this_ptr_conv.inner = untag_ptr(this_ptr);
37828         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37829         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37830         this_ptr_conv.is_owned = false;
37831         int64_t ret_conv = ChannelHandshakeLimits_get_max_funding_satoshis(&this_ptr_conv);
37832         return ret_conv;
37833 }
37834
37835 void  CS_LDK_ChannelHandshakeLimits_set_max_funding_satoshis(int64_t this_ptr, int64_t val) {
37836         LDKChannelHandshakeLimits this_ptr_conv;
37837         this_ptr_conv.inner = untag_ptr(this_ptr);
37838         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37839         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37840         this_ptr_conv.is_owned = false;
37841         ChannelHandshakeLimits_set_max_funding_satoshis(&this_ptr_conv, val);
37842 }
37843
37844 int64_t  CS_LDK_ChannelHandshakeLimits_get_max_htlc_minimum_msat(int64_t this_ptr) {
37845         LDKChannelHandshakeLimits this_ptr_conv;
37846         this_ptr_conv.inner = untag_ptr(this_ptr);
37847         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37848         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37849         this_ptr_conv.is_owned = false;
37850         int64_t ret_conv = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
37851         return ret_conv;
37852 }
37853
37854 void  CS_LDK_ChannelHandshakeLimits_set_max_htlc_minimum_msat(int64_t this_ptr, int64_t val) {
37855         LDKChannelHandshakeLimits 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         ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
37861 }
37862
37863 int64_t  CS_LDK_ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(int64_t this_ptr) {
37864         LDKChannelHandshakeLimits this_ptr_conv;
37865         this_ptr_conv.inner = untag_ptr(this_ptr);
37866         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37867         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37868         this_ptr_conv.is_owned = false;
37869         int64_t ret_conv = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
37870         return ret_conv;
37871 }
37872
37873 void  CS_LDK_ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(int64_t this_ptr, int64_t val) {
37874         LDKChannelHandshakeLimits 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         ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
37880 }
37881
37882 int64_t  CS_LDK_ChannelHandshakeLimits_get_max_channel_reserve_satoshis(int64_t this_ptr) {
37883         LDKChannelHandshakeLimits this_ptr_conv;
37884         this_ptr_conv.inner = untag_ptr(this_ptr);
37885         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37886         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37887         this_ptr_conv.is_owned = false;
37888         int64_t ret_conv = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
37889         return ret_conv;
37890 }
37891
37892 void  CS_LDK_ChannelHandshakeLimits_set_max_channel_reserve_satoshis(int64_t this_ptr, int64_t val) {
37893         LDKChannelHandshakeLimits 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         ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
37899 }
37900
37901 int16_t  CS_LDK_ChannelHandshakeLimits_get_min_max_accepted_htlcs(int64_t this_ptr) {
37902         LDKChannelHandshakeLimits this_ptr_conv;
37903         this_ptr_conv.inner = untag_ptr(this_ptr);
37904         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37905         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37906         this_ptr_conv.is_owned = false;
37907         int16_t ret_conv = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
37908         return ret_conv;
37909 }
37910
37911 void  CS_LDK_ChannelHandshakeLimits_set_min_max_accepted_htlcs(int64_t this_ptr, int16_t val) {
37912         LDKChannelHandshakeLimits this_ptr_conv;
37913         this_ptr_conv.inner = untag_ptr(this_ptr);
37914         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37915         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37916         this_ptr_conv.is_owned = false;
37917         ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
37918 }
37919
37920 int32_t  CS_LDK_ChannelHandshakeLimits_get_max_minimum_depth(int64_t this_ptr) {
37921         LDKChannelHandshakeLimits this_ptr_conv;
37922         this_ptr_conv.inner = untag_ptr(this_ptr);
37923         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37924         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37925         this_ptr_conv.is_owned = false;
37926         int32_t ret_conv = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
37927         return ret_conv;
37928 }
37929
37930 void  CS_LDK_ChannelHandshakeLimits_set_max_minimum_depth(int64_t this_ptr, int32_t val) {
37931         LDKChannelHandshakeLimits this_ptr_conv;
37932         this_ptr_conv.inner = untag_ptr(this_ptr);
37933         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37934         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37935         this_ptr_conv.is_owned = false;
37936         ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
37937 }
37938
37939 jboolean  CS_LDK_ChannelHandshakeLimits_get_trust_own_funding_0conf(int64_t this_ptr) {
37940         LDKChannelHandshakeLimits this_ptr_conv;
37941         this_ptr_conv.inner = untag_ptr(this_ptr);
37942         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37943         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37944         this_ptr_conv.is_owned = false;
37945         jboolean ret_conv = ChannelHandshakeLimits_get_trust_own_funding_0conf(&this_ptr_conv);
37946         return ret_conv;
37947 }
37948
37949 void  CS_LDK_ChannelHandshakeLimits_set_trust_own_funding_0conf(int64_t this_ptr, jboolean val) {
37950         LDKChannelHandshakeLimits this_ptr_conv;
37951         this_ptr_conv.inner = untag_ptr(this_ptr);
37952         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37953         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37954         this_ptr_conv.is_owned = false;
37955         ChannelHandshakeLimits_set_trust_own_funding_0conf(&this_ptr_conv, val);
37956 }
37957
37958 jboolean  CS_LDK_ChannelHandshakeLimits_get_force_announced_channel_preference(int64_t this_ptr) {
37959         LDKChannelHandshakeLimits this_ptr_conv;
37960         this_ptr_conv.inner = untag_ptr(this_ptr);
37961         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37962         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37963         this_ptr_conv.is_owned = false;
37964         jboolean ret_conv = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
37965         return ret_conv;
37966 }
37967
37968 void  CS_LDK_ChannelHandshakeLimits_set_force_announced_channel_preference(int64_t this_ptr, jboolean val) {
37969         LDKChannelHandshakeLimits this_ptr_conv;
37970         this_ptr_conv.inner = untag_ptr(this_ptr);
37971         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37972         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37973         this_ptr_conv.is_owned = false;
37974         ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
37975 }
37976
37977 int16_t  CS_LDK_ChannelHandshakeLimits_get_their_to_self_delay(int64_t this_ptr) {
37978         LDKChannelHandshakeLimits this_ptr_conv;
37979         this_ptr_conv.inner = untag_ptr(this_ptr);
37980         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37981         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37982         this_ptr_conv.is_owned = false;
37983         int16_t ret_conv = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
37984         return ret_conv;
37985 }
37986
37987 void  CS_LDK_ChannelHandshakeLimits_set_their_to_self_delay(int64_t this_ptr, int16_t val) {
37988         LDKChannelHandshakeLimits this_ptr_conv;
37989         this_ptr_conv.inner = untag_ptr(this_ptr);
37990         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37991         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37992         this_ptr_conv.is_owned = false;
37993         ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
37994 }
37995
37996 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) {
37997         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);
37998         int64_t ret_ref = 0;
37999         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38000         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38001         return ret_ref;
38002 }
38003
38004 static inline uint64_t ChannelHandshakeLimits_clone_ptr(LDKChannelHandshakeLimits *NONNULL_PTR arg) {
38005         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(arg);
38006         int64_t ret_ref = 0;
38007         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38008         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38009         return ret_ref;
38010 }
38011 int64_t  CS_LDK_ChannelHandshakeLimits_clone_ptr(int64_t arg) {
38012         LDKChannelHandshakeLimits arg_conv;
38013         arg_conv.inner = untag_ptr(arg);
38014         arg_conv.is_owned = ptr_is_owned(arg);
38015         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38016         arg_conv.is_owned = false;
38017         int64_t ret_conv = ChannelHandshakeLimits_clone_ptr(&arg_conv);
38018         return ret_conv;
38019 }
38020
38021 int64_t  CS_LDK_ChannelHandshakeLimits_clone(int64_t orig) {
38022         LDKChannelHandshakeLimits orig_conv;
38023         orig_conv.inner = untag_ptr(orig);
38024         orig_conv.is_owned = ptr_is_owned(orig);
38025         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38026         orig_conv.is_owned = false;
38027         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
38028         int64_t ret_ref = 0;
38029         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38030         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38031         return ret_ref;
38032 }
38033
38034 int64_t  CS_LDK_ChannelHandshakeLimits_default() {
38035         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
38036         int64_t ret_ref = 0;
38037         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38038         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38039         return ret_ref;
38040 }
38041
38042 void  CS_LDK_MaxDustHTLCExposure_free(int64_t this_ptr) {
38043         if (!ptr_is_owned(this_ptr)) return;
38044         void* this_ptr_ptr = untag_ptr(this_ptr);
38045         CHECK_ACCESS(this_ptr_ptr);
38046         LDKMaxDustHTLCExposure this_ptr_conv = *(LDKMaxDustHTLCExposure*)(this_ptr_ptr);
38047         FREE(untag_ptr(this_ptr));
38048         MaxDustHTLCExposure_free(this_ptr_conv);
38049 }
38050
38051 static inline uint64_t MaxDustHTLCExposure_clone_ptr(LDKMaxDustHTLCExposure *NONNULL_PTR arg) {
38052         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
38053         *ret_copy = MaxDustHTLCExposure_clone(arg);
38054         int64_t ret_ref = tag_ptr(ret_copy, true);
38055         return ret_ref;
38056 }
38057 int64_t  CS_LDK_MaxDustHTLCExposure_clone_ptr(int64_t arg) {
38058         LDKMaxDustHTLCExposure* arg_conv = (LDKMaxDustHTLCExposure*)untag_ptr(arg);
38059         int64_t ret_conv = MaxDustHTLCExposure_clone_ptr(arg_conv);
38060         return ret_conv;
38061 }
38062
38063 int64_t  CS_LDK_MaxDustHTLCExposure_clone(int64_t orig) {
38064         LDKMaxDustHTLCExposure* orig_conv = (LDKMaxDustHTLCExposure*)untag_ptr(orig);
38065         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
38066         *ret_copy = MaxDustHTLCExposure_clone(orig_conv);
38067         int64_t ret_ref = tag_ptr(ret_copy, true);
38068         return ret_ref;
38069 }
38070
38071 int64_t  CS_LDK_MaxDustHTLCExposure_fixed_limit_msat(int64_t a) {
38072         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
38073         *ret_copy = MaxDustHTLCExposure_fixed_limit_msat(a);
38074         int64_t ret_ref = tag_ptr(ret_copy, true);
38075         return ret_ref;
38076 }
38077
38078 int64_t  CS_LDK_MaxDustHTLCExposure_fee_rate_multiplier(int64_t a) {
38079         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
38080         *ret_copy = MaxDustHTLCExposure_fee_rate_multiplier(a);
38081         int64_t ret_ref = tag_ptr(ret_copy, true);
38082         return ret_ref;
38083 }
38084
38085 jboolean  CS_LDK_MaxDustHTLCExposure_eq(int64_t a, int64_t b) {
38086         LDKMaxDustHTLCExposure* a_conv = (LDKMaxDustHTLCExposure*)untag_ptr(a);
38087         LDKMaxDustHTLCExposure* b_conv = (LDKMaxDustHTLCExposure*)untag_ptr(b);
38088         jboolean ret_conv = MaxDustHTLCExposure_eq(a_conv, b_conv);
38089         return ret_conv;
38090 }
38091
38092 int8_tArray  CS_LDK_MaxDustHTLCExposure_write(int64_t obj) {
38093         LDKMaxDustHTLCExposure* obj_conv = (LDKMaxDustHTLCExposure*)untag_ptr(obj);
38094         LDKCVec_u8Z ret_var = MaxDustHTLCExposure_write(obj_conv);
38095         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38096         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38097         CVec_u8Z_free(ret_var);
38098         return ret_arr;
38099 }
38100
38101 int64_t  CS_LDK_MaxDustHTLCExposure_read(int8_tArray ser) {
38102         LDKu8slice ser_ref;
38103         ser_ref.datalen = ser->arr_len;
38104         ser_ref.data = ser->elems;
38105         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
38106         *ret_conv = MaxDustHTLCExposure_read(ser_ref);
38107         FREE(ser);
38108         return tag_ptr(ret_conv, true);
38109 }
38110
38111 void  CS_LDK_ChannelConfig_free(int64_t this_obj) {
38112         LDKChannelConfig this_obj_conv;
38113         this_obj_conv.inner = untag_ptr(this_obj);
38114         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38115         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38116         ChannelConfig_free(this_obj_conv);
38117 }
38118
38119 int32_t  CS_LDK_ChannelConfig_get_forwarding_fee_proportional_millionths(int64_t this_ptr) {
38120         LDKChannelConfig this_ptr_conv;
38121         this_ptr_conv.inner = untag_ptr(this_ptr);
38122         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38123         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38124         this_ptr_conv.is_owned = false;
38125         int32_t ret_conv = ChannelConfig_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
38126         return ret_conv;
38127 }
38128
38129 void  CS_LDK_ChannelConfig_set_forwarding_fee_proportional_millionths(int64_t this_ptr, int32_t val) {
38130         LDKChannelConfig this_ptr_conv;
38131         this_ptr_conv.inner = untag_ptr(this_ptr);
38132         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38133         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38134         this_ptr_conv.is_owned = false;
38135         ChannelConfig_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val);
38136 }
38137
38138 int32_t  CS_LDK_ChannelConfig_get_forwarding_fee_base_msat(int64_t this_ptr) {
38139         LDKChannelConfig this_ptr_conv;
38140         this_ptr_conv.inner = untag_ptr(this_ptr);
38141         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38142         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38143         this_ptr_conv.is_owned = false;
38144         int32_t ret_conv = ChannelConfig_get_forwarding_fee_base_msat(&this_ptr_conv);
38145         return ret_conv;
38146 }
38147
38148 void  CS_LDK_ChannelConfig_set_forwarding_fee_base_msat(int64_t this_ptr, int32_t val) {
38149         LDKChannelConfig this_ptr_conv;
38150         this_ptr_conv.inner = untag_ptr(this_ptr);
38151         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38152         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38153         this_ptr_conv.is_owned = false;
38154         ChannelConfig_set_forwarding_fee_base_msat(&this_ptr_conv, val);
38155 }
38156
38157 int16_t  CS_LDK_ChannelConfig_get_cltv_expiry_delta(int64_t this_ptr) {
38158         LDKChannelConfig this_ptr_conv;
38159         this_ptr_conv.inner = untag_ptr(this_ptr);
38160         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38161         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38162         this_ptr_conv.is_owned = false;
38163         int16_t ret_conv = ChannelConfig_get_cltv_expiry_delta(&this_ptr_conv);
38164         return ret_conv;
38165 }
38166
38167 void  CS_LDK_ChannelConfig_set_cltv_expiry_delta(int64_t this_ptr, int16_t val) {
38168         LDKChannelConfig this_ptr_conv;
38169         this_ptr_conv.inner = untag_ptr(this_ptr);
38170         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38171         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38172         this_ptr_conv.is_owned = false;
38173         ChannelConfig_set_cltv_expiry_delta(&this_ptr_conv, val);
38174 }
38175
38176 int64_t  CS_LDK_ChannelConfig_get_max_dust_htlc_exposure(int64_t this_ptr) {
38177         LDKChannelConfig this_ptr_conv;
38178         this_ptr_conv.inner = untag_ptr(this_ptr);
38179         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38180         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38181         this_ptr_conv.is_owned = false;
38182         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
38183         *ret_copy = ChannelConfig_get_max_dust_htlc_exposure(&this_ptr_conv);
38184         int64_t ret_ref = tag_ptr(ret_copy, true);
38185         return ret_ref;
38186 }
38187
38188 void  CS_LDK_ChannelConfig_set_max_dust_htlc_exposure(int64_t this_ptr, int64_t val) {
38189         LDKChannelConfig this_ptr_conv;
38190         this_ptr_conv.inner = untag_ptr(this_ptr);
38191         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38192         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38193         this_ptr_conv.is_owned = false;
38194         void* val_ptr = untag_ptr(val);
38195         CHECK_ACCESS(val_ptr);
38196         LDKMaxDustHTLCExposure val_conv = *(LDKMaxDustHTLCExposure*)(val_ptr);
38197         val_conv = MaxDustHTLCExposure_clone((LDKMaxDustHTLCExposure*)untag_ptr(val));
38198         ChannelConfig_set_max_dust_htlc_exposure(&this_ptr_conv, val_conv);
38199 }
38200
38201 int64_t  CS_LDK_ChannelConfig_get_force_close_avoidance_max_fee_satoshis(int64_t this_ptr) {
38202         LDKChannelConfig this_ptr_conv;
38203         this_ptr_conv.inner = untag_ptr(this_ptr);
38204         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38205         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38206         this_ptr_conv.is_owned = false;
38207         int64_t ret_conv = ChannelConfig_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
38208         return ret_conv;
38209 }
38210
38211 void  CS_LDK_ChannelConfig_set_force_close_avoidance_max_fee_satoshis(int64_t this_ptr, int64_t val) {
38212         LDKChannelConfig this_ptr_conv;
38213         this_ptr_conv.inner = untag_ptr(this_ptr);
38214         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38215         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38216         this_ptr_conv.is_owned = false;
38217         ChannelConfig_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val);
38218 }
38219
38220 jboolean  CS_LDK_ChannelConfig_get_accept_underpaying_htlcs(int64_t this_ptr) {
38221         LDKChannelConfig this_ptr_conv;
38222         this_ptr_conv.inner = untag_ptr(this_ptr);
38223         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38224         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38225         this_ptr_conv.is_owned = false;
38226         jboolean ret_conv = ChannelConfig_get_accept_underpaying_htlcs(&this_ptr_conv);
38227         return ret_conv;
38228 }
38229
38230 void  CS_LDK_ChannelConfig_set_accept_underpaying_htlcs(int64_t this_ptr, jboolean val) {
38231         LDKChannelConfig this_ptr_conv;
38232         this_ptr_conv.inner = untag_ptr(this_ptr);
38233         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38234         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38235         this_ptr_conv.is_owned = false;
38236         ChannelConfig_set_accept_underpaying_htlcs(&this_ptr_conv, val);
38237 }
38238
38239 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) {
38240         void* max_dust_htlc_exposure_arg_ptr = untag_ptr(max_dust_htlc_exposure_arg);
38241         CHECK_ACCESS(max_dust_htlc_exposure_arg_ptr);
38242         LDKMaxDustHTLCExposure max_dust_htlc_exposure_arg_conv = *(LDKMaxDustHTLCExposure*)(max_dust_htlc_exposure_arg_ptr);
38243         max_dust_htlc_exposure_arg_conv = MaxDustHTLCExposure_clone((LDKMaxDustHTLCExposure*)untag_ptr(max_dust_htlc_exposure_arg));
38244         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);
38245         int64_t ret_ref = 0;
38246         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38247         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38248         return ret_ref;
38249 }
38250
38251 static inline uint64_t ChannelConfig_clone_ptr(LDKChannelConfig *NONNULL_PTR arg) {
38252         LDKChannelConfig ret_var = ChannelConfig_clone(arg);
38253         int64_t ret_ref = 0;
38254         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38255         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38256         return ret_ref;
38257 }
38258 int64_t  CS_LDK_ChannelConfig_clone_ptr(int64_t arg) {
38259         LDKChannelConfig arg_conv;
38260         arg_conv.inner = untag_ptr(arg);
38261         arg_conv.is_owned = ptr_is_owned(arg);
38262         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38263         arg_conv.is_owned = false;
38264         int64_t ret_conv = ChannelConfig_clone_ptr(&arg_conv);
38265         return ret_conv;
38266 }
38267
38268 int64_t  CS_LDK_ChannelConfig_clone(int64_t orig) {
38269         LDKChannelConfig orig_conv;
38270         orig_conv.inner = untag_ptr(orig);
38271         orig_conv.is_owned = ptr_is_owned(orig);
38272         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38273         orig_conv.is_owned = false;
38274         LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
38275         int64_t ret_ref = 0;
38276         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38277         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38278         return ret_ref;
38279 }
38280
38281 jboolean  CS_LDK_ChannelConfig_eq(int64_t a, int64_t b) {
38282         LDKChannelConfig a_conv;
38283         a_conv.inner = untag_ptr(a);
38284         a_conv.is_owned = ptr_is_owned(a);
38285         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38286         a_conv.is_owned = false;
38287         LDKChannelConfig b_conv;
38288         b_conv.inner = untag_ptr(b);
38289         b_conv.is_owned = ptr_is_owned(b);
38290         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38291         b_conv.is_owned = false;
38292         jboolean ret_conv = ChannelConfig_eq(&a_conv, &b_conv);
38293         return ret_conv;
38294 }
38295
38296 void  CS_LDK_ChannelConfig_apply(int64_t this_arg, int64_t update) {
38297         LDKChannelConfig this_arg_conv;
38298         this_arg_conv.inner = untag_ptr(this_arg);
38299         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38300         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38301         this_arg_conv.is_owned = false;
38302         LDKChannelConfigUpdate update_conv;
38303         update_conv.inner = untag_ptr(update);
38304         update_conv.is_owned = ptr_is_owned(update);
38305         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
38306         update_conv.is_owned = false;
38307         ChannelConfig_apply(&this_arg_conv, &update_conv);
38308 }
38309
38310 int64_t  CS_LDK_ChannelConfig_default() {
38311         LDKChannelConfig ret_var = ChannelConfig_default();
38312         int64_t ret_ref = 0;
38313         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38314         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38315         return ret_ref;
38316 }
38317
38318 int8_tArray  CS_LDK_ChannelConfig_write(int64_t obj) {
38319         LDKChannelConfig obj_conv;
38320         obj_conv.inner = untag_ptr(obj);
38321         obj_conv.is_owned = ptr_is_owned(obj);
38322         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38323         obj_conv.is_owned = false;
38324         LDKCVec_u8Z ret_var = ChannelConfig_write(&obj_conv);
38325         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38326         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38327         CVec_u8Z_free(ret_var);
38328         return ret_arr;
38329 }
38330
38331 int64_t  CS_LDK_ChannelConfig_read(int8_tArray ser) {
38332         LDKu8slice ser_ref;
38333         ser_ref.datalen = ser->arr_len;
38334         ser_ref.data = ser->elems;
38335         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
38336         *ret_conv = ChannelConfig_read(ser_ref);
38337         FREE(ser);
38338         return tag_ptr(ret_conv, true);
38339 }
38340
38341 void  CS_LDK_ChannelConfigUpdate_free(int64_t this_obj) {
38342         LDKChannelConfigUpdate this_obj_conv;
38343         this_obj_conv.inner = untag_ptr(this_obj);
38344         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38345         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38346         ChannelConfigUpdate_free(this_obj_conv);
38347 }
38348
38349 int64_t  CS_LDK_ChannelConfigUpdate_get_forwarding_fee_proportional_millionths(int64_t this_ptr) {
38350         LDKChannelConfigUpdate this_ptr_conv;
38351         this_ptr_conv.inner = untag_ptr(this_ptr);
38352         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38353         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38354         this_ptr_conv.is_owned = false;
38355         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
38356         *ret_copy = ChannelConfigUpdate_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
38357         int64_t ret_ref = tag_ptr(ret_copy, true);
38358         return ret_ref;
38359 }
38360
38361 void  CS_LDK_ChannelConfigUpdate_set_forwarding_fee_proportional_millionths(int64_t this_ptr, int64_t val) {
38362         LDKChannelConfigUpdate this_ptr_conv;
38363         this_ptr_conv.inner = untag_ptr(this_ptr);
38364         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38365         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38366         this_ptr_conv.is_owned = false;
38367         void* val_ptr = untag_ptr(val);
38368         CHECK_ACCESS(val_ptr);
38369         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
38370         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
38371         ChannelConfigUpdate_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val_conv);
38372 }
38373
38374 int64_t  CS_LDK_ChannelConfigUpdate_get_forwarding_fee_base_msat(int64_t this_ptr) {
38375         LDKChannelConfigUpdate this_ptr_conv;
38376         this_ptr_conv.inner = untag_ptr(this_ptr);
38377         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38378         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38379         this_ptr_conv.is_owned = false;
38380         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
38381         *ret_copy = ChannelConfigUpdate_get_forwarding_fee_base_msat(&this_ptr_conv);
38382         int64_t ret_ref = tag_ptr(ret_copy, true);
38383         return ret_ref;
38384 }
38385
38386 void  CS_LDK_ChannelConfigUpdate_set_forwarding_fee_base_msat(int64_t this_ptr, int64_t val) {
38387         LDKChannelConfigUpdate this_ptr_conv;
38388         this_ptr_conv.inner = untag_ptr(this_ptr);
38389         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38390         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38391         this_ptr_conv.is_owned = false;
38392         void* val_ptr = untag_ptr(val);
38393         CHECK_ACCESS(val_ptr);
38394         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
38395         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
38396         ChannelConfigUpdate_set_forwarding_fee_base_msat(&this_ptr_conv, val_conv);
38397 }
38398
38399 int64_t  CS_LDK_ChannelConfigUpdate_get_cltv_expiry_delta(int64_t this_ptr) {
38400         LDKChannelConfigUpdate this_ptr_conv;
38401         this_ptr_conv.inner = untag_ptr(this_ptr);
38402         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38403         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38404         this_ptr_conv.is_owned = false;
38405         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
38406         *ret_copy = ChannelConfigUpdate_get_cltv_expiry_delta(&this_ptr_conv);
38407         int64_t ret_ref = tag_ptr(ret_copy, true);
38408         return ret_ref;
38409 }
38410
38411 void  CS_LDK_ChannelConfigUpdate_set_cltv_expiry_delta(int64_t this_ptr, int64_t val) {
38412         LDKChannelConfigUpdate this_ptr_conv;
38413         this_ptr_conv.inner = untag_ptr(this_ptr);
38414         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38415         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38416         this_ptr_conv.is_owned = false;
38417         void* val_ptr = untag_ptr(val);
38418         CHECK_ACCESS(val_ptr);
38419         LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(val_ptr);
38420         val_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(val));
38421         ChannelConfigUpdate_set_cltv_expiry_delta(&this_ptr_conv, val_conv);
38422 }
38423
38424 int64_t  CS_LDK_ChannelConfigUpdate_get_max_dust_htlc_exposure_msat(int64_t this_ptr) {
38425         LDKChannelConfigUpdate this_ptr_conv;
38426         this_ptr_conv.inner = untag_ptr(this_ptr);
38427         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38428         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38429         this_ptr_conv.is_owned = false;
38430         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
38431         *ret_copy = ChannelConfigUpdate_get_max_dust_htlc_exposure_msat(&this_ptr_conv);
38432         int64_t ret_ref = tag_ptr(ret_copy, true);
38433         return ret_ref;
38434 }
38435
38436 void  CS_LDK_ChannelConfigUpdate_set_max_dust_htlc_exposure_msat(int64_t this_ptr, int64_t val) {
38437         LDKChannelConfigUpdate this_ptr_conv;
38438         this_ptr_conv.inner = untag_ptr(this_ptr);
38439         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38440         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38441         this_ptr_conv.is_owned = false;
38442         void* val_ptr = untag_ptr(val);
38443         CHECK_ACCESS(val_ptr);
38444         LDKCOption_MaxDustHTLCExposureZ val_conv = *(LDKCOption_MaxDustHTLCExposureZ*)(val_ptr);
38445         val_conv = COption_MaxDustHTLCExposureZ_clone((LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(val));
38446         ChannelConfigUpdate_set_max_dust_htlc_exposure_msat(&this_ptr_conv, val_conv);
38447 }
38448
38449 int64_t  CS_LDK_ChannelConfigUpdate_get_force_close_avoidance_max_fee_satoshis(int64_t this_ptr) {
38450         LDKChannelConfigUpdate this_ptr_conv;
38451         this_ptr_conv.inner = untag_ptr(this_ptr);
38452         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38453         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38454         this_ptr_conv.is_owned = false;
38455         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
38456         *ret_copy = ChannelConfigUpdate_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
38457         int64_t ret_ref = tag_ptr(ret_copy, true);
38458         return ret_ref;
38459 }
38460
38461 void  CS_LDK_ChannelConfigUpdate_set_force_close_avoidance_max_fee_satoshis(int64_t this_ptr, int64_t val) {
38462         LDKChannelConfigUpdate this_ptr_conv;
38463         this_ptr_conv.inner = untag_ptr(this_ptr);
38464         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38465         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38466         this_ptr_conv.is_owned = false;
38467         void* val_ptr = untag_ptr(val);
38468         CHECK_ACCESS(val_ptr);
38469         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
38470         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
38471         ChannelConfigUpdate_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val_conv);
38472 }
38473
38474 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) {
38475         void* forwarding_fee_proportional_millionths_arg_ptr = untag_ptr(forwarding_fee_proportional_millionths_arg);
38476         CHECK_ACCESS(forwarding_fee_proportional_millionths_arg_ptr);
38477         LDKCOption_u32Z forwarding_fee_proportional_millionths_arg_conv = *(LDKCOption_u32Z*)(forwarding_fee_proportional_millionths_arg_ptr);
38478         forwarding_fee_proportional_millionths_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(forwarding_fee_proportional_millionths_arg));
38479         void* forwarding_fee_base_msat_arg_ptr = untag_ptr(forwarding_fee_base_msat_arg);
38480         CHECK_ACCESS(forwarding_fee_base_msat_arg_ptr);
38481         LDKCOption_u32Z forwarding_fee_base_msat_arg_conv = *(LDKCOption_u32Z*)(forwarding_fee_base_msat_arg_ptr);
38482         forwarding_fee_base_msat_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(forwarding_fee_base_msat_arg));
38483         void* cltv_expiry_delta_arg_ptr = untag_ptr(cltv_expiry_delta_arg);
38484         CHECK_ACCESS(cltv_expiry_delta_arg_ptr);
38485         LDKCOption_u16Z cltv_expiry_delta_arg_conv = *(LDKCOption_u16Z*)(cltv_expiry_delta_arg_ptr);
38486         cltv_expiry_delta_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(cltv_expiry_delta_arg));
38487         void* max_dust_htlc_exposure_msat_arg_ptr = untag_ptr(max_dust_htlc_exposure_msat_arg);
38488         CHECK_ACCESS(max_dust_htlc_exposure_msat_arg_ptr);
38489         LDKCOption_MaxDustHTLCExposureZ max_dust_htlc_exposure_msat_arg_conv = *(LDKCOption_MaxDustHTLCExposureZ*)(max_dust_htlc_exposure_msat_arg_ptr);
38490         max_dust_htlc_exposure_msat_arg_conv = COption_MaxDustHTLCExposureZ_clone((LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(max_dust_htlc_exposure_msat_arg));
38491         void* force_close_avoidance_max_fee_satoshis_arg_ptr = untag_ptr(force_close_avoidance_max_fee_satoshis_arg);
38492         CHECK_ACCESS(force_close_avoidance_max_fee_satoshis_arg_ptr);
38493         LDKCOption_u64Z force_close_avoidance_max_fee_satoshis_arg_conv = *(LDKCOption_u64Z*)(force_close_avoidance_max_fee_satoshis_arg_ptr);
38494         force_close_avoidance_max_fee_satoshis_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(force_close_avoidance_max_fee_satoshis_arg));
38495         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);
38496         int64_t ret_ref = 0;
38497         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38498         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38499         return ret_ref;
38500 }
38501
38502 int64_t  CS_LDK_ChannelConfigUpdate_default() {
38503         LDKChannelConfigUpdate ret_var = ChannelConfigUpdate_default();
38504         int64_t ret_ref = 0;
38505         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38506         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38507         return ret_ref;
38508 }
38509
38510 void  CS_LDK_UserConfig_free(int64_t this_obj) {
38511         LDKUserConfig this_obj_conv;
38512         this_obj_conv.inner = untag_ptr(this_obj);
38513         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38514         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38515         UserConfig_free(this_obj_conv);
38516 }
38517
38518 int64_t  CS_LDK_UserConfig_get_channel_handshake_config(int64_t this_ptr) {
38519         LDKUserConfig this_ptr_conv;
38520         this_ptr_conv.inner = untag_ptr(this_ptr);
38521         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38522         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38523         this_ptr_conv.is_owned = false;
38524         LDKChannelHandshakeConfig ret_var = UserConfig_get_channel_handshake_config(&this_ptr_conv);
38525         int64_t ret_ref = 0;
38526         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38527         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38528         return ret_ref;
38529 }
38530
38531 void  CS_LDK_UserConfig_set_channel_handshake_config(int64_t this_ptr, int64_t val) {
38532         LDKUserConfig this_ptr_conv;
38533         this_ptr_conv.inner = untag_ptr(this_ptr);
38534         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38535         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38536         this_ptr_conv.is_owned = false;
38537         LDKChannelHandshakeConfig val_conv;
38538         val_conv.inner = untag_ptr(val);
38539         val_conv.is_owned = ptr_is_owned(val);
38540         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38541         val_conv = ChannelHandshakeConfig_clone(&val_conv);
38542         UserConfig_set_channel_handshake_config(&this_ptr_conv, val_conv);
38543 }
38544
38545 int64_t  CS_LDK_UserConfig_get_channel_handshake_limits(int64_t this_ptr) {
38546         LDKUserConfig this_ptr_conv;
38547         this_ptr_conv.inner = untag_ptr(this_ptr);
38548         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38549         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38550         this_ptr_conv.is_owned = false;
38551         LDKChannelHandshakeLimits ret_var = UserConfig_get_channel_handshake_limits(&this_ptr_conv);
38552         int64_t ret_ref = 0;
38553         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38554         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38555         return ret_ref;
38556 }
38557
38558 void  CS_LDK_UserConfig_set_channel_handshake_limits(int64_t this_ptr, int64_t val) {
38559         LDKUserConfig this_ptr_conv;
38560         this_ptr_conv.inner = untag_ptr(this_ptr);
38561         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38562         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38563         this_ptr_conv.is_owned = false;
38564         LDKChannelHandshakeLimits val_conv;
38565         val_conv.inner = untag_ptr(val);
38566         val_conv.is_owned = ptr_is_owned(val);
38567         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38568         val_conv = ChannelHandshakeLimits_clone(&val_conv);
38569         UserConfig_set_channel_handshake_limits(&this_ptr_conv, val_conv);
38570 }
38571
38572 int64_t  CS_LDK_UserConfig_get_channel_config(int64_t this_ptr) {
38573         LDKUserConfig this_ptr_conv;
38574         this_ptr_conv.inner = untag_ptr(this_ptr);
38575         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38576         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38577         this_ptr_conv.is_owned = false;
38578         LDKChannelConfig ret_var = UserConfig_get_channel_config(&this_ptr_conv);
38579         int64_t ret_ref = 0;
38580         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38581         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38582         return ret_ref;
38583 }
38584
38585 void  CS_LDK_UserConfig_set_channel_config(int64_t this_ptr, int64_t val) {
38586         LDKUserConfig this_ptr_conv;
38587         this_ptr_conv.inner = untag_ptr(this_ptr);
38588         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38589         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38590         this_ptr_conv.is_owned = false;
38591         LDKChannelConfig val_conv;
38592         val_conv.inner = untag_ptr(val);
38593         val_conv.is_owned = ptr_is_owned(val);
38594         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38595         val_conv = ChannelConfig_clone(&val_conv);
38596         UserConfig_set_channel_config(&this_ptr_conv, val_conv);
38597 }
38598
38599 jboolean  CS_LDK_UserConfig_get_accept_forwards_to_priv_channels(int64_t this_ptr) {
38600         LDKUserConfig this_ptr_conv;
38601         this_ptr_conv.inner = untag_ptr(this_ptr);
38602         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38603         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38604         this_ptr_conv.is_owned = false;
38605         jboolean ret_conv = UserConfig_get_accept_forwards_to_priv_channels(&this_ptr_conv);
38606         return ret_conv;
38607 }
38608
38609 void  CS_LDK_UserConfig_set_accept_forwards_to_priv_channels(int64_t this_ptr, jboolean val) {
38610         LDKUserConfig this_ptr_conv;
38611         this_ptr_conv.inner = untag_ptr(this_ptr);
38612         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38613         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38614         this_ptr_conv.is_owned = false;
38615         UserConfig_set_accept_forwards_to_priv_channels(&this_ptr_conv, val);
38616 }
38617
38618 jboolean  CS_LDK_UserConfig_get_accept_inbound_channels(int64_t this_ptr) {
38619         LDKUserConfig this_ptr_conv;
38620         this_ptr_conv.inner = untag_ptr(this_ptr);
38621         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38622         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38623         this_ptr_conv.is_owned = false;
38624         jboolean ret_conv = UserConfig_get_accept_inbound_channels(&this_ptr_conv);
38625         return ret_conv;
38626 }
38627
38628 void  CS_LDK_UserConfig_set_accept_inbound_channels(int64_t this_ptr, jboolean val) {
38629         LDKUserConfig this_ptr_conv;
38630         this_ptr_conv.inner = untag_ptr(this_ptr);
38631         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38632         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38633         this_ptr_conv.is_owned = false;
38634         UserConfig_set_accept_inbound_channels(&this_ptr_conv, val);
38635 }
38636
38637 jboolean  CS_LDK_UserConfig_get_manually_accept_inbound_channels(int64_t this_ptr) {
38638         LDKUserConfig this_ptr_conv;
38639         this_ptr_conv.inner = untag_ptr(this_ptr);
38640         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38641         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38642         this_ptr_conv.is_owned = false;
38643         jboolean ret_conv = UserConfig_get_manually_accept_inbound_channels(&this_ptr_conv);
38644         return ret_conv;
38645 }
38646
38647 void  CS_LDK_UserConfig_set_manually_accept_inbound_channels(int64_t this_ptr, jboolean val) {
38648         LDKUserConfig this_ptr_conv;
38649         this_ptr_conv.inner = untag_ptr(this_ptr);
38650         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38651         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38652         this_ptr_conv.is_owned = false;
38653         UserConfig_set_manually_accept_inbound_channels(&this_ptr_conv, val);
38654 }
38655
38656 jboolean  CS_LDK_UserConfig_get_accept_intercept_htlcs(int64_t this_ptr) {
38657         LDKUserConfig this_ptr_conv;
38658         this_ptr_conv.inner = untag_ptr(this_ptr);
38659         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38660         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38661         this_ptr_conv.is_owned = false;
38662         jboolean ret_conv = UserConfig_get_accept_intercept_htlcs(&this_ptr_conv);
38663         return ret_conv;
38664 }
38665
38666 void  CS_LDK_UserConfig_set_accept_intercept_htlcs(int64_t this_ptr, jboolean val) {
38667         LDKUserConfig this_ptr_conv;
38668         this_ptr_conv.inner = untag_ptr(this_ptr);
38669         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38670         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38671         this_ptr_conv.is_owned = false;
38672         UserConfig_set_accept_intercept_htlcs(&this_ptr_conv, val);
38673 }
38674
38675 jboolean  CS_LDK_UserConfig_get_accept_mpp_keysend(int64_t this_ptr) {
38676         LDKUserConfig this_ptr_conv;
38677         this_ptr_conv.inner = untag_ptr(this_ptr);
38678         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38679         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38680         this_ptr_conv.is_owned = false;
38681         jboolean ret_conv = UserConfig_get_accept_mpp_keysend(&this_ptr_conv);
38682         return ret_conv;
38683 }
38684
38685 void  CS_LDK_UserConfig_set_accept_mpp_keysend(int64_t this_ptr, jboolean val) {
38686         LDKUserConfig this_ptr_conv;
38687         this_ptr_conv.inner = untag_ptr(this_ptr);
38688         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38689         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38690         this_ptr_conv.is_owned = false;
38691         UserConfig_set_accept_mpp_keysend(&this_ptr_conv, val);
38692 }
38693
38694 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) {
38695         LDKChannelHandshakeConfig channel_handshake_config_arg_conv;
38696         channel_handshake_config_arg_conv.inner = untag_ptr(channel_handshake_config_arg);
38697         channel_handshake_config_arg_conv.is_owned = ptr_is_owned(channel_handshake_config_arg);
38698         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_handshake_config_arg_conv);
38699         channel_handshake_config_arg_conv = ChannelHandshakeConfig_clone(&channel_handshake_config_arg_conv);
38700         LDKChannelHandshakeLimits channel_handshake_limits_arg_conv;
38701         channel_handshake_limits_arg_conv.inner = untag_ptr(channel_handshake_limits_arg);
38702         channel_handshake_limits_arg_conv.is_owned = ptr_is_owned(channel_handshake_limits_arg);
38703         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_handshake_limits_arg_conv);
38704         channel_handshake_limits_arg_conv = ChannelHandshakeLimits_clone(&channel_handshake_limits_arg_conv);
38705         LDKChannelConfig channel_config_arg_conv;
38706         channel_config_arg_conv.inner = untag_ptr(channel_config_arg);
38707         channel_config_arg_conv.is_owned = ptr_is_owned(channel_config_arg);
38708         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_config_arg_conv);
38709         channel_config_arg_conv = ChannelConfig_clone(&channel_config_arg_conv);
38710         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);
38711         int64_t ret_ref = 0;
38712         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38713         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38714         return ret_ref;
38715 }
38716
38717 static inline uint64_t UserConfig_clone_ptr(LDKUserConfig *NONNULL_PTR arg) {
38718         LDKUserConfig ret_var = UserConfig_clone(arg);
38719         int64_t ret_ref = 0;
38720         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38721         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38722         return ret_ref;
38723 }
38724 int64_t  CS_LDK_UserConfig_clone_ptr(int64_t arg) {
38725         LDKUserConfig arg_conv;
38726         arg_conv.inner = untag_ptr(arg);
38727         arg_conv.is_owned = ptr_is_owned(arg);
38728         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38729         arg_conv.is_owned = false;
38730         int64_t ret_conv = UserConfig_clone_ptr(&arg_conv);
38731         return ret_conv;
38732 }
38733
38734 int64_t  CS_LDK_UserConfig_clone(int64_t orig) {
38735         LDKUserConfig orig_conv;
38736         orig_conv.inner = untag_ptr(orig);
38737         orig_conv.is_owned = ptr_is_owned(orig);
38738         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38739         orig_conv.is_owned = false;
38740         LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
38741         int64_t ret_ref = 0;
38742         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38743         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38744         return ret_ref;
38745 }
38746
38747 int64_t  CS_LDK_UserConfig_default() {
38748         LDKUserConfig ret_var = UserConfig_default();
38749         int64_t ret_ref = 0;
38750         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38751         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38752         return ret_ref;
38753 }
38754
38755 void  CS_LDK_BestBlock_free(int64_t this_obj) {
38756         LDKBestBlock this_obj_conv;
38757         this_obj_conv.inner = untag_ptr(this_obj);
38758         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38759         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38760         BestBlock_free(this_obj_conv);
38761 }
38762
38763 int8_tArray  CS_LDK_BestBlock_get_block_hash(int64_t this_ptr) {
38764         LDKBestBlock this_ptr_conv;
38765         this_ptr_conv.inner = untag_ptr(this_ptr);
38766         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38767         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38768         this_ptr_conv.is_owned = false;
38769         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
38770         memcpy(ret_arr->elems, *BestBlock_get_block_hash(&this_ptr_conv), 32);
38771         return ret_arr;
38772 }
38773
38774 void  CS_LDK_BestBlock_set_block_hash(int64_t this_ptr, int8_tArray val) {
38775         LDKBestBlock this_ptr_conv;
38776         this_ptr_conv.inner = untag_ptr(this_ptr);
38777         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38778         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38779         this_ptr_conv.is_owned = false;
38780         LDKThirtyTwoBytes val_ref;
38781         CHECK(val->arr_len == 32);
38782         memcpy(val_ref.data, val->elems, 32); FREE(val);
38783         BestBlock_set_block_hash(&this_ptr_conv, val_ref);
38784 }
38785
38786 int32_t  CS_LDK_BestBlock_get_height(int64_t this_ptr) {
38787         LDKBestBlock this_ptr_conv;
38788         this_ptr_conv.inner = untag_ptr(this_ptr);
38789         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38790         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38791         this_ptr_conv.is_owned = false;
38792         int32_t ret_conv = BestBlock_get_height(&this_ptr_conv);
38793         return ret_conv;
38794 }
38795
38796 void  CS_LDK_BestBlock_set_height(int64_t this_ptr, int32_t val) {
38797         LDKBestBlock this_ptr_conv;
38798         this_ptr_conv.inner = untag_ptr(this_ptr);
38799         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38800         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38801         this_ptr_conv.is_owned = false;
38802         BestBlock_set_height(&this_ptr_conv, val);
38803 }
38804
38805 int64_t  CS_LDK_BestBlock_new(int8_tArray block_hash_arg, int32_t height_arg) {
38806         LDKThirtyTwoBytes block_hash_arg_ref;
38807         CHECK(block_hash_arg->arr_len == 32);
38808         memcpy(block_hash_arg_ref.data, block_hash_arg->elems, 32); FREE(block_hash_arg);
38809         LDKBestBlock ret_var = BestBlock_new(block_hash_arg_ref, height_arg);
38810         int64_t ret_ref = 0;
38811         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38812         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38813         return ret_ref;
38814 }
38815
38816 static inline uint64_t BestBlock_clone_ptr(LDKBestBlock *NONNULL_PTR arg) {
38817         LDKBestBlock ret_var = BestBlock_clone(arg);
38818         int64_t ret_ref = 0;
38819         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38820         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38821         return ret_ref;
38822 }
38823 int64_t  CS_LDK_BestBlock_clone_ptr(int64_t arg) {
38824         LDKBestBlock arg_conv;
38825         arg_conv.inner = untag_ptr(arg);
38826         arg_conv.is_owned = ptr_is_owned(arg);
38827         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38828         arg_conv.is_owned = false;
38829         int64_t ret_conv = BestBlock_clone_ptr(&arg_conv);
38830         return ret_conv;
38831 }
38832
38833 int64_t  CS_LDK_BestBlock_clone(int64_t orig) {
38834         LDKBestBlock orig_conv;
38835         orig_conv.inner = untag_ptr(orig);
38836         orig_conv.is_owned = ptr_is_owned(orig);
38837         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38838         orig_conv.is_owned = false;
38839         LDKBestBlock ret_var = BestBlock_clone(&orig_conv);
38840         int64_t ret_ref = 0;
38841         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38842         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38843         return ret_ref;
38844 }
38845
38846 int64_t  CS_LDK_BestBlock_hash(int64_t o) {
38847         LDKBestBlock o_conv;
38848         o_conv.inner = untag_ptr(o);
38849         o_conv.is_owned = ptr_is_owned(o);
38850         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
38851         o_conv.is_owned = false;
38852         int64_t ret_conv = BestBlock_hash(&o_conv);
38853         return ret_conv;
38854 }
38855
38856 jboolean  CS_LDK_BestBlock_eq(int64_t a, int64_t b) {
38857         LDKBestBlock a_conv;
38858         a_conv.inner = untag_ptr(a);
38859         a_conv.is_owned = ptr_is_owned(a);
38860         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38861         a_conv.is_owned = false;
38862         LDKBestBlock b_conv;
38863         b_conv.inner = untag_ptr(b);
38864         b_conv.is_owned = ptr_is_owned(b);
38865         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38866         b_conv.is_owned = false;
38867         jboolean ret_conv = BestBlock_eq(&a_conv, &b_conv);
38868         return ret_conv;
38869 }
38870
38871 int64_t  CS_LDK_BestBlock_from_network(int32_t network) {
38872         LDKNetwork network_conv = LDKNetwork_from_cs(network);
38873         LDKBestBlock ret_var = BestBlock_from_network(network_conv);
38874         int64_t ret_ref = 0;
38875         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38876         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38877         return ret_ref;
38878 }
38879
38880 int8_tArray  CS_LDK_BestBlock_write(int64_t obj) {
38881         LDKBestBlock obj_conv;
38882         obj_conv.inner = untag_ptr(obj);
38883         obj_conv.is_owned = ptr_is_owned(obj);
38884         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38885         obj_conv.is_owned = false;
38886         LDKCVec_u8Z ret_var = BestBlock_write(&obj_conv);
38887         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38888         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38889         CVec_u8Z_free(ret_var);
38890         return ret_arr;
38891 }
38892
38893 int64_t  CS_LDK_BestBlock_read(int8_tArray ser) {
38894         LDKu8slice ser_ref;
38895         ser_ref.datalen = ser->arr_len;
38896         ser_ref.data = ser->elems;
38897         LDKCResult_BestBlockDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BestBlockDecodeErrorZ), "LDKCResult_BestBlockDecodeErrorZ");
38898         *ret_conv = BestBlock_read(ser_ref);
38899         FREE(ser);
38900         return tag_ptr(ret_conv, true);
38901 }
38902
38903 void  CS_LDK_Listen_free(int64_t this_ptr) {
38904         if (!ptr_is_owned(this_ptr)) return;
38905         void* this_ptr_ptr = untag_ptr(this_ptr);
38906         CHECK_ACCESS(this_ptr_ptr);
38907         LDKListen this_ptr_conv = *(LDKListen*)(this_ptr_ptr);
38908         FREE(untag_ptr(this_ptr));
38909         Listen_free(this_ptr_conv);
38910 }
38911
38912 void  CS_LDK_Confirm_free(int64_t this_ptr) {
38913         if (!ptr_is_owned(this_ptr)) return;
38914         void* this_ptr_ptr = untag_ptr(this_ptr);
38915         CHECK_ACCESS(this_ptr_ptr);
38916         LDKConfirm this_ptr_conv = *(LDKConfirm*)(this_ptr_ptr);
38917         FREE(untag_ptr(this_ptr));
38918         Confirm_free(this_ptr_conv);
38919 }
38920
38921 int32_t  CS_LDK_ChannelMonitorUpdateStatus_clone(int64_t orig) {
38922         LDKChannelMonitorUpdateStatus* orig_conv = (LDKChannelMonitorUpdateStatus*)untag_ptr(orig);
38923         int32_t ret_conv = LDKChannelMonitorUpdateStatus_to_cs(ChannelMonitorUpdateStatus_clone(orig_conv));
38924         return ret_conv;
38925 }
38926
38927 int32_t  CS_LDK_ChannelMonitorUpdateStatus_completed() {
38928         int32_t ret_conv = LDKChannelMonitorUpdateStatus_to_cs(ChannelMonitorUpdateStatus_completed());
38929         return ret_conv;
38930 }
38931
38932 int32_t  CS_LDK_ChannelMonitorUpdateStatus_in_progress() {
38933         int32_t ret_conv = LDKChannelMonitorUpdateStatus_to_cs(ChannelMonitorUpdateStatus_in_progress());
38934         return ret_conv;
38935 }
38936
38937 int32_t  CS_LDK_ChannelMonitorUpdateStatus_unrecoverable_error() {
38938         int32_t ret_conv = LDKChannelMonitorUpdateStatus_to_cs(ChannelMonitorUpdateStatus_unrecoverable_error());
38939         return ret_conv;
38940 }
38941
38942 jboolean  CS_LDK_ChannelMonitorUpdateStatus_eq(int64_t a, int64_t b) {
38943         LDKChannelMonitorUpdateStatus* a_conv = (LDKChannelMonitorUpdateStatus*)untag_ptr(a);
38944         LDKChannelMonitorUpdateStatus* b_conv = (LDKChannelMonitorUpdateStatus*)untag_ptr(b);
38945         jboolean ret_conv = ChannelMonitorUpdateStatus_eq(a_conv, b_conv);
38946         return ret_conv;
38947 }
38948
38949 void  CS_LDK_Watch_free(int64_t this_ptr) {
38950         if (!ptr_is_owned(this_ptr)) return;
38951         void* this_ptr_ptr = untag_ptr(this_ptr);
38952         CHECK_ACCESS(this_ptr_ptr);
38953         LDKWatch this_ptr_conv = *(LDKWatch*)(this_ptr_ptr);
38954         FREE(untag_ptr(this_ptr));
38955         Watch_free(this_ptr_conv);
38956 }
38957
38958 void  CS_LDK_Filter_free(int64_t this_ptr) {
38959         if (!ptr_is_owned(this_ptr)) return;
38960         void* this_ptr_ptr = untag_ptr(this_ptr);
38961         CHECK_ACCESS(this_ptr_ptr);
38962         LDKFilter this_ptr_conv = *(LDKFilter*)(this_ptr_ptr);
38963         FREE(untag_ptr(this_ptr));
38964         Filter_free(this_ptr_conv);
38965 }
38966
38967 void  CS_LDK_WatchedOutput_free(int64_t this_obj) {
38968         LDKWatchedOutput this_obj_conv;
38969         this_obj_conv.inner = untag_ptr(this_obj);
38970         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38971         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38972         WatchedOutput_free(this_obj_conv);
38973 }
38974
38975 int64_t  CS_LDK_WatchedOutput_get_block_hash(int64_t this_ptr) {
38976         LDKWatchedOutput this_ptr_conv;
38977         this_ptr_conv.inner = untag_ptr(this_ptr);
38978         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38979         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38980         this_ptr_conv.is_owned = false;
38981         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
38982         *ret_copy = WatchedOutput_get_block_hash(&this_ptr_conv);
38983         int64_t ret_ref = tag_ptr(ret_copy, true);
38984         return ret_ref;
38985 }
38986
38987 void  CS_LDK_WatchedOutput_set_block_hash(int64_t this_ptr, int64_t val) {
38988         LDKWatchedOutput this_ptr_conv;
38989         this_ptr_conv.inner = untag_ptr(this_ptr);
38990         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38991         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38992         this_ptr_conv.is_owned = false;
38993         void* val_ptr = untag_ptr(val);
38994         CHECK_ACCESS(val_ptr);
38995         LDKCOption_ThirtyTwoBytesZ val_conv = *(LDKCOption_ThirtyTwoBytesZ*)(val_ptr);
38996         val_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(val));
38997         WatchedOutput_set_block_hash(&this_ptr_conv, val_conv);
38998 }
38999
39000 int64_t  CS_LDK_WatchedOutput_get_outpoint(int64_t this_ptr) {
39001         LDKWatchedOutput this_ptr_conv;
39002         this_ptr_conv.inner = untag_ptr(this_ptr);
39003         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39004         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39005         this_ptr_conv.is_owned = false;
39006         LDKOutPoint ret_var = WatchedOutput_get_outpoint(&this_ptr_conv);
39007         int64_t ret_ref = 0;
39008         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39009         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39010         return ret_ref;
39011 }
39012
39013 void  CS_LDK_WatchedOutput_set_outpoint(int64_t this_ptr, int64_t val) {
39014         LDKWatchedOutput this_ptr_conv;
39015         this_ptr_conv.inner = untag_ptr(this_ptr);
39016         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39017         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39018         this_ptr_conv.is_owned = false;
39019         LDKOutPoint val_conv;
39020         val_conv.inner = untag_ptr(val);
39021         val_conv.is_owned = ptr_is_owned(val);
39022         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39023         val_conv = OutPoint_clone(&val_conv);
39024         WatchedOutput_set_outpoint(&this_ptr_conv, val_conv);
39025 }
39026
39027 int8_tArray  CS_LDK_WatchedOutput_get_script_pubkey(int64_t this_ptr) {
39028         LDKWatchedOutput this_ptr_conv;
39029         this_ptr_conv.inner = untag_ptr(this_ptr);
39030         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39031         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39032         this_ptr_conv.is_owned = false;
39033         LDKCVec_u8Z ret_var = WatchedOutput_get_script_pubkey(&this_ptr_conv);
39034         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39035         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39036         CVec_u8Z_free(ret_var);
39037         return ret_arr;
39038 }
39039
39040 void  CS_LDK_WatchedOutput_set_script_pubkey(int64_t this_ptr, int8_tArray val) {
39041         LDKWatchedOutput this_ptr_conv;
39042         this_ptr_conv.inner = untag_ptr(this_ptr);
39043         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39044         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39045         this_ptr_conv.is_owned = false;
39046         LDKCVec_u8Z val_ref;
39047         val_ref.datalen = val->arr_len;
39048         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
39049         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
39050         WatchedOutput_set_script_pubkey(&this_ptr_conv, val_ref);
39051 }
39052
39053 int64_t  CS_LDK_WatchedOutput_new(int64_t block_hash_arg, int64_t outpoint_arg, int8_tArray script_pubkey_arg) {
39054         void* block_hash_arg_ptr = untag_ptr(block_hash_arg);
39055         CHECK_ACCESS(block_hash_arg_ptr);
39056         LDKCOption_ThirtyTwoBytesZ block_hash_arg_conv = *(LDKCOption_ThirtyTwoBytesZ*)(block_hash_arg_ptr);
39057         block_hash_arg_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(block_hash_arg));
39058         LDKOutPoint outpoint_arg_conv;
39059         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
39060         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
39061         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
39062         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
39063         LDKCVec_u8Z script_pubkey_arg_ref;
39064         script_pubkey_arg_ref.datalen = script_pubkey_arg->arr_len;
39065         script_pubkey_arg_ref.data = MALLOC(script_pubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
39066         memcpy(script_pubkey_arg_ref.data, script_pubkey_arg->elems, script_pubkey_arg_ref.datalen); FREE(script_pubkey_arg);
39067         LDKWatchedOutput ret_var = WatchedOutput_new(block_hash_arg_conv, outpoint_arg_conv, script_pubkey_arg_ref);
39068         int64_t ret_ref = 0;
39069         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39070         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39071         return ret_ref;
39072 }
39073
39074 static inline uint64_t WatchedOutput_clone_ptr(LDKWatchedOutput *NONNULL_PTR arg) {
39075         LDKWatchedOutput ret_var = WatchedOutput_clone(arg);
39076         int64_t ret_ref = 0;
39077         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39078         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39079         return ret_ref;
39080 }
39081 int64_t  CS_LDK_WatchedOutput_clone_ptr(int64_t arg) {
39082         LDKWatchedOutput arg_conv;
39083         arg_conv.inner = untag_ptr(arg);
39084         arg_conv.is_owned = ptr_is_owned(arg);
39085         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39086         arg_conv.is_owned = false;
39087         int64_t ret_conv = WatchedOutput_clone_ptr(&arg_conv);
39088         return ret_conv;
39089 }
39090
39091 int64_t  CS_LDK_WatchedOutput_clone(int64_t orig) {
39092         LDKWatchedOutput orig_conv;
39093         orig_conv.inner = untag_ptr(orig);
39094         orig_conv.is_owned = ptr_is_owned(orig);
39095         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39096         orig_conv.is_owned = false;
39097         LDKWatchedOutput ret_var = WatchedOutput_clone(&orig_conv);
39098         int64_t ret_ref = 0;
39099         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39100         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39101         return ret_ref;
39102 }
39103
39104 jboolean  CS_LDK_WatchedOutput_eq(int64_t a, int64_t b) {
39105         LDKWatchedOutput a_conv;
39106         a_conv.inner = untag_ptr(a);
39107         a_conv.is_owned = ptr_is_owned(a);
39108         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39109         a_conv.is_owned = false;
39110         LDKWatchedOutput b_conv;
39111         b_conv.inner = untag_ptr(b);
39112         b_conv.is_owned = ptr_is_owned(b);
39113         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39114         b_conv.is_owned = false;
39115         jboolean ret_conv = WatchedOutput_eq(&a_conv, &b_conv);
39116         return ret_conv;
39117 }
39118
39119 int64_t  CS_LDK_WatchedOutput_hash(int64_t o) {
39120         LDKWatchedOutput o_conv;
39121         o_conv.inner = untag_ptr(o);
39122         o_conv.is_owned = ptr_is_owned(o);
39123         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
39124         o_conv.is_owned = false;
39125         int64_t ret_conv = WatchedOutput_hash(&o_conv);
39126         return ret_conv;
39127 }
39128
39129 void  CS_LDK_BroadcasterInterface_free(int64_t this_ptr) {
39130         if (!ptr_is_owned(this_ptr)) return;
39131         void* this_ptr_ptr = untag_ptr(this_ptr);
39132         CHECK_ACCESS(this_ptr_ptr);
39133         LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)(this_ptr_ptr);
39134         FREE(untag_ptr(this_ptr));
39135         BroadcasterInterface_free(this_ptr_conv);
39136 }
39137
39138 int32_t  CS_LDK_ConfirmationTarget_clone(int64_t orig) {
39139         LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)untag_ptr(orig);
39140         int32_t ret_conv = LDKConfirmationTarget_to_cs(ConfirmationTarget_clone(orig_conv));
39141         return ret_conv;
39142 }
39143
39144 int32_t  CS_LDK_ConfirmationTarget_on_chain_sweep() {
39145         int32_t ret_conv = LDKConfirmationTarget_to_cs(ConfirmationTarget_on_chain_sweep());
39146         return ret_conv;
39147 }
39148
39149 int32_t  CS_LDK_ConfirmationTarget_min_allowed_anchor_channel_remote_fee() {
39150         int32_t ret_conv = LDKConfirmationTarget_to_cs(ConfirmationTarget_min_allowed_anchor_channel_remote_fee());
39151         return ret_conv;
39152 }
39153
39154 int32_t  CS_LDK_ConfirmationTarget_min_allowed_non_anchor_channel_remote_fee() {
39155         int32_t ret_conv = LDKConfirmationTarget_to_cs(ConfirmationTarget_min_allowed_non_anchor_channel_remote_fee());
39156         return ret_conv;
39157 }
39158
39159 int32_t  CS_LDK_ConfirmationTarget_anchor_channel_fee() {
39160         int32_t ret_conv = LDKConfirmationTarget_to_cs(ConfirmationTarget_anchor_channel_fee());
39161         return ret_conv;
39162 }
39163
39164 int32_t  CS_LDK_ConfirmationTarget_non_anchor_channel_fee() {
39165         int32_t ret_conv = LDKConfirmationTarget_to_cs(ConfirmationTarget_non_anchor_channel_fee());
39166         return ret_conv;
39167 }
39168
39169 int32_t  CS_LDK_ConfirmationTarget_channel_close_minimum() {
39170         int32_t ret_conv = LDKConfirmationTarget_to_cs(ConfirmationTarget_channel_close_minimum());
39171         return ret_conv;
39172 }
39173
39174 int32_t  CS_LDK_ConfirmationTarget_output_spending_fee() {
39175         int32_t ret_conv = LDKConfirmationTarget_to_cs(ConfirmationTarget_output_spending_fee());
39176         return ret_conv;
39177 }
39178
39179 int64_t  CS_LDK_ConfirmationTarget_hash(int64_t o) {
39180         LDKConfirmationTarget* o_conv = (LDKConfirmationTarget*)untag_ptr(o);
39181         int64_t ret_conv = ConfirmationTarget_hash(o_conv);
39182         return ret_conv;
39183 }
39184
39185 jboolean  CS_LDK_ConfirmationTarget_eq(int64_t a, int64_t b) {
39186         LDKConfirmationTarget* a_conv = (LDKConfirmationTarget*)untag_ptr(a);
39187         LDKConfirmationTarget* b_conv = (LDKConfirmationTarget*)untag_ptr(b);
39188         jboolean ret_conv = ConfirmationTarget_eq(a_conv, b_conv);
39189         return ret_conv;
39190 }
39191
39192 void  CS_LDK_FeeEstimator_free(int64_t this_ptr) {
39193         if (!ptr_is_owned(this_ptr)) return;
39194         void* this_ptr_ptr = untag_ptr(this_ptr);
39195         CHECK_ACCESS(this_ptr_ptr);
39196         LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)(this_ptr_ptr);
39197         FREE(untag_ptr(this_ptr));
39198         FeeEstimator_free(this_ptr_conv);
39199 }
39200
39201 void  CS_LDK_MonitorUpdateId_free(int64_t this_obj) {
39202         LDKMonitorUpdateId this_obj_conv;
39203         this_obj_conv.inner = untag_ptr(this_obj);
39204         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39205         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39206         MonitorUpdateId_free(this_obj_conv);
39207 }
39208
39209 static inline uint64_t MonitorUpdateId_clone_ptr(LDKMonitorUpdateId *NONNULL_PTR arg) {
39210         LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(arg);
39211         int64_t ret_ref = 0;
39212         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39213         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39214         return ret_ref;
39215 }
39216 int64_t  CS_LDK_MonitorUpdateId_clone_ptr(int64_t arg) {
39217         LDKMonitorUpdateId arg_conv;
39218         arg_conv.inner = untag_ptr(arg);
39219         arg_conv.is_owned = ptr_is_owned(arg);
39220         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39221         arg_conv.is_owned = false;
39222         int64_t ret_conv = MonitorUpdateId_clone_ptr(&arg_conv);
39223         return ret_conv;
39224 }
39225
39226 int64_t  CS_LDK_MonitorUpdateId_clone(int64_t orig) {
39227         LDKMonitorUpdateId orig_conv;
39228         orig_conv.inner = untag_ptr(orig);
39229         orig_conv.is_owned = ptr_is_owned(orig);
39230         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39231         orig_conv.is_owned = false;
39232         LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(&orig_conv);
39233         int64_t ret_ref = 0;
39234         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39235         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39236         return ret_ref;
39237 }
39238
39239 int64_t  CS_LDK_MonitorUpdateId_hash(int64_t o) {
39240         LDKMonitorUpdateId o_conv;
39241         o_conv.inner = untag_ptr(o);
39242         o_conv.is_owned = ptr_is_owned(o);
39243         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
39244         o_conv.is_owned = false;
39245         int64_t ret_conv = MonitorUpdateId_hash(&o_conv);
39246         return ret_conv;
39247 }
39248
39249 jboolean  CS_LDK_MonitorUpdateId_eq(int64_t a, int64_t b) {
39250         LDKMonitorUpdateId a_conv;
39251         a_conv.inner = untag_ptr(a);
39252         a_conv.is_owned = ptr_is_owned(a);
39253         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39254         a_conv.is_owned = false;
39255         LDKMonitorUpdateId b_conv;
39256         b_conv.inner = untag_ptr(b);
39257         b_conv.is_owned = ptr_is_owned(b);
39258         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39259         b_conv.is_owned = false;
39260         jboolean ret_conv = MonitorUpdateId_eq(&a_conv, &b_conv);
39261         return ret_conv;
39262 }
39263
39264 void  CS_LDK_Persist_free(int64_t this_ptr) {
39265         if (!ptr_is_owned(this_ptr)) return;
39266         void* this_ptr_ptr = untag_ptr(this_ptr);
39267         CHECK_ACCESS(this_ptr_ptr);
39268         LDKPersist this_ptr_conv = *(LDKPersist*)(this_ptr_ptr);
39269         FREE(untag_ptr(this_ptr));
39270         Persist_free(this_ptr_conv);
39271 }
39272
39273 void  CS_LDK_LockedChannelMonitor_free(int64_t this_obj) {
39274         LDKLockedChannelMonitor this_obj_conv;
39275         this_obj_conv.inner = untag_ptr(this_obj);
39276         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39277         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39278         LockedChannelMonitor_free(this_obj_conv);
39279 }
39280
39281 void  CS_LDK_ChainMonitor_free(int64_t this_obj) {
39282         LDKChainMonitor this_obj_conv;
39283         this_obj_conv.inner = untag_ptr(this_obj);
39284         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39285         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39286         ChainMonitor_free(this_obj_conv);
39287 }
39288
39289 int64_t  CS_LDK_ChainMonitor_new(int64_t chain_source, int64_t broadcaster, int64_t logger, int64_t feeest, int64_t persister) {
39290         void* chain_source_ptr = untag_ptr(chain_source);
39291         CHECK_ACCESS(chain_source_ptr);
39292         LDKCOption_FilterZ chain_source_conv = *(LDKCOption_FilterZ*)(chain_source_ptr);
39293         // WARNING: we may need a move here but no clone is available for LDKCOption_FilterZ
39294         if (chain_source_conv.tag == LDKCOption_FilterZ_Some) {
39295                 // Manually implement clone for Java trait instances
39296                 if (chain_source_conv.some.free == LDKFilter_JCalls_free) {
39297                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39298                         LDKFilter_JCalls_cloned(&chain_source_conv.some);
39299                 }
39300         }
39301         void* broadcaster_ptr = untag_ptr(broadcaster);
39302         CHECK_ACCESS(broadcaster_ptr);
39303         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
39304         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
39305                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39306                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
39307         }
39308         void* logger_ptr = untag_ptr(logger);
39309         CHECK_ACCESS(logger_ptr);
39310         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
39311         if (logger_conv.free == LDKLogger_JCalls_free) {
39312                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39313                 LDKLogger_JCalls_cloned(&logger_conv);
39314         }
39315         void* feeest_ptr = untag_ptr(feeest);
39316         CHECK_ACCESS(feeest_ptr);
39317         LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)(feeest_ptr);
39318         if (feeest_conv.free == LDKFeeEstimator_JCalls_free) {
39319                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39320                 LDKFeeEstimator_JCalls_cloned(&feeest_conv);
39321         }
39322         void* persister_ptr = untag_ptr(persister);
39323         CHECK_ACCESS(persister_ptr);
39324         LDKPersist persister_conv = *(LDKPersist*)(persister_ptr);
39325         if (persister_conv.free == LDKPersist_JCalls_free) {
39326                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39327                 LDKPersist_JCalls_cloned(&persister_conv);
39328         }
39329         LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
39330         int64_t ret_ref = 0;
39331         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39332         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39333         return ret_ref;
39334 }
39335
39336 int64_tArray  CS_LDK_ChainMonitor_get_claimable_balances(int64_t this_arg, int64_tArray ignored_channels) {
39337         LDKChainMonitor this_arg_conv;
39338         this_arg_conv.inner = untag_ptr(this_arg);
39339         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39340         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39341         this_arg_conv.is_owned = false;
39342         LDKCVec_ChannelDetailsZ ignored_channels_constr;
39343         ignored_channels_constr.datalen = ignored_channels->arr_len;
39344         if (ignored_channels_constr.datalen > 0)
39345                 ignored_channels_constr.data = MALLOC(ignored_channels_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
39346         else
39347                 ignored_channels_constr.data = NULL;
39348         int64_t* ignored_channels_vals = ignored_channels->elems;
39349         for (size_t q = 0; q < ignored_channels_constr.datalen; q++) {
39350                 int64_t ignored_channels_conv_16 = ignored_channels_vals[q];
39351                 LDKChannelDetails ignored_channels_conv_16_conv;
39352                 ignored_channels_conv_16_conv.inner = untag_ptr(ignored_channels_conv_16);
39353                 ignored_channels_conv_16_conv.is_owned = ptr_is_owned(ignored_channels_conv_16);
39354                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ignored_channels_conv_16_conv);
39355                 ignored_channels_conv_16_conv = ChannelDetails_clone(&ignored_channels_conv_16_conv);
39356                 ignored_channels_constr.data[q] = ignored_channels_conv_16_conv;
39357         }
39358         FREE(ignored_channels);
39359         LDKCVec_BalanceZ ret_var = ChainMonitor_get_claimable_balances(&this_arg_conv, ignored_channels_constr);
39360         int64_tArray ret_arr = NULL;
39361         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
39362         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
39363         for (size_t j = 0; j < ret_var.datalen; j++) {
39364                 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
39365                 *ret_conv_9_copy = ret_var.data[j];
39366                 int64_t ret_conv_9_ref = tag_ptr(ret_conv_9_copy, true);
39367                 ret_arr_ptr[j] = ret_conv_9_ref;
39368         }
39369         
39370         FREE(ret_var.data);
39371         return ret_arr;
39372 }
39373
39374 int64_t  CS_LDK_ChainMonitor_get_monitor(int64_t this_arg, int64_t funding_txo) {
39375         LDKChainMonitor this_arg_conv;
39376         this_arg_conv.inner = untag_ptr(this_arg);
39377         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39378         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39379         this_arg_conv.is_owned = false;
39380         LDKOutPoint funding_txo_conv;
39381         funding_txo_conv.inner = untag_ptr(funding_txo);
39382         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
39383         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
39384         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
39385         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
39386         *ret_conv = ChainMonitor_get_monitor(&this_arg_conv, funding_txo_conv);
39387         return tag_ptr(ret_conv, true);
39388 }
39389
39390 int64_tArray  CS_LDK_ChainMonitor_list_monitors(int64_t this_arg) {
39391         LDKChainMonitor this_arg_conv;
39392         this_arg_conv.inner = untag_ptr(this_arg);
39393         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39394         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39395         this_arg_conv.is_owned = false;
39396         LDKCVec_C2Tuple_OutPointChannelIdZZ ret_var = ChainMonitor_list_monitors(&this_arg_conv);
39397         int64_tArray ret_arr = NULL;
39398         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
39399         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
39400         for (size_t d = 0; d < ret_var.datalen; d++) {
39401                 LDKC2Tuple_OutPointChannelIdZ* ret_conv_29_conv = MALLOC(sizeof(LDKC2Tuple_OutPointChannelIdZ), "LDKC2Tuple_OutPointChannelIdZ");
39402                 *ret_conv_29_conv = ret_var.data[d];
39403                 ret_arr_ptr[d] = tag_ptr(ret_conv_29_conv, true);
39404         }
39405         
39406         FREE(ret_var.data);
39407         return ret_arr;
39408 }
39409
39410 int64_tArray  CS_LDK_ChainMonitor_list_pending_monitor_updates(int64_t this_arg) {
39411         LDKChainMonitor this_arg_conv;
39412         this_arg_conv.inner = untag_ptr(this_arg);
39413         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39414         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39415         this_arg_conv.is_owned = false;
39416         LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ ret_var = ChainMonitor_list_pending_monitor_updates(&this_arg_conv);
39417         int64_tArray ret_arr = NULL;
39418         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
39419         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
39420         for (size_t p = 0; p < ret_var.datalen; p++) {
39421                 LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv_41_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
39422                 *ret_conv_41_conv = ret_var.data[p];
39423                 ret_arr_ptr[p] = tag_ptr(ret_conv_41_conv, true);
39424         }
39425         
39426         FREE(ret_var.data);
39427         return ret_arr;
39428 }
39429
39430 int64_t  CS_LDK_ChainMonitor_channel_monitor_updated(int64_t this_arg, int64_t funding_txo, int64_t completed_update_id) {
39431         LDKChainMonitor this_arg_conv;
39432         this_arg_conv.inner = untag_ptr(this_arg);
39433         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39434         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39435         this_arg_conv.is_owned = false;
39436         LDKOutPoint funding_txo_conv;
39437         funding_txo_conv.inner = untag_ptr(funding_txo);
39438         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
39439         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
39440         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
39441         LDKMonitorUpdateId completed_update_id_conv;
39442         completed_update_id_conv.inner = untag_ptr(completed_update_id);
39443         completed_update_id_conv.is_owned = ptr_is_owned(completed_update_id);
39444         CHECK_INNER_FIELD_ACCESS_OR_NULL(completed_update_id_conv);
39445         completed_update_id_conv = MonitorUpdateId_clone(&completed_update_id_conv);
39446         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
39447         *ret_conv = ChainMonitor_channel_monitor_updated(&this_arg_conv, funding_txo_conv, completed_update_id_conv);
39448         return tag_ptr(ret_conv, true);
39449 }
39450
39451 int64_t  CS_LDK_ChainMonitor_get_update_future(int64_t this_arg) {
39452         LDKChainMonitor this_arg_conv;
39453         this_arg_conv.inner = untag_ptr(this_arg);
39454         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39455         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39456         this_arg_conv.is_owned = false;
39457         LDKFuture ret_var = ChainMonitor_get_update_future(&this_arg_conv);
39458         int64_t ret_ref = 0;
39459         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39460         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39461         return ret_ref;
39462 }
39463
39464 void  CS_LDK_ChainMonitor_rebroadcast_pending_claims(int64_t this_arg) {
39465         LDKChainMonitor this_arg_conv;
39466         this_arg_conv.inner = untag_ptr(this_arg);
39467         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39468         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39469         this_arg_conv.is_owned = false;
39470         ChainMonitor_rebroadcast_pending_claims(&this_arg_conv);
39471 }
39472
39473 void  CS_LDK_ChainMonitor_signer_unblocked(int64_t this_arg, int64_t monitor_opt) {
39474         LDKChainMonitor this_arg_conv;
39475         this_arg_conv.inner = untag_ptr(this_arg);
39476         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39477         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39478         this_arg_conv.is_owned = false;
39479         LDKOutPoint monitor_opt_conv;
39480         monitor_opt_conv.inner = untag_ptr(monitor_opt);
39481         monitor_opt_conv.is_owned = ptr_is_owned(monitor_opt);
39482         CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_opt_conv);
39483         monitor_opt_conv = OutPoint_clone(&monitor_opt_conv);
39484         ChainMonitor_signer_unblocked(&this_arg_conv, monitor_opt_conv);
39485 }
39486
39487 void  CS_LDK_ChainMonitor_archive_fully_resolved_channel_monitors(int64_t this_arg) {
39488         LDKChainMonitor this_arg_conv;
39489         this_arg_conv.inner = untag_ptr(this_arg);
39490         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39491         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39492         this_arg_conv.is_owned = false;
39493         ChainMonitor_archive_fully_resolved_channel_monitors(&this_arg_conv);
39494 }
39495
39496 int64_t  CS_LDK_ChainMonitor_as_Listen(int64_t this_arg) {
39497         LDKChainMonitor this_arg_conv;
39498         this_arg_conv.inner = untag_ptr(this_arg);
39499         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39500         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39501         this_arg_conv.is_owned = false;
39502         LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
39503         *ret_ret = ChainMonitor_as_Listen(&this_arg_conv);
39504         return tag_ptr(ret_ret, true);
39505 }
39506
39507 int64_t  CS_LDK_ChainMonitor_as_Confirm(int64_t this_arg) {
39508         LDKChainMonitor this_arg_conv;
39509         this_arg_conv.inner = untag_ptr(this_arg);
39510         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39511         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39512         this_arg_conv.is_owned = false;
39513         LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
39514         *ret_ret = ChainMonitor_as_Confirm(&this_arg_conv);
39515         return tag_ptr(ret_ret, true);
39516 }
39517
39518 int64_t  CS_LDK_ChainMonitor_as_Watch(int64_t this_arg) {
39519         LDKChainMonitor this_arg_conv;
39520         this_arg_conv.inner = untag_ptr(this_arg);
39521         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39522         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39523         this_arg_conv.is_owned = false;
39524         LDKWatch* ret_ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
39525         *ret_ret = ChainMonitor_as_Watch(&this_arg_conv);
39526         return tag_ptr(ret_ret, true);
39527 }
39528
39529 int64_t  CS_LDK_ChainMonitor_as_EventsProvider(int64_t this_arg) {
39530         LDKChainMonitor this_arg_conv;
39531         this_arg_conv.inner = untag_ptr(this_arg);
39532         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39533         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39534         this_arg_conv.is_owned = false;
39535         LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
39536         *ret_ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
39537         return tag_ptr(ret_ret, true);
39538 }
39539
39540 void  CS_LDK_ChannelMonitorUpdate_free(int64_t this_obj) {
39541         LDKChannelMonitorUpdate this_obj_conv;
39542         this_obj_conv.inner = untag_ptr(this_obj);
39543         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39544         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39545         ChannelMonitorUpdate_free(this_obj_conv);
39546 }
39547
39548 int64_t  CS_LDK_ChannelMonitorUpdate_get_update_id(int64_t this_ptr) {
39549         LDKChannelMonitorUpdate this_ptr_conv;
39550         this_ptr_conv.inner = untag_ptr(this_ptr);
39551         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39552         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39553         this_ptr_conv.is_owned = false;
39554         int64_t ret_conv = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
39555         return ret_conv;
39556 }
39557
39558 void  CS_LDK_ChannelMonitorUpdate_set_update_id(int64_t this_ptr, int64_t val) {
39559         LDKChannelMonitorUpdate this_ptr_conv;
39560         this_ptr_conv.inner = untag_ptr(this_ptr);
39561         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39562         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39563         this_ptr_conv.is_owned = false;
39564         ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
39565 }
39566
39567 int64_t  CS_LDK_ChannelMonitorUpdate_get_channel_id(int64_t this_ptr) {
39568         LDKChannelMonitorUpdate this_ptr_conv;
39569         this_ptr_conv.inner = untag_ptr(this_ptr);
39570         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39571         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39572         this_ptr_conv.is_owned = false;
39573         LDKChannelId ret_var = ChannelMonitorUpdate_get_channel_id(&this_ptr_conv);
39574         int64_t ret_ref = 0;
39575         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39576         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39577         return ret_ref;
39578 }
39579
39580 void  CS_LDK_ChannelMonitorUpdate_set_channel_id(int64_t this_ptr, int64_t val) {
39581         LDKChannelMonitorUpdate this_ptr_conv;
39582         this_ptr_conv.inner = untag_ptr(this_ptr);
39583         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39584         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39585         this_ptr_conv.is_owned = false;
39586         LDKChannelId val_conv;
39587         val_conv.inner = untag_ptr(val);
39588         val_conv.is_owned = ptr_is_owned(val);
39589         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39590         val_conv = ChannelId_clone(&val_conv);
39591         ChannelMonitorUpdate_set_channel_id(&this_ptr_conv, val_conv);
39592 }
39593
39594 static inline uint64_t ChannelMonitorUpdate_clone_ptr(LDKChannelMonitorUpdate *NONNULL_PTR arg) {
39595         LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(arg);
39596         int64_t ret_ref = 0;
39597         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39598         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39599         return ret_ref;
39600 }
39601 int64_t  CS_LDK_ChannelMonitorUpdate_clone_ptr(int64_t arg) {
39602         LDKChannelMonitorUpdate arg_conv;
39603         arg_conv.inner = untag_ptr(arg);
39604         arg_conv.is_owned = ptr_is_owned(arg);
39605         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39606         arg_conv.is_owned = false;
39607         int64_t ret_conv = ChannelMonitorUpdate_clone_ptr(&arg_conv);
39608         return ret_conv;
39609 }
39610
39611 int64_t  CS_LDK_ChannelMonitorUpdate_clone(int64_t orig) {
39612         LDKChannelMonitorUpdate orig_conv;
39613         orig_conv.inner = untag_ptr(orig);
39614         orig_conv.is_owned = ptr_is_owned(orig);
39615         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39616         orig_conv.is_owned = false;
39617         LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
39618         int64_t ret_ref = 0;
39619         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39620         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39621         return ret_ref;
39622 }
39623
39624 jboolean  CS_LDK_ChannelMonitorUpdate_eq(int64_t a, int64_t b) {
39625         LDKChannelMonitorUpdate a_conv;
39626         a_conv.inner = untag_ptr(a);
39627         a_conv.is_owned = ptr_is_owned(a);
39628         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39629         a_conv.is_owned = false;
39630         LDKChannelMonitorUpdate b_conv;
39631         b_conv.inner = untag_ptr(b);
39632         b_conv.is_owned = ptr_is_owned(b);
39633         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39634         b_conv.is_owned = false;
39635         jboolean ret_conv = ChannelMonitorUpdate_eq(&a_conv, &b_conv);
39636         return ret_conv;
39637 }
39638
39639 int8_tArray  CS_LDK_ChannelMonitorUpdate_write(int64_t obj) {
39640         LDKChannelMonitorUpdate obj_conv;
39641         obj_conv.inner = untag_ptr(obj);
39642         obj_conv.is_owned = ptr_is_owned(obj);
39643         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39644         obj_conv.is_owned = false;
39645         LDKCVec_u8Z ret_var = ChannelMonitorUpdate_write(&obj_conv);
39646         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39647         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39648         CVec_u8Z_free(ret_var);
39649         return ret_arr;
39650 }
39651
39652 int64_t  CS_LDK_ChannelMonitorUpdate_read(int8_tArray ser) {
39653         LDKu8slice ser_ref;
39654         ser_ref.datalen = ser->arr_len;
39655         ser_ref.data = ser->elems;
39656         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
39657         *ret_conv = ChannelMonitorUpdate_read(ser_ref);
39658         FREE(ser);
39659         return tag_ptr(ret_conv, true);
39660 }
39661
39662 void  CS_LDK_MonitorEvent_free(int64_t this_ptr) {
39663         if (!ptr_is_owned(this_ptr)) return;
39664         void* this_ptr_ptr = untag_ptr(this_ptr);
39665         CHECK_ACCESS(this_ptr_ptr);
39666         LDKMonitorEvent this_ptr_conv = *(LDKMonitorEvent*)(this_ptr_ptr);
39667         FREE(untag_ptr(this_ptr));
39668         MonitorEvent_free(this_ptr_conv);
39669 }
39670
39671 static inline uint64_t MonitorEvent_clone_ptr(LDKMonitorEvent *NONNULL_PTR arg) {
39672         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
39673         *ret_copy = MonitorEvent_clone(arg);
39674         int64_t ret_ref = tag_ptr(ret_copy, true);
39675         return ret_ref;
39676 }
39677 int64_t  CS_LDK_MonitorEvent_clone_ptr(int64_t arg) {
39678         LDKMonitorEvent* arg_conv = (LDKMonitorEvent*)untag_ptr(arg);
39679         int64_t ret_conv = MonitorEvent_clone_ptr(arg_conv);
39680         return ret_conv;
39681 }
39682
39683 int64_t  CS_LDK_MonitorEvent_clone(int64_t orig) {
39684         LDKMonitorEvent* orig_conv = (LDKMonitorEvent*)untag_ptr(orig);
39685         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
39686         *ret_copy = MonitorEvent_clone(orig_conv);
39687         int64_t ret_ref = tag_ptr(ret_copy, true);
39688         return ret_ref;
39689 }
39690
39691 int64_t  CS_LDK_MonitorEvent_htlcevent(int64_t a) {
39692         LDKHTLCUpdate a_conv;
39693         a_conv.inner = untag_ptr(a);
39694         a_conv.is_owned = ptr_is_owned(a);
39695         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39696         a_conv = HTLCUpdate_clone(&a_conv);
39697         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
39698         *ret_copy = MonitorEvent_htlcevent(a_conv);
39699         int64_t ret_ref = tag_ptr(ret_copy, true);
39700         return ret_ref;
39701 }
39702
39703 int64_t  CS_LDK_MonitorEvent_holder_force_closed_with_info(int64_t reason, int64_t outpoint, int64_t channel_id) {
39704         void* reason_ptr = untag_ptr(reason);
39705         CHECK_ACCESS(reason_ptr);
39706         LDKClosureReason reason_conv = *(LDKClosureReason*)(reason_ptr);
39707         reason_conv = ClosureReason_clone((LDKClosureReason*)untag_ptr(reason));
39708         LDKOutPoint outpoint_conv;
39709         outpoint_conv.inner = untag_ptr(outpoint);
39710         outpoint_conv.is_owned = ptr_is_owned(outpoint);
39711         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_conv);
39712         outpoint_conv = OutPoint_clone(&outpoint_conv);
39713         LDKChannelId channel_id_conv;
39714         channel_id_conv.inner = untag_ptr(channel_id);
39715         channel_id_conv.is_owned = ptr_is_owned(channel_id);
39716         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
39717         channel_id_conv = ChannelId_clone(&channel_id_conv);
39718         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
39719         *ret_copy = MonitorEvent_holder_force_closed_with_info(reason_conv, outpoint_conv, channel_id_conv);
39720         int64_t ret_ref = tag_ptr(ret_copy, true);
39721         return ret_ref;
39722 }
39723
39724 int64_t  CS_LDK_MonitorEvent_holder_force_closed(int64_t a) {
39725         LDKOutPoint a_conv;
39726         a_conv.inner = untag_ptr(a);
39727         a_conv.is_owned = ptr_is_owned(a);
39728         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39729         a_conv = OutPoint_clone(&a_conv);
39730         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
39731         *ret_copy = MonitorEvent_holder_force_closed(a_conv);
39732         int64_t ret_ref = tag_ptr(ret_copy, true);
39733         return ret_ref;
39734 }
39735
39736 int64_t  CS_LDK_MonitorEvent_completed(int64_t funding_txo, int64_t channel_id, int64_t monitor_update_id) {
39737         LDKOutPoint funding_txo_conv;
39738         funding_txo_conv.inner = untag_ptr(funding_txo);
39739         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
39740         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
39741         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
39742         LDKChannelId channel_id_conv;
39743         channel_id_conv.inner = untag_ptr(channel_id);
39744         channel_id_conv.is_owned = ptr_is_owned(channel_id);
39745         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
39746         channel_id_conv = ChannelId_clone(&channel_id_conv);
39747         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
39748         *ret_copy = MonitorEvent_completed(funding_txo_conv, channel_id_conv, monitor_update_id);
39749         int64_t ret_ref = tag_ptr(ret_copy, true);
39750         return ret_ref;
39751 }
39752
39753 jboolean  CS_LDK_MonitorEvent_eq(int64_t a, int64_t b) {
39754         LDKMonitorEvent* a_conv = (LDKMonitorEvent*)untag_ptr(a);
39755         LDKMonitorEvent* b_conv = (LDKMonitorEvent*)untag_ptr(b);
39756         jboolean ret_conv = MonitorEvent_eq(a_conv, b_conv);
39757         return ret_conv;
39758 }
39759
39760 int8_tArray  CS_LDK_MonitorEvent_write(int64_t obj) {
39761         LDKMonitorEvent* obj_conv = (LDKMonitorEvent*)untag_ptr(obj);
39762         LDKCVec_u8Z ret_var = MonitorEvent_write(obj_conv);
39763         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39764         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39765         CVec_u8Z_free(ret_var);
39766         return ret_arr;
39767 }
39768
39769 int64_t  CS_LDK_MonitorEvent_read(int8_tArray ser) {
39770         LDKu8slice ser_ref;
39771         ser_ref.datalen = ser->arr_len;
39772         ser_ref.data = ser->elems;
39773         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
39774         *ret_conv = MonitorEvent_read(ser_ref);
39775         FREE(ser);
39776         return tag_ptr(ret_conv, true);
39777 }
39778
39779 void  CS_LDK_HTLCUpdate_free(int64_t this_obj) {
39780         LDKHTLCUpdate this_obj_conv;
39781         this_obj_conv.inner = untag_ptr(this_obj);
39782         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39783         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39784         HTLCUpdate_free(this_obj_conv);
39785 }
39786
39787 static inline uint64_t HTLCUpdate_clone_ptr(LDKHTLCUpdate *NONNULL_PTR arg) {
39788         LDKHTLCUpdate ret_var = HTLCUpdate_clone(arg);
39789         int64_t ret_ref = 0;
39790         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39791         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39792         return ret_ref;
39793 }
39794 int64_t  CS_LDK_HTLCUpdate_clone_ptr(int64_t arg) {
39795         LDKHTLCUpdate arg_conv;
39796         arg_conv.inner = untag_ptr(arg);
39797         arg_conv.is_owned = ptr_is_owned(arg);
39798         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39799         arg_conv.is_owned = false;
39800         int64_t ret_conv = HTLCUpdate_clone_ptr(&arg_conv);
39801         return ret_conv;
39802 }
39803
39804 int64_t  CS_LDK_HTLCUpdate_clone(int64_t orig) {
39805         LDKHTLCUpdate orig_conv;
39806         orig_conv.inner = untag_ptr(orig);
39807         orig_conv.is_owned = ptr_is_owned(orig);
39808         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39809         orig_conv.is_owned = false;
39810         LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
39811         int64_t ret_ref = 0;
39812         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39813         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39814         return ret_ref;
39815 }
39816
39817 jboolean  CS_LDK_HTLCUpdate_eq(int64_t a, int64_t b) {
39818         LDKHTLCUpdate a_conv;
39819         a_conv.inner = untag_ptr(a);
39820         a_conv.is_owned = ptr_is_owned(a);
39821         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39822         a_conv.is_owned = false;
39823         LDKHTLCUpdate b_conv;
39824         b_conv.inner = untag_ptr(b);
39825         b_conv.is_owned = ptr_is_owned(b);
39826         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39827         b_conv.is_owned = false;
39828         jboolean ret_conv = HTLCUpdate_eq(&a_conv, &b_conv);
39829         return ret_conv;
39830 }
39831
39832 int8_tArray  CS_LDK_HTLCUpdate_write(int64_t obj) {
39833         LDKHTLCUpdate obj_conv;
39834         obj_conv.inner = untag_ptr(obj);
39835         obj_conv.is_owned = ptr_is_owned(obj);
39836         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39837         obj_conv.is_owned = false;
39838         LDKCVec_u8Z ret_var = HTLCUpdate_write(&obj_conv);
39839         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39840         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39841         CVec_u8Z_free(ret_var);
39842         return ret_arr;
39843 }
39844
39845 int64_t  CS_LDK_HTLCUpdate_read(int8_tArray ser) {
39846         LDKu8slice ser_ref;
39847         ser_ref.datalen = ser->arr_len;
39848         ser_ref.data = ser->elems;
39849         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
39850         *ret_conv = HTLCUpdate_read(ser_ref);
39851         FREE(ser);
39852         return tag_ptr(ret_conv, true);
39853 }
39854
39855 void  CS_LDK_Balance_free(int64_t this_ptr) {
39856         if (!ptr_is_owned(this_ptr)) return;
39857         void* this_ptr_ptr = untag_ptr(this_ptr);
39858         CHECK_ACCESS(this_ptr_ptr);
39859         LDKBalance this_ptr_conv = *(LDKBalance*)(this_ptr_ptr);
39860         FREE(untag_ptr(this_ptr));
39861         Balance_free(this_ptr_conv);
39862 }
39863
39864 static inline uint64_t Balance_clone_ptr(LDKBalance *NONNULL_PTR arg) {
39865         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
39866         *ret_copy = Balance_clone(arg);
39867         int64_t ret_ref = tag_ptr(ret_copy, true);
39868         return ret_ref;
39869 }
39870 int64_t  CS_LDK_Balance_clone_ptr(int64_t arg) {
39871         LDKBalance* arg_conv = (LDKBalance*)untag_ptr(arg);
39872         int64_t ret_conv = Balance_clone_ptr(arg_conv);
39873         return ret_conv;
39874 }
39875
39876 int64_t  CS_LDK_Balance_clone(int64_t orig) {
39877         LDKBalance* orig_conv = (LDKBalance*)untag_ptr(orig);
39878         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
39879         *ret_copy = Balance_clone(orig_conv);
39880         int64_t ret_ref = tag_ptr(ret_copy, true);
39881         return ret_ref;
39882 }
39883
39884 int64_t  CS_LDK_Balance_claimable_on_channel_close(int64_t amount_satoshis) {
39885         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
39886         *ret_copy = Balance_claimable_on_channel_close(amount_satoshis);
39887         int64_t ret_ref = tag_ptr(ret_copy, true);
39888         return ret_ref;
39889 }
39890
39891 int64_t  CS_LDK_Balance_claimable_awaiting_confirmations(int64_t amount_satoshis, int32_t confirmation_height) {
39892         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
39893         *ret_copy = Balance_claimable_awaiting_confirmations(amount_satoshis, confirmation_height);
39894         int64_t ret_ref = tag_ptr(ret_copy, true);
39895         return ret_ref;
39896 }
39897
39898 int64_t  CS_LDK_Balance_contentious_claimable(int64_t amount_satoshis, int32_t timeout_height, int8_tArray payment_hash, int8_tArray payment_preimage) {
39899         LDKThirtyTwoBytes payment_hash_ref;
39900         CHECK(payment_hash->arr_len == 32);
39901         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
39902         LDKThirtyTwoBytes payment_preimage_ref;
39903         CHECK(payment_preimage->arr_len == 32);
39904         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
39905         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
39906         *ret_copy = Balance_contentious_claimable(amount_satoshis, timeout_height, payment_hash_ref, payment_preimage_ref);
39907         int64_t ret_ref = tag_ptr(ret_copy, true);
39908         return ret_ref;
39909 }
39910
39911 int64_t  CS_LDK_Balance_maybe_timeout_claimable_htlc(int64_t amount_satoshis, int32_t claimable_height, int8_tArray payment_hash) {
39912         LDKThirtyTwoBytes payment_hash_ref;
39913         CHECK(payment_hash->arr_len == 32);
39914         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
39915         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
39916         *ret_copy = Balance_maybe_timeout_claimable_htlc(amount_satoshis, claimable_height, payment_hash_ref);
39917         int64_t ret_ref = tag_ptr(ret_copy, true);
39918         return ret_ref;
39919 }
39920
39921 int64_t  CS_LDK_Balance_maybe_preimage_claimable_htlc(int64_t amount_satoshis, int32_t expiry_height, int8_tArray payment_hash) {
39922         LDKThirtyTwoBytes payment_hash_ref;
39923         CHECK(payment_hash->arr_len == 32);
39924         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
39925         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
39926         *ret_copy = Balance_maybe_preimage_claimable_htlc(amount_satoshis, expiry_height, payment_hash_ref);
39927         int64_t ret_ref = tag_ptr(ret_copy, true);
39928         return ret_ref;
39929 }
39930
39931 int64_t  CS_LDK_Balance_counterparty_revoked_output_claimable(int64_t amount_satoshis) {
39932         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
39933         *ret_copy = Balance_counterparty_revoked_output_claimable(amount_satoshis);
39934         int64_t ret_ref = tag_ptr(ret_copy, true);
39935         return ret_ref;
39936 }
39937
39938 jboolean  CS_LDK_Balance_eq(int64_t a, int64_t b) {
39939         LDKBalance* a_conv = (LDKBalance*)untag_ptr(a);
39940         LDKBalance* b_conv = (LDKBalance*)untag_ptr(b);
39941         jboolean ret_conv = Balance_eq(a_conv, b_conv);
39942         return ret_conv;
39943 }
39944
39945 int64_t  CS_LDK_Balance_claimable_amount_satoshis(int64_t this_arg) {
39946         LDKBalance* this_arg_conv = (LDKBalance*)untag_ptr(this_arg);
39947         int64_t ret_conv = Balance_claimable_amount_satoshis(this_arg_conv);
39948         return ret_conv;
39949 }
39950
39951 void  CS_LDK_ChannelMonitor_free(int64_t this_obj) {
39952         LDKChannelMonitor this_obj_conv;
39953         this_obj_conv.inner = untag_ptr(this_obj);
39954         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39955         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39956         ChannelMonitor_free(this_obj_conv);
39957 }
39958
39959 static inline uint64_t ChannelMonitor_clone_ptr(LDKChannelMonitor *NONNULL_PTR arg) {
39960         LDKChannelMonitor ret_var = ChannelMonitor_clone(arg);
39961         int64_t ret_ref = 0;
39962         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39963         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39964         return ret_ref;
39965 }
39966 int64_t  CS_LDK_ChannelMonitor_clone_ptr(int64_t arg) {
39967         LDKChannelMonitor arg_conv;
39968         arg_conv.inner = untag_ptr(arg);
39969         arg_conv.is_owned = ptr_is_owned(arg);
39970         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39971         arg_conv.is_owned = false;
39972         int64_t ret_conv = ChannelMonitor_clone_ptr(&arg_conv);
39973         return ret_conv;
39974 }
39975
39976 int64_t  CS_LDK_ChannelMonitor_clone(int64_t orig) {
39977         LDKChannelMonitor orig_conv;
39978         orig_conv.inner = untag_ptr(orig);
39979         orig_conv.is_owned = ptr_is_owned(orig);
39980         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39981         orig_conv.is_owned = false;
39982         LDKChannelMonitor ret_var = ChannelMonitor_clone(&orig_conv);
39983         int64_t ret_ref = 0;
39984         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39985         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39986         return ret_ref;
39987 }
39988
39989 int8_tArray  CS_LDK_ChannelMonitor_write(int64_t obj) {
39990         LDKChannelMonitor obj_conv;
39991         obj_conv.inner = untag_ptr(obj);
39992         obj_conv.is_owned = ptr_is_owned(obj);
39993         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39994         obj_conv.is_owned = false;
39995         LDKCVec_u8Z ret_var = ChannelMonitor_write(&obj_conv);
39996         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39997         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39998         CVec_u8Z_free(ret_var);
39999         return ret_arr;
40000 }
40001
40002 int64_t  CS_LDK_ChannelMonitor_update_monitor(int64_t this_arg, int64_t updates, int64_t broadcaster, int64_t fee_estimator, int64_t logger) {
40003         LDKChannelMonitor this_arg_conv;
40004         this_arg_conv.inner = untag_ptr(this_arg);
40005         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40006         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40007         this_arg_conv.is_owned = false;
40008         LDKChannelMonitorUpdate updates_conv;
40009         updates_conv.inner = untag_ptr(updates);
40010         updates_conv.is_owned = ptr_is_owned(updates);
40011         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
40012         updates_conv.is_owned = false;
40013         void* broadcaster_ptr = untag_ptr(broadcaster);
40014         if (ptr_is_owned(broadcaster)) { CHECK_ACCESS(broadcaster_ptr); }
40015         LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
40016         void* fee_estimator_ptr = untag_ptr(fee_estimator);
40017         if (ptr_is_owned(fee_estimator)) { CHECK_ACCESS(fee_estimator_ptr); }
40018         LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator_ptr;
40019         void* logger_ptr = untag_ptr(logger);
40020         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
40021         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
40022         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
40023         *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
40024         return tag_ptr(ret_conv, true);
40025 }
40026
40027 int64_t  CS_LDK_ChannelMonitor_get_latest_update_id(int64_t this_arg) {
40028         LDKChannelMonitor this_arg_conv;
40029         this_arg_conv.inner = untag_ptr(this_arg);
40030         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40031         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40032         this_arg_conv.is_owned = false;
40033         int64_t ret_conv = ChannelMonitor_get_latest_update_id(&this_arg_conv);
40034         return ret_conv;
40035 }
40036
40037 int64_t  CS_LDK_ChannelMonitor_get_funding_txo(int64_t this_arg) {
40038         LDKChannelMonitor this_arg_conv;
40039         this_arg_conv.inner = untag_ptr(this_arg);
40040         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40041         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40042         this_arg_conv.is_owned = false;
40043         LDKC2Tuple_OutPointCVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_u8ZZ), "LDKC2Tuple_OutPointCVec_u8ZZ");
40044         *ret_conv = ChannelMonitor_get_funding_txo(&this_arg_conv);
40045         return tag_ptr(ret_conv, true);
40046 }
40047
40048 int64_t  CS_LDK_ChannelMonitor_channel_id(int64_t this_arg) {
40049         LDKChannelMonitor this_arg_conv;
40050         this_arg_conv.inner = untag_ptr(this_arg);
40051         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40052         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40053         this_arg_conv.is_owned = false;
40054         LDKChannelId ret_var = ChannelMonitor_channel_id(&this_arg_conv);
40055         int64_t ret_ref = 0;
40056         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40057         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40058         return ret_ref;
40059 }
40060
40061 int64_tArray  CS_LDK_ChannelMonitor_get_outputs_to_watch(int64_t this_arg) {
40062         LDKChannelMonitor this_arg_conv;
40063         this_arg_conv.inner = untag_ptr(this_arg);
40064         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40065         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40066         this_arg_conv.is_owned = false;
40067         LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ ret_var = ChannelMonitor_get_outputs_to_watch(&this_arg_conv);
40068         int64_tArray ret_arr = NULL;
40069         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
40070         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
40071         for (size_t a = 0; a < ret_var.datalen; a++) {
40072                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* ret_conv_52_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ");
40073                 *ret_conv_52_conv = ret_var.data[a];
40074                 ret_arr_ptr[a] = tag_ptr(ret_conv_52_conv, true);
40075         }
40076         
40077         FREE(ret_var.data);
40078         return ret_arr;
40079 }
40080
40081 void  CS_LDK_ChannelMonitor_load_outputs_to_watch(int64_t this_arg, int64_t filter, int64_t logger) {
40082         LDKChannelMonitor this_arg_conv;
40083         this_arg_conv.inner = untag_ptr(this_arg);
40084         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40085         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40086         this_arg_conv.is_owned = false;
40087         void* filter_ptr = untag_ptr(filter);
40088         if (ptr_is_owned(filter)) { CHECK_ACCESS(filter_ptr); }
40089         LDKFilter* filter_conv = (LDKFilter*)filter_ptr;
40090         void* logger_ptr = untag_ptr(logger);
40091         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
40092         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
40093         ChannelMonitor_load_outputs_to_watch(&this_arg_conv, filter_conv, logger_conv);
40094 }
40095
40096 int64_tArray  CS_LDK_ChannelMonitor_get_and_clear_pending_monitor_events(int64_t this_arg) {
40097         LDKChannelMonitor this_arg_conv;
40098         this_arg_conv.inner = untag_ptr(this_arg);
40099         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40100         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40101         this_arg_conv.is_owned = false;
40102         LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
40103         int64_tArray ret_arr = NULL;
40104         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
40105         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
40106         for (size_t o = 0; o < ret_var.datalen; o++) {
40107                 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
40108                 *ret_conv_14_copy = ret_var.data[o];
40109                 int64_t ret_conv_14_ref = tag_ptr(ret_conv_14_copy, true);
40110                 ret_arr_ptr[o] = ret_conv_14_ref;
40111         }
40112         
40113         FREE(ret_var.data);
40114         return ret_arr;
40115 }
40116
40117 void  CS_LDK_ChannelMonitor_process_pending_events(int64_t this_arg, int64_t handler) {
40118         LDKChannelMonitor this_arg_conv;
40119         this_arg_conv.inner = untag_ptr(this_arg);
40120         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40121         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40122         this_arg_conv.is_owned = false;
40123         void* handler_ptr = untag_ptr(handler);
40124         if (ptr_is_owned(handler)) { CHECK_ACCESS(handler_ptr); }
40125         LDKEventHandler* handler_conv = (LDKEventHandler*)handler_ptr;
40126         ChannelMonitor_process_pending_events(&this_arg_conv, handler_conv);
40127 }
40128
40129 int64_t  CS_LDK_ChannelMonitor_initial_counterparty_commitment_tx(int64_t this_arg) {
40130         LDKChannelMonitor this_arg_conv;
40131         this_arg_conv.inner = untag_ptr(this_arg);
40132         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40133         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40134         this_arg_conv.is_owned = false;
40135         LDKCommitmentTransaction ret_var = ChannelMonitor_initial_counterparty_commitment_tx(&this_arg_conv);
40136         int64_t ret_ref = 0;
40137         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40138         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40139         return ret_ref;
40140 }
40141
40142 int64_tArray  CS_LDK_ChannelMonitor_counterparty_commitment_txs_from_update(int64_t this_arg, int64_t update) {
40143         LDKChannelMonitor this_arg_conv;
40144         this_arg_conv.inner = untag_ptr(this_arg);
40145         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40146         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40147         this_arg_conv.is_owned = false;
40148         LDKChannelMonitorUpdate update_conv;
40149         update_conv.inner = untag_ptr(update);
40150         update_conv.is_owned = ptr_is_owned(update);
40151         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
40152         update_conv.is_owned = false;
40153         LDKCVec_CommitmentTransactionZ ret_var = ChannelMonitor_counterparty_commitment_txs_from_update(&this_arg_conv, &update_conv);
40154         int64_tArray ret_arr = NULL;
40155         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
40156         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
40157         for (size_t x = 0; x < ret_var.datalen; x++) {
40158                 LDKCommitmentTransaction ret_conv_23_var = ret_var.data[x];
40159                 int64_t ret_conv_23_ref = 0;
40160                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_23_var);
40161                 ret_conv_23_ref = tag_ptr(ret_conv_23_var.inner, ret_conv_23_var.is_owned);
40162                 ret_arr_ptr[x] = ret_conv_23_ref;
40163         }
40164         
40165         FREE(ret_var.data);
40166         return ret_arr;
40167 }
40168
40169 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) {
40170         LDKChannelMonitor this_arg_conv;
40171         this_arg_conv.inner = untag_ptr(this_arg);
40172         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40173         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40174         this_arg_conv.is_owned = false;
40175         LDKTransaction justice_tx_ref;
40176         justice_tx_ref.datalen = justice_tx->arr_len;
40177         justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
40178         memcpy(justice_tx_ref.data, justice_tx->elems, justice_tx_ref.datalen); FREE(justice_tx);
40179         justice_tx_ref.data_is_owned = true;
40180         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
40181         *ret_conv = ChannelMonitor_sign_to_local_justice_tx(&this_arg_conv, justice_tx_ref, input_idx, value, commitment_number);
40182         return tag_ptr(ret_conv, true);
40183 }
40184
40185 int8_tArray  CS_LDK_ChannelMonitor_get_counterparty_node_id(int64_t this_arg) {
40186         LDKChannelMonitor this_arg_conv;
40187         this_arg_conv.inner = untag_ptr(this_arg);
40188         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40189         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40190         this_arg_conv.is_owned = false;
40191         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
40192         memcpy(ret_arr->elems, ChannelMonitor_get_counterparty_node_id(&this_arg_conv).compressed_form, 33);
40193         return ret_arr;
40194 }
40195
40196 void  CS_LDK_ChannelMonitor_broadcast_latest_holder_commitment_txn(int64_t this_arg, int64_t broadcaster, int64_t fee_estimator, int64_t logger) {
40197         LDKChannelMonitor this_arg_conv;
40198         this_arg_conv.inner = untag_ptr(this_arg);
40199         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40200         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40201         this_arg_conv.is_owned = false;
40202         void* broadcaster_ptr = untag_ptr(broadcaster);
40203         if (ptr_is_owned(broadcaster)) { CHECK_ACCESS(broadcaster_ptr); }
40204         LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
40205         void* fee_estimator_ptr = untag_ptr(fee_estimator);
40206         if (ptr_is_owned(fee_estimator)) { CHECK_ACCESS(fee_estimator_ptr); }
40207         LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator_ptr;
40208         void* logger_ptr = untag_ptr(logger);
40209         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
40210         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
40211         ChannelMonitor_broadcast_latest_holder_commitment_txn(&this_arg_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
40212 }
40213
40214 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) {
40215         LDKChannelMonitor this_arg_conv;
40216         this_arg_conv.inner = untag_ptr(this_arg);
40217         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40218         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40219         this_arg_conv.is_owned = false;
40220         uint8_t header_arr[80];
40221         CHECK(header->arr_len == 80);
40222         memcpy(header_arr, header->elems, 80); FREE(header);
40223         uint8_t (*header_ref)[80] = &header_arr;
40224         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
40225         txdata_constr.datalen = txdata->arr_len;
40226         if (txdata_constr.datalen > 0)
40227                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
40228         else
40229                 txdata_constr.data = NULL;
40230         int64_t* txdata_vals = txdata->elems;
40231         for (size_t c = 0; c < txdata_constr.datalen; c++) {
40232                 int64_t txdata_conv_28 = txdata_vals[c];
40233                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
40234                 CHECK_ACCESS(txdata_conv_28_ptr);
40235                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
40236                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
40237                 txdata_constr.data[c] = txdata_conv_28_conv;
40238         }
40239         FREE(txdata);
40240         void* broadcaster_ptr = untag_ptr(broadcaster);
40241         CHECK_ACCESS(broadcaster_ptr);
40242         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
40243         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
40244                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
40245                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
40246         }
40247         void* fee_estimator_ptr = untag_ptr(fee_estimator);
40248         CHECK_ACCESS(fee_estimator_ptr);
40249         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
40250         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
40251                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
40252                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
40253         }
40254         void* logger_ptr = untag_ptr(logger);
40255         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
40256         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
40257         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);
40258         int64_tArray ret_arr = NULL;
40259         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
40260         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
40261         for (size_t x = 0; x < ret_var.datalen; x++) {
40262                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv_49_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
40263                 *ret_conv_49_conv = ret_var.data[x];
40264                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
40265         }
40266         
40267         FREE(ret_var.data);
40268         return ret_arr;
40269 }
40270
40271 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) {
40272         LDKChannelMonitor this_arg_conv;
40273         this_arg_conv.inner = untag_ptr(this_arg);
40274         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40275         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40276         this_arg_conv.is_owned = false;
40277         uint8_t header_arr[80];
40278         CHECK(header->arr_len == 80);
40279         memcpy(header_arr, header->elems, 80); FREE(header);
40280         uint8_t (*header_ref)[80] = &header_arr;
40281         void* broadcaster_ptr = untag_ptr(broadcaster);
40282         CHECK_ACCESS(broadcaster_ptr);
40283         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
40284         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
40285                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
40286                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
40287         }
40288         void* fee_estimator_ptr = untag_ptr(fee_estimator);
40289         CHECK_ACCESS(fee_estimator_ptr);
40290         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
40291         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
40292                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
40293                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
40294         }
40295         void* logger_ptr = untag_ptr(logger);
40296         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
40297         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
40298         ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
40299 }
40300
40301 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) {
40302         LDKChannelMonitor this_arg_conv;
40303         this_arg_conv.inner = untag_ptr(this_arg);
40304         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40305         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40306         this_arg_conv.is_owned = false;
40307         uint8_t header_arr[80];
40308         CHECK(header->arr_len == 80);
40309         memcpy(header_arr, header->elems, 80); FREE(header);
40310         uint8_t (*header_ref)[80] = &header_arr;
40311         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
40312         txdata_constr.datalen = txdata->arr_len;
40313         if (txdata_constr.datalen > 0)
40314                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
40315         else
40316                 txdata_constr.data = NULL;
40317         int64_t* txdata_vals = txdata->elems;
40318         for (size_t c = 0; c < txdata_constr.datalen; c++) {
40319                 int64_t txdata_conv_28 = txdata_vals[c];
40320                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
40321                 CHECK_ACCESS(txdata_conv_28_ptr);
40322                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
40323                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
40324                 txdata_constr.data[c] = txdata_conv_28_conv;
40325         }
40326         FREE(txdata);
40327         void* broadcaster_ptr = untag_ptr(broadcaster);
40328         CHECK_ACCESS(broadcaster_ptr);
40329         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
40330         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
40331                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
40332                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
40333         }
40334         void* fee_estimator_ptr = untag_ptr(fee_estimator);
40335         CHECK_ACCESS(fee_estimator_ptr);
40336         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
40337         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
40338                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
40339                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
40340         }
40341         void* logger_ptr = untag_ptr(logger);
40342         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
40343         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
40344         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);
40345         int64_tArray ret_arr = NULL;
40346         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
40347         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
40348         for (size_t x = 0; x < ret_var.datalen; x++) {
40349                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv_49_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
40350                 *ret_conv_49_conv = ret_var.data[x];
40351                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
40352         }
40353         
40354         FREE(ret_var.data);
40355         return ret_arr;
40356 }
40357
40358 void  CS_LDK_ChannelMonitor_transaction_unconfirmed(int64_t this_arg, int8_tArray txid, int64_t broadcaster, int64_t fee_estimator, int64_t logger) {
40359         LDKChannelMonitor this_arg_conv;
40360         this_arg_conv.inner = untag_ptr(this_arg);
40361         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40362         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40363         this_arg_conv.is_owned = false;
40364         uint8_t txid_arr[32];
40365         CHECK(txid->arr_len == 32);
40366         memcpy(txid_arr, txid->elems, 32); FREE(txid);
40367         uint8_t (*txid_ref)[32] = &txid_arr;
40368         void* broadcaster_ptr = untag_ptr(broadcaster);
40369         CHECK_ACCESS(broadcaster_ptr);
40370         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
40371         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
40372                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
40373                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
40374         }
40375         void* fee_estimator_ptr = untag_ptr(fee_estimator);
40376         CHECK_ACCESS(fee_estimator_ptr);
40377         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
40378         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
40379                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
40380                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
40381         }
40382         void* logger_ptr = untag_ptr(logger);
40383         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
40384         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
40385         ChannelMonitor_transaction_unconfirmed(&this_arg_conv, txid_ref, broadcaster_conv, fee_estimator_conv, logger_conv);
40386 }
40387
40388 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) {
40389         LDKChannelMonitor this_arg_conv;
40390         this_arg_conv.inner = untag_ptr(this_arg);
40391         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40392         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40393         this_arg_conv.is_owned = false;
40394         uint8_t header_arr[80];
40395         CHECK(header->arr_len == 80);
40396         memcpy(header_arr, header->elems, 80); FREE(header);
40397         uint8_t (*header_ref)[80] = &header_arr;
40398         void* broadcaster_ptr = untag_ptr(broadcaster);
40399         CHECK_ACCESS(broadcaster_ptr);
40400         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
40401         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
40402                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
40403                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
40404         }
40405         void* fee_estimator_ptr = untag_ptr(fee_estimator);
40406         CHECK_ACCESS(fee_estimator_ptr);
40407         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
40408         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
40409                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
40410                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
40411         }
40412         void* logger_ptr = untag_ptr(logger);
40413         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
40414         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
40415         LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_best_block_updated(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
40416         int64_tArray ret_arr = NULL;
40417         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
40418         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
40419         for (size_t x = 0; x < ret_var.datalen; x++) {
40420                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv_49_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
40421                 *ret_conv_49_conv = ret_var.data[x];
40422                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
40423         }
40424         
40425         FREE(ret_var.data);
40426         return ret_arr;
40427 }
40428
40429 int64_tArray  CS_LDK_ChannelMonitor_get_relevant_txids(int64_t this_arg) {
40430         LDKChannelMonitor this_arg_conv;
40431         this_arg_conv.inner = untag_ptr(this_arg);
40432         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40433         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40434         this_arg_conv.is_owned = false;
40435         LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ ret_var = ChannelMonitor_get_relevant_txids(&this_arg_conv);
40436         int64_tArray ret_arr = NULL;
40437         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
40438         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
40439         for (size_t c = 0; c < ret_var.datalen; c++) {
40440                 LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* ret_conv_54_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ), "LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ");
40441                 *ret_conv_54_conv = ret_var.data[c];
40442                 ret_arr_ptr[c] = tag_ptr(ret_conv_54_conv, true);
40443         }
40444         
40445         FREE(ret_var.data);
40446         return ret_arr;
40447 }
40448
40449 int64_t  CS_LDK_ChannelMonitor_current_best_block(int64_t this_arg) {
40450         LDKChannelMonitor this_arg_conv;
40451         this_arg_conv.inner = untag_ptr(this_arg);
40452         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40453         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40454         this_arg_conv.is_owned = false;
40455         LDKBestBlock ret_var = ChannelMonitor_current_best_block(&this_arg_conv);
40456         int64_t ret_ref = 0;
40457         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40458         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40459         return ret_ref;
40460 }
40461
40462 void  CS_LDK_ChannelMonitor_rebroadcast_pending_claims(int64_t this_arg, int64_t broadcaster, int64_t fee_estimator, int64_t logger) {
40463         LDKChannelMonitor this_arg_conv;
40464         this_arg_conv.inner = untag_ptr(this_arg);
40465         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40466         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40467         this_arg_conv.is_owned = false;
40468         void* broadcaster_ptr = untag_ptr(broadcaster);
40469         CHECK_ACCESS(broadcaster_ptr);
40470         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
40471         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
40472                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
40473                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
40474         }
40475         void* fee_estimator_ptr = untag_ptr(fee_estimator);
40476         CHECK_ACCESS(fee_estimator_ptr);
40477         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
40478         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
40479                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
40480                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
40481         }
40482         void* logger_ptr = untag_ptr(logger);
40483         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
40484         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
40485         ChannelMonitor_rebroadcast_pending_claims(&this_arg_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
40486 }
40487
40488 void  CS_LDK_ChannelMonitor_signer_unblocked(int64_t this_arg, int64_t broadcaster, int64_t fee_estimator, int64_t logger) {
40489         LDKChannelMonitor this_arg_conv;
40490         this_arg_conv.inner = untag_ptr(this_arg);
40491         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40492         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40493         this_arg_conv.is_owned = false;
40494         void* broadcaster_ptr = untag_ptr(broadcaster);
40495         CHECK_ACCESS(broadcaster_ptr);
40496         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
40497         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
40498                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
40499                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
40500         }
40501         void* fee_estimator_ptr = untag_ptr(fee_estimator);
40502         CHECK_ACCESS(fee_estimator_ptr);
40503         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
40504         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
40505                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
40506                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
40507         }
40508         void* logger_ptr = untag_ptr(logger);
40509         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
40510         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
40511         ChannelMonitor_signer_unblocked(&this_arg_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
40512 }
40513
40514 int64_tArray  CS_LDK_ChannelMonitor_get_spendable_outputs(int64_t this_arg, int8_tArray tx, int32_t confirmation_height) {
40515         LDKChannelMonitor this_arg_conv;
40516         this_arg_conv.inner = untag_ptr(this_arg);
40517         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40518         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40519         this_arg_conv.is_owned = false;
40520         LDKTransaction tx_ref;
40521         tx_ref.datalen = tx->arr_len;
40522         tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
40523         memcpy(tx_ref.data, tx->elems, tx_ref.datalen); FREE(tx);
40524         tx_ref.data_is_owned = true;
40525         LDKCVec_SpendableOutputDescriptorZ ret_var = ChannelMonitor_get_spendable_outputs(&this_arg_conv, tx_ref, confirmation_height);
40526         int64_tArray ret_arr = NULL;
40527         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
40528         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
40529         for (size_t b = 0; b < ret_var.datalen; b++) {
40530                 LDKSpendableOutputDescriptor *ret_conv_27_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
40531                 *ret_conv_27_copy = ret_var.data[b];
40532                 int64_t ret_conv_27_ref = tag_ptr(ret_conv_27_copy, true);
40533                 ret_arr_ptr[b] = ret_conv_27_ref;
40534         }
40535         
40536         FREE(ret_var.data);
40537         return ret_arr;
40538 }
40539
40540 jboolean  CS_LDK_ChannelMonitor_is_fully_resolved(int64_t this_arg, int64_t logger) {
40541         LDKChannelMonitor this_arg_conv;
40542         this_arg_conv.inner = untag_ptr(this_arg);
40543         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40544         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40545         this_arg_conv.is_owned = false;
40546         void* logger_ptr = untag_ptr(logger);
40547         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
40548         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
40549         jboolean ret_conv = ChannelMonitor_is_fully_resolved(&this_arg_conv, logger_conv);
40550         return ret_conv;
40551 }
40552
40553 int64_tArray  CS_LDK_ChannelMonitor_get_claimable_balances(int64_t this_arg) {
40554         LDKChannelMonitor this_arg_conv;
40555         this_arg_conv.inner = untag_ptr(this_arg);
40556         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40557         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40558         this_arg_conv.is_owned = false;
40559         LDKCVec_BalanceZ ret_var = ChannelMonitor_get_claimable_balances(&this_arg_conv);
40560         int64_tArray ret_arr = NULL;
40561         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
40562         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
40563         for (size_t j = 0; j < ret_var.datalen; j++) {
40564                 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
40565                 *ret_conv_9_copy = ret_var.data[j];
40566                 int64_t ret_conv_9_ref = tag_ptr(ret_conv_9_copy, true);
40567                 ret_arr_ptr[j] = ret_conv_9_ref;
40568         }
40569         
40570         FREE(ret_var.data);
40571         return ret_arr;
40572 }
40573
40574 int64_t  CS_LDK_C2Tuple_ThirtyTwoBytesChannelMonitorZ_read(int8_tArray ser, int64_t arg_a, int64_t arg_b) {
40575         LDKu8slice ser_ref;
40576         ser_ref.datalen = ser->arr_len;
40577         ser_ref.data = ser->elems;
40578         void* arg_a_ptr = untag_ptr(arg_a);
40579         if (ptr_is_owned(arg_a)) { CHECK_ACCESS(arg_a_ptr); }
40580         LDKEntropySource* arg_a_conv = (LDKEntropySource*)arg_a_ptr;
40581         void* arg_b_ptr = untag_ptr(arg_b);
40582         if (ptr_is_owned(arg_b)) { CHECK_ACCESS(arg_b_ptr); }
40583         LDKSignerProvider* arg_b_conv = (LDKSignerProvider*)arg_b_ptr;
40584         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ");
40585         *ret_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_read(ser_ref, arg_a_conv, arg_b_conv);
40586         FREE(ser);
40587         return tag_ptr(ret_conv, true);
40588 }
40589
40590 void  CS_LDK_OutPoint_free(int64_t this_obj) {
40591         LDKOutPoint this_obj_conv;
40592         this_obj_conv.inner = untag_ptr(this_obj);
40593         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40594         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40595         OutPoint_free(this_obj_conv);
40596 }
40597
40598 int8_tArray  CS_LDK_OutPoint_get_txid(int64_t this_ptr) {
40599         LDKOutPoint this_ptr_conv;
40600         this_ptr_conv.inner = untag_ptr(this_ptr);
40601         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40602         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40603         this_ptr_conv.is_owned = false;
40604         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
40605         memcpy(ret_arr->elems, *OutPoint_get_txid(&this_ptr_conv), 32);
40606         return ret_arr;
40607 }
40608
40609 void  CS_LDK_OutPoint_set_txid(int64_t this_ptr, int8_tArray val) {
40610         LDKOutPoint this_ptr_conv;
40611         this_ptr_conv.inner = untag_ptr(this_ptr);
40612         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40613         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40614         this_ptr_conv.is_owned = false;
40615         LDKThirtyTwoBytes val_ref;
40616         CHECK(val->arr_len == 32);
40617         memcpy(val_ref.data, val->elems, 32); FREE(val);
40618         OutPoint_set_txid(&this_ptr_conv, val_ref);
40619 }
40620
40621 int16_t  CS_LDK_OutPoint_get_index(int64_t this_ptr) {
40622         LDKOutPoint this_ptr_conv;
40623         this_ptr_conv.inner = untag_ptr(this_ptr);
40624         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40625         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40626         this_ptr_conv.is_owned = false;
40627         int16_t ret_conv = OutPoint_get_index(&this_ptr_conv);
40628         return ret_conv;
40629 }
40630
40631 void  CS_LDK_OutPoint_set_index(int64_t this_ptr, int16_t val) {
40632         LDKOutPoint this_ptr_conv;
40633         this_ptr_conv.inner = untag_ptr(this_ptr);
40634         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40635         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40636         this_ptr_conv.is_owned = false;
40637         OutPoint_set_index(&this_ptr_conv, val);
40638 }
40639
40640 int64_t  CS_LDK_OutPoint_new(int8_tArray txid_arg, int16_t index_arg) {
40641         LDKThirtyTwoBytes txid_arg_ref;
40642         CHECK(txid_arg->arr_len == 32);
40643         memcpy(txid_arg_ref.data, txid_arg->elems, 32); FREE(txid_arg);
40644         LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
40645         int64_t ret_ref = 0;
40646         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40647         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40648         return ret_ref;
40649 }
40650
40651 static inline uint64_t OutPoint_clone_ptr(LDKOutPoint *NONNULL_PTR arg) {
40652         LDKOutPoint ret_var = OutPoint_clone(arg);
40653         int64_t ret_ref = 0;
40654         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40655         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40656         return ret_ref;
40657 }
40658 int64_t  CS_LDK_OutPoint_clone_ptr(int64_t arg) {
40659         LDKOutPoint arg_conv;
40660         arg_conv.inner = untag_ptr(arg);
40661         arg_conv.is_owned = ptr_is_owned(arg);
40662         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40663         arg_conv.is_owned = false;
40664         int64_t ret_conv = OutPoint_clone_ptr(&arg_conv);
40665         return ret_conv;
40666 }
40667
40668 int64_t  CS_LDK_OutPoint_clone(int64_t orig) {
40669         LDKOutPoint orig_conv;
40670         orig_conv.inner = untag_ptr(orig);
40671         orig_conv.is_owned = ptr_is_owned(orig);
40672         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40673         orig_conv.is_owned = false;
40674         LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
40675         int64_t ret_ref = 0;
40676         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40677         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40678         return ret_ref;
40679 }
40680
40681 jboolean  CS_LDK_OutPoint_eq(int64_t a, int64_t b) {
40682         LDKOutPoint a_conv;
40683         a_conv.inner = untag_ptr(a);
40684         a_conv.is_owned = ptr_is_owned(a);
40685         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40686         a_conv.is_owned = false;
40687         LDKOutPoint b_conv;
40688         b_conv.inner = untag_ptr(b);
40689         b_conv.is_owned = ptr_is_owned(b);
40690         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40691         b_conv.is_owned = false;
40692         jboolean ret_conv = OutPoint_eq(&a_conv, &b_conv);
40693         return ret_conv;
40694 }
40695
40696 int64_t  CS_LDK_OutPoint_hash(int64_t o) {
40697         LDKOutPoint o_conv;
40698         o_conv.inner = untag_ptr(o);
40699         o_conv.is_owned = ptr_is_owned(o);
40700         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
40701         o_conv.is_owned = false;
40702         int64_t ret_conv = OutPoint_hash(&o_conv);
40703         return ret_conv;
40704 }
40705
40706 jstring  CS_LDK_OutPoint_to_str(int64_t o) {
40707         LDKOutPoint o_conv;
40708         o_conv.inner = untag_ptr(o);
40709         o_conv.is_owned = ptr_is_owned(o);
40710         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
40711         o_conv.is_owned = false;
40712         LDKStr ret_str = OutPoint_to_str(&o_conv);
40713         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
40714         Str_free(ret_str);
40715         return ret_conv;
40716 }
40717
40718 int8_tArray  CS_LDK_OutPoint_write(int64_t obj) {
40719         LDKOutPoint obj_conv;
40720         obj_conv.inner = untag_ptr(obj);
40721         obj_conv.is_owned = ptr_is_owned(obj);
40722         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40723         obj_conv.is_owned = false;
40724         LDKCVec_u8Z ret_var = OutPoint_write(&obj_conv);
40725         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40726         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40727         CVec_u8Z_free(ret_var);
40728         return ret_arr;
40729 }
40730
40731 int64_t  CS_LDK_OutPoint_read(int8_tArray ser) {
40732         LDKu8slice ser_ref;
40733         ser_ref.datalen = ser->arr_len;
40734         ser_ref.data = ser->elems;
40735         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
40736         *ret_conv = OutPoint_read(ser_ref);
40737         FREE(ser);
40738         return tag_ptr(ret_conv, true);
40739 }
40740
40741 void  CS_LDK_InboundHTLCErr_free(int64_t this_obj) {
40742         LDKInboundHTLCErr this_obj_conv;
40743         this_obj_conv.inner = untag_ptr(this_obj);
40744         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40745         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40746         InboundHTLCErr_free(this_obj_conv);
40747 }
40748
40749 int16_t  CS_LDK_InboundHTLCErr_get_err_code(int64_t this_ptr) {
40750         LDKInboundHTLCErr this_ptr_conv;
40751         this_ptr_conv.inner = untag_ptr(this_ptr);
40752         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40753         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40754         this_ptr_conv.is_owned = false;
40755         int16_t ret_conv = InboundHTLCErr_get_err_code(&this_ptr_conv);
40756         return ret_conv;
40757 }
40758
40759 void  CS_LDK_InboundHTLCErr_set_err_code(int64_t this_ptr, int16_t val) {
40760         LDKInboundHTLCErr this_ptr_conv;
40761         this_ptr_conv.inner = untag_ptr(this_ptr);
40762         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40763         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40764         this_ptr_conv.is_owned = false;
40765         InboundHTLCErr_set_err_code(&this_ptr_conv, val);
40766 }
40767
40768 int8_tArray  CS_LDK_InboundHTLCErr_get_err_data(int64_t this_ptr) {
40769         LDKInboundHTLCErr this_ptr_conv;
40770         this_ptr_conv.inner = untag_ptr(this_ptr);
40771         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40772         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40773         this_ptr_conv.is_owned = false;
40774         LDKCVec_u8Z ret_var = InboundHTLCErr_get_err_data(&this_ptr_conv);
40775         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40776         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40777         CVec_u8Z_free(ret_var);
40778         return ret_arr;
40779 }
40780
40781 void  CS_LDK_InboundHTLCErr_set_err_data(int64_t this_ptr, int8_tArray val) {
40782         LDKInboundHTLCErr this_ptr_conv;
40783         this_ptr_conv.inner = untag_ptr(this_ptr);
40784         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40785         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40786         this_ptr_conv.is_owned = false;
40787         LDKCVec_u8Z val_ref;
40788         val_ref.datalen = val->arr_len;
40789         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
40790         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
40791         InboundHTLCErr_set_err_data(&this_ptr_conv, val_ref);
40792 }
40793
40794 jstring  CS_LDK_InboundHTLCErr_get_msg(int64_t this_ptr) {
40795         LDKInboundHTLCErr this_ptr_conv;
40796         this_ptr_conv.inner = untag_ptr(this_ptr);
40797         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40798         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40799         this_ptr_conv.is_owned = false;
40800         LDKStr ret_str = InboundHTLCErr_get_msg(&this_ptr_conv);
40801         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
40802         Str_free(ret_str);
40803         return ret_conv;
40804 }
40805
40806 void  CS_LDK_InboundHTLCErr_set_msg(int64_t this_ptr, jstring val) {
40807         LDKInboundHTLCErr this_ptr_conv;
40808         this_ptr_conv.inner = untag_ptr(this_ptr);
40809         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40810         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40811         this_ptr_conv.is_owned = false;
40812         LDKStr val_conv = str_ref_to_owned_c(val);
40813         InboundHTLCErr_set_msg(&this_ptr_conv, val_conv);
40814 }
40815
40816 int64_t  CS_LDK_InboundHTLCErr_new(int16_t err_code_arg, int8_tArray err_data_arg, jstring msg_arg) {
40817         LDKCVec_u8Z err_data_arg_ref;
40818         err_data_arg_ref.datalen = err_data_arg->arr_len;
40819         err_data_arg_ref.data = MALLOC(err_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
40820         memcpy(err_data_arg_ref.data, err_data_arg->elems, err_data_arg_ref.datalen); FREE(err_data_arg);
40821         LDKStr msg_arg_conv = str_ref_to_owned_c(msg_arg);
40822         LDKInboundHTLCErr ret_var = InboundHTLCErr_new(err_code_arg, err_data_arg_ref, msg_arg_conv);
40823         int64_t ret_ref = 0;
40824         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40825         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40826         return ret_ref;
40827 }
40828
40829 static inline uint64_t InboundHTLCErr_clone_ptr(LDKInboundHTLCErr *NONNULL_PTR arg) {
40830         LDKInboundHTLCErr ret_var = InboundHTLCErr_clone(arg);
40831         int64_t ret_ref = 0;
40832         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40833         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40834         return ret_ref;
40835 }
40836 int64_t  CS_LDK_InboundHTLCErr_clone_ptr(int64_t arg) {
40837         LDKInboundHTLCErr arg_conv;
40838         arg_conv.inner = untag_ptr(arg);
40839         arg_conv.is_owned = ptr_is_owned(arg);
40840         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40841         arg_conv.is_owned = false;
40842         int64_t ret_conv = InboundHTLCErr_clone_ptr(&arg_conv);
40843         return ret_conv;
40844 }
40845
40846 int64_t  CS_LDK_InboundHTLCErr_clone(int64_t orig) {
40847         LDKInboundHTLCErr orig_conv;
40848         orig_conv.inner = untag_ptr(orig);
40849         orig_conv.is_owned = ptr_is_owned(orig);
40850         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40851         orig_conv.is_owned = false;
40852         LDKInboundHTLCErr ret_var = InboundHTLCErr_clone(&orig_conv);
40853         int64_t ret_ref = 0;
40854         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40855         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40856         return ret_ref;
40857 }
40858
40859 int64_t  CS_LDK_InboundHTLCErr_hash(int64_t o) {
40860         LDKInboundHTLCErr o_conv;
40861         o_conv.inner = untag_ptr(o);
40862         o_conv.is_owned = ptr_is_owned(o);
40863         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
40864         o_conv.is_owned = false;
40865         int64_t ret_conv = InboundHTLCErr_hash(&o_conv);
40866         return ret_conv;
40867 }
40868
40869 jboolean  CS_LDK_InboundHTLCErr_eq(int64_t a, int64_t b) {
40870         LDKInboundHTLCErr a_conv;
40871         a_conv.inner = untag_ptr(a);
40872         a_conv.is_owned = ptr_is_owned(a);
40873         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40874         a_conv.is_owned = false;
40875         LDKInboundHTLCErr b_conv;
40876         b_conv.inner = untag_ptr(b);
40877         b_conv.is_owned = ptr_is_owned(b);
40878         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40879         b_conv.is_owned = false;
40880         jboolean ret_conv = InboundHTLCErr_eq(&a_conv, &b_conv);
40881         return ret_conv;
40882 }
40883
40884 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) {
40885         LDKUpdateAddHTLC msg_conv;
40886         msg_conv.inner = untag_ptr(msg);
40887         msg_conv.is_owned = ptr_is_owned(msg);
40888         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
40889         msg_conv.is_owned = false;
40890         void* node_signer_ptr = untag_ptr(node_signer);
40891         if (ptr_is_owned(node_signer)) { CHECK_ACCESS(node_signer_ptr); }
40892         LDKNodeSigner* node_signer_conv = (LDKNodeSigner*)node_signer_ptr;
40893         void* logger_ptr = untag_ptr(logger);
40894         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
40895         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
40896         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoInboundHTLCErrZ), "LDKCResult_PendingHTLCInfoInboundHTLCErrZ");
40897         *ret_conv = peel_payment_onion(&msg_conv, node_signer_conv, logger_conv, cur_height, accept_mpp_keysend, allow_skimmed_fees);
40898         return tag_ptr(ret_conv, true);
40899 }
40900
40901 void  CS_LDK_PendingHTLCRouting_free(int64_t this_ptr) {
40902         if (!ptr_is_owned(this_ptr)) return;
40903         void* this_ptr_ptr = untag_ptr(this_ptr);
40904         CHECK_ACCESS(this_ptr_ptr);
40905         LDKPendingHTLCRouting this_ptr_conv = *(LDKPendingHTLCRouting*)(this_ptr_ptr);
40906         FREE(untag_ptr(this_ptr));
40907         PendingHTLCRouting_free(this_ptr_conv);
40908 }
40909
40910 static inline uint64_t PendingHTLCRouting_clone_ptr(LDKPendingHTLCRouting *NONNULL_PTR arg) {
40911         LDKPendingHTLCRouting *ret_copy = MALLOC(sizeof(LDKPendingHTLCRouting), "LDKPendingHTLCRouting");
40912         *ret_copy = PendingHTLCRouting_clone(arg);
40913         int64_t ret_ref = tag_ptr(ret_copy, true);
40914         return ret_ref;
40915 }
40916 int64_t  CS_LDK_PendingHTLCRouting_clone_ptr(int64_t arg) {
40917         LDKPendingHTLCRouting* arg_conv = (LDKPendingHTLCRouting*)untag_ptr(arg);
40918         int64_t ret_conv = PendingHTLCRouting_clone_ptr(arg_conv);
40919         return ret_conv;
40920 }
40921
40922 int64_t  CS_LDK_PendingHTLCRouting_clone(int64_t orig) {
40923         LDKPendingHTLCRouting* orig_conv = (LDKPendingHTLCRouting*)untag_ptr(orig);
40924         LDKPendingHTLCRouting *ret_copy = MALLOC(sizeof(LDKPendingHTLCRouting), "LDKPendingHTLCRouting");
40925         *ret_copy = PendingHTLCRouting_clone(orig_conv);
40926         int64_t ret_ref = tag_ptr(ret_copy, true);
40927         return ret_ref;
40928 }
40929
40930 int64_t  CS_LDK_PendingHTLCRouting_forward(int64_t onion_packet, int64_t short_channel_id, int64_t blinded) {
40931         LDKOnionPacket onion_packet_conv;
40932         onion_packet_conv.inner = untag_ptr(onion_packet);
40933         onion_packet_conv.is_owned = ptr_is_owned(onion_packet);
40934         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_packet_conv);
40935         onion_packet_conv = OnionPacket_clone(&onion_packet_conv);
40936         LDKBlindedForward blinded_conv;
40937         blinded_conv.inner = untag_ptr(blinded);
40938         blinded_conv.is_owned = ptr_is_owned(blinded);
40939         CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_conv);
40940         blinded_conv = BlindedForward_clone(&blinded_conv);
40941         LDKPendingHTLCRouting *ret_copy = MALLOC(sizeof(LDKPendingHTLCRouting), "LDKPendingHTLCRouting");
40942         *ret_copy = PendingHTLCRouting_forward(onion_packet_conv, short_channel_id, blinded_conv);
40943         int64_t ret_ref = tag_ptr(ret_copy, true);
40944         return ret_ref;
40945 }
40946
40947 int64_t  CS_LDK_PendingHTLCRouting_receive(int64_t payment_data, int64_t payment_metadata, int64_t payment_context, int32_t incoming_cltv_expiry, int8_tArray phantom_shared_secret, int64_tArray custom_tlvs, jboolean requires_blinded_error) {
40948         LDKFinalOnionHopData payment_data_conv;
40949         payment_data_conv.inner = untag_ptr(payment_data);
40950         payment_data_conv.is_owned = ptr_is_owned(payment_data);
40951         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_data_conv);
40952         payment_data_conv = FinalOnionHopData_clone(&payment_data_conv);
40953         void* payment_metadata_ptr = untag_ptr(payment_metadata);
40954         CHECK_ACCESS(payment_metadata_ptr);
40955         LDKCOption_CVec_u8ZZ payment_metadata_conv = *(LDKCOption_CVec_u8ZZ*)(payment_metadata_ptr);
40956         payment_metadata_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(payment_metadata));
40957         void* payment_context_ptr = untag_ptr(payment_context);
40958         CHECK_ACCESS(payment_context_ptr);
40959         LDKCOption_PaymentContextZ payment_context_conv = *(LDKCOption_PaymentContextZ*)(payment_context_ptr);
40960         payment_context_conv = COption_PaymentContextZ_clone((LDKCOption_PaymentContextZ*)untag_ptr(payment_context));
40961         LDKThirtyTwoBytes phantom_shared_secret_ref;
40962         CHECK(phantom_shared_secret->arr_len == 32);
40963         memcpy(phantom_shared_secret_ref.data, phantom_shared_secret->elems, 32); FREE(phantom_shared_secret);
40964         LDKCVec_C2Tuple_u64CVec_u8ZZZ custom_tlvs_constr;
40965         custom_tlvs_constr.datalen = custom_tlvs->arr_len;
40966         if (custom_tlvs_constr.datalen > 0)
40967                 custom_tlvs_constr.data = MALLOC(custom_tlvs_constr.datalen * sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKCVec_C2Tuple_u64CVec_u8ZZZ Elements");
40968         else
40969                 custom_tlvs_constr.data = NULL;
40970         int64_t* custom_tlvs_vals = custom_tlvs->elems;
40971         for (size_t x = 0; x < custom_tlvs_constr.datalen; x++) {
40972                 int64_t custom_tlvs_conv_23 = custom_tlvs_vals[x];
40973                 void* custom_tlvs_conv_23_ptr = untag_ptr(custom_tlvs_conv_23);
40974                 CHECK_ACCESS(custom_tlvs_conv_23_ptr);
40975                 LDKC2Tuple_u64CVec_u8ZZ custom_tlvs_conv_23_conv = *(LDKC2Tuple_u64CVec_u8ZZ*)(custom_tlvs_conv_23_ptr);
40976                 custom_tlvs_conv_23_conv = C2Tuple_u64CVec_u8ZZ_clone((LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(custom_tlvs_conv_23));
40977                 custom_tlvs_constr.data[x] = custom_tlvs_conv_23_conv;
40978         }
40979         FREE(custom_tlvs);
40980         LDKPendingHTLCRouting *ret_copy = MALLOC(sizeof(LDKPendingHTLCRouting), "LDKPendingHTLCRouting");
40981         *ret_copy = PendingHTLCRouting_receive(payment_data_conv, payment_metadata_conv, payment_context_conv, incoming_cltv_expiry, phantom_shared_secret_ref, custom_tlvs_constr, requires_blinded_error);
40982         int64_t ret_ref = tag_ptr(ret_copy, true);
40983         return ret_ref;
40984 }
40985
40986 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, jboolean requires_blinded_error) {
40987         LDKFinalOnionHopData payment_data_conv;
40988         payment_data_conv.inner = untag_ptr(payment_data);
40989         payment_data_conv.is_owned = ptr_is_owned(payment_data);
40990         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_data_conv);
40991         payment_data_conv = FinalOnionHopData_clone(&payment_data_conv);
40992         LDKThirtyTwoBytes payment_preimage_ref;
40993         CHECK(payment_preimage->arr_len == 32);
40994         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
40995         void* payment_metadata_ptr = untag_ptr(payment_metadata);
40996         CHECK_ACCESS(payment_metadata_ptr);
40997         LDKCOption_CVec_u8ZZ payment_metadata_conv = *(LDKCOption_CVec_u8ZZ*)(payment_metadata_ptr);
40998         payment_metadata_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(payment_metadata));
40999         LDKCVec_C2Tuple_u64CVec_u8ZZZ custom_tlvs_constr;
41000         custom_tlvs_constr.datalen = custom_tlvs->arr_len;
41001         if (custom_tlvs_constr.datalen > 0)
41002                 custom_tlvs_constr.data = MALLOC(custom_tlvs_constr.datalen * sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKCVec_C2Tuple_u64CVec_u8ZZZ Elements");
41003         else
41004                 custom_tlvs_constr.data = NULL;
41005         int64_t* custom_tlvs_vals = custom_tlvs->elems;
41006         for (size_t x = 0; x < custom_tlvs_constr.datalen; x++) {
41007                 int64_t custom_tlvs_conv_23 = custom_tlvs_vals[x];
41008                 void* custom_tlvs_conv_23_ptr = untag_ptr(custom_tlvs_conv_23);
41009                 CHECK_ACCESS(custom_tlvs_conv_23_ptr);
41010                 LDKC2Tuple_u64CVec_u8ZZ custom_tlvs_conv_23_conv = *(LDKC2Tuple_u64CVec_u8ZZ*)(custom_tlvs_conv_23_ptr);
41011                 custom_tlvs_conv_23_conv = C2Tuple_u64CVec_u8ZZ_clone((LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(custom_tlvs_conv_23));
41012                 custom_tlvs_constr.data[x] = custom_tlvs_conv_23_conv;
41013         }
41014         FREE(custom_tlvs);
41015         LDKPendingHTLCRouting *ret_copy = MALLOC(sizeof(LDKPendingHTLCRouting), "LDKPendingHTLCRouting");
41016         *ret_copy = PendingHTLCRouting_receive_keysend(payment_data_conv, payment_preimage_ref, payment_metadata_conv, incoming_cltv_expiry, custom_tlvs_constr, requires_blinded_error);
41017         int64_t ret_ref = tag_ptr(ret_copy, true);
41018         return ret_ref;
41019 }
41020
41021 void  CS_LDK_BlindedForward_free(int64_t this_obj) {
41022         LDKBlindedForward this_obj_conv;
41023         this_obj_conv.inner = untag_ptr(this_obj);
41024         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41025         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41026         BlindedForward_free(this_obj_conv);
41027 }
41028
41029 int8_tArray  CS_LDK_BlindedForward_get_inbound_blinding_point(int64_t this_ptr) {
41030         LDKBlindedForward this_ptr_conv;
41031         this_ptr_conv.inner = untag_ptr(this_ptr);
41032         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41033         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41034         this_ptr_conv.is_owned = false;
41035         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
41036         memcpy(ret_arr->elems, BlindedForward_get_inbound_blinding_point(&this_ptr_conv).compressed_form, 33);
41037         return ret_arr;
41038 }
41039
41040 void  CS_LDK_BlindedForward_set_inbound_blinding_point(int64_t this_ptr, int8_tArray val) {
41041         LDKBlindedForward this_ptr_conv;
41042         this_ptr_conv.inner = untag_ptr(this_ptr);
41043         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41044         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41045         this_ptr_conv.is_owned = false;
41046         LDKPublicKey val_ref;
41047         CHECK(val->arr_len == 33);
41048         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
41049         BlindedForward_set_inbound_blinding_point(&this_ptr_conv, val_ref);
41050 }
41051
41052 int32_t  CS_LDK_BlindedForward_get_failure(int64_t this_ptr) {
41053         LDKBlindedForward this_ptr_conv;
41054         this_ptr_conv.inner = untag_ptr(this_ptr);
41055         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41056         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41057         this_ptr_conv.is_owned = false;
41058         int32_t ret_conv = LDKBlindedFailure_to_cs(BlindedForward_get_failure(&this_ptr_conv));
41059         return ret_conv;
41060 }
41061
41062 void  CS_LDK_BlindedForward_set_failure(int64_t this_ptr, int32_t val) {
41063         LDKBlindedForward this_ptr_conv;
41064         this_ptr_conv.inner = untag_ptr(this_ptr);
41065         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41066         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41067         this_ptr_conv.is_owned = false;
41068         LDKBlindedFailure val_conv = LDKBlindedFailure_from_cs(val);
41069         BlindedForward_set_failure(&this_ptr_conv, val_conv);
41070 }
41071
41072 int64_t  CS_LDK_BlindedForward_new(int8_tArray inbound_blinding_point_arg, int32_t failure_arg) {
41073         LDKPublicKey inbound_blinding_point_arg_ref;
41074         CHECK(inbound_blinding_point_arg->arr_len == 33);
41075         memcpy(inbound_blinding_point_arg_ref.compressed_form, inbound_blinding_point_arg->elems, 33); FREE(inbound_blinding_point_arg);
41076         LDKBlindedFailure failure_arg_conv = LDKBlindedFailure_from_cs(failure_arg);
41077         LDKBlindedForward ret_var = BlindedForward_new(inbound_blinding_point_arg_ref, failure_arg_conv);
41078         int64_t ret_ref = 0;
41079         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41080         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41081         return ret_ref;
41082 }
41083
41084 static inline uint64_t BlindedForward_clone_ptr(LDKBlindedForward *NONNULL_PTR arg) {
41085         LDKBlindedForward ret_var = BlindedForward_clone(arg);
41086         int64_t ret_ref = 0;
41087         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41088         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41089         return ret_ref;
41090 }
41091 int64_t  CS_LDK_BlindedForward_clone_ptr(int64_t arg) {
41092         LDKBlindedForward arg_conv;
41093         arg_conv.inner = untag_ptr(arg);
41094         arg_conv.is_owned = ptr_is_owned(arg);
41095         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41096         arg_conv.is_owned = false;
41097         int64_t ret_conv = BlindedForward_clone_ptr(&arg_conv);
41098         return ret_conv;
41099 }
41100
41101 int64_t  CS_LDK_BlindedForward_clone(int64_t orig) {
41102         LDKBlindedForward orig_conv;
41103         orig_conv.inner = untag_ptr(orig);
41104         orig_conv.is_owned = ptr_is_owned(orig);
41105         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41106         orig_conv.is_owned = false;
41107         LDKBlindedForward ret_var = BlindedForward_clone(&orig_conv);
41108         int64_t ret_ref = 0;
41109         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41110         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41111         return ret_ref;
41112 }
41113
41114 int64_t  CS_LDK_BlindedForward_hash(int64_t o) {
41115         LDKBlindedForward o_conv;
41116         o_conv.inner = untag_ptr(o);
41117         o_conv.is_owned = ptr_is_owned(o);
41118         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
41119         o_conv.is_owned = false;
41120         int64_t ret_conv = BlindedForward_hash(&o_conv);
41121         return ret_conv;
41122 }
41123
41124 jboolean  CS_LDK_BlindedForward_eq(int64_t a, int64_t b) {
41125         LDKBlindedForward a_conv;
41126         a_conv.inner = untag_ptr(a);
41127         a_conv.is_owned = ptr_is_owned(a);
41128         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41129         a_conv.is_owned = false;
41130         LDKBlindedForward b_conv;
41131         b_conv.inner = untag_ptr(b);
41132         b_conv.is_owned = ptr_is_owned(b);
41133         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41134         b_conv.is_owned = false;
41135         jboolean ret_conv = BlindedForward_eq(&a_conv, &b_conv);
41136         return ret_conv;
41137 }
41138
41139 void  CS_LDK_PendingHTLCInfo_free(int64_t this_obj) {
41140         LDKPendingHTLCInfo this_obj_conv;
41141         this_obj_conv.inner = untag_ptr(this_obj);
41142         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41143         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41144         PendingHTLCInfo_free(this_obj_conv);
41145 }
41146
41147 int64_t  CS_LDK_PendingHTLCInfo_get_routing(int64_t this_ptr) {
41148         LDKPendingHTLCInfo this_ptr_conv;
41149         this_ptr_conv.inner = untag_ptr(this_ptr);
41150         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41151         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41152         this_ptr_conv.is_owned = false;
41153         LDKPendingHTLCRouting *ret_copy = MALLOC(sizeof(LDKPendingHTLCRouting), "LDKPendingHTLCRouting");
41154         *ret_copy = PendingHTLCInfo_get_routing(&this_ptr_conv);
41155         int64_t ret_ref = tag_ptr(ret_copy, true);
41156         return ret_ref;
41157 }
41158
41159 void  CS_LDK_PendingHTLCInfo_set_routing(int64_t this_ptr, int64_t val) {
41160         LDKPendingHTLCInfo this_ptr_conv;
41161         this_ptr_conv.inner = untag_ptr(this_ptr);
41162         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41163         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41164         this_ptr_conv.is_owned = false;
41165         void* val_ptr = untag_ptr(val);
41166         CHECK_ACCESS(val_ptr);
41167         LDKPendingHTLCRouting val_conv = *(LDKPendingHTLCRouting*)(val_ptr);
41168         val_conv = PendingHTLCRouting_clone((LDKPendingHTLCRouting*)untag_ptr(val));
41169         PendingHTLCInfo_set_routing(&this_ptr_conv, val_conv);
41170 }
41171
41172 int8_tArray  CS_LDK_PendingHTLCInfo_get_incoming_shared_secret(int64_t this_ptr) {
41173         LDKPendingHTLCInfo this_ptr_conv;
41174         this_ptr_conv.inner = untag_ptr(this_ptr);
41175         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41176         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41177         this_ptr_conv.is_owned = false;
41178         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
41179         memcpy(ret_arr->elems, *PendingHTLCInfo_get_incoming_shared_secret(&this_ptr_conv), 32);
41180         return ret_arr;
41181 }
41182
41183 void  CS_LDK_PendingHTLCInfo_set_incoming_shared_secret(int64_t this_ptr, int8_tArray val) {
41184         LDKPendingHTLCInfo this_ptr_conv;
41185         this_ptr_conv.inner = untag_ptr(this_ptr);
41186         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41187         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41188         this_ptr_conv.is_owned = false;
41189         LDKThirtyTwoBytes val_ref;
41190         CHECK(val->arr_len == 32);
41191         memcpy(val_ref.data, val->elems, 32); FREE(val);
41192         PendingHTLCInfo_set_incoming_shared_secret(&this_ptr_conv, val_ref);
41193 }
41194
41195 int8_tArray  CS_LDK_PendingHTLCInfo_get_payment_hash(int64_t this_ptr) {
41196         LDKPendingHTLCInfo this_ptr_conv;
41197         this_ptr_conv.inner = untag_ptr(this_ptr);
41198         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41199         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41200         this_ptr_conv.is_owned = false;
41201         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
41202         memcpy(ret_arr->elems, *PendingHTLCInfo_get_payment_hash(&this_ptr_conv), 32);
41203         return ret_arr;
41204 }
41205
41206 void  CS_LDK_PendingHTLCInfo_set_payment_hash(int64_t this_ptr, int8_tArray val) {
41207         LDKPendingHTLCInfo this_ptr_conv;
41208         this_ptr_conv.inner = untag_ptr(this_ptr);
41209         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41210         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41211         this_ptr_conv.is_owned = false;
41212         LDKThirtyTwoBytes val_ref;
41213         CHECK(val->arr_len == 32);
41214         memcpy(val_ref.data, val->elems, 32); FREE(val);
41215         PendingHTLCInfo_set_payment_hash(&this_ptr_conv, val_ref);
41216 }
41217
41218 int64_t  CS_LDK_PendingHTLCInfo_get_incoming_amt_msat(int64_t this_ptr) {
41219         LDKPendingHTLCInfo this_ptr_conv;
41220         this_ptr_conv.inner = untag_ptr(this_ptr);
41221         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41222         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41223         this_ptr_conv.is_owned = false;
41224         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
41225         *ret_copy = PendingHTLCInfo_get_incoming_amt_msat(&this_ptr_conv);
41226         int64_t ret_ref = tag_ptr(ret_copy, true);
41227         return ret_ref;
41228 }
41229
41230 void  CS_LDK_PendingHTLCInfo_set_incoming_amt_msat(int64_t this_ptr, int64_t val) {
41231         LDKPendingHTLCInfo this_ptr_conv;
41232         this_ptr_conv.inner = untag_ptr(this_ptr);
41233         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41234         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41235         this_ptr_conv.is_owned = false;
41236         void* val_ptr = untag_ptr(val);
41237         CHECK_ACCESS(val_ptr);
41238         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
41239         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
41240         PendingHTLCInfo_set_incoming_amt_msat(&this_ptr_conv, val_conv);
41241 }
41242
41243 int64_t  CS_LDK_PendingHTLCInfo_get_outgoing_amt_msat(int64_t this_ptr) {
41244         LDKPendingHTLCInfo this_ptr_conv;
41245         this_ptr_conv.inner = untag_ptr(this_ptr);
41246         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41247         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41248         this_ptr_conv.is_owned = false;
41249         int64_t ret_conv = PendingHTLCInfo_get_outgoing_amt_msat(&this_ptr_conv);
41250         return ret_conv;
41251 }
41252
41253 void  CS_LDK_PendingHTLCInfo_set_outgoing_amt_msat(int64_t this_ptr, int64_t val) {
41254         LDKPendingHTLCInfo this_ptr_conv;
41255         this_ptr_conv.inner = untag_ptr(this_ptr);
41256         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41257         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41258         this_ptr_conv.is_owned = false;
41259         PendingHTLCInfo_set_outgoing_amt_msat(&this_ptr_conv, val);
41260 }
41261
41262 int32_t  CS_LDK_PendingHTLCInfo_get_outgoing_cltv_value(int64_t this_ptr) {
41263         LDKPendingHTLCInfo this_ptr_conv;
41264         this_ptr_conv.inner = untag_ptr(this_ptr);
41265         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41266         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41267         this_ptr_conv.is_owned = false;
41268         int32_t ret_conv = PendingHTLCInfo_get_outgoing_cltv_value(&this_ptr_conv);
41269         return ret_conv;
41270 }
41271
41272 void  CS_LDK_PendingHTLCInfo_set_outgoing_cltv_value(int64_t this_ptr, int32_t val) {
41273         LDKPendingHTLCInfo this_ptr_conv;
41274         this_ptr_conv.inner = untag_ptr(this_ptr);
41275         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41276         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41277         this_ptr_conv.is_owned = false;
41278         PendingHTLCInfo_set_outgoing_cltv_value(&this_ptr_conv, val);
41279 }
41280
41281 int64_t  CS_LDK_PendingHTLCInfo_get_skimmed_fee_msat(int64_t this_ptr) {
41282         LDKPendingHTLCInfo this_ptr_conv;
41283         this_ptr_conv.inner = untag_ptr(this_ptr);
41284         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41285         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41286         this_ptr_conv.is_owned = false;
41287         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
41288         *ret_copy = PendingHTLCInfo_get_skimmed_fee_msat(&this_ptr_conv);
41289         int64_t ret_ref = tag_ptr(ret_copy, true);
41290         return ret_ref;
41291 }
41292
41293 void  CS_LDK_PendingHTLCInfo_set_skimmed_fee_msat(int64_t this_ptr, int64_t val) {
41294         LDKPendingHTLCInfo this_ptr_conv;
41295         this_ptr_conv.inner = untag_ptr(this_ptr);
41296         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41297         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41298         this_ptr_conv.is_owned = false;
41299         void* val_ptr = untag_ptr(val);
41300         CHECK_ACCESS(val_ptr);
41301         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
41302         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
41303         PendingHTLCInfo_set_skimmed_fee_msat(&this_ptr_conv, val_conv);
41304 }
41305
41306 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) {
41307         void* routing_arg_ptr = untag_ptr(routing_arg);
41308         CHECK_ACCESS(routing_arg_ptr);
41309         LDKPendingHTLCRouting routing_arg_conv = *(LDKPendingHTLCRouting*)(routing_arg_ptr);
41310         routing_arg_conv = PendingHTLCRouting_clone((LDKPendingHTLCRouting*)untag_ptr(routing_arg));
41311         LDKThirtyTwoBytes incoming_shared_secret_arg_ref;
41312         CHECK(incoming_shared_secret_arg->arr_len == 32);
41313         memcpy(incoming_shared_secret_arg_ref.data, incoming_shared_secret_arg->elems, 32); FREE(incoming_shared_secret_arg);
41314         LDKThirtyTwoBytes payment_hash_arg_ref;
41315         CHECK(payment_hash_arg->arr_len == 32);
41316         memcpy(payment_hash_arg_ref.data, payment_hash_arg->elems, 32); FREE(payment_hash_arg);
41317         void* incoming_amt_msat_arg_ptr = untag_ptr(incoming_amt_msat_arg);
41318         CHECK_ACCESS(incoming_amt_msat_arg_ptr);
41319         LDKCOption_u64Z incoming_amt_msat_arg_conv = *(LDKCOption_u64Z*)(incoming_amt_msat_arg_ptr);
41320         incoming_amt_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(incoming_amt_msat_arg));
41321         void* skimmed_fee_msat_arg_ptr = untag_ptr(skimmed_fee_msat_arg);
41322         CHECK_ACCESS(skimmed_fee_msat_arg_ptr);
41323         LDKCOption_u64Z skimmed_fee_msat_arg_conv = *(LDKCOption_u64Z*)(skimmed_fee_msat_arg_ptr);
41324         skimmed_fee_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(skimmed_fee_msat_arg));
41325         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);
41326         int64_t ret_ref = 0;
41327         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41328         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41329         return ret_ref;
41330 }
41331
41332 static inline uint64_t PendingHTLCInfo_clone_ptr(LDKPendingHTLCInfo *NONNULL_PTR arg) {
41333         LDKPendingHTLCInfo ret_var = PendingHTLCInfo_clone(arg);
41334         int64_t ret_ref = 0;
41335         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41336         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41337         return ret_ref;
41338 }
41339 int64_t  CS_LDK_PendingHTLCInfo_clone_ptr(int64_t arg) {
41340         LDKPendingHTLCInfo arg_conv;
41341         arg_conv.inner = untag_ptr(arg);
41342         arg_conv.is_owned = ptr_is_owned(arg);
41343         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41344         arg_conv.is_owned = false;
41345         int64_t ret_conv = PendingHTLCInfo_clone_ptr(&arg_conv);
41346         return ret_conv;
41347 }
41348
41349 int64_t  CS_LDK_PendingHTLCInfo_clone(int64_t orig) {
41350         LDKPendingHTLCInfo orig_conv;
41351         orig_conv.inner = untag_ptr(orig);
41352         orig_conv.is_owned = ptr_is_owned(orig);
41353         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41354         orig_conv.is_owned = false;
41355         LDKPendingHTLCInfo ret_var = PendingHTLCInfo_clone(&orig_conv);
41356         int64_t ret_ref = 0;
41357         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41358         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41359         return ret_ref;
41360 }
41361
41362 int32_t  CS_LDK_BlindedFailure_clone(int64_t orig) {
41363         LDKBlindedFailure* orig_conv = (LDKBlindedFailure*)untag_ptr(orig);
41364         int32_t ret_conv = LDKBlindedFailure_to_cs(BlindedFailure_clone(orig_conv));
41365         return ret_conv;
41366 }
41367
41368 int32_t  CS_LDK_BlindedFailure_from_introduction_node() {
41369         int32_t ret_conv = LDKBlindedFailure_to_cs(BlindedFailure_from_introduction_node());
41370         return ret_conv;
41371 }
41372
41373 int32_t  CS_LDK_BlindedFailure_from_blinded_node() {
41374         int32_t ret_conv = LDKBlindedFailure_to_cs(BlindedFailure_from_blinded_node());
41375         return ret_conv;
41376 }
41377
41378 int64_t  CS_LDK_BlindedFailure_hash(int64_t o) {
41379         LDKBlindedFailure* o_conv = (LDKBlindedFailure*)untag_ptr(o);
41380         int64_t ret_conv = BlindedFailure_hash(o_conv);
41381         return ret_conv;
41382 }
41383
41384 jboolean  CS_LDK_BlindedFailure_eq(int64_t a, int64_t b) {
41385         LDKBlindedFailure* a_conv = (LDKBlindedFailure*)untag_ptr(a);
41386         LDKBlindedFailure* b_conv = (LDKBlindedFailure*)untag_ptr(b);
41387         jboolean ret_conv = BlindedFailure_eq(a_conv, b_conv);
41388         return ret_conv;
41389 }
41390
41391 void  CS_LDK_FailureCode_free(int64_t this_ptr) {
41392         if (!ptr_is_owned(this_ptr)) return;
41393         void* this_ptr_ptr = untag_ptr(this_ptr);
41394         CHECK_ACCESS(this_ptr_ptr);
41395         LDKFailureCode this_ptr_conv = *(LDKFailureCode*)(this_ptr_ptr);
41396         FREE(untag_ptr(this_ptr));
41397         FailureCode_free(this_ptr_conv);
41398 }
41399
41400 static inline uint64_t FailureCode_clone_ptr(LDKFailureCode *NONNULL_PTR arg) {
41401         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
41402         *ret_copy = FailureCode_clone(arg);
41403         int64_t ret_ref = tag_ptr(ret_copy, true);
41404         return ret_ref;
41405 }
41406 int64_t  CS_LDK_FailureCode_clone_ptr(int64_t arg) {
41407         LDKFailureCode* arg_conv = (LDKFailureCode*)untag_ptr(arg);
41408         int64_t ret_conv = FailureCode_clone_ptr(arg_conv);
41409         return ret_conv;
41410 }
41411
41412 int64_t  CS_LDK_FailureCode_clone(int64_t orig) {
41413         LDKFailureCode* orig_conv = (LDKFailureCode*)untag_ptr(orig);
41414         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
41415         *ret_copy = FailureCode_clone(orig_conv);
41416         int64_t ret_ref = tag_ptr(ret_copy, true);
41417         return ret_ref;
41418 }
41419
41420 int64_t  CS_LDK_FailureCode_temporary_node_failure() {
41421         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
41422         *ret_copy = FailureCode_temporary_node_failure();
41423         int64_t ret_ref = tag_ptr(ret_copy, true);
41424         return ret_ref;
41425 }
41426
41427 int64_t  CS_LDK_FailureCode_required_node_feature_missing() {
41428         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
41429         *ret_copy = FailureCode_required_node_feature_missing();
41430         int64_t ret_ref = tag_ptr(ret_copy, true);
41431         return ret_ref;
41432 }
41433
41434 int64_t  CS_LDK_FailureCode_incorrect_or_unknown_payment_details() {
41435         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
41436         *ret_copy = FailureCode_incorrect_or_unknown_payment_details();
41437         int64_t ret_ref = tag_ptr(ret_copy, true);
41438         return ret_ref;
41439 }
41440
41441 int64_t  CS_LDK_FailureCode_invalid_onion_payload(int64_t a) {
41442         void* a_ptr = untag_ptr(a);
41443         CHECK_ACCESS(a_ptr);
41444         LDKCOption_C2Tuple_u64u16ZZ a_conv = *(LDKCOption_C2Tuple_u64u16ZZ*)(a_ptr);
41445         a_conv = COption_C2Tuple_u64u16ZZ_clone((LDKCOption_C2Tuple_u64u16ZZ*)untag_ptr(a));
41446         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
41447         *ret_copy = FailureCode_invalid_onion_payload(a_conv);
41448         int64_t ret_ref = tag_ptr(ret_copy, true);
41449         return ret_ref;
41450 }
41451
41452 void  CS_LDK_ChannelManager_free(int64_t this_obj) {
41453         LDKChannelManager this_obj_conv;
41454         this_obj_conv.inner = untag_ptr(this_obj);
41455         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41456         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41457         ChannelManager_free(this_obj_conv);
41458 }
41459
41460 void  CS_LDK_ChainParameters_free(int64_t this_obj) {
41461         LDKChainParameters this_obj_conv;
41462         this_obj_conv.inner = untag_ptr(this_obj);
41463         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41464         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41465         ChainParameters_free(this_obj_conv);
41466 }
41467
41468 int32_t  CS_LDK_ChainParameters_get_network(int64_t this_ptr) {
41469         LDKChainParameters this_ptr_conv;
41470         this_ptr_conv.inner = untag_ptr(this_ptr);
41471         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41472         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41473         this_ptr_conv.is_owned = false;
41474         int32_t ret_conv = LDKNetwork_to_cs(ChainParameters_get_network(&this_ptr_conv));
41475         return ret_conv;
41476 }
41477
41478 void  CS_LDK_ChainParameters_set_network(int64_t this_ptr, int32_t val) {
41479         LDKChainParameters this_ptr_conv;
41480         this_ptr_conv.inner = untag_ptr(this_ptr);
41481         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41482         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41483         this_ptr_conv.is_owned = false;
41484         LDKNetwork val_conv = LDKNetwork_from_cs(val);
41485         ChainParameters_set_network(&this_ptr_conv, val_conv);
41486 }
41487
41488 int64_t  CS_LDK_ChainParameters_get_best_block(int64_t this_ptr) {
41489         LDKChainParameters this_ptr_conv;
41490         this_ptr_conv.inner = untag_ptr(this_ptr);
41491         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41492         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41493         this_ptr_conv.is_owned = false;
41494         LDKBestBlock ret_var = ChainParameters_get_best_block(&this_ptr_conv);
41495         int64_t ret_ref = 0;
41496         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41497         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41498         return ret_ref;
41499 }
41500
41501 void  CS_LDK_ChainParameters_set_best_block(int64_t this_ptr, int64_t val) {
41502         LDKChainParameters this_ptr_conv;
41503         this_ptr_conv.inner = untag_ptr(this_ptr);
41504         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41505         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41506         this_ptr_conv.is_owned = false;
41507         LDKBestBlock val_conv;
41508         val_conv.inner = untag_ptr(val);
41509         val_conv.is_owned = ptr_is_owned(val);
41510         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
41511         val_conv = BestBlock_clone(&val_conv);
41512         ChainParameters_set_best_block(&this_ptr_conv, val_conv);
41513 }
41514
41515 int64_t  CS_LDK_ChainParameters_new(int32_t network_arg, int64_t best_block_arg) {
41516         LDKNetwork network_arg_conv = LDKNetwork_from_cs(network_arg);
41517         LDKBestBlock best_block_arg_conv;
41518         best_block_arg_conv.inner = untag_ptr(best_block_arg);
41519         best_block_arg_conv.is_owned = ptr_is_owned(best_block_arg);
41520         CHECK_INNER_FIELD_ACCESS_OR_NULL(best_block_arg_conv);
41521         best_block_arg_conv = BestBlock_clone(&best_block_arg_conv);
41522         LDKChainParameters ret_var = ChainParameters_new(network_arg_conv, best_block_arg_conv);
41523         int64_t ret_ref = 0;
41524         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41525         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41526         return ret_ref;
41527 }
41528
41529 static inline uint64_t ChainParameters_clone_ptr(LDKChainParameters *NONNULL_PTR arg) {
41530         LDKChainParameters ret_var = ChainParameters_clone(arg);
41531         int64_t ret_ref = 0;
41532         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41533         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41534         return ret_ref;
41535 }
41536 int64_t  CS_LDK_ChainParameters_clone_ptr(int64_t arg) {
41537         LDKChainParameters arg_conv;
41538         arg_conv.inner = untag_ptr(arg);
41539         arg_conv.is_owned = ptr_is_owned(arg);
41540         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41541         arg_conv.is_owned = false;
41542         int64_t ret_conv = ChainParameters_clone_ptr(&arg_conv);
41543         return ret_conv;
41544 }
41545
41546 int64_t  CS_LDK_ChainParameters_clone(int64_t orig) {
41547         LDKChainParameters orig_conv;
41548         orig_conv.inner = untag_ptr(orig);
41549         orig_conv.is_owned = ptr_is_owned(orig);
41550         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41551         orig_conv.is_owned = false;
41552         LDKChainParameters ret_var = ChainParameters_clone(&orig_conv);
41553         int64_t ret_ref = 0;
41554         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41555         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41556         return ret_ref;
41557 }
41558
41559 void  CS_LDK_RecentPaymentDetails_free(int64_t this_ptr) {
41560         if (!ptr_is_owned(this_ptr)) return;
41561         void* this_ptr_ptr = untag_ptr(this_ptr);
41562         CHECK_ACCESS(this_ptr_ptr);
41563         LDKRecentPaymentDetails this_ptr_conv = *(LDKRecentPaymentDetails*)(this_ptr_ptr);
41564         FREE(untag_ptr(this_ptr));
41565         RecentPaymentDetails_free(this_ptr_conv);
41566 }
41567
41568 static inline uint64_t RecentPaymentDetails_clone_ptr(LDKRecentPaymentDetails *NONNULL_PTR arg) {
41569         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
41570         *ret_copy = RecentPaymentDetails_clone(arg);
41571         int64_t ret_ref = tag_ptr(ret_copy, true);
41572         return ret_ref;
41573 }
41574 int64_t  CS_LDK_RecentPaymentDetails_clone_ptr(int64_t arg) {
41575         LDKRecentPaymentDetails* arg_conv = (LDKRecentPaymentDetails*)untag_ptr(arg);
41576         int64_t ret_conv = RecentPaymentDetails_clone_ptr(arg_conv);
41577         return ret_conv;
41578 }
41579
41580 int64_t  CS_LDK_RecentPaymentDetails_clone(int64_t orig) {
41581         LDKRecentPaymentDetails* orig_conv = (LDKRecentPaymentDetails*)untag_ptr(orig);
41582         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
41583         *ret_copy = RecentPaymentDetails_clone(orig_conv);
41584         int64_t ret_ref = tag_ptr(ret_copy, true);
41585         return ret_ref;
41586 }
41587
41588 int64_t  CS_LDK_RecentPaymentDetails_awaiting_invoice(int8_tArray payment_id) {
41589         LDKThirtyTwoBytes payment_id_ref;
41590         CHECK(payment_id->arr_len == 32);
41591         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
41592         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
41593         *ret_copy = RecentPaymentDetails_awaiting_invoice(payment_id_ref);
41594         int64_t ret_ref = tag_ptr(ret_copy, true);
41595         return ret_ref;
41596 }
41597
41598 int64_t  CS_LDK_RecentPaymentDetails_pending(int8_tArray payment_id, int8_tArray payment_hash, int64_t total_msat) {
41599         LDKThirtyTwoBytes payment_id_ref;
41600         CHECK(payment_id->arr_len == 32);
41601         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
41602         LDKThirtyTwoBytes payment_hash_ref;
41603         CHECK(payment_hash->arr_len == 32);
41604         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
41605         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
41606         *ret_copy = RecentPaymentDetails_pending(payment_id_ref, payment_hash_ref, total_msat);
41607         int64_t ret_ref = tag_ptr(ret_copy, true);
41608         return ret_ref;
41609 }
41610
41611 int64_t  CS_LDK_RecentPaymentDetails_fulfilled(int8_tArray payment_id, int64_t payment_hash) {
41612         LDKThirtyTwoBytes payment_id_ref;
41613         CHECK(payment_id->arr_len == 32);
41614         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
41615         void* payment_hash_ptr = untag_ptr(payment_hash);
41616         CHECK_ACCESS(payment_hash_ptr);
41617         LDKCOption_ThirtyTwoBytesZ payment_hash_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_hash_ptr);
41618         payment_hash_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_hash));
41619         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
41620         *ret_copy = RecentPaymentDetails_fulfilled(payment_id_ref, payment_hash_conv);
41621         int64_t ret_ref = tag_ptr(ret_copy, true);
41622         return ret_ref;
41623 }
41624
41625 int64_t  CS_LDK_RecentPaymentDetails_abandoned(int8_tArray payment_id, int8_tArray payment_hash) {
41626         LDKThirtyTwoBytes payment_id_ref;
41627         CHECK(payment_id->arr_len == 32);
41628         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
41629         LDKThirtyTwoBytes payment_hash_ref;
41630         CHECK(payment_hash->arr_len == 32);
41631         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
41632         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
41633         *ret_copy = RecentPaymentDetails_abandoned(payment_id_ref, payment_hash_ref);
41634         int64_t ret_ref = tag_ptr(ret_copy, true);
41635         return ret_ref;
41636 }
41637
41638 void  CS_LDK_PhantomRouteHints_free(int64_t this_obj) {
41639         LDKPhantomRouteHints this_obj_conv;
41640         this_obj_conv.inner = untag_ptr(this_obj);
41641         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41642         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41643         PhantomRouteHints_free(this_obj_conv);
41644 }
41645
41646 int64_tArray  CS_LDK_PhantomRouteHints_get_channels(int64_t this_ptr) {
41647         LDKPhantomRouteHints this_ptr_conv;
41648         this_ptr_conv.inner = untag_ptr(this_ptr);
41649         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41650         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41651         this_ptr_conv.is_owned = false;
41652         LDKCVec_ChannelDetailsZ ret_var = PhantomRouteHints_get_channels(&this_ptr_conv);
41653         int64_tArray ret_arr = NULL;
41654         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
41655         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
41656         for (size_t q = 0; q < ret_var.datalen; q++) {
41657                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
41658                 int64_t ret_conv_16_ref = 0;
41659                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
41660                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
41661                 ret_arr_ptr[q] = ret_conv_16_ref;
41662         }
41663         
41664         FREE(ret_var.data);
41665         return ret_arr;
41666 }
41667
41668 void  CS_LDK_PhantomRouteHints_set_channels(int64_t this_ptr, int64_tArray val) {
41669         LDKPhantomRouteHints this_ptr_conv;
41670         this_ptr_conv.inner = untag_ptr(this_ptr);
41671         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41672         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41673         this_ptr_conv.is_owned = false;
41674         LDKCVec_ChannelDetailsZ val_constr;
41675         val_constr.datalen = val->arr_len;
41676         if (val_constr.datalen > 0)
41677                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
41678         else
41679                 val_constr.data = NULL;
41680         int64_t* val_vals = val->elems;
41681         for (size_t q = 0; q < val_constr.datalen; q++) {
41682                 int64_t val_conv_16 = val_vals[q];
41683                 LDKChannelDetails val_conv_16_conv;
41684                 val_conv_16_conv.inner = untag_ptr(val_conv_16);
41685                 val_conv_16_conv.is_owned = ptr_is_owned(val_conv_16);
41686                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
41687                 val_conv_16_conv = ChannelDetails_clone(&val_conv_16_conv);
41688                 val_constr.data[q] = val_conv_16_conv;
41689         }
41690         FREE(val);
41691         PhantomRouteHints_set_channels(&this_ptr_conv, val_constr);
41692 }
41693
41694 int64_t  CS_LDK_PhantomRouteHints_get_phantom_scid(int64_t this_ptr) {
41695         LDKPhantomRouteHints this_ptr_conv;
41696         this_ptr_conv.inner = untag_ptr(this_ptr);
41697         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41698         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41699         this_ptr_conv.is_owned = false;
41700         int64_t ret_conv = PhantomRouteHints_get_phantom_scid(&this_ptr_conv);
41701         return ret_conv;
41702 }
41703
41704 void  CS_LDK_PhantomRouteHints_set_phantom_scid(int64_t this_ptr, int64_t val) {
41705         LDKPhantomRouteHints this_ptr_conv;
41706         this_ptr_conv.inner = untag_ptr(this_ptr);
41707         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41708         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41709         this_ptr_conv.is_owned = false;
41710         PhantomRouteHints_set_phantom_scid(&this_ptr_conv, val);
41711 }
41712
41713 int8_tArray  CS_LDK_PhantomRouteHints_get_real_node_pubkey(int64_t this_ptr) {
41714         LDKPhantomRouteHints this_ptr_conv;
41715         this_ptr_conv.inner = untag_ptr(this_ptr);
41716         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41717         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41718         this_ptr_conv.is_owned = false;
41719         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
41720         memcpy(ret_arr->elems, PhantomRouteHints_get_real_node_pubkey(&this_ptr_conv).compressed_form, 33);
41721         return ret_arr;
41722 }
41723
41724 void  CS_LDK_PhantomRouteHints_set_real_node_pubkey(int64_t this_ptr, int8_tArray val) {
41725         LDKPhantomRouteHints 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         LDKPublicKey val_ref;
41731         CHECK(val->arr_len == 33);
41732         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
41733         PhantomRouteHints_set_real_node_pubkey(&this_ptr_conv, val_ref);
41734 }
41735
41736 int64_t  CS_LDK_PhantomRouteHints_new(int64_tArray channels_arg, int64_t phantom_scid_arg, int8_tArray real_node_pubkey_arg) {
41737         LDKCVec_ChannelDetailsZ channels_arg_constr;
41738         channels_arg_constr.datalen = channels_arg->arr_len;
41739         if (channels_arg_constr.datalen > 0)
41740                 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
41741         else
41742                 channels_arg_constr.data = NULL;
41743         int64_t* channels_arg_vals = channels_arg->elems;
41744         for (size_t q = 0; q < channels_arg_constr.datalen; q++) {
41745                 int64_t channels_arg_conv_16 = channels_arg_vals[q];
41746                 LDKChannelDetails channels_arg_conv_16_conv;
41747                 channels_arg_conv_16_conv.inner = untag_ptr(channels_arg_conv_16);
41748                 channels_arg_conv_16_conv.is_owned = ptr_is_owned(channels_arg_conv_16);
41749                 CHECK_INNER_FIELD_ACCESS_OR_NULL(channels_arg_conv_16_conv);
41750                 channels_arg_conv_16_conv = ChannelDetails_clone(&channels_arg_conv_16_conv);
41751                 channels_arg_constr.data[q] = channels_arg_conv_16_conv;
41752         }
41753         FREE(channels_arg);
41754         LDKPublicKey real_node_pubkey_arg_ref;
41755         CHECK(real_node_pubkey_arg->arr_len == 33);
41756         memcpy(real_node_pubkey_arg_ref.compressed_form, real_node_pubkey_arg->elems, 33); FREE(real_node_pubkey_arg);
41757         LDKPhantomRouteHints ret_var = PhantomRouteHints_new(channels_arg_constr, phantom_scid_arg, real_node_pubkey_arg_ref);
41758         int64_t ret_ref = 0;
41759         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41760         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41761         return ret_ref;
41762 }
41763
41764 static inline uint64_t PhantomRouteHints_clone_ptr(LDKPhantomRouteHints *NONNULL_PTR arg) {
41765         LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(arg);
41766         int64_t ret_ref = 0;
41767         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41768         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41769         return ret_ref;
41770 }
41771 int64_t  CS_LDK_PhantomRouteHints_clone_ptr(int64_t arg) {
41772         LDKPhantomRouteHints arg_conv;
41773         arg_conv.inner = untag_ptr(arg);
41774         arg_conv.is_owned = ptr_is_owned(arg);
41775         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41776         arg_conv.is_owned = false;
41777         int64_t ret_conv = PhantomRouteHints_clone_ptr(&arg_conv);
41778         return ret_conv;
41779 }
41780
41781 int64_t  CS_LDK_PhantomRouteHints_clone(int64_t orig) {
41782         LDKPhantomRouteHints orig_conv;
41783         orig_conv.inner = untag_ptr(orig);
41784         orig_conv.is_owned = ptr_is_owned(orig);
41785         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41786         orig_conv.is_owned = false;
41787         LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(&orig_conv);
41788         int64_t ret_ref = 0;
41789         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41790         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41791         return ret_ref;
41792 }
41793
41794 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) {
41795         void* fee_est_ptr = untag_ptr(fee_est);
41796         CHECK_ACCESS(fee_est_ptr);
41797         LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)(fee_est_ptr);
41798         if (fee_est_conv.free == LDKFeeEstimator_JCalls_free) {
41799                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41800                 LDKFeeEstimator_JCalls_cloned(&fee_est_conv);
41801         }
41802         void* chain_monitor_ptr = untag_ptr(chain_monitor);
41803         CHECK_ACCESS(chain_monitor_ptr);
41804         LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
41805         if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
41806                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41807                 LDKWatch_JCalls_cloned(&chain_monitor_conv);
41808         }
41809         void* tx_broadcaster_ptr = untag_ptr(tx_broadcaster);
41810         CHECK_ACCESS(tx_broadcaster_ptr);
41811         LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
41812         if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
41813                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41814                 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
41815         }
41816         void* router_ptr = untag_ptr(router);
41817         CHECK_ACCESS(router_ptr);
41818         LDKRouter router_conv = *(LDKRouter*)(router_ptr);
41819         if (router_conv.free == LDKRouter_JCalls_free) {
41820                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41821                 LDKRouter_JCalls_cloned(&router_conv);
41822         }
41823         void* logger_ptr = untag_ptr(logger);
41824         CHECK_ACCESS(logger_ptr);
41825         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
41826         if (logger_conv.free == LDKLogger_JCalls_free) {
41827                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41828                 LDKLogger_JCalls_cloned(&logger_conv);
41829         }
41830         void* entropy_source_ptr = untag_ptr(entropy_source);
41831         CHECK_ACCESS(entropy_source_ptr);
41832         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
41833         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
41834                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41835                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
41836         }
41837         void* node_signer_ptr = untag_ptr(node_signer);
41838         CHECK_ACCESS(node_signer_ptr);
41839         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
41840         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
41841                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41842                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
41843         }
41844         void* signer_provider_ptr = untag_ptr(signer_provider);
41845         CHECK_ACCESS(signer_provider_ptr);
41846         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
41847         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
41848                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41849                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
41850         }
41851         LDKUserConfig config_conv;
41852         config_conv.inner = untag_ptr(config);
41853         config_conv.is_owned = ptr_is_owned(config);
41854         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
41855         config_conv = UserConfig_clone(&config_conv);
41856         LDKChainParameters params_conv;
41857         params_conv.inner = untag_ptr(params);
41858         params_conv.is_owned = ptr_is_owned(params);
41859         CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
41860         params_conv = ChainParameters_clone(&params_conv);
41861         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);
41862         int64_t ret_ref = 0;
41863         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41864         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41865         return ret_ref;
41866 }
41867
41868 int64_t  CS_LDK_ChannelManager_get_current_default_configuration(int64_t this_arg) {
41869         LDKChannelManager this_arg_conv;
41870         this_arg_conv.inner = untag_ptr(this_arg);
41871         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41872         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41873         this_arg_conv.is_owned = false;
41874         LDKUserConfig ret_var = ChannelManager_get_current_default_configuration(&this_arg_conv);
41875         int64_t ret_ref = 0;
41876         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41877         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41878         return ret_ref;
41879 }
41880
41881 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) {
41882         LDKChannelManager this_arg_conv;
41883         this_arg_conv.inner = untag_ptr(this_arg);
41884         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41885         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41886         this_arg_conv.is_owned = false;
41887         LDKPublicKey their_network_key_ref;
41888         CHECK(their_network_key->arr_len == 33);
41889         memcpy(their_network_key_ref.compressed_form, their_network_key->elems, 33); FREE(their_network_key);
41890         LDKU128 user_channel_id_ref;
41891         CHECK(user_channel_id->arr_len == 16);
41892         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
41893         LDKChannelId temporary_channel_id_conv;
41894         temporary_channel_id_conv.inner = untag_ptr(temporary_channel_id);
41895         temporary_channel_id_conv.is_owned = ptr_is_owned(temporary_channel_id);
41896         CHECK_INNER_FIELD_ACCESS_OR_NULL(temporary_channel_id_conv);
41897         temporary_channel_id_conv = ChannelId_clone(&temporary_channel_id_conv);
41898         LDKUserConfig override_config_conv;
41899         override_config_conv.inner = untag_ptr(override_config);
41900         override_config_conv.is_owned = ptr_is_owned(override_config);
41901         CHECK_INNER_FIELD_ACCESS_OR_NULL(override_config_conv);
41902         override_config_conv = UserConfig_clone(&override_config_conv);
41903         LDKCResult_ChannelIdAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelIdAPIErrorZ), "LDKCResult_ChannelIdAPIErrorZ");
41904         *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);
41905         return tag_ptr(ret_conv, true);
41906 }
41907
41908 int64_tArray  CS_LDK_ChannelManager_list_channels(int64_t this_arg) {
41909         LDKChannelManager this_arg_conv;
41910         this_arg_conv.inner = untag_ptr(this_arg);
41911         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41912         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41913         this_arg_conv.is_owned = false;
41914         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
41915         int64_tArray ret_arr = NULL;
41916         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
41917         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
41918         for (size_t q = 0; q < ret_var.datalen; q++) {
41919                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
41920                 int64_t ret_conv_16_ref = 0;
41921                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
41922                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
41923                 ret_arr_ptr[q] = ret_conv_16_ref;
41924         }
41925         
41926         FREE(ret_var.data);
41927         return ret_arr;
41928 }
41929
41930 int64_tArray  CS_LDK_ChannelManager_list_usable_channels(int64_t this_arg) {
41931         LDKChannelManager this_arg_conv;
41932         this_arg_conv.inner = untag_ptr(this_arg);
41933         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41934         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41935         this_arg_conv.is_owned = false;
41936         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
41937         int64_tArray ret_arr = NULL;
41938         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
41939         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
41940         for (size_t q = 0; q < ret_var.datalen; q++) {
41941                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
41942                 int64_t ret_conv_16_ref = 0;
41943                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
41944                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
41945                 ret_arr_ptr[q] = ret_conv_16_ref;
41946         }
41947         
41948         FREE(ret_var.data);
41949         return ret_arr;
41950 }
41951
41952 int64_tArray  CS_LDK_ChannelManager_list_channels_with_counterparty(int64_t this_arg, int8_tArray counterparty_node_id) {
41953         LDKChannelManager this_arg_conv;
41954         this_arg_conv.inner = untag_ptr(this_arg);
41955         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41956         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41957         this_arg_conv.is_owned = false;
41958         LDKPublicKey counterparty_node_id_ref;
41959         CHECK(counterparty_node_id->arr_len == 33);
41960         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
41961         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels_with_counterparty(&this_arg_conv, counterparty_node_id_ref);
41962         int64_tArray ret_arr = NULL;
41963         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
41964         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
41965         for (size_t q = 0; q < ret_var.datalen; q++) {
41966                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
41967                 int64_t ret_conv_16_ref = 0;
41968                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
41969                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
41970                 ret_arr_ptr[q] = ret_conv_16_ref;
41971         }
41972         
41973         FREE(ret_var.data);
41974         return ret_arr;
41975 }
41976
41977 int64_tArray  CS_LDK_ChannelManager_list_recent_payments(int64_t this_arg) {
41978         LDKChannelManager this_arg_conv;
41979         this_arg_conv.inner = untag_ptr(this_arg);
41980         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41981         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41982         this_arg_conv.is_owned = false;
41983         LDKCVec_RecentPaymentDetailsZ ret_var = ChannelManager_list_recent_payments(&this_arg_conv);
41984         int64_tArray ret_arr = NULL;
41985         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
41986         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
41987         for (size_t w = 0; w < ret_var.datalen; w++) {
41988                 LDKRecentPaymentDetails *ret_conv_22_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
41989                 *ret_conv_22_copy = ret_var.data[w];
41990                 int64_t ret_conv_22_ref = tag_ptr(ret_conv_22_copy, true);
41991                 ret_arr_ptr[w] = ret_conv_22_ref;
41992         }
41993         
41994         FREE(ret_var.data);
41995         return ret_arr;
41996 }
41997
41998 int64_t  CS_LDK_ChannelManager_close_channel(int64_t this_arg, int64_t channel_id, int8_tArray counterparty_node_id) {
41999         LDKChannelManager this_arg_conv;
42000         this_arg_conv.inner = untag_ptr(this_arg);
42001         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42002         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42003         this_arg_conv.is_owned = false;
42004         LDKChannelId channel_id_conv;
42005         channel_id_conv.inner = untag_ptr(channel_id);
42006         channel_id_conv.is_owned = ptr_is_owned(channel_id);
42007         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
42008         channel_id_conv.is_owned = false;
42009         LDKPublicKey counterparty_node_id_ref;
42010         CHECK(counterparty_node_id->arr_len == 33);
42011         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
42012         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
42013         *ret_conv = ChannelManager_close_channel(&this_arg_conv, &channel_id_conv, counterparty_node_id_ref);
42014         return tag_ptr(ret_conv, true);
42015 }
42016
42017 int64_t  CS_LDK_ChannelManager_close_channel_with_feerate_and_script(int64_t this_arg, int64_t channel_id, int8_tArray counterparty_node_id, int64_t target_feerate_sats_per_1000_weight, int64_t shutdown_script) {
42018         LDKChannelManager this_arg_conv;
42019         this_arg_conv.inner = untag_ptr(this_arg);
42020         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42021         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42022         this_arg_conv.is_owned = false;
42023         LDKChannelId channel_id_conv;
42024         channel_id_conv.inner = untag_ptr(channel_id);
42025         channel_id_conv.is_owned = ptr_is_owned(channel_id);
42026         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
42027         channel_id_conv.is_owned = false;
42028         LDKPublicKey counterparty_node_id_ref;
42029         CHECK(counterparty_node_id->arr_len == 33);
42030         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
42031         void* target_feerate_sats_per_1000_weight_ptr = untag_ptr(target_feerate_sats_per_1000_weight);
42032         CHECK_ACCESS(target_feerate_sats_per_1000_weight_ptr);
42033         LDKCOption_u32Z target_feerate_sats_per_1000_weight_conv = *(LDKCOption_u32Z*)(target_feerate_sats_per_1000_weight_ptr);
42034         target_feerate_sats_per_1000_weight_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(target_feerate_sats_per_1000_weight));
42035         LDKShutdownScript shutdown_script_conv;
42036         shutdown_script_conv.inner = untag_ptr(shutdown_script);
42037         shutdown_script_conv.is_owned = ptr_is_owned(shutdown_script);
42038         CHECK_INNER_FIELD_ACCESS_OR_NULL(shutdown_script_conv);
42039         shutdown_script_conv = ShutdownScript_clone(&shutdown_script_conv);
42040         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
42041         *ret_conv = ChannelManager_close_channel_with_feerate_and_script(&this_arg_conv, &channel_id_conv, counterparty_node_id_ref, target_feerate_sats_per_1000_weight_conv, shutdown_script_conv);
42042         return tag_ptr(ret_conv, true);
42043 }
42044
42045 int64_t  CS_LDK_ChannelManager_force_close_broadcasting_latest_txn(int64_t this_arg, int64_t channel_id, int8_tArray counterparty_node_id) {
42046         LDKChannelManager this_arg_conv;
42047         this_arg_conv.inner = untag_ptr(this_arg);
42048         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42049         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42050         this_arg_conv.is_owned = false;
42051         LDKChannelId channel_id_conv;
42052         channel_id_conv.inner = untag_ptr(channel_id);
42053         channel_id_conv.is_owned = ptr_is_owned(channel_id);
42054         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
42055         channel_id_conv.is_owned = false;
42056         LDKPublicKey counterparty_node_id_ref;
42057         CHECK(counterparty_node_id->arr_len == 33);
42058         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
42059         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
42060         *ret_conv = ChannelManager_force_close_broadcasting_latest_txn(&this_arg_conv, &channel_id_conv, counterparty_node_id_ref);
42061         return tag_ptr(ret_conv, true);
42062 }
42063
42064 int64_t  CS_LDK_ChannelManager_force_close_without_broadcasting_txn(int64_t this_arg, int64_t channel_id, int8_tArray counterparty_node_id) {
42065         LDKChannelManager this_arg_conv;
42066         this_arg_conv.inner = untag_ptr(this_arg);
42067         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42068         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42069         this_arg_conv.is_owned = false;
42070         LDKChannelId channel_id_conv;
42071         channel_id_conv.inner = untag_ptr(channel_id);
42072         channel_id_conv.is_owned = ptr_is_owned(channel_id);
42073         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
42074         channel_id_conv.is_owned = false;
42075         LDKPublicKey counterparty_node_id_ref;
42076         CHECK(counterparty_node_id->arr_len == 33);
42077         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
42078         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
42079         *ret_conv = ChannelManager_force_close_without_broadcasting_txn(&this_arg_conv, &channel_id_conv, counterparty_node_id_ref);
42080         return tag_ptr(ret_conv, true);
42081 }
42082
42083 void  CS_LDK_ChannelManager_force_close_all_channels_broadcasting_latest_txn(int64_t this_arg) {
42084         LDKChannelManager this_arg_conv;
42085         this_arg_conv.inner = untag_ptr(this_arg);
42086         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42087         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42088         this_arg_conv.is_owned = false;
42089         ChannelManager_force_close_all_channels_broadcasting_latest_txn(&this_arg_conv);
42090 }
42091
42092 void  CS_LDK_ChannelManager_force_close_all_channels_without_broadcasting_txn(int64_t this_arg) {
42093         LDKChannelManager this_arg_conv;
42094         this_arg_conv.inner = untag_ptr(this_arg);
42095         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42096         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42097         this_arg_conv.is_owned = false;
42098         ChannelManager_force_close_all_channels_without_broadcasting_txn(&this_arg_conv);
42099 }
42100
42101 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) {
42102         LDKChannelManager this_arg_conv;
42103         this_arg_conv.inner = untag_ptr(this_arg);
42104         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42105         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42106         this_arg_conv.is_owned = false;
42107         LDKRoute route_conv;
42108         route_conv.inner = untag_ptr(route);
42109         route_conv.is_owned = ptr_is_owned(route);
42110         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
42111         route_conv.is_owned = false;
42112         LDKThirtyTwoBytes payment_hash_ref;
42113         CHECK(payment_hash->arr_len == 32);
42114         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
42115         LDKRecipientOnionFields recipient_onion_conv;
42116         recipient_onion_conv.inner = untag_ptr(recipient_onion);
42117         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
42118         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
42119         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
42120         LDKThirtyTwoBytes payment_id_ref;
42121         CHECK(payment_id->arr_len == 32);
42122         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
42123         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
42124         *ret_conv = ChannelManager_send_payment_with_route(&this_arg_conv, &route_conv, payment_hash_ref, recipient_onion_conv, payment_id_ref);
42125         return tag_ptr(ret_conv, true);
42126 }
42127
42128 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) {
42129         LDKChannelManager this_arg_conv;
42130         this_arg_conv.inner = untag_ptr(this_arg);
42131         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42132         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42133         this_arg_conv.is_owned = false;
42134         LDKThirtyTwoBytes payment_hash_ref;
42135         CHECK(payment_hash->arr_len == 32);
42136         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
42137         LDKRecipientOnionFields recipient_onion_conv;
42138         recipient_onion_conv.inner = untag_ptr(recipient_onion);
42139         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
42140         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
42141         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
42142         LDKThirtyTwoBytes payment_id_ref;
42143         CHECK(payment_id->arr_len == 32);
42144         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
42145         LDKRouteParameters route_params_conv;
42146         route_params_conv.inner = untag_ptr(route_params);
42147         route_params_conv.is_owned = ptr_is_owned(route_params);
42148         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
42149         route_params_conv = RouteParameters_clone(&route_params_conv);
42150         void* retry_strategy_ptr = untag_ptr(retry_strategy);
42151         CHECK_ACCESS(retry_strategy_ptr);
42152         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
42153         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
42154         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
42155         *ret_conv = ChannelManager_send_payment(&this_arg_conv, payment_hash_ref, recipient_onion_conv, payment_id_ref, route_params_conv, retry_strategy_conv);
42156         return tag_ptr(ret_conv, true);
42157 }
42158
42159 void  CS_LDK_ChannelManager_abandon_payment(int64_t this_arg, int8_tArray payment_id) {
42160         LDKChannelManager this_arg_conv;
42161         this_arg_conv.inner = untag_ptr(this_arg);
42162         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42163         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42164         this_arg_conv.is_owned = false;
42165         LDKThirtyTwoBytes payment_id_ref;
42166         CHECK(payment_id->arr_len == 32);
42167         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
42168         ChannelManager_abandon_payment(&this_arg_conv, payment_id_ref);
42169 }
42170
42171 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) {
42172         LDKChannelManager this_arg_conv;
42173         this_arg_conv.inner = untag_ptr(this_arg);
42174         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42175         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42176         this_arg_conv.is_owned = false;
42177         LDKRoute route_conv;
42178         route_conv.inner = untag_ptr(route);
42179         route_conv.is_owned = ptr_is_owned(route);
42180         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
42181         route_conv.is_owned = false;
42182         void* payment_preimage_ptr = untag_ptr(payment_preimage);
42183         CHECK_ACCESS(payment_preimage_ptr);
42184         LDKCOption_ThirtyTwoBytesZ payment_preimage_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_preimage_ptr);
42185         payment_preimage_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_preimage));
42186         LDKRecipientOnionFields recipient_onion_conv;
42187         recipient_onion_conv.inner = untag_ptr(recipient_onion);
42188         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
42189         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
42190         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
42191         LDKThirtyTwoBytes payment_id_ref;
42192         CHECK(payment_id->arr_len == 32);
42193         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
42194         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ), "LDKCResult_ThirtyTwoBytesPaymentSendFailureZ");
42195         *ret_conv = ChannelManager_send_spontaneous_payment(&this_arg_conv, &route_conv, payment_preimage_conv, recipient_onion_conv, payment_id_ref);
42196         return tag_ptr(ret_conv, true);
42197 }
42198
42199 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) {
42200         LDKChannelManager this_arg_conv;
42201         this_arg_conv.inner = untag_ptr(this_arg);
42202         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42203         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42204         this_arg_conv.is_owned = false;
42205         void* payment_preimage_ptr = untag_ptr(payment_preimage);
42206         CHECK_ACCESS(payment_preimage_ptr);
42207         LDKCOption_ThirtyTwoBytesZ payment_preimage_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_preimage_ptr);
42208         payment_preimage_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_preimage));
42209         LDKRecipientOnionFields recipient_onion_conv;
42210         recipient_onion_conv.inner = untag_ptr(recipient_onion);
42211         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
42212         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
42213         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
42214         LDKThirtyTwoBytes payment_id_ref;
42215         CHECK(payment_id->arr_len == 32);
42216         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
42217         LDKRouteParameters route_params_conv;
42218         route_params_conv.inner = untag_ptr(route_params);
42219         route_params_conv.is_owned = ptr_is_owned(route_params);
42220         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
42221         route_params_conv = RouteParameters_clone(&route_params_conv);
42222         void* retry_strategy_ptr = untag_ptr(retry_strategy);
42223         CHECK_ACCESS(retry_strategy_ptr);
42224         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
42225         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
42226         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ), "LDKCResult_ThirtyTwoBytesRetryableSendFailureZ");
42227         *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);
42228         return tag_ptr(ret_conv, true);
42229 }
42230
42231 int64_t  CS_LDK_ChannelManager_send_probe(int64_t this_arg, int64_t path) {
42232         LDKChannelManager this_arg_conv;
42233         this_arg_conv.inner = untag_ptr(this_arg);
42234         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42235         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42236         this_arg_conv.is_owned = false;
42237         LDKPath path_conv;
42238         path_conv.inner = untag_ptr(path);
42239         path_conv.is_owned = ptr_is_owned(path);
42240         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
42241         path_conv = Path_clone(&path_conv);
42242         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ");
42243         *ret_conv = ChannelManager_send_probe(&this_arg_conv, path_conv);
42244         return tag_ptr(ret_conv, true);
42245 }
42246
42247 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) {
42248         LDKChannelManager this_arg_conv;
42249         this_arg_conv.inner = untag_ptr(this_arg);
42250         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42251         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42252         this_arg_conv.is_owned = false;
42253         LDKPublicKey node_id_ref;
42254         CHECK(node_id->arr_len == 33);
42255         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
42256         void* liquidity_limit_multiplier_ptr = untag_ptr(liquidity_limit_multiplier);
42257         CHECK_ACCESS(liquidity_limit_multiplier_ptr);
42258         LDKCOption_u64Z liquidity_limit_multiplier_conv = *(LDKCOption_u64Z*)(liquidity_limit_multiplier_ptr);
42259         liquidity_limit_multiplier_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(liquidity_limit_multiplier));
42260         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
42261         *ret_conv = ChannelManager_send_spontaneous_preflight_probes(&this_arg_conv, node_id_ref, amount_msat, final_cltv_expiry_delta, liquidity_limit_multiplier_conv);
42262         return tag_ptr(ret_conv, true);
42263 }
42264
42265 int64_t  CS_LDK_ChannelManager_send_preflight_probes(int64_t this_arg, int64_t route_params, int64_t liquidity_limit_multiplier) {
42266         LDKChannelManager this_arg_conv;
42267         this_arg_conv.inner = untag_ptr(this_arg);
42268         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42269         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42270         this_arg_conv.is_owned = false;
42271         LDKRouteParameters route_params_conv;
42272         route_params_conv.inner = untag_ptr(route_params);
42273         route_params_conv.is_owned = ptr_is_owned(route_params);
42274         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
42275         route_params_conv = RouteParameters_clone(&route_params_conv);
42276         void* liquidity_limit_multiplier_ptr = untag_ptr(liquidity_limit_multiplier);
42277         CHECK_ACCESS(liquidity_limit_multiplier_ptr);
42278         LDKCOption_u64Z liquidity_limit_multiplier_conv = *(LDKCOption_u64Z*)(liquidity_limit_multiplier_ptr);
42279         liquidity_limit_multiplier_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(liquidity_limit_multiplier));
42280         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
42281         *ret_conv = ChannelManager_send_preflight_probes(&this_arg_conv, route_params_conv, liquidity_limit_multiplier_conv);
42282         return tag_ptr(ret_conv, true);
42283 }
42284
42285 int64_t  CS_LDK_ChannelManager_funding_transaction_generated(int64_t this_arg, int64_t temporary_channel_id, int8_tArray counterparty_node_id, int8_tArray funding_transaction) {
42286         LDKChannelManager this_arg_conv;
42287         this_arg_conv.inner = untag_ptr(this_arg);
42288         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42289         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42290         this_arg_conv.is_owned = false;
42291         LDKChannelId temporary_channel_id_conv;
42292         temporary_channel_id_conv.inner = untag_ptr(temporary_channel_id);
42293         temporary_channel_id_conv.is_owned = ptr_is_owned(temporary_channel_id);
42294         CHECK_INNER_FIELD_ACCESS_OR_NULL(temporary_channel_id_conv);
42295         temporary_channel_id_conv.is_owned = false;
42296         LDKPublicKey counterparty_node_id_ref;
42297         CHECK(counterparty_node_id->arr_len == 33);
42298         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
42299         LDKTransaction funding_transaction_ref;
42300         funding_transaction_ref.datalen = funding_transaction->arr_len;
42301         funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
42302         memcpy(funding_transaction_ref.data, funding_transaction->elems, funding_transaction_ref.datalen); FREE(funding_transaction);
42303         funding_transaction_ref.data_is_owned = true;
42304         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
42305         *ret_conv = ChannelManager_funding_transaction_generated(&this_arg_conv, &temporary_channel_id_conv, counterparty_node_id_ref, funding_transaction_ref);
42306         return tag_ptr(ret_conv, true);
42307 }
42308
42309 int64_t  CS_LDK_ChannelManager_batch_funding_transaction_generated(int64_t this_arg, int64_tArray temporary_channels, int8_tArray funding_transaction) {
42310         LDKChannelManager this_arg_conv;
42311         this_arg_conv.inner = untag_ptr(this_arg);
42312         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42313         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42314         this_arg_conv.is_owned = false;
42315         LDKCVec_C2Tuple_ChannelIdPublicKeyZZ temporary_channels_constr;
42316         temporary_channels_constr.datalen = temporary_channels->arr_len;
42317         if (temporary_channels_constr.datalen > 0)
42318                 temporary_channels_constr.data = MALLOC(temporary_channels_constr.datalen * sizeof(LDKC2Tuple_ChannelIdPublicKeyZ), "LDKCVec_C2Tuple_ChannelIdPublicKeyZZ Elements");
42319         else
42320                 temporary_channels_constr.data = NULL;
42321         int64_t* temporary_channels_vals = temporary_channels->elems;
42322         for (size_t e = 0; e < temporary_channels_constr.datalen; e++) {
42323                 int64_t temporary_channels_conv_30 = temporary_channels_vals[e];
42324                 void* temporary_channels_conv_30_ptr = untag_ptr(temporary_channels_conv_30);
42325                 CHECK_ACCESS(temporary_channels_conv_30_ptr);
42326                 LDKC2Tuple_ChannelIdPublicKeyZ temporary_channels_conv_30_conv = *(LDKC2Tuple_ChannelIdPublicKeyZ*)(temporary_channels_conv_30_ptr);
42327                 temporary_channels_conv_30_conv = C2Tuple_ChannelIdPublicKeyZ_clone((LDKC2Tuple_ChannelIdPublicKeyZ*)untag_ptr(temporary_channels_conv_30));
42328                 temporary_channels_constr.data[e] = temporary_channels_conv_30_conv;
42329         }
42330         FREE(temporary_channels);
42331         LDKTransaction funding_transaction_ref;
42332         funding_transaction_ref.datalen = funding_transaction->arr_len;
42333         funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
42334         memcpy(funding_transaction_ref.data, funding_transaction->elems, funding_transaction_ref.datalen); FREE(funding_transaction);
42335         funding_transaction_ref.data_is_owned = true;
42336         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
42337         *ret_conv = ChannelManager_batch_funding_transaction_generated(&this_arg_conv, temporary_channels_constr, funding_transaction_ref);
42338         return tag_ptr(ret_conv, true);
42339 }
42340
42341 int64_t  CS_LDK_ChannelManager_update_partial_channel_config(int64_t this_arg, int8_tArray counterparty_node_id, int64_tArray channel_ids, int64_t config_update) {
42342         LDKChannelManager this_arg_conv;
42343         this_arg_conv.inner = untag_ptr(this_arg);
42344         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42345         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42346         this_arg_conv.is_owned = false;
42347         LDKPublicKey counterparty_node_id_ref;
42348         CHECK(counterparty_node_id->arr_len == 33);
42349         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
42350         LDKCVec_ChannelIdZ channel_ids_constr;
42351         channel_ids_constr.datalen = channel_ids->arr_len;
42352         if (channel_ids_constr.datalen > 0)
42353                 channel_ids_constr.data = MALLOC(channel_ids_constr.datalen * sizeof(LDKChannelId), "LDKCVec_ChannelIdZ Elements");
42354         else
42355                 channel_ids_constr.data = NULL;
42356         int64_t* channel_ids_vals = channel_ids->elems;
42357         for (size_t l = 0; l < channel_ids_constr.datalen; l++) {
42358                 int64_t channel_ids_conv_11 = channel_ids_vals[l];
42359                 LDKChannelId channel_ids_conv_11_conv;
42360                 channel_ids_conv_11_conv.inner = untag_ptr(channel_ids_conv_11);
42361                 channel_ids_conv_11_conv.is_owned = ptr_is_owned(channel_ids_conv_11);
42362                 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_ids_conv_11_conv);
42363                 channel_ids_conv_11_conv = ChannelId_clone(&channel_ids_conv_11_conv);
42364                 channel_ids_constr.data[l] = channel_ids_conv_11_conv;
42365         }
42366         FREE(channel_ids);
42367         LDKChannelConfigUpdate config_update_conv;
42368         config_update_conv.inner = untag_ptr(config_update);
42369         config_update_conv.is_owned = ptr_is_owned(config_update);
42370         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_update_conv);
42371         config_update_conv.is_owned = false;
42372         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
42373         *ret_conv = ChannelManager_update_partial_channel_config(&this_arg_conv, counterparty_node_id_ref, channel_ids_constr, &config_update_conv);
42374         return tag_ptr(ret_conv, true);
42375 }
42376
42377 int64_t  CS_LDK_ChannelManager_update_channel_config(int64_t this_arg, int8_tArray counterparty_node_id, int64_tArray channel_ids, int64_t config) {
42378         LDKChannelManager this_arg_conv;
42379         this_arg_conv.inner = untag_ptr(this_arg);
42380         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42381         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42382         this_arg_conv.is_owned = false;
42383         LDKPublicKey counterparty_node_id_ref;
42384         CHECK(counterparty_node_id->arr_len == 33);
42385         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
42386         LDKCVec_ChannelIdZ channel_ids_constr;
42387         channel_ids_constr.datalen = channel_ids->arr_len;
42388         if (channel_ids_constr.datalen > 0)
42389                 channel_ids_constr.data = MALLOC(channel_ids_constr.datalen * sizeof(LDKChannelId), "LDKCVec_ChannelIdZ Elements");
42390         else
42391                 channel_ids_constr.data = NULL;
42392         int64_t* channel_ids_vals = channel_ids->elems;
42393         for (size_t l = 0; l < channel_ids_constr.datalen; l++) {
42394                 int64_t channel_ids_conv_11 = channel_ids_vals[l];
42395                 LDKChannelId channel_ids_conv_11_conv;
42396                 channel_ids_conv_11_conv.inner = untag_ptr(channel_ids_conv_11);
42397                 channel_ids_conv_11_conv.is_owned = ptr_is_owned(channel_ids_conv_11);
42398                 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_ids_conv_11_conv);
42399                 channel_ids_conv_11_conv = ChannelId_clone(&channel_ids_conv_11_conv);
42400                 channel_ids_constr.data[l] = channel_ids_conv_11_conv;
42401         }
42402         FREE(channel_ids);
42403         LDKChannelConfig config_conv;
42404         config_conv.inner = untag_ptr(config);
42405         config_conv.is_owned = ptr_is_owned(config);
42406         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
42407         config_conv.is_owned = false;
42408         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
42409         *ret_conv = ChannelManager_update_channel_config(&this_arg_conv, counterparty_node_id_ref, channel_ids_constr, &config_conv);
42410         return tag_ptr(ret_conv, true);
42411 }
42412
42413 int64_t  CS_LDK_ChannelManager_forward_intercepted_htlc(int64_t this_arg, int8_tArray intercept_id, int64_t next_hop_channel_id, int8_tArray next_node_id, int64_t amt_to_forward_msat) {
42414         LDKChannelManager this_arg_conv;
42415         this_arg_conv.inner = untag_ptr(this_arg);
42416         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42417         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42418         this_arg_conv.is_owned = false;
42419         LDKThirtyTwoBytes intercept_id_ref;
42420         CHECK(intercept_id->arr_len == 32);
42421         memcpy(intercept_id_ref.data, intercept_id->elems, 32); FREE(intercept_id);
42422         LDKChannelId next_hop_channel_id_conv;
42423         next_hop_channel_id_conv.inner = untag_ptr(next_hop_channel_id);
42424         next_hop_channel_id_conv.is_owned = ptr_is_owned(next_hop_channel_id);
42425         CHECK_INNER_FIELD_ACCESS_OR_NULL(next_hop_channel_id_conv);
42426         next_hop_channel_id_conv.is_owned = false;
42427         LDKPublicKey next_node_id_ref;
42428         CHECK(next_node_id->arr_len == 33);
42429         memcpy(next_node_id_ref.compressed_form, next_node_id->elems, 33); FREE(next_node_id);
42430         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
42431         *ret_conv = ChannelManager_forward_intercepted_htlc(&this_arg_conv, intercept_id_ref, &next_hop_channel_id_conv, next_node_id_ref, amt_to_forward_msat);
42432         return tag_ptr(ret_conv, true);
42433 }
42434
42435 int64_t  CS_LDK_ChannelManager_fail_intercepted_htlc(int64_t this_arg, int8_tArray intercept_id) {
42436         LDKChannelManager this_arg_conv;
42437         this_arg_conv.inner = untag_ptr(this_arg);
42438         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42439         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42440         this_arg_conv.is_owned = false;
42441         LDKThirtyTwoBytes intercept_id_ref;
42442         CHECK(intercept_id->arr_len == 32);
42443         memcpy(intercept_id_ref.data, intercept_id->elems, 32); FREE(intercept_id);
42444         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
42445         *ret_conv = ChannelManager_fail_intercepted_htlc(&this_arg_conv, intercept_id_ref);
42446         return tag_ptr(ret_conv, true);
42447 }
42448
42449 void  CS_LDK_ChannelManager_process_pending_htlc_forwards(int64_t this_arg) {
42450         LDKChannelManager this_arg_conv;
42451         this_arg_conv.inner = untag_ptr(this_arg);
42452         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42453         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42454         this_arg_conv.is_owned = false;
42455         ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
42456 }
42457
42458 void  CS_LDK_ChannelManager_timer_tick_occurred(int64_t this_arg) {
42459         LDKChannelManager this_arg_conv;
42460         this_arg_conv.inner = untag_ptr(this_arg);
42461         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42462         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42463         this_arg_conv.is_owned = false;
42464         ChannelManager_timer_tick_occurred(&this_arg_conv);
42465 }
42466
42467 void  CS_LDK_ChannelManager_fail_htlc_backwards(int64_t this_arg, int8_tArray payment_hash) {
42468         LDKChannelManager this_arg_conv;
42469         this_arg_conv.inner = untag_ptr(this_arg);
42470         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42471         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42472         this_arg_conv.is_owned = false;
42473         uint8_t payment_hash_arr[32];
42474         CHECK(payment_hash->arr_len == 32);
42475         memcpy(payment_hash_arr, payment_hash->elems, 32); FREE(payment_hash);
42476         uint8_t (*payment_hash_ref)[32] = &payment_hash_arr;
42477         ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref);
42478 }
42479
42480 void  CS_LDK_ChannelManager_fail_htlc_backwards_with_reason(int64_t this_arg, int8_tArray payment_hash, int64_t failure_code) {
42481         LDKChannelManager this_arg_conv;
42482         this_arg_conv.inner = untag_ptr(this_arg);
42483         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42484         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42485         this_arg_conv.is_owned = false;
42486         uint8_t payment_hash_arr[32];
42487         CHECK(payment_hash->arr_len == 32);
42488         memcpy(payment_hash_arr, payment_hash->elems, 32); FREE(payment_hash);
42489         uint8_t (*payment_hash_ref)[32] = &payment_hash_arr;
42490         void* failure_code_ptr = untag_ptr(failure_code);
42491         CHECK_ACCESS(failure_code_ptr);
42492         LDKFailureCode failure_code_conv = *(LDKFailureCode*)(failure_code_ptr);
42493         failure_code_conv = FailureCode_clone((LDKFailureCode*)untag_ptr(failure_code));
42494         ChannelManager_fail_htlc_backwards_with_reason(&this_arg_conv, payment_hash_ref, failure_code_conv);
42495 }
42496
42497 void  CS_LDK_ChannelManager_claim_funds(int64_t this_arg, int8_tArray payment_preimage) {
42498         LDKChannelManager this_arg_conv;
42499         this_arg_conv.inner = untag_ptr(this_arg);
42500         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42501         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42502         this_arg_conv.is_owned = false;
42503         LDKThirtyTwoBytes payment_preimage_ref;
42504         CHECK(payment_preimage->arr_len == 32);
42505         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
42506         ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref);
42507 }
42508
42509 void  CS_LDK_ChannelManager_claim_funds_with_known_custom_tlvs(int64_t this_arg, int8_tArray payment_preimage) {
42510         LDKChannelManager this_arg_conv;
42511         this_arg_conv.inner = untag_ptr(this_arg);
42512         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42513         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42514         this_arg_conv.is_owned = false;
42515         LDKThirtyTwoBytes payment_preimage_ref;
42516         CHECK(payment_preimage->arr_len == 32);
42517         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
42518         ChannelManager_claim_funds_with_known_custom_tlvs(&this_arg_conv, payment_preimage_ref);
42519 }
42520
42521 int8_tArray  CS_LDK_ChannelManager_get_our_node_id(int64_t this_arg) {
42522         LDKChannelManager this_arg_conv;
42523         this_arg_conv.inner = untag_ptr(this_arg);
42524         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42525         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42526         this_arg_conv.is_owned = false;
42527         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
42528         memcpy(ret_arr->elems, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form, 33);
42529         return ret_arr;
42530 }
42531
42532 int64_t  CS_LDK_ChannelManager_accept_inbound_channel(int64_t this_arg, int64_t temporary_channel_id, int8_tArray counterparty_node_id, int8_tArray user_channel_id) {
42533         LDKChannelManager this_arg_conv;
42534         this_arg_conv.inner = untag_ptr(this_arg);
42535         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42536         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42537         this_arg_conv.is_owned = false;
42538         LDKChannelId temporary_channel_id_conv;
42539         temporary_channel_id_conv.inner = untag_ptr(temporary_channel_id);
42540         temporary_channel_id_conv.is_owned = ptr_is_owned(temporary_channel_id);
42541         CHECK_INNER_FIELD_ACCESS_OR_NULL(temporary_channel_id_conv);
42542         temporary_channel_id_conv.is_owned = false;
42543         LDKPublicKey counterparty_node_id_ref;
42544         CHECK(counterparty_node_id->arr_len == 33);
42545         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
42546         LDKU128 user_channel_id_ref;
42547         CHECK(user_channel_id->arr_len == 16);
42548         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
42549         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
42550         *ret_conv = ChannelManager_accept_inbound_channel(&this_arg_conv, &temporary_channel_id_conv, counterparty_node_id_ref, user_channel_id_ref);
42551         return tag_ptr(ret_conv, true);
42552 }
42553
42554 int64_t  CS_LDK_ChannelManager_accept_inbound_channel_from_trusted_peer_0conf(int64_t this_arg, int64_t temporary_channel_id, int8_tArray counterparty_node_id, int8_tArray user_channel_id) {
42555         LDKChannelManager this_arg_conv;
42556         this_arg_conv.inner = untag_ptr(this_arg);
42557         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42558         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42559         this_arg_conv.is_owned = false;
42560         LDKChannelId temporary_channel_id_conv;
42561         temporary_channel_id_conv.inner = untag_ptr(temporary_channel_id);
42562         temporary_channel_id_conv.is_owned = ptr_is_owned(temporary_channel_id);
42563         CHECK_INNER_FIELD_ACCESS_OR_NULL(temporary_channel_id_conv);
42564         temporary_channel_id_conv.is_owned = false;
42565         LDKPublicKey counterparty_node_id_ref;
42566         CHECK(counterparty_node_id->arr_len == 33);
42567         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
42568         LDKU128 user_channel_id_ref;
42569         CHECK(user_channel_id->arr_len == 16);
42570         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
42571         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
42572         *ret_conv = ChannelManager_accept_inbound_channel_from_trusted_peer_0conf(&this_arg_conv, &temporary_channel_id_conv, counterparty_node_id_ref, user_channel_id_ref);
42573         return tag_ptr(ret_conv, true);
42574 }
42575
42576 int64_t  CS_LDK_ChannelManager_create_offer_builder(int64_t this_arg) {
42577         LDKChannelManager this_arg_conv;
42578         this_arg_conv.inner = untag_ptr(this_arg);
42579         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42580         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42581         this_arg_conv.is_owned = false;
42582         LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ), "LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ");
42583         *ret_conv = ChannelManager_create_offer_builder(&this_arg_conv);
42584         return tag_ptr(ret_conv, true);
42585 }
42586
42587 int64_t  CS_LDK_ChannelManager_create_refund_builder(int64_t this_arg, int64_t amount_msats, int64_t absolute_expiry, int8_tArray payment_id, int64_t retry_strategy, int64_t max_total_routing_fee_msat) {
42588         LDKChannelManager this_arg_conv;
42589         this_arg_conv.inner = untag_ptr(this_arg);
42590         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42591         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42592         this_arg_conv.is_owned = false;
42593         LDKThirtyTwoBytes payment_id_ref;
42594         CHECK(payment_id->arr_len == 32);
42595         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
42596         void* retry_strategy_ptr = untag_ptr(retry_strategy);
42597         CHECK_ACCESS(retry_strategy_ptr);
42598         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
42599         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
42600         void* max_total_routing_fee_msat_ptr = untag_ptr(max_total_routing_fee_msat);
42601         CHECK_ACCESS(max_total_routing_fee_msat_ptr);
42602         LDKCOption_u64Z max_total_routing_fee_msat_conv = *(LDKCOption_u64Z*)(max_total_routing_fee_msat_ptr);
42603         max_total_routing_fee_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(max_total_routing_fee_msat));
42604         LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ), "LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ");
42605         *ret_conv = ChannelManager_create_refund_builder(&this_arg_conv, amount_msats, absolute_expiry, payment_id_ref, retry_strategy_conv, max_total_routing_fee_msat_conv);
42606         return tag_ptr(ret_conv, true);
42607 }
42608
42609 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) {
42610         LDKChannelManager this_arg_conv;
42611         this_arg_conv.inner = untag_ptr(this_arg);
42612         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42613         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42614         this_arg_conv.is_owned = false;
42615         LDKOffer offer_conv;
42616         offer_conv.inner = untag_ptr(offer);
42617         offer_conv.is_owned = ptr_is_owned(offer);
42618         CHECK_INNER_FIELD_ACCESS_OR_NULL(offer_conv);
42619         offer_conv.is_owned = false;
42620         void* quantity_ptr = untag_ptr(quantity);
42621         CHECK_ACCESS(quantity_ptr);
42622         LDKCOption_u64Z quantity_conv = *(LDKCOption_u64Z*)(quantity_ptr);
42623         quantity_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(quantity));
42624         void* amount_msats_ptr = untag_ptr(amount_msats);
42625         CHECK_ACCESS(amount_msats_ptr);
42626         LDKCOption_u64Z amount_msats_conv = *(LDKCOption_u64Z*)(amount_msats_ptr);
42627         amount_msats_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amount_msats));
42628         void* payer_note_ptr = untag_ptr(payer_note);
42629         CHECK_ACCESS(payer_note_ptr);
42630         LDKCOption_StrZ payer_note_conv = *(LDKCOption_StrZ*)(payer_note_ptr);
42631         payer_note_conv = COption_StrZ_clone((LDKCOption_StrZ*)untag_ptr(payer_note));
42632         LDKThirtyTwoBytes payment_id_ref;
42633         CHECK(payment_id->arr_len == 32);
42634         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
42635         void* retry_strategy_ptr = untag_ptr(retry_strategy);
42636         CHECK_ACCESS(retry_strategy_ptr);
42637         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
42638         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
42639         void* max_total_routing_fee_msat_ptr = untag_ptr(max_total_routing_fee_msat);
42640         CHECK_ACCESS(max_total_routing_fee_msat_ptr);
42641         LDKCOption_u64Z max_total_routing_fee_msat_conv = *(LDKCOption_u64Z*)(max_total_routing_fee_msat_ptr);
42642         max_total_routing_fee_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(max_total_routing_fee_msat));
42643         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
42644         *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);
42645         return tag_ptr(ret_conv, true);
42646 }
42647
42648 int64_t  CS_LDK_ChannelManager_request_refund_payment(int64_t this_arg, int64_t refund) {
42649         LDKChannelManager this_arg_conv;
42650         this_arg_conv.inner = untag_ptr(this_arg);
42651         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42652         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42653         this_arg_conv.is_owned = false;
42654         LDKRefund refund_conv;
42655         refund_conv.inner = untag_ptr(refund);
42656         refund_conv.is_owned = ptr_is_owned(refund);
42657         CHECK_INNER_FIELD_ACCESS_OR_NULL(refund_conv);
42658         refund_conv.is_owned = false;
42659         LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ), "LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ");
42660         *ret_conv = ChannelManager_request_refund_payment(&this_arg_conv, &refund_conv);
42661         return tag_ptr(ret_conv, true);
42662 }
42663
42664 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) {
42665         LDKChannelManager this_arg_conv;
42666         this_arg_conv.inner = untag_ptr(this_arg);
42667         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42668         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42669         this_arg_conv.is_owned = false;
42670         void* min_value_msat_ptr = untag_ptr(min_value_msat);
42671         CHECK_ACCESS(min_value_msat_ptr);
42672         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
42673         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
42674         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
42675         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
42676         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
42677         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
42678         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
42679         *ret_conv = ChannelManager_create_inbound_payment(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs, min_final_cltv_expiry_delta_conv);
42680         return tag_ptr(ret_conv, true);
42681 }
42682
42683 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) {
42684         LDKChannelManager this_arg_conv;
42685         this_arg_conv.inner = untag_ptr(this_arg);
42686         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42687         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42688         this_arg_conv.is_owned = false;
42689         LDKThirtyTwoBytes payment_hash_ref;
42690         CHECK(payment_hash->arr_len == 32);
42691         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
42692         void* min_value_msat_ptr = untag_ptr(min_value_msat);
42693         CHECK_ACCESS(min_value_msat_ptr);
42694         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
42695         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
42696         void* min_final_cltv_expiry_ptr = untag_ptr(min_final_cltv_expiry);
42697         CHECK_ACCESS(min_final_cltv_expiry_ptr);
42698         LDKCOption_u16Z min_final_cltv_expiry_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_ptr);
42699         min_final_cltv_expiry_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry));
42700         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
42701         *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);
42702         return tag_ptr(ret_conv, true);
42703 }
42704
42705 int64_t  CS_LDK_ChannelManager_get_payment_preimage(int64_t this_arg, int8_tArray payment_hash, int8_tArray payment_secret) {
42706         LDKChannelManager this_arg_conv;
42707         this_arg_conv.inner = untag_ptr(this_arg);
42708         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42709         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42710         this_arg_conv.is_owned = false;
42711         LDKThirtyTwoBytes payment_hash_ref;
42712         CHECK(payment_hash->arr_len == 32);
42713         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
42714         LDKThirtyTwoBytes payment_secret_ref;
42715         CHECK(payment_secret->arr_len == 32);
42716         memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
42717         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
42718         *ret_conv = ChannelManager_get_payment_preimage(&this_arg_conv, payment_hash_ref, payment_secret_ref);
42719         return tag_ptr(ret_conv, true);
42720 }
42721
42722 int64_t  CS_LDK_ChannelManager_get_phantom_scid(int64_t this_arg) {
42723         LDKChannelManager this_arg_conv;
42724         this_arg_conv.inner = untag_ptr(this_arg);
42725         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42726         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42727         this_arg_conv.is_owned = false;
42728         int64_t ret_conv = ChannelManager_get_phantom_scid(&this_arg_conv);
42729         return ret_conv;
42730 }
42731
42732 int64_t  CS_LDK_ChannelManager_get_phantom_route_hints(int64_t this_arg) {
42733         LDKChannelManager this_arg_conv;
42734         this_arg_conv.inner = untag_ptr(this_arg);
42735         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42736         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42737         this_arg_conv.is_owned = false;
42738         LDKPhantomRouteHints ret_var = ChannelManager_get_phantom_route_hints(&this_arg_conv);
42739         int64_t ret_ref = 0;
42740         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42741         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42742         return ret_ref;
42743 }
42744
42745 int64_t  CS_LDK_ChannelManager_get_intercept_scid(int64_t this_arg) {
42746         LDKChannelManager this_arg_conv;
42747         this_arg_conv.inner = untag_ptr(this_arg);
42748         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42749         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42750         this_arg_conv.is_owned = false;
42751         int64_t ret_conv = ChannelManager_get_intercept_scid(&this_arg_conv);
42752         return ret_conv;
42753 }
42754
42755 int64_t  CS_LDK_ChannelManager_compute_inflight_htlcs(int64_t this_arg) {
42756         LDKChannelManager this_arg_conv;
42757         this_arg_conv.inner = untag_ptr(this_arg);
42758         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42759         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42760         this_arg_conv.is_owned = false;
42761         LDKInFlightHtlcs ret_var = ChannelManager_compute_inflight_htlcs(&this_arg_conv);
42762         int64_t ret_ref = 0;
42763         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42764         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42765         return ret_ref;
42766 }
42767
42768 int64_t  CS_LDK_ChannelManager_as_MessageSendEventsProvider(int64_t this_arg) {
42769         LDKChannelManager this_arg_conv;
42770         this_arg_conv.inner = untag_ptr(this_arg);
42771         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42772         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42773         this_arg_conv.is_owned = false;
42774         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
42775         *ret_ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
42776         return tag_ptr(ret_ret, true);
42777 }
42778
42779 int64_t  CS_LDK_ChannelManager_as_EventsProvider(int64_t this_arg) {
42780         LDKChannelManager this_arg_conv;
42781         this_arg_conv.inner = untag_ptr(this_arg);
42782         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42783         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42784         this_arg_conv.is_owned = false;
42785         LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
42786         *ret_ret = ChannelManager_as_EventsProvider(&this_arg_conv);
42787         return tag_ptr(ret_ret, true);
42788 }
42789
42790 int64_t  CS_LDK_ChannelManager_as_Listen(int64_t this_arg) {
42791         LDKChannelManager this_arg_conv;
42792         this_arg_conv.inner = untag_ptr(this_arg);
42793         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42794         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42795         this_arg_conv.is_owned = false;
42796         LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
42797         *ret_ret = ChannelManager_as_Listen(&this_arg_conv);
42798         return tag_ptr(ret_ret, true);
42799 }
42800
42801 int64_t  CS_LDK_ChannelManager_as_Confirm(int64_t this_arg) {
42802         LDKChannelManager this_arg_conv;
42803         this_arg_conv.inner = untag_ptr(this_arg);
42804         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42805         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42806         this_arg_conv.is_owned = false;
42807         LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
42808         *ret_ret = ChannelManager_as_Confirm(&this_arg_conv);
42809         return tag_ptr(ret_ret, true);
42810 }
42811
42812 int64_t  CS_LDK_ChannelManager_get_event_or_persistence_needed_future(int64_t this_arg) {
42813         LDKChannelManager this_arg_conv;
42814         this_arg_conv.inner = untag_ptr(this_arg);
42815         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42816         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42817         this_arg_conv.is_owned = false;
42818         LDKFuture ret_var = ChannelManager_get_event_or_persistence_needed_future(&this_arg_conv);
42819         int64_t ret_ref = 0;
42820         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42821         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42822         return ret_ref;
42823 }
42824
42825 jboolean  CS_LDK_ChannelManager_get_and_clear_needs_persistence(int64_t this_arg) {
42826         LDKChannelManager this_arg_conv;
42827         this_arg_conv.inner = untag_ptr(this_arg);
42828         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42829         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42830         this_arg_conv.is_owned = false;
42831         jboolean ret_conv = ChannelManager_get_and_clear_needs_persistence(&this_arg_conv);
42832         return ret_conv;
42833 }
42834
42835 int64_t  CS_LDK_ChannelManager_current_best_block(int64_t this_arg) {
42836         LDKChannelManager this_arg_conv;
42837         this_arg_conv.inner = untag_ptr(this_arg);
42838         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42839         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42840         this_arg_conv.is_owned = false;
42841         LDKBestBlock ret_var = ChannelManager_current_best_block(&this_arg_conv);
42842         int64_t ret_ref = 0;
42843         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42844         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42845         return ret_ref;
42846 }
42847
42848 int64_t  CS_LDK_ChannelManager_node_features(int64_t this_arg) {
42849         LDKChannelManager this_arg_conv;
42850         this_arg_conv.inner = untag_ptr(this_arg);
42851         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42852         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42853         this_arg_conv.is_owned = false;
42854         LDKNodeFeatures ret_var = ChannelManager_node_features(&this_arg_conv);
42855         int64_t ret_ref = 0;
42856         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42857         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42858         return ret_ref;
42859 }
42860
42861 int64_t  CS_LDK_ChannelManager_channel_features(int64_t this_arg) {
42862         LDKChannelManager this_arg_conv;
42863         this_arg_conv.inner = untag_ptr(this_arg);
42864         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42865         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42866         this_arg_conv.is_owned = false;
42867         LDKChannelFeatures ret_var = ChannelManager_channel_features(&this_arg_conv);
42868         int64_t ret_ref = 0;
42869         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42870         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42871         return ret_ref;
42872 }
42873
42874 int64_t  CS_LDK_ChannelManager_channel_type_features(int64_t this_arg) {
42875         LDKChannelManager this_arg_conv;
42876         this_arg_conv.inner = untag_ptr(this_arg);
42877         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42878         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42879         this_arg_conv.is_owned = false;
42880         LDKChannelTypeFeatures ret_var = ChannelManager_channel_type_features(&this_arg_conv);
42881         int64_t ret_ref = 0;
42882         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42883         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42884         return ret_ref;
42885 }
42886
42887 int64_t  CS_LDK_ChannelManager_init_features(int64_t this_arg) {
42888         LDKChannelManager this_arg_conv;
42889         this_arg_conv.inner = untag_ptr(this_arg);
42890         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42891         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42892         this_arg_conv.is_owned = false;
42893         LDKInitFeatures ret_var = ChannelManager_init_features(&this_arg_conv);
42894         int64_t ret_ref = 0;
42895         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42896         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42897         return ret_ref;
42898 }
42899
42900 int64_t  CS_LDK_ChannelManager_as_ChannelMessageHandler(int64_t this_arg) {
42901         LDKChannelManager this_arg_conv;
42902         this_arg_conv.inner = untag_ptr(this_arg);
42903         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42904         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42905         this_arg_conv.is_owned = false;
42906         LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
42907         *ret_ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
42908         return tag_ptr(ret_ret, true);
42909 }
42910
42911 int64_t  CS_LDK_ChannelManager_as_OffersMessageHandler(int64_t this_arg) {
42912         LDKChannelManager this_arg_conv;
42913         this_arg_conv.inner = untag_ptr(this_arg);
42914         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42915         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42916         this_arg_conv.is_owned = false;
42917         LDKOffersMessageHandler* ret_ret = MALLOC(sizeof(LDKOffersMessageHandler), "LDKOffersMessageHandler");
42918         *ret_ret = ChannelManager_as_OffersMessageHandler(&this_arg_conv);
42919         return tag_ptr(ret_ret, true);
42920 }
42921
42922 int64_t  CS_LDK_ChannelManager_as_NodeIdLookUp(int64_t this_arg) {
42923         LDKChannelManager this_arg_conv;
42924         this_arg_conv.inner = untag_ptr(this_arg);
42925         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42926         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42927         this_arg_conv.is_owned = false;
42928         LDKNodeIdLookUp* ret_ret = MALLOC(sizeof(LDKNodeIdLookUp), "LDKNodeIdLookUp");
42929         *ret_ret = ChannelManager_as_NodeIdLookUp(&this_arg_conv);
42930         return tag_ptr(ret_ret, true);
42931 }
42932
42933 int64_t  CS_LDK_provided_init_features(int64_t config) {
42934         LDKUserConfig config_conv;
42935         config_conv.inner = untag_ptr(config);
42936         config_conv.is_owned = ptr_is_owned(config);
42937         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
42938         config_conv.is_owned = false;
42939         LDKInitFeatures ret_var = provided_init_features(&config_conv);
42940         int64_t ret_ref = 0;
42941         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42942         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42943         return ret_ref;
42944 }
42945
42946 int8_tArray  CS_LDK_PhantomRouteHints_write(int64_t obj) {
42947         LDKPhantomRouteHints obj_conv;
42948         obj_conv.inner = untag_ptr(obj);
42949         obj_conv.is_owned = ptr_is_owned(obj);
42950         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42951         obj_conv.is_owned = false;
42952         LDKCVec_u8Z ret_var = PhantomRouteHints_write(&obj_conv);
42953         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
42954         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
42955         CVec_u8Z_free(ret_var);
42956         return ret_arr;
42957 }
42958
42959 int64_t  CS_LDK_PhantomRouteHints_read(int8_tArray ser) {
42960         LDKu8slice ser_ref;
42961         ser_ref.datalen = ser->arr_len;
42962         ser_ref.data = ser->elems;
42963         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
42964         *ret_conv = PhantomRouteHints_read(ser_ref);
42965         FREE(ser);
42966         return tag_ptr(ret_conv, true);
42967 }
42968
42969 int8_tArray  CS_LDK_BlindedForward_write(int64_t obj) {
42970         LDKBlindedForward obj_conv;
42971         obj_conv.inner = untag_ptr(obj);
42972         obj_conv.is_owned = ptr_is_owned(obj);
42973         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42974         obj_conv.is_owned = false;
42975         LDKCVec_u8Z ret_var = BlindedForward_write(&obj_conv);
42976         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
42977         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
42978         CVec_u8Z_free(ret_var);
42979         return ret_arr;
42980 }
42981
42982 int64_t  CS_LDK_BlindedForward_read(int8_tArray ser) {
42983         LDKu8slice ser_ref;
42984         ser_ref.datalen = ser->arr_len;
42985         ser_ref.data = ser->elems;
42986         LDKCResult_BlindedForwardDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedForwardDecodeErrorZ), "LDKCResult_BlindedForwardDecodeErrorZ");
42987         *ret_conv = BlindedForward_read(ser_ref);
42988         FREE(ser);
42989         return tag_ptr(ret_conv, true);
42990 }
42991
42992 int8_tArray  CS_LDK_PendingHTLCRouting_write(int64_t obj) {
42993         LDKPendingHTLCRouting* obj_conv = (LDKPendingHTLCRouting*)untag_ptr(obj);
42994         LDKCVec_u8Z ret_var = PendingHTLCRouting_write(obj_conv);
42995         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
42996         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
42997         CVec_u8Z_free(ret_var);
42998         return ret_arr;
42999 }
43000
43001 int64_t  CS_LDK_PendingHTLCRouting_read(int8_tArray ser) {
43002         LDKu8slice ser_ref;
43003         ser_ref.datalen = ser->arr_len;
43004         ser_ref.data = ser->elems;
43005         LDKCResult_PendingHTLCRoutingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCRoutingDecodeErrorZ), "LDKCResult_PendingHTLCRoutingDecodeErrorZ");
43006         *ret_conv = PendingHTLCRouting_read(ser_ref);
43007         FREE(ser);
43008         return tag_ptr(ret_conv, true);
43009 }
43010
43011 int8_tArray  CS_LDK_PendingHTLCInfo_write(int64_t obj) {
43012         LDKPendingHTLCInfo obj_conv;
43013         obj_conv.inner = untag_ptr(obj);
43014         obj_conv.is_owned = ptr_is_owned(obj);
43015         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43016         obj_conv.is_owned = false;
43017         LDKCVec_u8Z ret_var = PendingHTLCInfo_write(&obj_conv);
43018         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43019         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43020         CVec_u8Z_free(ret_var);
43021         return ret_arr;
43022 }
43023
43024 int64_t  CS_LDK_PendingHTLCInfo_read(int8_tArray ser) {
43025         LDKu8slice ser_ref;
43026         ser_ref.datalen = ser->arr_len;
43027         ser_ref.data = ser->elems;
43028         LDKCResult_PendingHTLCInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoDecodeErrorZ), "LDKCResult_PendingHTLCInfoDecodeErrorZ");
43029         *ret_conv = PendingHTLCInfo_read(ser_ref);
43030         FREE(ser);
43031         return tag_ptr(ret_conv, true);
43032 }
43033
43034 int8_tArray  CS_LDK_BlindedFailure_write(int64_t obj) {
43035         LDKBlindedFailure* obj_conv = (LDKBlindedFailure*)untag_ptr(obj);
43036         LDKCVec_u8Z ret_var = BlindedFailure_write(obj_conv);
43037         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43038         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43039         CVec_u8Z_free(ret_var);
43040         return ret_arr;
43041 }
43042
43043 int64_t  CS_LDK_BlindedFailure_read(int8_tArray ser) {
43044         LDKu8slice ser_ref;
43045         ser_ref.datalen = ser->arr_len;
43046         ser_ref.data = ser->elems;
43047         LDKCResult_BlindedFailureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedFailureDecodeErrorZ), "LDKCResult_BlindedFailureDecodeErrorZ");
43048         *ret_conv = BlindedFailure_read(ser_ref);
43049         FREE(ser);
43050         return tag_ptr(ret_conv, true);
43051 }
43052
43053 int8_tArray  CS_LDK_ChannelManager_write(int64_t obj) {
43054         LDKChannelManager obj_conv;
43055         obj_conv.inner = untag_ptr(obj);
43056         obj_conv.is_owned = ptr_is_owned(obj);
43057         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43058         obj_conv.is_owned = false;
43059         LDKCVec_u8Z ret_var = ChannelManager_write(&obj_conv);
43060         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43061         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43062         CVec_u8Z_free(ret_var);
43063         return ret_arr;
43064 }
43065
43066 void  CS_LDK_ChannelManagerReadArgs_free(int64_t this_obj) {
43067         LDKChannelManagerReadArgs this_obj_conv;
43068         this_obj_conv.inner = untag_ptr(this_obj);
43069         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43070         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43071         ChannelManagerReadArgs_free(this_obj_conv);
43072 }
43073
43074 int64_t  CS_LDK_ChannelManagerReadArgs_get_entropy_source(int64_t this_ptr) {
43075         LDKChannelManagerReadArgs this_ptr_conv;
43076         this_ptr_conv.inner = untag_ptr(this_ptr);
43077         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43078         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43079         this_ptr_conv.is_owned = false;
43080         // WARNING: This object doesn't live past this scope, needs clone!
43081         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_entropy_source(&this_ptr_conv), false);
43082         return ret_ret;
43083 }
43084
43085 void  CS_LDK_ChannelManagerReadArgs_set_entropy_source(int64_t this_ptr, int64_t val) {
43086         LDKChannelManagerReadArgs this_ptr_conv;
43087         this_ptr_conv.inner = untag_ptr(this_ptr);
43088         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43089         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43090         this_ptr_conv.is_owned = false;
43091         void* val_ptr = untag_ptr(val);
43092         CHECK_ACCESS(val_ptr);
43093         LDKEntropySource val_conv = *(LDKEntropySource*)(val_ptr);
43094         if (val_conv.free == LDKEntropySource_JCalls_free) {
43095                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43096                 LDKEntropySource_JCalls_cloned(&val_conv);
43097         }
43098         ChannelManagerReadArgs_set_entropy_source(&this_ptr_conv, val_conv);
43099 }
43100
43101 int64_t  CS_LDK_ChannelManagerReadArgs_get_node_signer(int64_t this_ptr) {
43102         LDKChannelManagerReadArgs this_ptr_conv;
43103         this_ptr_conv.inner = untag_ptr(this_ptr);
43104         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43105         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43106         this_ptr_conv.is_owned = false;
43107         // WARNING: This object doesn't live past this scope, needs clone!
43108         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_node_signer(&this_ptr_conv), false);
43109         return ret_ret;
43110 }
43111
43112 void  CS_LDK_ChannelManagerReadArgs_set_node_signer(int64_t this_ptr, int64_t val) {
43113         LDKChannelManagerReadArgs this_ptr_conv;
43114         this_ptr_conv.inner = untag_ptr(this_ptr);
43115         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43116         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43117         this_ptr_conv.is_owned = false;
43118         void* val_ptr = untag_ptr(val);
43119         CHECK_ACCESS(val_ptr);
43120         LDKNodeSigner val_conv = *(LDKNodeSigner*)(val_ptr);
43121         if (val_conv.free == LDKNodeSigner_JCalls_free) {
43122                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43123                 LDKNodeSigner_JCalls_cloned(&val_conv);
43124         }
43125         ChannelManagerReadArgs_set_node_signer(&this_ptr_conv, val_conv);
43126 }
43127
43128 int64_t  CS_LDK_ChannelManagerReadArgs_get_signer_provider(int64_t this_ptr) {
43129         LDKChannelManagerReadArgs this_ptr_conv;
43130         this_ptr_conv.inner = untag_ptr(this_ptr);
43131         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43132         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43133         this_ptr_conv.is_owned = false;
43134         // WARNING: This object doesn't live past this scope, needs clone!
43135         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_signer_provider(&this_ptr_conv), false);
43136         return ret_ret;
43137 }
43138
43139 void  CS_LDK_ChannelManagerReadArgs_set_signer_provider(int64_t this_ptr, int64_t val) {
43140         LDKChannelManagerReadArgs this_ptr_conv;
43141         this_ptr_conv.inner = untag_ptr(this_ptr);
43142         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43143         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43144         this_ptr_conv.is_owned = false;
43145         void* val_ptr = untag_ptr(val);
43146         CHECK_ACCESS(val_ptr);
43147         LDKSignerProvider val_conv = *(LDKSignerProvider*)(val_ptr);
43148         if (val_conv.free == LDKSignerProvider_JCalls_free) {
43149                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43150                 LDKSignerProvider_JCalls_cloned(&val_conv);
43151         }
43152         ChannelManagerReadArgs_set_signer_provider(&this_ptr_conv, val_conv);
43153 }
43154
43155 int64_t  CS_LDK_ChannelManagerReadArgs_get_fee_estimator(int64_t this_ptr) {
43156         LDKChannelManagerReadArgs this_ptr_conv;
43157         this_ptr_conv.inner = untag_ptr(this_ptr);
43158         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43159         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43160         this_ptr_conv.is_owned = false;
43161         // WARNING: This object doesn't live past this scope, needs clone!
43162         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv), false);
43163         return ret_ret;
43164 }
43165
43166 void  CS_LDK_ChannelManagerReadArgs_set_fee_estimator(int64_t this_ptr, int64_t val) {
43167         LDKChannelManagerReadArgs this_ptr_conv;
43168         this_ptr_conv.inner = untag_ptr(this_ptr);
43169         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43170         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43171         this_ptr_conv.is_owned = false;
43172         void* val_ptr = untag_ptr(val);
43173         CHECK_ACCESS(val_ptr);
43174         LDKFeeEstimator val_conv = *(LDKFeeEstimator*)(val_ptr);
43175         if (val_conv.free == LDKFeeEstimator_JCalls_free) {
43176                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43177                 LDKFeeEstimator_JCalls_cloned(&val_conv);
43178         }
43179         ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
43180 }
43181
43182 int64_t  CS_LDK_ChannelManagerReadArgs_get_chain_monitor(int64_t this_ptr) {
43183         LDKChannelManagerReadArgs this_ptr_conv;
43184         this_ptr_conv.inner = untag_ptr(this_ptr);
43185         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43186         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43187         this_ptr_conv.is_owned = false;
43188         // WARNING: This object doesn't live past this scope, needs clone!
43189         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv), false);
43190         return ret_ret;
43191 }
43192
43193 void  CS_LDK_ChannelManagerReadArgs_set_chain_monitor(int64_t this_ptr, int64_t val) {
43194         LDKChannelManagerReadArgs this_ptr_conv;
43195         this_ptr_conv.inner = untag_ptr(this_ptr);
43196         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43197         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43198         this_ptr_conv.is_owned = false;
43199         void* val_ptr = untag_ptr(val);
43200         CHECK_ACCESS(val_ptr);
43201         LDKWatch val_conv = *(LDKWatch*)(val_ptr);
43202         if (val_conv.free == LDKWatch_JCalls_free) {
43203                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43204                 LDKWatch_JCalls_cloned(&val_conv);
43205         }
43206         ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
43207 }
43208
43209 int64_t  CS_LDK_ChannelManagerReadArgs_get_tx_broadcaster(int64_t this_ptr) {
43210         LDKChannelManagerReadArgs this_ptr_conv;
43211         this_ptr_conv.inner = untag_ptr(this_ptr);
43212         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43213         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43214         this_ptr_conv.is_owned = false;
43215         // WARNING: This object doesn't live past this scope, needs clone!
43216         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv), false);
43217         return ret_ret;
43218 }
43219
43220 void  CS_LDK_ChannelManagerReadArgs_set_tx_broadcaster(int64_t this_ptr, int64_t val) {
43221         LDKChannelManagerReadArgs this_ptr_conv;
43222         this_ptr_conv.inner = untag_ptr(this_ptr);
43223         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43224         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43225         this_ptr_conv.is_owned = false;
43226         void* val_ptr = untag_ptr(val);
43227         CHECK_ACCESS(val_ptr);
43228         LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)(val_ptr);
43229         if (val_conv.free == LDKBroadcasterInterface_JCalls_free) {
43230                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43231                 LDKBroadcasterInterface_JCalls_cloned(&val_conv);
43232         }
43233         ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
43234 }
43235
43236 int64_t  CS_LDK_ChannelManagerReadArgs_get_router(int64_t this_ptr) {
43237         LDKChannelManagerReadArgs 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         // WARNING: This object doesn't live past this scope, needs clone!
43243         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_router(&this_ptr_conv), false);
43244         return ret_ret;
43245 }
43246
43247 void  CS_LDK_ChannelManagerReadArgs_set_router(int64_t this_ptr, int64_t val) {
43248         LDKChannelManagerReadArgs this_ptr_conv;
43249         this_ptr_conv.inner = untag_ptr(this_ptr);
43250         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43251         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43252         this_ptr_conv.is_owned = false;
43253         void* val_ptr = untag_ptr(val);
43254         CHECK_ACCESS(val_ptr);
43255         LDKRouter val_conv = *(LDKRouter*)(val_ptr);
43256         if (val_conv.free == LDKRouter_JCalls_free) {
43257                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43258                 LDKRouter_JCalls_cloned(&val_conv);
43259         }
43260         ChannelManagerReadArgs_set_router(&this_ptr_conv, val_conv);
43261 }
43262
43263 int64_t  CS_LDK_ChannelManagerReadArgs_get_logger(int64_t this_ptr) {
43264         LDKChannelManagerReadArgs this_ptr_conv;
43265         this_ptr_conv.inner = untag_ptr(this_ptr);
43266         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43267         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43268         this_ptr_conv.is_owned = false;
43269         // WARNING: This object doesn't live past this scope, needs clone!
43270         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_logger(&this_ptr_conv), false);
43271         return ret_ret;
43272 }
43273
43274 void  CS_LDK_ChannelManagerReadArgs_set_logger(int64_t this_ptr, int64_t val) {
43275         LDKChannelManagerReadArgs 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         void* val_ptr = untag_ptr(val);
43281         CHECK_ACCESS(val_ptr);
43282         LDKLogger val_conv = *(LDKLogger*)(val_ptr);
43283         if (val_conv.free == LDKLogger_JCalls_free) {
43284                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43285                 LDKLogger_JCalls_cloned(&val_conv);
43286         }
43287         ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
43288 }
43289
43290 int64_t  CS_LDK_ChannelManagerReadArgs_get_default_config(int64_t this_ptr) {
43291         LDKChannelManagerReadArgs this_ptr_conv;
43292         this_ptr_conv.inner = untag_ptr(this_ptr);
43293         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43294         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43295         this_ptr_conv.is_owned = false;
43296         LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
43297         int64_t ret_ref = 0;
43298         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43299         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43300         return ret_ref;
43301 }
43302
43303 void  CS_LDK_ChannelManagerReadArgs_set_default_config(int64_t this_ptr, int64_t val) {
43304         LDKChannelManagerReadArgs this_ptr_conv;
43305         this_ptr_conv.inner = untag_ptr(this_ptr);
43306         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43307         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43308         this_ptr_conv.is_owned = false;
43309         LDKUserConfig val_conv;
43310         val_conv.inner = untag_ptr(val);
43311         val_conv.is_owned = ptr_is_owned(val);
43312         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43313         val_conv = UserConfig_clone(&val_conv);
43314         ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
43315 }
43316
43317 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) {
43318         void* entropy_source_ptr = untag_ptr(entropy_source);
43319         CHECK_ACCESS(entropy_source_ptr);
43320         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
43321         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
43322                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43323                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
43324         }
43325         void* node_signer_ptr = untag_ptr(node_signer);
43326         CHECK_ACCESS(node_signer_ptr);
43327         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
43328         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
43329                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43330                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
43331         }
43332         void* signer_provider_ptr = untag_ptr(signer_provider);
43333         CHECK_ACCESS(signer_provider_ptr);
43334         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
43335         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
43336                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43337                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
43338         }
43339         void* fee_estimator_ptr = untag_ptr(fee_estimator);
43340         CHECK_ACCESS(fee_estimator_ptr);
43341         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
43342         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
43343                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43344                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
43345         }
43346         void* chain_monitor_ptr = untag_ptr(chain_monitor);
43347         CHECK_ACCESS(chain_monitor_ptr);
43348         LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
43349         if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
43350                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43351                 LDKWatch_JCalls_cloned(&chain_monitor_conv);
43352         }
43353         void* tx_broadcaster_ptr = untag_ptr(tx_broadcaster);
43354         CHECK_ACCESS(tx_broadcaster_ptr);
43355         LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
43356         if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
43357                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43358                 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
43359         }
43360         void* router_ptr = untag_ptr(router);
43361         CHECK_ACCESS(router_ptr);
43362         LDKRouter router_conv = *(LDKRouter*)(router_ptr);
43363         if (router_conv.free == LDKRouter_JCalls_free) {
43364                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43365                 LDKRouter_JCalls_cloned(&router_conv);
43366         }
43367         void* logger_ptr = untag_ptr(logger);
43368         CHECK_ACCESS(logger_ptr);
43369         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
43370         if (logger_conv.free == LDKLogger_JCalls_free) {
43371                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43372                 LDKLogger_JCalls_cloned(&logger_conv);
43373         }
43374         LDKUserConfig default_config_conv;
43375         default_config_conv.inner = untag_ptr(default_config);
43376         default_config_conv.is_owned = ptr_is_owned(default_config);
43377         CHECK_INNER_FIELD_ACCESS_OR_NULL(default_config_conv);
43378         default_config_conv = UserConfig_clone(&default_config_conv);
43379         LDKCVec_ChannelMonitorZ channel_monitors_constr;
43380         channel_monitors_constr.datalen = channel_monitors->arr_len;
43381         if (channel_monitors_constr.datalen > 0)
43382                 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
43383         else
43384                 channel_monitors_constr.data = NULL;
43385         int64_t* channel_monitors_vals = channel_monitors->elems;
43386         for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
43387                 int64_t channel_monitors_conv_16 = channel_monitors_vals[q];
43388                 LDKChannelMonitor channel_monitors_conv_16_conv;
43389                 channel_monitors_conv_16_conv.inner = untag_ptr(channel_monitors_conv_16);
43390                 channel_monitors_conv_16_conv.is_owned = ptr_is_owned(channel_monitors_conv_16);
43391                 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_monitors_conv_16_conv);
43392                 channel_monitors_conv_16_conv.is_owned = false;
43393                 channel_monitors_constr.data[q] = channel_monitors_conv_16_conv;
43394         }
43395         FREE(channel_monitors);
43396         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);
43397         int64_t ret_ref = 0;
43398         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43399         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43400         return ret_ref;
43401 }
43402
43403 int64_t  CS_LDK_C2Tuple_ThirtyTwoBytesChannelManagerZ_read(int8_tArray ser, int64_t arg) {
43404         LDKu8slice ser_ref;
43405         ser_ref.datalen = ser->arr_len;
43406         ser_ref.data = ser->elems;
43407         LDKChannelManagerReadArgs arg_conv;
43408         arg_conv.inner = untag_ptr(arg);
43409         arg_conv.is_owned = ptr_is_owned(arg);
43410         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43411         // WARNING: we need a move here but no clone is available for LDKChannelManagerReadArgs
43412         
43413         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ");
43414         *ret_conv = C2Tuple_ThirtyTwoBytesChannelManagerZ_read(ser_ref, arg_conv);
43415         FREE(ser);
43416         return tag_ptr(ret_conv, true);
43417 }
43418
43419 void  CS_LDK_DelayedPaymentBasepoint_free(int64_t this_obj) {
43420         LDKDelayedPaymentBasepoint this_obj_conv;
43421         this_obj_conv.inner = untag_ptr(this_obj);
43422         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43423         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43424         DelayedPaymentBasepoint_free(this_obj_conv);
43425 }
43426
43427 int8_tArray  CS_LDK_DelayedPaymentBasepoint_get_a(int64_t this_ptr) {
43428         LDKDelayedPaymentBasepoint this_ptr_conv;
43429         this_ptr_conv.inner = untag_ptr(this_ptr);
43430         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43431         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43432         this_ptr_conv.is_owned = false;
43433         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
43434         memcpy(ret_arr->elems, DelayedPaymentBasepoint_get_a(&this_ptr_conv).compressed_form, 33);
43435         return ret_arr;
43436 }
43437
43438 void  CS_LDK_DelayedPaymentBasepoint_set_a(int64_t this_ptr, int8_tArray val) {
43439         LDKDelayedPaymentBasepoint this_ptr_conv;
43440         this_ptr_conv.inner = untag_ptr(this_ptr);
43441         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43442         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43443         this_ptr_conv.is_owned = false;
43444         LDKPublicKey val_ref;
43445         CHECK(val->arr_len == 33);
43446         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
43447         DelayedPaymentBasepoint_set_a(&this_ptr_conv, val_ref);
43448 }
43449
43450 int64_t  CS_LDK_DelayedPaymentBasepoint_new(int8_tArray a_arg) {
43451         LDKPublicKey a_arg_ref;
43452         CHECK(a_arg->arr_len == 33);
43453         memcpy(a_arg_ref.compressed_form, a_arg->elems, 33); FREE(a_arg);
43454         LDKDelayedPaymentBasepoint ret_var = DelayedPaymentBasepoint_new(a_arg_ref);
43455         int64_t ret_ref = 0;
43456         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43457         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43458         return ret_ref;
43459 }
43460
43461 jboolean  CS_LDK_DelayedPaymentBasepoint_eq(int64_t a, int64_t b) {
43462         LDKDelayedPaymentBasepoint a_conv;
43463         a_conv.inner = untag_ptr(a);
43464         a_conv.is_owned = ptr_is_owned(a);
43465         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43466         a_conv.is_owned = false;
43467         LDKDelayedPaymentBasepoint b_conv;
43468         b_conv.inner = untag_ptr(b);
43469         b_conv.is_owned = ptr_is_owned(b);
43470         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43471         b_conv.is_owned = false;
43472         jboolean ret_conv = DelayedPaymentBasepoint_eq(&a_conv, &b_conv);
43473         return ret_conv;
43474 }
43475
43476 static inline uint64_t DelayedPaymentBasepoint_clone_ptr(LDKDelayedPaymentBasepoint *NONNULL_PTR arg) {
43477         LDKDelayedPaymentBasepoint ret_var = DelayedPaymentBasepoint_clone(arg);
43478         int64_t ret_ref = 0;
43479         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43480         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43481         return ret_ref;
43482 }
43483 int64_t  CS_LDK_DelayedPaymentBasepoint_clone_ptr(int64_t arg) {
43484         LDKDelayedPaymentBasepoint arg_conv;
43485         arg_conv.inner = untag_ptr(arg);
43486         arg_conv.is_owned = ptr_is_owned(arg);
43487         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43488         arg_conv.is_owned = false;
43489         int64_t ret_conv = DelayedPaymentBasepoint_clone_ptr(&arg_conv);
43490         return ret_conv;
43491 }
43492
43493 int64_t  CS_LDK_DelayedPaymentBasepoint_clone(int64_t orig) {
43494         LDKDelayedPaymentBasepoint orig_conv;
43495         orig_conv.inner = untag_ptr(orig);
43496         orig_conv.is_owned = ptr_is_owned(orig);
43497         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43498         orig_conv.is_owned = false;
43499         LDKDelayedPaymentBasepoint ret_var = DelayedPaymentBasepoint_clone(&orig_conv);
43500         int64_t ret_ref = 0;
43501         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43502         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43503         return ret_ref;
43504 }
43505
43506 int64_t  CS_LDK_DelayedPaymentBasepoint_hash(int64_t o) {
43507         LDKDelayedPaymentBasepoint o_conv;
43508         o_conv.inner = untag_ptr(o);
43509         o_conv.is_owned = ptr_is_owned(o);
43510         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
43511         o_conv.is_owned = false;
43512         int64_t ret_conv = DelayedPaymentBasepoint_hash(&o_conv);
43513         return ret_conv;
43514 }
43515
43516 int8_tArray  CS_LDK_DelayedPaymentBasepoint_to_public_key(int64_t this_arg) {
43517         LDKDelayedPaymentBasepoint this_arg_conv;
43518         this_arg_conv.inner = untag_ptr(this_arg);
43519         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43520         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43521         this_arg_conv.is_owned = false;
43522         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
43523         memcpy(ret_arr->elems, DelayedPaymentBasepoint_to_public_key(&this_arg_conv).compressed_form, 33);
43524         return ret_arr;
43525 }
43526
43527 int8_tArray  CS_LDK_DelayedPaymentBasepoint_derive_add_tweak(int64_t this_arg, int8_tArray per_commitment_point) {
43528         LDKDelayedPaymentBasepoint this_arg_conv;
43529         this_arg_conv.inner = untag_ptr(this_arg);
43530         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43531         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43532         this_arg_conv.is_owned = false;
43533         LDKPublicKey per_commitment_point_ref;
43534         CHECK(per_commitment_point->arr_len == 33);
43535         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
43536         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
43537         memcpy(ret_arr->elems, DelayedPaymentBasepoint_derive_add_tweak(&this_arg_conv, per_commitment_point_ref).data, 32);
43538         return ret_arr;
43539 }
43540
43541 int8_tArray  CS_LDK_DelayedPaymentBasepoint_write(int64_t obj) {
43542         LDKDelayedPaymentBasepoint obj_conv;
43543         obj_conv.inner = untag_ptr(obj);
43544         obj_conv.is_owned = ptr_is_owned(obj);
43545         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43546         obj_conv.is_owned = false;
43547         LDKCVec_u8Z ret_var = DelayedPaymentBasepoint_write(&obj_conv);
43548         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43549         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43550         CVec_u8Z_free(ret_var);
43551         return ret_arr;
43552 }
43553
43554 int64_t  CS_LDK_DelayedPaymentBasepoint_read(int8_tArray ser) {
43555         LDKu8slice ser_ref;
43556         ser_ref.datalen = ser->arr_len;
43557         ser_ref.data = ser->elems;
43558         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentBasepointDecodeErrorZ), "LDKCResult_DelayedPaymentBasepointDecodeErrorZ");
43559         *ret_conv = DelayedPaymentBasepoint_read(ser_ref);
43560         FREE(ser);
43561         return tag_ptr(ret_conv, true);
43562 }
43563
43564 void  CS_LDK_DelayedPaymentKey_free(int64_t this_obj) {
43565         LDKDelayedPaymentKey this_obj_conv;
43566         this_obj_conv.inner = untag_ptr(this_obj);
43567         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43568         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43569         DelayedPaymentKey_free(this_obj_conv);
43570 }
43571
43572 int8_tArray  CS_LDK_DelayedPaymentKey_get_a(int64_t this_ptr) {
43573         LDKDelayedPaymentKey this_ptr_conv;
43574         this_ptr_conv.inner = untag_ptr(this_ptr);
43575         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43576         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43577         this_ptr_conv.is_owned = false;
43578         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
43579         memcpy(ret_arr->elems, DelayedPaymentKey_get_a(&this_ptr_conv).compressed_form, 33);
43580         return ret_arr;
43581 }
43582
43583 void  CS_LDK_DelayedPaymentKey_set_a(int64_t this_ptr, int8_tArray val) {
43584         LDKDelayedPaymentKey this_ptr_conv;
43585         this_ptr_conv.inner = untag_ptr(this_ptr);
43586         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43587         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43588         this_ptr_conv.is_owned = false;
43589         LDKPublicKey val_ref;
43590         CHECK(val->arr_len == 33);
43591         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
43592         DelayedPaymentKey_set_a(&this_ptr_conv, val_ref);
43593 }
43594
43595 int64_t  CS_LDK_DelayedPaymentKey_new(int8_tArray a_arg) {
43596         LDKPublicKey a_arg_ref;
43597         CHECK(a_arg->arr_len == 33);
43598         memcpy(a_arg_ref.compressed_form, a_arg->elems, 33); FREE(a_arg);
43599         LDKDelayedPaymentKey ret_var = DelayedPaymentKey_new(a_arg_ref);
43600         int64_t ret_ref = 0;
43601         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43602         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43603         return ret_ref;
43604 }
43605
43606 jboolean  CS_LDK_DelayedPaymentKey_eq(int64_t a, int64_t b) {
43607         LDKDelayedPaymentKey a_conv;
43608         a_conv.inner = untag_ptr(a);
43609         a_conv.is_owned = ptr_is_owned(a);
43610         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43611         a_conv.is_owned = false;
43612         LDKDelayedPaymentKey b_conv;
43613         b_conv.inner = untag_ptr(b);
43614         b_conv.is_owned = ptr_is_owned(b);
43615         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43616         b_conv.is_owned = false;
43617         jboolean ret_conv = DelayedPaymentKey_eq(&a_conv, &b_conv);
43618         return ret_conv;
43619 }
43620
43621 static inline uint64_t DelayedPaymentKey_clone_ptr(LDKDelayedPaymentKey *NONNULL_PTR arg) {
43622         LDKDelayedPaymentKey ret_var = DelayedPaymentKey_clone(arg);
43623         int64_t ret_ref = 0;
43624         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43625         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43626         return ret_ref;
43627 }
43628 int64_t  CS_LDK_DelayedPaymentKey_clone_ptr(int64_t arg) {
43629         LDKDelayedPaymentKey arg_conv;
43630         arg_conv.inner = untag_ptr(arg);
43631         arg_conv.is_owned = ptr_is_owned(arg);
43632         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43633         arg_conv.is_owned = false;
43634         int64_t ret_conv = DelayedPaymentKey_clone_ptr(&arg_conv);
43635         return ret_conv;
43636 }
43637
43638 int64_t  CS_LDK_DelayedPaymentKey_clone(int64_t orig) {
43639         LDKDelayedPaymentKey orig_conv;
43640         orig_conv.inner = untag_ptr(orig);
43641         orig_conv.is_owned = ptr_is_owned(orig);
43642         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43643         orig_conv.is_owned = false;
43644         LDKDelayedPaymentKey ret_var = DelayedPaymentKey_clone(&orig_conv);
43645         int64_t ret_ref = 0;
43646         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43647         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43648         return ret_ref;
43649 }
43650
43651 int64_t  CS_LDK_DelayedPaymentKey_from_basepoint(int64_t countersignatory_basepoint, int8_tArray per_commitment_point) {
43652         LDKDelayedPaymentBasepoint countersignatory_basepoint_conv;
43653         countersignatory_basepoint_conv.inner = untag_ptr(countersignatory_basepoint);
43654         countersignatory_basepoint_conv.is_owned = ptr_is_owned(countersignatory_basepoint);
43655         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_basepoint_conv);
43656         countersignatory_basepoint_conv.is_owned = false;
43657         LDKPublicKey per_commitment_point_ref;
43658         CHECK(per_commitment_point->arr_len == 33);
43659         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
43660         LDKDelayedPaymentKey ret_var = DelayedPaymentKey_from_basepoint(&countersignatory_basepoint_conv, per_commitment_point_ref);
43661         int64_t ret_ref = 0;
43662         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43663         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43664         return ret_ref;
43665 }
43666
43667 int64_t  CS_LDK_DelayedPaymentKey_from_secret_key(int8_tArray sk) {
43668         uint8_t sk_arr[32];
43669         CHECK(sk->arr_len == 32);
43670         memcpy(sk_arr, sk->elems, 32); FREE(sk);
43671         uint8_t (*sk_ref)[32] = &sk_arr;
43672         LDKDelayedPaymentKey ret_var = DelayedPaymentKey_from_secret_key(sk_ref);
43673         int64_t ret_ref = 0;
43674         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43675         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43676         return ret_ref;
43677 }
43678
43679 int8_tArray  CS_LDK_DelayedPaymentKey_to_public_key(int64_t this_arg) {
43680         LDKDelayedPaymentKey this_arg_conv;
43681         this_arg_conv.inner = untag_ptr(this_arg);
43682         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43683         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43684         this_arg_conv.is_owned = false;
43685         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
43686         memcpy(ret_arr->elems, DelayedPaymentKey_to_public_key(&this_arg_conv).compressed_form, 33);
43687         return ret_arr;
43688 }
43689
43690 int8_tArray  CS_LDK_DelayedPaymentKey_write(int64_t obj) {
43691         LDKDelayedPaymentKey obj_conv;
43692         obj_conv.inner = untag_ptr(obj);
43693         obj_conv.is_owned = ptr_is_owned(obj);
43694         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43695         obj_conv.is_owned = false;
43696         LDKCVec_u8Z ret_var = DelayedPaymentKey_write(&obj_conv);
43697         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43698         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43699         CVec_u8Z_free(ret_var);
43700         return ret_arr;
43701 }
43702
43703 int64_t  CS_LDK_DelayedPaymentKey_read(int8_tArray ser) {
43704         LDKu8slice ser_ref;
43705         ser_ref.datalen = ser->arr_len;
43706         ser_ref.data = ser->elems;
43707         LDKCResult_DelayedPaymentKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentKeyDecodeErrorZ), "LDKCResult_DelayedPaymentKeyDecodeErrorZ");
43708         *ret_conv = DelayedPaymentKey_read(ser_ref);
43709         FREE(ser);
43710         return tag_ptr(ret_conv, true);
43711 }
43712
43713 void  CS_LDK_HtlcBasepoint_free(int64_t this_obj) {
43714         LDKHtlcBasepoint this_obj_conv;
43715         this_obj_conv.inner = untag_ptr(this_obj);
43716         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43717         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43718         HtlcBasepoint_free(this_obj_conv);
43719 }
43720
43721 int8_tArray  CS_LDK_HtlcBasepoint_get_a(int64_t this_ptr) {
43722         LDKHtlcBasepoint this_ptr_conv;
43723         this_ptr_conv.inner = untag_ptr(this_ptr);
43724         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43725         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43726         this_ptr_conv.is_owned = false;
43727         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
43728         memcpy(ret_arr->elems, HtlcBasepoint_get_a(&this_ptr_conv).compressed_form, 33);
43729         return ret_arr;
43730 }
43731
43732 void  CS_LDK_HtlcBasepoint_set_a(int64_t this_ptr, int8_tArray val) {
43733         LDKHtlcBasepoint this_ptr_conv;
43734         this_ptr_conv.inner = untag_ptr(this_ptr);
43735         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43736         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43737         this_ptr_conv.is_owned = false;
43738         LDKPublicKey val_ref;
43739         CHECK(val->arr_len == 33);
43740         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
43741         HtlcBasepoint_set_a(&this_ptr_conv, val_ref);
43742 }
43743
43744 int64_t  CS_LDK_HtlcBasepoint_new(int8_tArray a_arg) {
43745         LDKPublicKey a_arg_ref;
43746         CHECK(a_arg->arr_len == 33);
43747         memcpy(a_arg_ref.compressed_form, a_arg->elems, 33); FREE(a_arg);
43748         LDKHtlcBasepoint ret_var = HtlcBasepoint_new(a_arg_ref);
43749         int64_t ret_ref = 0;
43750         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43751         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43752         return ret_ref;
43753 }
43754
43755 jboolean  CS_LDK_HtlcBasepoint_eq(int64_t a, int64_t b) {
43756         LDKHtlcBasepoint a_conv;
43757         a_conv.inner = untag_ptr(a);
43758         a_conv.is_owned = ptr_is_owned(a);
43759         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43760         a_conv.is_owned = false;
43761         LDKHtlcBasepoint b_conv;
43762         b_conv.inner = untag_ptr(b);
43763         b_conv.is_owned = ptr_is_owned(b);
43764         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43765         b_conv.is_owned = false;
43766         jboolean ret_conv = HtlcBasepoint_eq(&a_conv, &b_conv);
43767         return ret_conv;
43768 }
43769
43770 static inline uint64_t HtlcBasepoint_clone_ptr(LDKHtlcBasepoint *NONNULL_PTR arg) {
43771         LDKHtlcBasepoint ret_var = HtlcBasepoint_clone(arg);
43772         int64_t ret_ref = 0;
43773         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43774         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43775         return ret_ref;
43776 }
43777 int64_t  CS_LDK_HtlcBasepoint_clone_ptr(int64_t arg) {
43778         LDKHtlcBasepoint arg_conv;
43779         arg_conv.inner = untag_ptr(arg);
43780         arg_conv.is_owned = ptr_is_owned(arg);
43781         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43782         arg_conv.is_owned = false;
43783         int64_t ret_conv = HtlcBasepoint_clone_ptr(&arg_conv);
43784         return ret_conv;
43785 }
43786
43787 int64_t  CS_LDK_HtlcBasepoint_clone(int64_t orig) {
43788         LDKHtlcBasepoint orig_conv;
43789         orig_conv.inner = untag_ptr(orig);
43790         orig_conv.is_owned = ptr_is_owned(orig);
43791         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43792         orig_conv.is_owned = false;
43793         LDKHtlcBasepoint ret_var = HtlcBasepoint_clone(&orig_conv);
43794         int64_t ret_ref = 0;
43795         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43796         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43797         return ret_ref;
43798 }
43799
43800 int64_t  CS_LDK_HtlcBasepoint_hash(int64_t o) {
43801         LDKHtlcBasepoint o_conv;
43802         o_conv.inner = untag_ptr(o);
43803         o_conv.is_owned = ptr_is_owned(o);
43804         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
43805         o_conv.is_owned = false;
43806         int64_t ret_conv = HtlcBasepoint_hash(&o_conv);
43807         return ret_conv;
43808 }
43809
43810 int8_tArray  CS_LDK_HtlcBasepoint_to_public_key(int64_t this_arg) {
43811         LDKHtlcBasepoint this_arg_conv;
43812         this_arg_conv.inner = untag_ptr(this_arg);
43813         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43814         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43815         this_arg_conv.is_owned = false;
43816         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
43817         memcpy(ret_arr->elems, HtlcBasepoint_to_public_key(&this_arg_conv).compressed_form, 33);
43818         return ret_arr;
43819 }
43820
43821 int8_tArray  CS_LDK_HtlcBasepoint_derive_add_tweak(int64_t this_arg, int8_tArray per_commitment_point) {
43822         LDKHtlcBasepoint this_arg_conv;
43823         this_arg_conv.inner = untag_ptr(this_arg);
43824         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43825         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43826         this_arg_conv.is_owned = false;
43827         LDKPublicKey per_commitment_point_ref;
43828         CHECK(per_commitment_point->arr_len == 33);
43829         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
43830         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
43831         memcpy(ret_arr->elems, HtlcBasepoint_derive_add_tweak(&this_arg_conv, per_commitment_point_ref).data, 32);
43832         return ret_arr;
43833 }
43834
43835 int8_tArray  CS_LDK_HtlcBasepoint_write(int64_t obj) {
43836         LDKHtlcBasepoint obj_conv;
43837         obj_conv.inner = untag_ptr(obj);
43838         obj_conv.is_owned = ptr_is_owned(obj);
43839         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43840         obj_conv.is_owned = false;
43841         LDKCVec_u8Z ret_var = HtlcBasepoint_write(&obj_conv);
43842         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43843         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43844         CVec_u8Z_free(ret_var);
43845         return ret_arr;
43846 }
43847
43848 int64_t  CS_LDK_HtlcBasepoint_read(int8_tArray ser) {
43849         LDKu8slice ser_ref;
43850         ser_ref.datalen = ser->arr_len;
43851         ser_ref.data = ser->elems;
43852         LDKCResult_HtlcBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcBasepointDecodeErrorZ), "LDKCResult_HtlcBasepointDecodeErrorZ");
43853         *ret_conv = HtlcBasepoint_read(ser_ref);
43854         FREE(ser);
43855         return tag_ptr(ret_conv, true);
43856 }
43857
43858 void  CS_LDK_HtlcKey_free(int64_t this_obj) {
43859         LDKHtlcKey this_obj_conv;
43860         this_obj_conv.inner = untag_ptr(this_obj);
43861         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43862         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43863         HtlcKey_free(this_obj_conv);
43864 }
43865
43866 int8_tArray  CS_LDK_HtlcKey_get_a(int64_t this_ptr) {
43867         LDKHtlcKey this_ptr_conv;
43868         this_ptr_conv.inner = untag_ptr(this_ptr);
43869         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43870         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43871         this_ptr_conv.is_owned = false;
43872         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
43873         memcpy(ret_arr->elems, HtlcKey_get_a(&this_ptr_conv).compressed_form, 33);
43874         return ret_arr;
43875 }
43876
43877 void  CS_LDK_HtlcKey_set_a(int64_t this_ptr, int8_tArray val) {
43878         LDKHtlcKey this_ptr_conv;
43879         this_ptr_conv.inner = untag_ptr(this_ptr);
43880         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43881         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43882         this_ptr_conv.is_owned = false;
43883         LDKPublicKey val_ref;
43884         CHECK(val->arr_len == 33);
43885         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
43886         HtlcKey_set_a(&this_ptr_conv, val_ref);
43887 }
43888
43889 int64_t  CS_LDK_HtlcKey_new(int8_tArray a_arg) {
43890         LDKPublicKey a_arg_ref;
43891         CHECK(a_arg->arr_len == 33);
43892         memcpy(a_arg_ref.compressed_form, a_arg->elems, 33); FREE(a_arg);
43893         LDKHtlcKey ret_var = HtlcKey_new(a_arg_ref);
43894         int64_t ret_ref = 0;
43895         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43896         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43897         return ret_ref;
43898 }
43899
43900 jboolean  CS_LDK_HtlcKey_eq(int64_t a, int64_t b) {
43901         LDKHtlcKey a_conv;
43902         a_conv.inner = untag_ptr(a);
43903         a_conv.is_owned = ptr_is_owned(a);
43904         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43905         a_conv.is_owned = false;
43906         LDKHtlcKey b_conv;
43907         b_conv.inner = untag_ptr(b);
43908         b_conv.is_owned = ptr_is_owned(b);
43909         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43910         b_conv.is_owned = false;
43911         jboolean ret_conv = HtlcKey_eq(&a_conv, &b_conv);
43912         return ret_conv;
43913 }
43914
43915 static inline uint64_t HtlcKey_clone_ptr(LDKHtlcKey *NONNULL_PTR arg) {
43916         LDKHtlcKey ret_var = HtlcKey_clone(arg);
43917         int64_t ret_ref = 0;
43918         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43919         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43920         return ret_ref;
43921 }
43922 int64_t  CS_LDK_HtlcKey_clone_ptr(int64_t arg) {
43923         LDKHtlcKey arg_conv;
43924         arg_conv.inner = untag_ptr(arg);
43925         arg_conv.is_owned = ptr_is_owned(arg);
43926         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43927         arg_conv.is_owned = false;
43928         int64_t ret_conv = HtlcKey_clone_ptr(&arg_conv);
43929         return ret_conv;
43930 }
43931
43932 int64_t  CS_LDK_HtlcKey_clone(int64_t orig) {
43933         LDKHtlcKey orig_conv;
43934         orig_conv.inner = untag_ptr(orig);
43935         orig_conv.is_owned = ptr_is_owned(orig);
43936         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43937         orig_conv.is_owned = false;
43938         LDKHtlcKey ret_var = HtlcKey_clone(&orig_conv);
43939         int64_t ret_ref = 0;
43940         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43941         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43942         return ret_ref;
43943 }
43944
43945 int64_t  CS_LDK_HtlcKey_from_basepoint(int64_t countersignatory_basepoint, int8_tArray per_commitment_point) {
43946         LDKHtlcBasepoint countersignatory_basepoint_conv;
43947         countersignatory_basepoint_conv.inner = untag_ptr(countersignatory_basepoint);
43948         countersignatory_basepoint_conv.is_owned = ptr_is_owned(countersignatory_basepoint);
43949         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_basepoint_conv);
43950         countersignatory_basepoint_conv.is_owned = false;
43951         LDKPublicKey per_commitment_point_ref;
43952         CHECK(per_commitment_point->arr_len == 33);
43953         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
43954         LDKHtlcKey ret_var = HtlcKey_from_basepoint(&countersignatory_basepoint_conv, per_commitment_point_ref);
43955         int64_t ret_ref = 0;
43956         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43957         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43958         return ret_ref;
43959 }
43960
43961 int64_t  CS_LDK_HtlcKey_from_secret_key(int8_tArray sk) {
43962         uint8_t sk_arr[32];
43963         CHECK(sk->arr_len == 32);
43964         memcpy(sk_arr, sk->elems, 32); FREE(sk);
43965         uint8_t (*sk_ref)[32] = &sk_arr;
43966         LDKHtlcKey ret_var = HtlcKey_from_secret_key(sk_ref);
43967         int64_t ret_ref = 0;
43968         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43969         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43970         return ret_ref;
43971 }
43972
43973 int8_tArray  CS_LDK_HtlcKey_to_public_key(int64_t this_arg) {
43974         LDKHtlcKey this_arg_conv;
43975         this_arg_conv.inner = untag_ptr(this_arg);
43976         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43977         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43978         this_arg_conv.is_owned = false;
43979         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
43980         memcpy(ret_arr->elems, HtlcKey_to_public_key(&this_arg_conv).compressed_form, 33);
43981         return ret_arr;
43982 }
43983
43984 int8_tArray  CS_LDK_HtlcKey_write(int64_t obj) {
43985         LDKHtlcKey obj_conv;
43986         obj_conv.inner = untag_ptr(obj);
43987         obj_conv.is_owned = ptr_is_owned(obj);
43988         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43989         obj_conv.is_owned = false;
43990         LDKCVec_u8Z ret_var = HtlcKey_write(&obj_conv);
43991         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43992         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43993         CVec_u8Z_free(ret_var);
43994         return ret_arr;
43995 }
43996
43997 int64_t  CS_LDK_HtlcKey_read(int8_tArray ser) {
43998         LDKu8slice ser_ref;
43999         ser_ref.datalen = ser->arr_len;
44000         ser_ref.data = ser->elems;
44001         LDKCResult_HtlcKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcKeyDecodeErrorZ), "LDKCResult_HtlcKeyDecodeErrorZ");
44002         *ret_conv = HtlcKey_read(ser_ref);
44003         FREE(ser);
44004         return tag_ptr(ret_conv, true);
44005 }
44006
44007 int8_tArray  CS_LDK_add_public_key_tweak(int8_tArray base_point, int8_tArray tweak) {
44008         LDKPublicKey base_point_ref;
44009         CHECK(base_point->arr_len == 33);
44010         memcpy(base_point_ref.compressed_form, base_point->elems, 33); FREE(base_point);
44011         uint8_t tweak_arr[32];
44012         CHECK(tweak->arr_len == 32);
44013         memcpy(tweak_arr, tweak->elems, 32); FREE(tweak);
44014         uint8_t (*tweak_ref)[32] = &tweak_arr;
44015         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
44016         memcpy(ret_arr->elems, add_public_key_tweak(base_point_ref, tweak_ref).compressed_form, 33);
44017         return ret_arr;
44018 }
44019
44020 void  CS_LDK_RevocationBasepoint_free(int64_t this_obj) {
44021         LDKRevocationBasepoint this_obj_conv;
44022         this_obj_conv.inner = untag_ptr(this_obj);
44023         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44024         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44025         RevocationBasepoint_free(this_obj_conv);
44026 }
44027
44028 int8_tArray  CS_LDK_RevocationBasepoint_get_a(int64_t this_ptr) {
44029         LDKRevocationBasepoint this_ptr_conv;
44030         this_ptr_conv.inner = untag_ptr(this_ptr);
44031         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44032         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44033         this_ptr_conv.is_owned = false;
44034         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
44035         memcpy(ret_arr->elems, RevocationBasepoint_get_a(&this_ptr_conv).compressed_form, 33);
44036         return ret_arr;
44037 }
44038
44039 void  CS_LDK_RevocationBasepoint_set_a(int64_t this_ptr, int8_tArray val) {
44040         LDKRevocationBasepoint this_ptr_conv;
44041         this_ptr_conv.inner = untag_ptr(this_ptr);
44042         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44043         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44044         this_ptr_conv.is_owned = false;
44045         LDKPublicKey val_ref;
44046         CHECK(val->arr_len == 33);
44047         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
44048         RevocationBasepoint_set_a(&this_ptr_conv, val_ref);
44049 }
44050
44051 int64_t  CS_LDK_RevocationBasepoint_new(int8_tArray a_arg) {
44052         LDKPublicKey a_arg_ref;
44053         CHECK(a_arg->arr_len == 33);
44054         memcpy(a_arg_ref.compressed_form, a_arg->elems, 33); FREE(a_arg);
44055         LDKRevocationBasepoint ret_var = RevocationBasepoint_new(a_arg_ref);
44056         int64_t ret_ref = 0;
44057         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44058         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44059         return ret_ref;
44060 }
44061
44062 jboolean  CS_LDK_RevocationBasepoint_eq(int64_t a, int64_t b) {
44063         LDKRevocationBasepoint a_conv;
44064         a_conv.inner = untag_ptr(a);
44065         a_conv.is_owned = ptr_is_owned(a);
44066         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44067         a_conv.is_owned = false;
44068         LDKRevocationBasepoint b_conv;
44069         b_conv.inner = untag_ptr(b);
44070         b_conv.is_owned = ptr_is_owned(b);
44071         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44072         b_conv.is_owned = false;
44073         jboolean ret_conv = RevocationBasepoint_eq(&a_conv, &b_conv);
44074         return ret_conv;
44075 }
44076
44077 static inline uint64_t RevocationBasepoint_clone_ptr(LDKRevocationBasepoint *NONNULL_PTR arg) {
44078         LDKRevocationBasepoint ret_var = RevocationBasepoint_clone(arg);
44079         int64_t ret_ref = 0;
44080         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44081         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44082         return ret_ref;
44083 }
44084 int64_t  CS_LDK_RevocationBasepoint_clone_ptr(int64_t arg) {
44085         LDKRevocationBasepoint arg_conv;
44086         arg_conv.inner = untag_ptr(arg);
44087         arg_conv.is_owned = ptr_is_owned(arg);
44088         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44089         arg_conv.is_owned = false;
44090         int64_t ret_conv = RevocationBasepoint_clone_ptr(&arg_conv);
44091         return ret_conv;
44092 }
44093
44094 int64_t  CS_LDK_RevocationBasepoint_clone(int64_t orig) {
44095         LDKRevocationBasepoint orig_conv;
44096         orig_conv.inner = untag_ptr(orig);
44097         orig_conv.is_owned = ptr_is_owned(orig);
44098         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44099         orig_conv.is_owned = false;
44100         LDKRevocationBasepoint ret_var = RevocationBasepoint_clone(&orig_conv);
44101         int64_t ret_ref = 0;
44102         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44103         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44104         return ret_ref;
44105 }
44106
44107 int64_t  CS_LDK_RevocationBasepoint_hash(int64_t o) {
44108         LDKRevocationBasepoint o_conv;
44109         o_conv.inner = untag_ptr(o);
44110         o_conv.is_owned = ptr_is_owned(o);
44111         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44112         o_conv.is_owned = false;
44113         int64_t ret_conv = RevocationBasepoint_hash(&o_conv);
44114         return ret_conv;
44115 }
44116
44117 int8_tArray  CS_LDK_RevocationBasepoint_to_public_key(int64_t this_arg) {
44118         LDKRevocationBasepoint this_arg_conv;
44119         this_arg_conv.inner = untag_ptr(this_arg);
44120         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44121         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44122         this_arg_conv.is_owned = false;
44123         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
44124         memcpy(ret_arr->elems, RevocationBasepoint_to_public_key(&this_arg_conv).compressed_form, 33);
44125         return ret_arr;
44126 }
44127
44128 int8_tArray  CS_LDK_RevocationBasepoint_write(int64_t obj) {
44129         LDKRevocationBasepoint obj_conv;
44130         obj_conv.inner = untag_ptr(obj);
44131         obj_conv.is_owned = ptr_is_owned(obj);
44132         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44133         obj_conv.is_owned = false;
44134         LDKCVec_u8Z ret_var = RevocationBasepoint_write(&obj_conv);
44135         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
44136         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
44137         CVec_u8Z_free(ret_var);
44138         return ret_arr;
44139 }
44140
44141 int64_t  CS_LDK_RevocationBasepoint_read(int8_tArray ser) {
44142         LDKu8slice ser_ref;
44143         ser_ref.datalen = ser->arr_len;
44144         ser_ref.data = ser->elems;
44145         LDKCResult_RevocationBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationBasepointDecodeErrorZ), "LDKCResult_RevocationBasepointDecodeErrorZ");
44146         *ret_conv = RevocationBasepoint_read(ser_ref);
44147         FREE(ser);
44148         return tag_ptr(ret_conv, true);
44149 }
44150
44151 void  CS_LDK_RevocationKey_free(int64_t this_obj) {
44152         LDKRevocationKey this_obj_conv;
44153         this_obj_conv.inner = untag_ptr(this_obj);
44154         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44155         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44156         RevocationKey_free(this_obj_conv);
44157 }
44158
44159 int8_tArray  CS_LDK_RevocationKey_get_a(int64_t this_ptr) {
44160         LDKRevocationKey this_ptr_conv;
44161         this_ptr_conv.inner = untag_ptr(this_ptr);
44162         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44163         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44164         this_ptr_conv.is_owned = false;
44165         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
44166         memcpy(ret_arr->elems, RevocationKey_get_a(&this_ptr_conv).compressed_form, 33);
44167         return ret_arr;
44168 }
44169
44170 void  CS_LDK_RevocationKey_set_a(int64_t this_ptr, int8_tArray val) {
44171         LDKRevocationKey this_ptr_conv;
44172         this_ptr_conv.inner = untag_ptr(this_ptr);
44173         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44174         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44175         this_ptr_conv.is_owned = false;
44176         LDKPublicKey val_ref;
44177         CHECK(val->arr_len == 33);
44178         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
44179         RevocationKey_set_a(&this_ptr_conv, val_ref);
44180 }
44181
44182 int64_t  CS_LDK_RevocationKey_new(int8_tArray a_arg) {
44183         LDKPublicKey a_arg_ref;
44184         CHECK(a_arg->arr_len == 33);
44185         memcpy(a_arg_ref.compressed_form, a_arg->elems, 33); FREE(a_arg);
44186         LDKRevocationKey ret_var = RevocationKey_new(a_arg_ref);
44187         int64_t ret_ref = 0;
44188         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44189         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44190         return ret_ref;
44191 }
44192
44193 jboolean  CS_LDK_RevocationKey_eq(int64_t a, int64_t b) {
44194         LDKRevocationKey a_conv;
44195         a_conv.inner = untag_ptr(a);
44196         a_conv.is_owned = ptr_is_owned(a);
44197         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44198         a_conv.is_owned = false;
44199         LDKRevocationKey b_conv;
44200         b_conv.inner = untag_ptr(b);
44201         b_conv.is_owned = ptr_is_owned(b);
44202         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44203         b_conv.is_owned = false;
44204         jboolean ret_conv = RevocationKey_eq(&a_conv, &b_conv);
44205         return ret_conv;
44206 }
44207
44208 static inline uint64_t RevocationKey_clone_ptr(LDKRevocationKey *NONNULL_PTR arg) {
44209         LDKRevocationKey ret_var = RevocationKey_clone(arg);
44210         int64_t ret_ref = 0;
44211         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44212         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44213         return ret_ref;
44214 }
44215 int64_t  CS_LDK_RevocationKey_clone_ptr(int64_t arg) {
44216         LDKRevocationKey arg_conv;
44217         arg_conv.inner = untag_ptr(arg);
44218         arg_conv.is_owned = ptr_is_owned(arg);
44219         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44220         arg_conv.is_owned = false;
44221         int64_t ret_conv = RevocationKey_clone_ptr(&arg_conv);
44222         return ret_conv;
44223 }
44224
44225 int64_t  CS_LDK_RevocationKey_clone(int64_t orig) {
44226         LDKRevocationKey orig_conv;
44227         orig_conv.inner = untag_ptr(orig);
44228         orig_conv.is_owned = ptr_is_owned(orig);
44229         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44230         orig_conv.is_owned = false;
44231         LDKRevocationKey ret_var = RevocationKey_clone(&orig_conv);
44232         int64_t ret_ref = 0;
44233         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44234         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44235         return ret_ref;
44236 }
44237
44238 int64_t  CS_LDK_RevocationKey_hash(int64_t o) {
44239         LDKRevocationKey o_conv;
44240         o_conv.inner = untag_ptr(o);
44241         o_conv.is_owned = ptr_is_owned(o);
44242         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44243         o_conv.is_owned = false;
44244         int64_t ret_conv = RevocationKey_hash(&o_conv);
44245         return ret_conv;
44246 }
44247
44248 int64_t  CS_LDK_RevocationKey_from_basepoint(int64_t countersignatory_basepoint, int8_tArray per_commitment_point) {
44249         LDKRevocationBasepoint countersignatory_basepoint_conv;
44250         countersignatory_basepoint_conv.inner = untag_ptr(countersignatory_basepoint);
44251         countersignatory_basepoint_conv.is_owned = ptr_is_owned(countersignatory_basepoint);
44252         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_basepoint_conv);
44253         countersignatory_basepoint_conv.is_owned = false;
44254         LDKPublicKey per_commitment_point_ref;
44255         CHECK(per_commitment_point->arr_len == 33);
44256         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
44257         LDKRevocationKey ret_var = RevocationKey_from_basepoint(&countersignatory_basepoint_conv, per_commitment_point_ref);
44258         int64_t ret_ref = 0;
44259         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44260         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44261         return ret_ref;
44262 }
44263
44264 int8_tArray  CS_LDK_RevocationKey_to_public_key(int64_t this_arg) {
44265         LDKRevocationKey this_arg_conv;
44266         this_arg_conv.inner = untag_ptr(this_arg);
44267         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44268         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44269         this_arg_conv.is_owned = false;
44270         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
44271         memcpy(ret_arr->elems, RevocationKey_to_public_key(&this_arg_conv).compressed_form, 33);
44272         return ret_arr;
44273 }
44274
44275 int8_tArray  CS_LDK_RevocationKey_write(int64_t obj) {
44276         LDKRevocationKey obj_conv;
44277         obj_conv.inner = untag_ptr(obj);
44278         obj_conv.is_owned = ptr_is_owned(obj);
44279         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44280         obj_conv.is_owned = false;
44281         LDKCVec_u8Z ret_var = RevocationKey_write(&obj_conv);
44282         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
44283         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
44284         CVec_u8Z_free(ret_var);
44285         return ret_arr;
44286 }
44287
44288 int64_t  CS_LDK_RevocationKey_read(int8_tArray ser) {
44289         LDKu8slice ser_ref;
44290         ser_ref.datalen = ser->arr_len;
44291         ser_ref.data = ser->elems;
44292         LDKCResult_RevocationKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationKeyDecodeErrorZ), "LDKCResult_RevocationKeyDecodeErrorZ");
44293         *ret_conv = RevocationKey_read(ser_ref);
44294         FREE(ser);
44295         return tag_ptr(ret_conv, true);
44296 }
44297
44298 int32_t  CS_LDK_InboundHTLCStateDetails_clone(int64_t orig) {
44299         LDKInboundHTLCStateDetails* orig_conv = (LDKInboundHTLCStateDetails*)untag_ptr(orig);
44300         int32_t ret_conv = LDKInboundHTLCStateDetails_to_cs(InboundHTLCStateDetails_clone(orig_conv));
44301         return ret_conv;
44302 }
44303
44304 int32_t  CS_LDK_InboundHTLCStateDetails_awaiting_remote_revoke_to_add() {
44305         int32_t ret_conv = LDKInboundHTLCStateDetails_to_cs(InboundHTLCStateDetails_awaiting_remote_revoke_to_add());
44306         return ret_conv;
44307 }
44308
44309 int32_t  CS_LDK_InboundHTLCStateDetails_committed() {
44310         int32_t ret_conv = LDKInboundHTLCStateDetails_to_cs(InboundHTLCStateDetails_committed());
44311         return ret_conv;
44312 }
44313
44314 int32_t  CS_LDK_InboundHTLCStateDetails_awaiting_remote_revoke_to_remove_fulfill() {
44315         int32_t ret_conv = LDKInboundHTLCStateDetails_to_cs(InboundHTLCStateDetails_awaiting_remote_revoke_to_remove_fulfill());
44316         return ret_conv;
44317 }
44318
44319 int32_t  CS_LDK_InboundHTLCStateDetails_awaiting_remote_revoke_to_remove_fail() {
44320         int32_t ret_conv = LDKInboundHTLCStateDetails_to_cs(InboundHTLCStateDetails_awaiting_remote_revoke_to_remove_fail());
44321         return ret_conv;
44322 }
44323
44324 int8_tArray  CS_LDK_InboundHTLCStateDetails_write(int64_t obj) {
44325         LDKInboundHTLCStateDetails* obj_conv = (LDKInboundHTLCStateDetails*)untag_ptr(obj);
44326         LDKCVec_u8Z ret_var = InboundHTLCStateDetails_write(obj_conv);
44327         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
44328         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
44329         CVec_u8Z_free(ret_var);
44330         return ret_arr;
44331 }
44332
44333 int64_t  CS_LDK_InboundHTLCStateDetails_read(int8_tArray ser) {
44334         LDKu8slice ser_ref;
44335         ser_ref.datalen = ser->arr_len;
44336         ser_ref.data = ser->elems;
44337         LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ), "LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ");
44338         *ret_conv = InboundHTLCStateDetails_read(ser_ref);
44339         FREE(ser);
44340         return tag_ptr(ret_conv, true);
44341 }
44342
44343 void  CS_LDK_InboundHTLCDetails_free(int64_t this_obj) {
44344         LDKInboundHTLCDetails this_obj_conv;
44345         this_obj_conv.inner = untag_ptr(this_obj);
44346         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44347         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44348         InboundHTLCDetails_free(this_obj_conv);
44349 }
44350
44351 int64_t  CS_LDK_InboundHTLCDetails_get_htlc_id(int64_t this_ptr) {
44352         LDKInboundHTLCDetails this_ptr_conv;
44353         this_ptr_conv.inner = untag_ptr(this_ptr);
44354         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44355         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44356         this_ptr_conv.is_owned = false;
44357         int64_t ret_conv = InboundHTLCDetails_get_htlc_id(&this_ptr_conv);
44358         return ret_conv;
44359 }
44360
44361 void  CS_LDK_InboundHTLCDetails_set_htlc_id(int64_t this_ptr, int64_t val) {
44362         LDKInboundHTLCDetails this_ptr_conv;
44363         this_ptr_conv.inner = untag_ptr(this_ptr);
44364         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44365         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44366         this_ptr_conv.is_owned = false;
44367         InboundHTLCDetails_set_htlc_id(&this_ptr_conv, val);
44368 }
44369
44370 int64_t  CS_LDK_InboundHTLCDetails_get_amount_msat(int64_t this_ptr) {
44371         LDKInboundHTLCDetails this_ptr_conv;
44372         this_ptr_conv.inner = untag_ptr(this_ptr);
44373         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44374         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44375         this_ptr_conv.is_owned = false;
44376         int64_t ret_conv = InboundHTLCDetails_get_amount_msat(&this_ptr_conv);
44377         return ret_conv;
44378 }
44379
44380 void  CS_LDK_InboundHTLCDetails_set_amount_msat(int64_t this_ptr, int64_t val) {
44381         LDKInboundHTLCDetails this_ptr_conv;
44382         this_ptr_conv.inner = untag_ptr(this_ptr);
44383         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44384         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44385         this_ptr_conv.is_owned = false;
44386         InboundHTLCDetails_set_amount_msat(&this_ptr_conv, val);
44387 }
44388
44389 int32_t  CS_LDK_InboundHTLCDetails_get_cltv_expiry(int64_t this_ptr) {
44390         LDKInboundHTLCDetails this_ptr_conv;
44391         this_ptr_conv.inner = untag_ptr(this_ptr);
44392         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44393         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44394         this_ptr_conv.is_owned = false;
44395         int32_t ret_conv = InboundHTLCDetails_get_cltv_expiry(&this_ptr_conv);
44396         return ret_conv;
44397 }
44398
44399 void  CS_LDK_InboundHTLCDetails_set_cltv_expiry(int64_t this_ptr, int32_t val) {
44400         LDKInboundHTLCDetails this_ptr_conv;
44401         this_ptr_conv.inner = untag_ptr(this_ptr);
44402         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44403         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44404         this_ptr_conv.is_owned = false;
44405         InboundHTLCDetails_set_cltv_expiry(&this_ptr_conv, val);
44406 }
44407
44408 int8_tArray  CS_LDK_InboundHTLCDetails_get_payment_hash(int64_t this_ptr) {
44409         LDKInboundHTLCDetails this_ptr_conv;
44410         this_ptr_conv.inner = untag_ptr(this_ptr);
44411         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44412         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44413         this_ptr_conv.is_owned = false;
44414         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
44415         memcpy(ret_arr->elems, *InboundHTLCDetails_get_payment_hash(&this_ptr_conv), 32);
44416         return ret_arr;
44417 }
44418
44419 void  CS_LDK_InboundHTLCDetails_set_payment_hash(int64_t this_ptr, int8_tArray val) {
44420         LDKInboundHTLCDetails this_ptr_conv;
44421         this_ptr_conv.inner = untag_ptr(this_ptr);
44422         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44423         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44424         this_ptr_conv.is_owned = false;
44425         LDKThirtyTwoBytes val_ref;
44426         CHECK(val->arr_len == 32);
44427         memcpy(val_ref.data, val->elems, 32); FREE(val);
44428         InboundHTLCDetails_set_payment_hash(&this_ptr_conv, val_ref);
44429 }
44430
44431 int64_t  CS_LDK_InboundHTLCDetails_get_state(int64_t this_ptr) {
44432         LDKInboundHTLCDetails this_ptr_conv;
44433         this_ptr_conv.inner = untag_ptr(this_ptr);
44434         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44435         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44436         this_ptr_conv.is_owned = false;
44437         LDKCOption_InboundHTLCStateDetailsZ *ret_copy = MALLOC(sizeof(LDKCOption_InboundHTLCStateDetailsZ), "LDKCOption_InboundHTLCStateDetailsZ");
44438         *ret_copy = InboundHTLCDetails_get_state(&this_ptr_conv);
44439         int64_t ret_ref = tag_ptr(ret_copy, true);
44440         return ret_ref;
44441 }
44442
44443 void  CS_LDK_InboundHTLCDetails_set_state(int64_t this_ptr, int64_t val) {
44444         LDKInboundHTLCDetails this_ptr_conv;
44445         this_ptr_conv.inner = untag_ptr(this_ptr);
44446         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44447         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44448         this_ptr_conv.is_owned = false;
44449         void* val_ptr = untag_ptr(val);
44450         CHECK_ACCESS(val_ptr);
44451         LDKCOption_InboundHTLCStateDetailsZ val_conv = *(LDKCOption_InboundHTLCStateDetailsZ*)(val_ptr);
44452         val_conv = COption_InboundHTLCStateDetailsZ_clone((LDKCOption_InboundHTLCStateDetailsZ*)untag_ptr(val));
44453         InboundHTLCDetails_set_state(&this_ptr_conv, val_conv);
44454 }
44455
44456 jboolean  CS_LDK_InboundHTLCDetails_get_is_dust(int64_t this_ptr) {
44457         LDKInboundHTLCDetails this_ptr_conv;
44458         this_ptr_conv.inner = untag_ptr(this_ptr);
44459         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44460         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44461         this_ptr_conv.is_owned = false;
44462         jboolean ret_conv = InboundHTLCDetails_get_is_dust(&this_ptr_conv);
44463         return ret_conv;
44464 }
44465
44466 void  CS_LDK_InboundHTLCDetails_set_is_dust(int64_t this_ptr, jboolean val) {
44467         LDKInboundHTLCDetails this_ptr_conv;
44468         this_ptr_conv.inner = untag_ptr(this_ptr);
44469         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44470         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44471         this_ptr_conv.is_owned = false;
44472         InboundHTLCDetails_set_is_dust(&this_ptr_conv, val);
44473 }
44474
44475 int64_t  CS_LDK_InboundHTLCDetails_new(int64_t htlc_id_arg, int64_t amount_msat_arg, int32_t cltv_expiry_arg, int8_tArray payment_hash_arg, int64_t state_arg, jboolean is_dust_arg) {
44476         LDKThirtyTwoBytes payment_hash_arg_ref;
44477         CHECK(payment_hash_arg->arr_len == 32);
44478         memcpy(payment_hash_arg_ref.data, payment_hash_arg->elems, 32); FREE(payment_hash_arg);
44479         void* state_arg_ptr = untag_ptr(state_arg);
44480         CHECK_ACCESS(state_arg_ptr);
44481         LDKCOption_InboundHTLCStateDetailsZ state_arg_conv = *(LDKCOption_InboundHTLCStateDetailsZ*)(state_arg_ptr);
44482         state_arg_conv = COption_InboundHTLCStateDetailsZ_clone((LDKCOption_InboundHTLCStateDetailsZ*)untag_ptr(state_arg));
44483         LDKInboundHTLCDetails ret_var = InboundHTLCDetails_new(htlc_id_arg, amount_msat_arg, cltv_expiry_arg, payment_hash_arg_ref, state_arg_conv, is_dust_arg);
44484         int64_t ret_ref = 0;
44485         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44486         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44487         return ret_ref;
44488 }
44489
44490 static inline uint64_t InboundHTLCDetails_clone_ptr(LDKInboundHTLCDetails *NONNULL_PTR arg) {
44491         LDKInboundHTLCDetails ret_var = InboundHTLCDetails_clone(arg);
44492         int64_t ret_ref = 0;
44493         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44494         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44495         return ret_ref;
44496 }
44497 int64_t  CS_LDK_InboundHTLCDetails_clone_ptr(int64_t arg) {
44498         LDKInboundHTLCDetails arg_conv;
44499         arg_conv.inner = untag_ptr(arg);
44500         arg_conv.is_owned = ptr_is_owned(arg);
44501         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44502         arg_conv.is_owned = false;
44503         int64_t ret_conv = InboundHTLCDetails_clone_ptr(&arg_conv);
44504         return ret_conv;
44505 }
44506
44507 int64_t  CS_LDK_InboundHTLCDetails_clone(int64_t orig) {
44508         LDKInboundHTLCDetails orig_conv;
44509         orig_conv.inner = untag_ptr(orig);
44510         orig_conv.is_owned = ptr_is_owned(orig);
44511         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44512         orig_conv.is_owned = false;
44513         LDKInboundHTLCDetails ret_var = InboundHTLCDetails_clone(&orig_conv);
44514         int64_t ret_ref = 0;
44515         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44516         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44517         return ret_ref;
44518 }
44519
44520 int8_tArray  CS_LDK_InboundHTLCDetails_write(int64_t obj) {
44521         LDKInboundHTLCDetails obj_conv;
44522         obj_conv.inner = untag_ptr(obj);
44523         obj_conv.is_owned = ptr_is_owned(obj);
44524         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44525         obj_conv.is_owned = false;
44526         LDKCVec_u8Z ret_var = InboundHTLCDetails_write(&obj_conv);
44527         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
44528         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
44529         CVec_u8Z_free(ret_var);
44530         return ret_arr;
44531 }
44532
44533 int64_t  CS_LDK_InboundHTLCDetails_read(int8_tArray ser) {
44534         LDKu8slice ser_ref;
44535         ser_ref.datalen = ser->arr_len;
44536         ser_ref.data = ser->elems;
44537         LDKCResult_InboundHTLCDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InboundHTLCDetailsDecodeErrorZ), "LDKCResult_InboundHTLCDetailsDecodeErrorZ");
44538         *ret_conv = InboundHTLCDetails_read(ser_ref);
44539         FREE(ser);
44540         return tag_ptr(ret_conv, true);
44541 }
44542
44543 int32_t  CS_LDK_OutboundHTLCStateDetails_clone(int64_t orig) {
44544         LDKOutboundHTLCStateDetails* orig_conv = (LDKOutboundHTLCStateDetails*)untag_ptr(orig);
44545         int32_t ret_conv = LDKOutboundHTLCStateDetails_to_cs(OutboundHTLCStateDetails_clone(orig_conv));
44546         return ret_conv;
44547 }
44548
44549 int32_t  CS_LDK_OutboundHTLCStateDetails_awaiting_remote_revoke_to_add() {
44550         int32_t ret_conv = LDKOutboundHTLCStateDetails_to_cs(OutboundHTLCStateDetails_awaiting_remote_revoke_to_add());
44551         return ret_conv;
44552 }
44553
44554 int32_t  CS_LDK_OutboundHTLCStateDetails_committed() {
44555         int32_t ret_conv = LDKOutboundHTLCStateDetails_to_cs(OutboundHTLCStateDetails_committed());
44556         return ret_conv;
44557 }
44558
44559 int32_t  CS_LDK_OutboundHTLCStateDetails_awaiting_remote_revoke_to_remove_success() {
44560         int32_t ret_conv = LDKOutboundHTLCStateDetails_to_cs(OutboundHTLCStateDetails_awaiting_remote_revoke_to_remove_success());
44561         return ret_conv;
44562 }
44563
44564 int32_t  CS_LDK_OutboundHTLCStateDetails_awaiting_remote_revoke_to_remove_failure() {
44565         int32_t ret_conv = LDKOutboundHTLCStateDetails_to_cs(OutboundHTLCStateDetails_awaiting_remote_revoke_to_remove_failure());
44566         return ret_conv;
44567 }
44568
44569 int8_tArray  CS_LDK_OutboundHTLCStateDetails_write(int64_t obj) {
44570         LDKOutboundHTLCStateDetails* obj_conv = (LDKOutboundHTLCStateDetails*)untag_ptr(obj);
44571         LDKCVec_u8Z ret_var = OutboundHTLCStateDetails_write(obj_conv);
44572         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
44573         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
44574         CVec_u8Z_free(ret_var);
44575         return ret_arr;
44576 }
44577
44578 int64_t  CS_LDK_OutboundHTLCStateDetails_read(int8_tArray ser) {
44579         LDKu8slice ser_ref;
44580         ser_ref.datalen = ser->arr_len;
44581         ser_ref.data = ser->elems;
44582         LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ), "LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ");
44583         *ret_conv = OutboundHTLCStateDetails_read(ser_ref);
44584         FREE(ser);
44585         return tag_ptr(ret_conv, true);
44586 }
44587
44588 void  CS_LDK_OutboundHTLCDetails_free(int64_t this_obj) {
44589         LDKOutboundHTLCDetails this_obj_conv;
44590         this_obj_conv.inner = untag_ptr(this_obj);
44591         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44592         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44593         OutboundHTLCDetails_free(this_obj_conv);
44594 }
44595
44596 int64_t  CS_LDK_OutboundHTLCDetails_get_htlc_id(int64_t this_ptr) {
44597         LDKOutboundHTLCDetails this_ptr_conv;
44598         this_ptr_conv.inner = untag_ptr(this_ptr);
44599         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44600         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44601         this_ptr_conv.is_owned = false;
44602         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
44603         *ret_copy = OutboundHTLCDetails_get_htlc_id(&this_ptr_conv);
44604         int64_t ret_ref = tag_ptr(ret_copy, true);
44605         return ret_ref;
44606 }
44607
44608 void  CS_LDK_OutboundHTLCDetails_set_htlc_id(int64_t this_ptr, int64_t val) {
44609         LDKOutboundHTLCDetails this_ptr_conv;
44610         this_ptr_conv.inner = untag_ptr(this_ptr);
44611         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44612         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44613         this_ptr_conv.is_owned = false;
44614         void* val_ptr = untag_ptr(val);
44615         CHECK_ACCESS(val_ptr);
44616         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
44617         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
44618         OutboundHTLCDetails_set_htlc_id(&this_ptr_conv, val_conv);
44619 }
44620
44621 int64_t  CS_LDK_OutboundHTLCDetails_get_amount_msat(int64_t this_ptr) {
44622         LDKOutboundHTLCDetails this_ptr_conv;
44623         this_ptr_conv.inner = untag_ptr(this_ptr);
44624         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44625         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44626         this_ptr_conv.is_owned = false;
44627         int64_t ret_conv = OutboundHTLCDetails_get_amount_msat(&this_ptr_conv);
44628         return ret_conv;
44629 }
44630
44631 void  CS_LDK_OutboundHTLCDetails_set_amount_msat(int64_t this_ptr, int64_t val) {
44632         LDKOutboundHTLCDetails this_ptr_conv;
44633         this_ptr_conv.inner = untag_ptr(this_ptr);
44634         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44635         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44636         this_ptr_conv.is_owned = false;
44637         OutboundHTLCDetails_set_amount_msat(&this_ptr_conv, val);
44638 }
44639
44640 int32_t  CS_LDK_OutboundHTLCDetails_get_cltv_expiry(int64_t this_ptr) {
44641         LDKOutboundHTLCDetails this_ptr_conv;
44642         this_ptr_conv.inner = untag_ptr(this_ptr);
44643         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44644         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44645         this_ptr_conv.is_owned = false;
44646         int32_t ret_conv = OutboundHTLCDetails_get_cltv_expiry(&this_ptr_conv);
44647         return ret_conv;
44648 }
44649
44650 void  CS_LDK_OutboundHTLCDetails_set_cltv_expiry(int64_t this_ptr, int32_t val) {
44651         LDKOutboundHTLCDetails this_ptr_conv;
44652         this_ptr_conv.inner = untag_ptr(this_ptr);
44653         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44654         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44655         this_ptr_conv.is_owned = false;
44656         OutboundHTLCDetails_set_cltv_expiry(&this_ptr_conv, val);
44657 }
44658
44659 int8_tArray  CS_LDK_OutboundHTLCDetails_get_payment_hash(int64_t this_ptr) {
44660         LDKOutboundHTLCDetails this_ptr_conv;
44661         this_ptr_conv.inner = untag_ptr(this_ptr);
44662         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44663         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44664         this_ptr_conv.is_owned = false;
44665         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
44666         memcpy(ret_arr->elems, *OutboundHTLCDetails_get_payment_hash(&this_ptr_conv), 32);
44667         return ret_arr;
44668 }
44669
44670 void  CS_LDK_OutboundHTLCDetails_set_payment_hash(int64_t this_ptr, int8_tArray val) {
44671         LDKOutboundHTLCDetails this_ptr_conv;
44672         this_ptr_conv.inner = untag_ptr(this_ptr);
44673         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44674         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44675         this_ptr_conv.is_owned = false;
44676         LDKThirtyTwoBytes val_ref;
44677         CHECK(val->arr_len == 32);
44678         memcpy(val_ref.data, val->elems, 32); FREE(val);
44679         OutboundHTLCDetails_set_payment_hash(&this_ptr_conv, val_ref);
44680 }
44681
44682 int64_t  CS_LDK_OutboundHTLCDetails_get_state(int64_t this_ptr) {
44683         LDKOutboundHTLCDetails this_ptr_conv;
44684         this_ptr_conv.inner = untag_ptr(this_ptr);
44685         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44686         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44687         this_ptr_conv.is_owned = false;
44688         LDKCOption_OutboundHTLCStateDetailsZ *ret_copy = MALLOC(sizeof(LDKCOption_OutboundHTLCStateDetailsZ), "LDKCOption_OutboundHTLCStateDetailsZ");
44689         *ret_copy = OutboundHTLCDetails_get_state(&this_ptr_conv);
44690         int64_t ret_ref = tag_ptr(ret_copy, true);
44691         return ret_ref;
44692 }
44693
44694 void  CS_LDK_OutboundHTLCDetails_set_state(int64_t this_ptr, int64_t val) {
44695         LDKOutboundHTLCDetails this_ptr_conv;
44696         this_ptr_conv.inner = untag_ptr(this_ptr);
44697         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44698         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44699         this_ptr_conv.is_owned = false;
44700         void* val_ptr = untag_ptr(val);
44701         CHECK_ACCESS(val_ptr);
44702         LDKCOption_OutboundHTLCStateDetailsZ val_conv = *(LDKCOption_OutboundHTLCStateDetailsZ*)(val_ptr);
44703         val_conv = COption_OutboundHTLCStateDetailsZ_clone((LDKCOption_OutboundHTLCStateDetailsZ*)untag_ptr(val));
44704         OutboundHTLCDetails_set_state(&this_ptr_conv, val_conv);
44705 }
44706
44707 int64_t  CS_LDK_OutboundHTLCDetails_get_skimmed_fee_msat(int64_t this_ptr) {
44708         LDKOutboundHTLCDetails this_ptr_conv;
44709         this_ptr_conv.inner = untag_ptr(this_ptr);
44710         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44711         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44712         this_ptr_conv.is_owned = false;
44713         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
44714         *ret_copy = OutboundHTLCDetails_get_skimmed_fee_msat(&this_ptr_conv);
44715         int64_t ret_ref = tag_ptr(ret_copy, true);
44716         return ret_ref;
44717 }
44718
44719 void  CS_LDK_OutboundHTLCDetails_set_skimmed_fee_msat(int64_t this_ptr, int64_t val) {
44720         LDKOutboundHTLCDetails this_ptr_conv;
44721         this_ptr_conv.inner = untag_ptr(this_ptr);
44722         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44723         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44724         this_ptr_conv.is_owned = false;
44725         void* val_ptr = untag_ptr(val);
44726         CHECK_ACCESS(val_ptr);
44727         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
44728         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
44729         OutboundHTLCDetails_set_skimmed_fee_msat(&this_ptr_conv, val_conv);
44730 }
44731
44732 jboolean  CS_LDK_OutboundHTLCDetails_get_is_dust(int64_t this_ptr) {
44733         LDKOutboundHTLCDetails this_ptr_conv;
44734         this_ptr_conv.inner = untag_ptr(this_ptr);
44735         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44736         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44737         this_ptr_conv.is_owned = false;
44738         jboolean ret_conv = OutboundHTLCDetails_get_is_dust(&this_ptr_conv);
44739         return ret_conv;
44740 }
44741
44742 void  CS_LDK_OutboundHTLCDetails_set_is_dust(int64_t this_ptr, jboolean val) {
44743         LDKOutboundHTLCDetails this_ptr_conv;
44744         this_ptr_conv.inner = untag_ptr(this_ptr);
44745         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44746         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44747         this_ptr_conv.is_owned = false;
44748         OutboundHTLCDetails_set_is_dust(&this_ptr_conv, val);
44749 }
44750
44751 int64_t  CS_LDK_OutboundHTLCDetails_new(int64_t htlc_id_arg, int64_t amount_msat_arg, int32_t cltv_expiry_arg, int8_tArray payment_hash_arg, int64_t state_arg, int64_t skimmed_fee_msat_arg, jboolean is_dust_arg) {
44752         void* htlc_id_arg_ptr = untag_ptr(htlc_id_arg);
44753         CHECK_ACCESS(htlc_id_arg_ptr);
44754         LDKCOption_u64Z htlc_id_arg_conv = *(LDKCOption_u64Z*)(htlc_id_arg_ptr);
44755         htlc_id_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(htlc_id_arg));
44756         LDKThirtyTwoBytes payment_hash_arg_ref;
44757         CHECK(payment_hash_arg->arr_len == 32);
44758         memcpy(payment_hash_arg_ref.data, payment_hash_arg->elems, 32); FREE(payment_hash_arg);
44759         void* state_arg_ptr = untag_ptr(state_arg);
44760         CHECK_ACCESS(state_arg_ptr);
44761         LDKCOption_OutboundHTLCStateDetailsZ state_arg_conv = *(LDKCOption_OutboundHTLCStateDetailsZ*)(state_arg_ptr);
44762         state_arg_conv = COption_OutboundHTLCStateDetailsZ_clone((LDKCOption_OutboundHTLCStateDetailsZ*)untag_ptr(state_arg));
44763         void* skimmed_fee_msat_arg_ptr = untag_ptr(skimmed_fee_msat_arg);
44764         CHECK_ACCESS(skimmed_fee_msat_arg_ptr);
44765         LDKCOption_u64Z skimmed_fee_msat_arg_conv = *(LDKCOption_u64Z*)(skimmed_fee_msat_arg_ptr);
44766         skimmed_fee_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(skimmed_fee_msat_arg));
44767         LDKOutboundHTLCDetails ret_var = OutboundHTLCDetails_new(htlc_id_arg_conv, amount_msat_arg, cltv_expiry_arg, payment_hash_arg_ref, state_arg_conv, skimmed_fee_msat_arg_conv, is_dust_arg);
44768         int64_t ret_ref = 0;
44769         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44770         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44771         return ret_ref;
44772 }
44773
44774 static inline uint64_t OutboundHTLCDetails_clone_ptr(LDKOutboundHTLCDetails *NONNULL_PTR arg) {
44775         LDKOutboundHTLCDetails ret_var = OutboundHTLCDetails_clone(arg);
44776         int64_t ret_ref = 0;
44777         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44778         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44779         return ret_ref;
44780 }
44781 int64_t  CS_LDK_OutboundHTLCDetails_clone_ptr(int64_t arg) {
44782         LDKOutboundHTLCDetails arg_conv;
44783         arg_conv.inner = untag_ptr(arg);
44784         arg_conv.is_owned = ptr_is_owned(arg);
44785         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44786         arg_conv.is_owned = false;
44787         int64_t ret_conv = OutboundHTLCDetails_clone_ptr(&arg_conv);
44788         return ret_conv;
44789 }
44790
44791 int64_t  CS_LDK_OutboundHTLCDetails_clone(int64_t orig) {
44792         LDKOutboundHTLCDetails orig_conv;
44793         orig_conv.inner = untag_ptr(orig);
44794         orig_conv.is_owned = ptr_is_owned(orig);
44795         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44796         orig_conv.is_owned = false;
44797         LDKOutboundHTLCDetails ret_var = OutboundHTLCDetails_clone(&orig_conv);
44798         int64_t ret_ref = 0;
44799         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44800         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44801         return ret_ref;
44802 }
44803
44804 int8_tArray  CS_LDK_OutboundHTLCDetails_write(int64_t obj) {
44805         LDKOutboundHTLCDetails obj_conv;
44806         obj_conv.inner = untag_ptr(obj);
44807         obj_conv.is_owned = ptr_is_owned(obj);
44808         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44809         obj_conv.is_owned = false;
44810         LDKCVec_u8Z ret_var = OutboundHTLCDetails_write(&obj_conv);
44811         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
44812         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
44813         CVec_u8Z_free(ret_var);
44814         return ret_arr;
44815 }
44816
44817 int64_t  CS_LDK_OutboundHTLCDetails_read(int8_tArray ser) {
44818         LDKu8slice ser_ref;
44819         ser_ref.datalen = ser->arr_len;
44820         ser_ref.data = ser->elems;
44821         LDKCResult_OutboundHTLCDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutboundHTLCDetailsDecodeErrorZ), "LDKCResult_OutboundHTLCDetailsDecodeErrorZ");
44822         *ret_conv = OutboundHTLCDetails_read(ser_ref);
44823         FREE(ser);
44824         return tag_ptr(ret_conv, true);
44825 }
44826
44827 void  CS_LDK_CounterpartyForwardingInfo_free(int64_t this_obj) {
44828         LDKCounterpartyForwardingInfo this_obj_conv;
44829         this_obj_conv.inner = untag_ptr(this_obj);
44830         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44831         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44832         CounterpartyForwardingInfo_free(this_obj_conv);
44833 }
44834
44835 int32_t  CS_LDK_CounterpartyForwardingInfo_get_fee_base_msat(int64_t this_ptr) {
44836         LDKCounterpartyForwardingInfo this_ptr_conv;
44837         this_ptr_conv.inner = untag_ptr(this_ptr);
44838         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44839         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44840         this_ptr_conv.is_owned = false;
44841         int32_t ret_conv = CounterpartyForwardingInfo_get_fee_base_msat(&this_ptr_conv);
44842         return ret_conv;
44843 }
44844
44845 void  CS_LDK_CounterpartyForwardingInfo_set_fee_base_msat(int64_t this_ptr, int32_t val) {
44846         LDKCounterpartyForwardingInfo this_ptr_conv;
44847         this_ptr_conv.inner = untag_ptr(this_ptr);
44848         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44849         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44850         this_ptr_conv.is_owned = false;
44851         CounterpartyForwardingInfo_set_fee_base_msat(&this_ptr_conv, val);
44852 }
44853
44854 int32_t  CS_LDK_CounterpartyForwardingInfo_get_fee_proportional_millionths(int64_t this_ptr) {
44855         LDKCounterpartyForwardingInfo 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         int32_t ret_conv = CounterpartyForwardingInfo_get_fee_proportional_millionths(&this_ptr_conv);
44861         return ret_conv;
44862 }
44863
44864 void  CS_LDK_CounterpartyForwardingInfo_set_fee_proportional_millionths(int64_t this_ptr, int32_t val) {
44865         LDKCounterpartyForwardingInfo this_ptr_conv;
44866         this_ptr_conv.inner = untag_ptr(this_ptr);
44867         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44868         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44869         this_ptr_conv.is_owned = false;
44870         CounterpartyForwardingInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
44871 }
44872
44873 int16_t  CS_LDK_CounterpartyForwardingInfo_get_cltv_expiry_delta(int64_t this_ptr) {
44874         LDKCounterpartyForwardingInfo this_ptr_conv;
44875         this_ptr_conv.inner = untag_ptr(this_ptr);
44876         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44877         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44878         this_ptr_conv.is_owned = false;
44879         int16_t ret_conv = CounterpartyForwardingInfo_get_cltv_expiry_delta(&this_ptr_conv);
44880         return ret_conv;
44881 }
44882
44883 void  CS_LDK_CounterpartyForwardingInfo_set_cltv_expiry_delta(int64_t this_ptr, int16_t val) {
44884         LDKCounterpartyForwardingInfo this_ptr_conv;
44885         this_ptr_conv.inner = untag_ptr(this_ptr);
44886         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44887         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44888         this_ptr_conv.is_owned = false;
44889         CounterpartyForwardingInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
44890 }
44891
44892 int64_t  CS_LDK_CounterpartyForwardingInfo_new(int32_t fee_base_msat_arg, int32_t fee_proportional_millionths_arg, int16_t cltv_expiry_delta_arg) {
44893         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_new(fee_base_msat_arg, fee_proportional_millionths_arg, cltv_expiry_delta_arg);
44894         int64_t ret_ref = 0;
44895         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44896         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44897         return ret_ref;
44898 }
44899
44900 static inline uint64_t CounterpartyForwardingInfo_clone_ptr(LDKCounterpartyForwardingInfo *NONNULL_PTR arg) {
44901         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(arg);
44902         int64_t ret_ref = 0;
44903         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44904         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44905         return ret_ref;
44906 }
44907 int64_t  CS_LDK_CounterpartyForwardingInfo_clone_ptr(int64_t arg) {
44908         LDKCounterpartyForwardingInfo arg_conv;
44909         arg_conv.inner = untag_ptr(arg);
44910         arg_conv.is_owned = ptr_is_owned(arg);
44911         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44912         arg_conv.is_owned = false;
44913         int64_t ret_conv = CounterpartyForwardingInfo_clone_ptr(&arg_conv);
44914         return ret_conv;
44915 }
44916
44917 int64_t  CS_LDK_CounterpartyForwardingInfo_clone(int64_t orig) {
44918         LDKCounterpartyForwardingInfo orig_conv;
44919         orig_conv.inner = untag_ptr(orig);
44920         orig_conv.is_owned = ptr_is_owned(orig);
44921         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44922         orig_conv.is_owned = false;
44923         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(&orig_conv);
44924         int64_t ret_ref = 0;
44925         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44926         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44927         return ret_ref;
44928 }
44929
44930 int8_tArray  CS_LDK_CounterpartyForwardingInfo_write(int64_t obj) {
44931         LDKCounterpartyForwardingInfo obj_conv;
44932         obj_conv.inner = untag_ptr(obj);
44933         obj_conv.is_owned = ptr_is_owned(obj);
44934         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44935         obj_conv.is_owned = false;
44936         LDKCVec_u8Z ret_var = CounterpartyForwardingInfo_write(&obj_conv);
44937         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
44938         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
44939         CVec_u8Z_free(ret_var);
44940         return ret_arr;
44941 }
44942
44943 int64_t  CS_LDK_CounterpartyForwardingInfo_read(int8_tArray ser) {
44944         LDKu8slice ser_ref;
44945         ser_ref.datalen = ser->arr_len;
44946         ser_ref.data = ser->elems;
44947         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
44948         *ret_conv = CounterpartyForwardingInfo_read(ser_ref);
44949         FREE(ser);
44950         return tag_ptr(ret_conv, true);
44951 }
44952
44953 void  CS_LDK_ChannelCounterparty_free(int64_t this_obj) {
44954         LDKChannelCounterparty this_obj_conv;
44955         this_obj_conv.inner = untag_ptr(this_obj);
44956         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44957         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44958         ChannelCounterparty_free(this_obj_conv);
44959 }
44960
44961 int8_tArray  CS_LDK_ChannelCounterparty_get_node_id(int64_t this_ptr) {
44962         LDKChannelCounterparty this_ptr_conv;
44963         this_ptr_conv.inner = untag_ptr(this_ptr);
44964         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44965         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44966         this_ptr_conv.is_owned = false;
44967         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
44968         memcpy(ret_arr->elems, ChannelCounterparty_get_node_id(&this_ptr_conv).compressed_form, 33);
44969         return ret_arr;
44970 }
44971
44972 void  CS_LDK_ChannelCounterparty_set_node_id(int64_t this_ptr, int8_tArray val) {
44973         LDKChannelCounterparty this_ptr_conv;
44974         this_ptr_conv.inner = untag_ptr(this_ptr);
44975         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44976         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44977         this_ptr_conv.is_owned = false;
44978         LDKPublicKey val_ref;
44979         CHECK(val->arr_len == 33);
44980         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
44981         ChannelCounterparty_set_node_id(&this_ptr_conv, val_ref);
44982 }
44983
44984 int64_t  CS_LDK_ChannelCounterparty_get_features(int64_t this_ptr) {
44985         LDKChannelCounterparty this_ptr_conv;
44986         this_ptr_conv.inner = untag_ptr(this_ptr);
44987         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44988         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44989         this_ptr_conv.is_owned = false;
44990         LDKInitFeatures ret_var = ChannelCounterparty_get_features(&this_ptr_conv);
44991         int64_t ret_ref = 0;
44992         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44993         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44994         return ret_ref;
44995 }
44996
44997 void  CS_LDK_ChannelCounterparty_set_features(int64_t this_ptr, int64_t val) {
44998         LDKChannelCounterparty this_ptr_conv;
44999         this_ptr_conv.inner = untag_ptr(this_ptr);
45000         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45001         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45002         this_ptr_conv.is_owned = false;
45003         LDKInitFeatures val_conv;
45004         val_conv.inner = untag_ptr(val);
45005         val_conv.is_owned = ptr_is_owned(val);
45006         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
45007         val_conv = InitFeatures_clone(&val_conv);
45008         ChannelCounterparty_set_features(&this_ptr_conv, val_conv);
45009 }
45010
45011 int64_t  CS_LDK_ChannelCounterparty_get_unspendable_punishment_reserve(int64_t this_ptr) {
45012         LDKChannelCounterparty this_ptr_conv;
45013         this_ptr_conv.inner = untag_ptr(this_ptr);
45014         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45015         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45016         this_ptr_conv.is_owned = false;
45017         int64_t ret_conv = ChannelCounterparty_get_unspendable_punishment_reserve(&this_ptr_conv);
45018         return ret_conv;
45019 }
45020
45021 void  CS_LDK_ChannelCounterparty_set_unspendable_punishment_reserve(int64_t this_ptr, int64_t val) {
45022         LDKChannelCounterparty this_ptr_conv;
45023         this_ptr_conv.inner = untag_ptr(this_ptr);
45024         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45025         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45026         this_ptr_conv.is_owned = false;
45027         ChannelCounterparty_set_unspendable_punishment_reserve(&this_ptr_conv, val);
45028 }
45029
45030 int64_t  CS_LDK_ChannelCounterparty_get_forwarding_info(int64_t this_ptr) {
45031         LDKChannelCounterparty 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         LDKCounterpartyForwardingInfo ret_var = ChannelCounterparty_get_forwarding_info(&this_ptr_conv);
45037         int64_t ret_ref = 0;
45038         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45039         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45040         return ret_ref;
45041 }
45042
45043 void  CS_LDK_ChannelCounterparty_set_forwarding_info(int64_t this_ptr, int64_t val) {
45044         LDKChannelCounterparty this_ptr_conv;
45045         this_ptr_conv.inner = untag_ptr(this_ptr);
45046         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45047         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45048         this_ptr_conv.is_owned = false;
45049         LDKCounterpartyForwardingInfo val_conv;
45050         val_conv.inner = untag_ptr(val);
45051         val_conv.is_owned = ptr_is_owned(val);
45052         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
45053         val_conv = CounterpartyForwardingInfo_clone(&val_conv);
45054         ChannelCounterparty_set_forwarding_info(&this_ptr_conv, val_conv);
45055 }
45056
45057 int64_t  CS_LDK_ChannelCounterparty_get_outbound_htlc_minimum_msat(int64_t this_ptr) {
45058         LDKChannelCounterparty this_ptr_conv;
45059         this_ptr_conv.inner = untag_ptr(this_ptr);
45060         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45061         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45062         this_ptr_conv.is_owned = false;
45063         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
45064         *ret_copy = ChannelCounterparty_get_outbound_htlc_minimum_msat(&this_ptr_conv);
45065         int64_t ret_ref = tag_ptr(ret_copy, true);
45066         return ret_ref;
45067 }
45068
45069 void  CS_LDK_ChannelCounterparty_set_outbound_htlc_minimum_msat(int64_t this_ptr, int64_t val) {
45070         LDKChannelCounterparty this_ptr_conv;
45071         this_ptr_conv.inner = untag_ptr(this_ptr);
45072         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45073         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45074         this_ptr_conv.is_owned = false;
45075         void* val_ptr = untag_ptr(val);
45076         CHECK_ACCESS(val_ptr);
45077         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
45078         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
45079         ChannelCounterparty_set_outbound_htlc_minimum_msat(&this_ptr_conv, val_conv);
45080 }
45081
45082 int64_t  CS_LDK_ChannelCounterparty_get_outbound_htlc_maximum_msat(int64_t this_ptr) {
45083         LDKChannelCounterparty this_ptr_conv;
45084         this_ptr_conv.inner = untag_ptr(this_ptr);
45085         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45086         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45087         this_ptr_conv.is_owned = false;
45088         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
45089         *ret_copy = ChannelCounterparty_get_outbound_htlc_maximum_msat(&this_ptr_conv);
45090         int64_t ret_ref = tag_ptr(ret_copy, true);
45091         return ret_ref;
45092 }
45093
45094 void  CS_LDK_ChannelCounterparty_set_outbound_htlc_maximum_msat(int64_t this_ptr, int64_t val) {
45095         LDKChannelCounterparty this_ptr_conv;
45096         this_ptr_conv.inner = untag_ptr(this_ptr);
45097         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45098         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45099         this_ptr_conv.is_owned = false;
45100         void* val_ptr = untag_ptr(val);
45101         CHECK_ACCESS(val_ptr);
45102         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
45103         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
45104         ChannelCounterparty_set_outbound_htlc_maximum_msat(&this_ptr_conv, val_conv);
45105 }
45106
45107 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) {
45108         LDKPublicKey node_id_arg_ref;
45109         CHECK(node_id_arg->arr_len == 33);
45110         memcpy(node_id_arg_ref.compressed_form, node_id_arg->elems, 33); FREE(node_id_arg);
45111         LDKInitFeatures features_arg_conv;
45112         features_arg_conv.inner = untag_ptr(features_arg);
45113         features_arg_conv.is_owned = ptr_is_owned(features_arg);
45114         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
45115         features_arg_conv = InitFeatures_clone(&features_arg_conv);
45116         LDKCounterpartyForwardingInfo forwarding_info_arg_conv;
45117         forwarding_info_arg_conv.inner = untag_ptr(forwarding_info_arg);
45118         forwarding_info_arg_conv.is_owned = ptr_is_owned(forwarding_info_arg);
45119         CHECK_INNER_FIELD_ACCESS_OR_NULL(forwarding_info_arg_conv);
45120         forwarding_info_arg_conv = CounterpartyForwardingInfo_clone(&forwarding_info_arg_conv);
45121         void* outbound_htlc_minimum_msat_arg_ptr = untag_ptr(outbound_htlc_minimum_msat_arg);
45122         CHECK_ACCESS(outbound_htlc_minimum_msat_arg_ptr);
45123         LDKCOption_u64Z outbound_htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(outbound_htlc_minimum_msat_arg_ptr);
45124         outbound_htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_htlc_minimum_msat_arg));
45125         void* outbound_htlc_maximum_msat_arg_ptr = untag_ptr(outbound_htlc_maximum_msat_arg);
45126         CHECK_ACCESS(outbound_htlc_maximum_msat_arg_ptr);
45127         LDKCOption_u64Z outbound_htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(outbound_htlc_maximum_msat_arg_ptr);
45128         outbound_htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_htlc_maximum_msat_arg));
45129         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);
45130         int64_t ret_ref = 0;
45131         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45132         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45133         return ret_ref;
45134 }
45135
45136 static inline uint64_t ChannelCounterparty_clone_ptr(LDKChannelCounterparty *NONNULL_PTR arg) {
45137         LDKChannelCounterparty ret_var = ChannelCounterparty_clone(arg);
45138         int64_t ret_ref = 0;
45139         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45140         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45141         return ret_ref;
45142 }
45143 int64_t  CS_LDK_ChannelCounterparty_clone_ptr(int64_t arg) {
45144         LDKChannelCounterparty arg_conv;
45145         arg_conv.inner = untag_ptr(arg);
45146         arg_conv.is_owned = ptr_is_owned(arg);
45147         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45148         arg_conv.is_owned = false;
45149         int64_t ret_conv = ChannelCounterparty_clone_ptr(&arg_conv);
45150         return ret_conv;
45151 }
45152
45153 int64_t  CS_LDK_ChannelCounterparty_clone(int64_t orig) {
45154         LDKChannelCounterparty orig_conv;
45155         orig_conv.inner = untag_ptr(orig);
45156         orig_conv.is_owned = ptr_is_owned(orig);
45157         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45158         orig_conv.is_owned = false;
45159         LDKChannelCounterparty ret_var = ChannelCounterparty_clone(&orig_conv);
45160         int64_t ret_ref = 0;
45161         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45162         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45163         return ret_ref;
45164 }
45165
45166 int8_tArray  CS_LDK_ChannelCounterparty_write(int64_t obj) {
45167         LDKChannelCounterparty obj_conv;
45168         obj_conv.inner = untag_ptr(obj);
45169         obj_conv.is_owned = ptr_is_owned(obj);
45170         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45171         obj_conv.is_owned = false;
45172         LDKCVec_u8Z ret_var = ChannelCounterparty_write(&obj_conv);
45173         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45174         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45175         CVec_u8Z_free(ret_var);
45176         return ret_arr;
45177 }
45178
45179 int64_t  CS_LDK_ChannelCounterparty_read(int8_tArray ser) {
45180         LDKu8slice ser_ref;
45181         ser_ref.datalen = ser->arr_len;
45182         ser_ref.data = ser->elems;
45183         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
45184         *ret_conv = ChannelCounterparty_read(ser_ref);
45185         FREE(ser);
45186         return tag_ptr(ret_conv, true);
45187 }
45188
45189 void  CS_LDK_ChannelDetails_free(int64_t this_obj) {
45190         LDKChannelDetails this_obj_conv;
45191         this_obj_conv.inner = untag_ptr(this_obj);
45192         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45193         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45194         ChannelDetails_free(this_obj_conv);
45195 }
45196
45197 int64_t  CS_LDK_ChannelDetails_get_channel_id(int64_t this_ptr) {
45198         LDKChannelDetails this_ptr_conv;
45199         this_ptr_conv.inner = untag_ptr(this_ptr);
45200         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45201         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45202         this_ptr_conv.is_owned = false;
45203         LDKChannelId ret_var = ChannelDetails_get_channel_id(&this_ptr_conv);
45204         int64_t ret_ref = 0;
45205         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45206         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45207         return ret_ref;
45208 }
45209
45210 void  CS_LDK_ChannelDetails_set_channel_id(int64_t this_ptr, int64_t val) {
45211         LDKChannelDetails this_ptr_conv;
45212         this_ptr_conv.inner = untag_ptr(this_ptr);
45213         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45214         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45215         this_ptr_conv.is_owned = false;
45216         LDKChannelId val_conv;
45217         val_conv.inner = untag_ptr(val);
45218         val_conv.is_owned = ptr_is_owned(val);
45219         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
45220         val_conv = ChannelId_clone(&val_conv);
45221         ChannelDetails_set_channel_id(&this_ptr_conv, val_conv);
45222 }
45223
45224 int64_t  CS_LDK_ChannelDetails_get_counterparty(int64_t this_ptr) {
45225         LDKChannelDetails this_ptr_conv;
45226         this_ptr_conv.inner = untag_ptr(this_ptr);
45227         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45228         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45229         this_ptr_conv.is_owned = false;
45230         LDKChannelCounterparty ret_var = ChannelDetails_get_counterparty(&this_ptr_conv);
45231         int64_t ret_ref = 0;
45232         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45233         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45234         return ret_ref;
45235 }
45236
45237 void  CS_LDK_ChannelDetails_set_counterparty(int64_t this_ptr, int64_t val) {
45238         LDKChannelDetails this_ptr_conv;
45239         this_ptr_conv.inner = untag_ptr(this_ptr);
45240         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45241         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45242         this_ptr_conv.is_owned = false;
45243         LDKChannelCounterparty val_conv;
45244         val_conv.inner = untag_ptr(val);
45245         val_conv.is_owned = ptr_is_owned(val);
45246         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
45247         val_conv = ChannelCounterparty_clone(&val_conv);
45248         ChannelDetails_set_counterparty(&this_ptr_conv, val_conv);
45249 }
45250
45251 int64_t  CS_LDK_ChannelDetails_get_funding_txo(int64_t this_ptr) {
45252         LDKChannelDetails 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         LDKOutPoint ret_var = ChannelDetails_get_funding_txo(&this_ptr_conv);
45258         int64_t ret_ref = 0;
45259         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45260         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45261         return ret_ref;
45262 }
45263
45264 void  CS_LDK_ChannelDetails_set_funding_txo(int64_t this_ptr, int64_t val) {
45265         LDKChannelDetails this_ptr_conv;
45266         this_ptr_conv.inner = untag_ptr(this_ptr);
45267         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45268         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45269         this_ptr_conv.is_owned = false;
45270         LDKOutPoint val_conv;
45271         val_conv.inner = untag_ptr(val);
45272         val_conv.is_owned = ptr_is_owned(val);
45273         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
45274         val_conv = OutPoint_clone(&val_conv);
45275         ChannelDetails_set_funding_txo(&this_ptr_conv, val_conv);
45276 }
45277
45278 int64_t  CS_LDK_ChannelDetails_get_channel_type(int64_t this_ptr) {
45279         LDKChannelDetails this_ptr_conv;
45280         this_ptr_conv.inner = untag_ptr(this_ptr);
45281         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45282         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45283         this_ptr_conv.is_owned = false;
45284         LDKChannelTypeFeatures ret_var = ChannelDetails_get_channel_type(&this_ptr_conv);
45285         int64_t ret_ref = 0;
45286         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45287         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45288         return ret_ref;
45289 }
45290
45291 void  CS_LDK_ChannelDetails_set_channel_type(int64_t this_ptr, int64_t val) {
45292         LDKChannelDetails this_ptr_conv;
45293         this_ptr_conv.inner = untag_ptr(this_ptr);
45294         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45295         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45296         this_ptr_conv.is_owned = false;
45297         LDKChannelTypeFeatures val_conv;
45298         val_conv.inner = untag_ptr(val);
45299         val_conv.is_owned = ptr_is_owned(val);
45300         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
45301         val_conv = ChannelTypeFeatures_clone(&val_conv);
45302         ChannelDetails_set_channel_type(&this_ptr_conv, val_conv);
45303 }
45304
45305 int64_t  CS_LDK_ChannelDetails_get_short_channel_id(int64_t this_ptr) {
45306         LDKChannelDetails this_ptr_conv;
45307         this_ptr_conv.inner = untag_ptr(this_ptr);
45308         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45309         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45310         this_ptr_conv.is_owned = false;
45311         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
45312         *ret_copy = ChannelDetails_get_short_channel_id(&this_ptr_conv);
45313         int64_t ret_ref = tag_ptr(ret_copy, true);
45314         return ret_ref;
45315 }
45316
45317 void  CS_LDK_ChannelDetails_set_short_channel_id(int64_t this_ptr, int64_t val) {
45318         LDKChannelDetails this_ptr_conv;
45319         this_ptr_conv.inner = untag_ptr(this_ptr);
45320         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45321         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45322         this_ptr_conv.is_owned = false;
45323         void* val_ptr = untag_ptr(val);
45324         CHECK_ACCESS(val_ptr);
45325         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
45326         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
45327         ChannelDetails_set_short_channel_id(&this_ptr_conv, val_conv);
45328 }
45329
45330 int64_t  CS_LDK_ChannelDetails_get_outbound_scid_alias(int64_t this_ptr) {
45331         LDKChannelDetails this_ptr_conv;
45332         this_ptr_conv.inner = untag_ptr(this_ptr);
45333         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45334         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45335         this_ptr_conv.is_owned = false;
45336         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
45337         *ret_copy = ChannelDetails_get_outbound_scid_alias(&this_ptr_conv);
45338         int64_t ret_ref = tag_ptr(ret_copy, true);
45339         return ret_ref;
45340 }
45341
45342 void  CS_LDK_ChannelDetails_set_outbound_scid_alias(int64_t this_ptr, int64_t val) {
45343         LDKChannelDetails this_ptr_conv;
45344         this_ptr_conv.inner = untag_ptr(this_ptr);
45345         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45346         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45347         this_ptr_conv.is_owned = false;
45348         void* val_ptr = untag_ptr(val);
45349         CHECK_ACCESS(val_ptr);
45350         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
45351         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
45352         ChannelDetails_set_outbound_scid_alias(&this_ptr_conv, val_conv);
45353 }
45354
45355 int64_t  CS_LDK_ChannelDetails_get_inbound_scid_alias(int64_t this_ptr) {
45356         LDKChannelDetails this_ptr_conv;
45357         this_ptr_conv.inner = untag_ptr(this_ptr);
45358         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45359         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45360         this_ptr_conv.is_owned = false;
45361         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
45362         *ret_copy = ChannelDetails_get_inbound_scid_alias(&this_ptr_conv);
45363         int64_t ret_ref = tag_ptr(ret_copy, true);
45364         return ret_ref;
45365 }
45366
45367 void  CS_LDK_ChannelDetails_set_inbound_scid_alias(int64_t this_ptr, int64_t val) {
45368         LDKChannelDetails this_ptr_conv;
45369         this_ptr_conv.inner = untag_ptr(this_ptr);
45370         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45371         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45372         this_ptr_conv.is_owned = false;
45373         void* val_ptr = untag_ptr(val);
45374         CHECK_ACCESS(val_ptr);
45375         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
45376         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
45377         ChannelDetails_set_inbound_scid_alias(&this_ptr_conv, val_conv);
45378 }
45379
45380 int64_t  CS_LDK_ChannelDetails_get_channel_value_satoshis(int64_t this_ptr) {
45381         LDKChannelDetails this_ptr_conv;
45382         this_ptr_conv.inner = untag_ptr(this_ptr);
45383         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45384         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45385         this_ptr_conv.is_owned = false;
45386         int64_t ret_conv = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
45387         return ret_conv;
45388 }
45389
45390 void  CS_LDK_ChannelDetails_set_channel_value_satoshis(int64_t this_ptr, int64_t val) {
45391         LDKChannelDetails this_ptr_conv;
45392         this_ptr_conv.inner = untag_ptr(this_ptr);
45393         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45394         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45395         this_ptr_conv.is_owned = false;
45396         ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
45397 }
45398
45399 int64_t  CS_LDK_ChannelDetails_get_unspendable_punishment_reserve(int64_t this_ptr) {
45400         LDKChannelDetails this_ptr_conv;
45401         this_ptr_conv.inner = untag_ptr(this_ptr);
45402         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45403         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45404         this_ptr_conv.is_owned = false;
45405         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
45406         *ret_copy = ChannelDetails_get_unspendable_punishment_reserve(&this_ptr_conv);
45407         int64_t ret_ref = tag_ptr(ret_copy, true);
45408         return ret_ref;
45409 }
45410
45411 void  CS_LDK_ChannelDetails_set_unspendable_punishment_reserve(int64_t this_ptr, int64_t val) {
45412         LDKChannelDetails this_ptr_conv;
45413         this_ptr_conv.inner = untag_ptr(this_ptr);
45414         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45415         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45416         this_ptr_conv.is_owned = false;
45417         void* val_ptr = untag_ptr(val);
45418         CHECK_ACCESS(val_ptr);
45419         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
45420         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
45421         ChannelDetails_set_unspendable_punishment_reserve(&this_ptr_conv, val_conv);
45422 }
45423
45424 int8_tArray  CS_LDK_ChannelDetails_get_user_channel_id(int64_t this_ptr) {
45425         LDKChannelDetails this_ptr_conv;
45426         this_ptr_conv.inner = untag_ptr(this_ptr);
45427         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45428         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45429         this_ptr_conv.is_owned = false;
45430         int8_tArray ret_arr = init_int8_tArray(16, __LINE__);
45431         memcpy(ret_arr->elems, ChannelDetails_get_user_channel_id(&this_ptr_conv).le_bytes, 16);
45432         return ret_arr;
45433 }
45434
45435 void  CS_LDK_ChannelDetails_set_user_channel_id(int64_t this_ptr, int8_tArray val) {
45436         LDKChannelDetails this_ptr_conv;
45437         this_ptr_conv.inner = untag_ptr(this_ptr);
45438         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45439         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45440         this_ptr_conv.is_owned = false;
45441         LDKU128 val_ref;
45442         CHECK(val->arr_len == 16);
45443         memcpy(val_ref.le_bytes, val->elems, 16); FREE(val);
45444         ChannelDetails_set_user_channel_id(&this_ptr_conv, val_ref);
45445 }
45446
45447 int64_t  CS_LDK_ChannelDetails_get_feerate_sat_per_1000_weight(int64_t this_ptr) {
45448         LDKChannelDetails this_ptr_conv;
45449         this_ptr_conv.inner = untag_ptr(this_ptr);
45450         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45451         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45452         this_ptr_conv.is_owned = false;
45453         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
45454         *ret_copy = ChannelDetails_get_feerate_sat_per_1000_weight(&this_ptr_conv);
45455         int64_t ret_ref = tag_ptr(ret_copy, true);
45456         return ret_ref;
45457 }
45458
45459 void  CS_LDK_ChannelDetails_set_feerate_sat_per_1000_weight(int64_t this_ptr, int64_t val) {
45460         LDKChannelDetails this_ptr_conv;
45461         this_ptr_conv.inner = untag_ptr(this_ptr);
45462         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45463         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45464         this_ptr_conv.is_owned = false;
45465         void* val_ptr = untag_ptr(val);
45466         CHECK_ACCESS(val_ptr);
45467         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
45468         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
45469         ChannelDetails_set_feerate_sat_per_1000_weight(&this_ptr_conv, val_conv);
45470 }
45471
45472 int64_t  CS_LDK_ChannelDetails_get_balance_msat(int64_t this_ptr) {
45473         LDKChannelDetails this_ptr_conv;
45474         this_ptr_conv.inner = untag_ptr(this_ptr);
45475         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45476         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45477         this_ptr_conv.is_owned = false;
45478         int64_t ret_conv = ChannelDetails_get_balance_msat(&this_ptr_conv);
45479         return ret_conv;
45480 }
45481
45482 void  CS_LDK_ChannelDetails_set_balance_msat(int64_t this_ptr, int64_t val) {
45483         LDKChannelDetails this_ptr_conv;
45484         this_ptr_conv.inner = untag_ptr(this_ptr);
45485         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45486         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45487         this_ptr_conv.is_owned = false;
45488         ChannelDetails_set_balance_msat(&this_ptr_conv, val);
45489 }
45490
45491 int64_t  CS_LDK_ChannelDetails_get_outbound_capacity_msat(int64_t this_ptr) {
45492         LDKChannelDetails this_ptr_conv;
45493         this_ptr_conv.inner = untag_ptr(this_ptr);
45494         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45495         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45496         this_ptr_conv.is_owned = false;
45497         int64_t ret_conv = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
45498         return ret_conv;
45499 }
45500
45501 void  CS_LDK_ChannelDetails_set_outbound_capacity_msat(int64_t this_ptr, int64_t val) {
45502         LDKChannelDetails this_ptr_conv;
45503         this_ptr_conv.inner = untag_ptr(this_ptr);
45504         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45505         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45506         this_ptr_conv.is_owned = false;
45507         ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
45508 }
45509
45510 int64_t  CS_LDK_ChannelDetails_get_next_outbound_htlc_limit_msat(int64_t this_ptr) {
45511         LDKChannelDetails this_ptr_conv;
45512         this_ptr_conv.inner = untag_ptr(this_ptr);
45513         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45514         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45515         this_ptr_conv.is_owned = false;
45516         int64_t ret_conv = ChannelDetails_get_next_outbound_htlc_limit_msat(&this_ptr_conv);
45517         return ret_conv;
45518 }
45519
45520 void  CS_LDK_ChannelDetails_set_next_outbound_htlc_limit_msat(int64_t this_ptr, int64_t val) {
45521         LDKChannelDetails this_ptr_conv;
45522         this_ptr_conv.inner = untag_ptr(this_ptr);
45523         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45524         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45525         this_ptr_conv.is_owned = false;
45526         ChannelDetails_set_next_outbound_htlc_limit_msat(&this_ptr_conv, val);
45527 }
45528
45529 int64_t  CS_LDK_ChannelDetails_get_next_outbound_htlc_minimum_msat(int64_t this_ptr) {
45530         LDKChannelDetails this_ptr_conv;
45531         this_ptr_conv.inner = untag_ptr(this_ptr);
45532         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45533         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45534         this_ptr_conv.is_owned = false;
45535         int64_t ret_conv = ChannelDetails_get_next_outbound_htlc_minimum_msat(&this_ptr_conv);
45536         return ret_conv;
45537 }
45538
45539 void  CS_LDK_ChannelDetails_set_next_outbound_htlc_minimum_msat(int64_t this_ptr, int64_t val) {
45540         LDKChannelDetails this_ptr_conv;
45541         this_ptr_conv.inner = untag_ptr(this_ptr);
45542         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45543         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45544         this_ptr_conv.is_owned = false;
45545         ChannelDetails_set_next_outbound_htlc_minimum_msat(&this_ptr_conv, val);
45546 }
45547
45548 int64_t  CS_LDK_ChannelDetails_get_inbound_capacity_msat(int64_t this_ptr) {
45549         LDKChannelDetails this_ptr_conv;
45550         this_ptr_conv.inner = untag_ptr(this_ptr);
45551         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45552         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45553         this_ptr_conv.is_owned = false;
45554         int64_t ret_conv = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
45555         return ret_conv;
45556 }
45557
45558 void  CS_LDK_ChannelDetails_set_inbound_capacity_msat(int64_t this_ptr, int64_t val) {
45559         LDKChannelDetails this_ptr_conv;
45560         this_ptr_conv.inner = untag_ptr(this_ptr);
45561         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45562         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45563         this_ptr_conv.is_owned = false;
45564         ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
45565 }
45566
45567 int64_t  CS_LDK_ChannelDetails_get_confirmations_required(int64_t this_ptr) {
45568         LDKChannelDetails this_ptr_conv;
45569         this_ptr_conv.inner = untag_ptr(this_ptr);
45570         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45571         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45572         this_ptr_conv.is_owned = false;
45573         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
45574         *ret_copy = ChannelDetails_get_confirmations_required(&this_ptr_conv);
45575         int64_t ret_ref = tag_ptr(ret_copy, true);
45576         return ret_ref;
45577 }
45578
45579 void  CS_LDK_ChannelDetails_set_confirmations_required(int64_t this_ptr, int64_t val) {
45580         LDKChannelDetails this_ptr_conv;
45581         this_ptr_conv.inner = untag_ptr(this_ptr);
45582         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45583         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45584         this_ptr_conv.is_owned = false;
45585         void* val_ptr = untag_ptr(val);
45586         CHECK_ACCESS(val_ptr);
45587         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
45588         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
45589         ChannelDetails_set_confirmations_required(&this_ptr_conv, val_conv);
45590 }
45591
45592 int64_t  CS_LDK_ChannelDetails_get_confirmations(int64_t this_ptr) {
45593         LDKChannelDetails this_ptr_conv;
45594         this_ptr_conv.inner = untag_ptr(this_ptr);
45595         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45596         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45597         this_ptr_conv.is_owned = false;
45598         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
45599         *ret_copy = ChannelDetails_get_confirmations(&this_ptr_conv);
45600         int64_t ret_ref = tag_ptr(ret_copy, true);
45601         return ret_ref;
45602 }
45603
45604 void  CS_LDK_ChannelDetails_set_confirmations(int64_t this_ptr, int64_t val) {
45605         LDKChannelDetails this_ptr_conv;
45606         this_ptr_conv.inner = untag_ptr(this_ptr);
45607         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45608         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45609         this_ptr_conv.is_owned = false;
45610         void* val_ptr = untag_ptr(val);
45611         CHECK_ACCESS(val_ptr);
45612         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
45613         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
45614         ChannelDetails_set_confirmations(&this_ptr_conv, val_conv);
45615 }
45616
45617 int64_t  CS_LDK_ChannelDetails_get_force_close_spend_delay(int64_t this_ptr) {
45618         LDKChannelDetails this_ptr_conv;
45619         this_ptr_conv.inner = untag_ptr(this_ptr);
45620         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45621         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45622         this_ptr_conv.is_owned = false;
45623         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
45624         *ret_copy = ChannelDetails_get_force_close_spend_delay(&this_ptr_conv);
45625         int64_t ret_ref = tag_ptr(ret_copy, true);
45626         return ret_ref;
45627 }
45628
45629 void  CS_LDK_ChannelDetails_set_force_close_spend_delay(int64_t this_ptr, int64_t val) {
45630         LDKChannelDetails this_ptr_conv;
45631         this_ptr_conv.inner = untag_ptr(this_ptr);
45632         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45633         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45634         this_ptr_conv.is_owned = false;
45635         void* val_ptr = untag_ptr(val);
45636         CHECK_ACCESS(val_ptr);
45637         LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(val_ptr);
45638         val_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(val));
45639         ChannelDetails_set_force_close_spend_delay(&this_ptr_conv, val_conv);
45640 }
45641
45642 jboolean  CS_LDK_ChannelDetails_get_is_outbound(int64_t this_ptr) {
45643         LDKChannelDetails this_ptr_conv;
45644         this_ptr_conv.inner = untag_ptr(this_ptr);
45645         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45646         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45647         this_ptr_conv.is_owned = false;
45648         jboolean ret_conv = ChannelDetails_get_is_outbound(&this_ptr_conv);
45649         return ret_conv;
45650 }
45651
45652 void  CS_LDK_ChannelDetails_set_is_outbound(int64_t this_ptr, jboolean val) {
45653         LDKChannelDetails this_ptr_conv;
45654         this_ptr_conv.inner = untag_ptr(this_ptr);
45655         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45656         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45657         this_ptr_conv.is_owned = false;
45658         ChannelDetails_set_is_outbound(&this_ptr_conv, val);
45659 }
45660
45661 jboolean  CS_LDK_ChannelDetails_get_is_channel_ready(int64_t this_ptr) {
45662         LDKChannelDetails this_ptr_conv;
45663         this_ptr_conv.inner = untag_ptr(this_ptr);
45664         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45665         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45666         this_ptr_conv.is_owned = false;
45667         jboolean ret_conv = ChannelDetails_get_is_channel_ready(&this_ptr_conv);
45668         return ret_conv;
45669 }
45670
45671 void  CS_LDK_ChannelDetails_set_is_channel_ready(int64_t this_ptr, jboolean val) {
45672         LDKChannelDetails this_ptr_conv;
45673         this_ptr_conv.inner = untag_ptr(this_ptr);
45674         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45675         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45676         this_ptr_conv.is_owned = false;
45677         ChannelDetails_set_is_channel_ready(&this_ptr_conv, val);
45678 }
45679
45680 int64_t  CS_LDK_ChannelDetails_get_channel_shutdown_state(int64_t this_ptr) {
45681         LDKChannelDetails this_ptr_conv;
45682         this_ptr_conv.inner = untag_ptr(this_ptr);
45683         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45684         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45685         this_ptr_conv.is_owned = false;
45686         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
45687         *ret_copy = ChannelDetails_get_channel_shutdown_state(&this_ptr_conv);
45688         int64_t ret_ref = tag_ptr(ret_copy, true);
45689         return ret_ref;
45690 }
45691
45692 void  CS_LDK_ChannelDetails_set_channel_shutdown_state(int64_t this_ptr, int64_t val) {
45693         LDKChannelDetails this_ptr_conv;
45694         this_ptr_conv.inner = untag_ptr(this_ptr);
45695         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45696         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45697         this_ptr_conv.is_owned = false;
45698         void* val_ptr = untag_ptr(val);
45699         CHECK_ACCESS(val_ptr);
45700         LDKCOption_ChannelShutdownStateZ val_conv = *(LDKCOption_ChannelShutdownStateZ*)(val_ptr);
45701         val_conv = COption_ChannelShutdownStateZ_clone((LDKCOption_ChannelShutdownStateZ*)untag_ptr(val));
45702         ChannelDetails_set_channel_shutdown_state(&this_ptr_conv, val_conv);
45703 }
45704
45705 jboolean  CS_LDK_ChannelDetails_get_is_usable(int64_t this_ptr) {
45706         LDKChannelDetails this_ptr_conv;
45707         this_ptr_conv.inner = untag_ptr(this_ptr);
45708         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45709         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45710         this_ptr_conv.is_owned = false;
45711         jboolean ret_conv = ChannelDetails_get_is_usable(&this_ptr_conv);
45712         return ret_conv;
45713 }
45714
45715 void  CS_LDK_ChannelDetails_set_is_usable(int64_t this_ptr, jboolean val) {
45716         LDKChannelDetails this_ptr_conv;
45717         this_ptr_conv.inner = untag_ptr(this_ptr);
45718         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45719         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45720         this_ptr_conv.is_owned = false;
45721         ChannelDetails_set_is_usable(&this_ptr_conv, val);
45722 }
45723
45724 jboolean  CS_LDK_ChannelDetails_get_is_public(int64_t this_ptr) {
45725         LDKChannelDetails this_ptr_conv;
45726         this_ptr_conv.inner = untag_ptr(this_ptr);
45727         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45728         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45729         this_ptr_conv.is_owned = false;
45730         jboolean ret_conv = ChannelDetails_get_is_public(&this_ptr_conv);
45731         return ret_conv;
45732 }
45733
45734 void  CS_LDK_ChannelDetails_set_is_public(int64_t this_ptr, jboolean val) {
45735         LDKChannelDetails this_ptr_conv;
45736         this_ptr_conv.inner = untag_ptr(this_ptr);
45737         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45738         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45739         this_ptr_conv.is_owned = false;
45740         ChannelDetails_set_is_public(&this_ptr_conv, val);
45741 }
45742
45743 int64_t  CS_LDK_ChannelDetails_get_inbound_htlc_minimum_msat(int64_t this_ptr) {
45744         LDKChannelDetails this_ptr_conv;
45745         this_ptr_conv.inner = untag_ptr(this_ptr);
45746         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45747         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45748         this_ptr_conv.is_owned = false;
45749         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
45750         *ret_copy = ChannelDetails_get_inbound_htlc_minimum_msat(&this_ptr_conv);
45751         int64_t ret_ref = tag_ptr(ret_copy, true);
45752         return ret_ref;
45753 }
45754
45755 void  CS_LDK_ChannelDetails_set_inbound_htlc_minimum_msat(int64_t this_ptr, int64_t val) {
45756         LDKChannelDetails this_ptr_conv;
45757         this_ptr_conv.inner = untag_ptr(this_ptr);
45758         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45759         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45760         this_ptr_conv.is_owned = false;
45761         void* val_ptr = untag_ptr(val);
45762         CHECK_ACCESS(val_ptr);
45763         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
45764         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
45765         ChannelDetails_set_inbound_htlc_minimum_msat(&this_ptr_conv, val_conv);
45766 }
45767
45768 int64_t  CS_LDK_ChannelDetails_get_inbound_htlc_maximum_msat(int64_t this_ptr) {
45769         LDKChannelDetails this_ptr_conv;
45770         this_ptr_conv.inner = untag_ptr(this_ptr);
45771         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45772         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45773         this_ptr_conv.is_owned = false;
45774         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
45775         *ret_copy = ChannelDetails_get_inbound_htlc_maximum_msat(&this_ptr_conv);
45776         int64_t ret_ref = tag_ptr(ret_copy, true);
45777         return ret_ref;
45778 }
45779
45780 void  CS_LDK_ChannelDetails_set_inbound_htlc_maximum_msat(int64_t this_ptr, int64_t val) {
45781         LDKChannelDetails this_ptr_conv;
45782         this_ptr_conv.inner = untag_ptr(this_ptr);
45783         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45784         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45785         this_ptr_conv.is_owned = false;
45786         void* val_ptr = untag_ptr(val);
45787         CHECK_ACCESS(val_ptr);
45788         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
45789         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
45790         ChannelDetails_set_inbound_htlc_maximum_msat(&this_ptr_conv, val_conv);
45791 }
45792
45793 int64_t  CS_LDK_ChannelDetails_get_config(int64_t this_ptr) {
45794         LDKChannelDetails this_ptr_conv;
45795         this_ptr_conv.inner = untag_ptr(this_ptr);
45796         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45797         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45798         this_ptr_conv.is_owned = false;
45799         LDKChannelConfig ret_var = ChannelDetails_get_config(&this_ptr_conv);
45800         int64_t ret_ref = 0;
45801         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45802         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45803         return ret_ref;
45804 }
45805
45806 void  CS_LDK_ChannelDetails_set_config(int64_t this_ptr, int64_t val) {
45807         LDKChannelDetails this_ptr_conv;
45808         this_ptr_conv.inner = untag_ptr(this_ptr);
45809         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45810         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45811         this_ptr_conv.is_owned = false;
45812         LDKChannelConfig val_conv;
45813         val_conv.inner = untag_ptr(val);
45814         val_conv.is_owned = ptr_is_owned(val);
45815         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
45816         val_conv = ChannelConfig_clone(&val_conv);
45817         ChannelDetails_set_config(&this_ptr_conv, val_conv);
45818 }
45819
45820 int64_tArray  CS_LDK_ChannelDetails_get_pending_inbound_htlcs(int64_t this_ptr) {
45821         LDKChannelDetails this_ptr_conv;
45822         this_ptr_conv.inner = untag_ptr(this_ptr);
45823         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45824         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45825         this_ptr_conv.is_owned = false;
45826         LDKCVec_InboundHTLCDetailsZ ret_var = ChannelDetails_get_pending_inbound_htlcs(&this_ptr_conv);
45827         int64_tArray ret_arr = NULL;
45828         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
45829         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
45830         for (size_t u = 0; u < ret_var.datalen; u++) {
45831                 LDKInboundHTLCDetails ret_conv_20_var = ret_var.data[u];
45832                 int64_t ret_conv_20_ref = 0;
45833                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_20_var);
45834                 ret_conv_20_ref = tag_ptr(ret_conv_20_var.inner, ret_conv_20_var.is_owned);
45835                 ret_arr_ptr[u] = ret_conv_20_ref;
45836         }
45837         
45838         FREE(ret_var.data);
45839         return ret_arr;
45840 }
45841
45842 void  CS_LDK_ChannelDetails_set_pending_inbound_htlcs(int64_t this_ptr, int64_tArray val) {
45843         LDKChannelDetails this_ptr_conv;
45844         this_ptr_conv.inner = untag_ptr(this_ptr);
45845         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45846         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45847         this_ptr_conv.is_owned = false;
45848         LDKCVec_InboundHTLCDetailsZ val_constr;
45849         val_constr.datalen = val->arr_len;
45850         if (val_constr.datalen > 0)
45851                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKInboundHTLCDetails), "LDKCVec_InboundHTLCDetailsZ Elements");
45852         else
45853                 val_constr.data = NULL;
45854         int64_t* val_vals = val->elems;
45855         for (size_t u = 0; u < val_constr.datalen; u++) {
45856                 int64_t val_conv_20 = val_vals[u];
45857                 LDKInboundHTLCDetails val_conv_20_conv;
45858                 val_conv_20_conv.inner = untag_ptr(val_conv_20);
45859                 val_conv_20_conv.is_owned = ptr_is_owned(val_conv_20);
45860                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_20_conv);
45861                 val_conv_20_conv = InboundHTLCDetails_clone(&val_conv_20_conv);
45862                 val_constr.data[u] = val_conv_20_conv;
45863         }
45864         FREE(val);
45865         ChannelDetails_set_pending_inbound_htlcs(&this_ptr_conv, val_constr);
45866 }
45867
45868 int64_tArray  CS_LDK_ChannelDetails_get_pending_outbound_htlcs(int64_t this_ptr) {
45869         LDKChannelDetails this_ptr_conv;
45870         this_ptr_conv.inner = untag_ptr(this_ptr);
45871         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45872         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45873         this_ptr_conv.is_owned = false;
45874         LDKCVec_OutboundHTLCDetailsZ ret_var = ChannelDetails_get_pending_outbound_htlcs(&this_ptr_conv);
45875         int64_tArray ret_arr = NULL;
45876         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
45877         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
45878         for (size_t v = 0; v < ret_var.datalen; v++) {
45879                 LDKOutboundHTLCDetails ret_conv_21_var = ret_var.data[v];
45880                 int64_t ret_conv_21_ref = 0;
45881                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_21_var);
45882                 ret_conv_21_ref = tag_ptr(ret_conv_21_var.inner, ret_conv_21_var.is_owned);
45883                 ret_arr_ptr[v] = ret_conv_21_ref;
45884         }
45885         
45886         FREE(ret_var.data);
45887         return ret_arr;
45888 }
45889
45890 void  CS_LDK_ChannelDetails_set_pending_outbound_htlcs(int64_t this_ptr, int64_tArray val) {
45891         LDKChannelDetails this_ptr_conv;
45892         this_ptr_conv.inner = untag_ptr(this_ptr);
45893         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45894         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45895         this_ptr_conv.is_owned = false;
45896         LDKCVec_OutboundHTLCDetailsZ val_constr;
45897         val_constr.datalen = val->arr_len;
45898         if (val_constr.datalen > 0)
45899                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKOutboundHTLCDetails), "LDKCVec_OutboundHTLCDetailsZ Elements");
45900         else
45901                 val_constr.data = NULL;
45902         int64_t* val_vals = val->elems;
45903         for (size_t v = 0; v < val_constr.datalen; v++) {
45904                 int64_t val_conv_21 = val_vals[v];
45905                 LDKOutboundHTLCDetails val_conv_21_conv;
45906                 val_conv_21_conv.inner = untag_ptr(val_conv_21);
45907                 val_conv_21_conv.is_owned = ptr_is_owned(val_conv_21);
45908                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_21_conv);
45909                 val_conv_21_conv = OutboundHTLCDetails_clone(&val_conv_21_conv);
45910                 val_constr.data[v] = val_conv_21_conv;
45911         }
45912         FREE(val);
45913         ChannelDetails_set_pending_outbound_htlcs(&this_ptr_conv, val_constr);
45914 }
45915
45916 int64_t  CS_LDK_ChannelDetails_new(int64_t 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, int64_tArray pending_inbound_htlcs_arg, int64_tArray pending_outbound_htlcs_arg) {
45917         LDKChannelId channel_id_arg_conv;
45918         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
45919         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
45920         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
45921         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
45922         LDKChannelCounterparty counterparty_arg_conv;
45923         counterparty_arg_conv.inner = untag_ptr(counterparty_arg);
45924         counterparty_arg_conv.is_owned = ptr_is_owned(counterparty_arg);
45925         CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_arg_conv);
45926         counterparty_arg_conv = ChannelCounterparty_clone(&counterparty_arg_conv);
45927         LDKOutPoint funding_txo_arg_conv;
45928         funding_txo_arg_conv.inner = untag_ptr(funding_txo_arg);
45929         funding_txo_arg_conv.is_owned = ptr_is_owned(funding_txo_arg);
45930         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_arg_conv);
45931         funding_txo_arg_conv = OutPoint_clone(&funding_txo_arg_conv);
45932         LDKChannelTypeFeatures channel_type_arg_conv;
45933         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
45934         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
45935         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
45936         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
45937         void* short_channel_id_arg_ptr = untag_ptr(short_channel_id_arg);
45938         CHECK_ACCESS(short_channel_id_arg_ptr);
45939         LDKCOption_u64Z short_channel_id_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_arg_ptr);
45940         short_channel_id_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id_arg));
45941         void* outbound_scid_alias_arg_ptr = untag_ptr(outbound_scid_alias_arg);
45942         CHECK_ACCESS(outbound_scid_alias_arg_ptr);
45943         LDKCOption_u64Z outbound_scid_alias_arg_conv = *(LDKCOption_u64Z*)(outbound_scid_alias_arg_ptr);
45944         outbound_scid_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_scid_alias_arg));
45945         void* inbound_scid_alias_arg_ptr = untag_ptr(inbound_scid_alias_arg);
45946         CHECK_ACCESS(inbound_scid_alias_arg_ptr);
45947         LDKCOption_u64Z inbound_scid_alias_arg_conv = *(LDKCOption_u64Z*)(inbound_scid_alias_arg_ptr);
45948         inbound_scid_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_scid_alias_arg));
45949         void* unspendable_punishment_reserve_arg_ptr = untag_ptr(unspendable_punishment_reserve_arg);
45950         CHECK_ACCESS(unspendable_punishment_reserve_arg_ptr);
45951         LDKCOption_u64Z unspendable_punishment_reserve_arg_conv = *(LDKCOption_u64Z*)(unspendable_punishment_reserve_arg_ptr);
45952         LDKU128 user_channel_id_arg_ref;
45953         CHECK(user_channel_id_arg->arr_len == 16);
45954         memcpy(user_channel_id_arg_ref.le_bytes, user_channel_id_arg->elems, 16); FREE(user_channel_id_arg);
45955         void* feerate_sat_per_1000_weight_arg_ptr = untag_ptr(feerate_sat_per_1000_weight_arg);
45956         CHECK_ACCESS(feerate_sat_per_1000_weight_arg_ptr);
45957         LDKCOption_u32Z feerate_sat_per_1000_weight_arg_conv = *(LDKCOption_u32Z*)(feerate_sat_per_1000_weight_arg_ptr);
45958         feerate_sat_per_1000_weight_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(feerate_sat_per_1000_weight_arg));
45959         void* confirmations_required_arg_ptr = untag_ptr(confirmations_required_arg);
45960         CHECK_ACCESS(confirmations_required_arg_ptr);
45961         LDKCOption_u32Z confirmations_required_arg_conv = *(LDKCOption_u32Z*)(confirmations_required_arg_ptr);
45962         confirmations_required_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(confirmations_required_arg));
45963         void* confirmations_arg_ptr = untag_ptr(confirmations_arg);
45964         CHECK_ACCESS(confirmations_arg_ptr);
45965         LDKCOption_u32Z confirmations_arg_conv = *(LDKCOption_u32Z*)(confirmations_arg_ptr);
45966         confirmations_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(confirmations_arg));
45967         void* force_close_spend_delay_arg_ptr = untag_ptr(force_close_spend_delay_arg);
45968         CHECK_ACCESS(force_close_spend_delay_arg_ptr);
45969         LDKCOption_u16Z force_close_spend_delay_arg_conv = *(LDKCOption_u16Z*)(force_close_spend_delay_arg_ptr);
45970         force_close_spend_delay_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(force_close_spend_delay_arg));
45971         void* channel_shutdown_state_arg_ptr = untag_ptr(channel_shutdown_state_arg);
45972         CHECK_ACCESS(channel_shutdown_state_arg_ptr);
45973         LDKCOption_ChannelShutdownStateZ channel_shutdown_state_arg_conv = *(LDKCOption_ChannelShutdownStateZ*)(channel_shutdown_state_arg_ptr);
45974         channel_shutdown_state_arg_conv = COption_ChannelShutdownStateZ_clone((LDKCOption_ChannelShutdownStateZ*)untag_ptr(channel_shutdown_state_arg));
45975         void* inbound_htlc_minimum_msat_arg_ptr = untag_ptr(inbound_htlc_minimum_msat_arg);
45976         CHECK_ACCESS(inbound_htlc_minimum_msat_arg_ptr);
45977         LDKCOption_u64Z inbound_htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(inbound_htlc_minimum_msat_arg_ptr);
45978         inbound_htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_htlc_minimum_msat_arg));
45979         void* inbound_htlc_maximum_msat_arg_ptr = untag_ptr(inbound_htlc_maximum_msat_arg);
45980         CHECK_ACCESS(inbound_htlc_maximum_msat_arg_ptr);
45981         LDKCOption_u64Z inbound_htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(inbound_htlc_maximum_msat_arg_ptr);
45982         inbound_htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_htlc_maximum_msat_arg));
45983         LDKChannelConfig config_arg_conv;
45984         config_arg_conv.inner = untag_ptr(config_arg);
45985         config_arg_conv.is_owned = ptr_is_owned(config_arg);
45986         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_arg_conv);
45987         config_arg_conv = ChannelConfig_clone(&config_arg_conv);
45988         LDKCVec_InboundHTLCDetailsZ pending_inbound_htlcs_arg_constr;
45989         pending_inbound_htlcs_arg_constr.datalen = pending_inbound_htlcs_arg->arr_len;
45990         if (pending_inbound_htlcs_arg_constr.datalen > 0)
45991                 pending_inbound_htlcs_arg_constr.data = MALLOC(pending_inbound_htlcs_arg_constr.datalen * sizeof(LDKInboundHTLCDetails), "LDKCVec_InboundHTLCDetailsZ Elements");
45992         else
45993                 pending_inbound_htlcs_arg_constr.data = NULL;
45994         int64_t* pending_inbound_htlcs_arg_vals = pending_inbound_htlcs_arg->elems;
45995         for (size_t u = 0; u < pending_inbound_htlcs_arg_constr.datalen; u++) {
45996                 int64_t pending_inbound_htlcs_arg_conv_20 = pending_inbound_htlcs_arg_vals[u];
45997                 LDKInboundHTLCDetails pending_inbound_htlcs_arg_conv_20_conv;
45998                 pending_inbound_htlcs_arg_conv_20_conv.inner = untag_ptr(pending_inbound_htlcs_arg_conv_20);
45999                 pending_inbound_htlcs_arg_conv_20_conv.is_owned = ptr_is_owned(pending_inbound_htlcs_arg_conv_20);
46000                 CHECK_INNER_FIELD_ACCESS_OR_NULL(pending_inbound_htlcs_arg_conv_20_conv);
46001                 pending_inbound_htlcs_arg_conv_20_conv = InboundHTLCDetails_clone(&pending_inbound_htlcs_arg_conv_20_conv);
46002                 pending_inbound_htlcs_arg_constr.data[u] = pending_inbound_htlcs_arg_conv_20_conv;
46003         }
46004         FREE(pending_inbound_htlcs_arg);
46005         LDKCVec_OutboundHTLCDetailsZ pending_outbound_htlcs_arg_constr;
46006         pending_outbound_htlcs_arg_constr.datalen = pending_outbound_htlcs_arg->arr_len;
46007         if (pending_outbound_htlcs_arg_constr.datalen > 0)
46008                 pending_outbound_htlcs_arg_constr.data = MALLOC(pending_outbound_htlcs_arg_constr.datalen * sizeof(LDKOutboundHTLCDetails), "LDKCVec_OutboundHTLCDetailsZ Elements");
46009         else
46010                 pending_outbound_htlcs_arg_constr.data = NULL;
46011         int64_t* pending_outbound_htlcs_arg_vals = pending_outbound_htlcs_arg->elems;
46012         for (size_t v = 0; v < pending_outbound_htlcs_arg_constr.datalen; v++) {
46013                 int64_t pending_outbound_htlcs_arg_conv_21 = pending_outbound_htlcs_arg_vals[v];
46014                 LDKOutboundHTLCDetails pending_outbound_htlcs_arg_conv_21_conv;
46015                 pending_outbound_htlcs_arg_conv_21_conv.inner = untag_ptr(pending_outbound_htlcs_arg_conv_21);
46016                 pending_outbound_htlcs_arg_conv_21_conv.is_owned = ptr_is_owned(pending_outbound_htlcs_arg_conv_21);
46017                 CHECK_INNER_FIELD_ACCESS_OR_NULL(pending_outbound_htlcs_arg_conv_21_conv);
46018                 pending_outbound_htlcs_arg_conv_21_conv = OutboundHTLCDetails_clone(&pending_outbound_htlcs_arg_conv_21_conv);
46019                 pending_outbound_htlcs_arg_constr.data[v] = pending_outbound_htlcs_arg_conv_21_conv;
46020         }
46021         FREE(pending_outbound_htlcs_arg);
46022         LDKChannelDetails ret_var = ChannelDetails_new(channel_id_arg_conv, 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, pending_inbound_htlcs_arg_constr, pending_outbound_htlcs_arg_constr);
46023         int64_t ret_ref = 0;
46024         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46025         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46026         return ret_ref;
46027 }
46028
46029 static inline uint64_t ChannelDetails_clone_ptr(LDKChannelDetails *NONNULL_PTR arg) {
46030         LDKChannelDetails ret_var = ChannelDetails_clone(arg);
46031         int64_t ret_ref = 0;
46032         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46033         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46034         return ret_ref;
46035 }
46036 int64_t  CS_LDK_ChannelDetails_clone_ptr(int64_t arg) {
46037         LDKChannelDetails arg_conv;
46038         arg_conv.inner = untag_ptr(arg);
46039         arg_conv.is_owned = ptr_is_owned(arg);
46040         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46041         arg_conv.is_owned = false;
46042         int64_t ret_conv = ChannelDetails_clone_ptr(&arg_conv);
46043         return ret_conv;
46044 }
46045
46046 int64_t  CS_LDK_ChannelDetails_clone(int64_t orig) {
46047         LDKChannelDetails orig_conv;
46048         orig_conv.inner = untag_ptr(orig);
46049         orig_conv.is_owned = ptr_is_owned(orig);
46050         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46051         orig_conv.is_owned = false;
46052         LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
46053         int64_t ret_ref = 0;
46054         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46055         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46056         return ret_ref;
46057 }
46058
46059 int64_t  CS_LDK_ChannelDetails_get_inbound_payment_scid(int64_t this_arg) {
46060         LDKChannelDetails this_arg_conv;
46061         this_arg_conv.inner = untag_ptr(this_arg);
46062         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46063         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46064         this_arg_conv.is_owned = false;
46065         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
46066         *ret_copy = ChannelDetails_get_inbound_payment_scid(&this_arg_conv);
46067         int64_t ret_ref = tag_ptr(ret_copy, true);
46068         return ret_ref;
46069 }
46070
46071 int64_t  CS_LDK_ChannelDetails_get_outbound_payment_scid(int64_t this_arg) {
46072         LDKChannelDetails this_arg_conv;
46073         this_arg_conv.inner = untag_ptr(this_arg);
46074         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46075         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46076         this_arg_conv.is_owned = false;
46077         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
46078         *ret_copy = ChannelDetails_get_outbound_payment_scid(&this_arg_conv);
46079         int64_t ret_ref = tag_ptr(ret_copy, true);
46080         return ret_ref;
46081 }
46082
46083 int8_tArray  CS_LDK_ChannelDetails_write(int64_t obj) {
46084         LDKChannelDetails obj_conv;
46085         obj_conv.inner = untag_ptr(obj);
46086         obj_conv.is_owned = ptr_is_owned(obj);
46087         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46088         obj_conv.is_owned = false;
46089         LDKCVec_u8Z ret_var = ChannelDetails_write(&obj_conv);
46090         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
46091         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
46092         CVec_u8Z_free(ret_var);
46093         return ret_arr;
46094 }
46095
46096 int64_t  CS_LDK_ChannelDetails_read(int8_tArray ser) {
46097         LDKu8slice ser_ref;
46098         ser_ref.datalen = ser->arr_len;
46099         ser_ref.data = ser->elems;
46100         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
46101         *ret_conv = ChannelDetails_read(ser_ref);
46102         FREE(ser);
46103         return tag_ptr(ret_conv, true);
46104 }
46105
46106 int32_t  CS_LDK_ChannelShutdownState_clone(int64_t orig) {
46107         LDKChannelShutdownState* orig_conv = (LDKChannelShutdownState*)untag_ptr(orig);
46108         int32_t ret_conv = LDKChannelShutdownState_to_cs(ChannelShutdownState_clone(orig_conv));
46109         return ret_conv;
46110 }
46111
46112 int32_t  CS_LDK_ChannelShutdownState_not_shutting_down() {
46113         int32_t ret_conv = LDKChannelShutdownState_to_cs(ChannelShutdownState_not_shutting_down());
46114         return ret_conv;
46115 }
46116
46117 int32_t  CS_LDK_ChannelShutdownState_shutdown_initiated() {
46118         int32_t ret_conv = LDKChannelShutdownState_to_cs(ChannelShutdownState_shutdown_initiated());
46119         return ret_conv;
46120 }
46121
46122 int32_t  CS_LDK_ChannelShutdownState_resolving_htlcs() {
46123         int32_t ret_conv = LDKChannelShutdownState_to_cs(ChannelShutdownState_resolving_htlcs());
46124         return ret_conv;
46125 }
46126
46127 int32_t  CS_LDK_ChannelShutdownState_negotiating_closing_fee() {
46128         int32_t ret_conv = LDKChannelShutdownState_to_cs(ChannelShutdownState_negotiating_closing_fee());
46129         return ret_conv;
46130 }
46131
46132 int32_t  CS_LDK_ChannelShutdownState_shutdown_complete() {
46133         int32_t ret_conv = LDKChannelShutdownState_to_cs(ChannelShutdownState_shutdown_complete());
46134         return ret_conv;
46135 }
46136
46137 jboolean  CS_LDK_ChannelShutdownState_eq(int64_t a, int64_t b) {
46138         LDKChannelShutdownState* a_conv = (LDKChannelShutdownState*)untag_ptr(a);
46139         LDKChannelShutdownState* b_conv = (LDKChannelShutdownState*)untag_ptr(b);
46140         jboolean ret_conv = ChannelShutdownState_eq(a_conv, b_conv);
46141         return ret_conv;
46142 }
46143
46144 int8_tArray  CS_LDK_ChannelShutdownState_write(int64_t obj) {
46145         LDKChannelShutdownState* obj_conv = (LDKChannelShutdownState*)untag_ptr(obj);
46146         LDKCVec_u8Z ret_var = ChannelShutdownState_write(obj_conv);
46147         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
46148         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
46149         CVec_u8Z_free(ret_var);
46150         return ret_arr;
46151 }
46152
46153 int64_t  CS_LDK_ChannelShutdownState_read(int8_tArray ser) {
46154         LDKu8slice ser_ref;
46155         ser_ref.datalen = ser->arr_len;
46156         ser_ref.data = ser->elems;
46157         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
46158         *ret_conv = ChannelShutdownState_read(ser_ref);
46159         FREE(ser);
46160         return tag_ptr(ret_conv, true);
46161 }
46162
46163 void  CS_LDK_ExpandedKey_free(int64_t this_obj) {
46164         LDKExpandedKey this_obj_conv;
46165         this_obj_conv.inner = untag_ptr(this_obj);
46166         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46167         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46168         ExpandedKey_free(this_obj_conv);
46169 }
46170
46171 int64_t  CS_LDK_ExpandedKey_new(int8_tArray key_material) {
46172         uint8_t key_material_arr[32];
46173         CHECK(key_material->arr_len == 32);
46174         memcpy(key_material_arr, key_material->elems, 32); FREE(key_material);
46175         uint8_t (*key_material_ref)[32] = &key_material_arr;
46176         LDKExpandedKey ret_var = ExpandedKey_new(key_material_ref);
46177         int64_t ret_ref = 0;
46178         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46179         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46180         return ret_ref;
46181 }
46182
46183 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) {
46184         LDKExpandedKey keys_conv;
46185         keys_conv.inner = untag_ptr(keys);
46186         keys_conv.is_owned = ptr_is_owned(keys);
46187         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
46188         keys_conv.is_owned = false;
46189         void* min_value_msat_ptr = untag_ptr(min_value_msat);
46190         CHECK_ACCESS(min_value_msat_ptr);
46191         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
46192         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
46193         void* entropy_source_ptr = untag_ptr(entropy_source);
46194         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
46195         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
46196         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
46197         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
46198         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
46199         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
46200         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
46201         *ret_conv = create(&keys_conv, min_value_msat_conv, invoice_expiry_delta_secs, entropy_source_conv, current_time, min_final_cltv_expiry_delta_conv);
46202         return tag_ptr(ret_conv, true);
46203 }
46204
46205 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) {
46206         LDKExpandedKey keys_conv;
46207         keys_conv.inner = untag_ptr(keys);
46208         keys_conv.is_owned = ptr_is_owned(keys);
46209         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
46210         keys_conv.is_owned = false;
46211         void* min_value_msat_ptr = untag_ptr(min_value_msat);
46212         CHECK_ACCESS(min_value_msat_ptr);
46213         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
46214         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
46215         LDKThirtyTwoBytes payment_hash_ref;
46216         CHECK(payment_hash->arr_len == 32);
46217         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
46218         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
46219         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
46220         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
46221         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
46222         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
46223         *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);
46224         return tag_ptr(ret_conv, true);
46225 }
46226
46227 void  CS_LDK_DecodeError_free(int64_t this_ptr) {
46228         if (!ptr_is_owned(this_ptr)) return;
46229         void* this_ptr_ptr = untag_ptr(this_ptr);
46230         CHECK_ACCESS(this_ptr_ptr);
46231         LDKDecodeError this_ptr_conv = *(LDKDecodeError*)(this_ptr_ptr);
46232         FREE(untag_ptr(this_ptr));
46233         DecodeError_free(this_ptr_conv);
46234 }
46235
46236 static inline uint64_t DecodeError_clone_ptr(LDKDecodeError *NONNULL_PTR arg) {
46237         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
46238         *ret_copy = DecodeError_clone(arg);
46239         int64_t ret_ref = tag_ptr(ret_copy, true);
46240         return ret_ref;
46241 }
46242 int64_t  CS_LDK_DecodeError_clone_ptr(int64_t arg) {
46243         LDKDecodeError* arg_conv = (LDKDecodeError*)untag_ptr(arg);
46244         int64_t ret_conv = DecodeError_clone_ptr(arg_conv);
46245         return ret_conv;
46246 }
46247
46248 int64_t  CS_LDK_DecodeError_clone(int64_t orig) {
46249         LDKDecodeError* orig_conv = (LDKDecodeError*)untag_ptr(orig);
46250         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
46251         *ret_copy = DecodeError_clone(orig_conv);
46252         int64_t ret_ref = tag_ptr(ret_copy, true);
46253         return ret_ref;
46254 }
46255
46256 int64_t  CS_LDK_DecodeError_unknown_version() {
46257         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
46258         *ret_copy = DecodeError_unknown_version();
46259         int64_t ret_ref = tag_ptr(ret_copy, true);
46260         return ret_ref;
46261 }
46262
46263 int64_t  CS_LDK_DecodeError_unknown_required_feature() {
46264         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
46265         *ret_copy = DecodeError_unknown_required_feature();
46266         int64_t ret_ref = tag_ptr(ret_copy, true);
46267         return ret_ref;
46268 }
46269
46270 int64_t  CS_LDK_DecodeError_invalid_value() {
46271         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
46272         *ret_copy = DecodeError_invalid_value();
46273         int64_t ret_ref = tag_ptr(ret_copy, true);
46274         return ret_ref;
46275 }
46276
46277 int64_t  CS_LDK_DecodeError_short_read() {
46278         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
46279         *ret_copy = DecodeError_short_read();
46280         int64_t ret_ref = tag_ptr(ret_copy, true);
46281         return ret_ref;
46282 }
46283
46284 int64_t  CS_LDK_DecodeError_bad_length_descriptor() {
46285         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
46286         *ret_copy = DecodeError_bad_length_descriptor();
46287         int64_t ret_ref = tag_ptr(ret_copy, true);
46288         return ret_ref;
46289 }
46290
46291 int64_t  CS_LDK_DecodeError_io(int32_t a) {
46292         LDKIOError a_conv = LDKIOError_from_cs(a);
46293         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
46294         *ret_copy = DecodeError_io(a_conv);
46295         int64_t ret_ref = tag_ptr(ret_copy, true);
46296         return ret_ref;
46297 }
46298
46299 int64_t  CS_LDK_DecodeError_unsupported_compression() {
46300         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
46301         *ret_copy = DecodeError_unsupported_compression();
46302         int64_t ret_ref = tag_ptr(ret_copy, true);
46303         return ret_ref;
46304 }
46305
46306 int64_t  CS_LDK_DecodeError_dangerous_value() {
46307         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
46308         *ret_copy = DecodeError_dangerous_value();
46309         int64_t ret_ref = tag_ptr(ret_copy, true);
46310         return ret_ref;
46311 }
46312
46313 int64_t  CS_LDK_DecodeError_hash(int64_t o) {
46314         LDKDecodeError* o_conv = (LDKDecodeError*)untag_ptr(o);
46315         int64_t ret_conv = DecodeError_hash(o_conv);
46316         return ret_conv;
46317 }
46318
46319 jboolean  CS_LDK_DecodeError_eq(int64_t a, int64_t b) {
46320         LDKDecodeError* a_conv = (LDKDecodeError*)untag_ptr(a);
46321         LDKDecodeError* b_conv = (LDKDecodeError*)untag_ptr(b);
46322         jboolean ret_conv = DecodeError_eq(a_conv, b_conv);
46323         return ret_conv;
46324 }
46325
46326 void  CS_LDK_Init_free(int64_t this_obj) {
46327         LDKInit this_obj_conv;
46328         this_obj_conv.inner = untag_ptr(this_obj);
46329         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46330         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46331         Init_free(this_obj_conv);
46332 }
46333
46334 int64_t  CS_LDK_Init_get_features(int64_t this_ptr) {
46335         LDKInit this_ptr_conv;
46336         this_ptr_conv.inner = untag_ptr(this_ptr);
46337         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46338         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46339         this_ptr_conv.is_owned = false;
46340         LDKInitFeatures ret_var = Init_get_features(&this_ptr_conv);
46341         int64_t ret_ref = 0;
46342         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46343         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46344         return ret_ref;
46345 }
46346
46347 void  CS_LDK_Init_set_features(int64_t this_ptr, int64_t val) {
46348         LDKInit this_ptr_conv;
46349         this_ptr_conv.inner = untag_ptr(this_ptr);
46350         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46351         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46352         this_ptr_conv.is_owned = false;
46353         LDKInitFeatures val_conv;
46354         val_conv.inner = untag_ptr(val);
46355         val_conv.is_owned = ptr_is_owned(val);
46356         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
46357         val_conv = InitFeatures_clone(&val_conv);
46358         Init_set_features(&this_ptr_conv, val_conv);
46359 }
46360
46361 int64_t  CS_LDK_Init_get_networks(int64_t this_ptr) {
46362         LDKInit this_ptr_conv;
46363         this_ptr_conv.inner = untag_ptr(this_ptr);
46364         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46365         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46366         this_ptr_conv.is_owned = false;
46367         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
46368         *ret_copy = Init_get_networks(&this_ptr_conv);
46369         int64_t ret_ref = tag_ptr(ret_copy, true);
46370         return ret_ref;
46371 }
46372
46373 void  CS_LDK_Init_set_networks(int64_t this_ptr, int64_t val) {
46374         LDKInit this_ptr_conv;
46375         this_ptr_conv.inner = untag_ptr(this_ptr);
46376         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46377         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46378         this_ptr_conv.is_owned = false;
46379         void* val_ptr = untag_ptr(val);
46380         CHECK_ACCESS(val_ptr);
46381         LDKCOption_CVec_ThirtyTwoBytesZZ val_conv = *(LDKCOption_CVec_ThirtyTwoBytesZZ*)(val_ptr);
46382         val_conv = COption_CVec_ThirtyTwoBytesZZ_clone((LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(val));
46383         Init_set_networks(&this_ptr_conv, val_conv);
46384 }
46385
46386 int64_t  CS_LDK_Init_get_remote_network_address(int64_t this_ptr) {
46387         LDKInit 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         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
46393         *ret_copy = Init_get_remote_network_address(&this_ptr_conv);
46394         int64_t ret_ref = tag_ptr(ret_copy, true);
46395         return ret_ref;
46396 }
46397
46398 void  CS_LDK_Init_set_remote_network_address(int64_t this_ptr, int64_t val) {
46399         LDKInit this_ptr_conv;
46400         this_ptr_conv.inner = untag_ptr(this_ptr);
46401         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46402         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46403         this_ptr_conv.is_owned = false;
46404         void* val_ptr = untag_ptr(val);
46405         CHECK_ACCESS(val_ptr);
46406         LDKCOption_SocketAddressZ val_conv = *(LDKCOption_SocketAddressZ*)(val_ptr);
46407         val_conv = COption_SocketAddressZ_clone((LDKCOption_SocketAddressZ*)untag_ptr(val));
46408         Init_set_remote_network_address(&this_ptr_conv, val_conv);
46409 }
46410
46411 int64_t  CS_LDK_Init_new(int64_t features_arg, int64_t networks_arg, int64_t remote_network_address_arg) {
46412         LDKInitFeatures features_arg_conv;
46413         features_arg_conv.inner = untag_ptr(features_arg);
46414         features_arg_conv.is_owned = ptr_is_owned(features_arg);
46415         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
46416         features_arg_conv = InitFeatures_clone(&features_arg_conv);
46417         void* networks_arg_ptr = untag_ptr(networks_arg);
46418         CHECK_ACCESS(networks_arg_ptr);
46419         LDKCOption_CVec_ThirtyTwoBytesZZ networks_arg_conv = *(LDKCOption_CVec_ThirtyTwoBytesZZ*)(networks_arg_ptr);
46420         networks_arg_conv = COption_CVec_ThirtyTwoBytesZZ_clone((LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(networks_arg));
46421         void* remote_network_address_arg_ptr = untag_ptr(remote_network_address_arg);
46422         CHECK_ACCESS(remote_network_address_arg_ptr);
46423         LDKCOption_SocketAddressZ remote_network_address_arg_conv = *(LDKCOption_SocketAddressZ*)(remote_network_address_arg_ptr);
46424         LDKInit ret_var = Init_new(features_arg_conv, networks_arg_conv, remote_network_address_arg_conv);
46425         int64_t ret_ref = 0;
46426         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46427         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46428         return ret_ref;
46429 }
46430
46431 static inline uint64_t Init_clone_ptr(LDKInit *NONNULL_PTR arg) {
46432         LDKInit ret_var = Init_clone(arg);
46433         int64_t ret_ref = 0;
46434         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46435         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46436         return ret_ref;
46437 }
46438 int64_t  CS_LDK_Init_clone_ptr(int64_t arg) {
46439         LDKInit arg_conv;
46440         arg_conv.inner = untag_ptr(arg);
46441         arg_conv.is_owned = ptr_is_owned(arg);
46442         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46443         arg_conv.is_owned = false;
46444         int64_t ret_conv = Init_clone_ptr(&arg_conv);
46445         return ret_conv;
46446 }
46447
46448 int64_t  CS_LDK_Init_clone(int64_t orig) {
46449         LDKInit orig_conv;
46450         orig_conv.inner = untag_ptr(orig);
46451         orig_conv.is_owned = ptr_is_owned(orig);
46452         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46453         orig_conv.is_owned = false;
46454         LDKInit ret_var = Init_clone(&orig_conv);
46455         int64_t ret_ref = 0;
46456         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46457         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46458         return ret_ref;
46459 }
46460
46461 int64_t  CS_LDK_Init_hash(int64_t o) {
46462         LDKInit o_conv;
46463         o_conv.inner = untag_ptr(o);
46464         o_conv.is_owned = ptr_is_owned(o);
46465         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46466         o_conv.is_owned = false;
46467         int64_t ret_conv = Init_hash(&o_conv);
46468         return ret_conv;
46469 }
46470
46471 jboolean  CS_LDK_Init_eq(int64_t a, int64_t b) {
46472         LDKInit a_conv;
46473         a_conv.inner = untag_ptr(a);
46474         a_conv.is_owned = ptr_is_owned(a);
46475         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46476         a_conv.is_owned = false;
46477         LDKInit b_conv;
46478         b_conv.inner = untag_ptr(b);
46479         b_conv.is_owned = ptr_is_owned(b);
46480         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46481         b_conv.is_owned = false;
46482         jboolean ret_conv = Init_eq(&a_conv, &b_conv);
46483         return ret_conv;
46484 }
46485
46486 void  CS_LDK_ErrorMessage_free(int64_t this_obj) {
46487         LDKErrorMessage this_obj_conv;
46488         this_obj_conv.inner = untag_ptr(this_obj);
46489         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46490         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46491         ErrorMessage_free(this_obj_conv);
46492 }
46493
46494 int64_t  CS_LDK_ErrorMessage_get_channel_id(int64_t this_ptr) {
46495         LDKErrorMessage this_ptr_conv;
46496         this_ptr_conv.inner = untag_ptr(this_ptr);
46497         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46498         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46499         this_ptr_conv.is_owned = false;
46500         LDKChannelId ret_var = ErrorMessage_get_channel_id(&this_ptr_conv);
46501         int64_t ret_ref = 0;
46502         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46503         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46504         return ret_ref;
46505 }
46506
46507 void  CS_LDK_ErrorMessage_set_channel_id(int64_t this_ptr, int64_t val) {
46508         LDKErrorMessage this_ptr_conv;
46509         this_ptr_conv.inner = untag_ptr(this_ptr);
46510         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46511         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46512         this_ptr_conv.is_owned = false;
46513         LDKChannelId val_conv;
46514         val_conv.inner = untag_ptr(val);
46515         val_conv.is_owned = ptr_is_owned(val);
46516         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
46517         val_conv = ChannelId_clone(&val_conv);
46518         ErrorMessage_set_channel_id(&this_ptr_conv, val_conv);
46519 }
46520
46521 jstring  CS_LDK_ErrorMessage_get_data(int64_t this_ptr) {
46522         LDKErrorMessage this_ptr_conv;
46523         this_ptr_conv.inner = untag_ptr(this_ptr);
46524         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46525         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46526         this_ptr_conv.is_owned = false;
46527         LDKStr ret_str = ErrorMessage_get_data(&this_ptr_conv);
46528         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
46529         Str_free(ret_str);
46530         return ret_conv;
46531 }
46532
46533 void  CS_LDK_ErrorMessage_set_data(int64_t this_ptr, jstring val) {
46534         LDKErrorMessage this_ptr_conv;
46535         this_ptr_conv.inner = untag_ptr(this_ptr);
46536         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46537         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46538         this_ptr_conv.is_owned = false;
46539         LDKStr val_conv = str_ref_to_owned_c(val);
46540         ErrorMessage_set_data(&this_ptr_conv, val_conv);
46541 }
46542
46543 int64_t  CS_LDK_ErrorMessage_new(int64_t channel_id_arg, jstring data_arg) {
46544         LDKChannelId channel_id_arg_conv;
46545         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
46546         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
46547         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
46548         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
46549         LDKStr data_arg_conv = str_ref_to_owned_c(data_arg);
46550         LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_conv, data_arg_conv);
46551         int64_t ret_ref = 0;
46552         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46553         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46554         return ret_ref;
46555 }
46556
46557 static inline uint64_t ErrorMessage_clone_ptr(LDKErrorMessage *NONNULL_PTR arg) {
46558         LDKErrorMessage ret_var = ErrorMessage_clone(arg);
46559         int64_t ret_ref = 0;
46560         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46561         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46562         return ret_ref;
46563 }
46564 int64_t  CS_LDK_ErrorMessage_clone_ptr(int64_t arg) {
46565         LDKErrorMessage arg_conv;
46566         arg_conv.inner = untag_ptr(arg);
46567         arg_conv.is_owned = ptr_is_owned(arg);
46568         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46569         arg_conv.is_owned = false;
46570         int64_t ret_conv = ErrorMessage_clone_ptr(&arg_conv);
46571         return ret_conv;
46572 }
46573
46574 int64_t  CS_LDK_ErrorMessage_clone(int64_t orig) {
46575         LDKErrorMessage orig_conv;
46576         orig_conv.inner = untag_ptr(orig);
46577         orig_conv.is_owned = ptr_is_owned(orig);
46578         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46579         orig_conv.is_owned = false;
46580         LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
46581         int64_t ret_ref = 0;
46582         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46583         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46584         return ret_ref;
46585 }
46586
46587 int64_t  CS_LDK_ErrorMessage_hash(int64_t o) {
46588         LDKErrorMessage o_conv;
46589         o_conv.inner = untag_ptr(o);
46590         o_conv.is_owned = ptr_is_owned(o);
46591         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46592         o_conv.is_owned = false;
46593         int64_t ret_conv = ErrorMessage_hash(&o_conv);
46594         return ret_conv;
46595 }
46596
46597 jboolean  CS_LDK_ErrorMessage_eq(int64_t a, int64_t b) {
46598         LDKErrorMessage a_conv;
46599         a_conv.inner = untag_ptr(a);
46600         a_conv.is_owned = ptr_is_owned(a);
46601         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46602         a_conv.is_owned = false;
46603         LDKErrorMessage b_conv;
46604         b_conv.inner = untag_ptr(b);
46605         b_conv.is_owned = ptr_is_owned(b);
46606         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46607         b_conv.is_owned = false;
46608         jboolean ret_conv = ErrorMessage_eq(&a_conv, &b_conv);
46609         return ret_conv;
46610 }
46611
46612 void  CS_LDK_WarningMessage_free(int64_t this_obj) {
46613         LDKWarningMessage this_obj_conv;
46614         this_obj_conv.inner = untag_ptr(this_obj);
46615         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46616         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46617         WarningMessage_free(this_obj_conv);
46618 }
46619
46620 int64_t  CS_LDK_WarningMessage_get_channel_id(int64_t this_ptr) {
46621         LDKWarningMessage this_ptr_conv;
46622         this_ptr_conv.inner = untag_ptr(this_ptr);
46623         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46624         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46625         this_ptr_conv.is_owned = false;
46626         LDKChannelId ret_var = WarningMessage_get_channel_id(&this_ptr_conv);
46627         int64_t ret_ref = 0;
46628         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46629         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46630         return ret_ref;
46631 }
46632
46633 void  CS_LDK_WarningMessage_set_channel_id(int64_t this_ptr, int64_t val) {
46634         LDKWarningMessage this_ptr_conv;
46635         this_ptr_conv.inner = untag_ptr(this_ptr);
46636         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46637         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46638         this_ptr_conv.is_owned = false;
46639         LDKChannelId val_conv;
46640         val_conv.inner = untag_ptr(val);
46641         val_conv.is_owned = ptr_is_owned(val);
46642         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
46643         val_conv = ChannelId_clone(&val_conv);
46644         WarningMessage_set_channel_id(&this_ptr_conv, val_conv);
46645 }
46646
46647 jstring  CS_LDK_WarningMessage_get_data(int64_t this_ptr) {
46648         LDKWarningMessage this_ptr_conv;
46649         this_ptr_conv.inner = untag_ptr(this_ptr);
46650         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46651         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46652         this_ptr_conv.is_owned = false;
46653         LDKStr ret_str = WarningMessage_get_data(&this_ptr_conv);
46654         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
46655         Str_free(ret_str);
46656         return ret_conv;
46657 }
46658
46659 void  CS_LDK_WarningMessage_set_data(int64_t this_ptr, jstring val) {
46660         LDKWarningMessage this_ptr_conv;
46661         this_ptr_conv.inner = untag_ptr(this_ptr);
46662         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46663         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46664         this_ptr_conv.is_owned = false;
46665         LDKStr val_conv = str_ref_to_owned_c(val);
46666         WarningMessage_set_data(&this_ptr_conv, val_conv);
46667 }
46668
46669 int64_t  CS_LDK_WarningMessage_new(int64_t channel_id_arg, jstring data_arg) {
46670         LDKChannelId channel_id_arg_conv;
46671         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
46672         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
46673         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
46674         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
46675         LDKStr data_arg_conv = str_ref_to_owned_c(data_arg);
46676         LDKWarningMessage ret_var = WarningMessage_new(channel_id_arg_conv, data_arg_conv);
46677         int64_t ret_ref = 0;
46678         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46679         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46680         return ret_ref;
46681 }
46682
46683 static inline uint64_t WarningMessage_clone_ptr(LDKWarningMessage *NONNULL_PTR arg) {
46684         LDKWarningMessage ret_var = WarningMessage_clone(arg);
46685         int64_t ret_ref = 0;
46686         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46687         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46688         return ret_ref;
46689 }
46690 int64_t  CS_LDK_WarningMessage_clone_ptr(int64_t arg) {
46691         LDKWarningMessage arg_conv;
46692         arg_conv.inner = untag_ptr(arg);
46693         arg_conv.is_owned = ptr_is_owned(arg);
46694         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46695         arg_conv.is_owned = false;
46696         int64_t ret_conv = WarningMessage_clone_ptr(&arg_conv);
46697         return ret_conv;
46698 }
46699
46700 int64_t  CS_LDK_WarningMessage_clone(int64_t orig) {
46701         LDKWarningMessage orig_conv;
46702         orig_conv.inner = untag_ptr(orig);
46703         orig_conv.is_owned = ptr_is_owned(orig);
46704         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46705         orig_conv.is_owned = false;
46706         LDKWarningMessage ret_var = WarningMessage_clone(&orig_conv);
46707         int64_t ret_ref = 0;
46708         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46709         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46710         return ret_ref;
46711 }
46712
46713 int64_t  CS_LDK_WarningMessage_hash(int64_t o) {
46714         LDKWarningMessage o_conv;
46715         o_conv.inner = untag_ptr(o);
46716         o_conv.is_owned = ptr_is_owned(o);
46717         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46718         o_conv.is_owned = false;
46719         int64_t ret_conv = WarningMessage_hash(&o_conv);
46720         return ret_conv;
46721 }
46722
46723 jboolean  CS_LDK_WarningMessage_eq(int64_t a, int64_t b) {
46724         LDKWarningMessage a_conv;
46725         a_conv.inner = untag_ptr(a);
46726         a_conv.is_owned = ptr_is_owned(a);
46727         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46728         a_conv.is_owned = false;
46729         LDKWarningMessage b_conv;
46730         b_conv.inner = untag_ptr(b);
46731         b_conv.is_owned = ptr_is_owned(b);
46732         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46733         b_conv.is_owned = false;
46734         jboolean ret_conv = WarningMessage_eq(&a_conv, &b_conv);
46735         return ret_conv;
46736 }
46737
46738 void  CS_LDK_Ping_free(int64_t this_obj) {
46739         LDKPing this_obj_conv;
46740         this_obj_conv.inner = untag_ptr(this_obj);
46741         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46742         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46743         Ping_free(this_obj_conv);
46744 }
46745
46746 int16_t  CS_LDK_Ping_get_ponglen(int64_t this_ptr) {
46747         LDKPing this_ptr_conv;
46748         this_ptr_conv.inner = untag_ptr(this_ptr);
46749         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46750         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46751         this_ptr_conv.is_owned = false;
46752         int16_t ret_conv = Ping_get_ponglen(&this_ptr_conv);
46753         return ret_conv;
46754 }
46755
46756 void  CS_LDK_Ping_set_ponglen(int64_t this_ptr, int16_t val) {
46757         LDKPing this_ptr_conv;
46758         this_ptr_conv.inner = untag_ptr(this_ptr);
46759         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46760         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46761         this_ptr_conv.is_owned = false;
46762         Ping_set_ponglen(&this_ptr_conv, val);
46763 }
46764
46765 int16_t  CS_LDK_Ping_get_byteslen(int64_t this_ptr) {
46766         LDKPing this_ptr_conv;
46767         this_ptr_conv.inner = untag_ptr(this_ptr);
46768         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46769         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46770         this_ptr_conv.is_owned = false;
46771         int16_t ret_conv = Ping_get_byteslen(&this_ptr_conv);
46772         return ret_conv;
46773 }
46774
46775 void  CS_LDK_Ping_set_byteslen(int64_t this_ptr, int16_t val) {
46776         LDKPing this_ptr_conv;
46777         this_ptr_conv.inner = untag_ptr(this_ptr);
46778         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46779         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46780         this_ptr_conv.is_owned = false;
46781         Ping_set_byteslen(&this_ptr_conv, val);
46782 }
46783
46784 int64_t  CS_LDK_Ping_new(int16_t ponglen_arg, int16_t byteslen_arg) {
46785         LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
46786         int64_t ret_ref = 0;
46787         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46788         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46789         return ret_ref;
46790 }
46791
46792 static inline uint64_t Ping_clone_ptr(LDKPing *NONNULL_PTR arg) {
46793         LDKPing ret_var = Ping_clone(arg);
46794         int64_t ret_ref = 0;
46795         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46796         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46797         return ret_ref;
46798 }
46799 int64_t  CS_LDK_Ping_clone_ptr(int64_t arg) {
46800         LDKPing arg_conv;
46801         arg_conv.inner = untag_ptr(arg);
46802         arg_conv.is_owned = ptr_is_owned(arg);
46803         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46804         arg_conv.is_owned = false;
46805         int64_t ret_conv = Ping_clone_ptr(&arg_conv);
46806         return ret_conv;
46807 }
46808
46809 int64_t  CS_LDK_Ping_clone(int64_t orig) {
46810         LDKPing orig_conv;
46811         orig_conv.inner = untag_ptr(orig);
46812         orig_conv.is_owned = ptr_is_owned(orig);
46813         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46814         orig_conv.is_owned = false;
46815         LDKPing ret_var = Ping_clone(&orig_conv);
46816         int64_t ret_ref = 0;
46817         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46818         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46819         return ret_ref;
46820 }
46821
46822 int64_t  CS_LDK_Ping_hash(int64_t o) {
46823         LDKPing o_conv;
46824         o_conv.inner = untag_ptr(o);
46825         o_conv.is_owned = ptr_is_owned(o);
46826         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46827         o_conv.is_owned = false;
46828         int64_t ret_conv = Ping_hash(&o_conv);
46829         return ret_conv;
46830 }
46831
46832 jboolean  CS_LDK_Ping_eq(int64_t a, int64_t b) {
46833         LDKPing a_conv;
46834         a_conv.inner = untag_ptr(a);
46835         a_conv.is_owned = ptr_is_owned(a);
46836         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46837         a_conv.is_owned = false;
46838         LDKPing b_conv;
46839         b_conv.inner = untag_ptr(b);
46840         b_conv.is_owned = ptr_is_owned(b);
46841         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46842         b_conv.is_owned = false;
46843         jboolean ret_conv = Ping_eq(&a_conv, &b_conv);
46844         return ret_conv;
46845 }
46846
46847 void  CS_LDK_Pong_free(int64_t this_obj) {
46848         LDKPong this_obj_conv;
46849         this_obj_conv.inner = untag_ptr(this_obj);
46850         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46851         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46852         Pong_free(this_obj_conv);
46853 }
46854
46855 int16_t  CS_LDK_Pong_get_byteslen(int64_t this_ptr) {
46856         LDKPong this_ptr_conv;
46857         this_ptr_conv.inner = untag_ptr(this_ptr);
46858         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46859         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46860         this_ptr_conv.is_owned = false;
46861         int16_t ret_conv = Pong_get_byteslen(&this_ptr_conv);
46862         return ret_conv;
46863 }
46864
46865 void  CS_LDK_Pong_set_byteslen(int64_t this_ptr, int16_t val) {
46866         LDKPong this_ptr_conv;
46867         this_ptr_conv.inner = untag_ptr(this_ptr);
46868         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46869         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46870         this_ptr_conv.is_owned = false;
46871         Pong_set_byteslen(&this_ptr_conv, val);
46872 }
46873
46874 int64_t  CS_LDK_Pong_new(int16_t byteslen_arg) {
46875         LDKPong ret_var = Pong_new(byteslen_arg);
46876         int64_t ret_ref = 0;
46877         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46878         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46879         return ret_ref;
46880 }
46881
46882 static inline uint64_t Pong_clone_ptr(LDKPong *NONNULL_PTR arg) {
46883         LDKPong ret_var = Pong_clone(arg);
46884         int64_t ret_ref = 0;
46885         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46886         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46887         return ret_ref;
46888 }
46889 int64_t  CS_LDK_Pong_clone_ptr(int64_t arg) {
46890         LDKPong arg_conv;
46891         arg_conv.inner = untag_ptr(arg);
46892         arg_conv.is_owned = ptr_is_owned(arg);
46893         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46894         arg_conv.is_owned = false;
46895         int64_t ret_conv = Pong_clone_ptr(&arg_conv);
46896         return ret_conv;
46897 }
46898
46899 int64_t  CS_LDK_Pong_clone(int64_t orig) {
46900         LDKPong orig_conv;
46901         orig_conv.inner = untag_ptr(orig);
46902         orig_conv.is_owned = ptr_is_owned(orig);
46903         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46904         orig_conv.is_owned = false;
46905         LDKPong ret_var = Pong_clone(&orig_conv);
46906         int64_t ret_ref = 0;
46907         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46908         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46909         return ret_ref;
46910 }
46911
46912 int64_t  CS_LDK_Pong_hash(int64_t o) {
46913         LDKPong o_conv;
46914         o_conv.inner = untag_ptr(o);
46915         o_conv.is_owned = ptr_is_owned(o);
46916         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46917         o_conv.is_owned = false;
46918         int64_t ret_conv = Pong_hash(&o_conv);
46919         return ret_conv;
46920 }
46921
46922 jboolean  CS_LDK_Pong_eq(int64_t a, int64_t b) {
46923         LDKPong a_conv;
46924         a_conv.inner = untag_ptr(a);
46925         a_conv.is_owned = ptr_is_owned(a);
46926         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46927         a_conv.is_owned = false;
46928         LDKPong b_conv;
46929         b_conv.inner = untag_ptr(b);
46930         b_conv.is_owned = ptr_is_owned(b);
46931         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46932         b_conv.is_owned = false;
46933         jboolean ret_conv = Pong_eq(&a_conv, &b_conv);
46934         return ret_conv;
46935 }
46936
46937 void  CS_LDK_CommonOpenChannelFields_free(int64_t this_obj) {
46938         LDKCommonOpenChannelFields this_obj_conv;
46939         this_obj_conv.inner = untag_ptr(this_obj);
46940         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46941         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46942         CommonOpenChannelFields_free(this_obj_conv);
46943 }
46944
46945 int8_tArray  CS_LDK_CommonOpenChannelFields_get_chain_hash(int64_t this_ptr) {
46946         LDKCommonOpenChannelFields this_ptr_conv;
46947         this_ptr_conv.inner = untag_ptr(this_ptr);
46948         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46949         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46950         this_ptr_conv.is_owned = false;
46951         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
46952         memcpy(ret_arr->elems, *CommonOpenChannelFields_get_chain_hash(&this_ptr_conv), 32);
46953         return ret_arr;
46954 }
46955
46956 void  CS_LDK_CommonOpenChannelFields_set_chain_hash(int64_t this_ptr, int8_tArray val) {
46957         LDKCommonOpenChannelFields this_ptr_conv;
46958         this_ptr_conv.inner = untag_ptr(this_ptr);
46959         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46960         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46961         this_ptr_conv.is_owned = false;
46962         LDKThirtyTwoBytes val_ref;
46963         CHECK(val->arr_len == 32);
46964         memcpy(val_ref.data, val->elems, 32); FREE(val);
46965         CommonOpenChannelFields_set_chain_hash(&this_ptr_conv, val_ref);
46966 }
46967
46968 int64_t  CS_LDK_CommonOpenChannelFields_get_temporary_channel_id(int64_t this_ptr) {
46969         LDKCommonOpenChannelFields this_ptr_conv;
46970         this_ptr_conv.inner = untag_ptr(this_ptr);
46971         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46972         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46973         this_ptr_conv.is_owned = false;
46974         LDKChannelId ret_var = CommonOpenChannelFields_get_temporary_channel_id(&this_ptr_conv);
46975         int64_t ret_ref = 0;
46976         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46977         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46978         return ret_ref;
46979 }
46980
46981 void  CS_LDK_CommonOpenChannelFields_set_temporary_channel_id(int64_t this_ptr, int64_t val) {
46982         LDKCommonOpenChannelFields this_ptr_conv;
46983         this_ptr_conv.inner = untag_ptr(this_ptr);
46984         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46985         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46986         this_ptr_conv.is_owned = false;
46987         LDKChannelId val_conv;
46988         val_conv.inner = untag_ptr(val);
46989         val_conv.is_owned = ptr_is_owned(val);
46990         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
46991         val_conv = ChannelId_clone(&val_conv);
46992         CommonOpenChannelFields_set_temporary_channel_id(&this_ptr_conv, val_conv);
46993 }
46994
46995 int64_t  CS_LDK_CommonOpenChannelFields_get_funding_satoshis(int64_t this_ptr) {
46996         LDKCommonOpenChannelFields this_ptr_conv;
46997         this_ptr_conv.inner = untag_ptr(this_ptr);
46998         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46999         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47000         this_ptr_conv.is_owned = false;
47001         int64_t ret_conv = CommonOpenChannelFields_get_funding_satoshis(&this_ptr_conv);
47002         return ret_conv;
47003 }
47004
47005 void  CS_LDK_CommonOpenChannelFields_set_funding_satoshis(int64_t this_ptr, int64_t val) {
47006         LDKCommonOpenChannelFields this_ptr_conv;
47007         this_ptr_conv.inner = untag_ptr(this_ptr);
47008         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47009         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47010         this_ptr_conv.is_owned = false;
47011         CommonOpenChannelFields_set_funding_satoshis(&this_ptr_conv, val);
47012 }
47013
47014 int64_t  CS_LDK_CommonOpenChannelFields_get_dust_limit_satoshis(int64_t this_ptr) {
47015         LDKCommonOpenChannelFields this_ptr_conv;
47016         this_ptr_conv.inner = untag_ptr(this_ptr);
47017         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47018         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47019         this_ptr_conv.is_owned = false;
47020         int64_t ret_conv = CommonOpenChannelFields_get_dust_limit_satoshis(&this_ptr_conv);
47021         return ret_conv;
47022 }
47023
47024 void  CS_LDK_CommonOpenChannelFields_set_dust_limit_satoshis(int64_t this_ptr, int64_t val) {
47025         LDKCommonOpenChannelFields this_ptr_conv;
47026         this_ptr_conv.inner = untag_ptr(this_ptr);
47027         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47028         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47029         this_ptr_conv.is_owned = false;
47030         CommonOpenChannelFields_set_dust_limit_satoshis(&this_ptr_conv, val);
47031 }
47032
47033 int64_t  CS_LDK_CommonOpenChannelFields_get_max_htlc_value_in_flight_msat(int64_t this_ptr) {
47034         LDKCommonOpenChannelFields this_ptr_conv;
47035         this_ptr_conv.inner = untag_ptr(this_ptr);
47036         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47037         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47038         this_ptr_conv.is_owned = false;
47039         int64_t ret_conv = CommonOpenChannelFields_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
47040         return ret_conv;
47041 }
47042
47043 void  CS_LDK_CommonOpenChannelFields_set_max_htlc_value_in_flight_msat(int64_t this_ptr, int64_t val) {
47044         LDKCommonOpenChannelFields this_ptr_conv;
47045         this_ptr_conv.inner = untag_ptr(this_ptr);
47046         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47047         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47048         this_ptr_conv.is_owned = false;
47049         CommonOpenChannelFields_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
47050 }
47051
47052 int64_t  CS_LDK_CommonOpenChannelFields_get_htlc_minimum_msat(int64_t this_ptr) {
47053         LDKCommonOpenChannelFields this_ptr_conv;
47054         this_ptr_conv.inner = untag_ptr(this_ptr);
47055         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47056         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47057         this_ptr_conv.is_owned = false;
47058         int64_t ret_conv = CommonOpenChannelFields_get_htlc_minimum_msat(&this_ptr_conv);
47059         return ret_conv;
47060 }
47061
47062 void  CS_LDK_CommonOpenChannelFields_set_htlc_minimum_msat(int64_t this_ptr, int64_t val) {
47063         LDKCommonOpenChannelFields this_ptr_conv;
47064         this_ptr_conv.inner = untag_ptr(this_ptr);
47065         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47066         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47067         this_ptr_conv.is_owned = false;
47068         CommonOpenChannelFields_set_htlc_minimum_msat(&this_ptr_conv, val);
47069 }
47070
47071 int32_t  CS_LDK_CommonOpenChannelFields_get_commitment_feerate_sat_per_1000_weight(int64_t this_ptr) {
47072         LDKCommonOpenChannelFields this_ptr_conv;
47073         this_ptr_conv.inner = untag_ptr(this_ptr);
47074         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47075         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47076         this_ptr_conv.is_owned = false;
47077         int32_t ret_conv = CommonOpenChannelFields_get_commitment_feerate_sat_per_1000_weight(&this_ptr_conv);
47078         return ret_conv;
47079 }
47080
47081 void  CS_LDK_CommonOpenChannelFields_set_commitment_feerate_sat_per_1000_weight(int64_t this_ptr, int32_t val) {
47082         LDKCommonOpenChannelFields this_ptr_conv;
47083         this_ptr_conv.inner = untag_ptr(this_ptr);
47084         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47085         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47086         this_ptr_conv.is_owned = false;
47087         CommonOpenChannelFields_set_commitment_feerate_sat_per_1000_weight(&this_ptr_conv, val);
47088 }
47089
47090 int16_t  CS_LDK_CommonOpenChannelFields_get_to_self_delay(int64_t this_ptr) {
47091         LDKCommonOpenChannelFields this_ptr_conv;
47092         this_ptr_conv.inner = untag_ptr(this_ptr);
47093         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47094         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47095         this_ptr_conv.is_owned = false;
47096         int16_t ret_conv = CommonOpenChannelFields_get_to_self_delay(&this_ptr_conv);
47097         return ret_conv;
47098 }
47099
47100 void  CS_LDK_CommonOpenChannelFields_set_to_self_delay(int64_t this_ptr, int16_t val) {
47101         LDKCommonOpenChannelFields this_ptr_conv;
47102         this_ptr_conv.inner = untag_ptr(this_ptr);
47103         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47104         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47105         this_ptr_conv.is_owned = false;
47106         CommonOpenChannelFields_set_to_self_delay(&this_ptr_conv, val);
47107 }
47108
47109 int16_t  CS_LDK_CommonOpenChannelFields_get_max_accepted_htlcs(int64_t this_ptr) {
47110         LDKCommonOpenChannelFields this_ptr_conv;
47111         this_ptr_conv.inner = untag_ptr(this_ptr);
47112         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47113         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47114         this_ptr_conv.is_owned = false;
47115         int16_t ret_conv = CommonOpenChannelFields_get_max_accepted_htlcs(&this_ptr_conv);
47116         return ret_conv;
47117 }
47118
47119 void  CS_LDK_CommonOpenChannelFields_set_max_accepted_htlcs(int64_t this_ptr, int16_t val) {
47120         LDKCommonOpenChannelFields this_ptr_conv;
47121         this_ptr_conv.inner = untag_ptr(this_ptr);
47122         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47123         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47124         this_ptr_conv.is_owned = false;
47125         CommonOpenChannelFields_set_max_accepted_htlcs(&this_ptr_conv, val);
47126 }
47127
47128 int8_tArray  CS_LDK_CommonOpenChannelFields_get_funding_pubkey(int64_t this_ptr) {
47129         LDKCommonOpenChannelFields this_ptr_conv;
47130         this_ptr_conv.inner = untag_ptr(this_ptr);
47131         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47132         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47133         this_ptr_conv.is_owned = false;
47134         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
47135         memcpy(ret_arr->elems, CommonOpenChannelFields_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
47136         return ret_arr;
47137 }
47138
47139 void  CS_LDK_CommonOpenChannelFields_set_funding_pubkey(int64_t this_ptr, int8_tArray val) {
47140         LDKCommonOpenChannelFields this_ptr_conv;
47141         this_ptr_conv.inner = untag_ptr(this_ptr);
47142         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47143         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47144         this_ptr_conv.is_owned = false;
47145         LDKPublicKey val_ref;
47146         CHECK(val->arr_len == 33);
47147         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
47148         CommonOpenChannelFields_set_funding_pubkey(&this_ptr_conv, val_ref);
47149 }
47150
47151 int8_tArray  CS_LDK_CommonOpenChannelFields_get_revocation_basepoint(int64_t this_ptr) {
47152         LDKCommonOpenChannelFields this_ptr_conv;
47153         this_ptr_conv.inner = untag_ptr(this_ptr);
47154         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47155         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47156         this_ptr_conv.is_owned = false;
47157         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
47158         memcpy(ret_arr->elems, CommonOpenChannelFields_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
47159         return ret_arr;
47160 }
47161
47162 void  CS_LDK_CommonOpenChannelFields_set_revocation_basepoint(int64_t this_ptr, int8_tArray val) {
47163         LDKCommonOpenChannelFields this_ptr_conv;
47164         this_ptr_conv.inner = untag_ptr(this_ptr);
47165         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47166         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47167         this_ptr_conv.is_owned = false;
47168         LDKPublicKey val_ref;
47169         CHECK(val->arr_len == 33);
47170         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
47171         CommonOpenChannelFields_set_revocation_basepoint(&this_ptr_conv, val_ref);
47172 }
47173
47174 int8_tArray  CS_LDK_CommonOpenChannelFields_get_payment_basepoint(int64_t this_ptr) {
47175         LDKCommonOpenChannelFields this_ptr_conv;
47176         this_ptr_conv.inner = untag_ptr(this_ptr);
47177         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47178         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47179         this_ptr_conv.is_owned = false;
47180         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
47181         memcpy(ret_arr->elems, CommonOpenChannelFields_get_payment_basepoint(&this_ptr_conv).compressed_form, 33);
47182         return ret_arr;
47183 }
47184
47185 void  CS_LDK_CommonOpenChannelFields_set_payment_basepoint(int64_t this_ptr, int8_tArray val) {
47186         LDKCommonOpenChannelFields this_ptr_conv;
47187         this_ptr_conv.inner = untag_ptr(this_ptr);
47188         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47189         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47190         this_ptr_conv.is_owned = false;
47191         LDKPublicKey val_ref;
47192         CHECK(val->arr_len == 33);
47193         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
47194         CommonOpenChannelFields_set_payment_basepoint(&this_ptr_conv, val_ref);
47195 }
47196
47197 int8_tArray  CS_LDK_CommonOpenChannelFields_get_delayed_payment_basepoint(int64_t this_ptr) {
47198         LDKCommonOpenChannelFields this_ptr_conv;
47199         this_ptr_conv.inner = untag_ptr(this_ptr);
47200         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47201         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47202         this_ptr_conv.is_owned = false;
47203         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
47204         memcpy(ret_arr->elems, CommonOpenChannelFields_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
47205         return ret_arr;
47206 }
47207
47208 void  CS_LDK_CommonOpenChannelFields_set_delayed_payment_basepoint(int64_t this_ptr, int8_tArray val) {
47209         LDKCommonOpenChannelFields this_ptr_conv;
47210         this_ptr_conv.inner = untag_ptr(this_ptr);
47211         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47212         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47213         this_ptr_conv.is_owned = false;
47214         LDKPublicKey val_ref;
47215         CHECK(val->arr_len == 33);
47216         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
47217         CommonOpenChannelFields_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
47218 }
47219
47220 int8_tArray  CS_LDK_CommonOpenChannelFields_get_htlc_basepoint(int64_t this_ptr) {
47221         LDKCommonOpenChannelFields this_ptr_conv;
47222         this_ptr_conv.inner = untag_ptr(this_ptr);
47223         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47224         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47225         this_ptr_conv.is_owned = false;
47226         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
47227         memcpy(ret_arr->elems, CommonOpenChannelFields_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
47228         return ret_arr;
47229 }
47230
47231 void  CS_LDK_CommonOpenChannelFields_set_htlc_basepoint(int64_t this_ptr, int8_tArray val) {
47232         LDKCommonOpenChannelFields this_ptr_conv;
47233         this_ptr_conv.inner = untag_ptr(this_ptr);
47234         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47235         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47236         this_ptr_conv.is_owned = false;
47237         LDKPublicKey val_ref;
47238         CHECK(val->arr_len == 33);
47239         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
47240         CommonOpenChannelFields_set_htlc_basepoint(&this_ptr_conv, val_ref);
47241 }
47242
47243 int8_tArray  CS_LDK_CommonOpenChannelFields_get_first_per_commitment_point(int64_t this_ptr) {
47244         LDKCommonOpenChannelFields this_ptr_conv;
47245         this_ptr_conv.inner = untag_ptr(this_ptr);
47246         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47247         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47248         this_ptr_conv.is_owned = false;
47249         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
47250         memcpy(ret_arr->elems, CommonOpenChannelFields_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
47251         return ret_arr;
47252 }
47253
47254 void  CS_LDK_CommonOpenChannelFields_set_first_per_commitment_point(int64_t this_ptr, int8_tArray val) {
47255         LDKCommonOpenChannelFields this_ptr_conv;
47256         this_ptr_conv.inner = untag_ptr(this_ptr);
47257         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47258         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47259         this_ptr_conv.is_owned = false;
47260         LDKPublicKey val_ref;
47261         CHECK(val->arr_len == 33);
47262         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
47263         CommonOpenChannelFields_set_first_per_commitment_point(&this_ptr_conv, val_ref);
47264 }
47265
47266 int8_t  CS_LDK_CommonOpenChannelFields_get_channel_flags(int64_t this_ptr) {
47267         LDKCommonOpenChannelFields this_ptr_conv;
47268         this_ptr_conv.inner = untag_ptr(this_ptr);
47269         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47270         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47271         this_ptr_conv.is_owned = false;
47272         int8_t ret_conv = CommonOpenChannelFields_get_channel_flags(&this_ptr_conv);
47273         return ret_conv;
47274 }
47275
47276 void  CS_LDK_CommonOpenChannelFields_set_channel_flags(int64_t this_ptr, int8_t val) {
47277         LDKCommonOpenChannelFields this_ptr_conv;
47278         this_ptr_conv.inner = untag_ptr(this_ptr);
47279         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47280         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47281         this_ptr_conv.is_owned = false;
47282         CommonOpenChannelFields_set_channel_flags(&this_ptr_conv, val);
47283 }
47284
47285 int64_t  CS_LDK_CommonOpenChannelFields_get_shutdown_scriptpubkey(int64_t this_ptr) {
47286         LDKCommonOpenChannelFields this_ptr_conv;
47287         this_ptr_conv.inner = untag_ptr(this_ptr);
47288         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47289         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47290         this_ptr_conv.is_owned = false;
47291         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
47292         *ret_copy = CommonOpenChannelFields_get_shutdown_scriptpubkey(&this_ptr_conv);
47293         int64_t ret_ref = tag_ptr(ret_copy, true);
47294         return ret_ref;
47295 }
47296
47297 void  CS_LDK_CommonOpenChannelFields_set_shutdown_scriptpubkey(int64_t this_ptr, int64_t val) {
47298         LDKCommonOpenChannelFields this_ptr_conv;
47299         this_ptr_conv.inner = untag_ptr(this_ptr);
47300         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47301         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47302         this_ptr_conv.is_owned = false;
47303         void* val_ptr = untag_ptr(val);
47304         CHECK_ACCESS(val_ptr);
47305         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
47306         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
47307         CommonOpenChannelFields_set_shutdown_scriptpubkey(&this_ptr_conv, val_conv);
47308 }
47309
47310 int64_t  CS_LDK_CommonOpenChannelFields_get_channel_type(int64_t this_ptr) {
47311         LDKCommonOpenChannelFields this_ptr_conv;
47312         this_ptr_conv.inner = untag_ptr(this_ptr);
47313         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47314         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47315         this_ptr_conv.is_owned = false;
47316         LDKChannelTypeFeatures ret_var = CommonOpenChannelFields_get_channel_type(&this_ptr_conv);
47317         int64_t ret_ref = 0;
47318         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47319         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47320         return ret_ref;
47321 }
47322
47323 void  CS_LDK_CommonOpenChannelFields_set_channel_type(int64_t this_ptr, int64_t val) {
47324         LDKCommonOpenChannelFields 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         LDKChannelTypeFeatures val_conv;
47330         val_conv.inner = untag_ptr(val);
47331         val_conv.is_owned = ptr_is_owned(val);
47332         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
47333         val_conv = ChannelTypeFeatures_clone(&val_conv);
47334         CommonOpenChannelFields_set_channel_type(&this_ptr_conv, val_conv);
47335 }
47336
47337 int64_t  CS_LDK_CommonOpenChannelFields_new(int8_tArray chain_hash_arg, int64_t 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 commitment_feerate_sat_per_1000_weight_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_t channel_flags_arg, int64_t shutdown_scriptpubkey_arg, int64_t channel_type_arg) {
47338         LDKThirtyTwoBytes chain_hash_arg_ref;
47339         CHECK(chain_hash_arg->arr_len == 32);
47340         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
47341         LDKChannelId temporary_channel_id_arg_conv;
47342         temporary_channel_id_arg_conv.inner = untag_ptr(temporary_channel_id_arg);
47343         temporary_channel_id_arg_conv.is_owned = ptr_is_owned(temporary_channel_id_arg);
47344         CHECK_INNER_FIELD_ACCESS_OR_NULL(temporary_channel_id_arg_conv);
47345         temporary_channel_id_arg_conv = ChannelId_clone(&temporary_channel_id_arg_conv);
47346         LDKPublicKey funding_pubkey_arg_ref;
47347         CHECK(funding_pubkey_arg->arr_len == 33);
47348         memcpy(funding_pubkey_arg_ref.compressed_form, funding_pubkey_arg->elems, 33); FREE(funding_pubkey_arg);
47349         LDKPublicKey revocation_basepoint_arg_ref;
47350         CHECK(revocation_basepoint_arg->arr_len == 33);
47351         memcpy(revocation_basepoint_arg_ref.compressed_form, revocation_basepoint_arg->elems, 33); FREE(revocation_basepoint_arg);
47352         LDKPublicKey payment_basepoint_arg_ref;
47353         CHECK(payment_basepoint_arg->arr_len == 33);
47354         memcpy(payment_basepoint_arg_ref.compressed_form, payment_basepoint_arg->elems, 33); FREE(payment_basepoint_arg);
47355         LDKPublicKey delayed_payment_basepoint_arg_ref;
47356         CHECK(delayed_payment_basepoint_arg->arr_len == 33);
47357         memcpy(delayed_payment_basepoint_arg_ref.compressed_form, delayed_payment_basepoint_arg->elems, 33); FREE(delayed_payment_basepoint_arg);
47358         LDKPublicKey htlc_basepoint_arg_ref;
47359         CHECK(htlc_basepoint_arg->arr_len == 33);
47360         memcpy(htlc_basepoint_arg_ref.compressed_form, htlc_basepoint_arg->elems, 33); FREE(htlc_basepoint_arg);
47361         LDKPublicKey first_per_commitment_point_arg_ref;
47362         CHECK(first_per_commitment_point_arg->arr_len == 33);
47363         memcpy(first_per_commitment_point_arg_ref.compressed_form, first_per_commitment_point_arg->elems, 33); FREE(first_per_commitment_point_arg);
47364         void* shutdown_scriptpubkey_arg_ptr = untag_ptr(shutdown_scriptpubkey_arg);
47365         CHECK_ACCESS(shutdown_scriptpubkey_arg_ptr);
47366         LDKCOption_CVec_u8ZZ shutdown_scriptpubkey_arg_conv = *(LDKCOption_CVec_u8ZZ*)(shutdown_scriptpubkey_arg_ptr);
47367         shutdown_scriptpubkey_arg_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(shutdown_scriptpubkey_arg));
47368         LDKChannelTypeFeatures channel_type_arg_conv;
47369         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
47370         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
47371         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
47372         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
47373         LDKCommonOpenChannelFields ret_var = CommonOpenChannelFields_new(chain_hash_arg_ref, temporary_channel_id_arg_conv, funding_satoshis_arg, dust_limit_satoshis_arg, max_htlc_value_in_flight_msat_arg, htlc_minimum_msat_arg, commitment_feerate_sat_per_1000_weight_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, channel_flags_arg, shutdown_scriptpubkey_arg_conv, channel_type_arg_conv);
47374         int64_t ret_ref = 0;
47375         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47376         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47377         return ret_ref;
47378 }
47379
47380 static inline uint64_t CommonOpenChannelFields_clone_ptr(LDKCommonOpenChannelFields *NONNULL_PTR arg) {
47381         LDKCommonOpenChannelFields ret_var = CommonOpenChannelFields_clone(arg);
47382         int64_t ret_ref = 0;
47383         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47384         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47385         return ret_ref;
47386 }
47387 int64_t  CS_LDK_CommonOpenChannelFields_clone_ptr(int64_t arg) {
47388         LDKCommonOpenChannelFields arg_conv;
47389         arg_conv.inner = untag_ptr(arg);
47390         arg_conv.is_owned = ptr_is_owned(arg);
47391         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47392         arg_conv.is_owned = false;
47393         int64_t ret_conv = CommonOpenChannelFields_clone_ptr(&arg_conv);
47394         return ret_conv;
47395 }
47396
47397 int64_t  CS_LDK_CommonOpenChannelFields_clone(int64_t orig) {
47398         LDKCommonOpenChannelFields orig_conv;
47399         orig_conv.inner = untag_ptr(orig);
47400         orig_conv.is_owned = ptr_is_owned(orig);
47401         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47402         orig_conv.is_owned = false;
47403         LDKCommonOpenChannelFields ret_var = CommonOpenChannelFields_clone(&orig_conv);
47404         int64_t ret_ref = 0;
47405         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47406         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47407         return ret_ref;
47408 }
47409
47410 int64_t  CS_LDK_CommonOpenChannelFields_hash(int64_t o) {
47411         LDKCommonOpenChannelFields o_conv;
47412         o_conv.inner = untag_ptr(o);
47413         o_conv.is_owned = ptr_is_owned(o);
47414         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
47415         o_conv.is_owned = false;
47416         int64_t ret_conv = CommonOpenChannelFields_hash(&o_conv);
47417         return ret_conv;
47418 }
47419
47420 jboolean  CS_LDK_CommonOpenChannelFields_eq(int64_t a, int64_t b) {
47421         LDKCommonOpenChannelFields a_conv;
47422         a_conv.inner = untag_ptr(a);
47423         a_conv.is_owned = ptr_is_owned(a);
47424         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47425         a_conv.is_owned = false;
47426         LDKCommonOpenChannelFields b_conv;
47427         b_conv.inner = untag_ptr(b);
47428         b_conv.is_owned = ptr_is_owned(b);
47429         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47430         b_conv.is_owned = false;
47431         jboolean ret_conv = CommonOpenChannelFields_eq(&a_conv, &b_conv);
47432         return ret_conv;
47433 }
47434
47435 void  CS_LDK_OpenChannel_free(int64_t this_obj) {
47436         LDKOpenChannel this_obj_conv;
47437         this_obj_conv.inner = untag_ptr(this_obj);
47438         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47439         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47440         OpenChannel_free(this_obj_conv);
47441 }
47442
47443 int64_t  CS_LDK_OpenChannel_get_common_fields(int64_t this_ptr) {
47444         LDKOpenChannel this_ptr_conv;
47445         this_ptr_conv.inner = untag_ptr(this_ptr);
47446         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47447         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47448         this_ptr_conv.is_owned = false;
47449         LDKCommonOpenChannelFields ret_var = OpenChannel_get_common_fields(&this_ptr_conv);
47450         int64_t ret_ref = 0;
47451         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47452         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47453         return ret_ref;
47454 }
47455
47456 void  CS_LDK_OpenChannel_set_common_fields(int64_t this_ptr, int64_t val) {
47457         LDKOpenChannel this_ptr_conv;
47458         this_ptr_conv.inner = untag_ptr(this_ptr);
47459         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47460         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47461         this_ptr_conv.is_owned = false;
47462         LDKCommonOpenChannelFields val_conv;
47463         val_conv.inner = untag_ptr(val);
47464         val_conv.is_owned = ptr_is_owned(val);
47465         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
47466         val_conv = CommonOpenChannelFields_clone(&val_conv);
47467         OpenChannel_set_common_fields(&this_ptr_conv, val_conv);
47468 }
47469
47470 int64_t  CS_LDK_OpenChannel_get_push_msat(int64_t this_ptr) {
47471         LDKOpenChannel this_ptr_conv;
47472         this_ptr_conv.inner = untag_ptr(this_ptr);
47473         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47474         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47475         this_ptr_conv.is_owned = false;
47476         int64_t ret_conv = OpenChannel_get_push_msat(&this_ptr_conv);
47477         return ret_conv;
47478 }
47479
47480 void  CS_LDK_OpenChannel_set_push_msat(int64_t this_ptr, int64_t val) {
47481         LDKOpenChannel this_ptr_conv;
47482         this_ptr_conv.inner = untag_ptr(this_ptr);
47483         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47484         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47485         this_ptr_conv.is_owned = false;
47486         OpenChannel_set_push_msat(&this_ptr_conv, val);
47487 }
47488
47489 int64_t  CS_LDK_OpenChannel_get_channel_reserve_satoshis(int64_t this_ptr) {
47490         LDKOpenChannel this_ptr_conv;
47491         this_ptr_conv.inner = untag_ptr(this_ptr);
47492         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47493         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47494         this_ptr_conv.is_owned = false;
47495         int64_t ret_conv = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
47496         return ret_conv;
47497 }
47498
47499 void  CS_LDK_OpenChannel_set_channel_reserve_satoshis(int64_t this_ptr, int64_t val) {
47500         LDKOpenChannel this_ptr_conv;
47501         this_ptr_conv.inner = untag_ptr(this_ptr);
47502         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47503         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47504         this_ptr_conv.is_owned = false;
47505         OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
47506 }
47507
47508 int64_t  CS_LDK_OpenChannel_new(int64_t common_fields_arg, int64_t push_msat_arg, int64_t channel_reserve_satoshis_arg) {
47509         LDKCommonOpenChannelFields common_fields_arg_conv;
47510         common_fields_arg_conv.inner = untag_ptr(common_fields_arg);
47511         common_fields_arg_conv.is_owned = ptr_is_owned(common_fields_arg);
47512         CHECK_INNER_FIELD_ACCESS_OR_NULL(common_fields_arg_conv);
47513         common_fields_arg_conv = CommonOpenChannelFields_clone(&common_fields_arg_conv);
47514         LDKOpenChannel ret_var = OpenChannel_new(common_fields_arg_conv, push_msat_arg, channel_reserve_satoshis_arg);
47515         int64_t ret_ref = 0;
47516         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47517         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47518         return ret_ref;
47519 }
47520
47521 static inline uint64_t OpenChannel_clone_ptr(LDKOpenChannel *NONNULL_PTR arg) {
47522         LDKOpenChannel ret_var = OpenChannel_clone(arg);
47523         int64_t ret_ref = 0;
47524         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47525         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47526         return ret_ref;
47527 }
47528 int64_t  CS_LDK_OpenChannel_clone_ptr(int64_t arg) {
47529         LDKOpenChannel arg_conv;
47530         arg_conv.inner = untag_ptr(arg);
47531         arg_conv.is_owned = ptr_is_owned(arg);
47532         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47533         arg_conv.is_owned = false;
47534         int64_t ret_conv = OpenChannel_clone_ptr(&arg_conv);
47535         return ret_conv;
47536 }
47537
47538 int64_t  CS_LDK_OpenChannel_clone(int64_t orig) {
47539         LDKOpenChannel orig_conv;
47540         orig_conv.inner = untag_ptr(orig);
47541         orig_conv.is_owned = ptr_is_owned(orig);
47542         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47543         orig_conv.is_owned = false;
47544         LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
47545         int64_t ret_ref = 0;
47546         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47547         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47548         return ret_ref;
47549 }
47550
47551 int64_t  CS_LDK_OpenChannel_hash(int64_t o) {
47552         LDKOpenChannel o_conv;
47553         o_conv.inner = untag_ptr(o);
47554         o_conv.is_owned = ptr_is_owned(o);
47555         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
47556         o_conv.is_owned = false;
47557         int64_t ret_conv = OpenChannel_hash(&o_conv);
47558         return ret_conv;
47559 }
47560
47561 jboolean  CS_LDK_OpenChannel_eq(int64_t a, int64_t b) {
47562         LDKOpenChannel a_conv;
47563         a_conv.inner = untag_ptr(a);
47564         a_conv.is_owned = ptr_is_owned(a);
47565         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47566         a_conv.is_owned = false;
47567         LDKOpenChannel b_conv;
47568         b_conv.inner = untag_ptr(b);
47569         b_conv.is_owned = ptr_is_owned(b);
47570         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47571         b_conv.is_owned = false;
47572         jboolean ret_conv = OpenChannel_eq(&a_conv, &b_conv);
47573         return ret_conv;
47574 }
47575
47576 void  CS_LDK_OpenChannelV2_free(int64_t this_obj) {
47577         LDKOpenChannelV2 this_obj_conv;
47578         this_obj_conv.inner = untag_ptr(this_obj);
47579         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47580         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47581         OpenChannelV2_free(this_obj_conv);
47582 }
47583
47584 int64_t  CS_LDK_OpenChannelV2_get_common_fields(int64_t this_ptr) {
47585         LDKOpenChannelV2 this_ptr_conv;
47586         this_ptr_conv.inner = untag_ptr(this_ptr);
47587         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47588         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47589         this_ptr_conv.is_owned = false;
47590         LDKCommonOpenChannelFields ret_var = OpenChannelV2_get_common_fields(&this_ptr_conv);
47591         int64_t ret_ref = 0;
47592         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47593         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47594         return ret_ref;
47595 }
47596
47597 void  CS_LDK_OpenChannelV2_set_common_fields(int64_t this_ptr, int64_t val) {
47598         LDKOpenChannelV2 this_ptr_conv;
47599         this_ptr_conv.inner = untag_ptr(this_ptr);
47600         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47601         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47602         this_ptr_conv.is_owned = false;
47603         LDKCommonOpenChannelFields val_conv;
47604         val_conv.inner = untag_ptr(val);
47605         val_conv.is_owned = ptr_is_owned(val);
47606         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
47607         val_conv = CommonOpenChannelFields_clone(&val_conv);
47608         OpenChannelV2_set_common_fields(&this_ptr_conv, val_conv);
47609 }
47610
47611 int32_t  CS_LDK_OpenChannelV2_get_funding_feerate_sat_per_1000_weight(int64_t this_ptr) {
47612         LDKOpenChannelV2 this_ptr_conv;
47613         this_ptr_conv.inner = untag_ptr(this_ptr);
47614         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47615         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47616         this_ptr_conv.is_owned = false;
47617         int32_t ret_conv = OpenChannelV2_get_funding_feerate_sat_per_1000_weight(&this_ptr_conv);
47618         return ret_conv;
47619 }
47620
47621 void  CS_LDK_OpenChannelV2_set_funding_feerate_sat_per_1000_weight(int64_t this_ptr, int32_t val) {
47622         LDKOpenChannelV2 this_ptr_conv;
47623         this_ptr_conv.inner = untag_ptr(this_ptr);
47624         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47625         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47626         this_ptr_conv.is_owned = false;
47627         OpenChannelV2_set_funding_feerate_sat_per_1000_weight(&this_ptr_conv, val);
47628 }
47629
47630 int32_t  CS_LDK_OpenChannelV2_get_locktime(int64_t this_ptr) {
47631         LDKOpenChannelV2 this_ptr_conv;
47632         this_ptr_conv.inner = untag_ptr(this_ptr);
47633         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47634         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47635         this_ptr_conv.is_owned = false;
47636         int32_t ret_conv = OpenChannelV2_get_locktime(&this_ptr_conv);
47637         return ret_conv;
47638 }
47639
47640 void  CS_LDK_OpenChannelV2_set_locktime(int64_t this_ptr, int32_t val) {
47641         LDKOpenChannelV2 this_ptr_conv;
47642         this_ptr_conv.inner = untag_ptr(this_ptr);
47643         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47644         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47645         this_ptr_conv.is_owned = false;
47646         OpenChannelV2_set_locktime(&this_ptr_conv, val);
47647 }
47648
47649 int8_tArray  CS_LDK_OpenChannelV2_get_second_per_commitment_point(int64_t this_ptr) {
47650         LDKOpenChannelV2 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         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
47656         memcpy(ret_arr->elems, OpenChannelV2_get_second_per_commitment_point(&this_ptr_conv).compressed_form, 33);
47657         return ret_arr;
47658 }
47659
47660 void  CS_LDK_OpenChannelV2_set_second_per_commitment_point(int64_t this_ptr, int8_tArray val) {
47661         LDKOpenChannelV2 this_ptr_conv;
47662         this_ptr_conv.inner = untag_ptr(this_ptr);
47663         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47664         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47665         this_ptr_conv.is_owned = false;
47666         LDKPublicKey val_ref;
47667         CHECK(val->arr_len == 33);
47668         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
47669         OpenChannelV2_set_second_per_commitment_point(&this_ptr_conv, val_ref);
47670 }
47671
47672 int32_t  CS_LDK_OpenChannelV2_get_require_confirmed_inputs(int64_t this_ptr) {
47673         LDKOpenChannelV2 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         int32_t ret_conv = LDKCOption_NoneZ_to_cs(OpenChannelV2_get_require_confirmed_inputs(&this_ptr_conv));
47679         return ret_conv;
47680 }
47681
47682 void  CS_LDK_OpenChannelV2_set_require_confirmed_inputs(int64_t this_ptr, int32_t val) {
47683         LDKOpenChannelV2 this_ptr_conv;
47684         this_ptr_conv.inner = untag_ptr(this_ptr);
47685         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47686         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47687         this_ptr_conv.is_owned = false;
47688         LDKCOption_NoneZ val_conv = LDKCOption_NoneZ_from_cs(val);
47689         OpenChannelV2_set_require_confirmed_inputs(&this_ptr_conv, val_conv);
47690 }
47691
47692 int64_t  CS_LDK_OpenChannelV2_new(int64_t common_fields_arg, int32_t funding_feerate_sat_per_1000_weight_arg, int32_t locktime_arg, int8_tArray second_per_commitment_point_arg, int32_t require_confirmed_inputs_arg) {
47693         LDKCommonOpenChannelFields common_fields_arg_conv;
47694         common_fields_arg_conv.inner = untag_ptr(common_fields_arg);
47695         common_fields_arg_conv.is_owned = ptr_is_owned(common_fields_arg);
47696         CHECK_INNER_FIELD_ACCESS_OR_NULL(common_fields_arg_conv);
47697         common_fields_arg_conv = CommonOpenChannelFields_clone(&common_fields_arg_conv);
47698         LDKPublicKey second_per_commitment_point_arg_ref;
47699         CHECK(second_per_commitment_point_arg->arr_len == 33);
47700         memcpy(second_per_commitment_point_arg_ref.compressed_form, second_per_commitment_point_arg->elems, 33); FREE(second_per_commitment_point_arg);
47701         LDKCOption_NoneZ require_confirmed_inputs_arg_conv = LDKCOption_NoneZ_from_cs(require_confirmed_inputs_arg);
47702         LDKOpenChannelV2 ret_var = OpenChannelV2_new(common_fields_arg_conv, funding_feerate_sat_per_1000_weight_arg, locktime_arg, second_per_commitment_point_arg_ref, require_confirmed_inputs_arg_conv);
47703         int64_t ret_ref = 0;
47704         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47705         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47706         return ret_ref;
47707 }
47708
47709 static inline uint64_t OpenChannelV2_clone_ptr(LDKOpenChannelV2 *NONNULL_PTR arg) {
47710         LDKOpenChannelV2 ret_var = OpenChannelV2_clone(arg);
47711         int64_t ret_ref = 0;
47712         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47713         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47714         return ret_ref;
47715 }
47716 int64_t  CS_LDK_OpenChannelV2_clone_ptr(int64_t arg) {
47717         LDKOpenChannelV2 arg_conv;
47718         arg_conv.inner = untag_ptr(arg);
47719         arg_conv.is_owned = ptr_is_owned(arg);
47720         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47721         arg_conv.is_owned = false;
47722         int64_t ret_conv = OpenChannelV2_clone_ptr(&arg_conv);
47723         return ret_conv;
47724 }
47725
47726 int64_t  CS_LDK_OpenChannelV2_clone(int64_t orig) {
47727         LDKOpenChannelV2 orig_conv;
47728         orig_conv.inner = untag_ptr(orig);
47729         orig_conv.is_owned = ptr_is_owned(orig);
47730         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47731         orig_conv.is_owned = false;
47732         LDKOpenChannelV2 ret_var = OpenChannelV2_clone(&orig_conv);
47733         int64_t ret_ref = 0;
47734         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47735         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47736         return ret_ref;
47737 }
47738
47739 int64_t  CS_LDK_OpenChannelV2_hash(int64_t o) {
47740         LDKOpenChannelV2 o_conv;
47741         o_conv.inner = untag_ptr(o);
47742         o_conv.is_owned = ptr_is_owned(o);
47743         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
47744         o_conv.is_owned = false;
47745         int64_t ret_conv = OpenChannelV2_hash(&o_conv);
47746         return ret_conv;
47747 }
47748
47749 jboolean  CS_LDK_OpenChannelV2_eq(int64_t a, int64_t b) {
47750         LDKOpenChannelV2 a_conv;
47751         a_conv.inner = untag_ptr(a);
47752         a_conv.is_owned = ptr_is_owned(a);
47753         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47754         a_conv.is_owned = false;
47755         LDKOpenChannelV2 b_conv;
47756         b_conv.inner = untag_ptr(b);
47757         b_conv.is_owned = ptr_is_owned(b);
47758         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47759         b_conv.is_owned = false;
47760         jboolean ret_conv = OpenChannelV2_eq(&a_conv, &b_conv);
47761         return ret_conv;
47762 }
47763
47764 void  CS_LDK_CommonAcceptChannelFields_free(int64_t this_obj) {
47765         LDKCommonAcceptChannelFields this_obj_conv;
47766         this_obj_conv.inner = untag_ptr(this_obj);
47767         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47768         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47769         CommonAcceptChannelFields_free(this_obj_conv);
47770 }
47771
47772 int64_t  CS_LDK_CommonAcceptChannelFields_get_temporary_channel_id(int64_t this_ptr) {
47773         LDKCommonAcceptChannelFields this_ptr_conv;
47774         this_ptr_conv.inner = untag_ptr(this_ptr);
47775         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47776         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47777         this_ptr_conv.is_owned = false;
47778         LDKChannelId ret_var = CommonAcceptChannelFields_get_temporary_channel_id(&this_ptr_conv);
47779         int64_t ret_ref = 0;
47780         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47781         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47782         return ret_ref;
47783 }
47784
47785 void  CS_LDK_CommonAcceptChannelFields_set_temporary_channel_id(int64_t this_ptr, int64_t val) {
47786         LDKCommonAcceptChannelFields this_ptr_conv;
47787         this_ptr_conv.inner = untag_ptr(this_ptr);
47788         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47789         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47790         this_ptr_conv.is_owned = false;
47791         LDKChannelId val_conv;
47792         val_conv.inner = untag_ptr(val);
47793         val_conv.is_owned = ptr_is_owned(val);
47794         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
47795         val_conv = ChannelId_clone(&val_conv);
47796         CommonAcceptChannelFields_set_temporary_channel_id(&this_ptr_conv, val_conv);
47797 }
47798
47799 int64_t  CS_LDK_CommonAcceptChannelFields_get_dust_limit_satoshis(int64_t this_ptr) {
47800         LDKCommonAcceptChannelFields this_ptr_conv;
47801         this_ptr_conv.inner = untag_ptr(this_ptr);
47802         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47803         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47804         this_ptr_conv.is_owned = false;
47805         int64_t ret_conv = CommonAcceptChannelFields_get_dust_limit_satoshis(&this_ptr_conv);
47806         return ret_conv;
47807 }
47808
47809 void  CS_LDK_CommonAcceptChannelFields_set_dust_limit_satoshis(int64_t this_ptr, int64_t val) {
47810         LDKCommonAcceptChannelFields this_ptr_conv;
47811         this_ptr_conv.inner = untag_ptr(this_ptr);
47812         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47813         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47814         this_ptr_conv.is_owned = false;
47815         CommonAcceptChannelFields_set_dust_limit_satoshis(&this_ptr_conv, val);
47816 }
47817
47818 int64_t  CS_LDK_CommonAcceptChannelFields_get_max_htlc_value_in_flight_msat(int64_t this_ptr) {
47819         LDKCommonAcceptChannelFields this_ptr_conv;
47820         this_ptr_conv.inner = untag_ptr(this_ptr);
47821         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47822         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47823         this_ptr_conv.is_owned = false;
47824         int64_t ret_conv = CommonAcceptChannelFields_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
47825         return ret_conv;
47826 }
47827
47828 void  CS_LDK_CommonAcceptChannelFields_set_max_htlc_value_in_flight_msat(int64_t this_ptr, int64_t val) {
47829         LDKCommonAcceptChannelFields this_ptr_conv;
47830         this_ptr_conv.inner = untag_ptr(this_ptr);
47831         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47832         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47833         this_ptr_conv.is_owned = false;
47834         CommonAcceptChannelFields_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
47835 }
47836
47837 int64_t  CS_LDK_CommonAcceptChannelFields_get_htlc_minimum_msat(int64_t this_ptr) {
47838         LDKCommonAcceptChannelFields this_ptr_conv;
47839         this_ptr_conv.inner = untag_ptr(this_ptr);
47840         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47841         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47842         this_ptr_conv.is_owned = false;
47843         int64_t ret_conv = CommonAcceptChannelFields_get_htlc_minimum_msat(&this_ptr_conv);
47844         return ret_conv;
47845 }
47846
47847 void  CS_LDK_CommonAcceptChannelFields_set_htlc_minimum_msat(int64_t this_ptr, int64_t val) {
47848         LDKCommonAcceptChannelFields this_ptr_conv;
47849         this_ptr_conv.inner = untag_ptr(this_ptr);
47850         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47851         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47852         this_ptr_conv.is_owned = false;
47853         CommonAcceptChannelFields_set_htlc_minimum_msat(&this_ptr_conv, val);
47854 }
47855
47856 int32_t  CS_LDK_CommonAcceptChannelFields_get_minimum_depth(int64_t this_ptr) {
47857         LDKCommonAcceptChannelFields this_ptr_conv;
47858         this_ptr_conv.inner = untag_ptr(this_ptr);
47859         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47860         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47861         this_ptr_conv.is_owned = false;
47862         int32_t ret_conv = CommonAcceptChannelFields_get_minimum_depth(&this_ptr_conv);
47863         return ret_conv;
47864 }
47865
47866 void  CS_LDK_CommonAcceptChannelFields_set_minimum_depth(int64_t this_ptr, int32_t val) {
47867         LDKCommonAcceptChannelFields this_ptr_conv;
47868         this_ptr_conv.inner = untag_ptr(this_ptr);
47869         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47870         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47871         this_ptr_conv.is_owned = false;
47872         CommonAcceptChannelFields_set_minimum_depth(&this_ptr_conv, val);
47873 }
47874
47875 int16_t  CS_LDK_CommonAcceptChannelFields_get_to_self_delay(int64_t this_ptr) {
47876         LDKCommonAcceptChannelFields this_ptr_conv;
47877         this_ptr_conv.inner = untag_ptr(this_ptr);
47878         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47879         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47880         this_ptr_conv.is_owned = false;
47881         int16_t ret_conv = CommonAcceptChannelFields_get_to_self_delay(&this_ptr_conv);
47882         return ret_conv;
47883 }
47884
47885 void  CS_LDK_CommonAcceptChannelFields_set_to_self_delay(int64_t this_ptr, int16_t val) {
47886         LDKCommonAcceptChannelFields this_ptr_conv;
47887         this_ptr_conv.inner = untag_ptr(this_ptr);
47888         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47889         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47890         this_ptr_conv.is_owned = false;
47891         CommonAcceptChannelFields_set_to_self_delay(&this_ptr_conv, val);
47892 }
47893
47894 int16_t  CS_LDK_CommonAcceptChannelFields_get_max_accepted_htlcs(int64_t this_ptr) {
47895         LDKCommonAcceptChannelFields this_ptr_conv;
47896         this_ptr_conv.inner = untag_ptr(this_ptr);
47897         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47898         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47899         this_ptr_conv.is_owned = false;
47900         int16_t ret_conv = CommonAcceptChannelFields_get_max_accepted_htlcs(&this_ptr_conv);
47901         return ret_conv;
47902 }
47903
47904 void  CS_LDK_CommonAcceptChannelFields_set_max_accepted_htlcs(int64_t this_ptr, int16_t val) {
47905         LDKCommonAcceptChannelFields this_ptr_conv;
47906         this_ptr_conv.inner = untag_ptr(this_ptr);
47907         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47908         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47909         this_ptr_conv.is_owned = false;
47910         CommonAcceptChannelFields_set_max_accepted_htlcs(&this_ptr_conv, val);
47911 }
47912
47913 int8_tArray  CS_LDK_CommonAcceptChannelFields_get_funding_pubkey(int64_t this_ptr) {
47914         LDKCommonAcceptChannelFields this_ptr_conv;
47915         this_ptr_conv.inner = untag_ptr(this_ptr);
47916         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47917         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47918         this_ptr_conv.is_owned = false;
47919         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
47920         memcpy(ret_arr->elems, CommonAcceptChannelFields_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
47921         return ret_arr;
47922 }
47923
47924 void  CS_LDK_CommonAcceptChannelFields_set_funding_pubkey(int64_t this_ptr, int8_tArray val) {
47925         LDKCommonAcceptChannelFields this_ptr_conv;
47926         this_ptr_conv.inner = untag_ptr(this_ptr);
47927         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47928         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47929         this_ptr_conv.is_owned = false;
47930         LDKPublicKey val_ref;
47931         CHECK(val->arr_len == 33);
47932         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
47933         CommonAcceptChannelFields_set_funding_pubkey(&this_ptr_conv, val_ref);
47934 }
47935
47936 int8_tArray  CS_LDK_CommonAcceptChannelFields_get_revocation_basepoint(int64_t this_ptr) {
47937         LDKCommonAcceptChannelFields this_ptr_conv;
47938         this_ptr_conv.inner = untag_ptr(this_ptr);
47939         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47940         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47941         this_ptr_conv.is_owned = false;
47942         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
47943         memcpy(ret_arr->elems, CommonAcceptChannelFields_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
47944         return ret_arr;
47945 }
47946
47947 void  CS_LDK_CommonAcceptChannelFields_set_revocation_basepoint(int64_t this_ptr, int8_tArray val) {
47948         LDKCommonAcceptChannelFields this_ptr_conv;
47949         this_ptr_conv.inner = untag_ptr(this_ptr);
47950         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47951         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47952         this_ptr_conv.is_owned = false;
47953         LDKPublicKey val_ref;
47954         CHECK(val->arr_len == 33);
47955         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
47956         CommonAcceptChannelFields_set_revocation_basepoint(&this_ptr_conv, val_ref);
47957 }
47958
47959 int8_tArray  CS_LDK_CommonAcceptChannelFields_get_payment_basepoint(int64_t this_ptr) {
47960         LDKCommonAcceptChannelFields this_ptr_conv;
47961         this_ptr_conv.inner = untag_ptr(this_ptr);
47962         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47963         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47964         this_ptr_conv.is_owned = false;
47965         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
47966         memcpy(ret_arr->elems, CommonAcceptChannelFields_get_payment_basepoint(&this_ptr_conv).compressed_form, 33);
47967         return ret_arr;
47968 }
47969
47970 void  CS_LDK_CommonAcceptChannelFields_set_payment_basepoint(int64_t this_ptr, int8_tArray val) {
47971         LDKCommonAcceptChannelFields this_ptr_conv;
47972         this_ptr_conv.inner = untag_ptr(this_ptr);
47973         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47974         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47975         this_ptr_conv.is_owned = false;
47976         LDKPublicKey val_ref;
47977         CHECK(val->arr_len == 33);
47978         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
47979         CommonAcceptChannelFields_set_payment_basepoint(&this_ptr_conv, val_ref);
47980 }
47981
47982 int8_tArray  CS_LDK_CommonAcceptChannelFields_get_delayed_payment_basepoint(int64_t this_ptr) {
47983         LDKCommonAcceptChannelFields this_ptr_conv;
47984         this_ptr_conv.inner = untag_ptr(this_ptr);
47985         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47986         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47987         this_ptr_conv.is_owned = false;
47988         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
47989         memcpy(ret_arr->elems, CommonAcceptChannelFields_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
47990         return ret_arr;
47991 }
47992
47993 void  CS_LDK_CommonAcceptChannelFields_set_delayed_payment_basepoint(int64_t this_ptr, int8_tArray val) {
47994         LDKCommonAcceptChannelFields this_ptr_conv;
47995         this_ptr_conv.inner = untag_ptr(this_ptr);
47996         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47997         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47998         this_ptr_conv.is_owned = false;
47999         LDKPublicKey val_ref;
48000         CHECK(val->arr_len == 33);
48001         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
48002         CommonAcceptChannelFields_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
48003 }
48004
48005 int8_tArray  CS_LDK_CommonAcceptChannelFields_get_htlc_basepoint(int64_t this_ptr) {
48006         LDKCommonAcceptChannelFields this_ptr_conv;
48007         this_ptr_conv.inner = untag_ptr(this_ptr);
48008         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48009         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48010         this_ptr_conv.is_owned = false;
48011         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
48012         memcpy(ret_arr->elems, CommonAcceptChannelFields_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
48013         return ret_arr;
48014 }
48015
48016 void  CS_LDK_CommonAcceptChannelFields_set_htlc_basepoint(int64_t this_ptr, int8_tArray val) {
48017         LDKCommonAcceptChannelFields this_ptr_conv;
48018         this_ptr_conv.inner = untag_ptr(this_ptr);
48019         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48020         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48021         this_ptr_conv.is_owned = false;
48022         LDKPublicKey val_ref;
48023         CHECK(val->arr_len == 33);
48024         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
48025         CommonAcceptChannelFields_set_htlc_basepoint(&this_ptr_conv, val_ref);
48026 }
48027
48028 int8_tArray  CS_LDK_CommonAcceptChannelFields_get_first_per_commitment_point(int64_t this_ptr) {
48029         LDKCommonAcceptChannelFields this_ptr_conv;
48030         this_ptr_conv.inner = untag_ptr(this_ptr);
48031         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48032         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48033         this_ptr_conv.is_owned = false;
48034         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
48035         memcpy(ret_arr->elems, CommonAcceptChannelFields_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
48036         return ret_arr;
48037 }
48038
48039 void  CS_LDK_CommonAcceptChannelFields_set_first_per_commitment_point(int64_t this_ptr, int8_tArray val) {
48040         LDKCommonAcceptChannelFields this_ptr_conv;
48041         this_ptr_conv.inner = untag_ptr(this_ptr);
48042         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48043         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48044         this_ptr_conv.is_owned = false;
48045         LDKPublicKey val_ref;
48046         CHECK(val->arr_len == 33);
48047         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
48048         CommonAcceptChannelFields_set_first_per_commitment_point(&this_ptr_conv, val_ref);
48049 }
48050
48051 int64_t  CS_LDK_CommonAcceptChannelFields_get_shutdown_scriptpubkey(int64_t this_ptr) {
48052         LDKCommonAcceptChannelFields this_ptr_conv;
48053         this_ptr_conv.inner = untag_ptr(this_ptr);
48054         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48055         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48056         this_ptr_conv.is_owned = false;
48057         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
48058         *ret_copy = CommonAcceptChannelFields_get_shutdown_scriptpubkey(&this_ptr_conv);
48059         int64_t ret_ref = tag_ptr(ret_copy, true);
48060         return ret_ref;
48061 }
48062
48063 void  CS_LDK_CommonAcceptChannelFields_set_shutdown_scriptpubkey(int64_t this_ptr, int64_t val) {
48064         LDKCommonAcceptChannelFields this_ptr_conv;
48065         this_ptr_conv.inner = untag_ptr(this_ptr);
48066         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48067         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48068         this_ptr_conv.is_owned = false;
48069         void* val_ptr = untag_ptr(val);
48070         CHECK_ACCESS(val_ptr);
48071         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
48072         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
48073         CommonAcceptChannelFields_set_shutdown_scriptpubkey(&this_ptr_conv, val_conv);
48074 }
48075
48076 int64_t  CS_LDK_CommonAcceptChannelFields_get_channel_type(int64_t this_ptr) {
48077         LDKCommonAcceptChannelFields this_ptr_conv;
48078         this_ptr_conv.inner = untag_ptr(this_ptr);
48079         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48080         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48081         this_ptr_conv.is_owned = false;
48082         LDKChannelTypeFeatures ret_var = CommonAcceptChannelFields_get_channel_type(&this_ptr_conv);
48083         int64_t ret_ref = 0;
48084         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48085         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48086         return ret_ref;
48087 }
48088
48089 void  CS_LDK_CommonAcceptChannelFields_set_channel_type(int64_t this_ptr, int64_t val) {
48090         LDKCommonAcceptChannelFields this_ptr_conv;
48091         this_ptr_conv.inner = untag_ptr(this_ptr);
48092         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48093         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48094         this_ptr_conv.is_owned = false;
48095         LDKChannelTypeFeatures val_conv;
48096         val_conv.inner = untag_ptr(val);
48097         val_conv.is_owned = ptr_is_owned(val);
48098         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48099         val_conv = ChannelTypeFeatures_clone(&val_conv);
48100         CommonAcceptChannelFields_set_channel_type(&this_ptr_conv, val_conv);
48101 }
48102
48103 int64_t  CS_LDK_CommonAcceptChannelFields_new(int64_t temporary_channel_id_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, int64_t shutdown_scriptpubkey_arg, int64_t channel_type_arg) {
48104         LDKChannelId temporary_channel_id_arg_conv;
48105         temporary_channel_id_arg_conv.inner = untag_ptr(temporary_channel_id_arg);
48106         temporary_channel_id_arg_conv.is_owned = ptr_is_owned(temporary_channel_id_arg);
48107         CHECK_INNER_FIELD_ACCESS_OR_NULL(temporary_channel_id_arg_conv);
48108         temporary_channel_id_arg_conv = ChannelId_clone(&temporary_channel_id_arg_conv);
48109         LDKPublicKey funding_pubkey_arg_ref;
48110         CHECK(funding_pubkey_arg->arr_len == 33);
48111         memcpy(funding_pubkey_arg_ref.compressed_form, funding_pubkey_arg->elems, 33); FREE(funding_pubkey_arg);
48112         LDKPublicKey revocation_basepoint_arg_ref;
48113         CHECK(revocation_basepoint_arg->arr_len == 33);
48114         memcpy(revocation_basepoint_arg_ref.compressed_form, revocation_basepoint_arg->elems, 33); FREE(revocation_basepoint_arg);
48115         LDKPublicKey payment_basepoint_arg_ref;
48116         CHECK(payment_basepoint_arg->arr_len == 33);
48117         memcpy(payment_basepoint_arg_ref.compressed_form, payment_basepoint_arg->elems, 33); FREE(payment_basepoint_arg);
48118         LDKPublicKey delayed_payment_basepoint_arg_ref;
48119         CHECK(delayed_payment_basepoint_arg->arr_len == 33);
48120         memcpy(delayed_payment_basepoint_arg_ref.compressed_form, delayed_payment_basepoint_arg->elems, 33); FREE(delayed_payment_basepoint_arg);
48121         LDKPublicKey htlc_basepoint_arg_ref;
48122         CHECK(htlc_basepoint_arg->arr_len == 33);
48123         memcpy(htlc_basepoint_arg_ref.compressed_form, htlc_basepoint_arg->elems, 33); FREE(htlc_basepoint_arg);
48124         LDKPublicKey first_per_commitment_point_arg_ref;
48125         CHECK(first_per_commitment_point_arg->arr_len == 33);
48126         memcpy(first_per_commitment_point_arg_ref.compressed_form, first_per_commitment_point_arg->elems, 33); FREE(first_per_commitment_point_arg);
48127         void* shutdown_scriptpubkey_arg_ptr = untag_ptr(shutdown_scriptpubkey_arg);
48128         CHECK_ACCESS(shutdown_scriptpubkey_arg_ptr);
48129         LDKCOption_CVec_u8ZZ shutdown_scriptpubkey_arg_conv = *(LDKCOption_CVec_u8ZZ*)(shutdown_scriptpubkey_arg_ptr);
48130         shutdown_scriptpubkey_arg_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(shutdown_scriptpubkey_arg));
48131         LDKChannelTypeFeatures channel_type_arg_conv;
48132         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
48133         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
48134         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
48135         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
48136         LDKCommonAcceptChannelFields ret_var = CommonAcceptChannelFields_new(temporary_channel_id_arg_conv, 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, shutdown_scriptpubkey_arg_conv, channel_type_arg_conv);
48137         int64_t ret_ref = 0;
48138         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48139         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48140         return ret_ref;
48141 }
48142
48143 static inline uint64_t CommonAcceptChannelFields_clone_ptr(LDKCommonAcceptChannelFields *NONNULL_PTR arg) {
48144         LDKCommonAcceptChannelFields ret_var = CommonAcceptChannelFields_clone(arg);
48145         int64_t ret_ref = 0;
48146         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48147         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48148         return ret_ref;
48149 }
48150 int64_t  CS_LDK_CommonAcceptChannelFields_clone_ptr(int64_t arg) {
48151         LDKCommonAcceptChannelFields arg_conv;
48152         arg_conv.inner = untag_ptr(arg);
48153         arg_conv.is_owned = ptr_is_owned(arg);
48154         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48155         arg_conv.is_owned = false;
48156         int64_t ret_conv = CommonAcceptChannelFields_clone_ptr(&arg_conv);
48157         return ret_conv;
48158 }
48159
48160 int64_t  CS_LDK_CommonAcceptChannelFields_clone(int64_t orig) {
48161         LDKCommonAcceptChannelFields orig_conv;
48162         orig_conv.inner = untag_ptr(orig);
48163         orig_conv.is_owned = ptr_is_owned(orig);
48164         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48165         orig_conv.is_owned = false;
48166         LDKCommonAcceptChannelFields ret_var = CommonAcceptChannelFields_clone(&orig_conv);
48167         int64_t ret_ref = 0;
48168         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48169         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48170         return ret_ref;
48171 }
48172
48173 int64_t  CS_LDK_CommonAcceptChannelFields_hash(int64_t o) {
48174         LDKCommonAcceptChannelFields o_conv;
48175         o_conv.inner = untag_ptr(o);
48176         o_conv.is_owned = ptr_is_owned(o);
48177         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
48178         o_conv.is_owned = false;
48179         int64_t ret_conv = CommonAcceptChannelFields_hash(&o_conv);
48180         return ret_conv;
48181 }
48182
48183 jboolean  CS_LDK_CommonAcceptChannelFields_eq(int64_t a, int64_t b) {
48184         LDKCommonAcceptChannelFields a_conv;
48185         a_conv.inner = untag_ptr(a);
48186         a_conv.is_owned = ptr_is_owned(a);
48187         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48188         a_conv.is_owned = false;
48189         LDKCommonAcceptChannelFields b_conv;
48190         b_conv.inner = untag_ptr(b);
48191         b_conv.is_owned = ptr_is_owned(b);
48192         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48193         b_conv.is_owned = false;
48194         jboolean ret_conv = CommonAcceptChannelFields_eq(&a_conv, &b_conv);
48195         return ret_conv;
48196 }
48197
48198 void  CS_LDK_AcceptChannel_free(int64_t this_obj) {
48199         LDKAcceptChannel this_obj_conv;
48200         this_obj_conv.inner = untag_ptr(this_obj);
48201         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48202         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48203         AcceptChannel_free(this_obj_conv);
48204 }
48205
48206 int64_t  CS_LDK_AcceptChannel_get_common_fields(int64_t this_ptr) {
48207         LDKAcceptChannel this_ptr_conv;
48208         this_ptr_conv.inner = untag_ptr(this_ptr);
48209         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48210         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48211         this_ptr_conv.is_owned = false;
48212         LDKCommonAcceptChannelFields ret_var = AcceptChannel_get_common_fields(&this_ptr_conv);
48213         int64_t ret_ref = 0;
48214         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48215         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48216         return ret_ref;
48217 }
48218
48219 void  CS_LDK_AcceptChannel_set_common_fields(int64_t this_ptr, int64_t val) {
48220         LDKAcceptChannel this_ptr_conv;
48221         this_ptr_conv.inner = untag_ptr(this_ptr);
48222         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48223         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48224         this_ptr_conv.is_owned = false;
48225         LDKCommonAcceptChannelFields val_conv;
48226         val_conv.inner = untag_ptr(val);
48227         val_conv.is_owned = ptr_is_owned(val);
48228         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48229         val_conv = CommonAcceptChannelFields_clone(&val_conv);
48230         AcceptChannel_set_common_fields(&this_ptr_conv, val_conv);
48231 }
48232
48233 int64_t  CS_LDK_AcceptChannel_get_channel_reserve_satoshis(int64_t this_ptr) {
48234         LDKAcceptChannel this_ptr_conv;
48235         this_ptr_conv.inner = untag_ptr(this_ptr);
48236         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48237         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48238         this_ptr_conv.is_owned = false;
48239         int64_t ret_conv = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
48240         return ret_conv;
48241 }
48242
48243 void  CS_LDK_AcceptChannel_set_channel_reserve_satoshis(int64_t this_ptr, int64_t val) {
48244         LDKAcceptChannel this_ptr_conv;
48245         this_ptr_conv.inner = untag_ptr(this_ptr);
48246         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48247         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48248         this_ptr_conv.is_owned = false;
48249         AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
48250 }
48251
48252 int64_t  CS_LDK_AcceptChannel_new(int64_t common_fields_arg, int64_t channel_reserve_satoshis_arg) {
48253         LDKCommonAcceptChannelFields common_fields_arg_conv;
48254         common_fields_arg_conv.inner = untag_ptr(common_fields_arg);
48255         common_fields_arg_conv.is_owned = ptr_is_owned(common_fields_arg);
48256         CHECK_INNER_FIELD_ACCESS_OR_NULL(common_fields_arg_conv);
48257         common_fields_arg_conv = CommonAcceptChannelFields_clone(&common_fields_arg_conv);
48258         LDKAcceptChannel ret_var = AcceptChannel_new(common_fields_arg_conv, channel_reserve_satoshis_arg);
48259         int64_t ret_ref = 0;
48260         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48261         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48262         return ret_ref;
48263 }
48264
48265 static inline uint64_t AcceptChannel_clone_ptr(LDKAcceptChannel *NONNULL_PTR arg) {
48266         LDKAcceptChannel ret_var = AcceptChannel_clone(arg);
48267         int64_t ret_ref = 0;
48268         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48269         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48270         return ret_ref;
48271 }
48272 int64_t  CS_LDK_AcceptChannel_clone_ptr(int64_t arg) {
48273         LDKAcceptChannel arg_conv;
48274         arg_conv.inner = untag_ptr(arg);
48275         arg_conv.is_owned = ptr_is_owned(arg);
48276         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48277         arg_conv.is_owned = false;
48278         int64_t ret_conv = AcceptChannel_clone_ptr(&arg_conv);
48279         return ret_conv;
48280 }
48281
48282 int64_t  CS_LDK_AcceptChannel_clone(int64_t orig) {
48283         LDKAcceptChannel orig_conv;
48284         orig_conv.inner = untag_ptr(orig);
48285         orig_conv.is_owned = ptr_is_owned(orig);
48286         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48287         orig_conv.is_owned = false;
48288         LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
48289         int64_t ret_ref = 0;
48290         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48291         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48292         return ret_ref;
48293 }
48294
48295 int64_t  CS_LDK_AcceptChannel_hash(int64_t o) {
48296         LDKAcceptChannel o_conv;
48297         o_conv.inner = untag_ptr(o);
48298         o_conv.is_owned = ptr_is_owned(o);
48299         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
48300         o_conv.is_owned = false;
48301         int64_t ret_conv = AcceptChannel_hash(&o_conv);
48302         return ret_conv;
48303 }
48304
48305 jboolean  CS_LDK_AcceptChannel_eq(int64_t a, int64_t b) {
48306         LDKAcceptChannel a_conv;
48307         a_conv.inner = untag_ptr(a);
48308         a_conv.is_owned = ptr_is_owned(a);
48309         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48310         a_conv.is_owned = false;
48311         LDKAcceptChannel b_conv;
48312         b_conv.inner = untag_ptr(b);
48313         b_conv.is_owned = ptr_is_owned(b);
48314         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48315         b_conv.is_owned = false;
48316         jboolean ret_conv = AcceptChannel_eq(&a_conv, &b_conv);
48317         return ret_conv;
48318 }
48319
48320 void  CS_LDK_AcceptChannelV2_free(int64_t this_obj) {
48321         LDKAcceptChannelV2 this_obj_conv;
48322         this_obj_conv.inner = untag_ptr(this_obj);
48323         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48324         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48325         AcceptChannelV2_free(this_obj_conv);
48326 }
48327
48328 int64_t  CS_LDK_AcceptChannelV2_get_common_fields(int64_t this_ptr) {
48329         LDKAcceptChannelV2 this_ptr_conv;
48330         this_ptr_conv.inner = untag_ptr(this_ptr);
48331         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48332         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48333         this_ptr_conv.is_owned = false;
48334         LDKCommonAcceptChannelFields ret_var = AcceptChannelV2_get_common_fields(&this_ptr_conv);
48335         int64_t ret_ref = 0;
48336         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48337         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48338         return ret_ref;
48339 }
48340
48341 void  CS_LDK_AcceptChannelV2_set_common_fields(int64_t this_ptr, int64_t val) {
48342         LDKAcceptChannelV2 this_ptr_conv;
48343         this_ptr_conv.inner = untag_ptr(this_ptr);
48344         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48345         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48346         this_ptr_conv.is_owned = false;
48347         LDKCommonAcceptChannelFields val_conv;
48348         val_conv.inner = untag_ptr(val);
48349         val_conv.is_owned = ptr_is_owned(val);
48350         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48351         val_conv = CommonAcceptChannelFields_clone(&val_conv);
48352         AcceptChannelV2_set_common_fields(&this_ptr_conv, val_conv);
48353 }
48354
48355 int64_t  CS_LDK_AcceptChannelV2_get_funding_satoshis(int64_t this_ptr) {
48356         LDKAcceptChannelV2 this_ptr_conv;
48357         this_ptr_conv.inner = untag_ptr(this_ptr);
48358         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48359         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48360         this_ptr_conv.is_owned = false;
48361         int64_t ret_conv = AcceptChannelV2_get_funding_satoshis(&this_ptr_conv);
48362         return ret_conv;
48363 }
48364
48365 void  CS_LDK_AcceptChannelV2_set_funding_satoshis(int64_t this_ptr, int64_t val) {
48366         LDKAcceptChannelV2 this_ptr_conv;
48367         this_ptr_conv.inner = untag_ptr(this_ptr);
48368         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48369         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48370         this_ptr_conv.is_owned = false;
48371         AcceptChannelV2_set_funding_satoshis(&this_ptr_conv, val);
48372 }
48373
48374 int8_tArray  CS_LDK_AcceptChannelV2_get_second_per_commitment_point(int64_t this_ptr) {
48375         LDKAcceptChannelV2 this_ptr_conv;
48376         this_ptr_conv.inner = untag_ptr(this_ptr);
48377         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48378         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48379         this_ptr_conv.is_owned = false;
48380         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
48381         memcpy(ret_arr->elems, AcceptChannelV2_get_second_per_commitment_point(&this_ptr_conv).compressed_form, 33);
48382         return ret_arr;
48383 }
48384
48385 void  CS_LDK_AcceptChannelV2_set_second_per_commitment_point(int64_t this_ptr, int8_tArray val) {
48386         LDKAcceptChannelV2 this_ptr_conv;
48387         this_ptr_conv.inner = untag_ptr(this_ptr);
48388         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48389         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48390         this_ptr_conv.is_owned = false;
48391         LDKPublicKey val_ref;
48392         CHECK(val->arr_len == 33);
48393         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
48394         AcceptChannelV2_set_second_per_commitment_point(&this_ptr_conv, val_ref);
48395 }
48396
48397 int32_t  CS_LDK_AcceptChannelV2_get_require_confirmed_inputs(int64_t this_ptr) {
48398         LDKAcceptChannelV2 this_ptr_conv;
48399         this_ptr_conv.inner = untag_ptr(this_ptr);
48400         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48401         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48402         this_ptr_conv.is_owned = false;
48403         int32_t ret_conv = LDKCOption_NoneZ_to_cs(AcceptChannelV2_get_require_confirmed_inputs(&this_ptr_conv));
48404         return ret_conv;
48405 }
48406
48407 void  CS_LDK_AcceptChannelV2_set_require_confirmed_inputs(int64_t this_ptr, int32_t val) {
48408         LDKAcceptChannelV2 this_ptr_conv;
48409         this_ptr_conv.inner = untag_ptr(this_ptr);
48410         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48411         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48412         this_ptr_conv.is_owned = false;
48413         LDKCOption_NoneZ val_conv = LDKCOption_NoneZ_from_cs(val);
48414         AcceptChannelV2_set_require_confirmed_inputs(&this_ptr_conv, val_conv);
48415 }
48416
48417 int64_t  CS_LDK_AcceptChannelV2_new(int64_t common_fields_arg, int64_t funding_satoshis_arg, int8_tArray second_per_commitment_point_arg, int32_t require_confirmed_inputs_arg) {
48418         LDKCommonAcceptChannelFields common_fields_arg_conv;
48419         common_fields_arg_conv.inner = untag_ptr(common_fields_arg);
48420         common_fields_arg_conv.is_owned = ptr_is_owned(common_fields_arg);
48421         CHECK_INNER_FIELD_ACCESS_OR_NULL(common_fields_arg_conv);
48422         common_fields_arg_conv = CommonAcceptChannelFields_clone(&common_fields_arg_conv);
48423         LDKPublicKey second_per_commitment_point_arg_ref;
48424         CHECK(second_per_commitment_point_arg->arr_len == 33);
48425         memcpy(second_per_commitment_point_arg_ref.compressed_form, second_per_commitment_point_arg->elems, 33); FREE(second_per_commitment_point_arg);
48426         LDKCOption_NoneZ require_confirmed_inputs_arg_conv = LDKCOption_NoneZ_from_cs(require_confirmed_inputs_arg);
48427         LDKAcceptChannelV2 ret_var = AcceptChannelV2_new(common_fields_arg_conv, funding_satoshis_arg, second_per_commitment_point_arg_ref, require_confirmed_inputs_arg_conv);
48428         int64_t ret_ref = 0;
48429         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48430         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48431         return ret_ref;
48432 }
48433
48434 static inline uint64_t AcceptChannelV2_clone_ptr(LDKAcceptChannelV2 *NONNULL_PTR arg) {
48435         LDKAcceptChannelV2 ret_var = AcceptChannelV2_clone(arg);
48436         int64_t ret_ref = 0;
48437         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48438         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48439         return ret_ref;
48440 }
48441 int64_t  CS_LDK_AcceptChannelV2_clone_ptr(int64_t arg) {
48442         LDKAcceptChannelV2 arg_conv;
48443         arg_conv.inner = untag_ptr(arg);
48444         arg_conv.is_owned = ptr_is_owned(arg);
48445         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48446         arg_conv.is_owned = false;
48447         int64_t ret_conv = AcceptChannelV2_clone_ptr(&arg_conv);
48448         return ret_conv;
48449 }
48450
48451 int64_t  CS_LDK_AcceptChannelV2_clone(int64_t orig) {
48452         LDKAcceptChannelV2 orig_conv;
48453         orig_conv.inner = untag_ptr(orig);
48454         orig_conv.is_owned = ptr_is_owned(orig);
48455         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48456         orig_conv.is_owned = false;
48457         LDKAcceptChannelV2 ret_var = AcceptChannelV2_clone(&orig_conv);
48458         int64_t ret_ref = 0;
48459         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48460         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48461         return ret_ref;
48462 }
48463
48464 int64_t  CS_LDK_AcceptChannelV2_hash(int64_t o) {
48465         LDKAcceptChannelV2 o_conv;
48466         o_conv.inner = untag_ptr(o);
48467         o_conv.is_owned = ptr_is_owned(o);
48468         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
48469         o_conv.is_owned = false;
48470         int64_t ret_conv = AcceptChannelV2_hash(&o_conv);
48471         return ret_conv;
48472 }
48473
48474 jboolean  CS_LDK_AcceptChannelV2_eq(int64_t a, int64_t b) {
48475         LDKAcceptChannelV2 a_conv;
48476         a_conv.inner = untag_ptr(a);
48477         a_conv.is_owned = ptr_is_owned(a);
48478         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48479         a_conv.is_owned = false;
48480         LDKAcceptChannelV2 b_conv;
48481         b_conv.inner = untag_ptr(b);
48482         b_conv.is_owned = ptr_is_owned(b);
48483         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48484         b_conv.is_owned = false;
48485         jboolean ret_conv = AcceptChannelV2_eq(&a_conv, &b_conv);
48486         return ret_conv;
48487 }
48488
48489 void  CS_LDK_FundingCreated_free(int64_t this_obj) {
48490         LDKFundingCreated this_obj_conv;
48491         this_obj_conv.inner = untag_ptr(this_obj);
48492         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48493         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48494         FundingCreated_free(this_obj_conv);
48495 }
48496
48497 int64_t  CS_LDK_FundingCreated_get_temporary_channel_id(int64_t this_ptr) {
48498         LDKFundingCreated this_ptr_conv;
48499         this_ptr_conv.inner = untag_ptr(this_ptr);
48500         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48501         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48502         this_ptr_conv.is_owned = false;
48503         LDKChannelId ret_var = FundingCreated_get_temporary_channel_id(&this_ptr_conv);
48504         int64_t ret_ref = 0;
48505         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48506         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48507         return ret_ref;
48508 }
48509
48510 void  CS_LDK_FundingCreated_set_temporary_channel_id(int64_t this_ptr, int64_t val) {
48511         LDKFundingCreated this_ptr_conv;
48512         this_ptr_conv.inner = untag_ptr(this_ptr);
48513         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48514         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48515         this_ptr_conv.is_owned = false;
48516         LDKChannelId val_conv;
48517         val_conv.inner = untag_ptr(val);
48518         val_conv.is_owned = ptr_is_owned(val);
48519         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48520         val_conv = ChannelId_clone(&val_conv);
48521         FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_conv);
48522 }
48523
48524 int8_tArray  CS_LDK_FundingCreated_get_funding_txid(int64_t this_ptr) {
48525         LDKFundingCreated this_ptr_conv;
48526         this_ptr_conv.inner = untag_ptr(this_ptr);
48527         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48528         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48529         this_ptr_conv.is_owned = false;
48530         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
48531         memcpy(ret_arr->elems, *FundingCreated_get_funding_txid(&this_ptr_conv), 32);
48532         return ret_arr;
48533 }
48534
48535 void  CS_LDK_FundingCreated_set_funding_txid(int64_t this_ptr, int8_tArray val) {
48536         LDKFundingCreated this_ptr_conv;
48537         this_ptr_conv.inner = untag_ptr(this_ptr);
48538         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48539         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48540         this_ptr_conv.is_owned = false;
48541         LDKThirtyTwoBytes val_ref;
48542         CHECK(val->arr_len == 32);
48543         memcpy(val_ref.data, val->elems, 32); FREE(val);
48544         FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
48545 }
48546
48547 int16_t  CS_LDK_FundingCreated_get_funding_output_index(int64_t this_ptr) {
48548         LDKFundingCreated this_ptr_conv;
48549         this_ptr_conv.inner = untag_ptr(this_ptr);
48550         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48551         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48552         this_ptr_conv.is_owned = false;
48553         int16_t ret_conv = FundingCreated_get_funding_output_index(&this_ptr_conv);
48554         return ret_conv;
48555 }
48556
48557 void  CS_LDK_FundingCreated_set_funding_output_index(int64_t this_ptr, int16_t val) {
48558         LDKFundingCreated this_ptr_conv;
48559         this_ptr_conv.inner = untag_ptr(this_ptr);
48560         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48561         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48562         this_ptr_conv.is_owned = false;
48563         FundingCreated_set_funding_output_index(&this_ptr_conv, val);
48564 }
48565
48566 int8_tArray  CS_LDK_FundingCreated_get_signature(int64_t this_ptr) {
48567         LDKFundingCreated this_ptr_conv;
48568         this_ptr_conv.inner = untag_ptr(this_ptr);
48569         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48570         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48571         this_ptr_conv.is_owned = false;
48572         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
48573         memcpy(ret_arr->elems, FundingCreated_get_signature(&this_ptr_conv).compact_form, 64);
48574         return ret_arr;
48575 }
48576
48577 void  CS_LDK_FundingCreated_set_signature(int64_t this_ptr, int8_tArray val) {
48578         LDKFundingCreated this_ptr_conv;
48579         this_ptr_conv.inner = untag_ptr(this_ptr);
48580         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48581         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48582         this_ptr_conv.is_owned = false;
48583         LDKECDSASignature val_ref;
48584         CHECK(val->arr_len == 64);
48585         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
48586         FundingCreated_set_signature(&this_ptr_conv, val_ref);
48587 }
48588
48589 int64_t  CS_LDK_FundingCreated_new(int64_t temporary_channel_id_arg, int8_tArray funding_txid_arg, int16_t funding_output_index_arg, int8_tArray signature_arg) {
48590         LDKChannelId temporary_channel_id_arg_conv;
48591         temporary_channel_id_arg_conv.inner = untag_ptr(temporary_channel_id_arg);
48592         temporary_channel_id_arg_conv.is_owned = ptr_is_owned(temporary_channel_id_arg);
48593         CHECK_INNER_FIELD_ACCESS_OR_NULL(temporary_channel_id_arg_conv);
48594         temporary_channel_id_arg_conv = ChannelId_clone(&temporary_channel_id_arg_conv);
48595         LDKThirtyTwoBytes funding_txid_arg_ref;
48596         CHECK(funding_txid_arg->arr_len == 32);
48597         memcpy(funding_txid_arg_ref.data, funding_txid_arg->elems, 32); FREE(funding_txid_arg);
48598         LDKECDSASignature signature_arg_ref;
48599         CHECK(signature_arg->arr_len == 64);
48600         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
48601         LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_conv, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
48602         int64_t ret_ref = 0;
48603         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48604         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48605         return ret_ref;
48606 }
48607
48608 static inline uint64_t FundingCreated_clone_ptr(LDKFundingCreated *NONNULL_PTR arg) {
48609         LDKFundingCreated ret_var = FundingCreated_clone(arg);
48610         int64_t ret_ref = 0;
48611         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48612         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48613         return ret_ref;
48614 }
48615 int64_t  CS_LDK_FundingCreated_clone_ptr(int64_t arg) {
48616         LDKFundingCreated arg_conv;
48617         arg_conv.inner = untag_ptr(arg);
48618         arg_conv.is_owned = ptr_is_owned(arg);
48619         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48620         arg_conv.is_owned = false;
48621         int64_t ret_conv = FundingCreated_clone_ptr(&arg_conv);
48622         return ret_conv;
48623 }
48624
48625 int64_t  CS_LDK_FundingCreated_clone(int64_t orig) {
48626         LDKFundingCreated orig_conv;
48627         orig_conv.inner = untag_ptr(orig);
48628         orig_conv.is_owned = ptr_is_owned(orig);
48629         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48630         orig_conv.is_owned = false;
48631         LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
48632         int64_t ret_ref = 0;
48633         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48634         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48635         return ret_ref;
48636 }
48637
48638 int64_t  CS_LDK_FundingCreated_hash(int64_t o) {
48639         LDKFundingCreated o_conv;
48640         o_conv.inner = untag_ptr(o);
48641         o_conv.is_owned = ptr_is_owned(o);
48642         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
48643         o_conv.is_owned = false;
48644         int64_t ret_conv = FundingCreated_hash(&o_conv);
48645         return ret_conv;
48646 }
48647
48648 jboolean  CS_LDK_FundingCreated_eq(int64_t a, int64_t b) {
48649         LDKFundingCreated a_conv;
48650         a_conv.inner = untag_ptr(a);
48651         a_conv.is_owned = ptr_is_owned(a);
48652         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48653         a_conv.is_owned = false;
48654         LDKFundingCreated b_conv;
48655         b_conv.inner = untag_ptr(b);
48656         b_conv.is_owned = ptr_is_owned(b);
48657         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48658         b_conv.is_owned = false;
48659         jboolean ret_conv = FundingCreated_eq(&a_conv, &b_conv);
48660         return ret_conv;
48661 }
48662
48663 void  CS_LDK_FundingSigned_free(int64_t this_obj) {
48664         LDKFundingSigned this_obj_conv;
48665         this_obj_conv.inner = untag_ptr(this_obj);
48666         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48667         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48668         FundingSigned_free(this_obj_conv);
48669 }
48670
48671 int64_t  CS_LDK_FundingSigned_get_channel_id(int64_t this_ptr) {
48672         LDKFundingSigned this_ptr_conv;
48673         this_ptr_conv.inner = untag_ptr(this_ptr);
48674         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48675         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48676         this_ptr_conv.is_owned = false;
48677         LDKChannelId ret_var = FundingSigned_get_channel_id(&this_ptr_conv);
48678         int64_t ret_ref = 0;
48679         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48680         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48681         return ret_ref;
48682 }
48683
48684 void  CS_LDK_FundingSigned_set_channel_id(int64_t this_ptr, int64_t val) {
48685         LDKFundingSigned this_ptr_conv;
48686         this_ptr_conv.inner = untag_ptr(this_ptr);
48687         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48688         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48689         this_ptr_conv.is_owned = false;
48690         LDKChannelId val_conv;
48691         val_conv.inner = untag_ptr(val);
48692         val_conv.is_owned = ptr_is_owned(val);
48693         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48694         val_conv = ChannelId_clone(&val_conv);
48695         FundingSigned_set_channel_id(&this_ptr_conv, val_conv);
48696 }
48697
48698 int8_tArray  CS_LDK_FundingSigned_get_signature(int64_t this_ptr) {
48699         LDKFundingSigned this_ptr_conv;
48700         this_ptr_conv.inner = untag_ptr(this_ptr);
48701         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48702         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48703         this_ptr_conv.is_owned = false;
48704         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
48705         memcpy(ret_arr->elems, FundingSigned_get_signature(&this_ptr_conv).compact_form, 64);
48706         return ret_arr;
48707 }
48708
48709 void  CS_LDK_FundingSigned_set_signature(int64_t this_ptr, int8_tArray val) {
48710         LDKFundingSigned this_ptr_conv;
48711         this_ptr_conv.inner = untag_ptr(this_ptr);
48712         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48713         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48714         this_ptr_conv.is_owned = false;
48715         LDKECDSASignature val_ref;
48716         CHECK(val->arr_len == 64);
48717         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
48718         FundingSigned_set_signature(&this_ptr_conv, val_ref);
48719 }
48720
48721 int64_t  CS_LDK_FundingSigned_new(int64_t channel_id_arg, int8_tArray signature_arg) {
48722         LDKChannelId channel_id_arg_conv;
48723         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
48724         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
48725         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
48726         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
48727         LDKECDSASignature signature_arg_ref;
48728         CHECK(signature_arg->arr_len == 64);
48729         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
48730         LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_conv, signature_arg_ref);
48731         int64_t ret_ref = 0;
48732         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48733         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48734         return ret_ref;
48735 }
48736
48737 static inline uint64_t FundingSigned_clone_ptr(LDKFundingSigned *NONNULL_PTR arg) {
48738         LDKFundingSigned ret_var = FundingSigned_clone(arg);
48739         int64_t ret_ref = 0;
48740         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48741         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48742         return ret_ref;
48743 }
48744 int64_t  CS_LDK_FundingSigned_clone_ptr(int64_t arg) {
48745         LDKFundingSigned arg_conv;
48746         arg_conv.inner = untag_ptr(arg);
48747         arg_conv.is_owned = ptr_is_owned(arg);
48748         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48749         arg_conv.is_owned = false;
48750         int64_t ret_conv = FundingSigned_clone_ptr(&arg_conv);
48751         return ret_conv;
48752 }
48753
48754 int64_t  CS_LDK_FundingSigned_clone(int64_t orig) {
48755         LDKFundingSigned orig_conv;
48756         orig_conv.inner = untag_ptr(orig);
48757         orig_conv.is_owned = ptr_is_owned(orig);
48758         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48759         orig_conv.is_owned = false;
48760         LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
48761         int64_t ret_ref = 0;
48762         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48763         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48764         return ret_ref;
48765 }
48766
48767 int64_t  CS_LDK_FundingSigned_hash(int64_t o) {
48768         LDKFundingSigned o_conv;
48769         o_conv.inner = untag_ptr(o);
48770         o_conv.is_owned = ptr_is_owned(o);
48771         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
48772         o_conv.is_owned = false;
48773         int64_t ret_conv = FundingSigned_hash(&o_conv);
48774         return ret_conv;
48775 }
48776
48777 jboolean  CS_LDK_FundingSigned_eq(int64_t a, int64_t b) {
48778         LDKFundingSigned a_conv;
48779         a_conv.inner = untag_ptr(a);
48780         a_conv.is_owned = ptr_is_owned(a);
48781         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48782         a_conv.is_owned = false;
48783         LDKFundingSigned b_conv;
48784         b_conv.inner = untag_ptr(b);
48785         b_conv.is_owned = ptr_is_owned(b);
48786         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48787         b_conv.is_owned = false;
48788         jboolean ret_conv = FundingSigned_eq(&a_conv, &b_conv);
48789         return ret_conv;
48790 }
48791
48792 void  CS_LDK_ChannelReady_free(int64_t this_obj) {
48793         LDKChannelReady this_obj_conv;
48794         this_obj_conv.inner = untag_ptr(this_obj);
48795         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48796         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48797         ChannelReady_free(this_obj_conv);
48798 }
48799
48800 int64_t  CS_LDK_ChannelReady_get_channel_id(int64_t this_ptr) {
48801         LDKChannelReady this_ptr_conv;
48802         this_ptr_conv.inner = untag_ptr(this_ptr);
48803         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48804         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48805         this_ptr_conv.is_owned = false;
48806         LDKChannelId ret_var = ChannelReady_get_channel_id(&this_ptr_conv);
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 void  CS_LDK_ChannelReady_set_channel_id(int64_t this_ptr, int64_t val) {
48814         LDKChannelReady this_ptr_conv;
48815         this_ptr_conv.inner = untag_ptr(this_ptr);
48816         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48817         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48818         this_ptr_conv.is_owned = false;
48819         LDKChannelId val_conv;
48820         val_conv.inner = untag_ptr(val);
48821         val_conv.is_owned = ptr_is_owned(val);
48822         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48823         val_conv = ChannelId_clone(&val_conv);
48824         ChannelReady_set_channel_id(&this_ptr_conv, val_conv);
48825 }
48826
48827 int8_tArray  CS_LDK_ChannelReady_get_next_per_commitment_point(int64_t this_ptr) {
48828         LDKChannelReady this_ptr_conv;
48829         this_ptr_conv.inner = untag_ptr(this_ptr);
48830         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48831         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48832         this_ptr_conv.is_owned = false;
48833         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
48834         memcpy(ret_arr->elems, ChannelReady_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
48835         return ret_arr;
48836 }
48837
48838 void  CS_LDK_ChannelReady_set_next_per_commitment_point(int64_t this_ptr, int8_tArray val) {
48839         LDKChannelReady this_ptr_conv;
48840         this_ptr_conv.inner = untag_ptr(this_ptr);
48841         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48842         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48843         this_ptr_conv.is_owned = false;
48844         LDKPublicKey val_ref;
48845         CHECK(val->arr_len == 33);
48846         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
48847         ChannelReady_set_next_per_commitment_point(&this_ptr_conv, val_ref);
48848 }
48849
48850 int64_t  CS_LDK_ChannelReady_get_short_channel_id_alias(int64_t this_ptr) {
48851         LDKChannelReady this_ptr_conv;
48852         this_ptr_conv.inner = untag_ptr(this_ptr);
48853         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48854         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48855         this_ptr_conv.is_owned = false;
48856         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
48857         *ret_copy = ChannelReady_get_short_channel_id_alias(&this_ptr_conv);
48858         int64_t ret_ref = tag_ptr(ret_copy, true);
48859         return ret_ref;
48860 }
48861
48862 void  CS_LDK_ChannelReady_set_short_channel_id_alias(int64_t this_ptr, int64_t val) {
48863         LDKChannelReady this_ptr_conv;
48864         this_ptr_conv.inner = untag_ptr(this_ptr);
48865         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48866         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48867         this_ptr_conv.is_owned = false;
48868         void* val_ptr = untag_ptr(val);
48869         CHECK_ACCESS(val_ptr);
48870         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
48871         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
48872         ChannelReady_set_short_channel_id_alias(&this_ptr_conv, val_conv);
48873 }
48874
48875 int64_t  CS_LDK_ChannelReady_new(int64_t channel_id_arg, int8_tArray next_per_commitment_point_arg, int64_t short_channel_id_alias_arg) {
48876         LDKChannelId channel_id_arg_conv;
48877         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
48878         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
48879         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
48880         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
48881         LDKPublicKey next_per_commitment_point_arg_ref;
48882         CHECK(next_per_commitment_point_arg->arr_len == 33);
48883         memcpy(next_per_commitment_point_arg_ref.compressed_form, next_per_commitment_point_arg->elems, 33); FREE(next_per_commitment_point_arg);
48884         void* short_channel_id_alias_arg_ptr = untag_ptr(short_channel_id_alias_arg);
48885         CHECK_ACCESS(short_channel_id_alias_arg_ptr);
48886         LDKCOption_u64Z short_channel_id_alias_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_alias_arg_ptr);
48887         short_channel_id_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id_alias_arg));
48888         LDKChannelReady ret_var = ChannelReady_new(channel_id_arg_conv, next_per_commitment_point_arg_ref, short_channel_id_alias_arg_conv);
48889         int64_t ret_ref = 0;
48890         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48891         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48892         return ret_ref;
48893 }
48894
48895 static inline uint64_t ChannelReady_clone_ptr(LDKChannelReady *NONNULL_PTR arg) {
48896         LDKChannelReady ret_var = ChannelReady_clone(arg);
48897         int64_t ret_ref = 0;
48898         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48899         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48900         return ret_ref;
48901 }
48902 int64_t  CS_LDK_ChannelReady_clone_ptr(int64_t arg) {
48903         LDKChannelReady arg_conv;
48904         arg_conv.inner = untag_ptr(arg);
48905         arg_conv.is_owned = ptr_is_owned(arg);
48906         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
48907         arg_conv.is_owned = false;
48908         int64_t ret_conv = ChannelReady_clone_ptr(&arg_conv);
48909         return ret_conv;
48910 }
48911
48912 int64_t  CS_LDK_ChannelReady_clone(int64_t orig) {
48913         LDKChannelReady orig_conv;
48914         orig_conv.inner = untag_ptr(orig);
48915         orig_conv.is_owned = ptr_is_owned(orig);
48916         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48917         orig_conv.is_owned = false;
48918         LDKChannelReady ret_var = ChannelReady_clone(&orig_conv);
48919         int64_t ret_ref = 0;
48920         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48921         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48922         return ret_ref;
48923 }
48924
48925 int64_t  CS_LDK_ChannelReady_hash(int64_t o) {
48926         LDKChannelReady o_conv;
48927         o_conv.inner = untag_ptr(o);
48928         o_conv.is_owned = ptr_is_owned(o);
48929         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
48930         o_conv.is_owned = false;
48931         int64_t ret_conv = ChannelReady_hash(&o_conv);
48932         return ret_conv;
48933 }
48934
48935 jboolean  CS_LDK_ChannelReady_eq(int64_t a, int64_t b) {
48936         LDKChannelReady a_conv;
48937         a_conv.inner = untag_ptr(a);
48938         a_conv.is_owned = ptr_is_owned(a);
48939         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48940         a_conv.is_owned = false;
48941         LDKChannelReady b_conv;
48942         b_conv.inner = untag_ptr(b);
48943         b_conv.is_owned = ptr_is_owned(b);
48944         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48945         b_conv.is_owned = false;
48946         jboolean ret_conv = ChannelReady_eq(&a_conv, &b_conv);
48947         return ret_conv;
48948 }
48949
48950 void  CS_LDK_Stfu_free(int64_t this_obj) {
48951         LDKStfu this_obj_conv;
48952         this_obj_conv.inner = untag_ptr(this_obj);
48953         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48954         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48955         Stfu_free(this_obj_conv);
48956 }
48957
48958 int64_t  CS_LDK_Stfu_get_channel_id(int64_t this_ptr) {
48959         LDKStfu this_ptr_conv;
48960         this_ptr_conv.inner = untag_ptr(this_ptr);
48961         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48962         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48963         this_ptr_conv.is_owned = false;
48964         LDKChannelId ret_var = Stfu_get_channel_id(&this_ptr_conv);
48965         int64_t ret_ref = 0;
48966         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48967         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48968         return ret_ref;
48969 }
48970
48971 void  CS_LDK_Stfu_set_channel_id(int64_t this_ptr, int64_t val) {
48972         LDKStfu this_ptr_conv;
48973         this_ptr_conv.inner = untag_ptr(this_ptr);
48974         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48975         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48976         this_ptr_conv.is_owned = false;
48977         LDKChannelId val_conv;
48978         val_conv.inner = untag_ptr(val);
48979         val_conv.is_owned = ptr_is_owned(val);
48980         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
48981         val_conv = ChannelId_clone(&val_conv);
48982         Stfu_set_channel_id(&this_ptr_conv, val_conv);
48983 }
48984
48985 int8_t  CS_LDK_Stfu_get_initiator(int64_t this_ptr) {
48986         LDKStfu this_ptr_conv;
48987         this_ptr_conv.inner = untag_ptr(this_ptr);
48988         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48989         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
48990         this_ptr_conv.is_owned = false;
48991         int8_t ret_conv = Stfu_get_initiator(&this_ptr_conv);
48992         return ret_conv;
48993 }
48994
48995 void  CS_LDK_Stfu_set_initiator(int64_t this_ptr, int8_t val) {
48996         LDKStfu this_ptr_conv;
48997         this_ptr_conv.inner = untag_ptr(this_ptr);
48998         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
48999         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49000         this_ptr_conv.is_owned = false;
49001         Stfu_set_initiator(&this_ptr_conv, val);
49002 }
49003
49004 int64_t  CS_LDK_Stfu_new(int64_t channel_id_arg, int8_t initiator_arg) {
49005         LDKChannelId channel_id_arg_conv;
49006         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
49007         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
49008         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
49009         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
49010         LDKStfu ret_var = Stfu_new(channel_id_arg_conv, initiator_arg);
49011         int64_t ret_ref = 0;
49012         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49013         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49014         return ret_ref;
49015 }
49016
49017 static inline uint64_t Stfu_clone_ptr(LDKStfu *NONNULL_PTR arg) {
49018         LDKStfu ret_var = Stfu_clone(arg);
49019         int64_t ret_ref = 0;
49020         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49021         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49022         return ret_ref;
49023 }
49024 int64_t  CS_LDK_Stfu_clone_ptr(int64_t arg) {
49025         LDKStfu arg_conv;
49026         arg_conv.inner = untag_ptr(arg);
49027         arg_conv.is_owned = ptr_is_owned(arg);
49028         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49029         arg_conv.is_owned = false;
49030         int64_t ret_conv = Stfu_clone_ptr(&arg_conv);
49031         return ret_conv;
49032 }
49033
49034 int64_t  CS_LDK_Stfu_clone(int64_t orig) {
49035         LDKStfu orig_conv;
49036         orig_conv.inner = untag_ptr(orig);
49037         orig_conv.is_owned = ptr_is_owned(orig);
49038         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49039         orig_conv.is_owned = false;
49040         LDKStfu ret_var = Stfu_clone(&orig_conv);
49041         int64_t ret_ref = 0;
49042         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49043         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49044         return ret_ref;
49045 }
49046
49047 jboolean  CS_LDK_Stfu_eq(int64_t a, int64_t b) {
49048         LDKStfu a_conv;
49049         a_conv.inner = untag_ptr(a);
49050         a_conv.is_owned = ptr_is_owned(a);
49051         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49052         a_conv.is_owned = false;
49053         LDKStfu b_conv;
49054         b_conv.inner = untag_ptr(b);
49055         b_conv.is_owned = ptr_is_owned(b);
49056         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49057         b_conv.is_owned = false;
49058         jboolean ret_conv = Stfu_eq(&a_conv, &b_conv);
49059         return ret_conv;
49060 }
49061
49062 void  CS_LDK_Splice_free(int64_t this_obj) {
49063         LDKSplice this_obj_conv;
49064         this_obj_conv.inner = untag_ptr(this_obj);
49065         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49066         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49067         Splice_free(this_obj_conv);
49068 }
49069
49070 int64_t  CS_LDK_Splice_get_channel_id(int64_t this_ptr) {
49071         LDKSplice this_ptr_conv;
49072         this_ptr_conv.inner = untag_ptr(this_ptr);
49073         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49074         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49075         this_ptr_conv.is_owned = false;
49076         LDKChannelId ret_var = Splice_get_channel_id(&this_ptr_conv);
49077         int64_t ret_ref = 0;
49078         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49079         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49080         return ret_ref;
49081 }
49082
49083 void  CS_LDK_Splice_set_channel_id(int64_t this_ptr, int64_t val) {
49084         LDKSplice 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         LDKChannelId val_conv;
49090         val_conv.inner = untag_ptr(val);
49091         val_conv.is_owned = ptr_is_owned(val);
49092         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
49093         val_conv = ChannelId_clone(&val_conv);
49094         Splice_set_channel_id(&this_ptr_conv, val_conv);
49095 }
49096
49097 int8_tArray  CS_LDK_Splice_get_chain_hash(int64_t this_ptr) {
49098         LDKSplice this_ptr_conv;
49099         this_ptr_conv.inner = untag_ptr(this_ptr);
49100         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49101         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49102         this_ptr_conv.is_owned = false;
49103         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
49104         memcpy(ret_arr->elems, *Splice_get_chain_hash(&this_ptr_conv), 32);
49105         return ret_arr;
49106 }
49107
49108 void  CS_LDK_Splice_set_chain_hash(int64_t this_ptr, int8_tArray val) {
49109         LDKSplice this_ptr_conv;
49110         this_ptr_conv.inner = untag_ptr(this_ptr);
49111         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49112         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49113         this_ptr_conv.is_owned = false;
49114         LDKThirtyTwoBytes val_ref;
49115         CHECK(val->arr_len == 32);
49116         memcpy(val_ref.data, val->elems, 32); FREE(val);
49117         Splice_set_chain_hash(&this_ptr_conv, val_ref);
49118 }
49119
49120 int64_t  CS_LDK_Splice_get_relative_satoshis(int64_t this_ptr) {
49121         LDKSplice this_ptr_conv;
49122         this_ptr_conv.inner = untag_ptr(this_ptr);
49123         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49124         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49125         this_ptr_conv.is_owned = false;
49126         int64_t ret_conv = Splice_get_relative_satoshis(&this_ptr_conv);
49127         return ret_conv;
49128 }
49129
49130 void  CS_LDK_Splice_set_relative_satoshis(int64_t this_ptr, int64_t val) {
49131         LDKSplice this_ptr_conv;
49132         this_ptr_conv.inner = untag_ptr(this_ptr);
49133         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49134         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49135         this_ptr_conv.is_owned = false;
49136         Splice_set_relative_satoshis(&this_ptr_conv, val);
49137 }
49138
49139 int32_t  CS_LDK_Splice_get_funding_feerate_perkw(int64_t this_ptr) {
49140         LDKSplice this_ptr_conv;
49141         this_ptr_conv.inner = untag_ptr(this_ptr);
49142         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49143         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49144         this_ptr_conv.is_owned = false;
49145         int32_t ret_conv = Splice_get_funding_feerate_perkw(&this_ptr_conv);
49146         return ret_conv;
49147 }
49148
49149 void  CS_LDK_Splice_set_funding_feerate_perkw(int64_t this_ptr, int32_t val) {
49150         LDKSplice this_ptr_conv;
49151         this_ptr_conv.inner = untag_ptr(this_ptr);
49152         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49153         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49154         this_ptr_conv.is_owned = false;
49155         Splice_set_funding_feerate_perkw(&this_ptr_conv, val);
49156 }
49157
49158 int32_t  CS_LDK_Splice_get_locktime(int64_t this_ptr) {
49159         LDKSplice this_ptr_conv;
49160         this_ptr_conv.inner = untag_ptr(this_ptr);
49161         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49162         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49163         this_ptr_conv.is_owned = false;
49164         int32_t ret_conv = Splice_get_locktime(&this_ptr_conv);
49165         return ret_conv;
49166 }
49167
49168 void  CS_LDK_Splice_set_locktime(int64_t this_ptr, int32_t val) {
49169         LDKSplice this_ptr_conv;
49170         this_ptr_conv.inner = untag_ptr(this_ptr);
49171         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49172         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49173         this_ptr_conv.is_owned = false;
49174         Splice_set_locktime(&this_ptr_conv, val);
49175 }
49176
49177 int8_tArray  CS_LDK_Splice_get_funding_pubkey(int64_t this_ptr) {
49178         LDKSplice this_ptr_conv;
49179         this_ptr_conv.inner = untag_ptr(this_ptr);
49180         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49181         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49182         this_ptr_conv.is_owned = false;
49183         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
49184         memcpy(ret_arr->elems, Splice_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
49185         return ret_arr;
49186 }
49187
49188 void  CS_LDK_Splice_set_funding_pubkey(int64_t this_ptr, int8_tArray val) {
49189         LDKSplice this_ptr_conv;
49190         this_ptr_conv.inner = untag_ptr(this_ptr);
49191         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49192         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49193         this_ptr_conv.is_owned = false;
49194         LDKPublicKey val_ref;
49195         CHECK(val->arr_len == 33);
49196         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
49197         Splice_set_funding_pubkey(&this_ptr_conv, val_ref);
49198 }
49199
49200 int64_t  CS_LDK_Splice_new(int64_t 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) {
49201         LDKChannelId channel_id_arg_conv;
49202         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
49203         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
49204         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
49205         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
49206         LDKThirtyTwoBytes chain_hash_arg_ref;
49207         CHECK(chain_hash_arg->arr_len == 32);
49208         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
49209         LDKPublicKey funding_pubkey_arg_ref;
49210         CHECK(funding_pubkey_arg->arr_len == 33);
49211         memcpy(funding_pubkey_arg_ref.compressed_form, funding_pubkey_arg->elems, 33); FREE(funding_pubkey_arg);
49212         LDKSplice ret_var = Splice_new(channel_id_arg_conv, chain_hash_arg_ref, relative_satoshis_arg, funding_feerate_perkw_arg, locktime_arg, funding_pubkey_arg_ref);
49213         int64_t ret_ref = 0;
49214         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49215         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49216         return ret_ref;
49217 }
49218
49219 static inline uint64_t Splice_clone_ptr(LDKSplice *NONNULL_PTR arg) {
49220         LDKSplice ret_var = Splice_clone(arg);
49221         int64_t ret_ref = 0;
49222         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49223         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49224         return ret_ref;
49225 }
49226 int64_t  CS_LDK_Splice_clone_ptr(int64_t arg) {
49227         LDKSplice arg_conv;
49228         arg_conv.inner = untag_ptr(arg);
49229         arg_conv.is_owned = ptr_is_owned(arg);
49230         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49231         arg_conv.is_owned = false;
49232         int64_t ret_conv = Splice_clone_ptr(&arg_conv);
49233         return ret_conv;
49234 }
49235
49236 int64_t  CS_LDK_Splice_clone(int64_t orig) {
49237         LDKSplice orig_conv;
49238         orig_conv.inner = untag_ptr(orig);
49239         orig_conv.is_owned = ptr_is_owned(orig);
49240         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49241         orig_conv.is_owned = false;
49242         LDKSplice ret_var = Splice_clone(&orig_conv);
49243         int64_t ret_ref = 0;
49244         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49245         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49246         return ret_ref;
49247 }
49248
49249 jboolean  CS_LDK_Splice_eq(int64_t a, int64_t b) {
49250         LDKSplice a_conv;
49251         a_conv.inner = untag_ptr(a);
49252         a_conv.is_owned = ptr_is_owned(a);
49253         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49254         a_conv.is_owned = false;
49255         LDKSplice b_conv;
49256         b_conv.inner = untag_ptr(b);
49257         b_conv.is_owned = ptr_is_owned(b);
49258         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49259         b_conv.is_owned = false;
49260         jboolean ret_conv = Splice_eq(&a_conv, &b_conv);
49261         return ret_conv;
49262 }
49263
49264 void  CS_LDK_SpliceAck_free(int64_t this_obj) {
49265         LDKSpliceAck this_obj_conv;
49266         this_obj_conv.inner = untag_ptr(this_obj);
49267         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49268         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49269         SpliceAck_free(this_obj_conv);
49270 }
49271
49272 int64_t  CS_LDK_SpliceAck_get_channel_id(int64_t this_ptr) {
49273         LDKSpliceAck this_ptr_conv;
49274         this_ptr_conv.inner = untag_ptr(this_ptr);
49275         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49276         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49277         this_ptr_conv.is_owned = false;
49278         LDKChannelId ret_var = SpliceAck_get_channel_id(&this_ptr_conv);
49279         int64_t ret_ref = 0;
49280         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49281         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49282         return ret_ref;
49283 }
49284
49285 void  CS_LDK_SpliceAck_set_channel_id(int64_t this_ptr, int64_t val) {
49286         LDKSpliceAck this_ptr_conv;
49287         this_ptr_conv.inner = untag_ptr(this_ptr);
49288         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49289         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49290         this_ptr_conv.is_owned = false;
49291         LDKChannelId val_conv;
49292         val_conv.inner = untag_ptr(val);
49293         val_conv.is_owned = ptr_is_owned(val);
49294         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
49295         val_conv = ChannelId_clone(&val_conv);
49296         SpliceAck_set_channel_id(&this_ptr_conv, val_conv);
49297 }
49298
49299 int8_tArray  CS_LDK_SpliceAck_get_chain_hash(int64_t this_ptr) {
49300         LDKSpliceAck this_ptr_conv;
49301         this_ptr_conv.inner = untag_ptr(this_ptr);
49302         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49303         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49304         this_ptr_conv.is_owned = false;
49305         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
49306         memcpy(ret_arr->elems, *SpliceAck_get_chain_hash(&this_ptr_conv), 32);
49307         return ret_arr;
49308 }
49309
49310 void  CS_LDK_SpliceAck_set_chain_hash(int64_t this_ptr, int8_tArray val) {
49311         LDKSpliceAck this_ptr_conv;
49312         this_ptr_conv.inner = untag_ptr(this_ptr);
49313         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49314         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49315         this_ptr_conv.is_owned = false;
49316         LDKThirtyTwoBytes val_ref;
49317         CHECK(val->arr_len == 32);
49318         memcpy(val_ref.data, val->elems, 32); FREE(val);
49319         SpliceAck_set_chain_hash(&this_ptr_conv, val_ref);
49320 }
49321
49322 int64_t  CS_LDK_SpliceAck_get_relative_satoshis(int64_t this_ptr) {
49323         LDKSpliceAck this_ptr_conv;
49324         this_ptr_conv.inner = untag_ptr(this_ptr);
49325         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49326         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49327         this_ptr_conv.is_owned = false;
49328         int64_t ret_conv = SpliceAck_get_relative_satoshis(&this_ptr_conv);
49329         return ret_conv;
49330 }
49331
49332 void  CS_LDK_SpliceAck_set_relative_satoshis(int64_t this_ptr, int64_t val) {
49333         LDKSpliceAck this_ptr_conv;
49334         this_ptr_conv.inner = untag_ptr(this_ptr);
49335         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49336         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49337         this_ptr_conv.is_owned = false;
49338         SpliceAck_set_relative_satoshis(&this_ptr_conv, val);
49339 }
49340
49341 int8_tArray  CS_LDK_SpliceAck_get_funding_pubkey(int64_t this_ptr) {
49342         LDKSpliceAck this_ptr_conv;
49343         this_ptr_conv.inner = untag_ptr(this_ptr);
49344         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49345         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49346         this_ptr_conv.is_owned = false;
49347         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
49348         memcpy(ret_arr->elems, SpliceAck_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
49349         return ret_arr;
49350 }
49351
49352 void  CS_LDK_SpliceAck_set_funding_pubkey(int64_t this_ptr, int8_tArray val) {
49353         LDKSpliceAck this_ptr_conv;
49354         this_ptr_conv.inner = untag_ptr(this_ptr);
49355         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49356         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49357         this_ptr_conv.is_owned = false;
49358         LDKPublicKey val_ref;
49359         CHECK(val->arr_len == 33);
49360         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
49361         SpliceAck_set_funding_pubkey(&this_ptr_conv, val_ref);
49362 }
49363
49364 int64_t  CS_LDK_SpliceAck_new(int64_t channel_id_arg, int8_tArray chain_hash_arg, int64_t relative_satoshis_arg, int8_tArray funding_pubkey_arg) {
49365         LDKChannelId channel_id_arg_conv;
49366         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
49367         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
49368         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
49369         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
49370         LDKThirtyTwoBytes chain_hash_arg_ref;
49371         CHECK(chain_hash_arg->arr_len == 32);
49372         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
49373         LDKPublicKey funding_pubkey_arg_ref;
49374         CHECK(funding_pubkey_arg->arr_len == 33);
49375         memcpy(funding_pubkey_arg_ref.compressed_form, funding_pubkey_arg->elems, 33); FREE(funding_pubkey_arg);
49376         LDKSpliceAck ret_var = SpliceAck_new(channel_id_arg_conv, chain_hash_arg_ref, relative_satoshis_arg, funding_pubkey_arg_ref);
49377         int64_t ret_ref = 0;
49378         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49379         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49380         return ret_ref;
49381 }
49382
49383 static inline uint64_t SpliceAck_clone_ptr(LDKSpliceAck *NONNULL_PTR arg) {
49384         LDKSpliceAck ret_var = SpliceAck_clone(arg);
49385         int64_t ret_ref = 0;
49386         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49387         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49388         return ret_ref;
49389 }
49390 int64_t  CS_LDK_SpliceAck_clone_ptr(int64_t arg) {
49391         LDKSpliceAck arg_conv;
49392         arg_conv.inner = untag_ptr(arg);
49393         arg_conv.is_owned = ptr_is_owned(arg);
49394         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49395         arg_conv.is_owned = false;
49396         int64_t ret_conv = SpliceAck_clone_ptr(&arg_conv);
49397         return ret_conv;
49398 }
49399
49400 int64_t  CS_LDK_SpliceAck_clone(int64_t orig) {
49401         LDKSpliceAck orig_conv;
49402         orig_conv.inner = untag_ptr(orig);
49403         orig_conv.is_owned = ptr_is_owned(orig);
49404         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49405         orig_conv.is_owned = false;
49406         LDKSpliceAck ret_var = SpliceAck_clone(&orig_conv);
49407         int64_t ret_ref = 0;
49408         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49409         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49410         return ret_ref;
49411 }
49412
49413 jboolean  CS_LDK_SpliceAck_eq(int64_t a, int64_t b) {
49414         LDKSpliceAck a_conv;
49415         a_conv.inner = untag_ptr(a);
49416         a_conv.is_owned = ptr_is_owned(a);
49417         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49418         a_conv.is_owned = false;
49419         LDKSpliceAck b_conv;
49420         b_conv.inner = untag_ptr(b);
49421         b_conv.is_owned = ptr_is_owned(b);
49422         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49423         b_conv.is_owned = false;
49424         jboolean ret_conv = SpliceAck_eq(&a_conv, &b_conv);
49425         return ret_conv;
49426 }
49427
49428 void  CS_LDK_SpliceLocked_free(int64_t this_obj) {
49429         LDKSpliceLocked this_obj_conv;
49430         this_obj_conv.inner = untag_ptr(this_obj);
49431         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49432         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49433         SpliceLocked_free(this_obj_conv);
49434 }
49435
49436 int64_t  CS_LDK_SpliceLocked_get_channel_id(int64_t this_ptr) {
49437         LDKSpliceLocked this_ptr_conv;
49438         this_ptr_conv.inner = untag_ptr(this_ptr);
49439         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49440         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49441         this_ptr_conv.is_owned = false;
49442         LDKChannelId ret_var = SpliceLocked_get_channel_id(&this_ptr_conv);
49443         int64_t ret_ref = 0;
49444         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49445         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49446         return ret_ref;
49447 }
49448
49449 void  CS_LDK_SpliceLocked_set_channel_id(int64_t this_ptr, int64_t val) {
49450         LDKSpliceLocked this_ptr_conv;
49451         this_ptr_conv.inner = untag_ptr(this_ptr);
49452         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49453         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49454         this_ptr_conv.is_owned = false;
49455         LDKChannelId val_conv;
49456         val_conv.inner = untag_ptr(val);
49457         val_conv.is_owned = ptr_is_owned(val);
49458         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
49459         val_conv = ChannelId_clone(&val_conv);
49460         SpliceLocked_set_channel_id(&this_ptr_conv, val_conv);
49461 }
49462
49463 int64_t  CS_LDK_SpliceLocked_new(int64_t channel_id_arg) {
49464         LDKChannelId channel_id_arg_conv;
49465         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
49466         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
49467         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
49468         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
49469         LDKSpliceLocked ret_var = SpliceLocked_new(channel_id_arg_conv);
49470         int64_t ret_ref = 0;
49471         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49472         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49473         return ret_ref;
49474 }
49475
49476 static inline uint64_t SpliceLocked_clone_ptr(LDKSpliceLocked *NONNULL_PTR arg) {
49477         LDKSpliceLocked ret_var = SpliceLocked_clone(arg);
49478         int64_t ret_ref = 0;
49479         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49480         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49481         return ret_ref;
49482 }
49483 int64_t  CS_LDK_SpliceLocked_clone_ptr(int64_t arg) {
49484         LDKSpliceLocked arg_conv;
49485         arg_conv.inner = untag_ptr(arg);
49486         arg_conv.is_owned = ptr_is_owned(arg);
49487         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49488         arg_conv.is_owned = false;
49489         int64_t ret_conv = SpliceLocked_clone_ptr(&arg_conv);
49490         return ret_conv;
49491 }
49492
49493 int64_t  CS_LDK_SpliceLocked_clone(int64_t orig) {
49494         LDKSpliceLocked orig_conv;
49495         orig_conv.inner = untag_ptr(orig);
49496         orig_conv.is_owned = ptr_is_owned(orig);
49497         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49498         orig_conv.is_owned = false;
49499         LDKSpliceLocked ret_var = SpliceLocked_clone(&orig_conv);
49500         int64_t ret_ref = 0;
49501         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49502         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49503         return ret_ref;
49504 }
49505
49506 jboolean  CS_LDK_SpliceLocked_eq(int64_t a, int64_t b) {
49507         LDKSpliceLocked a_conv;
49508         a_conv.inner = untag_ptr(a);
49509         a_conv.is_owned = ptr_is_owned(a);
49510         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49511         a_conv.is_owned = false;
49512         LDKSpliceLocked b_conv;
49513         b_conv.inner = untag_ptr(b);
49514         b_conv.is_owned = ptr_is_owned(b);
49515         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49516         b_conv.is_owned = false;
49517         jboolean ret_conv = SpliceLocked_eq(&a_conv, &b_conv);
49518         return ret_conv;
49519 }
49520
49521 void  CS_LDK_TxAddInput_free(int64_t this_obj) {
49522         LDKTxAddInput this_obj_conv;
49523         this_obj_conv.inner = untag_ptr(this_obj);
49524         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49525         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49526         TxAddInput_free(this_obj_conv);
49527 }
49528
49529 int64_t  CS_LDK_TxAddInput_get_channel_id(int64_t this_ptr) {
49530         LDKTxAddInput this_ptr_conv;
49531         this_ptr_conv.inner = untag_ptr(this_ptr);
49532         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49533         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49534         this_ptr_conv.is_owned = false;
49535         LDKChannelId ret_var = TxAddInput_get_channel_id(&this_ptr_conv);
49536         int64_t ret_ref = 0;
49537         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49538         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49539         return ret_ref;
49540 }
49541
49542 void  CS_LDK_TxAddInput_set_channel_id(int64_t this_ptr, int64_t val) {
49543         LDKTxAddInput this_ptr_conv;
49544         this_ptr_conv.inner = untag_ptr(this_ptr);
49545         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49546         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49547         this_ptr_conv.is_owned = false;
49548         LDKChannelId val_conv;
49549         val_conv.inner = untag_ptr(val);
49550         val_conv.is_owned = ptr_is_owned(val);
49551         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
49552         val_conv = ChannelId_clone(&val_conv);
49553         TxAddInput_set_channel_id(&this_ptr_conv, val_conv);
49554 }
49555
49556 int64_t  CS_LDK_TxAddInput_get_serial_id(int64_t this_ptr) {
49557         LDKTxAddInput this_ptr_conv;
49558         this_ptr_conv.inner = untag_ptr(this_ptr);
49559         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49560         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49561         this_ptr_conv.is_owned = false;
49562         int64_t ret_conv = TxAddInput_get_serial_id(&this_ptr_conv);
49563         return ret_conv;
49564 }
49565
49566 void  CS_LDK_TxAddInput_set_serial_id(int64_t this_ptr, int64_t val) {
49567         LDKTxAddInput this_ptr_conv;
49568         this_ptr_conv.inner = untag_ptr(this_ptr);
49569         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49570         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49571         this_ptr_conv.is_owned = false;
49572         TxAddInput_set_serial_id(&this_ptr_conv, val);
49573 }
49574
49575 int64_t  CS_LDK_TxAddInput_get_prevtx(int64_t this_ptr) {
49576         LDKTxAddInput this_ptr_conv;
49577         this_ptr_conv.inner = untag_ptr(this_ptr);
49578         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49579         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49580         this_ptr_conv.is_owned = false;
49581         LDKTransactionU16LenLimited ret_var = TxAddInput_get_prevtx(&this_ptr_conv);
49582         int64_t ret_ref = 0;
49583         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49584         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49585         return ret_ref;
49586 }
49587
49588 void  CS_LDK_TxAddInput_set_prevtx(int64_t this_ptr, int64_t val) {
49589         LDKTxAddInput this_ptr_conv;
49590         this_ptr_conv.inner = untag_ptr(this_ptr);
49591         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49592         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49593         this_ptr_conv.is_owned = false;
49594         LDKTransactionU16LenLimited val_conv;
49595         val_conv.inner = untag_ptr(val);
49596         val_conv.is_owned = ptr_is_owned(val);
49597         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
49598         val_conv = TransactionU16LenLimited_clone(&val_conv);
49599         TxAddInput_set_prevtx(&this_ptr_conv, val_conv);
49600 }
49601
49602 int32_t  CS_LDK_TxAddInput_get_prevtx_out(int64_t this_ptr) {
49603         LDKTxAddInput this_ptr_conv;
49604         this_ptr_conv.inner = untag_ptr(this_ptr);
49605         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49606         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49607         this_ptr_conv.is_owned = false;
49608         int32_t ret_conv = TxAddInput_get_prevtx_out(&this_ptr_conv);
49609         return ret_conv;
49610 }
49611
49612 void  CS_LDK_TxAddInput_set_prevtx_out(int64_t this_ptr, int32_t val) {
49613         LDKTxAddInput this_ptr_conv;
49614         this_ptr_conv.inner = untag_ptr(this_ptr);
49615         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49616         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49617         this_ptr_conv.is_owned = false;
49618         TxAddInput_set_prevtx_out(&this_ptr_conv, val);
49619 }
49620
49621 int32_t  CS_LDK_TxAddInput_get_sequence(int64_t this_ptr) {
49622         LDKTxAddInput this_ptr_conv;
49623         this_ptr_conv.inner = untag_ptr(this_ptr);
49624         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49625         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49626         this_ptr_conv.is_owned = false;
49627         int32_t ret_conv = TxAddInput_get_sequence(&this_ptr_conv);
49628         return ret_conv;
49629 }
49630
49631 void  CS_LDK_TxAddInput_set_sequence(int64_t this_ptr, int32_t val) {
49632         LDKTxAddInput this_ptr_conv;
49633         this_ptr_conv.inner = untag_ptr(this_ptr);
49634         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49635         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49636         this_ptr_conv.is_owned = false;
49637         TxAddInput_set_sequence(&this_ptr_conv, val);
49638 }
49639
49640 int64_t  CS_LDK_TxAddInput_new(int64_t channel_id_arg, int64_t serial_id_arg, int64_t prevtx_arg, int32_t prevtx_out_arg, int32_t sequence_arg) {
49641         LDKChannelId channel_id_arg_conv;
49642         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
49643         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
49644         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
49645         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
49646         LDKTransactionU16LenLimited prevtx_arg_conv;
49647         prevtx_arg_conv.inner = untag_ptr(prevtx_arg);
49648         prevtx_arg_conv.is_owned = ptr_is_owned(prevtx_arg);
49649         CHECK_INNER_FIELD_ACCESS_OR_NULL(prevtx_arg_conv);
49650         prevtx_arg_conv = TransactionU16LenLimited_clone(&prevtx_arg_conv);
49651         LDKTxAddInput ret_var = TxAddInput_new(channel_id_arg_conv, serial_id_arg, prevtx_arg_conv, prevtx_out_arg, sequence_arg);
49652         int64_t ret_ref = 0;
49653         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49654         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49655         return ret_ref;
49656 }
49657
49658 static inline uint64_t TxAddInput_clone_ptr(LDKTxAddInput *NONNULL_PTR arg) {
49659         LDKTxAddInput ret_var = TxAddInput_clone(arg);
49660         int64_t ret_ref = 0;
49661         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49662         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49663         return ret_ref;
49664 }
49665 int64_t  CS_LDK_TxAddInput_clone_ptr(int64_t arg) {
49666         LDKTxAddInput arg_conv;
49667         arg_conv.inner = untag_ptr(arg);
49668         arg_conv.is_owned = ptr_is_owned(arg);
49669         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49670         arg_conv.is_owned = false;
49671         int64_t ret_conv = TxAddInput_clone_ptr(&arg_conv);
49672         return ret_conv;
49673 }
49674
49675 int64_t  CS_LDK_TxAddInput_clone(int64_t orig) {
49676         LDKTxAddInput orig_conv;
49677         orig_conv.inner = untag_ptr(orig);
49678         orig_conv.is_owned = ptr_is_owned(orig);
49679         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49680         orig_conv.is_owned = false;
49681         LDKTxAddInput ret_var = TxAddInput_clone(&orig_conv);
49682         int64_t ret_ref = 0;
49683         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49684         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49685         return ret_ref;
49686 }
49687
49688 int64_t  CS_LDK_TxAddInput_hash(int64_t o) {
49689         LDKTxAddInput o_conv;
49690         o_conv.inner = untag_ptr(o);
49691         o_conv.is_owned = ptr_is_owned(o);
49692         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
49693         o_conv.is_owned = false;
49694         int64_t ret_conv = TxAddInput_hash(&o_conv);
49695         return ret_conv;
49696 }
49697
49698 jboolean  CS_LDK_TxAddInput_eq(int64_t a, int64_t b) {
49699         LDKTxAddInput a_conv;
49700         a_conv.inner = untag_ptr(a);
49701         a_conv.is_owned = ptr_is_owned(a);
49702         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49703         a_conv.is_owned = false;
49704         LDKTxAddInput b_conv;
49705         b_conv.inner = untag_ptr(b);
49706         b_conv.is_owned = ptr_is_owned(b);
49707         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49708         b_conv.is_owned = false;
49709         jboolean ret_conv = TxAddInput_eq(&a_conv, &b_conv);
49710         return ret_conv;
49711 }
49712
49713 void  CS_LDK_TxAddOutput_free(int64_t this_obj) {
49714         LDKTxAddOutput this_obj_conv;
49715         this_obj_conv.inner = untag_ptr(this_obj);
49716         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49717         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49718         TxAddOutput_free(this_obj_conv);
49719 }
49720
49721 int64_t  CS_LDK_TxAddOutput_get_channel_id(int64_t this_ptr) {
49722         LDKTxAddOutput this_ptr_conv;
49723         this_ptr_conv.inner = untag_ptr(this_ptr);
49724         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49725         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49726         this_ptr_conv.is_owned = false;
49727         LDKChannelId ret_var = TxAddOutput_get_channel_id(&this_ptr_conv);
49728         int64_t ret_ref = 0;
49729         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49730         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49731         return ret_ref;
49732 }
49733
49734 void  CS_LDK_TxAddOutput_set_channel_id(int64_t this_ptr, int64_t val) {
49735         LDKTxAddOutput this_ptr_conv;
49736         this_ptr_conv.inner = untag_ptr(this_ptr);
49737         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49738         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49739         this_ptr_conv.is_owned = false;
49740         LDKChannelId val_conv;
49741         val_conv.inner = untag_ptr(val);
49742         val_conv.is_owned = ptr_is_owned(val);
49743         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
49744         val_conv = ChannelId_clone(&val_conv);
49745         TxAddOutput_set_channel_id(&this_ptr_conv, val_conv);
49746 }
49747
49748 int64_t  CS_LDK_TxAddOutput_get_serial_id(int64_t this_ptr) {
49749         LDKTxAddOutput this_ptr_conv;
49750         this_ptr_conv.inner = untag_ptr(this_ptr);
49751         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49752         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49753         this_ptr_conv.is_owned = false;
49754         int64_t ret_conv = TxAddOutput_get_serial_id(&this_ptr_conv);
49755         return ret_conv;
49756 }
49757
49758 void  CS_LDK_TxAddOutput_set_serial_id(int64_t this_ptr, int64_t val) {
49759         LDKTxAddOutput this_ptr_conv;
49760         this_ptr_conv.inner = untag_ptr(this_ptr);
49761         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49762         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49763         this_ptr_conv.is_owned = false;
49764         TxAddOutput_set_serial_id(&this_ptr_conv, val);
49765 }
49766
49767 int64_t  CS_LDK_TxAddOutput_get_sats(int64_t this_ptr) {
49768         LDKTxAddOutput this_ptr_conv;
49769         this_ptr_conv.inner = untag_ptr(this_ptr);
49770         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49771         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49772         this_ptr_conv.is_owned = false;
49773         int64_t ret_conv = TxAddOutput_get_sats(&this_ptr_conv);
49774         return ret_conv;
49775 }
49776
49777 void  CS_LDK_TxAddOutput_set_sats(int64_t this_ptr, int64_t val) {
49778         LDKTxAddOutput this_ptr_conv;
49779         this_ptr_conv.inner = untag_ptr(this_ptr);
49780         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49781         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49782         this_ptr_conv.is_owned = false;
49783         TxAddOutput_set_sats(&this_ptr_conv, val);
49784 }
49785
49786 int8_tArray  CS_LDK_TxAddOutput_get_script(int64_t this_ptr) {
49787         LDKTxAddOutput this_ptr_conv;
49788         this_ptr_conv.inner = untag_ptr(this_ptr);
49789         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49790         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49791         this_ptr_conv.is_owned = false;
49792         LDKCVec_u8Z ret_var = TxAddOutput_get_script(&this_ptr_conv);
49793         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
49794         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
49795         CVec_u8Z_free(ret_var);
49796         return ret_arr;
49797 }
49798
49799 void  CS_LDK_TxAddOutput_set_script(int64_t this_ptr, int8_tArray val) {
49800         LDKTxAddOutput this_ptr_conv;
49801         this_ptr_conv.inner = untag_ptr(this_ptr);
49802         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49803         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49804         this_ptr_conv.is_owned = false;
49805         LDKCVec_u8Z val_ref;
49806         val_ref.datalen = val->arr_len;
49807         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
49808         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
49809         TxAddOutput_set_script(&this_ptr_conv, val_ref);
49810 }
49811
49812 int64_t  CS_LDK_TxAddOutput_new(int64_t channel_id_arg, int64_t serial_id_arg, int64_t sats_arg, int8_tArray script_arg) {
49813         LDKChannelId channel_id_arg_conv;
49814         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
49815         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
49816         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
49817         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
49818         LDKCVec_u8Z script_arg_ref;
49819         script_arg_ref.datalen = script_arg->arr_len;
49820         script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
49821         memcpy(script_arg_ref.data, script_arg->elems, script_arg_ref.datalen); FREE(script_arg);
49822         LDKTxAddOutput ret_var = TxAddOutput_new(channel_id_arg_conv, serial_id_arg, sats_arg, script_arg_ref);
49823         int64_t ret_ref = 0;
49824         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49825         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49826         return ret_ref;
49827 }
49828
49829 static inline uint64_t TxAddOutput_clone_ptr(LDKTxAddOutput *NONNULL_PTR arg) {
49830         LDKTxAddOutput ret_var = TxAddOutput_clone(arg);
49831         int64_t ret_ref = 0;
49832         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49833         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49834         return ret_ref;
49835 }
49836 int64_t  CS_LDK_TxAddOutput_clone_ptr(int64_t arg) {
49837         LDKTxAddOutput arg_conv;
49838         arg_conv.inner = untag_ptr(arg);
49839         arg_conv.is_owned = ptr_is_owned(arg);
49840         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49841         arg_conv.is_owned = false;
49842         int64_t ret_conv = TxAddOutput_clone_ptr(&arg_conv);
49843         return ret_conv;
49844 }
49845
49846 int64_t  CS_LDK_TxAddOutput_clone(int64_t orig) {
49847         LDKTxAddOutput orig_conv;
49848         orig_conv.inner = untag_ptr(orig);
49849         orig_conv.is_owned = ptr_is_owned(orig);
49850         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49851         orig_conv.is_owned = false;
49852         LDKTxAddOutput ret_var = TxAddOutput_clone(&orig_conv);
49853         int64_t ret_ref = 0;
49854         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49855         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49856         return ret_ref;
49857 }
49858
49859 int64_t  CS_LDK_TxAddOutput_hash(int64_t o) {
49860         LDKTxAddOutput o_conv;
49861         o_conv.inner = untag_ptr(o);
49862         o_conv.is_owned = ptr_is_owned(o);
49863         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
49864         o_conv.is_owned = false;
49865         int64_t ret_conv = TxAddOutput_hash(&o_conv);
49866         return ret_conv;
49867 }
49868
49869 jboolean  CS_LDK_TxAddOutput_eq(int64_t a, int64_t b) {
49870         LDKTxAddOutput a_conv;
49871         a_conv.inner = untag_ptr(a);
49872         a_conv.is_owned = ptr_is_owned(a);
49873         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49874         a_conv.is_owned = false;
49875         LDKTxAddOutput b_conv;
49876         b_conv.inner = untag_ptr(b);
49877         b_conv.is_owned = ptr_is_owned(b);
49878         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49879         b_conv.is_owned = false;
49880         jboolean ret_conv = TxAddOutput_eq(&a_conv, &b_conv);
49881         return ret_conv;
49882 }
49883
49884 void  CS_LDK_TxRemoveInput_free(int64_t this_obj) {
49885         LDKTxRemoveInput this_obj_conv;
49886         this_obj_conv.inner = untag_ptr(this_obj);
49887         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49888         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49889         TxRemoveInput_free(this_obj_conv);
49890 }
49891
49892 int64_t  CS_LDK_TxRemoveInput_get_channel_id(int64_t this_ptr) {
49893         LDKTxRemoveInput this_ptr_conv;
49894         this_ptr_conv.inner = untag_ptr(this_ptr);
49895         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49896         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49897         this_ptr_conv.is_owned = false;
49898         LDKChannelId ret_var = TxRemoveInput_get_channel_id(&this_ptr_conv);
49899         int64_t ret_ref = 0;
49900         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49901         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49902         return ret_ref;
49903 }
49904
49905 void  CS_LDK_TxRemoveInput_set_channel_id(int64_t this_ptr, int64_t val) {
49906         LDKTxRemoveInput this_ptr_conv;
49907         this_ptr_conv.inner = untag_ptr(this_ptr);
49908         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49909         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49910         this_ptr_conv.is_owned = false;
49911         LDKChannelId val_conv;
49912         val_conv.inner = untag_ptr(val);
49913         val_conv.is_owned = ptr_is_owned(val);
49914         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
49915         val_conv = ChannelId_clone(&val_conv);
49916         TxRemoveInput_set_channel_id(&this_ptr_conv, val_conv);
49917 }
49918
49919 int64_t  CS_LDK_TxRemoveInput_get_serial_id(int64_t this_ptr) {
49920         LDKTxRemoveInput this_ptr_conv;
49921         this_ptr_conv.inner = untag_ptr(this_ptr);
49922         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49923         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49924         this_ptr_conv.is_owned = false;
49925         int64_t ret_conv = TxRemoveInput_get_serial_id(&this_ptr_conv);
49926         return ret_conv;
49927 }
49928
49929 void  CS_LDK_TxRemoveInput_set_serial_id(int64_t this_ptr, int64_t val) {
49930         LDKTxRemoveInput this_ptr_conv;
49931         this_ptr_conv.inner = untag_ptr(this_ptr);
49932         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49933         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49934         this_ptr_conv.is_owned = false;
49935         TxRemoveInput_set_serial_id(&this_ptr_conv, val);
49936 }
49937
49938 int64_t  CS_LDK_TxRemoveInput_new(int64_t channel_id_arg, int64_t serial_id_arg) {
49939         LDKChannelId channel_id_arg_conv;
49940         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
49941         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
49942         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
49943         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
49944         LDKTxRemoveInput ret_var = TxRemoveInput_new(channel_id_arg_conv, serial_id_arg);
49945         int64_t ret_ref = 0;
49946         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49947         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49948         return ret_ref;
49949 }
49950
49951 static inline uint64_t TxRemoveInput_clone_ptr(LDKTxRemoveInput *NONNULL_PTR arg) {
49952         LDKTxRemoveInput ret_var = TxRemoveInput_clone(arg);
49953         int64_t ret_ref = 0;
49954         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49955         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49956         return ret_ref;
49957 }
49958 int64_t  CS_LDK_TxRemoveInput_clone_ptr(int64_t arg) {
49959         LDKTxRemoveInput arg_conv;
49960         arg_conv.inner = untag_ptr(arg);
49961         arg_conv.is_owned = ptr_is_owned(arg);
49962         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49963         arg_conv.is_owned = false;
49964         int64_t ret_conv = TxRemoveInput_clone_ptr(&arg_conv);
49965         return ret_conv;
49966 }
49967
49968 int64_t  CS_LDK_TxRemoveInput_clone(int64_t orig) {
49969         LDKTxRemoveInput orig_conv;
49970         orig_conv.inner = untag_ptr(orig);
49971         orig_conv.is_owned = ptr_is_owned(orig);
49972         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49973         orig_conv.is_owned = false;
49974         LDKTxRemoveInput ret_var = TxRemoveInput_clone(&orig_conv);
49975         int64_t ret_ref = 0;
49976         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49977         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49978         return ret_ref;
49979 }
49980
49981 int64_t  CS_LDK_TxRemoveInput_hash(int64_t o) {
49982         LDKTxRemoveInput o_conv;
49983         o_conv.inner = untag_ptr(o);
49984         o_conv.is_owned = ptr_is_owned(o);
49985         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
49986         o_conv.is_owned = false;
49987         int64_t ret_conv = TxRemoveInput_hash(&o_conv);
49988         return ret_conv;
49989 }
49990
49991 jboolean  CS_LDK_TxRemoveInput_eq(int64_t a, int64_t b) {
49992         LDKTxRemoveInput a_conv;
49993         a_conv.inner = untag_ptr(a);
49994         a_conv.is_owned = ptr_is_owned(a);
49995         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49996         a_conv.is_owned = false;
49997         LDKTxRemoveInput b_conv;
49998         b_conv.inner = untag_ptr(b);
49999         b_conv.is_owned = ptr_is_owned(b);
50000         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
50001         b_conv.is_owned = false;
50002         jboolean ret_conv = TxRemoveInput_eq(&a_conv, &b_conv);
50003         return ret_conv;
50004 }
50005
50006 void  CS_LDK_TxRemoveOutput_free(int64_t this_obj) {
50007         LDKTxRemoveOutput this_obj_conv;
50008         this_obj_conv.inner = untag_ptr(this_obj);
50009         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50010         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50011         TxRemoveOutput_free(this_obj_conv);
50012 }
50013
50014 int64_t  CS_LDK_TxRemoveOutput_get_channel_id(int64_t this_ptr) {
50015         LDKTxRemoveOutput 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         LDKChannelId ret_var = TxRemoveOutput_get_channel_id(&this_ptr_conv);
50021         int64_t ret_ref = 0;
50022         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50023         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50024         return ret_ref;
50025 }
50026
50027 void  CS_LDK_TxRemoveOutput_set_channel_id(int64_t this_ptr, int64_t val) {
50028         LDKTxRemoveOutput this_ptr_conv;
50029         this_ptr_conv.inner = untag_ptr(this_ptr);
50030         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50031         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50032         this_ptr_conv.is_owned = false;
50033         LDKChannelId val_conv;
50034         val_conv.inner = untag_ptr(val);
50035         val_conv.is_owned = ptr_is_owned(val);
50036         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
50037         val_conv = ChannelId_clone(&val_conv);
50038         TxRemoveOutput_set_channel_id(&this_ptr_conv, val_conv);
50039 }
50040
50041 int64_t  CS_LDK_TxRemoveOutput_get_serial_id(int64_t this_ptr) {
50042         LDKTxRemoveOutput this_ptr_conv;
50043         this_ptr_conv.inner = untag_ptr(this_ptr);
50044         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50045         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50046         this_ptr_conv.is_owned = false;
50047         int64_t ret_conv = TxRemoveOutput_get_serial_id(&this_ptr_conv);
50048         return ret_conv;
50049 }
50050
50051 void  CS_LDK_TxRemoveOutput_set_serial_id(int64_t this_ptr, int64_t val) {
50052         LDKTxRemoveOutput this_ptr_conv;
50053         this_ptr_conv.inner = untag_ptr(this_ptr);
50054         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50055         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50056         this_ptr_conv.is_owned = false;
50057         TxRemoveOutput_set_serial_id(&this_ptr_conv, val);
50058 }
50059
50060 int64_t  CS_LDK_TxRemoveOutput_new(int64_t channel_id_arg, int64_t serial_id_arg) {
50061         LDKChannelId channel_id_arg_conv;
50062         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
50063         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
50064         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
50065         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
50066         LDKTxRemoveOutput ret_var = TxRemoveOutput_new(channel_id_arg_conv, serial_id_arg);
50067         int64_t ret_ref = 0;
50068         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50069         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50070         return ret_ref;
50071 }
50072
50073 static inline uint64_t TxRemoveOutput_clone_ptr(LDKTxRemoveOutput *NONNULL_PTR arg) {
50074         LDKTxRemoveOutput ret_var = TxRemoveOutput_clone(arg);
50075         int64_t ret_ref = 0;
50076         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50077         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50078         return ret_ref;
50079 }
50080 int64_t  CS_LDK_TxRemoveOutput_clone_ptr(int64_t arg) {
50081         LDKTxRemoveOutput arg_conv;
50082         arg_conv.inner = untag_ptr(arg);
50083         arg_conv.is_owned = ptr_is_owned(arg);
50084         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50085         arg_conv.is_owned = false;
50086         int64_t ret_conv = TxRemoveOutput_clone_ptr(&arg_conv);
50087         return ret_conv;
50088 }
50089
50090 int64_t  CS_LDK_TxRemoveOutput_clone(int64_t orig) {
50091         LDKTxRemoveOutput orig_conv;
50092         orig_conv.inner = untag_ptr(orig);
50093         orig_conv.is_owned = ptr_is_owned(orig);
50094         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50095         orig_conv.is_owned = false;
50096         LDKTxRemoveOutput ret_var = TxRemoveOutput_clone(&orig_conv);
50097         int64_t ret_ref = 0;
50098         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50099         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50100         return ret_ref;
50101 }
50102
50103 int64_t  CS_LDK_TxRemoveOutput_hash(int64_t o) {
50104         LDKTxRemoveOutput o_conv;
50105         o_conv.inner = untag_ptr(o);
50106         o_conv.is_owned = ptr_is_owned(o);
50107         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
50108         o_conv.is_owned = false;
50109         int64_t ret_conv = TxRemoveOutput_hash(&o_conv);
50110         return ret_conv;
50111 }
50112
50113 jboolean  CS_LDK_TxRemoveOutput_eq(int64_t a, int64_t b) {
50114         LDKTxRemoveOutput a_conv;
50115         a_conv.inner = untag_ptr(a);
50116         a_conv.is_owned = ptr_is_owned(a);
50117         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50118         a_conv.is_owned = false;
50119         LDKTxRemoveOutput b_conv;
50120         b_conv.inner = untag_ptr(b);
50121         b_conv.is_owned = ptr_is_owned(b);
50122         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
50123         b_conv.is_owned = false;
50124         jboolean ret_conv = TxRemoveOutput_eq(&a_conv, &b_conv);
50125         return ret_conv;
50126 }
50127
50128 void  CS_LDK_TxComplete_free(int64_t this_obj) {
50129         LDKTxComplete this_obj_conv;
50130         this_obj_conv.inner = untag_ptr(this_obj);
50131         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50132         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50133         TxComplete_free(this_obj_conv);
50134 }
50135
50136 int64_t  CS_LDK_TxComplete_get_channel_id(int64_t this_ptr) {
50137         LDKTxComplete this_ptr_conv;
50138         this_ptr_conv.inner = untag_ptr(this_ptr);
50139         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50140         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50141         this_ptr_conv.is_owned = false;
50142         LDKChannelId ret_var = TxComplete_get_channel_id(&this_ptr_conv);
50143         int64_t ret_ref = 0;
50144         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50145         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50146         return ret_ref;
50147 }
50148
50149 void  CS_LDK_TxComplete_set_channel_id(int64_t this_ptr, int64_t val) {
50150         LDKTxComplete 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         LDKChannelId val_conv;
50156         val_conv.inner = untag_ptr(val);
50157         val_conv.is_owned = ptr_is_owned(val);
50158         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
50159         val_conv = ChannelId_clone(&val_conv);
50160         TxComplete_set_channel_id(&this_ptr_conv, val_conv);
50161 }
50162
50163 int64_t  CS_LDK_TxComplete_new(int64_t channel_id_arg) {
50164         LDKChannelId channel_id_arg_conv;
50165         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
50166         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
50167         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
50168         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
50169         LDKTxComplete ret_var = TxComplete_new(channel_id_arg_conv);
50170         int64_t ret_ref = 0;
50171         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50172         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50173         return ret_ref;
50174 }
50175
50176 static inline uint64_t TxComplete_clone_ptr(LDKTxComplete *NONNULL_PTR arg) {
50177         LDKTxComplete ret_var = TxComplete_clone(arg);
50178         int64_t ret_ref = 0;
50179         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50180         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50181         return ret_ref;
50182 }
50183 int64_t  CS_LDK_TxComplete_clone_ptr(int64_t arg) {
50184         LDKTxComplete arg_conv;
50185         arg_conv.inner = untag_ptr(arg);
50186         arg_conv.is_owned = ptr_is_owned(arg);
50187         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50188         arg_conv.is_owned = false;
50189         int64_t ret_conv = TxComplete_clone_ptr(&arg_conv);
50190         return ret_conv;
50191 }
50192
50193 int64_t  CS_LDK_TxComplete_clone(int64_t orig) {
50194         LDKTxComplete orig_conv;
50195         orig_conv.inner = untag_ptr(orig);
50196         orig_conv.is_owned = ptr_is_owned(orig);
50197         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50198         orig_conv.is_owned = false;
50199         LDKTxComplete ret_var = TxComplete_clone(&orig_conv);
50200         int64_t ret_ref = 0;
50201         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50202         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50203         return ret_ref;
50204 }
50205
50206 int64_t  CS_LDK_TxComplete_hash(int64_t o) {
50207         LDKTxComplete o_conv;
50208         o_conv.inner = untag_ptr(o);
50209         o_conv.is_owned = ptr_is_owned(o);
50210         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
50211         o_conv.is_owned = false;
50212         int64_t ret_conv = TxComplete_hash(&o_conv);
50213         return ret_conv;
50214 }
50215
50216 jboolean  CS_LDK_TxComplete_eq(int64_t a, int64_t b) {
50217         LDKTxComplete a_conv;
50218         a_conv.inner = untag_ptr(a);
50219         a_conv.is_owned = ptr_is_owned(a);
50220         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50221         a_conv.is_owned = false;
50222         LDKTxComplete b_conv;
50223         b_conv.inner = untag_ptr(b);
50224         b_conv.is_owned = ptr_is_owned(b);
50225         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
50226         b_conv.is_owned = false;
50227         jboolean ret_conv = TxComplete_eq(&a_conv, &b_conv);
50228         return ret_conv;
50229 }
50230
50231 void  CS_LDK_TxSignatures_free(int64_t this_obj) {
50232         LDKTxSignatures this_obj_conv;
50233         this_obj_conv.inner = untag_ptr(this_obj);
50234         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50235         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50236         TxSignatures_free(this_obj_conv);
50237 }
50238
50239 int64_t  CS_LDK_TxSignatures_get_channel_id(int64_t this_ptr) {
50240         LDKTxSignatures this_ptr_conv;
50241         this_ptr_conv.inner = untag_ptr(this_ptr);
50242         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50243         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50244         this_ptr_conv.is_owned = false;
50245         LDKChannelId ret_var = TxSignatures_get_channel_id(&this_ptr_conv);
50246         int64_t ret_ref = 0;
50247         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50248         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50249         return ret_ref;
50250 }
50251
50252 void  CS_LDK_TxSignatures_set_channel_id(int64_t this_ptr, int64_t val) {
50253         LDKTxSignatures this_ptr_conv;
50254         this_ptr_conv.inner = untag_ptr(this_ptr);
50255         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50256         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50257         this_ptr_conv.is_owned = false;
50258         LDKChannelId val_conv;
50259         val_conv.inner = untag_ptr(val);
50260         val_conv.is_owned = ptr_is_owned(val);
50261         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
50262         val_conv = ChannelId_clone(&val_conv);
50263         TxSignatures_set_channel_id(&this_ptr_conv, val_conv);
50264 }
50265
50266 int8_tArray  CS_LDK_TxSignatures_get_tx_hash(int64_t this_ptr) {
50267         LDKTxSignatures this_ptr_conv;
50268         this_ptr_conv.inner = untag_ptr(this_ptr);
50269         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50270         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50271         this_ptr_conv.is_owned = false;
50272         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
50273         memcpy(ret_arr->elems, *TxSignatures_get_tx_hash(&this_ptr_conv), 32);
50274         return ret_arr;
50275 }
50276
50277 void  CS_LDK_TxSignatures_set_tx_hash(int64_t this_ptr, int8_tArray val) {
50278         LDKTxSignatures this_ptr_conv;
50279         this_ptr_conv.inner = untag_ptr(this_ptr);
50280         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50281         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50282         this_ptr_conv.is_owned = false;
50283         LDKThirtyTwoBytes val_ref;
50284         CHECK(val->arr_len == 32);
50285         memcpy(val_ref.data, val->elems, 32); FREE(val);
50286         TxSignatures_set_tx_hash(&this_ptr_conv, val_ref);
50287 }
50288
50289 ptrArray  CS_LDK_TxSignatures_get_witnesses(int64_t this_ptr) {
50290         LDKTxSignatures this_ptr_conv;
50291         this_ptr_conv.inner = untag_ptr(this_ptr);
50292         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50293         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50294         this_ptr_conv.is_owned = false;
50295         LDKCVec_WitnessZ ret_var = TxSignatures_get_witnesses(&this_ptr_conv);
50296         ptrArray ret_arr = NULL;
50297         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
50298         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
50299         for (size_t i = 0; i < ret_var.datalen; i++) {
50300                 LDKWitness ret_conv_8_var = ret_var.data[i];
50301                 int8_tArray ret_conv_8_arr = init_int8_tArray(ret_conv_8_var.datalen, __LINE__);
50302                 memcpy(ret_conv_8_arr->elems, ret_conv_8_var.data, ret_conv_8_var.datalen);
50303                 Witness_free(ret_conv_8_var);
50304                 ret_arr_ptr[i] = ret_conv_8_arr;
50305         }
50306         
50307         FREE(ret_var.data);
50308         return ret_arr;
50309 }
50310
50311 void  CS_LDK_TxSignatures_set_witnesses(int64_t this_ptr, ptrArray val) {
50312         LDKTxSignatures this_ptr_conv;
50313         this_ptr_conv.inner = untag_ptr(this_ptr);
50314         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50315         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50316         this_ptr_conv.is_owned = false;
50317         LDKCVec_WitnessZ val_constr;
50318         val_constr.datalen = val->arr_len;
50319         if (val_constr.datalen > 0)
50320                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKWitness), "LDKCVec_WitnessZ Elements");
50321         else
50322                 val_constr.data = NULL;
50323         int8_tArray* val_vals = (void*) val->elems;
50324         for (size_t i = 0; i < val_constr.datalen; i++) {
50325                 int8_tArray val_conv_8 = val_vals[i];
50326                 LDKWitness val_conv_8_ref;
50327                 val_conv_8_ref.datalen = val_conv_8->arr_len;
50328                 val_conv_8_ref.data = MALLOC(val_conv_8_ref.datalen, "LDKWitness Bytes");
50329                 memcpy(val_conv_8_ref.data, val_conv_8->elems, val_conv_8_ref.datalen); FREE(val_conv_8);
50330                 val_conv_8_ref.data_is_owned = true;
50331                 val_constr.data[i] = val_conv_8_ref;
50332         }
50333         FREE(val);
50334         TxSignatures_set_witnesses(&this_ptr_conv, val_constr);
50335 }
50336
50337 int64_t  CS_LDK_TxSignatures_get_funding_outpoint_sig(int64_t this_ptr) {
50338         LDKTxSignatures this_ptr_conv;
50339         this_ptr_conv.inner = untag_ptr(this_ptr);
50340         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50341         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50342         this_ptr_conv.is_owned = false;
50343         LDKCOption_ECDSASignatureZ *ret_copy = MALLOC(sizeof(LDKCOption_ECDSASignatureZ), "LDKCOption_ECDSASignatureZ");
50344         *ret_copy = TxSignatures_get_funding_outpoint_sig(&this_ptr_conv);
50345         int64_t ret_ref = tag_ptr(ret_copy, true);
50346         return ret_ref;
50347 }
50348
50349 void  CS_LDK_TxSignatures_set_funding_outpoint_sig(int64_t this_ptr, int64_t val) {
50350         LDKTxSignatures this_ptr_conv;
50351         this_ptr_conv.inner = untag_ptr(this_ptr);
50352         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50353         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50354         this_ptr_conv.is_owned = false;
50355         void* val_ptr = untag_ptr(val);
50356         CHECK_ACCESS(val_ptr);
50357         LDKCOption_ECDSASignatureZ val_conv = *(LDKCOption_ECDSASignatureZ*)(val_ptr);
50358         val_conv = COption_ECDSASignatureZ_clone((LDKCOption_ECDSASignatureZ*)untag_ptr(val));
50359         TxSignatures_set_funding_outpoint_sig(&this_ptr_conv, val_conv);
50360 }
50361
50362 int64_t  CS_LDK_TxSignatures_new(int64_t channel_id_arg, int8_tArray tx_hash_arg, ptrArray witnesses_arg, int64_t funding_outpoint_sig_arg) {
50363         LDKChannelId channel_id_arg_conv;
50364         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
50365         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
50366         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
50367         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
50368         LDKThirtyTwoBytes tx_hash_arg_ref;
50369         CHECK(tx_hash_arg->arr_len == 32);
50370         memcpy(tx_hash_arg_ref.data, tx_hash_arg->elems, 32); FREE(tx_hash_arg);
50371         LDKCVec_WitnessZ witnesses_arg_constr;
50372         witnesses_arg_constr.datalen = witnesses_arg->arr_len;
50373         if (witnesses_arg_constr.datalen > 0)
50374                 witnesses_arg_constr.data = MALLOC(witnesses_arg_constr.datalen * sizeof(LDKWitness), "LDKCVec_WitnessZ Elements");
50375         else
50376                 witnesses_arg_constr.data = NULL;
50377         int8_tArray* witnesses_arg_vals = (void*) witnesses_arg->elems;
50378         for (size_t i = 0; i < witnesses_arg_constr.datalen; i++) {
50379                 int8_tArray witnesses_arg_conv_8 = witnesses_arg_vals[i];
50380                 LDKWitness witnesses_arg_conv_8_ref;
50381                 witnesses_arg_conv_8_ref.datalen = witnesses_arg_conv_8->arr_len;
50382                 witnesses_arg_conv_8_ref.data = MALLOC(witnesses_arg_conv_8_ref.datalen, "LDKWitness Bytes");
50383                 memcpy(witnesses_arg_conv_8_ref.data, witnesses_arg_conv_8->elems, witnesses_arg_conv_8_ref.datalen); FREE(witnesses_arg_conv_8);
50384                 witnesses_arg_conv_8_ref.data_is_owned = true;
50385                 witnesses_arg_constr.data[i] = witnesses_arg_conv_8_ref;
50386         }
50387         FREE(witnesses_arg);
50388         void* funding_outpoint_sig_arg_ptr = untag_ptr(funding_outpoint_sig_arg);
50389         CHECK_ACCESS(funding_outpoint_sig_arg_ptr);
50390         LDKCOption_ECDSASignatureZ funding_outpoint_sig_arg_conv = *(LDKCOption_ECDSASignatureZ*)(funding_outpoint_sig_arg_ptr);
50391         funding_outpoint_sig_arg_conv = COption_ECDSASignatureZ_clone((LDKCOption_ECDSASignatureZ*)untag_ptr(funding_outpoint_sig_arg));
50392         LDKTxSignatures ret_var = TxSignatures_new(channel_id_arg_conv, tx_hash_arg_ref, witnesses_arg_constr, funding_outpoint_sig_arg_conv);
50393         int64_t ret_ref = 0;
50394         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50395         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50396         return ret_ref;
50397 }
50398
50399 static inline uint64_t TxSignatures_clone_ptr(LDKTxSignatures *NONNULL_PTR arg) {
50400         LDKTxSignatures ret_var = TxSignatures_clone(arg);
50401         int64_t ret_ref = 0;
50402         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50403         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50404         return ret_ref;
50405 }
50406 int64_t  CS_LDK_TxSignatures_clone_ptr(int64_t arg) {
50407         LDKTxSignatures arg_conv;
50408         arg_conv.inner = untag_ptr(arg);
50409         arg_conv.is_owned = ptr_is_owned(arg);
50410         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50411         arg_conv.is_owned = false;
50412         int64_t ret_conv = TxSignatures_clone_ptr(&arg_conv);
50413         return ret_conv;
50414 }
50415
50416 int64_t  CS_LDK_TxSignatures_clone(int64_t orig) {
50417         LDKTxSignatures orig_conv;
50418         orig_conv.inner = untag_ptr(orig);
50419         orig_conv.is_owned = ptr_is_owned(orig);
50420         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50421         orig_conv.is_owned = false;
50422         LDKTxSignatures ret_var = TxSignatures_clone(&orig_conv);
50423         int64_t ret_ref = 0;
50424         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50425         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50426         return ret_ref;
50427 }
50428
50429 int64_t  CS_LDK_TxSignatures_hash(int64_t o) {
50430         LDKTxSignatures o_conv;
50431         o_conv.inner = untag_ptr(o);
50432         o_conv.is_owned = ptr_is_owned(o);
50433         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
50434         o_conv.is_owned = false;
50435         int64_t ret_conv = TxSignatures_hash(&o_conv);
50436         return ret_conv;
50437 }
50438
50439 jboolean  CS_LDK_TxSignatures_eq(int64_t a, int64_t b) {
50440         LDKTxSignatures a_conv;
50441         a_conv.inner = untag_ptr(a);
50442         a_conv.is_owned = ptr_is_owned(a);
50443         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50444         a_conv.is_owned = false;
50445         LDKTxSignatures b_conv;
50446         b_conv.inner = untag_ptr(b);
50447         b_conv.is_owned = ptr_is_owned(b);
50448         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
50449         b_conv.is_owned = false;
50450         jboolean ret_conv = TxSignatures_eq(&a_conv, &b_conv);
50451         return ret_conv;
50452 }
50453
50454 void  CS_LDK_TxInitRbf_free(int64_t this_obj) {
50455         LDKTxInitRbf this_obj_conv;
50456         this_obj_conv.inner = untag_ptr(this_obj);
50457         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50458         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50459         TxInitRbf_free(this_obj_conv);
50460 }
50461
50462 int64_t  CS_LDK_TxInitRbf_get_channel_id(int64_t this_ptr) {
50463         LDKTxInitRbf this_ptr_conv;
50464         this_ptr_conv.inner = untag_ptr(this_ptr);
50465         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50466         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50467         this_ptr_conv.is_owned = false;
50468         LDKChannelId ret_var = TxInitRbf_get_channel_id(&this_ptr_conv);
50469         int64_t ret_ref = 0;
50470         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50471         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50472         return ret_ref;
50473 }
50474
50475 void  CS_LDK_TxInitRbf_set_channel_id(int64_t this_ptr, int64_t val) {
50476         LDKTxInitRbf this_ptr_conv;
50477         this_ptr_conv.inner = untag_ptr(this_ptr);
50478         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50479         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50480         this_ptr_conv.is_owned = false;
50481         LDKChannelId val_conv;
50482         val_conv.inner = untag_ptr(val);
50483         val_conv.is_owned = ptr_is_owned(val);
50484         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
50485         val_conv = ChannelId_clone(&val_conv);
50486         TxInitRbf_set_channel_id(&this_ptr_conv, val_conv);
50487 }
50488
50489 int32_t  CS_LDK_TxInitRbf_get_locktime(int64_t this_ptr) {
50490         LDKTxInitRbf this_ptr_conv;
50491         this_ptr_conv.inner = untag_ptr(this_ptr);
50492         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50493         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50494         this_ptr_conv.is_owned = false;
50495         int32_t ret_conv = TxInitRbf_get_locktime(&this_ptr_conv);
50496         return ret_conv;
50497 }
50498
50499 void  CS_LDK_TxInitRbf_set_locktime(int64_t this_ptr, int32_t val) {
50500         LDKTxInitRbf this_ptr_conv;
50501         this_ptr_conv.inner = untag_ptr(this_ptr);
50502         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50503         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50504         this_ptr_conv.is_owned = false;
50505         TxInitRbf_set_locktime(&this_ptr_conv, val);
50506 }
50507
50508 int32_t  CS_LDK_TxInitRbf_get_feerate_sat_per_1000_weight(int64_t this_ptr) {
50509         LDKTxInitRbf this_ptr_conv;
50510         this_ptr_conv.inner = untag_ptr(this_ptr);
50511         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50512         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50513         this_ptr_conv.is_owned = false;
50514         int32_t ret_conv = TxInitRbf_get_feerate_sat_per_1000_weight(&this_ptr_conv);
50515         return ret_conv;
50516 }
50517
50518 void  CS_LDK_TxInitRbf_set_feerate_sat_per_1000_weight(int64_t this_ptr, int32_t val) {
50519         LDKTxInitRbf this_ptr_conv;
50520         this_ptr_conv.inner = untag_ptr(this_ptr);
50521         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50522         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50523         this_ptr_conv.is_owned = false;
50524         TxInitRbf_set_feerate_sat_per_1000_weight(&this_ptr_conv, val);
50525 }
50526
50527 int64_t  CS_LDK_TxInitRbf_get_funding_output_contribution(int64_t this_ptr) {
50528         LDKTxInitRbf this_ptr_conv;
50529         this_ptr_conv.inner = untag_ptr(this_ptr);
50530         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50531         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50532         this_ptr_conv.is_owned = false;
50533         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
50534         *ret_copy = TxInitRbf_get_funding_output_contribution(&this_ptr_conv);
50535         int64_t ret_ref = tag_ptr(ret_copy, true);
50536         return ret_ref;
50537 }
50538
50539 void  CS_LDK_TxInitRbf_set_funding_output_contribution(int64_t this_ptr, int64_t val) {
50540         LDKTxInitRbf this_ptr_conv;
50541         this_ptr_conv.inner = untag_ptr(this_ptr);
50542         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50543         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50544         this_ptr_conv.is_owned = false;
50545         void* val_ptr = untag_ptr(val);
50546         CHECK_ACCESS(val_ptr);
50547         LDKCOption_i64Z val_conv = *(LDKCOption_i64Z*)(val_ptr);
50548         val_conv = COption_i64Z_clone((LDKCOption_i64Z*)untag_ptr(val));
50549         TxInitRbf_set_funding_output_contribution(&this_ptr_conv, val_conv);
50550 }
50551
50552 int64_t  CS_LDK_TxInitRbf_new(int64_t channel_id_arg, int32_t locktime_arg, int32_t feerate_sat_per_1000_weight_arg, int64_t funding_output_contribution_arg) {
50553         LDKChannelId channel_id_arg_conv;
50554         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
50555         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
50556         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
50557         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
50558         void* funding_output_contribution_arg_ptr = untag_ptr(funding_output_contribution_arg);
50559         CHECK_ACCESS(funding_output_contribution_arg_ptr);
50560         LDKCOption_i64Z funding_output_contribution_arg_conv = *(LDKCOption_i64Z*)(funding_output_contribution_arg_ptr);
50561         funding_output_contribution_arg_conv = COption_i64Z_clone((LDKCOption_i64Z*)untag_ptr(funding_output_contribution_arg));
50562         LDKTxInitRbf ret_var = TxInitRbf_new(channel_id_arg_conv, locktime_arg, feerate_sat_per_1000_weight_arg, funding_output_contribution_arg_conv);
50563         int64_t ret_ref = 0;
50564         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50565         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50566         return ret_ref;
50567 }
50568
50569 static inline uint64_t TxInitRbf_clone_ptr(LDKTxInitRbf *NONNULL_PTR arg) {
50570         LDKTxInitRbf ret_var = TxInitRbf_clone(arg);
50571         int64_t ret_ref = 0;
50572         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50573         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50574         return ret_ref;
50575 }
50576 int64_t  CS_LDK_TxInitRbf_clone_ptr(int64_t arg) {
50577         LDKTxInitRbf arg_conv;
50578         arg_conv.inner = untag_ptr(arg);
50579         arg_conv.is_owned = ptr_is_owned(arg);
50580         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50581         arg_conv.is_owned = false;
50582         int64_t ret_conv = TxInitRbf_clone_ptr(&arg_conv);
50583         return ret_conv;
50584 }
50585
50586 int64_t  CS_LDK_TxInitRbf_clone(int64_t orig) {
50587         LDKTxInitRbf orig_conv;
50588         orig_conv.inner = untag_ptr(orig);
50589         orig_conv.is_owned = ptr_is_owned(orig);
50590         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50591         orig_conv.is_owned = false;
50592         LDKTxInitRbf ret_var = TxInitRbf_clone(&orig_conv);
50593         int64_t ret_ref = 0;
50594         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50595         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50596         return ret_ref;
50597 }
50598
50599 int64_t  CS_LDK_TxInitRbf_hash(int64_t o) {
50600         LDKTxInitRbf o_conv;
50601         o_conv.inner = untag_ptr(o);
50602         o_conv.is_owned = ptr_is_owned(o);
50603         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
50604         o_conv.is_owned = false;
50605         int64_t ret_conv = TxInitRbf_hash(&o_conv);
50606         return ret_conv;
50607 }
50608
50609 jboolean  CS_LDK_TxInitRbf_eq(int64_t a, int64_t b) {
50610         LDKTxInitRbf a_conv;
50611         a_conv.inner = untag_ptr(a);
50612         a_conv.is_owned = ptr_is_owned(a);
50613         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50614         a_conv.is_owned = false;
50615         LDKTxInitRbf b_conv;
50616         b_conv.inner = untag_ptr(b);
50617         b_conv.is_owned = ptr_is_owned(b);
50618         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
50619         b_conv.is_owned = false;
50620         jboolean ret_conv = TxInitRbf_eq(&a_conv, &b_conv);
50621         return ret_conv;
50622 }
50623
50624 void  CS_LDK_TxAckRbf_free(int64_t this_obj) {
50625         LDKTxAckRbf this_obj_conv;
50626         this_obj_conv.inner = untag_ptr(this_obj);
50627         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50628         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50629         TxAckRbf_free(this_obj_conv);
50630 }
50631
50632 int64_t  CS_LDK_TxAckRbf_get_channel_id(int64_t this_ptr) {
50633         LDKTxAckRbf this_ptr_conv;
50634         this_ptr_conv.inner = untag_ptr(this_ptr);
50635         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50636         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50637         this_ptr_conv.is_owned = false;
50638         LDKChannelId ret_var = TxAckRbf_get_channel_id(&this_ptr_conv);
50639         int64_t ret_ref = 0;
50640         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50641         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50642         return ret_ref;
50643 }
50644
50645 void  CS_LDK_TxAckRbf_set_channel_id(int64_t this_ptr, int64_t val) {
50646         LDKTxAckRbf this_ptr_conv;
50647         this_ptr_conv.inner = untag_ptr(this_ptr);
50648         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50649         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50650         this_ptr_conv.is_owned = false;
50651         LDKChannelId val_conv;
50652         val_conv.inner = untag_ptr(val);
50653         val_conv.is_owned = ptr_is_owned(val);
50654         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
50655         val_conv = ChannelId_clone(&val_conv);
50656         TxAckRbf_set_channel_id(&this_ptr_conv, val_conv);
50657 }
50658
50659 int64_t  CS_LDK_TxAckRbf_get_funding_output_contribution(int64_t this_ptr) {
50660         LDKTxAckRbf this_ptr_conv;
50661         this_ptr_conv.inner = untag_ptr(this_ptr);
50662         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50663         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50664         this_ptr_conv.is_owned = false;
50665         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
50666         *ret_copy = TxAckRbf_get_funding_output_contribution(&this_ptr_conv);
50667         int64_t ret_ref = tag_ptr(ret_copy, true);
50668         return ret_ref;
50669 }
50670
50671 void  CS_LDK_TxAckRbf_set_funding_output_contribution(int64_t this_ptr, int64_t val) {
50672         LDKTxAckRbf this_ptr_conv;
50673         this_ptr_conv.inner = untag_ptr(this_ptr);
50674         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50675         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50676         this_ptr_conv.is_owned = false;
50677         void* val_ptr = untag_ptr(val);
50678         CHECK_ACCESS(val_ptr);
50679         LDKCOption_i64Z val_conv = *(LDKCOption_i64Z*)(val_ptr);
50680         val_conv = COption_i64Z_clone((LDKCOption_i64Z*)untag_ptr(val));
50681         TxAckRbf_set_funding_output_contribution(&this_ptr_conv, val_conv);
50682 }
50683
50684 int64_t  CS_LDK_TxAckRbf_new(int64_t channel_id_arg, int64_t funding_output_contribution_arg) {
50685         LDKChannelId channel_id_arg_conv;
50686         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
50687         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
50688         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
50689         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
50690         void* funding_output_contribution_arg_ptr = untag_ptr(funding_output_contribution_arg);
50691         CHECK_ACCESS(funding_output_contribution_arg_ptr);
50692         LDKCOption_i64Z funding_output_contribution_arg_conv = *(LDKCOption_i64Z*)(funding_output_contribution_arg_ptr);
50693         funding_output_contribution_arg_conv = COption_i64Z_clone((LDKCOption_i64Z*)untag_ptr(funding_output_contribution_arg));
50694         LDKTxAckRbf ret_var = TxAckRbf_new(channel_id_arg_conv, funding_output_contribution_arg_conv);
50695         int64_t ret_ref = 0;
50696         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50697         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50698         return ret_ref;
50699 }
50700
50701 static inline uint64_t TxAckRbf_clone_ptr(LDKTxAckRbf *NONNULL_PTR arg) {
50702         LDKTxAckRbf ret_var = TxAckRbf_clone(arg);
50703         int64_t ret_ref = 0;
50704         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50705         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50706         return ret_ref;
50707 }
50708 int64_t  CS_LDK_TxAckRbf_clone_ptr(int64_t arg) {
50709         LDKTxAckRbf arg_conv;
50710         arg_conv.inner = untag_ptr(arg);
50711         arg_conv.is_owned = ptr_is_owned(arg);
50712         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50713         arg_conv.is_owned = false;
50714         int64_t ret_conv = TxAckRbf_clone_ptr(&arg_conv);
50715         return ret_conv;
50716 }
50717
50718 int64_t  CS_LDK_TxAckRbf_clone(int64_t orig) {
50719         LDKTxAckRbf orig_conv;
50720         orig_conv.inner = untag_ptr(orig);
50721         orig_conv.is_owned = ptr_is_owned(orig);
50722         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50723         orig_conv.is_owned = false;
50724         LDKTxAckRbf ret_var = TxAckRbf_clone(&orig_conv);
50725         int64_t ret_ref = 0;
50726         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50727         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50728         return ret_ref;
50729 }
50730
50731 int64_t  CS_LDK_TxAckRbf_hash(int64_t o) {
50732         LDKTxAckRbf o_conv;
50733         o_conv.inner = untag_ptr(o);
50734         o_conv.is_owned = ptr_is_owned(o);
50735         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
50736         o_conv.is_owned = false;
50737         int64_t ret_conv = TxAckRbf_hash(&o_conv);
50738         return ret_conv;
50739 }
50740
50741 jboolean  CS_LDK_TxAckRbf_eq(int64_t a, int64_t b) {
50742         LDKTxAckRbf a_conv;
50743         a_conv.inner = untag_ptr(a);
50744         a_conv.is_owned = ptr_is_owned(a);
50745         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50746         a_conv.is_owned = false;
50747         LDKTxAckRbf b_conv;
50748         b_conv.inner = untag_ptr(b);
50749         b_conv.is_owned = ptr_is_owned(b);
50750         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
50751         b_conv.is_owned = false;
50752         jboolean ret_conv = TxAckRbf_eq(&a_conv, &b_conv);
50753         return ret_conv;
50754 }
50755
50756 void  CS_LDK_TxAbort_free(int64_t this_obj) {
50757         LDKTxAbort this_obj_conv;
50758         this_obj_conv.inner = untag_ptr(this_obj);
50759         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50760         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50761         TxAbort_free(this_obj_conv);
50762 }
50763
50764 int64_t  CS_LDK_TxAbort_get_channel_id(int64_t this_ptr) {
50765         LDKTxAbort this_ptr_conv;
50766         this_ptr_conv.inner = untag_ptr(this_ptr);
50767         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50768         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50769         this_ptr_conv.is_owned = false;
50770         LDKChannelId ret_var = TxAbort_get_channel_id(&this_ptr_conv);
50771         int64_t ret_ref = 0;
50772         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50773         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50774         return ret_ref;
50775 }
50776
50777 void  CS_LDK_TxAbort_set_channel_id(int64_t this_ptr, int64_t val) {
50778         LDKTxAbort this_ptr_conv;
50779         this_ptr_conv.inner = untag_ptr(this_ptr);
50780         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50781         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50782         this_ptr_conv.is_owned = false;
50783         LDKChannelId val_conv;
50784         val_conv.inner = untag_ptr(val);
50785         val_conv.is_owned = ptr_is_owned(val);
50786         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
50787         val_conv = ChannelId_clone(&val_conv);
50788         TxAbort_set_channel_id(&this_ptr_conv, val_conv);
50789 }
50790
50791 int8_tArray  CS_LDK_TxAbort_get_data(int64_t this_ptr) {
50792         LDKTxAbort this_ptr_conv;
50793         this_ptr_conv.inner = untag_ptr(this_ptr);
50794         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50795         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50796         this_ptr_conv.is_owned = false;
50797         LDKCVec_u8Z ret_var = TxAbort_get_data(&this_ptr_conv);
50798         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
50799         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
50800         CVec_u8Z_free(ret_var);
50801         return ret_arr;
50802 }
50803
50804 void  CS_LDK_TxAbort_set_data(int64_t this_ptr, int8_tArray val) {
50805         LDKTxAbort this_ptr_conv;
50806         this_ptr_conv.inner = untag_ptr(this_ptr);
50807         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50808         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50809         this_ptr_conv.is_owned = false;
50810         LDKCVec_u8Z val_ref;
50811         val_ref.datalen = val->arr_len;
50812         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
50813         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
50814         TxAbort_set_data(&this_ptr_conv, val_ref);
50815 }
50816
50817 int64_t  CS_LDK_TxAbort_new(int64_t channel_id_arg, int8_tArray data_arg) {
50818         LDKChannelId channel_id_arg_conv;
50819         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
50820         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
50821         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
50822         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
50823         LDKCVec_u8Z data_arg_ref;
50824         data_arg_ref.datalen = data_arg->arr_len;
50825         data_arg_ref.data = MALLOC(data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
50826         memcpy(data_arg_ref.data, data_arg->elems, data_arg_ref.datalen); FREE(data_arg);
50827         LDKTxAbort ret_var = TxAbort_new(channel_id_arg_conv, data_arg_ref);
50828         int64_t ret_ref = 0;
50829         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50830         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50831         return ret_ref;
50832 }
50833
50834 static inline uint64_t TxAbort_clone_ptr(LDKTxAbort *NONNULL_PTR arg) {
50835         LDKTxAbort ret_var = TxAbort_clone(arg);
50836         int64_t ret_ref = 0;
50837         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50838         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50839         return ret_ref;
50840 }
50841 int64_t  CS_LDK_TxAbort_clone_ptr(int64_t arg) {
50842         LDKTxAbort arg_conv;
50843         arg_conv.inner = untag_ptr(arg);
50844         arg_conv.is_owned = ptr_is_owned(arg);
50845         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50846         arg_conv.is_owned = false;
50847         int64_t ret_conv = TxAbort_clone_ptr(&arg_conv);
50848         return ret_conv;
50849 }
50850
50851 int64_t  CS_LDK_TxAbort_clone(int64_t orig) {
50852         LDKTxAbort orig_conv;
50853         orig_conv.inner = untag_ptr(orig);
50854         orig_conv.is_owned = ptr_is_owned(orig);
50855         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50856         orig_conv.is_owned = false;
50857         LDKTxAbort ret_var = TxAbort_clone(&orig_conv);
50858         int64_t ret_ref = 0;
50859         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50860         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50861         return ret_ref;
50862 }
50863
50864 int64_t  CS_LDK_TxAbort_hash(int64_t o) {
50865         LDKTxAbort o_conv;
50866         o_conv.inner = untag_ptr(o);
50867         o_conv.is_owned = ptr_is_owned(o);
50868         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
50869         o_conv.is_owned = false;
50870         int64_t ret_conv = TxAbort_hash(&o_conv);
50871         return ret_conv;
50872 }
50873
50874 jboolean  CS_LDK_TxAbort_eq(int64_t a, int64_t b) {
50875         LDKTxAbort a_conv;
50876         a_conv.inner = untag_ptr(a);
50877         a_conv.is_owned = ptr_is_owned(a);
50878         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50879         a_conv.is_owned = false;
50880         LDKTxAbort b_conv;
50881         b_conv.inner = untag_ptr(b);
50882         b_conv.is_owned = ptr_is_owned(b);
50883         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
50884         b_conv.is_owned = false;
50885         jboolean ret_conv = TxAbort_eq(&a_conv, &b_conv);
50886         return ret_conv;
50887 }
50888
50889 void  CS_LDK_Shutdown_free(int64_t this_obj) {
50890         LDKShutdown this_obj_conv;
50891         this_obj_conv.inner = untag_ptr(this_obj);
50892         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50893         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50894         Shutdown_free(this_obj_conv);
50895 }
50896
50897 int64_t  CS_LDK_Shutdown_get_channel_id(int64_t this_ptr) {
50898         LDKShutdown this_ptr_conv;
50899         this_ptr_conv.inner = untag_ptr(this_ptr);
50900         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50901         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50902         this_ptr_conv.is_owned = false;
50903         LDKChannelId ret_var = Shutdown_get_channel_id(&this_ptr_conv);
50904         int64_t ret_ref = 0;
50905         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50906         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50907         return ret_ref;
50908 }
50909
50910 void  CS_LDK_Shutdown_set_channel_id(int64_t this_ptr, int64_t val) {
50911         LDKShutdown this_ptr_conv;
50912         this_ptr_conv.inner = untag_ptr(this_ptr);
50913         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50914         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50915         this_ptr_conv.is_owned = false;
50916         LDKChannelId val_conv;
50917         val_conv.inner = untag_ptr(val);
50918         val_conv.is_owned = ptr_is_owned(val);
50919         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
50920         val_conv = ChannelId_clone(&val_conv);
50921         Shutdown_set_channel_id(&this_ptr_conv, val_conv);
50922 }
50923
50924 int8_tArray  CS_LDK_Shutdown_get_scriptpubkey(int64_t this_ptr) {
50925         LDKShutdown this_ptr_conv;
50926         this_ptr_conv.inner = untag_ptr(this_ptr);
50927         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50928         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50929         this_ptr_conv.is_owned = false;
50930         LDKCVec_u8Z ret_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
50931         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
50932         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
50933         CVec_u8Z_free(ret_var);
50934         return ret_arr;
50935 }
50936
50937 void  CS_LDK_Shutdown_set_scriptpubkey(int64_t this_ptr, int8_tArray val) {
50938         LDKShutdown this_ptr_conv;
50939         this_ptr_conv.inner = untag_ptr(this_ptr);
50940         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50941         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50942         this_ptr_conv.is_owned = false;
50943         LDKCVec_u8Z val_ref;
50944         val_ref.datalen = val->arr_len;
50945         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
50946         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
50947         Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
50948 }
50949
50950 int64_t  CS_LDK_Shutdown_new(int64_t channel_id_arg, int8_tArray scriptpubkey_arg) {
50951         LDKChannelId channel_id_arg_conv;
50952         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
50953         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
50954         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
50955         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
50956         LDKCVec_u8Z scriptpubkey_arg_ref;
50957         scriptpubkey_arg_ref.datalen = scriptpubkey_arg->arr_len;
50958         scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
50959         memcpy(scriptpubkey_arg_ref.data, scriptpubkey_arg->elems, scriptpubkey_arg_ref.datalen); FREE(scriptpubkey_arg);
50960         LDKShutdown ret_var = Shutdown_new(channel_id_arg_conv, scriptpubkey_arg_ref);
50961         int64_t ret_ref = 0;
50962         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50963         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50964         return ret_ref;
50965 }
50966
50967 static inline uint64_t Shutdown_clone_ptr(LDKShutdown *NONNULL_PTR arg) {
50968         LDKShutdown ret_var = Shutdown_clone(arg);
50969         int64_t ret_ref = 0;
50970         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50971         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50972         return ret_ref;
50973 }
50974 int64_t  CS_LDK_Shutdown_clone_ptr(int64_t arg) {
50975         LDKShutdown arg_conv;
50976         arg_conv.inner = untag_ptr(arg);
50977         arg_conv.is_owned = ptr_is_owned(arg);
50978         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50979         arg_conv.is_owned = false;
50980         int64_t ret_conv = Shutdown_clone_ptr(&arg_conv);
50981         return ret_conv;
50982 }
50983
50984 int64_t  CS_LDK_Shutdown_clone(int64_t orig) {
50985         LDKShutdown orig_conv;
50986         orig_conv.inner = untag_ptr(orig);
50987         orig_conv.is_owned = ptr_is_owned(orig);
50988         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50989         orig_conv.is_owned = false;
50990         LDKShutdown ret_var = Shutdown_clone(&orig_conv);
50991         int64_t ret_ref = 0;
50992         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50993         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50994         return ret_ref;
50995 }
50996
50997 int64_t  CS_LDK_Shutdown_hash(int64_t o) {
50998         LDKShutdown o_conv;
50999         o_conv.inner = untag_ptr(o);
51000         o_conv.is_owned = ptr_is_owned(o);
51001         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
51002         o_conv.is_owned = false;
51003         int64_t ret_conv = Shutdown_hash(&o_conv);
51004         return ret_conv;
51005 }
51006
51007 jboolean  CS_LDK_Shutdown_eq(int64_t a, int64_t b) {
51008         LDKShutdown a_conv;
51009         a_conv.inner = untag_ptr(a);
51010         a_conv.is_owned = ptr_is_owned(a);
51011         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
51012         a_conv.is_owned = false;
51013         LDKShutdown b_conv;
51014         b_conv.inner = untag_ptr(b);
51015         b_conv.is_owned = ptr_is_owned(b);
51016         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
51017         b_conv.is_owned = false;
51018         jboolean ret_conv = Shutdown_eq(&a_conv, &b_conv);
51019         return ret_conv;
51020 }
51021
51022 void  CS_LDK_ClosingSignedFeeRange_free(int64_t this_obj) {
51023         LDKClosingSignedFeeRange this_obj_conv;
51024         this_obj_conv.inner = untag_ptr(this_obj);
51025         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51026         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51027         ClosingSignedFeeRange_free(this_obj_conv);
51028 }
51029
51030 int64_t  CS_LDK_ClosingSignedFeeRange_get_min_fee_satoshis(int64_t this_ptr) {
51031         LDKClosingSignedFeeRange this_ptr_conv;
51032         this_ptr_conv.inner = untag_ptr(this_ptr);
51033         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51034         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51035         this_ptr_conv.is_owned = false;
51036         int64_t ret_conv = ClosingSignedFeeRange_get_min_fee_satoshis(&this_ptr_conv);
51037         return ret_conv;
51038 }
51039
51040 void  CS_LDK_ClosingSignedFeeRange_set_min_fee_satoshis(int64_t this_ptr, int64_t val) {
51041         LDKClosingSignedFeeRange this_ptr_conv;
51042         this_ptr_conv.inner = untag_ptr(this_ptr);
51043         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51044         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51045         this_ptr_conv.is_owned = false;
51046         ClosingSignedFeeRange_set_min_fee_satoshis(&this_ptr_conv, val);
51047 }
51048
51049 int64_t  CS_LDK_ClosingSignedFeeRange_get_max_fee_satoshis(int64_t this_ptr) {
51050         LDKClosingSignedFeeRange this_ptr_conv;
51051         this_ptr_conv.inner = untag_ptr(this_ptr);
51052         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51053         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51054         this_ptr_conv.is_owned = false;
51055         int64_t ret_conv = ClosingSignedFeeRange_get_max_fee_satoshis(&this_ptr_conv);
51056         return ret_conv;
51057 }
51058
51059 void  CS_LDK_ClosingSignedFeeRange_set_max_fee_satoshis(int64_t this_ptr, int64_t val) {
51060         LDKClosingSignedFeeRange this_ptr_conv;
51061         this_ptr_conv.inner = untag_ptr(this_ptr);
51062         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51063         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51064         this_ptr_conv.is_owned = false;
51065         ClosingSignedFeeRange_set_max_fee_satoshis(&this_ptr_conv, val);
51066 }
51067
51068 int64_t  CS_LDK_ClosingSignedFeeRange_new(int64_t min_fee_satoshis_arg, int64_t max_fee_satoshis_arg) {
51069         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_new(min_fee_satoshis_arg, max_fee_satoshis_arg);
51070         int64_t ret_ref = 0;
51071         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51072         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51073         return ret_ref;
51074 }
51075
51076 static inline uint64_t ClosingSignedFeeRange_clone_ptr(LDKClosingSignedFeeRange *NONNULL_PTR arg) {
51077         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(arg);
51078         int64_t ret_ref = 0;
51079         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51080         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51081         return ret_ref;
51082 }
51083 int64_t  CS_LDK_ClosingSignedFeeRange_clone_ptr(int64_t arg) {
51084         LDKClosingSignedFeeRange arg_conv;
51085         arg_conv.inner = untag_ptr(arg);
51086         arg_conv.is_owned = ptr_is_owned(arg);
51087         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51088         arg_conv.is_owned = false;
51089         int64_t ret_conv = ClosingSignedFeeRange_clone_ptr(&arg_conv);
51090         return ret_conv;
51091 }
51092
51093 int64_t  CS_LDK_ClosingSignedFeeRange_clone(int64_t orig) {
51094         LDKClosingSignedFeeRange orig_conv;
51095         orig_conv.inner = untag_ptr(orig);
51096         orig_conv.is_owned = ptr_is_owned(orig);
51097         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51098         orig_conv.is_owned = false;
51099         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(&orig_conv);
51100         int64_t ret_ref = 0;
51101         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51102         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51103         return ret_ref;
51104 }
51105
51106 int64_t  CS_LDK_ClosingSignedFeeRange_hash(int64_t o) {
51107         LDKClosingSignedFeeRange o_conv;
51108         o_conv.inner = untag_ptr(o);
51109         o_conv.is_owned = ptr_is_owned(o);
51110         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
51111         o_conv.is_owned = false;
51112         int64_t ret_conv = ClosingSignedFeeRange_hash(&o_conv);
51113         return ret_conv;
51114 }
51115
51116 jboolean  CS_LDK_ClosingSignedFeeRange_eq(int64_t a, int64_t b) {
51117         LDKClosingSignedFeeRange a_conv;
51118         a_conv.inner = untag_ptr(a);
51119         a_conv.is_owned = ptr_is_owned(a);
51120         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
51121         a_conv.is_owned = false;
51122         LDKClosingSignedFeeRange b_conv;
51123         b_conv.inner = untag_ptr(b);
51124         b_conv.is_owned = ptr_is_owned(b);
51125         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
51126         b_conv.is_owned = false;
51127         jboolean ret_conv = ClosingSignedFeeRange_eq(&a_conv, &b_conv);
51128         return ret_conv;
51129 }
51130
51131 void  CS_LDK_ClosingSigned_free(int64_t this_obj) {
51132         LDKClosingSigned this_obj_conv;
51133         this_obj_conv.inner = untag_ptr(this_obj);
51134         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51135         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51136         ClosingSigned_free(this_obj_conv);
51137 }
51138
51139 int64_t  CS_LDK_ClosingSigned_get_channel_id(int64_t this_ptr) {
51140         LDKClosingSigned this_ptr_conv;
51141         this_ptr_conv.inner = untag_ptr(this_ptr);
51142         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51143         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51144         this_ptr_conv.is_owned = false;
51145         LDKChannelId ret_var = ClosingSigned_get_channel_id(&this_ptr_conv);
51146         int64_t ret_ref = 0;
51147         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51148         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51149         return ret_ref;
51150 }
51151
51152 void  CS_LDK_ClosingSigned_set_channel_id(int64_t this_ptr, int64_t val) {
51153         LDKClosingSigned this_ptr_conv;
51154         this_ptr_conv.inner = untag_ptr(this_ptr);
51155         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51156         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51157         this_ptr_conv.is_owned = false;
51158         LDKChannelId val_conv;
51159         val_conv.inner = untag_ptr(val);
51160         val_conv.is_owned = ptr_is_owned(val);
51161         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
51162         val_conv = ChannelId_clone(&val_conv);
51163         ClosingSigned_set_channel_id(&this_ptr_conv, val_conv);
51164 }
51165
51166 int64_t  CS_LDK_ClosingSigned_get_fee_satoshis(int64_t this_ptr) {
51167         LDKClosingSigned this_ptr_conv;
51168         this_ptr_conv.inner = untag_ptr(this_ptr);
51169         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51170         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51171         this_ptr_conv.is_owned = false;
51172         int64_t ret_conv = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
51173         return ret_conv;
51174 }
51175
51176 void  CS_LDK_ClosingSigned_set_fee_satoshis(int64_t this_ptr, int64_t val) {
51177         LDKClosingSigned this_ptr_conv;
51178         this_ptr_conv.inner = untag_ptr(this_ptr);
51179         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51180         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51181         this_ptr_conv.is_owned = false;
51182         ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
51183 }
51184
51185 int8_tArray  CS_LDK_ClosingSigned_get_signature(int64_t this_ptr) {
51186         LDKClosingSigned this_ptr_conv;
51187         this_ptr_conv.inner = untag_ptr(this_ptr);
51188         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51189         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51190         this_ptr_conv.is_owned = false;
51191         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
51192         memcpy(ret_arr->elems, ClosingSigned_get_signature(&this_ptr_conv).compact_form, 64);
51193         return ret_arr;
51194 }
51195
51196 void  CS_LDK_ClosingSigned_set_signature(int64_t this_ptr, int8_tArray val) {
51197         LDKClosingSigned this_ptr_conv;
51198         this_ptr_conv.inner = untag_ptr(this_ptr);
51199         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51200         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51201         this_ptr_conv.is_owned = false;
51202         LDKECDSASignature val_ref;
51203         CHECK(val->arr_len == 64);
51204         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
51205         ClosingSigned_set_signature(&this_ptr_conv, val_ref);
51206 }
51207
51208 int64_t  CS_LDK_ClosingSigned_get_fee_range(int64_t this_ptr) {
51209         LDKClosingSigned this_ptr_conv;
51210         this_ptr_conv.inner = untag_ptr(this_ptr);
51211         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51212         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51213         this_ptr_conv.is_owned = false;
51214         LDKClosingSignedFeeRange ret_var = ClosingSigned_get_fee_range(&this_ptr_conv);
51215         int64_t ret_ref = 0;
51216         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51217         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51218         return ret_ref;
51219 }
51220
51221 void  CS_LDK_ClosingSigned_set_fee_range(int64_t this_ptr, int64_t val) {
51222         LDKClosingSigned this_ptr_conv;
51223         this_ptr_conv.inner = untag_ptr(this_ptr);
51224         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51225         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51226         this_ptr_conv.is_owned = false;
51227         LDKClosingSignedFeeRange val_conv;
51228         val_conv.inner = untag_ptr(val);
51229         val_conv.is_owned = ptr_is_owned(val);
51230         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
51231         val_conv = ClosingSignedFeeRange_clone(&val_conv);
51232         ClosingSigned_set_fee_range(&this_ptr_conv, val_conv);
51233 }
51234
51235 int64_t  CS_LDK_ClosingSigned_new(int64_t channel_id_arg, int64_t fee_satoshis_arg, int8_tArray signature_arg, int64_t fee_range_arg) {
51236         LDKChannelId channel_id_arg_conv;
51237         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
51238         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
51239         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
51240         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
51241         LDKECDSASignature signature_arg_ref;
51242         CHECK(signature_arg->arr_len == 64);
51243         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
51244         LDKClosingSignedFeeRange fee_range_arg_conv;
51245         fee_range_arg_conv.inner = untag_ptr(fee_range_arg);
51246         fee_range_arg_conv.is_owned = ptr_is_owned(fee_range_arg);
51247         CHECK_INNER_FIELD_ACCESS_OR_NULL(fee_range_arg_conv);
51248         fee_range_arg_conv = ClosingSignedFeeRange_clone(&fee_range_arg_conv);
51249         LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_conv, fee_satoshis_arg, signature_arg_ref, fee_range_arg_conv);
51250         int64_t ret_ref = 0;
51251         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51252         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51253         return ret_ref;
51254 }
51255
51256 static inline uint64_t ClosingSigned_clone_ptr(LDKClosingSigned *NONNULL_PTR arg) {
51257         LDKClosingSigned ret_var = ClosingSigned_clone(arg);
51258         int64_t ret_ref = 0;
51259         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51260         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51261         return ret_ref;
51262 }
51263 int64_t  CS_LDK_ClosingSigned_clone_ptr(int64_t arg) {
51264         LDKClosingSigned arg_conv;
51265         arg_conv.inner = untag_ptr(arg);
51266         arg_conv.is_owned = ptr_is_owned(arg);
51267         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51268         arg_conv.is_owned = false;
51269         int64_t ret_conv = ClosingSigned_clone_ptr(&arg_conv);
51270         return ret_conv;
51271 }
51272
51273 int64_t  CS_LDK_ClosingSigned_clone(int64_t orig) {
51274         LDKClosingSigned orig_conv;
51275         orig_conv.inner = untag_ptr(orig);
51276         orig_conv.is_owned = ptr_is_owned(orig);
51277         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51278         orig_conv.is_owned = false;
51279         LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
51280         int64_t ret_ref = 0;
51281         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51282         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51283         return ret_ref;
51284 }
51285
51286 int64_t  CS_LDK_ClosingSigned_hash(int64_t o) {
51287         LDKClosingSigned o_conv;
51288         o_conv.inner = untag_ptr(o);
51289         o_conv.is_owned = ptr_is_owned(o);
51290         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
51291         o_conv.is_owned = false;
51292         int64_t ret_conv = ClosingSigned_hash(&o_conv);
51293         return ret_conv;
51294 }
51295
51296 jboolean  CS_LDK_ClosingSigned_eq(int64_t a, int64_t b) {
51297         LDKClosingSigned a_conv;
51298         a_conv.inner = untag_ptr(a);
51299         a_conv.is_owned = ptr_is_owned(a);
51300         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
51301         a_conv.is_owned = false;
51302         LDKClosingSigned b_conv;
51303         b_conv.inner = untag_ptr(b);
51304         b_conv.is_owned = ptr_is_owned(b);
51305         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
51306         b_conv.is_owned = false;
51307         jboolean ret_conv = ClosingSigned_eq(&a_conv, &b_conv);
51308         return ret_conv;
51309 }
51310
51311 void  CS_LDK_UpdateAddHTLC_free(int64_t this_obj) {
51312         LDKUpdateAddHTLC this_obj_conv;
51313         this_obj_conv.inner = untag_ptr(this_obj);
51314         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51315         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51316         UpdateAddHTLC_free(this_obj_conv);
51317 }
51318
51319 int64_t  CS_LDK_UpdateAddHTLC_get_channel_id(int64_t this_ptr) {
51320         LDKUpdateAddHTLC this_ptr_conv;
51321         this_ptr_conv.inner = untag_ptr(this_ptr);
51322         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51323         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51324         this_ptr_conv.is_owned = false;
51325         LDKChannelId ret_var = UpdateAddHTLC_get_channel_id(&this_ptr_conv);
51326         int64_t ret_ref = 0;
51327         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51328         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51329         return ret_ref;
51330 }
51331
51332 void  CS_LDK_UpdateAddHTLC_set_channel_id(int64_t this_ptr, int64_t val) {
51333         LDKUpdateAddHTLC this_ptr_conv;
51334         this_ptr_conv.inner = untag_ptr(this_ptr);
51335         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51336         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51337         this_ptr_conv.is_owned = false;
51338         LDKChannelId val_conv;
51339         val_conv.inner = untag_ptr(val);
51340         val_conv.is_owned = ptr_is_owned(val);
51341         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
51342         val_conv = ChannelId_clone(&val_conv);
51343         UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_conv);
51344 }
51345
51346 int64_t  CS_LDK_UpdateAddHTLC_get_htlc_id(int64_t this_ptr) {
51347         LDKUpdateAddHTLC this_ptr_conv;
51348         this_ptr_conv.inner = untag_ptr(this_ptr);
51349         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51350         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51351         this_ptr_conv.is_owned = false;
51352         int64_t ret_conv = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
51353         return ret_conv;
51354 }
51355
51356 void  CS_LDK_UpdateAddHTLC_set_htlc_id(int64_t this_ptr, int64_t val) {
51357         LDKUpdateAddHTLC this_ptr_conv;
51358         this_ptr_conv.inner = untag_ptr(this_ptr);
51359         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51360         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51361         this_ptr_conv.is_owned = false;
51362         UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
51363 }
51364
51365 int64_t  CS_LDK_UpdateAddHTLC_get_amount_msat(int64_t this_ptr) {
51366         LDKUpdateAddHTLC this_ptr_conv;
51367         this_ptr_conv.inner = untag_ptr(this_ptr);
51368         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51369         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51370         this_ptr_conv.is_owned = false;
51371         int64_t ret_conv = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
51372         return ret_conv;
51373 }
51374
51375 void  CS_LDK_UpdateAddHTLC_set_amount_msat(int64_t this_ptr, int64_t val) {
51376         LDKUpdateAddHTLC this_ptr_conv;
51377         this_ptr_conv.inner = untag_ptr(this_ptr);
51378         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51379         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51380         this_ptr_conv.is_owned = false;
51381         UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
51382 }
51383
51384 int8_tArray  CS_LDK_UpdateAddHTLC_get_payment_hash(int64_t this_ptr) {
51385         LDKUpdateAddHTLC this_ptr_conv;
51386         this_ptr_conv.inner = untag_ptr(this_ptr);
51387         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51388         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51389         this_ptr_conv.is_owned = false;
51390         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
51391         memcpy(ret_arr->elems, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv), 32);
51392         return ret_arr;
51393 }
51394
51395 void  CS_LDK_UpdateAddHTLC_set_payment_hash(int64_t this_ptr, int8_tArray val) {
51396         LDKUpdateAddHTLC this_ptr_conv;
51397         this_ptr_conv.inner = untag_ptr(this_ptr);
51398         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51399         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51400         this_ptr_conv.is_owned = false;
51401         LDKThirtyTwoBytes val_ref;
51402         CHECK(val->arr_len == 32);
51403         memcpy(val_ref.data, val->elems, 32); FREE(val);
51404         UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
51405 }
51406
51407 int32_t  CS_LDK_UpdateAddHTLC_get_cltv_expiry(int64_t this_ptr) {
51408         LDKUpdateAddHTLC this_ptr_conv;
51409         this_ptr_conv.inner = untag_ptr(this_ptr);
51410         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51411         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51412         this_ptr_conv.is_owned = false;
51413         int32_t ret_conv = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
51414         return ret_conv;
51415 }
51416
51417 void  CS_LDK_UpdateAddHTLC_set_cltv_expiry(int64_t this_ptr, int32_t val) {
51418         LDKUpdateAddHTLC this_ptr_conv;
51419         this_ptr_conv.inner = untag_ptr(this_ptr);
51420         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51421         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51422         this_ptr_conv.is_owned = false;
51423         UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
51424 }
51425
51426 int64_t  CS_LDK_UpdateAddHTLC_get_skimmed_fee_msat(int64_t this_ptr) {
51427         LDKUpdateAddHTLC this_ptr_conv;
51428         this_ptr_conv.inner = untag_ptr(this_ptr);
51429         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51430         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51431         this_ptr_conv.is_owned = false;
51432         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
51433         *ret_copy = UpdateAddHTLC_get_skimmed_fee_msat(&this_ptr_conv);
51434         int64_t ret_ref = tag_ptr(ret_copy, true);
51435         return ret_ref;
51436 }
51437
51438 void  CS_LDK_UpdateAddHTLC_set_skimmed_fee_msat(int64_t this_ptr, int64_t val) {
51439         LDKUpdateAddHTLC this_ptr_conv;
51440         this_ptr_conv.inner = untag_ptr(this_ptr);
51441         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51442         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51443         this_ptr_conv.is_owned = false;
51444         void* val_ptr = untag_ptr(val);
51445         CHECK_ACCESS(val_ptr);
51446         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
51447         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
51448         UpdateAddHTLC_set_skimmed_fee_msat(&this_ptr_conv, val_conv);
51449 }
51450
51451 int64_t  CS_LDK_UpdateAddHTLC_get_onion_routing_packet(int64_t this_ptr) {
51452         LDKUpdateAddHTLC this_ptr_conv;
51453         this_ptr_conv.inner = untag_ptr(this_ptr);
51454         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51455         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51456         this_ptr_conv.is_owned = false;
51457         LDKOnionPacket ret_var = UpdateAddHTLC_get_onion_routing_packet(&this_ptr_conv);
51458         int64_t ret_ref = 0;
51459         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51460         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51461         return ret_ref;
51462 }
51463
51464 void  CS_LDK_UpdateAddHTLC_set_onion_routing_packet(int64_t this_ptr, int64_t val) {
51465         LDKUpdateAddHTLC this_ptr_conv;
51466         this_ptr_conv.inner = untag_ptr(this_ptr);
51467         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51468         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51469         this_ptr_conv.is_owned = false;
51470         LDKOnionPacket val_conv;
51471         val_conv.inner = untag_ptr(val);
51472         val_conv.is_owned = ptr_is_owned(val);
51473         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
51474         val_conv = OnionPacket_clone(&val_conv);
51475         UpdateAddHTLC_set_onion_routing_packet(&this_ptr_conv, val_conv);
51476 }
51477
51478 int8_tArray  CS_LDK_UpdateAddHTLC_get_blinding_point(int64_t this_ptr) {
51479         LDKUpdateAddHTLC this_ptr_conv;
51480         this_ptr_conv.inner = untag_ptr(this_ptr);
51481         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51482         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51483         this_ptr_conv.is_owned = false;
51484         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
51485         memcpy(ret_arr->elems, UpdateAddHTLC_get_blinding_point(&this_ptr_conv).compressed_form, 33);
51486         return ret_arr;
51487 }
51488
51489 void  CS_LDK_UpdateAddHTLC_set_blinding_point(int64_t this_ptr, int8_tArray val) {
51490         LDKUpdateAddHTLC this_ptr_conv;
51491         this_ptr_conv.inner = untag_ptr(this_ptr);
51492         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51493         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51494         this_ptr_conv.is_owned = false;
51495         LDKPublicKey val_ref;
51496         CHECK(val->arr_len == 33);
51497         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
51498         UpdateAddHTLC_set_blinding_point(&this_ptr_conv, val_ref);
51499 }
51500
51501 int64_t  CS_LDK_UpdateAddHTLC_new(int64_t 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) {
51502         LDKChannelId channel_id_arg_conv;
51503         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
51504         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
51505         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
51506         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
51507         LDKThirtyTwoBytes payment_hash_arg_ref;
51508         CHECK(payment_hash_arg->arr_len == 32);
51509         memcpy(payment_hash_arg_ref.data, payment_hash_arg->elems, 32); FREE(payment_hash_arg);
51510         void* skimmed_fee_msat_arg_ptr = untag_ptr(skimmed_fee_msat_arg);
51511         CHECK_ACCESS(skimmed_fee_msat_arg_ptr);
51512         LDKCOption_u64Z skimmed_fee_msat_arg_conv = *(LDKCOption_u64Z*)(skimmed_fee_msat_arg_ptr);
51513         skimmed_fee_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(skimmed_fee_msat_arg));
51514         LDKOnionPacket onion_routing_packet_arg_conv;
51515         onion_routing_packet_arg_conv.inner = untag_ptr(onion_routing_packet_arg);
51516         onion_routing_packet_arg_conv.is_owned = ptr_is_owned(onion_routing_packet_arg);
51517         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_routing_packet_arg_conv);
51518         onion_routing_packet_arg_conv = OnionPacket_clone(&onion_routing_packet_arg_conv);
51519         LDKPublicKey blinding_point_arg_ref;
51520         CHECK(blinding_point_arg->arr_len == 33);
51521         memcpy(blinding_point_arg_ref.compressed_form, blinding_point_arg->elems, 33); FREE(blinding_point_arg);
51522         LDKUpdateAddHTLC ret_var = UpdateAddHTLC_new(channel_id_arg_conv, 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);
51523         int64_t ret_ref = 0;
51524         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51525         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51526         return ret_ref;
51527 }
51528
51529 static inline uint64_t UpdateAddHTLC_clone_ptr(LDKUpdateAddHTLC *NONNULL_PTR arg) {
51530         LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(arg);
51531         int64_t ret_ref = 0;
51532         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51533         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51534         return ret_ref;
51535 }
51536 int64_t  CS_LDK_UpdateAddHTLC_clone_ptr(int64_t arg) {
51537         LDKUpdateAddHTLC arg_conv;
51538         arg_conv.inner = untag_ptr(arg);
51539         arg_conv.is_owned = ptr_is_owned(arg);
51540         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51541         arg_conv.is_owned = false;
51542         int64_t ret_conv = UpdateAddHTLC_clone_ptr(&arg_conv);
51543         return ret_conv;
51544 }
51545
51546 int64_t  CS_LDK_UpdateAddHTLC_clone(int64_t orig) {
51547         LDKUpdateAddHTLC orig_conv;
51548         orig_conv.inner = untag_ptr(orig);
51549         orig_conv.is_owned = ptr_is_owned(orig);
51550         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51551         orig_conv.is_owned = false;
51552         LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
51553         int64_t ret_ref = 0;
51554         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51555         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51556         return ret_ref;
51557 }
51558
51559 int64_t  CS_LDK_UpdateAddHTLC_hash(int64_t o) {
51560         LDKUpdateAddHTLC o_conv;
51561         o_conv.inner = untag_ptr(o);
51562         o_conv.is_owned = ptr_is_owned(o);
51563         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
51564         o_conv.is_owned = false;
51565         int64_t ret_conv = UpdateAddHTLC_hash(&o_conv);
51566         return ret_conv;
51567 }
51568
51569 jboolean  CS_LDK_UpdateAddHTLC_eq(int64_t a, int64_t b) {
51570         LDKUpdateAddHTLC a_conv;
51571         a_conv.inner = untag_ptr(a);
51572         a_conv.is_owned = ptr_is_owned(a);
51573         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
51574         a_conv.is_owned = false;
51575         LDKUpdateAddHTLC b_conv;
51576         b_conv.inner = untag_ptr(b);
51577         b_conv.is_owned = ptr_is_owned(b);
51578         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
51579         b_conv.is_owned = false;
51580         jboolean ret_conv = UpdateAddHTLC_eq(&a_conv, &b_conv);
51581         return ret_conv;
51582 }
51583
51584 void  CS_LDK_OnionMessage_free(int64_t this_obj) {
51585         LDKOnionMessage this_obj_conv;
51586         this_obj_conv.inner = untag_ptr(this_obj);
51587         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51588         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51589         OnionMessage_free(this_obj_conv);
51590 }
51591
51592 int8_tArray  CS_LDK_OnionMessage_get_blinding_point(int64_t this_ptr) {
51593         LDKOnionMessage this_ptr_conv;
51594         this_ptr_conv.inner = untag_ptr(this_ptr);
51595         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51596         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51597         this_ptr_conv.is_owned = false;
51598         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
51599         memcpy(ret_arr->elems, OnionMessage_get_blinding_point(&this_ptr_conv).compressed_form, 33);
51600         return ret_arr;
51601 }
51602
51603 void  CS_LDK_OnionMessage_set_blinding_point(int64_t this_ptr, int8_tArray val) {
51604         LDKOnionMessage this_ptr_conv;
51605         this_ptr_conv.inner = untag_ptr(this_ptr);
51606         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51607         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51608         this_ptr_conv.is_owned = false;
51609         LDKPublicKey val_ref;
51610         CHECK(val->arr_len == 33);
51611         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
51612         OnionMessage_set_blinding_point(&this_ptr_conv, val_ref);
51613 }
51614
51615 int64_t  CS_LDK_OnionMessage_get_onion_routing_packet(int64_t this_ptr) {
51616         LDKOnionMessage this_ptr_conv;
51617         this_ptr_conv.inner = untag_ptr(this_ptr);
51618         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51619         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51620         this_ptr_conv.is_owned = false;
51621         LDKPacket ret_var = OnionMessage_get_onion_routing_packet(&this_ptr_conv);
51622         int64_t ret_ref = 0;
51623         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51624         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51625         return ret_ref;
51626 }
51627
51628 void  CS_LDK_OnionMessage_set_onion_routing_packet(int64_t this_ptr, int64_t val) {
51629         LDKOnionMessage this_ptr_conv;
51630         this_ptr_conv.inner = untag_ptr(this_ptr);
51631         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51632         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51633         this_ptr_conv.is_owned = false;
51634         LDKPacket val_conv;
51635         val_conv.inner = untag_ptr(val);
51636         val_conv.is_owned = ptr_is_owned(val);
51637         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
51638         val_conv = Packet_clone(&val_conv);
51639         OnionMessage_set_onion_routing_packet(&this_ptr_conv, val_conv);
51640 }
51641
51642 int64_t  CS_LDK_OnionMessage_new(int8_tArray blinding_point_arg, int64_t onion_routing_packet_arg) {
51643         LDKPublicKey blinding_point_arg_ref;
51644         CHECK(blinding_point_arg->arr_len == 33);
51645         memcpy(blinding_point_arg_ref.compressed_form, blinding_point_arg->elems, 33); FREE(blinding_point_arg);
51646         LDKPacket onion_routing_packet_arg_conv;
51647         onion_routing_packet_arg_conv.inner = untag_ptr(onion_routing_packet_arg);
51648         onion_routing_packet_arg_conv.is_owned = ptr_is_owned(onion_routing_packet_arg);
51649         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_routing_packet_arg_conv);
51650         onion_routing_packet_arg_conv = Packet_clone(&onion_routing_packet_arg_conv);
51651         LDKOnionMessage ret_var = OnionMessage_new(blinding_point_arg_ref, onion_routing_packet_arg_conv);
51652         int64_t ret_ref = 0;
51653         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51654         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51655         return ret_ref;
51656 }
51657
51658 static inline uint64_t OnionMessage_clone_ptr(LDKOnionMessage *NONNULL_PTR arg) {
51659         LDKOnionMessage ret_var = OnionMessage_clone(arg);
51660         int64_t ret_ref = 0;
51661         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51662         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51663         return ret_ref;
51664 }
51665 int64_t  CS_LDK_OnionMessage_clone_ptr(int64_t arg) {
51666         LDKOnionMessage arg_conv;
51667         arg_conv.inner = untag_ptr(arg);
51668         arg_conv.is_owned = ptr_is_owned(arg);
51669         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51670         arg_conv.is_owned = false;
51671         int64_t ret_conv = OnionMessage_clone_ptr(&arg_conv);
51672         return ret_conv;
51673 }
51674
51675 int64_t  CS_LDK_OnionMessage_clone(int64_t orig) {
51676         LDKOnionMessage orig_conv;
51677         orig_conv.inner = untag_ptr(orig);
51678         orig_conv.is_owned = ptr_is_owned(orig);
51679         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51680         orig_conv.is_owned = false;
51681         LDKOnionMessage ret_var = OnionMessage_clone(&orig_conv);
51682         int64_t ret_ref = 0;
51683         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51684         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51685         return ret_ref;
51686 }
51687
51688 int64_t  CS_LDK_OnionMessage_hash(int64_t o) {
51689         LDKOnionMessage o_conv;
51690         o_conv.inner = untag_ptr(o);
51691         o_conv.is_owned = ptr_is_owned(o);
51692         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
51693         o_conv.is_owned = false;
51694         int64_t ret_conv = OnionMessage_hash(&o_conv);
51695         return ret_conv;
51696 }
51697
51698 jboolean  CS_LDK_OnionMessage_eq(int64_t a, int64_t b) {
51699         LDKOnionMessage a_conv;
51700         a_conv.inner = untag_ptr(a);
51701         a_conv.is_owned = ptr_is_owned(a);
51702         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
51703         a_conv.is_owned = false;
51704         LDKOnionMessage b_conv;
51705         b_conv.inner = untag_ptr(b);
51706         b_conv.is_owned = ptr_is_owned(b);
51707         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
51708         b_conv.is_owned = false;
51709         jboolean ret_conv = OnionMessage_eq(&a_conv, &b_conv);
51710         return ret_conv;
51711 }
51712
51713 void  CS_LDK_UpdateFulfillHTLC_free(int64_t this_obj) {
51714         LDKUpdateFulfillHTLC this_obj_conv;
51715         this_obj_conv.inner = untag_ptr(this_obj);
51716         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51717         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51718         UpdateFulfillHTLC_free(this_obj_conv);
51719 }
51720
51721 int64_t  CS_LDK_UpdateFulfillHTLC_get_channel_id(int64_t this_ptr) {
51722         LDKUpdateFulfillHTLC this_ptr_conv;
51723         this_ptr_conv.inner = untag_ptr(this_ptr);
51724         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51725         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51726         this_ptr_conv.is_owned = false;
51727         LDKChannelId ret_var = UpdateFulfillHTLC_get_channel_id(&this_ptr_conv);
51728         int64_t ret_ref = 0;
51729         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51730         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51731         return ret_ref;
51732 }
51733
51734 void  CS_LDK_UpdateFulfillHTLC_set_channel_id(int64_t this_ptr, int64_t val) {
51735         LDKUpdateFulfillHTLC this_ptr_conv;
51736         this_ptr_conv.inner = untag_ptr(this_ptr);
51737         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51738         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51739         this_ptr_conv.is_owned = false;
51740         LDKChannelId val_conv;
51741         val_conv.inner = untag_ptr(val);
51742         val_conv.is_owned = ptr_is_owned(val);
51743         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
51744         val_conv = ChannelId_clone(&val_conv);
51745         UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_conv);
51746 }
51747
51748 int64_t  CS_LDK_UpdateFulfillHTLC_get_htlc_id(int64_t this_ptr) {
51749         LDKUpdateFulfillHTLC this_ptr_conv;
51750         this_ptr_conv.inner = untag_ptr(this_ptr);
51751         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51752         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51753         this_ptr_conv.is_owned = false;
51754         int64_t ret_conv = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
51755         return ret_conv;
51756 }
51757
51758 void  CS_LDK_UpdateFulfillHTLC_set_htlc_id(int64_t this_ptr, int64_t val) {
51759         LDKUpdateFulfillHTLC this_ptr_conv;
51760         this_ptr_conv.inner = untag_ptr(this_ptr);
51761         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51762         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51763         this_ptr_conv.is_owned = false;
51764         UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
51765 }
51766
51767 int8_tArray  CS_LDK_UpdateFulfillHTLC_get_payment_preimage(int64_t this_ptr) {
51768         LDKUpdateFulfillHTLC this_ptr_conv;
51769         this_ptr_conv.inner = untag_ptr(this_ptr);
51770         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51771         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51772         this_ptr_conv.is_owned = false;
51773         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
51774         memcpy(ret_arr->elems, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv), 32);
51775         return ret_arr;
51776 }
51777
51778 void  CS_LDK_UpdateFulfillHTLC_set_payment_preimage(int64_t this_ptr, int8_tArray val) {
51779         LDKUpdateFulfillHTLC this_ptr_conv;
51780         this_ptr_conv.inner = untag_ptr(this_ptr);
51781         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51782         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51783         this_ptr_conv.is_owned = false;
51784         LDKThirtyTwoBytes val_ref;
51785         CHECK(val->arr_len == 32);
51786         memcpy(val_ref.data, val->elems, 32); FREE(val);
51787         UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
51788 }
51789
51790 int64_t  CS_LDK_UpdateFulfillHTLC_new(int64_t channel_id_arg, int64_t htlc_id_arg, int8_tArray payment_preimage_arg) {
51791         LDKChannelId channel_id_arg_conv;
51792         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
51793         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
51794         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
51795         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
51796         LDKThirtyTwoBytes payment_preimage_arg_ref;
51797         CHECK(payment_preimage_arg->arr_len == 32);
51798         memcpy(payment_preimage_arg_ref.data, payment_preimage_arg->elems, 32); FREE(payment_preimage_arg);
51799         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_conv, htlc_id_arg, payment_preimage_arg_ref);
51800         int64_t ret_ref = 0;
51801         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51802         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51803         return ret_ref;
51804 }
51805
51806 static inline uint64_t UpdateFulfillHTLC_clone_ptr(LDKUpdateFulfillHTLC *NONNULL_PTR arg) {
51807         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(arg);
51808         int64_t ret_ref = 0;
51809         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51810         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51811         return ret_ref;
51812 }
51813 int64_t  CS_LDK_UpdateFulfillHTLC_clone_ptr(int64_t arg) {
51814         LDKUpdateFulfillHTLC arg_conv;
51815         arg_conv.inner = untag_ptr(arg);
51816         arg_conv.is_owned = ptr_is_owned(arg);
51817         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51818         arg_conv.is_owned = false;
51819         int64_t ret_conv = UpdateFulfillHTLC_clone_ptr(&arg_conv);
51820         return ret_conv;
51821 }
51822
51823 int64_t  CS_LDK_UpdateFulfillHTLC_clone(int64_t orig) {
51824         LDKUpdateFulfillHTLC orig_conv;
51825         orig_conv.inner = untag_ptr(orig);
51826         orig_conv.is_owned = ptr_is_owned(orig);
51827         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51828         orig_conv.is_owned = false;
51829         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
51830         int64_t ret_ref = 0;
51831         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51832         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51833         return ret_ref;
51834 }
51835
51836 int64_t  CS_LDK_UpdateFulfillHTLC_hash(int64_t o) {
51837         LDKUpdateFulfillHTLC o_conv;
51838         o_conv.inner = untag_ptr(o);
51839         o_conv.is_owned = ptr_is_owned(o);
51840         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
51841         o_conv.is_owned = false;
51842         int64_t ret_conv = UpdateFulfillHTLC_hash(&o_conv);
51843         return ret_conv;
51844 }
51845
51846 jboolean  CS_LDK_UpdateFulfillHTLC_eq(int64_t a, int64_t b) {
51847         LDKUpdateFulfillHTLC a_conv;
51848         a_conv.inner = untag_ptr(a);
51849         a_conv.is_owned = ptr_is_owned(a);
51850         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
51851         a_conv.is_owned = false;
51852         LDKUpdateFulfillHTLC b_conv;
51853         b_conv.inner = untag_ptr(b);
51854         b_conv.is_owned = ptr_is_owned(b);
51855         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
51856         b_conv.is_owned = false;
51857         jboolean ret_conv = UpdateFulfillHTLC_eq(&a_conv, &b_conv);
51858         return ret_conv;
51859 }
51860
51861 void  CS_LDK_UpdateFailHTLC_free(int64_t this_obj) {
51862         LDKUpdateFailHTLC this_obj_conv;
51863         this_obj_conv.inner = untag_ptr(this_obj);
51864         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51865         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51866         UpdateFailHTLC_free(this_obj_conv);
51867 }
51868
51869 int64_t  CS_LDK_UpdateFailHTLC_get_channel_id(int64_t this_ptr) {
51870         LDKUpdateFailHTLC this_ptr_conv;
51871         this_ptr_conv.inner = untag_ptr(this_ptr);
51872         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51873         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51874         this_ptr_conv.is_owned = false;
51875         LDKChannelId ret_var = UpdateFailHTLC_get_channel_id(&this_ptr_conv);
51876         int64_t ret_ref = 0;
51877         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51878         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51879         return ret_ref;
51880 }
51881
51882 void  CS_LDK_UpdateFailHTLC_set_channel_id(int64_t this_ptr, int64_t val) {
51883         LDKUpdateFailHTLC this_ptr_conv;
51884         this_ptr_conv.inner = untag_ptr(this_ptr);
51885         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51886         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51887         this_ptr_conv.is_owned = false;
51888         LDKChannelId val_conv;
51889         val_conv.inner = untag_ptr(val);
51890         val_conv.is_owned = ptr_is_owned(val);
51891         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
51892         val_conv = ChannelId_clone(&val_conv);
51893         UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_conv);
51894 }
51895
51896 int64_t  CS_LDK_UpdateFailHTLC_get_htlc_id(int64_t this_ptr) {
51897         LDKUpdateFailHTLC this_ptr_conv;
51898         this_ptr_conv.inner = untag_ptr(this_ptr);
51899         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51900         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51901         this_ptr_conv.is_owned = false;
51902         int64_t ret_conv = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
51903         return ret_conv;
51904 }
51905
51906 void  CS_LDK_UpdateFailHTLC_set_htlc_id(int64_t this_ptr, int64_t val) {
51907         LDKUpdateFailHTLC this_ptr_conv;
51908         this_ptr_conv.inner = untag_ptr(this_ptr);
51909         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51910         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51911         this_ptr_conv.is_owned = false;
51912         UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
51913 }
51914
51915 static inline uint64_t UpdateFailHTLC_clone_ptr(LDKUpdateFailHTLC *NONNULL_PTR arg) {
51916         LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(arg);
51917         int64_t ret_ref = 0;
51918         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51919         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51920         return ret_ref;
51921 }
51922 int64_t  CS_LDK_UpdateFailHTLC_clone_ptr(int64_t arg) {
51923         LDKUpdateFailHTLC arg_conv;
51924         arg_conv.inner = untag_ptr(arg);
51925         arg_conv.is_owned = ptr_is_owned(arg);
51926         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51927         arg_conv.is_owned = false;
51928         int64_t ret_conv = UpdateFailHTLC_clone_ptr(&arg_conv);
51929         return ret_conv;
51930 }
51931
51932 int64_t  CS_LDK_UpdateFailHTLC_clone(int64_t orig) {
51933         LDKUpdateFailHTLC orig_conv;
51934         orig_conv.inner = untag_ptr(orig);
51935         orig_conv.is_owned = ptr_is_owned(orig);
51936         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51937         orig_conv.is_owned = false;
51938         LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
51939         int64_t ret_ref = 0;
51940         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51941         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51942         return ret_ref;
51943 }
51944
51945 int64_t  CS_LDK_UpdateFailHTLC_hash(int64_t o) {
51946         LDKUpdateFailHTLC o_conv;
51947         o_conv.inner = untag_ptr(o);
51948         o_conv.is_owned = ptr_is_owned(o);
51949         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
51950         o_conv.is_owned = false;
51951         int64_t ret_conv = UpdateFailHTLC_hash(&o_conv);
51952         return ret_conv;
51953 }
51954
51955 jboolean  CS_LDK_UpdateFailHTLC_eq(int64_t a, int64_t b) {
51956         LDKUpdateFailHTLC a_conv;
51957         a_conv.inner = untag_ptr(a);
51958         a_conv.is_owned = ptr_is_owned(a);
51959         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
51960         a_conv.is_owned = false;
51961         LDKUpdateFailHTLC b_conv;
51962         b_conv.inner = untag_ptr(b);
51963         b_conv.is_owned = ptr_is_owned(b);
51964         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
51965         b_conv.is_owned = false;
51966         jboolean ret_conv = UpdateFailHTLC_eq(&a_conv, &b_conv);
51967         return ret_conv;
51968 }
51969
51970 void  CS_LDK_UpdateFailMalformedHTLC_free(int64_t this_obj) {
51971         LDKUpdateFailMalformedHTLC this_obj_conv;
51972         this_obj_conv.inner = untag_ptr(this_obj);
51973         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51974         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51975         UpdateFailMalformedHTLC_free(this_obj_conv);
51976 }
51977
51978 int64_t  CS_LDK_UpdateFailMalformedHTLC_get_channel_id(int64_t this_ptr) {
51979         LDKUpdateFailMalformedHTLC this_ptr_conv;
51980         this_ptr_conv.inner = untag_ptr(this_ptr);
51981         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51982         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51983         this_ptr_conv.is_owned = false;
51984         LDKChannelId ret_var = UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv);
51985         int64_t ret_ref = 0;
51986         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51987         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51988         return ret_ref;
51989 }
51990
51991 void  CS_LDK_UpdateFailMalformedHTLC_set_channel_id(int64_t this_ptr, int64_t val) {
51992         LDKUpdateFailMalformedHTLC this_ptr_conv;
51993         this_ptr_conv.inner = untag_ptr(this_ptr);
51994         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51995         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51996         this_ptr_conv.is_owned = false;
51997         LDKChannelId val_conv;
51998         val_conv.inner = untag_ptr(val);
51999         val_conv.is_owned = ptr_is_owned(val);
52000         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
52001         val_conv = ChannelId_clone(&val_conv);
52002         UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_conv);
52003 }
52004
52005 int64_t  CS_LDK_UpdateFailMalformedHTLC_get_htlc_id(int64_t this_ptr) {
52006         LDKUpdateFailMalformedHTLC this_ptr_conv;
52007         this_ptr_conv.inner = untag_ptr(this_ptr);
52008         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52009         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52010         this_ptr_conv.is_owned = false;
52011         int64_t ret_conv = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
52012         return ret_conv;
52013 }
52014
52015 void  CS_LDK_UpdateFailMalformedHTLC_set_htlc_id(int64_t this_ptr, int64_t val) {
52016         LDKUpdateFailMalformedHTLC this_ptr_conv;
52017         this_ptr_conv.inner = untag_ptr(this_ptr);
52018         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52019         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52020         this_ptr_conv.is_owned = false;
52021         UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
52022 }
52023
52024 int16_t  CS_LDK_UpdateFailMalformedHTLC_get_failure_code(int64_t this_ptr) {
52025         LDKUpdateFailMalformedHTLC this_ptr_conv;
52026         this_ptr_conv.inner = untag_ptr(this_ptr);
52027         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52028         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52029         this_ptr_conv.is_owned = false;
52030         int16_t ret_conv = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
52031         return ret_conv;
52032 }
52033
52034 void  CS_LDK_UpdateFailMalformedHTLC_set_failure_code(int64_t this_ptr, int16_t val) {
52035         LDKUpdateFailMalformedHTLC this_ptr_conv;
52036         this_ptr_conv.inner = untag_ptr(this_ptr);
52037         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52038         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52039         this_ptr_conv.is_owned = false;
52040         UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
52041 }
52042
52043 static inline uint64_t UpdateFailMalformedHTLC_clone_ptr(LDKUpdateFailMalformedHTLC *NONNULL_PTR arg) {
52044         LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(arg);
52045         int64_t ret_ref = 0;
52046         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52047         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52048         return ret_ref;
52049 }
52050 int64_t  CS_LDK_UpdateFailMalformedHTLC_clone_ptr(int64_t arg) {
52051         LDKUpdateFailMalformedHTLC arg_conv;
52052         arg_conv.inner = untag_ptr(arg);
52053         arg_conv.is_owned = ptr_is_owned(arg);
52054         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52055         arg_conv.is_owned = false;
52056         int64_t ret_conv = UpdateFailMalformedHTLC_clone_ptr(&arg_conv);
52057         return ret_conv;
52058 }
52059
52060 int64_t  CS_LDK_UpdateFailMalformedHTLC_clone(int64_t orig) {
52061         LDKUpdateFailMalformedHTLC orig_conv;
52062         orig_conv.inner = untag_ptr(orig);
52063         orig_conv.is_owned = ptr_is_owned(orig);
52064         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52065         orig_conv.is_owned = false;
52066         LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
52067         int64_t ret_ref = 0;
52068         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52069         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52070         return ret_ref;
52071 }
52072
52073 int64_t  CS_LDK_UpdateFailMalformedHTLC_hash(int64_t o) {
52074         LDKUpdateFailMalformedHTLC o_conv;
52075         o_conv.inner = untag_ptr(o);
52076         o_conv.is_owned = ptr_is_owned(o);
52077         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
52078         o_conv.is_owned = false;
52079         int64_t ret_conv = UpdateFailMalformedHTLC_hash(&o_conv);
52080         return ret_conv;
52081 }
52082
52083 jboolean  CS_LDK_UpdateFailMalformedHTLC_eq(int64_t a, int64_t b) {
52084         LDKUpdateFailMalformedHTLC a_conv;
52085         a_conv.inner = untag_ptr(a);
52086         a_conv.is_owned = ptr_is_owned(a);
52087         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
52088         a_conv.is_owned = false;
52089         LDKUpdateFailMalformedHTLC b_conv;
52090         b_conv.inner = untag_ptr(b);
52091         b_conv.is_owned = ptr_is_owned(b);
52092         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
52093         b_conv.is_owned = false;
52094         jboolean ret_conv = UpdateFailMalformedHTLC_eq(&a_conv, &b_conv);
52095         return ret_conv;
52096 }
52097
52098 void  CS_LDK_CommitmentSigned_free(int64_t this_obj) {
52099         LDKCommitmentSigned this_obj_conv;
52100         this_obj_conv.inner = untag_ptr(this_obj);
52101         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52102         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52103         CommitmentSigned_free(this_obj_conv);
52104 }
52105
52106 int64_t  CS_LDK_CommitmentSigned_get_channel_id(int64_t this_ptr) {
52107         LDKCommitmentSigned this_ptr_conv;
52108         this_ptr_conv.inner = untag_ptr(this_ptr);
52109         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52110         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52111         this_ptr_conv.is_owned = false;
52112         LDKChannelId ret_var = CommitmentSigned_get_channel_id(&this_ptr_conv);
52113         int64_t ret_ref = 0;
52114         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52115         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52116         return ret_ref;
52117 }
52118
52119 void  CS_LDK_CommitmentSigned_set_channel_id(int64_t this_ptr, int64_t val) {
52120         LDKCommitmentSigned this_ptr_conv;
52121         this_ptr_conv.inner = untag_ptr(this_ptr);
52122         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52123         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52124         this_ptr_conv.is_owned = false;
52125         LDKChannelId val_conv;
52126         val_conv.inner = untag_ptr(val);
52127         val_conv.is_owned = ptr_is_owned(val);
52128         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
52129         val_conv = ChannelId_clone(&val_conv);
52130         CommitmentSigned_set_channel_id(&this_ptr_conv, val_conv);
52131 }
52132
52133 int8_tArray  CS_LDK_CommitmentSigned_get_signature(int64_t this_ptr) {
52134         LDKCommitmentSigned this_ptr_conv;
52135         this_ptr_conv.inner = untag_ptr(this_ptr);
52136         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52137         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52138         this_ptr_conv.is_owned = false;
52139         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
52140         memcpy(ret_arr->elems, CommitmentSigned_get_signature(&this_ptr_conv).compact_form, 64);
52141         return ret_arr;
52142 }
52143
52144 void  CS_LDK_CommitmentSigned_set_signature(int64_t this_ptr, int8_tArray val) {
52145         LDKCommitmentSigned this_ptr_conv;
52146         this_ptr_conv.inner = untag_ptr(this_ptr);
52147         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52148         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52149         this_ptr_conv.is_owned = false;
52150         LDKECDSASignature val_ref;
52151         CHECK(val->arr_len == 64);
52152         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
52153         CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
52154 }
52155
52156 ptrArray  CS_LDK_CommitmentSigned_get_htlc_signatures(int64_t this_ptr) {
52157         LDKCommitmentSigned this_ptr_conv;
52158         this_ptr_conv.inner = untag_ptr(this_ptr);
52159         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52160         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52161         this_ptr_conv.is_owned = false;
52162         LDKCVec_ECDSASignatureZ ret_var = CommitmentSigned_get_htlc_signatures(&this_ptr_conv);
52163         ptrArray ret_arr = NULL;
52164         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
52165         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
52166         for (size_t i = 0; i < ret_var.datalen; i++) {
52167                 int8_tArray ret_conv_8_arr = init_int8_tArray(64, __LINE__);
52168                 memcpy(ret_conv_8_arr->elems, ret_var.data[i].compact_form, 64);
52169                 ret_arr_ptr[i] = ret_conv_8_arr;
52170         }
52171         
52172         FREE(ret_var.data);
52173         return ret_arr;
52174 }
52175
52176 void  CS_LDK_CommitmentSigned_set_htlc_signatures(int64_t this_ptr, ptrArray val) {
52177         LDKCommitmentSigned this_ptr_conv;
52178         this_ptr_conv.inner = untag_ptr(this_ptr);
52179         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52180         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52181         this_ptr_conv.is_owned = false;
52182         LDKCVec_ECDSASignatureZ val_constr;
52183         val_constr.datalen = val->arr_len;
52184         if (val_constr.datalen > 0)
52185                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
52186         else
52187                 val_constr.data = NULL;
52188         int8_tArray* val_vals = (void*) val->elems;
52189         for (size_t i = 0; i < val_constr.datalen; i++) {
52190                 int8_tArray val_conv_8 = val_vals[i];
52191                 LDKECDSASignature val_conv_8_ref;
52192                 CHECK(val_conv_8->arr_len == 64);
52193                 memcpy(val_conv_8_ref.compact_form, val_conv_8->elems, 64); FREE(val_conv_8);
52194                 val_constr.data[i] = val_conv_8_ref;
52195         }
52196         FREE(val);
52197         CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
52198 }
52199
52200 int64_t  CS_LDK_CommitmentSigned_new(int64_t channel_id_arg, int8_tArray signature_arg, ptrArray htlc_signatures_arg) {
52201         LDKChannelId channel_id_arg_conv;
52202         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
52203         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
52204         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
52205         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
52206         LDKECDSASignature signature_arg_ref;
52207         CHECK(signature_arg->arr_len == 64);
52208         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
52209         LDKCVec_ECDSASignatureZ htlc_signatures_arg_constr;
52210         htlc_signatures_arg_constr.datalen = htlc_signatures_arg->arr_len;
52211         if (htlc_signatures_arg_constr.datalen > 0)
52212                 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
52213         else
52214                 htlc_signatures_arg_constr.data = NULL;
52215         int8_tArray* htlc_signatures_arg_vals = (void*) htlc_signatures_arg->elems;
52216         for (size_t i = 0; i < htlc_signatures_arg_constr.datalen; i++) {
52217                 int8_tArray htlc_signatures_arg_conv_8 = htlc_signatures_arg_vals[i];
52218                 LDKECDSASignature htlc_signatures_arg_conv_8_ref;
52219                 CHECK(htlc_signatures_arg_conv_8->arr_len == 64);
52220                 memcpy(htlc_signatures_arg_conv_8_ref.compact_form, htlc_signatures_arg_conv_8->elems, 64); FREE(htlc_signatures_arg_conv_8);
52221                 htlc_signatures_arg_constr.data[i] = htlc_signatures_arg_conv_8_ref;
52222         }
52223         FREE(htlc_signatures_arg);
52224         LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_conv, signature_arg_ref, htlc_signatures_arg_constr);
52225         int64_t ret_ref = 0;
52226         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52227         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52228         return ret_ref;
52229 }
52230
52231 static inline uint64_t CommitmentSigned_clone_ptr(LDKCommitmentSigned *NONNULL_PTR arg) {
52232         LDKCommitmentSigned ret_var = CommitmentSigned_clone(arg);
52233         int64_t ret_ref = 0;
52234         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52235         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52236         return ret_ref;
52237 }
52238 int64_t  CS_LDK_CommitmentSigned_clone_ptr(int64_t arg) {
52239         LDKCommitmentSigned arg_conv;
52240         arg_conv.inner = untag_ptr(arg);
52241         arg_conv.is_owned = ptr_is_owned(arg);
52242         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52243         arg_conv.is_owned = false;
52244         int64_t ret_conv = CommitmentSigned_clone_ptr(&arg_conv);
52245         return ret_conv;
52246 }
52247
52248 int64_t  CS_LDK_CommitmentSigned_clone(int64_t orig) {
52249         LDKCommitmentSigned orig_conv;
52250         orig_conv.inner = untag_ptr(orig);
52251         orig_conv.is_owned = ptr_is_owned(orig);
52252         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52253         orig_conv.is_owned = false;
52254         LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
52255         int64_t ret_ref = 0;
52256         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52257         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52258         return ret_ref;
52259 }
52260
52261 int64_t  CS_LDK_CommitmentSigned_hash(int64_t o) {
52262         LDKCommitmentSigned o_conv;
52263         o_conv.inner = untag_ptr(o);
52264         o_conv.is_owned = ptr_is_owned(o);
52265         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
52266         o_conv.is_owned = false;
52267         int64_t ret_conv = CommitmentSigned_hash(&o_conv);
52268         return ret_conv;
52269 }
52270
52271 jboolean  CS_LDK_CommitmentSigned_eq(int64_t a, int64_t b) {
52272         LDKCommitmentSigned a_conv;
52273         a_conv.inner = untag_ptr(a);
52274         a_conv.is_owned = ptr_is_owned(a);
52275         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
52276         a_conv.is_owned = false;
52277         LDKCommitmentSigned b_conv;
52278         b_conv.inner = untag_ptr(b);
52279         b_conv.is_owned = ptr_is_owned(b);
52280         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
52281         b_conv.is_owned = false;
52282         jboolean ret_conv = CommitmentSigned_eq(&a_conv, &b_conv);
52283         return ret_conv;
52284 }
52285
52286 void  CS_LDK_RevokeAndACK_free(int64_t this_obj) {
52287         LDKRevokeAndACK this_obj_conv;
52288         this_obj_conv.inner = untag_ptr(this_obj);
52289         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52290         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52291         RevokeAndACK_free(this_obj_conv);
52292 }
52293
52294 int64_t  CS_LDK_RevokeAndACK_get_channel_id(int64_t this_ptr) {
52295         LDKRevokeAndACK this_ptr_conv;
52296         this_ptr_conv.inner = untag_ptr(this_ptr);
52297         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52298         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52299         this_ptr_conv.is_owned = false;
52300         LDKChannelId ret_var = RevokeAndACK_get_channel_id(&this_ptr_conv);
52301         int64_t ret_ref = 0;
52302         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52303         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52304         return ret_ref;
52305 }
52306
52307 void  CS_LDK_RevokeAndACK_set_channel_id(int64_t this_ptr, int64_t val) {
52308         LDKRevokeAndACK this_ptr_conv;
52309         this_ptr_conv.inner = untag_ptr(this_ptr);
52310         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52311         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52312         this_ptr_conv.is_owned = false;
52313         LDKChannelId val_conv;
52314         val_conv.inner = untag_ptr(val);
52315         val_conv.is_owned = ptr_is_owned(val);
52316         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
52317         val_conv = ChannelId_clone(&val_conv);
52318         RevokeAndACK_set_channel_id(&this_ptr_conv, val_conv);
52319 }
52320
52321 int8_tArray  CS_LDK_RevokeAndACK_get_per_commitment_secret(int64_t this_ptr) {
52322         LDKRevokeAndACK this_ptr_conv;
52323         this_ptr_conv.inner = untag_ptr(this_ptr);
52324         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52325         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52326         this_ptr_conv.is_owned = false;
52327         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
52328         memcpy(ret_arr->elems, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv), 32);
52329         return ret_arr;
52330 }
52331
52332 void  CS_LDK_RevokeAndACK_set_per_commitment_secret(int64_t this_ptr, int8_tArray val) {
52333         LDKRevokeAndACK this_ptr_conv;
52334         this_ptr_conv.inner = untag_ptr(this_ptr);
52335         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52336         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52337         this_ptr_conv.is_owned = false;
52338         LDKThirtyTwoBytes val_ref;
52339         CHECK(val->arr_len == 32);
52340         memcpy(val_ref.data, val->elems, 32); FREE(val);
52341         RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
52342 }
52343
52344 int8_tArray  CS_LDK_RevokeAndACK_get_next_per_commitment_point(int64_t this_ptr) {
52345         LDKRevokeAndACK this_ptr_conv;
52346         this_ptr_conv.inner = untag_ptr(this_ptr);
52347         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52348         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52349         this_ptr_conv.is_owned = false;
52350         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
52351         memcpy(ret_arr->elems, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
52352         return ret_arr;
52353 }
52354
52355 void  CS_LDK_RevokeAndACK_set_next_per_commitment_point(int64_t this_ptr, int8_tArray val) {
52356         LDKRevokeAndACK this_ptr_conv;
52357         this_ptr_conv.inner = untag_ptr(this_ptr);
52358         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52359         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52360         this_ptr_conv.is_owned = false;
52361         LDKPublicKey val_ref;
52362         CHECK(val->arr_len == 33);
52363         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
52364         RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
52365 }
52366
52367 int64_t  CS_LDK_RevokeAndACK_new(int64_t channel_id_arg, int8_tArray per_commitment_secret_arg, int8_tArray next_per_commitment_point_arg) {
52368         LDKChannelId channel_id_arg_conv;
52369         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
52370         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
52371         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
52372         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
52373         LDKThirtyTwoBytes per_commitment_secret_arg_ref;
52374         CHECK(per_commitment_secret_arg->arr_len == 32);
52375         memcpy(per_commitment_secret_arg_ref.data, per_commitment_secret_arg->elems, 32); FREE(per_commitment_secret_arg);
52376         LDKPublicKey next_per_commitment_point_arg_ref;
52377         CHECK(next_per_commitment_point_arg->arr_len == 33);
52378         memcpy(next_per_commitment_point_arg_ref.compressed_form, next_per_commitment_point_arg->elems, 33); FREE(next_per_commitment_point_arg);
52379         LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_conv, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
52380         int64_t ret_ref = 0;
52381         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52382         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52383         return ret_ref;
52384 }
52385
52386 static inline uint64_t RevokeAndACK_clone_ptr(LDKRevokeAndACK *NONNULL_PTR arg) {
52387         LDKRevokeAndACK ret_var = RevokeAndACK_clone(arg);
52388         int64_t ret_ref = 0;
52389         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52390         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52391         return ret_ref;
52392 }
52393 int64_t  CS_LDK_RevokeAndACK_clone_ptr(int64_t arg) {
52394         LDKRevokeAndACK arg_conv;
52395         arg_conv.inner = untag_ptr(arg);
52396         arg_conv.is_owned = ptr_is_owned(arg);
52397         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52398         arg_conv.is_owned = false;
52399         int64_t ret_conv = RevokeAndACK_clone_ptr(&arg_conv);
52400         return ret_conv;
52401 }
52402
52403 int64_t  CS_LDK_RevokeAndACK_clone(int64_t orig) {
52404         LDKRevokeAndACK orig_conv;
52405         orig_conv.inner = untag_ptr(orig);
52406         orig_conv.is_owned = ptr_is_owned(orig);
52407         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52408         orig_conv.is_owned = false;
52409         LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
52410         int64_t ret_ref = 0;
52411         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52412         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52413         return ret_ref;
52414 }
52415
52416 int64_t  CS_LDK_RevokeAndACK_hash(int64_t o) {
52417         LDKRevokeAndACK o_conv;
52418         o_conv.inner = untag_ptr(o);
52419         o_conv.is_owned = ptr_is_owned(o);
52420         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
52421         o_conv.is_owned = false;
52422         int64_t ret_conv = RevokeAndACK_hash(&o_conv);
52423         return ret_conv;
52424 }
52425
52426 jboolean  CS_LDK_RevokeAndACK_eq(int64_t a, int64_t b) {
52427         LDKRevokeAndACK a_conv;
52428         a_conv.inner = untag_ptr(a);
52429         a_conv.is_owned = ptr_is_owned(a);
52430         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
52431         a_conv.is_owned = false;
52432         LDKRevokeAndACK b_conv;
52433         b_conv.inner = untag_ptr(b);
52434         b_conv.is_owned = ptr_is_owned(b);
52435         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
52436         b_conv.is_owned = false;
52437         jboolean ret_conv = RevokeAndACK_eq(&a_conv, &b_conv);
52438         return ret_conv;
52439 }
52440
52441 void  CS_LDK_UpdateFee_free(int64_t this_obj) {
52442         LDKUpdateFee this_obj_conv;
52443         this_obj_conv.inner = untag_ptr(this_obj);
52444         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52445         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52446         UpdateFee_free(this_obj_conv);
52447 }
52448
52449 int64_t  CS_LDK_UpdateFee_get_channel_id(int64_t this_ptr) {
52450         LDKUpdateFee this_ptr_conv;
52451         this_ptr_conv.inner = untag_ptr(this_ptr);
52452         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52453         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52454         this_ptr_conv.is_owned = false;
52455         LDKChannelId ret_var = UpdateFee_get_channel_id(&this_ptr_conv);
52456         int64_t ret_ref = 0;
52457         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52458         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52459         return ret_ref;
52460 }
52461
52462 void  CS_LDK_UpdateFee_set_channel_id(int64_t this_ptr, int64_t val) {
52463         LDKUpdateFee this_ptr_conv;
52464         this_ptr_conv.inner = untag_ptr(this_ptr);
52465         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52466         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52467         this_ptr_conv.is_owned = false;
52468         LDKChannelId val_conv;
52469         val_conv.inner = untag_ptr(val);
52470         val_conv.is_owned = ptr_is_owned(val);
52471         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
52472         val_conv = ChannelId_clone(&val_conv);
52473         UpdateFee_set_channel_id(&this_ptr_conv, val_conv);
52474 }
52475
52476 int32_t  CS_LDK_UpdateFee_get_feerate_per_kw(int64_t this_ptr) {
52477         LDKUpdateFee this_ptr_conv;
52478         this_ptr_conv.inner = untag_ptr(this_ptr);
52479         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52480         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52481         this_ptr_conv.is_owned = false;
52482         int32_t ret_conv = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
52483         return ret_conv;
52484 }
52485
52486 void  CS_LDK_UpdateFee_set_feerate_per_kw(int64_t this_ptr, int32_t val) {
52487         LDKUpdateFee this_ptr_conv;
52488         this_ptr_conv.inner = untag_ptr(this_ptr);
52489         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52490         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52491         this_ptr_conv.is_owned = false;
52492         UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
52493 }
52494
52495 int64_t  CS_LDK_UpdateFee_new(int64_t channel_id_arg, int32_t feerate_per_kw_arg) {
52496         LDKChannelId channel_id_arg_conv;
52497         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
52498         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
52499         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
52500         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
52501         LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_conv, feerate_per_kw_arg);
52502         int64_t ret_ref = 0;
52503         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52504         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52505         return ret_ref;
52506 }
52507
52508 static inline uint64_t UpdateFee_clone_ptr(LDKUpdateFee *NONNULL_PTR arg) {
52509         LDKUpdateFee ret_var = UpdateFee_clone(arg);
52510         int64_t ret_ref = 0;
52511         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52512         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52513         return ret_ref;
52514 }
52515 int64_t  CS_LDK_UpdateFee_clone_ptr(int64_t arg) {
52516         LDKUpdateFee arg_conv;
52517         arg_conv.inner = untag_ptr(arg);
52518         arg_conv.is_owned = ptr_is_owned(arg);
52519         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52520         arg_conv.is_owned = false;
52521         int64_t ret_conv = UpdateFee_clone_ptr(&arg_conv);
52522         return ret_conv;
52523 }
52524
52525 int64_t  CS_LDK_UpdateFee_clone(int64_t orig) {
52526         LDKUpdateFee orig_conv;
52527         orig_conv.inner = untag_ptr(orig);
52528         orig_conv.is_owned = ptr_is_owned(orig);
52529         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52530         orig_conv.is_owned = false;
52531         LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
52532         int64_t ret_ref = 0;
52533         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52534         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52535         return ret_ref;
52536 }
52537
52538 int64_t  CS_LDK_UpdateFee_hash(int64_t o) {
52539         LDKUpdateFee o_conv;
52540         o_conv.inner = untag_ptr(o);
52541         o_conv.is_owned = ptr_is_owned(o);
52542         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
52543         o_conv.is_owned = false;
52544         int64_t ret_conv = UpdateFee_hash(&o_conv);
52545         return ret_conv;
52546 }
52547
52548 jboolean  CS_LDK_UpdateFee_eq(int64_t a, int64_t b) {
52549         LDKUpdateFee a_conv;
52550         a_conv.inner = untag_ptr(a);
52551         a_conv.is_owned = ptr_is_owned(a);
52552         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
52553         a_conv.is_owned = false;
52554         LDKUpdateFee b_conv;
52555         b_conv.inner = untag_ptr(b);
52556         b_conv.is_owned = ptr_is_owned(b);
52557         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
52558         b_conv.is_owned = false;
52559         jboolean ret_conv = UpdateFee_eq(&a_conv, &b_conv);
52560         return ret_conv;
52561 }
52562
52563 void  CS_LDK_ChannelReestablish_free(int64_t this_obj) {
52564         LDKChannelReestablish this_obj_conv;
52565         this_obj_conv.inner = untag_ptr(this_obj);
52566         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52567         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52568         ChannelReestablish_free(this_obj_conv);
52569 }
52570
52571 int64_t  CS_LDK_ChannelReestablish_get_channel_id(int64_t this_ptr) {
52572         LDKChannelReestablish this_ptr_conv;
52573         this_ptr_conv.inner = untag_ptr(this_ptr);
52574         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52575         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52576         this_ptr_conv.is_owned = false;
52577         LDKChannelId ret_var = ChannelReestablish_get_channel_id(&this_ptr_conv);
52578         int64_t ret_ref = 0;
52579         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52580         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52581         return ret_ref;
52582 }
52583
52584 void  CS_LDK_ChannelReestablish_set_channel_id(int64_t this_ptr, int64_t val) {
52585         LDKChannelReestablish this_ptr_conv;
52586         this_ptr_conv.inner = untag_ptr(this_ptr);
52587         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52588         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52589         this_ptr_conv.is_owned = false;
52590         LDKChannelId val_conv;
52591         val_conv.inner = untag_ptr(val);
52592         val_conv.is_owned = ptr_is_owned(val);
52593         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
52594         val_conv = ChannelId_clone(&val_conv);
52595         ChannelReestablish_set_channel_id(&this_ptr_conv, val_conv);
52596 }
52597
52598 int64_t  CS_LDK_ChannelReestablish_get_next_local_commitment_number(int64_t this_ptr) {
52599         LDKChannelReestablish this_ptr_conv;
52600         this_ptr_conv.inner = untag_ptr(this_ptr);
52601         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52602         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52603         this_ptr_conv.is_owned = false;
52604         int64_t ret_conv = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
52605         return ret_conv;
52606 }
52607
52608 void  CS_LDK_ChannelReestablish_set_next_local_commitment_number(int64_t this_ptr, int64_t val) {
52609         LDKChannelReestablish this_ptr_conv;
52610         this_ptr_conv.inner = untag_ptr(this_ptr);
52611         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52612         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52613         this_ptr_conv.is_owned = false;
52614         ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
52615 }
52616
52617 int64_t  CS_LDK_ChannelReestablish_get_next_remote_commitment_number(int64_t this_ptr) {
52618         LDKChannelReestablish this_ptr_conv;
52619         this_ptr_conv.inner = untag_ptr(this_ptr);
52620         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52621         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52622         this_ptr_conv.is_owned = false;
52623         int64_t ret_conv = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
52624         return ret_conv;
52625 }
52626
52627 void  CS_LDK_ChannelReestablish_set_next_remote_commitment_number(int64_t this_ptr, int64_t val) {
52628         LDKChannelReestablish this_ptr_conv;
52629         this_ptr_conv.inner = untag_ptr(this_ptr);
52630         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52631         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52632         this_ptr_conv.is_owned = false;
52633         ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
52634 }
52635
52636 int8_tArray  CS_LDK_ChannelReestablish_get_your_last_per_commitment_secret(int64_t this_ptr) {
52637         LDKChannelReestablish this_ptr_conv;
52638         this_ptr_conv.inner = untag_ptr(this_ptr);
52639         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52640         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52641         this_ptr_conv.is_owned = false;
52642         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
52643         memcpy(ret_arr->elems, *ChannelReestablish_get_your_last_per_commitment_secret(&this_ptr_conv), 32);
52644         return ret_arr;
52645 }
52646
52647 void  CS_LDK_ChannelReestablish_set_your_last_per_commitment_secret(int64_t this_ptr, int8_tArray val) {
52648         LDKChannelReestablish this_ptr_conv;
52649         this_ptr_conv.inner = untag_ptr(this_ptr);
52650         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52651         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52652         this_ptr_conv.is_owned = false;
52653         LDKThirtyTwoBytes val_ref;
52654         CHECK(val->arr_len == 32);
52655         memcpy(val_ref.data, val->elems, 32); FREE(val);
52656         ChannelReestablish_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
52657 }
52658
52659 int8_tArray  CS_LDK_ChannelReestablish_get_my_current_per_commitment_point(int64_t this_ptr) {
52660         LDKChannelReestablish this_ptr_conv;
52661         this_ptr_conv.inner = untag_ptr(this_ptr);
52662         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52663         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52664         this_ptr_conv.is_owned = false;
52665         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
52666         memcpy(ret_arr->elems, ChannelReestablish_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form, 33);
52667         return ret_arr;
52668 }
52669
52670 void  CS_LDK_ChannelReestablish_set_my_current_per_commitment_point(int64_t this_ptr, int8_tArray val) {
52671         LDKChannelReestablish this_ptr_conv;
52672         this_ptr_conv.inner = untag_ptr(this_ptr);
52673         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52674         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52675         this_ptr_conv.is_owned = false;
52676         LDKPublicKey val_ref;
52677         CHECK(val->arr_len == 33);
52678         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
52679         ChannelReestablish_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
52680 }
52681
52682 int64_t  CS_LDK_ChannelReestablish_get_next_funding_txid(int64_t this_ptr) {
52683         LDKChannelReestablish this_ptr_conv;
52684         this_ptr_conv.inner = untag_ptr(this_ptr);
52685         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52686         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52687         this_ptr_conv.is_owned = false;
52688         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
52689         *ret_copy = ChannelReestablish_get_next_funding_txid(&this_ptr_conv);
52690         int64_t ret_ref = tag_ptr(ret_copy, true);
52691         return ret_ref;
52692 }
52693
52694 void  CS_LDK_ChannelReestablish_set_next_funding_txid(int64_t this_ptr, int64_t val) {
52695         LDKChannelReestablish this_ptr_conv;
52696         this_ptr_conv.inner = untag_ptr(this_ptr);
52697         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52698         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52699         this_ptr_conv.is_owned = false;
52700         void* val_ptr = untag_ptr(val);
52701         CHECK_ACCESS(val_ptr);
52702         LDKCOption_ThirtyTwoBytesZ val_conv = *(LDKCOption_ThirtyTwoBytesZ*)(val_ptr);
52703         val_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(val));
52704         ChannelReestablish_set_next_funding_txid(&this_ptr_conv, val_conv);
52705 }
52706
52707 int64_t  CS_LDK_ChannelReestablish_new(int64_t 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) {
52708         LDKChannelId channel_id_arg_conv;
52709         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
52710         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
52711         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
52712         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
52713         LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
52714         CHECK(your_last_per_commitment_secret_arg->arr_len == 32);
52715         memcpy(your_last_per_commitment_secret_arg_ref.data, your_last_per_commitment_secret_arg->elems, 32); FREE(your_last_per_commitment_secret_arg);
52716         LDKPublicKey my_current_per_commitment_point_arg_ref;
52717         CHECK(my_current_per_commitment_point_arg->arr_len == 33);
52718         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);
52719         void* next_funding_txid_arg_ptr = untag_ptr(next_funding_txid_arg);
52720         CHECK_ACCESS(next_funding_txid_arg_ptr);
52721         LDKCOption_ThirtyTwoBytesZ next_funding_txid_arg_conv = *(LDKCOption_ThirtyTwoBytesZ*)(next_funding_txid_arg_ptr);
52722         next_funding_txid_arg_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(next_funding_txid_arg));
52723         LDKChannelReestablish ret_var = ChannelReestablish_new(channel_id_arg_conv, 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);
52724         int64_t ret_ref = 0;
52725         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52726         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52727         return ret_ref;
52728 }
52729
52730 static inline uint64_t ChannelReestablish_clone_ptr(LDKChannelReestablish *NONNULL_PTR arg) {
52731         LDKChannelReestablish ret_var = ChannelReestablish_clone(arg);
52732         int64_t ret_ref = 0;
52733         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52734         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52735         return ret_ref;
52736 }
52737 int64_t  CS_LDK_ChannelReestablish_clone_ptr(int64_t arg) {
52738         LDKChannelReestablish arg_conv;
52739         arg_conv.inner = untag_ptr(arg);
52740         arg_conv.is_owned = ptr_is_owned(arg);
52741         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52742         arg_conv.is_owned = false;
52743         int64_t ret_conv = ChannelReestablish_clone_ptr(&arg_conv);
52744         return ret_conv;
52745 }
52746
52747 int64_t  CS_LDK_ChannelReestablish_clone(int64_t orig) {
52748         LDKChannelReestablish orig_conv;
52749         orig_conv.inner = untag_ptr(orig);
52750         orig_conv.is_owned = ptr_is_owned(orig);
52751         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52752         orig_conv.is_owned = false;
52753         LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
52754         int64_t ret_ref = 0;
52755         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52756         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52757         return ret_ref;
52758 }
52759
52760 int64_t  CS_LDK_ChannelReestablish_hash(int64_t o) {
52761         LDKChannelReestablish o_conv;
52762         o_conv.inner = untag_ptr(o);
52763         o_conv.is_owned = ptr_is_owned(o);
52764         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
52765         o_conv.is_owned = false;
52766         int64_t ret_conv = ChannelReestablish_hash(&o_conv);
52767         return ret_conv;
52768 }
52769
52770 jboolean  CS_LDK_ChannelReestablish_eq(int64_t a, int64_t b) {
52771         LDKChannelReestablish a_conv;
52772         a_conv.inner = untag_ptr(a);
52773         a_conv.is_owned = ptr_is_owned(a);
52774         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
52775         a_conv.is_owned = false;
52776         LDKChannelReestablish b_conv;
52777         b_conv.inner = untag_ptr(b);
52778         b_conv.is_owned = ptr_is_owned(b);
52779         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
52780         b_conv.is_owned = false;
52781         jboolean ret_conv = ChannelReestablish_eq(&a_conv, &b_conv);
52782         return ret_conv;
52783 }
52784
52785 void  CS_LDK_AnnouncementSignatures_free(int64_t this_obj) {
52786         LDKAnnouncementSignatures this_obj_conv;
52787         this_obj_conv.inner = untag_ptr(this_obj);
52788         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52789         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52790         AnnouncementSignatures_free(this_obj_conv);
52791 }
52792
52793 int64_t  CS_LDK_AnnouncementSignatures_get_channel_id(int64_t this_ptr) {
52794         LDKAnnouncementSignatures this_ptr_conv;
52795         this_ptr_conv.inner = untag_ptr(this_ptr);
52796         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52797         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52798         this_ptr_conv.is_owned = false;
52799         LDKChannelId ret_var = AnnouncementSignatures_get_channel_id(&this_ptr_conv);
52800         int64_t ret_ref = 0;
52801         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52802         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52803         return ret_ref;
52804 }
52805
52806 void  CS_LDK_AnnouncementSignatures_set_channel_id(int64_t this_ptr, int64_t val) {
52807         LDKAnnouncementSignatures this_ptr_conv;
52808         this_ptr_conv.inner = untag_ptr(this_ptr);
52809         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52810         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52811         this_ptr_conv.is_owned = false;
52812         LDKChannelId val_conv;
52813         val_conv.inner = untag_ptr(val);
52814         val_conv.is_owned = ptr_is_owned(val);
52815         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
52816         val_conv = ChannelId_clone(&val_conv);
52817         AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_conv);
52818 }
52819
52820 int64_t  CS_LDK_AnnouncementSignatures_get_short_channel_id(int64_t this_ptr) {
52821         LDKAnnouncementSignatures this_ptr_conv;
52822         this_ptr_conv.inner = untag_ptr(this_ptr);
52823         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52824         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52825         this_ptr_conv.is_owned = false;
52826         int64_t ret_conv = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
52827         return ret_conv;
52828 }
52829
52830 void  CS_LDK_AnnouncementSignatures_set_short_channel_id(int64_t this_ptr, int64_t val) {
52831         LDKAnnouncementSignatures this_ptr_conv;
52832         this_ptr_conv.inner = untag_ptr(this_ptr);
52833         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52834         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52835         this_ptr_conv.is_owned = false;
52836         AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
52837 }
52838
52839 int8_tArray  CS_LDK_AnnouncementSignatures_get_node_signature(int64_t this_ptr) {
52840         LDKAnnouncementSignatures this_ptr_conv;
52841         this_ptr_conv.inner = untag_ptr(this_ptr);
52842         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52843         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52844         this_ptr_conv.is_owned = false;
52845         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
52846         memcpy(ret_arr->elems, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form, 64);
52847         return ret_arr;
52848 }
52849
52850 void  CS_LDK_AnnouncementSignatures_set_node_signature(int64_t this_ptr, int8_tArray val) {
52851         LDKAnnouncementSignatures this_ptr_conv;
52852         this_ptr_conv.inner = untag_ptr(this_ptr);
52853         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52854         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52855         this_ptr_conv.is_owned = false;
52856         LDKECDSASignature val_ref;
52857         CHECK(val->arr_len == 64);
52858         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
52859         AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
52860 }
52861
52862 int8_tArray  CS_LDK_AnnouncementSignatures_get_bitcoin_signature(int64_t this_ptr) {
52863         LDKAnnouncementSignatures this_ptr_conv;
52864         this_ptr_conv.inner = untag_ptr(this_ptr);
52865         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52866         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52867         this_ptr_conv.is_owned = false;
52868         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
52869         memcpy(ret_arr->elems, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form, 64);
52870         return ret_arr;
52871 }
52872
52873 void  CS_LDK_AnnouncementSignatures_set_bitcoin_signature(int64_t this_ptr, int8_tArray val) {
52874         LDKAnnouncementSignatures this_ptr_conv;
52875         this_ptr_conv.inner = untag_ptr(this_ptr);
52876         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52877         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52878         this_ptr_conv.is_owned = false;
52879         LDKECDSASignature val_ref;
52880         CHECK(val->arr_len == 64);
52881         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
52882         AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
52883 }
52884
52885 int64_t  CS_LDK_AnnouncementSignatures_new(int64_t channel_id_arg, int64_t short_channel_id_arg, int8_tArray node_signature_arg, int8_tArray bitcoin_signature_arg) {
52886         LDKChannelId channel_id_arg_conv;
52887         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
52888         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
52889         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
52890         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
52891         LDKECDSASignature node_signature_arg_ref;
52892         CHECK(node_signature_arg->arr_len == 64);
52893         memcpy(node_signature_arg_ref.compact_form, node_signature_arg->elems, 64); FREE(node_signature_arg);
52894         LDKECDSASignature bitcoin_signature_arg_ref;
52895         CHECK(bitcoin_signature_arg->arr_len == 64);
52896         memcpy(bitcoin_signature_arg_ref.compact_form, bitcoin_signature_arg->elems, 64); FREE(bitcoin_signature_arg);
52897         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_conv, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
52898         int64_t ret_ref = 0;
52899         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52900         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52901         return ret_ref;
52902 }
52903
52904 static inline uint64_t AnnouncementSignatures_clone_ptr(LDKAnnouncementSignatures *NONNULL_PTR arg) {
52905         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(arg);
52906         int64_t ret_ref = 0;
52907         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52908         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52909         return ret_ref;
52910 }
52911 int64_t  CS_LDK_AnnouncementSignatures_clone_ptr(int64_t arg) {
52912         LDKAnnouncementSignatures arg_conv;
52913         arg_conv.inner = untag_ptr(arg);
52914         arg_conv.is_owned = ptr_is_owned(arg);
52915         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52916         arg_conv.is_owned = false;
52917         int64_t ret_conv = AnnouncementSignatures_clone_ptr(&arg_conv);
52918         return ret_conv;
52919 }
52920
52921 int64_t  CS_LDK_AnnouncementSignatures_clone(int64_t orig) {
52922         LDKAnnouncementSignatures orig_conv;
52923         orig_conv.inner = untag_ptr(orig);
52924         orig_conv.is_owned = ptr_is_owned(orig);
52925         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52926         orig_conv.is_owned = false;
52927         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
52928         int64_t ret_ref = 0;
52929         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52930         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52931         return ret_ref;
52932 }
52933
52934 int64_t  CS_LDK_AnnouncementSignatures_hash(int64_t o) {
52935         LDKAnnouncementSignatures o_conv;
52936         o_conv.inner = untag_ptr(o);
52937         o_conv.is_owned = ptr_is_owned(o);
52938         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
52939         o_conv.is_owned = false;
52940         int64_t ret_conv = AnnouncementSignatures_hash(&o_conv);
52941         return ret_conv;
52942 }
52943
52944 jboolean  CS_LDK_AnnouncementSignatures_eq(int64_t a, int64_t b) {
52945         LDKAnnouncementSignatures a_conv;
52946         a_conv.inner = untag_ptr(a);
52947         a_conv.is_owned = ptr_is_owned(a);
52948         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
52949         a_conv.is_owned = false;
52950         LDKAnnouncementSignatures b_conv;
52951         b_conv.inner = untag_ptr(b);
52952         b_conv.is_owned = ptr_is_owned(b);
52953         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
52954         b_conv.is_owned = false;
52955         jboolean ret_conv = AnnouncementSignatures_eq(&a_conv, &b_conv);
52956         return ret_conv;
52957 }
52958
52959 void  CS_LDK_SocketAddress_free(int64_t this_ptr) {
52960         if (!ptr_is_owned(this_ptr)) return;
52961         void* this_ptr_ptr = untag_ptr(this_ptr);
52962         CHECK_ACCESS(this_ptr_ptr);
52963         LDKSocketAddress this_ptr_conv = *(LDKSocketAddress*)(this_ptr_ptr);
52964         FREE(untag_ptr(this_ptr));
52965         SocketAddress_free(this_ptr_conv);
52966 }
52967
52968 static inline uint64_t SocketAddress_clone_ptr(LDKSocketAddress *NONNULL_PTR arg) {
52969         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
52970         *ret_copy = SocketAddress_clone(arg);
52971         int64_t ret_ref = tag_ptr(ret_copy, true);
52972         return ret_ref;
52973 }
52974 int64_t  CS_LDK_SocketAddress_clone_ptr(int64_t arg) {
52975         LDKSocketAddress* arg_conv = (LDKSocketAddress*)untag_ptr(arg);
52976         int64_t ret_conv = SocketAddress_clone_ptr(arg_conv);
52977         return ret_conv;
52978 }
52979
52980 int64_t  CS_LDK_SocketAddress_clone(int64_t orig) {
52981         LDKSocketAddress* orig_conv = (LDKSocketAddress*)untag_ptr(orig);
52982         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
52983         *ret_copy = SocketAddress_clone(orig_conv);
52984         int64_t ret_ref = tag_ptr(ret_copy, true);
52985         return ret_ref;
52986 }
52987
52988 int64_t  CS_LDK_SocketAddress_tcp_ip_v4(int8_tArray addr, int16_t port) {
52989         LDKFourBytes addr_ref;
52990         CHECK(addr->arr_len == 4);
52991         memcpy(addr_ref.data, addr->elems, 4); FREE(addr);
52992         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
52993         *ret_copy = SocketAddress_tcp_ip_v4(addr_ref, port);
52994         int64_t ret_ref = tag_ptr(ret_copy, true);
52995         return ret_ref;
52996 }
52997
52998 int64_t  CS_LDK_SocketAddress_tcp_ip_v6(int8_tArray addr, int16_t port) {
52999         LDKSixteenBytes addr_ref;
53000         CHECK(addr->arr_len == 16);
53001         memcpy(addr_ref.data, addr->elems, 16); FREE(addr);
53002         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
53003         *ret_copy = SocketAddress_tcp_ip_v6(addr_ref, port);
53004         int64_t ret_ref = tag_ptr(ret_copy, true);
53005         return ret_ref;
53006 }
53007
53008 int64_t  CS_LDK_SocketAddress_onion_v2(int8_tArray a) {
53009         LDKTwelveBytes a_ref;
53010         CHECK(a->arr_len == 12);
53011         memcpy(a_ref.data, a->elems, 12); FREE(a);
53012         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
53013         *ret_copy = SocketAddress_onion_v2(a_ref);
53014         int64_t ret_ref = tag_ptr(ret_copy, true);
53015         return ret_ref;
53016 }
53017
53018 int64_t  CS_LDK_SocketAddress_onion_v3(int8_tArray ed25519_pubkey, int16_t checksum, int8_t version, int16_t port) {
53019         LDKThirtyTwoBytes ed25519_pubkey_ref;
53020         CHECK(ed25519_pubkey->arr_len == 32);
53021         memcpy(ed25519_pubkey_ref.data, ed25519_pubkey->elems, 32); FREE(ed25519_pubkey);
53022         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
53023         *ret_copy = SocketAddress_onion_v3(ed25519_pubkey_ref, checksum, version, port);
53024         int64_t ret_ref = tag_ptr(ret_copy, true);
53025         return ret_ref;
53026 }
53027
53028 int64_t  CS_LDK_SocketAddress_hostname(int64_t hostname, int16_t port) {
53029         LDKHostname hostname_conv;
53030         hostname_conv.inner = untag_ptr(hostname);
53031         hostname_conv.is_owned = ptr_is_owned(hostname);
53032         CHECK_INNER_FIELD_ACCESS_OR_NULL(hostname_conv);
53033         hostname_conv = Hostname_clone(&hostname_conv);
53034         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
53035         *ret_copy = SocketAddress_hostname(hostname_conv, port);
53036         int64_t ret_ref = tag_ptr(ret_copy, true);
53037         return ret_ref;
53038 }
53039
53040 int64_t  CS_LDK_SocketAddress_hash(int64_t o) {
53041         LDKSocketAddress* o_conv = (LDKSocketAddress*)untag_ptr(o);
53042         int64_t ret_conv = SocketAddress_hash(o_conv);
53043         return ret_conv;
53044 }
53045
53046 jboolean  CS_LDK_SocketAddress_eq(int64_t a, int64_t b) {
53047         LDKSocketAddress* a_conv = (LDKSocketAddress*)untag_ptr(a);
53048         LDKSocketAddress* b_conv = (LDKSocketAddress*)untag_ptr(b);
53049         jboolean ret_conv = SocketAddress_eq(a_conv, b_conv);
53050         return ret_conv;
53051 }
53052
53053 int8_tArray  CS_LDK_SocketAddress_write(int64_t obj) {
53054         LDKSocketAddress* obj_conv = (LDKSocketAddress*)untag_ptr(obj);
53055         LDKCVec_u8Z ret_var = SocketAddress_write(obj_conv);
53056         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
53057         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
53058         CVec_u8Z_free(ret_var);
53059         return ret_arr;
53060 }
53061
53062 int64_t  CS_LDK_SocketAddress_read(int8_tArray ser) {
53063         LDKu8slice ser_ref;
53064         ser_ref.datalen = ser->arr_len;
53065         ser_ref.data = ser->elems;
53066         LDKCResult_SocketAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressDecodeErrorZ), "LDKCResult_SocketAddressDecodeErrorZ");
53067         *ret_conv = SocketAddress_read(ser_ref);
53068         FREE(ser);
53069         return tag_ptr(ret_conv, true);
53070 }
53071
53072 int32_t  CS_LDK_SocketAddressParseError_clone(int64_t orig) {
53073         LDKSocketAddressParseError* orig_conv = (LDKSocketAddressParseError*)untag_ptr(orig);
53074         int32_t ret_conv = LDKSocketAddressParseError_to_cs(SocketAddressParseError_clone(orig_conv));
53075         return ret_conv;
53076 }
53077
53078 int32_t  CS_LDK_SocketAddressParseError_socket_addr_parse() {
53079         int32_t ret_conv = LDKSocketAddressParseError_to_cs(SocketAddressParseError_socket_addr_parse());
53080         return ret_conv;
53081 }
53082
53083 int32_t  CS_LDK_SocketAddressParseError_invalid_input() {
53084         int32_t ret_conv = LDKSocketAddressParseError_to_cs(SocketAddressParseError_invalid_input());
53085         return ret_conv;
53086 }
53087
53088 int32_t  CS_LDK_SocketAddressParseError_invalid_port() {
53089         int32_t ret_conv = LDKSocketAddressParseError_to_cs(SocketAddressParseError_invalid_port());
53090         return ret_conv;
53091 }
53092
53093 int32_t  CS_LDK_SocketAddressParseError_invalid_onion_v3() {
53094         int32_t ret_conv = LDKSocketAddressParseError_to_cs(SocketAddressParseError_invalid_onion_v3());
53095         return ret_conv;
53096 }
53097
53098 int64_t  CS_LDK_SocketAddressParseError_hash(int64_t o) {
53099         LDKSocketAddressParseError* o_conv = (LDKSocketAddressParseError*)untag_ptr(o);
53100         int64_t ret_conv = SocketAddressParseError_hash(o_conv);
53101         return ret_conv;
53102 }
53103
53104 jboolean  CS_LDK_SocketAddressParseError_eq(int64_t a, int64_t b) {
53105         LDKSocketAddressParseError* a_conv = (LDKSocketAddressParseError*)untag_ptr(a);
53106         LDKSocketAddressParseError* b_conv = (LDKSocketAddressParseError*)untag_ptr(b);
53107         jboolean ret_conv = SocketAddressParseError_eq(a_conv, b_conv);
53108         return ret_conv;
53109 }
53110
53111 jstring  CS_LDK_SocketAddressParseError_to_str(int64_t o) {
53112         LDKSocketAddressParseError* o_conv = (LDKSocketAddressParseError*)untag_ptr(o);
53113         LDKStr ret_str = SocketAddressParseError_to_str(o_conv);
53114         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
53115         Str_free(ret_str);
53116         return ret_conv;
53117 }
53118
53119 int64_t  CS_LDK_parse_onion_address(jstring host, int16_t port) {
53120         LDKStr host_conv = str_ref_to_owned_c(host);
53121         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
53122         *ret_conv = parse_onion_address(host_conv, port);
53123         return tag_ptr(ret_conv, true);
53124 }
53125
53126 jstring  CS_LDK_SocketAddress_to_str(int64_t o) {
53127         LDKSocketAddress* o_conv = (LDKSocketAddress*)untag_ptr(o);
53128         LDKStr ret_str = SocketAddress_to_str(o_conv);
53129         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
53130         Str_free(ret_str);
53131         return ret_conv;
53132 }
53133
53134 int64_t  CS_LDK_SocketAddress_from_str(jstring s) {
53135         LDKStr s_conv = str_ref_to_owned_c(s);
53136         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
53137         *ret_conv = SocketAddress_from_str(s_conv);
53138         return tag_ptr(ret_conv, true);
53139 }
53140
53141 void  CS_LDK_UnsignedGossipMessage_free(int64_t this_ptr) {
53142         if (!ptr_is_owned(this_ptr)) return;
53143         void* this_ptr_ptr = untag_ptr(this_ptr);
53144         CHECK_ACCESS(this_ptr_ptr);
53145         LDKUnsignedGossipMessage this_ptr_conv = *(LDKUnsignedGossipMessage*)(this_ptr_ptr);
53146         FREE(untag_ptr(this_ptr));
53147         UnsignedGossipMessage_free(this_ptr_conv);
53148 }
53149
53150 static inline uint64_t UnsignedGossipMessage_clone_ptr(LDKUnsignedGossipMessage *NONNULL_PTR arg) {
53151         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
53152         *ret_copy = UnsignedGossipMessage_clone(arg);
53153         int64_t ret_ref = tag_ptr(ret_copy, true);
53154         return ret_ref;
53155 }
53156 int64_t  CS_LDK_UnsignedGossipMessage_clone_ptr(int64_t arg) {
53157         LDKUnsignedGossipMessage* arg_conv = (LDKUnsignedGossipMessage*)untag_ptr(arg);
53158         int64_t ret_conv = UnsignedGossipMessage_clone_ptr(arg_conv);
53159         return ret_conv;
53160 }
53161
53162 int64_t  CS_LDK_UnsignedGossipMessage_clone(int64_t orig) {
53163         LDKUnsignedGossipMessage* orig_conv = (LDKUnsignedGossipMessage*)untag_ptr(orig);
53164         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
53165         *ret_copy = UnsignedGossipMessage_clone(orig_conv);
53166         int64_t ret_ref = tag_ptr(ret_copy, true);
53167         return ret_ref;
53168 }
53169
53170 int64_t  CS_LDK_UnsignedGossipMessage_channel_announcement(int64_t a) {
53171         LDKUnsignedChannelAnnouncement a_conv;
53172         a_conv.inner = untag_ptr(a);
53173         a_conv.is_owned = ptr_is_owned(a);
53174         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
53175         a_conv = UnsignedChannelAnnouncement_clone(&a_conv);
53176         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
53177         *ret_copy = UnsignedGossipMessage_channel_announcement(a_conv);
53178         int64_t ret_ref = tag_ptr(ret_copy, true);
53179         return ret_ref;
53180 }
53181
53182 int64_t  CS_LDK_UnsignedGossipMessage_channel_update(int64_t a) {
53183         LDKUnsignedChannelUpdate a_conv;
53184         a_conv.inner = untag_ptr(a);
53185         a_conv.is_owned = ptr_is_owned(a);
53186         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
53187         a_conv = UnsignedChannelUpdate_clone(&a_conv);
53188         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
53189         *ret_copy = UnsignedGossipMessage_channel_update(a_conv);
53190         int64_t ret_ref = tag_ptr(ret_copy, true);
53191         return ret_ref;
53192 }
53193
53194 int64_t  CS_LDK_UnsignedGossipMessage_node_announcement(int64_t a) {
53195         LDKUnsignedNodeAnnouncement a_conv;
53196         a_conv.inner = untag_ptr(a);
53197         a_conv.is_owned = ptr_is_owned(a);
53198         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
53199         a_conv = UnsignedNodeAnnouncement_clone(&a_conv);
53200         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
53201         *ret_copy = UnsignedGossipMessage_node_announcement(a_conv);
53202         int64_t ret_ref = tag_ptr(ret_copy, true);
53203         return ret_ref;
53204 }
53205
53206 int8_tArray  CS_LDK_UnsignedGossipMessage_write(int64_t obj) {
53207         LDKUnsignedGossipMessage* obj_conv = (LDKUnsignedGossipMessage*)untag_ptr(obj);
53208         LDKCVec_u8Z ret_var = UnsignedGossipMessage_write(obj_conv);
53209         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
53210         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
53211         CVec_u8Z_free(ret_var);
53212         return ret_arr;
53213 }
53214
53215 void  CS_LDK_UnsignedNodeAnnouncement_free(int64_t this_obj) {
53216         LDKUnsignedNodeAnnouncement this_obj_conv;
53217         this_obj_conv.inner = untag_ptr(this_obj);
53218         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53219         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53220         UnsignedNodeAnnouncement_free(this_obj_conv);
53221 }
53222
53223 int64_t  CS_LDK_UnsignedNodeAnnouncement_get_features(int64_t this_ptr) {
53224         LDKUnsignedNodeAnnouncement this_ptr_conv;
53225         this_ptr_conv.inner = untag_ptr(this_ptr);
53226         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53227         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53228         this_ptr_conv.is_owned = false;
53229         LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
53230         int64_t ret_ref = 0;
53231         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53232         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53233         return ret_ref;
53234 }
53235
53236 void  CS_LDK_UnsignedNodeAnnouncement_set_features(int64_t this_ptr, int64_t val) {
53237         LDKUnsignedNodeAnnouncement this_ptr_conv;
53238         this_ptr_conv.inner = untag_ptr(this_ptr);
53239         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53240         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53241         this_ptr_conv.is_owned = false;
53242         LDKNodeFeatures val_conv;
53243         val_conv.inner = untag_ptr(val);
53244         val_conv.is_owned = ptr_is_owned(val);
53245         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
53246         val_conv = NodeFeatures_clone(&val_conv);
53247         UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
53248 }
53249
53250 int32_t  CS_LDK_UnsignedNodeAnnouncement_get_timestamp(int64_t this_ptr) {
53251         LDKUnsignedNodeAnnouncement this_ptr_conv;
53252         this_ptr_conv.inner = untag_ptr(this_ptr);
53253         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53254         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53255         this_ptr_conv.is_owned = false;
53256         int32_t ret_conv = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
53257         return ret_conv;
53258 }
53259
53260 void  CS_LDK_UnsignedNodeAnnouncement_set_timestamp(int64_t this_ptr, int32_t val) {
53261         LDKUnsignedNodeAnnouncement this_ptr_conv;
53262         this_ptr_conv.inner = untag_ptr(this_ptr);
53263         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53264         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53265         this_ptr_conv.is_owned = false;
53266         UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
53267 }
53268
53269 int64_t  CS_LDK_UnsignedNodeAnnouncement_get_node_id(int64_t this_ptr) {
53270         LDKUnsignedNodeAnnouncement this_ptr_conv;
53271         this_ptr_conv.inner = untag_ptr(this_ptr);
53272         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53273         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53274         this_ptr_conv.is_owned = false;
53275         LDKNodeId ret_var = UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv);
53276         int64_t ret_ref = 0;
53277         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53278         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53279         return ret_ref;
53280 }
53281
53282 void  CS_LDK_UnsignedNodeAnnouncement_set_node_id(int64_t this_ptr, int64_t val) {
53283         LDKUnsignedNodeAnnouncement this_ptr_conv;
53284         this_ptr_conv.inner = untag_ptr(this_ptr);
53285         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53286         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53287         this_ptr_conv.is_owned = false;
53288         LDKNodeId val_conv;
53289         val_conv.inner = untag_ptr(val);
53290         val_conv.is_owned = ptr_is_owned(val);
53291         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
53292         val_conv = NodeId_clone(&val_conv);
53293         UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_conv);
53294 }
53295
53296 int8_tArray  CS_LDK_UnsignedNodeAnnouncement_get_rgb(int64_t this_ptr) {
53297         LDKUnsignedNodeAnnouncement this_ptr_conv;
53298         this_ptr_conv.inner = untag_ptr(this_ptr);
53299         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53300         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53301         this_ptr_conv.is_owned = false;
53302         int8_tArray ret_arr = init_int8_tArray(3, __LINE__);
53303         memcpy(ret_arr->elems, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv), 3);
53304         return ret_arr;
53305 }
53306
53307 void  CS_LDK_UnsignedNodeAnnouncement_set_rgb(int64_t this_ptr, int8_tArray val) {
53308         LDKUnsignedNodeAnnouncement this_ptr_conv;
53309         this_ptr_conv.inner = untag_ptr(this_ptr);
53310         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53311         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53312         this_ptr_conv.is_owned = false;
53313         LDKThreeBytes val_ref;
53314         CHECK(val->arr_len == 3);
53315         memcpy(val_ref.data, val->elems, 3); FREE(val);
53316         UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
53317 }
53318
53319 int64_t  CS_LDK_UnsignedNodeAnnouncement_get_alias(int64_t this_ptr) {
53320         LDKUnsignedNodeAnnouncement this_ptr_conv;
53321         this_ptr_conv.inner = untag_ptr(this_ptr);
53322         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53323         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53324         this_ptr_conv.is_owned = false;
53325         LDKNodeAlias ret_var = UnsignedNodeAnnouncement_get_alias(&this_ptr_conv);
53326         int64_t ret_ref = 0;
53327         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53328         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53329         return ret_ref;
53330 }
53331
53332 void  CS_LDK_UnsignedNodeAnnouncement_set_alias(int64_t this_ptr, int64_t val) {
53333         LDKUnsignedNodeAnnouncement this_ptr_conv;
53334         this_ptr_conv.inner = untag_ptr(this_ptr);
53335         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53336         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53337         this_ptr_conv.is_owned = false;
53338         LDKNodeAlias val_conv;
53339         val_conv.inner = untag_ptr(val);
53340         val_conv.is_owned = ptr_is_owned(val);
53341         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
53342         val_conv = NodeAlias_clone(&val_conv);
53343         UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_conv);
53344 }
53345
53346 int64_tArray  CS_LDK_UnsignedNodeAnnouncement_get_addresses(int64_t this_ptr) {
53347         LDKUnsignedNodeAnnouncement this_ptr_conv;
53348         this_ptr_conv.inner = untag_ptr(this_ptr);
53349         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53350         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53351         this_ptr_conv.is_owned = false;
53352         LDKCVec_SocketAddressZ ret_var = UnsignedNodeAnnouncement_get_addresses(&this_ptr_conv);
53353         int64_tArray ret_arr = NULL;
53354         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
53355         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
53356         for (size_t p = 0; p < ret_var.datalen; p++) {
53357                 LDKSocketAddress *ret_conv_15_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
53358                 *ret_conv_15_copy = ret_var.data[p];
53359                 int64_t ret_conv_15_ref = tag_ptr(ret_conv_15_copy, true);
53360                 ret_arr_ptr[p] = ret_conv_15_ref;
53361         }
53362         
53363         FREE(ret_var.data);
53364         return ret_arr;
53365 }
53366
53367 void  CS_LDK_UnsignedNodeAnnouncement_set_addresses(int64_t this_ptr, int64_tArray val) {
53368         LDKUnsignedNodeAnnouncement this_ptr_conv;
53369         this_ptr_conv.inner = untag_ptr(this_ptr);
53370         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53371         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53372         this_ptr_conv.is_owned = false;
53373         LDKCVec_SocketAddressZ val_constr;
53374         val_constr.datalen = val->arr_len;
53375         if (val_constr.datalen > 0)
53376                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
53377         else
53378                 val_constr.data = NULL;
53379         int64_t* val_vals = val->elems;
53380         for (size_t p = 0; p < val_constr.datalen; p++) {
53381                 int64_t val_conv_15 = val_vals[p];
53382                 void* val_conv_15_ptr = untag_ptr(val_conv_15);
53383                 CHECK_ACCESS(val_conv_15_ptr);
53384                 LDKSocketAddress val_conv_15_conv = *(LDKSocketAddress*)(val_conv_15_ptr);
53385                 val_conv_15_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(val_conv_15));
53386                 val_constr.data[p] = val_conv_15_conv;
53387         }
53388         FREE(val);
53389         UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
53390 }
53391
53392 int8_tArray  CS_LDK_UnsignedNodeAnnouncement_get_excess_address_data(int64_t this_ptr) {
53393         LDKUnsignedNodeAnnouncement this_ptr_conv;
53394         this_ptr_conv.inner = untag_ptr(this_ptr);
53395         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53396         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53397         this_ptr_conv.is_owned = false;
53398         LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_get_excess_address_data(&this_ptr_conv);
53399         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
53400         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
53401         CVec_u8Z_free(ret_var);
53402         return ret_arr;
53403 }
53404
53405 void  CS_LDK_UnsignedNodeAnnouncement_set_excess_address_data(int64_t this_ptr, int8_tArray val) {
53406         LDKUnsignedNodeAnnouncement this_ptr_conv;
53407         this_ptr_conv.inner = untag_ptr(this_ptr);
53408         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53409         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53410         this_ptr_conv.is_owned = false;
53411         LDKCVec_u8Z val_ref;
53412         val_ref.datalen = val->arr_len;
53413         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
53414         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
53415         UnsignedNodeAnnouncement_set_excess_address_data(&this_ptr_conv, val_ref);
53416 }
53417
53418 int8_tArray  CS_LDK_UnsignedNodeAnnouncement_get_excess_data(int64_t this_ptr) {
53419         LDKUnsignedNodeAnnouncement this_ptr_conv;
53420         this_ptr_conv.inner = untag_ptr(this_ptr);
53421         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53422         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53423         this_ptr_conv.is_owned = false;
53424         LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_get_excess_data(&this_ptr_conv);
53425         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
53426         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
53427         CVec_u8Z_free(ret_var);
53428         return ret_arr;
53429 }
53430
53431 void  CS_LDK_UnsignedNodeAnnouncement_set_excess_data(int64_t this_ptr, int8_tArray val) {
53432         LDKUnsignedNodeAnnouncement this_ptr_conv;
53433         this_ptr_conv.inner = untag_ptr(this_ptr);
53434         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53435         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53436         this_ptr_conv.is_owned = false;
53437         LDKCVec_u8Z val_ref;
53438         val_ref.datalen = val->arr_len;
53439         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
53440         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
53441         UnsignedNodeAnnouncement_set_excess_data(&this_ptr_conv, val_ref);
53442 }
53443
53444 int64_t  CS_LDK_UnsignedNodeAnnouncement_new(int64_t features_arg, int32_t timestamp_arg, int64_t node_id_arg, int8_tArray rgb_arg, int64_t alias_arg, int64_tArray addresses_arg, int8_tArray excess_address_data_arg, int8_tArray excess_data_arg) {
53445         LDKNodeFeatures features_arg_conv;
53446         features_arg_conv.inner = untag_ptr(features_arg);
53447         features_arg_conv.is_owned = ptr_is_owned(features_arg);
53448         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
53449         features_arg_conv = NodeFeatures_clone(&features_arg_conv);
53450         LDKNodeId node_id_arg_conv;
53451         node_id_arg_conv.inner = untag_ptr(node_id_arg);
53452         node_id_arg_conv.is_owned = ptr_is_owned(node_id_arg);
53453         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_arg_conv);
53454         node_id_arg_conv = NodeId_clone(&node_id_arg_conv);
53455         LDKThreeBytes rgb_arg_ref;
53456         CHECK(rgb_arg->arr_len == 3);
53457         memcpy(rgb_arg_ref.data, rgb_arg->elems, 3); FREE(rgb_arg);
53458         LDKNodeAlias alias_arg_conv;
53459         alias_arg_conv.inner = untag_ptr(alias_arg);
53460         alias_arg_conv.is_owned = ptr_is_owned(alias_arg);
53461         CHECK_INNER_FIELD_ACCESS_OR_NULL(alias_arg_conv);
53462         alias_arg_conv = NodeAlias_clone(&alias_arg_conv);
53463         LDKCVec_SocketAddressZ addresses_arg_constr;
53464         addresses_arg_constr.datalen = addresses_arg->arr_len;
53465         if (addresses_arg_constr.datalen > 0)
53466                 addresses_arg_constr.data = MALLOC(addresses_arg_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
53467         else
53468                 addresses_arg_constr.data = NULL;
53469         int64_t* addresses_arg_vals = addresses_arg->elems;
53470         for (size_t p = 0; p < addresses_arg_constr.datalen; p++) {
53471                 int64_t addresses_arg_conv_15 = addresses_arg_vals[p];
53472                 void* addresses_arg_conv_15_ptr = untag_ptr(addresses_arg_conv_15);
53473                 CHECK_ACCESS(addresses_arg_conv_15_ptr);
53474                 LDKSocketAddress addresses_arg_conv_15_conv = *(LDKSocketAddress*)(addresses_arg_conv_15_ptr);
53475                 addresses_arg_constr.data[p] = addresses_arg_conv_15_conv;
53476         }
53477         FREE(addresses_arg);
53478         LDKCVec_u8Z excess_address_data_arg_ref;
53479         excess_address_data_arg_ref.datalen = excess_address_data_arg->arr_len;
53480         excess_address_data_arg_ref.data = MALLOC(excess_address_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
53481         memcpy(excess_address_data_arg_ref.data, excess_address_data_arg->elems, excess_address_data_arg_ref.datalen); FREE(excess_address_data_arg);
53482         LDKCVec_u8Z excess_data_arg_ref;
53483         excess_data_arg_ref.datalen = excess_data_arg->arr_len;
53484         excess_data_arg_ref.data = MALLOC(excess_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
53485         memcpy(excess_data_arg_ref.data, excess_data_arg->elems, excess_data_arg_ref.datalen); FREE(excess_data_arg);
53486         LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_new(features_arg_conv, timestamp_arg, node_id_arg_conv, rgb_arg_ref, alias_arg_conv, addresses_arg_constr, excess_address_data_arg_ref, excess_data_arg_ref);
53487         int64_t ret_ref = 0;
53488         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53489         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53490         return ret_ref;
53491 }
53492
53493 static inline uint64_t UnsignedNodeAnnouncement_clone_ptr(LDKUnsignedNodeAnnouncement *NONNULL_PTR arg) {
53494         LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(arg);
53495         int64_t ret_ref = 0;
53496         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53497         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53498         return ret_ref;
53499 }
53500 int64_t  CS_LDK_UnsignedNodeAnnouncement_clone_ptr(int64_t arg) {
53501         LDKUnsignedNodeAnnouncement arg_conv;
53502         arg_conv.inner = untag_ptr(arg);
53503         arg_conv.is_owned = ptr_is_owned(arg);
53504         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
53505         arg_conv.is_owned = false;
53506         int64_t ret_conv = UnsignedNodeAnnouncement_clone_ptr(&arg_conv);
53507         return ret_conv;
53508 }
53509
53510 int64_t  CS_LDK_UnsignedNodeAnnouncement_clone(int64_t orig) {
53511         LDKUnsignedNodeAnnouncement orig_conv;
53512         orig_conv.inner = untag_ptr(orig);
53513         orig_conv.is_owned = ptr_is_owned(orig);
53514         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
53515         orig_conv.is_owned = false;
53516         LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
53517         int64_t ret_ref = 0;
53518         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53519         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53520         return ret_ref;
53521 }
53522
53523 int64_t  CS_LDK_UnsignedNodeAnnouncement_hash(int64_t o) {
53524         LDKUnsignedNodeAnnouncement o_conv;
53525         o_conv.inner = untag_ptr(o);
53526         o_conv.is_owned = ptr_is_owned(o);
53527         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
53528         o_conv.is_owned = false;
53529         int64_t ret_conv = UnsignedNodeAnnouncement_hash(&o_conv);
53530         return ret_conv;
53531 }
53532
53533 jboolean  CS_LDK_UnsignedNodeAnnouncement_eq(int64_t a, int64_t b) {
53534         LDKUnsignedNodeAnnouncement a_conv;
53535         a_conv.inner = untag_ptr(a);
53536         a_conv.is_owned = ptr_is_owned(a);
53537         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
53538         a_conv.is_owned = false;
53539         LDKUnsignedNodeAnnouncement b_conv;
53540         b_conv.inner = untag_ptr(b);
53541         b_conv.is_owned = ptr_is_owned(b);
53542         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
53543         b_conv.is_owned = false;
53544         jboolean ret_conv = UnsignedNodeAnnouncement_eq(&a_conv, &b_conv);
53545         return ret_conv;
53546 }
53547
53548 void  CS_LDK_NodeAnnouncement_free(int64_t this_obj) {
53549         LDKNodeAnnouncement this_obj_conv;
53550         this_obj_conv.inner = untag_ptr(this_obj);
53551         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53552         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53553         NodeAnnouncement_free(this_obj_conv);
53554 }
53555
53556 int8_tArray  CS_LDK_NodeAnnouncement_get_signature(int64_t this_ptr) {
53557         LDKNodeAnnouncement this_ptr_conv;
53558         this_ptr_conv.inner = untag_ptr(this_ptr);
53559         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53560         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53561         this_ptr_conv.is_owned = false;
53562         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
53563         memcpy(ret_arr->elems, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form, 64);
53564         return ret_arr;
53565 }
53566
53567 void  CS_LDK_NodeAnnouncement_set_signature(int64_t this_ptr, int8_tArray val) {
53568         LDKNodeAnnouncement this_ptr_conv;
53569         this_ptr_conv.inner = untag_ptr(this_ptr);
53570         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53571         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53572         this_ptr_conv.is_owned = false;
53573         LDKECDSASignature val_ref;
53574         CHECK(val->arr_len == 64);
53575         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
53576         NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
53577 }
53578
53579 int64_t  CS_LDK_NodeAnnouncement_get_contents(int64_t this_ptr) {
53580         LDKNodeAnnouncement this_ptr_conv;
53581         this_ptr_conv.inner = untag_ptr(this_ptr);
53582         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53583         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53584         this_ptr_conv.is_owned = false;
53585         LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
53586         int64_t ret_ref = 0;
53587         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53588         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53589         return ret_ref;
53590 }
53591
53592 void  CS_LDK_NodeAnnouncement_set_contents(int64_t this_ptr, int64_t val) {
53593         LDKNodeAnnouncement this_ptr_conv;
53594         this_ptr_conv.inner = untag_ptr(this_ptr);
53595         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53596         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53597         this_ptr_conv.is_owned = false;
53598         LDKUnsignedNodeAnnouncement val_conv;
53599         val_conv.inner = untag_ptr(val);
53600         val_conv.is_owned = ptr_is_owned(val);
53601         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
53602         val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
53603         NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
53604 }
53605
53606 int64_t  CS_LDK_NodeAnnouncement_new(int8_tArray signature_arg, int64_t contents_arg) {
53607         LDKECDSASignature signature_arg_ref;
53608         CHECK(signature_arg->arr_len == 64);
53609         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
53610         LDKUnsignedNodeAnnouncement contents_arg_conv;
53611         contents_arg_conv.inner = untag_ptr(contents_arg);
53612         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
53613         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
53614         contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
53615         LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
53616         int64_t ret_ref = 0;
53617         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53618         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53619         return ret_ref;
53620 }
53621
53622 static inline uint64_t NodeAnnouncement_clone_ptr(LDKNodeAnnouncement *NONNULL_PTR arg) {
53623         LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(arg);
53624         int64_t ret_ref = 0;
53625         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53626         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53627         return ret_ref;
53628 }
53629 int64_t  CS_LDK_NodeAnnouncement_clone_ptr(int64_t arg) {
53630         LDKNodeAnnouncement arg_conv;
53631         arg_conv.inner = untag_ptr(arg);
53632         arg_conv.is_owned = ptr_is_owned(arg);
53633         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
53634         arg_conv.is_owned = false;
53635         int64_t ret_conv = NodeAnnouncement_clone_ptr(&arg_conv);
53636         return ret_conv;
53637 }
53638
53639 int64_t  CS_LDK_NodeAnnouncement_clone(int64_t orig) {
53640         LDKNodeAnnouncement orig_conv;
53641         orig_conv.inner = untag_ptr(orig);
53642         orig_conv.is_owned = ptr_is_owned(orig);
53643         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
53644         orig_conv.is_owned = false;
53645         LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
53646         int64_t ret_ref = 0;
53647         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53648         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53649         return ret_ref;
53650 }
53651
53652 int64_t  CS_LDK_NodeAnnouncement_hash(int64_t o) {
53653         LDKNodeAnnouncement o_conv;
53654         o_conv.inner = untag_ptr(o);
53655         o_conv.is_owned = ptr_is_owned(o);
53656         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
53657         o_conv.is_owned = false;
53658         int64_t ret_conv = NodeAnnouncement_hash(&o_conv);
53659         return ret_conv;
53660 }
53661
53662 jboolean  CS_LDK_NodeAnnouncement_eq(int64_t a, int64_t b) {
53663         LDKNodeAnnouncement a_conv;
53664         a_conv.inner = untag_ptr(a);
53665         a_conv.is_owned = ptr_is_owned(a);
53666         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
53667         a_conv.is_owned = false;
53668         LDKNodeAnnouncement b_conv;
53669         b_conv.inner = untag_ptr(b);
53670         b_conv.is_owned = ptr_is_owned(b);
53671         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
53672         b_conv.is_owned = false;
53673         jboolean ret_conv = NodeAnnouncement_eq(&a_conv, &b_conv);
53674         return ret_conv;
53675 }
53676
53677 void  CS_LDK_UnsignedChannelAnnouncement_free(int64_t this_obj) {
53678         LDKUnsignedChannelAnnouncement this_obj_conv;
53679         this_obj_conv.inner = untag_ptr(this_obj);
53680         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53681         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53682         UnsignedChannelAnnouncement_free(this_obj_conv);
53683 }
53684
53685 int64_t  CS_LDK_UnsignedChannelAnnouncement_get_features(int64_t this_ptr) {
53686         LDKUnsignedChannelAnnouncement this_ptr_conv;
53687         this_ptr_conv.inner = untag_ptr(this_ptr);
53688         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53689         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53690         this_ptr_conv.is_owned = false;
53691         LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
53692         int64_t ret_ref = 0;
53693         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53694         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53695         return ret_ref;
53696 }
53697
53698 void  CS_LDK_UnsignedChannelAnnouncement_set_features(int64_t this_ptr, int64_t val) {
53699         LDKUnsignedChannelAnnouncement this_ptr_conv;
53700         this_ptr_conv.inner = untag_ptr(this_ptr);
53701         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53702         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53703         this_ptr_conv.is_owned = false;
53704         LDKChannelFeatures val_conv;
53705         val_conv.inner = untag_ptr(val);
53706         val_conv.is_owned = ptr_is_owned(val);
53707         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
53708         val_conv = ChannelFeatures_clone(&val_conv);
53709         UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
53710 }
53711
53712 int8_tArray  CS_LDK_UnsignedChannelAnnouncement_get_chain_hash(int64_t this_ptr) {
53713         LDKUnsignedChannelAnnouncement this_ptr_conv;
53714         this_ptr_conv.inner = untag_ptr(this_ptr);
53715         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53716         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53717         this_ptr_conv.is_owned = false;
53718         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
53719         memcpy(ret_arr->elems, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv), 32);
53720         return ret_arr;
53721 }
53722
53723 void  CS_LDK_UnsignedChannelAnnouncement_set_chain_hash(int64_t this_ptr, int8_tArray val) {
53724         LDKUnsignedChannelAnnouncement this_ptr_conv;
53725         this_ptr_conv.inner = untag_ptr(this_ptr);
53726         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53727         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53728         this_ptr_conv.is_owned = false;
53729         LDKThirtyTwoBytes val_ref;
53730         CHECK(val->arr_len == 32);
53731         memcpy(val_ref.data, val->elems, 32); FREE(val);
53732         UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
53733 }
53734
53735 int64_t  CS_LDK_UnsignedChannelAnnouncement_get_short_channel_id(int64_t this_ptr) {
53736         LDKUnsignedChannelAnnouncement this_ptr_conv;
53737         this_ptr_conv.inner = untag_ptr(this_ptr);
53738         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53739         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53740         this_ptr_conv.is_owned = false;
53741         int64_t ret_conv = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
53742         return ret_conv;
53743 }
53744
53745 void  CS_LDK_UnsignedChannelAnnouncement_set_short_channel_id(int64_t this_ptr, int64_t val) {
53746         LDKUnsignedChannelAnnouncement this_ptr_conv;
53747         this_ptr_conv.inner = untag_ptr(this_ptr);
53748         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53749         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53750         this_ptr_conv.is_owned = false;
53751         UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
53752 }
53753
53754 int64_t  CS_LDK_UnsignedChannelAnnouncement_get_node_id_1(int64_t this_ptr) {
53755         LDKUnsignedChannelAnnouncement this_ptr_conv;
53756         this_ptr_conv.inner = untag_ptr(this_ptr);
53757         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53758         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53759         this_ptr_conv.is_owned = false;
53760         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv);
53761         int64_t ret_ref = 0;
53762         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53763         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53764         return ret_ref;
53765 }
53766
53767 void  CS_LDK_UnsignedChannelAnnouncement_set_node_id_1(int64_t this_ptr, int64_t val) {
53768         LDKUnsignedChannelAnnouncement this_ptr_conv;
53769         this_ptr_conv.inner = untag_ptr(this_ptr);
53770         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53771         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53772         this_ptr_conv.is_owned = false;
53773         LDKNodeId val_conv;
53774         val_conv.inner = untag_ptr(val);
53775         val_conv.is_owned = ptr_is_owned(val);
53776         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
53777         val_conv = NodeId_clone(&val_conv);
53778         UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_conv);
53779 }
53780
53781 int64_t  CS_LDK_UnsignedChannelAnnouncement_get_node_id_2(int64_t this_ptr) {
53782         LDKUnsignedChannelAnnouncement this_ptr_conv;
53783         this_ptr_conv.inner = untag_ptr(this_ptr);
53784         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53785         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53786         this_ptr_conv.is_owned = false;
53787         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv);
53788         int64_t ret_ref = 0;
53789         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53790         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53791         return ret_ref;
53792 }
53793
53794 void  CS_LDK_UnsignedChannelAnnouncement_set_node_id_2(int64_t this_ptr, int64_t val) {
53795         LDKUnsignedChannelAnnouncement this_ptr_conv;
53796         this_ptr_conv.inner = untag_ptr(this_ptr);
53797         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53798         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53799         this_ptr_conv.is_owned = false;
53800         LDKNodeId val_conv;
53801         val_conv.inner = untag_ptr(val);
53802         val_conv.is_owned = ptr_is_owned(val);
53803         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
53804         val_conv = NodeId_clone(&val_conv);
53805         UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_conv);
53806 }
53807
53808 int64_t  CS_LDK_UnsignedChannelAnnouncement_get_bitcoin_key_1(int64_t this_ptr) {
53809         LDKUnsignedChannelAnnouncement this_ptr_conv;
53810         this_ptr_conv.inner = untag_ptr(this_ptr);
53811         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53812         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53813         this_ptr_conv.is_owned = false;
53814         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv);
53815         int64_t ret_ref = 0;
53816         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53817         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53818         return ret_ref;
53819 }
53820
53821 void  CS_LDK_UnsignedChannelAnnouncement_set_bitcoin_key_1(int64_t this_ptr, int64_t val) {
53822         LDKUnsignedChannelAnnouncement this_ptr_conv;
53823         this_ptr_conv.inner = untag_ptr(this_ptr);
53824         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53825         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53826         this_ptr_conv.is_owned = false;
53827         LDKNodeId val_conv;
53828         val_conv.inner = untag_ptr(val);
53829         val_conv.is_owned = ptr_is_owned(val);
53830         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
53831         val_conv = NodeId_clone(&val_conv);
53832         UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_conv);
53833 }
53834
53835 int64_t  CS_LDK_UnsignedChannelAnnouncement_get_bitcoin_key_2(int64_t this_ptr) {
53836         LDKUnsignedChannelAnnouncement this_ptr_conv;
53837         this_ptr_conv.inner = untag_ptr(this_ptr);
53838         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53839         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53840         this_ptr_conv.is_owned = false;
53841         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv);
53842         int64_t ret_ref = 0;
53843         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53844         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53845         return ret_ref;
53846 }
53847
53848 void  CS_LDK_UnsignedChannelAnnouncement_set_bitcoin_key_2(int64_t this_ptr, int64_t val) {
53849         LDKUnsignedChannelAnnouncement this_ptr_conv;
53850         this_ptr_conv.inner = untag_ptr(this_ptr);
53851         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53852         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53853         this_ptr_conv.is_owned = false;
53854         LDKNodeId val_conv;
53855         val_conv.inner = untag_ptr(val);
53856         val_conv.is_owned = ptr_is_owned(val);
53857         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
53858         val_conv = NodeId_clone(&val_conv);
53859         UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_conv);
53860 }
53861
53862 int8_tArray  CS_LDK_UnsignedChannelAnnouncement_get_excess_data(int64_t this_ptr) {
53863         LDKUnsignedChannelAnnouncement this_ptr_conv;
53864         this_ptr_conv.inner = untag_ptr(this_ptr);
53865         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53866         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53867         this_ptr_conv.is_owned = false;
53868         LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_get_excess_data(&this_ptr_conv);
53869         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
53870         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
53871         CVec_u8Z_free(ret_var);
53872         return ret_arr;
53873 }
53874
53875 void  CS_LDK_UnsignedChannelAnnouncement_set_excess_data(int64_t this_ptr, int8_tArray val) {
53876         LDKUnsignedChannelAnnouncement this_ptr_conv;
53877         this_ptr_conv.inner = untag_ptr(this_ptr);
53878         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53879         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53880         this_ptr_conv.is_owned = false;
53881         LDKCVec_u8Z val_ref;
53882         val_ref.datalen = val->arr_len;
53883         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
53884         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
53885         UnsignedChannelAnnouncement_set_excess_data(&this_ptr_conv, val_ref);
53886 }
53887
53888 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) {
53889         LDKChannelFeatures features_arg_conv;
53890         features_arg_conv.inner = untag_ptr(features_arg);
53891         features_arg_conv.is_owned = ptr_is_owned(features_arg);
53892         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
53893         features_arg_conv = ChannelFeatures_clone(&features_arg_conv);
53894         LDKThirtyTwoBytes chain_hash_arg_ref;
53895         CHECK(chain_hash_arg->arr_len == 32);
53896         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
53897         LDKNodeId node_id_1_arg_conv;
53898         node_id_1_arg_conv.inner = untag_ptr(node_id_1_arg);
53899         node_id_1_arg_conv.is_owned = ptr_is_owned(node_id_1_arg);
53900         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_1_arg_conv);
53901         node_id_1_arg_conv = NodeId_clone(&node_id_1_arg_conv);
53902         LDKNodeId node_id_2_arg_conv;
53903         node_id_2_arg_conv.inner = untag_ptr(node_id_2_arg);
53904         node_id_2_arg_conv.is_owned = ptr_is_owned(node_id_2_arg);
53905         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_2_arg_conv);
53906         node_id_2_arg_conv = NodeId_clone(&node_id_2_arg_conv);
53907         LDKNodeId bitcoin_key_1_arg_conv;
53908         bitcoin_key_1_arg_conv.inner = untag_ptr(bitcoin_key_1_arg);
53909         bitcoin_key_1_arg_conv.is_owned = ptr_is_owned(bitcoin_key_1_arg);
53910         CHECK_INNER_FIELD_ACCESS_OR_NULL(bitcoin_key_1_arg_conv);
53911         bitcoin_key_1_arg_conv = NodeId_clone(&bitcoin_key_1_arg_conv);
53912         LDKNodeId bitcoin_key_2_arg_conv;
53913         bitcoin_key_2_arg_conv.inner = untag_ptr(bitcoin_key_2_arg);
53914         bitcoin_key_2_arg_conv.is_owned = ptr_is_owned(bitcoin_key_2_arg);
53915         CHECK_INNER_FIELD_ACCESS_OR_NULL(bitcoin_key_2_arg_conv);
53916         bitcoin_key_2_arg_conv = NodeId_clone(&bitcoin_key_2_arg_conv);
53917         LDKCVec_u8Z excess_data_arg_ref;
53918         excess_data_arg_ref.datalen = excess_data_arg->arr_len;
53919         excess_data_arg_ref.data = MALLOC(excess_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
53920         memcpy(excess_data_arg_ref.data, excess_data_arg->elems, excess_data_arg_ref.datalen); FREE(excess_data_arg);
53921         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);
53922         int64_t ret_ref = 0;
53923         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53924         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53925         return ret_ref;
53926 }
53927
53928 static inline uint64_t UnsignedChannelAnnouncement_clone_ptr(LDKUnsignedChannelAnnouncement *NONNULL_PTR arg) {
53929         LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(arg);
53930         int64_t ret_ref = 0;
53931         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53932         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53933         return ret_ref;
53934 }
53935 int64_t  CS_LDK_UnsignedChannelAnnouncement_clone_ptr(int64_t arg) {
53936         LDKUnsignedChannelAnnouncement arg_conv;
53937         arg_conv.inner = untag_ptr(arg);
53938         arg_conv.is_owned = ptr_is_owned(arg);
53939         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
53940         arg_conv.is_owned = false;
53941         int64_t ret_conv = UnsignedChannelAnnouncement_clone_ptr(&arg_conv);
53942         return ret_conv;
53943 }
53944
53945 int64_t  CS_LDK_UnsignedChannelAnnouncement_clone(int64_t orig) {
53946         LDKUnsignedChannelAnnouncement orig_conv;
53947         orig_conv.inner = untag_ptr(orig);
53948         orig_conv.is_owned = ptr_is_owned(orig);
53949         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
53950         orig_conv.is_owned = false;
53951         LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
53952         int64_t ret_ref = 0;
53953         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53954         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53955         return ret_ref;
53956 }
53957
53958 int64_t  CS_LDK_UnsignedChannelAnnouncement_hash(int64_t o) {
53959         LDKUnsignedChannelAnnouncement o_conv;
53960         o_conv.inner = untag_ptr(o);
53961         o_conv.is_owned = ptr_is_owned(o);
53962         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
53963         o_conv.is_owned = false;
53964         int64_t ret_conv = UnsignedChannelAnnouncement_hash(&o_conv);
53965         return ret_conv;
53966 }
53967
53968 jboolean  CS_LDK_UnsignedChannelAnnouncement_eq(int64_t a, int64_t b) {
53969         LDKUnsignedChannelAnnouncement a_conv;
53970         a_conv.inner = untag_ptr(a);
53971         a_conv.is_owned = ptr_is_owned(a);
53972         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
53973         a_conv.is_owned = false;
53974         LDKUnsignedChannelAnnouncement b_conv;
53975         b_conv.inner = untag_ptr(b);
53976         b_conv.is_owned = ptr_is_owned(b);
53977         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
53978         b_conv.is_owned = false;
53979         jboolean ret_conv = UnsignedChannelAnnouncement_eq(&a_conv, &b_conv);
53980         return ret_conv;
53981 }
53982
53983 void  CS_LDK_ChannelAnnouncement_free(int64_t this_obj) {
53984         LDKChannelAnnouncement this_obj_conv;
53985         this_obj_conv.inner = untag_ptr(this_obj);
53986         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53987         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53988         ChannelAnnouncement_free(this_obj_conv);
53989 }
53990
53991 int8_tArray  CS_LDK_ChannelAnnouncement_get_node_signature_1(int64_t this_ptr) {
53992         LDKChannelAnnouncement this_ptr_conv;
53993         this_ptr_conv.inner = untag_ptr(this_ptr);
53994         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53995         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53996         this_ptr_conv.is_owned = false;
53997         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
53998         memcpy(ret_arr->elems, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form, 64);
53999         return ret_arr;
54000 }
54001
54002 void  CS_LDK_ChannelAnnouncement_set_node_signature_1(int64_t this_ptr, int8_tArray val) {
54003         LDKChannelAnnouncement this_ptr_conv;
54004         this_ptr_conv.inner = untag_ptr(this_ptr);
54005         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54006         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54007         this_ptr_conv.is_owned = false;
54008         LDKECDSASignature val_ref;
54009         CHECK(val->arr_len == 64);
54010         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
54011         ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
54012 }
54013
54014 int8_tArray  CS_LDK_ChannelAnnouncement_get_node_signature_2(int64_t this_ptr) {
54015         LDKChannelAnnouncement this_ptr_conv;
54016         this_ptr_conv.inner = untag_ptr(this_ptr);
54017         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54018         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54019         this_ptr_conv.is_owned = false;
54020         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
54021         memcpy(ret_arr->elems, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form, 64);
54022         return ret_arr;
54023 }
54024
54025 void  CS_LDK_ChannelAnnouncement_set_node_signature_2(int64_t this_ptr, int8_tArray val) {
54026         LDKChannelAnnouncement this_ptr_conv;
54027         this_ptr_conv.inner = untag_ptr(this_ptr);
54028         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54029         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54030         this_ptr_conv.is_owned = false;
54031         LDKECDSASignature val_ref;
54032         CHECK(val->arr_len == 64);
54033         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
54034         ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
54035 }
54036
54037 int8_tArray  CS_LDK_ChannelAnnouncement_get_bitcoin_signature_1(int64_t this_ptr) {
54038         LDKChannelAnnouncement this_ptr_conv;
54039         this_ptr_conv.inner = untag_ptr(this_ptr);
54040         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54041         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54042         this_ptr_conv.is_owned = false;
54043         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
54044         memcpy(ret_arr->elems, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form, 64);
54045         return ret_arr;
54046 }
54047
54048 void  CS_LDK_ChannelAnnouncement_set_bitcoin_signature_1(int64_t this_ptr, int8_tArray val) {
54049         LDKChannelAnnouncement this_ptr_conv;
54050         this_ptr_conv.inner = untag_ptr(this_ptr);
54051         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54052         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54053         this_ptr_conv.is_owned = false;
54054         LDKECDSASignature val_ref;
54055         CHECK(val->arr_len == 64);
54056         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
54057         ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
54058 }
54059
54060 int8_tArray  CS_LDK_ChannelAnnouncement_get_bitcoin_signature_2(int64_t this_ptr) {
54061         LDKChannelAnnouncement this_ptr_conv;
54062         this_ptr_conv.inner = untag_ptr(this_ptr);
54063         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54064         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54065         this_ptr_conv.is_owned = false;
54066         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
54067         memcpy(ret_arr->elems, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form, 64);
54068         return ret_arr;
54069 }
54070
54071 void  CS_LDK_ChannelAnnouncement_set_bitcoin_signature_2(int64_t this_ptr, int8_tArray val) {
54072         LDKChannelAnnouncement this_ptr_conv;
54073         this_ptr_conv.inner = untag_ptr(this_ptr);
54074         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54075         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54076         this_ptr_conv.is_owned = false;
54077         LDKECDSASignature val_ref;
54078         CHECK(val->arr_len == 64);
54079         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
54080         ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
54081 }
54082
54083 int64_t  CS_LDK_ChannelAnnouncement_get_contents(int64_t this_ptr) {
54084         LDKChannelAnnouncement this_ptr_conv;
54085         this_ptr_conv.inner = untag_ptr(this_ptr);
54086         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54087         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54088         this_ptr_conv.is_owned = false;
54089         LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
54090         int64_t ret_ref = 0;
54091         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54092         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54093         return ret_ref;
54094 }
54095
54096 void  CS_LDK_ChannelAnnouncement_set_contents(int64_t this_ptr, int64_t val) {
54097         LDKChannelAnnouncement this_ptr_conv;
54098         this_ptr_conv.inner = untag_ptr(this_ptr);
54099         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54100         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54101         this_ptr_conv.is_owned = false;
54102         LDKUnsignedChannelAnnouncement val_conv;
54103         val_conv.inner = untag_ptr(val);
54104         val_conv.is_owned = ptr_is_owned(val);
54105         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
54106         val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
54107         ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
54108 }
54109
54110 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) {
54111         LDKECDSASignature node_signature_1_arg_ref;
54112         CHECK(node_signature_1_arg->arr_len == 64);
54113         memcpy(node_signature_1_arg_ref.compact_form, node_signature_1_arg->elems, 64); FREE(node_signature_1_arg);
54114         LDKECDSASignature node_signature_2_arg_ref;
54115         CHECK(node_signature_2_arg->arr_len == 64);
54116         memcpy(node_signature_2_arg_ref.compact_form, node_signature_2_arg->elems, 64); FREE(node_signature_2_arg);
54117         LDKECDSASignature bitcoin_signature_1_arg_ref;
54118         CHECK(bitcoin_signature_1_arg->arr_len == 64);
54119         memcpy(bitcoin_signature_1_arg_ref.compact_form, bitcoin_signature_1_arg->elems, 64); FREE(bitcoin_signature_1_arg);
54120         LDKECDSASignature bitcoin_signature_2_arg_ref;
54121         CHECK(bitcoin_signature_2_arg->arr_len == 64);
54122         memcpy(bitcoin_signature_2_arg_ref.compact_form, bitcoin_signature_2_arg->elems, 64); FREE(bitcoin_signature_2_arg);
54123         LDKUnsignedChannelAnnouncement contents_arg_conv;
54124         contents_arg_conv.inner = untag_ptr(contents_arg);
54125         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
54126         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
54127         contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
54128         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);
54129         int64_t ret_ref = 0;
54130         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54131         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54132         return ret_ref;
54133 }
54134
54135 static inline uint64_t ChannelAnnouncement_clone_ptr(LDKChannelAnnouncement *NONNULL_PTR arg) {
54136         LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(arg);
54137         int64_t ret_ref = 0;
54138         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54139         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54140         return ret_ref;
54141 }
54142 int64_t  CS_LDK_ChannelAnnouncement_clone_ptr(int64_t arg) {
54143         LDKChannelAnnouncement arg_conv;
54144         arg_conv.inner = untag_ptr(arg);
54145         arg_conv.is_owned = ptr_is_owned(arg);
54146         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54147         arg_conv.is_owned = false;
54148         int64_t ret_conv = ChannelAnnouncement_clone_ptr(&arg_conv);
54149         return ret_conv;
54150 }
54151
54152 int64_t  CS_LDK_ChannelAnnouncement_clone(int64_t orig) {
54153         LDKChannelAnnouncement orig_conv;
54154         orig_conv.inner = untag_ptr(orig);
54155         orig_conv.is_owned = ptr_is_owned(orig);
54156         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54157         orig_conv.is_owned = false;
54158         LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
54159         int64_t ret_ref = 0;
54160         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54161         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54162         return ret_ref;
54163 }
54164
54165 int64_t  CS_LDK_ChannelAnnouncement_hash(int64_t o) {
54166         LDKChannelAnnouncement o_conv;
54167         o_conv.inner = untag_ptr(o);
54168         o_conv.is_owned = ptr_is_owned(o);
54169         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
54170         o_conv.is_owned = false;
54171         int64_t ret_conv = ChannelAnnouncement_hash(&o_conv);
54172         return ret_conv;
54173 }
54174
54175 jboolean  CS_LDK_ChannelAnnouncement_eq(int64_t a, int64_t b) {
54176         LDKChannelAnnouncement a_conv;
54177         a_conv.inner = untag_ptr(a);
54178         a_conv.is_owned = ptr_is_owned(a);
54179         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
54180         a_conv.is_owned = false;
54181         LDKChannelAnnouncement b_conv;
54182         b_conv.inner = untag_ptr(b);
54183         b_conv.is_owned = ptr_is_owned(b);
54184         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
54185         b_conv.is_owned = false;
54186         jboolean ret_conv = ChannelAnnouncement_eq(&a_conv, &b_conv);
54187         return ret_conv;
54188 }
54189
54190 void  CS_LDK_UnsignedChannelUpdate_free(int64_t this_obj) {
54191         LDKUnsignedChannelUpdate this_obj_conv;
54192         this_obj_conv.inner = untag_ptr(this_obj);
54193         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54194         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54195         UnsignedChannelUpdate_free(this_obj_conv);
54196 }
54197
54198 int8_tArray  CS_LDK_UnsignedChannelUpdate_get_chain_hash(int64_t this_ptr) {
54199         LDKUnsignedChannelUpdate this_ptr_conv;
54200         this_ptr_conv.inner = untag_ptr(this_ptr);
54201         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54202         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54203         this_ptr_conv.is_owned = false;
54204         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
54205         memcpy(ret_arr->elems, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv), 32);
54206         return ret_arr;
54207 }
54208
54209 void  CS_LDK_UnsignedChannelUpdate_set_chain_hash(int64_t this_ptr, int8_tArray val) {
54210         LDKUnsignedChannelUpdate this_ptr_conv;
54211         this_ptr_conv.inner = untag_ptr(this_ptr);
54212         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54213         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54214         this_ptr_conv.is_owned = false;
54215         LDKThirtyTwoBytes val_ref;
54216         CHECK(val->arr_len == 32);
54217         memcpy(val_ref.data, val->elems, 32); FREE(val);
54218         UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
54219 }
54220
54221 int64_t  CS_LDK_UnsignedChannelUpdate_get_short_channel_id(int64_t this_ptr) {
54222         LDKUnsignedChannelUpdate this_ptr_conv;
54223         this_ptr_conv.inner = untag_ptr(this_ptr);
54224         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54225         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54226         this_ptr_conv.is_owned = false;
54227         int64_t ret_conv = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
54228         return ret_conv;
54229 }
54230
54231 void  CS_LDK_UnsignedChannelUpdate_set_short_channel_id(int64_t this_ptr, int64_t val) {
54232         LDKUnsignedChannelUpdate this_ptr_conv;
54233         this_ptr_conv.inner = untag_ptr(this_ptr);
54234         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54235         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54236         this_ptr_conv.is_owned = false;
54237         UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
54238 }
54239
54240 int32_t  CS_LDK_UnsignedChannelUpdate_get_timestamp(int64_t this_ptr) {
54241         LDKUnsignedChannelUpdate this_ptr_conv;
54242         this_ptr_conv.inner = untag_ptr(this_ptr);
54243         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54244         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54245         this_ptr_conv.is_owned = false;
54246         int32_t ret_conv = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
54247         return ret_conv;
54248 }
54249
54250 void  CS_LDK_UnsignedChannelUpdate_set_timestamp(int64_t this_ptr, int32_t val) {
54251         LDKUnsignedChannelUpdate this_ptr_conv;
54252         this_ptr_conv.inner = untag_ptr(this_ptr);
54253         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54254         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54255         this_ptr_conv.is_owned = false;
54256         UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
54257 }
54258
54259 int8_t  CS_LDK_UnsignedChannelUpdate_get_flags(int64_t this_ptr) {
54260         LDKUnsignedChannelUpdate 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         int8_t ret_conv = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
54266         return ret_conv;
54267 }
54268
54269 void  CS_LDK_UnsignedChannelUpdate_set_flags(int64_t this_ptr, int8_t val) {
54270         LDKUnsignedChannelUpdate this_ptr_conv;
54271         this_ptr_conv.inner = untag_ptr(this_ptr);
54272         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54273         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54274         this_ptr_conv.is_owned = false;
54275         UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
54276 }
54277
54278 int16_t  CS_LDK_UnsignedChannelUpdate_get_cltv_expiry_delta(int64_t this_ptr) {
54279         LDKUnsignedChannelUpdate this_ptr_conv;
54280         this_ptr_conv.inner = untag_ptr(this_ptr);
54281         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54282         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54283         this_ptr_conv.is_owned = false;
54284         int16_t ret_conv = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
54285         return ret_conv;
54286 }
54287
54288 void  CS_LDK_UnsignedChannelUpdate_set_cltv_expiry_delta(int64_t this_ptr, int16_t val) {
54289         LDKUnsignedChannelUpdate this_ptr_conv;
54290         this_ptr_conv.inner = untag_ptr(this_ptr);
54291         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54292         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54293         this_ptr_conv.is_owned = false;
54294         UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
54295 }
54296
54297 int64_t  CS_LDK_UnsignedChannelUpdate_get_htlc_minimum_msat(int64_t this_ptr) {
54298         LDKUnsignedChannelUpdate this_ptr_conv;
54299         this_ptr_conv.inner = untag_ptr(this_ptr);
54300         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54301         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54302         this_ptr_conv.is_owned = false;
54303         int64_t ret_conv = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
54304         return ret_conv;
54305 }
54306
54307 void  CS_LDK_UnsignedChannelUpdate_set_htlc_minimum_msat(int64_t this_ptr, int64_t val) {
54308         LDKUnsignedChannelUpdate this_ptr_conv;
54309         this_ptr_conv.inner = untag_ptr(this_ptr);
54310         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54311         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54312         this_ptr_conv.is_owned = false;
54313         UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
54314 }
54315
54316 int64_t  CS_LDK_UnsignedChannelUpdate_get_htlc_maximum_msat(int64_t this_ptr) {
54317         LDKUnsignedChannelUpdate this_ptr_conv;
54318         this_ptr_conv.inner = untag_ptr(this_ptr);
54319         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54320         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54321         this_ptr_conv.is_owned = false;
54322         int64_t ret_conv = UnsignedChannelUpdate_get_htlc_maximum_msat(&this_ptr_conv);
54323         return ret_conv;
54324 }
54325
54326 void  CS_LDK_UnsignedChannelUpdate_set_htlc_maximum_msat(int64_t this_ptr, int64_t val) {
54327         LDKUnsignedChannelUpdate this_ptr_conv;
54328         this_ptr_conv.inner = untag_ptr(this_ptr);
54329         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54330         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54331         this_ptr_conv.is_owned = false;
54332         UnsignedChannelUpdate_set_htlc_maximum_msat(&this_ptr_conv, val);
54333 }
54334
54335 int32_t  CS_LDK_UnsignedChannelUpdate_get_fee_base_msat(int64_t this_ptr) {
54336         LDKUnsignedChannelUpdate this_ptr_conv;
54337         this_ptr_conv.inner = untag_ptr(this_ptr);
54338         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54339         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54340         this_ptr_conv.is_owned = false;
54341         int32_t ret_conv = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
54342         return ret_conv;
54343 }
54344
54345 void  CS_LDK_UnsignedChannelUpdate_set_fee_base_msat(int64_t this_ptr, int32_t val) {
54346         LDKUnsignedChannelUpdate this_ptr_conv;
54347         this_ptr_conv.inner = untag_ptr(this_ptr);
54348         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54349         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54350         this_ptr_conv.is_owned = false;
54351         UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
54352 }
54353
54354 int32_t  CS_LDK_UnsignedChannelUpdate_get_fee_proportional_millionths(int64_t this_ptr) {
54355         LDKUnsignedChannelUpdate this_ptr_conv;
54356         this_ptr_conv.inner = untag_ptr(this_ptr);
54357         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54358         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54359         this_ptr_conv.is_owned = false;
54360         int32_t ret_conv = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
54361         return ret_conv;
54362 }
54363
54364 void  CS_LDK_UnsignedChannelUpdate_set_fee_proportional_millionths(int64_t this_ptr, int32_t val) {
54365         LDKUnsignedChannelUpdate this_ptr_conv;
54366         this_ptr_conv.inner = untag_ptr(this_ptr);
54367         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54368         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54369         this_ptr_conv.is_owned = false;
54370         UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
54371 }
54372
54373 int8_tArray  CS_LDK_UnsignedChannelUpdate_get_excess_data(int64_t this_ptr) {
54374         LDKUnsignedChannelUpdate this_ptr_conv;
54375         this_ptr_conv.inner = untag_ptr(this_ptr);
54376         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54377         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54378         this_ptr_conv.is_owned = false;
54379         LDKCVec_u8Z ret_var = UnsignedChannelUpdate_get_excess_data(&this_ptr_conv);
54380         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
54381         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
54382         CVec_u8Z_free(ret_var);
54383         return ret_arr;
54384 }
54385
54386 void  CS_LDK_UnsignedChannelUpdate_set_excess_data(int64_t this_ptr, int8_tArray val) {
54387         LDKUnsignedChannelUpdate this_ptr_conv;
54388         this_ptr_conv.inner = untag_ptr(this_ptr);
54389         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54390         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54391         this_ptr_conv.is_owned = false;
54392         LDKCVec_u8Z val_ref;
54393         val_ref.datalen = val->arr_len;
54394         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
54395         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
54396         UnsignedChannelUpdate_set_excess_data(&this_ptr_conv, val_ref);
54397 }
54398
54399 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) {
54400         LDKThirtyTwoBytes chain_hash_arg_ref;
54401         CHECK(chain_hash_arg->arr_len == 32);
54402         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
54403         LDKCVec_u8Z excess_data_arg_ref;
54404         excess_data_arg_ref.datalen = excess_data_arg->arr_len;
54405         excess_data_arg_ref.data = MALLOC(excess_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
54406         memcpy(excess_data_arg_ref.data, excess_data_arg->elems, excess_data_arg_ref.datalen); FREE(excess_data_arg);
54407         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);
54408         int64_t ret_ref = 0;
54409         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54410         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54411         return ret_ref;
54412 }
54413
54414 static inline uint64_t UnsignedChannelUpdate_clone_ptr(LDKUnsignedChannelUpdate *NONNULL_PTR arg) {
54415         LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(arg);
54416         int64_t ret_ref = 0;
54417         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54418         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54419         return ret_ref;
54420 }
54421 int64_t  CS_LDK_UnsignedChannelUpdate_clone_ptr(int64_t arg) {
54422         LDKUnsignedChannelUpdate arg_conv;
54423         arg_conv.inner = untag_ptr(arg);
54424         arg_conv.is_owned = ptr_is_owned(arg);
54425         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54426         arg_conv.is_owned = false;
54427         int64_t ret_conv = UnsignedChannelUpdate_clone_ptr(&arg_conv);
54428         return ret_conv;
54429 }
54430
54431 int64_t  CS_LDK_UnsignedChannelUpdate_clone(int64_t orig) {
54432         LDKUnsignedChannelUpdate orig_conv;
54433         orig_conv.inner = untag_ptr(orig);
54434         orig_conv.is_owned = ptr_is_owned(orig);
54435         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54436         orig_conv.is_owned = false;
54437         LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
54438         int64_t ret_ref = 0;
54439         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54440         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54441         return ret_ref;
54442 }
54443
54444 int64_t  CS_LDK_UnsignedChannelUpdate_hash(int64_t o) {
54445         LDKUnsignedChannelUpdate o_conv;
54446         o_conv.inner = untag_ptr(o);
54447         o_conv.is_owned = ptr_is_owned(o);
54448         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
54449         o_conv.is_owned = false;
54450         int64_t ret_conv = UnsignedChannelUpdate_hash(&o_conv);
54451         return ret_conv;
54452 }
54453
54454 jboolean  CS_LDK_UnsignedChannelUpdate_eq(int64_t a, int64_t b) {
54455         LDKUnsignedChannelUpdate a_conv;
54456         a_conv.inner = untag_ptr(a);
54457         a_conv.is_owned = ptr_is_owned(a);
54458         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
54459         a_conv.is_owned = false;
54460         LDKUnsignedChannelUpdate b_conv;
54461         b_conv.inner = untag_ptr(b);
54462         b_conv.is_owned = ptr_is_owned(b);
54463         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
54464         b_conv.is_owned = false;
54465         jboolean ret_conv = UnsignedChannelUpdate_eq(&a_conv, &b_conv);
54466         return ret_conv;
54467 }
54468
54469 void  CS_LDK_ChannelUpdate_free(int64_t this_obj) {
54470         LDKChannelUpdate this_obj_conv;
54471         this_obj_conv.inner = untag_ptr(this_obj);
54472         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54473         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54474         ChannelUpdate_free(this_obj_conv);
54475 }
54476
54477 int8_tArray  CS_LDK_ChannelUpdate_get_signature(int64_t this_ptr) {
54478         LDKChannelUpdate this_ptr_conv;
54479         this_ptr_conv.inner = untag_ptr(this_ptr);
54480         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54481         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54482         this_ptr_conv.is_owned = false;
54483         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
54484         memcpy(ret_arr->elems, ChannelUpdate_get_signature(&this_ptr_conv).compact_form, 64);
54485         return ret_arr;
54486 }
54487
54488 void  CS_LDK_ChannelUpdate_set_signature(int64_t this_ptr, int8_tArray val) {
54489         LDKChannelUpdate this_ptr_conv;
54490         this_ptr_conv.inner = untag_ptr(this_ptr);
54491         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54492         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54493         this_ptr_conv.is_owned = false;
54494         LDKECDSASignature val_ref;
54495         CHECK(val->arr_len == 64);
54496         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
54497         ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
54498 }
54499
54500 int64_t  CS_LDK_ChannelUpdate_get_contents(int64_t this_ptr) {
54501         LDKChannelUpdate this_ptr_conv;
54502         this_ptr_conv.inner = untag_ptr(this_ptr);
54503         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54504         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54505         this_ptr_conv.is_owned = false;
54506         LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
54507         int64_t ret_ref = 0;
54508         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54509         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54510         return ret_ref;
54511 }
54512
54513 void  CS_LDK_ChannelUpdate_set_contents(int64_t this_ptr, int64_t val) {
54514         LDKChannelUpdate this_ptr_conv;
54515         this_ptr_conv.inner = untag_ptr(this_ptr);
54516         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54517         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54518         this_ptr_conv.is_owned = false;
54519         LDKUnsignedChannelUpdate val_conv;
54520         val_conv.inner = untag_ptr(val);
54521         val_conv.is_owned = ptr_is_owned(val);
54522         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
54523         val_conv = UnsignedChannelUpdate_clone(&val_conv);
54524         ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
54525 }
54526
54527 int64_t  CS_LDK_ChannelUpdate_new(int8_tArray signature_arg, int64_t contents_arg) {
54528         LDKECDSASignature signature_arg_ref;
54529         CHECK(signature_arg->arr_len == 64);
54530         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
54531         LDKUnsignedChannelUpdate contents_arg_conv;
54532         contents_arg_conv.inner = untag_ptr(contents_arg);
54533         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
54534         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
54535         contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
54536         LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
54537         int64_t ret_ref = 0;
54538         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54539         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54540         return ret_ref;
54541 }
54542
54543 static inline uint64_t ChannelUpdate_clone_ptr(LDKChannelUpdate *NONNULL_PTR arg) {
54544         LDKChannelUpdate ret_var = ChannelUpdate_clone(arg);
54545         int64_t ret_ref = 0;
54546         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54547         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54548         return ret_ref;
54549 }
54550 int64_t  CS_LDK_ChannelUpdate_clone_ptr(int64_t arg) {
54551         LDKChannelUpdate arg_conv;
54552         arg_conv.inner = untag_ptr(arg);
54553         arg_conv.is_owned = ptr_is_owned(arg);
54554         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54555         arg_conv.is_owned = false;
54556         int64_t ret_conv = ChannelUpdate_clone_ptr(&arg_conv);
54557         return ret_conv;
54558 }
54559
54560 int64_t  CS_LDK_ChannelUpdate_clone(int64_t orig) {
54561         LDKChannelUpdate orig_conv;
54562         orig_conv.inner = untag_ptr(orig);
54563         orig_conv.is_owned = ptr_is_owned(orig);
54564         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54565         orig_conv.is_owned = false;
54566         LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
54567         int64_t ret_ref = 0;
54568         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54569         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54570         return ret_ref;
54571 }
54572
54573 int64_t  CS_LDK_ChannelUpdate_hash(int64_t o) {
54574         LDKChannelUpdate o_conv;
54575         o_conv.inner = untag_ptr(o);
54576         o_conv.is_owned = ptr_is_owned(o);
54577         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
54578         o_conv.is_owned = false;
54579         int64_t ret_conv = ChannelUpdate_hash(&o_conv);
54580         return ret_conv;
54581 }
54582
54583 jboolean  CS_LDK_ChannelUpdate_eq(int64_t a, int64_t b) {
54584         LDKChannelUpdate a_conv;
54585         a_conv.inner = untag_ptr(a);
54586         a_conv.is_owned = ptr_is_owned(a);
54587         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
54588         a_conv.is_owned = false;
54589         LDKChannelUpdate b_conv;
54590         b_conv.inner = untag_ptr(b);
54591         b_conv.is_owned = ptr_is_owned(b);
54592         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
54593         b_conv.is_owned = false;
54594         jboolean ret_conv = ChannelUpdate_eq(&a_conv, &b_conv);
54595         return ret_conv;
54596 }
54597
54598 void  CS_LDK_QueryChannelRange_free(int64_t this_obj) {
54599         LDKQueryChannelRange this_obj_conv;
54600         this_obj_conv.inner = untag_ptr(this_obj);
54601         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54602         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54603         QueryChannelRange_free(this_obj_conv);
54604 }
54605
54606 int8_tArray  CS_LDK_QueryChannelRange_get_chain_hash(int64_t this_ptr) {
54607         LDKQueryChannelRange this_ptr_conv;
54608         this_ptr_conv.inner = untag_ptr(this_ptr);
54609         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54610         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54611         this_ptr_conv.is_owned = false;
54612         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
54613         memcpy(ret_arr->elems, *QueryChannelRange_get_chain_hash(&this_ptr_conv), 32);
54614         return ret_arr;
54615 }
54616
54617 void  CS_LDK_QueryChannelRange_set_chain_hash(int64_t this_ptr, int8_tArray val) {
54618         LDKQueryChannelRange this_ptr_conv;
54619         this_ptr_conv.inner = untag_ptr(this_ptr);
54620         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54621         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54622         this_ptr_conv.is_owned = false;
54623         LDKThirtyTwoBytes val_ref;
54624         CHECK(val->arr_len == 32);
54625         memcpy(val_ref.data, val->elems, 32); FREE(val);
54626         QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
54627 }
54628
54629 int32_t  CS_LDK_QueryChannelRange_get_first_blocknum(int64_t this_ptr) {
54630         LDKQueryChannelRange this_ptr_conv;
54631         this_ptr_conv.inner = untag_ptr(this_ptr);
54632         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54633         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54634         this_ptr_conv.is_owned = false;
54635         int32_t ret_conv = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
54636         return ret_conv;
54637 }
54638
54639 void  CS_LDK_QueryChannelRange_set_first_blocknum(int64_t this_ptr, int32_t val) {
54640         LDKQueryChannelRange this_ptr_conv;
54641         this_ptr_conv.inner = untag_ptr(this_ptr);
54642         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54643         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54644         this_ptr_conv.is_owned = false;
54645         QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
54646 }
54647
54648 int32_t  CS_LDK_QueryChannelRange_get_number_of_blocks(int64_t this_ptr) {
54649         LDKQueryChannelRange this_ptr_conv;
54650         this_ptr_conv.inner = untag_ptr(this_ptr);
54651         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54652         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54653         this_ptr_conv.is_owned = false;
54654         int32_t ret_conv = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
54655         return ret_conv;
54656 }
54657
54658 void  CS_LDK_QueryChannelRange_set_number_of_blocks(int64_t this_ptr, int32_t val) {
54659         LDKQueryChannelRange this_ptr_conv;
54660         this_ptr_conv.inner = untag_ptr(this_ptr);
54661         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54662         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54663         this_ptr_conv.is_owned = false;
54664         QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
54665 }
54666
54667 int64_t  CS_LDK_QueryChannelRange_new(int8_tArray chain_hash_arg, int32_t first_blocknum_arg, int32_t number_of_blocks_arg) {
54668         LDKThirtyTwoBytes chain_hash_arg_ref;
54669         CHECK(chain_hash_arg->arr_len == 32);
54670         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
54671         LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
54672         int64_t ret_ref = 0;
54673         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54674         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54675         return ret_ref;
54676 }
54677
54678 static inline uint64_t QueryChannelRange_clone_ptr(LDKQueryChannelRange *NONNULL_PTR arg) {
54679         LDKQueryChannelRange ret_var = QueryChannelRange_clone(arg);
54680         int64_t ret_ref = 0;
54681         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54682         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54683         return ret_ref;
54684 }
54685 int64_t  CS_LDK_QueryChannelRange_clone_ptr(int64_t arg) {
54686         LDKQueryChannelRange arg_conv;
54687         arg_conv.inner = untag_ptr(arg);
54688         arg_conv.is_owned = ptr_is_owned(arg);
54689         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54690         arg_conv.is_owned = false;
54691         int64_t ret_conv = QueryChannelRange_clone_ptr(&arg_conv);
54692         return ret_conv;
54693 }
54694
54695 int64_t  CS_LDK_QueryChannelRange_clone(int64_t orig) {
54696         LDKQueryChannelRange orig_conv;
54697         orig_conv.inner = untag_ptr(orig);
54698         orig_conv.is_owned = ptr_is_owned(orig);
54699         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54700         orig_conv.is_owned = false;
54701         LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
54702         int64_t ret_ref = 0;
54703         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54704         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54705         return ret_ref;
54706 }
54707
54708 int64_t  CS_LDK_QueryChannelRange_hash(int64_t o) {
54709         LDKQueryChannelRange o_conv;
54710         o_conv.inner = untag_ptr(o);
54711         o_conv.is_owned = ptr_is_owned(o);
54712         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
54713         o_conv.is_owned = false;
54714         int64_t ret_conv = QueryChannelRange_hash(&o_conv);
54715         return ret_conv;
54716 }
54717
54718 jboolean  CS_LDK_QueryChannelRange_eq(int64_t a, int64_t b) {
54719         LDKQueryChannelRange a_conv;
54720         a_conv.inner = untag_ptr(a);
54721         a_conv.is_owned = ptr_is_owned(a);
54722         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
54723         a_conv.is_owned = false;
54724         LDKQueryChannelRange b_conv;
54725         b_conv.inner = untag_ptr(b);
54726         b_conv.is_owned = ptr_is_owned(b);
54727         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
54728         b_conv.is_owned = false;
54729         jboolean ret_conv = QueryChannelRange_eq(&a_conv, &b_conv);
54730         return ret_conv;
54731 }
54732
54733 void  CS_LDK_ReplyChannelRange_free(int64_t this_obj) {
54734         LDKReplyChannelRange this_obj_conv;
54735         this_obj_conv.inner = untag_ptr(this_obj);
54736         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54737         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54738         ReplyChannelRange_free(this_obj_conv);
54739 }
54740
54741 int8_tArray  CS_LDK_ReplyChannelRange_get_chain_hash(int64_t this_ptr) {
54742         LDKReplyChannelRange this_ptr_conv;
54743         this_ptr_conv.inner = untag_ptr(this_ptr);
54744         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54745         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54746         this_ptr_conv.is_owned = false;
54747         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
54748         memcpy(ret_arr->elems, *ReplyChannelRange_get_chain_hash(&this_ptr_conv), 32);
54749         return ret_arr;
54750 }
54751
54752 void  CS_LDK_ReplyChannelRange_set_chain_hash(int64_t this_ptr, int8_tArray val) {
54753         LDKReplyChannelRange this_ptr_conv;
54754         this_ptr_conv.inner = untag_ptr(this_ptr);
54755         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54756         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54757         this_ptr_conv.is_owned = false;
54758         LDKThirtyTwoBytes val_ref;
54759         CHECK(val->arr_len == 32);
54760         memcpy(val_ref.data, val->elems, 32); FREE(val);
54761         ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
54762 }
54763
54764 int32_t  CS_LDK_ReplyChannelRange_get_first_blocknum(int64_t this_ptr) {
54765         LDKReplyChannelRange this_ptr_conv;
54766         this_ptr_conv.inner = untag_ptr(this_ptr);
54767         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54768         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54769         this_ptr_conv.is_owned = false;
54770         int32_t ret_conv = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
54771         return ret_conv;
54772 }
54773
54774 void  CS_LDK_ReplyChannelRange_set_first_blocknum(int64_t this_ptr, int32_t val) {
54775         LDKReplyChannelRange this_ptr_conv;
54776         this_ptr_conv.inner = untag_ptr(this_ptr);
54777         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54778         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54779         this_ptr_conv.is_owned = false;
54780         ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
54781 }
54782
54783 int32_t  CS_LDK_ReplyChannelRange_get_number_of_blocks(int64_t this_ptr) {
54784         LDKReplyChannelRange this_ptr_conv;
54785         this_ptr_conv.inner = untag_ptr(this_ptr);
54786         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54787         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54788         this_ptr_conv.is_owned = false;
54789         int32_t ret_conv = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
54790         return ret_conv;
54791 }
54792
54793 void  CS_LDK_ReplyChannelRange_set_number_of_blocks(int64_t this_ptr, int32_t val) {
54794         LDKReplyChannelRange this_ptr_conv;
54795         this_ptr_conv.inner = untag_ptr(this_ptr);
54796         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54797         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54798         this_ptr_conv.is_owned = false;
54799         ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
54800 }
54801
54802 jboolean  CS_LDK_ReplyChannelRange_get_sync_complete(int64_t this_ptr) {
54803         LDKReplyChannelRange this_ptr_conv;
54804         this_ptr_conv.inner = untag_ptr(this_ptr);
54805         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54806         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54807         this_ptr_conv.is_owned = false;
54808         jboolean ret_conv = ReplyChannelRange_get_sync_complete(&this_ptr_conv);
54809         return ret_conv;
54810 }
54811
54812 void  CS_LDK_ReplyChannelRange_set_sync_complete(int64_t this_ptr, jboolean val) {
54813         LDKReplyChannelRange this_ptr_conv;
54814         this_ptr_conv.inner = untag_ptr(this_ptr);
54815         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54816         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54817         this_ptr_conv.is_owned = false;
54818         ReplyChannelRange_set_sync_complete(&this_ptr_conv, val);
54819 }
54820
54821 int64_tArray  CS_LDK_ReplyChannelRange_get_short_channel_ids(int64_t this_ptr) {
54822         LDKReplyChannelRange this_ptr_conv;
54823         this_ptr_conv.inner = untag_ptr(this_ptr);
54824         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54825         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54826         this_ptr_conv.is_owned = false;
54827         LDKCVec_u64Z ret_var = ReplyChannelRange_get_short_channel_ids(&this_ptr_conv);
54828         int64_tArray ret_arr = NULL;
54829         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
54830         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
54831         for (size_t g = 0; g < ret_var.datalen; g++) {
54832                 int64_t ret_conv_6_conv = ret_var.data[g];
54833                 ret_arr_ptr[g] = ret_conv_6_conv;
54834         }
54835         
54836         FREE(ret_var.data);
54837         return ret_arr;
54838 }
54839
54840 void  CS_LDK_ReplyChannelRange_set_short_channel_ids(int64_t this_ptr, int64_tArray val) {
54841         LDKReplyChannelRange this_ptr_conv;
54842         this_ptr_conv.inner = untag_ptr(this_ptr);
54843         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54844         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54845         this_ptr_conv.is_owned = false;
54846         LDKCVec_u64Z val_constr;
54847         val_constr.datalen = val->arr_len;
54848         if (val_constr.datalen > 0)
54849                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
54850         else
54851                 val_constr.data = NULL;
54852         int64_t* val_vals = val->elems;
54853         for (size_t g = 0; g < val_constr.datalen; g++) {
54854                 int64_t val_conv_6 = val_vals[g];
54855                 val_constr.data[g] = val_conv_6;
54856         }
54857         FREE(val);
54858         ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
54859 }
54860
54861 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) {
54862         LDKThirtyTwoBytes chain_hash_arg_ref;
54863         CHECK(chain_hash_arg->arr_len == 32);
54864         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
54865         LDKCVec_u64Z short_channel_ids_arg_constr;
54866         short_channel_ids_arg_constr.datalen = short_channel_ids_arg->arr_len;
54867         if (short_channel_ids_arg_constr.datalen > 0)
54868                 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
54869         else
54870                 short_channel_ids_arg_constr.data = NULL;
54871         int64_t* short_channel_ids_arg_vals = short_channel_ids_arg->elems;
54872         for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
54873                 int64_t short_channel_ids_arg_conv_6 = short_channel_ids_arg_vals[g];
54874                 short_channel_ids_arg_constr.data[g] = short_channel_ids_arg_conv_6;
54875         }
54876         FREE(short_channel_ids_arg);
54877         LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg_constr);
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 static inline uint64_t ReplyChannelRange_clone_ptr(LDKReplyChannelRange *NONNULL_PTR arg) {
54885         LDKReplyChannelRange ret_var = ReplyChannelRange_clone(arg);
54886         int64_t ret_ref = 0;
54887         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54888         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54889         return ret_ref;
54890 }
54891 int64_t  CS_LDK_ReplyChannelRange_clone_ptr(int64_t arg) {
54892         LDKReplyChannelRange arg_conv;
54893         arg_conv.inner = untag_ptr(arg);
54894         arg_conv.is_owned = ptr_is_owned(arg);
54895         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54896         arg_conv.is_owned = false;
54897         int64_t ret_conv = ReplyChannelRange_clone_ptr(&arg_conv);
54898         return ret_conv;
54899 }
54900
54901 int64_t  CS_LDK_ReplyChannelRange_clone(int64_t orig) {
54902         LDKReplyChannelRange orig_conv;
54903         orig_conv.inner = untag_ptr(orig);
54904         orig_conv.is_owned = ptr_is_owned(orig);
54905         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54906         orig_conv.is_owned = false;
54907         LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
54908         int64_t ret_ref = 0;
54909         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54910         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54911         return ret_ref;
54912 }
54913
54914 int64_t  CS_LDK_ReplyChannelRange_hash(int64_t o) {
54915         LDKReplyChannelRange o_conv;
54916         o_conv.inner = untag_ptr(o);
54917         o_conv.is_owned = ptr_is_owned(o);
54918         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
54919         o_conv.is_owned = false;
54920         int64_t ret_conv = ReplyChannelRange_hash(&o_conv);
54921         return ret_conv;
54922 }
54923
54924 jboolean  CS_LDK_ReplyChannelRange_eq(int64_t a, int64_t b) {
54925         LDKReplyChannelRange a_conv;
54926         a_conv.inner = untag_ptr(a);
54927         a_conv.is_owned = ptr_is_owned(a);
54928         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
54929         a_conv.is_owned = false;
54930         LDKReplyChannelRange b_conv;
54931         b_conv.inner = untag_ptr(b);
54932         b_conv.is_owned = ptr_is_owned(b);
54933         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
54934         b_conv.is_owned = false;
54935         jboolean ret_conv = ReplyChannelRange_eq(&a_conv, &b_conv);
54936         return ret_conv;
54937 }
54938
54939 void  CS_LDK_QueryShortChannelIds_free(int64_t this_obj) {
54940         LDKQueryShortChannelIds this_obj_conv;
54941         this_obj_conv.inner = untag_ptr(this_obj);
54942         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54943         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54944         QueryShortChannelIds_free(this_obj_conv);
54945 }
54946
54947 int8_tArray  CS_LDK_QueryShortChannelIds_get_chain_hash(int64_t this_ptr) {
54948         LDKQueryShortChannelIds this_ptr_conv;
54949         this_ptr_conv.inner = untag_ptr(this_ptr);
54950         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54951         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54952         this_ptr_conv.is_owned = false;
54953         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
54954         memcpy(ret_arr->elems, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv), 32);
54955         return ret_arr;
54956 }
54957
54958 void  CS_LDK_QueryShortChannelIds_set_chain_hash(int64_t this_ptr, int8_tArray val) {
54959         LDKQueryShortChannelIds this_ptr_conv;
54960         this_ptr_conv.inner = untag_ptr(this_ptr);
54961         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54962         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54963         this_ptr_conv.is_owned = false;
54964         LDKThirtyTwoBytes val_ref;
54965         CHECK(val->arr_len == 32);
54966         memcpy(val_ref.data, val->elems, 32); FREE(val);
54967         QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
54968 }
54969
54970 int64_tArray  CS_LDK_QueryShortChannelIds_get_short_channel_ids(int64_t this_ptr) {
54971         LDKQueryShortChannelIds this_ptr_conv;
54972         this_ptr_conv.inner = untag_ptr(this_ptr);
54973         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54974         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54975         this_ptr_conv.is_owned = false;
54976         LDKCVec_u64Z ret_var = QueryShortChannelIds_get_short_channel_ids(&this_ptr_conv);
54977         int64_tArray ret_arr = NULL;
54978         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
54979         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
54980         for (size_t g = 0; g < ret_var.datalen; g++) {
54981                 int64_t ret_conv_6_conv = ret_var.data[g];
54982                 ret_arr_ptr[g] = ret_conv_6_conv;
54983         }
54984         
54985         FREE(ret_var.data);
54986         return ret_arr;
54987 }
54988
54989 void  CS_LDK_QueryShortChannelIds_set_short_channel_ids(int64_t this_ptr, int64_tArray val) {
54990         LDKQueryShortChannelIds this_ptr_conv;
54991         this_ptr_conv.inner = untag_ptr(this_ptr);
54992         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54993         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54994         this_ptr_conv.is_owned = false;
54995         LDKCVec_u64Z val_constr;
54996         val_constr.datalen = val->arr_len;
54997         if (val_constr.datalen > 0)
54998                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
54999         else
55000                 val_constr.data = NULL;
55001         int64_t* val_vals = val->elems;
55002         for (size_t g = 0; g < val_constr.datalen; g++) {
55003                 int64_t val_conv_6 = val_vals[g];
55004                 val_constr.data[g] = val_conv_6;
55005         }
55006         FREE(val);
55007         QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
55008 }
55009
55010 int64_t  CS_LDK_QueryShortChannelIds_new(int8_tArray chain_hash_arg, int64_tArray short_channel_ids_arg) {
55011         LDKThirtyTwoBytes chain_hash_arg_ref;
55012         CHECK(chain_hash_arg->arr_len == 32);
55013         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
55014         LDKCVec_u64Z short_channel_ids_arg_constr;
55015         short_channel_ids_arg_constr.datalen = short_channel_ids_arg->arr_len;
55016         if (short_channel_ids_arg_constr.datalen > 0)
55017                 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
55018         else
55019                 short_channel_ids_arg_constr.data = NULL;
55020         int64_t* short_channel_ids_arg_vals = short_channel_ids_arg->elems;
55021         for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
55022                 int64_t short_channel_ids_arg_conv_6 = short_channel_ids_arg_vals[g];
55023                 short_channel_ids_arg_constr.data[g] = short_channel_ids_arg_conv_6;
55024         }
55025         FREE(short_channel_ids_arg);
55026         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
55027         int64_t ret_ref = 0;
55028         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55029         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55030         return ret_ref;
55031 }
55032
55033 static inline uint64_t QueryShortChannelIds_clone_ptr(LDKQueryShortChannelIds *NONNULL_PTR arg) {
55034         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(arg);
55035         int64_t ret_ref = 0;
55036         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55037         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55038         return ret_ref;
55039 }
55040 int64_t  CS_LDK_QueryShortChannelIds_clone_ptr(int64_t arg) {
55041         LDKQueryShortChannelIds arg_conv;
55042         arg_conv.inner = untag_ptr(arg);
55043         arg_conv.is_owned = ptr_is_owned(arg);
55044         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55045         arg_conv.is_owned = false;
55046         int64_t ret_conv = QueryShortChannelIds_clone_ptr(&arg_conv);
55047         return ret_conv;
55048 }
55049
55050 int64_t  CS_LDK_QueryShortChannelIds_clone(int64_t orig) {
55051         LDKQueryShortChannelIds orig_conv;
55052         orig_conv.inner = untag_ptr(orig);
55053         orig_conv.is_owned = ptr_is_owned(orig);
55054         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55055         orig_conv.is_owned = false;
55056         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
55057         int64_t ret_ref = 0;
55058         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55059         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55060         return ret_ref;
55061 }
55062
55063 int64_t  CS_LDK_QueryShortChannelIds_hash(int64_t o) {
55064         LDKQueryShortChannelIds o_conv;
55065         o_conv.inner = untag_ptr(o);
55066         o_conv.is_owned = ptr_is_owned(o);
55067         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
55068         o_conv.is_owned = false;
55069         int64_t ret_conv = QueryShortChannelIds_hash(&o_conv);
55070         return ret_conv;
55071 }
55072
55073 jboolean  CS_LDK_QueryShortChannelIds_eq(int64_t a, int64_t b) {
55074         LDKQueryShortChannelIds a_conv;
55075         a_conv.inner = untag_ptr(a);
55076         a_conv.is_owned = ptr_is_owned(a);
55077         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
55078         a_conv.is_owned = false;
55079         LDKQueryShortChannelIds b_conv;
55080         b_conv.inner = untag_ptr(b);
55081         b_conv.is_owned = ptr_is_owned(b);
55082         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
55083         b_conv.is_owned = false;
55084         jboolean ret_conv = QueryShortChannelIds_eq(&a_conv, &b_conv);
55085         return ret_conv;
55086 }
55087
55088 void  CS_LDK_ReplyShortChannelIdsEnd_free(int64_t this_obj) {
55089         LDKReplyShortChannelIdsEnd this_obj_conv;
55090         this_obj_conv.inner = untag_ptr(this_obj);
55091         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55092         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55093         ReplyShortChannelIdsEnd_free(this_obj_conv);
55094 }
55095
55096 int8_tArray  CS_LDK_ReplyShortChannelIdsEnd_get_chain_hash(int64_t this_ptr) {
55097         LDKReplyShortChannelIdsEnd this_ptr_conv;
55098         this_ptr_conv.inner = untag_ptr(this_ptr);
55099         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55100         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55101         this_ptr_conv.is_owned = false;
55102         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
55103         memcpy(ret_arr->elems, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv), 32);
55104         return ret_arr;
55105 }
55106
55107 void  CS_LDK_ReplyShortChannelIdsEnd_set_chain_hash(int64_t this_ptr, int8_tArray val) {
55108         LDKReplyShortChannelIdsEnd this_ptr_conv;
55109         this_ptr_conv.inner = untag_ptr(this_ptr);
55110         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55111         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55112         this_ptr_conv.is_owned = false;
55113         LDKThirtyTwoBytes val_ref;
55114         CHECK(val->arr_len == 32);
55115         memcpy(val_ref.data, val->elems, 32); FREE(val);
55116         ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
55117 }
55118
55119 jboolean  CS_LDK_ReplyShortChannelIdsEnd_get_full_information(int64_t this_ptr) {
55120         LDKReplyShortChannelIdsEnd this_ptr_conv;
55121         this_ptr_conv.inner = untag_ptr(this_ptr);
55122         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55123         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55124         this_ptr_conv.is_owned = false;
55125         jboolean ret_conv = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
55126         return ret_conv;
55127 }
55128
55129 void  CS_LDK_ReplyShortChannelIdsEnd_set_full_information(int64_t this_ptr, jboolean val) {
55130         LDKReplyShortChannelIdsEnd this_ptr_conv;
55131         this_ptr_conv.inner = untag_ptr(this_ptr);
55132         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55133         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55134         this_ptr_conv.is_owned = false;
55135         ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
55136 }
55137
55138 int64_t  CS_LDK_ReplyShortChannelIdsEnd_new(int8_tArray chain_hash_arg, jboolean full_information_arg) {
55139         LDKThirtyTwoBytes chain_hash_arg_ref;
55140         CHECK(chain_hash_arg->arr_len == 32);
55141         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
55142         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
55143         int64_t ret_ref = 0;
55144         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55145         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55146         return ret_ref;
55147 }
55148
55149 static inline uint64_t ReplyShortChannelIdsEnd_clone_ptr(LDKReplyShortChannelIdsEnd *NONNULL_PTR arg) {
55150         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(arg);
55151         int64_t ret_ref = 0;
55152         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55153         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55154         return ret_ref;
55155 }
55156 int64_t  CS_LDK_ReplyShortChannelIdsEnd_clone_ptr(int64_t arg) {
55157         LDKReplyShortChannelIdsEnd arg_conv;
55158         arg_conv.inner = untag_ptr(arg);
55159         arg_conv.is_owned = ptr_is_owned(arg);
55160         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55161         arg_conv.is_owned = false;
55162         int64_t ret_conv = ReplyShortChannelIdsEnd_clone_ptr(&arg_conv);
55163         return ret_conv;
55164 }
55165
55166 int64_t  CS_LDK_ReplyShortChannelIdsEnd_clone(int64_t orig) {
55167         LDKReplyShortChannelIdsEnd orig_conv;
55168         orig_conv.inner = untag_ptr(orig);
55169         orig_conv.is_owned = ptr_is_owned(orig);
55170         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55171         orig_conv.is_owned = false;
55172         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
55173         int64_t ret_ref = 0;
55174         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55175         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55176         return ret_ref;
55177 }
55178
55179 int64_t  CS_LDK_ReplyShortChannelIdsEnd_hash(int64_t o) {
55180         LDKReplyShortChannelIdsEnd o_conv;
55181         o_conv.inner = untag_ptr(o);
55182         o_conv.is_owned = ptr_is_owned(o);
55183         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
55184         o_conv.is_owned = false;
55185         int64_t ret_conv = ReplyShortChannelIdsEnd_hash(&o_conv);
55186         return ret_conv;
55187 }
55188
55189 jboolean  CS_LDK_ReplyShortChannelIdsEnd_eq(int64_t a, int64_t b) {
55190         LDKReplyShortChannelIdsEnd a_conv;
55191         a_conv.inner = untag_ptr(a);
55192         a_conv.is_owned = ptr_is_owned(a);
55193         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
55194         a_conv.is_owned = false;
55195         LDKReplyShortChannelIdsEnd b_conv;
55196         b_conv.inner = untag_ptr(b);
55197         b_conv.is_owned = ptr_is_owned(b);
55198         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
55199         b_conv.is_owned = false;
55200         jboolean ret_conv = ReplyShortChannelIdsEnd_eq(&a_conv, &b_conv);
55201         return ret_conv;
55202 }
55203
55204 void  CS_LDK_GossipTimestampFilter_free(int64_t this_obj) {
55205         LDKGossipTimestampFilter this_obj_conv;
55206         this_obj_conv.inner = untag_ptr(this_obj);
55207         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55208         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55209         GossipTimestampFilter_free(this_obj_conv);
55210 }
55211
55212 int8_tArray  CS_LDK_GossipTimestampFilter_get_chain_hash(int64_t this_ptr) {
55213         LDKGossipTimestampFilter this_ptr_conv;
55214         this_ptr_conv.inner = untag_ptr(this_ptr);
55215         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55216         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55217         this_ptr_conv.is_owned = false;
55218         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
55219         memcpy(ret_arr->elems, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv), 32);
55220         return ret_arr;
55221 }
55222
55223 void  CS_LDK_GossipTimestampFilter_set_chain_hash(int64_t this_ptr, int8_tArray val) {
55224         LDKGossipTimestampFilter this_ptr_conv;
55225         this_ptr_conv.inner = untag_ptr(this_ptr);
55226         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55227         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55228         this_ptr_conv.is_owned = false;
55229         LDKThirtyTwoBytes val_ref;
55230         CHECK(val->arr_len == 32);
55231         memcpy(val_ref.data, val->elems, 32); FREE(val);
55232         GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
55233 }
55234
55235 int32_t  CS_LDK_GossipTimestampFilter_get_first_timestamp(int64_t this_ptr) {
55236         LDKGossipTimestampFilter this_ptr_conv;
55237         this_ptr_conv.inner = untag_ptr(this_ptr);
55238         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55239         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55240         this_ptr_conv.is_owned = false;
55241         int32_t ret_conv = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
55242         return ret_conv;
55243 }
55244
55245 void  CS_LDK_GossipTimestampFilter_set_first_timestamp(int64_t this_ptr, int32_t val) {
55246         LDKGossipTimestampFilter this_ptr_conv;
55247         this_ptr_conv.inner = untag_ptr(this_ptr);
55248         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55249         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55250         this_ptr_conv.is_owned = false;
55251         GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
55252 }
55253
55254 int32_t  CS_LDK_GossipTimestampFilter_get_timestamp_range(int64_t this_ptr) {
55255         LDKGossipTimestampFilter this_ptr_conv;
55256         this_ptr_conv.inner = untag_ptr(this_ptr);
55257         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55258         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55259         this_ptr_conv.is_owned = false;
55260         int32_t ret_conv = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
55261         return ret_conv;
55262 }
55263
55264 void  CS_LDK_GossipTimestampFilter_set_timestamp_range(int64_t this_ptr, int32_t val) {
55265         LDKGossipTimestampFilter this_ptr_conv;
55266         this_ptr_conv.inner = untag_ptr(this_ptr);
55267         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55268         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55269         this_ptr_conv.is_owned = false;
55270         GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
55271 }
55272
55273 int64_t  CS_LDK_GossipTimestampFilter_new(int8_tArray chain_hash_arg, int32_t first_timestamp_arg, int32_t timestamp_range_arg) {
55274         LDKThirtyTwoBytes chain_hash_arg_ref;
55275         CHECK(chain_hash_arg->arr_len == 32);
55276         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
55277         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
55278         int64_t ret_ref = 0;
55279         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55280         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55281         return ret_ref;
55282 }
55283
55284 static inline uint64_t GossipTimestampFilter_clone_ptr(LDKGossipTimestampFilter *NONNULL_PTR arg) {
55285         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(arg);
55286         int64_t ret_ref = 0;
55287         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55288         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55289         return ret_ref;
55290 }
55291 int64_t  CS_LDK_GossipTimestampFilter_clone_ptr(int64_t arg) {
55292         LDKGossipTimestampFilter arg_conv;
55293         arg_conv.inner = untag_ptr(arg);
55294         arg_conv.is_owned = ptr_is_owned(arg);
55295         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55296         arg_conv.is_owned = false;
55297         int64_t ret_conv = GossipTimestampFilter_clone_ptr(&arg_conv);
55298         return ret_conv;
55299 }
55300
55301 int64_t  CS_LDK_GossipTimestampFilter_clone(int64_t orig) {
55302         LDKGossipTimestampFilter orig_conv;
55303         orig_conv.inner = untag_ptr(orig);
55304         orig_conv.is_owned = ptr_is_owned(orig);
55305         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55306         orig_conv.is_owned = false;
55307         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
55308         int64_t ret_ref = 0;
55309         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55310         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55311         return ret_ref;
55312 }
55313
55314 int64_t  CS_LDK_GossipTimestampFilter_hash(int64_t o) {
55315         LDKGossipTimestampFilter o_conv;
55316         o_conv.inner = untag_ptr(o);
55317         o_conv.is_owned = ptr_is_owned(o);
55318         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
55319         o_conv.is_owned = false;
55320         int64_t ret_conv = GossipTimestampFilter_hash(&o_conv);
55321         return ret_conv;
55322 }
55323
55324 jboolean  CS_LDK_GossipTimestampFilter_eq(int64_t a, int64_t b) {
55325         LDKGossipTimestampFilter a_conv;
55326         a_conv.inner = untag_ptr(a);
55327         a_conv.is_owned = ptr_is_owned(a);
55328         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
55329         a_conv.is_owned = false;
55330         LDKGossipTimestampFilter b_conv;
55331         b_conv.inner = untag_ptr(b);
55332         b_conv.is_owned = ptr_is_owned(b);
55333         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
55334         b_conv.is_owned = false;
55335         jboolean ret_conv = GossipTimestampFilter_eq(&a_conv, &b_conv);
55336         return ret_conv;
55337 }
55338
55339 void  CS_LDK_ErrorAction_free(int64_t this_ptr) {
55340         if (!ptr_is_owned(this_ptr)) return;
55341         void* this_ptr_ptr = untag_ptr(this_ptr);
55342         CHECK_ACCESS(this_ptr_ptr);
55343         LDKErrorAction this_ptr_conv = *(LDKErrorAction*)(this_ptr_ptr);
55344         FREE(untag_ptr(this_ptr));
55345         ErrorAction_free(this_ptr_conv);
55346 }
55347
55348 static inline uint64_t ErrorAction_clone_ptr(LDKErrorAction *NONNULL_PTR arg) {
55349         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
55350         *ret_copy = ErrorAction_clone(arg);
55351         int64_t ret_ref = tag_ptr(ret_copy, true);
55352         return ret_ref;
55353 }
55354 int64_t  CS_LDK_ErrorAction_clone_ptr(int64_t arg) {
55355         LDKErrorAction* arg_conv = (LDKErrorAction*)untag_ptr(arg);
55356         int64_t ret_conv = ErrorAction_clone_ptr(arg_conv);
55357         return ret_conv;
55358 }
55359
55360 int64_t  CS_LDK_ErrorAction_clone(int64_t orig) {
55361         LDKErrorAction* orig_conv = (LDKErrorAction*)untag_ptr(orig);
55362         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
55363         *ret_copy = ErrorAction_clone(orig_conv);
55364         int64_t ret_ref = tag_ptr(ret_copy, true);
55365         return ret_ref;
55366 }
55367
55368 int64_t  CS_LDK_ErrorAction_disconnect_peer(int64_t msg) {
55369         LDKErrorMessage msg_conv;
55370         msg_conv.inner = untag_ptr(msg);
55371         msg_conv.is_owned = ptr_is_owned(msg);
55372         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
55373         msg_conv = ErrorMessage_clone(&msg_conv);
55374         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
55375         *ret_copy = ErrorAction_disconnect_peer(msg_conv);
55376         int64_t ret_ref = tag_ptr(ret_copy, true);
55377         return ret_ref;
55378 }
55379
55380 int64_t  CS_LDK_ErrorAction_disconnect_peer_with_warning(int64_t msg) {
55381         LDKWarningMessage msg_conv;
55382         msg_conv.inner = untag_ptr(msg);
55383         msg_conv.is_owned = ptr_is_owned(msg);
55384         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
55385         msg_conv = WarningMessage_clone(&msg_conv);
55386         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
55387         *ret_copy = ErrorAction_disconnect_peer_with_warning(msg_conv);
55388         int64_t ret_ref = tag_ptr(ret_copy, true);
55389         return ret_ref;
55390 }
55391
55392 int64_t  CS_LDK_ErrorAction_ignore_error() {
55393         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
55394         *ret_copy = ErrorAction_ignore_error();
55395         int64_t ret_ref = tag_ptr(ret_copy, true);
55396         return ret_ref;
55397 }
55398
55399 int64_t  CS_LDK_ErrorAction_ignore_and_log(int32_t a) {
55400         LDKLevel a_conv = LDKLevel_from_cs(a);
55401         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
55402         *ret_copy = ErrorAction_ignore_and_log(a_conv);
55403         int64_t ret_ref = tag_ptr(ret_copy, true);
55404         return ret_ref;
55405 }
55406
55407 int64_t  CS_LDK_ErrorAction_ignore_duplicate_gossip() {
55408         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
55409         *ret_copy = ErrorAction_ignore_duplicate_gossip();
55410         int64_t ret_ref = tag_ptr(ret_copy, true);
55411         return ret_ref;
55412 }
55413
55414 int64_t  CS_LDK_ErrorAction_send_error_message(int64_t msg) {
55415         LDKErrorMessage msg_conv;
55416         msg_conv.inner = untag_ptr(msg);
55417         msg_conv.is_owned = ptr_is_owned(msg);
55418         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
55419         msg_conv = ErrorMessage_clone(&msg_conv);
55420         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
55421         *ret_copy = ErrorAction_send_error_message(msg_conv);
55422         int64_t ret_ref = tag_ptr(ret_copy, true);
55423         return ret_ref;
55424 }
55425
55426 int64_t  CS_LDK_ErrorAction_send_warning_message(int64_t msg, int32_t log_level) {
55427         LDKWarningMessage msg_conv;
55428         msg_conv.inner = untag_ptr(msg);
55429         msg_conv.is_owned = ptr_is_owned(msg);
55430         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
55431         msg_conv = WarningMessage_clone(&msg_conv);
55432         LDKLevel log_level_conv = LDKLevel_from_cs(log_level);
55433         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
55434         *ret_copy = ErrorAction_send_warning_message(msg_conv, log_level_conv);
55435         int64_t ret_ref = tag_ptr(ret_copy, true);
55436         return ret_ref;
55437 }
55438
55439 int64_t  CS_LDK_ErrorAction_hash(int64_t o) {
55440         LDKErrorAction* o_conv = (LDKErrorAction*)untag_ptr(o);
55441         int64_t ret_conv = ErrorAction_hash(o_conv);
55442         return ret_conv;
55443 }
55444
55445 void  CS_LDK_LightningError_free(int64_t this_obj) {
55446         LDKLightningError this_obj_conv;
55447         this_obj_conv.inner = untag_ptr(this_obj);
55448         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55449         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55450         LightningError_free(this_obj_conv);
55451 }
55452
55453 jstring  CS_LDK_LightningError_get_err(int64_t this_ptr) {
55454         LDKLightningError this_ptr_conv;
55455         this_ptr_conv.inner = untag_ptr(this_ptr);
55456         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55457         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55458         this_ptr_conv.is_owned = false;
55459         LDKStr ret_str = LightningError_get_err(&this_ptr_conv);
55460         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
55461         Str_free(ret_str);
55462         return ret_conv;
55463 }
55464
55465 void  CS_LDK_LightningError_set_err(int64_t this_ptr, jstring val) {
55466         LDKLightningError this_ptr_conv;
55467         this_ptr_conv.inner = untag_ptr(this_ptr);
55468         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55469         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55470         this_ptr_conv.is_owned = false;
55471         LDKStr val_conv = str_ref_to_owned_c(val);
55472         LightningError_set_err(&this_ptr_conv, val_conv);
55473 }
55474
55475 int64_t  CS_LDK_LightningError_get_action(int64_t this_ptr) {
55476         LDKLightningError this_ptr_conv;
55477         this_ptr_conv.inner = untag_ptr(this_ptr);
55478         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55479         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55480         this_ptr_conv.is_owned = false;
55481         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
55482         *ret_copy = LightningError_get_action(&this_ptr_conv);
55483         int64_t ret_ref = tag_ptr(ret_copy, true);
55484         return ret_ref;
55485 }
55486
55487 void  CS_LDK_LightningError_set_action(int64_t this_ptr, int64_t val) {
55488         LDKLightningError this_ptr_conv;
55489         this_ptr_conv.inner = untag_ptr(this_ptr);
55490         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55491         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55492         this_ptr_conv.is_owned = false;
55493         void* val_ptr = untag_ptr(val);
55494         CHECK_ACCESS(val_ptr);
55495         LDKErrorAction val_conv = *(LDKErrorAction*)(val_ptr);
55496         val_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(val));
55497         LightningError_set_action(&this_ptr_conv, val_conv);
55498 }
55499
55500 int64_t  CS_LDK_LightningError_new(jstring err_arg, int64_t action_arg) {
55501         LDKStr err_arg_conv = str_ref_to_owned_c(err_arg);
55502         void* action_arg_ptr = untag_ptr(action_arg);
55503         CHECK_ACCESS(action_arg_ptr);
55504         LDKErrorAction action_arg_conv = *(LDKErrorAction*)(action_arg_ptr);
55505         action_arg_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(action_arg));
55506         LDKLightningError ret_var = LightningError_new(err_arg_conv, action_arg_conv);
55507         int64_t ret_ref = 0;
55508         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55509         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55510         return ret_ref;
55511 }
55512
55513 static inline uint64_t LightningError_clone_ptr(LDKLightningError *NONNULL_PTR arg) {
55514         LDKLightningError ret_var = LightningError_clone(arg);
55515         int64_t ret_ref = 0;
55516         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55517         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55518         return ret_ref;
55519 }
55520 int64_t  CS_LDK_LightningError_clone_ptr(int64_t arg) {
55521         LDKLightningError arg_conv;
55522         arg_conv.inner = untag_ptr(arg);
55523         arg_conv.is_owned = ptr_is_owned(arg);
55524         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55525         arg_conv.is_owned = false;
55526         int64_t ret_conv = LightningError_clone_ptr(&arg_conv);
55527         return ret_conv;
55528 }
55529
55530 int64_t  CS_LDK_LightningError_clone(int64_t orig) {
55531         LDKLightningError orig_conv;
55532         orig_conv.inner = untag_ptr(orig);
55533         orig_conv.is_owned = ptr_is_owned(orig);
55534         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55535         orig_conv.is_owned = false;
55536         LDKLightningError ret_var = LightningError_clone(&orig_conv);
55537         int64_t ret_ref = 0;
55538         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55539         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55540         return ret_ref;
55541 }
55542
55543 void  CS_LDK_CommitmentUpdate_free(int64_t this_obj) {
55544         LDKCommitmentUpdate this_obj_conv;
55545         this_obj_conv.inner = untag_ptr(this_obj);
55546         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55547         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55548         CommitmentUpdate_free(this_obj_conv);
55549 }
55550
55551 int64_tArray  CS_LDK_CommitmentUpdate_get_update_add_htlcs(int64_t this_ptr) {
55552         LDKCommitmentUpdate this_ptr_conv;
55553         this_ptr_conv.inner = untag_ptr(this_ptr);
55554         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55555         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55556         this_ptr_conv.is_owned = false;
55557         LDKCVec_UpdateAddHTLCZ ret_var = CommitmentUpdate_get_update_add_htlcs(&this_ptr_conv);
55558         int64_tArray ret_arr = NULL;
55559         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
55560         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
55561         for (size_t p = 0; p < ret_var.datalen; p++) {
55562                 LDKUpdateAddHTLC ret_conv_15_var = ret_var.data[p];
55563                 int64_t ret_conv_15_ref = 0;
55564                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_15_var);
55565                 ret_conv_15_ref = tag_ptr(ret_conv_15_var.inner, ret_conv_15_var.is_owned);
55566                 ret_arr_ptr[p] = ret_conv_15_ref;
55567         }
55568         
55569         FREE(ret_var.data);
55570         return ret_arr;
55571 }
55572
55573 void  CS_LDK_CommitmentUpdate_set_update_add_htlcs(int64_t this_ptr, int64_tArray val) {
55574         LDKCommitmentUpdate this_ptr_conv;
55575         this_ptr_conv.inner = untag_ptr(this_ptr);
55576         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55577         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55578         this_ptr_conv.is_owned = false;
55579         LDKCVec_UpdateAddHTLCZ val_constr;
55580         val_constr.datalen = val->arr_len;
55581         if (val_constr.datalen > 0)
55582                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
55583         else
55584                 val_constr.data = NULL;
55585         int64_t* val_vals = val->elems;
55586         for (size_t p = 0; p < val_constr.datalen; p++) {
55587                 int64_t val_conv_15 = val_vals[p];
55588                 LDKUpdateAddHTLC val_conv_15_conv;
55589                 val_conv_15_conv.inner = untag_ptr(val_conv_15);
55590                 val_conv_15_conv.is_owned = ptr_is_owned(val_conv_15);
55591                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_15_conv);
55592                 val_conv_15_conv = UpdateAddHTLC_clone(&val_conv_15_conv);
55593                 val_constr.data[p] = val_conv_15_conv;
55594         }
55595         FREE(val);
55596         CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
55597 }
55598
55599 int64_tArray  CS_LDK_CommitmentUpdate_get_update_fulfill_htlcs(int64_t this_ptr) {
55600         LDKCommitmentUpdate this_ptr_conv;
55601         this_ptr_conv.inner = untag_ptr(this_ptr);
55602         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55603         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55604         this_ptr_conv.is_owned = false;
55605         LDKCVec_UpdateFulfillHTLCZ ret_var = CommitmentUpdate_get_update_fulfill_htlcs(&this_ptr_conv);
55606         int64_tArray ret_arr = NULL;
55607         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
55608         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
55609         for (size_t t = 0; t < ret_var.datalen; t++) {
55610                 LDKUpdateFulfillHTLC ret_conv_19_var = ret_var.data[t];
55611                 int64_t ret_conv_19_ref = 0;
55612                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_19_var);
55613                 ret_conv_19_ref = tag_ptr(ret_conv_19_var.inner, ret_conv_19_var.is_owned);
55614                 ret_arr_ptr[t] = ret_conv_19_ref;
55615         }
55616         
55617         FREE(ret_var.data);
55618         return ret_arr;
55619 }
55620
55621 void  CS_LDK_CommitmentUpdate_set_update_fulfill_htlcs(int64_t this_ptr, int64_tArray val) {
55622         LDKCommitmentUpdate this_ptr_conv;
55623         this_ptr_conv.inner = untag_ptr(this_ptr);
55624         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55625         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55626         this_ptr_conv.is_owned = false;
55627         LDKCVec_UpdateFulfillHTLCZ val_constr;
55628         val_constr.datalen = val->arr_len;
55629         if (val_constr.datalen > 0)
55630                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
55631         else
55632                 val_constr.data = NULL;
55633         int64_t* val_vals = val->elems;
55634         for (size_t t = 0; t < val_constr.datalen; t++) {
55635                 int64_t val_conv_19 = val_vals[t];
55636                 LDKUpdateFulfillHTLC val_conv_19_conv;
55637                 val_conv_19_conv.inner = untag_ptr(val_conv_19);
55638                 val_conv_19_conv.is_owned = ptr_is_owned(val_conv_19);
55639                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_19_conv);
55640                 val_conv_19_conv = UpdateFulfillHTLC_clone(&val_conv_19_conv);
55641                 val_constr.data[t] = val_conv_19_conv;
55642         }
55643         FREE(val);
55644         CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
55645 }
55646
55647 int64_tArray  CS_LDK_CommitmentUpdate_get_update_fail_htlcs(int64_t this_ptr) {
55648         LDKCommitmentUpdate this_ptr_conv;
55649         this_ptr_conv.inner = untag_ptr(this_ptr);
55650         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55651         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55652         this_ptr_conv.is_owned = false;
55653         LDKCVec_UpdateFailHTLCZ ret_var = CommitmentUpdate_get_update_fail_htlcs(&this_ptr_conv);
55654         int64_tArray ret_arr = NULL;
55655         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
55656         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
55657         for (size_t q = 0; q < ret_var.datalen; q++) {
55658                 LDKUpdateFailHTLC ret_conv_16_var = ret_var.data[q];
55659                 int64_t ret_conv_16_ref = 0;
55660                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
55661                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
55662                 ret_arr_ptr[q] = ret_conv_16_ref;
55663         }
55664         
55665         FREE(ret_var.data);
55666         return ret_arr;
55667 }
55668
55669 void  CS_LDK_CommitmentUpdate_set_update_fail_htlcs(int64_t this_ptr, int64_tArray val) {
55670         LDKCommitmentUpdate this_ptr_conv;
55671         this_ptr_conv.inner = untag_ptr(this_ptr);
55672         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55673         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55674         this_ptr_conv.is_owned = false;
55675         LDKCVec_UpdateFailHTLCZ val_constr;
55676         val_constr.datalen = val->arr_len;
55677         if (val_constr.datalen > 0)
55678                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
55679         else
55680                 val_constr.data = NULL;
55681         int64_t* val_vals = val->elems;
55682         for (size_t q = 0; q < val_constr.datalen; q++) {
55683                 int64_t val_conv_16 = val_vals[q];
55684                 LDKUpdateFailHTLC val_conv_16_conv;
55685                 val_conv_16_conv.inner = untag_ptr(val_conv_16);
55686                 val_conv_16_conv.is_owned = ptr_is_owned(val_conv_16);
55687                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
55688                 val_conv_16_conv = UpdateFailHTLC_clone(&val_conv_16_conv);
55689                 val_constr.data[q] = val_conv_16_conv;
55690         }
55691         FREE(val);
55692         CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
55693 }
55694
55695 int64_tArray  CS_LDK_CommitmentUpdate_get_update_fail_malformed_htlcs(int64_t this_ptr) {
55696         LDKCommitmentUpdate this_ptr_conv;
55697         this_ptr_conv.inner = untag_ptr(this_ptr);
55698         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55699         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55700         this_ptr_conv.is_owned = false;
55701         LDKCVec_UpdateFailMalformedHTLCZ ret_var = CommitmentUpdate_get_update_fail_malformed_htlcs(&this_ptr_conv);
55702         int64_tArray ret_arr = NULL;
55703         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
55704         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
55705         for (size_t z = 0; z < ret_var.datalen; z++) {
55706                 LDKUpdateFailMalformedHTLC ret_conv_25_var = ret_var.data[z];
55707                 int64_t ret_conv_25_ref = 0;
55708                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_25_var);
55709                 ret_conv_25_ref = tag_ptr(ret_conv_25_var.inner, ret_conv_25_var.is_owned);
55710                 ret_arr_ptr[z] = ret_conv_25_ref;
55711         }
55712         
55713         FREE(ret_var.data);
55714         return ret_arr;
55715 }
55716
55717 void  CS_LDK_CommitmentUpdate_set_update_fail_malformed_htlcs(int64_t this_ptr, int64_tArray val) {
55718         LDKCommitmentUpdate this_ptr_conv;
55719         this_ptr_conv.inner = untag_ptr(this_ptr);
55720         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55721         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55722         this_ptr_conv.is_owned = false;
55723         LDKCVec_UpdateFailMalformedHTLCZ val_constr;
55724         val_constr.datalen = val->arr_len;
55725         if (val_constr.datalen > 0)
55726                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
55727         else
55728                 val_constr.data = NULL;
55729         int64_t* val_vals = val->elems;
55730         for (size_t z = 0; z < val_constr.datalen; z++) {
55731                 int64_t val_conv_25 = val_vals[z];
55732                 LDKUpdateFailMalformedHTLC val_conv_25_conv;
55733                 val_conv_25_conv.inner = untag_ptr(val_conv_25);
55734                 val_conv_25_conv.is_owned = ptr_is_owned(val_conv_25);
55735                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_25_conv);
55736                 val_conv_25_conv = UpdateFailMalformedHTLC_clone(&val_conv_25_conv);
55737                 val_constr.data[z] = val_conv_25_conv;
55738         }
55739         FREE(val);
55740         CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
55741 }
55742
55743 int64_t  CS_LDK_CommitmentUpdate_get_update_fee(int64_t this_ptr) {
55744         LDKCommitmentUpdate this_ptr_conv;
55745         this_ptr_conv.inner = untag_ptr(this_ptr);
55746         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55747         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55748         this_ptr_conv.is_owned = false;
55749         LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
55750         int64_t ret_ref = 0;
55751         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55752         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55753         return ret_ref;
55754 }
55755
55756 void  CS_LDK_CommitmentUpdate_set_update_fee(int64_t this_ptr, int64_t val) {
55757         LDKCommitmentUpdate this_ptr_conv;
55758         this_ptr_conv.inner = untag_ptr(this_ptr);
55759         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55760         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55761         this_ptr_conv.is_owned = false;
55762         LDKUpdateFee val_conv;
55763         val_conv.inner = untag_ptr(val);
55764         val_conv.is_owned = ptr_is_owned(val);
55765         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
55766         val_conv = UpdateFee_clone(&val_conv);
55767         CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
55768 }
55769
55770 int64_t  CS_LDK_CommitmentUpdate_get_commitment_signed(int64_t this_ptr) {
55771         LDKCommitmentUpdate this_ptr_conv;
55772         this_ptr_conv.inner = untag_ptr(this_ptr);
55773         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55774         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55775         this_ptr_conv.is_owned = false;
55776         LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
55777         int64_t ret_ref = 0;
55778         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55779         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55780         return ret_ref;
55781 }
55782
55783 void  CS_LDK_CommitmentUpdate_set_commitment_signed(int64_t this_ptr, int64_t val) {
55784         LDKCommitmentUpdate this_ptr_conv;
55785         this_ptr_conv.inner = untag_ptr(this_ptr);
55786         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55787         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55788         this_ptr_conv.is_owned = false;
55789         LDKCommitmentSigned val_conv;
55790         val_conv.inner = untag_ptr(val);
55791         val_conv.is_owned = ptr_is_owned(val);
55792         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
55793         val_conv = CommitmentSigned_clone(&val_conv);
55794         CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
55795 }
55796
55797 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) {
55798         LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
55799         update_add_htlcs_arg_constr.datalen = update_add_htlcs_arg->arr_len;
55800         if (update_add_htlcs_arg_constr.datalen > 0)
55801                 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
55802         else
55803                 update_add_htlcs_arg_constr.data = NULL;
55804         int64_t* update_add_htlcs_arg_vals = update_add_htlcs_arg->elems;
55805         for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
55806                 int64_t update_add_htlcs_arg_conv_15 = update_add_htlcs_arg_vals[p];
55807                 LDKUpdateAddHTLC update_add_htlcs_arg_conv_15_conv;
55808                 update_add_htlcs_arg_conv_15_conv.inner = untag_ptr(update_add_htlcs_arg_conv_15);
55809                 update_add_htlcs_arg_conv_15_conv.is_owned = ptr_is_owned(update_add_htlcs_arg_conv_15);
55810                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_add_htlcs_arg_conv_15_conv);
55811                 update_add_htlcs_arg_conv_15_conv = UpdateAddHTLC_clone(&update_add_htlcs_arg_conv_15_conv);
55812                 update_add_htlcs_arg_constr.data[p] = update_add_htlcs_arg_conv_15_conv;
55813         }
55814         FREE(update_add_htlcs_arg);
55815         LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
55816         update_fulfill_htlcs_arg_constr.datalen = update_fulfill_htlcs_arg->arr_len;
55817         if (update_fulfill_htlcs_arg_constr.datalen > 0)
55818                 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
55819         else
55820                 update_fulfill_htlcs_arg_constr.data = NULL;
55821         int64_t* update_fulfill_htlcs_arg_vals = update_fulfill_htlcs_arg->elems;
55822         for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
55823                 int64_t update_fulfill_htlcs_arg_conv_19 = update_fulfill_htlcs_arg_vals[t];
55824                 LDKUpdateFulfillHTLC update_fulfill_htlcs_arg_conv_19_conv;
55825                 update_fulfill_htlcs_arg_conv_19_conv.inner = untag_ptr(update_fulfill_htlcs_arg_conv_19);
55826                 update_fulfill_htlcs_arg_conv_19_conv.is_owned = ptr_is_owned(update_fulfill_htlcs_arg_conv_19);
55827                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fulfill_htlcs_arg_conv_19_conv);
55828                 update_fulfill_htlcs_arg_conv_19_conv = UpdateFulfillHTLC_clone(&update_fulfill_htlcs_arg_conv_19_conv);
55829                 update_fulfill_htlcs_arg_constr.data[t] = update_fulfill_htlcs_arg_conv_19_conv;
55830         }
55831         FREE(update_fulfill_htlcs_arg);
55832         LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
55833         update_fail_htlcs_arg_constr.datalen = update_fail_htlcs_arg->arr_len;
55834         if (update_fail_htlcs_arg_constr.datalen > 0)
55835                 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
55836         else
55837                 update_fail_htlcs_arg_constr.data = NULL;
55838         int64_t* update_fail_htlcs_arg_vals = update_fail_htlcs_arg->elems;
55839         for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
55840                 int64_t update_fail_htlcs_arg_conv_16 = update_fail_htlcs_arg_vals[q];
55841                 LDKUpdateFailHTLC update_fail_htlcs_arg_conv_16_conv;
55842                 update_fail_htlcs_arg_conv_16_conv.inner = untag_ptr(update_fail_htlcs_arg_conv_16);
55843                 update_fail_htlcs_arg_conv_16_conv.is_owned = ptr_is_owned(update_fail_htlcs_arg_conv_16);
55844                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_htlcs_arg_conv_16_conv);
55845                 update_fail_htlcs_arg_conv_16_conv = UpdateFailHTLC_clone(&update_fail_htlcs_arg_conv_16_conv);
55846                 update_fail_htlcs_arg_constr.data[q] = update_fail_htlcs_arg_conv_16_conv;
55847         }
55848         FREE(update_fail_htlcs_arg);
55849         LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
55850         update_fail_malformed_htlcs_arg_constr.datalen = update_fail_malformed_htlcs_arg->arr_len;
55851         if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
55852                 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
55853         else
55854                 update_fail_malformed_htlcs_arg_constr.data = NULL;
55855         int64_t* update_fail_malformed_htlcs_arg_vals = update_fail_malformed_htlcs_arg->elems;
55856         for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
55857                 int64_t update_fail_malformed_htlcs_arg_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
55858                 LDKUpdateFailMalformedHTLC update_fail_malformed_htlcs_arg_conv_25_conv;
55859                 update_fail_malformed_htlcs_arg_conv_25_conv.inner = untag_ptr(update_fail_malformed_htlcs_arg_conv_25);
55860                 update_fail_malformed_htlcs_arg_conv_25_conv.is_owned = ptr_is_owned(update_fail_malformed_htlcs_arg_conv_25);
55861                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_malformed_htlcs_arg_conv_25_conv);
55862                 update_fail_malformed_htlcs_arg_conv_25_conv = UpdateFailMalformedHTLC_clone(&update_fail_malformed_htlcs_arg_conv_25_conv);
55863                 update_fail_malformed_htlcs_arg_constr.data[z] = update_fail_malformed_htlcs_arg_conv_25_conv;
55864         }
55865         FREE(update_fail_malformed_htlcs_arg);
55866         LDKUpdateFee update_fee_arg_conv;
55867         update_fee_arg_conv.inner = untag_ptr(update_fee_arg);
55868         update_fee_arg_conv.is_owned = ptr_is_owned(update_fee_arg);
55869         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fee_arg_conv);
55870         update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
55871         LDKCommitmentSigned commitment_signed_arg_conv;
55872         commitment_signed_arg_conv.inner = untag_ptr(commitment_signed_arg);
55873         commitment_signed_arg_conv.is_owned = ptr_is_owned(commitment_signed_arg);
55874         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_signed_arg_conv);
55875         commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
55876         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);
55877         int64_t ret_ref = 0;
55878         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55879         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55880         return ret_ref;
55881 }
55882
55883 static inline uint64_t CommitmentUpdate_clone_ptr(LDKCommitmentUpdate *NONNULL_PTR arg) {
55884         LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(arg);
55885         int64_t ret_ref = 0;
55886         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55887         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55888         return ret_ref;
55889 }
55890 int64_t  CS_LDK_CommitmentUpdate_clone_ptr(int64_t arg) {
55891         LDKCommitmentUpdate arg_conv;
55892         arg_conv.inner = untag_ptr(arg);
55893         arg_conv.is_owned = ptr_is_owned(arg);
55894         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55895         arg_conv.is_owned = false;
55896         int64_t ret_conv = CommitmentUpdate_clone_ptr(&arg_conv);
55897         return ret_conv;
55898 }
55899
55900 int64_t  CS_LDK_CommitmentUpdate_clone(int64_t orig) {
55901         LDKCommitmentUpdate orig_conv;
55902         orig_conv.inner = untag_ptr(orig);
55903         orig_conv.is_owned = ptr_is_owned(orig);
55904         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55905         orig_conv.is_owned = false;
55906         LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
55907         int64_t ret_ref = 0;
55908         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55909         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55910         return ret_ref;
55911 }
55912
55913 int64_t  CS_LDK_CommitmentUpdate_hash(int64_t o) {
55914         LDKCommitmentUpdate o_conv;
55915         o_conv.inner = untag_ptr(o);
55916         o_conv.is_owned = ptr_is_owned(o);
55917         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
55918         o_conv.is_owned = false;
55919         int64_t ret_conv = CommitmentUpdate_hash(&o_conv);
55920         return ret_conv;
55921 }
55922
55923 jboolean  CS_LDK_CommitmentUpdate_eq(int64_t a, int64_t b) {
55924         LDKCommitmentUpdate a_conv;
55925         a_conv.inner = untag_ptr(a);
55926         a_conv.is_owned = ptr_is_owned(a);
55927         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
55928         a_conv.is_owned = false;
55929         LDKCommitmentUpdate b_conv;
55930         b_conv.inner = untag_ptr(b);
55931         b_conv.is_owned = ptr_is_owned(b);
55932         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
55933         b_conv.is_owned = false;
55934         jboolean ret_conv = CommitmentUpdate_eq(&a_conv, &b_conv);
55935         return ret_conv;
55936 }
55937
55938 void  CS_LDK_ChannelMessageHandler_free(int64_t this_ptr) {
55939         if (!ptr_is_owned(this_ptr)) return;
55940         void* this_ptr_ptr = untag_ptr(this_ptr);
55941         CHECK_ACCESS(this_ptr_ptr);
55942         LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)(this_ptr_ptr);
55943         FREE(untag_ptr(this_ptr));
55944         ChannelMessageHandler_free(this_ptr_conv);
55945 }
55946
55947 void  CS_LDK_RoutingMessageHandler_free(int64_t this_ptr) {
55948         if (!ptr_is_owned(this_ptr)) return;
55949         void* this_ptr_ptr = untag_ptr(this_ptr);
55950         CHECK_ACCESS(this_ptr_ptr);
55951         LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)(this_ptr_ptr);
55952         FREE(untag_ptr(this_ptr));
55953         RoutingMessageHandler_free(this_ptr_conv);
55954 }
55955
55956 void  CS_LDK_OnionMessageHandler_free(int64_t this_ptr) {
55957         if (!ptr_is_owned(this_ptr)) return;
55958         void* this_ptr_ptr = untag_ptr(this_ptr);
55959         CHECK_ACCESS(this_ptr_ptr);
55960         LDKOnionMessageHandler this_ptr_conv = *(LDKOnionMessageHandler*)(this_ptr_ptr);
55961         FREE(untag_ptr(this_ptr));
55962         OnionMessageHandler_free(this_ptr_conv);
55963 }
55964
55965 void  CS_LDK_FinalOnionHopData_free(int64_t this_obj) {
55966         LDKFinalOnionHopData this_obj_conv;
55967         this_obj_conv.inner = untag_ptr(this_obj);
55968         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55969         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55970         FinalOnionHopData_free(this_obj_conv);
55971 }
55972
55973 int8_tArray  CS_LDK_FinalOnionHopData_get_payment_secret(int64_t this_ptr) {
55974         LDKFinalOnionHopData this_ptr_conv;
55975         this_ptr_conv.inner = untag_ptr(this_ptr);
55976         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55977         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55978         this_ptr_conv.is_owned = false;
55979         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
55980         memcpy(ret_arr->elems, *FinalOnionHopData_get_payment_secret(&this_ptr_conv), 32);
55981         return ret_arr;
55982 }
55983
55984 void  CS_LDK_FinalOnionHopData_set_payment_secret(int64_t this_ptr, int8_tArray val) {
55985         LDKFinalOnionHopData this_ptr_conv;
55986         this_ptr_conv.inner = untag_ptr(this_ptr);
55987         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55988         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55989         this_ptr_conv.is_owned = false;
55990         LDKThirtyTwoBytes val_ref;
55991         CHECK(val->arr_len == 32);
55992         memcpy(val_ref.data, val->elems, 32); FREE(val);
55993         FinalOnionHopData_set_payment_secret(&this_ptr_conv, val_ref);
55994 }
55995
55996 int64_t  CS_LDK_FinalOnionHopData_get_total_msat(int64_t this_ptr) {
55997         LDKFinalOnionHopData this_ptr_conv;
55998         this_ptr_conv.inner = untag_ptr(this_ptr);
55999         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56000         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56001         this_ptr_conv.is_owned = false;
56002         int64_t ret_conv = FinalOnionHopData_get_total_msat(&this_ptr_conv);
56003         return ret_conv;
56004 }
56005
56006 void  CS_LDK_FinalOnionHopData_set_total_msat(int64_t this_ptr, int64_t val) {
56007         LDKFinalOnionHopData this_ptr_conv;
56008         this_ptr_conv.inner = untag_ptr(this_ptr);
56009         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56010         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56011         this_ptr_conv.is_owned = false;
56012         FinalOnionHopData_set_total_msat(&this_ptr_conv, val);
56013 }
56014
56015 int64_t  CS_LDK_FinalOnionHopData_new(int8_tArray payment_secret_arg, int64_t total_msat_arg) {
56016         LDKThirtyTwoBytes payment_secret_arg_ref;
56017         CHECK(payment_secret_arg->arr_len == 32);
56018         memcpy(payment_secret_arg_ref.data, payment_secret_arg->elems, 32); FREE(payment_secret_arg);
56019         LDKFinalOnionHopData ret_var = FinalOnionHopData_new(payment_secret_arg_ref, total_msat_arg);
56020         int64_t ret_ref = 0;
56021         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56022         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56023         return ret_ref;
56024 }
56025
56026 static inline uint64_t FinalOnionHopData_clone_ptr(LDKFinalOnionHopData *NONNULL_PTR arg) {
56027         LDKFinalOnionHopData ret_var = FinalOnionHopData_clone(arg);
56028         int64_t ret_ref = 0;
56029         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56030         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56031         return ret_ref;
56032 }
56033 int64_t  CS_LDK_FinalOnionHopData_clone_ptr(int64_t arg) {
56034         LDKFinalOnionHopData arg_conv;
56035         arg_conv.inner = untag_ptr(arg);
56036         arg_conv.is_owned = ptr_is_owned(arg);
56037         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
56038         arg_conv.is_owned = false;
56039         int64_t ret_conv = FinalOnionHopData_clone_ptr(&arg_conv);
56040         return ret_conv;
56041 }
56042
56043 int64_t  CS_LDK_FinalOnionHopData_clone(int64_t orig) {
56044         LDKFinalOnionHopData orig_conv;
56045         orig_conv.inner = untag_ptr(orig);
56046         orig_conv.is_owned = ptr_is_owned(orig);
56047         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
56048         orig_conv.is_owned = false;
56049         LDKFinalOnionHopData ret_var = FinalOnionHopData_clone(&orig_conv);
56050         int64_t ret_ref = 0;
56051         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56052         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56053         return ret_ref;
56054 }
56055
56056 void  CS_LDK_OnionPacket_free(int64_t this_obj) {
56057         LDKOnionPacket this_obj_conv;
56058         this_obj_conv.inner = untag_ptr(this_obj);
56059         this_obj_conv.is_owned = ptr_is_owned(this_obj);
56060         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
56061         OnionPacket_free(this_obj_conv);
56062 }
56063
56064 int8_t  CS_LDK_OnionPacket_get_version(int64_t this_ptr) {
56065         LDKOnionPacket this_ptr_conv;
56066         this_ptr_conv.inner = untag_ptr(this_ptr);
56067         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56068         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56069         this_ptr_conv.is_owned = false;
56070         int8_t ret_conv = OnionPacket_get_version(&this_ptr_conv);
56071         return ret_conv;
56072 }
56073
56074 void  CS_LDK_OnionPacket_set_version(int64_t this_ptr, int8_t val) {
56075         LDKOnionPacket this_ptr_conv;
56076         this_ptr_conv.inner = untag_ptr(this_ptr);
56077         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56078         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56079         this_ptr_conv.is_owned = false;
56080         OnionPacket_set_version(&this_ptr_conv, val);
56081 }
56082
56083 int64_t  CS_LDK_OnionPacket_get_public_key(int64_t this_ptr) {
56084         LDKOnionPacket this_ptr_conv;
56085         this_ptr_conv.inner = untag_ptr(this_ptr);
56086         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56087         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56088         this_ptr_conv.is_owned = false;
56089         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
56090         *ret_conv = OnionPacket_get_public_key(&this_ptr_conv);
56091         return tag_ptr(ret_conv, true);
56092 }
56093
56094 void  CS_LDK_OnionPacket_set_public_key(int64_t this_ptr, int64_t val) {
56095         LDKOnionPacket this_ptr_conv;
56096         this_ptr_conv.inner = untag_ptr(this_ptr);
56097         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56098         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56099         this_ptr_conv.is_owned = false;
56100         void* val_ptr = untag_ptr(val);
56101         CHECK_ACCESS(val_ptr);
56102         LDKCResult_PublicKeySecp256k1ErrorZ val_conv = *(LDKCResult_PublicKeySecp256k1ErrorZ*)(val_ptr);
56103         val_conv = CResult_PublicKeySecp256k1ErrorZ_clone((LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(val));
56104         OnionPacket_set_public_key(&this_ptr_conv, val_conv);
56105 }
56106
56107 int8_tArray  CS_LDK_OnionPacket_get_hmac(int64_t this_ptr) {
56108         LDKOnionPacket this_ptr_conv;
56109         this_ptr_conv.inner = untag_ptr(this_ptr);
56110         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56111         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56112         this_ptr_conv.is_owned = false;
56113         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
56114         memcpy(ret_arr->elems, *OnionPacket_get_hmac(&this_ptr_conv), 32);
56115         return ret_arr;
56116 }
56117
56118 void  CS_LDK_OnionPacket_set_hmac(int64_t this_ptr, int8_tArray val) {
56119         LDKOnionPacket this_ptr_conv;
56120         this_ptr_conv.inner = untag_ptr(this_ptr);
56121         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56122         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56123         this_ptr_conv.is_owned = false;
56124         LDKThirtyTwoBytes val_ref;
56125         CHECK(val->arr_len == 32);
56126         memcpy(val_ref.data, val->elems, 32); FREE(val);
56127         OnionPacket_set_hmac(&this_ptr_conv, val_ref);
56128 }
56129
56130 static inline uint64_t OnionPacket_clone_ptr(LDKOnionPacket *NONNULL_PTR arg) {
56131         LDKOnionPacket ret_var = OnionPacket_clone(arg);
56132         int64_t ret_ref = 0;
56133         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56134         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56135         return ret_ref;
56136 }
56137 int64_t  CS_LDK_OnionPacket_clone_ptr(int64_t arg) {
56138         LDKOnionPacket arg_conv;
56139         arg_conv.inner = untag_ptr(arg);
56140         arg_conv.is_owned = ptr_is_owned(arg);
56141         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
56142         arg_conv.is_owned = false;
56143         int64_t ret_conv = OnionPacket_clone_ptr(&arg_conv);
56144         return ret_conv;
56145 }
56146
56147 int64_t  CS_LDK_OnionPacket_clone(int64_t orig) {
56148         LDKOnionPacket orig_conv;
56149         orig_conv.inner = untag_ptr(orig);
56150         orig_conv.is_owned = ptr_is_owned(orig);
56151         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
56152         orig_conv.is_owned = false;
56153         LDKOnionPacket ret_var = OnionPacket_clone(&orig_conv);
56154         int64_t ret_ref = 0;
56155         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56156         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56157         return ret_ref;
56158 }
56159
56160 int64_t  CS_LDK_OnionPacket_hash(int64_t o) {
56161         LDKOnionPacket o_conv;
56162         o_conv.inner = untag_ptr(o);
56163         o_conv.is_owned = ptr_is_owned(o);
56164         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
56165         o_conv.is_owned = false;
56166         int64_t ret_conv = OnionPacket_hash(&o_conv);
56167         return ret_conv;
56168 }
56169
56170 jboolean  CS_LDK_OnionPacket_eq(int64_t a, int64_t b) {
56171         LDKOnionPacket a_conv;
56172         a_conv.inner = untag_ptr(a);
56173         a_conv.is_owned = ptr_is_owned(a);
56174         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
56175         a_conv.is_owned = false;
56176         LDKOnionPacket b_conv;
56177         b_conv.inner = untag_ptr(b);
56178         b_conv.is_owned = ptr_is_owned(b);
56179         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
56180         b_conv.is_owned = false;
56181         jboolean ret_conv = OnionPacket_eq(&a_conv, &b_conv);
56182         return ret_conv;
56183 }
56184
56185 void  CS_LDK_TrampolineOnionPacket_free(int64_t this_obj) {
56186         LDKTrampolineOnionPacket this_obj_conv;
56187         this_obj_conv.inner = untag_ptr(this_obj);
56188         this_obj_conv.is_owned = ptr_is_owned(this_obj);
56189         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
56190         TrampolineOnionPacket_free(this_obj_conv);
56191 }
56192
56193 int8_t  CS_LDK_TrampolineOnionPacket_get_version(int64_t this_ptr) {
56194         LDKTrampolineOnionPacket this_ptr_conv;
56195         this_ptr_conv.inner = untag_ptr(this_ptr);
56196         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56197         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56198         this_ptr_conv.is_owned = false;
56199         int8_t ret_conv = TrampolineOnionPacket_get_version(&this_ptr_conv);
56200         return ret_conv;
56201 }
56202
56203 void  CS_LDK_TrampolineOnionPacket_set_version(int64_t this_ptr, int8_t val) {
56204         LDKTrampolineOnionPacket this_ptr_conv;
56205         this_ptr_conv.inner = untag_ptr(this_ptr);
56206         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56207         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56208         this_ptr_conv.is_owned = false;
56209         TrampolineOnionPacket_set_version(&this_ptr_conv, val);
56210 }
56211
56212 int8_tArray  CS_LDK_TrampolineOnionPacket_get_public_key(int64_t this_ptr) {
56213         LDKTrampolineOnionPacket this_ptr_conv;
56214         this_ptr_conv.inner = untag_ptr(this_ptr);
56215         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56216         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56217         this_ptr_conv.is_owned = false;
56218         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
56219         memcpy(ret_arr->elems, TrampolineOnionPacket_get_public_key(&this_ptr_conv).compressed_form, 33);
56220         return ret_arr;
56221 }
56222
56223 void  CS_LDK_TrampolineOnionPacket_set_public_key(int64_t this_ptr, int8_tArray val) {
56224         LDKTrampolineOnionPacket this_ptr_conv;
56225         this_ptr_conv.inner = untag_ptr(this_ptr);
56226         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56227         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56228         this_ptr_conv.is_owned = false;
56229         LDKPublicKey val_ref;
56230         CHECK(val->arr_len == 33);
56231         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
56232         TrampolineOnionPacket_set_public_key(&this_ptr_conv, val_ref);
56233 }
56234
56235 int8_tArray  CS_LDK_TrampolineOnionPacket_get_hop_data(int64_t this_ptr) {
56236         LDKTrampolineOnionPacket this_ptr_conv;
56237         this_ptr_conv.inner = untag_ptr(this_ptr);
56238         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56239         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56240         this_ptr_conv.is_owned = false;
56241         LDKCVec_u8Z ret_var = TrampolineOnionPacket_get_hop_data(&this_ptr_conv);
56242         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56243         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56244         CVec_u8Z_free(ret_var);
56245         return ret_arr;
56246 }
56247
56248 void  CS_LDK_TrampolineOnionPacket_set_hop_data(int64_t this_ptr, int8_tArray val) {
56249         LDKTrampolineOnionPacket this_ptr_conv;
56250         this_ptr_conv.inner = untag_ptr(this_ptr);
56251         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56252         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56253         this_ptr_conv.is_owned = false;
56254         LDKCVec_u8Z val_ref;
56255         val_ref.datalen = val->arr_len;
56256         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
56257         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
56258         TrampolineOnionPacket_set_hop_data(&this_ptr_conv, val_ref);
56259 }
56260
56261 int8_tArray  CS_LDK_TrampolineOnionPacket_get_hmac(int64_t this_ptr) {
56262         LDKTrampolineOnionPacket this_ptr_conv;
56263         this_ptr_conv.inner = untag_ptr(this_ptr);
56264         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56265         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56266         this_ptr_conv.is_owned = false;
56267         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
56268         memcpy(ret_arr->elems, *TrampolineOnionPacket_get_hmac(&this_ptr_conv), 32);
56269         return ret_arr;
56270 }
56271
56272 void  CS_LDK_TrampolineOnionPacket_set_hmac(int64_t this_ptr, int8_tArray val) {
56273         LDKTrampolineOnionPacket this_ptr_conv;
56274         this_ptr_conv.inner = untag_ptr(this_ptr);
56275         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56276         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56277         this_ptr_conv.is_owned = false;
56278         LDKThirtyTwoBytes val_ref;
56279         CHECK(val->arr_len == 32);
56280         memcpy(val_ref.data, val->elems, 32); FREE(val);
56281         TrampolineOnionPacket_set_hmac(&this_ptr_conv, val_ref);
56282 }
56283
56284 int64_t  CS_LDK_TrampolineOnionPacket_new(int8_t version_arg, int8_tArray public_key_arg, int8_tArray hop_data_arg, int8_tArray hmac_arg) {
56285         LDKPublicKey public_key_arg_ref;
56286         CHECK(public_key_arg->arr_len == 33);
56287         memcpy(public_key_arg_ref.compressed_form, public_key_arg->elems, 33); FREE(public_key_arg);
56288         LDKCVec_u8Z hop_data_arg_ref;
56289         hop_data_arg_ref.datalen = hop_data_arg->arr_len;
56290         hop_data_arg_ref.data = MALLOC(hop_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
56291         memcpy(hop_data_arg_ref.data, hop_data_arg->elems, hop_data_arg_ref.datalen); FREE(hop_data_arg);
56292         LDKThirtyTwoBytes hmac_arg_ref;
56293         CHECK(hmac_arg->arr_len == 32);
56294         memcpy(hmac_arg_ref.data, hmac_arg->elems, 32); FREE(hmac_arg);
56295         LDKTrampolineOnionPacket ret_var = TrampolineOnionPacket_new(version_arg, public_key_arg_ref, hop_data_arg_ref, hmac_arg_ref);
56296         int64_t ret_ref = 0;
56297         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56298         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56299         return ret_ref;
56300 }
56301
56302 static inline uint64_t TrampolineOnionPacket_clone_ptr(LDKTrampolineOnionPacket *NONNULL_PTR arg) {
56303         LDKTrampolineOnionPacket ret_var = TrampolineOnionPacket_clone(arg);
56304         int64_t ret_ref = 0;
56305         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56306         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56307         return ret_ref;
56308 }
56309 int64_t  CS_LDK_TrampolineOnionPacket_clone_ptr(int64_t arg) {
56310         LDKTrampolineOnionPacket arg_conv;
56311         arg_conv.inner = untag_ptr(arg);
56312         arg_conv.is_owned = ptr_is_owned(arg);
56313         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
56314         arg_conv.is_owned = false;
56315         int64_t ret_conv = TrampolineOnionPacket_clone_ptr(&arg_conv);
56316         return ret_conv;
56317 }
56318
56319 int64_t  CS_LDK_TrampolineOnionPacket_clone(int64_t orig) {
56320         LDKTrampolineOnionPacket orig_conv;
56321         orig_conv.inner = untag_ptr(orig);
56322         orig_conv.is_owned = ptr_is_owned(orig);
56323         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
56324         orig_conv.is_owned = false;
56325         LDKTrampolineOnionPacket ret_var = TrampolineOnionPacket_clone(&orig_conv);
56326         int64_t ret_ref = 0;
56327         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56328         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56329         return ret_ref;
56330 }
56331
56332 int64_t  CS_LDK_TrampolineOnionPacket_hash(int64_t o) {
56333         LDKTrampolineOnionPacket o_conv;
56334         o_conv.inner = untag_ptr(o);
56335         o_conv.is_owned = ptr_is_owned(o);
56336         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
56337         o_conv.is_owned = false;
56338         int64_t ret_conv = TrampolineOnionPacket_hash(&o_conv);
56339         return ret_conv;
56340 }
56341
56342 jboolean  CS_LDK_TrampolineOnionPacket_eq(int64_t a, int64_t b) {
56343         LDKTrampolineOnionPacket a_conv;
56344         a_conv.inner = untag_ptr(a);
56345         a_conv.is_owned = ptr_is_owned(a);
56346         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
56347         a_conv.is_owned = false;
56348         LDKTrampolineOnionPacket b_conv;
56349         b_conv.inner = untag_ptr(b);
56350         b_conv.is_owned = ptr_is_owned(b);
56351         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
56352         b_conv.is_owned = false;
56353         jboolean ret_conv = TrampolineOnionPacket_eq(&a_conv, &b_conv);
56354         return ret_conv;
56355 }
56356
56357 int8_tArray  CS_LDK_TrampolineOnionPacket_write(int64_t obj) {
56358         LDKTrampolineOnionPacket obj_conv;
56359         obj_conv.inner = untag_ptr(obj);
56360         obj_conv.is_owned = ptr_is_owned(obj);
56361         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56362         obj_conv.is_owned = false;
56363         LDKCVec_u8Z ret_var = TrampolineOnionPacket_write(&obj_conv);
56364         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56365         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56366         CVec_u8Z_free(ret_var);
56367         return ret_arr;
56368 }
56369
56370 jstring  CS_LDK_DecodeError_to_str(int64_t o) {
56371         LDKDecodeError* o_conv = (LDKDecodeError*)untag_ptr(o);
56372         LDKStr ret_str = DecodeError_to_str(o_conv);
56373         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
56374         Str_free(ret_str);
56375         return ret_conv;
56376 }
56377
56378 int8_tArray  CS_LDK_AcceptChannel_write(int64_t obj) {
56379         LDKAcceptChannel obj_conv;
56380         obj_conv.inner = untag_ptr(obj);
56381         obj_conv.is_owned = ptr_is_owned(obj);
56382         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56383         obj_conv.is_owned = false;
56384         LDKCVec_u8Z ret_var = AcceptChannel_write(&obj_conv);
56385         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56386         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56387         CVec_u8Z_free(ret_var);
56388         return ret_arr;
56389 }
56390
56391 int64_t  CS_LDK_AcceptChannel_read(int8_tArray ser) {
56392         LDKu8slice ser_ref;
56393         ser_ref.datalen = ser->arr_len;
56394         ser_ref.data = ser->elems;
56395         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
56396         *ret_conv = AcceptChannel_read(ser_ref);
56397         FREE(ser);
56398         return tag_ptr(ret_conv, true);
56399 }
56400
56401 int8_tArray  CS_LDK_AcceptChannelV2_write(int64_t obj) {
56402         LDKAcceptChannelV2 obj_conv;
56403         obj_conv.inner = untag_ptr(obj);
56404         obj_conv.is_owned = ptr_is_owned(obj);
56405         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56406         obj_conv.is_owned = false;
56407         LDKCVec_u8Z ret_var = AcceptChannelV2_write(&obj_conv);
56408         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56409         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56410         CVec_u8Z_free(ret_var);
56411         return ret_arr;
56412 }
56413
56414 int64_t  CS_LDK_AcceptChannelV2_read(int8_tArray ser) {
56415         LDKu8slice ser_ref;
56416         ser_ref.datalen = ser->arr_len;
56417         ser_ref.data = ser->elems;
56418         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
56419         *ret_conv = AcceptChannelV2_read(ser_ref);
56420         FREE(ser);
56421         return tag_ptr(ret_conv, true);
56422 }
56423
56424 int8_tArray  CS_LDK_Stfu_write(int64_t obj) {
56425         LDKStfu obj_conv;
56426         obj_conv.inner = untag_ptr(obj);
56427         obj_conv.is_owned = ptr_is_owned(obj);
56428         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56429         obj_conv.is_owned = false;
56430         LDKCVec_u8Z ret_var = Stfu_write(&obj_conv);
56431         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56432         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56433         CVec_u8Z_free(ret_var);
56434         return ret_arr;
56435 }
56436
56437 int64_t  CS_LDK_Stfu_read(int8_tArray ser) {
56438         LDKu8slice ser_ref;
56439         ser_ref.datalen = ser->arr_len;
56440         ser_ref.data = ser->elems;
56441         LDKCResult_StfuDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StfuDecodeErrorZ), "LDKCResult_StfuDecodeErrorZ");
56442         *ret_conv = Stfu_read(ser_ref);
56443         FREE(ser);
56444         return tag_ptr(ret_conv, true);
56445 }
56446
56447 int8_tArray  CS_LDK_Splice_write(int64_t obj) {
56448         LDKSplice obj_conv;
56449         obj_conv.inner = untag_ptr(obj);
56450         obj_conv.is_owned = ptr_is_owned(obj);
56451         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56452         obj_conv.is_owned = false;
56453         LDKCVec_u8Z ret_var = Splice_write(&obj_conv);
56454         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56455         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56456         CVec_u8Z_free(ret_var);
56457         return ret_arr;
56458 }
56459
56460 int64_t  CS_LDK_Splice_read(int8_tArray ser) {
56461         LDKu8slice ser_ref;
56462         ser_ref.datalen = ser->arr_len;
56463         ser_ref.data = ser->elems;
56464         LDKCResult_SpliceDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceDecodeErrorZ), "LDKCResult_SpliceDecodeErrorZ");
56465         *ret_conv = Splice_read(ser_ref);
56466         FREE(ser);
56467         return tag_ptr(ret_conv, true);
56468 }
56469
56470 int8_tArray  CS_LDK_SpliceAck_write(int64_t obj) {
56471         LDKSpliceAck obj_conv;
56472         obj_conv.inner = untag_ptr(obj);
56473         obj_conv.is_owned = ptr_is_owned(obj);
56474         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56475         obj_conv.is_owned = false;
56476         LDKCVec_u8Z ret_var = SpliceAck_write(&obj_conv);
56477         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56478         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56479         CVec_u8Z_free(ret_var);
56480         return ret_arr;
56481 }
56482
56483 int64_t  CS_LDK_SpliceAck_read(int8_tArray ser) {
56484         LDKu8slice ser_ref;
56485         ser_ref.datalen = ser->arr_len;
56486         ser_ref.data = ser->elems;
56487         LDKCResult_SpliceAckDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceAckDecodeErrorZ), "LDKCResult_SpliceAckDecodeErrorZ");
56488         *ret_conv = SpliceAck_read(ser_ref);
56489         FREE(ser);
56490         return tag_ptr(ret_conv, true);
56491 }
56492
56493 int8_tArray  CS_LDK_SpliceLocked_write(int64_t obj) {
56494         LDKSpliceLocked obj_conv;
56495         obj_conv.inner = untag_ptr(obj);
56496         obj_conv.is_owned = ptr_is_owned(obj);
56497         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56498         obj_conv.is_owned = false;
56499         LDKCVec_u8Z ret_var = SpliceLocked_write(&obj_conv);
56500         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56501         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56502         CVec_u8Z_free(ret_var);
56503         return ret_arr;
56504 }
56505
56506 int64_t  CS_LDK_SpliceLocked_read(int8_tArray ser) {
56507         LDKu8slice ser_ref;
56508         ser_ref.datalen = ser->arr_len;
56509         ser_ref.data = ser->elems;
56510         LDKCResult_SpliceLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceLockedDecodeErrorZ), "LDKCResult_SpliceLockedDecodeErrorZ");
56511         *ret_conv = SpliceLocked_read(ser_ref);
56512         FREE(ser);
56513         return tag_ptr(ret_conv, true);
56514 }
56515
56516 int8_tArray  CS_LDK_TxAddInput_write(int64_t obj) {
56517         LDKTxAddInput obj_conv;
56518         obj_conv.inner = untag_ptr(obj);
56519         obj_conv.is_owned = ptr_is_owned(obj);
56520         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56521         obj_conv.is_owned = false;
56522         LDKCVec_u8Z ret_var = TxAddInput_write(&obj_conv);
56523         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56524         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56525         CVec_u8Z_free(ret_var);
56526         return ret_arr;
56527 }
56528
56529 int64_t  CS_LDK_TxAddInput_read(int8_tArray ser) {
56530         LDKu8slice ser_ref;
56531         ser_ref.datalen = ser->arr_len;
56532         ser_ref.data = ser->elems;
56533         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
56534         *ret_conv = TxAddInput_read(ser_ref);
56535         FREE(ser);
56536         return tag_ptr(ret_conv, true);
56537 }
56538
56539 int8_tArray  CS_LDK_TxAddOutput_write(int64_t obj) {
56540         LDKTxAddOutput obj_conv;
56541         obj_conv.inner = untag_ptr(obj);
56542         obj_conv.is_owned = ptr_is_owned(obj);
56543         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56544         obj_conv.is_owned = false;
56545         LDKCVec_u8Z ret_var = TxAddOutput_write(&obj_conv);
56546         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56547         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56548         CVec_u8Z_free(ret_var);
56549         return ret_arr;
56550 }
56551
56552 int64_t  CS_LDK_TxAddOutput_read(int8_tArray ser) {
56553         LDKu8slice ser_ref;
56554         ser_ref.datalen = ser->arr_len;
56555         ser_ref.data = ser->elems;
56556         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
56557         *ret_conv = TxAddOutput_read(ser_ref);
56558         FREE(ser);
56559         return tag_ptr(ret_conv, true);
56560 }
56561
56562 int8_tArray  CS_LDK_TxRemoveInput_write(int64_t obj) {
56563         LDKTxRemoveInput obj_conv;
56564         obj_conv.inner = untag_ptr(obj);
56565         obj_conv.is_owned = ptr_is_owned(obj);
56566         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56567         obj_conv.is_owned = false;
56568         LDKCVec_u8Z ret_var = TxRemoveInput_write(&obj_conv);
56569         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56570         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56571         CVec_u8Z_free(ret_var);
56572         return ret_arr;
56573 }
56574
56575 int64_t  CS_LDK_TxRemoveInput_read(int8_tArray ser) {
56576         LDKu8slice ser_ref;
56577         ser_ref.datalen = ser->arr_len;
56578         ser_ref.data = ser->elems;
56579         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
56580         *ret_conv = TxRemoveInput_read(ser_ref);
56581         FREE(ser);
56582         return tag_ptr(ret_conv, true);
56583 }
56584
56585 int8_tArray  CS_LDK_TxRemoveOutput_write(int64_t obj) {
56586         LDKTxRemoveOutput obj_conv;
56587         obj_conv.inner = untag_ptr(obj);
56588         obj_conv.is_owned = ptr_is_owned(obj);
56589         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56590         obj_conv.is_owned = false;
56591         LDKCVec_u8Z ret_var = TxRemoveOutput_write(&obj_conv);
56592         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56593         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56594         CVec_u8Z_free(ret_var);
56595         return ret_arr;
56596 }
56597
56598 int64_t  CS_LDK_TxRemoveOutput_read(int8_tArray ser) {
56599         LDKu8slice ser_ref;
56600         ser_ref.datalen = ser->arr_len;
56601         ser_ref.data = ser->elems;
56602         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
56603         *ret_conv = TxRemoveOutput_read(ser_ref);
56604         FREE(ser);
56605         return tag_ptr(ret_conv, true);
56606 }
56607
56608 int8_tArray  CS_LDK_TxComplete_write(int64_t obj) {
56609         LDKTxComplete obj_conv;
56610         obj_conv.inner = untag_ptr(obj);
56611         obj_conv.is_owned = ptr_is_owned(obj);
56612         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56613         obj_conv.is_owned = false;
56614         LDKCVec_u8Z ret_var = TxComplete_write(&obj_conv);
56615         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56616         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56617         CVec_u8Z_free(ret_var);
56618         return ret_arr;
56619 }
56620
56621 int64_t  CS_LDK_TxComplete_read(int8_tArray ser) {
56622         LDKu8slice ser_ref;
56623         ser_ref.datalen = ser->arr_len;
56624         ser_ref.data = ser->elems;
56625         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
56626         *ret_conv = TxComplete_read(ser_ref);
56627         FREE(ser);
56628         return tag_ptr(ret_conv, true);
56629 }
56630
56631 int8_tArray  CS_LDK_TxSignatures_write(int64_t obj) {
56632         LDKTxSignatures obj_conv;
56633         obj_conv.inner = untag_ptr(obj);
56634         obj_conv.is_owned = ptr_is_owned(obj);
56635         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56636         obj_conv.is_owned = false;
56637         LDKCVec_u8Z ret_var = TxSignatures_write(&obj_conv);
56638         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56639         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56640         CVec_u8Z_free(ret_var);
56641         return ret_arr;
56642 }
56643
56644 int64_t  CS_LDK_TxSignatures_read(int8_tArray ser) {
56645         LDKu8slice ser_ref;
56646         ser_ref.datalen = ser->arr_len;
56647         ser_ref.data = ser->elems;
56648         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
56649         *ret_conv = TxSignatures_read(ser_ref);
56650         FREE(ser);
56651         return tag_ptr(ret_conv, true);
56652 }
56653
56654 int8_tArray  CS_LDK_TxInitRbf_write(int64_t obj) {
56655         LDKTxInitRbf obj_conv;
56656         obj_conv.inner = untag_ptr(obj);
56657         obj_conv.is_owned = ptr_is_owned(obj);
56658         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56659         obj_conv.is_owned = false;
56660         LDKCVec_u8Z ret_var = TxInitRbf_write(&obj_conv);
56661         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56662         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56663         CVec_u8Z_free(ret_var);
56664         return ret_arr;
56665 }
56666
56667 int64_t  CS_LDK_TxInitRbf_read(int8_tArray ser) {
56668         LDKu8slice ser_ref;
56669         ser_ref.datalen = ser->arr_len;
56670         ser_ref.data = ser->elems;
56671         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
56672         *ret_conv = TxInitRbf_read(ser_ref);
56673         FREE(ser);
56674         return tag_ptr(ret_conv, true);
56675 }
56676
56677 int8_tArray  CS_LDK_TxAckRbf_write(int64_t obj) {
56678         LDKTxAckRbf obj_conv;
56679         obj_conv.inner = untag_ptr(obj);
56680         obj_conv.is_owned = ptr_is_owned(obj);
56681         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56682         obj_conv.is_owned = false;
56683         LDKCVec_u8Z ret_var = TxAckRbf_write(&obj_conv);
56684         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56685         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56686         CVec_u8Z_free(ret_var);
56687         return ret_arr;
56688 }
56689
56690 int64_t  CS_LDK_TxAckRbf_read(int8_tArray ser) {
56691         LDKu8slice ser_ref;
56692         ser_ref.datalen = ser->arr_len;
56693         ser_ref.data = ser->elems;
56694         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
56695         *ret_conv = TxAckRbf_read(ser_ref);
56696         FREE(ser);
56697         return tag_ptr(ret_conv, true);
56698 }
56699
56700 int8_tArray  CS_LDK_TxAbort_write(int64_t obj) {
56701         LDKTxAbort obj_conv;
56702         obj_conv.inner = untag_ptr(obj);
56703         obj_conv.is_owned = ptr_is_owned(obj);
56704         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56705         obj_conv.is_owned = false;
56706         LDKCVec_u8Z ret_var = TxAbort_write(&obj_conv);
56707         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56708         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56709         CVec_u8Z_free(ret_var);
56710         return ret_arr;
56711 }
56712
56713 int64_t  CS_LDK_TxAbort_read(int8_tArray ser) {
56714         LDKu8slice ser_ref;
56715         ser_ref.datalen = ser->arr_len;
56716         ser_ref.data = ser->elems;
56717         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
56718         *ret_conv = TxAbort_read(ser_ref);
56719         FREE(ser);
56720         return tag_ptr(ret_conv, true);
56721 }
56722
56723 int8_tArray  CS_LDK_AnnouncementSignatures_write(int64_t obj) {
56724         LDKAnnouncementSignatures obj_conv;
56725         obj_conv.inner = untag_ptr(obj);
56726         obj_conv.is_owned = ptr_is_owned(obj);
56727         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56728         obj_conv.is_owned = false;
56729         LDKCVec_u8Z ret_var = AnnouncementSignatures_write(&obj_conv);
56730         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56731         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56732         CVec_u8Z_free(ret_var);
56733         return ret_arr;
56734 }
56735
56736 int64_t  CS_LDK_AnnouncementSignatures_read(int8_tArray ser) {
56737         LDKu8slice ser_ref;
56738         ser_ref.datalen = ser->arr_len;
56739         ser_ref.data = ser->elems;
56740         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
56741         *ret_conv = AnnouncementSignatures_read(ser_ref);
56742         FREE(ser);
56743         return tag_ptr(ret_conv, true);
56744 }
56745
56746 int8_tArray  CS_LDK_ChannelReestablish_write(int64_t obj) {
56747         LDKChannelReestablish obj_conv;
56748         obj_conv.inner = untag_ptr(obj);
56749         obj_conv.is_owned = ptr_is_owned(obj);
56750         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56751         obj_conv.is_owned = false;
56752         LDKCVec_u8Z ret_var = ChannelReestablish_write(&obj_conv);
56753         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56754         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56755         CVec_u8Z_free(ret_var);
56756         return ret_arr;
56757 }
56758
56759 int64_t  CS_LDK_ChannelReestablish_read(int8_tArray ser) {
56760         LDKu8slice ser_ref;
56761         ser_ref.datalen = ser->arr_len;
56762         ser_ref.data = ser->elems;
56763         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
56764         *ret_conv = ChannelReestablish_read(ser_ref);
56765         FREE(ser);
56766         return tag_ptr(ret_conv, true);
56767 }
56768
56769 int8_tArray  CS_LDK_ClosingSigned_write(int64_t obj) {
56770         LDKClosingSigned obj_conv;
56771         obj_conv.inner = untag_ptr(obj);
56772         obj_conv.is_owned = ptr_is_owned(obj);
56773         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56774         obj_conv.is_owned = false;
56775         LDKCVec_u8Z ret_var = ClosingSigned_write(&obj_conv);
56776         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56777         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56778         CVec_u8Z_free(ret_var);
56779         return ret_arr;
56780 }
56781
56782 int64_t  CS_LDK_ClosingSigned_read(int8_tArray ser) {
56783         LDKu8slice ser_ref;
56784         ser_ref.datalen = ser->arr_len;
56785         ser_ref.data = ser->elems;
56786         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
56787         *ret_conv = ClosingSigned_read(ser_ref);
56788         FREE(ser);
56789         return tag_ptr(ret_conv, true);
56790 }
56791
56792 int8_tArray  CS_LDK_ClosingSignedFeeRange_write(int64_t obj) {
56793         LDKClosingSignedFeeRange obj_conv;
56794         obj_conv.inner = untag_ptr(obj);
56795         obj_conv.is_owned = ptr_is_owned(obj);
56796         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56797         obj_conv.is_owned = false;
56798         LDKCVec_u8Z ret_var = ClosingSignedFeeRange_write(&obj_conv);
56799         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56800         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56801         CVec_u8Z_free(ret_var);
56802         return ret_arr;
56803 }
56804
56805 int64_t  CS_LDK_ClosingSignedFeeRange_read(int8_tArray ser) {
56806         LDKu8slice ser_ref;
56807         ser_ref.datalen = ser->arr_len;
56808         ser_ref.data = ser->elems;
56809         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
56810         *ret_conv = ClosingSignedFeeRange_read(ser_ref);
56811         FREE(ser);
56812         return tag_ptr(ret_conv, true);
56813 }
56814
56815 int8_tArray  CS_LDK_CommitmentSigned_write(int64_t obj) {
56816         LDKCommitmentSigned obj_conv;
56817         obj_conv.inner = untag_ptr(obj);
56818         obj_conv.is_owned = ptr_is_owned(obj);
56819         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56820         obj_conv.is_owned = false;
56821         LDKCVec_u8Z ret_var = CommitmentSigned_write(&obj_conv);
56822         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56823         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56824         CVec_u8Z_free(ret_var);
56825         return ret_arr;
56826 }
56827
56828 int64_t  CS_LDK_CommitmentSigned_read(int8_tArray ser) {
56829         LDKu8slice ser_ref;
56830         ser_ref.datalen = ser->arr_len;
56831         ser_ref.data = ser->elems;
56832         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
56833         *ret_conv = CommitmentSigned_read(ser_ref);
56834         FREE(ser);
56835         return tag_ptr(ret_conv, true);
56836 }
56837
56838 int8_tArray  CS_LDK_FundingCreated_write(int64_t obj) {
56839         LDKFundingCreated obj_conv;
56840         obj_conv.inner = untag_ptr(obj);
56841         obj_conv.is_owned = ptr_is_owned(obj);
56842         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56843         obj_conv.is_owned = false;
56844         LDKCVec_u8Z ret_var = FundingCreated_write(&obj_conv);
56845         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56846         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56847         CVec_u8Z_free(ret_var);
56848         return ret_arr;
56849 }
56850
56851 int64_t  CS_LDK_FundingCreated_read(int8_tArray ser) {
56852         LDKu8slice ser_ref;
56853         ser_ref.datalen = ser->arr_len;
56854         ser_ref.data = ser->elems;
56855         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
56856         *ret_conv = FundingCreated_read(ser_ref);
56857         FREE(ser);
56858         return tag_ptr(ret_conv, true);
56859 }
56860
56861 int8_tArray  CS_LDK_FundingSigned_write(int64_t obj) {
56862         LDKFundingSigned obj_conv;
56863         obj_conv.inner = untag_ptr(obj);
56864         obj_conv.is_owned = ptr_is_owned(obj);
56865         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56866         obj_conv.is_owned = false;
56867         LDKCVec_u8Z ret_var = FundingSigned_write(&obj_conv);
56868         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56869         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56870         CVec_u8Z_free(ret_var);
56871         return ret_arr;
56872 }
56873
56874 int64_t  CS_LDK_FundingSigned_read(int8_tArray ser) {
56875         LDKu8slice ser_ref;
56876         ser_ref.datalen = ser->arr_len;
56877         ser_ref.data = ser->elems;
56878         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
56879         *ret_conv = FundingSigned_read(ser_ref);
56880         FREE(ser);
56881         return tag_ptr(ret_conv, true);
56882 }
56883
56884 int8_tArray  CS_LDK_ChannelReady_write(int64_t obj) {
56885         LDKChannelReady obj_conv;
56886         obj_conv.inner = untag_ptr(obj);
56887         obj_conv.is_owned = ptr_is_owned(obj);
56888         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56889         obj_conv.is_owned = false;
56890         LDKCVec_u8Z ret_var = ChannelReady_write(&obj_conv);
56891         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56892         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56893         CVec_u8Z_free(ret_var);
56894         return ret_arr;
56895 }
56896
56897 int64_t  CS_LDK_ChannelReady_read(int8_tArray ser) {
56898         LDKu8slice ser_ref;
56899         ser_ref.datalen = ser->arr_len;
56900         ser_ref.data = ser->elems;
56901         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
56902         *ret_conv = ChannelReady_read(ser_ref);
56903         FREE(ser);
56904         return tag_ptr(ret_conv, true);
56905 }
56906
56907 int8_tArray  CS_LDK_Init_write(int64_t obj) {
56908         LDKInit obj_conv;
56909         obj_conv.inner = untag_ptr(obj);
56910         obj_conv.is_owned = ptr_is_owned(obj);
56911         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56912         obj_conv.is_owned = false;
56913         LDKCVec_u8Z ret_var = Init_write(&obj_conv);
56914         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56915         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56916         CVec_u8Z_free(ret_var);
56917         return ret_arr;
56918 }
56919
56920 int64_t  CS_LDK_Init_read(int8_tArray ser) {
56921         LDKu8slice ser_ref;
56922         ser_ref.datalen = ser->arr_len;
56923         ser_ref.data = ser->elems;
56924         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
56925         *ret_conv = Init_read(ser_ref);
56926         FREE(ser);
56927         return tag_ptr(ret_conv, true);
56928 }
56929
56930 int8_tArray  CS_LDK_OpenChannel_write(int64_t obj) {
56931         LDKOpenChannel obj_conv;
56932         obj_conv.inner = untag_ptr(obj);
56933         obj_conv.is_owned = ptr_is_owned(obj);
56934         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56935         obj_conv.is_owned = false;
56936         LDKCVec_u8Z ret_var = OpenChannel_write(&obj_conv);
56937         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56938         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56939         CVec_u8Z_free(ret_var);
56940         return ret_arr;
56941 }
56942
56943 int64_t  CS_LDK_OpenChannel_read(int8_tArray ser) {
56944         LDKu8slice ser_ref;
56945         ser_ref.datalen = ser->arr_len;
56946         ser_ref.data = ser->elems;
56947         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
56948         *ret_conv = OpenChannel_read(ser_ref);
56949         FREE(ser);
56950         return tag_ptr(ret_conv, true);
56951 }
56952
56953 int8_tArray  CS_LDK_OpenChannelV2_write(int64_t obj) {
56954         LDKOpenChannelV2 obj_conv;
56955         obj_conv.inner = untag_ptr(obj);
56956         obj_conv.is_owned = ptr_is_owned(obj);
56957         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56958         obj_conv.is_owned = false;
56959         LDKCVec_u8Z ret_var = OpenChannelV2_write(&obj_conv);
56960         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56961         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56962         CVec_u8Z_free(ret_var);
56963         return ret_arr;
56964 }
56965
56966 int64_t  CS_LDK_OpenChannelV2_read(int8_tArray ser) {
56967         LDKu8slice ser_ref;
56968         ser_ref.datalen = ser->arr_len;
56969         ser_ref.data = ser->elems;
56970         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
56971         *ret_conv = OpenChannelV2_read(ser_ref);
56972         FREE(ser);
56973         return tag_ptr(ret_conv, true);
56974 }
56975
56976 int8_tArray  CS_LDK_RevokeAndACK_write(int64_t obj) {
56977         LDKRevokeAndACK obj_conv;
56978         obj_conv.inner = untag_ptr(obj);
56979         obj_conv.is_owned = ptr_is_owned(obj);
56980         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56981         obj_conv.is_owned = false;
56982         LDKCVec_u8Z ret_var = RevokeAndACK_write(&obj_conv);
56983         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56984         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56985         CVec_u8Z_free(ret_var);
56986         return ret_arr;
56987 }
56988
56989 int64_t  CS_LDK_RevokeAndACK_read(int8_tArray ser) {
56990         LDKu8slice ser_ref;
56991         ser_ref.datalen = ser->arr_len;
56992         ser_ref.data = ser->elems;
56993         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
56994         *ret_conv = RevokeAndACK_read(ser_ref);
56995         FREE(ser);
56996         return tag_ptr(ret_conv, true);
56997 }
56998
56999 int8_tArray  CS_LDK_Shutdown_write(int64_t obj) {
57000         LDKShutdown obj_conv;
57001         obj_conv.inner = untag_ptr(obj);
57002         obj_conv.is_owned = ptr_is_owned(obj);
57003         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57004         obj_conv.is_owned = false;
57005         LDKCVec_u8Z ret_var = Shutdown_write(&obj_conv);
57006         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
57007         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
57008         CVec_u8Z_free(ret_var);
57009         return ret_arr;
57010 }
57011
57012 int64_t  CS_LDK_Shutdown_read(int8_tArray ser) {
57013         LDKu8slice ser_ref;
57014         ser_ref.datalen = ser->arr_len;
57015         ser_ref.data = ser->elems;
57016         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
57017         *ret_conv = Shutdown_read(ser_ref);
57018         FREE(ser);
57019         return tag_ptr(ret_conv, true);
57020 }
57021
57022 int8_tArray  CS_LDK_UpdateFailHTLC_write(int64_t obj) {
57023         LDKUpdateFailHTLC obj_conv;
57024         obj_conv.inner = untag_ptr(obj);
57025         obj_conv.is_owned = ptr_is_owned(obj);
57026         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57027         obj_conv.is_owned = false;
57028         LDKCVec_u8Z ret_var = UpdateFailHTLC_write(&obj_conv);
57029         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
57030         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
57031         CVec_u8Z_free(ret_var);
57032         return ret_arr;
57033 }
57034
57035 int64_t  CS_LDK_UpdateFailHTLC_read(int8_tArray ser) {
57036         LDKu8slice ser_ref;
57037         ser_ref.datalen = ser->arr_len;
57038         ser_ref.data = ser->elems;
57039         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
57040         *ret_conv = UpdateFailHTLC_read(ser_ref);
57041         FREE(ser);
57042         return tag_ptr(ret_conv, true);
57043 }
57044
57045 int8_tArray  CS_LDK_UpdateFailMalformedHTLC_write(int64_t obj) {
57046         LDKUpdateFailMalformedHTLC obj_conv;
57047         obj_conv.inner = untag_ptr(obj);
57048         obj_conv.is_owned = ptr_is_owned(obj);
57049         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57050         obj_conv.is_owned = false;
57051         LDKCVec_u8Z ret_var = UpdateFailMalformedHTLC_write(&obj_conv);
57052         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
57053         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
57054         CVec_u8Z_free(ret_var);
57055         return ret_arr;
57056 }
57057
57058 int64_t  CS_LDK_UpdateFailMalformedHTLC_read(int8_tArray ser) {
57059         LDKu8slice ser_ref;
57060         ser_ref.datalen = ser->arr_len;
57061         ser_ref.data = ser->elems;
57062         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
57063         *ret_conv = UpdateFailMalformedHTLC_read(ser_ref);
57064         FREE(ser);
57065         return tag_ptr(ret_conv, true);
57066 }
57067
57068 int8_tArray  CS_LDK_UpdateFee_write(int64_t obj) {
57069         LDKUpdateFee obj_conv;
57070         obj_conv.inner = untag_ptr(obj);
57071         obj_conv.is_owned = ptr_is_owned(obj);
57072         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57073         obj_conv.is_owned = false;
57074         LDKCVec_u8Z ret_var = UpdateFee_write(&obj_conv);
57075         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
57076         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
57077         CVec_u8Z_free(ret_var);
57078         return ret_arr;
57079 }
57080
57081 int64_t  CS_LDK_UpdateFee_read(int8_tArray ser) {
57082         LDKu8slice ser_ref;
57083         ser_ref.datalen = ser->arr_len;
57084         ser_ref.data = ser->elems;
57085         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
57086         *ret_conv = UpdateFee_read(ser_ref);
57087         FREE(ser);
57088         return tag_ptr(ret_conv, true);
57089 }
57090
57091 int8_tArray  CS_LDK_UpdateFulfillHTLC_write(int64_t obj) {
57092         LDKUpdateFulfillHTLC obj_conv;
57093         obj_conv.inner = untag_ptr(obj);
57094         obj_conv.is_owned = ptr_is_owned(obj);
57095         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57096         obj_conv.is_owned = false;
57097         LDKCVec_u8Z ret_var = UpdateFulfillHTLC_write(&obj_conv);
57098         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
57099         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
57100         CVec_u8Z_free(ret_var);
57101         return ret_arr;
57102 }
57103
57104 int64_t  CS_LDK_UpdateFulfillHTLC_read(int8_tArray ser) {
57105         LDKu8slice ser_ref;
57106         ser_ref.datalen = ser->arr_len;
57107         ser_ref.data = ser->elems;
57108         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
57109         *ret_conv = UpdateFulfillHTLC_read(ser_ref);
57110         FREE(ser);
57111         return tag_ptr(ret_conv, true);
57112 }
57113
57114 int8_tArray  CS_LDK_OnionPacket_write(int64_t obj) {
57115         LDKOnionPacket obj_conv;
57116         obj_conv.inner = untag_ptr(obj);
57117         obj_conv.is_owned = ptr_is_owned(obj);
57118         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57119         obj_conv.is_owned = false;
57120         LDKCVec_u8Z ret_var = OnionPacket_write(&obj_conv);
57121         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
57122         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
57123         CVec_u8Z_free(ret_var);
57124         return ret_arr;
57125 }
57126
57127 int64_t  CS_LDK_OnionPacket_read(int8_tArray ser) {
57128         LDKu8slice ser_ref;
57129         ser_ref.datalen = ser->arr_len;
57130         ser_ref.data = ser->elems;
57131         LDKCResult_OnionPacketDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionPacketDecodeErrorZ), "LDKCResult_OnionPacketDecodeErrorZ");
57132         *ret_conv = OnionPacket_read(ser_ref);
57133         FREE(ser);
57134         return tag_ptr(ret_conv, true);
57135 }
57136
57137 int8_tArray  CS_LDK_UpdateAddHTLC_write(int64_t obj) {
57138         LDKUpdateAddHTLC obj_conv;
57139         obj_conv.inner = untag_ptr(obj);
57140         obj_conv.is_owned = ptr_is_owned(obj);
57141         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57142         obj_conv.is_owned = false;
57143         LDKCVec_u8Z ret_var = UpdateAddHTLC_write(&obj_conv);
57144         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
57145         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
57146         CVec_u8Z_free(ret_var);
57147         return ret_arr;
57148 }
57149
57150 int64_t  CS_LDK_UpdateAddHTLC_read(int8_tArray ser) {
57151         LDKu8slice ser_ref;
57152         ser_ref.datalen = ser->arr_len;
57153         ser_ref.data = ser->elems;
57154         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
57155         *ret_conv = UpdateAddHTLC_read(ser_ref);
57156         FREE(ser);
57157         return tag_ptr(ret_conv, true);
57158 }
57159
57160 int64_t  CS_LDK_OnionMessage_read(int8_tArray ser) {
57161         LDKu8slice ser_ref;
57162         ser_ref.datalen = ser->arr_len;
57163         ser_ref.data = ser->elems;
57164         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
57165         *ret_conv = OnionMessage_read(ser_ref);
57166         FREE(ser);
57167         return tag_ptr(ret_conv, true);
57168 }
57169
57170 int8_tArray  CS_LDK_OnionMessage_write(int64_t obj) {
57171         LDKOnionMessage obj_conv;
57172         obj_conv.inner = untag_ptr(obj);
57173         obj_conv.is_owned = ptr_is_owned(obj);
57174         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57175         obj_conv.is_owned = false;
57176         LDKCVec_u8Z ret_var = OnionMessage_write(&obj_conv);
57177         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
57178         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
57179         CVec_u8Z_free(ret_var);
57180         return ret_arr;
57181 }
57182
57183 int8_tArray  CS_LDK_FinalOnionHopData_write(int64_t obj) {
57184         LDKFinalOnionHopData obj_conv;
57185         obj_conv.inner = untag_ptr(obj);
57186         obj_conv.is_owned = ptr_is_owned(obj);
57187         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57188         obj_conv.is_owned = false;
57189         LDKCVec_u8Z ret_var = FinalOnionHopData_write(&obj_conv);
57190         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
57191         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
57192         CVec_u8Z_free(ret_var);
57193         return ret_arr;
57194 }
57195
57196 int64_t  CS_LDK_FinalOnionHopData_read(int8_tArray ser) {
57197         LDKu8slice ser_ref;
57198         ser_ref.datalen = ser->arr_len;
57199         ser_ref.data = ser->elems;
57200         LDKCResult_FinalOnionHopDataDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FinalOnionHopDataDecodeErrorZ), "LDKCResult_FinalOnionHopDataDecodeErrorZ");
57201         *ret_conv = FinalOnionHopData_read(ser_ref);
57202         FREE(ser);
57203         return tag_ptr(ret_conv, true);
57204 }
57205
57206 int8_tArray  CS_LDK_Ping_write(int64_t obj) {
57207         LDKPing obj_conv;
57208         obj_conv.inner = untag_ptr(obj);
57209         obj_conv.is_owned = ptr_is_owned(obj);
57210         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57211         obj_conv.is_owned = false;
57212         LDKCVec_u8Z ret_var = Ping_write(&obj_conv);
57213         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
57214         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
57215         CVec_u8Z_free(ret_var);
57216         return ret_arr;
57217 }
57218
57219 int64_t  CS_LDK_Ping_read(int8_tArray ser) {
57220         LDKu8slice ser_ref;
57221         ser_ref.datalen = ser->arr_len;
57222         ser_ref.data = ser->elems;
57223         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
57224         *ret_conv = Ping_read(ser_ref);
57225         FREE(ser);
57226         return tag_ptr(ret_conv, true);
57227 }
57228
57229 int8_tArray  CS_LDK_Pong_write(int64_t obj) {
57230         LDKPong obj_conv;
57231         obj_conv.inner = untag_ptr(obj);
57232         obj_conv.is_owned = ptr_is_owned(obj);
57233         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57234         obj_conv.is_owned = false;
57235         LDKCVec_u8Z ret_var = Pong_write(&obj_conv);
57236         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
57237         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
57238         CVec_u8Z_free(ret_var);
57239         return ret_arr;
57240 }
57241
57242 int64_t  CS_LDK_Pong_read(int8_tArray ser) {
57243         LDKu8slice ser_ref;
57244         ser_ref.datalen = ser->arr_len;
57245         ser_ref.data = ser->elems;
57246         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
57247         *ret_conv = Pong_read(ser_ref);
57248         FREE(ser);
57249         return tag_ptr(ret_conv, true);
57250 }
57251
57252 int8_tArray  CS_LDK_UnsignedChannelAnnouncement_write(int64_t obj) {
57253         LDKUnsignedChannelAnnouncement obj_conv;
57254         obj_conv.inner = untag_ptr(obj);
57255         obj_conv.is_owned = ptr_is_owned(obj);
57256         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57257         obj_conv.is_owned = false;
57258         LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_write(&obj_conv);
57259         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
57260         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
57261         CVec_u8Z_free(ret_var);
57262         return ret_arr;
57263 }
57264
57265 int64_t  CS_LDK_UnsignedChannelAnnouncement_read(int8_tArray ser) {
57266         LDKu8slice ser_ref;
57267         ser_ref.datalen = ser->arr_len;
57268         ser_ref.data = ser->elems;
57269         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
57270         *ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
57271         FREE(ser);
57272         return tag_ptr(ret_conv, true);
57273 }
57274
57275 int8_tArray  CS_LDK_ChannelAnnouncement_write(int64_t obj) {
57276         LDKChannelAnnouncement obj_conv;
57277         obj_conv.inner = untag_ptr(obj);
57278         obj_conv.is_owned = ptr_is_owned(obj);
57279         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57280         obj_conv.is_owned = false;
57281         LDKCVec_u8Z ret_var = ChannelAnnouncement_write(&obj_conv);
57282         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
57283         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
57284         CVec_u8Z_free(ret_var);
57285         return ret_arr;
57286 }
57287
57288 int64_t  CS_LDK_ChannelAnnouncement_read(int8_tArray ser) {
57289         LDKu8slice ser_ref;
57290         ser_ref.datalen = ser->arr_len;
57291         ser_ref.data = ser->elems;
57292         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
57293         *ret_conv = ChannelAnnouncement_read(ser_ref);
57294         FREE(ser);
57295         return tag_ptr(ret_conv, true);
57296 }
57297
57298 int8_tArray  CS_LDK_UnsignedChannelUpdate_write(int64_t obj) {
57299         LDKUnsignedChannelUpdate obj_conv;
57300         obj_conv.inner = untag_ptr(obj);
57301         obj_conv.is_owned = ptr_is_owned(obj);
57302         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57303         obj_conv.is_owned = false;
57304         LDKCVec_u8Z ret_var = UnsignedChannelUpdate_write(&obj_conv);
57305         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
57306         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
57307         CVec_u8Z_free(ret_var);
57308         return ret_arr;
57309 }
57310
57311 int64_t  CS_LDK_UnsignedChannelUpdate_read(int8_tArray ser) {
57312         LDKu8slice ser_ref;
57313         ser_ref.datalen = ser->arr_len;
57314         ser_ref.data = ser->elems;
57315         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
57316         *ret_conv = UnsignedChannelUpdate_read(ser_ref);
57317         FREE(ser);
57318         return tag_ptr(ret_conv, true);
57319 }
57320
57321 int8_tArray  CS_LDK_ChannelUpdate_write(int64_t obj) {
57322         LDKChannelUpdate obj_conv;
57323         obj_conv.inner = untag_ptr(obj);
57324         obj_conv.is_owned = ptr_is_owned(obj);
57325         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57326         obj_conv.is_owned = false;
57327         LDKCVec_u8Z ret_var = ChannelUpdate_write(&obj_conv);
57328         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
57329         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
57330         CVec_u8Z_free(ret_var);
57331         return ret_arr;
57332 }
57333
57334 int64_t  CS_LDK_ChannelUpdate_read(int8_tArray ser) {
57335         LDKu8slice ser_ref;
57336         ser_ref.datalen = ser->arr_len;
57337         ser_ref.data = ser->elems;
57338         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
57339         *ret_conv = ChannelUpdate_read(ser_ref);
57340         FREE(ser);
57341         return tag_ptr(ret_conv, true);
57342 }
57343
57344 int8_tArray  CS_LDK_ErrorMessage_write(int64_t obj) {
57345         LDKErrorMessage obj_conv;
57346         obj_conv.inner = untag_ptr(obj);
57347         obj_conv.is_owned = ptr_is_owned(obj);
57348         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57349         obj_conv.is_owned = false;
57350         LDKCVec_u8Z ret_var = ErrorMessage_write(&obj_conv);
57351         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
57352         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
57353         CVec_u8Z_free(ret_var);
57354         return ret_arr;
57355 }
57356
57357 int64_t  CS_LDK_ErrorMessage_read(int8_tArray ser) {
57358         LDKu8slice ser_ref;
57359         ser_ref.datalen = ser->arr_len;
57360         ser_ref.data = ser->elems;
57361         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
57362         *ret_conv = ErrorMessage_read(ser_ref);
57363         FREE(ser);
57364         return tag_ptr(ret_conv, true);
57365 }
57366
57367 int8_tArray  CS_LDK_WarningMessage_write(int64_t obj) {
57368         LDKWarningMessage obj_conv;
57369         obj_conv.inner = untag_ptr(obj);
57370         obj_conv.is_owned = ptr_is_owned(obj);
57371         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57372         obj_conv.is_owned = false;
57373         LDKCVec_u8Z ret_var = WarningMessage_write(&obj_conv);
57374         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
57375         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
57376         CVec_u8Z_free(ret_var);
57377         return ret_arr;
57378 }
57379
57380 int64_t  CS_LDK_WarningMessage_read(int8_tArray ser) {
57381         LDKu8slice ser_ref;
57382         ser_ref.datalen = ser->arr_len;
57383         ser_ref.data = ser->elems;
57384         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
57385         *ret_conv = WarningMessage_read(ser_ref);
57386         FREE(ser);
57387         return tag_ptr(ret_conv, true);
57388 }
57389
57390 int8_tArray  CS_LDK_UnsignedNodeAnnouncement_write(int64_t obj) {
57391         LDKUnsignedNodeAnnouncement obj_conv;
57392         obj_conv.inner = untag_ptr(obj);
57393         obj_conv.is_owned = ptr_is_owned(obj);
57394         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57395         obj_conv.is_owned = false;
57396         LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_write(&obj_conv);
57397         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
57398         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
57399         CVec_u8Z_free(ret_var);
57400         return ret_arr;
57401 }
57402
57403 int64_t  CS_LDK_UnsignedNodeAnnouncement_read(int8_tArray ser) {
57404         LDKu8slice ser_ref;
57405         ser_ref.datalen = ser->arr_len;
57406         ser_ref.data = ser->elems;
57407         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
57408         *ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
57409         FREE(ser);
57410         return tag_ptr(ret_conv, true);
57411 }
57412
57413 int8_tArray  CS_LDK_NodeAnnouncement_write(int64_t obj) {
57414         LDKNodeAnnouncement obj_conv;
57415         obj_conv.inner = untag_ptr(obj);
57416         obj_conv.is_owned = ptr_is_owned(obj);
57417         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57418         obj_conv.is_owned = false;
57419         LDKCVec_u8Z ret_var = NodeAnnouncement_write(&obj_conv);
57420         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
57421         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
57422         CVec_u8Z_free(ret_var);
57423         return ret_arr;
57424 }
57425
57426 int64_t  CS_LDK_NodeAnnouncement_read(int8_tArray ser) {
57427         LDKu8slice ser_ref;
57428         ser_ref.datalen = ser->arr_len;
57429         ser_ref.data = ser->elems;
57430         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
57431         *ret_conv = NodeAnnouncement_read(ser_ref);
57432         FREE(ser);
57433         return tag_ptr(ret_conv, true);
57434 }
57435
57436 int64_t  CS_LDK_QueryShortChannelIds_read(int8_tArray ser) {
57437         LDKu8slice ser_ref;
57438         ser_ref.datalen = ser->arr_len;
57439         ser_ref.data = ser->elems;
57440         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
57441         *ret_conv = QueryShortChannelIds_read(ser_ref);
57442         FREE(ser);
57443         return tag_ptr(ret_conv, true);
57444 }
57445
57446 int8_tArray  CS_LDK_QueryShortChannelIds_write(int64_t obj) {
57447         LDKQueryShortChannelIds obj_conv;
57448         obj_conv.inner = untag_ptr(obj);
57449         obj_conv.is_owned = ptr_is_owned(obj);
57450         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57451         obj_conv.is_owned = false;
57452         LDKCVec_u8Z ret_var = QueryShortChannelIds_write(&obj_conv);
57453         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
57454         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
57455         CVec_u8Z_free(ret_var);
57456         return ret_arr;
57457 }
57458
57459 int8_tArray  CS_LDK_ReplyShortChannelIdsEnd_write(int64_t obj) {
57460         LDKReplyShortChannelIdsEnd obj_conv;
57461         obj_conv.inner = untag_ptr(obj);
57462         obj_conv.is_owned = ptr_is_owned(obj);
57463         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57464         obj_conv.is_owned = false;
57465         LDKCVec_u8Z ret_var = ReplyShortChannelIdsEnd_write(&obj_conv);
57466         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
57467         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
57468         CVec_u8Z_free(ret_var);
57469         return ret_arr;
57470 }
57471
57472 int64_t  CS_LDK_ReplyShortChannelIdsEnd_read(int8_tArray ser) {
57473         LDKu8slice ser_ref;
57474         ser_ref.datalen = ser->arr_len;
57475         ser_ref.data = ser->elems;
57476         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
57477         *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
57478         FREE(ser);
57479         return tag_ptr(ret_conv, true);
57480 }
57481
57482 int32_t  CS_LDK_QueryChannelRange_end_blocknum(int64_t this_arg) {
57483         LDKQueryChannelRange this_arg_conv;
57484         this_arg_conv.inner = untag_ptr(this_arg);
57485         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57486         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57487         this_arg_conv.is_owned = false;
57488         int32_t ret_conv = QueryChannelRange_end_blocknum(&this_arg_conv);
57489         return ret_conv;
57490 }
57491
57492 int8_tArray  CS_LDK_QueryChannelRange_write(int64_t obj) {
57493         LDKQueryChannelRange obj_conv;
57494         obj_conv.inner = untag_ptr(obj);
57495         obj_conv.is_owned = ptr_is_owned(obj);
57496         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57497         obj_conv.is_owned = false;
57498         LDKCVec_u8Z ret_var = QueryChannelRange_write(&obj_conv);
57499         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
57500         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
57501         CVec_u8Z_free(ret_var);
57502         return ret_arr;
57503 }
57504
57505 int64_t  CS_LDK_QueryChannelRange_read(int8_tArray ser) {
57506         LDKu8slice ser_ref;
57507         ser_ref.datalen = ser->arr_len;
57508         ser_ref.data = ser->elems;
57509         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
57510         *ret_conv = QueryChannelRange_read(ser_ref);
57511         FREE(ser);
57512         return tag_ptr(ret_conv, true);
57513 }
57514
57515 int64_t  CS_LDK_ReplyChannelRange_read(int8_tArray ser) {
57516         LDKu8slice ser_ref;
57517         ser_ref.datalen = ser->arr_len;
57518         ser_ref.data = ser->elems;
57519         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
57520         *ret_conv = ReplyChannelRange_read(ser_ref);
57521         FREE(ser);
57522         return tag_ptr(ret_conv, true);
57523 }
57524
57525 int8_tArray  CS_LDK_ReplyChannelRange_write(int64_t obj) {
57526         LDKReplyChannelRange obj_conv;
57527         obj_conv.inner = untag_ptr(obj);
57528         obj_conv.is_owned = ptr_is_owned(obj);
57529         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57530         obj_conv.is_owned = false;
57531         LDKCVec_u8Z ret_var = ReplyChannelRange_write(&obj_conv);
57532         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
57533         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
57534         CVec_u8Z_free(ret_var);
57535         return ret_arr;
57536 }
57537
57538 int8_tArray  CS_LDK_GossipTimestampFilter_write(int64_t obj) {
57539         LDKGossipTimestampFilter obj_conv;
57540         obj_conv.inner = untag_ptr(obj);
57541         obj_conv.is_owned = ptr_is_owned(obj);
57542         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57543         obj_conv.is_owned = false;
57544         LDKCVec_u8Z ret_var = GossipTimestampFilter_write(&obj_conv);
57545         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
57546         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
57547         CVec_u8Z_free(ret_var);
57548         return ret_arr;
57549 }
57550
57551 int64_t  CS_LDK_GossipTimestampFilter_read(int8_tArray ser) {
57552         LDKu8slice ser_ref;
57553         ser_ref.datalen = ser->arr_len;
57554         ser_ref.data = ser->elems;
57555         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
57556         *ret_conv = GossipTimestampFilter_read(ser_ref);
57557         FREE(ser);
57558         return tag_ptr(ret_conv, true);
57559 }
57560
57561 void  CS_LDK_CustomMessageHandler_free(int64_t this_ptr) {
57562         if (!ptr_is_owned(this_ptr)) return;
57563         void* this_ptr_ptr = untag_ptr(this_ptr);
57564         CHECK_ACCESS(this_ptr_ptr);
57565         LDKCustomMessageHandler this_ptr_conv = *(LDKCustomMessageHandler*)(this_ptr_ptr);
57566         FREE(untag_ptr(this_ptr));
57567         CustomMessageHandler_free(this_ptr_conv);
57568 }
57569
57570 void  CS_LDK_IgnoringMessageHandler_free(int64_t this_obj) {
57571         LDKIgnoringMessageHandler this_obj_conv;
57572         this_obj_conv.inner = untag_ptr(this_obj);
57573         this_obj_conv.is_owned = ptr_is_owned(this_obj);
57574         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
57575         IgnoringMessageHandler_free(this_obj_conv);
57576 }
57577
57578 int64_t  CS_LDK_IgnoringMessageHandler_new() {
57579         LDKIgnoringMessageHandler ret_var = IgnoringMessageHandler_new();
57580         int64_t ret_ref = 0;
57581         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57582         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57583         return ret_ref;
57584 }
57585
57586 int64_t  CS_LDK_IgnoringMessageHandler_as_EventsProvider(int64_t this_arg) {
57587         LDKIgnoringMessageHandler this_arg_conv;
57588         this_arg_conv.inner = untag_ptr(this_arg);
57589         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57590         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57591         this_arg_conv.is_owned = false;
57592         LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
57593         *ret_ret = IgnoringMessageHandler_as_EventsProvider(&this_arg_conv);
57594         return tag_ptr(ret_ret, true);
57595 }
57596
57597 int64_t  CS_LDK_IgnoringMessageHandler_as_MessageSendEventsProvider(int64_t this_arg) {
57598         LDKIgnoringMessageHandler this_arg_conv;
57599         this_arg_conv.inner = untag_ptr(this_arg);
57600         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57601         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57602         this_arg_conv.is_owned = false;
57603         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
57604         *ret_ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
57605         return tag_ptr(ret_ret, true);
57606 }
57607
57608 int64_t  CS_LDK_IgnoringMessageHandler_as_RoutingMessageHandler(int64_t this_arg) {
57609         LDKIgnoringMessageHandler this_arg_conv;
57610         this_arg_conv.inner = untag_ptr(this_arg);
57611         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57612         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57613         this_arg_conv.is_owned = false;
57614         LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
57615         *ret_ret = IgnoringMessageHandler_as_RoutingMessageHandler(&this_arg_conv);
57616         return tag_ptr(ret_ret, true);
57617 }
57618
57619 int64_t  CS_LDK_IgnoringMessageHandler_as_OnionMessageHandler(int64_t this_arg) {
57620         LDKIgnoringMessageHandler this_arg_conv;
57621         this_arg_conv.inner = untag_ptr(this_arg);
57622         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57623         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57624         this_arg_conv.is_owned = false;
57625         LDKOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
57626         *ret_ret = IgnoringMessageHandler_as_OnionMessageHandler(&this_arg_conv);
57627         return tag_ptr(ret_ret, true);
57628 }
57629
57630 int64_t  CS_LDK_IgnoringMessageHandler_as_OffersMessageHandler(int64_t this_arg) {
57631         LDKIgnoringMessageHandler this_arg_conv;
57632         this_arg_conv.inner = untag_ptr(this_arg);
57633         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57634         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57635         this_arg_conv.is_owned = false;
57636         LDKOffersMessageHandler* ret_ret = MALLOC(sizeof(LDKOffersMessageHandler), "LDKOffersMessageHandler");
57637         *ret_ret = IgnoringMessageHandler_as_OffersMessageHandler(&this_arg_conv);
57638         return tag_ptr(ret_ret, true);
57639 }
57640
57641 int64_t  CS_LDK_IgnoringMessageHandler_as_CustomOnionMessageHandler(int64_t this_arg) {
57642         LDKIgnoringMessageHandler this_arg_conv;
57643         this_arg_conv.inner = untag_ptr(this_arg);
57644         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57645         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57646         this_arg_conv.is_owned = false;
57647         LDKCustomOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKCustomOnionMessageHandler), "LDKCustomOnionMessageHandler");
57648         *ret_ret = IgnoringMessageHandler_as_CustomOnionMessageHandler(&this_arg_conv);
57649         return tag_ptr(ret_ret, true);
57650 }
57651
57652 int64_t  CS_LDK_IgnoringMessageHandler_as_CustomMessageReader(int64_t this_arg) {
57653         LDKIgnoringMessageHandler this_arg_conv;
57654         this_arg_conv.inner = untag_ptr(this_arg);
57655         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57656         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57657         this_arg_conv.is_owned = false;
57658         LDKCustomMessageReader* ret_ret = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
57659         *ret_ret = IgnoringMessageHandler_as_CustomMessageReader(&this_arg_conv);
57660         return tag_ptr(ret_ret, true);
57661 }
57662
57663 int64_t  CS_LDK_IgnoringMessageHandler_as_CustomMessageHandler(int64_t this_arg) {
57664         LDKIgnoringMessageHandler this_arg_conv;
57665         this_arg_conv.inner = untag_ptr(this_arg);
57666         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57667         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57668         this_arg_conv.is_owned = false;
57669         LDKCustomMessageHandler* ret_ret = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
57670         *ret_ret = IgnoringMessageHandler_as_CustomMessageHandler(&this_arg_conv);
57671         return tag_ptr(ret_ret, true);
57672 }
57673
57674 void  CS_LDK_ErroringMessageHandler_free(int64_t this_obj) {
57675         LDKErroringMessageHandler this_obj_conv;
57676         this_obj_conv.inner = untag_ptr(this_obj);
57677         this_obj_conv.is_owned = ptr_is_owned(this_obj);
57678         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
57679         ErroringMessageHandler_free(this_obj_conv);
57680 }
57681
57682 int64_t  CS_LDK_ErroringMessageHandler_new() {
57683         LDKErroringMessageHandler ret_var = ErroringMessageHandler_new();
57684         int64_t ret_ref = 0;
57685         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57686         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57687         return ret_ref;
57688 }
57689
57690 int64_t  CS_LDK_ErroringMessageHandler_as_MessageSendEventsProvider(int64_t this_arg) {
57691         LDKErroringMessageHandler this_arg_conv;
57692         this_arg_conv.inner = untag_ptr(this_arg);
57693         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57694         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57695         this_arg_conv.is_owned = false;
57696         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
57697         *ret_ret = ErroringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
57698         return tag_ptr(ret_ret, true);
57699 }
57700
57701 int64_t  CS_LDK_ErroringMessageHandler_as_ChannelMessageHandler(int64_t this_arg) {
57702         LDKErroringMessageHandler this_arg_conv;
57703         this_arg_conv.inner = untag_ptr(this_arg);
57704         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57705         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57706         this_arg_conv.is_owned = false;
57707         LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
57708         *ret_ret = ErroringMessageHandler_as_ChannelMessageHandler(&this_arg_conv);
57709         return tag_ptr(ret_ret, true);
57710 }
57711
57712 void  CS_LDK_MessageHandler_free(int64_t this_obj) {
57713         LDKMessageHandler this_obj_conv;
57714         this_obj_conv.inner = untag_ptr(this_obj);
57715         this_obj_conv.is_owned = ptr_is_owned(this_obj);
57716         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
57717         MessageHandler_free(this_obj_conv);
57718 }
57719
57720 int64_t  CS_LDK_MessageHandler_get_chan_handler(int64_t this_ptr) {
57721         LDKMessageHandler this_ptr_conv;
57722         this_ptr_conv.inner = untag_ptr(this_ptr);
57723         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57724         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57725         this_ptr_conv.is_owned = false;
57726         // WARNING: This object doesn't live past this scope, needs clone!
57727         int64_t ret_ret = tag_ptr(MessageHandler_get_chan_handler(&this_ptr_conv), false);
57728         return ret_ret;
57729 }
57730
57731 void  CS_LDK_MessageHandler_set_chan_handler(int64_t this_ptr, int64_t val) {
57732         LDKMessageHandler this_ptr_conv;
57733         this_ptr_conv.inner = untag_ptr(this_ptr);
57734         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57735         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57736         this_ptr_conv.is_owned = false;
57737         void* val_ptr = untag_ptr(val);
57738         CHECK_ACCESS(val_ptr);
57739         LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)(val_ptr);
57740         if (val_conv.free == LDKChannelMessageHandler_JCalls_free) {
57741                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
57742                 LDKChannelMessageHandler_JCalls_cloned(&val_conv);
57743         }
57744         MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
57745 }
57746
57747 int64_t  CS_LDK_MessageHandler_get_route_handler(int64_t this_ptr) {
57748         LDKMessageHandler this_ptr_conv;
57749         this_ptr_conv.inner = untag_ptr(this_ptr);
57750         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57751         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57752         this_ptr_conv.is_owned = false;
57753         // WARNING: This object doesn't live past this scope, needs clone!
57754         int64_t ret_ret = tag_ptr(MessageHandler_get_route_handler(&this_ptr_conv), false);
57755         return ret_ret;
57756 }
57757
57758 void  CS_LDK_MessageHandler_set_route_handler(int64_t this_ptr, int64_t val) {
57759         LDKMessageHandler this_ptr_conv;
57760         this_ptr_conv.inner = untag_ptr(this_ptr);
57761         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57762         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57763         this_ptr_conv.is_owned = false;
57764         void* val_ptr = untag_ptr(val);
57765         CHECK_ACCESS(val_ptr);
57766         LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)(val_ptr);
57767         if (val_conv.free == LDKRoutingMessageHandler_JCalls_free) {
57768                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
57769                 LDKRoutingMessageHandler_JCalls_cloned(&val_conv);
57770         }
57771         MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
57772 }
57773
57774 int64_t  CS_LDK_MessageHandler_get_onion_message_handler(int64_t this_ptr) {
57775         LDKMessageHandler this_ptr_conv;
57776         this_ptr_conv.inner = untag_ptr(this_ptr);
57777         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57778         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57779         this_ptr_conv.is_owned = false;
57780         // WARNING: This object doesn't live past this scope, needs clone!
57781         int64_t ret_ret = tag_ptr(MessageHandler_get_onion_message_handler(&this_ptr_conv), false);
57782         return ret_ret;
57783 }
57784
57785 void  CS_LDK_MessageHandler_set_onion_message_handler(int64_t this_ptr, int64_t val) {
57786         LDKMessageHandler this_ptr_conv;
57787         this_ptr_conv.inner = untag_ptr(this_ptr);
57788         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57789         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57790         this_ptr_conv.is_owned = false;
57791         void* val_ptr = untag_ptr(val);
57792         CHECK_ACCESS(val_ptr);
57793         LDKOnionMessageHandler val_conv = *(LDKOnionMessageHandler*)(val_ptr);
57794         if (val_conv.free == LDKOnionMessageHandler_JCalls_free) {
57795                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
57796                 LDKOnionMessageHandler_JCalls_cloned(&val_conv);
57797         }
57798         MessageHandler_set_onion_message_handler(&this_ptr_conv, val_conv);
57799 }
57800
57801 int64_t  CS_LDK_MessageHandler_get_custom_message_handler(int64_t this_ptr) {
57802         LDKMessageHandler this_ptr_conv;
57803         this_ptr_conv.inner = untag_ptr(this_ptr);
57804         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57805         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57806         this_ptr_conv.is_owned = false;
57807         // WARNING: This object doesn't live past this scope, needs clone!
57808         int64_t ret_ret = tag_ptr(MessageHandler_get_custom_message_handler(&this_ptr_conv), false);
57809         return ret_ret;
57810 }
57811
57812 void  CS_LDK_MessageHandler_set_custom_message_handler(int64_t this_ptr, int64_t val) {
57813         LDKMessageHandler this_ptr_conv;
57814         this_ptr_conv.inner = untag_ptr(this_ptr);
57815         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57816         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57817         this_ptr_conv.is_owned = false;
57818         void* val_ptr = untag_ptr(val);
57819         CHECK_ACCESS(val_ptr);
57820         LDKCustomMessageHandler val_conv = *(LDKCustomMessageHandler*)(val_ptr);
57821         if (val_conv.free == LDKCustomMessageHandler_JCalls_free) {
57822                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
57823                 LDKCustomMessageHandler_JCalls_cloned(&val_conv);
57824         }
57825         MessageHandler_set_custom_message_handler(&this_ptr_conv, val_conv);
57826 }
57827
57828 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) {
57829         void* chan_handler_arg_ptr = untag_ptr(chan_handler_arg);
57830         CHECK_ACCESS(chan_handler_arg_ptr);
57831         LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)(chan_handler_arg_ptr);
57832         if (chan_handler_arg_conv.free == LDKChannelMessageHandler_JCalls_free) {
57833                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
57834                 LDKChannelMessageHandler_JCalls_cloned(&chan_handler_arg_conv);
57835         }
57836         void* route_handler_arg_ptr = untag_ptr(route_handler_arg);
57837         CHECK_ACCESS(route_handler_arg_ptr);
57838         LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)(route_handler_arg_ptr);
57839         if (route_handler_arg_conv.free == LDKRoutingMessageHandler_JCalls_free) {
57840                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
57841                 LDKRoutingMessageHandler_JCalls_cloned(&route_handler_arg_conv);
57842         }
57843         void* onion_message_handler_arg_ptr = untag_ptr(onion_message_handler_arg);
57844         CHECK_ACCESS(onion_message_handler_arg_ptr);
57845         LDKOnionMessageHandler onion_message_handler_arg_conv = *(LDKOnionMessageHandler*)(onion_message_handler_arg_ptr);
57846         if (onion_message_handler_arg_conv.free == LDKOnionMessageHandler_JCalls_free) {
57847                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
57848                 LDKOnionMessageHandler_JCalls_cloned(&onion_message_handler_arg_conv);
57849         }
57850         void* custom_message_handler_arg_ptr = untag_ptr(custom_message_handler_arg);
57851         CHECK_ACCESS(custom_message_handler_arg_ptr);
57852         LDKCustomMessageHandler custom_message_handler_arg_conv = *(LDKCustomMessageHandler*)(custom_message_handler_arg_ptr);
57853         if (custom_message_handler_arg_conv.free == LDKCustomMessageHandler_JCalls_free) {
57854                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
57855                 LDKCustomMessageHandler_JCalls_cloned(&custom_message_handler_arg_conv);
57856         }
57857         LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv, onion_message_handler_arg_conv, custom_message_handler_arg_conv);
57858         int64_t ret_ref = 0;
57859         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57860         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57861         return ret_ref;
57862 }
57863
57864 static inline uint64_t SocketDescriptor_clone_ptr(LDKSocketDescriptor *NONNULL_PTR arg) {
57865         LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
57866         *ret_ret = SocketDescriptor_clone(arg);
57867         return tag_ptr(ret_ret, true);
57868 }
57869 int64_t  CS_LDK_SocketDescriptor_clone_ptr(int64_t arg) {
57870         void* arg_ptr = untag_ptr(arg);
57871         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
57872         LDKSocketDescriptor* arg_conv = (LDKSocketDescriptor*)arg_ptr;
57873         int64_t ret_conv = SocketDescriptor_clone_ptr(arg_conv);
57874         return ret_conv;
57875 }
57876
57877 int64_t  CS_LDK_SocketDescriptor_clone(int64_t orig) {
57878         void* orig_ptr = untag_ptr(orig);
57879         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
57880         LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)orig_ptr;
57881         LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
57882         *ret_ret = SocketDescriptor_clone(orig_conv);
57883         return tag_ptr(ret_ret, true);
57884 }
57885
57886 void  CS_LDK_SocketDescriptor_free(int64_t this_ptr) {
57887         if (!ptr_is_owned(this_ptr)) return;
57888         void* this_ptr_ptr = untag_ptr(this_ptr);
57889         CHECK_ACCESS(this_ptr_ptr);
57890         LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)(this_ptr_ptr);
57891         FREE(untag_ptr(this_ptr));
57892         SocketDescriptor_free(this_ptr_conv);
57893 }
57894
57895 void  CS_LDK_PeerDetails_free(int64_t this_obj) {
57896         LDKPeerDetails this_obj_conv;
57897         this_obj_conv.inner = untag_ptr(this_obj);
57898         this_obj_conv.is_owned = ptr_is_owned(this_obj);
57899         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
57900         PeerDetails_free(this_obj_conv);
57901 }
57902
57903 int8_tArray  CS_LDK_PeerDetails_get_counterparty_node_id(int64_t this_ptr) {
57904         LDKPeerDetails this_ptr_conv;
57905         this_ptr_conv.inner = untag_ptr(this_ptr);
57906         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57907         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57908         this_ptr_conv.is_owned = false;
57909         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
57910         memcpy(ret_arr->elems, PeerDetails_get_counterparty_node_id(&this_ptr_conv).compressed_form, 33);
57911         return ret_arr;
57912 }
57913
57914 void  CS_LDK_PeerDetails_set_counterparty_node_id(int64_t this_ptr, int8_tArray val) {
57915         LDKPeerDetails this_ptr_conv;
57916         this_ptr_conv.inner = untag_ptr(this_ptr);
57917         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57918         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57919         this_ptr_conv.is_owned = false;
57920         LDKPublicKey val_ref;
57921         CHECK(val->arr_len == 33);
57922         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
57923         PeerDetails_set_counterparty_node_id(&this_ptr_conv, val_ref);
57924 }
57925
57926 int64_t  CS_LDK_PeerDetails_get_socket_address(int64_t this_ptr) {
57927         LDKPeerDetails this_ptr_conv;
57928         this_ptr_conv.inner = untag_ptr(this_ptr);
57929         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57930         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57931         this_ptr_conv.is_owned = false;
57932         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
57933         *ret_copy = PeerDetails_get_socket_address(&this_ptr_conv);
57934         int64_t ret_ref = tag_ptr(ret_copy, true);
57935         return ret_ref;
57936 }
57937
57938 void  CS_LDK_PeerDetails_set_socket_address(int64_t this_ptr, int64_t val) {
57939         LDKPeerDetails this_ptr_conv;
57940         this_ptr_conv.inner = untag_ptr(this_ptr);
57941         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57942         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57943         this_ptr_conv.is_owned = false;
57944         void* val_ptr = untag_ptr(val);
57945         CHECK_ACCESS(val_ptr);
57946         LDKCOption_SocketAddressZ val_conv = *(LDKCOption_SocketAddressZ*)(val_ptr);
57947         val_conv = COption_SocketAddressZ_clone((LDKCOption_SocketAddressZ*)untag_ptr(val));
57948         PeerDetails_set_socket_address(&this_ptr_conv, val_conv);
57949 }
57950
57951 int64_t  CS_LDK_PeerDetails_get_init_features(int64_t this_ptr) {
57952         LDKPeerDetails this_ptr_conv;
57953         this_ptr_conv.inner = untag_ptr(this_ptr);
57954         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57955         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57956         this_ptr_conv.is_owned = false;
57957         LDKInitFeatures ret_var = PeerDetails_get_init_features(&this_ptr_conv);
57958         int64_t ret_ref = 0;
57959         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57960         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57961         return ret_ref;
57962 }
57963
57964 void  CS_LDK_PeerDetails_set_init_features(int64_t this_ptr, int64_t val) {
57965         LDKPeerDetails this_ptr_conv;
57966         this_ptr_conv.inner = untag_ptr(this_ptr);
57967         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57968         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57969         this_ptr_conv.is_owned = false;
57970         LDKInitFeatures val_conv;
57971         val_conv.inner = untag_ptr(val);
57972         val_conv.is_owned = ptr_is_owned(val);
57973         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
57974         val_conv = InitFeatures_clone(&val_conv);
57975         PeerDetails_set_init_features(&this_ptr_conv, val_conv);
57976 }
57977
57978 jboolean  CS_LDK_PeerDetails_get_is_inbound_connection(int64_t this_ptr) {
57979         LDKPeerDetails this_ptr_conv;
57980         this_ptr_conv.inner = untag_ptr(this_ptr);
57981         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57982         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57983         this_ptr_conv.is_owned = false;
57984         jboolean ret_conv = PeerDetails_get_is_inbound_connection(&this_ptr_conv);
57985         return ret_conv;
57986 }
57987
57988 void  CS_LDK_PeerDetails_set_is_inbound_connection(int64_t this_ptr, jboolean val) {
57989         LDKPeerDetails this_ptr_conv;
57990         this_ptr_conv.inner = untag_ptr(this_ptr);
57991         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57992         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57993         this_ptr_conv.is_owned = false;
57994         PeerDetails_set_is_inbound_connection(&this_ptr_conv, val);
57995 }
57996
57997 int64_t  CS_LDK_PeerDetails_new(int8_tArray counterparty_node_id_arg, int64_t socket_address_arg, int64_t init_features_arg, jboolean is_inbound_connection_arg) {
57998         LDKPublicKey counterparty_node_id_arg_ref;
57999         CHECK(counterparty_node_id_arg->arr_len == 33);
58000         memcpy(counterparty_node_id_arg_ref.compressed_form, counterparty_node_id_arg->elems, 33); FREE(counterparty_node_id_arg);
58001         void* socket_address_arg_ptr = untag_ptr(socket_address_arg);
58002         CHECK_ACCESS(socket_address_arg_ptr);
58003         LDKCOption_SocketAddressZ socket_address_arg_conv = *(LDKCOption_SocketAddressZ*)(socket_address_arg_ptr);
58004         LDKInitFeatures init_features_arg_conv;
58005         init_features_arg_conv.inner = untag_ptr(init_features_arg);
58006         init_features_arg_conv.is_owned = ptr_is_owned(init_features_arg);
58007         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_features_arg_conv);
58008         init_features_arg_conv = InitFeatures_clone(&init_features_arg_conv);
58009         LDKPeerDetails ret_var = PeerDetails_new(counterparty_node_id_arg_ref, socket_address_arg_conv, init_features_arg_conv, is_inbound_connection_arg);
58010         int64_t ret_ref = 0;
58011         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58012         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58013         return ret_ref;
58014 }
58015
58016 void  CS_LDK_PeerHandleError_free(int64_t this_obj) {
58017         LDKPeerHandleError this_obj_conv;
58018         this_obj_conv.inner = untag_ptr(this_obj);
58019         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58020         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58021         PeerHandleError_free(this_obj_conv);
58022 }
58023
58024 int64_t  CS_LDK_PeerHandleError_new() {
58025         LDKPeerHandleError ret_var = PeerHandleError_new();
58026         int64_t ret_ref = 0;
58027         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58028         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58029         return ret_ref;
58030 }
58031
58032 static inline uint64_t PeerHandleError_clone_ptr(LDKPeerHandleError *NONNULL_PTR arg) {
58033         LDKPeerHandleError ret_var = PeerHandleError_clone(arg);
58034         int64_t ret_ref = 0;
58035         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58036         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58037         return ret_ref;
58038 }
58039 int64_t  CS_LDK_PeerHandleError_clone_ptr(int64_t arg) {
58040         LDKPeerHandleError arg_conv;
58041         arg_conv.inner = untag_ptr(arg);
58042         arg_conv.is_owned = ptr_is_owned(arg);
58043         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
58044         arg_conv.is_owned = false;
58045         int64_t ret_conv = PeerHandleError_clone_ptr(&arg_conv);
58046         return ret_conv;
58047 }
58048
58049 int64_t  CS_LDK_PeerHandleError_clone(int64_t orig) {
58050         LDKPeerHandleError orig_conv;
58051         orig_conv.inner = untag_ptr(orig);
58052         orig_conv.is_owned = ptr_is_owned(orig);
58053         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
58054         orig_conv.is_owned = false;
58055         LDKPeerHandleError ret_var = PeerHandleError_clone(&orig_conv);
58056         int64_t ret_ref = 0;
58057         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58058         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58059         return ret_ref;
58060 }
58061
58062 jstring  CS_LDK_PeerHandleError_to_str(int64_t o) {
58063         LDKPeerHandleError o_conv;
58064         o_conv.inner = untag_ptr(o);
58065         o_conv.is_owned = ptr_is_owned(o);
58066         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
58067         o_conv.is_owned = false;
58068         LDKStr ret_str = PeerHandleError_to_str(&o_conv);
58069         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
58070         Str_free(ret_str);
58071         return ret_conv;
58072 }
58073
58074 void  CS_LDK_PeerManager_free(int64_t this_obj) {
58075         LDKPeerManager this_obj_conv;
58076         this_obj_conv.inner = untag_ptr(this_obj);
58077         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58078         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58079         PeerManager_free(this_obj_conv);
58080 }
58081
58082 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) {
58083         LDKMessageHandler message_handler_conv;
58084         message_handler_conv.inner = untag_ptr(message_handler);
58085         message_handler_conv.is_owned = ptr_is_owned(message_handler);
58086         CHECK_INNER_FIELD_ACCESS_OR_NULL(message_handler_conv);
58087         // WARNING: we need a move here but no clone is available for LDKMessageHandler
58088         
58089         uint8_t ephemeral_random_data_arr[32];
58090         CHECK(ephemeral_random_data->arr_len == 32);
58091         memcpy(ephemeral_random_data_arr, ephemeral_random_data->elems, 32); FREE(ephemeral_random_data);
58092         uint8_t (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
58093         void* logger_ptr = untag_ptr(logger);
58094         CHECK_ACCESS(logger_ptr);
58095         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
58096         if (logger_conv.free == LDKLogger_JCalls_free) {
58097                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
58098                 LDKLogger_JCalls_cloned(&logger_conv);
58099         }
58100         void* node_signer_ptr = untag_ptr(node_signer);
58101         CHECK_ACCESS(node_signer_ptr);
58102         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
58103         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
58104                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
58105                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
58106         }
58107         LDKPeerManager ret_var = PeerManager_new(message_handler_conv, current_time, ephemeral_random_data_ref, logger_conv, node_signer_conv);
58108         int64_t ret_ref = 0;
58109         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58110         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58111         return ret_ref;
58112 }
58113
58114 int64_tArray  CS_LDK_PeerManager_list_peers(int64_t this_arg) {
58115         LDKPeerManager this_arg_conv;
58116         this_arg_conv.inner = untag_ptr(this_arg);
58117         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58118         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58119         this_arg_conv.is_owned = false;
58120         LDKCVec_PeerDetailsZ ret_var = PeerManager_list_peers(&this_arg_conv);
58121         int64_tArray ret_arr = NULL;
58122         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
58123         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
58124         for (size_t n = 0; n < ret_var.datalen; n++) {
58125                 LDKPeerDetails ret_conv_13_var = ret_var.data[n];
58126                 int64_t ret_conv_13_ref = 0;
58127                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
58128                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
58129                 ret_arr_ptr[n] = ret_conv_13_ref;
58130         }
58131         
58132         FREE(ret_var.data);
58133         return ret_arr;
58134 }
58135
58136 int64_t  CS_LDK_PeerManager_peer_by_node_id(int64_t this_arg, int8_tArray their_node_id) {
58137         LDKPeerManager this_arg_conv;
58138         this_arg_conv.inner = untag_ptr(this_arg);
58139         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58140         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58141         this_arg_conv.is_owned = false;
58142         LDKPublicKey their_node_id_ref;
58143         CHECK(their_node_id->arr_len == 33);
58144         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
58145         LDKPeerDetails ret_var = PeerManager_peer_by_node_id(&this_arg_conv, their_node_id_ref);
58146         int64_t ret_ref = 0;
58147         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58148         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58149         return ret_ref;
58150 }
58151
58152 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) {
58153         LDKPeerManager this_arg_conv;
58154         this_arg_conv.inner = untag_ptr(this_arg);
58155         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58156         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58157         this_arg_conv.is_owned = false;
58158         LDKPublicKey their_node_id_ref;
58159         CHECK(their_node_id->arr_len == 33);
58160         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
58161         void* descriptor_ptr = untag_ptr(descriptor);
58162         CHECK_ACCESS(descriptor_ptr);
58163         LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
58164         if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
58165                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
58166                 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
58167         }
58168         void* remote_network_address_ptr = untag_ptr(remote_network_address);
58169         CHECK_ACCESS(remote_network_address_ptr);
58170         LDKCOption_SocketAddressZ remote_network_address_conv = *(LDKCOption_SocketAddressZ*)(remote_network_address_ptr);
58171         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
58172         *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv, remote_network_address_conv);
58173         return tag_ptr(ret_conv, true);
58174 }
58175
58176 int64_t  CS_LDK_PeerManager_new_inbound_connection(int64_t this_arg, int64_t descriptor, int64_t remote_network_address) {
58177         LDKPeerManager this_arg_conv;
58178         this_arg_conv.inner = untag_ptr(this_arg);
58179         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58180         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58181         this_arg_conv.is_owned = false;
58182         void* descriptor_ptr = untag_ptr(descriptor);
58183         CHECK_ACCESS(descriptor_ptr);
58184         LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
58185         if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
58186                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
58187                 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
58188         }
58189         void* remote_network_address_ptr = untag_ptr(remote_network_address);
58190         CHECK_ACCESS(remote_network_address_ptr);
58191         LDKCOption_SocketAddressZ remote_network_address_conv = *(LDKCOption_SocketAddressZ*)(remote_network_address_ptr);
58192         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
58193         *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv, remote_network_address_conv);
58194         return tag_ptr(ret_conv, true);
58195 }
58196
58197 int64_t  CS_LDK_PeerManager_write_buffer_space_avail(int64_t this_arg, int64_t descriptor) {
58198         LDKPeerManager this_arg_conv;
58199         this_arg_conv.inner = untag_ptr(this_arg);
58200         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58201         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58202         this_arg_conv.is_owned = false;
58203         void* descriptor_ptr = untag_ptr(descriptor);
58204         if (ptr_is_owned(descriptor)) { CHECK_ACCESS(descriptor_ptr); }
58205         LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
58206         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
58207         *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
58208         return tag_ptr(ret_conv, true);
58209 }
58210
58211 int64_t  CS_LDK_PeerManager_read_event(int64_t this_arg, int64_t peer_descriptor, int8_tArray data) {
58212         LDKPeerManager 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         void* peer_descriptor_ptr = untag_ptr(peer_descriptor);
58218         if (ptr_is_owned(peer_descriptor)) { CHECK_ACCESS(peer_descriptor_ptr); }
58219         LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)peer_descriptor_ptr;
58220         LDKu8slice data_ref;
58221         data_ref.datalen = data->arr_len;
58222         data_ref.data = data->elems;
58223         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
58224         *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
58225         FREE(data);
58226         return tag_ptr(ret_conv, true);
58227 }
58228
58229 void  CS_LDK_PeerManager_process_events(int64_t this_arg) {
58230         LDKPeerManager this_arg_conv;
58231         this_arg_conv.inner = untag_ptr(this_arg);
58232         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58233         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58234         this_arg_conv.is_owned = false;
58235         PeerManager_process_events(&this_arg_conv);
58236 }
58237
58238 void  CS_LDK_PeerManager_socket_disconnected(int64_t this_arg, int64_t descriptor) {
58239         LDKPeerManager this_arg_conv;
58240         this_arg_conv.inner = untag_ptr(this_arg);
58241         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58242         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58243         this_arg_conv.is_owned = false;
58244         void* descriptor_ptr = untag_ptr(descriptor);
58245         if (ptr_is_owned(descriptor)) { CHECK_ACCESS(descriptor_ptr); }
58246         LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
58247         PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
58248 }
58249
58250 void  CS_LDK_PeerManager_disconnect_by_node_id(int64_t this_arg, int8_tArray node_id) {
58251         LDKPeerManager this_arg_conv;
58252         this_arg_conv.inner = untag_ptr(this_arg);
58253         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58254         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58255         this_arg_conv.is_owned = false;
58256         LDKPublicKey node_id_ref;
58257         CHECK(node_id->arr_len == 33);
58258         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
58259         PeerManager_disconnect_by_node_id(&this_arg_conv, node_id_ref);
58260 }
58261
58262 void  CS_LDK_PeerManager_disconnect_all_peers(int64_t this_arg) {
58263         LDKPeerManager this_arg_conv;
58264         this_arg_conv.inner = untag_ptr(this_arg);
58265         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58266         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58267         this_arg_conv.is_owned = false;
58268         PeerManager_disconnect_all_peers(&this_arg_conv);
58269 }
58270
58271 void  CS_LDK_PeerManager_timer_tick_occurred(int64_t this_arg) {
58272         LDKPeerManager this_arg_conv;
58273         this_arg_conv.inner = untag_ptr(this_arg);
58274         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58275         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58276         this_arg_conv.is_owned = false;
58277         PeerManager_timer_tick_occurred(&this_arg_conv);
58278 }
58279
58280 void  CS_LDK_PeerManager_broadcast_node_announcement(int64_t this_arg, int8_tArray rgb, int8_tArray alias, int64_tArray addresses) {
58281         LDKPeerManager this_arg_conv;
58282         this_arg_conv.inner = untag_ptr(this_arg);
58283         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58284         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58285         this_arg_conv.is_owned = false;
58286         LDKThreeBytes rgb_ref;
58287         CHECK(rgb->arr_len == 3);
58288         memcpy(rgb_ref.data, rgb->elems, 3); FREE(rgb);
58289         LDKThirtyTwoBytes alias_ref;
58290         CHECK(alias->arr_len == 32);
58291         memcpy(alias_ref.data, alias->elems, 32); FREE(alias);
58292         LDKCVec_SocketAddressZ addresses_constr;
58293         addresses_constr.datalen = addresses->arr_len;
58294         if (addresses_constr.datalen > 0)
58295                 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
58296         else
58297                 addresses_constr.data = NULL;
58298         int64_t* addresses_vals = addresses->elems;
58299         for (size_t p = 0; p < addresses_constr.datalen; p++) {
58300                 int64_t addresses_conv_15 = addresses_vals[p];
58301                 void* addresses_conv_15_ptr = untag_ptr(addresses_conv_15);
58302                 CHECK_ACCESS(addresses_conv_15_ptr);
58303                 LDKSocketAddress addresses_conv_15_conv = *(LDKSocketAddress*)(addresses_conv_15_ptr);
58304                 addresses_constr.data[p] = addresses_conv_15_conv;
58305         }
58306         FREE(addresses);
58307         PeerManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
58308 }
58309
58310 int64_t  CS_LDK_htlc_success_tx_weight(int64_t channel_type_features) {
58311         LDKChannelTypeFeatures channel_type_features_conv;
58312         channel_type_features_conv.inner = untag_ptr(channel_type_features);
58313         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
58314         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
58315         channel_type_features_conv.is_owned = false;
58316         int64_t ret_conv = htlc_success_tx_weight(&channel_type_features_conv);
58317         return ret_conv;
58318 }
58319
58320 int64_t  CS_LDK_htlc_timeout_tx_weight(int64_t channel_type_features) {
58321         LDKChannelTypeFeatures channel_type_features_conv;
58322         channel_type_features_conv.inner = untag_ptr(channel_type_features);
58323         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
58324         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
58325         channel_type_features_conv.is_owned = false;
58326         int64_t ret_conv = htlc_timeout_tx_weight(&channel_type_features_conv);
58327         return ret_conv;
58328 }
58329
58330 int32_t  CS_LDK_HTLCClaim_clone(int64_t orig) {
58331         LDKHTLCClaim* orig_conv = (LDKHTLCClaim*)untag_ptr(orig);
58332         int32_t ret_conv = LDKHTLCClaim_to_cs(HTLCClaim_clone(orig_conv));
58333         return ret_conv;
58334 }
58335
58336 int32_t  CS_LDK_HTLCClaim_offered_timeout() {
58337         int32_t ret_conv = LDKHTLCClaim_to_cs(HTLCClaim_offered_timeout());
58338         return ret_conv;
58339 }
58340
58341 int32_t  CS_LDK_HTLCClaim_offered_preimage() {
58342         int32_t ret_conv = LDKHTLCClaim_to_cs(HTLCClaim_offered_preimage());
58343         return ret_conv;
58344 }
58345
58346 int32_t  CS_LDK_HTLCClaim_accepted_timeout() {
58347         int32_t ret_conv = LDKHTLCClaim_to_cs(HTLCClaim_accepted_timeout());
58348         return ret_conv;
58349 }
58350
58351 int32_t  CS_LDK_HTLCClaim_accepted_preimage() {
58352         int32_t ret_conv = LDKHTLCClaim_to_cs(HTLCClaim_accepted_preimage());
58353         return ret_conv;
58354 }
58355
58356 int32_t  CS_LDK_HTLCClaim_revocation() {
58357         int32_t ret_conv = LDKHTLCClaim_to_cs(HTLCClaim_revocation());
58358         return ret_conv;
58359 }
58360
58361 jboolean  CS_LDK_HTLCClaim_eq(int64_t a, int64_t b) {
58362         LDKHTLCClaim* a_conv = (LDKHTLCClaim*)untag_ptr(a);
58363         LDKHTLCClaim* b_conv = (LDKHTLCClaim*)untag_ptr(b);
58364         jboolean ret_conv = HTLCClaim_eq(a_conv, b_conv);
58365         return ret_conv;
58366 }
58367
58368 int64_t  CS_LDK_HTLCClaim_from_witness(int8_tArray witness) {
58369         LDKWitness witness_ref;
58370         witness_ref.datalen = witness->arr_len;
58371         witness_ref.data = MALLOC(witness_ref.datalen, "LDKWitness Bytes");
58372         memcpy(witness_ref.data, witness->elems, witness_ref.datalen); FREE(witness);
58373         witness_ref.data_is_owned = true;
58374         LDKCOption_HTLCClaimZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCClaimZ), "LDKCOption_HTLCClaimZ");
58375         *ret_copy = HTLCClaim_from_witness(witness_ref);
58376         int64_t ret_ref = tag_ptr(ret_copy, true);
58377         return ret_ref;
58378 }
58379
58380 int8_tArray  CS_LDK_build_commitment_secret(int8_tArray commitment_seed, int64_t idx) {
58381         uint8_t commitment_seed_arr[32];
58382         CHECK(commitment_seed->arr_len == 32);
58383         memcpy(commitment_seed_arr, commitment_seed->elems, 32); FREE(commitment_seed);
58384         uint8_t (*commitment_seed_ref)[32] = &commitment_seed_arr;
58385         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
58386         memcpy(ret_arr->elems, build_commitment_secret(commitment_seed_ref, idx).data, 32);
58387         return ret_arr;
58388 }
58389
58390 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) {
58391         LDKCVec_u8Z to_holder_script_ref;
58392         to_holder_script_ref.datalen = to_holder_script->arr_len;
58393         to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
58394         memcpy(to_holder_script_ref.data, to_holder_script->elems, to_holder_script_ref.datalen); FREE(to_holder_script);
58395         LDKCVec_u8Z to_counterparty_script_ref;
58396         to_counterparty_script_ref.datalen = to_counterparty_script->arr_len;
58397         to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
58398         memcpy(to_counterparty_script_ref.data, to_counterparty_script->elems, to_counterparty_script_ref.datalen); FREE(to_counterparty_script);
58399         LDKOutPoint funding_outpoint_conv;
58400         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
58401         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
58402         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
58403         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
58404         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);
58405         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
58406         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
58407         Transaction_free(ret_var);
58408         return ret_arr;
58409 }
58410
58411 void  CS_LDK_CounterpartyCommitmentSecrets_free(int64_t this_obj) {
58412         LDKCounterpartyCommitmentSecrets this_obj_conv;
58413         this_obj_conv.inner = untag_ptr(this_obj);
58414         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58415         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58416         CounterpartyCommitmentSecrets_free(this_obj_conv);
58417 }
58418
58419 static inline uint64_t CounterpartyCommitmentSecrets_clone_ptr(LDKCounterpartyCommitmentSecrets *NONNULL_PTR arg) {
58420         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(arg);
58421         int64_t ret_ref = 0;
58422         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58423         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58424         return ret_ref;
58425 }
58426 int64_t  CS_LDK_CounterpartyCommitmentSecrets_clone_ptr(int64_t arg) {
58427         LDKCounterpartyCommitmentSecrets arg_conv;
58428         arg_conv.inner = untag_ptr(arg);
58429         arg_conv.is_owned = ptr_is_owned(arg);
58430         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
58431         arg_conv.is_owned = false;
58432         int64_t ret_conv = CounterpartyCommitmentSecrets_clone_ptr(&arg_conv);
58433         return ret_conv;
58434 }
58435
58436 int64_t  CS_LDK_CounterpartyCommitmentSecrets_clone(int64_t orig) {
58437         LDKCounterpartyCommitmentSecrets orig_conv;
58438         orig_conv.inner = untag_ptr(orig);
58439         orig_conv.is_owned = ptr_is_owned(orig);
58440         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
58441         orig_conv.is_owned = false;
58442         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(&orig_conv);
58443         int64_t ret_ref = 0;
58444         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58445         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58446         return ret_ref;
58447 }
58448
58449 int64_t  CS_LDK_CounterpartyCommitmentSecrets_new() {
58450         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_new();
58451         int64_t ret_ref = 0;
58452         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58453         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58454         return ret_ref;
58455 }
58456
58457 int64_t  CS_LDK_CounterpartyCommitmentSecrets_get_min_seen_secret(int64_t this_arg) {
58458         LDKCounterpartyCommitmentSecrets 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         int64_t ret_conv = CounterpartyCommitmentSecrets_get_min_seen_secret(&this_arg_conv);
58464         return ret_conv;
58465 }
58466
58467 int64_t  CS_LDK_CounterpartyCommitmentSecrets_provide_secret(int64_t this_arg, int64_t idx, int8_tArray secret) {
58468         LDKCounterpartyCommitmentSecrets 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         LDKThirtyTwoBytes secret_ref;
58474         CHECK(secret->arr_len == 32);
58475         memcpy(secret_ref.data, secret->elems, 32); FREE(secret);
58476         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
58477         *ret_conv = CounterpartyCommitmentSecrets_provide_secret(&this_arg_conv, idx, secret_ref);
58478         return tag_ptr(ret_conv, true);
58479 }
58480
58481 int8_tArray  CS_LDK_CounterpartyCommitmentSecrets_get_secret(int64_t this_arg, int64_t idx) {
58482         LDKCounterpartyCommitmentSecrets this_arg_conv;
58483         this_arg_conv.inner = untag_ptr(this_arg);
58484         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58485         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58486         this_arg_conv.is_owned = false;
58487         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
58488         memcpy(ret_arr->elems, CounterpartyCommitmentSecrets_get_secret(&this_arg_conv, idx).data, 32);
58489         return ret_arr;
58490 }
58491
58492 int8_tArray  CS_LDK_CounterpartyCommitmentSecrets_write(int64_t obj) {
58493         LDKCounterpartyCommitmentSecrets obj_conv;
58494         obj_conv.inner = untag_ptr(obj);
58495         obj_conv.is_owned = ptr_is_owned(obj);
58496         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
58497         obj_conv.is_owned = false;
58498         LDKCVec_u8Z ret_var = CounterpartyCommitmentSecrets_write(&obj_conv);
58499         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
58500         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
58501         CVec_u8Z_free(ret_var);
58502         return ret_arr;
58503 }
58504
58505 int64_t  CS_LDK_CounterpartyCommitmentSecrets_read(int8_tArray ser) {
58506         LDKu8slice ser_ref;
58507         ser_ref.datalen = ser->arr_len;
58508         ser_ref.data = ser->elems;
58509         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
58510         *ret_conv = CounterpartyCommitmentSecrets_read(ser_ref);
58511         FREE(ser);
58512         return tag_ptr(ret_conv, true);
58513 }
58514
58515 int8_tArray  CS_LDK_derive_private_key(int8_tArray per_commitment_point, int8_tArray base_secret) {
58516         LDKPublicKey per_commitment_point_ref;
58517         CHECK(per_commitment_point->arr_len == 33);
58518         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
58519         uint8_t base_secret_arr[32];
58520         CHECK(base_secret->arr_len == 32);
58521         memcpy(base_secret_arr, base_secret->elems, 32); FREE(base_secret);
58522         uint8_t (*base_secret_ref)[32] = &base_secret_arr;
58523         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
58524         memcpy(ret_arr->elems, derive_private_key(per_commitment_point_ref, base_secret_ref).bytes, 32);
58525         return ret_arr;
58526 }
58527
58528 int8_tArray  CS_LDK_derive_private_revocation_key(int8_tArray per_commitment_secret, int8_tArray countersignatory_revocation_base_secret) {
58529         uint8_t per_commitment_secret_arr[32];
58530         CHECK(per_commitment_secret->arr_len == 32);
58531         memcpy(per_commitment_secret_arr, per_commitment_secret->elems, 32); FREE(per_commitment_secret);
58532         uint8_t (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
58533         uint8_t countersignatory_revocation_base_secret_arr[32];
58534         CHECK(countersignatory_revocation_base_secret->arr_len == 32);
58535         memcpy(countersignatory_revocation_base_secret_arr, countersignatory_revocation_base_secret->elems, 32); FREE(countersignatory_revocation_base_secret);
58536         uint8_t (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
58537         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
58538         memcpy(ret_arr->elems, derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref).bytes, 32);
58539         return ret_arr;
58540 }
58541
58542 void  CS_LDK_TxCreationKeys_free(int64_t this_obj) {
58543         LDKTxCreationKeys this_obj_conv;
58544         this_obj_conv.inner = untag_ptr(this_obj);
58545         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58546         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58547         TxCreationKeys_free(this_obj_conv);
58548 }
58549
58550 int8_tArray  CS_LDK_TxCreationKeys_get_per_commitment_point(int64_t this_ptr) {
58551         LDKTxCreationKeys this_ptr_conv;
58552         this_ptr_conv.inner = untag_ptr(this_ptr);
58553         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58554         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58555         this_ptr_conv.is_owned = false;
58556         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
58557         memcpy(ret_arr->elems, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
58558         return ret_arr;
58559 }
58560
58561 void  CS_LDK_TxCreationKeys_set_per_commitment_point(int64_t this_ptr, int8_tArray val) {
58562         LDKTxCreationKeys this_ptr_conv;
58563         this_ptr_conv.inner = untag_ptr(this_ptr);
58564         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58565         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58566         this_ptr_conv.is_owned = false;
58567         LDKPublicKey val_ref;
58568         CHECK(val->arr_len == 33);
58569         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
58570         TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
58571 }
58572
58573 int64_t  CS_LDK_TxCreationKeys_get_revocation_key(int64_t this_ptr) {
58574         LDKTxCreationKeys this_ptr_conv;
58575         this_ptr_conv.inner = untag_ptr(this_ptr);
58576         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58577         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58578         this_ptr_conv.is_owned = false;
58579         LDKRevocationKey ret_var = TxCreationKeys_get_revocation_key(&this_ptr_conv);
58580         int64_t ret_ref = 0;
58581         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58582         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58583         return ret_ref;
58584 }
58585
58586 void  CS_LDK_TxCreationKeys_set_revocation_key(int64_t this_ptr, int64_t val) {
58587         LDKTxCreationKeys 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         LDKRevocationKey val_conv;
58593         val_conv.inner = untag_ptr(val);
58594         val_conv.is_owned = ptr_is_owned(val);
58595         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
58596         val_conv = RevocationKey_clone(&val_conv);
58597         TxCreationKeys_set_revocation_key(&this_ptr_conv, val_conv);
58598 }
58599
58600 int64_t  CS_LDK_TxCreationKeys_get_broadcaster_htlc_key(int64_t this_ptr) {
58601         LDKTxCreationKeys this_ptr_conv;
58602         this_ptr_conv.inner = untag_ptr(this_ptr);
58603         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58604         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58605         this_ptr_conv.is_owned = false;
58606         LDKHtlcKey ret_var = TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv);
58607         int64_t ret_ref = 0;
58608         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58609         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58610         return ret_ref;
58611 }
58612
58613 void  CS_LDK_TxCreationKeys_set_broadcaster_htlc_key(int64_t this_ptr, int64_t val) {
58614         LDKTxCreationKeys this_ptr_conv;
58615         this_ptr_conv.inner = untag_ptr(this_ptr);
58616         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58617         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58618         this_ptr_conv.is_owned = false;
58619         LDKHtlcKey val_conv;
58620         val_conv.inner = untag_ptr(val);
58621         val_conv.is_owned = ptr_is_owned(val);
58622         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
58623         val_conv = HtlcKey_clone(&val_conv);
58624         TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_conv);
58625 }
58626
58627 int64_t  CS_LDK_TxCreationKeys_get_countersignatory_htlc_key(int64_t this_ptr) {
58628         LDKTxCreationKeys this_ptr_conv;
58629         this_ptr_conv.inner = untag_ptr(this_ptr);
58630         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58631         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58632         this_ptr_conv.is_owned = false;
58633         LDKHtlcKey ret_var = TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv);
58634         int64_t ret_ref = 0;
58635         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58636         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58637         return ret_ref;
58638 }
58639
58640 void  CS_LDK_TxCreationKeys_set_countersignatory_htlc_key(int64_t this_ptr, int64_t val) {
58641         LDKTxCreationKeys this_ptr_conv;
58642         this_ptr_conv.inner = untag_ptr(this_ptr);
58643         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58644         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58645         this_ptr_conv.is_owned = false;
58646         LDKHtlcKey val_conv;
58647         val_conv.inner = untag_ptr(val);
58648         val_conv.is_owned = ptr_is_owned(val);
58649         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
58650         val_conv = HtlcKey_clone(&val_conv);
58651         TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_conv);
58652 }
58653
58654 int64_t  CS_LDK_TxCreationKeys_get_broadcaster_delayed_payment_key(int64_t this_ptr) {
58655         LDKTxCreationKeys this_ptr_conv;
58656         this_ptr_conv.inner = untag_ptr(this_ptr);
58657         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58658         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58659         this_ptr_conv.is_owned = false;
58660         LDKDelayedPaymentKey ret_var = TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv);
58661         int64_t ret_ref = 0;
58662         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58663         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58664         return ret_ref;
58665 }
58666
58667 void  CS_LDK_TxCreationKeys_set_broadcaster_delayed_payment_key(int64_t this_ptr, int64_t val) {
58668         LDKTxCreationKeys this_ptr_conv;
58669         this_ptr_conv.inner = untag_ptr(this_ptr);
58670         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58671         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58672         this_ptr_conv.is_owned = false;
58673         LDKDelayedPaymentKey val_conv;
58674         val_conv.inner = untag_ptr(val);
58675         val_conv.is_owned = ptr_is_owned(val);
58676         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
58677         val_conv = DelayedPaymentKey_clone(&val_conv);
58678         TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_conv);
58679 }
58680
58681 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) {
58682         LDKPublicKey per_commitment_point_arg_ref;
58683         CHECK(per_commitment_point_arg->arr_len == 33);
58684         memcpy(per_commitment_point_arg_ref.compressed_form, per_commitment_point_arg->elems, 33); FREE(per_commitment_point_arg);
58685         LDKRevocationKey revocation_key_arg_conv;
58686         revocation_key_arg_conv.inner = untag_ptr(revocation_key_arg);
58687         revocation_key_arg_conv.is_owned = ptr_is_owned(revocation_key_arg);
58688         CHECK_INNER_FIELD_ACCESS_OR_NULL(revocation_key_arg_conv);
58689         revocation_key_arg_conv = RevocationKey_clone(&revocation_key_arg_conv);
58690         LDKHtlcKey broadcaster_htlc_key_arg_conv;
58691         broadcaster_htlc_key_arg_conv.inner = untag_ptr(broadcaster_htlc_key_arg);
58692         broadcaster_htlc_key_arg_conv.is_owned = ptr_is_owned(broadcaster_htlc_key_arg);
58693         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_htlc_key_arg_conv);
58694         broadcaster_htlc_key_arg_conv = HtlcKey_clone(&broadcaster_htlc_key_arg_conv);
58695         LDKHtlcKey countersignatory_htlc_key_arg_conv;
58696         countersignatory_htlc_key_arg_conv.inner = untag_ptr(countersignatory_htlc_key_arg);
58697         countersignatory_htlc_key_arg_conv.is_owned = ptr_is_owned(countersignatory_htlc_key_arg);
58698         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_htlc_key_arg_conv);
58699         countersignatory_htlc_key_arg_conv = HtlcKey_clone(&countersignatory_htlc_key_arg_conv);
58700         LDKDelayedPaymentKey broadcaster_delayed_payment_key_arg_conv;
58701         broadcaster_delayed_payment_key_arg_conv.inner = untag_ptr(broadcaster_delayed_payment_key_arg);
58702         broadcaster_delayed_payment_key_arg_conv.is_owned = ptr_is_owned(broadcaster_delayed_payment_key_arg);
58703         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_delayed_payment_key_arg_conv);
58704         broadcaster_delayed_payment_key_arg_conv = DelayedPaymentKey_clone(&broadcaster_delayed_payment_key_arg_conv);
58705         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);
58706         int64_t ret_ref = 0;
58707         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58708         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58709         return ret_ref;
58710 }
58711
58712 jboolean  CS_LDK_TxCreationKeys_eq(int64_t a, int64_t b) {
58713         LDKTxCreationKeys a_conv;
58714         a_conv.inner = untag_ptr(a);
58715         a_conv.is_owned = ptr_is_owned(a);
58716         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
58717         a_conv.is_owned = false;
58718         LDKTxCreationKeys b_conv;
58719         b_conv.inner = untag_ptr(b);
58720         b_conv.is_owned = ptr_is_owned(b);
58721         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
58722         b_conv.is_owned = false;
58723         jboolean ret_conv = TxCreationKeys_eq(&a_conv, &b_conv);
58724         return ret_conv;
58725 }
58726
58727 static inline uint64_t TxCreationKeys_clone_ptr(LDKTxCreationKeys *NONNULL_PTR arg) {
58728         LDKTxCreationKeys ret_var = TxCreationKeys_clone(arg);
58729         int64_t ret_ref = 0;
58730         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58731         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58732         return ret_ref;
58733 }
58734 int64_t  CS_LDK_TxCreationKeys_clone_ptr(int64_t arg) {
58735         LDKTxCreationKeys arg_conv;
58736         arg_conv.inner = untag_ptr(arg);
58737         arg_conv.is_owned = ptr_is_owned(arg);
58738         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
58739         arg_conv.is_owned = false;
58740         int64_t ret_conv = TxCreationKeys_clone_ptr(&arg_conv);
58741         return ret_conv;
58742 }
58743
58744 int64_t  CS_LDK_TxCreationKeys_clone(int64_t orig) {
58745         LDKTxCreationKeys orig_conv;
58746         orig_conv.inner = untag_ptr(orig);
58747         orig_conv.is_owned = ptr_is_owned(orig);
58748         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
58749         orig_conv.is_owned = false;
58750         LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
58751         int64_t ret_ref = 0;
58752         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58753         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58754         return ret_ref;
58755 }
58756
58757 int8_tArray  CS_LDK_TxCreationKeys_write(int64_t obj) {
58758         LDKTxCreationKeys obj_conv;
58759         obj_conv.inner = untag_ptr(obj);
58760         obj_conv.is_owned = ptr_is_owned(obj);
58761         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
58762         obj_conv.is_owned = false;
58763         LDKCVec_u8Z ret_var = TxCreationKeys_write(&obj_conv);
58764         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
58765         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
58766         CVec_u8Z_free(ret_var);
58767         return ret_arr;
58768 }
58769
58770 int64_t  CS_LDK_TxCreationKeys_read(int8_tArray ser) {
58771         LDKu8slice ser_ref;
58772         ser_ref.datalen = ser->arr_len;
58773         ser_ref.data = ser->elems;
58774         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
58775         *ret_conv = TxCreationKeys_read(ser_ref);
58776         FREE(ser);
58777         return tag_ptr(ret_conv, true);
58778 }
58779
58780 void  CS_LDK_ChannelPublicKeys_free(int64_t this_obj) {
58781         LDKChannelPublicKeys this_obj_conv;
58782         this_obj_conv.inner = untag_ptr(this_obj);
58783         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58784         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58785         ChannelPublicKeys_free(this_obj_conv);
58786 }
58787
58788 int8_tArray  CS_LDK_ChannelPublicKeys_get_funding_pubkey(int64_t this_ptr) {
58789         LDKChannelPublicKeys this_ptr_conv;
58790         this_ptr_conv.inner = untag_ptr(this_ptr);
58791         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58792         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58793         this_ptr_conv.is_owned = false;
58794         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
58795         memcpy(ret_arr->elems, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
58796         return ret_arr;
58797 }
58798
58799 void  CS_LDK_ChannelPublicKeys_set_funding_pubkey(int64_t this_ptr, int8_tArray val) {
58800         LDKChannelPublicKeys this_ptr_conv;
58801         this_ptr_conv.inner = untag_ptr(this_ptr);
58802         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58803         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58804         this_ptr_conv.is_owned = false;
58805         LDKPublicKey val_ref;
58806         CHECK(val->arr_len == 33);
58807         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
58808         ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
58809 }
58810
58811 int64_t  CS_LDK_ChannelPublicKeys_get_revocation_basepoint(int64_t this_ptr) {
58812         LDKChannelPublicKeys this_ptr_conv;
58813         this_ptr_conv.inner = untag_ptr(this_ptr);
58814         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58815         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58816         this_ptr_conv.is_owned = false;
58817         LDKRevocationBasepoint ret_var = ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv);
58818         int64_t ret_ref = 0;
58819         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58820         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58821         return ret_ref;
58822 }
58823
58824 void  CS_LDK_ChannelPublicKeys_set_revocation_basepoint(int64_t this_ptr, int64_t val) {
58825         LDKChannelPublicKeys this_ptr_conv;
58826         this_ptr_conv.inner = untag_ptr(this_ptr);
58827         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58828         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58829         this_ptr_conv.is_owned = false;
58830         LDKRevocationBasepoint val_conv;
58831         val_conv.inner = untag_ptr(val);
58832         val_conv.is_owned = ptr_is_owned(val);
58833         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
58834         val_conv = RevocationBasepoint_clone(&val_conv);
58835         ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_conv);
58836 }
58837
58838 int8_tArray  CS_LDK_ChannelPublicKeys_get_payment_point(int64_t this_ptr) {
58839         LDKChannelPublicKeys this_ptr_conv;
58840         this_ptr_conv.inner = untag_ptr(this_ptr);
58841         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58842         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58843         this_ptr_conv.is_owned = false;
58844         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
58845         memcpy(ret_arr->elems, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form, 33);
58846         return ret_arr;
58847 }
58848
58849 void  CS_LDK_ChannelPublicKeys_set_payment_point(int64_t this_ptr, int8_tArray val) {
58850         LDKChannelPublicKeys this_ptr_conv;
58851         this_ptr_conv.inner = untag_ptr(this_ptr);
58852         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58853         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58854         this_ptr_conv.is_owned = false;
58855         LDKPublicKey val_ref;
58856         CHECK(val->arr_len == 33);
58857         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
58858         ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
58859 }
58860
58861 int64_t  CS_LDK_ChannelPublicKeys_get_delayed_payment_basepoint(int64_t this_ptr) {
58862         LDKChannelPublicKeys this_ptr_conv;
58863         this_ptr_conv.inner = untag_ptr(this_ptr);
58864         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58865         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58866         this_ptr_conv.is_owned = false;
58867         LDKDelayedPaymentBasepoint ret_var = ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv);
58868         int64_t ret_ref = 0;
58869         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58870         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58871         return ret_ref;
58872 }
58873
58874 void  CS_LDK_ChannelPublicKeys_set_delayed_payment_basepoint(int64_t this_ptr, int64_t val) {
58875         LDKChannelPublicKeys this_ptr_conv;
58876         this_ptr_conv.inner = untag_ptr(this_ptr);
58877         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58878         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58879         this_ptr_conv.is_owned = false;
58880         LDKDelayedPaymentBasepoint val_conv;
58881         val_conv.inner = untag_ptr(val);
58882         val_conv.is_owned = ptr_is_owned(val);
58883         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
58884         val_conv = DelayedPaymentBasepoint_clone(&val_conv);
58885         ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_conv);
58886 }
58887
58888 int64_t  CS_LDK_ChannelPublicKeys_get_htlc_basepoint(int64_t this_ptr) {
58889         LDKChannelPublicKeys this_ptr_conv;
58890         this_ptr_conv.inner = untag_ptr(this_ptr);
58891         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58892         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58893         this_ptr_conv.is_owned = false;
58894         LDKHtlcBasepoint ret_var = ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv);
58895         int64_t ret_ref = 0;
58896         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58897         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58898         return ret_ref;
58899 }
58900
58901 void  CS_LDK_ChannelPublicKeys_set_htlc_basepoint(int64_t this_ptr, int64_t val) {
58902         LDKChannelPublicKeys this_ptr_conv;
58903         this_ptr_conv.inner = untag_ptr(this_ptr);
58904         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58905         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58906         this_ptr_conv.is_owned = false;
58907         LDKHtlcBasepoint val_conv;
58908         val_conv.inner = untag_ptr(val);
58909         val_conv.is_owned = ptr_is_owned(val);
58910         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
58911         val_conv = HtlcBasepoint_clone(&val_conv);
58912         ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_conv);
58913 }
58914
58915 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) {
58916         LDKPublicKey funding_pubkey_arg_ref;
58917         CHECK(funding_pubkey_arg->arr_len == 33);
58918         memcpy(funding_pubkey_arg_ref.compressed_form, funding_pubkey_arg->elems, 33); FREE(funding_pubkey_arg);
58919         LDKRevocationBasepoint revocation_basepoint_arg_conv;
58920         revocation_basepoint_arg_conv.inner = untag_ptr(revocation_basepoint_arg);
58921         revocation_basepoint_arg_conv.is_owned = ptr_is_owned(revocation_basepoint_arg);
58922         CHECK_INNER_FIELD_ACCESS_OR_NULL(revocation_basepoint_arg_conv);
58923         revocation_basepoint_arg_conv = RevocationBasepoint_clone(&revocation_basepoint_arg_conv);
58924         LDKPublicKey payment_point_arg_ref;
58925         CHECK(payment_point_arg->arr_len == 33);
58926         memcpy(payment_point_arg_ref.compressed_form, payment_point_arg->elems, 33); FREE(payment_point_arg);
58927         LDKDelayedPaymentBasepoint delayed_payment_basepoint_arg_conv;
58928         delayed_payment_basepoint_arg_conv.inner = untag_ptr(delayed_payment_basepoint_arg);
58929         delayed_payment_basepoint_arg_conv.is_owned = ptr_is_owned(delayed_payment_basepoint_arg);
58930         CHECK_INNER_FIELD_ACCESS_OR_NULL(delayed_payment_basepoint_arg_conv);
58931         delayed_payment_basepoint_arg_conv = DelayedPaymentBasepoint_clone(&delayed_payment_basepoint_arg_conv);
58932         LDKHtlcBasepoint htlc_basepoint_arg_conv;
58933         htlc_basepoint_arg_conv.inner = untag_ptr(htlc_basepoint_arg);
58934         htlc_basepoint_arg_conv.is_owned = ptr_is_owned(htlc_basepoint_arg);
58935         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_basepoint_arg_conv);
58936         htlc_basepoint_arg_conv = HtlcBasepoint_clone(&htlc_basepoint_arg_conv);
58937         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);
58938         int64_t ret_ref = 0;
58939         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58940         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58941         return ret_ref;
58942 }
58943
58944 static inline uint64_t ChannelPublicKeys_clone_ptr(LDKChannelPublicKeys *NONNULL_PTR arg) {
58945         LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(arg);
58946         int64_t ret_ref = 0;
58947         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58948         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58949         return ret_ref;
58950 }
58951 int64_t  CS_LDK_ChannelPublicKeys_clone_ptr(int64_t arg) {
58952         LDKChannelPublicKeys arg_conv;
58953         arg_conv.inner = untag_ptr(arg);
58954         arg_conv.is_owned = ptr_is_owned(arg);
58955         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
58956         arg_conv.is_owned = false;
58957         int64_t ret_conv = ChannelPublicKeys_clone_ptr(&arg_conv);
58958         return ret_conv;
58959 }
58960
58961 int64_t  CS_LDK_ChannelPublicKeys_clone(int64_t orig) {
58962         LDKChannelPublicKeys orig_conv;
58963         orig_conv.inner = untag_ptr(orig);
58964         orig_conv.is_owned = ptr_is_owned(orig);
58965         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
58966         orig_conv.is_owned = false;
58967         LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
58968         int64_t ret_ref = 0;
58969         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58970         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58971         return ret_ref;
58972 }
58973
58974 int64_t  CS_LDK_ChannelPublicKeys_hash(int64_t o) {
58975         LDKChannelPublicKeys o_conv;
58976         o_conv.inner = untag_ptr(o);
58977         o_conv.is_owned = ptr_is_owned(o);
58978         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
58979         o_conv.is_owned = false;
58980         int64_t ret_conv = ChannelPublicKeys_hash(&o_conv);
58981         return ret_conv;
58982 }
58983
58984 jboolean  CS_LDK_ChannelPublicKeys_eq(int64_t a, int64_t b) {
58985         LDKChannelPublicKeys a_conv;
58986         a_conv.inner = untag_ptr(a);
58987         a_conv.is_owned = ptr_is_owned(a);
58988         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
58989         a_conv.is_owned = false;
58990         LDKChannelPublicKeys b_conv;
58991         b_conv.inner = untag_ptr(b);
58992         b_conv.is_owned = ptr_is_owned(b);
58993         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
58994         b_conv.is_owned = false;
58995         jboolean ret_conv = ChannelPublicKeys_eq(&a_conv, &b_conv);
58996         return ret_conv;
58997 }
58998
58999 int8_tArray  CS_LDK_ChannelPublicKeys_write(int64_t obj) {
59000         LDKChannelPublicKeys obj_conv;
59001         obj_conv.inner = untag_ptr(obj);
59002         obj_conv.is_owned = ptr_is_owned(obj);
59003         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
59004         obj_conv.is_owned = false;
59005         LDKCVec_u8Z ret_var = ChannelPublicKeys_write(&obj_conv);
59006         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
59007         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
59008         CVec_u8Z_free(ret_var);
59009         return ret_arr;
59010 }
59011
59012 int64_t  CS_LDK_ChannelPublicKeys_read(int8_tArray ser) {
59013         LDKu8slice ser_ref;
59014         ser_ref.datalen = ser->arr_len;
59015         ser_ref.data = ser->elems;
59016         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
59017         *ret_conv = ChannelPublicKeys_read(ser_ref);
59018         FREE(ser);
59019         return tag_ptr(ret_conv, true);
59020 }
59021
59022 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) {
59023         LDKPublicKey per_commitment_point_ref;
59024         CHECK(per_commitment_point->arr_len == 33);
59025         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
59026         LDKDelayedPaymentBasepoint broadcaster_delayed_payment_base_conv;
59027         broadcaster_delayed_payment_base_conv.inner = untag_ptr(broadcaster_delayed_payment_base);
59028         broadcaster_delayed_payment_base_conv.is_owned = ptr_is_owned(broadcaster_delayed_payment_base);
59029         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_delayed_payment_base_conv);
59030         broadcaster_delayed_payment_base_conv.is_owned = false;
59031         LDKHtlcBasepoint broadcaster_htlc_base_conv;
59032         broadcaster_htlc_base_conv.inner = untag_ptr(broadcaster_htlc_base);
59033         broadcaster_htlc_base_conv.is_owned = ptr_is_owned(broadcaster_htlc_base);
59034         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_htlc_base_conv);
59035         broadcaster_htlc_base_conv.is_owned = false;
59036         LDKRevocationBasepoint countersignatory_revocation_base_conv;
59037         countersignatory_revocation_base_conv.inner = untag_ptr(countersignatory_revocation_base);
59038         countersignatory_revocation_base_conv.is_owned = ptr_is_owned(countersignatory_revocation_base);
59039         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_revocation_base_conv);
59040         countersignatory_revocation_base_conv.is_owned = false;
59041         LDKHtlcBasepoint countersignatory_htlc_base_conv;
59042         countersignatory_htlc_base_conv.inner = untag_ptr(countersignatory_htlc_base);
59043         countersignatory_htlc_base_conv.is_owned = ptr_is_owned(countersignatory_htlc_base);
59044         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_htlc_base_conv);
59045         countersignatory_htlc_base_conv.is_owned = false;
59046         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);
59047         int64_t ret_ref = 0;
59048         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59049         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59050         return ret_ref;
59051 }
59052
59053 int64_t  CS_LDK_TxCreationKeys_from_channel_static_keys(int8_tArray per_commitment_point, int64_t broadcaster_keys, int64_t countersignatory_keys) {
59054         LDKPublicKey per_commitment_point_ref;
59055         CHECK(per_commitment_point->arr_len == 33);
59056         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
59057         LDKChannelPublicKeys broadcaster_keys_conv;
59058         broadcaster_keys_conv.inner = untag_ptr(broadcaster_keys);
59059         broadcaster_keys_conv.is_owned = ptr_is_owned(broadcaster_keys);
59060         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
59061         broadcaster_keys_conv.is_owned = false;
59062         LDKChannelPublicKeys countersignatory_keys_conv;
59063         countersignatory_keys_conv.inner = untag_ptr(countersignatory_keys);
59064         countersignatory_keys_conv.is_owned = ptr_is_owned(countersignatory_keys);
59065         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
59066         countersignatory_keys_conv.is_owned = false;
59067         LDKTxCreationKeys ret_var = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv);
59068         int64_t ret_ref = 0;
59069         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59070         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59071         return ret_ref;
59072 }
59073
59074 int8_tArray  CS_LDK_get_revokeable_redeemscript(int64_t revocation_key, int16_t contest_delay, int64_t broadcaster_delayed_payment_key) {
59075         LDKRevocationKey revocation_key_conv;
59076         revocation_key_conv.inner = untag_ptr(revocation_key);
59077         revocation_key_conv.is_owned = ptr_is_owned(revocation_key);
59078         CHECK_INNER_FIELD_ACCESS_OR_NULL(revocation_key_conv);
59079         revocation_key_conv.is_owned = false;
59080         LDKDelayedPaymentKey broadcaster_delayed_payment_key_conv;
59081         broadcaster_delayed_payment_key_conv.inner = untag_ptr(broadcaster_delayed_payment_key);
59082         broadcaster_delayed_payment_key_conv.is_owned = ptr_is_owned(broadcaster_delayed_payment_key);
59083         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_delayed_payment_key_conv);
59084         broadcaster_delayed_payment_key_conv.is_owned = false;
59085         LDKCVec_u8Z ret_var = get_revokeable_redeemscript(&revocation_key_conv, contest_delay, &broadcaster_delayed_payment_key_conv);
59086         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
59087         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
59088         CVec_u8Z_free(ret_var);
59089         return ret_arr;
59090 }
59091
59092 int8_tArray  CS_LDK_get_counterparty_payment_script(int64_t channel_type_features, int8_tArray payment_key) {
59093         LDKChannelTypeFeatures channel_type_features_conv;
59094         channel_type_features_conv.inner = untag_ptr(channel_type_features);
59095         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
59096         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
59097         channel_type_features_conv.is_owned = false;
59098         LDKPublicKey payment_key_ref;
59099         CHECK(payment_key->arr_len == 33);
59100         memcpy(payment_key_ref.compressed_form, payment_key->elems, 33); FREE(payment_key);
59101         LDKCVec_u8Z ret_var = get_counterparty_payment_script(&channel_type_features_conv, payment_key_ref);
59102         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
59103         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
59104         CVec_u8Z_free(ret_var);
59105         return ret_arr;
59106 }
59107
59108 void  CS_LDK_HTLCOutputInCommitment_free(int64_t this_obj) {
59109         LDKHTLCOutputInCommitment this_obj_conv;
59110         this_obj_conv.inner = untag_ptr(this_obj);
59111         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59112         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59113         HTLCOutputInCommitment_free(this_obj_conv);
59114 }
59115
59116 jboolean  CS_LDK_HTLCOutputInCommitment_get_offered(int64_t this_ptr) {
59117         LDKHTLCOutputInCommitment this_ptr_conv;
59118         this_ptr_conv.inner = untag_ptr(this_ptr);
59119         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59120         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59121         this_ptr_conv.is_owned = false;
59122         jboolean ret_conv = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
59123         return ret_conv;
59124 }
59125
59126 void  CS_LDK_HTLCOutputInCommitment_set_offered(int64_t this_ptr, jboolean val) {
59127         LDKHTLCOutputInCommitment this_ptr_conv;
59128         this_ptr_conv.inner = untag_ptr(this_ptr);
59129         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59130         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59131         this_ptr_conv.is_owned = false;
59132         HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
59133 }
59134
59135 int64_t  CS_LDK_HTLCOutputInCommitment_get_amount_msat(int64_t this_ptr) {
59136         LDKHTLCOutputInCommitment this_ptr_conv;
59137         this_ptr_conv.inner = untag_ptr(this_ptr);
59138         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59139         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59140         this_ptr_conv.is_owned = false;
59141         int64_t ret_conv = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
59142         return ret_conv;
59143 }
59144
59145 void  CS_LDK_HTLCOutputInCommitment_set_amount_msat(int64_t this_ptr, int64_t val) {
59146         LDKHTLCOutputInCommitment this_ptr_conv;
59147         this_ptr_conv.inner = untag_ptr(this_ptr);
59148         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59149         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59150         this_ptr_conv.is_owned = false;
59151         HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
59152 }
59153
59154 int32_t  CS_LDK_HTLCOutputInCommitment_get_cltv_expiry(int64_t this_ptr) {
59155         LDKHTLCOutputInCommitment this_ptr_conv;
59156         this_ptr_conv.inner = untag_ptr(this_ptr);
59157         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59158         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59159         this_ptr_conv.is_owned = false;
59160         int32_t ret_conv = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
59161         return ret_conv;
59162 }
59163
59164 void  CS_LDK_HTLCOutputInCommitment_set_cltv_expiry(int64_t this_ptr, int32_t val) {
59165         LDKHTLCOutputInCommitment this_ptr_conv;
59166         this_ptr_conv.inner = untag_ptr(this_ptr);
59167         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59168         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59169         this_ptr_conv.is_owned = false;
59170         HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
59171 }
59172
59173 int8_tArray  CS_LDK_HTLCOutputInCommitment_get_payment_hash(int64_t this_ptr) {
59174         LDKHTLCOutputInCommitment this_ptr_conv;
59175         this_ptr_conv.inner = untag_ptr(this_ptr);
59176         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59177         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59178         this_ptr_conv.is_owned = false;
59179         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
59180         memcpy(ret_arr->elems, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv), 32);
59181         return ret_arr;
59182 }
59183
59184 void  CS_LDK_HTLCOutputInCommitment_set_payment_hash(int64_t this_ptr, int8_tArray val) {
59185         LDKHTLCOutputInCommitment this_ptr_conv;
59186         this_ptr_conv.inner = untag_ptr(this_ptr);
59187         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59188         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59189         this_ptr_conv.is_owned = false;
59190         LDKThirtyTwoBytes val_ref;
59191         CHECK(val->arr_len == 32);
59192         memcpy(val_ref.data, val->elems, 32); FREE(val);
59193         HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
59194 }
59195
59196 int64_t  CS_LDK_HTLCOutputInCommitment_get_transaction_output_index(int64_t this_ptr) {
59197         LDKHTLCOutputInCommitment this_ptr_conv;
59198         this_ptr_conv.inner = untag_ptr(this_ptr);
59199         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59200         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59201         this_ptr_conv.is_owned = false;
59202         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
59203         *ret_copy = HTLCOutputInCommitment_get_transaction_output_index(&this_ptr_conv);
59204         int64_t ret_ref = tag_ptr(ret_copy, true);
59205         return ret_ref;
59206 }
59207
59208 void  CS_LDK_HTLCOutputInCommitment_set_transaction_output_index(int64_t this_ptr, int64_t val) {
59209         LDKHTLCOutputInCommitment this_ptr_conv;
59210         this_ptr_conv.inner = untag_ptr(this_ptr);
59211         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59212         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59213         this_ptr_conv.is_owned = false;
59214         void* val_ptr = untag_ptr(val);
59215         CHECK_ACCESS(val_ptr);
59216         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
59217         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
59218         HTLCOutputInCommitment_set_transaction_output_index(&this_ptr_conv, val_conv);
59219 }
59220
59221 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) {
59222         LDKThirtyTwoBytes payment_hash_arg_ref;
59223         CHECK(payment_hash_arg->arr_len == 32);
59224         memcpy(payment_hash_arg_ref.data, payment_hash_arg->elems, 32); FREE(payment_hash_arg);
59225         void* transaction_output_index_arg_ptr = untag_ptr(transaction_output_index_arg);
59226         CHECK_ACCESS(transaction_output_index_arg_ptr);
59227         LDKCOption_u32Z transaction_output_index_arg_conv = *(LDKCOption_u32Z*)(transaction_output_index_arg_ptr);
59228         transaction_output_index_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(transaction_output_index_arg));
59229         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_new(offered_arg, amount_msat_arg, cltv_expiry_arg, payment_hash_arg_ref, transaction_output_index_arg_conv);
59230         int64_t ret_ref = 0;
59231         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59232         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59233         return ret_ref;
59234 }
59235
59236 static inline uint64_t HTLCOutputInCommitment_clone_ptr(LDKHTLCOutputInCommitment *NONNULL_PTR arg) {
59237         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(arg);
59238         int64_t ret_ref = 0;
59239         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59240         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59241         return ret_ref;
59242 }
59243 int64_t  CS_LDK_HTLCOutputInCommitment_clone_ptr(int64_t arg) {
59244         LDKHTLCOutputInCommitment arg_conv;
59245         arg_conv.inner = untag_ptr(arg);
59246         arg_conv.is_owned = ptr_is_owned(arg);
59247         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59248         arg_conv.is_owned = false;
59249         int64_t ret_conv = HTLCOutputInCommitment_clone_ptr(&arg_conv);
59250         return ret_conv;
59251 }
59252
59253 int64_t  CS_LDK_HTLCOutputInCommitment_clone(int64_t orig) {
59254         LDKHTLCOutputInCommitment orig_conv;
59255         orig_conv.inner = untag_ptr(orig);
59256         orig_conv.is_owned = ptr_is_owned(orig);
59257         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59258         orig_conv.is_owned = false;
59259         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
59260         int64_t ret_ref = 0;
59261         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59262         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59263         return ret_ref;
59264 }
59265
59266 jboolean  CS_LDK_HTLCOutputInCommitment_eq(int64_t a, int64_t b) {
59267         LDKHTLCOutputInCommitment a_conv;
59268         a_conv.inner = untag_ptr(a);
59269         a_conv.is_owned = ptr_is_owned(a);
59270         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
59271         a_conv.is_owned = false;
59272         LDKHTLCOutputInCommitment b_conv;
59273         b_conv.inner = untag_ptr(b);
59274         b_conv.is_owned = ptr_is_owned(b);
59275         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
59276         b_conv.is_owned = false;
59277         jboolean ret_conv = HTLCOutputInCommitment_eq(&a_conv, &b_conv);
59278         return ret_conv;
59279 }
59280
59281 int8_tArray  CS_LDK_HTLCOutputInCommitment_write(int64_t obj) {
59282         LDKHTLCOutputInCommitment obj_conv;
59283         obj_conv.inner = untag_ptr(obj);
59284         obj_conv.is_owned = ptr_is_owned(obj);
59285         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
59286         obj_conv.is_owned = false;
59287         LDKCVec_u8Z ret_var = HTLCOutputInCommitment_write(&obj_conv);
59288         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
59289         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
59290         CVec_u8Z_free(ret_var);
59291         return ret_arr;
59292 }
59293
59294 int64_t  CS_LDK_HTLCOutputInCommitment_read(int8_tArray ser) {
59295         LDKu8slice ser_ref;
59296         ser_ref.datalen = ser->arr_len;
59297         ser_ref.data = ser->elems;
59298         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
59299         *ret_conv = HTLCOutputInCommitment_read(ser_ref);
59300         FREE(ser);
59301         return tag_ptr(ret_conv, true);
59302 }
59303
59304 int8_tArray  CS_LDK_get_htlc_redeemscript(int64_t htlc, int64_t channel_type_features, int64_t keys) {
59305         LDKHTLCOutputInCommitment htlc_conv;
59306         htlc_conv.inner = untag_ptr(htlc);
59307         htlc_conv.is_owned = ptr_is_owned(htlc);
59308         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
59309         htlc_conv.is_owned = false;
59310         LDKChannelTypeFeatures channel_type_features_conv;
59311         channel_type_features_conv.inner = untag_ptr(channel_type_features);
59312         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
59313         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
59314         channel_type_features_conv.is_owned = false;
59315         LDKTxCreationKeys keys_conv;
59316         keys_conv.inner = untag_ptr(keys);
59317         keys_conv.is_owned = ptr_is_owned(keys);
59318         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
59319         keys_conv.is_owned = false;
59320         LDKCVec_u8Z ret_var = get_htlc_redeemscript(&htlc_conv, &channel_type_features_conv, &keys_conv);
59321         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
59322         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
59323         CVec_u8Z_free(ret_var);
59324         return ret_arr;
59325 }
59326
59327 int8_tArray  CS_LDK_make_funding_redeemscript(int8_tArray broadcaster, int8_tArray countersignatory) {
59328         LDKPublicKey broadcaster_ref;
59329         CHECK(broadcaster->arr_len == 33);
59330         memcpy(broadcaster_ref.compressed_form, broadcaster->elems, 33); FREE(broadcaster);
59331         LDKPublicKey countersignatory_ref;
59332         CHECK(countersignatory->arr_len == 33);
59333         memcpy(countersignatory_ref.compressed_form, countersignatory->elems, 33); FREE(countersignatory);
59334         LDKCVec_u8Z ret_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
59335         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
59336         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
59337         CVec_u8Z_free(ret_var);
59338         return ret_arr;
59339 }
59340
59341 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) {
59342         uint8_t commitment_txid_arr[32];
59343         CHECK(commitment_txid->arr_len == 32);
59344         memcpy(commitment_txid_arr, commitment_txid->elems, 32); FREE(commitment_txid);
59345         uint8_t (*commitment_txid_ref)[32] = &commitment_txid_arr;
59346         LDKHTLCOutputInCommitment htlc_conv;
59347         htlc_conv.inner = untag_ptr(htlc);
59348         htlc_conv.is_owned = ptr_is_owned(htlc);
59349         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
59350         htlc_conv.is_owned = false;
59351         LDKChannelTypeFeatures channel_type_features_conv;
59352         channel_type_features_conv.inner = untag_ptr(channel_type_features);
59353         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
59354         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
59355         channel_type_features_conv.is_owned = false;
59356         LDKDelayedPaymentKey broadcaster_delayed_payment_key_conv;
59357         broadcaster_delayed_payment_key_conv.inner = untag_ptr(broadcaster_delayed_payment_key);
59358         broadcaster_delayed_payment_key_conv.is_owned = ptr_is_owned(broadcaster_delayed_payment_key);
59359         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_delayed_payment_key_conv);
59360         broadcaster_delayed_payment_key_conv.is_owned = false;
59361         LDKRevocationKey revocation_key_conv;
59362         revocation_key_conv.inner = untag_ptr(revocation_key);
59363         revocation_key_conv.is_owned = ptr_is_owned(revocation_key);
59364         CHECK_INNER_FIELD_ACCESS_OR_NULL(revocation_key_conv);
59365         revocation_key_conv.is_owned = false;
59366         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);
59367         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
59368         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
59369         Transaction_free(ret_var);
59370         return ret_arr;
59371 }
59372
59373 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) {
59374         LDKECDSASignature local_sig_ref;
59375         CHECK(local_sig->arr_len == 64);
59376         memcpy(local_sig_ref.compact_form, local_sig->elems, 64); FREE(local_sig);
59377         LDKECDSASignature remote_sig_ref;
59378         CHECK(remote_sig->arr_len == 64);
59379         memcpy(remote_sig_ref.compact_form, remote_sig->elems, 64); FREE(remote_sig);
59380         void* preimage_ptr = untag_ptr(preimage);
59381         CHECK_ACCESS(preimage_ptr);
59382         LDKCOption_ThirtyTwoBytesZ preimage_conv = *(LDKCOption_ThirtyTwoBytesZ*)(preimage_ptr);
59383         preimage_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(preimage));
59384         LDKu8slice redeem_script_ref;
59385         redeem_script_ref.datalen = redeem_script->arr_len;
59386         redeem_script_ref.data = redeem_script->elems;
59387         LDKChannelTypeFeatures channel_type_features_conv;
59388         channel_type_features_conv.inner = untag_ptr(channel_type_features);
59389         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
59390         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
59391         channel_type_features_conv.is_owned = false;
59392         LDKWitness ret_var = build_htlc_input_witness(local_sig_ref, remote_sig_ref, preimage_conv, redeem_script_ref, &channel_type_features_conv);
59393         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
59394         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
59395         Witness_free(ret_var);
59396         FREE(redeem_script);
59397         return ret_arr;
59398 }
59399
59400 int8_tArray  CS_LDK_get_to_countersignatory_with_anchors_redeemscript(int8_tArray payment_point) {
59401         LDKPublicKey payment_point_ref;
59402         CHECK(payment_point->arr_len == 33);
59403         memcpy(payment_point_ref.compressed_form, payment_point->elems, 33); FREE(payment_point);
59404         LDKCVec_u8Z ret_var = get_to_countersignatory_with_anchors_redeemscript(payment_point_ref);
59405         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
59406         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
59407         CVec_u8Z_free(ret_var);
59408         return ret_arr;
59409 }
59410
59411 int8_tArray  CS_LDK_get_anchor_redeemscript(int8_tArray funding_pubkey) {
59412         LDKPublicKey funding_pubkey_ref;
59413         CHECK(funding_pubkey->arr_len == 33);
59414         memcpy(funding_pubkey_ref.compressed_form, funding_pubkey->elems, 33); FREE(funding_pubkey);
59415         LDKCVec_u8Z ret_var = get_anchor_redeemscript(funding_pubkey_ref);
59416         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
59417         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
59418         CVec_u8Z_free(ret_var);
59419         return ret_arr;
59420 }
59421
59422 int8_tArray  CS_LDK_build_anchor_input_witness(int8_tArray funding_key, int8_tArray funding_sig) {
59423         LDKPublicKey funding_key_ref;
59424         CHECK(funding_key->arr_len == 33);
59425         memcpy(funding_key_ref.compressed_form, funding_key->elems, 33); FREE(funding_key);
59426         LDKECDSASignature funding_sig_ref;
59427         CHECK(funding_sig->arr_len == 64);
59428         memcpy(funding_sig_ref.compact_form, funding_sig->elems, 64); FREE(funding_sig);
59429         LDKWitness ret_var = build_anchor_input_witness(funding_key_ref, funding_sig_ref);
59430         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
59431         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
59432         Witness_free(ret_var);
59433         return ret_arr;
59434 }
59435
59436 void  CS_LDK_ChannelTransactionParameters_free(int64_t this_obj) {
59437         LDKChannelTransactionParameters this_obj_conv;
59438         this_obj_conv.inner = untag_ptr(this_obj);
59439         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59440         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59441         ChannelTransactionParameters_free(this_obj_conv);
59442 }
59443
59444 int64_t  CS_LDK_ChannelTransactionParameters_get_holder_pubkeys(int64_t this_ptr) {
59445         LDKChannelTransactionParameters this_ptr_conv;
59446         this_ptr_conv.inner = untag_ptr(this_ptr);
59447         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59448         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59449         this_ptr_conv.is_owned = false;
59450         LDKChannelPublicKeys ret_var = ChannelTransactionParameters_get_holder_pubkeys(&this_ptr_conv);
59451         int64_t ret_ref = 0;
59452         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59453         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59454         return ret_ref;
59455 }
59456
59457 void  CS_LDK_ChannelTransactionParameters_set_holder_pubkeys(int64_t this_ptr, int64_t val) {
59458         LDKChannelTransactionParameters this_ptr_conv;
59459         this_ptr_conv.inner = untag_ptr(this_ptr);
59460         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59461         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59462         this_ptr_conv.is_owned = false;
59463         LDKChannelPublicKeys val_conv;
59464         val_conv.inner = untag_ptr(val);
59465         val_conv.is_owned = ptr_is_owned(val);
59466         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
59467         val_conv = ChannelPublicKeys_clone(&val_conv);
59468         ChannelTransactionParameters_set_holder_pubkeys(&this_ptr_conv, val_conv);
59469 }
59470
59471 int16_t  CS_LDK_ChannelTransactionParameters_get_holder_selected_contest_delay(int64_t this_ptr) {
59472         LDKChannelTransactionParameters this_ptr_conv;
59473         this_ptr_conv.inner = untag_ptr(this_ptr);
59474         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59475         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59476         this_ptr_conv.is_owned = false;
59477         int16_t ret_conv = ChannelTransactionParameters_get_holder_selected_contest_delay(&this_ptr_conv);
59478         return ret_conv;
59479 }
59480
59481 void  CS_LDK_ChannelTransactionParameters_set_holder_selected_contest_delay(int64_t this_ptr, int16_t val) {
59482         LDKChannelTransactionParameters this_ptr_conv;
59483         this_ptr_conv.inner = untag_ptr(this_ptr);
59484         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59485         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59486         this_ptr_conv.is_owned = false;
59487         ChannelTransactionParameters_set_holder_selected_contest_delay(&this_ptr_conv, val);
59488 }
59489
59490 jboolean  CS_LDK_ChannelTransactionParameters_get_is_outbound_from_holder(int64_t this_ptr) {
59491         LDKChannelTransactionParameters this_ptr_conv;
59492         this_ptr_conv.inner = untag_ptr(this_ptr);
59493         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59494         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59495         this_ptr_conv.is_owned = false;
59496         jboolean ret_conv = ChannelTransactionParameters_get_is_outbound_from_holder(&this_ptr_conv);
59497         return ret_conv;
59498 }
59499
59500 void  CS_LDK_ChannelTransactionParameters_set_is_outbound_from_holder(int64_t this_ptr, jboolean val) {
59501         LDKChannelTransactionParameters this_ptr_conv;
59502         this_ptr_conv.inner = untag_ptr(this_ptr);
59503         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59504         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59505         this_ptr_conv.is_owned = false;
59506         ChannelTransactionParameters_set_is_outbound_from_holder(&this_ptr_conv, val);
59507 }
59508
59509 int64_t  CS_LDK_ChannelTransactionParameters_get_counterparty_parameters(int64_t this_ptr) {
59510         LDKChannelTransactionParameters this_ptr_conv;
59511         this_ptr_conv.inner = untag_ptr(this_ptr);
59512         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59513         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59514         this_ptr_conv.is_owned = false;
59515         LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv);
59516         int64_t ret_ref = 0;
59517         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59518         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59519         return ret_ref;
59520 }
59521
59522 void  CS_LDK_ChannelTransactionParameters_set_counterparty_parameters(int64_t this_ptr, int64_t val) {
59523         LDKChannelTransactionParameters this_ptr_conv;
59524         this_ptr_conv.inner = untag_ptr(this_ptr);
59525         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59526         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59527         this_ptr_conv.is_owned = false;
59528         LDKCounterpartyChannelTransactionParameters val_conv;
59529         val_conv.inner = untag_ptr(val);
59530         val_conv.is_owned = ptr_is_owned(val);
59531         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
59532         val_conv = CounterpartyChannelTransactionParameters_clone(&val_conv);
59533         ChannelTransactionParameters_set_counterparty_parameters(&this_ptr_conv, val_conv);
59534 }
59535
59536 int64_t  CS_LDK_ChannelTransactionParameters_get_funding_outpoint(int64_t this_ptr) {
59537         LDKChannelTransactionParameters this_ptr_conv;
59538         this_ptr_conv.inner = untag_ptr(this_ptr);
59539         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59540         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59541         this_ptr_conv.is_owned = false;
59542         LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv);
59543         int64_t ret_ref = 0;
59544         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59545         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59546         return ret_ref;
59547 }
59548
59549 void  CS_LDK_ChannelTransactionParameters_set_funding_outpoint(int64_t this_ptr, int64_t val) {
59550         LDKChannelTransactionParameters this_ptr_conv;
59551         this_ptr_conv.inner = untag_ptr(this_ptr);
59552         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59553         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59554         this_ptr_conv.is_owned = false;
59555         LDKOutPoint val_conv;
59556         val_conv.inner = untag_ptr(val);
59557         val_conv.is_owned = ptr_is_owned(val);
59558         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
59559         val_conv = OutPoint_clone(&val_conv);
59560         ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv);
59561 }
59562
59563 int64_t  CS_LDK_ChannelTransactionParameters_get_channel_type_features(int64_t this_ptr) {
59564         LDKChannelTransactionParameters this_ptr_conv;
59565         this_ptr_conv.inner = untag_ptr(this_ptr);
59566         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59567         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59568         this_ptr_conv.is_owned = false;
59569         LDKChannelTypeFeatures ret_var = ChannelTransactionParameters_get_channel_type_features(&this_ptr_conv);
59570         int64_t ret_ref = 0;
59571         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59572         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59573         return ret_ref;
59574 }
59575
59576 void  CS_LDK_ChannelTransactionParameters_set_channel_type_features(int64_t this_ptr, int64_t val) {
59577         LDKChannelTransactionParameters this_ptr_conv;
59578         this_ptr_conv.inner = untag_ptr(this_ptr);
59579         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59580         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59581         this_ptr_conv.is_owned = false;
59582         LDKChannelTypeFeatures val_conv;
59583         val_conv.inner = untag_ptr(val);
59584         val_conv.is_owned = ptr_is_owned(val);
59585         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
59586         val_conv = ChannelTypeFeatures_clone(&val_conv);
59587         ChannelTransactionParameters_set_channel_type_features(&this_ptr_conv, val_conv);
59588 }
59589
59590 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) {
59591         LDKChannelPublicKeys holder_pubkeys_arg_conv;
59592         holder_pubkeys_arg_conv.inner = untag_ptr(holder_pubkeys_arg);
59593         holder_pubkeys_arg_conv.is_owned = ptr_is_owned(holder_pubkeys_arg);
59594         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_pubkeys_arg_conv);
59595         holder_pubkeys_arg_conv = ChannelPublicKeys_clone(&holder_pubkeys_arg_conv);
59596         LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg_conv;
59597         counterparty_parameters_arg_conv.inner = untag_ptr(counterparty_parameters_arg);
59598         counterparty_parameters_arg_conv.is_owned = ptr_is_owned(counterparty_parameters_arg);
59599         CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_parameters_arg_conv);
59600         counterparty_parameters_arg_conv = CounterpartyChannelTransactionParameters_clone(&counterparty_parameters_arg_conv);
59601         LDKOutPoint funding_outpoint_arg_conv;
59602         funding_outpoint_arg_conv.inner = untag_ptr(funding_outpoint_arg);
59603         funding_outpoint_arg_conv.is_owned = ptr_is_owned(funding_outpoint_arg);
59604         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_arg_conv);
59605         funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv);
59606         LDKChannelTypeFeatures channel_type_features_arg_conv;
59607         channel_type_features_arg_conv.inner = untag_ptr(channel_type_features_arg);
59608         channel_type_features_arg_conv.is_owned = ptr_is_owned(channel_type_features_arg);
59609         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_arg_conv);
59610         channel_type_features_arg_conv = ChannelTypeFeatures_clone(&channel_type_features_arg_conv);
59611         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);
59612         int64_t ret_ref = 0;
59613         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59614         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59615         return ret_ref;
59616 }
59617
59618 static inline uint64_t ChannelTransactionParameters_clone_ptr(LDKChannelTransactionParameters *NONNULL_PTR arg) {
59619         LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(arg);
59620         int64_t ret_ref = 0;
59621         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59622         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59623         return ret_ref;
59624 }
59625 int64_t  CS_LDK_ChannelTransactionParameters_clone_ptr(int64_t arg) {
59626         LDKChannelTransactionParameters arg_conv;
59627         arg_conv.inner = untag_ptr(arg);
59628         arg_conv.is_owned = ptr_is_owned(arg);
59629         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59630         arg_conv.is_owned = false;
59631         int64_t ret_conv = ChannelTransactionParameters_clone_ptr(&arg_conv);
59632         return ret_conv;
59633 }
59634
59635 int64_t  CS_LDK_ChannelTransactionParameters_clone(int64_t orig) {
59636         LDKChannelTransactionParameters orig_conv;
59637         orig_conv.inner = untag_ptr(orig);
59638         orig_conv.is_owned = ptr_is_owned(orig);
59639         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59640         orig_conv.is_owned = false;
59641         LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv);
59642         int64_t ret_ref = 0;
59643         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59644         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59645         return ret_ref;
59646 }
59647
59648 int64_t  CS_LDK_ChannelTransactionParameters_hash(int64_t o) {
59649         LDKChannelTransactionParameters o_conv;
59650         o_conv.inner = untag_ptr(o);
59651         o_conv.is_owned = ptr_is_owned(o);
59652         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
59653         o_conv.is_owned = false;
59654         int64_t ret_conv = ChannelTransactionParameters_hash(&o_conv);
59655         return ret_conv;
59656 }
59657
59658 jboolean  CS_LDK_ChannelTransactionParameters_eq(int64_t a, int64_t b) {
59659         LDKChannelTransactionParameters a_conv;
59660         a_conv.inner = untag_ptr(a);
59661         a_conv.is_owned = ptr_is_owned(a);
59662         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
59663         a_conv.is_owned = false;
59664         LDKChannelTransactionParameters b_conv;
59665         b_conv.inner = untag_ptr(b);
59666         b_conv.is_owned = ptr_is_owned(b);
59667         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
59668         b_conv.is_owned = false;
59669         jboolean ret_conv = ChannelTransactionParameters_eq(&a_conv, &b_conv);
59670         return ret_conv;
59671 }
59672
59673 void  CS_LDK_CounterpartyChannelTransactionParameters_free(int64_t this_obj) {
59674         LDKCounterpartyChannelTransactionParameters this_obj_conv;
59675         this_obj_conv.inner = untag_ptr(this_obj);
59676         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59677         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59678         CounterpartyChannelTransactionParameters_free(this_obj_conv);
59679 }
59680
59681 int64_t  CS_LDK_CounterpartyChannelTransactionParameters_get_pubkeys(int64_t this_ptr) {
59682         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
59683         this_ptr_conv.inner = untag_ptr(this_ptr);
59684         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59685         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59686         this_ptr_conv.is_owned = false;
59687         LDKChannelPublicKeys ret_var = CounterpartyChannelTransactionParameters_get_pubkeys(&this_ptr_conv);
59688         int64_t ret_ref = 0;
59689         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59690         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59691         return ret_ref;
59692 }
59693
59694 void  CS_LDK_CounterpartyChannelTransactionParameters_set_pubkeys(int64_t this_ptr, int64_t val) {
59695         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
59696         this_ptr_conv.inner = untag_ptr(this_ptr);
59697         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59698         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59699         this_ptr_conv.is_owned = false;
59700         LDKChannelPublicKeys val_conv;
59701         val_conv.inner = untag_ptr(val);
59702         val_conv.is_owned = ptr_is_owned(val);
59703         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
59704         val_conv = ChannelPublicKeys_clone(&val_conv);
59705         CounterpartyChannelTransactionParameters_set_pubkeys(&this_ptr_conv, val_conv);
59706 }
59707
59708 int16_t  CS_LDK_CounterpartyChannelTransactionParameters_get_selected_contest_delay(int64_t this_ptr) {
59709         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
59710         this_ptr_conv.inner = untag_ptr(this_ptr);
59711         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59712         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59713         this_ptr_conv.is_owned = false;
59714         int16_t ret_conv = CounterpartyChannelTransactionParameters_get_selected_contest_delay(&this_ptr_conv);
59715         return ret_conv;
59716 }
59717
59718 void  CS_LDK_CounterpartyChannelTransactionParameters_set_selected_contest_delay(int64_t this_ptr, int16_t val) {
59719         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
59720         this_ptr_conv.inner = untag_ptr(this_ptr);
59721         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59722         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59723         this_ptr_conv.is_owned = false;
59724         CounterpartyChannelTransactionParameters_set_selected_contest_delay(&this_ptr_conv, val);
59725 }
59726
59727 int64_t  CS_LDK_CounterpartyChannelTransactionParameters_new(int64_t pubkeys_arg, int16_t selected_contest_delay_arg) {
59728         LDKChannelPublicKeys pubkeys_arg_conv;
59729         pubkeys_arg_conv.inner = untag_ptr(pubkeys_arg);
59730         pubkeys_arg_conv.is_owned = ptr_is_owned(pubkeys_arg);
59731         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_arg_conv);
59732         pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv);
59733         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg);
59734         int64_t ret_ref = 0;
59735         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59736         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59737         return ret_ref;
59738 }
59739
59740 static inline uint64_t CounterpartyChannelTransactionParameters_clone_ptr(LDKCounterpartyChannelTransactionParameters *NONNULL_PTR arg) {
59741         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(arg);
59742         int64_t ret_ref = 0;
59743         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59744         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59745         return ret_ref;
59746 }
59747 int64_t  CS_LDK_CounterpartyChannelTransactionParameters_clone_ptr(int64_t arg) {
59748         LDKCounterpartyChannelTransactionParameters arg_conv;
59749         arg_conv.inner = untag_ptr(arg);
59750         arg_conv.is_owned = ptr_is_owned(arg);
59751         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59752         arg_conv.is_owned = false;
59753         int64_t ret_conv = CounterpartyChannelTransactionParameters_clone_ptr(&arg_conv);
59754         return ret_conv;
59755 }
59756
59757 int64_t  CS_LDK_CounterpartyChannelTransactionParameters_clone(int64_t orig) {
59758         LDKCounterpartyChannelTransactionParameters orig_conv;
59759         orig_conv.inner = untag_ptr(orig);
59760         orig_conv.is_owned = ptr_is_owned(orig);
59761         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59762         orig_conv.is_owned = false;
59763         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_conv);
59764         int64_t ret_ref = 0;
59765         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59766         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59767         return ret_ref;
59768 }
59769
59770 int64_t  CS_LDK_CounterpartyChannelTransactionParameters_hash(int64_t o) {
59771         LDKCounterpartyChannelTransactionParameters o_conv;
59772         o_conv.inner = untag_ptr(o);
59773         o_conv.is_owned = ptr_is_owned(o);
59774         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
59775         o_conv.is_owned = false;
59776         int64_t ret_conv = CounterpartyChannelTransactionParameters_hash(&o_conv);
59777         return ret_conv;
59778 }
59779
59780 jboolean  CS_LDK_CounterpartyChannelTransactionParameters_eq(int64_t a, int64_t b) {
59781         LDKCounterpartyChannelTransactionParameters a_conv;
59782         a_conv.inner = untag_ptr(a);
59783         a_conv.is_owned = ptr_is_owned(a);
59784         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
59785         a_conv.is_owned = false;
59786         LDKCounterpartyChannelTransactionParameters b_conv;
59787         b_conv.inner = untag_ptr(b);
59788         b_conv.is_owned = ptr_is_owned(b);
59789         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
59790         b_conv.is_owned = false;
59791         jboolean ret_conv = CounterpartyChannelTransactionParameters_eq(&a_conv, &b_conv);
59792         return ret_conv;
59793 }
59794
59795 jboolean  CS_LDK_ChannelTransactionParameters_is_populated(int64_t this_arg) {
59796         LDKChannelTransactionParameters this_arg_conv;
59797         this_arg_conv.inner = untag_ptr(this_arg);
59798         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59799         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59800         this_arg_conv.is_owned = false;
59801         jboolean ret_conv = ChannelTransactionParameters_is_populated(&this_arg_conv);
59802         return ret_conv;
59803 }
59804
59805 int64_t  CS_LDK_ChannelTransactionParameters_as_holder_broadcastable(int64_t this_arg) {
59806         LDKChannelTransactionParameters this_arg_conv;
59807         this_arg_conv.inner = untag_ptr(this_arg);
59808         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59809         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59810         this_arg_conv.is_owned = false;
59811         LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv);
59812         int64_t ret_ref = 0;
59813         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59814         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59815         return ret_ref;
59816 }
59817
59818 int64_t  CS_LDK_ChannelTransactionParameters_as_counterparty_broadcastable(int64_t this_arg) {
59819         LDKChannelTransactionParameters this_arg_conv;
59820         this_arg_conv.inner = untag_ptr(this_arg);
59821         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59822         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59823         this_arg_conv.is_owned = false;
59824         LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv);
59825         int64_t ret_ref = 0;
59826         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59827         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59828         return ret_ref;
59829 }
59830
59831 int8_tArray  CS_LDK_CounterpartyChannelTransactionParameters_write(int64_t obj) {
59832         LDKCounterpartyChannelTransactionParameters obj_conv;
59833         obj_conv.inner = untag_ptr(obj);
59834         obj_conv.is_owned = ptr_is_owned(obj);
59835         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
59836         obj_conv.is_owned = false;
59837         LDKCVec_u8Z ret_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
59838         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
59839         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
59840         CVec_u8Z_free(ret_var);
59841         return ret_arr;
59842 }
59843
59844 int64_t  CS_LDK_CounterpartyChannelTransactionParameters_read(int8_tArray ser) {
59845         LDKu8slice ser_ref;
59846         ser_ref.datalen = ser->arr_len;
59847         ser_ref.data = ser->elems;
59848         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
59849         *ret_conv = CounterpartyChannelTransactionParameters_read(ser_ref);
59850         FREE(ser);
59851         return tag_ptr(ret_conv, true);
59852 }
59853
59854 int8_tArray  CS_LDK_ChannelTransactionParameters_write(int64_t obj) {
59855         LDKChannelTransactionParameters obj_conv;
59856         obj_conv.inner = untag_ptr(obj);
59857         obj_conv.is_owned = ptr_is_owned(obj);
59858         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
59859         obj_conv.is_owned = false;
59860         LDKCVec_u8Z ret_var = ChannelTransactionParameters_write(&obj_conv);
59861         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
59862         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
59863         CVec_u8Z_free(ret_var);
59864         return ret_arr;
59865 }
59866
59867 int64_t  CS_LDK_ChannelTransactionParameters_read(int8_tArray ser) {
59868         LDKu8slice ser_ref;
59869         ser_ref.datalen = ser->arr_len;
59870         ser_ref.data = ser->elems;
59871         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
59872         *ret_conv = ChannelTransactionParameters_read(ser_ref);
59873         FREE(ser);
59874         return tag_ptr(ret_conv, true);
59875 }
59876
59877 void  CS_LDK_DirectedChannelTransactionParameters_free(int64_t this_obj) {
59878         LDKDirectedChannelTransactionParameters this_obj_conv;
59879         this_obj_conv.inner = untag_ptr(this_obj);
59880         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59881         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59882         DirectedChannelTransactionParameters_free(this_obj_conv);
59883 }
59884
59885 int64_t  CS_LDK_DirectedChannelTransactionParameters_broadcaster_pubkeys(int64_t this_arg) {
59886         LDKDirectedChannelTransactionParameters this_arg_conv;
59887         this_arg_conv.inner = untag_ptr(this_arg);
59888         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59889         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59890         this_arg_conv.is_owned = false;
59891         LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_conv);
59892         int64_t ret_ref = 0;
59893         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59894         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59895         return ret_ref;
59896 }
59897
59898 int64_t  CS_LDK_DirectedChannelTransactionParameters_countersignatory_pubkeys(int64_t this_arg) {
59899         LDKDirectedChannelTransactionParameters this_arg_conv;
59900         this_arg_conv.inner = untag_ptr(this_arg);
59901         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59902         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59903         this_arg_conv.is_owned = false;
59904         LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_conv);
59905         int64_t ret_ref = 0;
59906         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59907         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59908         return ret_ref;
59909 }
59910
59911 int16_t  CS_LDK_DirectedChannelTransactionParameters_contest_delay(int64_t this_arg) {
59912         LDKDirectedChannelTransactionParameters this_arg_conv;
59913         this_arg_conv.inner = untag_ptr(this_arg);
59914         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59915         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59916         this_arg_conv.is_owned = false;
59917         int16_t ret_conv = DirectedChannelTransactionParameters_contest_delay(&this_arg_conv);
59918         return ret_conv;
59919 }
59920
59921 jboolean  CS_LDK_DirectedChannelTransactionParameters_is_outbound(int64_t this_arg) {
59922         LDKDirectedChannelTransactionParameters this_arg_conv;
59923         this_arg_conv.inner = untag_ptr(this_arg);
59924         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59925         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59926         this_arg_conv.is_owned = false;
59927         jboolean ret_conv = DirectedChannelTransactionParameters_is_outbound(&this_arg_conv);
59928         return ret_conv;
59929 }
59930
59931 int64_t  CS_LDK_DirectedChannelTransactionParameters_funding_outpoint(int64_t this_arg) {
59932         LDKDirectedChannelTransactionParameters this_arg_conv;
59933         this_arg_conv.inner = untag_ptr(this_arg);
59934         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59935         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59936         this_arg_conv.is_owned = false;
59937         LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_conv);
59938         int64_t ret_ref = 0;
59939         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59940         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59941         return ret_ref;
59942 }
59943
59944 int64_t  CS_LDK_DirectedChannelTransactionParameters_channel_type_features(int64_t this_arg) {
59945         LDKDirectedChannelTransactionParameters this_arg_conv;
59946         this_arg_conv.inner = untag_ptr(this_arg);
59947         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59948         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59949         this_arg_conv.is_owned = false;
59950         LDKChannelTypeFeatures ret_var = DirectedChannelTransactionParameters_channel_type_features(&this_arg_conv);
59951         int64_t ret_ref = 0;
59952         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59953         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59954         return ret_ref;
59955 }
59956
59957 void  CS_LDK_HolderCommitmentTransaction_free(int64_t this_obj) {
59958         LDKHolderCommitmentTransaction this_obj_conv;
59959         this_obj_conv.inner = untag_ptr(this_obj);
59960         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59961         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59962         HolderCommitmentTransaction_free(this_obj_conv);
59963 }
59964
59965 int8_tArray  CS_LDK_HolderCommitmentTransaction_get_counterparty_sig(int64_t this_ptr) {
59966         LDKHolderCommitmentTransaction this_ptr_conv;
59967         this_ptr_conv.inner = untag_ptr(this_ptr);
59968         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59969         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59970         this_ptr_conv.is_owned = false;
59971         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
59972         memcpy(ret_arr->elems, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form, 64);
59973         return ret_arr;
59974 }
59975
59976 void  CS_LDK_HolderCommitmentTransaction_set_counterparty_sig(int64_t this_ptr, int8_tArray val) {
59977         LDKHolderCommitmentTransaction this_ptr_conv;
59978         this_ptr_conv.inner = untag_ptr(this_ptr);
59979         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59980         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59981         this_ptr_conv.is_owned = false;
59982         LDKECDSASignature val_ref;
59983         CHECK(val->arr_len == 64);
59984         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
59985         HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
59986 }
59987
59988 ptrArray  CS_LDK_HolderCommitmentTransaction_get_counterparty_htlc_sigs(int64_t this_ptr) {
59989         LDKHolderCommitmentTransaction this_ptr_conv;
59990         this_ptr_conv.inner = untag_ptr(this_ptr);
59991         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59992         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59993         this_ptr_conv.is_owned = false;
59994         LDKCVec_ECDSASignatureZ ret_var = HolderCommitmentTransaction_get_counterparty_htlc_sigs(&this_ptr_conv);
59995         ptrArray ret_arr = NULL;
59996         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
59997         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
59998         for (size_t i = 0; i < ret_var.datalen; i++) {
59999                 int8_tArray ret_conv_8_arr = init_int8_tArray(64, __LINE__);
60000                 memcpy(ret_conv_8_arr->elems, ret_var.data[i].compact_form, 64);
60001                 ret_arr_ptr[i] = ret_conv_8_arr;
60002         }
60003         
60004         FREE(ret_var.data);
60005         return ret_arr;
60006 }
60007
60008 void  CS_LDK_HolderCommitmentTransaction_set_counterparty_htlc_sigs(int64_t this_ptr, ptrArray val) {
60009         LDKHolderCommitmentTransaction this_ptr_conv;
60010         this_ptr_conv.inner = untag_ptr(this_ptr);
60011         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60012         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60013         this_ptr_conv.is_owned = false;
60014         LDKCVec_ECDSASignatureZ val_constr;
60015         val_constr.datalen = val->arr_len;
60016         if (val_constr.datalen > 0)
60017                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
60018         else
60019                 val_constr.data = NULL;
60020         int8_tArray* val_vals = (void*) val->elems;
60021         for (size_t i = 0; i < val_constr.datalen; i++) {
60022                 int8_tArray val_conv_8 = val_vals[i];
60023                 LDKECDSASignature val_conv_8_ref;
60024                 CHECK(val_conv_8->arr_len == 64);
60025                 memcpy(val_conv_8_ref.compact_form, val_conv_8->elems, 64); FREE(val_conv_8);
60026                 val_constr.data[i] = val_conv_8_ref;
60027         }
60028         FREE(val);
60029         HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
60030 }
60031
60032 static inline uint64_t HolderCommitmentTransaction_clone_ptr(LDKHolderCommitmentTransaction *NONNULL_PTR arg) {
60033         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(arg);
60034         int64_t ret_ref = 0;
60035         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60036         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60037         return ret_ref;
60038 }
60039 int64_t  CS_LDK_HolderCommitmentTransaction_clone_ptr(int64_t arg) {
60040         LDKHolderCommitmentTransaction arg_conv;
60041         arg_conv.inner = untag_ptr(arg);
60042         arg_conv.is_owned = ptr_is_owned(arg);
60043         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60044         arg_conv.is_owned = false;
60045         int64_t ret_conv = HolderCommitmentTransaction_clone_ptr(&arg_conv);
60046         return ret_conv;
60047 }
60048
60049 int64_t  CS_LDK_HolderCommitmentTransaction_clone(int64_t orig) {
60050         LDKHolderCommitmentTransaction orig_conv;
60051         orig_conv.inner = untag_ptr(orig);
60052         orig_conv.is_owned = ptr_is_owned(orig);
60053         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60054         orig_conv.is_owned = false;
60055         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
60056         int64_t ret_ref = 0;
60057         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60058         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60059         return ret_ref;
60060 }
60061
60062 int8_tArray  CS_LDK_HolderCommitmentTransaction_write(int64_t obj) {
60063         LDKHolderCommitmentTransaction obj_conv;
60064         obj_conv.inner = untag_ptr(obj);
60065         obj_conv.is_owned = ptr_is_owned(obj);
60066         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60067         obj_conv.is_owned = false;
60068         LDKCVec_u8Z ret_var = HolderCommitmentTransaction_write(&obj_conv);
60069         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
60070         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
60071         CVec_u8Z_free(ret_var);
60072         return ret_arr;
60073 }
60074
60075 int64_t  CS_LDK_HolderCommitmentTransaction_read(int8_tArray ser) {
60076         LDKu8slice ser_ref;
60077         ser_ref.datalen = ser->arr_len;
60078         ser_ref.data = ser->elems;
60079         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
60080         *ret_conv = HolderCommitmentTransaction_read(ser_ref);
60081         FREE(ser);
60082         return tag_ptr(ret_conv, true);
60083 }
60084
60085 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) {
60086         LDKCommitmentTransaction commitment_tx_conv;
60087         commitment_tx_conv.inner = untag_ptr(commitment_tx);
60088         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
60089         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
60090         commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
60091         LDKECDSASignature counterparty_sig_ref;
60092         CHECK(counterparty_sig->arr_len == 64);
60093         memcpy(counterparty_sig_ref.compact_form, counterparty_sig->elems, 64); FREE(counterparty_sig);
60094         LDKCVec_ECDSASignatureZ counterparty_htlc_sigs_constr;
60095         counterparty_htlc_sigs_constr.datalen = counterparty_htlc_sigs->arr_len;
60096         if (counterparty_htlc_sigs_constr.datalen > 0)
60097                 counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
60098         else
60099                 counterparty_htlc_sigs_constr.data = NULL;
60100         int8_tArray* counterparty_htlc_sigs_vals = (void*) counterparty_htlc_sigs->elems;
60101         for (size_t i = 0; i < counterparty_htlc_sigs_constr.datalen; i++) {
60102                 int8_tArray counterparty_htlc_sigs_conv_8 = counterparty_htlc_sigs_vals[i];
60103                 LDKECDSASignature counterparty_htlc_sigs_conv_8_ref;
60104                 CHECK(counterparty_htlc_sigs_conv_8->arr_len == 64);
60105                 memcpy(counterparty_htlc_sigs_conv_8_ref.compact_form, counterparty_htlc_sigs_conv_8->elems, 64); FREE(counterparty_htlc_sigs_conv_8);
60106                 counterparty_htlc_sigs_constr.data[i] = counterparty_htlc_sigs_conv_8_ref;
60107         }
60108         FREE(counterparty_htlc_sigs);
60109         LDKPublicKey holder_funding_key_ref;
60110         CHECK(holder_funding_key->arr_len == 33);
60111         memcpy(holder_funding_key_ref.compressed_form, holder_funding_key->elems, 33); FREE(holder_funding_key);
60112         LDKPublicKey counterparty_funding_key_ref;
60113         CHECK(counterparty_funding_key->arr_len == 33);
60114         memcpy(counterparty_funding_key_ref.compressed_form, counterparty_funding_key->elems, 33); FREE(counterparty_funding_key);
60115         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
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 void  CS_LDK_BuiltCommitmentTransaction_free(int64_t this_obj) {
60123         LDKBuiltCommitmentTransaction this_obj_conv;
60124         this_obj_conv.inner = untag_ptr(this_obj);
60125         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60126         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60127         BuiltCommitmentTransaction_free(this_obj_conv);
60128 }
60129
60130 int8_tArray  CS_LDK_BuiltCommitmentTransaction_get_transaction(int64_t this_ptr) {
60131         LDKBuiltCommitmentTransaction this_ptr_conv;
60132         this_ptr_conv.inner = untag_ptr(this_ptr);
60133         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60134         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60135         this_ptr_conv.is_owned = false;
60136         LDKTransaction ret_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
60137         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
60138         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
60139         Transaction_free(ret_var);
60140         return ret_arr;
60141 }
60142
60143 void  CS_LDK_BuiltCommitmentTransaction_set_transaction(int64_t this_ptr, int8_tArray val) {
60144         LDKBuiltCommitmentTransaction this_ptr_conv;
60145         this_ptr_conv.inner = untag_ptr(this_ptr);
60146         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60147         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60148         this_ptr_conv.is_owned = false;
60149         LDKTransaction val_ref;
60150         val_ref.datalen = val->arr_len;
60151         val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
60152         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
60153         val_ref.data_is_owned = true;
60154         BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
60155 }
60156
60157 int8_tArray  CS_LDK_BuiltCommitmentTransaction_get_txid(int64_t this_ptr) {
60158         LDKBuiltCommitmentTransaction this_ptr_conv;
60159         this_ptr_conv.inner = untag_ptr(this_ptr);
60160         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60161         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60162         this_ptr_conv.is_owned = false;
60163         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
60164         memcpy(ret_arr->elems, *BuiltCommitmentTransaction_get_txid(&this_ptr_conv), 32);
60165         return ret_arr;
60166 }
60167
60168 void  CS_LDK_BuiltCommitmentTransaction_set_txid(int64_t this_ptr, int8_tArray val) {
60169         LDKBuiltCommitmentTransaction this_ptr_conv;
60170         this_ptr_conv.inner = untag_ptr(this_ptr);
60171         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60172         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60173         this_ptr_conv.is_owned = false;
60174         LDKThirtyTwoBytes val_ref;
60175         CHECK(val->arr_len == 32);
60176         memcpy(val_ref.data, val->elems, 32); FREE(val);
60177         BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
60178 }
60179
60180 int64_t  CS_LDK_BuiltCommitmentTransaction_new(int8_tArray transaction_arg, int8_tArray txid_arg) {
60181         LDKTransaction transaction_arg_ref;
60182         transaction_arg_ref.datalen = transaction_arg->arr_len;
60183         transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
60184         memcpy(transaction_arg_ref.data, transaction_arg->elems, transaction_arg_ref.datalen); FREE(transaction_arg);
60185         transaction_arg_ref.data_is_owned = true;
60186         LDKThirtyTwoBytes txid_arg_ref;
60187         CHECK(txid_arg->arr_len == 32);
60188         memcpy(txid_arg_ref.data, txid_arg->elems, 32); FREE(txid_arg);
60189         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
60190         int64_t ret_ref = 0;
60191         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60192         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60193         return ret_ref;
60194 }
60195
60196 static inline uint64_t BuiltCommitmentTransaction_clone_ptr(LDKBuiltCommitmentTransaction *NONNULL_PTR arg) {
60197         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(arg);
60198         int64_t ret_ref = 0;
60199         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60200         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60201         return ret_ref;
60202 }
60203 int64_t  CS_LDK_BuiltCommitmentTransaction_clone_ptr(int64_t arg) {
60204         LDKBuiltCommitmentTransaction arg_conv;
60205         arg_conv.inner = untag_ptr(arg);
60206         arg_conv.is_owned = ptr_is_owned(arg);
60207         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60208         arg_conv.is_owned = false;
60209         int64_t ret_conv = BuiltCommitmentTransaction_clone_ptr(&arg_conv);
60210         return ret_conv;
60211 }
60212
60213 int64_t  CS_LDK_BuiltCommitmentTransaction_clone(int64_t orig) {
60214         LDKBuiltCommitmentTransaction orig_conv;
60215         orig_conv.inner = untag_ptr(orig);
60216         orig_conv.is_owned = ptr_is_owned(orig);
60217         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60218         orig_conv.is_owned = false;
60219         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
60220         int64_t ret_ref = 0;
60221         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60222         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60223         return ret_ref;
60224 }
60225
60226 int8_tArray  CS_LDK_BuiltCommitmentTransaction_write(int64_t obj) {
60227         LDKBuiltCommitmentTransaction obj_conv;
60228         obj_conv.inner = untag_ptr(obj);
60229         obj_conv.is_owned = ptr_is_owned(obj);
60230         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60231         obj_conv.is_owned = false;
60232         LDKCVec_u8Z ret_var = BuiltCommitmentTransaction_write(&obj_conv);
60233         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
60234         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
60235         CVec_u8Z_free(ret_var);
60236         return ret_arr;
60237 }
60238
60239 int64_t  CS_LDK_BuiltCommitmentTransaction_read(int8_tArray ser) {
60240         LDKu8slice ser_ref;
60241         ser_ref.datalen = ser->arr_len;
60242         ser_ref.data = ser->elems;
60243         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
60244         *ret_conv = BuiltCommitmentTransaction_read(ser_ref);
60245         FREE(ser);
60246         return tag_ptr(ret_conv, true);
60247 }
60248
60249 int8_tArray  CS_LDK_BuiltCommitmentTransaction_get_sighash_all(int64_t this_arg, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
60250         LDKBuiltCommitmentTransaction this_arg_conv;
60251         this_arg_conv.inner = untag_ptr(this_arg);
60252         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60253         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60254         this_arg_conv.is_owned = false;
60255         LDKu8slice funding_redeemscript_ref;
60256         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
60257         funding_redeemscript_ref.data = funding_redeemscript->elems;
60258         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
60259         memcpy(ret_arr->elems, BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
60260         FREE(funding_redeemscript);
60261         return ret_arr;
60262 }
60263
60264 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) {
60265         LDKBuiltCommitmentTransaction this_arg_conv;
60266         this_arg_conv.inner = untag_ptr(this_arg);
60267         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60268         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60269         this_arg_conv.is_owned = false;
60270         uint8_t funding_key_arr[32];
60271         CHECK(funding_key->arr_len == 32);
60272         memcpy(funding_key_arr, funding_key->elems, 32); FREE(funding_key);
60273         uint8_t (*funding_key_ref)[32] = &funding_key_arr;
60274         LDKu8slice funding_redeemscript_ref;
60275         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
60276         funding_redeemscript_ref.data = funding_redeemscript->elems;
60277         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
60278         memcpy(ret_arr->elems, BuiltCommitmentTransaction_sign_counterparty_commitment(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
60279         FREE(funding_redeemscript);
60280         return ret_arr;
60281 }
60282
60283 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) {
60284         LDKBuiltCommitmentTransaction this_arg_conv;
60285         this_arg_conv.inner = untag_ptr(this_arg);
60286         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60287         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60288         this_arg_conv.is_owned = false;
60289         uint8_t funding_key_arr[32];
60290         CHECK(funding_key->arr_len == 32);
60291         memcpy(funding_key_arr, funding_key->elems, 32); FREE(funding_key);
60292         uint8_t (*funding_key_ref)[32] = &funding_key_arr;
60293         LDKu8slice funding_redeemscript_ref;
60294         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
60295         funding_redeemscript_ref.data = funding_redeemscript->elems;
60296         void* entropy_source_ptr = untag_ptr(entropy_source);
60297         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
60298         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
60299         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
60300         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);
60301         FREE(funding_redeemscript);
60302         return ret_arr;
60303 }
60304
60305 void  CS_LDK_ClosingTransaction_free(int64_t this_obj) {
60306         LDKClosingTransaction this_obj_conv;
60307         this_obj_conv.inner = untag_ptr(this_obj);
60308         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60309         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60310         ClosingTransaction_free(this_obj_conv);
60311 }
60312
60313 static inline uint64_t ClosingTransaction_clone_ptr(LDKClosingTransaction *NONNULL_PTR arg) {
60314         LDKClosingTransaction ret_var = ClosingTransaction_clone(arg);
60315         int64_t ret_ref = 0;
60316         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60317         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60318         return ret_ref;
60319 }
60320 int64_t  CS_LDK_ClosingTransaction_clone_ptr(int64_t arg) {
60321         LDKClosingTransaction arg_conv;
60322         arg_conv.inner = untag_ptr(arg);
60323         arg_conv.is_owned = ptr_is_owned(arg);
60324         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60325         arg_conv.is_owned = false;
60326         int64_t ret_conv = ClosingTransaction_clone_ptr(&arg_conv);
60327         return ret_conv;
60328 }
60329
60330 int64_t  CS_LDK_ClosingTransaction_clone(int64_t orig) {
60331         LDKClosingTransaction orig_conv;
60332         orig_conv.inner = untag_ptr(orig);
60333         orig_conv.is_owned = ptr_is_owned(orig);
60334         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60335         orig_conv.is_owned = false;
60336         LDKClosingTransaction ret_var = ClosingTransaction_clone(&orig_conv);
60337         int64_t ret_ref = 0;
60338         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60339         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60340         return ret_ref;
60341 }
60342
60343 int64_t  CS_LDK_ClosingTransaction_hash(int64_t o) {
60344         LDKClosingTransaction o_conv;
60345         o_conv.inner = untag_ptr(o);
60346         o_conv.is_owned = ptr_is_owned(o);
60347         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
60348         o_conv.is_owned = false;
60349         int64_t ret_conv = ClosingTransaction_hash(&o_conv);
60350         return ret_conv;
60351 }
60352
60353 jboolean  CS_LDK_ClosingTransaction_eq(int64_t a, int64_t b) {
60354         LDKClosingTransaction a_conv;
60355         a_conv.inner = untag_ptr(a);
60356         a_conv.is_owned = ptr_is_owned(a);
60357         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
60358         a_conv.is_owned = false;
60359         LDKClosingTransaction b_conv;
60360         b_conv.inner = untag_ptr(b);
60361         b_conv.is_owned = ptr_is_owned(b);
60362         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
60363         b_conv.is_owned = false;
60364         jboolean ret_conv = ClosingTransaction_eq(&a_conv, &b_conv);
60365         return ret_conv;
60366 }
60367
60368 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) {
60369         LDKCVec_u8Z to_holder_script_ref;
60370         to_holder_script_ref.datalen = to_holder_script->arr_len;
60371         to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
60372         memcpy(to_holder_script_ref.data, to_holder_script->elems, to_holder_script_ref.datalen); FREE(to_holder_script);
60373         LDKCVec_u8Z to_counterparty_script_ref;
60374         to_counterparty_script_ref.datalen = to_counterparty_script->arr_len;
60375         to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
60376         memcpy(to_counterparty_script_ref.data, to_counterparty_script->elems, to_counterparty_script_ref.datalen); FREE(to_counterparty_script);
60377         LDKOutPoint funding_outpoint_conv;
60378         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
60379         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
60380         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
60381         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
60382         LDKClosingTransaction ret_var = ClosingTransaction_new(to_holder_value_sat, to_counterparty_value_sat, to_holder_script_ref, to_counterparty_script_ref, funding_outpoint_conv);
60383         int64_t ret_ref = 0;
60384         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60385         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60386         return ret_ref;
60387 }
60388
60389 int64_t  CS_LDK_ClosingTransaction_trust(int64_t this_arg) {
60390         LDKClosingTransaction this_arg_conv;
60391         this_arg_conv.inner = untag_ptr(this_arg);
60392         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60393         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60394         this_arg_conv.is_owned = false;
60395         LDKTrustedClosingTransaction ret_var = ClosingTransaction_trust(&this_arg_conv);
60396         int64_t ret_ref = 0;
60397         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60398         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60399         return ret_ref;
60400 }
60401
60402 int64_t  CS_LDK_ClosingTransaction_verify(int64_t this_arg, int64_t funding_outpoint) {
60403         LDKClosingTransaction this_arg_conv;
60404         this_arg_conv.inner = untag_ptr(this_arg);
60405         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60406         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60407         this_arg_conv.is_owned = false;
60408         LDKOutPoint funding_outpoint_conv;
60409         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
60410         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
60411         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
60412         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
60413         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
60414         *ret_conv = ClosingTransaction_verify(&this_arg_conv, funding_outpoint_conv);
60415         return tag_ptr(ret_conv, true);
60416 }
60417
60418 int64_t  CS_LDK_ClosingTransaction_to_holder_value_sat(int64_t this_arg) {
60419         LDKClosingTransaction this_arg_conv;
60420         this_arg_conv.inner = untag_ptr(this_arg);
60421         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60422         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60423         this_arg_conv.is_owned = false;
60424         int64_t ret_conv = ClosingTransaction_to_holder_value_sat(&this_arg_conv);
60425         return ret_conv;
60426 }
60427
60428 int64_t  CS_LDK_ClosingTransaction_to_counterparty_value_sat(int64_t this_arg) {
60429         LDKClosingTransaction this_arg_conv;
60430         this_arg_conv.inner = untag_ptr(this_arg);
60431         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60432         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60433         this_arg_conv.is_owned = false;
60434         int64_t ret_conv = ClosingTransaction_to_counterparty_value_sat(&this_arg_conv);
60435         return ret_conv;
60436 }
60437
60438 int8_tArray  CS_LDK_ClosingTransaction_to_holder_script(int64_t this_arg) {
60439         LDKClosingTransaction this_arg_conv;
60440         this_arg_conv.inner = untag_ptr(this_arg);
60441         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60442         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60443         this_arg_conv.is_owned = false;
60444         LDKu8slice ret_var = ClosingTransaction_to_holder_script(&this_arg_conv);
60445         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
60446         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
60447         return ret_arr;
60448 }
60449
60450 int8_tArray  CS_LDK_ClosingTransaction_to_counterparty_script(int64_t this_arg) {
60451         LDKClosingTransaction this_arg_conv;
60452         this_arg_conv.inner = untag_ptr(this_arg);
60453         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60454         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60455         this_arg_conv.is_owned = false;
60456         LDKu8slice ret_var = ClosingTransaction_to_counterparty_script(&this_arg_conv);
60457         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
60458         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
60459         return ret_arr;
60460 }
60461
60462 void  CS_LDK_TrustedClosingTransaction_free(int64_t this_obj) {
60463         LDKTrustedClosingTransaction this_obj_conv;
60464         this_obj_conv.inner = untag_ptr(this_obj);
60465         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60466         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60467         TrustedClosingTransaction_free(this_obj_conv);
60468 }
60469
60470 int8_tArray  CS_LDK_TrustedClosingTransaction_built_transaction(int64_t this_arg) {
60471         LDKTrustedClosingTransaction this_arg_conv;
60472         this_arg_conv.inner = untag_ptr(this_arg);
60473         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60474         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60475         this_arg_conv.is_owned = false;
60476         LDKTransaction ret_var = TrustedClosingTransaction_built_transaction(&this_arg_conv);
60477         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
60478         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
60479         Transaction_free(ret_var);
60480         return ret_arr;
60481 }
60482
60483 int8_tArray  CS_LDK_TrustedClosingTransaction_get_sighash_all(int64_t this_arg, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
60484         LDKTrustedClosingTransaction this_arg_conv;
60485         this_arg_conv.inner = untag_ptr(this_arg);
60486         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60487         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60488         this_arg_conv.is_owned = false;
60489         LDKu8slice funding_redeemscript_ref;
60490         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
60491         funding_redeemscript_ref.data = funding_redeemscript->elems;
60492         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
60493         memcpy(ret_arr->elems, TrustedClosingTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
60494         FREE(funding_redeemscript);
60495         return ret_arr;
60496 }
60497
60498 int8_tArray  CS_LDK_TrustedClosingTransaction_sign(int64_t this_arg, int8_tArray funding_key, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
60499         LDKTrustedClosingTransaction this_arg_conv;
60500         this_arg_conv.inner = untag_ptr(this_arg);
60501         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60502         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60503         this_arg_conv.is_owned = false;
60504         uint8_t funding_key_arr[32];
60505         CHECK(funding_key->arr_len == 32);
60506         memcpy(funding_key_arr, funding_key->elems, 32); FREE(funding_key);
60507         uint8_t (*funding_key_ref)[32] = &funding_key_arr;
60508         LDKu8slice funding_redeemscript_ref;
60509         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
60510         funding_redeemscript_ref.data = funding_redeemscript->elems;
60511         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
60512         memcpy(ret_arr->elems, TrustedClosingTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
60513         FREE(funding_redeemscript);
60514         return ret_arr;
60515 }
60516
60517 void  CS_LDK_CommitmentTransaction_free(int64_t this_obj) {
60518         LDKCommitmentTransaction this_obj_conv;
60519         this_obj_conv.inner = untag_ptr(this_obj);
60520         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60521         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60522         CommitmentTransaction_free(this_obj_conv);
60523 }
60524
60525 static inline uint64_t CommitmentTransaction_clone_ptr(LDKCommitmentTransaction *NONNULL_PTR arg) {
60526         LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(arg);
60527         int64_t ret_ref = 0;
60528         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60529         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60530         return ret_ref;
60531 }
60532 int64_t  CS_LDK_CommitmentTransaction_clone_ptr(int64_t arg) {
60533         LDKCommitmentTransaction arg_conv;
60534         arg_conv.inner = untag_ptr(arg);
60535         arg_conv.is_owned = ptr_is_owned(arg);
60536         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60537         arg_conv.is_owned = false;
60538         int64_t ret_conv = CommitmentTransaction_clone_ptr(&arg_conv);
60539         return ret_conv;
60540 }
60541
60542 int64_t  CS_LDK_CommitmentTransaction_clone(int64_t orig) {
60543         LDKCommitmentTransaction orig_conv;
60544         orig_conv.inner = untag_ptr(orig);
60545         orig_conv.is_owned = ptr_is_owned(orig);
60546         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60547         orig_conv.is_owned = false;
60548         LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(&orig_conv);
60549         int64_t ret_ref = 0;
60550         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60551         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60552         return ret_ref;
60553 }
60554
60555 int8_tArray  CS_LDK_CommitmentTransaction_write(int64_t obj) {
60556         LDKCommitmentTransaction obj_conv;
60557         obj_conv.inner = untag_ptr(obj);
60558         obj_conv.is_owned = ptr_is_owned(obj);
60559         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60560         obj_conv.is_owned = false;
60561         LDKCVec_u8Z ret_var = CommitmentTransaction_write(&obj_conv);
60562         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
60563         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
60564         CVec_u8Z_free(ret_var);
60565         return ret_arr;
60566 }
60567
60568 int64_t  CS_LDK_CommitmentTransaction_read(int8_tArray ser) {
60569         LDKu8slice ser_ref;
60570         ser_ref.datalen = ser->arr_len;
60571         ser_ref.data = ser->elems;
60572         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
60573         *ret_conv = CommitmentTransaction_read(ser_ref);
60574         FREE(ser);
60575         return tag_ptr(ret_conv, true);
60576 }
60577
60578 int64_t  CS_LDK_CommitmentTransaction_commitment_number(int64_t this_arg) {
60579         LDKCommitmentTransaction this_arg_conv;
60580         this_arg_conv.inner = untag_ptr(this_arg);
60581         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60582         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60583         this_arg_conv.is_owned = false;
60584         int64_t ret_conv = CommitmentTransaction_commitment_number(&this_arg_conv);
60585         return ret_conv;
60586 }
60587
60588 int8_tArray  CS_LDK_CommitmentTransaction_per_commitment_point(int64_t this_arg) {
60589         LDKCommitmentTransaction this_arg_conv;
60590         this_arg_conv.inner = untag_ptr(this_arg);
60591         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60592         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60593         this_arg_conv.is_owned = false;
60594         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
60595         memcpy(ret_arr->elems, CommitmentTransaction_per_commitment_point(&this_arg_conv).compressed_form, 33);
60596         return ret_arr;
60597 }
60598
60599 int64_t  CS_LDK_CommitmentTransaction_to_broadcaster_value_sat(int64_t this_arg) {
60600         LDKCommitmentTransaction this_arg_conv;
60601         this_arg_conv.inner = untag_ptr(this_arg);
60602         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60603         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60604         this_arg_conv.is_owned = false;
60605         int64_t ret_conv = CommitmentTransaction_to_broadcaster_value_sat(&this_arg_conv);
60606         return ret_conv;
60607 }
60608
60609 int64_t  CS_LDK_CommitmentTransaction_to_countersignatory_value_sat(int64_t this_arg) {
60610         LDKCommitmentTransaction this_arg_conv;
60611         this_arg_conv.inner = untag_ptr(this_arg);
60612         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60613         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60614         this_arg_conv.is_owned = false;
60615         int64_t ret_conv = CommitmentTransaction_to_countersignatory_value_sat(&this_arg_conv);
60616         return ret_conv;
60617 }
60618
60619 int32_t  CS_LDK_CommitmentTransaction_feerate_per_kw(int64_t this_arg) {
60620         LDKCommitmentTransaction this_arg_conv;
60621         this_arg_conv.inner = untag_ptr(this_arg);
60622         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60623         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60624         this_arg_conv.is_owned = false;
60625         int32_t ret_conv = CommitmentTransaction_feerate_per_kw(&this_arg_conv);
60626         return ret_conv;
60627 }
60628
60629 int64_t  CS_LDK_CommitmentTransaction_trust(int64_t this_arg) {
60630         LDKCommitmentTransaction this_arg_conv;
60631         this_arg_conv.inner = untag_ptr(this_arg);
60632         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60633         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60634         this_arg_conv.is_owned = false;
60635         LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv);
60636         int64_t ret_ref = 0;
60637         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60638         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60639         return ret_ref;
60640 }
60641
60642 int64_t  CS_LDK_CommitmentTransaction_verify(int64_t this_arg, int64_t channel_parameters, int64_t broadcaster_keys, int64_t countersignatory_keys) {
60643         LDKCommitmentTransaction this_arg_conv;
60644         this_arg_conv.inner = untag_ptr(this_arg);
60645         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60646         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60647         this_arg_conv.is_owned = false;
60648         LDKDirectedChannelTransactionParameters channel_parameters_conv;
60649         channel_parameters_conv.inner = untag_ptr(channel_parameters);
60650         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
60651         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
60652         channel_parameters_conv.is_owned = false;
60653         LDKChannelPublicKeys broadcaster_keys_conv;
60654         broadcaster_keys_conv.inner = untag_ptr(broadcaster_keys);
60655         broadcaster_keys_conv.is_owned = ptr_is_owned(broadcaster_keys);
60656         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
60657         broadcaster_keys_conv.is_owned = false;
60658         LDKChannelPublicKeys countersignatory_keys_conv;
60659         countersignatory_keys_conv.inner = untag_ptr(countersignatory_keys);
60660         countersignatory_keys_conv.is_owned = ptr_is_owned(countersignatory_keys);
60661         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
60662         countersignatory_keys_conv.is_owned = false;
60663         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
60664         *ret_conv = CommitmentTransaction_verify(&this_arg_conv, &channel_parameters_conv, &broadcaster_keys_conv, &countersignatory_keys_conv);
60665         return tag_ptr(ret_conv, true);
60666 }
60667
60668 void  CS_LDK_TrustedCommitmentTransaction_free(int64_t this_obj) {
60669         LDKTrustedCommitmentTransaction this_obj_conv;
60670         this_obj_conv.inner = untag_ptr(this_obj);
60671         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60672         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60673         TrustedCommitmentTransaction_free(this_obj_conv);
60674 }
60675
60676 int8_tArray  CS_LDK_TrustedCommitmentTransaction_txid(int64_t this_arg) {
60677         LDKTrustedCommitmentTransaction this_arg_conv;
60678         this_arg_conv.inner = untag_ptr(this_arg);
60679         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60680         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60681         this_arg_conv.is_owned = false;
60682         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
60683         memcpy(ret_arr->elems, TrustedCommitmentTransaction_txid(&this_arg_conv).data, 32);
60684         return ret_arr;
60685 }
60686
60687 int64_t  CS_LDK_TrustedCommitmentTransaction_built_transaction(int64_t this_arg) {
60688         LDKTrustedCommitmentTransaction this_arg_conv;
60689         this_arg_conv.inner = untag_ptr(this_arg);
60690         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60691         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60692         this_arg_conv.is_owned = false;
60693         LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&this_arg_conv);
60694         int64_t ret_ref = 0;
60695         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60696         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60697         return ret_ref;
60698 }
60699
60700 int64_t  CS_LDK_TrustedCommitmentTransaction_keys(int64_t this_arg) {
60701         LDKTrustedCommitmentTransaction this_arg_conv;
60702         this_arg_conv.inner = untag_ptr(this_arg);
60703         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60704         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60705         this_arg_conv.is_owned = false;
60706         LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_conv);
60707         int64_t ret_ref = 0;
60708         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60709         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60710         return ret_ref;
60711 }
60712
60713 int64_t  CS_LDK_TrustedCommitmentTransaction_channel_type_features(int64_t this_arg) {
60714         LDKTrustedCommitmentTransaction this_arg_conv;
60715         this_arg_conv.inner = untag_ptr(this_arg);
60716         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60717         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60718         this_arg_conv.is_owned = false;
60719         LDKChannelTypeFeatures ret_var = TrustedCommitmentTransaction_channel_type_features(&this_arg_conv);
60720         int64_t ret_ref = 0;
60721         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60722         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60723         return ret_ref;
60724 }
60725
60726 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) {
60727         LDKTrustedCommitmentTransaction 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         uint8_t htlc_base_key_arr[32];
60733         CHECK(htlc_base_key->arr_len == 32);
60734         memcpy(htlc_base_key_arr, htlc_base_key->elems, 32); FREE(htlc_base_key);
60735         uint8_t (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
60736         LDKDirectedChannelTransactionParameters channel_parameters_conv;
60737         channel_parameters_conv.inner = untag_ptr(channel_parameters);
60738         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
60739         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
60740         channel_parameters_conv.is_owned = false;
60741         void* entropy_source_ptr = untag_ptr(entropy_source);
60742         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
60743         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
60744         LDKCResult_CVec_ECDSASignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_ECDSASignatureZNoneZ), "LDKCResult_CVec_ECDSASignatureZNoneZ");
60745         *ret_conv = TrustedCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, &channel_parameters_conv, entropy_source_conv);
60746         return tag_ptr(ret_conv, true);
60747 }
60748
60749 int64_t  CS_LDK_TrustedCommitmentTransaction_revokeable_output_index(int64_t this_arg) {
60750         LDKTrustedCommitmentTransaction this_arg_conv;
60751         this_arg_conv.inner = untag_ptr(this_arg);
60752         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60753         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60754         this_arg_conv.is_owned = false;
60755         LDKCOption_usizeZ *ret_copy = MALLOC(sizeof(LDKCOption_usizeZ), "LDKCOption_usizeZ");
60756         *ret_copy = TrustedCommitmentTransaction_revokeable_output_index(&this_arg_conv);
60757         int64_t ret_ref = tag_ptr(ret_copy, true);
60758         return ret_ref;
60759 }
60760
60761 int64_t  CS_LDK_TrustedCommitmentTransaction_build_to_local_justice_tx(int64_t this_arg, int64_t feerate_per_kw, int8_tArray destination_script) {
60762         LDKTrustedCommitmentTransaction this_arg_conv;
60763         this_arg_conv.inner = untag_ptr(this_arg);
60764         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60765         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60766         this_arg_conv.is_owned = false;
60767         LDKCVec_u8Z destination_script_ref;
60768         destination_script_ref.datalen = destination_script->arr_len;
60769         destination_script_ref.data = MALLOC(destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
60770         memcpy(destination_script_ref.data, destination_script->elems, destination_script_ref.datalen); FREE(destination_script);
60771         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
60772         *ret_conv = TrustedCommitmentTransaction_build_to_local_justice_tx(&this_arg_conv, feerate_per_kw, destination_script_ref);
60773         return tag_ptr(ret_conv, true);
60774 }
60775
60776 int64_t  CS_LDK_get_commitment_transaction_number_obscure_factor(int8_tArray broadcaster_payment_basepoint, int8_tArray countersignatory_payment_basepoint, jboolean outbound_from_broadcaster) {
60777         LDKPublicKey broadcaster_payment_basepoint_ref;
60778         CHECK(broadcaster_payment_basepoint->arr_len == 33);
60779         memcpy(broadcaster_payment_basepoint_ref.compressed_form, broadcaster_payment_basepoint->elems, 33); FREE(broadcaster_payment_basepoint);
60780         LDKPublicKey countersignatory_payment_basepoint_ref;
60781         CHECK(countersignatory_payment_basepoint->arr_len == 33);
60782         memcpy(countersignatory_payment_basepoint_ref.compressed_form, countersignatory_payment_basepoint->elems, 33); FREE(countersignatory_payment_basepoint);
60783         int64_t ret_conv = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
60784         return ret_conv;
60785 }
60786
60787 jboolean  CS_LDK_InitFeatures_eq(int64_t a, int64_t b) {
60788         LDKInitFeatures a_conv;
60789         a_conv.inner = untag_ptr(a);
60790         a_conv.is_owned = ptr_is_owned(a);
60791         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
60792         a_conv.is_owned = false;
60793         LDKInitFeatures b_conv;
60794         b_conv.inner = untag_ptr(b);
60795         b_conv.is_owned = ptr_is_owned(b);
60796         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
60797         b_conv.is_owned = false;
60798         jboolean ret_conv = InitFeatures_eq(&a_conv, &b_conv);
60799         return ret_conv;
60800 }
60801
60802 jboolean  CS_LDK_NodeFeatures_eq(int64_t a, int64_t b) {
60803         LDKNodeFeatures a_conv;
60804         a_conv.inner = untag_ptr(a);
60805         a_conv.is_owned = ptr_is_owned(a);
60806         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
60807         a_conv.is_owned = false;
60808         LDKNodeFeatures b_conv;
60809         b_conv.inner = untag_ptr(b);
60810         b_conv.is_owned = ptr_is_owned(b);
60811         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
60812         b_conv.is_owned = false;
60813         jboolean ret_conv = NodeFeatures_eq(&a_conv, &b_conv);
60814         return ret_conv;
60815 }
60816
60817 jboolean  CS_LDK_ChannelFeatures_eq(int64_t a, int64_t b) {
60818         LDKChannelFeatures a_conv;
60819         a_conv.inner = untag_ptr(a);
60820         a_conv.is_owned = ptr_is_owned(a);
60821         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
60822         a_conv.is_owned = false;
60823         LDKChannelFeatures b_conv;
60824         b_conv.inner = untag_ptr(b);
60825         b_conv.is_owned = ptr_is_owned(b);
60826         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
60827         b_conv.is_owned = false;
60828         jboolean ret_conv = ChannelFeatures_eq(&a_conv, &b_conv);
60829         return ret_conv;
60830 }
60831
60832 jboolean  CS_LDK_Bolt11InvoiceFeatures_eq(int64_t a, int64_t b) {
60833         LDKBolt11InvoiceFeatures a_conv;
60834         a_conv.inner = untag_ptr(a);
60835         a_conv.is_owned = ptr_is_owned(a);
60836         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
60837         a_conv.is_owned = false;
60838         LDKBolt11InvoiceFeatures b_conv;
60839         b_conv.inner = untag_ptr(b);
60840         b_conv.is_owned = ptr_is_owned(b);
60841         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
60842         b_conv.is_owned = false;
60843         jboolean ret_conv = Bolt11InvoiceFeatures_eq(&a_conv, &b_conv);
60844         return ret_conv;
60845 }
60846
60847 jboolean  CS_LDK_OfferFeatures_eq(int64_t a, int64_t b) {
60848         LDKOfferFeatures a_conv;
60849         a_conv.inner = untag_ptr(a);
60850         a_conv.is_owned = ptr_is_owned(a);
60851         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
60852         a_conv.is_owned = false;
60853         LDKOfferFeatures b_conv;
60854         b_conv.inner = untag_ptr(b);
60855         b_conv.is_owned = ptr_is_owned(b);
60856         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
60857         b_conv.is_owned = false;
60858         jboolean ret_conv = OfferFeatures_eq(&a_conv, &b_conv);
60859         return ret_conv;
60860 }
60861
60862 jboolean  CS_LDK_InvoiceRequestFeatures_eq(int64_t a, int64_t b) {
60863         LDKInvoiceRequestFeatures a_conv;
60864         a_conv.inner = untag_ptr(a);
60865         a_conv.is_owned = ptr_is_owned(a);
60866         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
60867         a_conv.is_owned = false;
60868         LDKInvoiceRequestFeatures b_conv;
60869         b_conv.inner = untag_ptr(b);
60870         b_conv.is_owned = ptr_is_owned(b);
60871         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
60872         b_conv.is_owned = false;
60873         jboolean ret_conv = InvoiceRequestFeatures_eq(&a_conv, &b_conv);
60874         return ret_conv;
60875 }
60876
60877 jboolean  CS_LDK_Bolt12InvoiceFeatures_eq(int64_t a, int64_t b) {
60878         LDKBolt12InvoiceFeatures a_conv;
60879         a_conv.inner = untag_ptr(a);
60880         a_conv.is_owned = ptr_is_owned(a);
60881         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
60882         a_conv.is_owned = false;
60883         LDKBolt12InvoiceFeatures b_conv;
60884         b_conv.inner = untag_ptr(b);
60885         b_conv.is_owned = ptr_is_owned(b);
60886         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
60887         b_conv.is_owned = false;
60888         jboolean ret_conv = Bolt12InvoiceFeatures_eq(&a_conv, &b_conv);
60889         return ret_conv;
60890 }
60891
60892 jboolean  CS_LDK_BlindedHopFeatures_eq(int64_t a, int64_t b) {
60893         LDKBlindedHopFeatures a_conv;
60894         a_conv.inner = untag_ptr(a);
60895         a_conv.is_owned = ptr_is_owned(a);
60896         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
60897         a_conv.is_owned = false;
60898         LDKBlindedHopFeatures b_conv;
60899         b_conv.inner = untag_ptr(b);
60900         b_conv.is_owned = ptr_is_owned(b);
60901         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
60902         b_conv.is_owned = false;
60903         jboolean ret_conv = BlindedHopFeatures_eq(&a_conv, &b_conv);
60904         return ret_conv;
60905 }
60906
60907 jboolean  CS_LDK_ChannelTypeFeatures_eq(int64_t a, int64_t b) {
60908         LDKChannelTypeFeatures a_conv;
60909         a_conv.inner = untag_ptr(a);
60910         a_conv.is_owned = ptr_is_owned(a);
60911         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
60912         a_conv.is_owned = false;
60913         LDKChannelTypeFeatures b_conv;
60914         b_conv.inner = untag_ptr(b);
60915         b_conv.is_owned = ptr_is_owned(b);
60916         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
60917         b_conv.is_owned = false;
60918         jboolean ret_conv = ChannelTypeFeatures_eq(&a_conv, &b_conv);
60919         return ret_conv;
60920 }
60921
60922 static inline uint64_t InitFeatures_clone_ptr(LDKInitFeatures *NONNULL_PTR arg) {
60923         LDKInitFeatures ret_var = InitFeatures_clone(arg);
60924         int64_t ret_ref = 0;
60925         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60926         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60927         return ret_ref;
60928 }
60929 int64_t  CS_LDK_InitFeatures_clone_ptr(int64_t arg) {
60930         LDKInitFeatures arg_conv;
60931         arg_conv.inner = untag_ptr(arg);
60932         arg_conv.is_owned = ptr_is_owned(arg);
60933         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60934         arg_conv.is_owned = false;
60935         int64_t ret_conv = InitFeatures_clone_ptr(&arg_conv);
60936         return ret_conv;
60937 }
60938
60939 int64_t  CS_LDK_InitFeatures_clone(int64_t orig) {
60940         LDKInitFeatures orig_conv;
60941         orig_conv.inner = untag_ptr(orig);
60942         orig_conv.is_owned = ptr_is_owned(orig);
60943         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60944         orig_conv.is_owned = false;
60945         LDKInitFeatures ret_var = InitFeatures_clone(&orig_conv);
60946         int64_t ret_ref = 0;
60947         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60948         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60949         return ret_ref;
60950 }
60951
60952 static inline uint64_t NodeFeatures_clone_ptr(LDKNodeFeatures *NONNULL_PTR arg) {
60953         LDKNodeFeatures ret_var = NodeFeatures_clone(arg);
60954         int64_t ret_ref = 0;
60955         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60956         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60957         return ret_ref;
60958 }
60959 int64_t  CS_LDK_NodeFeatures_clone_ptr(int64_t arg) {
60960         LDKNodeFeatures arg_conv;
60961         arg_conv.inner = untag_ptr(arg);
60962         arg_conv.is_owned = ptr_is_owned(arg);
60963         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60964         arg_conv.is_owned = false;
60965         int64_t ret_conv = NodeFeatures_clone_ptr(&arg_conv);
60966         return ret_conv;
60967 }
60968
60969 int64_t  CS_LDK_NodeFeatures_clone(int64_t orig) {
60970         LDKNodeFeatures orig_conv;
60971         orig_conv.inner = untag_ptr(orig);
60972         orig_conv.is_owned = ptr_is_owned(orig);
60973         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60974         orig_conv.is_owned = false;
60975         LDKNodeFeatures ret_var = NodeFeatures_clone(&orig_conv);
60976         int64_t ret_ref = 0;
60977         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60978         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60979         return ret_ref;
60980 }
60981
60982 static inline uint64_t ChannelFeatures_clone_ptr(LDKChannelFeatures *NONNULL_PTR arg) {
60983         LDKChannelFeatures ret_var = ChannelFeatures_clone(arg);
60984         int64_t ret_ref = 0;
60985         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60986         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60987         return ret_ref;
60988 }
60989 int64_t  CS_LDK_ChannelFeatures_clone_ptr(int64_t arg) {
60990         LDKChannelFeatures arg_conv;
60991         arg_conv.inner = untag_ptr(arg);
60992         arg_conv.is_owned = ptr_is_owned(arg);
60993         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60994         arg_conv.is_owned = false;
60995         int64_t ret_conv = ChannelFeatures_clone_ptr(&arg_conv);
60996         return ret_conv;
60997 }
60998
60999 int64_t  CS_LDK_ChannelFeatures_clone(int64_t orig) {
61000         LDKChannelFeatures orig_conv;
61001         orig_conv.inner = untag_ptr(orig);
61002         orig_conv.is_owned = ptr_is_owned(orig);
61003         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
61004         orig_conv.is_owned = false;
61005         LDKChannelFeatures ret_var = ChannelFeatures_clone(&orig_conv);
61006         int64_t ret_ref = 0;
61007         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61008         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61009         return ret_ref;
61010 }
61011
61012 static inline uint64_t Bolt11InvoiceFeatures_clone_ptr(LDKBolt11InvoiceFeatures *NONNULL_PTR arg) {
61013         LDKBolt11InvoiceFeatures ret_var = Bolt11InvoiceFeatures_clone(arg);
61014         int64_t ret_ref = 0;
61015         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61016         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61017         return ret_ref;
61018 }
61019 int64_t  CS_LDK_Bolt11InvoiceFeatures_clone_ptr(int64_t arg) {
61020         LDKBolt11InvoiceFeatures arg_conv;
61021         arg_conv.inner = untag_ptr(arg);
61022         arg_conv.is_owned = ptr_is_owned(arg);
61023         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
61024         arg_conv.is_owned = false;
61025         int64_t ret_conv = Bolt11InvoiceFeatures_clone_ptr(&arg_conv);
61026         return ret_conv;
61027 }
61028
61029 int64_t  CS_LDK_Bolt11InvoiceFeatures_clone(int64_t orig) {
61030         LDKBolt11InvoiceFeatures orig_conv;
61031         orig_conv.inner = untag_ptr(orig);
61032         orig_conv.is_owned = ptr_is_owned(orig);
61033         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
61034         orig_conv.is_owned = false;
61035         LDKBolt11InvoiceFeatures ret_var = Bolt11InvoiceFeatures_clone(&orig_conv);
61036         int64_t ret_ref = 0;
61037         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61038         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61039         return ret_ref;
61040 }
61041
61042 static inline uint64_t OfferFeatures_clone_ptr(LDKOfferFeatures *NONNULL_PTR arg) {
61043         LDKOfferFeatures ret_var = OfferFeatures_clone(arg);
61044         int64_t ret_ref = 0;
61045         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61046         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61047         return ret_ref;
61048 }
61049 int64_t  CS_LDK_OfferFeatures_clone_ptr(int64_t arg) {
61050         LDKOfferFeatures arg_conv;
61051         arg_conv.inner = untag_ptr(arg);
61052         arg_conv.is_owned = ptr_is_owned(arg);
61053         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
61054         arg_conv.is_owned = false;
61055         int64_t ret_conv = OfferFeatures_clone_ptr(&arg_conv);
61056         return ret_conv;
61057 }
61058
61059 int64_t  CS_LDK_OfferFeatures_clone(int64_t orig) {
61060         LDKOfferFeatures orig_conv;
61061         orig_conv.inner = untag_ptr(orig);
61062         orig_conv.is_owned = ptr_is_owned(orig);
61063         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
61064         orig_conv.is_owned = false;
61065         LDKOfferFeatures ret_var = OfferFeatures_clone(&orig_conv);
61066         int64_t ret_ref = 0;
61067         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61068         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61069         return ret_ref;
61070 }
61071
61072 static inline uint64_t InvoiceRequestFeatures_clone_ptr(LDKInvoiceRequestFeatures *NONNULL_PTR arg) {
61073         LDKInvoiceRequestFeatures ret_var = InvoiceRequestFeatures_clone(arg);
61074         int64_t ret_ref = 0;
61075         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61076         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61077         return ret_ref;
61078 }
61079 int64_t  CS_LDK_InvoiceRequestFeatures_clone_ptr(int64_t arg) {
61080         LDKInvoiceRequestFeatures arg_conv;
61081         arg_conv.inner = untag_ptr(arg);
61082         arg_conv.is_owned = ptr_is_owned(arg);
61083         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
61084         arg_conv.is_owned = false;
61085         int64_t ret_conv = InvoiceRequestFeatures_clone_ptr(&arg_conv);
61086         return ret_conv;
61087 }
61088
61089 int64_t  CS_LDK_InvoiceRequestFeatures_clone(int64_t orig) {
61090         LDKInvoiceRequestFeatures orig_conv;
61091         orig_conv.inner = untag_ptr(orig);
61092         orig_conv.is_owned = ptr_is_owned(orig);
61093         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
61094         orig_conv.is_owned = false;
61095         LDKInvoiceRequestFeatures ret_var = InvoiceRequestFeatures_clone(&orig_conv);
61096         int64_t ret_ref = 0;
61097         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61098         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61099         return ret_ref;
61100 }
61101
61102 static inline uint64_t Bolt12InvoiceFeatures_clone_ptr(LDKBolt12InvoiceFeatures *NONNULL_PTR arg) {
61103         LDKBolt12InvoiceFeatures ret_var = Bolt12InvoiceFeatures_clone(arg);
61104         int64_t ret_ref = 0;
61105         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61106         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61107         return ret_ref;
61108 }
61109 int64_t  CS_LDK_Bolt12InvoiceFeatures_clone_ptr(int64_t arg) {
61110         LDKBolt12InvoiceFeatures arg_conv;
61111         arg_conv.inner = untag_ptr(arg);
61112         arg_conv.is_owned = ptr_is_owned(arg);
61113         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
61114         arg_conv.is_owned = false;
61115         int64_t ret_conv = Bolt12InvoiceFeatures_clone_ptr(&arg_conv);
61116         return ret_conv;
61117 }
61118
61119 int64_t  CS_LDK_Bolt12InvoiceFeatures_clone(int64_t orig) {
61120         LDKBolt12InvoiceFeatures orig_conv;
61121         orig_conv.inner = untag_ptr(orig);
61122         orig_conv.is_owned = ptr_is_owned(orig);
61123         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
61124         orig_conv.is_owned = false;
61125         LDKBolt12InvoiceFeatures ret_var = Bolt12InvoiceFeatures_clone(&orig_conv);
61126         int64_t ret_ref = 0;
61127         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61128         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61129         return ret_ref;
61130 }
61131
61132 static inline uint64_t BlindedHopFeatures_clone_ptr(LDKBlindedHopFeatures *NONNULL_PTR arg) {
61133         LDKBlindedHopFeatures ret_var = BlindedHopFeatures_clone(arg);
61134         int64_t ret_ref = 0;
61135         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61136         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61137         return ret_ref;
61138 }
61139 int64_t  CS_LDK_BlindedHopFeatures_clone_ptr(int64_t arg) {
61140         LDKBlindedHopFeatures arg_conv;
61141         arg_conv.inner = untag_ptr(arg);
61142         arg_conv.is_owned = ptr_is_owned(arg);
61143         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
61144         arg_conv.is_owned = false;
61145         int64_t ret_conv = BlindedHopFeatures_clone_ptr(&arg_conv);
61146         return ret_conv;
61147 }
61148
61149 int64_t  CS_LDK_BlindedHopFeatures_clone(int64_t orig) {
61150         LDKBlindedHopFeatures orig_conv;
61151         orig_conv.inner = untag_ptr(orig);
61152         orig_conv.is_owned = ptr_is_owned(orig);
61153         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
61154         orig_conv.is_owned = false;
61155         LDKBlindedHopFeatures ret_var = BlindedHopFeatures_clone(&orig_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 static inline uint64_t ChannelTypeFeatures_clone_ptr(LDKChannelTypeFeatures *NONNULL_PTR arg) {
61163         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(arg);
61164         int64_t ret_ref = 0;
61165         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61166         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61167         return ret_ref;
61168 }
61169 int64_t  CS_LDK_ChannelTypeFeatures_clone_ptr(int64_t arg) {
61170         LDKChannelTypeFeatures arg_conv;
61171         arg_conv.inner = untag_ptr(arg);
61172         arg_conv.is_owned = ptr_is_owned(arg);
61173         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
61174         arg_conv.is_owned = false;
61175         int64_t ret_conv = ChannelTypeFeatures_clone_ptr(&arg_conv);
61176         return ret_conv;
61177 }
61178
61179 int64_t  CS_LDK_ChannelTypeFeatures_clone(int64_t orig) {
61180         LDKChannelTypeFeatures orig_conv;
61181         orig_conv.inner = untag_ptr(orig);
61182         orig_conv.is_owned = ptr_is_owned(orig);
61183         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
61184         orig_conv.is_owned = false;
61185         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(&orig_conv);
61186         int64_t ret_ref = 0;
61187         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61188         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61189         return ret_ref;
61190 }
61191
61192 int64_t  CS_LDK_InitFeatures_hash(int64_t o) {
61193         LDKInitFeatures o_conv;
61194         o_conv.inner = untag_ptr(o);
61195         o_conv.is_owned = ptr_is_owned(o);
61196         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
61197         o_conv.is_owned = false;
61198         int64_t ret_conv = InitFeatures_hash(&o_conv);
61199         return ret_conv;
61200 }
61201
61202 int64_t  CS_LDK_NodeFeatures_hash(int64_t o) {
61203         LDKNodeFeatures o_conv;
61204         o_conv.inner = untag_ptr(o);
61205         o_conv.is_owned = ptr_is_owned(o);
61206         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
61207         o_conv.is_owned = false;
61208         int64_t ret_conv = NodeFeatures_hash(&o_conv);
61209         return ret_conv;
61210 }
61211
61212 int64_t  CS_LDK_ChannelFeatures_hash(int64_t o) {
61213         LDKChannelFeatures o_conv;
61214         o_conv.inner = untag_ptr(o);
61215         o_conv.is_owned = ptr_is_owned(o);
61216         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
61217         o_conv.is_owned = false;
61218         int64_t ret_conv = ChannelFeatures_hash(&o_conv);
61219         return ret_conv;
61220 }
61221
61222 int64_t  CS_LDK_Bolt11InvoiceFeatures_hash(int64_t o) {
61223         LDKBolt11InvoiceFeatures o_conv;
61224         o_conv.inner = untag_ptr(o);
61225         o_conv.is_owned = ptr_is_owned(o);
61226         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
61227         o_conv.is_owned = false;
61228         int64_t ret_conv = Bolt11InvoiceFeatures_hash(&o_conv);
61229         return ret_conv;
61230 }
61231
61232 int64_t  CS_LDK_OfferFeatures_hash(int64_t o) {
61233         LDKOfferFeatures o_conv;
61234         o_conv.inner = untag_ptr(o);
61235         o_conv.is_owned = ptr_is_owned(o);
61236         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
61237         o_conv.is_owned = false;
61238         int64_t ret_conv = OfferFeatures_hash(&o_conv);
61239         return ret_conv;
61240 }
61241
61242 int64_t  CS_LDK_InvoiceRequestFeatures_hash(int64_t o) {
61243         LDKInvoiceRequestFeatures o_conv;
61244         o_conv.inner = untag_ptr(o);
61245         o_conv.is_owned = ptr_is_owned(o);
61246         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
61247         o_conv.is_owned = false;
61248         int64_t ret_conv = InvoiceRequestFeatures_hash(&o_conv);
61249         return ret_conv;
61250 }
61251
61252 int64_t  CS_LDK_Bolt12InvoiceFeatures_hash(int64_t o) {
61253         LDKBolt12InvoiceFeatures o_conv;
61254         o_conv.inner = untag_ptr(o);
61255         o_conv.is_owned = ptr_is_owned(o);
61256         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
61257         o_conv.is_owned = false;
61258         int64_t ret_conv = Bolt12InvoiceFeatures_hash(&o_conv);
61259         return ret_conv;
61260 }
61261
61262 int64_t  CS_LDK_BlindedHopFeatures_hash(int64_t o) {
61263         LDKBlindedHopFeatures o_conv;
61264         o_conv.inner = untag_ptr(o);
61265         o_conv.is_owned = ptr_is_owned(o);
61266         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
61267         o_conv.is_owned = false;
61268         int64_t ret_conv = BlindedHopFeatures_hash(&o_conv);
61269         return ret_conv;
61270 }
61271
61272 int64_t  CS_LDK_ChannelTypeFeatures_hash(int64_t o) {
61273         LDKChannelTypeFeatures o_conv;
61274         o_conv.inner = untag_ptr(o);
61275         o_conv.is_owned = ptr_is_owned(o);
61276         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
61277         o_conv.is_owned = false;
61278         int64_t ret_conv = ChannelTypeFeatures_hash(&o_conv);
61279         return ret_conv;
61280 }
61281
61282 void  CS_LDK_InitFeatures_free(int64_t this_obj) {
61283         LDKInitFeatures this_obj_conv;
61284         this_obj_conv.inner = untag_ptr(this_obj);
61285         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61286         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61287         InitFeatures_free(this_obj_conv);
61288 }
61289
61290 void  CS_LDK_NodeFeatures_free(int64_t this_obj) {
61291         LDKNodeFeatures this_obj_conv;
61292         this_obj_conv.inner = untag_ptr(this_obj);
61293         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61294         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61295         NodeFeatures_free(this_obj_conv);
61296 }
61297
61298 void  CS_LDK_ChannelFeatures_free(int64_t this_obj) {
61299         LDKChannelFeatures this_obj_conv;
61300         this_obj_conv.inner = untag_ptr(this_obj);
61301         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61302         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61303         ChannelFeatures_free(this_obj_conv);
61304 }
61305
61306 void  CS_LDK_Bolt11InvoiceFeatures_free(int64_t this_obj) {
61307         LDKBolt11InvoiceFeatures this_obj_conv;
61308         this_obj_conv.inner = untag_ptr(this_obj);
61309         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61310         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61311         Bolt11InvoiceFeatures_free(this_obj_conv);
61312 }
61313
61314 void  CS_LDK_OfferFeatures_free(int64_t this_obj) {
61315         LDKOfferFeatures this_obj_conv;
61316         this_obj_conv.inner = untag_ptr(this_obj);
61317         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61318         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61319         OfferFeatures_free(this_obj_conv);
61320 }
61321
61322 void  CS_LDK_InvoiceRequestFeatures_free(int64_t this_obj) {
61323         LDKInvoiceRequestFeatures this_obj_conv;
61324         this_obj_conv.inner = untag_ptr(this_obj);
61325         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61326         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61327         InvoiceRequestFeatures_free(this_obj_conv);
61328 }
61329
61330 void  CS_LDK_Bolt12InvoiceFeatures_free(int64_t this_obj) {
61331         LDKBolt12InvoiceFeatures this_obj_conv;
61332         this_obj_conv.inner = untag_ptr(this_obj);
61333         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61334         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61335         Bolt12InvoiceFeatures_free(this_obj_conv);
61336 }
61337
61338 void  CS_LDK_BlindedHopFeatures_free(int64_t this_obj) {
61339         LDKBlindedHopFeatures this_obj_conv;
61340         this_obj_conv.inner = untag_ptr(this_obj);
61341         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61342         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61343         BlindedHopFeatures_free(this_obj_conv);
61344 }
61345
61346 void  CS_LDK_ChannelTypeFeatures_free(int64_t this_obj) {
61347         LDKChannelTypeFeatures this_obj_conv;
61348         this_obj_conv.inner = untag_ptr(this_obj);
61349         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61350         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61351         ChannelTypeFeatures_free(this_obj_conv);
61352 }
61353
61354 int64_t  CS_LDK_InitFeatures_empty() {
61355         LDKInitFeatures ret_var = InitFeatures_empty();
61356         int64_t ret_ref = 0;
61357         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61358         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61359         return ret_ref;
61360 }
61361
61362 jboolean  CS_LDK_InitFeatures_requires_unknown_bits_from(int64_t this_arg, int64_t other) {
61363         LDKInitFeatures this_arg_conv;
61364         this_arg_conv.inner = untag_ptr(this_arg);
61365         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61366         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61367         this_arg_conv.is_owned = false;
61368         LDKInitFeatures other_conv;
61369         other_conv.inner = untag_ptr(other);
61370         other_conv.is_owned = ptr_is_owned(other);
61371         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
61372         other_conv.is_owned = false;
61373         jboolean ret_conv = InitFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
61374         return ret_conv;
61375 }
61376
61377 jboolean  CS_LDK_InitFeatures_requires_unknown_bits(int64_t this_arg) {
61378         LDKInitFeatures 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         jboolean ret_conv = InitFeatures_requires_unknown_bits(&this_arg_conv);
61384         return ret_conv;
61385 }
61386
61387 int64_t  CS_LDK_InitFeatures_set_required_feature_bit(int64_t this_arg, int64_t bit) {
61388         LDKInitFeatures this_arg_conv;
61389         this_arg_conv.inner = untag_ptr(this_arg);
61390         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61391         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61392         this_arg_conv.is_owned = false;
61393         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61394         *ret_conv = InitFeatures_set_required_feature_bit(&this_arg_conv, bit);
61395         return tag_ptr(ret_conv, true);
61396 }
61397
61398 int64_t  CS_LDK_InitFeatures_set_optional_feature_bit(int64_t this_arg, int64_t bit) {
61399         LDKInitFeatures this_arg_conv;
61400         this_arg_conv.inner = untag_ptr(this_arg);
61401         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61402         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61403         this_arg_conv.is_owned = false;
61404         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61405         *ret_conv = InitFeatures_set_optional_feature_bit(&this_arg_conv, bit);
61406         return tag_ptr(ret_conv, true);
61407 }
61408
61409 int64_t  CS_LDK_InitFeatures_set_required_custom_bit(int64_t this_arg, int64_t bit) {
61410         LDKInitFeatures this_arg_conv;
61411         this_arg_conv.inner = untag_ptr(this_arg);
61412         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61413         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61414         this_arg_conv.is_owned = false;
61415         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61416         *ret_conv = InitFeatures_set_required_custom_bit(&this_arg_conv, bit);
61417         return tag_ptr(ret_conv, true);
61418 }
61419
61420 int64_t  CS_LDK_InitFeatures_set_optional_custom_bit(int64_t this_arg, int64_t bit) {
61421         LDKInitFeatures this_arg_conv;
61422         this_arg_conv.inner = untag_ptr(this_arg);
61423         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61424         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61425         this_arg_conv.is_owned = false;
61426         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61427         *ret_conv = InitFeatures_set_optional_custom_bit(&this_arg_conv, bit);
61428         return tag_ptr(ret_conv, true);
61429 }
61430
61431 int64_t  CS_LDK_NodeFeatures_empty() {
61432         LDKNodeFeatures ret_var = NodeFeatures_empty();
61433         int64_t ret_ref = 0;
61434         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61435         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61436         return ret_ref;
61437 }
61438
61439 jboolean  CS_LDK_NodeFeatures_requires_unknown_bits_from(int64_t this_arg, int64_t other) {
61440         LDKNodeFeatures this_arg_conv;
61441         this_arg_conv.inner = untag_ptr(this_arg);
61442         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61443         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61444         this_arg_conv.is_owned = false;
61445         LDKNodeFeatures other_conv;
61446         other_conv.inner = untag_ptr(other);
61447         other_conv.is_owned = ptr_is_owned(other);
61448         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
61449         other_conv.is_owned = false;
61450         jboolean ret_conv = NodeFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
61451         return ret_conv;
61452 }
61453
61454 jboolean  CS_LDK_NodeFeatures_requires_unknown_bits(int64_t this_arg) {
61455         LDKNodeFeatures this_arg_conv;
61456         this_arg_conv.inner = untag_ptr(this_arg);
61457         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61458         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61459         this_arg_conv.is_owned = false;
61460         jboolean ret_conv = NodeFeatures_requires_unknown_bits(&this_arg_conv);
61461         return ret_conv;
61462 }
61463
61464 int64_t  CS_LDK_NodeFeatures_set_required_feature_bit(int64_t this_arg, int64_t bit) {
61465         LDKNodeFeatures this_arg_conv;
61466         this_arg_conv.inner = untag_ptr(this_arg);
61467         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61468         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61469         this_arg_conv.is_owned = false;
61470         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61471         *ret_conv = NodeFeatures_set_required_feature_bit(&this_arg_conv, bit);
61472         return tag_ptr(ret_conv, true);
61473 }
61474
61475 int64_t  CS_LDK_NodeFeatures_set_optional_feature_bit(int64_t this_arg, int64_t bit) {
61476         LDKNodeFeatures this_arg_conv;
61477         this_arg_conv.inner = untag_ptr(this_arg);
61478         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61479         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61480         this_arg_conv.is_owned = false;
61481         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61482         *ret_conv = NodeFeatures_set_optional_feature_bit(&this_arg_conv, bit);
61483         return tag_ptr(ret_conv, true);
61484 }
61485
61486 int64_t  CS_LDK_NodeFeatures_set_required_custom_bit(int64_t this_arg, int64_t bit) {
61487         LDKNodeFeatures this_arg_conv;
61488         this_arg_conv.inner = untag_ptr(this_arg);
61489         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61490         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61491         this_arg_conv.is_owned = false;
61492         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61493         *ret_conv = NodeFeatures_set_required_custom_bit(&this_arg_conv, bit);
61494         return tag_ptr(ret_conv, true);
61495 }
61496
61497 int64_t  CS_LDK_NodeFeatures_set_optional_custom_bit(int64_t this_arg, int64_t bit) {
61498         LDKNodeFeatures this_arg_conv;
61499         this_arg_conv.inner = untag_ptr(this_arg);
61500         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61501         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61502         this_arg_conv.is_owned = false;
61503         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61504         *ret_conv = NodeFeatures_set_optional_custom_bit(&this_arg_conv, bit);
61505         return tag_ptr(ret_conv, true);
61506 }
61507
61508 int64_t  CS_LDK_ChannelFeatures_empty() {
61509         LDKChannelFeatures ret_var = ChannelFeatures_empty();
61510         int64_t ret_ref = 0;
61511         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61512         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61513         return ret_ref;
61514 }
61515
61516 jboolean  CS_LDK_ChannelFeatures_requires_unknown_bits_from(int64_t this_arg, int64_t other) {
61517         LDKChannelFeatures this_arg_conv;
61518         this_arg_conv.inner = untag_ptr(this_arg);
61519         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61520         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61521         this_arg_conv.is_owned = false;
61522         LDKChannelFeatures other_conv;
61523         other_conv.inner = untag_ptr(other);
61524         other_conv.is_owned = ptr_is_owned(other);
61525         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
61526         other_conv.is_owned = false;
61527         jboolean ret_conv = ChannelFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
61528         return ret_conv;
61529 }
61530
61531 jboolean  CS_LDK_ChannelFeatures_requires_unknown_bits(int64_t this_arg) {
61532         LDKChannelFeatures this_arg_conv;
61533         this_arg_conv.inner = untag_ptr(this_arg);
61534         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61535         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61536         this_arg_conv.is_owned = false;
61537         jboolean ret_conv = ChannelFeatures_requires_unknown_bits(&this_arg_conv);
61538         return ret_conv;
61539 }
61540
61541 int64_t  CS_LDK_ChannelFeatures_set_required_feature_bit(int64_t this_arg, int64_t bit) {
61542         LDKChannelFeatures this_arg_conv;
61543         this_arg_conv.inner = untag_ptr(this_arg);
61544         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61545         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61546         this_arg_conv.is_owned = false;
61547         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61548         *ret_conv = ChannelFeatures_set_required_feature_bit(&this_arg_conv, bit);
61549         return tag_ptr(ret_conv, true);
61550 }
61551
61552 int64_t  CS_LDK_ChannelFeatures_set_optional_feature_bit(int64_t this_arg, int64_t bit) {
61553         LDKChannelFeatures this_arg_conv;
61554         this_arg_conv.inner = untag_ptr(this_arg);
61555         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61556         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61557         this_arg_conv.is_owned = false;
61558         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61559         *ret_conv = ChannelFeatures_set_optional_feature_bit(&this_arg_conv, bit);
61560         return tag_ptr(ret_conv, true);
61561 }
61562
61563 int64_t  CS_LDK_ChannelFeatures_set_required_custom_bit(int64_t this_arg, int64_t bit) {
61564         LDKChannelFeatures this_arg_conv;
61565         this_arg_conv.inner = untag_ptr(this_arg);
61566         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61567         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61568         this_arg_conv.is_owned = false;
61569         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61570         *ret_conv = ChannelFeatures_set_required_custom_bit(&this_arg_conv, bit);
61571         return tag_ptr(ret_conv, true);
61572 }
61573
61574 int64_t  CS_LDK_ChannelFeatures_set_optional_custom_bit(int64_t this_arg, int64_t bit) {
61575         LDKChannelFeatures this_arg_conv;
61576         this_arg_conv.inner = untag_ptr(this_arg);
61577         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61578         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61579         this_arg_conv.is_owned = false;
61580         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61581         *ret_conv = ChannelFeatures_set_optional_custom_bit(&this_arg_conv, bit);
61582         return tag_ptr(ret_conv, true);
61583 }
61584
61585 int64_t  CS_LDK_Bolt11InvoiceFeatures_empty() {
61586         LDKBolt11InvoiceFeatures ret_var = Bolt11InvoiceFeatures_empty();
61587         int64_t ret_ref = 0;
61588         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61589         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61590         return ret_ref;
61591 }
61592
61593 jboolean  CS_LDK_Bolt11InvoiceFeatures_requires_unknown_bits_from(int64_t this_arg, int64_t other) {
61594         LDKBolt11InvoiceFeatures this_arg_conv;
61595         this_arg_conv.inner = untag_ptr(this_arg);
61596         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61597         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61598         this_arg_conv.is_owned = false;
61599         LDKBolt11InvoiceFeatures other_conv;
61600         other_conv.inner = untag_ptr(other);
61601         other_conv.is_owned = ptr_is_owned(other);
61602         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
61603         other_conv.is_owned = false;
61604         jboolean ret_conv = Bolt11InvoiceFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
61605         return ret_conv;
61606 }
61607
61608 jboolean  CS_LDK_Bolt11InvoiceFeatures_requires_unknown_bits(int64_t this_arg) {
61609         LDKBolt11InvoiceFeatures this_arg_conv;
61610         this_arg_conv.inner = untag_ptr(this_arg);
61611         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61612         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61613         this_arg_conv.is_owned = false;
61614         jboolean ret_conv = Bolt11InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
61615         return ret_conv;
61616 }
61617
61618 int64_t  CS_LDK_Bolt11InvoiceFeatures_set_required_feature_bit(int64_t this_arg, int64_t bit) {
61619         LDKBolt11InvoiceFeatures this_arg_conv;
61620         this_arg_conv.inner = untag_ptr(this_arg);
61621         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61622         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61623         this_arg_conv.is_owned = false;
61624         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61625         *ret_conv = Bolt11InvoiceFeatures_set_required_feature_bit(&this_arg_conv, bit);
61626         return tag_ptr(ret_conv, true);
61627 }
61628
61629 int64_t  CS_LDK_Bolt11InvoiceFeatures_set_optional_feature_bit(int64_t this_arg, int64_t bit) {
61630         LDKBolt11InvoiceFeatures this_arg_conv;
61631         this_arg_conv.inner = untag_ptr(this_arg);
61632         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61633         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61634         this_arg_conv.is_owned = false;
61635         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61636         *ret_conv = Bolt11InvoiceFeatures_set_optional_feature_bit(&this_arg_conv, bit);
61637         return tag_ptr(ret_conv, true);
61638 }
61639
61640 int64_t  CS_LDK_Bolt11InvoiceFeatures_set_required_custom_bit(int64_t this_arg, int64_t bit) {
61641         LDKBolt11InvoiceFeatures this_arg_conv;
61642         this_arg_conv.inner = untag_ptr(this_arg);
61643         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61644         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61645         this_arg_conv.is_owned = false;
61646         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61647         *ret_conv = Bolt11InvoiceFeatures_set_required_custom_bit(&this_arg_conv, bit);
61648         return tag_ptr(ret_conv, true);
61649 }
61650
61651 int64_t  CS_LDK_Bolt11InvoiceFeatures_set_optional_custom_bit(int64_t this_arg, int64_t bit) {
61652         LDKBolt11InvoiceFeatures this_arg_conv;
61653         this_arg_conv.inner = untag_ptr(this_arg);
61654         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61655         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61656         this_arg_conv.is_owned = false;
61657         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61658         *ret_conv = Bolt11InvoiceFeatures_set_optional_custom_bit(&this_arg_conv, bit);
61659         return tag_ptr(ret_conv, true);
61660 }
61661
61662 int64_t  CS_LDK_OfferFeatures_empty() {
61663         LDKOfferFeatures ret_var = OfferFeatures_empty();
61664         int64_t ret_ref = 0;
61665         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61666         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61667         return ret_ref;
61668 }
61669
61670 jboolean  CS_LDK_OfferFeatures_requires_unknown_bits_from(int64_t this_arg, int64_t other) {
61671         LDKOfferFeatures this_arg_conv;
61672         this_arg_conv.inner = untag_ptr(this_arg);
61673         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61674         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61675         this_arg_conv.is_owned = false;
61676         LDKOfferFeatures other_conv;
61677         other_conv.inner = untag_ptr(other);
61678         other_conv.is_owned = ptr_is_owned(other);
61679         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
61680         other_conv.is_owned = false;
61681         jboolean ret_conv = OfferFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
61682         return ret_conv;
61683 }
61684
61685 jboolean  CS_LDK_OfferFeatures_requires_unknown_bits(int64_t this_arg) {
61686         LDKOfferFeatures this_arg_conv;
61687         this_arg_conv.inner = untag_ptr(this_arg);
61688         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61689         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61690         this_arg_conv.is_owned = false;
61691         jboolean ret_conv = OfferFeatures_requires_unknown_bits(&this_arg_conv);
61692         return ret_conv;
61693 }
61694
61695 int64_t  CS_LDK_OfferFeatures_set_required_feature_bit(int64_t this_arg, int64_t bit) {
61696         LDKOfferFeatures this_arg_conv;
61697         this_arg_conv.inner = untag_ptr(this_arg);
61698         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61699         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61700         this_arg_conv.is_owned = false;
61701         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61702         *ret_conv = OfferFeatures_set_required_feature_bit(&this_arg_conv, bit);
61703         return tag_ptr(ret_conv, true);
61704 }
61705
61706 int64_t  CS_LDK_OfferFeatures_set_optional_feature_bit(int64_t this_arg, int64_t bit) {
61707         LDKOfferFeatures this_arg_conv;
61708         this_arg_conv.inner = untag_ptr(this_arg);
61709         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61710         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61711         this_arg_conv.is_owned = false;
61712         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61713         *ret_conv = OfferFeatures_set_optional_feature_bit(&this_arg_conv, bit);
61714         return tag_ptr(ret_conv, true);
61715 }
61716
61717 int64_t  CS_LDK_OfferFeatures_set_required_custom_bit(int64_t this_arg, int64_t bit) {
61718         LDKOfferFeatures this_arg_conv;
61719         this_arg_conv.inner = untag_ptr(this_arg);
61720         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61721         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61722         this_arg_conv.is_owned = false;
61723         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61724         *ret_conv = OfferFeatures_set_required_custom_bit(&this_arg_conv, bit);
61725         return tag_ptr(ret_conv, true);
61726 }
61727
61728 int64_t  CS_LDK_OfferFeatures_set_optional_custom_bit(int64_t this_arg, int64_t bit) {
61729         LDKOfferFeatures this_arg_conv;
61730         this_arg_conv.inner = untag_ptr(this_arg);
61731         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61732         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61733         this_arg_conv.is_owned = false;
61734         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61735         *ret_conv = OfferFeatures_set_optional_custom_bit(&this_arg_conv, bit);
61736         return tag_ptr(ret_conv, true);
61737 }
61738
61739 int64_t  CS_LDK_InvoiceRequestFeatures_empty() {
61740         LDKInvoiceRequestFeatures ret_var = InvoiceRequestFeatures_empty();
61741         int64_t ret_ref = 0;
61742         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61743         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61744         return ret_ref;
61745 }
61746
61747 jboolean  CS_LDK_InvoiceRequestFeatures_requires_unknown_bits_from(int64_t this_arg, int64_t other) {
61748         LDKInvoiceRequestFeatures this_arg_conv;
61749         this_arg_conv.inner = untag_ptr(this_arg);
61750         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61751         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61752         this_arg_conv.is_owned = false;
61753         LDKInvoiceRequestFeatures other_conv;
61754         other_conv.inner = untag_ptr(other);
61755         other_conv.is_owned = ptr_is_owned(other);
61756         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
61757         other_conv.is_owned = false;
61758         jboolean ret_conv = InvoiceRequestFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
61759         return ret_conv;
61760 }
61761
61762 jboolean  CS_LDK_InvoiceRequestFeatures_requires_unknown_bits(int64_t this_arg) {
61763         LDKInvoiceRequestFeatures this_arg_conv;
61764         this_arg_conv.inner = untag_ptr(this_arg);
61765         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61766         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61767         this_arg_conv.is_owned = false;
61768         jboolean ret_conv = InvoiceRequestFeatures_requires_unknown_bits(&this_arg_conv);
61769         return ret_conv;
61770 }
61771
61772 int64_t  CS_LDK_InvoiceRequestFeatures_set_required_feature_bit(int64_t this_arg, int64_t bit) {
61773         LDKInvoiceRequestFeatures this_arg_conv;
61774         this_arg_conv.inner = untag_ptr(this_arg);
61775         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61776         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61777         this_arg_conv.is_owned = false;
61778         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61779         *ret_conv = InvoiceRequestFeatures_set_required_feature_bit(&this_arg_conv, bit);
61780         return tag_ptr(ret_conv, true);
61781 }
61782
61783 int64_t  CS_LDK_InvoiceRequestFeatures_set_optional_feature_bit(int64_t this_arg, int64_t bit) {
61784         LDKInvoiceRequestFeatures this_arg_conv;
61785         this_arg_conv.inner = untag_ptr(this_arg);
61786         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61787         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61788         this_arg_conv.is_owned = false;
61789         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61790         *ret_conv = InvoiceRequestFeatures_set_optional_feature_bit(&this_arg_conv, bit);
61791         return tag_ptr(ret_conv, true);
61792 }
61793
61794 int64_t  CS_LDK_InvoiceRequestFeatures_set_required_custom_bit(int64_t this_arg, int64_t bit) {
61795         LDKInvoiceRequestFeatures this_arg_conv;
61796         this_arg_conv.inner = untag_ptr(this_arg);
61797         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61798         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61799         this_arg_conv.is_owned = false;
61800         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61801         *ret_conv = InvoiceRequestFeatures_set_required_custom_bit(&this_arg_conv, bit);
61802         return tag_ptr(ret_conv, true);
61803 }
61804
61805 int64_t  CS_LDK_InvoiceRequestFeatures_set_optional_custom_bit(int64_t this_arg, int64_t bit) {
61806         LDKInvoiceRequestFeatures this_arg_conv;
61807         this_arg_conv.inner = untag_ptr(this_arg);
61808         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61809         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61810         this_arg_conv.is_owned = false;
61811         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61812         *ret_conv = InvoiceRequestFeatures_set_optional_custom_bit(&this_arg_conv, bit);
61813         return tag_ptr(ret_conv, true);
61814 }
61815
61816 int64_t  CS_LDK_Bolt12InvoiceFeatures_empty() {
61817         LDKBolt12InvoiceFeatures ret_var = Bolt12InvoiceFeatures_empty();
61818         int64_t ret_ref = 0;
61819         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61820         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61821         return ret_ref;
61822 }
61823
61824 jboolean  CS_LDK_Bolt12InvoiceFeatures_requires_unknown_bits_from(int64_t this_arg, int64_t other) {
61825         LDKBolt12InvoiceFeatures this_arg_conv;
61826         this_arg_conv.inner = untag_ptr(this_arg);
61827         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61828         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61829         this_arg_conv.is_owned = false;
61830         LDKBolt12InvoiceFeatures other_conv;
61831         other_conv.inner = untag_ptr(other);
61832         other_conv.is_owned = ptr_is_owned(other);
61833         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
61834         other_conv.is_owned = false;
61835         jboolean ret_conv = Bolt12InvoiceFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
61836         return ret_conv;
61837 }
61838
61839 jboolean  CS_LDK_Bolt12InvoiceFeatures_requires_unknown_bits(int64_t this_arg) {
61840         LDKBolt12InvoiceFeatures this_arg_conv;
61841         this_arg_conv.inner = untag_ptr(this_arg);
61842         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61843         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61844         this_arg_conv.is_owned = false;
61845         jboolean ret_conv = Bolt12InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
61846         return ret_conv;
61847 }
61848
61849 int64_t  CS_LDK_Bolt12InvoiceFeatures_set_required_feature_bit(int64_t this_arg, int64_t bit) {
61850         LDKBolt12InvoiceFeatures this_arg_conv;
61851         this_arg_conv.inner = untag_ptr(this_arg);
61852         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61853         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61854         this_arg_conv.is_owned = false;
61855         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61856         *ret_conv = Bolt12InvoiceFeatures_set_required_feature_bit(&this_arg_conv, bit);
61857         return tag_ptr(ret_conv, true);
61858 }
61859
61860 int64_t  CS_LDK_Bolt12InvoiceFeatures_set_optional_feature_bit(int64_t this_arg, int64_t bit) {
61861         LDKBolt12InvoiceFeatures 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         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61867         *ret_conv = Bolt12InvoiceFeatures_set_optional_feature_bit(&this_arg_conv, bit);
61868         return tag_ptr(ret_conv, true);
61869 }
61870
61871 int64_t  CS_LDK_Bolt12InvoiceFeatures_set_required_custom_bit(int64_t this_arg, int64_t bit) {
61872         LDKBolt12InvoiceFeatures this_arg_conv;
61873         this_arg_conv.inner = untag_ptr(this_arg);
61874         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61875         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61876         this_arg_conv.is_owned = false;
61877         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61878         *ret_conv = Bolt12InvoiceFeatures_set_required_custom_bit(&this_arg_conv, bit);
61879         return tag_ptr(ret_conv, true);
61880 }
61881
61882 int64_t  CS_LDK_Bolt12InvoiceFeatures_set_optional_custom_bit(int64_t this_arg, int64_t bit) {
61883         LDKBolt12InvoiceFeatures this_arg_conv;
61884         this_arg_conv.inner = untag_ptr(this_arg);
61885         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61886         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61887         this_arg_conv.is_owned = false;
61888         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61889         *ret_conv = Bolt12InvoiceFeatures_set_optional_custom_bit(&this_arg_conv, bit);
61890         return tag_ptr(ret_conv, true);
61891 }
61892
61893 int64_t  CS_LDK_BlindedHopFeatures_empty() {
61894         LDKBlindedHopFeatures ret_var = BlindedHopFeatures_empty();
61895         int64_t ret_ref = 0;
61896         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61897         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61898         return ret_ref;
61899 }
61900
61901 jboolean  CS_LDK_BlindedHopFeatures_requires_unknown_bits_from(int64_t this_arg, int64_t other) {
61902         LDKBlindedHopFeatures this_arg_conv;
61903         this_arg_conv.inner = untag_ptr(this_arg);
61904         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61905         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61906         this_arg_conv.is_owned = false;
61907         LDKBlindedHopFeatures other_conv;
61908         other_conv.inner = untag_ptr(other);
61909         other_conv.is_owned = ptr_is_owned(other);
61910         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
61911         other_conv.is_owned = false;
61912         jboolean ret_conv = BlindedHopFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
61913         return ret_conv;
61914 }
61915
61916 jboolean  CS_LDK_BlindedHopFeatures_requires_unknown_bits(int64_t this_arg) {
61917         LDKBlindedHopFeatures this_arg_conv;
61918         this_arg_conv.inner = untag_ptr(this_arg);
61919         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61920         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61921         this_arg_conv.is_owned = false;
61922         jboolean ret_conv = BlindedHopFeatures_requires_unknown_bits(&this_arg_conv);
61923         return ret_conv;
61924 }
61925
61926 int64_t  CS_LDK_BlindedHopFeatures_set_required_feature_bit(int64_t this_arg, int64_t bit) {
61927         LDKBlindedHopFeatures this_arg_conv;
61928         this_arg_conv.inner = untag_ptr(this_arg);
61929         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61930         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61931         this_arg_conv.is_owned = false;
61932         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61933         *ret_conv = BlindedHopFeatures_set_required_feature_bit(&this_arg_conv, bit);
61934         return tag_ptr(ret_conv, true);
61935 }
61936
61937 int64_t  CS_LDK_BlindedHopFeatures_set_optional_feature_bit(int64_t this_arg, int64_t bit) {
61938         LDKBlindedHopFeatures this_arg_conv;
61939         this_arg_conv.inner = untag_ptr(this_arg);
61940         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61941         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61942         this_arg_conv.is_owned = false;
61943         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61944         *ret_conv = BlindedHopFeatures_set_optional_feature_bit(&this_arg_conv, bit);
61945         return tag_ptr(ret_conv, true);
61946 }
61947
61948 int64_t  CS_LDK_BlindedHopFeatures_set_required_custom_bit(int64_t this_arg, int64_t bit) {
61949         LDKBlindedHopFeatures this_arg_conv;
61950         this_arg_conv.inner = untag_ptr(this_arg);
61951         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61952         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61953         this_arg_conv.is_owned = false;
61954         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61955         *ret_conv = BlindedHopFeatures_set_required_custom_bit(&this_arg_conv, bit);
61956         return tag_ptr(ret_conv, true);
61957 }
61958
61959 int64_t  CS_LDK_BlindedHopFeatures_set_optional_custom_bit(int64_t this_arg, int64_t bit) {
61960         LDKBlindedHopFeatures this_arg_conv;
61961         this_arg_conv.inner = untag_ptr(this_arg);
61962         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61963         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61964         this_arg_conv.is_owned = false;
61965         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
61966         *ret_conv = BlindedHopFeatures_set_optional_custom_bit(&this_arg_conv, bit);
61967         return tag_ptr(ret_conv, true);
61968 }
61969
61970 int64_t  CS_LDK_ChannelTypeFeatures_empty() {
61971         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_empty();
61972         int64_t ret_ref = 0;
61973         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61974         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61975         return ret_ref;
61976 }
61977
61978 jboolean  CS_LDK_ChannelTypeFeatures_requires_unknown_bits_from(int64_t this_arg, int64_t other) {
61979         LDKChannelTypeFeatures this_arg_conv;
61980         this_arg_conv.inner = untag_ptr(this_arg);
61981         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61982         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61983         this_arg_conv.is_owned = false;
61984         LDKChannelTypeFeatures other_conv;
61985         other_conv.inner = untag_ptr(other);
61986         other_conv.is_owned = ptr_is_owned(other);
61987         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
61988         other_conv.is_owned = false;
61989         jboolean ret_conv = ChannelTypeFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
61990         return ret_conv;
61991 }
61992
61993 jboolean  CS_LDK_ChannelTypeFeatures_requires_unknown_bits(int64_t this_arg) {
61994         LDKChannelTypeFeatures this_arg_conv;
61995         this_arg_conv.inner = untag_ptr(this_arg);
61996         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61997         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61998         this_arg_conv.is_owned = false;
61999         jboolean ret_conv = ChannelTypeFeatures_requires_unknown_bits(&this_arg_conv);
62000         return ret_conv;
62001 }
62002
62003 int64_t  CS_LDK_ChannelTypeFeatures_set_required_feature_bit(int64_t this_arg, int64_t bit) {
62004         LDKChannelTypeFeatures this_arg_conv;
62005         this_arg_conv.inner = untag_ptr(this_arg);
62006         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62007         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62008         this_arg_conv.is_owned = false;
62009         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
62010         *ret_conv = ChannelTypeFeatures_set_required_feature_bit(&this_arg_conv, bit);
62011         return tag_ptr(ret_conv, true);
62012 }
62013
62014 int64_t  CS_LDK_ChannelTypeFeatures_set_optional_feature_bit(int64_t this_arg, int64_t bit) {
62015         LDKChannelTypeFeatures this_arg_conv;
62016         this_arg_conv.inner = untag_ptr(this_arg);
62017         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62018         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62019         this_arg_conv.is_owned = false;
62020         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
62021         *ret_conv = ChannelTypeFeatures_set_optional_feature_bit(&this_arg_conv, bit);
62022         return tag_ptr(ret_conv, true);
62023 }
62024
62025 int64_t  CS_LDK_ChannelTypeFeatures_set_required_custom_bit(int64_t this_arg, int64_t bit) {
62026         LDKChannelTypeFeatures this_arg_conv;
62027         this_arg_conv.inner = untag_ptr(this_arg);
62028         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62029         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62030         this_arg_conv.is_owned = false;
62031         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
62032         *ret_conv = ChannelTypeFeatures_set_required_custom_bit(&this_arg_conv, bit);
62033         return tag_ptr(ret_conv, true);
62034 }
62035
62036 int64_t  CS_LDK_ChannelTypeFeatures_set_optional_custom_bit(int64_t this_arg, int64_t bit) {
62037         LDKChannelTypeFeatures this_arg_conv;
62038         this_arg_conv.inner = untag_ptr(this_arg);
62039         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62040         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62041         this_arg_conv.is_owned = false;
62042         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
62043         *ret_conv = ChannelTypeFeatures_set_optional_custom_bit(&this_arg_conv, bit);
62044         return tag_ptr(ret_conv, true);
62045 }
62046
62047 int8_tArray  CS_LDK_InitFeatures_write(int64_t obj) {
62048         LDKInitFeatures obj_conv;
62049         obj_conv.inner = untag_ptr(obj);
62050         obj_conv.is_owned = ptr_is_owned(obj);
62051         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
62052         obj_conv.is_owned = false;
62053         LDKCVec_u8Z ret_var = InitFeatures_write(&obj_conv);
62054         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
62055         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
62056         CVec_u8Z_free(ret_var);
62057         return ret_arr;
62058 }
62059
62060 int64_t  CS_LDK_InitFeatures_read(int8_tArray ser) {
62061         LDKu8slice ser_ref;
62062         ser_ref.datalen = ser->arr_len;
62063         ser_ref.data = ser->elems;
62064         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
62065         *ret_conv = InitFeatures_read(ser_ref);
62066         FREE(ser);
62067         return tag_ptr(ret_conv, true);
62068 }
62069
62070 int8_tArray  CS_LDK_ChannelFeatures_write(int64_t obj) {
62071         LDKChannelFeatures obj_conv;
62072         obj_conv.inner = untag_ptr(obj);
62073         obj_conv.is_owned = ptr_is_owned(obj);
62074         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
62075         obj_conv.is_owned = false;
62076         LDKCVec_u8Z ret_var = ChannelFeatures_write(&obj_conv);
62077         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
62078         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
62079         CVec_u8Z_free(ret_var);
62080         return ret_arr;
62081 }
62082
62083 int64_t  CS_LDK_ChannelFeatures_read(int8_tArray ser) {
62084         LDKu8slice ser_ref;
62085         ser_ref.datalen = ser->arr_len;
62086         ser_ref.data = ser->elems;
62087         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
62088         *ret_conv = ChannelFeatures_read(ser_ref);
62089         FREE(ser);
62090         return tag_ptr(ret_conv, true);
62091 }
62092
62093 int8_tArray  CS_LDK_NodeFeatures_write(int64_t obj) {
62094         LDKNodeFeatures obj_conv;
62095         obj_conv.inner = untag_ptr(obj);
62096         obj_conv.is_owned = ptr_is_owned(obj);
62097         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
62098         obj_conv.is_owned = false;
62099         LDKCVec_u8Z ret_var = NodeFeatures_write(&obj_conv);
62100         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
62101         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
62102         CVec_u8Z_free(ret_var);
62103         return ret_arr;
62104 }
62105
62106 int64_t  CS_LDK_NodeFeatures_read(int8_tArray ser) {
62107         LDKu8slice ser_ref;
62108         ser_ref.datalen = ser->arr_len;
62109         ser_ref.data = ser->elems;
62110         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
62111         *ret_conv = NodeFeatures_read(ser_ref);
62112         FREE(ser);
62113         return tag_ptr(ret_conv, true);
62114 }
62115
62116 int8_tArray  CS_LDK_Bolt11InvoiceFeatures_write(int64_t obj) {
62117         LDKBolt11InvoiceFeatures obj_conv;
62118         obj_conv.inner = untag_ptr(obj);
62119         obj_conv.is_owned = ptr_is_owned(obj);
62120         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
62121         obj_conv.is_owned = false;
62122         LDKCVec_u8Z ret_var = Bolt11InvoiceFeatures_write(&obj_conv);
62123         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
62124         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
62125         CVec_u8Z_free(ret_var);
62126         return ret_arr;
62127 }
62128
62129 int64_t  CS_LDK_Bolt11InvoiceFeatures_read(int8_tArray ser) {
62130         LDKu8slice ser_ref;
62131         ser_ref.datalen = ser->arr_len;
62132         ser_ref.data = ser->elems;
62133         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
62134         *ret_conv = Bolt11InvoiceFeatures_read(ser_ref);
62135         FREE(ser);
62136         return tag_ptr(ret_conv, true);
62137 }
62138
62139 int8_tArray  CS_LDK_Bolt12InvoiceFeatures_write(int64_t obj) {
62140         LDKBolt12InvoiceFeatures obj_conv;
62141         obj_conv.inner = untag_ptr(obj);
62142         obj_conv.is_owned = ptr_is_owned(obj);
62143         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
62144         obj_conv.is_owned = false;
62145         LDKCVec_u8Z ret_var = Bolt12InvoiceFeatures_write(&obj_conv);
62146         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
62147         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
62148         CVec_u8Z_free(ret_var);
62149         return ret_arr;
62150 }
62151
62152 int64_t  CS_LDK_Bolt12InvoiceFeatures_read(int8_tArray ser) {
62153         LDKu8slice ser_ref;
62154         ser_ref.datalen = ser->arr_len;
62155         ser_ref.data = ser->elems;
62156         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
62157         *ret_conv = Bolt12InvoiceFeatures_read(ser_ref);
62158         FREE(ser);
62159         return tag_ptr(ret_conv, true);
62160 }
62161
62162 int8_tArray  CS_LDK_BlindedHopFeatures_write(int64_t obj) {
62163         LDKBlindedHopFeatures obj_conv;
62164         obj_conv.inner = untag_ptr(obj);
62165         obj_conv.is_owned = ptr_is_owned(obj);
62166         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
62167         obj_conv.is_owned = false;
62168         LDKCVec_u8Z ret_var = BlindedHopFeatures_write(&obj_conv);
62169         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
62170         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
62171         CVec_u8Z_free(ret_var);
62172         return ret_arr;
62173 }
62174
62175 int64_t  CS_LDK_BlindedHopFeatures_read(int8_tArray ser) {
62176         LDKu8slice ser_ref;
62177         ser_ref.datalen = ser->arr_len;
62178         ser_ref.data = ser->elems;
62179         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
62180         *ret_conv = BlindedHopFeatures_read(ser_ref);
62181         FREE(ser);
62182         return tag_ptr(ret_conv, true);
62183 }
62184
62185 int8_tArray  CS_LDK_ChannelTypeFeatures_write(int64_t obj) {
62186         LDKChannelTypeFeatures obj_conv;
62187         obj_conv.inner = untag_ptr(obj);
62188         obj_conv.is_owned = ptr_is_owned(obj);
62189         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
62190         obj_conv.is_owned = false;
62191         LDKCVec_u8Z ret_var = ChannelTypeFeatures_write(&obj_conv);
62192         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
62193         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
62194         CVec_u8Z_free(ret_var);
62195         return ret_arr;
62196 }
62197
62198 int64_t  CS_LDK_ChannelTypeFeatures_read(int8_tArray ser) {
62199         LDKu8slice ser_ref;
62200         ser_ref.datalen = ser->arr_len;
62201         ser_ref.data = ser->elems;
62202         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
62203         *ret_conv = ChannelTypeFeatures_read(ser_ref);
62204         FREE(ser);
62205         return tag_ptr(ret_conv, true);
62206 }
62207
62208 void  CS_LDK_InitFeatures_set_data_loss_protect_optional(int64_t this_arg) {
62209         LDKInitFeatures this_arg_conv;
62210         this_arg_conv.inner = untag_ptr(this_arg);
62211         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62212         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62213         this_arg_conv.is_owned = false;
62214         InitFeatures_set_data_loss_protect_optional(&this_arg_conv);
62215 }
62216
62217 void  CS_LDK_InitFeatures_set_data_loss_protect_required(int64_t this_arg) {
62218         LDKInitFeatures this_arg_conv;
62219         this_arg_conv.inner = untag_ptr(this_arg);
62220         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62221         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62222         this_arg_conv.is_owned = false;
62223         InitFeatures_set_data_loss_protect_required(&this_arg_conv);
62224 }
62225
62226 jboolean  CS_LDK_InitFeatures_supports_data_loss_protect(int64_t this_arg) {
62227         LDKInitFeatures this_arg_conv;
62228         this_arg_conv.inner = untag_ptr(this_arg);
62229         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62230         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62231         this_arg_conv.is_owned = false;
62232         jboolean ret_conv = InitFeatures_supports_data_loss_protect(&this_arg_conv);
62233         return ret_conv;
62234 }
62235
62236 void  CS_LDK_NodeFeatures_set_data_loss_protect_optional(int64_t this_arg) {
62237         LDKNodeFeatures this_arg_conv;
62238         this_arg_conv.inner = untag_ptr(this_arg);
62239         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62240         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62241         this_arg_conv.is_owned = false;
62242         NodeFeatures_set_data_loss_protect_optional(&this_arg_conv);
62243 }
62244
62245 void  CS_LDK_NodeFeatures_set_data_loss_protect_required(int64_t this_arg) {
62246         LDKNodeFeatures this_arg_conv;
62247         this_arg_conv.inner = untag_ptr(this_arg);
62248         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62249         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62250         this_arg_conv.is_owned = false;
62251         NodeFeatures_set_data_loss_protect_required(&this_arg_conv);
62252 }
62253
62254 jboolean  CS_LDK_NodeFeatures_supports_data_loss_protect(int64_t this_arg) {
62255         LDKNodeFeatures this_arg_conv;
62256         this_arg_conv.inner = untag_ptr(this_arg);
62257         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62258         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62259         this_arg_conv.is_owned = false;
62260         jboolean ret_conv = NodeFeatures_supports_data_loss_protect(&this_arg_conv);
62261         return ret_conv;
62262 }
62263
62264 jboolean  CS_LDK_InitFeatures_requires_data_loss_protect(int64_t this_arg) {
62265         LDKInitFeatures this_arg_conv;
62266         this_arg_conv.inner = untag_ptr(this_arg);
62267         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62268         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62269         this_arg_conv.is_owned = false;
62270         jboolean ret_conv = InitFeatures_requires_data_loss_protect(&this_arg_conv);
62271         return ret_conv;
62272 }
62273
62274 jboolean  CS_LDK_NodeFeatures_requires_data_loss_protect(int64_t this_arg) {
62275         LDKNodeFeatures this_arg_conv;
62276         this_arg_conv.inner = untag_ptr(this_arg);
62277         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62278         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62279         this_arg_conv.is_owned = false;
62280         jboolean ret_conv = NodeFeatures_requires_data_loss_protect(&this_arg_conv);
62281         return ret_conv;
62282 }
62283
62284 void  CS_LDK_InitFeatures_set_initial_routing_sync_optional(int64_t this_arg) {
62285         LDKInitFeatures this_arg_conv;
62286         this_arg_conv.inner = untag_ptr(this_arg);
62287         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62288         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62289         this_arg_conv.is_owned = false;
62290         InitFeatures_set_initial_routing_sync_optional(&this_arg_conv);
62291 }
62292
62293 void  CS_LDK_InitFeatures_set_initial_routing_sync_required(int64_t this_arg) {
62294         LDKInitFeatures this_arg_conv;
62295         this_arg_conv.inner = untag_ptr(this_arg);
62296         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62297         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62298         this_arg_conv.is_owned = false;
62299         InitFeatures_set_initial_routing_sync_required(&this_arg_conv);
62300 }
62301
62302 jboolean  CS_LDK_InitFeatures_initial_routing_sync(int64_t this_arg) {
62303         LDKInitFeatures this_arg_conv;
62304         this_arg_conv.inner = untag_ptr(this_arg);
62305         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62306         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62307         this_arg_conv.is_owned = false;
62308         jboolean ret_conv = InitFeatures_initial_routing_sync(&this_arg_conv);
62309         return ret_conv;
62310 }
62311
62312 void  CS_LDK_InitFeatures_set_upfront_shutdown_script_optional(int64_t this_arg) {
62313         LDKInitFeatures this_arg_conv;
62314         this_arg_conv.inner = untag_ptr(this_arg);
62315         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62316         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62317         this_arg_conv.is_owned = false;
62318         InitFeatures_set_upfront_shutdown_script_optional(&this_arg_conv);
62319 }
62320
62321 void  CS_LDK_InitFeatures_set_upfront_shutdown_script_required(int64_t this_arg) {
62322         LDKInitFeatures this_arg_conv;
62323         this_arg_conv.inner = untag_ptr(this_arg);
62324         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62325         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62326         this_arg_conv.is_owned = false;
62327         InitFeatures_set_upfront_shutdown_script_required(&this_arg_conv);
62328 }
62329
62330 jboolean  CS_LDK_InitFeatures_supports_upfront_shutdown_script(int64_t this_arg) {
62331         LDKInitFeatures this_arg_conv;
62332         this_arg_conv.inner = untag_ptr(this_arg);
62333         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62334         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62335         this_arg_conv.is_owned = false;
62336         jboolean ret_conv = InitFeatures_supports_upfront_shutdown_script(&this_arg_conv);
62337         return ret_conv;
62338 }
62339
62340 void  CS_LDK_NodeFeatures_set_upfront_shutdown_script_optional(int64_t this_arg) {
62341         LDKNodeFeatures this_arg_conv;
62342         this_arg_conv.inner = untag_ptr(this_arg);
62343         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62344         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62345         this_arg_conv.is_owned = false;
62346         NodeFeatures_set_upfront_shutdown_script_optional(&this_arg_conv);
62347 }
62348
62349 void  CS_LDK_NodeFeatures_set_upfront_shutdown_script_required(int64_t this_arg) {
62350         LDKNodeFeatures this_arg_conv;
62351         this_arg_conv.inner = untag_ptr(this_arg);
62352         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62353         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62354         this_arg_conv.is_owned = false;
62355         NodeFeatures_set_upfront_shutdown_script_required(&this_arg_conv);
62356 }
62357
62358 jboolean  CS_LDK_NodeFeatures_supports_upfront_shutdown_script(int64_t this_arg) {
62359         LDKNodeFeatures this_arg_conv;
62360         this_arg_conv.inner = untag_ptr(this_arg);
62361         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62362         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62363         this_arg_conv.is_owned = false;
62364         jboolean ret_conv = NodeFeatures_supports_upfront_shutdown_script(&this_arg_conv);
62365         return ret_conv;
62366 }
62367
62368 jboolean  CS_LDK_InitFeatures_requires_upfront_shutdown_script(int64_t this_arg) {
62369         LDKInitFeatures this_arg_conv;
62370         this_arg_conv.inner = untag_ptr(this_arg);
62371         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62372         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62373         this_arg_conv.is_owned = false;
62374         jboolean ret_conv = InitFeatures_requires_upfront_shutdown_script(&this_arg_conv);
62375         return ret_conv;
62376 }
62377
62378 jboolean  CS_LDK_NodeFeatures_requires_upfront_shutdown_script(int64_t this_arg) {
62379         LDKNodeFeatures this_arg_conv;
62380         this_arg_conv.inner = untag_ptr(this_arg);
62381         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62382         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62383         this_arg_conv.is_owned = false;
62384         jboolean ret_conv = NodeFeatures_requires_upfront_shutdown_script(&this_arg_conv);
62385         return ret_conv;
62386 }
62387
62388 void  CS_LDK_InitFeatures_set_gossip_queries_optional(int64_t this_arg) {
62389         LDKInitFeatures this_arg_conv;
62390         this_arg_conv.inner = untag_ptr(this_arg);
62391         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62392         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62393         this_arg_conv.is_owned = false;
62394         InitFeatures_set_gossip_queries_optional(&this_arg_conv);
62395 }
62396
62397 void  CS_LDK_InitFeatures_set_gossip_queries_required(int64_t this_arg) {
62398         LDKInitFeatures this_arg_conv;
62399         this_arg_conv.inner = untag_ptr(this_arg);
62400         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62401         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62402         this_arg_conv.is_owned = false;
62403         InitFeatures_set_gossip_queries_required(&this_arg_conv);
62404 }
62405
62406 jboolean  CS_LDK_InitFeatures_supports_gossip_queries(int64_t this_arg) {
62407         LDKInitFeatures this_arg_conv;
62408         this_arg_conv.inner = untag_ptr(this_arg);
62409         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62410         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62411         this_arg_conv.is_owned = false;
62412         jboolean ret_conv = InitFeatures_supports_gossip_queries(&this_arg_conv);
62413         return ret_conv;
62414 }
62415
62416 void  CS_LDK_NodeFeatures_set_gossip_queries_optional(int64_t this_arg) {
62417         LDKNodeFeatures this_arg_conv;
62418         this_arg_conv.inner = untag_ptr(this_arg);
62419         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62420         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62421         this_arg_conv.is_owned = false;
62422         NodeFeatures_set_gossip_queries_optional(&this_arg_conv);
62423 }
62424
62425 void  CS_LDK_NodeFeatures_set_gossip_queries_required(int64_t this_arg) {
62426         LDKNodeFeatures this_arg_conv;
62427         this_arg_conv.inner = untag_ptr(this_arg);
62428         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62429         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62430         this_arg_conv.is_owned = false;
62431         NodeFeatures_set_gossip_queries_required(&this_arg_conv);
62432 }
62433
62434 jboolean  CS_LDK_NodeFeatures_supports_gossip_queries(int64_t this_arg) {
62435         LDKNodeFeatures this_arg_conv;
62436         this_arg_conv.inner = untag_ptr(this_arg);
62437         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62438         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62439         this_arg_conv.is_owned = false;
62440         jboolean ret_conv = NodeFeatures_supports_gossip_queries(&this_arg_conv);
62441         return ret_conv;
62442 }
62443
62444 jboolean  CS_LDK_InitFeatures_requires_gossip_queries(int64_t this_arg) {
62445         LDKInitFeatures this_arg_conv;
62446         this_arg_conv.inner = untag_ptr(this_arg);
62447         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62448         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62449         this_arg_conv.is_owned = false;
62450         jboolean ret_conv = InitFeatures_requires_gossip_queries(&this_arg_conv);
62451         return ret_conv;
62452 }
62453
62454 jboolean  CS_LDK_NodeFeatures_requires_gossip_queries(int64_t this_arg) {
62455         LDKNodeFeatures this_arg_conv;
62456         this_arg_conv.inner = untag_ptr(this_arg);
62457         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62458         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62459         this_arg_conv.is_owned = false;
62460         jboolean ret_conv = NodeFeatures_requires_gossip_queries(&this_arg_conv);
62461         return ret_conv;
62462 }
62463
62464 void  CS_LDK_InitFeatures_set_variable_length_onion_optional(int64_t this_arg) {
62465         LDKInitFeatures this_arg_conv;
62466         this_arg_conv.inner = untag_ptr(this_arg);
62467         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62468         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62469         this_arg_conv.is_owned = false;
62470         InitFeatures_set_variable_length_onion_optional(&this_arg_conv);
62471 }
62472
62473 void  CS_LDK_InitFeatures_set_variable_length_onion_required(int64_t this_arg) {
62474         LDKInitFeatures this_arg_conv;
62475         this_arg_conv.inner = untag_ptr(this_arg);
62476         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62477         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62478         this_arg_conv.is_owned = false;
62479         InitFeatures_set_variable_length_onion_required(&this_arg_conv);
62480 }
62481
62482 jboolean  CS_LDK_InitFeatures_supports_variable_length_onion(int64_t this_arg) {
62483         LDKInitFeatures this_arg_conv;
62484         this_arg_conv.inner = untag_ptr(this_arg);
62485         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62486         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62487         this_arg_conv.is_owned = false;
62488         jboolean ret_conv = InitFeatures_supports_variable_length_onion(&this_arg_conv);
62489         return ret_conv;
62490 }
62491
62492 void  CS_LDK_NodeFeatures_set_variable_length_onion_optional(int64_t this_arg) {
62493         LDKNodeFeatures this_arg_conv;
62494         this_arg_conv.inner = untag_ptr(this_arg);
62495         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62496         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62497         this_arg_conv.is_owned = false;
62498         NodeFeatures_set_variable_length_onion_optional(&this_arg_conv);
62499 }
62500
62501 void  CS_LDK_NodeFeatures_set_variable_length_onion_required(int64_t this_arg) {
62502         LDKNodeFeatures this_arg_conv;
62503         this_arg_conv.inner = untag_ptr(this_arg);
62504         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62505         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62506         this_arg_conv.is_owned = false;
62507         NodeFeatures_set_variable_length_onion_required(&this_arg_conv);
62508 }
62509
62510 jboolean  CS_LDK_NodeFeatures_supports_variable_length_onion(int64_t this_arg) {
62511         LDKNodeFeatures this_arg_conv;
62512         this_arg_conv.inner = untag_ptr(this_arg);
62513         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62514         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62515         this_arg_conv.is_owned = false;
62516         jboolean ret_conv = NodeFeatures_supports_variable_length_onion(&this_arg_conv);
62517         return ret_conv;
62518 }
62519
62520 void  CS_LDK_Bolt11InvoiceFeatures_set_variable_length_onion_optional(int64_t this_arg) {
62521         LDKBolt11InvoiceFeatures this_arg_conv;
62522         this_arg_conv.inner = untag_ptr(this_arg);
62523         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62524         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62525         this_arg_conv.is_owned = false;
62526         Bolt11InvoiceFeatures_set_variable_length_onion_optional(&this_arg_conv);
62527 }
62528
62529 void  CS_LDK_Bolt11InvoiceFeatures_set_variable_length_onion_required(int64_t this_arg) {
62530         LDKBolt11InvoiceFeatures this_arg_conv;
62531         this_arg_conv.inner = untag_ptr(this_arg);
62532         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62533         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62534         this_arg_conv.is_owned = false;
62535         Bolt11InvoiceFeatures_set_variable_length_onion_required(&this_arg_conv);
62536 }
62537
62538 jboolean  CS_LDK_Bolt11InvoiceFeatures_supports_variable_length_onion(int64_t this_arg) {
62539         LDKBolt11InvoiceFeatures this_arg_conv;
62540         this_arg_conv.inner = untag_ptr(this_arg);
62541         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62542         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62543         this_arg_conv.is_owned = false;
62544         jboolean ret_conv = Bolt11InvoiceFeatures_supports_variable_length_onion(&this_arg_conv);
62545         return ret_conv;
62546 }
62547
62548 jboolean  CS_LDK_InitFeatures_requires_variable_length_onion(int64_t this_arg) {
62549         LDKInitFeatures this_arg_conv;
62550         this_arg_conv.inner = untag_ptr(this_arg);
62551         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62552         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62553         this_arg_conv.is_owned = false;
62554         jboolean ret_conv = InitFeatures_requires_variable_length_onion(&this_arg_conv);
62555         return ret_conv;
62556 }
62557
62558 jboolean  CS_LDK_NodeFeatures_requires_variable_length_onion(int64_t this_arg) {
62559         LDKNodeFeatures this_arg_conv;
62560         this_arg_conv.inner = untag_ptr(this_arg);
62561         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62562         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62563         this_arg_conv.is_owned = false;
62564         jboolean ret_conv = NodeFeatures_requires_variable_length_onion(&this_arg_conv);
62565         return ret_conv;
62566 }
62567
62568 jboolean  CS_LDK_Bolt11InvoiceFeatures_requires_variable_length_onion(int64_t this_arg) {
62569         LDKBolt11InvoiceFeatures this_arg_conv;
62570         this_arg_conv.inner = untag_ptr(this_arg);
62571         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62572         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62573         this_arg_conv.is_owned = false;
62574         jboolean ret_conv = Bolt11InvoiceFeatures_requires_variable_length_onion(&this_arg_conv);
62575         return ret_conv;
62576 }
62577
62578 void  CS_LDK_InitFeatures_set_static_remote_key_optional(int64_t this_arg) {
62579         LDKInitFeatures this_arg_conv;
62580         this_arg_conv.inner = untag_ptr(this_arg);
62581         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62582         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62583         this_arg_conv.is_owned = false;
62584         InitFeatures_set_static_remote_key_optional(&this_arg_conv);
62585 }
62586
62587 void  CS_LDK_InitFeatures_set_static_remote_key_required(int64_t this_arg) {
62588         LDKInitFeatures this_arg_conv;
62589         this_arg_conv.inner = untag_ptr(this_arg);
62590         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62591         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62592         this_arg_conv.is_owned = false;
62593         InitFeatures_set_static_remote_key_required(&this_arg_conv);
62594 }
62595
62596 jboolean  CS_LDK_InitFeatures_supports_static_remote_key(int64_t this_arg) {
62597         LDKInitFeatures this_arg_conv;
62598         this_arg_conv.inner = untag_ptr(this_arg);
62599         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62600         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62601         this_arg_conv.is_owned = false;
62602         jboolean ret_conv = InitFeatures_supports_static_remote_key(&this_arg_conv);
62603         return ret_conv;
62604 }
62605
62606 void  CS_LDK_NodeFeatures_set_static_remote_key_optional(int64_t this_arg) {
62607         LDKNodeFeatures this_arg_conv;
62608         this_arg_conv.inner = untag_ptr(this_arg);
62609         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62610         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62611         this_arg_conv.is_owned = false;
62612         NodeFeatures_set_static_remote_key_optional(&this_arg_conv);
62613 }
62614
62615 void  CS_LDK_NodeFeatures_set_static_remote_key_required(int64_t this_arg) {
62616         LDKNodeFeatures this_arg_conv;
62617         this_arg_conv.inner = untag_ptr(this_arg);
62618         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62619         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62620         this_arg_conv.is_owned = false;
62621         NodeFeatures_set_static_remote_key_required(&this_arg_conv);
62622 }
62623
62624 jboolean  CS_LDK_NodeFeatures_supports_static_remote_key(int64_t this_arg) {
62625         LDKNodeFeatures this_arg_conv;
62626         this_arg_conv.inner = untag_ptr(this_arg);
62627         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62628         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62629         this_arg_conv.is_owned = false;
62630         jboolean ret_conv = NodeFeatures_supports_static_remote_key(&this_arg_conv);
62631         return ret_conv;
62632 }
62633
62634 void  CS_LDK_ChannelTypeFeatures_set_static_remote_key_optional(int64_t this_arg) {
62635         LDKChannelTypeFeatures this_arg_conv;
62636         this_arg_conv.inner = untag_ptr(this_arg);
62637         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62638         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62639         this_arg_conv.is_owned = false;
62640         ChannelTypeFeatures_set_static_remote_key_optional(&this_arg_conv);
62641 }
62642
62643 void  CS_LDK_ChannelTypeFeatures_set_static_remote_key_required(int64_t this_arg) {
62644         LDKChannelTypeFeatures this_arg_conv;
62645         this_arg_conv.inner = untag_ptr(this_arg);
62646         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62647         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62648         this_arg_conv.is_owned = false;
62649         ChannelTypeFeatures_set_static_remote_key_required(&this_arg_conv);
62650 }
62651
62652 jboolean  CS_LDK_ChannelTypeFeatures_supports_static_remote_key(int64_t this_arg) {
62653         LDKChannelTypeFeatures this_arg_conv;
62654         this_arg_conv.inner = untag_ptr(this_arg);
62655         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62656         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62657         this_arg_conv.is_owned = false;
62658         jboolean ret_conv = ChannelTypeFeatures_supports_static_remote_key(&this_arg_conv);
62659         return ret_conv;
62660 }
62661
62662 jboolean  CS_LDK_InitFeatures_requires_static_remote_key(int64_t this_arg) {
62663         LDKInitFeatures this_arg_conv;
62664         this_arg_conv.inner = untag_ptr(this_arg);
62665         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62666         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62667         this_arg_conv.is_owned = false;
62668         jboolean ret_conv = InitFeatures_requires_static_remote_key(&this_arg_conv);
62669         return ret_conv;
62670 }
62671
62672 jboolean  CS_LDK_NodeFeatures_requires_static_remote_key(int64_t this_arg) {
62673         LDKNodeFeatures this_arg_conv;
62674         this_arg_conv.inner = untag_ptr(this_arg);
62675         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62676         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62677         this_arg_conv.is_owned = false;
62678         jboolean ret_conv = NodeFeatures_requires_static_remote_key(&this_arg_conv);
62679         return ret_conv;
62680 }
62681
62682 jboolean  CS_LDK_ChannelTypeFeatures_requires_static_remote_key(int64_t this_arg) {
62683         LDKChannelTypeFeatures this_arg_conv;
62684         this_arg_conv.inner = untag_ptr(this_arg);
62685         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62686         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62687         this_arg_conv.is_owned = false;
62688         jboolean ret_conv = ChannelTypeFeatures_requires_static_remote_key(&this_arg_conv);
62689         return ret_conv;
62690 }
62691
62692 void  CS_LDK_InitFeatures_set_payment_secret_optional(int64_t this_arg) {
62693         LDKInitFeatures this_arg_conv;
62694         this_arg_conv.inner = untag_ptr(this_arg);
62695         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62696         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62697         this_arg_conv.is_owned = false;
62698         InitFeatures_set_payment_secret_optional(&this_arg_conv);
62699 }
62700
62701 void  CS_LDK_InitFeatures_set_payment_secret_required(int64_t this_arg) {
62702         LDKInitFeatures this_arg_conv;
62703         this_arg_conv.inner = untag_ptr(this_arg);
62704         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62705         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62706         this_arg_conv.is_owned = false;
62707         InitFeatures_set_payment_secret_required(&this_arg_conv);
62708 }
62709
62710 jboolean  CS_LDK_InitFeatures_supports_payment_secret(int64_t this_arg) {
62711         LDKInitFeatures this_arg_conv;
62712         this_arg_conv.inner = untag_ptr(this_arg);
62713         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62714         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62715         this_arg_conv.is_owned = false;
62716         jboolean ret_conv = InitFeatures_supports_payment_secret(&this_arg_conv);
62717         return ret_conv;
62718 }
62719
62720 void  CS_LDK_NodeFeatures_set_payment_secret_optional(int64_t this_arg) {
62721         LDKNodeFeatures this_arg_conv;
62722         this_arg_conv.inner = untag_ptr(this_arg);
62723         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62724         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62725         this_arg_conv.is_owned = false;
62726         NodeFeatures_set_payment_secret_optional(&this_arg_conv);
62727 }
62728
62729 void  CS_LDK_NodeFeatures_set_payment_secret_required(int64_t this_arg) {
62730         LDKNodeFeatures this_arg_conv;
62731         this_arg_conv.inner = untag_ptr(this_arg);
62732         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62733         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62734         this_arg_conv.is_owned = false;
62735         NodeFeatures_set_payment_secret_required(&this_arg_conv);
62736 }
62737
62738 jboolean  CS_LDK_NodeFeatures_supports_payment_secret(int64_t this_arg) {
62739         LDKNodeFeatures this_arg_conv;
62740         this_arg_conv.inner = untag_ptr(this_arg);
62741         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62742         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62743         this_arg_conv.is_owned = false;
62744         jboolean ret_conv = NodeFeatures_supports_payment_secret(&this_arg_conv);
62745         return ret_conv;
62746 }
62747
62748 void  CS_LDK_Bolt11InvoiceFeatures_set_payment_secret_optional(int64_t this_arg) {
62749         LDKBolt11InvoiceFeatures this_arg_conv;
62750         this_arg_conv.inner = untag_ptr(this_arg);
62751         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62752         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62753         this_arg_conv.is_owned = false;
62754         Bolt11InvoiceFeatures_set_payment_secret_optional(&this_arg_conv);
62755 }
62756
62757 void  CS_LDK_Bolt11InvoiceFeatures_set_payment_secret_required(int64_t this_arg) {
62758         LDKBolt11InvoiceFeatures this_arg_conv;
62759         this_arg_conv.inner = untag_ptr(this_arg);
62760         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62761         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62762         this_arg_conv.is_owned = false;
62763         Bolt11InvoiceFeatures_set_payment_secret_required(&this_arg_conv);
62764 }
62765
62766 jboolean  CS_LDK_Bolt11InvoiceFeatures_supports_payment_secret(int64_t this_arg) {
62767         LDKBolt11InvoiceFeatures this_arg_conv;
62768         this_arg_conv.inner = untag_ptr(this_arg);
62769         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62770         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62771         this_arg_conv.is_owned = false;
62772         jboolean ret_conv = Bolt11InvoiceFeatures_supports_payment_secret(&this_arg_conv);
62773         return ret_conv;
62774 }
62775
62776 jboolean  CS_LDK_InitFeatures_requires_payment_secret(int64_t this_arg) {
62777         LDKInitFeatures this_arg_conv;
62778         this_arg_conv.inner = untag_ptr(this_arg);
62779         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62780         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62781         this_arg_conv.is_owned = false;
62782         jboolean ret_conv = InitFeatures_requires_payment_secret(&this_arg_conv);
62783         return ret_conv;
62784 }
62785
62786 jboolean  CS_LDK_NodeFeatures_requires_payment_secret(int64_t this_arg) {
62787         LDKNodeFeatures this_arg_conv;
62788         this_arg_conv.inner = untag_ptr(this_arg);
62789         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62790         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62791         this_arg_conv.is_owned = false;
62792         jboolean ret_conv = NodeFeatures_requires_payment_secret(&this_arg_conv);
62793         return ret_conv;
62794 }
62795
62796 jboolean  CS_LDK_Bolt11InvoiceFeatures_requires_payment_secret(int64_t this_arg) {
62797         LDKBolt11InvoiceFeatures this_arg_conv;
62798         this_arg_conv.inner = untag_ptr(this_arg);
62799         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62800         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62801         this_arg_conv.is_owned = false;
62802         jboolean ret_conv = Bolt11InvoiceFeatures_requires_payment_secret(&this_arg_conv);
62803         return ret_conv;
62804 }
62805
62806 void  CS_LDK_InitFeatures_set_basic_mpp_optional(int64_t this_arg) {
62807         LDKInitFeatures this_arg_conv;
62808         this_arg_conv.inner = untag_ptr(this_arg);
62809         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62810         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62811         this_arg_conv.is_owned = false;
62812         InitFeatures_set_basic_mpp_optional(&this_arg_conv);
62813 }
62814
62815 void  CS_LDK_InitFeatures_set_basic_mpp_required(int64_t this_arg) {
62816         LDKInitFeatures this_arg_conv;
62817         this_arg_conv.inner = untag_ptr(this_arg);
62818         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62819         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62820         this_arg_conv.is_owned = false;
62821         InitFeatures_set_basic_mpp_required(&this_arg_conv);
62822 }
62823
62824 jboolean  CS_LDK_InitFeatures_supports_basic_mpp(int64_t this_arg) {
62825         LDKInitFeatures this_arg_conv;
62826         this_arg_conv.inner = untag_ptr(this_arg);
62827         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62828         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62829         this_arg_conv.is_owned = false;
62830         jboolean ret_conv = InitFeatures_supports_basic_mpp(&this_arg_conv);
62831         return ret_conv;
62832 }
62833
62834 void  CS_LDK_NodeFeatures_set_basic_mpp_optional(int64_t this_arg) {
62835         LDKNodeFeatures this_arg_conv;
62836         this_arg_conv.inner = untag_ptr(this_arg);
62837         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62838         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62839         this_arg_conv.is_owned = false;
62840         NodeFeatures_set_basic_mpp_optional(&this_arg_conv);
62841 }
62842
62843 void  CS_LDK_NodeFeatures_set_basic_mpp_required(int64_t this_arg) {
62844         LDKNodeFeatures this_arg_conv;
62845         this_arg_conv.inner = untag_ptr(this_arg);
62846         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62847         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62848         this_arg_conv.is_owned = false;
62849         NodeFeatures_set_basic_mpp_required(&this_arg_conv);
62850 }
62851
62852 jboolean  CS_LDK_NodeFeatures_supports_basic_mpp(int64_t this_arg) {
62853         LDKNodeFeatures this_arg_conv;
62854         this_arg_conv.inner = untag_ptr(this_arg);
62855         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62856         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62857         this_arg_conv.is_owned = false;
62858         jboolean ret_conv = NodeFeatures_supports_basic_mpp(&this_arg_conv);
62859         return ret_conv;
62860 }
62861
62862 void  CS_LDK_Bolt11InvoiceFeatures_set_basic_mpp_optional(int64_t this_arg) {
62863         LDKBolt11InvoiceFeatures this_arg_conv;
62864         this_arg_conv.inner = untag_ptr(this_arg);
62865         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62866         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62867         this_arg_conv.is_owned = false;
62868         Bolt11InvoiceFeatures_set_basic_mpp_optional(&this_arg_conv);
62869 }
62870
62871 void  CS_LDK_Bolt11InvoiceFeatures_set_basic_mpp_required(int64_t this_arg) {
62872         LDKBolt11InvoiceFeatures this_arg_conv;
62873         this_arg_conv.inner = untag_ptr(this_arg);
62874         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62875         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62876         this_arg_conv.is_owned = false;
62877         Bolt11InvoiceFeatures_set_basic_mpp_required(&this_arg_conv);
62878 }
62879
62880 jboolean  CS_LDK_Bolt11InvoiceFeatures_supports_basic_mpp(int64_t this_arg) {
62881         LDKBolt11InvoiceFeatures this_arg_conv;
62882         this_arg_conv.inner = untag_ptr(this_arg);
62883         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62884         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62885         this_arg_conv.is_owned = false;
62886         jboolean ret_conv = Bolt11InvoiceFeatures_supports_basic_mpp(&this_arg_conv);
62887         return ret_conv;
62888 }
62889
62890 void  CS_LDK_Bolt12InvoiceFeatures_set_basic_mpp_optional(int64_t this_arg) {
62891         LDKBolt12InvoiceFeatures this_arg_conv;
62892         this_arg_conv.inner = untag_ptr(this_arg);
62893         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62894         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62895         this_arg_conv.is_owned = false;
62896         Bolt12InvoiceFeatures_set_basic_mpp_optional(&this_arg_conv);
62897 }
62898
62899 void  CS_LDK_Bolt12InvoiceFeatures_set_basic_mpp_required(int64_t this_arg) {
62900         LDKBolt12InvoiceFeatures this_arg_conv;
62901         this_arg_conv.inner = untag_ptr(this_arg);
62902         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62903         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62904         this_arg_conv.is_owned = false;
62905         Bolt12InvoiceFeatures_set_basic_mpp_required(&this_arg_conv);
62906 }
62907
62908 jboolean  CS_LDK_Bolt12InvoiceFeatures_supports_basic_mpp(int64_t this_arg) {
62909         LDKBolt12InvoiceFeatures this_arg_conv;
62910         this_arg_conv.inner = untag_ptr(this_arg);
62911         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62912         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62913         this_arg_conv.is_owned = false;
62914         jboolean ret_conv = Bolt12InvoiceFeatures_supports_basic_mpp(&this_arg_conv);
62915         return ret_conv;
62916 }
62917
62918 jboolean  CS_LDK_InitFeatures_requires_basic_mpp(int64_t this_arg) {
62919         LDKInitFeatures this_arg_conv;
62920         this_arg_conv.inner = untag_ptr(this_arg);
62921         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62922         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62923         this_arg_conv.is_owned = false;
62924         jboolean ret_conv = InitFeatures_requires_basic_mpp(&this_arg_conv);
62925         return ret_conv;
62926 }
62927
62928 jboolean  CS_LDK_NodeFeatures_requires_basic_mpp(int64_t this_arg) {
62929         LDKNodeFeatures this_arg_conv;
62930         this_arg_conv.inner = untag_ptr(this_arg);
62931         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62932         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62933         this_arg_conv.is_owned = false;
62934         jboolean ret_conv = NodeFeatures_requires_basic_mpp(&this_arg_conv);
62935         return ret_conv;
62936 }
62937
62938 jboolean  CS_LDK_Bolt11InvoiceFeatures_requires_basic_mpp(int64_t this_arg) {
62939         LDKBolt11InvoiceFeatures this_arg_conv;
62940         this_arg_conv.inner = untag_ptr(this_arg);
62941         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62942         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62943         this_arg_conv.is_owned = false;
62944         jboolean ret_conv = Bolt11InvoiceFeatures_requires_basic_mpp(&this_arg_conv);
62945         return ret_conv;
62946 }
62947
62948 jboolean  CS_LDK_Bolt12InvoiceFeatures_requires_basic_mpp(int64_t this_arg) {
62949         LDKBolt12InvoiceFeatures this_arg_conv;
62950         this_arg_conv.inner = untag_ptr(this_arg);
62951         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62952         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62953         this_arg_conv.is_owned = false;
62954         jboolean ret_conv = Bolt12InvoiceFeatures_requires_basic_mpp(&this_arg_conv);
62955         return ret_conv;
62956 }
62957
62958 void  CS_LDK_InitFeatures_set_wumbo_optional(int64_t this_arg) {
62959         LDKInitFeatures this_arg_conv;
62960         this_arg_conv.inner = untag_ptr(this_arg);
62961         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62962         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62963         this_arg_conv.is_owned = false;
62964         InitFeatures_set_wumbo_optional(&this_arg_conv);
62965 }
62966
62967 void  CS_LDK_InitFeatures_set_wumbo_required(int64_t this_arg) {
62968         LDKInitFeatures this_arg_conv;
62969         this_arg_conv.inner = untag_ptr(this_arg);
62970         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62971         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62972         this_arg_conv.is_owned = false;
62973         InitFeatures_set_wumbo_required(&this_arg_conv);
62974 }
62975
62976 jboolean  CS_LDK_InitFeatures_supports_wumbo(int64_t this_arg) {
62977         LDKInitFeatures this_arg_conv;
62978         this_arg_conv.inner = untag_ptr(this_arg);
62979         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62980         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62981         this_arg_conv.is_owned = false;
62982         jboolean ret_conv = InitFeatures_supports_wumbo(&this_arg_conv);
62983         return ret_conv;
62984 }
62985
62986 void  CS_LDK_NodeFeatures_set_wumbo_optional(int64_t this_arg) {
62987         LDKNodeFeatures this_arg_conv;
62988         this_arg_conv.inner = untag_ptr(this_arg);
62989         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62990         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62991         this_arg_conv.is_owned = false;
62992         NodeFeatures_set_wumbo_optional(&this_arg_conv);
62993 }
62994
62995 void  CS_LDK_NodeFeatures_set_wumbo_required(int64_t this_arg) {
62996         LDKNodeFeatures this_arg_conv;
62997         this_arg_conv.inner = untag_ptr(this_arg);
62998         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62999         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63000         this_arg_conv.is_owned = false;
63001         NodeFeatures_set_wumbo_required(&this_arg_conv);
63002 }
63003
63004 jboolean  CS_LDK_NodeFeatures_supports_wumbo(int64_t this_arg) {
63005         LDKNodeFeatures this_arg_conv;
63006         this_arg_conv.inner = untag_ptr(this_arg);
63007         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63008         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63009         this_arg_conv.is_owned = false;
63010         jboolean ret_conv = NodeFeatures_supports_wumbo(&this_arg_conv);
63011         return ret_conv;
63012 }
63013
63014 jboolean  CS_LDK_InitFeatures_requires_wumbo(int64_t this_arg) {
63015         LDKInitFeatures this_arg_conv;
63016         this_arg_conv.inner = untag_ptr(this_arg);
63017         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63018         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63019         this_arg_conv.is_owned = false;
63020         jboolean ret_conv = InitFeatures_requires_wumbo(&this_arg_conv);
63021         return ret_conv;
63022 }
63023
63024 jboolean  CS_LDK_NodeFeatures_requires_wumbo(int64_t this_arg) {
63025         LDKNodeFeatures this_arg_conv;
63026         this_arg_conv.inner = untag_ptr(this_arg);
63027         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63028         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63029         this_arg_conv.is_owned = false;
63030         jboolean ret_conv = NodeFeatures_requires_wumbo(&this_arg_conv);
63031         return ret_conv;
63032 }
63033
63034 void  CS_LDK_InitFeatures_set_anchors_nonzero_fee_htlc_tx_optional(int64_t this_arg) {
63035         LDKInitFeatures this_arg_conv;
63036         this_arg_conv.inner = untag_ptr(this_arg);
63037         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63038         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63039         this_arg_conv.is_owned = false;
63040         InitFeatures_set_anchors_nonzero_fee_htlc_tx_optional(&this_arg_conv);
63041 }
63042
63043 void  CS_LDK_InitFeatures_set_anchors_nonzero_fee_htlc_tx_required(int64_t this_arg) {
63044         LDKInitFeatures this_arg_conv;
63045         this_arg_conv.inner = untag_ptr(this_arg);
63046         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63047         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63048         this_arg_conv.is_owned = false;
63049         InitFeatures_set_anchors_nonzero_fee_htlc_tx_required(&this_arg_conv);
63050 }
63051
63052 jboolean  CS_LDK_InitFeatures_supports_anchors_nonzero_fee_htlc_tx(int64_t this_arg) {
63053         LDKInitFeatures this_arg_conv;
63054         this_arg_conv.inner = untag_ptr(this_arg);
63055         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63056         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63057         this_arg_conv.is_owned = false;
63058         jboolean ret_conv = InitFeatures_supports_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
63059         return ret_conv;
63060 }
63061
63062 void  CS_LDK_NodeFeatures_set_anchors_nonzero_fee_htlc_tx_optional(int64_t this_arg) {
63063         LDKNodeFeatures this_arg_conv;
63064         this_arg_conv.inner = untag_ptr(this_arg);
63065         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63066         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63067         this_arg_conv.is_owned = false;
63068         NodeFeatures_set_anchors_nonzero_fee_htlc_tx_optional(&this_arg_conv);
63069 }
63070
63071 void  CS_LDK_NodeFeatures_set_anchors_nonzero_fee_htlc_tx_required(int64_t this_arg) {
63072         LDKNodeFeatures this_arg_conv;
63073         this_arg_conv.inner = untag_ptr(this_arg);
63074         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63075         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63076         this_arg_conv.is_owned = false;
63077         NodeFeatures_set_anchors_nonzero_fee_htlc_tx_required(&this_arg_conv);
63078 }
63079
63080 jboolean  CS_LDK_NodeFeatures_supports_anchors_nonzero_fee_htlc_tx(int64_t this_arg) {
63081         LDKNodeFeatures this_arg_conv;
63082         this_arg_conv.inner = untag_ptr(this_arg);
63083         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63084         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63085         this_arg_conv.is_owned = false;
63086         jboolean ret_conv = NodeFeatures_supports_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
63087         return ret_conv;
63088 }
63089
63090 void  CS_LDK_ChannelTypeFeatures_set_anchors_nonzero_fee_htlc_tx_optional(int64_t this_arg) {
63091         LDKChannelTypeFeatures this_arg_conv;
63092         this_arg_conv.inner = untag_ptr(this_arg);
63093         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63094         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63095         this_arg_conv.is_owned = false;
63096         ChannelTypeFeatures_set_anchors_nonzero_fee_htlc_tx_optional(&this_arg_conv);
63097 }
63098
63099 void  CS_LDK_ChannelTypeFeatures_set_anchors_nonzero_fee_htlc_tx_required(int64_t this_arg) {
63100         LDKChannelTypeFeatures this_arg_conv;
63101         this_arg_conv.inner = untag_ptr(this_arg);
63102         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63103         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63104         this_arg_conv.is_owned = false;
63105         ChannelTypeFeatures_set_anchors_nonzero_fee_htlc_tx_required(&this_arg_conv);
63106 }
63107
63108 jboolean  CS_LDK_ChannelTypeFeatures_supports_anchors_nonzero_fee_htlc_tx(int64_t this_arg) {
63109         LDKChannelTypeFeatures this_arg_conv;
63110         this_arg_conv.inner = untag_ptr(this_arg);
63111         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63112         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63113         this_arg_conv.is_owned = false;
63114         jboolean ret_conv = ChannelTypeFeatures_supports_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
63115         return ret_conv;
63116 }
63117
63118 jboolean  CS_LDK_InitFeatures_requires_anchors_nonzero_fee_htlc_tx(int64_t this_arg) {
63119         LDKInitFeatures this_arg_conv;
63120         this_arg_conv.inner = untag_ptr(this_arg);
63121         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63122         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63123         this_arg_conv.is_owned = false;
63124         jboolean ret_conv = InitFeatures_requires_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
63125         return ret_conv;
63126 }
63127
63128 jboolean  CS_LDK_NodeFeatures_requires_anchors_nonzero_fee_htlc_tx(int64_t this_arg) {
63129         LDKNodeFeatures this_arg_conv;
63130         this_arg_conv.inner = untag_ptr(this_arg);
63131         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63132         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63133         this_arg_conv.is_owned = false;
63134         jboolean ret_conv = NodeFeatures_requires_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
63135         return ret_conv;
63136 }
63137
63138 jboolean  CS_LDK_ChannelTypeFeatures_requires_anchors_nonzero_fee_htlc_tx(int64_t this_arg) {
63139         LDKChannelTypeFeatures this_arg_conv;
63140         this_arg_conv.inner = untag_ptr(this_arg);
63141         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63142         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63143         this_arg_conv.is_owned = false;
63144         jboolean ret_conv = ChannelTypeFeatures_requires_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
63145         return ret_conv;
63146 }
63147
63148 void  CS_LDK_InitFeatures_set_anchors_zero_fee_htlc_tx_optional(int64_t this_arg) {
63149         LDKInitFeatures this_arg_conv;
63150         this_arg_conv.inner = untag_ptr(this_arg);
63151         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63152         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63153         this_arg_conv.is_owned = false;
63154         InitFeatures_set_anchors_zero_fee_htlc_tx_optional(&this_arg_conv);
63155 }
63156
63157 void  CS_LDK_InitFeatures_set_anchors_zero_fee_htlc_tx_required(int64_t this_arg) {
63158         LDKInitFeatures this_arg_conv;
63159         this_arg_conv.inner = untag_ptr(this_arg);
63160         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63161         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63162         this_arg_conv.is_owned = false;
63163         InitFeatures_set_anchors_zero_fee_htlc_tx_required(&this_arg_conv);
63164 }
63165
63166 jboolean  CS_LDK_InitFeatures_supports_anchors_zero_fee_htlc_tx(int64_t this_arg) {
63167         LDKInitFeatures this_arg_conv;
63168         this_arg_conv.inner = untag_ptr(this_arg);
63169         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63170         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63171         this_arg_conv.is_owned = false;
63172         jboolean ret_conv = InitFeatures_supports_anchors_zero_fee_htlc_tx(&this_arg_conv);
63173         return ret_conv;
63174 }
63175
63176 void  CS_LDK_NodeFeatures_set_anchors_zero_fee_htlc_tx_optional(int64_t this_arg) {
63177         LDKNodeFeatures this_arg_conv;
63178         this_arg_conv.inner = untag_ptr(this_arg);
63179         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63180         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63181         this_arg_conv.is_owned = false;
63182         NodeFeatures_set_anchors_zero_fee_htlc_tx_optional(&this_arg_conv);
63183 }
63184
63185 void  CS_LDK_NodeFeatures_set_anchors_zero_fee_htlc_tx_required(int64_t this_arg) {
63186         LDKNodeFeatures this_arg_conv;
63187         this_arg_conv.inner = untag_ptr(this_arg);
63188         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63189         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63190         this_arg_conv.is_owned = false;
63191         NodeFeatures_set_anchors_zero_fee_htlc_tx_required(&this_arg_conv);
63192 }
63193
63194 jboolean  CS_LDK_NodeFeatures_supports_anchors_zero_fee_htlc_tx(int64_t this_arg) {
63195         LDKNodeFeatures this_arg_conv;
63196         this_arg_conv.inner = untag_ptr(this_arg);
63197         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63198         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63199         this_arg_conv.is_owned = false;
63200         jboolean ret_conv = NodeFeatures_supports_anchors_zero_fee_htlc_tx(&this_arg_conv);
63201         return ret_conv;
63202 }
63203
63204 void  CS_LDK_ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_optional(int64_t this_arg) {
63205         LDKChannelTypeFeatures this_arg_conv;
63206         this_arg_conv.inner = untag_ptr(this_arg);
63207         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63208         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63209         this_arg_conv.is_owned = false;
63210         ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_optional(&this_arg_conv);
63211 }
63212
63213 void  CS_LDK_ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_required(int64_t this_arg) {
63214         LDKChannelTypeFeatures this_arg_conv;
63215         this_arg_conv.inner = untag_ptr(this_arg);
63216         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63217         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63218         this_arg_conv.is_owned = false;
63219         ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_required(&this_arg_conv);
63220 }
63221
63222 jboolean  CS_LDK_ChannelTypeFeatures_supports_anchors_zero_fee_htlc_tx(int64_t this_arg) {
63223         LDKChannelTypeFeatures this_arg_conv;
63224         this_arg_conv.inner = untag_ptr(this_arg);
63225         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63226         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63227         this_arg_conv.is_owned = false;
63228         jboolean ret_conv = ChannelTypeFeatures_supports_anchors_zero_fee_htlc_tx(&this_arg_conv);
63229         return ret_conv;
63230 }
63231
63232 jboolean  CS_LDK_InitFeatures_requires_anchors_zero_fee_htlc_tx(int64_t this_arg) {
63233         LDKInitFeatures this_arg_conv;
63234         this_arg_conv.inner = untag_ptr(this_arg);
63235         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63236         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63237         this_arg_conv.is_owned = false;
63238         jboolean ret_conv = InitFeatures_requires_anchors_zero_fee_htlc_tx(&this_arg_conv);
63239         return ret_conv;
63240 }
63241
63242 jboolean  CS_LDK_NodeFeatures_requires_anchors_zero_fee_htlc_tx(int64_t this_arg) {
63243         LDKNodeFeatures this_arg_conv;
63244         this_arg_conv.inner = untag_ptr(this_arg);
63245         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63246         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63247         this_arg_conv.is_owned = false;
63248         jboolean ret_conv = NodeFeatures_requires_anchors_zero_fee_htlc_tx(&this_arg_conv);
63249         return ret_conv;
63250 }
63251
63252 jboolean  CS_LDK_ChannelTypeFeatures_requires_anchors_zero_fee_htlc_tx(int64_t this_arg) {
63253         LDKChannelTypeFeatures this_arg_conv;
63254         this_arg_conv.inner = untag_ptr(this_arg);
63255         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63256         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63257         this_arg_conv.is_owned = false;
63258         jboolean ret_conv = ChannelTypeFeatures_requires_anchors_zero_fee_htlc_tx(&this_arg_conv);
63259         return ret_conv;
63260 }
63261
63262 void  CS_LDK_InitFeatures_set_route_blinding_optional(int64_t this_arg) {
63263         LDKInitFeatures this_arg_conv;
63264         this_arg_conv.inner = untag_ptr(this_arg);
63265         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63266         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63267         this_arg_conv.is_owned = false;
63268         InitFeatures_set_route_blinding_optional(&this_arg_conv);
63269 }
63270
63271 void  CS_LDK_InitFeatures_set_route_blinding_required(int64_t this_arg) {
63272         LDKInitFeatures this_arg_conv;
63273         this_arg_conv.inner = untag_ptr(this_arg);
63274         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63275         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63276         this_arg_conv.is_owned = false;
63277         InitFeatures_set_route_blinding_required(&this_arg_conv);
63278 }
63279
63280 jboolean  CS_LDK_InitFeatures_supports_route_blinding(int64_t this_arg) {
63281         LDKInitFeatures this_arg_conv;
63282         this_arg_conv.inner = untag_ptr(this_arg);
63283         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63284         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63285         this_arg_conv.is_owned = false;
63286         jboolean ret_conv = InitFeatures_supports_route_blinding(&this_arg_conv);
63287         return ret_conv;
63288 }
63289
63290 void  CS_LDK_NodeFeatures_set_route_blinding_optional(int64_t this_arg) {
63291         LDKNodeFeatures this_arg_conv;
63292         this_arg_conv.inner = untag_ptr(this_arg);
63293         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63294         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63295         this_arg_conv.is_owned = false;
63296         NodeFeatures_set_route_blinding_optional(&this_arg_conv);
63297 }
63298
63299 void  CS_LDK_NodeFeatures_set_route_blinding_required(int64_t this_arg) {
63300         LDKNodeFeatures this_arg_conv;
63301         this_arg_conv.inner = untag_ptr(this_arg);
63302         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63303         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63304         this_arg_conv.is_owned = false;
63305         NodeFeatures_set_route_blinding_required(&this_arg_conv);
63306 }
63307
63308 jboolean  CS_LDK_NodeFeatures_supports_route_blinding(int64_t this_arg) {
63309         LDKNodeFeatures this_arg_conv;
63310         this_arg_conv.inner = untag_ptr(this_arg);
63311         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63312         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63313         this_arg_conv.is_owned = false;
63314         jboolean ret_conv = NodeFeatures_supports_route_blinding(&this_arg_conv);
63315         return ret_conv;
63316 }
63317
63318 jboolean  CS_LDK_InitFeatures_requires_route_blinding(int64_t this_arg) {
63319         LDKInitFeatures this_arg_conv;
63320         this_arg_conv.inner = untag_ptr(this_arg);
63321         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63322         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63323         this_arg_conv.is_owned = false;
63324         jboolean ret_conv = InitFeatures_requires_route_blinding(&this_arg_conv);
63325         return ret_conv;
63326 }
63327
63328 jboolean  CS_LDK_NodeFeatures_requires_route_blinding(int64_t this_arg) {
63329         LDKNodeFeatures this_arg_conv;
63330         this_arg_conv.inner = untag_ptr(this_arg);
63331         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63332         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63333         this_arg_conv.is_owned = false;
63334         jboolean ret_conv = NodeFeatures_requires_route_blinding(&this_arg_conv);
63335         return ret_conv;
63336 }
63337
63338 void  CS_LDK_InitFeatures_set_shutdown_any_segwit_optional(int64_t this_arg) {
63339         LDKInitFeatures this_arg_conv;
63340         this_arg_conv.inner = untag_ptr(this_arg);
63341         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63342         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63343         this_arg_conv.is_owned = false;
63344         InitFeatures_set_shutdown_any_segwit_optional(&this_arg_conv);
63345 }
63346
63347 void  CS_LDK_InitFeatures_set_shutdown_any_segwit_required(int64_t this_arg) {
63348         LDKInitFeatures this_arg_conv;
63349         this_arg_conv.inner = untag_ptr(this_arg);
63350         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63351         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63352         this_arg_conv.is_owned = false;
63353         InitFeatures_set_shutdown_any_segwit_required(&this_arg_conv);
63354 }
63355
63356 jboolean  CS_LDK_InitFeatures_supports_shutdown_anysegwit(int64_t this_arg) {
63357         LDKInitFeatures this_arg_conv;
63358         this_arg_conv.inner = untag_ptr(this_arg);
63359         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63360         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63361         this_arg_conv.is_owned = false;
63362         jboolean ret_conv = InitFeatures_supports_shutdown_anysegwit(&this_arg_conv);
63363         return ret_conv;
63364 }
63365
63366 void  CS_LDK_NodeFeatures_set_shutdown_any_segwit_optional(int64_t this_arg) {
63367         LDKNodeFeatures this_arg_conv;
63368         this_arg_conv.inner = untag_ptr(this_arg);
63369         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63370         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63371         this_arg_conv.is_owned = false;
63372         NodeFeatures_set_shutdown_any_segwit_optional(&this_arg_conv);
63373 }
63374
63375 void  CS_LDK_NodeFeatures_set_shutdown_any_segwit_required(int64_t this_arg) {
63376         LDKNodeFeatures this_arg_conv;
63377         this_arg_conv.inner = untag_ptr(this_arg);
63378         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63379         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63380         this_arg_conv.is_owned = false;
63381         NodeFeatures_set_shutdown_any_segwit_required(&this_arg_conv);
63382 }
63383
63384 jboolean  CS_LDK_NodeFeatures_supports_shutdown_anysegwit(int64_t this_arg) {
63385         LDKNodeFeatures this_arg_conv;
63386         this_arg_conv.inner = untag_ptr(this_arg);
63387         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63388         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63389         this_arg_conv.is_owned = false;
63390         jboolean ret_conv = NodeFeatures_supports_shutdown_anysegwit(&this_arg_conv);
63391         return ret_conv;
63392 }
63393
63394 jboolean  CS_LDK_InitFeatures_requires_shutdown_anysegwit(int64_t this_arg) {
63395         LDKInitFeatures this_arg_conv;
63396         this_arg_conv.inner = untag_ptr(this_arg);
63397         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63398         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63399         this_arg_conv.is_owned = false;
63400         jboolean ret_conv = InitFeatures_requires_shutdown_anysegwit(&this_arg_conv);
63401         return ret_conv;
63402 }
63403
63404 jboolean  CS_LDK_NodeFeatures_requires_shutdown_anysegwit(int64_t this_arg) {
63405         LDKNodeFeatures this_arg_conv;
63406         this_arg_conv.inner = untag_ptr(this_arg);
63407         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63408         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63409         this_arg_conv.is_owned = false;
63410         jboolean ret_conv = NodeFeatures_requires_shutdown_anysegwit(&this_arg_conv);
63411         return ret_conv;
63412 }
63413
63414 void  CS_LDK_InitFeatures_set_taproot_optional(int64_t this_arg) {
63415         LDKInitFeatures this_arg_conv;
63416         this_arg_conv.inner = untag_ptr(this_arg);
63417         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63418         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63419         this_arg_conv.is_owned = false;
63420         InitFeatures_set_taproot_optional(&this_arg_conv);
63421 }
63422
63423 void  CS_LDK_InitFeatures_set_taproot_required(int64_t this_arg) {
63424         LDKInitFeatures this_arg_conv;
63425         this_arg_conv.inner = untag_ptr(this_arg);
63426         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63427         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63428         this_arg_conv.is_owned = false;
63429         InitFeatures_set_taproot_required(&this_arg_conv);
63430 }
63431
63432 jboolean  CS_LDK_InitFeatures_supports_taproot(int64_t this_arg) {
63433         LDKInitFeatures this_arg_conv;
63434         this_arg_conv.inner = untag_ptr(this_arg);
63435         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63436         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63437         this_arg_conv.is_owned = false;
63438         jboolean ret_conv = InitFeatures_supports_taproot(&this_arg_conv);
63439         return ret_conv;
63440 }
63441
63442 void  CS_LDK_NodeFeatures_set_taproot_optional(int64_t this_arg) {
63443         LDKNodeFeatures this_arg_conv;
63444         this_arg_conv.inner = untag_ptr(this_arg);
63445         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63446         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63447         this_arg_conv.is_owned = false;
63448         NodeFeatures_set_taproot_optional(&this_arg_conv);
63449 }
63450
63451 void  CS_LDK_NodeFeatures_set_taproot_required(int64_t this_arg) {
63452         LDKNodeFeatures this_arg_conv;
63453         this_arg_conv.inner = untag_ptr(this_arg);
63454         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63455         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63456         this_arg_conv.is_owned = false;
63457         NodeFeatures_set_taproot_required(&this_arg_conv);
63458 }
63459
63460 jboolean  CS_LDK_NodeFeatures_supports_taproot(int64_t this_arg) {
63461         LDKNodeFeatures this_arg_conv;
63462         this_arg_conv.inner = untag_ptr(this_arg);
63463         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63464         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63465         this_arg_conv.is_owned = false;
63466         jboolean ret_conv = NodeFeatures_supports_taproot(&this_arg_conv);
63467         return ret_conv;
63468 }
63469
63470 void  CS_LDK_ChannelTypeFeatures_set_taproot_optional(int64_t this_arg) {
63471         LDKChannelTypeFeatures this_arg_conv;
63472         this_arg_conv.inner = untag_ptr(this_arg);
63473         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63474         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63475         this_arg_conv.is_owned = false;
63476         ChannelTypeFeatures_set_taproot_optional(&this_arg_conv);
63477 }
63478
63479 void  CS_LDK_ChannelTypeFeatures_set_taproot_required(int64_t this_arg) {
63480         LDKChannelTypeFeatures this_arg_conv;
63481         this_arg_conv.inner = untag_ptr(this_arg);
63482         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63483         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63484         this_arg_conv.is_owned = false;
63485         ChannelTypeFeatures_set_taproot_required(&this_arg_conv);
63486 }
63487
63488 jboolean  CS_LDK_ChannelTypeFeatures_supports_taproot(int64_t this_arg) {
63489         LDKChannelTypeFeatures this_arg_conv;
63490         this_arg_conv.inner = untag_ptr(this_arg);
63491         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63492         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63493         this_arg_conv.is_owned = false;
63494         jboolean ret_conv = ChannelTypeFeatures_supports_taproot(&this_arg_conv);
63495         return ret_conv;
63496 }
63497
63498 jboolean  CS_LDK_InitFeatures_requires_taproot(int64_t this_arg) {
63499         LDKInitFeatures this_arg_conv;
63500         this_arg_conv.inner = untag_ptr(this_arg);
63501         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63502         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63503         this_arg_conv.is_owned = false;
63504         jboolean ret_conv = InitFeatures_requires_taproot(&this_arg_conv);
63505         return ret_conv;
63506 }
63507
63508 jboolean  CS_LDK_NodeFeatures_requires_taproot(int64_t this_arg) {
63509         LDKNodeFeatures this_arg_conv;
63510         this_arg_conv.inner = untag_ptr(this_arg);
63511         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63512         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63513         this_arg_conv.is_owned = false;
63514         jboolean ret_conv = NodeFeatures_requires_taproot(&this_arg_conv);
63515         return ret_conv;
63516 }
63517
63518 jboolean  CS_LDK_ChannelTypeFeatures_requires_taproot(int64_t this_arg) {
63519         LDKChannelTypeFeatures this_arg_conv;
63520         this_arg_conv.inner = untag_ptr(this_arg);
63521         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63522         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63523         this_arg_conv.is_owned = false;
63524         jboolean ret_conv = ChannelTypeFeatures_requires_taproot(&this_arg_conv);
63525         return ret_conv;
63526 }
63527
63528 void  CS_LDK_InitFeatures_set_onion_messages_optional(int64_t this_arg) {
63529         LDKInitFeatures this_arg_conv;
63530         this_arg_conv.inner = untag_ptr(this_arg);
63531         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63532         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63533         this_arg_conv.is_owned = false;
63534         InitFeatures_set_onion_messages_optional(&this_arg_conv);
63535 }
63536
63537 void  CS_LDK_InitFeatures_set_onion_messages_required(int64_t this_arg) {
63538         LDKInitFeatures 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         InitFeatures_set_onion_messages_required(&this_arg_conv);
63544 }
63545
63546 jboolean  CS_LDK_InitFeatures_supports_onion_messages(int64_t this_arg) {
63547         LDKInitFeatures this_arg_conv;
63548         this_arg_conv.inner = untag_ptr(this_arg);
63549         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63550         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63551         this_arg_conv.is_owned = false;
63552         jboolean ret_conv = InitFeatures_supports_onion_messages(&this_arg_conv);
63553         return ret_conv;
63554 }
63555
63556 void  CS_LDK_NodeFeatures_set_onion_messages_optional(int64_t this_arg) {
63557         LDKNodeFeatures this_arg_conv;
63558         this_arg_conv.inner = untag_ptr(this_arg);
63559         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63560         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63561         this_arg_conv.is_owned = false;
63562         NodeFeatures_set_onion_messages_optional(&this_arg_conv);
63563 }
63564
63565 void  CS_LDK_NodeFeatures_set_onion_messages_required(int64_t this_arg) {
63566         LDKNodeFeatures this_arg_conv;
63567         this_arg_conv.inner = untag_ptr(this_arg);
63568         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63569         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63570         this_arg_conv.is_owned = false;
63571         NodeFeatures_set_onion_messages_required(&this_arg_conv);
63572 }
63573
63574 jboolean  CS_LDK_NodeFeatures_supports_onion_messages(int64_t this_arg) {
63575         LDKNodeFeatures this_arg_conv;
63576         this_arg_conv.inner = untag_ptr(this_arg);
63577         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63578         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63579         this_arg_conv.is_owned = false;
63580         jboolean ret_conv = NodeFeatures_supports_onion_messages(&this_arg_conv);
63581         return ret_conv;
63582 }
63583
63584 jboolean  CS_LDK_InitFeatures_requires_onion_messages(int64_t this_arg) {
63585         LDKInitFeatures this_arg_conv;
63586         this_arg_conv.inner = untag_ptr(this_arg);
63587         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63588         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63589         this_arg_conv.is_owned = false;
63590         jboolean ret_conv = InitFeatures_requires_onion_messages(&this_arg_conv);
63591         return ret_conv;
63592 }
63593
63594 jboolean  CS_LDK_NodeFeatures_requires_onion_messages(int64_t this_arg) {
63595         LDKNodeFeatures this_arg_conv;
63596         this_arg_conv.inner = untag_ptr(this_arg);
63597         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63598         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63599         this_arg_conv.is_owned = false;
63600         jboolean ret_conv = NodeFeatures_requires_onion_messages(&this_arg_conv);
63601         return ret_conv;
63602 }
63603
63604 void  CS_LDK_InitFeatures_set_channel_type_optional(int64_t this_arg) {
63605         LDKInitFeatures this_arg_conv;
63606         this_arg_conv.inner = untag_ptr(this_arg);
63607         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63608         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63609         this_arg_conv.is_owned = false;
63610         InitFeatures_set_channel_type_optional(&this_arg_conv);
63611 }
63612
63613 void  CS_LDK_InitFeatures_set_channel_type_required(int64_t this_arg) {
63614         LDKInitFeatures this_arg_conv;
63615         this_arg_conv.inner = untag_ptr(this_arg);
63616         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63617         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63618         this_arg_conv.is_owned = false;
63619         InitFeatures_set_channel_type_required(&this_arg_conv);
63620 }
63621
63622 jboolean  CS_LDK_InitFeatures_supports_channel_type(int64_t this_arg) {
63623         LDKInitFeatures this_arg_conv;
63624         this_arg_conv.inner = untag_ptr(this_arg);
63625         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63626         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63627         this_arg_conv.is_owned = false;
63628         jboolean ret_conv = InitFeatures_supports_channel_type(&this_arg_conv);
63629         return ret_conv;
63630 }
63631
63632 void  CS_LDK_NodeFeatures_set_channel_type_optional(int64_t this_arg) {
63633         LDKNodeFeatures this_arg_conv;
63634         this_arg_conv.inner = untag_ptr(this_arg);
63635         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63636         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63637         this_arg_conv.is_owned = false;
63638         NodeFeatures_set_channel_type_optional(&this_arg_conv);
63639 }
63640
63641 void  CS_LDK_NodeFeatures_set_channel_type_required(int64_t this_arg) {
63642         LDKNodeFeatures this_arg_conv;
63643         this_arg_conv.inner = untag_ptr(this_arg);
63644         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63645         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63646         this_arg_conv.is_owned = false;
63647         NodeFeatures_set_channel_type_required(&this_arg_conv);
63648 }
63649
63650 jboolean  CS_LDK_NodeFeatures_supports_channel_type(int64_t this_arg) {
63651         LDKNodeFeatures this_arg_conv;
63652         this_arg_conv.inner = untag_ptr(this_arg);
63653         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63654         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63655         this_arg_conv.is_owned = false;
63656         jboolean ret_conv = NodeFeatures_supports_channel_type(&this_arg_conv);
63657         return ret_conv;
63658 }
63659
63660 jboolean  CS_LDK_InitFeatures_requires_channel_type(int64_t this_arg) {
63661         LDKInitFeatures this_arg_conv;
63662         this_arg_conv.inner = untag_ptr(this_arg);
63663         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63664         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63665         this_arg_conv.is_owned = false;
63666         jboolean ret_conv = InitFeatures_requires_channel_type(&this_arg_conv);
63667         return ret_conv;
63668 }
63669
63670 jboolean  CS_LDK_NodeFeatures_requires_channel_type(int64_t this_arg) {
63671         LDKNodeFeatures this_arg_conv;
63672         this_arg_conv.inner = untag_ptr(this_arg);
63673         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63674         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63675         this_arg_conv.is_owned = false;
63676         jboolean ret_conv = NodeFeatures_requires_channel_type(&this_arg_conv);
63677         return ret_conv;
63678 }
63679
63680 void  CS_LDK_InitFeatures_set_scid_privacy_optional(int64_t this_arg) {
63681         LDKInitFeatures this_arg_conv;
63682         this_arg_conv.inner = untag_ptr(this_arg);
63683         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63684         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63685         this_arg_conv.is_owned = false;
63686         InitFeatures_set_scid_privacy_optional(&this_arg_conv);
63687 }
63688
63689 void  CS_LDK_InitFeatures_set_scid_privacy_required(int64_t this_arg) {
63690         LDKInitFeatures this_arg_conv;
63691         this_arg_conv.inner = untag_ptr(this_arg);
63692         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63693         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63694         this_arg_conv.is_owned = false;
63695         InitFeatures_set_scid_privacy_required(&this_arg_conv);
63696 }
63697
63698 jboolean  CS_LDK_InitFeatures_supports_scid_privacy(int64_t this_arg) {
63699         LDKInitFeatures this_arg_conv;
63700         this_arg_conv.inner = untag_ptr(this_arg);
63701         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63702         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63703         this_arg_conv.is_owned = false;
63704         jboolean ret_conv = InitFeatures_supports_scid_privacy(&this_arg_conv);
63705         return ret_conv;
63706 }
63707
63708 void  CS_LDK_NodeFeatures_set_scid_privacy_optional(int64_t this_arg) {
63709         LDKNodeFeatures this_arg_conv;
63710         this_arg_conv.inner = untag_ptr(this_arg);
63711         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63712         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63713         this_arg_conv.is_owned = false;
63714         NodeFeatures_set_scid_privacy_optional(&this_arg_conv);
63715 }
63716
63717 void  CS_LDK_NodeFeatures_set_scid_privacy_required(int64_t this_arg) {
63718         LDKNodeFeatures this_arg_conv;
63719         this_arg_conv.inner = untag_ptr(this_arg);
63720         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63721         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63722         this_arg_conv.is_owned = false;
63723         NodeFeatures_set_scid_privacy_required(&this_arg_conv);
63724 }
63725
63726 jboolean  CS_LDK_NodeFeatures_supports_scid_privacy(int64_t this_arg) {
63727         LDKNodeFeatures this_arg_conv;
63728         this_arg_conv.inner = untag_ptr(this_arg);
63729         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63730         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63731         this_arg_conv.is_owned = false;
63732         jboolean ret_conv = NodeFeatures_supports_scid_privacy(&this_arg_conv);
63733         return ret_conv;
63734 }
63735
63736 void  CS_LDK_ChannelTypeFeatures_set_scid_privacy_optional(int64_t this_arg) {
63737         LDKChannelTypeFeatures this_arg_conv;
63738         this_arg_conv.inner = untag_ptr(this_arg);
63739         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63740         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63741         this_arg_conv.is_owned = false;
63742         ChannelTypeFeatures_set_scid_privacy_optional(&this_arg_conv);
63743 }
63744
63745 void  CS_LDK_ChannelTypeFeatures_set_scid_privacy_required(int64_t this_arg) {
63746         LDKChannelTypeFeatures this_arg_conv;
63747         this_arg_conv.inner = untag_ptr(this_arg);
63748         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63749         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63750         this_arg_conv.is_owned = false;
63751         ChannelTypeFeatures_set_scid_privacy_required(&this_arg_conv);
63752 }
63753
63754 jboolean  CS_LDK_ChannelTypeFeatures_supports_scid_privacy(int64_t this_arg) {
63755         LDKChannelTypeFeatures this_arg_conv;
63756         this_arg_conv.inner = untag_ptr(this_arg);
63757         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63758         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63759         this_arg_conv.is_owned = false;
63760         jboolean ret_conv = ChannelTypeFeatures_supports_scid_privacy(&this_arg_conv);
63761         return ret_conv;
63762 }
63763
63764 jboolean  CS_LDK_InitFeatures_requires_scid_privacy(int64_t this_arg) {
63765         LDKInitFeatures this_arg_conv;
63766         this_arg_conv.inner = untag_ptr(this_arg);
63767         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63768         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63769         this_arg_conv.is_owned = false;
63770         jboolean ret_conv = InitFeatures_requires_scid_privacy(&this_arg_conv);
63771         return ret_conv;
63772 }
63773
63774 jboolean  CS_LDK_NodeFeatures_requires_scid_privacy(int64_t this_arg) {
63775         LDKNodeFeatures this_arg_conv;
63776         this_arg_conv.inner = untag_ptr(this_arg);
63777         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63778         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63779         this_arg_conv.is_owned = false;
63780         jboolean ret_conv = NodeFeatures_requires_scid_privacy(&this_arg_conv);
63781         return ret_conv;
63782 }
63783
63784 jboolean  CS_LDK_ChannelTypeFeatures_requires_scid_privacy(int64_t this_arg) {
63785         LDKChannelTypeFeatures this_arg_conv;
63786         this_arg_conv.inner = untag_ptr(this_arg);
63787         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63788         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63789         this_arg_conv.is_owned = false;
63790         jboolean ret_conv = ChannelTypeFeatures_requires_scid_privacy(&this_arg_conv);
63791         return ret_conv;
63792 }
63793
63794 void  CS_LDK_Bolt11InvoiceFeatures_set_payment_metadata_optional(int64_t this_arg) {
63795         LDKBolt11InvoiceFeatures this_arg_conv;
63796         this_arg_conv.inner = untag_ptr(this_arg);
63797         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63798         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63799         this_arg_conv.is_owned = false;
63800         Bolt11InvoiceFeatures_set_payment_metadata_optional(&this_arg_conv);
63801 }
63802
63803 void  CS_LDK_Bolt11InvoiceFeatures_set_payment_metadata_required(int64_t this_arg) {
63804         LDKBolt11InvoiceFeatures this_arg_conv;
63805         this_arg_conv.inner = untag_ptr(this_arg);
63806         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63807         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63808         this_arg_conv.is_owned = false;
63809         Bolt11InvoiceFeatures_set_payment_metadata_required(&this_arg_conv);
63810 }
63811
63812 jboolean  CS_LDK_Bolt11InvoiceFeatures_supports_payment_metadata(int64_t this_arg) {
63813         LDKBolt11InvoiceFeatures this_arg_conv;
63814         this_arg_conv.inner = untag_ptr(this_arg);
63815         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63816         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63817         this_arg_conv.is_owned = false;
63818         jboolean ret_conv = Bolt11InvoiceFeatures_supports_payment_metadata(&this_arg_conv);
63819         return ret_conv;
63820 }
63821
63822 jboolean  CS_LDK_Bolt11InvoiceFeatures_requires_payment_metadata(int64_t this_arg) {
63823         LDKBolt11InvoiceFeatures this_arg_conv;
63824         this_arg_conv.inner = untag_ptr(this_arg);
63825         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63826         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63827         this_arg_conv.is_owned = false;
63828         jboolean ret_conv = Bolt11InvoiceFeatures_requires_payment_metadata(&this_arg_conv);
63829         return ret_conv;
63830 }
63831
63832 void  CS_LDK_InitFeatures_set_zero_conf_optional(int64_t this_arg) {
63833         LDKInitFeatures this_arg_conv;
63834         this_arg_conv.inner = untag_ptr(this_arg);
63835         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63836         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63837         this_arg_conv.is_owned = false;
63838         InitFeatures_set_zero_conf_optional(&this_arg_conv);
63839 }
63840
63841 void  CS_LDK_InitFeatures_set_zero_conf_required(int64_t this_arg) {
63842         LDKInitFeatures this_arg_conv;
63843         this_arg_conv.inner = untag_ptr(this_arg);
63844         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63845         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63846         this_arg_conv.is_owned = false;
63847         InitFeatures_set_zero_conf_required(&this_arg_conv);
63848 }
63849
63850 jboolean  CS_LDK_InitFeatures_supports_zero_conf(int64_t this_arg) {
63851         LDKInitFeatures this_arg_conv;
63852         this_arg_conv.inner = untag_ptr(this_arg);
63853         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63854         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63855         this_arg_conv.is_owned = false;
63856         jboolean ret_conv = InitFeatures_supports_zero_conf(&this_arg_conv);
63857         return ret_conv;
63858 }
63859
63860 void  CS_LDK_NodeFeatures_set_zero_conf_optional(int64_t this_arg) {
63861         LDKNodeFeatures this_arg_conv;
63862         this_arg_conv.inner = untag_ptr(this_arg);
63863         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63864         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63865         this_arg_conv.is_owned = false;
63866         NodeFeatures_set_zero_conf_optional(&this_arg_conv);
63867 }
63868
63869 void  CS_LDK_NodeFeatures_set_zero_conf_required(int64_t this_arg) {
63870         LDKNodeFeatures this_arg_conv;
63871         this_arg_conv.inner = untag_ptr(this_arg);
63872         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63873         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63874         this_arg_conv.is_owned = false;
63875         NodeFeatures_set_zero_conf_required(&this_arg_conv);
63876 }
63877
63878 jboolean  CS_LDK_NodeFeatures_supports_zero_conf(int64_t this_arg) {
63879         LDKNodeFeatures this_arg_conv;
63880         this_arg_conv.inner = untag_ptr(this_arg);
63881         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63882         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63883         this_arg_conv.is_owned = false;
63884         jboolean ret_conv = NodeFeatures_supports_zero_conf(&this_arg_conv);
63885         return ret_conv;
63886 }
63887
63888 void  CS_LDK_ChannelTypeFeatures_set_zero_conf_optional(int64_t this_arg) {
63889         LDKChannelTypeFeatures this_arg_conv;
63890         this_arg_conv.inner = untag_ptr(this_arg);
63891         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63892         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63893         this_arg_conv.is_owned = false;
63894         ChannelTypeFeatures_set_zero_conf_optional(&this_arg_conv);
63895 }
63896
63897 void  CS_LDK_ChannelTypeFeatures_set_zero_conf_required(int64_t this_arg) {
63898         LDKChannelTypeFeatures this_arg_conv;
63899         this_arg_conv.inner = untag_ptr(this_arg);
63900         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63901         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63902         this_arg_conv.is_owned = false;
63903         ChannelTypeFeatures_set_zero_conf_required(&this_arg_conv);
63904 }
63905
63906 jboolean  CS_LDK_ChannelTypeFeatures_supports_zero_conf(int64_t this_arg) {
63907         LDKChannelTypeFeatures this_arg_conv;
63908         this_arg_conv.inner = untag_ptr(this_arg);
63909         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63910         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63911         this_arg_conv.is_owned = false;
63912         jboolean ret_conv = ChannelTypeFeatures_supports_zero_conf(&this_arg_conv);
63913         return ret_conv;
63914 }
63915
63916 jboolean  CS_LDK_InitFeatures_requires_zero_conf(int64_t this_arg) {
63917         LDKInitFeatures this_arg_conv;
63918         this_arg_conv.inner = untag_ptr(this_arg);
63919         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63920         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63921         this_arg_conv.is_owned = false;
63922         jboolean ret_conv = InitFeatures_requires_zero_conf(&this_arg_conv);
63923         return ret_conv;
63924 }
63925
63926 jboolean  CS_LDK_NodeFeatures_requires_zero_conf(int64_t this_arg) {
63927         LDKNodeFeatures this_arg_conv;
63928         this_arg_conv.inner = untag_ptr(this_arg);
63929         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63930         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63931         this_arg_conv.is_owned = false;
63932         jboolean ret_conv = NodeFeatures_requires_zero_conf(&this_arg_conv);
63933         return ret_conv;
63934 }
63935
63936 jboolean  CS_LDK_ChannelTypeFeatures_requires_zero_conf(int64_t this_arg) {
63937         LDKChannelTypeFeatures this_arg_conv;
63938         this_arg_conv.inner = untag_ptr(this_arg);
63939         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63940         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63941         this_arg_conv.is_owned = false;
63942         jboolean ret_conv = ChannelTypeFeatures_requires_zero_conf(&this_arg_conv);
63943         return ret_conv;
63944 }
63945
63946 void  CS_LDK_NodeFeatures_set_keysend_optional(int64_t this_arg) {
63947         LDKNodeFeatures this_arg_conv;
63948         this_arg_conv.inner = untag_ptr(this_arg);
63949         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63950         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63951         this_arg_conv.is_owned = false;
63952         NodeFeatures_set_keysend_optional(&this_arg_conv);
63953 }
63954
63955 void  CS_LDK_NodeFeatures_set_keysend_required(int64_t this_arg) {
63956         LDKNodeFeatures this_arg_conv;
63957         this_arg_conv.inner = untag_ptr(this_arg);
63958         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63959         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63960         this_arg_conv.is_owned = false;
63961         NodeFeatures_set_keysend_required(&this_arg_conv);
63962 }
63963
63964 jboolean  CS_LDK_NodeFeatures_supports_keysend(int64_t this_arg) {
63965         LDKNodeFeatures this_arg_conv;
63966         this_arg_conv.inner = untag_ptr(this_arg);
63967         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63968         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63969         this_arg_conv.is_owned = false;
63970         jboolean ret_conv = NodeFeatures_supports_keysend(&this_arg_conv);
63971         return ret_conv;
63972 }
63973
63974 jboolean  CS_LDK_NodeFeatures_requires_keysend(int64_t this_arg) {
63975         LDKNodeFeatures this_arg_conv;
63976         this_arg_conv.inner = untag_ptr(this_arg);
63977         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63978         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63979         this_arg_conv.is_owned = false;
63980         jboolean ret_conv = NodeFeatures_requires_keysend(&this_arg_conv);
63981         return ret_conv;
63982 }
63983
63984 void  CS_LDK_InitFeatures_set_trampoline_routing_optional(int64_t this_arg) {
63985         LDKInitFeatures this_arg_conv;
63986         this_arg_conv.inner = untag_ptr(this_arg);
63987         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63988         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63989         this_arg_conv.is_owned = false;
63990         InitFeatures_set_trampoline_routing_optional(&this_arg_conv);
63991 }
63992
63993 void  CS_LDK_InitFeatures_set_trampoline_routing_required(int64_t this_arg) {
63994         LDKInitFeatures this_arg_conv;
63995         this_arg_conv.inner = untag_ptr(this_arg);
63996         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63997         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63998         this_arg_conv.is_owned = false;
63999         InitFeatures_set_trampoline_routing_required(&this_arg_conv);
64000 }
64001
64002 jboolean  CS_LDK_InitFeatures_supports_trampoline_routing(int64_t this_arg) {
64003         LDKInitFeatures this_arg_conv;
64004         this_arg_conv.inner = untag_ptr(this_arg);
64005         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64006         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64007         this_arg_conv.is_owned = false;
64008         jboolean ret_conv = InitFeatures_supports_trampoline_routing(&this_arg_conv);
64009         return ret_conv;
64010 }
64011
64012 void  CS_LDK_NodeFeatures_set_trampoline_routing_optional(int64_t this_arg) {
64013         LDKNodeFeatures this_arg_conv;
64014         this_arg_conv.inner = untag_ptr(this_arg);
64015         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64016         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64017         this_arg_conv.is_owned = false;
64018         NodeFeatures_set_trampoline_routing_optional(&this_arg_conv);
64019 }
64020
64021 void  CS_LDK_NodeFeatures_set_trampoline_routing_required(int64_t this_arg) {
64022         LDKNodeFeatures this_arg_conv;
64023         this_arg_conv.inner = untag_ptr(this_arg);
64024         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64025         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64026         this_arg_conv.is_owned = false;
64027         NodeFeatures_set_trampoline_routing_required(&this_arg_conv);
64028 }
64029
64030 jboolean  CS_LDK_NodeFeatures_supports_trampoline_routing(int64_t this_arg) {
64031         LDKNodeFeatures this_arg_conv;
64032         this_arg_conv.inner = untag_ptr(this_arg);
64033         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64034         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64035         this_arg_conv.is_owned = false;
64036         jboolean ret_conv = NodeFeatures_supports_trampoline_routing(&this_arg_conv);
64037         return ret_conv;
64038 }
64039
64040 void  CS_LDK_Bolt11InvoiceFeatures_set_trampoline_routing_optional(int64_t this_arg) {
64041         LDKBolt11InvoiceFeatures this_arg_conv;
64042         this_arg_conv.inner = untag_ptr(this_arg);
64043         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64044         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64045         this_arg_conv.is_owned = false;
64046         Bolt11InvoiceFeatures_set_trampoline_routing_optional(&this_arg_conv);
64047 }
64048
64049 void  CS_LDK_Bolt11InvoiceFeatures_set_trampoline_routing_required(int64_t this_arg) {
64050         LDKBolt11InvoiceFeatures this_arg_conv;
64051         this_arg_conv.inner = untag_ptr(this_arg);
64052         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64053         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64054         this_arg_conv.is_owned = false;
64055         Bolt11InvoiceFeatures_set_trampoline_routing_required(&this_arg_conv);
64056 }
64057
64058 jboolean  CS_LDK_Bolt11InvoiceFeatures_supports_trampoline_routing(int64_t this_arg) {
64059         LDKBolt11InvoiceFeatures this_arg_conv;
64060         this_arg_conv.inner = untag_ptr(this_arg);
64061         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64062         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64063         this_arg_conv.is_owned = false;
64064         jboolean ret_conv = Bolt11InvoiceFeatures_supports_trampoline_routing(&this_arg_conv);
64065         return ret_conv;
64066 }
64067
64068 jboolean  CS_LDK_InitFeatures_requires_trampoline_routing(int64_t this_arg) {
64069         LDKInitFeatures this_arg_conv;
64070         this_arg_conv.inner = untag_ptr(this_arg);
64071         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64072         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64073         this_arg_conv.is_owned = false;
64074         jboolean ret_conv = InitFeatures_requires_trampoline_routing(&this_arg_conv);
64075         return ret_conv;
64076 }
64077
64078 jboolean  CS_LDK_NodeFeatures_requires_trampoline_routing(int64_t this_arg) {
64079         LDKNodeFeatures this_arg_conv;
64080         this_arg_conv.inner = untag_ptr(this_arg);
64081         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64082         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64083         this_arg_conv.is_owned = false;
64084         jboolean ret_conv = NodeFeatures_requires_trampoline_routing(&this_arg_conv);
64085         return ret_conv;
64086 }
64087
64088 jboolean  CS_LDK_Bolt11InvoiceFeatures_requires_trampoline_routing(int64_t this_arg) {
64089         LDKBolt11InvoiceFeatures this_arg_conv;
64090         this_arg_conv.inner = untag_ptr(this_arg);
64091         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64092         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64093         this_arg_conv.is_owned = false;
64094         jboolean ret_conv = Bolt11InvoiceFeatures_requires_trampoline_routing(&this_arg_conv);
64095         return ret_conv;
64096 }
64097
64098 void  CS_LDK_ShutdownScript_free(int64_t this_obj) {
64099         LDKShutdownScript this_obj_conv;
64100         this_obj_conv.inner = untag_ptr(this_obj);
64101         this_obj_conv.is_owned = ptr_is_owned(this_obj);
64102         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
64103         ShutdownScript_free(this_obj_conv);
64104 }
64105
64106 static inline uint64_t ShutdownScript_clone_ptr(LDKShutdownScript *NONNULL_PTR arg) {
64107         LDKShutdownScript ret_var = ShutdownScript_clone(arg);
64108         int64_t ret_ref = 0;
64109         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64110         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64111         return ret_ref;
64112 }
64113 int64_t  CS_LDK_ShutdownScript_clone_ptr(int64_t arg) {
64114         LDKShutdownScript arg_conv;
64115         arg_conv.inner = untag_ptr(arg);
64116         arg_conv.is_owned = ptr_is_owned(arg);
64117         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
64118         arg_conv.is_owned = false;
64119         int64_t ret_conv = ShutdownScript_clone_ptr(&arg_conv);
64120         return ret_conv;
64121 }
64122
64123 int64_t  CS_LDK_ShutdownScript_clone(int64_t orig) {
64124         LDKShutdownScript orig_conv;
64125         orig_conv.inner = untag_ptr(orig);
64126         orig_conv.is_owned = ptr_is_owned(orig);
64127         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
64128         orig_conv.is_owned = false;
64129         LDKShutdownScript ret_var = ShutdownScript_clone(&orig_conv);
64130         int64_t ret_ref = 0;
64131         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64132         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64133         return ret_ref;
64134 }
64135
64136 jboolean  CS_LDK_ShutdownScript_eq(int64_t a, int64_t b) {
64137         LDKShutdownScript a_conv;
64138         a_conv.inner = untag_ptr(a);
64139         a_conv.is_owned = ptr_is_owned(a);
64140         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
64141         a_conv.is_owned = false;
64142         LDKShutdownScript b_conv;
64143         b_conv.inner = untag_ptr(b);
64144         b_conv.is_owned = ptr_is_owned(b);
64145         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
64146         b_conv.is_owned = false;
64147         jboolean ret_conv = ShutdownScript_eq(&a_conv, &b_conv);
64148         return ret_conv;
64149 }
64150
64151 void  CS_LDK_InvalidShutdownScript_free(int64_t this_obj) {
64152         LDKInvalidShutdownScript this_obj_conv;
64153         this_obj_conv.inner = untag_ptr(this_obj);
64154         this_obj_conv.is_owned = ptr_is_owned(this_obj);
64155         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
64156         InvalidShutdownScript_free(this_obj_conv);
64157 }
64158
64159 int8_tArray  CS_LDK_InvalidShutdownScript_get_script(int64_t this_ptr) {
64160         LDKInvalidShutdownScript this_ptr_conv;
64161         this_ptr_conv.inner = untag_ptr(this_ptr);
64162         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64163         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64164         this_ptr_conv.is_owned = false;
64165         LDKCVec_u8Z ret_var = InvalidShutdownScript_get_script(&this_ptr_conv);
64166         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
64167         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
64168         CVec_u8Z_free(ret_var);
64169         return ret_arr;
64170 }
64171
64172 void  CS_LDK_InvalidShutdownScript_set_script(int64_t this_ptr, int8_tArray val) {
64173         LDKInvalidShutdownScript this_ptr_conv;
64174         this_ptr_conv.inner = untag_ptr(this_ptr);
64175         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64176         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64177         this_ptr_conv.is_owned = false;
64178         LDKCVec_u8Z val_ref;
64179         val_ref.datalen = val->arr_len;
64180         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
64181         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
64182         InvalidShutdownScript_set_script(&this_ptr_conv, val_ref);
64183 }
64184
64185 int64_t  CS_LDK_InvalidShutdownScript_new(int8_tArray script_arg) {
64186         LDKCVec_u8Z script_arg_ref;
64187         script_arg_ref.datalen = script_arg->arr_len;
64188         script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
64189         memcpy(script_arg_ref.data, script_arg->elems, script_arg_ref.datalen); FREE(script_arg);
64190         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_new(script_arg_ref);
64191         int64_t ret_ref = 0;
64192         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64193         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64194         return ret_ref;
64195 }
64196
64197 static inline uint64_t InvalidShutdownScript_clone_ptr(LDKInvalidShutdownScript *NONNULL_PTR arg) {
64198         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(arg);
64199         int64_t ret_ref = 0;
64200         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64201         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64202         return ret_ref;
64203 }
64204 int64_t  CS_LDK_InvalidShutdownScript_clone_ptr(int64_t arg) {
64205         LDKInvalidShutdownScript arg_conv;
64206         arg_conv.inner = untag_ptr(arg);
64207         arg_conv.is_owned = ptr_is_owned(arg);
64208         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
64209         arg_conv.is_owned = false;
64210         int64_t ret_conv = InvalidShutdownScript_clone_ptr(&arg_conv);
64211         return ret_conv;
64212 }
64213
64214 int64_t  CS_LDK_InvalidShutdownScript_clone(int64_t orig) {
64215         LDKInvalidShutdownScript orig_conv;
64216         orig_conv.inner = untag_ptr(orig);
64217         orig_conv.is_owned = ptr_is_owned(orig);
64218         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
64219         orig_conv.is_owned = false;
64220         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(&orig_conv);
64221         int64_t ret_ref = 0;
64222         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64223         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64224         return ret_ref;
64225 }
64226
64227 int8_tArray  CS_LDK_ShutdownScript_write(int64_t obj) {
64228         LDKShutdownScript obj_conv;
64229         obj_conv.inner = untag_ptr(obj);
64230         obj_conv.is_owned = ptr_is_owned(obj);
64231         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
64232         obj_conv.is_owned = false;
64233         LDKCVec_u8Z ret_var = ShutdownScript_write(&obj_conv);
64234         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
64235         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
64236         CVec_u8Z_free(ret_var);
64237         return ret_arr;
64238 }
64239
64240 int64_t  CS_LDK_ShutdownScript_read(int8_tArray ser) {
64241         LDKu8slice ser_ref;
64242         ser_ref.datalen = ser->arr_len;
64243         ser_ref.data = ser->elems;
64244         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
64245         *ret_conv = ShutdownScript_read(ser_ref);
64246         FREE(ser);
64247         return tag_ptr(ret_conv, true);
64248 }
64249
64250 int64_t  CS_LDK_ShutdownScript_new_p2wpkh(int8_tArray pubkey_hash) {
64251         uint8_t pubkey_hash_arr[20];
64252         CHECK(pubkey_hash->arr_len == 20);
64253         memcpy(pubkey_hash_arr, pubkey_hash->elems, 20); FREE(pubkey_hash);
64254         uint8_t (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
64255         LDKShutdownScript ret_var = ShutdownScript_new_p2wpkh(pubkey_hash_ref);
64256         int64_t ret_ref = 0;
64257         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64258         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64259         return ret_ref;
64260 }
64261
64262 int64_t  CS_LDK_ShutdownScript_new_p2wsh(int8_tArray script_hash) {
64263         uint8_t script_hash_arr[32];
64264         CHECK(script_hash->arr_len == 32);
64265         memcpy(script_hash_arr, script_hash->elems, 32); FREE(script_hash);
64266         uint8_t (*script_hash_ref)[32] = &script_hash_arr;
64267         LDKShutdownScript ret_var = ShutdownScript_new_p2wsh(script_hash_ref);
64268         int64_t ret_ref = 0;
64269         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64270         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64271         return ret_ref;
64272 }
64273
64274 int64_t  CS_LDK_ShutdownScript_new_witness_program(int64_t witness_program) {
64275         void* witness_program_ptr = untag_ptr(witness_program);
64276         CHECK_ACCESS(witness_program_ptr);
64277         LDKWitnessProgram witness_program_conv = *(LDKWitnessProgram*)(witness_program_ptr);
64278         witness_program_conv = WitnessProgram_clone((LDKWitnessProgram*)untag_ptr(witness_program));
64279         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
64280         *ret_conv = ShutdownScript_new_witness_program(witness_program_conv);
64281         return tag_ptr(ret_conv, true);
64282 }
64283
64284 int8_tArray  CS_LDK_ShutdownScript_into_inner(int64_t this_arg) {
64285         LDKShutdownScript this_arg_conv;
64286         this_arg_conv.inner = untag_ptr(this_arg);
64287         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64288         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64289         this_arg_conv = ShutdownScript_clone(&this_arg_conv);
64290         LDKCVec_u8Z ret_var = ShutdownScript_into_inner(this_arg_conv);
64291         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
64292         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
64293         CVec_u8Z_free(ret_var);
64294         return ret_arr;
64295 }
64296
64297 int8_tArray  CS_LDK_ShutdownScript_as_legacy_pubkey(int64_t this_arg) {
64298         LDKShutdownScript this_arg_conv;
64299         this_arg_conv.inner = untag_ptr(this_arg);
64300         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64301         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64302         this_arg_conv.is_owned = false;
64303         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
64304         memcpy(ret_arr->elems, ShutdownScript_as_legacy_pubkey(&this_arg_conv).compressed_form, 33);
64305         return ret_arr;
64306 }
64307
64308 jboolean  CS_LDK_ShutdownScript_is_compatible(int64_t this_arg, int64_t features) {
64309         LDKShutdownScript this_arg_conv;
64310         this_arg_conv.inner = untag_ptr(this_arg);
64311         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64312         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64313         this_arg_conv.is_owned = false;
64314         LDKInitFeatures features_conv;
64315         features_conv.inner = untag_ptr(features);
64316         features_conv.is_owned = ptr_is_owned(features);
64317         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
64318         features_conv.is_owned = false;
64319         jboolean ret_conv = ShutdownScript_is_compatible(&this_arg_conv, &features_conv);
64320         return ret_conv;
64321 }
64322
64323 jstring  CS_LDK_ShutdownScript_to_str(int64_t o) {
64324         LDKShutdownScript o_conv;
64325         o_conv.inner = untag_ptr(o);
64326         o_conv.is_owned = ptr_is_owned(o);
64327         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
64328         o_conv.is_owned = false;
64329         LDKStr ret_str = ShutdownScript_to_str(&o_conv);
64330         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
64331         Str_free(ret_str);
64332         return ret_conv;
64333 }
64334
64335 void  CS_LDK_ChannelId_free(int64_t this_obj) {
64336         LDKChannelId this_obj_conv;
64337         this_obj_conv.inner = untag_ptr(this_obj);
64338         this_obj_conv.is_owned = ptr_is_owned(this_obj);
64339         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
64340         ChannelId_free(this_obj_conv);
64341 }
64342
64343 int8_tArray  CS_LDK_ChannelId_get_a(int64_t this_ptr) {
64344         LDKChannelId this_ptr_conv;
64345         this_ptr_conv.inner = untag_ptr(this_ptr);
64346         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64347         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64348         this_ptr_conv.is_owned = false;
64349         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
64350         memcpy(ret_arr->elems, *ChannelId_get_a(&this_ptr_conv), 32);
64351         return ret_arr;
64352 }
64353
64354 void  CS_LDK_ChannelId_set_a(int64_t this_ptr, int8_tArray val) {
64355         LDKChannelId this_ptr_conv;
64356         this_ptr_conv.inner = untag_ptr(this_ptr);
64357         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64358         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64359         this_ptr_conv.is_owned = false;
64360         LDKThirtyTwoBytes val_ref;
64361         CHECK(val->arr_len == 32);
64362         memcpy(val_ref.data, val->elems, 32); FREE(val);
64363         ChannelId_set_a(&this_ptr_conv, val_ref);
64364 }
64365
64366 int64_t  CS_LDK_ChannelId_new(int8_tArray a_arg) {
64367         LDKThirtyTwoBytes a_arg_ref;
64368         CHECK(a_arg->arr_len == 32);
64369         memcpy(a_arg_ref.data, a_arg->elems, 32); FREE(a_arg);
64370         LDKChannelId ret_var = ChannelId_new(a_arg_ref);
64371         int64_t ret_ref = 0;
64372         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64373         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64374         return ret_ref;
64375 }
64376
64377 static inline uint64_t ChannelId_clone_ptr(LDKChannelId *NONNULL_PTR arg) {
64378         LDKChannelId ret_var = ChannelId_clone(arg);
64379         int64_t ret_ref = 0;
64380         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64381         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64382         return ret_ref;
64383 }
64384 int64_t  CS_LDK_ChannelId_clone_ptr(int64_t arg) {
64385         LDKChannelId arg_conv;
64386         arg_conv.inner = untag_ptr(arg);
64387         arg_conv.is_owned = ptr_is_owned(arg);
64388         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
64389         arg_conv.is_owned = false;
64390         int64_t ret_conv = ChannelId_clone_ptr(&arg_conv);
64391         return ret_conv;
64392 }
64393
64394 int64_t  CS_LDK_ChannelId_clone(int64_t orig) {
64395         LDKChannelId orig_conv;
64396         orig_conv.inner = untag_ptr(orig);
64397         orig_conv.is_owned = ptr_is_owned(orig);
64398         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
64399         orig_conv.is_owned = false;
64400         LDKChannelId ret_var = ChannelId_clone(&orig_conv);
64401         int64_t ret_ref = 0;
64402         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64403         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64404         return ret_ref;
64405 }
64406
64407 jboolean  CS_LDK_ChannelId_eq(int64_t a, int64_t b) {
64408         LDKChannelId a_conv;
64409         a_conv.inner = untag_ptr(a);
64410         a_conv.is_owned = ptr_is_owned(a);
64411         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
64412         a_conv.is_owned = false;
64413         LDKChannelId b_conv;
64414         b_conv.inner = untag_ptr(b);
64415         b_conv.is_owned = ptr_is_owned(b);
64416         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
64417         b_conv.is_owned = false;
64418         jboolean ret_conv = ChannelId_eq(&a_conv, &b_conv);
64419         return ret_conv;
64420 }
64421
64422 int64_t  CS_LDK_ChannelId_hash(int64_t o) {
64423         LDKChannelId o_conv;
64424         o_conv.inner = untag_ptr(o);
64425         o_conv.is_owned = ptr_is_owned(o);
64426         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
64427         o_conv.is_owned = false;
64428         int64_t ret_conv = ChannelId_hash(&o_conv);
64429         return ret_conv;
64430 }
64431
64432 int64_t  CS_LDK_ChannelId_v1_from_funding_txid(int8_tArray txid, int16_t output_index) {
64433         uint8_t txid_arr[32];
64434         CHECK(txid->arr_len == 32);
64435         memcpy(txid_arr, txid->elems, 32); FREE(txid);
64436         uint8_t (*txid_ref)[32] = &txid_arr;
64437         LDKChannelId ret_var = ChannelId_v1_from_funding_txid(txid_ref, output_index);
64438         int64_t ret_ref = 0;
64439         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64440         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64441         return ret_ref;
64442 }
64443
64444 int64_t  CS_LDK_ChannelId_v1_from_funding_outpoint(int64_t outpoint) {
64445         LDKOutPoint outpoint_conv;
64446         outpoint_conv.inner = untag_ptr(outpoint);
64447         outpoint_conv.is_owned = ptr_is_owned(outpoint);
64448         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_conv);
64449         outpoint_conv = OutPoint_clone(&outpoint_conv);
64450         LDKChannelId ret_var = ChannelId_v1_from_funding_outpoint(outpoint_conv);
64451         int64_t ret_ref = 0;
64452         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64453         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64454         return ret_ref;
64455 }
64456
64457 int64_t  CS_LDK_ChannelId_temporary_from_entropy_source(int64_t entropy_source) {
64458         void* entropy_source_ptr = untag_ptr(entropy_source);
64459         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
64460         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
64461         LDKChannelId ret_var = ChannelId_temporary_from_entropy_source(entropy_source_conv);
64462         int64_t ret_ref = 0;
64463         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64464         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64465         return ret_ref;
64466 }
64467
64468 int64_t  CS_LDK_ChannelId_from_bytes(int8_tArray data) {
64469         LDKThirtyTwoBytes data_ref;
64470         CHECK(data->arr_len == 32);
64471         memcpy(data_ref.data, data->elems, 32); FREE(data);
64472         LDKChannelId ret_var = ChannelId_from_bytes(data_ref);
64473         int64_t ret_ref = 0;
64474         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64475         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64476         return ret_ref;
64477 }
64478
64479 int64_t  CS_LDK_ChannelId_new_zero() {
64480         LDKChannelId ret_var = ChannelId_new_zero();
64481         int64_t ret_ref = 0;
64482         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64483         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64484         return ret_ref;
64485 }
64486
64487 jboolean  CS_LDK_ChannelId_is_zero(int64_t this_arg) {
64488         LDKChannelId this_arg_conv;
64489         this_arg_conv.inner = untag_ptr(this_arg);
64490         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64491         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64492         this_arg_conv.is_owned = false;
64493         jboolean ret_conv = ChannelId_is_zero(&this_arg_conv);
64494         return ret_conv;
64495 }
64496
64497 int64_t  CS_LDK_ChannelId_v2_from_revocation_basepoints(int64_t ours, int64_t theirs) {
64498         LDKRevocationBasepoint ours_conv;
64499         ours_conv.inner = untag_ptr(ours);
64500         ours_conv.is_owned = ptr_is_owned(ours);
64501         CHECK_INNER_FIELD_ACCESS_OR_NULL(ours_conv);
64502         ours_conv.is_owned = false;
64503         LDKRevocationBasepoint theirs_conv;
64504         theirs_conv.inner = untag_ptr(theirs);
64505         theirs_conv.is_owned = ptr_is_owned(theirs);
64506         CHECK_INNER_FIELD_ACCESS_OR_NULL(theirs_conv);
64507         theirs_conv.is_owned = false;
64508         LDKChannelId ret_var = ChannelId_v2_from_revocation_basepoints(&ours_conv, &theirs_conv);
64509         int64_t ret_ref = 0;
64510         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64511         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64512         return ret_ref;
64513 }
64514
64515 int64_t  CS_LDK_ChannelId_temporary_v2_from_revocation_basepoint(int64_t our_revocation_basepoint) {
64516         LDKRevocationBasepoint our_revocation_basepoint_conv;
64517         our_revocation_basepoint_conv.inner = untag_ptr(our_revocation_basepoint);
64518         our_revocation_basepoint_conv.is_owned = ptr_is_owned(our_revocation_basepoint);
64519         CHECK_INNER_FIELD_ACCESS_OR_NULL(our_revocation_basepoint_conv);
64520         our_revocation_basepoint_conv.is_owned = false;
64521         LDKChannelId ret_var = ChannelId_temporary_v2_from_revocation_basepoint(&our_revocation_basepoint_conv);
64522         int64_t ret_ref = 0;
64523         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64524         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64525         return ret_ref;
64526 }
64527
64528 int8_tArray  CS_LDK_ChannelId_write(int64_t obj) {
64529         LDKChannelId obj_conv;
64530         obj_conv.inner = untag_ptr(obj);
64531         obj_conv.is_owned = ptr_is_owned(obj);
64532         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
64533         obj_conv.is_owned = false;
64534         LDKCVec_u8Z ret_var = ChannelId_write(&obj_conv);
64535         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
64536         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
64537         CVec_u8Z_free(ret_var);
64538         return ret_arr;
64539 }
64540
64541 int64_t  CS_LDK_ChannelId_read(int8_tArray ser) {
64542         LDKu8slice ser_ref;
64543         ser_ref.datalen = ser->arr_len;
64544         ser_ref.data = ser->elems;
64545         LDKCResult_ChannelIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelIdDecodeErrorZ), "LDKCResult_ChannelIdDecodeErrorZ");
64546         *ret_conv = ChannelId_read(ser_ref);
64547         FREE(ser);
64548         return tag_ptr(ret_conv, true);
64549 }
64550
64551 jstring  CS_LDK_ChannelId_to_str(int64_t o) {
64552         LDKChannelId o_conv;
64553         o_conv.inner = untag_ptr(o);
64554         o_conv.is_owned = ptr_is_owned(o);
64555         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
64556         o_conv.is_owned = false;
64557         LDKStr ret_str = ChannelId_to_str(&o_conv);
64558         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
64559         Str_free(ret_str);
64560         return ret_conv;
64561 }
64562
64563 void  CS_LDK_Retry_free(int64_t this_ptr) {
64564         if (!ptr_is_owned(this_ptr)) return;
64565         void* this_ptr_ptr = untag_ptr(this_ptr);
64566         CHECK_ACCESS(this_ptr_ptr);
64567         LDKRetry this_ptr_conv = *(LDKRetry*)(this_ptr_ptr);
64568         FREE(untag_ptr(this_ptr));
64569         Retry_free(this_ptr_conv);
64570 }
64571
64572 static inline uint64_t Retry_clone_ptr(LDKRetry *NONNULL_PTR arg) {
64573         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
64574         *ret_copy = Retry_clone(arg);
64575         int64_t ret_ref = tag_ptr(ret_copy, true);
64576         return ret_ref;
64577 }
64578 int64_t  CS_LDK_Retry_clone_ptr(int64_t arg) {
64579         LDKRetry* arg_conv = (LDKRetry*)untag_ptr(arg);
64580         int64_t ret_conv = Retry_clone_ptr(arg_conv);
64581         return ret_conv;
64582 }
64583
64584 int64_t  CS_LDK_Retry_clone(int64_t orig) {
64585         LDKRetry* orig_conv = (LDKRetry*)untag_ptr(orig);
64586         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
64587         *ret_copy = Retry_clone(orig_conv);
64588         int64_t ret_ref = tag_ptr(ret_copy, true);
64589         return ret_ref;
64590 }
64591
64592 int64_t  CS_LDK_Retry_attempts(int32_t a) {
64593         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
64594         *ret_copy = Retry_attempts(a);
64595         int64_t ret_ref = tag_ptr(ret_copy, true);
64596         return ret_ref;
64597 }
64598
64599 int64_t  CS_LDK_Retry_timeout(int64_t a) {
64600         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
64601         *ret_copy = Retry_timeout(a);
64602         int64_t ret_ref = tag_ptr(ret_copy, true);
64603         return ret_ref;
64604 }
64605
64606 jboolean  CS_LDK_Retry_eq(int64_t a, int64_t b) {
64607         LDKRetry* a_conv = (LDKRetry*)untag_ptr(a);
64608         LDKRetry* b_conv = (LDKRetry*)untag_ptr(b);
64609         jboolean ret_conv = Retry_eq(a_conv, b_conv);
64610         return ret_conv;
64611 }
64612
64613 int64_t  CS_LDK_Retry_hash(int64_t o) {
64614         LDKRetry* o_conv = (LDKRetry*)untag_ptr(o);
64615         int64_t ret_conv = Retry_hash(o_conv);
64616         return ret_conv;
64617 }
64618
64619 int8_tArray  CS_LDK_Retry_write(int64_t obj) {
64620         LDKRetry* obj_conv = (LDKRetry*)untag_ptr(obj);
64621         LDKCVec_u8Z ret_var = Retry_write(obj_conv);
64622         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
64623         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
64624         CVec_u8Z_free(ret_var);
64625         return ret_arr;
64626 }
64627
64628 int64_t  CS_LDK_Retry_read(int8_tArray ser) {
64629         LDKu8slice ser_ref;
64630         ser_ref.datalen = ser->arr_len;
64631         ser_ref.data = ser->elems;
64632         LDKCResult_RetryDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RetryDecodeErrorZ), "LDKCResult_RetryDecodeErrorZ");
64633         *ret_conv = Retry_read(ser_ref);
64634         FREE(ser);
64635         return tag_ptr(ret_conv, true);
64636 }
64637
64638 int32_t  CS_LDK_RetryableSendFailure_clone(int64_t orig) {
64639         LDKRetryableSendFailure* orig_conv = (LDKRetryableSendFailure*)untag_ptr(orig);
64640         int32_t ret_conv = LDKRetryableSendFailure_to_cs(RetryableSendFailure_clone(orig_conv));
64641         return ret_conv;
64642 }
64643
64644 int32_t  CS_LDK_RetryableSendFailure_payment_expired() {
64645         int32_t ret_conv = LDKRetryableSendFailure_to_cs(RetryableSendFailure_payment_expired());
64646         return ret_conv;
64647 }
64648
64649 int32_t  CS_LDK_RetryableSendFailure_route_not_found() {
64650         int32_t ret_conv = LDKRetryableSendFailure_to_cs(RetryableSendFailure_route_not_found());
64651         return ret_conv;
64652 }
64653
64654 int32_t  CS_LDK_RetryableSendFailure_duplicate_payment() {
64655         int32_t ret_conv = LDKRetryableSendFailure_to_cs(RetryableSendFailure_duplicate_payment());
64656         return ret_conv;
64657 }
64658
64659 jboolean  CS_LDK_RetryableSendFailure_eq(int64_t a, int64_t b) {
64660         LDKRetryableSendFailure* a_conv = (LDKRetryableSendFailure*)untag_ptr(a);
64661         LDKRetryableSendFailure* b_conv = (LDKRetryableSendFailure*)untag_ptr(b);
64662         jboolean ret_conv = RetryableSendFailure_eq(a_conv, b_conv);
64663         return ret_conv;
64664 }
64665
64666 void  CS_LDK_PaymentSendFailure_free(int64_t this_ptr) {
64667         if (!ptr_is_owned(this_ptr)) return;
64668         void* this_ptr_ptr = untag_ptr(this_ptr);
64669         CHECK_ACCESS(this_ptr_ptr);
64670         LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)(this_ptr_ptr);
64671         FREE(untag_ptr(this_ptr));
64672         PaymentSendFailure_free(this_ptr_conv);
64673 }
64674
64675 static inline uint64_t PaymentSendFailure_clone_ptr(LDKPaymentSendFailure *NONNULL_PTR arg) {
64676         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
64677         *ret_copy = PaymentSendFailure_clone(arg);
64678         int64_t ret_ref = tag_ptr(ret_copy, true);
64679         return ret_ref;
64680 }
64681 int64_t  CS_LDK_PaymentSendFailure_clone_ptr(int64_t arg) {
64682         LDKPaymentSendFailure* arg_conv = (LDKPaymentSendFailure*)untag_ptr(arg);
64683         int64_t ret_conv = PaymentSendFailure_clone_ptr(arg_conv);
64684         return ret_conv;
64685 }
64686
64687 int64_t  CS_LDK_PaymentSendFailure_clone(int64_t orig) {
64688         LDKPaymentSendFailure* orig_conv = (LDKPaymentSendFailure*)untag_ptr(orig);
64689         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
64690         *ret_copy = PaymentSendFailure_clone(orig_conv);
64691         int64_t ret_ref = tag_ptr(ret_copy, true);
64692         return ret_ref;
64693 }
64694
64695 int64_t  CS_LDK_PaymentSendFailure_parameter_error(int64_t a) {
64696         void* a_ptr = untag_ptr(a);
64697         CHECK_ACCESS(a_ptr);
64698         LDKAPIError a_conv = *(LDKAPIError*)(a_ptr);
64699         a_conv = APIError_clone((LDKAPIError*)untag_ptr(a));
64700         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
64701         *ret_copy = PaymentSendFailure_parameter_error(a_conv);
64702         int64_t ret_ref = tag_ptr(ret_copy, true);
64703         return ret_ref;
64704 }
64705
64706 int64_t  CS_LDK_PaymentSendFailure_path_parameter_error(int64_tArray a) {
64707         LDKCVec_CResult_NoneAPIErrorZZ a_constr;
64708         a_constr.datalen = a->arr_len;
64709         if (a_constr.datalen > 0)
64710                 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
64711         else
64712                 a_constr.data = NULL;
64713         int64_t* a_vals = a->elems;
64714         for (size_t w = 0; w < a_constr.datalen; w++) {
64715                 int64_t a_conv_22 = a_vals[w];
64716                 void* a_conv_22_ptr = untag_ptr(a_conv_22);
64717                 CHECK_ACCESS(a_conv_22_ptr);
64718                 LDKCResult_NoneAPIErrorZ a_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(a_conv_22_ptr);
64719                 a_conv_22_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)untag_ptr(a_conv_22));
64720                 a_constr.data[w] = a_conv_22_conv;
64721         }
64722         FREE(a);
64723         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
64724         *ret_copy = PaymentSendFailure_path_parameter_error(a_constr);
64725         int64_t ret_ref = tag_ptr(ret_copy, true);
64726         return ret_ref;
64727 }
64728
64729 int64_t  CS_LDK_PaymentSendFailure_all_failed_resend_safe(int64_tArray a) {
64730         LDKCVec_APIErrorZ a_constr;
64731         a_constr.datalen = a->arr_len;
64732         if (a_constr.datalen > 0)
64733                 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
64734         else
64735                 a_constr.data = NULL;
64736         int64_t* a_vals = a->elems;
64737         for (size_t k = 0; k < a_constr.datalen; k++) {
64738                 int64_t a_conv_10 = a_vals[k];
64739                 void* a_conv_10_ptr = untag_ptr(a_conv_10);
64740                 CHECK_ACCESS(a_conv_10_ptr);
64741                 LDKAPIError a_conv_10_conv = *(LDKAPIError*)(a_conv_10_ptr);
64742                 a_conv_10_conv = APIError_clone((LDKAPIError*)untag_ptr(a_conv_10));
64743                 a_constr.data[k] = a_conv_10_conv;
64744         }
64745         FREE(a);
64746         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
64747         *ret_copy = PaymentSendFailure_all_failed_resend_safe(a_constr);
64748         int64_t ret_ref = tag_ptr(ret_copy, true);
64749         return ret_ref;
64750 }
64751
64752 int64_t  CS_LDK_PaymentSendFailure_duplicate_payment() {
64753         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
64754         *ret_copy = PaymentSendFailure_duplicate_payment();
64755         int64_t ret_ref = tag_ptr(ret_copy, true);
64756         return ret_ref;
64757 }
64758
64759 int64_t  CS_LDK_PaymentSendFailure_partial_failure(int64_tArray results, int64_t failed_paths_retry, int8_tArray payment_id) {
64760         LDKCVec_CResult_NoneAPIErrorZZ results_constr;
64761         results_constr.datalen = results->arr_len;
64762         if (results_constr.datalen > 0)
64763                 results_constr.data = MALLOC(results_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
64764         else
64765                 results_constr.data = NULL;
64766         int64_t* results_vals = results->elems;
64767         for (size_t w = 0; w < results_constr.datalen; w++) {
64768                 int64_t results_conv_22 = results_vals[w];
64769                 void* results_conv_22_ptr = untag_ptr(results_conv_22);
64770                 CHECK_ACCESS(results_conv_22_ptr);
64771                 LDKCResult_NoneAPIErrorZ results_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(results_conv_22_ptr);
64772                 results_constr.data[w] = results_conv_22_conv;
64773         }
64774         FREE(results);
64775         LDKRouteParameters failed_paths_retry_conv;
64776         failed_paths_retry_conv.inner = untag_ptr(failed_paths_retry);
64777         failed_paths_retry_conv.is_owned = ptr_is_owned(failed_paths_retry);
64778         CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_conv);
64779         failed_paths_retry_conv = RouteParameters_clone(&failed_paths_retry_conv);
64780         LDKThirtyTwoBytes payment_id_ref;
64781         CHECK(payment_id->arr_len == 32);
64782         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
64783         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
64784         *ret_copy = PaymentSendFailure_partial_failure(results_constr, failed_paths_retry_conv, payment_id_ref);
64785         int64_t ret_ref = tag_ptr(ret_copy, true);
64786         return ret_ref;
64787 }
64788
64789 jboolean  CS_LDK_PaymentSendFailure_eq(int64_t a, int64_t b) {
64790         LDKPaymentSendFailure* a_conv = (LDKPaymentSendFailure*)untag_ptr(a);
64791         LDKPaymentSendFailure* b_conv = (LDKPaymentSendFailure*)untag_ptr(b);
64792         jboolean ret_conv = PaymentSendFailure_eq(a_conv, b_conv);
64793         return ret_conv;
64794 }
64795
64796 void  CS_LDK_ProbeSendFailure_free(int64_t this_ptr) {
64797         if (!ptr_is_owned(this_ptr)) return;
64798         void* this_ptr_ptr = untag_ptr(this_ptr);
64799         CHECK_ACCESS(this_ptr_ptr);
64800         LDKProbeSendFailure this_ptr_conv = *(LDKProbeSendFailure*)(this_ptr_ptr);
64801         FREE(untag_ptr(this_ptr));
64802         ProbeSendFailure_free(this_ptr_conv);
64803 }
64804
64805 static inline uint64_t ProbeSendFailure_clone_ptr(LDKProbeSendFailure *NONNULL_PTR arg) {
64806         LDKProbeSendFailure *ret_copy = MALLOC(sizeof(LDKProbeSendFailure), "LDKProbeSendFailure");
64807         *ret_copy = ProbeSendFailure_clone(arg);
64808         int64_t ret_ref = tag_ptr(ret_copy, true);
64809         return ret_ref;
64810 }
64811 int64_t  CS_LDK_ProbeSendFailure_clone_ptr(int64_t arg) {
64812         LDKProbeSendFailure* arg_conv = (LDKProbeSendFailure*)untag_ptr(arg);
64813         int64_t ret_conv = ProbeSendFailure_clone_ptr(arg_conv);
64814         return ret_conv;
64815 }
64816
64817 int64_t  CS_LDK_ProbeSendFailure_clone(int64_t orig) {
64818         LDKProbeSendFailure* orig_conv = (LDKProbeSendFailure*)untag_ptr(orig);
64819         LDKProbeSendFailure *ret_copy = MALLOC(sizeof(LDKProbeSendFailure), "LDKProbeSendFailure");
64820         *ret_copy = ProbeSendFailure_clone(orig_conv);
64821         int64_t ret_ref = tag_ptr(ret_copy, true);
64822         return ret_ref;
64823 }
64824
64825 int64_t  CS_LDK_ProbeSendFailure_route_not_found() {
64826         LDKProbeSendFailure *ret_copy = MALLOC(sizeof(LDKProbeSendFailure), "LDKProbeSendFailure");
64827         *ret_copy = ProbeSendFailure_route_not_found();
64828         int64_t ret_ref = tag_ptr(ret_copy, true);
64829         return ret_ref;
64830 }
64831
64832 int64_t  CS_LDK_ProbeSendFailure_sending_failed(int64_t a) {
64833         void* a_ptr = untag_ptr(a);
64834         CHECK_ACCESS(a_ptr);
64835         LDKPaymentSendFailure a_conv = *(LDKPaymentSendFailure*)(a_ptr);
64836         a_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(a));
64837         LDKProbeSendFailure *ret_copy = MALLOC(sizeof(LDKProbeSendFailure), "LDKProbeSendFailure");
64838         *ret_copy = ProbeSendFailure_sending_failed(a_conv);
64839         int64_t ret_ref = tag_ptr(ret_copy, true);
64840         return ret_ref;
64841 }
64842
64843 jboolean  CS_LDK_ProbeSendFailure_eq(int64_t a, int64_t b) {
64844         LDKProbeSendFailure* a_conv = (LDKProbeSendFailure*)untag_ptr(a);
64845         LDKProbeSendFailure* b_conv = (LDKProbeSendFailure*)untag_ptr(b);
64846         jboolean ret_conv = ProbeSendFailure_eq(a_conv, b_conv);
64847         return ret_conv;
64848 }
64849
64850 void  CS_LDK_RecipientOnionFields_free(int64_t this_obj) {
64851         LDKRecipientOnionFields this_obj_conv;
64852         this_obj_conv.inner = untag_ptr(this_obj);
64853         this_obj_conv.is_owned = ptr_is_owned(this_obj);
64854         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
64855         RecipientOnionFields_free(this_obj_conv);
64856 }
64857
64858 int64_t  CS_LDK_RecipientOnionFields_get_payment_secret(int64_t this_ptr) {
64859         LDKRecipientOnionFields this_ptr_conv;
64860         this_ptr_conv.inner = untag_ptr(this_ptr);
64861         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64862         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64863         this_ptr_conv.is_owned = false;
64864         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
64865         *ret_copy = RecipientOnionFields_get_payment_secret(&this_ptr_conv);
64866         int64_t ret_ref = tag_ptr(ret_copy, true);
64867         return ret_ref;
64868 }
64869
64870 void  CS_LDK_RecipientOnionFields_set_payment_secret(int64_t this_ptr, int64_t val) {
64871         LDKRecipientOnionFields this_ptr_conv;
64872         this_ptr_conv.inner = untag_ptr(this_ptr);
64873         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64874         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64875         this_ptr_conv.is_owned = false;
64876         void* val_ptr = untag_ptr(val);
64877         CHECK_ACCESS(val_ptr);
64878         LDKCOption_ThirtyTwoBytesZ val_conv = *(LDKCOption_ThirtyTwoBytesZ*)(val_ptr);
64879         val_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(val));
64880         RecipientOnionFields_set_payment_secret(&this_ptr_conv, val_conv);
64881 }
64882
64883 int64_t  CS_LDK_RecipientOnionFields_get_payment_metadata(int64_t this_ptr) {
64884         LDKRecipientOnionFields this_ptr_conv;
64885         this_ptr_conv.inner = untag_ptr(this_ptr);
64886         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64887         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64888         this_ptr_conv.is_owned = false;
64889         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
64890         *ret_copy = RecipientOnionFields_get_payment_metadata(&this_ptr_conv);
64891         int64_t ret_ref = tag_ptr(ret_copy, true);
64892         return ret_ref;
64893 }
64894
64895 void  CS_LDK_RecipientOnionFields_set_payment_metadata(int64_t this_ptr, int64_t val) {
64896         LDKRecipientOnionFields this_ptr_conv;
64897         this_ptr_conv.inner = untag_ptr(this_ptr);
64898         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64899         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64900         this_ptr_conv.is_owned = false;
64901         void* val_ptr = untag_ptr(val);
64902         CHECK_ACCESS(val_ptr);
64903         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
64904         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
64905         RecipientOnionFields_set_payment_metadata(&this_ptr_conv, val_conv);
64906 }
64907
64908 static inline uint64_t RecipientOnionFields_clone_ptr(LDKRecipientOnionFields *NONNULL_PTR arg) {
64909         LDKRecipientOnionFields ret_var = RecipientOnionFields_clone(arg);
64910         int64_t ret_ref = 0;
64911         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64912         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64913         return ret_ref;
64914 }
64915 int64_t  CS_LDK_RecipientOnionFields_clone_ptr(int64_t arg) {
64916         LDKRecipientOnionFields arg_conv;
64917         arg_conv.inner = untag_ptr(arg);
64918         arg_conv.is_owned = ptr_is_owned(arg);
64919         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
64920         arg_conv.is_owned = false;
64921         int64_t ret_conv = RecipientOnionFields_clone_ptr(&arg_conv);
64922         return ret_conv;
64923 }
64924
64925 int64_t  CS_LDK_RecipientOnionFields_clone(int64_t orig) {
64926         LDKRecipientOnionFields orig_conv;
64927         orig_conv.inner = untag_ptr(orig);
64928         orig_conv.is_owned = ptr_is_owned(orig);
64929         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
64930         orig_conv.is_owned = false;
64931         LDKRecipientOnionFields ret_var = RecipientOnionFields_clone(&orig_conv);
64932         int64_t ret_ref = 0;
64933         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64934         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64935         return ret_ref;
64936 }
64937
64938 jboolean  CS_LDK_RecipientOnionFields_eq(int64_t a, int64_t b) {
64939         LDKRecipientOnionFields a_conv;
64940         a_conv.inner = untag_ptr(a);
64941         a_conv.is_owned = ptr_is_owned(a);
64942         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
64943         a_conv.is_owned = false;
64944         LDKRecipientOnionFields b_conv;
64945         b_conv.inner = untag_ptr(b);
64946         b_conv.is_owned = ptr_is_owned(b);
64947         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
64948         b_conv.is_owned = false;
64949         jboolean ret_conv = RecipientOnionFields_eq(&a_conv, &b_conv);
64950         return ret_conv;
64951 }
64952
64953 int8_tArray  CS_LDK_RecipientOnionFields_write(int64_t obj) {
64954         LDKRecipientOnionFields obj_conv;
64955         obj_conv.inner = untag_ptr(obj);
64956         obj_conv.is_owned = ptr_is_owned(obj);
64957         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
64958         obj_conv.is_owned = false;
64959         LDKCVec_u8Z ret_var = RecipientOnionFields_write(&obj_conv);
64960         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
64961         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
64962         CVec_u8Z_free(ret_var);
64963         return ret_arr;
64964 }
64965
64966 int64_t  CS_LDK_RecipientOnionFields_read(int8_tArray ser) {
64967         LDKu8slice ser_ref;
64968         ser_ref.datalen = ser->arr_len;
64969         ser_ref.data = ser->elems;
64970         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
64971         *ret_conv = RecipientOnionFields_read(ser_ref);
64972         FREE(ser);
64973         return tag_ptr(ret_conv, true);
64974 }
64975
64976 int64_t  CS_LDK_RecipientOnionFields_secret_only(int8_tArray payment_secret) {
64977         LDKThirtyTwoBytes payment_secret_ref;
64978         CHECK(payment_secret->arr_len == 32);
64979         memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
64980         LDKRecipientOnionFields ret_var = RecipientOnionFields_secret_only(payment_secret_ref);
64981         int64_t ret_ref = 0;
64982         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64983         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64984         return ret_ref;
64985 }
64986
64987 int64_t  CS_LDK_RecipientOnionFields_spontaneous_empty() {
64988         LDKRecipientOnionFields ret_var = RecipientOnionFields_spontaneous_empty();
64989         int64_t ret_ref = 0;
64990         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64991         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64992         return ret_ref;
64993 }
64994
64995 int64_t  CS_LDK_RecipientOnionFields_with_custom_tlvs(int64_t this_arg, int64_tArray custom_tlvs) {
64996         LDKRecipientOnionFields this_arg_conv;
64997         this_arg_conv.inner = untag_ptr(this_arg);
64998         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64999         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65000         this_arg_conv = RecipientOnionFields_clone(&this_arg_conv);
65001         LDKCVec_C2Tuple_u64CVec_u8ZZZ custom_tlvs_constr;
65002         custom_tlvs_constr.datalen = custom_tlvs->arr_len;
65003         if (custom_tlvs_constr.datalen > 0)
65004                 custom_tlvs_constr.data = MALLOC(custom_tlvs_constr.datalen * sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKCVec_C2Tuple_u64CVec_u8ZZZ Elements");
65005         else
65006                 custom_tlvs_constr.data = NULL;
65007         int64_t* custom_tlvs_vals = custom_tlvs->elems;
65008         for (size_t x = 0; x < custom_tlvs_constr.datalen; x++) {
65009                 int64_t custom_tlvs_conv_23 = custom_tlvs_vals[x];
65010                 void* custom_tlvs_conv_23_ptr = untag_ptr(custom_tlvs_conv_23);
65011                 CHECK_ACCESS(custom_tlvs_conv_23_ptr);
65012                 LDKC2Tuple_u64CVec_u8ZZ custom_tlvs_conv_23_conv = *(LDKC2Tuple_u64CVec_u8ZZ*)(custom_tlvs_conv_23_ptr);
65013                 custom_tlvs_conv_23_conv = C2Tuple_u64CVec_u8ZZ_clone((LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(custom_tlvs_conv_23));
65014                 custom_tlvs_constr.data[x] = custom_tlvs_conv_23_conv;
65015         }
65016         FREE(custom_tlvs);
65017         LDKCResult_RecipientOnionFieldsNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsNoneZ), "LDKCResult_RecipientOnionFieldsNoneZ");
65018         *ret_conv = RecipientOnionFields_with_custom_tlvs(this_arg_conv, custom_tlvs_constr);
65019         return tag_ptr(ret_conv, true);
65020 }
65021
65022 int64_tArray  CS_LDK_RecipientOnionFields_custom_tlvs(int64_t this_arg) {
65023         LDKRecipientOnionFields this_arg_conv;
65024         this_arg_conv.inner = untag_ptr(this_arg);
65025         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65026         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65027         this_arg_conv.is_owned = false;
65028         LDKCVec_C2Tuple_u64CVec_u8ZZZ ret_var = RecipientOnionFields_custom_tlvs(&this_arg_conv);
65029         int64_tArray ret_arr = NULL;
65030         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
65031         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
65032         for (size_t x = 0; x < ret_var.datalen; x++) {
65033                 LDKC2Tuple_u64CVec_u8ZZ* ret_conv_23_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
65034                 *ret_conv_23_conv = ret_var.data[x];
65035                 ret_arr_ptr[x] = tag_ptr(ret_conv_23_conv, true);
65036         }
65037         
65038         FREE(ret_var.data);
65039         return ret_arr;
65040 }
65041
65042 void  CS_LDK_CustomMessageReader_free(int64_t this_ptr) {
65043         if (!ptr_is_owned(this_ptr)) return;
65044         void* this_ptr_ptr = untag_ptr(this_ptr);
65045         CHECK_ACCESS(this_ptr_ptr);
65046         LDKCustomMessageReader this_ptr_conv = *(LDKCustomMessageReader*)(this_ptr_ptr);
65047         FREE(untag_ptr(this_ptr));
65048         CustomMessageReader_free(this_ptr_conv);
65049 }
65050
65051 static inline uint64_t Type_clone_ptr(LDKType *NONNULL_PTR arg) {
65052         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
65053         *ret_ret = Type_clone(arg);
65054         return tag_ptr(ret_ret, true);
65055 }
65056 int64_t  CS_LDK_Type_clone_ptr(int64_t arg) {
65057         void* arg_ptr = untag_ptr(arg);
65058         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
65059         LDKType* arg_conv = (LDKType*)arg_ptr;
65060         int64_t ret_conv = Type_clone_ptr(arg_conv);
65061         return ret_conv;
65062 }
65063
65064 int64_t  CS_LDK_Type_clone(int64_t orig) {
65065         void* orig_ptr = untag_ptr(orig);
65066         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
65067         LDKType* orig_conv = (LDKType*)orig_ptr;
65068         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
65069         *ret_ret = Type_clone(orig_conv);
65070         return tag_ptr(ret_ret, true);
65071 }
65072
65073 void  CS_LDK_Type_free(int64_t this_ptr) {
65074         if (!ptr_is_owned(this_ptr)) return;
65075         void* this_ptr_ptr = untag_ptr(this_ptr);
65076         CHECK_ACCESS(this_ptr_ptr);
65077         LDKType this_ptr_conv = *(LDKType*)(this_ptr_ptr);
65078         FREE(untag_ptr(this_ptr));
65079         Type_free(this_ptr_conv);
65080 }
65081
65082 void  CS_LDK_OfferId_free(int64_t this_obj) {
65083         LDKOfferId this_obj_conv;
65084         this_obj_conv.inner = untag_ptr(this_obj);
65085         this_obj_conv.is_owned = ptr_is_owned(this_obj);
65086         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
65087         OfferId_free(this_obj_conv);
65088 }
65089
65090 int8_tArray  CS_LDK_OfferId_get_a(int64_t this_ptr) {
65091         LDKOfferId this_ptr_conv;
65092         this_ptr_conv.inner = untag_ptr(this_ptr);
65093         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65094         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65095         this_ptr_conv.is_owned = false;
65096         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
65097         memcpy(ret_arr->elems, *OfferId_get_a(&this_ptr_conv), 32);
65098         return ret_arr;
65099 }
65100
65101 void  CS_LDK_OfferId_set_a(int64_t this_ptr, int8_tArray val) {
65102         LDKOfferId this_ptr_conv;
65103         this_ptr_conv.inner = untag_ptr(this_ptr);
65104         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65105         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65106         this_ptr_conv.is_owned = false;
65107         LDKThirtyTwoBytes val_ref;
65108         CHECK(val->arr_len == 32);
65109         memcpy(val_ref.data, val->elems, 32); FREE(val);
65110         OfferId_set_a(&this_ptr_conv, val_ref);
65111 }
65112
65113 int64_t  CS_LDK_OfferId_new(int8_tArray a_arg) {
65114         LDKThirtyTwoBytes a_arg_ref;
65115         CHECK(a_arg->arr_len == 32);
65116         memcpy(a_arg_ref.data, a_arg->elems, 32); FREE(a_arg);
65117         LDKOfferId ret_var = OfferId_new(a_arg_ref);
65118         int64_t ret_ref = 0;
65119         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65120         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65121         return ret_ref;
65122 }
65123
65124 static inline uint64_t OfferId_clone_ptr(LDKOfferId *NONNULL_PTR arg) {
65125         LDKOfferId ret_var = OfferId_clone(arg);
65126         int64_t ret_ref = 0;
65127         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65128         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65129         return ret_ref;
65130 }
65131 int64_t  CS_LDK_OfferId_clone_ptr(int64_t arg) {
65132         LDKOfferId arg_conv;
65133         arg_conv.inner = untag_ptr(arg);
65134         arg_conv.is_owned = ptr_is_owned(arg);
65135         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
65136         arg_conv.is_owned = false;
65137         int64_t ret_conv = OfferId_clone_ptr(&arg_conv);
65138         return ret_conv;
65139 }
65140
65141 int64_t  CS_LDK_OfferId_clone(int64_t orig) {
65142         LDKOfferId orig_conv;
65143         orig_conv.inner = untag_ptr(orig);
65144         orig_conv.is_owned = ptr_is_owned(orig);
65145         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
65146         orig_conv.is_owned = false;
65147         LDKOfferId ret_var = OfferId_clone(&orig_conv);
65148         int64_t ret_ref = 0;
65149         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65150         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65151         return ret_ref;
65152 }
65153
65154 jboolean  CS_LDK_OfferId_eq(int64_t a, int64_t b) {
65155         LDKOfferId a_conv;
65156         a_conv.inner = untag_ptr(a);
65157         a_conv.is_owned = ptr_is_owned(a);
65158         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
65159         a_conv.is_owned = false;
65160         LDKOfferId b_conv;
65161         b_conv.inner = untag_ptr(b);
65162         b_conv.is_owned = ptr_is_owned(b);
65163         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
65164         b_conv.is_owned = false;
65165         jboolean ret_conv = OfferId_eq(&a_conv, &b_conv);
65166         return ret_conv;
65167 }
65168
65169 int8_tArray  CS_LDK_OfferId_write(int64_t obj) {
65170         LDKOfferId obj_conv;
65171         obj_conv.inner = untag_ptr(obj);
65172         obj_conv.is_owned = ptr_is_owned(obj);
65173         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
65174         obj_conv.is_owned = false;
65175         LDKCVec_u8Z ret_var = OfferId_write(&obj_conv);
65176         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
65177         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
65178         CVec_u8Z_free(ret_var);
65179         return ret_arr;
65180 }
65181
65182 int64_t  CS_LDK_OfferId_read(int8_tArray ser) {
65183         LDKu8slice ser_ref;
65184         ser_ref.datalen = ser->arr_len;
65185         ser_ref.data = ser->elems;
65186         LDKCResult_OfferIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferIdDecodeErrorZ), "LDKCResult_OfferIdDecodeErrorZ");
65187         *ret_conv = OfferId_read(ser_ref);
65188         FREE(ser);
65189         return tag_ptr(ret_conv, true);
65190 }
65191
65192 void  CS_LDK_OfferWithExplicitMetadataBuilder_free(int64_t this_obj) {
65193         LDKOfferWithExplicitMetadataBuilder this_obj_conv;
65194         this_obj_conv.inner = untag_ptr(this_obj);
65195         this_obj_conv.is_owned = ptr_is_owned(this_obj);
65196         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
65197         OfferWithExplicitMetadataBuilder_free(this_obj_conv);
65198 }
65199
65200 static inline uint64_t OfferWithExplicitMetadataBuilder_clone_ptr(LDKOfferWithExplicitMetadataBuilder *NONNULL_PTR arg) {
65201         LDKOfferWithExplicitMetadataBuilder ret_var = OfferWithExplicitMetadataBuilder_clone(arg);
65202         int64_t ret_ref = 0;
65203         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65204         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65205         return ret_ref;
65206 }
65207 int64_t  CS_LDK_OfferWithExplicitMetadataBuilder_clone_ptr(int64_t arg) {
65208         LDKOfferWithExplicitMetadataBuilder arg_conv;
65209         arg_conv.inner = untag_ptr(arg);
65210         arg_conv.is_owned = ptr_is_owned(arg);
65211         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
65212         arg_conv.is_owned = false;
65213         int64_t ret_conv = OfferWithExplicitMetadataBuilder_clone_ptr(&arg_conv);
65214         return ret_conv;
65215 }
65216
65217 int64_t  CS_LDK_OfferWithExplicitMetadataBuilder_clone(int64_t orig) {
65218         LDKOfferWithExplicitMetadataBuilder orig_conv;
65219         orig_conv.inner = untag_ptr(orig);
65220         orig_conv.is_owned = ptr_is_owned(orig);
65221         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
65222         orig_conv.is_owned = false;
65223         LDKOfferWithExplicitMetadataBuilder ret_var = OfferWithExplicitMetadataBuilder_clone(&orig_conv);
65224         int64_t ret_ref = 0;
65225         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65226         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65227         return ret_ref;
65228 }
65229
65230 void  CS_LDK_OfferWithDerivedMetadataBuilder_free(int64_t this_obj) {
65231         LDKOfferWithDerivedMetadataBuilder this_obj_conv;
65232         this_obj_conv.inner = untag_ptr(this_obj);
65233         this_obj_conv.is_owned = ptr_is_owned(this_obj);
65234         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
65235         OfferWithDerivedMetadataBuilder_free(this_obj_conv);
65236 }
65237
65238 static inline uint64_t OfferWithDerivedMetadataBuilder_clone_ptr(LDKOfferWithDerivedMetadataBuilder *NONNULL_PTR arg) {
65239         LDKOfferWithDerivedMetadataBuilder ret_var = OfferWithDerivedMetadataBuilder_clone(arg);
65240         int64_t ret_ref = 0;
65241         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65242         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65243         return ret_ref;
65244 }
65245 int64_t  CS_LDK_OfferWithDerivedMetadataBuilder_clone_ptr(int64_t arg) {
65246         LDKOfferWithDerivedMetadataBuilder arg_conv;
65247         arg_conv.inner = untag_ptr(arg);
65248         arg_conv.is_owned = ptr_is_owned(arg);
65249         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
65250         arg_conv.is_owned = false;
65251         int64_t ret_conv = OfferWithDerivedMetadataBuilder_clone_ptr(&arg_conv);
65252         return ret_conv;
65253 }
65254
65255 int64_t  CS_LDK_OfferWithDerivedMetadataBuilder_clone(int64_t orig) {
65256         LDKOfferWithDerivedMetadataBuilder orig_conv;
65257         orig_conv.inner = untag_ptr(orig);
65258         orig_conv.is_owned = ptr_is_owned(orig);
65259         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
65260         orig_conv.is_owned = false;
65261         LDKOfferWithDerivedMetadataBuilder ret_var = OfferWithDerivedMetadataBuilder_clone(&orig_conv);
65262         int64_t ret_ref = 0;
65263         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65264         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65265         return ret_ref;
65266 }
65267
65268 int64_t  CS_LDK_OfferWithExplicitMetadataBuilder_new(int8_tArray signing_pubkey) {
65269         LDKPublicKey signing_pubkey_ref;
65270         CHECK(signing_pubkey->arr_len == 33);
65271         memcpy(signing_pubkey_ref.compressed_form, signing_pubkey->elems, 33); FREE(signing_pubkey);
65272         LDKOfferWithExplicitMetadataBuilder ret_var = OfferWithExplicitMetadataBuilder_new(signing_pubkey_ref);
65273         int64_t ret_ref = 0;
65274         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65275         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65276         return ret_ref;
65277 }
65278
65279 int64_t  CS_LDK_OfferWithExplicitMetadataBuilder_metadata(int64_t this_arg, int8_tArray metadata) {
65280         LDKOfferWithExplicitMetadataBuilder this_arg_conv;
65281         this_arg_conv.inner = untag_ptr(this_arg);
65282         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65283         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65284         this_arg_conv = OfferWithExplicitMetadataBuilder_clone(&this_arg_conv);
65285         LDKCVec_u8Z metadata_ref;
65286         metadata_ref.datalen = metadata->arr_len;
65287         metadata_ref.data = MALLOC(metadata_ref.datalen, "LDKCVec_u8Z Bytes");
65288         memcpy(metadata_ref.data, metadata->elems, metadata_ref.datalen); FREE(metadata);
65289         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
65290         *ret_conv = OfferWithExplicitMetadataBuilder_metadata(this_arg_conv, metadata_ref);
65291         return tag_ptr(ret_conv, true);
65292 }
65293
65294 void  CS_LDK_OfferWithExplicitMetadataBuilder_chain(int64_t this_arg, int32_t network) {
65295         LDKOfferWithExplicitMetadataBuilder this_arg_conv;
65296         this_arg_conv.inner = untag_ptr(this_arg);
65297         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65298         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65299         this_arg_conv = OfferWithExplicitMetadataBuilder_clone(&this_arg_conv);
65300         LDKNetwork network_conv = LDKNetwork_from_cs(network);
65301         OfferWithExplicitMetadataBuilder_chain(this_arg_conv, network_conv);
65302 }
65303
65304 void  CS_LDK_OfferWithExplicitMetadataBuilder_amount_msats(int64_t this_arg, int64_t amount_msats) {
65305         LDKOfferWithExplicitMetadataBuilder this_arg_conv;
65306         this_arg_conv.inner = untag_ptr(this_arg);
65307         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65308         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65309         this_arg_conv = OfferWithExplicitMetadataBuilder_clone(&this_arg_conv);
65310         OfferWithExplicitMetadataBuilder_amount_msats(this_arg_conv, amount_msats);
65311 }
65312
65313 void  CS_LDK_OfferWithExplicitMetadataBuilder_absolute_expiry(int64_t this_arg, int64_t absolute_expiry) {
65314         LDKOfferWithExplicitMetadataBuilder this_arg_conv;
65315         this_arg_conv.inner = untag_ptr(this_arg);
65316         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65317         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65318         this_arg_conv = OfferWithExplicitMetadataBuilder_clone(&this_arg_conv);
65319         OfferWithExplicitMetadataBuilder_absolute_expiry(this_arg_conv, absolute_expiry);
65320 }
65321
65322 void  CS_LDK_OfferWithExplicitMetadataBuilder_description(int64_t this_arg, jstring description) {
65323         LDKOfferWithExplicitMetadataBuilder this_arg_conv;
65324         this_arg_conv.inner = untag_ptr(this_arg);
65325         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65326         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65327         this_arg_conv = OfferWithExplicitMetadataBuilder_clone(&this_arg_conv);
65328         LDKStr description_conv = str_ref_to_owned_c(description);
65329         OfferWithExplicitMetadataBuilder_description(this_arg_conv, description_conv);
65330 }
65331
65332 void  CS_LDK_OfferWithExplicitMetadataBuilder_issuer(int64_t this_arg, jstring issuer) {
65333         LDKOfferWithExplicitMetadataBuilder this_arg_conv;
65334         this_arg_conv.inner = untag_ptr(this_arg);
65335         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65336         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65337         this_arg_conv = OfferWithExplicitMetadataBuilder_clone(&this_arg_conv);
65338         LDKStr issuer_conv = str_ref_to_owned_c(issuer);
65339         OfferWithExplicitMetadataBuilder_issuer(this_arg_conv, issuer_conv);
65340 }
65341
65342 void  CS_LDK_OfferWithExplicitMetadataBuilder_path(int64_t this_arg, int64_t path) {
65343         LDKOfferWithExplicitMetadataBuilder 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 = OfferWithExplicitMetadataBuilder_clone(&this_arg_conv);
65348         LDKBlindedPath path_conv;
65349         path_conv.inner = untag_ptr(path);
65350         path_conv.is_owned = ptr_is_owned(path);
65351         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
65352         path_conv = BlindedPath_clone(&path_conv);
65353         OfferWithExplicitMetadataBuilder_path(this_arg_conv, path_conv);
65354 }
65355
65356 void  CS_LDK_OfferWithExplicitMetadataBuilder_supported_quantity(int64_t this_arg, int64_t quantity) {
65357         LDKOfferWithExplicitMetadataBuilder this_arg_conv;
65358         this_arg_conv.inner = untag_ptr(this_arg);
65359         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65360         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65361         this_arg_conv = OfferWithExplicitMetadataBuilder_clone(&this_arg_conv);
65362         void* quantity_ptr = untag_ptr(quantity);
65363         CHECK_ACCESS(quantity_ptr);
65364         LDKQuantity quantity_conv = *(LDKQuantity*)(quantity_ptr);
65365         quantity_conv = Quantity_clone((LDKQuantity*)untag_ptr(quantity));
65366         OfferWithExplicitMetadataBuilder_supported_quantity(this_arg_conv, quantity_conv);
65367 }
65368
65369 int64_t  CS_LDK_OfferWithExplicitMetadataBuilder_build(int64_t this_arg) {
65370         LDKOfferWithExplicitMetadataBuilder this_arg_conv;
65371         this_arg_conv.inner = untag_ptr(this_arg);
65372         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65373         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65374         this_arg_conv = OfferWithExplicitMetadataBuilder_clone(&this_arg_conv);
65375         LDKCResult_OfferBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12SemanticErrorZ), "LDKCResult_OfferBolt12SemanticErrorZ");
65376         *ret_conv = OfferWithExplicitMetadataBuilder_build(this_arg_conv);
65377         return tag_ptr(ret_conv, true);
65378 }
65379
65380 int64_t  CS_LDK_OfferWithDerivedMetadataBuilder_deriving_signing_pubkey(int8_tArray node_id, int64_t expanded_key, int64_t entropy_source) {
65381         LDKPublicKey node_id_ref;
65382         CHECK(node_id->arr_len == 33);
65383         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
65384         LDKExpandedKey expanded_key_conv;
65385         expanded_key_conv.inner = untag_ptr(expanded_key);
65386         expanded_key_conv.is_owned = ptr_is_owned(expanded_key);
65387         CHECK_INNER_FIELD_ACCESS_OR_NULL(expanded_key_conv);
65388         expanded_key_conv.is_owned = false;
65389         void* entropy_source_ptr = untag_ptr(entropy_source);
65390         CHECK_ACCESS(entropy_source_ptr);
65391         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
65392         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
65393                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
65394                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
65395         }
65396         LDKOfferWithDerivedMetadataBuilder ret_var = OfferWithDerivedMetadataBuilder_deriving_signing_pubkey(node_id_ref, &expanded_key_conv, entropy_source_conv);
65397         int64_t ret_ref = 0;
65398         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65399         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65400         return ret_ref;
65401 }
65402
65403 void  CS_LDK_OfferWithDerivedMetadataBuilder_chain(int64_t this_arg, int32_t network) {
65404         LDKOfferWithDerivedMetadataBuilder this_arg_conv;
65405         this_arg_conv.inner = untag_ptr(this_arg);
65406         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65407         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65408         this_arg_conv = OfferWithDerivedMetadataBuilder_clone(&this_arg_conv);
65409         LDKNetwork network_conv = LDKNetwork_from_cs(network);
65410         OfferWithDerivedMetadataBuilder_chain(this_arg_conv, network_conv);
65411 }
65412
65413 void  CS_LDK_OfferWithDerivedMetadataBuilder_amount_msats(int64_t this_arg, int64_t amount_msats) {
65414         LDKOfferWithDerivedMetadataBuilder this_arg_conv;
65415         this_arg_conv.inner = untag_ptr(this_arg);
65416         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65417         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65418         this_arg_conv = OfferWithDerivedMetadataBuilder_clone(&this_arg_conv);
65419         OfferWithDerivedMetadataBuilder_amount_msats(this_arg_conv, amount_msats);
65420 }
65421
65422 void  CS_LDK_OfferWithDerivedMetadataBuilder_absolute_expiry(int64_t this_arg, int64_t absolute_expiry) {
65423         LDKOfferWithDerivedMetadataBuilder this_arg_conv;
65424         this_arg_conv.inner = untag_ptr(this_arg);
65425         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65426         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65427         this_arg_conv = OfferWithDerivedMetadataBuilder_clone(&this_arg_conv);
65428         OfferWithDerivedMetadataBuilder_absolute_expiry(this_arg_conv, absolute_expiry);
65429 }
65430
65431 void  CS_LDK_OfferWithDerivedMetadataBuilder_description(int64_t this_arg, jstring description) {
65432         LDKOfferWithDerivedMetadataBuilder this_arg_conv;
65433         this_arg_conv.inner = untag_ptr(this_arg);
65434         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65435         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65436         this_arg_conv = OfferWithDerivedMetadataBuilder_clone(&this_arg_conv);
65437         LDKStr description_conv = str_ref_to_owned_c(description);
65438         OfferWithDerivedMetadataBuilder_description(this_arg_conv, description_conv);
65439 }
65440
65441 void  CS_LDK_OfferWithDerivedMetadataBuilder_issuer(int64_t this_arg, jstring issuer) {
65442         LDKOfferWithDerivedMetadataBuilder this_arg_conv;
65443         this_arg_conv.inner = untag_ptr(this_arg);
65444         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65445         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65446         this_arg_conv = OfferWithDerivedMetadataBuilder_clone(&this_arg_conv);
65447         LDKStr issuer_conv = str_ref_to_owned_c(issuer);
65448         OfferWithDerivedMetadataBuilder_issuer(this_arg_conv, issuer_conv);
65449 }
65450
65451 void  CS_LDK_OfferWithDerivedMetadataBuilder_path(int64_t this_arg, int64_t path) {
65452         LDKOfferWithDerivedMetadataBuilder this_arg_conv;
65453         this_arg_conv.inner = untag_ptr(this_arg);
65454         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65455         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65456         this_arg_conv = OfferWithDerivedMetadataBuilder_clone(&this_arg_conv);
65457         LDKBlindedPath path_conv;
65458         path_conv.inner = untag_ptr(path);
65459         path_conv.is_owned = ptr_is_owned(path);
65460         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
65461         path_conv = BlindedPath_clone(&path_conv);
65462         OfferWithDerivedMetadataBuilder_path(this_arg_conv, path_conv);
65463 }
65464
65465 void  CS_LDK_OfferWithDerivedMetadataBuilder_supported_quantity(int64_t this_arg, int64_t quantity) {
65466         LDKOfferWithDerivedMetadataBuilder this_arg_conv;
65467         this_arg_conv.inner = untag_ptr(this_arg);
65468         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65469         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65470         this_arg_conv = OfferWithDerivedMetadataBuilder_clone(&this_arg_conv);
65471         void* quantity_ptr = untag_ptr(quantity);
65472         CHECK_ACCESS(quantity_ptr);
65473         LDKQuantity quantity_conv = *(LDKQuantity*)(quantity_ptr);
65474         quantity_conv = Quantity_clone((LDKQuantity*)untag_ptr(quantity));
65475         OfferWithDerivedMetadataBuilder_supported_quantity(this_arg_conv, quantity_conv);
65476 }
65477
65478 int64_t  CS_LDK_OfferWithDerivedMetadataBuilder_build(int64_t this_arg) {
65479         LDKOfferWithDerivedMetadataBuilder this_arg_conv;
65480         this_arg_conv.inner = untag_ptr(this_arg);
65481         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65482         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65483         this_arg_conv = OfferWithDerivedMetadataBuilder_clone(&this_arg_conv);
65484         LDKCResult_OfferBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12SemanticErrorZ), "LDKCResult_OfferBolt12SemanticErrorZ");
65485         *ret_conv = OfferWithDerivedMetadataBuilder_build(this_arg_conv);
65486         return tag_ptr(ret_conv, true);
65487 }
65488
65489 void  CS_LDK_Offer_free(int64_t this_obj) {
65490         LDKOffer this_obj_conv;
65491         this_obj_conv.inner = untag_ptr(this_obj);
65492         this_obj_conv.is_owned = ptr_is_owned(this_obj);
65493         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
65494         Offer_free(this_obj_conv);
65495 }
65496
65497 static inline uint64_t Offer_clone_ptr(LDKOffer *NONNULL_PTR arg) {
65498         LDKOffer ret_var = Offer_clone(arg);
65499         int64_t ret_ref = 0;
65500         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65501         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65502         return ret_ref;
65503 }
65504 int64_t  CS_LDK_Offer_clone_ptr(int64_t arg) {
65505         LDKOffer arg_conv;
65506         arg_conv.inner = untag_ptr(arg);
65507         arg_conv.is_owned = ptr_is_owned(arg);
65508         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
65509         arg_conv.is_owned = false;
65510         int64_t ret_conv = Offer_clone_ptr(&arg_conv);
65511         return ret_conv;
65512 }
65513
65514 int64_t  CS_LDK_Offer_clone(int64_t orig) {
65515         LDKOffer orig_conv;
65516         orig_conv.inner = untag_ptr(orig);
65517         orig_conv.is_owned = ptr_is_owned(orig);
65518         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
65519         orig_conv.is_owned = false;
65520         LDKOffer ret_var = Offer_clone(&orig_conv);
65521         int64_t ret_ref = 0;
65522         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65523         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65524         return ret_ref;
65525 }
65526
65527 ptrArray  CS_LDK_Offer_chains(int64_t this_arg) {
65528         LDKOffer this_arg_conv;
65529         this_arg_conv.inner = untag_ptr(this_arg);
65530         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65531         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65532         this_arg_conv.is_owned = false;
65533         LDKCVec_ThirtyTwoBytesZ ret_var = Offer_chains(&this_arg_conv);
65534         ptrArray ret_arr = NULL;
65535         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
65536         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
65537         for (size_t i = 0; i < ret_var.datalen; i++) {
65538                 int8_tArray ret_conv_8_arr = init_int8_tArray(32, __LINE__);
65539                 memcpy(ret_conv_8_arr->elems, ret_var.data[i].data, 32);
65540                 ret_arr_ptr[i] = ret_conv_8_arr;
65541         }
65542         
65543         FREE(ret_var.data);
65544         return ret_arr;
65545 }
65546
65547 int64_t  CS_LDK_Offer_metadata(int64_t this_arg) {
65548         LDKOffer this_arg_conv;
65549         this_arg_conv.inner = untag_ptr(this_arg);
65550         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65551         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65552         this_arg_conv.is_owned = false;
65553         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
65554         *ret_copy = Offer_metadata(&this_arg_conv);
65555         int64_t ret_ref = tag_ptr(ret_copy, true);
65556         return ret_ref;
65557 }
65558
65559 int64_t  CS_LDK_Offer_amount(int64_t this_arg) {
65560         LDKOffer this_arg_conv;
65561         this_arg_conv.inner = untag_ptr(this_arg);
65562         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65563         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65564         this_arg_conv.is_owned = false;
65565         LDKCOption_AmountZ *ret_copy = MALLOC(sizeof(LDKCOption_AmountZ), "LDKCOption_AmountZ");
65566         *ret_copy = Offer_amount(&this_arg_conv);
65567         int64_t ret_ref = tag_ptr(ret_copy, true);
65568         return ret_ref;
65569 }
65570
65571 int64_t  CS_LDK_Offer_description(int64_t this_arg) {
65572         LDKOffer this_arg_conv;
65573         this_arg_conv.inner = untag_ptr(this_arg);
65574         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65575         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65576         this_arg_conv.is_owned = false;
65577         LDKPrintableString ret_var = Offer_description(&this_arg_conv);
65578         int64_t ret_ref = 0;
65579         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65580         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65581         return ret_ref;
65582 }
65583
65584 int64_t  CS_LDK_Offer_offer_features(int64_t this_arg) {
65585         LDKOffer this_arg_conv;
65586         this_arg_conv.inner = untag_ptr(this_arg);
65587         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65588         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65589         this_arg_conv.is_owned = false;
65590         LDKOfferFeatures ret_var = Offer_offer_features(&this_arg_conv);
65591         int64_t ret_ref = 0;
65592         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65593         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65594         return ret_ref;
65595 }
65596
65597 int64_t  CS_LDK_Offer_absolute_expiry(int64_t this_arg) {
65598         LDKOffer this_arg_conv;
65599         this_arg_conv.inner = untag_ptr(this_arg);
65600         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65601         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65602         this_arg_conv.is_owned = false;
65603         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
65604         *ret_copy = Offer_absolute_expiry(&this_arg_conv);
65605         int64_t ret_ref = tag_ptr(ret_copy, true);
65606         return ret_ref;
65607 }
65608
65609 int64_t  CS_LDK_Offer_issuer(int64_t this_arg) {
65610         LDKOffer this_arg_conv;
65611         this_arg_conv.inner = untag_ptr(this_arg);
65612         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65613         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65614         this_arg_conv.is_owned = false;
65615         LDKPrintableString ret_var = Offer_issuer(&this_arg_conv);
65616         int64_t ret_ref = 0;
65617         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65618         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65619         return ret_ref;
65620 }
65621
65622 int64_tArray  CS_LDK_Offer_paths(int64_t this_arg) {
65623         LDKOffer this_arg_conv;
65624         this_arg_conv.inner = untag_ptr(this_arg);
65625         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65626         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65627         this_arg_conv.is_owned = false;
65628         LDKCVec_BlindedPathZ ret_var = Offer_paths(&this_arg_conv);
65629         int64_tArray ret_arr = NULL;
65630         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
65631         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
65632         for (size_t n = 0; n < ret_var.datalen; n++) {
65633                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
65634                 int64_t ret_conv_13_ref = 0;
65635                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
65636                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
65637                 ret_arr_ptr[n] = ret_conv_13_ref;
65638         }
65639         
65640         FREE(ret_var.data);
65641         return ret_arr;
65642 }
65643
65644 int64_t  CS_LDK_Offer_supported_quantity(int64_t this_arg) {
65645         LDKOffer this_arg_conv;
65646         this_arg_conv.inner = untag_ptr(this_arg);
65647         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65648         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65649         this_arg_conv.is_owned = false;
65650         LDKQuantity *ret_copy = MALLOC(sizeof(LDKQuantity), "LDKQuantity");
65651         *ret_copy = Offer_supported_quantity(&this_arg_conv);
65652         int64_t ret_ref = tag_ptr(ret_copy, true);
65653         return ret_ref;
65654 }
65655
65656 int8_tArray  CS_LDK_Offer_signing_pubkey(int64_t this_arg) {
65657         LDKOffer this_arg_conv;
65658         this_arg_conv.inner = untag_ptr(this_arg);
65659         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65660         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65661         this_arg_conv.is_owned = false;
65662         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
65663         memcpy(ret_arr->elems, Offer_signing_pubkey(&this_arg_conv).compressed_form, 33);
65664         return ret_arr;
65665 }
65666
65667 int64_t  CS_LDK_Offer_id(int64_t this_arg) {
65668         LDKOffer this_arg_conv;
65669         this_arg_conv.inner = untag_ptr(this_arg);
65670         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65671         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65672         this_arg_conv.is_owned = false;
65673         LDKOfferId ret_var = Offer_id(&this_arg_conv);
65674         int64_t ret_ref = 0;
65675         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65676         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65677         return ret_ref;
65678 }
65679
65680 jboolean  CS_LDK_Offer_supports_chain(int64_t this_arg, int8_tArray chain) {
65681         LDKOffer this_arg_conv;
65682         this_arg_conv.inner = untag_ptr(this_arg);
65683         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65684         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65685         this_arg_conv.is_owned = false;
65686         LDKThirtyTwoBytes chain_ref;
65687         CHECK(chain->arr_len == 32);
65688         memcpy(chain_ref.data, chain->elems, 32); FREE(chain);
65689         jboolean ret_conv = Offer_supports_chain(&this_arg_conv, chain_ref);
65690         return ret_conv;
65691 }
65692
65693 jboolean  CS_LDK_Offer_is_expired(int64_t this_arg) {
65694         LDKOffer this_arg_conv;
65695         this_arg_conv.inner = untag_ptr(this_arg);
65696         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65697         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65698         this_arg_conv.is_owned = false;
65699         jboolean ret_conv = Offer_is_expired(&this_arg_conv);
65700         return ret_conv;
65701 }
65702
65703 jboolean  CS_LDK_Offer_is_expired_no_std(int64_t this_arg, int64_t duration_since_epoch) {
65704         LDKOffer this_arg_conv;
65705         this_arg_conv.inner = untag_ptr(this_arg);
65706         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65707         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65708         this_arg_conv.is_owned = false;
65709         jboolean ret_conv = Offer_is_expired_no_std(&this_arg_conv, duration_since_epoch);
65710         return ret_conv;
65711 }
65712
65713 jboolean  CS_LDK_Offer_is_valid_quantity(int64_t this_arg, int64_t quantity) {
65714         LDKOffer this_arg_conv;
65715         this_arg_conv.inner = untag_ptr(this_arg);
65716         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65717         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65718         this_arg_conv.is_owned = false;
65719         jboolean ret_conv = Offer_is_valid_quantity(&this_arg_conv, quantity);
65720         return ret_conv;
65721 }
65722
65723 jboolean  CS_LDK_Offer_expects_quantity(int64_t this_arg) {
65724         LDKOffer this_arg_conv;
65725         this_arg_conv.inner = untag_ptr(this_arg);
65726         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65727         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65728         this_arg_conv.is_owned = false;
65729         jboolean ret_conv = Offer_expects_quantity(&this_arg_conv);
65730         return ret_conv;
65731 }
65732
65733 int64_t  CS_LDK_Offer_request_invoice_deriving_payer_id(int64_t this_arg, int64_t expanded_key, int64_t entropy_source, int8_tArray payment_id) {
65734         LDKOffer this_arg_conv;
65735         this_arg_conv.inner = untag_ptr(this_arg);
65736         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65737         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65738         this_arg_conv.is_owned = false;
65739         LDKExpandedKey expanded_key_conv;
65740         expanded_key_conv.inner = untag_ptr(expanded_key);
65741         expanded_key_conv.is_owned = ptr_is_owned(expanded_key);
65742         CHECK_INNER_FIELD_ACCESS_OR_NULL(expanded_key_conv);
65743         expanded_key_conv.is_owned = false;
65744         void* entropy_source_ptr = untag_ptr(entropy_source);
65745         CHECK_ACCESS(entropy_source_ptr);
65746         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
65747         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
65748                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
65749                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
65750         }
65751         LDKThirtyTwoBytes payment_id_ref;
65752         CHECK(payment_id->arr_len == 32);
65753         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
65754         LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ");
65755         *ret_conv = Offer_request_invoice_deriving_payer_id(&this_arg_conv, &expanded_key_conv, entropy_source_conv, payment_id_ref);
65756         return tag_ptr(ret_conv, true);
65757 }
65758
65759 int64_t  CS_LDK_Offer_request_invoice_deriving_metadata(int64_t this_arg, int8_tArray payer_id, int64_t expanded_key, int64_t entropy_source, int8_tArray payment_id) {
65760         LDKOffer this_arg_conv;
65761         this_arg_conv.inner = untag_ptr(this_arg);
65762         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65763         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65764         this_arg_conv.is_owned = false;
65765         LDKPublicKey payer_id_ref;
65766         CHECK(payer_id->arr_len == 33);
65767         memcpy(payer_id_ref.compressed_form, payer_id->elems, 33); FREE(payer_id);
65768         LDKExpandedKey expanded_key_conv;
65769         expanded_key_conv.inner = untag_ptr(expanded_key);
65770         expanded_key_conv.is_owned = ptr_is_owned(expanded_key);
65771         CHECK_INNER_FIELD_ACCESS_OR_NULL(expanded_key_conv);
65772         expanded_key_conv.is_owned = false;
65773         void* entropy_source_ptr = untag_ptr(entropy_source);
65774         CHECK_ACCESS(entropy_source_ptr);
65775         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
65776         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
65777                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
65778                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
65779         }
65780         LDKThirtyTwoBytes payment_id_ref;
65781         CHECK(payment_id->arr_len == 32);
65782         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
65783         LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ");
65784         *ret_conv = Offer_request_invoice_deriving_metadata(&this_arg_conv, payer_id_ref, &expanded_key_conv, entropy_source_conv, payment_id_ref);
65785         return tag_ptr(ret_conv, true);
65786 }
65787
65788 int64_t  CS_LDK_Offer_request_invoice(int64_t this_arg, int8_tArray metadata, int8_tArray payer_id) {
65789         LDKOffer this_arg_conv;
65790         this_arg_conv.inner = untag_ptr(this_arg);
65791         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65792         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65793         this_arg_conv.is_owned = false;
65794         LDKCVec_u8Z metadata_ref;
65795         metadata_ref.datalen = metadata->arr_len;
65796         metadata_ref.data = MALLOC(metadata_ref.datalen, "LDKCVec_u8Z Bytes");
65797         memcpy(metadata_ref.data, metadata->elems, metadata_ref.datalen); FREE(metadata);
65798         LDKPublicKey payer_id_ref;
65799         CHECK(payer_id->arr_len == 33);
65800         memcpy(payer_id_ref.compressed_form, payer_id->elems, 33); FREE(payer_id);
65801         LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ");
65802         *ret_conv = Offer_request_invoice(&this_arg_conv, metadata_ref, payer_id_ref);
65803         return tag_ptr(ret_conv, true);
65804 }
65805
65806 int64_t  CS_LDK_Offer_hash(int64_t o) {
65807         LDKOffer o_conv;
65808         o_conv.inner = untag_ptr(o);
65809         o_conv.is_owned = ptr_is_owned(o);
65810         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
65811         o_conv.is_owned = false;
65812         int64_t ret_conv = Offer_hash(&o_conv);
65813         return ret_conv;
65814 }
65815
65816 int8_tArray  CS_LDK_Offer_write(int64_t obj) {
65817         LDKOffer obj_conv;
65818         obj_conv.inner = untag_ptr(obj);
65819         obj_conv.is_owned = ptr_is_owned(obj);
65820         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
65821         obj_conv.is_owned = false;
65822         LDKCVec_u8Z ret_var = Offer_write(&obj_conv);
65823         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
65824         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
65825         CVec_u8Z_free(ret_var);
65826         return ret_arr;
65827 }
65828
65829 void  CS_LDK_Amount_free(int64_t this_ptr) {
65830         if (!ptr_is_owned(this_ptr)) return;
65831         void* this_ptr_ptr = untag_ptr(this_ptr);
65832         CHECK_ACCESS(this_ptr_ptr);
65833         LDKAmount this_ptr_conv = *(LDKAmount*)(this_ptr_ptr);
65834         FREE(untag_ptr(this_ptr));
65835         Amount_free(this_ptr_conv);
65836 }
65837
65838 static inline uint64_t Amount_clone_ptr(LDKAmount *NONNULL_PTR arg) {
65839         LDKAmount *ret_copy = MALLOC(sizeof(LDKAmount), "LDKAmount");
65840         *ret_copy = Amount_clone(arg);
65841         int64_t ret_ref = tag_ptr(ret_copy, true);
65842         return ret_ref;
65843 }
65844 int64_t  CS_LDK_Amount_clone_ptr(int64_t arg) {
65845         LDKAmount* arg_conv = (LDKAmount*)untag_ptr(arg);
65846         int64_t ret_conv = Amount_clone_ptr(arg_conv);
65847         return ret_conv;
65848 }
65849
65850 int64_t  CS_LDK_Amount_clone(int64_t orig) {
65851         LDKAmount* orig_conv = (LDKAmount*)untag_ptr(orig);
65852         LDKAmount *ret_copy = MALLOC(sizeof(LDKAmount), "LDKAmount");
65853         *ret_copy = Amount_clone(orig_conv);
65854         int64_t ret_ref = tag_ptr(ret_copy, true);
65855         return ret_ref;
65856 }
65857
65858 int64_t  CS_LDK_Amount_bitcoin(int64_t amount_msats) {
65859         LDKAmount *ret_copy = MALLOC(sizeof(LDKAmount), "LDKAmount");
65860         *ret_copy = Amount_bitcoin(amount_msats);
65861         int64_t ret_ref = tag_ptr(ret_copy, true);
65862         return ret_ref;
65863 }
65864
65865 int64_t  CS_LDK_Amount_currency(int8_tArray iso4217_code, int64_t amount) {
65866         LDKThreeBytes iso4217_code_ref;
65867         CHECK(iso4217_code->arr_len == 3);
65868         memcpy(iso4217_code_ref.data, iso4217_code->elems, 3); FREE(iso4217_code);
65869         LDKAmount *ret_copy = MALLOC(sizeof(LDKAmount), "LDKAmount");
65870         *ret_copy = Amount_currency(iso4217_code_ref, amount);
65871         int64_t ret_ref = tag_ptr(ret_copy, true);
65872         return ret_ref;
65873 }
65874
65875 void  CS_LDK_Quantity_free(int64_t this_ptr) {
65876         if (!ptr_is_owned(this_ptr)) return;
65877         void* this_ptr_ptr = untag_ptr(this_ptr);
65878         CHECK_ACCESS(this_ptr_ptr);
65879         LDKQuantity this_ptr_conv = *(LDKQuantity*)(this_ptr_ptr);
65880         FREE(untag_ptr(this_ptr));
65881         Quantity_free(this_ptr_conv);
65882 }
65883
65884 static inline uint64_t Quantity_clone_ptr(LDKQuantity *NONNULL_PTR arg) {
65885         LDKQuantity *ret_copy = MALLOC(sizeof(LDKQuantity), "LDKQuantity");
65886         *ret_copy = Quantity_clone(arg);
65887         int64_t ret_ref = tag_ptr(ret_copy, true);
65888         return ret_ref;
65889 }
65890 int64_t  CS_LDK_Quantity_clone_ptr(int64_t arg) {
65891         LDKQuantity* arg_conv = (LDKQuantity*)untag_ptr(arg);
65892         int64_t ret_conv = Quantity_clone_ptr(arg_conv);
65893         return ret_conv;
65894 }
65895
65896 int64_t  CS_LDK_Quantity_clone(int64_t orig) {
65897         LDKQuantity* orig_conv = (LDKQuantity*)untag_ptr(orig);
65898         LDKQuantity *ret_copy = MALLOC(sizeof(LDKQuantity), "LDKQuantity");
65899         *ret_copy = Quantity_clone(orig_conv);
65900         int64_t ret_ref = tag_ptr(ret_copy, true);
65901         return ret_ref;
65902 }
65903
65904 int64_t  CS_LDK_Quantity_bounded(int64_t a) {
65905         LDKQuantity *ret_copy = MALLOC(sizeof(LDKQuantity), "LDKQuantity");
65906         *ret_copy = Quantity_bounded(a);
65907         int64_t ret_ref = tag_ptr(ret_copy, true);
65908         return ret_ref;
65909 }
65910
65911 int64_t  CS_LDK_Quantity_unbounded() {
65912         LDKQuantity *ret_copy = MALLOC(sizeof(LDKQuantity), "LDKQuantity");
65913         *ret_copy = Quantity_unbounded();
65914         int64_t ret_ref = tag_ptr(ret_copy, true);
65915         return ret_ref;
65916 }
65917
65918 int64_t  CS_LDK_Quantity_one() {
65919         LDKQuantity *ret_copy = MALLOC(sizeof(LDKQuantity), "LDKQuantity");
65920         *ret_copy = Quantity_one();
65921         int64_t ret_ref = tag_ptr(ret_copy, true);
65922         return ret_ref;
65923 }
65924
65925 int64_t  CS_LDK_Offer_from_str(jstring s) {
65926         LDKStr s_conv = str_ref_to_owned_c(s);
65927         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
65928         *ret_conv = Offer_from_str(s_conv);
65929         return tag_ptr(ret_conv, true);
65930 }
65931
65932 jstring  CS_LDK_Offer_to_str(int64_t o) {
65933         LDKOffer o_conv;
65934         o_conv.inner = untag_ptr(o);
65935         o_conv.is_owned = ptr_is_owned(o);
65936         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
65937         o_conv.is_owned = false;
65938         LDKStr ret_str = Offer_to_str(&o_conv);
65939         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
65940         Str_free(ret_str);
65941         return ret_conv;
65942 }
65943
65944 void  CS_LDK_InvoiceWithExplicitSigningPubkeyBuilder_free(int64_t this_obj) {
65945         LDKInvoiceWithExplicitSigningPubkeyBuilder this_obj_conv;
65946         this_obj_conv.inner = untag_ptr(this_obj);
65947         this_obj_conv.is_owned = ptr_is_owned(this_obj);
65948         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
65949         InvoiceWithExplicitSigningPubkeyBuilder_free(this_obj_conv);
65950 }
65951
65952 void  CS_LDK_InvoiceWithDerivedSigningPubkeyBuilder_free(int64_t this_obj) {
65953         LDKInvoiceWithDerivedSigningPubkeyBuilder this_obj_conv;
65954         this_obj_conv.inner = untag_ptr(this_obj);
65955         this_obj_conv.is_owned = ptr_is_owned(this_obj);
65956         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
65957         InvoiceWithDerivedSigningPubkeyBuilder_free(this_obj_conv);
65958 }
65959
65960 int64_t  CS_LDK_InvoiceWithExplicitSigningPubkeyBuilder_build(int64_t this_arg) {
65961         LDKInvoiceWithExplicitSigningPubkeyBuilder this_arg_conv;
65962         this_arg_conv.inner = untag_ptr(this_arg);
65963         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65964         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65965         // WARNING: we need a move here but no clone is available for LDKInvoiceWithExplicitSigningPubkeyBuilder
65966         
65967         LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ), "LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ");
65968         *ret_conv = InvoiceWithExplicitSigningPubkeyBuilder_build(this_arg_conv);
65969         return tag_ptr(ret_conv, true);
65970 }
65971
65972 void  CS_LDK_InvoiceWithExplicitSigningPubkeyBuilder_relative_expiry(int64_t this_arg, int32_t relative_expiry_secs) {
65973         LDKInvoiceWithExplicitSigningPubkeyBuilder this_arg_conv;
65974         this_arg_conv.inner = untag_ptr(this_arg);
65975         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65976         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65977         // WARNING: we need a move here but no clone is available for LDKInvoiceWithExplicitSigningPubkeyBuilder
65978         
65979         InvoiceWithExplicitSigningPubkeyBuilder_relative_expiry(this_arg_conv, relative_expiry_secs);
65980 }
65981
65982 void  CS_LDK_InvoiceWithExplicitSigningPubkeyBuilder_fallback_v0_p2wsh(int64_t this_arg, int8_tArray script_hash) {
65983         LDKInvoiceWithExplicitSigningPubkeyBuilder this_arg_conv;
65984         this_arg_conv.inner = untag_ptr(this_arg);
65985         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65986         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65987         // WARNING: we need a move here but no clone is available for LDKInvoiceWithExplicitSigningPubkeyBuilder
65988         
65989         uint8_t script_hash_arr[32];
65990         CHECK(script_hash->arr_len == 32);
65991         memcpy(script_hash_arr, script_hash->elems, 32); FREE(script_hash);
65992         uint8_t (*script_hash_ref)[32] = &script_hash_arr;
65993         InvoiceWithExplicitSigningPubkeyBuilder_fallback_v0_p2wsh(this_arg_conv, script_hash_ref);
65994 }
65995
65996 void  CS_LDK_InvoiceWithExplicitSigningPubkeyBuilder_fallback_v0_p2wpkh(int64_t this_arg, int8_tArray pubkey_hash) {
65997         LDKInvoiceWithExplicitSigningPubkeyBuilder this_arg_conv;
65998         this_arg_conv.inner = untag_ptr(this_arg);
65999         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66000         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66001         // WARNING: we need a move here but no clone is available for LDKInvoiceWithExplicitSigningPubkeyBuilder
66002         
66003         uint8_t pubkey_hash_arr[20];
66004         CHECK(pubkey_hash->arr_len == 20);
66005         memcpy(pubkey_hash_arr, pubkey_hash->elems, 20); FREE(pubkey_hash);
66006         uint8_t (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
66007         InvoiceWithExplicitSigningPubkeyBuilder_fallback_v0_p2wpkh(this_arg_conv, pubkey_hash_ref);
66008 }
66009
66010 void  CS_LDK_InvoiceWithExplicitSigningPubkeyBuilder_fallback_v1_p2tr_tweaked(int64_t this_arg, int8_tArray utput_key) {
66011         LDKInvoiceWithExplicitSigningPubkeyBuilder this_arg_conv;
66012         this_arg_conv.inner = untag_ptr(this_arg);
66013         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66014         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66015         // WARNING: we need a move here but no clone is available for LDKInvoiceWithExplicitSigningPubkeyBuilder
66016         
66017         LDKTweakedPublicKey utput_key_ref;
66018         CHECK(utput_key->arr_len == 32);
66019         memcpy(utput_key_ref.x_coordinate, utput_key->elems, 32); FREE(utput_key);
66020         InvoiceWithExplicitSigningPubkeyBuilder_fallback_v1_p2tr_tweaked(this_arg_conv, utput_key_ref);
66021 }
66022
66023 void  CS_LDK_InvoiceWithExplicitSigningPubkeyBuilder_allow_mpp(int64_t this_arg) {
66024         LDKInvoiceWithExplicitSigningPubkeyBuilder this_arg_conv;
66025         this_arg_conv.inner = untag_ptr(this_arg);
66026         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66027         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66028         // WARNING: we need a move here but no clone is available for LDKInvoiceWithExplicitSigningPubkeyBuilder
66029         
66030         InvoiceWithExplicitSigningPubkeyBuilder_allow_mpp(this_arg_conv);
66031 }
66032
66033 int64_t  CS_LDK_InvoiceWithDerivedSigningPubkeyBuilder_build_and_sign(int64_t this_arg) {
66034         LDKInvoiceWithDerivedSigningPubkeyBuilder this_arg_conv;
66035         this_arg_conv.inner = untag_ptr(this_arg);
66036         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66037         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66038         // WARNING: we need a move here but no clone is available for LDKInvoiceWithDerivedSigningPubkeyBuilder
66039         
66040         LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ), "LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ");
66041         *ret_conv = InvoiceWithDerivedSigningPubkeyBuilder_build_and_sign(this_arg_conv);
66042         return tag_ptr(ret_conv, true);
66043 }
66044
66045 void  CS_LDK_InvoiceWithDerivedSigningPubkeyBuilder_relative_expiry(int64_t this_arg, int32_t relative_expiry_secs) {
66046         LDKInvoiceWithDerivedSigningPubkeyBuilder this_arg_conv;
66047         this_arg_conv.inner = untag_ptr(this_arg);
66048         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66049         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66050         // WARNING: we need a move here but no clone is available for LDKInvoiceWithDerivedSigningPubkeyBuilder
66051         
66052         InvoiceWithDerivedSigningPubkeyBuilder_relative_expiry(this_arg_conv, relative_expiry_secs);
66053 }
66054
66055 void  CS_LDK_InvoiceWithDerivedSigningPubkeyBuilder_fallback_v0_p2wsh(int64_t this_arg, int8_tArray script_hash) {
66056         LDKInvoiceWithDerivedSigningPubkeyBuilder this_arg_conv;
66057         this_arg_conv.inner = untag_ptr(this_arg);
66058         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66059         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66060         // WARNING: we need a move here but no clone is available for LDKInvoiceWithDerivedSigningPubkeyBuilder
66061         
66062         uint8_t script_hash_arr[32];
66063         CHECK(script_hash->arr_len == 32);
66064         memcpy(script_hash_arr, script_hash->elems, 32); FREE(script_hash);
66065         uint8_t (*script_hash_ref)[32] = &script_hash_arr;
66066         InvoiceWithDerivedSigningPubkeyBuilder_fallback_v0_p2wsh(this_arg_conv, script_hash_ref);
66067 }
66068
66069 void  CS_LDK_InvoiceWithDerivedSigningPubkeyBuilder_fallback_v0_p2wpkh(int64_t this_arg, int8_tArray pubkey_hash) {
66070         LDKInvoiceWithDerivedSigningPubkeyBuilder this_arg_conv;
66071         this_arg_conv.inner = untag_ptr(this_arg);
66072         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66073         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66074         // WARNING: we need a move here but no clone is available for LDKInvoiceWithDerivedSigningPubkeyBuilder
66075         
66076         uint8_t pubkey_hash_arr[20];
66077         CHECK(pubkey_hash->arr_len == 20);
66078         memcpy(pubkey_hash_arr, pubkey_hash->elems, 20); FREE(pubkey_hash);
66079         uint8_t (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
66080         InvoiceWithDerivedSigningPubkeyBuilder_fallback_v0_p2wpkh(this_arg_conv, pubkey_hash_ref);
66081 }
66082
66083 void  CS_LDK_InvoiceWithDerivedSigningPubkeyBuilder_fallback_v1_p2tr_tweaked(int64_t this_arg, int8_tArray utput_key) {
66084         LDKInvoiceWithDerivedSigningPubkeyBuilder this_arg_conv;
66085         this_arg_conv.inner = untag_ptr(this_arg);
66086         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66087         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66088         // WARNING: we need a move here but no clone is available for LDKInvoiceWithDerivedSigningPubkeyBuilder
66089         
66090         LDKTweakedPublicKey utput_key_ref;
66091         CHECK(utput_key->arr_len == 32);
66092         memcpy(utput_key_ref.x_coordinate, utput_key->elems, 32); FREE(utput_key);
66093         InvoiceWithDerivedSigningPubkeyBuilder_fallback_v1_p2tr_tweaked(this_arg_conv, utput_key_ref);
66094 }
66095
66096 void  CS_LDK_InvoiceWithDerivedSigningPubkeyBuilder_allow_mpp(int64_t this_arg) {
66097         LDKInvoiceWithDerivedSigningPubkeyBuilder this_arg_conv;
66098         this_arg_conv.inner = untag_ptr(this_arg);
66099         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66100         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66101         // WARNING: we need a move here but no clone is available for LDKInvoiceWithDerivedSigningPubkeyBuilder
66102         
66103         InvoiceWithDerivedSigningPubkeyBuilder_allow_mpp(this_arg_conv);
66104 }
66105
66106 void  CS_LDK_UnsignedBolt12Invoice_free(int64_t this_obj) {
66107         LDKUnsignedBolt12Invoice this_obj_conv;
66108         this_obj_conv.inner = untag_ptr(this_obj);
66109         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66110         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66111         UnsignedBolt12Invoice_free(this_obj_conv);
66112 }
66113
66114 static inline uint64_t UnsignedBolt12Invoice_clone_ptr(LDKUnsignedBolt12Invoice *NONNULL_PTR arg) {
66115         LDKUnsignedBolt12Invoice ret_var = UnsignedBolt12Invoice_clone(arg);
66116         int64_t ret_ref = 0;
66117         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66118         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66119         return ret_ref;
66120 }
66121 int64_t  CS_LDK_UnsignedBolt12Invoice_clone_ptr(int64_t arg) {
66122         LDKUnsignedBolt12Invoice arg_conv;
66123         arg_conv.inner = untag_ptr(arg);
66124         arg_conv.is_owned = ptr_is_owned(arg);
66125         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
66126         arg_conv.is_owned = false;
66127         int64_t ret_conv = UnsignedBolt12Invoice_clone_ptr(&arg_conv);
66128         return ret_conv;
66129 }
66130
66131 int64_t  CS_LDK_UnsignedBolt12Invoice_clone(int64_t orig) {
66132         LDKUnsignedBolt12Invoice orig_conv;
66133         orig_conv.inner = untag_ptr(orig);
66134         orig_conv.is_owned = ptr_is_owned(orig);
66135         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
66136         orig_conv.is_owned = false;
66137         LDKUnsignedBolt12Invoice ret_var = UnsignedBolt12Invoice_clone(&orig_conv);
66138         int64_t ret_ref = 0;
66139         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66140         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66141         return ret_ref;
66142 }
66143
66144 void  CS_LDK_SignBolt12InvoiceFn_free(int64_t this_ptr) {
66145         if (!ptr_is_owned(this_ptr)) return;
66146         void* this_ptr_ptr = untag_ptr(this_ptr);
66147         CHECK_ACCESS(this_ptr_ptr);
66148         LDKSignBolt12InvoiceFn this_ptr_conv = *(LDKSignBolt12InvoiceFn*)(this_ptr_ptr);
66149         FREE(untag_ptr(this_ptr));
66150         SignBolt12InvoiceFn_free(this_ptr_conv);
66151 }
66152
66153 int64_t  CS_LDK_UnsignedBolt12Invoice_tagged_hash(int64_t this_arg) {
66154         LDKUnsignedBolt12Invoice this_arg_conv;
66155         this_arg_conv.inner = untag_ptr(this_arg);
66156         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66157         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66158         this_arg_conv.is_owned = false;
66159         LDKTaggedHash ret_var = UnsignedBolt12Invoice_tagged_hash(&this_arg_conv);
66160         int64_t ret_ref = 0;
66161         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66162         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66163         return ret_ref;
66164 }
66165
66166 void  CS_LDK_Bolt12Invoice_free(int64_t this_obj) {
66167         LDKBolt12Invoice this_obj_conv;
66168         this_obj_conv.inner = untag_ptr(this_obj);
66169         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66170         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66171         Bolt12Invoice_free(this_obj_conv);
66172 }
66173
66174 static inline uint64_t Bolt12Invoice_clone_ptr(LDKBolt12Invoice *NONNULL_PTR arg) {
66175         LDKBolt12Invoice ret_var = Bolt12Invoice_clone(arg);
66176         int64_t ret_ref = 0;
66177         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66178         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66179         return ret_ref;
66180 }
66181 int64_t  CS_LDK_Bolt12Invoice_clone_ptr(int64_t arg) {
66182         LDKBolt12Invoice arg_conv;
66183         arg_conv.inner = untag_ptr(arg);
66184         arg_conv.is_owned = ptr_is_owned(arg);
66185         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
66186         arg_conv.is_owned = false;
66187         int64_t ret_conv = Bolt12Invoice_clone_ptr(&arg_conv);
66188         return ret_conv;
66189 }
66190
66191 int64_t  CS_LDK_Bolt12Invoice_clone(int64_t orig) {
66192         LDKBolt12Invoice orig_conv;
66193         orig_conv.inner = untag_ptr(orig);
66194         orig_conv.is_owned = ptr_is_owned(orig);
66195         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
66196         orig_conv.is_owned = false;
66197         LDKBolt12Invoice ret_var = Bolt12Invoice_clone(&orig_conv);
66198         int64_t ret_ref = 0;
66199         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66200         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66201         return ret_ref;
66202 }
66203
66204 int64_t  CS_LDK_UnsignedBolt12Invoice_offer_chains(int64_t this_arg) {
66205         LDKUnsignedBolt12Invoice this_arg_conv;
66206         this_arg_conv.inner = untag_ptr(this_arg);
66207         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66208         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66209         this_arg_conv.is_owned = false;
66210         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
66211         *ret_copy = UnsignedBolt12Invoice_offer_chains(&this_arg_conv);
66212         int64_t ret_ref = tag_ptr(ret_copy, true);
66213         return ret_ref;
66214 }
66215
66216 int8_tArray  CS_LDK_UnsignedBolt12Invoice_chain(int64_t this_arg) {
66217         LDKUnsignedBolt12Invoice this_arg_conv;
66218         this_arg_conv.inner = untag_ptr(this_arg);
66219         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66220         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66221         this_arg_conv.is_owned = false;
66222         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
66223         memcpy(ret_arr->elems, UnsignedBolt12Invoice_chain(&this_arg_conv).data, 32);
66224         return ret_arr;
66225 }
66226
66227 int64_t  CS_LDK_UnsignedBolt12Invoice_metadata(int64_t this_arg) {
66228         LDKUnsignedBolt12Invoice this_arg_conv;
66229         this_arg_conv.inner = untag_ptr(this_arg);
66230         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66231         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66232         this_arg_conv.is_owned = false;
66233         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
66234         *ret_copy = UnsignedBolt12Invoice_metadata(&this_arg_conv);
66235         int64_t ret_ref = tag_ptr(ret_copy, true);
66236         return ret_ref;
66237 }
66238
66239 int64_t  CS_LDK_UnsignedBolt12Invoice_amount(int64_t this_arg) {
66240         LDKUnsignedBolt12Invoice this_arg_conv;
66241         this_arg_conv.inner = untag_ptr(this_arg);
66242         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66243         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66244         this_arg_conv.is_owned = false;
66245         LDKCOption_AmountZ *ret_copy = MALLOC(sizeof(LDKCOption_AmountZ), "LDKCOption_AmountZ");
66246         *ret_copy = UnsignedBolt12Invoice_amount(&this_arg_conv);
66247         int64_t ret_ref = tag_ptr(ret_copy, true);
66248         return ret_ref;
66249 }
66250
66251 int64_t  CS_LDK_UnsignedBolt12Invoice_offer_features(int64_t this_arg) {
66252         LDKUnsignedBolt12Invoice this_arg_conv;
66253         this_arg_conv.inner = untag_ptr(this_arg);
66254         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66255         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66256         this_arg_conv.is_owned = false;
66257         LDKOfferFeatures ret_var = UnsignedBolt12Invoice_offer_features(&this_arg_conv);
66258         int64_t ret_ref = 0;
66259         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66260         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66261         return ret_ref;
66262 }
66263
66264 int64_t  CS_LDK_UnsignedBolt12Invoice_description(int64_t this_arg) {
66265         LDKUnsignedBolt12Invoice this_arg_conv;
66266         this_arg_conv.inner = untag_ptr(this_arg);
66267         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66268         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66269         this_arg_conv.is_owned = false;
66270         LDKPrintableString ret_var = UnsignedBolt12Invoice_description(&this_arg_conv);
66271         int64_t ret_ref = 0;
66272         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66273         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66274         return ret_ref;
66275 }
66276
66277 int64_t  CS_LDK_UnsignedBolt12Invoice_absolute_expiry(int64_t this_arg) {
66278         LDKUnsignedBolt12Invoice this_arg_conv;
66279         this_arg_conv.inner = untag_ptr(this_arg);
66280         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66281         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66282         this_arg_conv.is_owned = false;
66283         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
66284         *ret_copy = UnsignedBolt12Invoice_absolute_expiry(&this_arg_conv);
66285         int64_t ret_ref = tag_ptr(ret_copy, true);
66286         return ret_ref;
66287 }
66288
66289 int64_t  CS_LDK_UnsignedBolt12Invoice_issuer(int64_t this_arg) {
66290         LDKUnsignedBolt12Invoice this_arg_conv;
66291         this_arg_conv.inner = untag_ptr(this_arg);
66292         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66293         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66294         this_arg_conv.is_owned = false;
66295         LDKPrintableString ret_var = UnsignedBolt12Invoice_issuer(&this_arg_conv);
66296         int64_t ret_ref = 0;
66297         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66298         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66299         return ret_ref;
66300 }
66301
66302 int64_tArray  CS_LDK_UnsignedBolt12Invoice_message_paths(int64_t this_arg) {
66303         LDKUnsignedBolt12Invoice this_arg_conv;
66304         this_arg_conv.inner = untag_ptr(this_arg);
66305         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66306         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66307         this_arg_conv.is_owned = false;
66308         LDKCVec_BlindedPathZ ret_var = UnsignedBolt12Invoice_message_paths(&this_arg_conv);
66309         int64_tArray ret_arr = NULL;
66310         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
66311         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
66312         for (size_t n = 0; n < ret_var.datalen; n++) {
66313                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
66314                 int64_t ret_conv_13_ref = 0;
66315                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
66316                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
66317                 ret_arr_ptr[n] = ret_conv_13_ref;
66318         }
66319         
66320         FREE(ret_var.data);
66321         return ret_arr;
66322 }
66323
66324 int64_t  CS_LDK_UnsignedBolt12Invoice_supported_quantity(int64_t this_arg) {
66325         LDKUnsignedBolt12Invoice this_arg_conv;
66326         this_arg_conv.inner = untag_ptr(this_arg);
66327         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66328         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66329         this_arg_conv.is_owned = false;
66330         LDKCOption_QuantityZ *ret_copy = MALLOC(sizeof(LDKCOption_QuantityZ), "LDKCOption_QuantityZ");
66331         *ret_copy = UnsignedBolt12Invoice_supported_quantity(&this_arg_conv);
66332         int64_t ret_ref = tag_ptr(ret_copy, true);
66333         return ret_ref;
66334 }
66335
66336 int8_tArray  CS_LDK_UnsignedBolt12Invoice_payer_metadata(int64_t this_arg) {
66337         LDKUnsignedBolt12Invoice this_arg_conv;
66338         this_arg_conv.inner = untag_ptr(this_arg);
66339         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66340         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66341         this_arg_conv.is_owned = false;
66342         LDKu8slice ret_var = UnsignedBolt12Invoice_payer_metadata(&this_arg_conv);
66343         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
66344         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
66345         return ret_arr;
66346 }
66347
66348 int64_t  CS_LDK_UnsignedBolt12Invoice_invoice_request_features(int64_t this_arg) {
66349         LDKUnsignedBolt12Invoice this_arg_conv;
66350         this_arg_conv.inner = untag_ptr(this_arg);
66351         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66352         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66353         this_arg_conv.is_owned = false;
66354         LDKInvoiceRequestFeatures ret_var = UnsignedBolt12Invoice_invoice_request_features(&this_arg_conv);
66355         int64_t ret_ref = 0;
66356         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66357         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66358         return ret_ref;
66359 }
66360
66361 int64_t  CS_LDK_UnsignedBolt12Invoice_quantity(int64_t this_arg) {
66362         LDKUnsignedBolt12Invoice this_arg_conv;
66363         this_arg_conv.inner = untag_ptr(this_arg);
66364         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66365         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66366         this_arg_conv.is_owned = false;
66367         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
66368         *ret_copy = UnsignedBolt12Invoice_quantity(&this_arg_conv);
66369         int64_t ret_ref = tag_ptr(ret_copy, true);
66370         return ret_ref;
66371 }
66372
66373 int8_tArray  CS_LDK_UnsignedBolt12Invoice_payer_id(int64_t this_arg) {
66374         LDKUnsignedBolt12Invoice this_arg_conv;
66375         this_arg_conv.inner = untag_ptr(this_arg);
66376         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66377         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66378         this_arg_conv.is_owned = false;
66379         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
66380         memcpy(ret_arr->elems, UnsignedBolt12Invoice_payer_id(&this_arg_conv).compressed_form, 33);
66381         return ret_arr;
66382 }
66383
66384 int64_t  CS_LDK_UnsignedBolt12Invoice_payer_note(int64_t this_arg) {
66385         LDKUnsignedBolt12Invoice this_arg_conv;
66386         this_arg_conv.inner = untag_ptr(this_arg);
66387         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66388         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66389         this_arg_conv.is_owned = false;
66390         LDKPrintableString ret_var = UnsignedBolt12Invoice_payer_note(&this_arg_conv);
66391         int64_t ret_ref = 0;
66392         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66393         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66394         return ret_ref;
66395 }
66396
66397 int64_t  CS_LDK_UnsignedBolt12Invoice_created_at(int64_t this_arg) {
66398         LDKUnsignedBolt12Invoice this_arg_conv;
66399         this_arg_conv.inner = untag_ptr(this_arg);
66400         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66401         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66402         this_arg_conv.is_owned = false;
66403         int64_t ret_conv = UnsignedBolt12Invoice_created_at(&this_arg_conv);
66404         return ret_conv;
66405 }
66406
66407 int64_t  CS_LDK_UnsignedBolt12Invoice_relative_expiry(int64_t this_arg) {
66408         LDKUnsignedBolt12Invoice this_arg_conv;
66409         this_arg_conv.inner = untag_ptr(this_arg);
66410         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66411         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66412         this_arg_conv.is_owned = false;
66413         int64_t ret_conv = UnsignedBolt12Invoice_relative_expiry(&this_arg_conv);
66414         return ret_conv;
66415 }
66416
66417 jboolean  CS_LDK_UnsignedBolt12Invoice_is_expired(int64_t this_arg) {
66418         LDKUnsignedBolt12Invoice this_arg_conv;
66419         this_arg_conv.inner = untag_ptr(this_arg);
66420         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66421         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66422         this_arg_conv.is_owned = false;
66423         jboolean ret_conv = UnsignedBolt12Invoice_is_expired(&this_arg_conv);
66424         return ret_conv;
66425 }
66426
66427 int8_tArray  CS_LDK_UnsignedBolt12Invoice_payment_hash(int64_t this_arg) {
66428         LDKUnsignedBolt12Invoice this_arg_conv;
66429         this_arg_conv.inner = untag_ptr(this_arg);
66430         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66431         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66432         this_arg_conv.is_owned = false;
66433         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
66434         memcpy(ret_arr->elems, UnsignedBolt12Invoice_payment_hash(&this_arg_conv).data, 32);
66435         return ret_arr;
66436 }
66437
66438 int64_t  CS_LDK_UnsignedBolt12Invoice_amount_msats(int64_t this_arg) {
66439         LDKUnsignedBolt12Invoice this_arg_conv;
66440         this_arg_conv.inner = untag_ptr(this_arg);
66441         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66442         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66443         this_arg_conv.is_owned = false;
66444         int64_t ret_conv = UnsignedBolt12Invoice_amount_msats(&this_arg_conv);
66445         return ret_conv;
66446 }
66447
66448 int64_t  CS_LDK_UnsignedBolt12Invoice_invoice_features(int64_t this_arg) {
66449         LDKUnsignedBolt12Invoice this_arg_conv;
66450         this_arg_conv.inner = untag_ptr(this_arg);
66451         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66452         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66453         this_arg_conv.is_owned = false;
66454         LDKBolt12InvoiceFeatures ret_var = UnsignedBolt12Invoice_invoice_features(&this_arg_conv);
66455         int64_t ret_ref = 0;
66456         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66457         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66458         return ret_ref;
66459 }
66460
66461 int8_tArray  CS_LDK_UnsignedBolt12Invoice_signing_pubkey(int64_t this_arg) {
66462         LDKUnsignedBolt12Invoice this_arg_conv;
66463         this_arg_conv.inner = untag_ptr(this_arg);
66464         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66465         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66466         this_arg_conv.is_owned = false;
66467         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
66468         memcpy(ret_arr->elems, UnsignedBolt12Invoice_signing_pubkey(&this_arg_conv).compressed_form, 33);
66469         return ret_arr;
66470 }
66471
66472 int64_t  CS_LDK_Bolt12Invoice_offer_chains(int64_t this_arg) {
66473         LDKBolt12Invoice this_arg_conv;
66474         this_arg_conv.inner = untag_ptr(this_arg);
66475         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66476         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66477         this_arg_conv.is_owned = false;
66478         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
66479         *ret_copy = Bolt12Invoice_offer_chains(&this_arg_conv);
66480         int64_t ret_ref = tag_ptr(ret_copy, true);
66481         return ret_ref;
66482 }
66483
66484 int8_tArray  CS_LDK_Bolt12Invoice_chain(int64_t this_arg) {
66485         LDKBolt12Invoice this_arg_conv;
66486         this_arg_conv.inner = untag_ptr(this_arg);
66487         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66488         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66489         this_arg_conv.is_owned = false;
66490         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
66491         memcpy(ret_arr->elems, Bolt12Invoice_chain(&this_arg_conv).data, 32);
66492         return ret_arr;
66493 }
66494
66495 int64_t  CS_LDK_Bolt12Invoice_metadata(int64_t this_arg) {
66496         LDKBolt12Invoice this_arg_conv;
66497         this_arg_conv.inner = untag_ptr(this_arg);
66498         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66499         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66500         this_arg_conv.is_owned = false;
66501         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
66502         *ret_copy = Bolt12Invoice_metadata(&this_arg_conv);
66503         int64_t ret_ref = tag_ptr(ret_copy, true);
66504         return ret_ref;
66505 }
66506
66507 int64_t  CS_LDK_Bolt12Invoice_amount(int64_t this_arg) {
66508         LDKBolt12Invoice this_arg_conv;
66509         this_arg_conv.inner = untag_ptr(this_arg);
66510         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66511         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66512         this_arg_conv.is_owned = false;
66513         LDKCOption_AmountZ *ret_copy = MALLOC(sizeof(LDKCOption_AmountZ), "LDKCOption_AmountZ");
66514         *ret_copy = Bolt12Invoice_amount(&this_arg_conv);
66515         int64_t ret_ref = tag_ptr(ret_copy, true);
66516         return ret_ref;
66517 }
66518
66519 int64_t  CS_LDK_Bolt12Invoice_offer_features(int64_t this_arg) {
66520         LDKBolt12Invoice this_arg_conv;
66521         this_arg_conv.inner = untag_ptr(this_arg);
66522         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66523         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66524         this_arg_conv.is_owned = false;
66525         LDKOfferFeatures ret_var = Bolt12Invoice_offer_features(&this_arg_conv);
66526         int64_t ret_ref = 0;
66527         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66528         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66529         return ret_ref;
66530 }
66531
66532 int64_t  CS_LDK_Bolt12Invoice_description(int64_t this_arg) {
66533         LDKBolt12Invoice this_arg_conv;
66534         this_arg_conv.inner = untag_ptr(this_arg);
66535         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66536         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66537         this_arg_conv.is_owned = false;
66538         LDKPrintableString ret_var = Bolt12Invoice_description(&this_arg_conv);
66539         int64_t ret_ref = 0;
66540         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66541         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66542         return ret_ref;
66543 }
66544
66545 int64_t  CS_LDK_Bolt12Invoice_absolute_expiry(int64_t this_arg) {
66546         LDKBolt12Invoice this_arg_conv;
66547         this_arg_conv.inner = untag_ptr(this_arg);
66548         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66549         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66550         this_arg_conv.is_owned = false;
66551         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
66552         *ret_copy = Bolt12Invoice_absolute_expiry(&this_arg_conv);
66553         int64_t ret_ref = tag_ptr(ret_copy, true);
66554         return ret_ref;
66555 }
66556
66557 int64_t  CS_LDK_Bolt12Invoice_issuer(int64_t this_arg) {
66558         LDKBolt12Invoice this_arg_conv;
66559         this_arg_conv.inner = untag_ptr(this_arg);
66560         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66561         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66562         this_arg_conv.is_owned = false;
66563         LDKPrintableString ret_var = Bolt12Invoice_issuer(&this_arg_conv);
66564         int64_t ret_ref = 0;
66565         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66566         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66567         return ret_ref;
66568 }
66569
66570 int64_tArray  CS_LDK_Bolt12Invoice_message_paths(int64_t this_arg) {
66571         LDKBolt12Invoice this_arg_conv;
66572         this_arg_conv.inner = untag_ptr(this_arg);
66573         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66574         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66575         this_arg_conv.is_owned = false;
66576         LDKCVec_BlindedPathZ ret_var = Bolt12Invoice_message_paths(&this_arg_conv);
66577         int64_tArray ret_arr = NULL;
66578         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
66579         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
66580         for (size_t n = 0; n < ret_var.datalen; n++) {
66581                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
66582                 int64_t ret_conv_13_ref = 0;
66583                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
66584                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
66585                 ret_arr_ptr[n] = ret_conv_13_ref;
66586         }
66587         
66588         FREE(ret_var.data);
66589         return ret_arr;
66590 }
66591
66592 int64_t  CS_LDK_Bolt12Invoice_supported_quantity(int64_t this_arg) {
66593         LDKBolt12Invoice this_arg_conv;
66594         this_arg_conv.inner = untag_ptr(this_arg);
66595         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66596         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66597         this_arg_conv.is_owned = false;
66598         LDKCOption_QuantityZ *ret_copy = MALLOC(sizeof(LDKCOption_QuantityZ), "LDKCOption_QuantityZ");
66599         *ret_copy = Bolt12Invoice_supported_quantity(&this_arg_conv);
66600         int64_t ret_ref = tag_ptr(ret_copy, true);
66601         return ret_ref;
66602 }
66603
66604 int8_tArray  CS_LDK_Bolt12Invoice_payer_metadata(int64_t this_arg) {
66605         LDKBolt12Invoice this_arg_conv;
66606         this_arg_conv.inner = untag_ptr(this_arg);
66607         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66608         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66609         this_arg_conv.is_owned = false;
66610         LDKu8slice ret_var = Bolt12Invoice_payer_metadata(&this_arg_conv);
66611         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
66612         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
66613         return ret_arr;
66614 }
66615
66616 int64_t  CS_LDK_Bolt12Invoice_invoice_request_features(int64_t this_arg) {
66617         LDKBolt12Invoice this_arg_conv;
66618         this_arg_conv.inner = untag_ptr(this_arg);
66619         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66620         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66621         this_arg_conv.is_owned = false;
66622         LDKInvoiceRequestFeatures ret_var = Bolt12Invoice_invoice_request_features(&this_arg_conv);
66623         int64_t ret_ref = 0;
66624         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66625         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66626         return ret_ref;
66627 }
66628
66629 int64_t  CS_LDK_Bolt12Invoice_quantity(int64_t this_arg) {
66630         LDKBolt12Invoice this_arg_conv;
66631         this_arg_conv.inner = untag_ptr(this_arg);
66632         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66633         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66634         this_arg_conv.is_owned = false;
66635         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
66636         *ret_copy = Bolt12Invoice_quantity(&this_arg_conv);
66637         int64_t ret_ref = tag_ptr(ret_copy, true);
66638         return ret_ref;
66639 }
66640
66641 int8_tArray  CS_LDK_Bolt12Invoice_payer_id(int64_t this_arg) {
66642         LDKBolt12Invoice this_arg_conv;
66643         this_arg_conv.inner = untag_ptr(this_arg);
66644         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66645         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66646         this_arg_conv.is_owned = false;
66647         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
66648         memcpy(ret_arr->elems, Bolt12Invoice_payer_id(&this_arg_conv).compressed_form, 33);
66649         return ret_arr;
66650 }
66651
66652 int64_t  CS_LDK_Bolt12Invoice_payer_note(int64_t this_arg) {
66653         LDKBolt12Invoice this_arg_conv;
66654         this_arg_conv.inner = untag_ptr(this_arg);
66655         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66656         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66657         this_arg_conv.is_owned = false;
66658         LDKPrintableString ret_var = Bolt12Invoice_payer_note(&this_arg_conv);
66659         int64_t ret_ref = 0;
66660         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66661         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66662         return ret_ref;
66663 }
66664
66665 int64_t  CS_LDK_Bolt12Invoice_created_at(int64_t this_arg) {
66666         LDKBolt12Invoice this_arg_conv;
66667         this_arg_conv.inner = untag_ptr(this_arg);
66668         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66669         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66670         this_arg_conv.is_owned = false;
66671         int64_t ret_conv = Bolt12Invoice_created_at(&this_arg_conv);
66672         return ret_conv;
66673 }
66674
66675 int64_t  CS_LDK_Bolt12Invoice_relative_expiry(int64_t this_arg) {
66676         LDKBolt12Invoice this_arg_conv;
66677         this_arg_conv.inner = untag_ptr(this_arg);
66678         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66679         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66680         this_arg_conv.is_owned = false;
66681         int64_t ret_conv = Bolt12Invoice_relative_expiry(&this_arg_conv);
66682         return ret_conv;
66683 }
66684
66685 jboolean  CS_LDK_Bolt12Invoice_is_expired(int64_t this_arg) {
66686         LDKBolt12Invoice this_arg_conv;
66687         this_arg_conv.inner = untag_ptr(this_arg);
66688         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66689         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66690         this_arg_conv.is_owned = false;
66691         jboolean ret_conv = Bolt12Invoice_is_expired(&this_arg_conv);
66692         return ret_conv;
66693 }
66694
66695 int8_tArray  CS_LDK_Bolt12Invoice_payment_hash(int64_t this_arg) {
66696         LDKBolt12Invoice this_arg_conv;
66697         this_arg_conv.inner = untag_ptr(this_arg);
66698         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66699         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66700         this_arg_conv.is_owned = false;
66701         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
66702         memcpy(ret_arr->elems, Bolt12Invoice_payment_hash(&this_arg_conv).data, 32);
66703         return ret_arr;
66704 }
66705
66706 int64_t  CS_LDK_Bolt12Invoice_amount_msats(int64_t this_arg) {
66707         LDKBolt12Invoice this_arg_conv;
66708         this_arg_conv.inner = untag_ptr(this_arg);
66709         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66710         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66711         this_arg_conv.is_owned = false;
66712         int64_t ret_conv = Bolt12Invoice_amount_msats(&this_arg_conv);
66713         return ret_conv;
66714 }
66715
66716 int64_t  CS_LDK_Bolt12Invoice_invoice_features(int64_t this_arg) {
66717         LDKBolt12Invoice this_arg_conv;
66718         this_arg_conv.inner = untag_ptr(this_arg);
66719         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66720         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66721         this_arg_conv.is_owned = false;
66722         LDKBolt12InvoiceFeatures ret_var = Bolt12Invoice_invoice_features(&this_arg_conv);
66723         int64_t ret_ref = 0;
66724         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66725         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66726         return ret_ref;
66727 }
66728
66729 int8_tArray  CS_LDK_Bolt12Invoice_signing_pubkey(int64_t this_arg) {
66730         LDKBolt12Invoice this_arg_conv;
66731         this_arg_conv.inner = untag_ptr(this_arg);
66732         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66733         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66734         this_arg_conv.is_owned = false;
66735         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
66736         memcpy(ret_arr->elems, Bolt12Invoice_signing_pubkey(&this_arg_conv).compressed_form, 33);
66737         return ret_arr;
66738 }
66739
66740 int8_tArray  CS_LDK_Bolt12Invoice_signature(int64_t this_arg) {
66741         LDKBolt12Invoice this_arg_conv;
66742         this_arg_conv.inner = untag_ptr(this_arg);
66743         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66744         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66745         this_arg_conv.is_owned = false;
66746         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
66747         memcpy(ret_arr->elems, Bolt12Invoice_signature(&this_arg_conv).compact_form, 64);
66748         return ret_arr;
66749 }
66750
66751 int8_tArray  CS_LDK_Bolt12Invoice_signable_hash(int64_t this_arg) {
66752         LDKBolt12Invoice this_arg_conv;
66753         this_arg_conv.inner = untag_ptr(this_arg);
66754         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66755         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66756         this_arg_conv.is_owned = false;
66757         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
66758         memcpy(ret_arr->elems, Bolt12Invoice_signable_hash(&this_arg_conv).data, 32);
66759         return ret_arr;
66760 }
66761
66762 int64_t  CS_LDK_Bolt12Invoice_verify(int64_t this_arg, int64_t key) {
66763         LDKBolt12Invoice this_arg_conv;
66764         this_arg_conv.inner = untag_ptr(this_arg);
66765         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66766         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66767         this_arg_conv.is_owned = false;
66768         LDKExpandedKey key_conv;
66769         key_conv.inner = untag_ptr(key);
66770         key_conv.is_owned = ptr_is_owned(key);
66771         CHECK_INNER_FIELD_ACCESS_OR_NULL(key_conv);
66772         key_conv.is_owned = false;
66773         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
66774         *ret_conv = Bolt12Invoice_verify(&this_arg_conv, &key_conv);
66775         return tag_ptr(ret_conv, true);
66776 }
66777
66778 int64_t  CS_LDK_Bolt12Invoice_hash(int64_t o) {
66779         LDKBolt12Invoice o_conv;
66780         o_conv.inner = untag_ptr(o);
66781         o_conv.is_owned = ptr_is_owned(o);
66782         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
66783         o_conv.is_owned = false;
66784         int64_t ret_conv = Bolt12Invoice_hash(&o_conv);
66785         return ret_conv;
66786 }
66787
66788 int8_tArray  CS_LDK_UnsignedBolt12Invoice_write(int64_t obj) {
66789         LDKUnsignedBolt12Invoice obj_conv;
66790         obj_conv.inner = untag_ptr(obj);
66791         obj_conv.is_owned = ptr_is_owned(obj);
66792         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
66793         obj_conv.is_owned = false;
66794         LDKCVec_u8Z ret_var = UnsignedBolt12Invoice_write(&obj_conv);
66795         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
66796         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
66797         CVec_u8Z_free(ret_var);
66798         return ret_arr;
66799 }
66800
66801 int8_tArray  CS_LDK_Bolt12Invoice_write(int64_t obj) {
66802         LDKBolt12Invoice obj_conv;
66803         obj_conv.inner = untag_ptr(obj);
66804         obj_conv.is_owned = ptr_is_owned(obj);
66805         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
66806         obj_conv.is_owned = false;
66807         LDKCVec_u8Z ret_var = Bolt12Invoice_write(&obj_conv);
66808         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
66809         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
66810         CVec_u8Z_free(ret_var);
66811         return ret_arr;
66812 }
66813
66814 void  CS_LDK_BlindedPayInfo_free(int64_t this_obj) {
66815         LDKBlindedPayInfo this_obj_conv;
66816         this_obj_conv.inner = untag_ptr(this_obj);
66817         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66818         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66819         BlindedPayInfo_free(this_obj_conv);
66820 }
66821
66822 int32_t  CS_LDK_BlindedPayInfo_get_fee_base_msat(int64_t this_ptr) {
66823         LDKBlindedPayInfo this_ptr_conv;
66824         this_ptr_conv.inner = untag_ptr(this_ptr);
66825         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66826         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66827         this_ptr_conv.is_owned = false;
66828         int32_t ret_conv = BlindedPayInfo_get_fee_base_msat(&this_ptr_conv);
66829         return ret_conv;
66830 }
66831
66832 void  CS_LDK_BlindedPayInfo_set_fee_base_msat(int64_t this_ptr, int32_t val) {
66833         LDKBlindedPayInfo this_ptr_conv;
66834         this_ptr_conv.inner = untag_ptr(this_ptr);
66835         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66836         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66837         this_ptr_conv.is_owned = false;
66838         BlindedPayInfo_set_fee_base_msat(&this_ptr_conv, val);
66839 }
66840
66841 int32_t  CS_LDK_BlindedPayInfo_get_fee_proportional_millionths(int64_t this_ptr) {
66842         LDKBlindedPayInfo this_ptr_conv;
66843         this_ptr_conv.inner = untag_ptr(this_ptr);
66844         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66845         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66846         this_ptr_conv.is_owned = false;
66847         int32_t ret_conv = BlindedPayInfo_get_fee_proportional_millionths(&this_ptr_conv);
66848         return ret_conv;
66849 }
66850
66851 void  CS_LDK_BlindedPayInfo_set_fee_proportional_millionths(int64_t this_ptr, int32_t val) {
66852         LDKBlindedPayInfo this_ptr_conv;
66853         this_ptr_conv.inner = untag_ptr(this_ptr);
66854         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66855         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66856         this_ptr_conv.is_owned = false;
66857         BlindedPayInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
66858 }
66859
66860 int16_t  CS_LDK_BlindedPayInfo_get_cltv_expiry_delta(int64_t this_ptr) {
66861         LDKBlindedPayInfo this_ptr_conv;
66862         this_ptr_conv.inner = untag_ptr(this_ptr);
66863         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66864         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66865         this_ptr_conv.is_owned = false;
66866         int16_t ret_conv = BlindedPayInfo_get_cltv_expiry_delta(&this_ptr_conv);
66867         return ret_conv;
66868 }
66869
66870 void  CS_LDK_BlindedPayInfo_set_cltv_expiry_delta(int64_t this_ptr, int16_t val) {
66871         LDKBlindedPayInfo this_ptr_conv;
66872         this_ptr_conv.inner = untag_ptr(this_ptr);
66873         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66874         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66875         this_ptr_conv.is_owned = false;
66876         BlindedPayInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
66877 }
66878
66879 int64_t  CS_LDK_BlindedPayInfo_get_htlc_minimum_msat(int64_t this_ptr) {
66880         LDKBlindedPayInfo this_ptr_conv;
66881         this_ptr_conv.inner = untag_ptr(this_ptr);
66882         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66883         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66884         this_ptr_conv.is_owned = false;
66885         int64_t ret_conv = BlindedPayInfo_get_htlc_minimum_msat(&this_ptr_conv);
66886         return ret_conv;
66887 }
66888
66889 void  CS_LDK_BlindedPayInfo_set_htlc_minimum_msat(int64_t this_ptr, int64_t val) {
66890         LDKBlindedPayInfo this_ptr_conv;
66891         this_ptr_conv.inner = untag_ptr(this_ptr);
66892         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66893         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66894         this_ptr_conv.is_owned = false;
66895         BlindedPayInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
66896 }
66897
66898 int64_t  CS_LDK_BlindedPayInfo_get_htlc_maximum_msat(int64_t this_ptr) {
66899         LDKBlindedPayInfo this_ptr_conv;
66900         this_ptr_conv.inner = untag_ptr(this_ptr);
66901         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66902         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66903         this_ptr_conv.is_owned = false;
66904         int64_t ret_conv = BlindedPayInfo_get_htlc_maximum_msat(&this_ptr_conv);
66905         return ret_conv;
66906 }
66907
66908 void  CS_LDK_BlindedPayInfo_set_htlc_maximum_msat(int64_t this_ptr, int64_t val) {
66909         LDKBlindedPayInfo this_ptr_conv;
66910         this_ptr_conv.inner = untag_ptr(this_ptr);
66911         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66912         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66913         this_ptr_conv.is_owned = false;
66914         BlindedPayInfo_set_htlc_maximum_msat(&this_ptr_conv, val);
66915 }
66916
66917 int64_t  CS_LDK_BlindedPayInfo_get_features(int64_t this_ptr) {
66918         LDKBlindedPayInfo this_ptr_conv;
66919         this_ptr_conv.inner = untag_ptr(this_ptr);
66920         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66921         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66922         this_ptr_conv.is_owned = false;
66923         LDKBlindedHopFeatures ret_var = BlindedPayInfo_get_features(&this_ptr_conv);
66924         int64_t ret_ref = 0;
66925         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66926         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66927         return ret_ref;
66928 }
66929
66930 void  CS_LDK_BlindedPayInfo_set_features(int64_t this_ptr, int64_t val) {
66931         LDKBlindedPayInfo this_ptr_conv;
66932         this_ptr_conv.inner = untag_ptr(this_ptr);
66933         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66934         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66935         this_ptr_conv.is_owned = false;
66936         LDKBlindedHopFeatures val_conv;
66937         val_conv.inner = untag_ptr(val);
66938         val_conv.is_owned = ptr_is_owned(val);
66939         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
66940         val_conv = BlindedHopFeatures_clone(&val_conv);
66941         BlindedPayInfo_set_features(&this_ptr_conv, val_conv);
66942 }
66943
66944 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) {
66945         LDKBlindedHopFeatures features_arg_conv;
66946         features_arg_conv.inner = untag_ptr(features_arg);
66947         features_arg_conv.is_owned = ptr_is_owned(features_arg);
66948         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
66949         features_arg_conv = BlindedHopFeatures_clone(&features_arg_conv);
66950         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);
66951         int64_t ret_ref = 0;
66952         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66953         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66954         return ret_ref;
66955 }
66956
66957 static inline uint64_t BlindedPayInfo_clone_ptr(LDKBlindedPayInfo *NONNULL_PTR arg) {
66958         LDKBlindedPayInfo ret_var = BlindedPayInfo_clone(arg);
66959         int64_t ret_ref = 0;
66960         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66961         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66962         return ret_ref;
66963 }
66964 int64_t  CS_LDK_BlindedPayInfo_clone_ptr(int64_t arg) {
66965         LDKBlindedPayInfo arg_conv;
66966         arg_conv.inner = untag_ptr(arg);
66967         arg_conv.is_owned = ptr_is_owned(arg);
66968         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
66969         arg_conv.is_owned = false;
66970         int64_t ret_conv = BlindedPayInfo_clone_ptr(&arg_conv);
66971         return ret_conv;
66972 }
66973
66974 int64_t  CS_LDK_BlindedPayInfo_clone(int64_t orig) {
66975         LDKBlindedPayInfo orig_conv;
66976         orig_conv.inner = untag_ptr(orig);
66977         orig_conv.is_owned = ptr_is_owned(orig);
66978         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
66979         orig_conv.is_owned = false;
66980         LDKBlindedPayInfo ret_var = BlindedPayInfo_clone(&orig_conv);
66981         int64_t ret_ref = 0;
66982         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66983         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66984         return ret_ref;
66985 }
66986
66987 int64_t  CS_LDK_BlindedPayInfo_hash(int64_t o) {
66988         LDKBlindedPayInfo o_conv;
66989         o_conv.inner = untag_ptr(o);
66990         o_conv.is_owned = ptr_is_owned(o);
66991         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
66992         o_conv.is_owned = false;
66993         int64_t ret_conv = BlindedPayInfo_hash(&o_conv);
66994         return ret_conv;
66995 }
66996
66997 jboolean  CS_LDK_BlindedPayInfo_eq(int64_t a, int64_t b) {
66998         LDKBlindedPayInfo a_conv;
66999         a_conv.inner = untag_ptr(a);
67000         a_conv.is_owned = ptr_is_owned(a);
67001         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
67002         a_conv.is_owned = false;
67003         LDKBlindedPayInfo b_conv;
67004         b_conv.inner = untag_ptr(b);
67005         b_conv.is_owned = ptr_is_owned(b);
67006         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
67007         b_conv.is_owned = false;
67008         jboolean ret_conv = BlindedPayInfo_eq(&a_conv, &b_conv);
67009         return ret_conv;
67010 }
67011
67012 int8_tArray  CS_LDK_BlindedPayInfo_write(int64_t obj) {
67013         LDKBlindedPayInfo obj_conv;
67014         obj_conv.inner = untag_ptr(obj);
67015         obj_conv.is_owned = ptr_is_owned(obj);
67016         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
67017         obj_conv.is_owned = false;
67018         LDKCVec_u8Z ret_var = BlindedPayInfo_write(&obj_conv);
67019         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
67020         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
67021         CVec_u8Z_free(ret_var);
67022         return ret_arr;
67023 }
67024
67025 int64_t  CS_LDK_BlindedPayInfo_read(int8_tArray ser) {
67026         LDKu8slice ser_ref;
67027         ser_ref.datalen = ser->arr_len;
67028         ser_ref.data = ser->elems;
67029         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
67030         *ret_conv = BlindedPayInfo_read(ser_ref);
67031         FREE(ser);
67032         return tag_ptr(ret_conv, true);
67033 }
67034
67035 void  CS_LDK_InvoiceError_free(int64_t this_obj) {
67036         LDKInvoiceError this_obj_conv;
67037         this_obj_conv.inner = untag_ptr(this_obj);
67038         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67039         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67040         InvoiceError_free(this_obj_conv);
67041 }
67042
67043 int64_t  CS_LDK_InvoiceError_get_erroneous_field(int64_t this_ptr) {
67044         LDKInvoiceError this_ptr_conv;
67045         this_ptr_conv.inner = untag_ptr(this_ptr);
67046         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67047         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67048         this_ptr_conv.is_owned = false;
67049         LDKErroneousField ret_var = InvoiceError_get_erroneous_field(&this_ptr_conv);
67050         int64_t ret_ref = 0;
67051         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67052         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67053         return ret_ref;
67054 }
67055
67056 void  CS_LDK_InvoiceError_set_erroneous_field(int64_t this_ptr, int64_t val) {
67057         LDKInvoiceError this_ptr_conv;
67058         this_ptr_conv.inner = untag_ptr(this_ptr);
67059         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67060         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67061         this_ptr_conv.is_owned = false;
67062         LDKErroneousField val_conv;
67063         val_conv.inner = untag_ptr(val);
67064         val_conv.is_owned = ptr_is_owned(val);
67065         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
67066         val_conv = ErroneousField_clone(&val_conv);
67067         InvoiceError_set_erroneous_field(&this_ptr_conv, val_conv);
67068 }
67069
67070 int64_t  CS_LDK_InvoiceError_get_message(int64_t this_ptr) {
67071         LDKInvoiceError this_ptr_conv;
67072         this_ptr_conv.inner = untag_ptr(this_ptr);
67073         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67074         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67075         this_ptr_conv.is_owned = false;
67076         LDKUntrustedString ret_var = InvoiceError_get_message(&this_ptr_conv);
67077         int64_t ret_ref = 0;
67078         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67079         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67080         return ret_ref;
67081 }
67082
67083 void  CS_LDK_InvoiceError_set_message(int64_t this_ptr, int64_t val) {
67084         LDKInvoiceError this_ptr_conv;
67085         this_ptr_conv.inner = untag_ptr(this_ptr);
67086         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67087         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67088         this_ptr_conv.is_owned = false;
67089         LDKUntrustedString val_conv;
67090         val_conv.inner = untag_ptr(val);
67091         val_conv.is_owned = ptr_is_owned(val);
67092         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
67093         val_conv = UntrustedString_clone(&val_conv);
67094         InvoiceError_set_message(&this_ptr_conv, val_conv);
67095 }
67096
67097 int64_t  CS_LDK_InvoiceError_new(int64_t erroneous_field_arg, int64_t message_arg) {
67098         LDKErroneousField erroneous_field_arg_conv;
67099         erroneous_field_arg_conv.inner = untag_ptr(erroneous_field_arg);
67100         erroneous_field_arg_conv.is_owned = ptr_is_owned(erroneous_field_arg);
67101         CHECK_INNER_FIELD_ACCESS_OR_NULL(erroneous_field_arg_conv);
67102         erroneous_field_arg_conv = ErroneousField_clone(&erroneous_field_arg_conv);
67103         LDKUntrustedString message_arg_conv;
67104         message_arg_conv.inner = untag_ptr(message_arg);
67105         message_arg_conv.is_owned = ptr_is_owned(message_arg);
67106         CHECK_INNER_FIELD_ACCESS_OR_NULL(message_arg_conv);
67107         message_arg_conv = UntrustedString_clone(&message_arg_conv);
67108         LDKInvoiceError ret_var = InvoiceError_new(erroneous_field_arg_conv, message_arg_conv);
67109         int64_t ret_ref = 0;
67110         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67111         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67112         return ret_ref;
67113 }
67114
67115 static inline uint64_t InvoiceError_clone_ptr(LDKInvoiceError *NONNULL_PTR arg) {
67116         LDKInvoiceError ret_var = InvoiceError_clone(arg);
67117         int64_t ret_ref = 0;
67118         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67119         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67120         return ret_ref;
67121 }
67122 int64_t  CS_LDK_InvoiceError_clone_ptr(int64_t arg) {
67123         LDKInvoiceError arg_conv;
67124         arg_conv.inner = untag_ptr(arg);
67125         arg_conv.is_owned = ptr_is_owned(arg);
67126         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
67127         arg_conv.is_owned = false;
67128         int64_t ret_conv = InvoiceError_clone_ptr(&arg_conv);
67129         return ret_conv;
67130 }
67131
67132 int64_t  CS_LDK_InvoiceError_clone(int64_t orig) {
67133         LDKInvoiceError orig_conv;
67134         orig_conv.inner = untag_ptr(orig);
67135         orig_conv.is_owned = ptr_is_owned(orig);
67136         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
67137         orig_conv.is_owned = false;
67138         LDKInvoiceError ret_var = InvoiceError_clone(&orig_conv);
67139         int64_t ret_ref = 0;
67140         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67141         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67142         return ret_ref;
67143 }
67144
67145 void  CS_LDK_ErroneousField_free(int64_t this_obj) {
67146         LDKErroneousField this_obj_conv;
67147         this_obj_conv.inner = untag_ptr(this_obj);
67148         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67149         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67150         ErroneousField_free(this_obj_conv);
67151 }
67152
67153 int64_t  CS_LDK_ErroneousField_get_tlv_fieldnum(int64_t this_ptr) {
67154         LDKErroneousField this_ptr_conv;
67155         this_ptr_conv.inner = untag_ptr(this_ptr);
67156         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67157         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67158         this_ptr_conv.is_owned = false;
67159         int64_t ret_conv = ErroneousField_get_tlv_fieldnum(&this_ptr_conv);
67160         return ret_conv;
67161 }
67162
67163 void  CS_LDK_ErroneousField_set_tlv_fieldnum(int64_t this_ptr, int64_t val) {
67164         LDKErroneousField this_ptr_conv;
67165         this_ptr_conv.inner = untag_ptr(this_ptr);
67166         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67167         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67168         this_ptr_conv.is_owned = false;
67169         ErroneousField_set_tlv_fieldnum(&this_ptr_conv, val);
67170 }
67171
67172 int64_t  CS_LDK_ErroneousField_get_suggested_value(int64_t this_ptr) {
67173         LDKErroneousField this_ptr_conv;
67174         this_ptr_conv.inner = untag_ptr(this_ptr);
67175         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67176         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67177         this_ptr_conv.is_owned = false;
67178         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
67179         *ret_copy = ErroneousField_get_suggested_value(&this_ptr_conv);
67180         int64_t ret_ref = tag_ptr(ret_copy, true);
67181         return ret_ref;
67182 }
67183
67184 void  CS_LDK_ErroneousField_set_suggested_value(int64_t this_ptr, int64_t val) {
67185         LDKErroneousField this_ptr_conv;
67186         this_ptr_conv.inner = untag_ptr(this_ptr);
67187         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67188         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67189         this_ptr_conv.is_owned = false;
67190         void* val_ptr = untag_ptr(val);
67191         CHECK_ACCESS(val_ptr);
67192         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
67193         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
67194         ErroneousField_set_suggested_value(&this_ptr_conv, val_conv);
67195 }
67196
67197 int64_t  CS_LDK_ErroneousField_new(int64_t tlv_fieldnum_arg, int64_t suggested_value_arg) {
67198         void* suggested_value_arg_ptr = untag_ptr(suggested_value_arg);
67199         CHECK_ACCESS(suggested_value_arg_ptr);
67200         LDKCOption_CVec_u8ZZ suggested_value_arg_conv = *(LDKCOption_CVec_u8ZZ*)(suggested_value_arg_ptr);
67201         suggested_value_arg_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(suggested_value_arg));
67202         LDKErroneousField ret_var = ErroneousField_new(tlv_fieldnum_arg, suggested_value_arg_conv);
67203         int64_t ret_ref = 0;
67204         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67205         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67206         return ret_ref;
67207 }
67208
67209 static inline uint64_t ErroneousField_clone_ptr(LDKErroneousField *NONNULL_PTR arg) {
67210         LDKErroneousField ret_var = ErroneousField_clone(arg);
67211         int64_t ret_ref = 0;
67212         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67213         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67214         return ret_ref;
67215 }
67216 int64_t  CS_LDK_ErroneousField_clone_ptr(int64_t arg) {
67217         LDKErroneousField arg_conv;
67218         arg_conv.inner = untag_ptr(arg);
67219         arg_conv.is_owned = ptr_is_owned(arg);
67220         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
67221         arg_conv.is_owned = false;
67222         int64_t ret_conv = ErroneousField_clone_ptr(&arg_conv);
67223         return ret_conv;
67224 }
67225
67226 int64_t  CS_LDK_ErroneousField_clone(int64_t orig) {
67227         LDKErroneousField orig_conv;
67228         orig_conv.inner = untag_ptr(orig);
67229         orig_conv.is_owned = ptr_is_owned(orig);
67230         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
67231         orig_conv.is_owned = false;
67232         LDKErroneousField ret_var = ErroneousField_clone(&orig_conv);
67233         int64_t ret_ref = 0;
67234         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67235         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67236         return ret_ref;
67237 }
67238
67239 int64_t  CS_LDK_InvoiceError_from_string(jstring s) {
67240         LDKStr s_conv = str_ref_to_owned_c(s);
67241         LDKInvoiceError ret_var = InvoiceError_from_string(s_conv);
67242         int64_t ret_ref = 0;
67243         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67244         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67245         return ret_ref;
67246 }
67247
67248 jstring  CS_LDK_InvoiceError_to_str(int64_t o) {
67249         LDKInvoiceError o_conv;
67250         o_conv.inner = untag_ptr(o);
67251         o_conv.is_owned = ptr_is_owned(o);
67252         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
67253         o_conv.is_owned = false;
67254         LDKStr ret_str = InvoiceError_to_str(&o_conv);
67255         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
67256         Str_free(ret_str);
67257         return ret_conv;
67258 }
67259
67260 int8_tArray  CS_LDK_InvoiceError_write(int64_t obj) {
67261         LDKInvoiceError obj_conv;
67262         obj_conv.inner = untag_ptr(obj);
67263         obj_conv.is_owned = ptr_is_owned(obj);
67264         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
67265         obj_conv.is_owned = false;
67266         LDKCVec_u8Z ret_var = InvoiceError_write(&obj_conv);
67267         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
67268         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
67269         CVec_u8Z_free(ret_var);
67270         return ret_arr;
67271 }
67272
67273 int64_t  CS_LDK_InvoiceError_read(int8_tArray ser) {
67274         LDKu8slice ser_ref;
67275         ser_ref.datalen = ser->arr_len;
67276         ser_ref.data = ser->elems;
67277         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
67278         *ret_conv = InvoiceError_read(ser_ref);
67279         FREE(ser);
67280         return tag_ptr(ret_conv, true);
67281 }
67282
67283 void  CS_LDK_InvoiceRequestWithExplicitPayerIdBuilder_free(int64_t this_obj) {
67284         LDKInvoiceRequestWithExplicitPayerIdBuilder this_obj_conv;
67285         this_obj_conv.inner = untag_ptr(this_obj);
67286         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67287         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67288         InvoiceRequestWithExplicitPayerIdBuilder_free(this_obj_conv);
67289 }
67290
67291 void  CS_LDK_InvoiceRequestWithDerivedPayerIdBuilder_free(int64_t this_obj) {
67292         LDKInvoiceRequestWithDerivedPayerIdBuilder this_obj_conv;
67293         this_obj_conv.inner = untag_ptr(this_obj);
67294         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67295         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67296         InvoiceRequestWithDerivedPayerIdBuilder_free(this_obj_conv);
67297 }
67298
67299 int64_t  CS_LDK_InvoiceRequestWithExplicitPayerIdBuilder_build(int64_t this_arg) {
67300         LDKInvoiceRequestWithExplicitPayerIdBuilder this_arg_conv;
67301         this_arg_conv.inner = untag_ptr(this_arg);
67302         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67303         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67304         // WARNING: we need a move here but no clone is available for LDKInvoiceRequestWithExplicitPayerIdBuilder
67305         
67306         LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ), "LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ");
67307         *ret_conv = InvoiceRequestWithExplicitPayerIdBuilder_build(this_arg_conv);
67308         return tag_ptr(ret_conv, true);
67309 }
67310
67311 int64_t  CS_LDK_InvoiceRequestWithExplicitPayerIdBuilder_chain(int64_t this_arg, int32_t network) {
67312         LDKInvoiceRequestWithExplicitPayerIdBuilder this_arg_conv;
67313         this_arg_conv.inner = untag_ptr(this_arg);
67314         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67315         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67316         // WARNING: we need a move here but no clone is available for LDKInvoiceRequestWithExplicitPayerIdBuilder
67317         
67318         LDKNetwork network_conv = LDKNetwork_from_cs(network);
67319         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
67320         *ret_conv = InvoiceRequestWithExplicitPayerIdBuilder_chain(this_arg_conv, network_conv);
67321         return tag_ptr(ret_conv, true);
67322 }
67323
67324 int64_t  CS_LDK_InvoiceRequestWithExplicitPayerIdBuilder_amount_msats(int64_t this_arg, int64_t amount_msats) {
67325         LDKInvoiceRequestWithExplicitPayerIdBuilder this_arg_conv;
67326         this_arg_conv.inner = untag_ptr(this_arg);
67327         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67328         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67329         // WARNING: we need a move here but no clone is available for LDKInvoiceRequestWithExplicitPayerIdBuilder
67330         
67331         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
67332         *ret_conv = InvoiceRequestWithExplicitPayerIdBuilder_amount_msats(this_arg_conv, amount_msats);
67333         return tag_ptr(ret_conv, true);
67334 }
67335
67336 int64_t  CS_LDK_InvoiceRequestWithExplicitPayerIdBuilder_quantity(int64_t this_arg, int64_t quantity) {
67337         LDKInvoiceRequestWithExplicitPayerIdBuilder this_arg_conv;
67338         this_arg_conv.inner = untag_ptr(this_arg);
67339         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67340         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67341         // WARNING: we need a move here but no clone is available for LDKInvoiceRequestWithExplicitPayerIdBuilder
67342         
67343         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
67344         *ret_conv = InvoiceRequestWithExplicitPayerIdBuilder_quantity(this_arg_conv, quantity);
67345         return tag_ptr(ret_conv, true);
67346 }
67347
67348 void  CS_LDK_InvoiceRequestWithExplicitPayerIdBuilder_payer_note(int64_t this_arg, jstring payer_note) {
67349         LDKInvoiceRequestWithExplicitPayerIdBuilder this_arg_conv;
67350         this_arg_conv.inner = untag_ptr(this_arg);
67351         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67352         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67353         // WARNING: we need a move here but no clone is available for LDKInvoiceRequestWithExplicitPayerIdBuilder
67354         
67355         LDKStr payer_note_conv = str_ref_to_owned_c(payer_note);
67356         InvoiceRequestWithExplicitPayerIdBuilder_payer_note(this_arg_conv, payer_note_conv);
67357 }
67358
67359 int64_t  CS_LDK_InvoiceRequestWithDerivedPayerIdBuilder_build_and_sign(int64_t this_arg) {
67360         LDKInvoiceRequestWithDerivedPayerIdBuilder this_arg_conv;
67361         this_arg_conv.inner = untag_ptr(this_arg);
67362         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67363         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67364         // WARNING: we need a move here but no clone is available for LDKInvoiceRequestWithDerivedPayerIdBuilder
67365         
67366         LDKCResult_InvoiceRequestBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestBolt12SemanticErrorZ), "LDKCResult_InvoiceRequestBolt12SemanticErrorZ");
67367         *ret_conv = InvoiceRequestWithDerivedPayerIdBuilder_build_and_sign(this_arg_conv);
67368         return tag_ptr(ret_conv, true);
67369 }
67370
67371 int64_t  CS_LDK_InvoiceRequestWithDerivedPayerIdBuilder_chain(int64_t this_arg, int32_t network) {
67372         LDKInvoiceRequestWithDerivedPayerIdBuilder this_arg_conv;
67373         this_arg_conv.inner = untag_ptr(this_arg);
67374         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67375         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67376         // WARNING: we need a move here but no clone is available for LDKInvoiceRequestWithDerivedPayerIdBuilder
67377         
67378         LDKNetwork network_conv = LDKNetwork_from_cs(network);
67379         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
67380         *ret_conv = InvoiceRequestWithDerivedPayerIdBuilder_chain(this_arg_conv, network_conv);
67381         return tag_ptr(ret_conv, true);
67382 }
67383
67384 int64_t  CS_LDK_InvoiceRequestWithDerivedPayerIdBuilder_amount_msats(int64_t this_arg, int64_t amount_msats) {
67385         LDKInvoiceRequestWithDerivedPayerIdBuilder this_arg_conv;
67386         this_arg_conv.inner = untag_ptr(this_arg);
67387         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67388         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67389         // WARNING: we need a move here but no clone is available for LDKInvoiceRequestWithDerivedPayerIdBuilder
67390         
67391         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
67392         *ret_conv = InvoiceRequestWithDerivedPayerIdBuilder_amount_msats(this_arg_conv, amount_msats);
67393         return tag_ptr(ret_conv, true);
67394 }
67395
67396 int64_t  CS_LDK_InvoiceRequestWithDerivedPayerIdBuilder_quantity(int64_t this_arg, int64_t quantity) {
67397         LDKInvoiceRequestWithDerivedPayerIdBuilder this_arg_conv;
67398         this_arg_conv.inner = untag_ptr(this_arg);
67399         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67400         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67401         // WARNING: we need a move here but no clone is available for LDKInvoiceRequestWithDerivedPayerIdBuilder
67402         
67403         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
67404         *ret_conv = InvoiceRequestWithDerivedPayerIdBuilder_quantity(this_arg_conv, quantity);
67405         return tag_ptr(ret_conv, true);
67406 }
67407
67408 void  CS_LDK_InvoiceRequestWithDerivedPayerIdBuilder_payer_note(int64_t this_arg, jstring payer_note) {
67409         LDKInvoiceRequestWithDerivedPayerIdBuilder this_arg_conv;
67410         this_arg_conv.inner = untag_ptr(this_arg);
67411         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67412         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67413         // WARNING: we need a move here but no clone is available for LDKInvoiceRequestWithDerivedPayerIdBuilder
67414         
67415         LDKStr payer_note_conv = str_ref_to_owned_c(payer_note);
67416         InvoiceRequestWithDerivedPayerIdBuilder_payer_note(this_arg_conv, payer_note_conv);
67417 }
67418
67419 void  CS_LDK_UnsignedInvoiceRequest_free(int64_t this_obj) {
67420         LDKUnsignedInvoiceRequest this_obj_conv;
67421         this_obj_conv.inner = untag_ptr(this_obj);
67422         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67423         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67424         UnsignedInvoiceRequest_free(this_obj_conv);
67425 }
67426
67427 static inline uint64_t UnsignedInvoiceRequest_clone_ptr(LDKUnsignedInvoiceRequest *NONNULL_PTR arg) {
67428         LDKUnsignedInvoiceRequest ret_var = UnsignedInvoiceRequest_clone(arg);
67429         int64_t ret_ref = 0;
67430         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67431         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67432         return ret_ref;
67433 }
67434 int64_t  CS_LDK_UnsignedInvoiceRequest_clone_ptr(int64_t arg) {
67435         LDKUnsignedInvoiceRequest arg_conv;
67436         arg_conv.inner = untag_ptr(arg);
67437         arg_conv.is_owned = ptr_is_owned(arg);
67438         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
67439         arg_conv.is_owned = false;
67440         int64_t ret_conv = UnsignedInvoiceRequest_clone_ptr(&arg_conv);
67441         return ret_conv;
67442 }
67443
67444 int64_t  CS_LDK_UnsignedInvoiceRequest_clone(int64_t orig) {
67445         LDKUnsignedInvoiceRequest orig_conv;
67446         orig_conv.inner = untag_ptr(orig);
67447         orig_conv.is_owned = ptr_is_owned(orig);
67448         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
67449         orig_conv.is_owned = false;
67450         LDKUnsignedInvoiceRequest ret_var = UnsignedInvoiceRequest_clone(&orig_conv);
67451         int64_t ret_ref = 0;
67452         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67453         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67454         return ret_ref;
67455 }
67456
67457 void  CS_LDK_SignInvoiceRequestFn_free(int64_t this_ptr) {
67458         if (!ptr_is_owned(this_ptr)) return;
67459         void* this_ptr_ptr = untag_ptr(this_ptr);
67460         CHECK_ACCESS(this_ptr_ptr);
67461         LDKSignInvoiceRequestFn this_ptr_conv = *(LDKSignInvoiceRequestFn*)(this_ptr_ptr);
67462         FREE(untag_ptr(this_ptr));
67463         SignInvoiceRequestFn_free(this_ptr_conv);
67464 }
67465
67466 int64_t  CS_LDK_UnsignedInvoiceRequest_tagged_hash(int64_t this_arg) {
67467         LDKUnsignedInvoiceRequest this_arg_conv;
67468         this_arg_conv.inner = untag_ptr(this_arg);
67469         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67470         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67471         this_arg_conv.is_owned = false;
67472         LDKTaggedHash ret_var = UnsignedInvoiceRequest_tagged_hash(&this_arg_conv);
67473         int64_t ret_ref = 0;
67474         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67475         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67476         return ret_ref;
67477 }
67478
67479 void  CS_LDK_InvoiceRequest_free(int64_t this_obj) {
67480         LDKInvoiceRequest this_obj_conv;
67481         this_obj_conv.inner = untag_ptr(this_obj);
67482         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67483         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67484         InvoiceRequest_free(this_obj_conv);
67485 }
67486
67487 static inline uint64_t InvoiceRequest_clone_ptr(LDKInvoiceRequest *NONNULL_PTR arg) {
67488         LDKInvoiceRequest ret_var = InvoiceRequest_clone(arg);
67489         int64_t ret_ref = 0;
67490         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67491         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67492         return ret_ref;
67493 }
67494 int64_t  CS_LDK_InvoiceRequest_clone_ptr(int64_t arg) {
67495         LDKInvoiceRequest arg_conv;
67496         arg_conv.inner = untag_ptr(arg);
67497         arg_conv.is_owned = ptr_is_owned(arg);
67498         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
67499         arg_conv.is_owned = false;
67500         int64_t ret_conv = InvoiceRequest_clone_ptr(&arg_conv);
67501         return ret_conv;
67502 }
67503
67504 int64_t  CS_LDK_InvoiceRequest_clone(int64_t orig) {
67505         LDKInvoiceRequest orig_conv;
67506         orig_conv.inner = untag_ptr(orig);
67507         orig_conv.is_owned = ptr_is_owned(orig);
67508         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
67509         orig_conv.is_owned = false;
67510         LDKInvoiceRequest ret_var = InvoiceRequest_clone(&orig_conv);
67511         int64_t ret_ref = 0;
67512         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67513         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67514         return ret_ref;
67515 }
67516
67517 void  CS_LDK_VerifiedInvoiceRequest_free(int64_t this_obj) {
67518         LDKVerifiedInvoiceRequest this_obj_conv;
67519         this_obj_conv.inner = untag_ptr(this_obj);
67520         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67521         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67522         VerifiedInvoiceRequest_free(this_obj_conv);
67523 }
67524
67525 int64_t  CS_LDK_VerifiedInvoiceRequest_get_offer_id(int64_t this_ptr) {
67526         LDKVerifiedInvoiceRequest this_ptr_conv;
67527         this_ptr_conv.inner = untag_ptr(this_ptr);
67528         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67529         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67530         this_ptr_conv.is_owned = false;
67531         LDKOfferId ret_var = VerifiedInvoiceRequest_get_offer_id(&this_ptr_conv);
67532         int64_t ret_ref = 0;
67533         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67534         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67535         return ret_ref;
67536 }
67537
67538 void  CS_LDK_VerifiedInvoiceRequest_set_offer_id(int64_t this_ptr, int64_t val) {
67539         LDKVerifiedInvoiceRequest this_ptr_conv;
67540         this_ptr_conv.inner = untag_ptr(this_ptr);
67541         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67542         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67543         this_ptr_conv.is_owned = false;
67544         LDKOfferId val_conv;
67545         val_conv.inner = untag_ptr(val);
67546         val_conv.is_owned = ptr_is_owned(val);
67547         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
67548         val_conv = OfferId_clone(&val_conv);
67549         VerifiedInvoiceRequest_set_offer_id(&this_ptr_conv, val_conv);
67550 }
67551
67552 int64_t  CS_LDK_VerifiedInvoiceRequest_get_keys(int64_t this_ptr) {
67553         LDKVerifiedInvoiceRequest this_ptr_conv;
67554         this_ptr_conv.inner = untag_ptr(this_ptr);
67555         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67556         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67557         this_ptr_conv.is_owned = false;
67558         LDKCOption_SecretKeyZ *ret_copy = MALLOC(sizeof(LDKCOption_SecretKeyZ), "LDKCOption_SecretKeyZ");
67559         *ret_copy = VerifiedInvoiceRequest_get_keys(&this_ptr_conv);
67560         int64_t ret_ref = tag_ptr(ret_copy, true);
67561         return ret_ref;
67562 }
67563
67564 void  CS_LDK_VerifiedInvoiceRequest_set_keys(int64_t this_ptr, int64_t val) {
67565         LDKVerifiedInvoiceRequest this_ptr_conv;
67566         this_ptr_conv.inner = untag_ptr(this_ptr);
67567         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67568         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67569         this_ptr_conv.is_owned = false;
67570         void* val_ptr = untag_ptr(val);
67571         CHECK_ACCESS(val_ptr);
67572         LDKCOption_SecretKeyZ val_conv = *(LDKCOption_SecretKeyZ*)(val_ptr);
67573         val_conv = COption_SecretKeyZ_clone((LDKCOption_SecretKeyZ*)untag_ptr(val));
67574         VerifiedInvoiceRequest_set_keys(&this_ptr_conv, val_conv);
67575 }
67576
67577 static inline uint64_t VerifiedInvoiceRequest_clone_ptr(LDKVerifiedInvoiceRequest *NONNULL_PTR arg) {
67578         LDKVerifiedInvoiceRequest ret_var = VerifiedInvoiceRequest_clone(arg);
67579         int64_t ret_ref = 0;
67580         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67581         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67582         return ret_ref;
67583 }
67584 int64_t  CS_LDK_VerifiedInvoiceRequest_clone_ptr(int64_t arg) {
67585         LDKVerifiedInvoiceRequest arg_conv;
67586         arg_conv.inner = untag_ptr(arg);
67587         arg_conv.is_owned = ptr_is_owned(arg);
67588         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
67589         arg_conv.is_owned = false;
67590         int64_t ret_conv = VerifiedInvoiceRequest_clone_ptr(&arg_conv);
67591         return ret_conv;
67592 }
67593
67594 int64_t  CS_LDK_VerifiedInvoiceRequest_clone(int64_t orig) {
67595         LDKVerifiedInvoiceRequest orig_conv;
67596         orig_conv.inner = untag_ptr(orig);
67597         orig_conv.is_owned = ptr_is_owned(orig);
67598         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
67599         orig_conv.is_owned = false;
67600         LDKVerifiedInvoiceRequest ret_var = VerifiedInvoiceRequest_clone(&orig_conv);
67601         int64_t ret_ref = 0;
67602         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67603         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67604         return ret_ref;
67605 }
67606
67607 ptrArray  CS_LDK_UnsignedInvoiceRequest_chains(int64_t this_arg) {
67608         LDKUnsignedInvoiceRequest this_arg_conv;
67609         this_arg_conv.inner = untag_ptr(this_arg);
67610         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67611         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67612         this_arg_conv.is_owned = false;
67613         LDKCVec_ThirtyTwoBytesZ ret_var = UnsignedInvoiceRequest_chains(&this_arg_conv);
67614         ptrArray ret_arr = NULL;
67615         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
67616         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
67617         for (size_t i = 0; i < ret_var.datalen; i++) {
67618                 int8_tArray ret_conv_8_arr = init_int8_tArray(32, __LINE__);
67619                 memcpy(ret_conv_8_arr->elems, ret_var.data[i].data, 32);
67620                 ret_arr_ptr[i] = ret_conv_8_arr;
67621         }
67622         
67623         FREE(ret_var.data);
67624         return ret_arr;
67625 }
67626
67627 int64_t  CS_LDK_UnsignedInvoiceRequest_metadata(int64_t this_arg) {
67628         LDKUnsignedInvoiceRequest this_arg_conv;
67629         this_arg_conv.inner = untag_ptr(this_arg);
67630         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67631         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67632         this_arg_conv.is_owned = false;
67633         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
67634         *ret_copy = UnsignedInvoiceRequest_metadata(&this_arg_conv);
67635         int64_t ret_ref = tag_ptr(ret_copy, true);
67636         return ret_ref;
67637 }
67638
67639 int64_t  CS_LDK_UnsignedInvoiceRequest_amount(int64_t this_arg) {
67640         LDKUnsignedInvoiceRequest this_arg_conv;
67641         this_arg_conv.inner = untag_ptr(this_arg);
67642         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67643         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67644         this_arg_conv.is_owned = false;
67645         LDKCOption_AmountZ *ret_copy = MALLOC(sizeof(LDKCOption_AmountZ), "LDKCOption_AmountZ");
67646         *ret_copy = UnsignedInvoiceRequest_amount(&this_arg_conv);
67647         int64_t ret_ref = tag_ptr(ret_copy, true);
67648         return ret_ref;
67649 }
67650
67651 int64_t  CS_LDK_UnsignedInvoiceRequest_description(int64_t this_arg) {
67652         LDKUnsignedInvoiceRequest this_arg_conv;
67653         this_arg_conv.inner = untag_ptr(this_arg);
67654         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67655         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67656         this_arg_conv.is_owned = false;
67657         LDKPrintableString ret_var = UnsignedInvoiceRequest_description(&this_arg_conv);
67658         int64_t ret_ref = 0;
67659         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67660         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67661         return ret_ref;
67662 }
67663
67664 int64_t  CS_LDK_UnsignedInvoiceRequest_offer_features(int64_t this_arg) {
67665         LDKUnsignedInvoiceRequest this_arg_conv;
67666         this_arg_conv.inner = untag_ptr(this_arg);
67667         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67668         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67669         this_arg_conv.is_owned = false;
67670         LDKOfferFeatures ret_var = UnsignedInvoiceRequest_offer_features(&this_arg_conv);
67671         int64_t ret_ref = 0;
67672         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67673         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67674         return ret_ref;
67675 }
67676
67677 int64_t  CS_LDK_UnsignedInvoiceRequest_absolute_expiry(int64_t this_arg) {
67678         LDKUnsignedInvoiceRequest this_arg_conv;
67679         this_arg_conv.inner = untag_ptr(this_arg);
67680         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67681         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67682         this_arg_conv.is_owned = false;
67683         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
67684         *ret_copy = UnsignedInvoiceRequest_absolute_expiry(&this_arg_conv);
67685         int64_t ret_ref = tag_ptr(ret_copy, true);
67686         return ret_ref;
67687 }
67688
67689 int64_t  CS_LDK_UnsignedInvoiceRequest_issuer(int64_t this_arg) {
67690         LDKUnsignedInvoiceRequest this_arg_conv;
67691         this_arg_conv.inner = untag_ptr(this_arg);
67692         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67693         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67694         this_arg_conv.is_owned = false;
67695         LDKPrintableString ret_var = UnsignedInvoiceRequest_issuer(&this_arg_conv);
67696         int64_t ret_ref = 0;
67697         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67698         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67699         return ret_ref;
67700 }
67701
67702 int64_tArray  CS_LDK_UnsignedInvoiceRequest_paths(int64_t this_arg) {
67703         LDKUnsignedInvoiceRequest this_arg_conv;
67704         this_arg_conv.inner = untag_ptr(this_arg);
67705         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67706         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67707         this_arg_conv.is_owned = false;
67708         LDKCVec_BlindedPathZ ret_var = UnsignedInvoiceRequest_paths(&this_arg_conv);
67709         int64_tArray ret_arr = NULL;
67710         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
67711         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
67712         for (size_t n = 0; n < ret_var.datalen; n++) {
67713                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
67714                 int64_t ret_conv_13_ref = 0;
67715                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
67716                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
67717                 ret_arr_ptr[n] = ret_conv_13_ref;
67718         }
67719         
67720         FREE(ret_var.data);
67721         return ret_arr;
67722 }
67723
67724 int64_t  CS_LDK_UnsignedInvoiceRequest_supported_quantity(int64_t this_arg) {
67725         LDKUnsignedInvoiceRequest this_arg_conv;
67726         this_arg_conv.inner = untag_ptr(this_arg);
67727         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67728         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67729         this_arg_conv.is_owned = false;
67730         LDKQuantity *ret_copy = MALLOC(sizeof(LDKQuantity), "LDKQuantity");
67731         *ret_copy = UnsignedInvoiceRequest_supported_quantity(&this_arg_conv);
67732         int64_t ret_ref = tag_ptr(ret_copy, true);
67733         return ret_ref;
67734 }
67735
67736 int8_tArray  CS_LDK_UnsignedInvoiceRequest_signing_pubkey(int64_t this_arg) {
67737         LDKUnsignedInvoiceRequest this_arg_conv;
67738         this_arg_conv.inner = untag_ptr(this_arg);
67739         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67740         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67741         this_arg_conv.is_owned = false;
67742         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
67743         memcpy(ret_arr->elems, UnsignedInvoiceRequest_signing_pubkey(&this_arg_conv).compressed_form, 33);
67744         return ret_arr;
67745 }
67746
67747 int8_tArray  CS_LDK_UnsignedInvoiceRequest_payer_metadata(int64_t this_arg) {
67748         LDKUnsignedInvoiceRequest this_arg_conv;
67749         this_arg_conv.inner = untag_ptr(this_arg);
67750         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67751         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67752         this_arg_conv.is_owned = false;
67753         LDKu8slice ret_var = UnsignedInvoiceRequest_payer_metadata(&this_arg_conv);
67754         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
67755         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
67756         return ret_arr;
67757 }
67758
67759 int8_tArray  CS_LDK_UnsignedInvoiceRequest_chain(int64_t this_arg) {
67760         LDKUnsignedInvoiceRequest 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         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
67766         memcpy(ret_arr->elems, UnsignedInvoiceRequest_chain(&this_arg_conv).data, 32);
67767         return ret_arr;
67768 }
67769
67770 int64_t  CS_LDK_UnsignedInvoiceRequest_amount_msats(int64_t this_arg) {
67771         LDKUnsignedInvoiceRequest 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         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
67777         *ret_copy = UnsignedInvoiceRequest_amount_msats(&this_arg_conv);
67778         int64_t ret_ref = tag_ptr(ret_copy, true);
67779         return ret_ref;
67780 }
67781
67782 int64_t  CS_LDK_UnsignedInvoiceRequest_invoice_request_features(int64_t this_arg) {
67783         LDKUnsignedInvoiceRequest this_arg_conv;
67784         this_arg_conv.inner = untag_ptr(this_arg);
67785         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67786         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67787         this_arg_conv.is_owned = false;
67788         LDKInvoiceRequestFeatures ret_var = UnsignedInvoiceRequest_invoice_request_features(&this_arg_conv);
67789         int64_t ret_ref = 0;
67790         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67791         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67792         return ret_ref;
67793 }
67794
67795 int64_t  CS_LDK_UnsignedInvoiceRequest_quantity(int64_t this_arg) {
67796         LDKUnsignedInvoiceRequest this_arg_conv;
67797         this_arg_conv.inner = untag_ptr(this_arg);
67798         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67799         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67800         this_arg_conv.is_owned = false;
67801         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
67802         *ret_copy = UnsignedInvoiceRequest_quantity(&this_arg_conv);
67803         int64_t ret_ref = tag_ptr(ret_copy, true);
67804         return ret_ref;
67805 }
67806
67807 int8_tArray  CS_LDK_UnsignedInvoiceRequest_payer_id(int64_t this_arg) {
67808         LDKUnsignedInvoiceRequest this_arg_conv;
67809         this_arg_conv.inner = untag_ptr(this_arg);
67810         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67811         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67812         this_arg_conv.is_owned = false;
67813         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
67814         memcpy(ret_arr->elems, UnsignedInvoiceRequest_payer_id(&this_arg_conv).compressed_form, 33);
67815         return ret_arr;
67816 }
67817
67818 int64_t  CS_LDK_UnsignedInvoiceRequest_payer_note(int64_t this_arg) {
67819         LDKUnsignedInvoiceRequest this_arg_conv;
67820         this_arg_conv.inner = untag_ptr(this_arg);
67821         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67822         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67823         this_arg_conv.is_owned = false;
67824         LDKPrintableString ret_var = UnsignedInvoiceRequest_payer_note(&this_arg_conv);
67825         int64_t ret_ref = 0;
67826         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67827         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67828         return ret_ref;
67829 }
67830
67831 ptrArray  CS_LDK_InvoiceRequest_chains(int64_t this_arg) {
67832         LDKInvoiceRequest this_arg_conv;
67833         this_arg_conv.inner = untag_ptr(this_arg);
67834         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67835         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67836         this_arg_conv.is_owned = false;
67837         LDKCVec_ThirtyTwoBytesZ ret_var = InvoiceRequest_chains(&this_arg_conv);
67838         ptrArray ret_arr = NULL;
67839         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
67840         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
67841         for (size_t i = 0; i < ret_var.datalen; i++) {
67842                 int8_tArray ret_conv_8_arr = init_int8_tArray(32, __LINE__);
67843                 memcpy(ret_conv_8_arr->elems, ret_var.data[i].data, 32);
67844                 ret_arr_ptr[i] = ret_conv_8_arr;
67845         }
67846         
67847         FREE(ret_var.data);
67848         return ret_arr;
67849 }
67850
67851 int64_t  CS_LDK_InvoiceRequest_metadata(int64_t this_arg) {
67852         LDKInvoiceRequest this_arg_conv;
67853         this_arg_conv.inner = untag_ptr(this_arg);
67854         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67855         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67856         this_arg_conv.is_owned = false;
67857         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
67858         *ret_copy = InvoiceRequest_metadata(&this_arg_conv);
67859         int64_t ret_ref = tag_ptr(ret_copy, true);
67860         return ret_ref;
67861 }
67862
67863 int64_t  CS_LDK_InvoiceRequest_amount(int64_t this_arg) {
67864         LDKInvoiceRequest this_arg_conv;
67865         this_arg_conv.inner = untag_ptr(this_arg);
67866         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67867         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67868         this_arg_conv.is_owned = false;
67869         LDKCOption_AmountZ *ret_copy = MALLOC(sizeof(LDKCOption_AmountZ), "LDKCOption_AmountZ");
67870         *ret_copy = InvoiceRequest_amount(&this_arg_conv);
67871         int64_t ret_ref = tag_ptr(ret_copy, true);
67872         return ret_ref;
67873 }
67874
67875 int64_t  CS_LDK_InvoiceRequest_description(int64_t this_arg) {
67876         LDKInvoiceRequest this_arg_conv;
67877         this_arg_conv.inner = untag_ptr(this_arg);
67878         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67879         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67880         this_arg_conv.is_owned = false;
67881         LDKPrintableString ret_var = InvoiceRequest_description(&this_arg_conv);
67882         int64_t ret_ref = 0;
67883         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67884         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67885         return ret_ref;
67886 }
67887
67888 int64_t  CS_LDK_InvoiceRequest_offer_features(int64_t this_arg) {
67889         LDKInvoiceRequest this_arg_conv;
67890         this_arg_conv.inner = untag_ptr(this_arg);
67891         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67892         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67893         this_arg_conv.is_owned = false;
67894         LDKOfferFeatures ret_var = InvoiceRequest_offer_features(&this_arg_conv);
67895         int64_t ret_ref = 0;
67896         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67897         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67898         return ret_ref;
67899 }
67900
67901 int64_t  CS_LDK_InvoiceRequest_absolute_expiry(int64_t this_arg) {
67902         LDKInvoiceRequest this_arg_conv;
67903         this_arg_conv.inner = untag_ptr(this_arg);
67904         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67905         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67906         this_arg_conv.is_owned = false;
67907         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
67908         *ret_copy = InvoiceRequest_absolute_expiry(&this_arg_conv);
67909         int64_t ret_ref = tag_ptr(ret_copy, true);
67910         return ret_ref;
67911 }
67912
67913 int64_t  CS_LDK_InvoiceRequest_issuer(int64_t this_arg) {
67914         LDKInvoiceRequest this_arg_conv;
67915         this_arg_conv.inner = untag_ptr(this_arg);
67916         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67917         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67918         this_arg_conv.is_owned = false;
67919         LDKPrintableString ret_var = InvoiceRequest_issuer(&this_arg_conv);
67920         int64_t ret_ref = 0;
67921         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67922         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67923         return ret_ref;
67924 }
67925
67926 int64_tArray  CS_LDK_InvoiceRequest_paths(int64_t this_arg) {
67927         LDKInvoiceRequest this_arg_conv;
67928         this_arg_conv.inner = untag_ptr(this_arg);
67929         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67930         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67931         this_arg_conv.is_owned = false;
67932         LDKCVec_BlindedPathZ ret_var = InvoiceRequest_paths(&this_arg_conv);
67933         int64_tArray ret_arr = NULL;
67934         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
67935         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
67936         for (size_t n = 0; n < ret_var.datalen; n++) {
67937                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
67938                 int64_t ret_conv_13_ref = 0;
67939                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
67940                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
67941                 ret_arr_ptr[n] = ret_conv_13_ref;
67942         }
67943         
67944         FREE(ret_var.data);
67945         return ret_arr;
67946 }
67947
67948 int64_t  CS_LDK_InvoiceRequest_supported_quantity(int64_t this_arg) {
67949         LDKInvoiceRequest this_arg_conv;
67950         this_arg_conv.inner = untag_ptr(this_arg);
67951         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67952         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67953         this_arg_conv.is_owned = false;
67954         LDKQuantity *ret_copy = MALLOC(sizeof(LDKQuantity), "LDKQuantity");
67955         *ret_copy = InvoiceRequest_supported_quantity(&this_arg_conv);
67956         int64_t ret_ref = tag_ptr(ret_copy, true);
67957         return ret_ref;
67958 }
67959
67960 int8_tArray  CS_LDK_InvoiceRequest_signing_pubkey(int64_t this_arg) {
67961         LDKInvoiceRequest this_arg_conv;
67962         this_arg_conv.inner = untag_ptr(this_arg);
67963         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67964         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67965         this_arg_conv.is_owned = false;
67966         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
67967         memcpy(ret_arr->elems, InvoiceRequest_signing_pubkey(&this_arg_conv).compressed_form, 33);
67968         return ret_arr;
67969 }
67970
67971 int8_tArray  CS_LDK_InvoiceRequest_payer_metadata(int64_t this_arg) {
67972         LDKInvoiceRequest this_arg_conv;
67973         this_arg_conv.inner = untag_ptr(this_arg);
67974         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67975         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67976         this_arg_conv.is_owned = false;
67977         LDKu8slice ret_var = InvoiceRequest_payer_metadata(&this_arg_conv);
67978         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
67979         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
67980         return ret_arr;
67981 }
67982
67983 int8_tArray  CS_LDK_InvoiceRequest_chain(int64_t this_arg) {
67984         LDKInvoiceRequest this_arg_conv;
67985         this_arg_conv.inner = untag_ptr(this_arg);
67986         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67987         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67988         this_arg_conv.is_owned = false;
67989         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
67990         memcpy(ret_arr->elems, InvoiceRequest_chain(&this_arg_conv).data, 32);
67991         return ret_arr;
67992 }
67993
67994 int64_t  CS_LDK_InvoiceRequest_amount_msats(int64_t this_arg) {
67995         LDKInvoiceRequest this_arg_conv;
67996         this_arg_conv.inner = untag_ptr(this_arg);
67997         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67998         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67999         this_arg_conv.is_owned = false;
68000         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
68001         *ret_copy = InvoiceRequest_amount_msats(&this_arg_conv);
68002         int64_t ret_ref = tag_ptr(ret_copy, true);
68003         return ret_ref;
68004 }
68005
68006 int64_t  CS_LDK_InvoiceRequest_invoice_request_features(int64_t this_arg) {
68007         LDKInvoiceRequest this_arg_conv;
68008         this_arg_conv.inner = untag_ptr(this_arg);
68009         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68010         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68011         this_arg_conv.is_owned = false;
68012         LDKInvoiceRequestFeatures ret_var = InvoiceRequest_invoice_request_features(&this_arg_conv);
68013         int64_t ret_ref = 0;
68014         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68015         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68016         return ret_ref;
68017 }
68018
68019 int64_t  CS_LDK_InvoiceRequest_quantity(int64_t this_arg) {
68020         LDKInvoiceRequest this_arg_conv;
68021         this_arg_conv.inner = untag_ptr(this_arg);
68022         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68023         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68024         this_arg_conv.is_owned = false;
68025         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
68026         *ret_copy = InvoiceRequest_quantity(&this_arg_conv);
68027         int64_t ret_ref = tag_ptr(ret_copy, true);
68028         return ret_ref;
68029 }
68030
68031 int8_tArray  CS_LDK_InvoiceRequest_payer_id(int64_t this_arg) {
68032         LDKInvoiceRequest this_arg_conv;
68033         this_arg_conv.inner = untag_ptr(this_arg);
68034         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68035         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68036         this_arg_conv.is_owned = false;
68037         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
68038         memcpy(ret_arr->elems, InvoiceRequest_payer_id(&this_arg_conv).compressed_form, 33);
68039         return ret_arr;
68040 }
68041
68042 int64_t  CS_LDK_InvoiceRequest_payer_note(int64_t this_arg) {
68043         LDKInvoiceRequest this_arg_conv;
68044         this_arg_conv.inner = untag_ptr(this_arg);
68045         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68046         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68047         this_arg_conv.is_owned = false;
68048         LDKPrintableString ret_var = InvoiceRequest_payer_note(&this_arg_conv);
68049         int64_t ret_ref = 0;
68050         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68051         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68052         return ret_ref;
68053 }
68054
68055 int64_t  CS_LDK_InvoiceRequest_respond_with(int64_t this_arg, int64_tArray payment_paths, int8_tArray payment_hash) {
68056         LDKInvoiceRequest this_arg_conv;
68057         this_arg_conv.inner = untag_ptr(this_arg);
68058         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68059         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68060         this_arg_conv.is_owned = false;
68061         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ payment_paths_constr;
68062         payment_paths_constr.datalen = payment_paths->arr_len;
68063         if (payment_paths_constr.datalen > 0)
68064                 payment_paths_constr.data = MALLOC(payment_paths_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
68065         else
68066                 payment_paths_constr.data = NULL;
68067         int64_t* payment_paths_vals = payment_paths->elems;
68068         for (size_t l = 0; l < payment_paths_constr.datalen; l++) {
68069                 int64_t payment_paths_conv_37 = payment_paths_vals[l];
68070                 void* payment_paths_conv_37_ptr = untag_ptr(payment_paths_conv_37);
68071                 CHECK_ACCESS(payment_paths_conv_37_ptr);
68072                 LDKC2Tuple_BlindedPayInfoBlindedPathZ payment_paths_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(payment_paths_conv_37_ptr);
68073                 payment_paths_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(payment_paths_conv_37));
68074                 payment_paths_constr.data[l] = payment_paths_conv_37_conv;
68075         }
68076         FREE(payment_paths);
68077         LDKThirtyTwoBytes payment_hash_ref;
68078         CHECK(payment_hash->arr_len == 32);
68079         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
68080         LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ");
68081         *ret_conv = InvoiceRequest_respond_with(&this_arg_conv, payment_paths_constr, payment_hash_ref);
68082         return tag_ptr(ret_conv, true);
68083 }
68084
68085 int64_t  CS_LDK_InvoiceRequest_respond_with_no_std(int64_t this_arg, int64_tArray payment_paths, int8_tArray payment_hash, int64_t created_at) {
68086         LDKInvoiceRequest this_arg_conv;
68087         this_arg_conv.inner = untag_ptr(this_arg);
68088         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68089         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68090         this_arg_conv.is_owned = false;
68091         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ payment_paths_constr;
68092         payment_paths_constr.datalen = payment_paths->arr_len;
68093         if (payment_paths_constr.datalen > 0)
68094                 payment_paths_constr.data = MALLOC(payment_paths_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
68095         else
68096                 payment_paths_constr.data = NULL;
68097         int64_t* payment_paths_vals = payment_paths->elems;
68098         for (size_t l = 0; l < payment_paths_constr.datalen; l++) {
68099                 int64_t payment_paths_conv_37 = payment_paths_vals[l];
68100                 void* payment_paths_conv_37_ptr = untag_ptr(payment_paths_conv_37);
68101                 CHECK_ACCESS(payment_paths_conv_37_ptr);
68102                 LDKC2Tuple_BlindedPayInfoBlindedPathZ payment_paths_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(payment_paths_conv_37_ptr);
68103                 payment_paths_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(payment_paths_conv_37));
68104                 payment_paths_constr.data[l] = payment_paths_conv_37_conv;
68105         }
68106         FREE(payment_paths);
68107         LDKThirtyTwoBytes payment_hash_ref;
68108         CHECK(payment_hash->arr_len == 32);
68109         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
68110         LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ");
68111         *ret_conv = InvoiceRequest_respond_with_no_std(&this_arg_conv, payment_paths_constr, payment_hash_ref, created_at);
68112         return tag_ptr(ret_conv, true);
68113 }
68114
68115 int64_t  CS_LDK_InvoiceRequest_verify(int64_t this_arg, int64_t key) {
68116         LDKInvoiceRequest this_arg_conv;
68117         this_arg_conv.inner = untag_ptr(this_arg);
68118         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68119         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68120         this_arg_conv = InvoiceRequest_clone(&this_arg_conv);
68121         LDKExpandedKey key_conv;
68122         key_conv.inner = untag_ptr(key);
68123         key_conv.is_owned = ptr_is_owned(key);
68124         CHECK_INNER_FIELD_ACCESS_OR_NULL(key_conv);
68125         key_conv.is_owned = false;
68126         LDKCResult_VerifiedInvoiceRequestNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_VerifiedInvoiceRequestNoneZ), "LDKCResult_VerifiedInvoiceRequestNoneZ");
68127         *ret_conv = InvoiceRequest_verify(this_arg_conv, &key_conv);
68128         return tag_ptr(ret_conv, true);
68129 }
68130
68131 int8_tArray  CS_LDK_InvoiceRequest_signature(int64_t this_arg) {
68132         LDKInvoiceRequest this_arg_conv;
68133         this_arg_conv.inner = untag_ptr(this_arg);
68134         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68135         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68136         this_arg_conv.is_owned = false;
68137         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
68138         memcpy(ret_arr->elems, InvoiceRequest_signature(&this_arg_conv).compact_form, 64);
68139         return ret_arr;
68140 }
68141
68142 ptrArray  CS_LDK_VerifiedInvoiceRequest_chains(int64_t this_arg) {
68143         LDKVerifiedInvoiceRequest this_arg_conv;
68144         this_arg_conv.inner = untag_ptr(this_arg);
68145         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68146         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68147         this_arg_conv.is_owned = false;
68148         LDKCVec_ThirtyTwoBytesZ ret_var = VerifiedInvoiceRequest_chains(&this_arg_conv);
68149         ptrArray ret_arr = NULL;
68150         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
68151         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
68152         for (size_t i = 0; i < ret_var.datalen; i++) {
68153                 int8_tArray ret_conv_8_arr = init_int8_tArray(32, __LINE__);
68154                 memcpy(ret_conv_8_arr->elems, ret_var.data[i].data, 32);
68155                 ret_arr_ptr[i] = ret_conv_8_arr;
68156         }
68157         
68158         FREE(ret_var.data);
68159         return ret_arr;
68160 }
68161
68162 int64_t  CS_LDK_VerifiedInvoiceRequest_metadata(int64_t this_arg) {
68163         LDKVerifiedInvoiceRequest this_arg_conv;
68164         this_arg_conv.inner = untag_ptr(this_arg);
68165         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68166         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68167         this_arg_conv.is_owned = false;
68168         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
68169         *ret_copy = VerifiedInvoiceRequest_metadata(&this_arg_conv);
68170         int64_t ret_ref = tag_ptr(ret_copy, true);
68171         return ret_ref;
68172 }
68173
68174 int64_t  CS_LDK_VerifiedInvoiceRequest_amount(int64_t this_arg) {
68175         LDKVerifiedInvoiceRequest this_arg_conv;
68176         this_arg_conv.inner = untag_ptr(this_arg);
68177         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68178         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68179         this_arg_conv.is_owned = false;
68180         LDKCOption_AmountZ *ret_copy = MALLOC(sizeof(LDKCOption_AmountZ), "LDKCOption_AmountZ");
68181         *ret_copy = VerifiedInvoiceRequest_amount(&this_arg_conv);
68182         int64_t ret_ref = tag_ptr(ret_copy, true);
68183         return ret_ref;
68184 }
68185
68186 int64_t  CS_LDK_VerifiedInvoiceRequest_description(int64_t this_arg) {
68187         LDKVerifiedInvoiceRequest this_arg_conv;
68188         this_arg_conv.inner = untag_ptr(this_arg);
68189         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68190         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68191         this_arg_conv.is_owned = false;
68192         LDKPrintableString ret_var = VerifiedInvoiceRequest_description(&this_arg_conv);
68193         int64_t ret_ref = 0;
68194         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68195         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68196         return ret_ref;
68197 }
68198
68199 int64_t  CS_LDK_VerifiedInvoiceRequest_offer_features(int64_t this_arg) {
68200         LDKVerifiedInvoiceRequest this_arg_conv;
68201         this_arg_conv.inner = untag_ptr(this_arg);
68202         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68203         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68204         this_arg_conv.is_owned = false;
68205         LDKOfferFeatures ret_var = VerifiedInvoiceRequest_offer_features(&this_arg_conv);
68206         int64_t ret_ref = 0;
68207         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68208         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68209         return ret_ref;
68210 }
68211
68212 int64_t  CS_LDK_VerifiedInvoiceRequest_absolute_expiry(int64_t this_arg) {
68213         LDKVerifiedInvoiceRequest this_arg_conv;
68214         this_arg_conv.inner = untag_ptr(this_arg);
68215         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68216         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68217         this_arg_conv.is_owned = false;
68218         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
68219         *ret_copy = VerifiedInvoiceRequest_absolute_expiry(&this_arg_conv);
68220         int64_t ret_ref = tag_ptr(ret_copy, true);
68221         return ret_ref;
68222 }
68223
68224 int64_t  CS_LDK_VerifiedInvoiceRequest_issuer(int64_t this_arg) {
68225         LDKVerifiedInvoiceRequest this_arg_conv;
68226         this_arg_conv.inner = untag_ptr(this_arg);
68227         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68228         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68229         this_arg_conv.is_owned = false;
68230         LDKPrintableString ret_var = VerifiedInvoiceRequest_issuer(&this_arg_conv);
68231         int64_t ret_ref = 0;
68232         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68233         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68234         return ret_ref;
68235 }
68236
68237 int64_tArray  CS_LDK_VerifiedInvoiceRequest_paths(int64_t this_arg) {
68238         LDKVerifiedInvoiceRequest this_arg_conv;
68239         this_arg_conv.inner = untag_ptr(this_arg);
68240         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68241         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68242         this_arg_conv.is_owned = false;
68243         LDKCVec_BlindedPathZ ret_var = VerifiedInvoiceRequest_paths(&this_arg_conv);
68244         int64_tArray ret_arr = NULL;
68245         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
68246         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
68247         for (size_t n = 0; n < ret_var.datalen; n++) {
68248                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
68249                 int64_t ret_conv_13_ref = 0;
68250                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
68251                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
68252                 ret_arr_ptr[n] = ret_conv_13_ref;
68253         }
68254         
68255         FREE(ret_var.data);
68256         return ret_arr;
68257 }
68258
68259 int64_t  CS_LDK_VerifiedInvoiceRequest_supported_quantity(int64_t this_arg) {
68260         LDKVerifiedInvoiceRequest this_arg_conv;
68261         this_arg_conv.inner = untag_ptr(this_arg);
68262         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68263         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68264         this_arg_conv.is_owned = false;
68265         LDKQuantity *ret_copy = MALLOC(sizeof(LDKQuantity), "LDKQuantity");
68266         *ret_copy = VerifiedInvoiceRequest_supported_quantity(&this_arg_conv);
68267         int64_t ret_ref = tag_ptr(ret_copy, true);
68268         return ret_ref;
68269 }
68270
68271 int8_tArray  CS_LDK_VerifiedInvoiceRequest_signing_pubkey(int64_t this_arg) {
68272         LDKVerifiedInvoiceRequest this_arg_conv;
68273         this_arg_conv.inner = untag_ptr(this_arg);
68274         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68275         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68276         this_arg_conv.is_owned = false;
68277         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
68278         memcpy(ret_arr->elems, VerifiedInvoiceRequest_signing_pubkey(&this_arg_conv).compressed_form, 33);
68279         return ret_arr;
68280 }
68281
68282 int8_tArray  CS_LDK_VerifiedInvoiceRequest_payer_metadata(int64_t this_arg) {
68283         LDKVerifiedInvoiceRequest this_arg_conv;
68284         this_arg_conv.inner = untag_ptr(this_arg);
68285         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68286         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68287         this_arg_conv.is_owned = false;
68288         LDKu8slice ret_var = VerifiedInvoiceRequest_payer_metadata(&this_arg_conv);
68289         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
68290         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
68291         return ret_arr;
68292 }
68293
68294 int8_tArray  CS_LDK_VerifiedInvoiceRequest_chain(int64_t this_arg) {
68295         LDKVerifiedInvoiceRequest this_arg_conv;
68296         this_arg_conv.inner = untag_ptr(this_arg);
68297         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68298         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68299         this_arg_conv.is_owned = false;
68300         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
68301         memcpy(ret_arr->elems, VerifiedInvoiceRequest_chain(&this_arg_conv).data, 32);
68302         return ret_arr;
68303 }
68304
68305 int64_t  CS_LDK_VerifiedInvoiceRequest_amount_msats(int64_t this_arg) {
68306         LDKVerifiedInvoiceRequest this_arg_conv;
68307         this_arg_conv.inner = untag_ptr(this_arg);
68308         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68309         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68310         this_arg_conv.is_owned = false;
68311         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
68312         *ret_copy = VerifiedInvoiceRequest_amount_msats(&this_arg_conv);
68313         int64_t ret_ref = tag_ptr(ret_copy, true);
68314         return ret_ref;
68315 }
68316
68317 int64_t  CS_LDK_VerifiedInvoiceRequest_invoice_request_features(int64_t this_arg) {
68318         LDKVerifiedInvoiceRequest this_arg_conv;
68319         this_arg_conv.inner = untag_ptr(this_arg);
68320         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68321         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68322         this_arg_conv.is_owned = false;
68323         LDKInvoiceRequestFeatures ret_var = VerifiedInvoiceRequest_invoice_request_features(&this_arg_conv);
68324         int64_t ret_ref = 0;
68325         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68326         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68327         return ret_ref;
68328 }
68329
68330 int64_t  CS_LDK_VerifiedInvoiceRequest_quantity(int64_t this_arg) {
68331         LDKVerifiedInvoiceRequest this_arg_conv;
68332         this_arg_conv.inner = untag_ptr(this_arg);
68333         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68334         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68335         this_arg_conv.is_owned = false;
68336         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
68337         *ret_copy = VerifiedInvoiceRequest_quantity(&this_arg_conv);
68338         int64_t ret_ref = tag_ptr(ret_copy, true);
68339         return ret_ref;
68340 }
68341
68342 int8_tArray  CS_LDK_VerifiedInvoiceRequest_payer_id(int64_t this_arg) {
68343         LDKVerifiedInvoiceRequest this_arg_conv;
68344         this_arg_conv.inner = untag_ptr(this_arg);
68345         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68346         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68347         this_arg_conv.is_owned = false;
68348         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
68349         memcpy(ret_arr->elems, VerifiedInvoiceRequest_payer_id(&this_arg_conv).compressed_form, 33);
68350         return ret_arr;
68351 }
68352
68353 int64_t  CS_LDK_VerifiedInvoiceRequest_payer_note(int64_t this_arg) {
68354         LDKVerifiedInvoiceRequest this_arg_conv;
68355         this_arg_conv.inner = untag_ptr(this_arg);
68356         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68357         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68358         this_arg_conv.is_owned = false;
68359         LDKPrintableString ret_var = VerifiedInvoiceRequest_payer_note(&this_arg_conv);
68360         int64_t ret_ref = 0;
68361         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68362         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68363         return ret_ref;
68364 }
68365
68366 int64_t  CS_LDK_VerifiedInvoiceRequest_respond_with(int64_t this_arg, int64_tArray payment_paths, int8_tArray payment_hash) {
68367         LDKVerifiedInvoiceRequest this_arg_conv;
68368         this_arg_conv.inner = untag_ptr(this_arg);
68369         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68370         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68371         this_arg_conv.is_owned = false;
68372         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ payment_paths_constr;
68373         payment_paths_constr.datalen = payment_paths->arr_len;
68374         if (payment_paths_constr.datalen > 0)
68375                 payment_paths_constr.data = MALLOC(payment_paths_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
68376         else
68377                 payment_paths_constr.data = NULL;
68378         int64_t* payment_paths_vals = payment_paths->elems;
68379         for (size_t l = 0; l < payment_paths_constr.datalen; l++) {
68380                 int64_t payment_paths_conv_37 = payment_paths_vals[l];
68381                 void* payment_paths_conv_37_ptr = untag_ptr(payment_paths_conv_37);
68382                 CHECK_ACCESS(payment_paths_conv_37_ptr);
68383                 LDKC2Tuple_BlindedPayInfoBlindedPathZ payment_paths_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(payment_paths_conv_37_ptr);
68384                 payment_paths_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(payment_paths_conv_37));
68385                 payment_paths_constr.data[l] = payment_paths_conv_37_conv;
68386         }
68387         FREE(payment_paths);
68388         LDKThirtyTwoBytes payment_hash_ref;
68389         CHECK(payment_hash->arr_len == 32);
68390         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
68391         LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ");
68392         *ret_conv = VerifiedInvoiceRequest_respond_with(&this_arg_conv, payment_paths_constr, payment_hash_ref);
68393         return tag_ptr(ret_conv, true);
68394 }
68395
68396 int64_t  CS_LDK_VerifiedInvoiceRequest_respond_with_no_std(int64_t this_arg, int64_tArray payment_paths, int8_tArray payment_hash, int64_t created_at) {
68397         LDKVerifiedInvoiceRequest this_arg_conv;
68398         this_arg_conv.inner = untag_ptr(this_arg);
68399         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68400         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68401         this_arg_conv.is_owned = false;
68402         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ payment_paths_constr;
68403         payment_paths_constr.datalen = payment_paths->arr_len;
68404         if (payment_paths_constr.datalen > 0)
68405                 payment_paths_constr.data = MALLOC(payment_paths_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
68406         else
68407                 payment_paths_constr.data = NULL;
68408         int64_t* payment_paths_vals = payment_paths->elems;
68409         for (size_t l = 0; l < payment_paths_constr.datalen; l++) {
68410                 int64_t payment_paths_conv_37 = payment_paths_vals[l];
68411                 void* payment_paths_conv_37_ptr = untag_ptr(payment_paths_conv_37);
68412                 CHECK_ACCESS(payment_paths_conv_37_ptr);
68413                 LDKC2Tuple_BlindedPayInfoBlindedPathZ payment_paths_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(payment_paths_conv_37_ptr);
68414                 payment_paths_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(payment_paths_conv_37));
68415                 payment_paths_constr.data[l] = payment_paths_conv_37_conv;
68416         }
68417         FREE(payment_paths);
68418         LDKThirtyTwoBytes payment_hash_ref;
68419         CHECK(payment_hash->arr_len == 32);
68420         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
68421         LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ");
68422         *ret_conv = VerifiedInvoiceRequest_respond_with_no_std(&this_arg_conv, payment_paths_constr, payment_hash_ref, created_at);
68423         return tag_ptr(ret_conv, true);
68424 }
68425
68426 int64_t  CS_LDK_VerifiedInvoiceRequest_respond_using_derived_keys(int64_t this_arg, int64_tArray payment_paths, int8_tArray payment_hash) {
68427         LDKVerifiedInvoiceRequest this_arg_conv;
68428         this_arg_conv.inner = untag_ptr(this_arg);
68429         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68430         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68431         this_arg_conv.is_owned = false;
68432         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ payment_paths_constr;
68433         payment_paths_constr.datalen = payment_paths->arr_len;
68434         if (payment_paths_constr.datalen > 0)
68435                 payment_paths_constr.data = MALLOC(payment_paths_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
68436         else
68437                 payment_paths_constr.data = NULL;
68438         int64_t* payment_paths_vals = payment_paths->elems;
68439         for (size_t l = 0; l < payment_paths_constr.datalen; l++) {
68440                 int64_t payment_paths_conv_37 = payment_paths_vals[l];
68441                 void* payment_paths_conv_37_ptr = untag_ptr(payment_paths_conv_37);
68442                 CHECK_ACCESS(payment_paths_conv_37_ptr);
68443                 LDKC2Tuple_BlindedPayInfoBlindedPathZ payment_paths_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(payment_paths_conv_37_ptr);
68444                 payment_paths_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(payment_paths_conv_37));
68445                 payment_paths_constr.data[l] = payment_paths_conv_37_conv;
68446         }
68447         FREE(payment_paths);
68448         LDKThirtyTwoBytes payment_hash_ref;
68449         CHECK(payment_hash->arr_len == 32);
68450         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
68451         LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ");
68452         *ret_conv = VerifiedInvoiceRequest_respond_using_derived_keys(&this_arg_conv, payment_paths_constr, payment_hash_ref);
68453         return tag_ptr(ret_conv, true);
68454 }
68455
68456 int64_t  CS_LDK_VerifiedInvoiceRequest_respond_using_derived_keys_no_std(int64_t this_arg, int64_tArray payment_paths, int8_tArray payment_hash, int64_t created_at) {
68457         LDKVerifiedInvoiceRequest this_arg_conv;
68458         this_arg_conv.inner = untag_ptr(this_arg);
68459         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68460         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68461         this_arg_conv.is_owned = false;
68462         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ payment_paths_constr;
68463         payment_paths_constr.datalen = payment_paths->arr_len;
68464         if (payment_paths_constr.datalen > 0)
68465                 payment_paths_constr.data = MALLOC(payment_paths_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
68466         else
68467                 payment_paths_constr.data = NULL;
68468         int64_t* payment_paths_vals = payment_paths->elems;
68469         for (size_t l = 0; l < payment_paths_constr.datalen; l++) {
68470                 int64_t payment_paths_conv_37 = payment_paths_vals[l];
68471                 void* payment_paths_conv_37_ptr = untag_ptr(payment_paths_conv_37);
68472                 CHECK_ACCESS(payment_paths_conv_37_ptr);
68473                 LDKC2Tuple_BlindedPayInfoBlindedPathZ payment_paths_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(payment_paths_conv_37_ptr);
68474                 payment_paths_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(payment_paths_conv_37));
68475                 payment_paths_constr.data[l] = payment_paths_conv_37_conv;
68476         }
68477         FREE(payment_paths);
68478         LDKThirtyTwoBytes payment_hash_ref;
68479         CHECK(payment_hash->arr_len == 32);
68480         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
68481         LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ");
68482         *ret_conv = VerifiedInvoiceRequest_respond_using_derived_keys_no_std(&this_arg_conv, payment_paths_constr, payment_hash_ref, created_at);
68483         return tag_ptr(ret_conv, true);
68484 }
68485
68486 int8_tArray  CS_LDK_UnsignedInvoiceRequest_write(int64_t obj) {
68487         LDKUnsignedInvoiceRequest obj_conv;
68488         obj_conv.inner = untag_ptr(obj);
68489         obj_conv.is_owned = ptr_is_owned(obj);
68490         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
68491         obj_conv.is_owned = false;
68492         LDKCVec_u8Z ret_var = UnsignedInvoiceRequest_write(&obj_conv);
68493         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
68494         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
68495         CVec_u8Z_free(ret_var);
68496         return ret_arr;
68497 }
68498
68499 int8_tArray  CS_LDK_InvoiceRequest_write(int64_t obj) {
68500         LDKInvoiceRequest obj_conv;
68501         obj_conv.inner = untag_ptr(obj);
68502         obj_conv.is_owned = ptr_is_owned(obj);
68503         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
68504         obj_conv.is_owned = false;
68505         LDKCVec_u8Z ret_var = InvoiceRequest_write(&obj_conv);
68506         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
68507         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
68508         CVec_u8Z_free(ret_var);
68509         return ret_arr;
68510 }
68511
68512 void  CS_LDK_InvoiceRequestFields_free(int64_t this_obj) {
68513         LDKInvoiceRequestFields this_obj_conv;
68514         this_obj_conv.inner = untag_ptr(this_obj);
68515         this_obj_conv.is_owned = ptr_is_owned(this_obj);
68516         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
68517         InvoiceRequestFields_free(this_obj_conv);
68518 }
68519
68520 int8_tArray  CS_LDK_InvoiceRequestFields_get_payer_id(int64_t this_ptr) {
68521         LDKInvoiceRequestFields this_ptr_conv;
68522         this_ptr_conv.inner = untag_ptr(this_ptr);
68523         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68524         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68525         this_ptr_conv.is_owned = false;
68526         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
68527         memcpy(ret_arr->elems, InvoiceRequestFields_get_payer_id(&this_ptr_conv).compressed_form, 33);
68528         return ret_arr;
68529 }
68530
68531 void  CS_LDK_InvoiceRequestFields_set_payer_id(int64_t this_ptr, int8_tArray val) {
68532         LDKInvoiceRequestFields this_ptr_conv;
68533         this_ptr_conv.inner = untag_ptr(this_ptr);
68534         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68535         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68536         this_ptr_conv.is_owned = false;
68537         LDKPublicKey val_ref;
68538         CHECK(val->arr_len == 33);
68539         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
68540         InvoiceRequestFields_set_payer_id(&this_ptr_conv, val_ref);
68541 }
68542
68543 int64_t  CS_LDK_InvoiceRequestFields_get_quantity(int64_t this_ptr) {
68544         LDKInvoiceRequestFields this_ptr_conv;
68545         this_ptr_conv.inner = untag_ptr(this_ptr);
68546         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68547         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68548         this_ptr_conv.is_owned = false;
68549         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
68550         *ret_copy = InvoiceRequestFields_get_quantity(&this_ptr_conv);
68551         int64_t ret_ref = tag_ptr(ret_copy, true);
68552         return ret_ref;
68553 }
68554
68555 void  CS_LDK_InvoiceRequestFields_set_quantity(int64_t this_ptr, int64_t val) {
68556         LDKInvoiceRequestFields this_ptr_conv;
68557         this_ptr_conv.inner = untag_ptr(this_ptr);
68558         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68559         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68560         this_ptr_conv.is_owned = false;
68561         void* val_ptr = untag_ptr(val);
68562         CHECK_ACCESS(val_ptr);
68563         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
68564         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
68565         InvoiceRequestFields_set_quantity(&this_ptr_conv, val_conv);
68566 }
68567
68568 int64_t  CS_LDK_InvoiceRequestFields_get_payer_note_truncated(int64_t this_ptr) {
68569         LDKInvoiceRequestFields this_ptr_conv;
68570         this_ptr_conv.inner = untag_ptr(this_ptr);
68571         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68572         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68573         this_ptr_conv.is_owned = false;
68574         LDKUntrustedString ret_var = InvoiceRequestFields_get_payer_note_truncated(&this_ptr_conv);
68575         int64_t ret_ref = 0;
68576         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68577         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68578         return ret_ref;
68579 }
68580
68581 void  CS_LDK_InvoiceRequestFields_set_payer_note_truncated(int64_t this_ptr, int64_t val) {
68582         LDKInvoiceRequestFields this_ptr_conv;
68583         this_ptr_conv.inner = untag_ptr(this_ptr);
68584         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68585         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68586         this_ptr_conv.is_owned = false;
68587         LDKUntrustedString val_conv;
68588         val_conv.inner = untag_ptr(val);
68589         val_conv.is_owned = ptr_is_owned(val);
68590         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
68591         val_conv = UntrustedString_clone(&val_conv);
68592         InvoiceRequestFields_set_payer_note_truncated(&this_ptr_conv, val_conv);
68593 }
68594
68595 int64_t  CS_LDK_InvoiceRequestFields_new(int8_tArray payer_id_arg, int64_t quantity_arg, int64_t payer_note_truncated_arg) {
68596         LDKPublicKey payer_id_arg_ref;
68597         CHECK(payer_id_arg->arr_len == 33);
68598         memcpy(payer_id_arg_ref.compressed_form, payer_id_arg->elems, 33); FREE(payer_id_arg);
68599         void* quantity_arg_ptr = untag_ptr(quantity_arg);
68600         CHECK_ACCESS(quantity_arg_ptr);
68601         LDKCOption_u64Z quantity_arg_conv = *(LDKCOption_u64Z*)(quantity_arg_ptr);
68602         quantity_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(quantity_arg));
68603         LDKUntrustedString payer_note_truncated_arg_conv;
68604         payer_note_truncated_arg_conv.inner = untag_ptr(payer_note_truncated_arg);
68605         payer_note_truncated_arg_conv.is_owned = ptr_is_owned(payer_note_truncated_arg);
68606         CHECK_INNER_FIELD_ACCESS_OR_NULL(payer_note_truncated_arg_conv);
68607         payer_note_truncated_arg_conv = UntrustedString_clone(&payer_note_truncated_arg_conv);
68608         LDKInvoiceRequestFields ret_var = InvoiceRequestFields_new(payer_id_arg_ref, quantity_arg_conv, payer_note_truncated_arg_conv);
68609         int64_t ret_ref = 0;
68610         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68611         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68612         return ret_ref;
68613 }
68614
68615 static inline uint64_t InvoiceRequestFields_clone_ptr(LDKInvoiceRequestFields *NONNULL_PTR arg) {
68616         LDKInvoiceRequestFields ret_var = InvoiceRequestFields_clone(arg);
68617         int64_t ret_ref = 0;
68618         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68619         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68620         return ret_ref;
68621 }
68622 int64_t  CS_LDK_InvoiceRequestFields_clone_ptr(int64_t arg) {
68623         LDKInvoiceRequestFields arg_conv;
68624         arg_conv.inner = untag_ptr(arg);
68625         arg_conv.is_owned = ptr_is_owned(arg);
68626         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
68627         arg_conv.is_owned = false;
68628         int64_t ret_conv = InvoiceRequestFields_clone_ptr(&arg_conv);
68629         return ret_conv;
68630 }
68631
68632 int64_t  CS_LDK_InvoiceRequestFields_clone(int64_t orig) {
68633         LDKInvoiceRequestFields orig_conv;
68634         orig_conv.inner = untag_ptr(orig);
68635         orig_conv.is_owned = ptr_is_owned(orig);
68636         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
68637         orig_conv.is_owned = false;
68638         LDKInvoiceRequestFields ret_var = InvoiceRequestFields_clone(&orig_conv);
68639         int64_t ret_ref = 0;
68640         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68641         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68642         return ret_ref;
68643 }
68644
68645 jboolean  CS_LDK_InvoiceRequestFields_eq(int64_t a, int64_t b) {
68646         LDKInvoiceRequestFields a_conv;
68647         a_conv.inner = untag_ptr(a);
68648         a_conv.is_owned = ptr_is_owned(a);
68649         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
68650         a_conv.is_owned = false;
68651         LDKInvoiceRequestFields b_conv;
68652         b_conv.inner = untag_ptr(b);
68653         b_conv.is_owned = ptr_is_owned(b);
68654         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
68655         b_conv.is_owned = false;
68656         jboolean ret_conv = InvoiceRequestFields_eq(&a_conv, &b_conv);
68657         return ret_conv;
68658 }
68659
68660 int8_tArray  CS_LDK_InvoiceRequestFields_write(int64_t obj) {
68661         LDKInvoiceRequestFields obj_conv;
68662         obj_conv.inner = untag_ptr(obj);
68663         obj_conv.is_owned = ptr_is_owned(obj);
68664         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
68665         obj_conv.is_owned = false;
68666         LDKCVec_u8Z ret_var = InvoiceRequestFields_write(&obj_conv);
68667         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
68668         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
68669         CVec_u8Z_free(ret_var);
68670         return ret_arr;
68671 }
68672
68673 int64_t  CS_LDK_InvoiceRequestFields_read(int8_tArray ser) {
68674         LDKu8slice ser_ref;
68675         ser_ref.datalen = ser->arr_len;
68676         ser_ref.data = ser->elems;
68677         LDKCResult_InvoiceRequestFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestFieldsDecodeErrorZ), "LDKCResult_InvoiceRequestFieldsDecodeErrorZ");
68678         *ret_conv = InvoiceRequestFields_read(ser_ref);
68679         FREE(ser);
68680         return tag_ptr(ret_conv, true);
68681 }
68682
68683 void  CS_LDK_TaggedHash_free(int64_t this_obj) {
68684         LDKTaggedHash this_obj_conv;
68685         this_obj_conv.inner = untag_ptr(this_obj);
68686         this_obj_conv.is_owned = ptr_is_owned(this_obj);
68687         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
68688         TaggedHash_free(this_obj_conv);
68689 }
68690
68691 static inline uint64_t TaggedHash_clone_ptr(LDKTaggedHash *NONNULL_PTR arg) {
68692         LDKTaggedHash ret_var = TaggedHash_clone(arg);
68693         int64_t ret_ref = 0;
68694         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68695         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68696         return ret_ref;
68697 }
68698 int64_t  CS_LDK_TaggedHash_clone_ptr(int64_t arg) {
68699         LDKTaggedHash arg_conv;
68700         arg_conv.inner = untag_ptr(arg);
68701         arg_conv.is_owned = ptr_is_owned(arg);
68702         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
68703         arg_conv.is_owned = false;
68704         int64_t ret_conv = TaggedHash_clone_ptr(&arg_conv);
68705         return ret_conv;
68706 }
68707
68708 int64_t  CS_LDK_TaggedHash_clone(int64_t orig) {
68709         LDKTaggedHash orig_conv;
68710         orig_conv.inner = untag_ptr(orig);
68711         orig_conv.is_owned = ptr_is_owned(orig);
68712         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
68713         orig_conv.is_owned = false;
68714         LDKTaggedHash ret_var = TaggedHash_clone(&orig_conv);
68715         int64_t ret_ref = 0;
68716         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68717         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68718         return ret_ref;
68719 }
68720
68721 int8_tArray  CS_LDK_TaggedHash_as_digest(int64_t this_arg) {
68722         LDKTaggedHash this_arg_conv;
68723         this_arg_conv.inner = untag_ptr(this_arg);
68724         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68725         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68726         this_arg_conv.is_owned = false;
68727         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
68728         memcpy(ret_arr->elems, *TaggedHash_as_digest(&this_arg_conv), 32);
68729         return ret_arr;
68730 }
68731
68732 jstring  CS_LDK_TaggedHash_tag(int64_t this_arg) {
68733         LDKTaggedHash this_arg_conv;
68734         this_arg_conv.inner = untag_ptr(this_arg);
68735         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68736         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68737         this_arg_conv.is_owned = false;
68738         LDKStr ret_str = TaggedHash_tag(&this_arg_conv);
68739         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
68740         Str_free(ret_str);
68741         return ret_conv;
68742 }
68743
68744 int8_tArray  CS_LDK_TaggedHash_merkle_root(int64_t this_arg) {
68745         LDKTaggedHash this_arg_conv;
68746         this_arg_conv.inner = untag_ptr(this_arg);
68747         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68748         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68749         this_arg_conv.is_owned = false;
68750         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
68751         memcpy(ret_arr->elems, TaggedHash_merkle_root(&this_arg_conv).data, 32);
68752         return ret_arr;
68753 }
68754
68755 void  CS_LDK_SignError_free(int64_t this_ptr) {
68756         if (!ptr_is_owned(this_ptr)) return;
68757         void* this_ptr_ptr = untag_ptr(this_ptr);
68758         CHECK_ACCESS(this_ptr_ptr);
68759         LDKSignError this_ptr_conv = *(LDKSignError*)(this_ptr_ptr);
68760         FREE(untag_ptr(this_ptr));
68761         SignError_free(this_ptr_conv);
68762 }
68763
68764 static inline uint64_t SignError_clone_ptr(LDKSignError *NONNULL_PTR arg) {
68765         LDKSignError *ret_copy = MALLOC(sizeof(LDKSignError), "LDKSignError");
68766         *ret_copy = SignError_clone(arg);
68767         int64_t ret_ref = tag_ptr(ret_copy, true);
68768         return ret_ref;
68769 }
68770 int64_t  CS_LDK_SignError_clone_ptr(int64_t arg) {
68771         LDKSignError* arg_conv = (LDKSignError*)untag_ptr(arg);
68772         int64_t ret_conv = SignError_clone_ptr(arg_conv);
68773         return ret_conv;
68774 }
68775
68776 int64_t  CS_LDK_SignError_clone(int64_t orig) {
68777         LDKSignError* orig_conv = (LDKSignError*)untag_ptr(orig);
68778         LDKSignError *ret_copy = MALLOC(sizeof(LDKSignError), "LDKSignError");
68779         *ret_copy = SignError_clone(orig_conv);
68780         int64_t ret_ref = tag_ptr(ret_copy, true);
68781         return ret_ref;
68782 }
68783
68784 int64_t  CS_LDK_SignError_signing() {
68785         LDKSignError *ret_copy = MALLOC(sizeof(LDKSignError), "LDKSignError");
68786         *ret_copy = SignError_signing();
68787         int64_t ret_ref = tag_ptr(ret_copy, true);
68788         return ret_ref;
68789 }
68790
68791 int64_t  CS_LDK_SignError_verification(int32_t a) {
68792         LDKSecp256k1Error a_conv = LDKSecp256k1Error_from_cs(a);
68793         LDKSignError *ret_copy = MALLOC(sizeof(LDKSignError), "LDKSignError");
68794         *ret_copy = SignError_verification(a_conv);
68795         int64_t ret_ref = tag_ptr(ret_copy, true);
68796         return ret_ref;
68797 }
68798
68799 void  CS_LDK_Bolt12ParseError_free(int64_t this_obj) {
68800         LDKBolt12ParseError this_obj_conv;
68801         this_obj_conv.inner = untag_ptr(this_obj);
68802         this_obj_conv.is_owned = ptr_is_owned(this_obj);
68803         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
68804         Bolt12ParseError_free(this_obj_conv);
68805 }
68806
68807 static inline uint64_t Bolt12ParseError_clone_ptr(LDKBolt12ParseError *NONNULL_PTR arg) {
68808         LDKBolt12ParseError ret_var = Bolt12ParseError_clone(arg);
68809         int64_t ret_ref = 0;
68810         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68811         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68812         return ret_ref;
68813 }
68814 int64_t  CS_LDK_Bolt12ParseError_clone_ptr(int64_t arg) {
68815         LDKBolt12ParseError arg_conv;
68816         arg_conv.inner = untag_ptr(arg);
68817         arg_conv.is_owned = ptr_is_owned(arg);
68818         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
68819         arg_conv.is_owned = false;
68820         int64_t ret_conv = Bolt12ParseError_clone_ptr(&arg_conv);
68821         return ret_conv;
68822 }
68823
68824 int64_t  CS_LDK_Bolt12ParseError_clone(int64_t orig) {
68825         LDKBolt12ParseError orig_conv;
68826         orig_conv.inner = untag_ptr(orig);
68827         orig_conv.is_owned = ptr_is_owned(orig);
68828         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
68829         orig_conv.is_owned = false;
68830         LDKBolt12ParseError ret_var = Bolt12ParseError_clone(&orig_conv);
68831         int64_t ret_ref = 0;
68832         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68833         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68834         return ret_ref;
68835 }
68836
68837 int32_t  CS_LDK_Bolt12SemanticError_clone(int64_t orig) {
68838         LDKBolt12SemanticError* orig_conv = (LDKBolt12SemanticError*)untag_ptr(orig);
68839         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_clone(orig_conv));
68840         return ret_conv;
68841 }
68842
68843 int32_t  CS_LDK_Bolt12SemanticError_already_expired() {
68844         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_already_expired());
68845         return ret_conv;
68846 }
68847
68848 int32_t  CS_LDK_Bolt12SemanticError_unsupported_chain() {
68849         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_unsupported_chain());
68850         return ret_conv;
68851 }
68852
68853 int32_t  CS_LDK_Bolt12SemanticError_unexpected_chain() {
68854         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_unexpected_chain());
68855         return ret_conv;
68856 }
68857
68858 int32_t  CS_LDK_Bolt12SemanticError_missing_amount() {
68859         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_missing_amount());
68860         return ret_conv;
68861 }
68862
68863 int32_t  CS_LDK_Bolt12SemanticError_invalid_amount() {
68864         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_invalid_amount());
68865         return ret_conv;
68866 }
68867
68868 int32_t  CS_LDK_Bolt12SemanticError_insufficient_amount() {
68869         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_insufficient_amount());
68870         return ret_conv;
68871 }
68872
68873 int32_t  CS_LDK_Bolt12SemanticError_unexpected_amount() {
68874         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_unexpected_amount());
68875         return ret_conv;
68876 }
68877
68878 int32_t  CS_LDK_Bolt12SemanticError_unsupported_currency() {
68879         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_unsupported_currency());
68880         return ret_conv;
68881 }
68882
68883 int32_t  CS_LDK_Bolt12SemanticError_unknown_required_features() {
68884         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_unknown_required_features());
68885         return ret_conv;
68886 }
68887
68888 int32_t  CS_LDK_Bolt12SemanticError_unexpected_features() {
68889         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_unexpected_features());
68890         return ret_conv;
68891 }
68892
68893 int32_t  CS_LDK_Bolt12SemanticError_missing_description() {
68894         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_missing_description());
68895         return ret_conv;
68896 }
68897
68898 int32_t  CS_LDK_Bolt12SemanticError_missing_signing_pubkey() {
68899         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_missing_signing_pubkey());
68900         return ret_conv;
68901 }
68902
68903 int32_t  CS_LDK_Bolt12SemanticError_invalid_signing_pubkey() {
68904         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_invalid_signing_pubkey());
68905         return ret_conv;
68906 }
68907
68908 int32_t  CS_LDK_Bolt12SemanticError_unexpected_signing_pubkey() {
68909         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_unexpected_signing_pubkey());
68910         return ret_conv;
68911 }
68912
68913 int32_t  CS_LDK_Bolt12SemanticError_missing_quantity() {
68914         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_missing_quantity());
68915         return ret_conv;
68916 }
68917
68918 int32_t  CS_LDK_Bolt12SemanticError_invalid_quantity() {
68919         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_invalid_quantity());
68920         return ret_conv;
68921 }
68922
68923 int32_t  CS_LDK_Bolt12SemanticError_unexpected_quantity() {
68924         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_unexpected_quantity());
68925         return ret_conv;
68926 }
68927
68928 int32_t  CS_LDK_Bolt12SemanticError_invalid_metadata() {
68929         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_invalid_metadata());
68930         return ret_conv;
68931 }
68932
68933 int32_t  CS_LDK_Bolt12SemanticError_unexpected_metadata() {
68934         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_unexpected_metadata());
68935         return ret_conv;
68936 }
68937
68938 int32_t  CS_LDK_Bolt12SemanticError_missing_payer_metadata() {
68939         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_missing_payer_metadata());
68940         return ret_conv;
68941 }
68942
68943 int32_t  CS_LDK_Bolt12SemanticError_missing_payer_id() {
68944         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_missing_payer_id());
68945         return ret_conv;
68946 }
68947
68948 int32_t  CS_LDK_Bolt12SemanticError_duplicate_payment_id() {
68949         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_duplicate_payment_id());
68950         return ret_conv;
68951 }
68952
68953 int32_t  CS_LDK_Bolt12SemanticError_missing_paths() {
68954         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_missing_paths());
68955         return ret_conv;
68956 }
68957
68958 int32_t  CS_LDK_Bolt12SemanticError_unexpected_paths() {
68959         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_unexpected_paths());
68960         return ret_conv;
68961 }
68962
68963 int32_t  CS_LDK_Bolt12SemanticError_invalid_pay_info() {
68964         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_invalid_pay_info());
68965         return ret_conv;
68966 }
68967
68968 int32_t  CS_LDK_Bolt12SemanticError_missing_creation_time() {
68969         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_missing_creation_time());
68970         return ret_conv;
68971 }
68972
68973 int32_t  CS_LDK_Bolt12SemanticError_missing_payment_hash() {
68974         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_missing_payment_hash());
68975         return ret_conv;
68976 }
68977
68978 int32_t  CS_LDK_Bolt12SemanticError_missing_signature() {
68979         int32_t ret_conv = LDKBolt12SemanticError_to_cs(Bolt12SemanticError_missing_signature());
68980         return ret_conv;
68981 }
68982
68983 void  CS_LDK_RefundMaybeWithDerivedMetadataBuilder_free(int64_t this_obj) {
68984         LDKRefundMaybeWithDerivedMetadataBuilder this_obj_conv;
68985         this_obj_conv.inner = untag_ptr(this_obj);
68986         this_obj_conv.is_owned = ptr_is_owned(this_obj);
68987         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
68988         RefundMaybeWithDerivedMetadataBuilder_free(this_obj_conv);
68989 }
68990
68991 static inline uint64_t RefundMaybeWithDerivedMetadataBuilder_clone_ptr(LDKRefundMaybeWithDerivedMetadataBuilder *NONNULL_PTR arg) {
68992         LDKRefundMaybeWithDerivedMetadataBuilder ret_var = RefundMaybeWithDerivedMetadataBuilder_clone(arg);
68993         int64_t ret_ref = 0;
68994         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68995         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68996         return ret_ref;
68997 }
68998 int64_t  CS_LDK_RefundMaybeWithDerivedMetadataBuilder_clone_ptr(int64_t arg) {
68999         LDKRefundMaybeWithDerivedMetadataBuilder arg_conv;
69000         arg_conv.inner = untag_ptr(arg);
69001         arg_conv.is_owned = ptr_is_owned(arg);
69002         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
69003         arg_conv.is_owned = false;
69004         int64_t ret_conv = RefundMaybeWithDerivedMetadataBuilder_clone_ptr(&arg_conv);
69005         return ret_conv;
69006 }
69007
69008 int64_t  CS_LDK_RefundMaybeWithDerivedMetadataBuilder_clone(int64_t orig) {
69009         LDKRefundMaybeWithDerivedMetadataBuilder orig_conv;
69010         orig_conv.inner = untag_ptr(orig);
69011         orig_conv.is_owned = ptr_is_owned(orig);
69012         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
69013         orig_conv.is_owned = false;
69014         LDKRefundMaybeWithDerivedMetadataBuilder ret_var = RefundMaybeWithDerivedMetadataBuilder_clone(&orig_conv);
69015         int64_t ret_ref = 0;
69016         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69017         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69018         return ret_ref;
69019 }
69020
69021 int64_t  CS_LDK_RefundMaybeWithDerivedMetadataBuilder_new(int8_tArray metadata, int8_tArray payer_id, int64_t amount_msats) {
69022         LDKCVec_u8Z metadata_ref;
69023         metadata_ref.datalen = metadata->arr_len;
69024         metadata_ref.data = MALLOC(metadata_ref.datalen, "LDKCVec_u8Z Bytes");
69025         memcpy(metadata_ref.data, metadata->elems, metadata_ref.datalen); FREE(metadata);
69026         LDKPublicKey payer_id_ref;
69027         CHECK(payer_id->arr_len == 33);
69028         memcpy(payer_id_ref.compressed_form, payer_id->elems, 33); FREE(payer_id);
69029         LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ), "LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ");
69030         *ret_conv = RefundMaybeWithDerivedMetadataBuilder_new(metadata_ref, payer_id_ref, amount_msats);
69031         return tag_ptr(ret_conv, true);
69032 }
69033
69034 int64_t  CS_LDK_RefundMaybeWithDerivedMetadataBuilder_deriving_payer_id(int8_tArray node_id, int64_t expanded_key, int64_t entropy_source, int64_t amount_msats, int8_tArray payment_id) {
69035         LDKPublicKey node_id_ref;
69036         CHECK(node_id->arr_len == 33);
69037         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
69038         LDKExpandedKey expanded_key_conv;
69039         expanded_key_conv.inner = untag_ptr(expanded_key);
69040         expanded_key_conv.is_owned = ptr_is_owned(expanded_key);
69041         CHECK_INNER_FIELD_ACCESS_OR_NULL(expanded_key_conv);
69042         expanded_key_conv.is_owned = false;
69043         void* entropy_source_ptr = untag_ptr(entropy_source);
69044         CHECK_ACCESS(entropy_source_ptr);
69045         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
69046         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
69047                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69048                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
69049         }
69050         LDKThirtyTwoBytes payment_id_ref;
69051         CHECK(payment_id->arr_len == 32);
69052         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
69053         LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ), "LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ");
69054         *ret_conv = RefundMaybeWithDerivedMetadataBuilder_deriving_payer_id(node_id_ref, &expanded_key_conv, entropy_source_conv, amount_msats, payment_id_ref);
69055         return tag_ptr(ret_conv, true);
69056 }
69057
69058 void  CS_LDK_RefundMaybeWithDerivedMetadataBuilder_description(int64_t this_arg, jstring description) {
69059         LDKRefundMaybeWithDerivedMetadataBuilder this_arg_conv;
69060         this_arg_conv.inner = untag_ptr(this_arg);
69061         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69062         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69063         this_arg_conv = RefundMaybeWithDerivedMetadataBuilder_clone(&this_arg_conv);
69064         LDKStr description_conv = str_ref_to_owned_c(description);
69065         RefundMaybeWithDerivedMetadataBuilder_description(this_arg_conv, description_conv);
69066 }
69067
69068 void  CS_LDK_RefundMaybeWithDerivedMetadataBuilder_absolute_expiry(int64_t this_arg, int64_t absolute_expiry) {
69069         LDKRefundMaybeWithDerivedMetadataBuilder this_arg_conv;
69070         this_arg_conv.inner = untag_ptr(this_arg);
69071         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69072         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69073         this_arg_conv = RefundMaybeWithDerivedMetadataBuilder_clone(&this_arg_conv);
69074         RefundMaybeWithDerivedMetadataBuilder_absolute_expiry(this_arg_conv, absolute_expiry);
69075 }
69076
69077 void  CS_LDK_RefundMaybeWithDerivedMetadataBuilder_issuer(int64_t this_arg, jstring issuer) {
69078         LDKRefundMaybeWithDerivedMetadataBuilder this_arg_conv;
69079         this_arg_conv.inner = untag_ptr(this_arg);
69080         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69081         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69082         this_arg_conv = RefundMaybeWithDerivedMetadataBuilder_clone(&this_arg_conv);
69083         LDKStr issuer_conv = str_ref_to_owned_c(issuer);
69084         RefundMaybeWithDerivedMetadataBuilder_issuer(this_arg_conv, issuer_conv);
69085 }
69086
69087 void  CS_LDK_RefundMaybeWithDerivedMetadataBuilder_path(int64_t this_arg, int64_t path) {
69088         LDKRefundMaybeWithDerivedMetadataBuilder this_arg_conv;
69089         this_arg_conv.inner = untag_ptr(this_arg);
69090         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69091         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69092         this_arg_conv = RefundMaybeWithDerivedMetadataBuilder_clone(&this_arg_conv);
69093         LDKBlindedPath path_conv;
69094         path_conv.inner = untag_ptr(path);
69095         path_conv.is_owned = ptr_is_owned(path);
69096         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
69097         path_conv = BlindedPath_clone(&path_conv);
69098         RefundMaybeWithDerivedMetadataBuilder_path(this_arg_conv, path_conv);
69099 }
69100
69101 void  CS_LDK_RefundMaybeWithDerivedMetadataBuilder_chain(int64_t this_arg, int32_t network) {
69102         LDKRefundMaybeWithDerivedMetadataBuilder this_arg_conv;
69103         this_arg_conv.inner = untag_ptr(this_arg);
69104         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69105         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69106         this_arg_conv = RefundMaybeWithDerivedMetadataBuilder_clone(&this_arg_conv);
69107         LDKNetwork network_conv = LDKNetwork_from_cs(network);
69108         RefundMaybeWithDerivedMetadataBuilder_chain(this_arg_conv, network_conv);
69109 }
69110
69111 void  CS_LDK_RefundMaybeWithDerivedMetadataBuilder_quantity(int64_t this_arg, int64_t quantity) {
69112         LDKRefundMaybeWithDerivedMetadataBuilder this_arg_conv;
69113         this_arg_conv.inner = untag_ptr(this_arg);
69114         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69115         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69116         this_arg_conv = RefundMaybeWithDerivedMetadataBuilder_clone(&this_arg_conv);
69117         RefundMaybeWithDerivedMetadataBuilder_quantity(this_arg_conv, quantity);
69118 }
69119
69120 void  CS_LDK_RefundMaybeWithDerivedMetadataBuilder_payer_note(int64_t this_arg, jstring payer_note) {
69121         LDKRefundMaybeWithDerivedMetadataBuilder this_arg_conv;
69122         this_arg_conv.inner = untag_ptr(this_arg);
69123         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69124         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69125         this_arg_conv = RefundMaybeWithDerivedMetadataBuilder_clone(&this_arg_conv);
69126         LDKStr payer_note_conv = str_ref_to_owned_c(payer_note);
69127         RefundMaybeWithDerivedMetadataBuilder_payer_note(this_arg_conv, payer_note_conv);
69128 }
69129
69130 int64_t  CS_LDK_RefundMaybeWithDerivedMetadataBuilder_build(int64_t this_arg) {
69131         LDKRefundMaybeWithDerivedMetadataBuilder this_arg_conv;
69132         this_arg_conv.inner = untag_ptr(this_arg);
69133         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69134         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69135         this_arg_conv = RefundMaybeWithDerivedMetadataBuilder_clone(&this_arg_conv);
69136         LDKCResult_RefundBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12SemanticErrorZ), "LDKCResult_RefundBolt12SemanticErrorZ");
69137         *ret_conv = RefundMaybeWithDerivedMetadataBuilder_build(this_arg_conv);
69138         return tag_ptr(ret_conv, true);
69139 }
69140
69141 void  CS_LDK_Refund_free(int64_t this_obj) {
69142         LDKRefund this_obj_conv;
69143         this_obj_conv.inner = untag_ptr(this_obj);
69144         this_obj_conv.is_owned = ptr_is_owned(this_obj);
69145         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
69146         Refund_free(this_obj_conv);
69147 }
69148
69149 static inline uint64_t Refund_clone_ptr(LDKRefund *NONNULL_PTR arg) {
69150         LDKRefund ret_var = Refund_clone(arg);
69151         int64_t ret_ref = 0;
69152         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69153         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69154         return ret_ref;
69155 }
69156 int64_t  CS_LDK_Refund_clone_ptr(int64_t arg) {
69157         LDKRefund arg_conv;
69158         arg_conv.inner = untag_ptr(arg);
69159         arg_conv.is_owned = ptr_is_owned(arg);
69160         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
69161         arg_conv.is_owned = false;
69162         int64_t ret_conv = Refund_clone_ptr(&arg_conv);
69163         return ret_conv;
69164 }
69165
69166 int64_t  CS_LDK_Refund_clone(int64_t orig) {
69167         LDKRefund orig_conv;
69168         orig_conv.inner = untag_ptr(orig);
69169         orig_conv.is_owned = ptr_is_owned(orig);
69170         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
69171         orig_conv.is_owned = false;
69172         LDKRefund ret_var = Refund_clone(&orig_conv);
69173         int64_t ret_ref = 0;
69174         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69175         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69176         return ret_ref;
69177 }
69178
69179 int64_t  CS_LDK_Refund_description(int64_t this_arg) {
69180         LDKRefund this_arg_conv;
69181         this_arg_conv.inner = untag_ptr(this_arg);
69182         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69183         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69184         this_arg_conv.is_owned = false;
69185         LDKPrintableString ret_var = Refund_description(&this_arg_conv);
69186         int64_t ret_ref = 0;
69187         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69188         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69189         return ret_ref;
69190 }
69191
69192 int64_t  CS_LDK_Refund_absolute_expiry(int64_t this_arg) {
69193         LDKRefund this_arg_conv;
69194         this_arg_conv.inner = untag_ptr(this_arg);
69195         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69196         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69197         this_arg_conv.is_owned = false;
69198         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
69199         *ret_copy = Refund_absolute_expiry(&this_arg_conv);
69200         int64_t ret_ref = tag_ptr(ret_copy, true);
69201         return ret_ref;
69202 }
69203
69204 jboolean  CS_LDK_Refund_is_expired(int64_t this_arg) {
69205         LDKRefund this_arg_conv;
69206         this_arg_conv.inner = untag_ptr(this_arg);
69207         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69208         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69209         this_arg_conv.is_owned = false;
69210         jboolean ret_conv = Refund_is_expired(&this_arg_conv);
69211         return ret_conv;
69212 }
69213
69214 jboolean  CS_LDK_Refund_is_expired_no_std(int64_t this_arg, int64_t duration_since_epoch) {
69215         LDKRefund this_arg_conv;
69216         this_arg_conv.inner = untag_ptr(this_arg);
69217         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69218         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69219         this_arg_conv.is_owned = false;
69220         jboolean ret_conv = Refund_is_expired_no_std(&this_arg_conv, duration_since_epoch);
69221         return ret_conv;
69222 }
69223
69224 int64_t  CS_LDK_Refund_issuer(int64_t this_arg) {
69225         LDKRefund this_arg_conv;
69226         this_arg_conv.inner = untag_ptr(this_arg);
69227         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69228         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69229         this_arg_conv.is_owned = false;
69230         LDKPrintableString ret_var = Refund_issuer(&this_arg_conv);
69231         int64_t ret_ref = 0;
69232         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69233         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69234         return ret_ref;
69235 }
69236
69237 int64_tArray  CS_LDK_Refund_paths(int64_t this_arg) {
69238         LDKRefund this_arg_conv;
69239         this_arg_conv.inner = untag_ptr(this_arg);
69240         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69241         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69242         this_arg_conv.is_owned = false;
69243         LDKCVec_BlindedPathZ ret_var = Refund_paths(&this_arg_conv);
69244         int64_tArray ret_arr = NULL;
69245         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
69246         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
69247         for (size_t n = 0; n < ret_var.datalen; n++) {
69248                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
69249                 int64_t ret_conv_13_ref = 0;
69250                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
69251                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
69252                 ret_arr_ptr[n] = ret_conv_13_ref;
69253         }
69254         
69255         FREE(ret_var.data);
69256         return ret_arr;
69257 }
69258
69259 int8_tArray  CS_LDK_Refund_payer_metadata(int64_t this_arg) {
69260         LDKRefund this_arg_conv;
69261         this_arg_conv.inner = untag_ptr(this_arg);
69262         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69263         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69264         this_arg_conv.is_owned = false;
69265         LDKu8slice ret_var = Refund_payer_metadata(&this_arg_conv);
69266         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
69267         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
69268         return ret_arr;
69269 }
69270
69271 int8_tArray  CS_LDK_Refund_chain(int64_t this_arg) {
69272         LDKRefund this_arg_conv;
69273         this_arg_conv.inner = untag_ptr(this_arg);
69274         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69275         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69276         this_arg_conv.is_owned = false;
69277         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
69278         memcpy(ret_arr->elems, Refund_chain(&this_arg_conv).data, 32);
69279         return ret_arr;
69280 }
69281
69282 int64_t  CS_LDK_Refund_amount_msats(int64_t this_arg) {
69283         LDKRefund this_arg_conv;
69284         this_arg_conv.inner = untag_ptr(this_arg);
69285         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69286         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69287         this_arg_conv.is_owned = false;
69288         int64_t ret_conv = Refund_amount_msats(&this_arg_conv);
69289         return ret_conv;
69290 }
69291
69292 int64_t  CS_LDK_Refund_features(int64_t this_arg) {
69293         LDKRefund this_arg_conv;
69294         this_arg_conv.inner = untag_ptr(this_arg);
69295         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69296         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69297         this_arg_conv.is_owned = false;
69298         LDKInvoiceRequestFeatures ret_var = Refund_features(&this_arg_conv);
69299         int64_t ret_ref = 0;
69300         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69301         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69302         return ret_ref;
69303 }
69304
69305 int64_t  CS_LDK_Refund_quantity(int64_t this_arg) {
69306         LDKRefund this_arg_conv;
69307         this_arg_conv.inner = untag_ptr(this_arg);
69308         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69309         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69310         this_arg_conv.is_owned = false;
69311         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
69312         *ret_copy = Refund_quantity(&this_arg_conv);
69313         int64_t ret_ref = tag_ptr(ret_copy, true);
69314         return ret_ref;
69315 }
69316
69317 int8_tArray  CS_LDK_Refund_payer_id(int64_t this_arg) {
69318         LDKRefund this_arg_conv;
69319         this_arg_conv.inner = untag_ptr(this_arg);
69320         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69321         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69322         this_arg_conv.is_owned = false;
69323         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
69324         memcpy(ret_arr->elems, Refund_payer_id(&this_arg_conv).compressed_form, 33);
69325         return ret_arr;
69326 }
69327
69328 int64_t  CS_LDK_Refund_payer_note(int64_t this_arg) {
69329         LDKRefund this_arg_conv;
69330         this_arg_conv.inner = untag_ptr(this_arg);
69331         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69332         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69333         this_arg_conv.is_owned = false;
69334         LDKPrintableString ret_var = Refund_payer_note(&this_arg_conv);
69335         int64_t ret_ref = 0;
69336         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69337         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69338         return ret_ref;
69339 }
69340
69341 int64_t  CS_LDK_Refund_hash(int64_t o) {
69342         LDKRefund o_conv;
69343         o_conv.inner = untag_ptr(o);
69344         o_conv.is_owned = ptr_is_owned(o);
69345         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
69346         o_conv.is_owned = false;
69347         int64_t ret_conv = Refund_hash(&o_conv);
69348         return ret_conv;
69349 }
69350
69351 int8_tArray  CS_LDK_Refund_write(int64_t obj) {
69352         LDKRefund obj_conv;
69353         obj_conv.inner = untag_ptr(obj);
69354         obj_conv.is_owned = ptr_is_owned(obj);
69355         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
69356         obj_conv.is_owned = false;
69357         LDKCVec_u8Z ret_var = Refund_write(&obj_conv);
69358         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
69359         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
69360         CVec_u8Z_free(ret_var);
69361         return ret_arr;
69362 }
69363
69364 int64_t  CS_LDK_Refund_from_str(jstring s) {
69365         LDKStr s_conv = str_ref_to_owned_c(s);
69366         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
69367         *ret_conv = Refund_from_str(s_conv);
69368         return tag_ptr(ret_conv, true);
69369 }
69370
69371 jstring  CS_LDK_Refund_to_str(int64_t o) {
69372         LDKRefund o_conv;
69373         o_conv.inner = untag_ptr(o);
69374         o_conv.is_owned = ptr_is_owned(o);
69375         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
69376         o_conv.is_owned = false;
69377         LDKStr ret_str = Refund_to_str(&o_conv);
69378         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
69379         Str_free(ret_str);
69380         return ret_conv;
69381 }
69382
69383 int32_t  CS_LDK_UtxoLookupError_clone(int64_t orig) {
69384         LDKUtxoLookupError* orig_conv = (LDKUtxoLookupError*)untag_ptr(orig);
69385         int32_t ret_conv = LDKUtxoLookupError_to_cs(UtxoLookupError_clone(orig_conv));
69386         return ret_conv;
69387 }
69388
69389 int32_t  CS_LDK_UtxoLookupError_unknown_chain() {
69390         int32_t ret_conv = LDKUtxoLookupError_to_cs(UtxoLookupError_unknown_chain());
69391         return ret_conv;
69392 }
69393
69394 int32_t  CS_LDK_UtxoLookupError_unknown_tx() {
69395         int32_t ret_conv = LDKUtxoLookupError_to_cs(UtxoLookupError_unknown_tx());
69396         return ret_conv;
69397 }
69398
69399 void  CS_LDK_UtxoResult_free(int64_t this_ptr) {
69400         if (!ptr_is_owned(this_ptr)) return;
69401         void* this_ptr_ptr = untag_ptr(this_ptr);
69402         CHECK_ACCESS(this_ptr_ptr);
69403         LDKUtxoResult this_ptr_conv = *(LDKUtxoResult*)(this_ptr_ptr);
69404         FREE(untag_ptr(this_ptr));
69405         UtxoResult_free(this_ptr_conv);
69406 }
69407
69408 static inline uint64_t UtxoResult_clone_ptr(LDKUtxoResult *NONNULL_PTR arg) {
69409         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
69410         *ret_copy = UtxoResult_clone(arg);
69411         int64_t ret_ref = tag_ptr(ret_copy, true);
69412         return ret_ref;
69413 }
69414 int64_t  CS_LDK_UtxoResult_clone_ptr(int64_t arg) {
69415         LDKUtxoResult* arg_conv = (LDKUtxoResult*)untag_ptr(arg);
69416         int64_t ret_conv = UtxoResult_clone_ptr(arg_conv);
69417         return ret_conv;
69418 }
69419
69420 int64_t  CS_LDK_UtxoResult_clone(int64_t orig) {
69421         LDKUtxoResult* orig_conv = (LDKUtxoResult*)untag_ptr(orig);
69422         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
69423         *ret_copy = UtxoResult_clone(orig_conv);
69424         int64_t ret_ref = tag_ptr(ret_copy, true);
69425         return ret_ref;
69426 }
69427
69428 int64_t  CS_LDK_UtxoResult_sync(int64_t a) {
69429         void* a_ptr = untag_ptr(a);
69430         CHECK_ACCESS(a_ptr);
69431         LDKCResult_TxOutUtxoLookupErrorZ a_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(a_ptr);
69432         a_conv = CResult_TxOutUtxoLookupErrorZ_clone((LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(a));
69433         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
69434         *ret_copy = UtxoResult_sync(a_conv);
69435         int64_t ret_ref = tag_ptr(ret_copy, true);
69436         return ret_ref;
69437 }
69438
69439 int64_t  CS_LDK_UtxoResult_async(int64_t a) {
69440         LDKUtxoFuture a_conv;
69441         a_conv.inner = untag_ptr(a);
69442         a_conv.is_owned = ptr_is_owned(a);
69443         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
69444         a_conv = UtxoFuture_clone(&a_conv);
69445         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
69446         *ret_copy = UtxoResult_async(a_conv);
69447         int64_t ret_ref = tag_ptr(ret_copy, true);
69448         return ret_ref;
69449 }
69450
69451 void  CS_LDK_UtxoLookup_free(int64_t this_ptr) {
69452         if (!ptr_is_owned(this_ptr)) return;
69453         void* this_ptr_ptr = untag_ptr(this_ptr);
69454         CHECK_ACCESS(this_ptr_ptr);
69455         LDKUtxoLookup this_ptr_conv = *(LDKUtxoLookup*)(this_ptr_ptr);
69456         FREE(untag_ptr(this_ptr));
69457         UtxoLookup_free(this_ptr_conv);
69458 }
69459
69460 void  CS_LDK_UtxoFuture_free(int64_t this_obj) {
69461         LDKUtxoFuture this_obj_conv;
69462         this_obj_conv.inner = untag_ptr(this_obj);
69463         this_obj_conv.is_owned = ptr_is_owned(this_obj);
69464         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
69465         UtxoFuture_free(this_obj_conv);
69466 }
69467
69468 static inline uint64_t UtxoFuture_clone_ptr(LDKUtxoFuture *NONNULL_PTR arg) {
69469         LDKUtxoFuture ret_var = UtxoFuture_clone(arg);
69470         int64_t ret_ref = 0;
69471         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69472         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69473         return ret_ref;
69474 }
69475 int64_t  CS_LDK_UtxoFuture_clone_ptr(int64_t arg) {
69476         LDKUtxoFuture arg_conv;
69477         arg_conv.inner = untag_ptr(arg);
69478         arg_conv.is_owned = ptr_is_owned(arg);
69479         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
69480         arg_conv.is_owned = false;
69481         int64_t ret_conv = UtxoFuture_clone_ptr(&arg_conv);
69482         return ret_conv;
69483 }
69484
69485 int64_t  CS_LDK_UtxoFuture_clone(int64_t orig) {
69486         LDKUtxoFuture orig_conv;
69487         orig_conv.inner = untag_ptr(orig);
69488         orig_conv.is_owned = ptr_is_owned(orig);
69489         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
69490         orig_conv.is_owned = false;
69491         LDKUtxoFuture ret_var = UtxoFuture_clone(&orig_conv);
69492         int64_t ret_ref = 0;
69493         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69494         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69495         return ret_ref;
69496 }
69497
69498 int64_t  CS_LDK_UtxoFuture_new() {
69499         LDKUtxoFuture ret_var = UtxoFuture_new();
69500         int64_t ret_ref = 0;
69501         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69502         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69503         return ret_ref;
69504 }
69505
69506 void  CS_LDK_UtxoFuture_resolve_without_forwarding(int64_t this_arg, int64_t graph, int64_t result) {
69507         LDKUtxoFuture this_arg_conv;
69508         this_arg_conv.inner = untag_ptr(this_arg);
69509         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69510         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69511         this_arg_conv.is_owned = false;
69512         LDKNetworkGraph graph_conv;
69513         graph_conv.inner = untag_ptr(graph);
69514         graph_conv.is_owned = ptr_is_owned(graph);
69515         CHECK_INNER_FIELD_ACCESS_OR_NULL(graph_conv);
69516         graph_conv.is_owned = false;
69517         void* result_ptr = untag_ptr(result);
69518         CHECK_ACCESS(result_ptr);
69519         LDKCResult_TxOutUtxoLookupErrorZ result_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(result_ptr);
69520         UtxoFuture_resolve_without_forwarding(&this_arg_conv, &graph_conv, result_conv);
69521 }
69522
69523 void  CS_LDK_UtxoFuture_resolve(int64_t this_arg, int64_t graph, int64_t gossip, int64_t result) {
69524         LDKUtxoFuture this_arg_conv;
69525         this_arg_conv.inner = untag_ptr(this_arg);
69526         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69527         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69528         this_arg_conv.is_owned = false;
69529         LDKNetworkGraph graph_conv;
69530         graph_conv.inner = untag_ptr(graph);
69531         graph_conv.is_owned = ptr_is_owned(graph);
69532         CHECK_INNER_FIELD_ACCESS_OR_NULL(graph_conv);
69533         graph_conv.is_owned = false;
69534         LDKP2PGossipSync gossip_conv;
69535         gossip_conv.inner = untag_ptr(gossip);
69536         gossip_conv.is_owned = ptr_is_owned(gossip);
69537         CHECK_INNER_FIELD_ACCESS_OR_NULL(gossip_conv);
69538         gossip_conv.is_owned = false;
69539         void* result_ptr = untag_ptr(result);
69540         CHECK_ACCESS(result_ptr);
69541         LDKCResult_TxOutUtxoLookupErrorZ result_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(result_ptr);
69542         UtxoFuture_resolve(&this_arg_conv, &graph_conv, &gossip_conv, result_conv);
69543 }
69544
69545 void  CS_LDK_NodeId_free(int64_t this_obj) {
69546         LDKNodeId this_obj_conv;
69547         this_obj_conv.inner = untag_ptr(this_obj);
69548         this_obj_conv.is_owned = ptr_is_owned(this_obj);
69549         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
69550         NodeId_free(this_obj_conv);
69551 }
69552
69553 static inline uint64_t NodeId_clone_ptr(LDKNodeId *NONNULL_PTR arg) {
69554         LDKNodeId ret_var = NodeId_clone(arg);
69555         int64_t ret_ref = 0;
69556         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69557         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69558         return ret_ref;
69559 }
69560 int64_t  CS_LDK_NodeId_clone_ptr(int64_t arg) {
69561         LDKNodeId arg_conv;
69562         arg_conv.inner = untag_ptr(arg);
69563         arg_conv.is_owned = ptr_is_owned(arg);
69564         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
69565         arg_conv.is_owned = false;
69566         int64_t ret_conv = NodeId_clone_ptr(&arg_conv);
69567         return ret_conv;
69568 }
69569
69570 int64_t  CS_LDK_NodeId_clone(int64_t orig) {
69571         LDKNodeId orig_conv;
69572         orig_conv.inner = untag_ptr(orig);
69573         orig_conv.is_owned = ptr_is_owned(orig);
69574         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
69575         orig_conv.is_owned = false;
69576         LDKNodeId ret_var = NodeId_clone(&orig_conv);
69577         int64_t ret_ref = 0;
69578         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69579         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69580         return ret_ref;
69581 }
69582
69583 int64_t  CS_LDK_NodeId_from_pubkey(int8_tArray pubkey) {
69584         LDKPublicKey pubkey_ref;
69585         CHECK(pubkey->arr_len == 33);
69586         memcpy(pubkey_ref.compressed_form, pubkey->elems, 33); FREE(pubkey);
69587         LDKNodeId ret_var = NodeId_from_pubkey(pubkey_ref);
69588         int64_t ret_ref = 0;
69589         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69590         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69591         return ret_ref;
69592 }
69593
69594 int64_t  CS_LDK_NodeId_from_slice(int8_tArray bytes) {
69595         LDKu8slice bytes_ref;
69596         bytes_ref.datalen = bytes->arr_len;
69597         bytes_ref.data = bytes->elems;
69598         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
69599         *ret_conv = NodeId_from_slice(bytes_ref);
69600         FREE(bytes);
69601         return tag_ptr(ret_conv, true);
69602 }
69603
69604 int8_tArray  CS_LDK_NodeId_as_slice(int64_t this_arg) {
69605         LDKNodeId this_arg_conv;
69606         this_arg_conv.inner = untag_ptr(this_arg);
69607         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69608         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69609         this_arg_conv.is_owned = false;
69610         LDKu8slice ret_var = NodeId_as_slice(&this_arg_conv);
69611         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
69612         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
69613         return ret_arr;
69614 }
69615
69616 int8_tArray  CS_LDK_NodeId_as_array(int64_t this_arg) {
69617         LDKNodeId this_arg_conv;
69618         this_arg_conv.inner = untag_ptr(this_arg);
69619         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69620         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69621         this_arg_conv.is_owned = false;
69622         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
69623         memcpy(ret_arr->elems, *NodeId_as_array(&this_arg_conv), 33);
69624         return ret_arr;
69625 }
69626
69627 int64_t  CS_LDK_NodeId_as_pubkey(int64_t this_arg) {
69628         LDKNodeId this_arg_conv;
69629         this_arg_conv.inner = untag_ptr(this_arg);
69630         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69631         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69632         this_arg_conv.is_owned = false;
69633         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
69634         *ret_conv = NodeId_as_pubkey(&this_arg_conv);
69635         return tag_ptr(ret_conv, true);
69636 }
69637
69638 jstring  CS_LDK_NodeId_to_str(int64_t o) {
69639         LDKNodeId o_conv;
69640         o_conv.inner = untag_ptr(o);
69641         o_conv.is_owned = ptr_is_owned(o);
69642         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
69643         o_conv.is_owned = false;
69644         LDKStr ret_str = NodeId_to_str(&o_conv);
69645         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
69646         Str_free(ret_str);
69647         return ret_conv;
69648 }
69649
69650 int64_t  CS_LDK_NodeId_hash(int64_t o) {
69651         LDKNodeId o_conv;
69652         o_conv.inner = untag_ptr(o);
69653         o_conv.is_owned = ptr_is_owned(o);
69654         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
69655         o_conv.is_owned = false;
69656         int64_t ret_conv = NodeId_hash(&o_conv);
69657         return ret_conv;
69658 }
69659
69660 int8_tArray  CS_LDK_NodeId_write(int64_t obj) {
69661         LDKNodeId obj_conv;
69662         obj_conv.inner = untag_ptr(obj);
69663         obj_conv.is_owned = ptr_is_owned(obj);
69664         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
69665         obj_conv.is_owned = false;
69666         LDKCVec_u8Z ret_var = NodeId_write(&obj_conv);
69667         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
69668         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
69669         CVec_u8Z_free(ret_var);
69670         return ret_arr;
69671 }
69672
69673 int64_t  CS_LDK_NodeId_read(int8_tArray ser) {
69674         LDKu8slice ser_ref;
69675         ser_ref.datalen = ser->arr_len;
69676         ser_ref.data = ser->elems;
69677         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
69678         *ret_conv = NodeId_read(ser_ref);
69679         FREE(ser);
69680         return tag_ptr(ret_conv, true);
69681 }
69682
69683 void  CS_LDK_NetworkGraph_free(int64_t this_obj) {
69684         LDKNetworkGraph this_obj_conv;
69685         this_obj_conv.inner = untag_ptr(this_obj);
69686         this_obj_conv.is_owned = ptr_is_owned(this_obj);
69687         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
69688         NetworkGraph_free(this_obj_conv);
69689 }
69690
69691 void  CS_LDK_ReadOnlyNetworkGraph_free(int64_t this_obj) {
69692         LDKReadOnlyNetworkGraph this_obj_conv;
69693         this_obj_conv.inner = untag_ptr(this_obj);
69694         this_obj_conv.is_owned = ptr_is_owned(this_obj);
69695         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
69696         ReadOnlyNetworkGraph_free(this_obj_conv);
69697 }
69698
69699 void  CS_LDK_NetworkUpdate_free(int64_t this_ptr) {
69700         if (!ptr_is_owned(this_ptr)) return;
69701         void* this_ptr_ptr = untag_ptr(this_ptr);
69702         CHECK_ACCESS(this_ptr_ptr);
69703         LDKNetworkUpdate this_ptr_conv = *(LDKNetworkUpdate*)(this_ptr_ptr);
69704         FREE(untag_ptr(this_ptr));
69705         NetworkUpdate_free(this_ptr_conv);
69706 }
69707
69708 static inline uint64_t NetworkUpdate_clone_ptr(LDKNetworkUpdate *NONNULL_PTR arg) {
69709         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
69710         *ret_copy = NetworkUpdate_clone(arg);
69711         int64_t ret_ref = tag_ptr(ret_copy, true);
69712         return ret_ref;
69713 }
69714 int64_t  CS_LDK_NetworkUpdate_clone_ptr(int64_t arg) {
69715         LDKNetworkUpdate* arg_conv = (LDKNetworkUpdate*)untag_ptr(arg);
69716         int64_t ret_conv = NetworkUpdate_clone_ptr(arg_conv);
69717         return ret_conv;
69718 }
69719
69720 int64_t  CS_LDK_NetworkUpdate_clone(int64_t orig) {
69721         LDKNetworkUpdate* orig_conv = (LDKNetworkUpdate*)untag_ptr(orig);
69722         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
69723         *ret_copy = NetworkUpdate_clone(orig_conv);
69724         int64_t ret_ref = tag_ptr(ret_copy, true);
69725         return ret_ref;
69726 }
69727
69728 int64_t  CS_LDK_NetworkUpdate_channel_update_message(int64_t msg) {
69729         LDKChannelUpdate msg_conv;
69730         msg_conv.inner = untag_ptr(msg);
69731         msg_conv.is_owned = ptr_is_owned(msg);
69732         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
69733         msg_conv = ChannelUpdate_clone(&msg_conv);
69734         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
69735         *ret_copy = NetworkUpdate_channel_update_message(msg_conv);
69736         int64_t ret_ref = tag_ptr(ret_copy, true);
69737         return ret_ref;
69738 }
69739
69740 int64_t  CS_LDK_NetworkUpdate_channel_failure(int64_t short_channel_id, jboolean is_permanent) {
69741         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
69742         *ret_copy = NetworkUpdate_channel_failure(short_channel_id, is_permanent);
69743         int64_t ret_ref = tag_ptr(ret_copy, true);
69744         return ret_ref;
69745 }
69746
69747 int64_t  CS_LDK_NetworkUpdate_node_failure(int8_tArray node_id, jboolean is_permanent) {
69748         LDKPublicKey node_id_ref;
69749         CHECK(node_id->arr_len == 33);
69750         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
69751         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
69752         *ret_copy = NetworkUpdate_node_failure(node_id_ref, is_permanent);
69753         int64_t ret_ref = tag_ptr(ret_copy, true);
69754         return ret_ref;
69755 }
69756
69757 jboolean  CS_LDK_NetworkUpdate_eq(int64_t a, int64_t b) {
69758         LDKNetworkUpdate* a_conv = (LDKNetworkUpdate*)untag_ptr(a);
69759         LDKNetworkUpdate* b_conv = (LDKNetworkUpdate*)untag_ptr(b);
69760         jboolean ret_conv = NetworkUpdate_eq(a_conv, b_conv);
69761         return ret_conv;
69762 }
69763
69764 int8_tArray  CS_LDK_NetworkUpdate_write(int64_t obj) {
69765         LDKNetworkUpdate* obj_conv = (LDKNetworkUpdate*)untag_ptr(obj);
69766         LDKCVec_u8Z ret_var = NetworkUpdate_write(obj_conv);
69767         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
69768         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
69769         CVec_u8Z_free(ret_var);
69770         return ret_arr;
69771 }
69772
69773 int64_t  CS_LDK_NetworkUpdate_read(int8_tArray ser) {
69774         LDKu8slice ser_ref;
69775         ser_ref.datalen = ser->arr_len;
69776         ser_ref.data = ser->elems;
69777         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
69778         *ret_conv = NetworkUpdate_read(ser_ref);
69779         FREE(ser);
69780         return tag_ptr(ret_conv, true);
69781 }
69782
69783 void  CS_LDK_P2PGossipSync_free(int64_t this_obj) {
69784         LDKP2PGossipSync this_obj_conv;
69785         this_obj_conv.inner = untag_ptr(this_obj);
69786         this_obj_conv.is_owned = ptr_is_owned(this_obj);
69787         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
69788         P2PGossipSync_free(this_obj_conv);
69789 }
69790
69791 int64_t  CS_LDK_P2PGossipSync_new(int64_t network_graph, int64_t utxo_lookup, int64_t logger) {
69792         LDKNetworkGraph network_graph_conv;
69793         network_graph_conv.inner = untag_ptr(network_graph);
69794         network_graph_conv.is_owned = ptr_is_owned(network_graph);
69795         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
69796         network_graph_conv.is_owned = false;
69797         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
69798         CHECK_ACCESS(utxo_lookup_ptr);
69799         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
69800         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
69801         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
69802                 // Manually implement clone for Java trait instances
69803                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
69804                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69805                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
69806                 }
69807         }
69808         void* logger_ptr = untag_ptr(logger);
69809         CHECK_ACCESS(logger_ptr);
69810         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
69811         if (logger_conv.free == LDKLogger_JCalls_free) {
69812                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69813                 LDKLogger_JCalls_cloned(&logger_conv);
69814         }
69815         LDKP2PGossipSync ret_var = P2PGossipSync_new(&network_graph_conv, utxo_lookup_conv, logger_conv);
69816         int64_t ret_ref = 0;
69817         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69818         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69819         return ret_ref;
69820 }
69821
69822 void  CS_LDK_P2PGossipSync_add_utxo_lookup(int64_t this_arg, int64_t utxo_lookup) {
69823         LDKP2PGossipSync this_arg_conv;
69824         this_arg_conv.inner = untag_ptr(this_arg);
69825         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69826         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69827         this_arg_conv.is_owned = false;
69828         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
69829         CHECK_ACCESS(utxo_lookup_ptr);
69830         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
69831         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
69832         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
69833                 // Manually implement clone for Java trait instances
69834                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
69835                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69836                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
69837                 }
69838         }
69839         P2PGossipSync_add_utxo_lookup(&this_arg_conv, utxo_lookup_conv);
69840 }
69841
69842 void  CS_LDK_NetworkGraph_handle_network_update(int64_t this_arg, int64_t network_update) {
69843         LDKNetworkGraph this_arg_conv;
69844         this_arg_conv.inner = untag_ptr(this_arg);
69845         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69846         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69847         this_arg_conv.is_owned = false;
69848         LDKNetworkUpdate* network_update_conv = (LDKNetworkUpdate*)untag_ptr(network_update);
69849         NetworkGraph_handle_network_update(&this_arg_conv, network_update_conv);
69850 }
69851
69852 int8_tArray  CS_LDK_NetworkGraph_get_chain_hash(int64_t this_arg) {
69853         LDKNetworkGraph this_arg_conv;
69854         this_arg_conv.inner = untag_ptr(this_arg);
69855         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69856         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69857         this_arg_conv.is_owned = false;
69858         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
69859         memcpy(ret_arr->elems, NetworkGraph_get_chain_hash(&this_arg_conv).data, 32);
69860         return ret_arr;
69861 }
69862
69863 int64_t  CS_LDK_verify_node_announcement(int64_t msg) {
69864         LDKNodeAnnouncement msg_conv;
69865         msg_conv.inner = untag_ptr(msg);
69866         msg_conv.is_owned = ptr_is_owned(msg);
69867         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
69868         msg_conv.is_owned = false;
69869         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
69870         *ret_conv = verify_node_announcement(&msg_conv);
69871         return tag_ptr(ret_conv, true);
69872 }
69873
69874 int64_t  CS_LDK_verify_channel_announcement(int64_t msg) {
69875         LDKChannelAnnouncement msg_conv;
69876         msg_conv.inner = untag_ptr(msg);
69877         msg_conv.is_owned = ptr_is_owned(msg);
69878         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
69879         msg_conv.is_owned = false;
69880         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
69881         *ret_conv = verify_channel_announcement(&msg_conv);
69882         return tag_ptr(ret_conv, true);
69883 }
69884
69885 int64_t  CS_LDK_P2PGossipSync_as_RoutingMessageHandler(int64_t this_arg) {
69886         LDKP2PGossipSync this_arg_conv;
69887         this_arg_conv.inner = untag_ptr(this_arg);
69888         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69889         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69890         this_arg_conv.is_owned = false;
69891         LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
69892         *ret_ret = P2PGossipSync_as_RoutingMessageHandler(&this_arg_conv);
69893         return tag_ptr(ret_ret, true);
69894 }
69895
69896 int64_t  CS_LDK_P2PGossipSync_as_MessageSendEventsProvider(int64_t this_arg) {
69897         LDKP2PGossipSync this_arg_conv;
69898         this_arg_conv.inner = untag_ptr(this_arg);
69899         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69900         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69901         this_arg_conv.is_owned = false;
69902         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
69903         *ret_ret = P2PGossipSync_as_MessageSendEventsProvider(&this_arg_conv);
69904         return tag_ptr(ret_ret, true);
69905 }
69906
69907 void  CS_LDK_ChannelUpdateInfo_free(int64_t this_obj) {
69908         LDKChannelUpdateInfo this_obj_conv;
69909         this_obj_conv.inner = untag_ptr(this_obj);
69910         this_obj_conv.is_owned = ptr_is_owned(this_obj);
69911         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
69912         ChannelUpdateInfo_free(this_obj_conv);
69913 }
69914
69915 int32_t  CS_LDK_ChannelUpdateInfo_get_last_update(int64_t this_ptr) {
69916         LDKChannelUpdateInfo this_ptr_conv;
69917         this_ptr_conv.inner = untag_ptr(this_ptr);
69918         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69919         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69920         this_ptr_conv.is_owned = false;
69921         int32_t ret_conv = ChannelUpdateInfo_get_last_update(&this_ptr_conv);
69922         return ret_conv;
69923 }
69924
69925 void  CS_LDK_ChannelUpdateInfo_set_last_update(int64_t this_ptr, int32_t val) {
69926         LDKChannelUpdateInfo this_ptr_conv;
69927         this_ptr_conv.inner = untag_ptr(this_ptr);
69928         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69929         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69930         this_ptr_conv.is_owned = false;
69931         ChannelUpdateInfo_set_last_update(&this_ptr_conv, val);
69932 }
69933
69934 jboolean  CS_LDK_ChannelUpdateInfo_get_enabled(int64_t this_ptr) {
69935         LDKChannelUpdateInfo this_ptr_conv;
69936         this_ptr_conv.inner = untag_ptr(this_ptr);
69937         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69938         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69939         this_ptr_conv.is_owned = false;
69940         jboolean ret_conv = ChannelUpdateInfo_get_enabled(&this_ptr_conv);
69941         return ret_conv;
69942 }
69943
69944 void  CS_LDK_ChannelUpdateInfo_set_enabled(int64_t this_ptr, jboolean val) {
69945         LDKChannelUpdateInfo this_ptr_conv;
69946         this_ptr_conv.inner = untag_ptr(this_ptr);
69947         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69948         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69949         this_ptr_conv.is_owned = false;
69950         ChannelUpdateInfo_set_enabled(&this_ptr_conv, val);
69951 }
69952
69953 int16_t  CS_LDK_ChannelUpdateInfo_get_cltv_expiry_delta(int64_t this_ptr) {
69954         LDKChannelUpdateInfo this_ptr_conv;
69955         this_ptr_conv.inner = untag_ptr(this_ptr);
69956         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69957         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69958         this_ptr_conv.is_owned = false;
69959         int16_t ret_conv = ChannelUpdateInfo_get_cltv_expiry_delta(&this_ptr_conv);
69960         return ret_conv;
69961 }
69962
69963 void  CS_LDK_ChannelUpdateInfo_set_cltv_expiry_delta(int64_t this_ptr, int16_t val) {
69964         LDKChannelUpdateInfo 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         ChannelUpdateInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
69970 }
69971
69972 int64_t  CS_LDK_ChannelUpdateInfo_get_htlc_minimum_msat(int64_t this_ptr) {
69973         LDKChannelUpdateInfo this_ptr_conv;
69974         this_ptr_conv.inner = untag_ptr(this_ptr);
69975         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69976         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69977         this_ptr_conv.is_owned = false;
69978         int64_t ret_conv = ChannelUpdateInfo_get_htlc_minimum_msat(&this_ptr_conv);
69979         return ret_conv;
69980 }
69981
69982 void  CS_LDK_ChannelUpdateInfo_set_htlc_minimum_msat(int64_t this_ptr, int64_t val) {
69983         LDKChannelUpdateInfo this_ptr_conv;
69984         this_ptr_conv.inner = untag_ptr(this_ptr);
69985         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69986         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69987         this_ptr_conv.is_owned = false;
69988         ChannelUpdateInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
69989 }
69990
69991 int64_t  CS_LDK_ChannelUpdateInfo_get_htlc_maximum_msat(int64_t this_ptr) {
69992         LDKChannelUpdateInfo this_ptr_conv;
69993         this_ptr_conv.inner = untag_ptr(this_ptr);
69994         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69995         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69996         this_ptr_conv.is_owned = false;
69997         int64_t ret_conv = ChannelUpdateInfo_get_htlc_maximum_msat(&this_ptr_conv);
69998         return ret_conv;
69999 }
70000
70001 void  CS_LDK_ChannelUpdateInfo_set_htlc_maximum_msat(int64_t this_ptr, int64_t val) {
70002         LDKChannelUpdateInfo this_ptr_conv;
70003         this_ptr_conv.inner = untag_ptr(this_ptr);
70004         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70005         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70006         this_ptr_conv.is_owned = false;
70007         ChannelUpdateInfo_set_htlc_maximum_msat(&this_ptr_conv, val);
70008 }
70009
70010 int64_t  CS_LDK_ChannelUpdateInfo_get_fees(int64_t this_ptr) {
70011         LDKChannelUpdateInfo this_ptr_conv;
70012         this_ptr_conv.inner = untag_ptr(this_ptr);
70013         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70014         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70015         this_ptr_conv.is_owned = false;
70016         LDKRoutingFees ret_var = ChannelUpdateInfo_get_fees(&this_ptr_conv);
70017         int64_t ret_ref = 0;
70018         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70019         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70020         return ret_ref;
70021 }
70022
70023 void  CS_LDK_ChannelUpdateInfo_set_fees(int64_t this_ptr, int64_t val) {
70024         LDKChannelUpdateInfo this_ptr_conv;
70025         this_ptr_conv.inner = untag_ptr(this_ptr);
70026         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70027         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70028         this_ptr_conv.is_owned = false;
70029         LDKRoutingFees val_conv;
70030         val_conv.inner = untag_ptr(val);
70031         val_conv.is_owned = ptr_is_owned(val);
70032         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
70033         val_conv = RoutingFees_clone(&val_conv);
70034         ChannelUpdateInfo_set_fees(&this_ptr_conv, val_conv);
70035 }
70036
70037 int64_t  CS_LDK_ChannelUpdateInfo_get_last_update_message(int64_t this_ptr) {
70038         LDKChannelUpdateInfo this_ptr_conv;
70039         this_ptr_conv.inner = untag_ptr(this_ptr);
70040         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70041         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70042         this_ptr_conv.is_owned = false;
70043         LDKChannelUpdate ret_var = ChannelUpdateInfo_get_last_update_message(&this_ptr_conv);
70044         int64_t ret_ref = 0;
70045         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70046         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70047         return ret_ref;
70048 }
70049
70050 void  CS_LDK_ChannelUpdateInfo_set_last_update_message(int64_t this_ptr, int64_t val) {
70051         LDKChannelUpdateInfo this_ptr_conv;
70052         this_ptr_conv.inner = untag_ptr(this_ptr);
70053         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70054         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70055         this_ptr_conv.is_owned = false;
70056         LDKChannelUpdate val_conv;
70057         val_conv.inner = untag_ptr(val);
70058         val_conv.is_owned = ptr_is_owned(val);
70059         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
70060         val_conv = ChannelUpdate_clone(&val_conv);
70061         ChannelUpdateInfo_set_last_update_message(&this_ptr_conv, val_conv);
70062 }
70063
70064 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) {
70065         LDKRoutingFees fees_arg_conv;
70066         fees_arg_conv.inner = untag_ptr(fees_arg);
70067         fees_arg_conv.is_owned = ptr_is_owned(fees_arg);
70068         CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
70069         fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
70070         LDKChannelUpdate last_update_message_arg_conv;
70071         last_update_message_arg_conv.inner = untag_ptr(last_update_message_arg);
70072         last_update_message_arg_conv.is_owned = ptr_is_owned(last_update_message_arg);
70073         CHECK_INNER_FIELD_ACCESS_OR_NULL(last_update_message_arg_conv);
70074         last_update_message_arg_conv = ChannelUpdate_clone(&last_update_message_arg_conv);
70075         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);
70076         int64_t ret_ref = 0;
70077         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70078         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70079         return ret_ref;
70080 }
70081
70082 static inline uint64_t ChannelUpdateInfo_clone_ptr(LDKChannelUpdateInfo *NONNULL_PTR arg) {
70083         LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(arg);
70084         int64_t ret_ref = 0;
70085         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70086         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70087         return ret_ref;
70088 }
70089 int64_t  CS_LDK_ChannelUpdateInfo_clone_ptr(int64_t arg) {
70090         LDKChannelUpdateInfo arg_conv;
70091         arg_conv.inner = untag_ptr(arg);
70092         arg_conv.is_owned = ptr_is_owned(arg);
70093         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
70094         arg_conv.is_owned = false;
70095         int64_t ret_conv = ChannelUpdateInfo_clone_ptr(&arg_conv);
70096         return ret_conv;
70097 }
70098
70099 int64_t  CS_LDK_ChannelUpdateInfo_clone(int64_t orig) {
70100         LDKChannelUpdateInfo orig_conv;
70101         orig_conv.inner = untag_ptr(orig);
70102         orig_conv.is_owned = ptr_is_owned(orig);
70103         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
70104         orig_conv.is_owned = false;
70105         LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(&orig_conv);
70106         int64_t ret_ref = 0;
70107         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70108         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70109         return ret_ref;
70110 }
70111
70112 jboolean  CS_LDK_ChannelUpdateInfo_eq(int64_t a, int64_t b) {
70113         LDKChannelUpdateInfo a_conv;
70114         a_conv.inner = untag_ptr(a);
70115         a_conv.is_owned = ptr_is_owned(a);
70116         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
70117         a_conv.is_owned = false;
70118         LDKChannelUpdateInfo b_conv;
70119         b_conv.inner = untag_ptr(b);
70120         b_conv.is_owned = ptr_is_owned(b);
70121         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
70122         b_conv.is_owned = false;
70123         jboolean ret_conv = ChannelUpdateInfo_eq(&a_conv, &b_conv);
70124         return ret_conv;
70125 }
70126
70127 jstring  CS_LDK_ChannelUpdateInfo_to_str(int64_t o) {
70128         LDKChannelUpdateInfo o_conv;
70129         o_conv.inner = untag_ptr(o);
70130         o_conv.is_owned = ptr_is_owned(o);
70131         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
70132         o_conv.is_owned = false;
70133         LDKStr ret_str = ChannelUpdateInfo_to_str(&o_conv);
70134         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
70135         Str_free(ret_str);
70136         return ret_conv;
70137 }
70138
70139 int8_tArray  CS_LDK_ChannelUpdateInfo_write(int64_t obj) {
70140         LDKChannelUpdateInfo obj_conv;
70141         obj_conv.inner = untag_ptr(obj);
70142         obj_conv.is_owned = ptr_is_owned(obj);
70143         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
70144         obj_conv.is_owned = false;
70145         LDKCVec_u8Z ret_var = ChannelUpdateInfo_write(&obj_conv);
70146         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
70147         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
70148         CVec_u8Z_free(ret_var);
70149         return ret_arr;
70150 }
70151
70152 int64_t  CS_LDK_ChannelUpdateInfo_read(int8_tArray ser) {
70153         LDKu8slice ser_ref;
70154         ser_ref.datalen = ser->arr_len;
70155         ser_ref.data = ser->elems;
70156         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
70157         *ret_conv = ChannelUpdateInfo_read(ser_ref);
70158         FREE(ser);
70159         return tag_ptr(ret_conv, true);
70160 }
70161
70162 void  CS_LDK_ChannelInfo_free(int64_t this_obj) {
70163         LDKChannelInfo this_obj_conv;
70164         this_obj_conv.inner = untag_ptr(this_obj);
70165         this_obj_conv.is_owned = ptr_is_owned(this_obj);
70166         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
70167         ChannelInfo_free(this_obj_conv);
70168 }
70169
70170 int64_t  CS_LDK_ChannelInfo_get_features(int64_t this_ptr) {
70171         LDKChannelInfo this_ptr_conv;
70172         this_ptr_conv.inner = untag_ptr(this_ptr);
70173         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70174         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70175         this_ptr_conv.is_owned = false;
70176         LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
70177         int64_t ret_ref = 0;
70178         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70179         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70180         return ret_ref;
70181 }
70182
70183 void  CS_LDK_ChannelInfo_set_features(int64_t this_ptr, int64_t val) {
70184         LDKChannelInfo this_ptr_conv;
70185         this_ptr_conv.inner = untag_ptr(this_ptr);
70186         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70187         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70188         this_ptr_conv.is_owned = false;
70189         LDKChannelFeatures val_conv;
70190         val_conv.inner = untag_ptr(val);
70191         val_conv.is_owned = ptr_is_owned(val);
70192         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
70193         val_conv = ChannelFeatures_clone(&val_conv);
70194         ChannelInfo_set_features(&this_ptr_conv, val_conv);
70195 }
70196
70197 int64_t  CS_LDK_ChannelInfo_get_node_one(int64_t this_ptr) {
70198         LDKChannelInfo this_ptr_conv;
70199         this_ptr_conv.inner = untag_ptr(this_ptr);
70200         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70201         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70202         this_ptr_conv.is_owned = false;
70203         LDKNodeId ret_var = ChannelInfo_get_node_one(&this_ptr_conv);
70204         int64_t ret_ref = 0;
70205         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70206         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70207         return ret_ref;
70208 }
70209
70210 void  CS_LDK_ChannelInfo_set_node_one(int64_t this_ptr, int64_t val) {
70211         LDKChannelInfo this_ptr_conv;
70212         this_ptr_conv.inner = untag_ptr(this_ptr);
70213         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70214         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70215         this_ptr_conv.is_owned = false;
70216         LDKNodeId val_conv;
70217         val_conv.inner = untag_ptr(val);
70218         val_conv.is_owned = ptr_is_owned(val);
70219         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
70220         val_conv = NodeId_clone(&val_conv);
70221         ChannelInfo_set_node_one(&this_ptr_conv, val_conv);
70222 }
70223
70224 int64_t  CS_LDK_ChannelInfo_get_one_to_two(int64_t this_ptr) {
70225         LDKChannelInfo this_ptr_conv;
70226         this_ptr_conv.inner = untag_ptr(this_ptr);
70227         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70228         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70229         this_ptr_conv.is_owned = false;
70230         LDKChannelUpdateInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
70231         int64_t ret_ref = 0;
70232         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70233         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70234         return ret_ref;
70235 }
70236
70237 void  CS_LDK_ChannelInfo_set_one_to_two(int64_t this_ptr, int64_t val) {
70238         LDKChannelInfo this_ptr_conv;
70239         this_ptr_conv.inner = untag_ptr(this_ptr);
70240         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70241         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70242         this_ptr_conv.is_owned = false;
70243         LDKChannelUpdateInfo val_conv;
70244         val_conv.inner = untag_ptr(val);
70245         val_conv.is_owned = ptr_is_owned(val);
70246         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
70247         val_conv = ChannelUpdateInfo_clone(&val_conv);
70248         ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
70249 }
70250
70251 int64_t  CS_LDK_ChannelInfo_get_node_two(int64_t this_ptr) {
70252         LDKChannelInfo this_ptr_conv;
70253         this_ptr_conv.inner = untag_ptr(this_ptr);
70254         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70255         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70256         this_ptr_conv.is_owned = false;
70257         LDKNodeId ret_var = ChannelInfo_get_node_two(&this_ptr_conv);
70258         int64_t ret_ref = 0;
70259         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70260         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70261         return ret_ref;
70262 }
70263
70264 void  CS_LDK_ChannelInfo_set_node_two(int64_t this_ptr, int64_t val) {
70265         LDKChannelInfo this_ptr_conv;
70266         this_ptr_conv.inner = untag_ptr(this_ptr);
70267         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70268         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70269         this_ptr_conv.is_owned = false;
70270         LDKNodeId val_conv;
70271         val_conv.inner = untag_ptr(val);
70272         val_conv.is_owned = ptr_is_owned(val);
70273         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
70274         val_conv = NodeId_clone(&val_conv);
70275         ChannelInfo_set_node_two(&this_ptr_conv, val_conv);
70276 }
70277
70278 int64_t  CS_LDK_ChannelInfo_get_two_to_one(int64_t this_ptr) {
70279         LDKChannelInfo this_ptr_conv;
70280         this_ptr_conv.inner = untag_ptr(this_ptr);
70281         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70282         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70283         this_ptr_conv.is_owned = false;
70284         LDKChannelUpdateInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
70285         int64_t ret_ref = 0;
70286         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70287         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70288         return ret_ref;
70289 }
70290
70291 void  CS_LDK_ChannelInfo_set_two_to_one(int64_t this_ptr, int64_t val) {
70292         LDKChannelInfo this_ptr_conv;
70293         this_ptr_conv.inner = untag_ptr(this_ptr);
70294         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70295         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70296         this_ptr_conv.is_owned = false;
70297         LDKChannelUpdateInfo val_conv;
70298         val_conv.inner = untag_ptr(val);
70299         val_conv.is_owned = ptr_is_owned(val);
70300         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
70301         val_conv = ChannelUpdateInfo_clone(&val_conv);
70302         ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
70303 }
70304
70305 int64_t  CS_LDK_ChannelInfo_get_capacity_sats(int64_t this_ptr) {
70306         LDKChannelInfo this_ptr_conv;
70307         this_ptr_conv.inner = untag_ptr(this_ptr);
70308         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70309         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70310         this_ptr_conv.is_owned = false;
70311         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
70312         *ret_copy = ChannelInfo_get_capacity_sats(&this_ptr_conv);
70313         int64_t ret_ref = tag_ptr(ret_copy, true);
70314         return ret_ref;
70315 }
70316
70317 void  CS_LDK_ChannelInfo_set_capacity_sats(int64_t this_ptr, int64_t val) {
70318         LDKChannelInfo this_ptr_conv;
70319         this_ptr_conv.inner = untag_ptr(this_ptr);
70320         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70321         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70322         this_ptr_conv.is_owned = false;
70323         void* val_ptr = untag_ptr(val);
70324         CHECK_ACCESS(val_ptr);
70325         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
70326         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
70327         ChannelInfo_set_capacity_sats(&this_ptr_conv, val_conv);
70328 }
70329
70330 int64_t  CS_LDK_ChannelInfo_get_announcement_message(int64_t this_ptr) {
70331         LDKChannelInfo this_ptr_conv;
70332         this_ptr_conv.inner = untag_ptr(this_ptr);
70333         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70334         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70335         this_ptr_conv.is_owned = false;
70336         LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
70337         int64_t ret_ref = 0;
70338         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70339         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70340         return ret_ref;
70341 }
70342
70343 void  CS_LDK_ChannelInfo_set_announcement_message(int64_t this_ptr, int64_t val) {
70344         LDKChannelInfo this_ptr_conv;
70345         this_ptr_conv.inner = untag_ptr(this_ptr);
70346         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70347         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70348         this_ptr_conv.is_owned = false;
70349         LDKChannelAnnouncement val_conv;
70350         val_conv.inner = untag_ptr(val);
70351         val_conv.is_owned = ptr_is_owned(val);
70352         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
70353         val_conv = ChannelAnnouncement_clone(&val_conv);
70354         ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
70355 }
70356
70357 static inline uint64_t ChannelInfo_clone_ptr(LDKChannelInfo *NONNULL_PTR arg) {
70358         LDKChannelInfo ret_var = ChannelInfo_clone(arg);
70359         int64_t ret_ref = 0;
70360         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70361         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70362         return ret_ref;
70363 }
70364 int64_t  CS_LDK_ChannelInfo_clone_ptr(int64_t arg) {
70365         LDKChannelInfo arg_conv;
70366         arg_conv.inner = untag_ptr(arg);
70367         arg_conv.is_owned = ptr_is_owned(arg);
70368         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
70369         arg_conv.is_owned = false;
70370         int64_t ret_conv = ChannelInfo_clone_ptr(&arg_conv);
70371         return ret_conv;
70372 }
70373
70374 int64_t  CS_LDK_ChannelInfo_clone(int64_t orig) {
70375         LDKChannelInfo orig_conv;
70376         orig_conv.inner = untag_ptr(orig);
70377         orig_conv.is_owned = ptr_is_owned(orig);
70378         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
70379         orig_conv.is_owned = false;
70380         LDKChannelInfo ret_var = ChannelInfo_clone(&orig_conv);
70381         int64_t ret_ref = 0;
70382         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70383         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70384         return ret_ref;
70385 }
70386
70387 jboolean  CS_LDK_ChannelInfo_eq(int64_t a, int64_t b) {
70388         LDKChannelInfo a_conv;
70389         a_conv.inner = untag_ptr(a);
70390         a_conv.is_owned = ptr_is_owned(a);
70391         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
70392         a_conv.is_owned = false;
70393         LDKChannelInfo b_conv;
70394         b_conv.inner = untag_ptr(b);
70395         b_conv.is_owned = ptr_is_owned(b);
70396         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
70397         b_conv.is_owned = false;
70398         jboolean ret_conv = ChannelInfo_eq(&a_conv, &b_conv);
70399         return ret_conv;
70400 }
70401
70402 int64_t  CS_LDK_ChannelInfo_get_directional_info(int64_t this_arg, int8_t channel_flags) {
70403         LDKChannelInfo this_arg_conv;
70404         this_arg_conv.inner = untag_ptr(this_arg);
70405         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70406         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70407         this_arg_conv.is_owned = false;
70408         LDKChannelUpdateInfo ret_var = ChannelInfo_get_directional_info(&this_arg_conv, channel_flags);
70409         int64_t ret_ref = 0;
70410         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70411         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70412         return ret_ref;
70413 }
70414
70415 jstring  CS_LDK_ChannelInfo_to_str(int64_t o) {
70416         LDKChannelInfo o_conv;
70417         o_conv.inner = untag_ptr(o);
70418         o_conv.is_owned = ptr_is_owned(o);
70419         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
70420         o_conv.is_owned = false;
70421         LDKStr ret_str = ChannelInfo_to_str(&o_conv);
70422         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
70423         Str_free(ret_str);
70424         return ret_conv;
70425 }
70426
70427 int8_tArray  CS_LDK_ChannelInfo_write(int64_t obj) {
70428         LDKChannelInfo obj_conv;
70429         obj_conv.inner = untag_ptr(obj);
70430         obj_conv.is_owned = ptr_is_owned(obj);
70431         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
70432         obj_conv.is_owned = false;
70433         LDKCVec_u8Z ret_var = ChannelInfo_write(&obj_conv);
70434         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
70435         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
70436         CVec_u8Z_free(ret_var);
70437         return ret_arr;
70438 }
70439
70440 int64_t  CS_LDK_ChannelInfo_read(int8_tArray ser) {
70441         LDKu8slice ser_ref;
70442         ser_ref.datalen = ser->arr_len;
70443         ser_ref.data = ser->elems;
70444         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
70445         *ret_conv = ChannelInfo_read(ser_ref);
70446         FREE(ser);
70447         return tag_ptr(ret_conv, true);
70448 }
70449
70450 void  CS_LDK_DirectedChannelInfo_free(int64_t this_obj) {
70451         LDKDirectedChannelInfo this_obj_conv;
70452         this_obj_conv.inner = untag_ptr(this_obj);
70453         this_obj_conv.is_owned = ptr_is_owned(this_obj);
70454         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
70455         DirectedChannelInfo_free(this_obj_conv);
70456 }
70457
70458 static inline uint64_t DirectedChannelInfo_clone_ptr(LDKDirectedChannelInfo *NONNULL_PTR arg) {
70459         LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(arg);
70460         int64_t ret_ref = 0;
70461         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70462         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70463         return ret_ref;
70464 }
70465 int64_t  CS_LDK_DirectedChannelInfo_clone_ptr(int64_t arg) {
70466         LDKDirectedChannelInfo arg_conv;
70467         arg_conv.inner = untag_ptr(arg);
70468         arg_conv.is_owned = ptr_is_owned(arg);
70469         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
70470         arg_conv.is_owned = false;
70471         int64_t ret_conv = DirectedChannelInfo_clone_ptr(&arg_conv);
70472         return ret_conv;
70473 }
70474
70475 int64_t  CS_LDK_DirectedChannelInfo_clone(int64_t orig) {
70476         LDKDirectedChannelInfo orig_conv;
70477         orig_conv.inner = untag_ptr(orig);
70478         orig_conv.is_owned = ptr_is_owned(orig);
70479         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
70480         orig_conv.is_owned = false;
70481         LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(&orig_conv);
70482         int64_t ret_ref = 0;
70483         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70484         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70485         return ret_ref;
70486 }
70487
70488 int64_t  CS_LDK_DirectedChannelInfo_channel(int64_t this_arg) {
70489         LDKDirectedChannelInfo this_arg_conv;
70490         this_arg_conv.inner = untag_ptr(this_arg);
70491         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70492         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70493         this_arg_conv.is_owned = false;
70494         LDKChannelInfo ret_var = DirectedChannelInfo_channel(&this_arg_conv);
70495         int64_t ret_ref = 0;
70496         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70497         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70498         return ret_ref;
70499 }
70500
70501 int64_t  CS_LDK_DirectedChannelInfo_effective_capacity(int64_t this_arg) {
70502         LDKDirectedChannelInfo this_arg_conv;
70503         this_arg_conv.inner = untag_ptr(this_arg);
70504         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70505         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70506         this_arg_conv.is_owned = false;
70507         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
70508         *ret_copy = DirectedChannelInfo_effective_capacity(&this_arg_conv);
70509         int64_t ret_ref = tag_ptr(ret_copy, true);
70510         return ret_ref;
70511 }
70512
70513 int64_t  CS_LDK_DirectedChannelInfo_source(int64_t this_arg) {
70514         LDKDirectedChannelInfo this_arg_conv;
70515         this_arg_conv.inner = untag_ptr(this_arg);
70516         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70517         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70518         this_arg_conv.is_owned = false;
70519         LDKNodeId ret_var = DirectedChannelInfo_source(&this_arg_conv);
70520         int64_t ret_ref = 0;
70521         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70522         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70523         return ret_ref;
70524 }
70525
70526 int64_t  CS_LDK_DirectedChannelInfo_target(int64_t this_arg) {
70527         LDKDirectedChannelInfo this_arg_conv;
70528         this_arg_conv.inner = untag_ptr(this_arg);
70529         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70530         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70531         this_arg_conv.is_owned = false;
70532         LDKNodeId ret_var = DirectedChannelInfo_target(&this_arg_conv);
70533         int64_t ret_ref = 0;
70534         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70535         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70536         return ret_ref;
70537 }
70538
70539 void  CS_LDK_EffectiveCapacity_free(int64_t this_ptr) {
70540         if (!ptr_is_owned(this_ptr)) return;
70541         void* this_ptr_ptr = untag_ptr(this_ptr);
70542         CHECK_ACCESS(this_ptr_ptr);
70543         LDKEffectiveCapacity this_ptr_conv = *(LDKEffectiveCapacity*)(this_ptr_ptr);
70544         FREE(untag_ptr(this_ptr));
70545         EffectiveCapacity_free(this_ptr_conv);
70546 }
70547
70548 static inline uint64_t EffectiveCapacity_clone_ptr(LDKEffectiveCapacity *NONNULL_PTR arg) {
70549         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
70550         *ret_copy = EffectiveCapacity_clone(arg);
70551         int64_t ret_ref = tag_ptr(ret_copy, true);
70552         return ret_ref;
70553 }
70554 int64_t  CS_LDK_EffectiveCapacity_clone_ptr(int64_t arg) {
70555         LDKEffectiveCapacity* arg_conv = (LDKEffectiveCapacity*)untag_ptr(arg);
70556         int64_t ret_conv = EffectiveCapacity_clone_ptr(arg_conv);
70557         return ret_conv;
70558 }
70559
70560 int64_t  CS_LDK_EffectiveCapacity_clone(int64_t orig) {
70561         LDKEffectiveCapacity* orig_conv = (LDKEffectiveCapacity*)untag_ptr(orig);
70562         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
70563         *ret_copy = EffectiveCapacity_clone(orig_conv);
70564         int64_t ret_ref = tag_ptr(ret_copy, true);
70565         return ret_ref;
70566 }
70567
70568 int64_t  CS_LDK_EffectiveCapacity_exact_liquidity(int64_t liquidity_msat) {
70569         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
70570         *ret_copy = EffectiveCapacity_exact_liquidity(liquidity_msat);
70571         int64_t ret_ref = tag_ptr(ret_copy, true);
70572         return ret_ref;
70573 }
70574
70575 int64_t  CS_LDK_EffectiveCapacity_advertised_max_htlc(int64_t amount_msat) {
70576         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
70577         *ret_copy = EffectiveCapacity_advertised_max_htlc(amount_msat);
70578         int64_t ret_ref = tag_ptr(ret_copy, true);
70579         return ret_ref;
70580 }
70581
70582 int64_t  CS_LDK_EffectiveCapacity_total(int64_t capacity_msat, int64_t htlc_maximum_msat) {
70583         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
70584         *ret_copy = EffectiveCapacity_total(capacity_msat, htlc_maximum_msat);
70585         int64_t ret_ref = tag_ptr(ret_copy, true);
70586         return ret_ref;
70587 }
70588
70589 int64_t  CS_LDK_EffectiveCapacity_infinite() {
70590         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
70591         *ret_copy = EffectiveCapacity_infinite();
70592         int64_t ret_ref = tag_ptr(ret_copy, true);
70593         return ret_ref;
70594 }
70595
70596 int64_t  CS_LDK_EffectiveCapacity_hint_max_htlc(int64_t amount_msat) {
70597         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
70598         *ret_copy = EffectiveCapacity_hint_max_htlc(amount_msat);
70599         int64_t ret_ref = tag_ptr(ret_copy, true);
70600         return ret_ref;
70601 }
70602
70603 int64_t  CS_LDK_EffectiveCapacity_unknown() {
70604         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
70605         *ret_copy = EffectiveCapacity_unknown();
70606         int64_t ret_ref = tag_ptr(ret_copy, true);
70607         return ret_ref;
70608 }
70609
70610 int64_t  CS_LDK_EffectiveCapacity_as_msat(int64_t this_arg) {
70611         LDKEffectiveCapacity* this_arg_conv = (LDKEffectiveCapacity*)untag_ptr(this_arg);
70612         int64_t ret_conv = EffectiveCapacity_as_msat(this_arg_conv);
70613         return ret_conv;
70614 }
70615
70616 void  CS_LDK_RoutingFees_free(int64_t this_obj) {
70617         LDKRoutingFees this_obj_conv;
70618         this_obj_conv.inner = untag_ptr(this_obj);
70619         this_obj_conv.is_owned = ptr_is_owned(this_obj);
70620         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
70621         RoutingFees_free(this_obj_conv);
70622 }
70623
70624 int32_t  CS_LDK_RoutingFees_get_base_msat(int64_t this_ptr) {
70625         LDKRoutingFees this_ptr_conv;
70626         this_ptr_conv.inner = untag_ptr(this_ptr);
70627         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70628         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70629         this_ptr_conv.is_owned = false;
70630         int32_t ret_conv = RoutingFees_get_base_msat(&this_ptr_conv);
70631         return ret_conv;
70632 }
70633
70634 void  CS_LDK_RoutingFees_set_base_msat(int64_t this_ptr, int32_t val) {
70635         LDKRoutingFees this_ptr_conv;
70636         this_ptr_conv.inner = untag_ptr(this_ptr);
70637         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70638         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70639         this_ptr_conv.is_owned = false;
70640         RoutingFees_set_base_msat(&this_ptr_conv, val);
70641 }
70642
70643 int32_t  CS_LDK_RoutingFees_get_proportional_millionths(int64_t this_ptr) {
70644         LDKRoutingFees this_ptr_conv;
70645         this_ptr_conv.inner = untag_ptr(this_ptr);
70646         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70647         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70648         this_ptr_conv.is_owned = false;
70649         int32_t ret_conv = RoutingFees_get_proportional_millionths(&this_ptr_conv);
70650         return ret_conv;
70651 }
70652
70653 void  CS_LDK_RoutingFees_set_proportional_millionths(int64_t this_ptr, int32_t val) {
70654         LDKRoutingFees this_ptr_conv;
70655         this_ptr_conv.inner = untag_ptr(this_ptr);
70656         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70657         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70658         this_ptr_conv.is_owned = false;
70659         RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
70660 }
70661
70662 int64_t  CS_LDK_RoutingFees_new(int32_t base_msat_arg, int32_t proportional_millionths_arg) {
70663         LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
70664         int64_t ret_ref = 0;
70665         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70666         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70667         return ret_ref;
70668 }
70669
70670 jboolean  CS_LDK_RoutingFees_eq(int64_t a, int64_t b) {
70671         LDKRoutingFees a_conv;
70672         a_conv.inner = untag_ptr(a);
70673         a_conv.is_owned = ptr_is_owned(a);
70674         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
70675         a_conv.is_owned = false;
70676         LDKRoutingFees b_conv;
70677         b_conv.inner = untag_ptr(b);
70678         b_conv.is_owned = ptr_is_owned(b);
70679         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
70680         b_conv.is_owned = false;
70681         jboolean ret_conv = RoutingFees_eq(&a_conv, &b_conv);
70682         return ret_conv;
70683 }
70684
70685 static inline uint64_t RoutingFees_clone_ptr(LDKRoutingFees *NONNULL_PTR arg) {
70686         LDKRoutingFees ret_var = RoutingFees_clone(arg);
70687         int64_t ret_ref = 0;
70688         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70689         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70690         return ret_ref;
70691 }
70692 int64_t  CS_LDK_RoutingFees_clone_ptr(int64_t arg) {
70693         LDKRoutingFees arg_conv;
70694         arg_conv.inner = untag_ptr(arg);
70695         arg_conv.is_owned = ptr_is_owned(arg);
70696         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
70697         arg_conv.is_owned = false;
70698         int64_t ret_conv = RoutingFees_clone_ptr(&arg_conv);
70699         return ret_conv;
70700 }
70701
70702 int64_t  CS_LDK_RoutingFees_clone(int64_t orig) {
70703         LDKRoutingFees orig_conv;
70704         orig_conv.inner = untag_ptr(orig);
70705         orig_conv.is_owned = ptr_is_owned(orig);
70706         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
70707         orig_conv.is_owned = false;
70708         LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
70709         int64_t ret_ref = 0;
70710         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70711         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70712         return ret_ref;
70713 }
70714
70715 int64_t  CS_LDK_RoutingFees_hash(int64_t o) {
70716         LDKRoutingFees o_conv;
70717         o_conv.inner = untag_ptr(o);
70718         o_conv.is_owned = ptr_is_owned(o);
70719         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
70720         o_conv.is_owned = false;
70721         int64_t ret_conv = RoutingFees_hash(&o_conv);
70722         return ret_conv;
70723 }
70724
70725 int8_tArray  CS_LDK_RoutingFees_write(int64_t obj) {
70726         LDKRoutingFees obj_conv;
70727         obj_conv.inner = untag_ptr(obj);
70728         obj_conv.is_owned = ptr_is_owned(obj);
70729         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
70730         obj_conv.is_owned = false;
70731         LDKCVec_u8Z ret_var = RoutingFees_write(&obj_conv);
70732         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
70733         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
70734         CVec_u8Z_free(ret_var);
70735         return ret_arr;
70736 }
70737
70738 int64_t  CS_LDK_RoutingFees_read(int8_tArray ser) {
70739         LDKu8slice ser_ref;
70740         ser_ref.datalen = ser->arr_len;
70741         ser_ref.data = ser->elems;
70742         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
70743         *ret_conv = RoutingFees_read(ser_ref);
70744         FREE(ser);
70745         return tag_ptr(ret_conv, true);
70746 }
70747
70748 void  CS_LDK_NodeAnnouncementInfo_free(int64_t this_obj) {
70749         LDKNodeAnnouncementInfo this_obj_conv;
70750         this_obj_conv.inner = untag_ptr(this_obj);
70751         this_obj_conv.is_owned = ptr_is_owned(this_obj);
70752         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
70753         NodeAnnouncementInfo_free(this_obj_conv);
70754 }
70755
70756 int64_t  CS_LDK_NodeAnnouncementInfo_get_features(int64_t this_ptr) {
70757         LDKNodeAnnouncementInfo this_ptr_conv;
70758         this_ptr_conv.inner = untag_ptr(this_ptr);
70759         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70760         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70761         this_ptr_conv.is_owned = false;
70762         LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
70763         int64_t ret_ref = 0;
70764         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70765         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70766         return ret_ref;
70767 }
70768
70769 void  CS_LDK_NodeAnnouncementInfo_set_features(int64_t this_ptr, int64_t val) {
70770         LDKNodeAnnouncementInfo this_ptr_conv;
70771         this_ptr_conv.inner = untag_ptr(this_ptr);
70772         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70773         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70774         this_ptr_conv.is_owned = false;
70775         LDKNodeFeatures val_conv;
70776         val_conv.inner = untag_ptr(val);
70777         val_conv.is_owned = ptr_is_owned(val);
70778         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
70779         val_conv = NodeFeatures_clone(&val_conv);
70780         NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
70781 }
70782
70783 int32_t  CS_LDK_NodeAnnouncementInfo_get_last_update(int64_t this_ptr) {
70784         LDKNodeAnnouncementInfo this_ptr_conv;
70785         this_ptr_conv.inner = untag_ptr(this_ptr);
70786         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70787         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70788         this_ptr_conv.is_owned = false;
70789         int32_t ret_conv = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
70790         return ret_conv;
70791 }
70792
70793 void  CS_LDK_NodeAnnouncementInfo_set_last_update(int64_t this_ptr, int32_t val) {
70794         LDKNodeAnnouncementInfo this_ptr_conv;
70795         this_ptr_conv.inner = untag_ptr(this_ptr);
70796         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70797         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70798         this_ptr_conv.is_owned = false;
70799         NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
70800 }
70801
70802 int8_tArray  CS_LDK_NodeAnnouncementInfo_get_rgb(int64_t this_ptr) {
70803         LDKNodeAnnouncementInfo this_ptr_conv;
70804         this_ptr_conv.inner = untag_ptr(this_ptr);
70805         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70806         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70807         this_ptr_conv.is_owned = false;
70808         int8_tArray ret_arr = init_int8_tArray(3, __LINE__);
70809         memcpy(ret_arr->elems, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv), 3);
70810         return ret_arr;
70811 }
70812
70813 void  CS_LDK_NodeAnnouncementInfo_set_rgb(int64_t this_ptr, int8_tArray val) {
70814         LDKNodeAnnouncementInfo this_ptr_conv;
70815         this_ptr_conv.inner = untag_ptr(this_ptr);
70816         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70817         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70818         this_ptr_conv.is_owned = false;
70819         LDKThreeBytes val_ref;
70820         CHECK(val->arr_len == 3);
70821         memcpy(val_ref.data, val->elems, 3); FREE(val);
70822         NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
70823 }
70824
70825 int64_t  CS_LDK_NodeAnnouncementInfo_get_alias(int64_t this_ptr) {
70826         LDKNodeAnnouncementInfo this_ptr_conv;
70827         this_ptr_conv.inner = untag_ptr(this_ptr);
70828         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70829         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70830         this_ptr_conv.is_owned = false;
70831         LDKNodeAlias ret_var = NodeAnnouncementInfo_get_alias(&this_ptr_conv);
70832         int64_t ret_ref = 0;
70833         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70834         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70835         return ret_ref;
70836 }
70837
70838 void  CS_LDK_NodeAnnouncementInfo_set_alias(int64_t this_ptr, int64_t val) {
70839         LDKNodeAnnouncementInfo this_ptr_conv;
70840         this_ptr_conv.inner = untag_ptr(this_ptr);
70841         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70842         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70843         this_ptr_conv.is_owned = false;
70844         LDKNodeAlias val_conv;
70845         val_conv.inner = untag_ptr(val);
70846         val_conv.is_owned = ptr_is_owned(val);
70847         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
70848         val_conv = NodeAlias_clone(&val_conv);
70849         NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_conv);
70850 }
70851
70852 int64_t  CS_LDK_NodeAnnouncementInfo_get_announcement_message(int64_t this_ptr) {
70853         LDKNodeAnnouncementInfo this_ptr_conv;
70854         this_ptr_conv.inner = untag_ptr(this_ptr);
70855         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70856         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70857         this_ptr_conv.is_owned = false;
70858         LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
70859         int64_t ret_ref = 0;
70860         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70861         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70862         return ret_ref;
70863 }
70864
70865 void  CS_LDK_NodeAnnouncementInfo_set_announcement_message(int64_t this_ptr, int64_t val) {
70866         LDKNodeAnnouncementInfo this_ptr_conv;
70867         this_ptr_conv.inner = untag_ptr(this_ptr);
70868         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70869         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70870         this_ptr_conv.is_owned = false;
70871         LDKNodeAnnouncement val_conv;
70872         val_conv.inner = untag_ptr(val);
70873         val_conv.is_owned = ptr_is_owned(val);
70874         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
70875         val_conv = NodeAnnouncement_clone(&val_conv);
70876         NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
70877 }
70878
70879 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) {
70880         LDKNodeFeatures features_arg_conv;
70881         features_arg_conv.inner = untag_ptr(features_arg);
70882         features_arg_conv.is_owned = ptr_is_owned(features_arg);
70883         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
70884         features_arg_conv = NodeFeatures_clone(&features_arg_conv);
70885         LDKThreeBytes rgb_arg_ref;
70886         CHECK(rgb_arg->arr_len == 3);
70887         memcpy(rgb_arg_ref.data, rgb_arg->elems, 3); FREE(rgb_arg);
70888         LDKNodeAlias alias_arg_conv;
70889         alias_arg_conv.inner = untag_ptr(alias_arg);
70890         alias_arg_conv.is_owned = ptr_is_owned(alias_arg);
70891         CHECK_INNER_FIELD_ACCESS_OR_NULL(alias_arg_conv);
70892         alias_arg_conv = NodeAlias_clone(&alias_arg_conv);
70893         LDKNodeAnnouncement announcement_message_arg_conv;
70894         announcement_message_arg_conv.inner = untag_ptr(announcement_message_arg);
70895         announcement_message_arg_conv.is_owned = ptr_is_owned(announcement_message_arg);
70896         CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_message_arg_conv);
70897         announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
70898         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_conv, announcement_message_arg_conv);
70899         int64_t ret_ref = 0;
70900         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70901         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70902         return ret_ref;
70903 }
70904
70905 static inline uint64_t NodeAnnouncementInfo_clone_ptr(LDKNodeAnnouncementInfo *NONNULL_PTR arg) {
70906         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(arg);
70907         int64_t ret_ref = 0;
70908         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70909         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70910         return ret_ref;
70911 }
70912 int64_t  CS_LDK_NodeAnnouncementInfo_clone_ptr(int64_t arg) {
70913         LDKNodeAnnouncementInfo arg_conv;
70914         arg_conv.inner = untag_ptr(arg);
70915         arg_conv.is_owned = ptr_is_owned(arg);
70916         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
70917         arg_conv.is_owned = false;
70918         int64_t ret_conv = NodeAnnouncementInfo_clone_ptr(&arg_conv);
70919         return ret_conv;
70920 }
70921
70922 int64_t  CS_LDK_NodeAnnouncementInfo_clone(int64_t orig) {
70923         LDKNodeAnnouncementInfo orig_conv;
70924         orig_conv.inner = untag_ptr(orig);
70925         orig_conv.is_owned = ptr_is_owned(orig);
70926         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
70927         orig_conv.is_owned = false;
70928         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(&orig_conv);
70929         int64_t ret_ref = 0;
70930         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70931         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70932         return ret_ref;
70933 }
70934
70935 jboolean  CS_LDK_NodeAnnouncementInfo_eq(int64_t a, int64_t b) {
70936         LDKNodeAnnouncementInfo a_conv;
70937         a_conv.inner = untag_ptr(a);
70938         a_conv.is_owned = ptr_is_owned(a);
70939         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
70940         a_conv.is_owned = false;
70941         LDKNodeAnnouncementInfo b_conv;
70942         b_conv.inner = untag_ptr(b);
70943         b_conv.is_owned = ptr_is_owned(b);
70944         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
70945         b_conv.is_owned = false;
70946         jboolean ret_conv = NodeAnnouncementInfo_eq(&a_conv, &b_conv);
70947         return ret_conv;
70948 }
70949
70950 int64_tArray  CS_LDK_NodeAnnouncementInfo_addresses(int64_t this_arg) {
70951         LDKNodeAnnouncementInfo this_arg_conv;
70952         this_arg_conv.inner = untag_ptr(this_arg);
70953         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70954         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70955         this_arg_conv.is_owned = false;
70956         LDKCVec_SocketAddressZ ret_var = NodeAnnouncementInfo_addresses(&this_arg_conv);
70957         int64_tArray ret_arr = NULL;
70958         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
70959         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
70960         for (size_t p = 0; p < ret_var.datalen; p++) {
70961                 LDKSocketAddress *ret_conv_15_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
70962                 *ret_conv_15_copy = ret_var.data[p];
70963                 int64_t ret_conv_15_ref = tag_ptr(ret_conv_15_copy, true);
70964                 ret_arr_ptr[p] = ret_conv_15_ref;
70965         }
70966         
70967         FREE(ret_var.data);
70968         return ret_arr;
70969 }
70970
70971 int8_tArray  CS_LDK_NodeAnnouncementInfo_write(int64_t obj) {
70972         LDKNodeAnnouncementInfo obj_conv;
70973         obj_conv.inner = untag_ptr(obj);
70974         obj_conv.is_owned = ptr_is_owned(obj);
70975         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
70976         obj_conv.is_owned = false;
70977         LDKCVec_u8Z ret_var = NodeAnnouncementInfo_write(&obj_conv);
70978         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
70979         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
70980         CVec_u8Z_free(ret_var);
70981         return ret_arr;
70982 }
70983
70984 int64_t  CS_LDK_NodeAnnouncementInfo_read(int8_tArray ser) {
70985         LDKu8slice ser_ref;
70986         ser_ref.datalen = ser->arr_len;
70987         ser_ref.data = ser->elems;
70988         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
70989         *ret_conv = NodeAnnouncementInfo_read(ser_ref);
70990         FREE(ser);
70991         return tag_ptr(ret_conv, true);
70992 }
70993
70994 void  CS_LDK_NodeAlias_free(int64_t this_obj) {
70995         LDKNodeAlias this_obj_conv;
70996         this_obj_conv.inner = untag_ptr(this_obj);
70997         this_obj_conv.is_owned = ptr_is_owned(this_obj);
70998         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
70999         NodeAlias_free(this_obj_conv);
71000 }
71001
71002 int8_tArray  CS_LDK_NodeAlias_get_a(int64_t this_ptr) {
71003         LDKNodeAlias this_ptr_conv;
71004         this_ptr_conv.inner = untag_ptr(this_ptr);
71005         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71006         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71007         this_ptr_conv.is_owned = false;
71008         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
71009         memcpy(ret_arr->elems, *NodeAlias_get_a(&this_ptr_conv), 32);
71010         return ret_arr;
71011 }
71012
71013 void  CS_LDK_NodeAlias_set_a(int64_t this_ptr, int8_tArray val) {
71014         LDKNodeAlias this_ptr_conv;
71015         this_ptr_conv.inner = untag_ptr(this_ptr);
71016         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71017         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71018         this_ptr_conv.is_owned = false;
71019         LDKThirtyTwoBytes val_ref;
71020         CHECK(val->arr_len == 32);
71021         memcpy(val_ref.data, val->elems, 32); FREE(val);
71022         NodeAlias_set_a(&this_ptr_conv, val_ref);
71023 }
71024
71025 int64_t  CS_LDK_NodeAlias_new(int8_tArray a_arg) {
71026         LDKThirtyTwoBytes a_arg_ref;
71027         CHECK(a_arg->arr_len == 32);
71028         memcpy(a_arg_ref.data, a_arg->elems, 32); FREE(a_arg);
71029         LDKNodeAlias ret_var = NodeAlias_new(a_arg_ref);
71030         int64_t ret_ref = 0;
71031         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71032         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71033         return ret_ref;
71034 }
71035
71036 static inline uint64_t NodeAlias_clone_ptr(LDKNodeAlias *NONNULL_PTR arg) {
71037         LDKNodeAlias ret_var = NodeAlias_clone(arg);
71038         int64_t ret_ref = 0;
71039         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71040         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71041         return ret_ref;
71042 }
71043 int64_t  CS_LDK_NodeAlias_clone_ptr(int64_t arg) {
71044         LDKNodeAlias arg_conv;
71045         arg_conv.inner = untag_ptr(arg);
71046         arg_conv.is_owned = ptr_is_owned(arg);
71047         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
71048         arg_conv.is_owned = false;
71049         int64_t ret_conv = NodeAlias_clone_ptr(&arg_conv);
71050         return ret_conv;
71051 }
71052
71053 int64_t  CS_LDK_NodeAlias_clone(int64_t orig) {
71054         LDKNodeAlias orig_conv;
71055         orig_conv.inner = untag_ptr(orig);
71056         orig_conv.is_owned = ptr_is_owned(orig);
71057         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
71058         orig_conv.is_owned = false;
71059         LDKNodeAlias ret_var = NodeAlias_clone(&orig_conv);
71060         int64_t ret_ref = 0;
71061         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71062         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71063         return ret_ref;
71064 }
71065
71066 int64_t  CS_LDK_NodeAlias_hash(int64_t o) {
71067         LDKNodeAlias o_conv;
71068         o_conv.inner = untag_ptr(o);
71069         o_conv.is_owned = ptr_is_owned(o);
71070         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
71071         o_conv.is_owned = false;
71072         int64_t ret_conv = NodeAlias_hash(&o_conv);
71073         return ret_conv;
71074 }
71075
71076 jboolean  CS_LDK_NodeAlias_eq(int64_t a, int64_t b) {
71077         LDKNodeAlias a_conv;
71078         a_conv.inner = untag_ptr(a);
71079         a_conv.is_owned = ptr_is_owned(a);
71080         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
71081         a_conv.is_owned = false;
71082         LDKNodeAlias b_conv;
71083         b_conv.inner = untag_ptr(b);
71084         b_conv.is_owned = ptr_is_owned(b);
71085         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
71086         b_conv.is_owned = false;
71087         jboolean ret_conv = NodeAlias_eq(&a_conv, &b_conv);
71088         return ret_conv;
71089 }
71090
71091 jstring  CS_LDK_NodeAlias_to_str(int64_t o) {
71092         LDKNodeAlias o_conv;
71093         o_conv.inner = untag_ptr(o);
71094         o_conv.is_owned = ptr_is_owned(o);
71095         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
71096         o_conv.is_owned = false;
71097         LDKStr ret_str = NodeAlias_to_str(&o_conv);
71098         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
71099         Str_free(ret_str);
71100         return ret_conv;
71101 }
71102
71103 int8_tArray  CS_LDK_NodeAlias_write(int64_t obj) {
71104         LDKNodeAlias obj_conv;
71105         obj_conv.inner = untag_ptr(obj);
71106         obj_conv.is_owned = ptr_is_owned(obj);
71107         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
71108         obj_conv.is_owned = false;
71109         LDKCVec_u8Z ret_var = NodeAlias_write(&obj_conv);
71110         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
71111         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
71112         CVec_u8Z_free(ret_var);
71113         return ret_arr;
71114 }
71115
71116 int64_t  CS_LDK_NodeAlias_read(int8_tArray ser) {
71117         LDKu8slice ser_ref;
71118         ser_ref.datalen = ser->arr_len;
71119         ser_ref.data = ser->elems;
71120         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
71121         *ret_conv = NodeAlias_read(ser_ref);
71122         FREE(ser);
71123         return tag_ptr(ret_conv, true);
71124 }
71125
71126 void  CS_LDK_NodeInfo_free(int64_t this_obj) {
71127         LDKNodeInfo this_obj_conv;
71128         this_obj_conv.inner = untag_ptr(this_obj);
71129         this_obj_conv.is_owned = ptr_is_owned(this_obj);
71130         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
71131         NodeInfo_free(this_obj_conv);
71132 }
71133
71134 int64_tArray  CS_LDK_NodeInfo_get_channels(int64_t this_ptr) {
71135         LDKNodeInfo this_ptr_conv;
71136         this_ptr_conv.inner = untag_ptr(this_ptr);
71137         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71138         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71139         this_ptr_conv.is_owned = false;
71140         LDKCVec_u64Z ret_var = NodeInfo_get_channels(&this_ptr_conv);
71141         int64_tArray ret_arr = NULL;
71142         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
71143         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
71144         for (size_t g = 0; g < ret_var.datalen; g++) {
71145                 int64_t ret_conv_6_conv = ret_var.data[g];
71146                 ret_arr_ptr[g] = ret_conv_6_conv;
71147         }
71148         
71149         FREE(ret_var.data);
71150         return ret_arr;
71151 }
71152
71153 void  CS_LDK_NodeInfo_set_channels(int64_t this_ptr, int64_tArray val) {
71154         LDKNodeInfo this_ptr_conv;
71155         this_ptr_conv.inner = untag_ptr(this_ptr);
71156         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71157         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71158         this_ptr_conv.is_owned = false;
71159         LDKCVec_u64Z val_constr;
71160         val_constr.datalen = val->arr_len;
71161         if (val_constr.datalen > 0)
71162                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
71163         else
71164                 val_constr.data = NULL;
71165         int64_t* val_vals = val->elems;
71166         for (size_t g = 0; g < val_constr.datalen; g++) {
71167                 int64_t val_conv_6 = val_vals[g];
71168                 val_constr.data[g] = val_conv_6;
71169         }
71170         FREE(val);
71171         NodeInfo_set_channels(&this_ptr_conv, val_constr);
71172 }
71173
71174 int64_t  CS_LDK_NodeInfo_get_announcement_info(int64_t this_ptr) {
71175         LDKNodeInfo this_ptr_conv;
71176         this_ptr_conv.inner = untag_ptr(this_ptr);
71177         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71178         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71179         this_ptr_conv.is_owned = false;
71180         LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
71181         int64_t ret_ref = 0;
71182         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71183         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71184         return ret_ref;
71185 }
71186
71187 void  CS_LDK_NodeInfo_set_announcement_info(int64_t this_ptr, int64_t val) {
71188         LDKNodeInfo this_ptr_conv;
71189         this_ptr_conv.inner = untag_ptr(this_ptr);
71190         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71191         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71192         this_ptr_conv.is_owned = false;
71193         LDKNodeAnnouncementInfo val_conv;
71194         val_conv.inner = untag_ptr(val);
71195         val_conv.is_owned = ptr_is_owned(val);
71196         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
71197         val_conv = NodeAnnouncementInfo_clone(&val_conv);
71198         NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
71199 }
71200
71201 int64_t  CS_LDK_NodeInfo_new(int64_tArray channels_arg, int64_t announcement_info_arg) {
71202         LDKCVec_u64Z channels_arg_constr;
71203         channels_arg_constr.datalen = channels_arg->arr_len;
71204         if (channels_arg_constr.datalen > 0)
71205                 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
71206         else
71207                 channels_arg_constr.data = NULL;
71208         int64_t* channels_arg_vals = channels_arg->elems;
71209         for (size_t g = 0; g < channels_arg_constr.datalen; g++) {
71210                 int64_t channels_arg_conv_6 = channels_arg_vals[g];
71211                 channels_arg_constr.data[g] = channels_arg_conv_6;
71212         }
71213         FREE(channels_arg);
71214         LDKNodeAnnouncementInfo announcement_info_arg_conv;
71215         announcement_info_arg_conv.inner = untag_ptr(announcement_info_arg);
71216         announcement_info_arg_conv.is_owned = ptr_is_owned(announcement_info_arg);
71217         CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_info_arg_conv);
71218         announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv);
71219         LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, announcement_info_arg_conv);
71220         int64_t ret_ref = 0;
71221         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71222         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71223         return ret_ref;
71224 }
71225
71226 static inline uint64_t NodeInfo_clone_ptr(LDKNodeInfo *NONNULL_PTR arg) {
71227         LDKNodeInfo ret_var = NodeInfo_clone(arg);
71228         int64_t ret_ref = 0;
71229         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71230         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71231         return ret_ref;
71232 }
71233 int64_t  CS_LDK_NodeInfo_clone_ptr(int64_t arg) {
71234         LDKNodeInfo arg_conv;
71235         arg_conv.inner = untag_ptr(arg);
71236         arg_conv.is_owned = ptr_is_owned(arg);
71237         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
71238         arg_conv.is_owned = false;
71239         int64_t ret_conv = NodeInfo_clone_ptr(&arg_conv);
71240         return ret_conv;
71241 }
71242
71243 int64_t  CS_LDK_NodeInfo_clone(int64_t orig) {
71244         LDKNodeInfo orig_conv;
71245         orig_conv.inner = untag_ptr(orig);
71246         orig_conv.is_owned = ptr_is_owned(orig);
71247         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
71248         orig_conv.is_owned = false;
71249         LDKNodeInfo ret_var = NodeInfo_clone(&orig_conv);
71250         int64_t ret_ref = 0;
71251         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71252         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71253         return ret_ref;
71254 }
71255
71256 jboolean  CS_LDK_NodeInfo_eq(int64_t a, int64_t b) {
71257         LDKNodeInfo a_conv;
71258         a_conv.inner = untag_ptr(a);
71259         a_conv.is_owned = ptr_is_owned(a);
71260         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
71261         a_conv.is_owned = false;
71262         LDKNodeInfo b_conv;
71263         b_conv.inner = untag_ptr(b);
71264         b_conv.is_owned = ptr_is_owned(b);
71265         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
71266         b_conv.is_owned = false;
71267         jboolean ret_conv = NodeInfo_eq(&a_conv, &b_conv);
71268         return ret_conv;
71269 }
71270
71271 jboolean  CS_LDK_NodeInfo_is_tor_only(int64_t this_arg) {
71272         LDKNodeInfo this_arg_conv;
71273         this_arg_conv.inner = untag_ptr(this_arg);
71274         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71275         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71276         this_arg_conv.is_owned = false;
71277         jboolean ret_conv = NodeInfo_is_tor_only(&this_arg_conv);
71278         return ret_conv;
71279 }
71280
71281 jstring  CS_LDK_NodeInfo_to_str(int64_t o) {
71282         LDKNodeInfo o_conv;
71283         o_conv.inner = untag_ptr(o);
71284         o_conv.is_owned = ptr_is_owned(o);
71285         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
71286         o_conv.is_owned = false;
71287         LDKStr ret_str = NodeInfo_to_str(&o_conv);
71288         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
71289         Str_free(ret_str);
71290         return ret_conv;
71291 }
71292
71293 int8_tArray  CS_LDK_NodeInfo_write(int64_t obj) {
71294         LDKNodeInfo obj_conv;
71295         obj_conv.inner = untag_ptr(obj);
71296         obj_conv.is_owned = ptr_is_owned(obj);
71297         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
71298         obj_conv.is_owned = false;
71299         LDKCVec_u8Z ret_var = NodeInfo_write(&obj_conv);
71300         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
71301         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
71302         CVec_u8Z_free(ret_var);
71303         return ret_arr;
71304 }
71305
71306 int64_t  CS_LDK_NodeInfo_read(int8_tArray ser) {
71307         LDKu8slice ser_ref;
71308         ser_ref.datalen = ser->arr_len;
71309         ser_ref.data = ser->elems;
71310         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
71311         *ret_conv = NodeInfo_read(ser_ref);
71312         FREE(ser);
71313         return tag_ptr(ret_conv, true);
71314 }
71315
71316 int8_tArray  CS_LDK_NetworkGraph_write(int64_t obj) {
71317         LDKNetworkGraph obj_conv;
71318         obj_conv.inner = untag_ptr(obj);
71319         obj_conv.is_owned = ptr_is_owned(obj);
71320         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
71321         obj_conv.is_owned = false;
71322         LDKCVec_u8Z ret_var = NetworkGraph_write(&obj_conv);
71323         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
71324         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
71325         CVec_u8Z_free(ret_var);
71326         return ret_arr;
71327 }
71328
71329 int64_t  CS_LDK_NetworkGraph_read(int8_tArray ser, int64_t arg) {
71330         LDKu8slice ser_ref;
71331         ser_ref.datalen = ser->arr_len;
71332         ser_ref.data = ser->elems;
71333         void* arg_ptr = untag_ptr(arg);
71334         CHECK_ACCESS(arg_ptr);
71335         LDKLogger arg_conv = *(LDKLogger*)(arg_ptr);
71336         if (arg_conv.free == LDKLogger_JCalls_free) {
71337                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
71338                 LDKLogger_JCalls_cloned(&arg_conv);
71339         }
71340         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
71341         *ret_conv = NetworkGraph_read(ser_ref, arg_conv);
71342         FREE(ser);
71343         return tag_ptr(ret_conv, true);
71344 }
71345
71346 jstring  CS_LDK_NetworkGraph_to_str(int64_t o) {
71347         LDKNetworkGraph o_conv;
71348         o_conv.inner = untag_ptr(o);
71349         o_conv.is_owned = ptr_is_owned(o);
71350         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
71351         o_conv.is_owned = false;
71352         LDKStr ret_str = NetworkGraph_to_str(&o_conv);
71353         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
71354         Str_free(ret_str);
71355         return ret_conv;
71356 }
71357
71358 int64_t  CS_LDK_NetworkGraph_new(int32_t network, int64_t logger) {
71359         LDKNetwork network_conv = LDKNetwork_from_cs(network);
71360         void* logger_ptr = untag_ptr(logger);
71361         CHECK_ACCESS(logger_ptr);
71362         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
71363         if (logger_conv.free == LDKLogger_JCalls_free) {
71364                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
71365                 LDKLogger_JCalls_cloned(&logger_conv);
71366         }
71367         LDKNetworkGraph ret_var = NetworkGraph_new(network_conv, logger_conv);
71368         int64_t ret_ref = 0;
71369         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71370         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71371         return ret_ref;
71372 }
71373
71374 int64_t  CS_LDK_NetworkGraph_read_only(int64_t this_arg) {
71375         LDKNetworkGraph this_arg_conv;
71376         this_arg_conv.inner = untag_ptr(this_arg);
71377         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71378         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71379         this_arg_conv.is_owned = false;
71380         LDKReadOnlyNetworkGraph ret_var = NetworkGraph_read_only(&this_arg_conv);
71381         int64_t ret_ref = 0;
71382         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71383         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71384         return ret_ref;
71385 }
71386
71387 int64_t  CS_LDK_NetworkGraph_get_last_rapid_gossip_sync_timestamp(int64_t this_arg) {
71388         LDKNetworkGraph this_arg_conv;
71389         this_arg_conv.inner = untag_ptr(this_arg);
71390         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71391         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71392         this_arg_conv.is_owned = false;
71393         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
71394         *ret_copy = NetworkGraph_get_last_rapid_gossip_sync_timestamp(&this_arg_conv);
71395         int64_t ret_ref = tag_ptr(ret_copy, true);
71396         return ret_ref;
71397 }
71398
71399 void  CS_LDK_NetworkGraph_set_last_rapid_gossip_sync_timestamp(int64_t this_arg, int32_t last_rapid_gossip_sync_timestamp) {
71400         LDKNetworkGraph this_arg_conv;
71401         this_arg_conv.inner = untag_ptr(this_arg);
71402         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71403         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71404         this_arg_conv.is_owned = false;
71405         NetworkGraph_set_last_rapid_gossip_sync_timestamp(&this_arg_conv, last_rapid_gossip_sync_timestamp);
71406 }
71407
71408 int64_t  CS_LDK_NetworkGraph_update_node_from_announcement(int64_t this_arg, int64_t msg) {
71409         LDKNetworkGraph this_arg_conv;
71410         this_arg_conv.inner = untag_ptr(this_arg);
71411         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71412         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71413         this_arg_conv.is_owned = false;
71414         LDKNodeAnnouncement msg_conv;
71415         msg_conv.inner = untag_ptr(msg);
71416         msg_conv.is_owned = ptr_is_owned(msg);
71417         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
71418         msg_conv.is_owned = false;
71419         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
71420         *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv);
71421         return tag_ptr(ret_conv, true);
71422 }
71423
71424 int64_t  CS_LDK_NetworkGraph_update_node_from_unsigned_announcement(int64_t this_arg, int64_t msg) {
71425         LDKNetworkGraph this_arg_conv;
71426         this_arg_conv.inner = untag_ptr(this_arg);
71427         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71428         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71429         this_arg_conv.is_owned = false;
71430         LDKUnsignedNodeAnnouncement msg_conv;
71431         msg_conv.inner = untag_ptr(msg);
71432         msg_conv.is_owned = ptr_is_owned(msg);
71433         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
71434         msg_conv.is_owned = false;
71435         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
71436         *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
71437         return tag_ptr(ret_conv, true);
71438 }
71439
71440 int64_t  CS_LDK_NetworkGraph_update_channel_from_announcement(int64_t this_arg, int64_t msg, int64_t utxo_lookup) {
71441         LDKNetworkGraph this_arg_conv;
71442         this_arg_conv.inner = untag_ptr(this_arg);
71443         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71444         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71445         this_arg_conv.is_owned = false;
71446         LDKChannelAnnouncement msg_conv;
71447         msg_conv.inner = untag_ptr(msg);
71448         msg_conv.is_owned = ptr_is_owned(msg);
71449         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
71450         msg_conv.is_owned = false;
71451         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
71452         CHECK_ACCESS(utxo_lookup_ptr);
71453         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
71454         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
71455         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
71456                 // Manually implement clone for Java trait instances
71457                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
71458                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
71459                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
71460                 }
71461         }
71462         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
71463         *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, utxo_lookup_conv);
71464         return tag_ptr(ret_conv, true);
71465 }
71466
71467 int64_t  CS_LDK_NetworkGraph_update_channel_from_announcement_no_lookup(int64_t this_arg, int64_t msg) {
71468         LDKNetworkGraph this_arg_conv;
71469         this_arg_conv.inner = untag_ptr(this_arg);
71470         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71471         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71472         this_arg_conv.is_owned = false;
71473         LDKChannelAnnouncement msg_conv;
71474         msg_conv.inner = untag_ptr(msg);
71475         msg_conv.is_owned = ptr_is_owned(msg);
71476         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
71477         msg_conv.is_owned = false;
71478         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
71479         *ret_conv = NetworkGraph_update_channel_from_announcement_no_lookup(&this_arg_conv, &msg_conv);
71480         return tag_ptr(ret_conv, true);
71481 }
71482
71483 int64_t  CS_LDK_NetworkGraph_update_channel_from_unsigned_announcement(int64_t this_arg, int64_t msg, int64_t utxo_lookup) {
71484         LDKNetworkGraph this_arg_conv;
71485         this_arg_conv.inner = untag_ptr(this_arg);
71486         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71487         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71488         this_arg_conv.is_owned = false;
71489         LDKUnsignedChannelAnnouncement msg_conv;
71490         msg_conv.inner = untag_ptr(msg);
71491         msg_conv.is_owned = ptr_is_owned(msg);
71492         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
71493         msg_conv.is_owned = false;
71494         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
71495         CHECK_ACCESS(utxo_lookup_ptr);
71496         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
71497         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
71498         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
71499                 // Manually implement clone for Java trait instances
71500                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
71501                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
71502                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
71503                 }
71504         }
71505         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
71506         *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, utxo_lookup_conv);
71507         return tag_ptr(ret_conv, true);
71508 }
71509
71510 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) {
71511         LDKNetworkGraph this_arg_conv;
71512         this_arg_conv.inner = untag_ptr(this_arg);
71513         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71514         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71515         this_arg_conv.is_owned = false;
71516         LDKChannelFeatures features_conv;
71517         features_conv.inner = untag_ptr(features);
71518         features_conv.is_owned = ptr_is_owned(features);
71519         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
71520         features_conv = ChannelFeatures_clone(&features_conv);
71521         LDKPublicKey node_id_1_ref;
71522         CHECK(node_id_1->arr_len == 33);
71523         memcpy(node_id_1_ref.compressed_form, node_id_1->elems, 33); FREE(node_id_1);
71524         LDKPublicKey node_id_2_ref;
71525         CHECK(node_id_2->arr_len == 33);
71526         memcpy(node_id_2_ref.compressed_form, node_id_2->elems, 33); FREE(node_id_2);
71527         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
71528         *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);
71529         return tag_ptr(ret_conv, true);
71530 }
71531
71532 void  CS_LDK_NetworkGraph_channel_failed_permanent(int64_t this_arg, int64_t short_channel_id) {
71533         LDKNetworkGraph this_arg_conv;
71534         this_arg_conv.inner = untag_ptr(this_arg);
71535         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71536         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71537         this_arg_conv.is_owned = false;
71538         NetworkGraph_channel_failed_permanent(&this_arg_conv, short_channel_id);
71539 }
71540
71541 void  CS_LDK_NetworkGraph_node_failed_permanent(int64_t this_arg, int8_tArray node_id) {
71542         LDKNetworkGraph this_arg_conv;
71543         this_arg_conv.inner = untag_ptr(this_arg);
71544         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71545         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71546         this_arg_conv.is_owned = false;
71547         LDKPublicKey node_id_ref;
71548         CHECK(node_id->arr_len == 33);
71549         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
71550         NetworkGraph_node_failed_permanent(&this_arg_conv, node_id_ref);
71551 }
71552
71553 void  CS_LDK_NetworkGraph_remove_stale_channels_and_tracking(int64_t this_arg) {
71554         LDKNetworkGraph this_arg_conv;
71555         this_arg_conv.inner = untag_ptr(this_arg);
71556         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71557         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71558         this_arg_conv.is_owned = false;
71559         NetworkGraph_remove_stale_channels_and_tracking(&this_arg_conv);
71560 }
71561
71562 void  CS_LDK_NetworkGraph_remove_stale_channels_and_tracking_with_time(int64_t this_arg, int64_t current_time_unix) {
71563         LDKNetworkGraph this_arg_conv;
71564         this_arg_conv.inner = untag_ptr(this_arg);
71565         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71566         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71567         this_arg_conv.is_owned = false;
71568         NetworkGraph_remove_stale_channels_and_tracking_with_time(&this_arg_conv, current_time_unix);
71569 }
71570
71571 int64_t  CS_LDK_NetworkGraph_update_channel(int64_t this_arg, int64_t msg) {
71572         LDKNetworkGraph this_arg_conv;
71573         this_arg_conv.inner = untag_ptr(this_arg);
71574         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71575         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71576         this_arg_conv.is_owned = false;
71577         LDKChannelUpdate msg_conv;
71578         msg_conv.inner = untag_ptr(msg);
71579         msg_conv.is_owned = ptr_is_owned(msg);
71580         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
71581         msg_conv.is_owned = false;
71582         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
71583         *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
71584         return tag_ptr(ret_conv, true);
71585 }
71586
71587 int64_t  CS_LDK_NetworkGraph_update_channel_unsigned(int64_t this_arg, int64_t msg) {
71588         LDKNetworkGraph this_arg_conv;
71589         this_arg_conv.inner = untag_ptr(this_arg);
71590         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71591         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71592         this_arg_conv.is_owned = false;
71593         LDKUnsignedChannelUpdate msg_conv;
71594         msg_conv.inner = untag_ptr(msg);
71595         msg_conv.is_owned = ptr_is_owned(msg);
71596         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
71597         msg_conv.is_owned = false;
71598         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
71599         *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
71600         return tag_ptr(ret_conv, true);
71601 }
71602
71603 int64_t  CS_LDK_NetworkGraph_verify_channel_update(int64_t this_arg, int64_t msg) {
71604         LDKNetworkGraph this_arg_conv;
71605         this_arg_conv.inner = untag_ptr(this_arg);
71606         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71607         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71608         this_arg_conv.is_owned = false;
71609         LDKChannelUpdate msg_conv;
71610         msg_conv.inner = untag_ptr(msg);
71611         msg_conv.is_owned = ptr_is_owned(msg);
71612         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
71613         msg_conv.is_owned = false;
71614         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
71615         *ret_conv = NetworkGraph_verify_channel_update(&this_arg_conv, &msg_conv);
71616         return tag_ptr(ret_conv, true);
71617 }
71618
71619 int64_t  CS_LDK_ReadOnlyNetworkGraph_channel(int64_t this_arg, int64_t short_channel_id) {
71620         LDKReadOnlyNetworkGraph this_arg_conv;
71621         this_arg_conv.inner = untag_ptr(this_arg);
71622         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71623         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71624         this_arg_conv.is_owned = false;
71625         LDKChannelInfo ret_var = ReadOnlyNetworkGraph_channel(&this_arg_conv, short_channel_id);
71626         int64_t ret_ref = 0;
71627         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71628         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71629         return ret_ref;
71630 }
71631
71632 int64_tArray  CS_LDK_ReadOnlyNetworkGraph_list_channels(int64_t this_arg) {
71633         LDKReadOnlyNetworkGraph this_arg_conv;
71634         this_arg_conv.inner = untag_ptr(this_arg);
71635         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71636         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71637         this_arg_conv.is_owned = false;
71638         LDKCVec_u64Z ret_var = ReadOnlyNetworkGraph_list_channels(&this_arg_conv);
71639         int64_tArray ret_arr = NULL;
71640         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
71641         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
71642         for (size_t g = 0; g < ret_var.datalen; g++) {
71643                 int64_t ret_conv_6_conv = ret_var.data[g];
71644                 ret_arr_ptr[g] = ret_conv_6_conv;
71645         }
71646         
71647         FREE(ret_var.data);
71648         return ret_arr;
71649 }
71650
71651 int64_t  CS_LDK_ReadOnlyNetworkGraph_node(int64_t this_arg, int64_t node_id) {
71652         LDKReadOnlyNetworkGraph this_arg_conv;
71653         this_arg_conv.inner = untag_ptr(this_arg);
71654         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71655         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71656         this_arg_conv.is_owned = false;
71657         LDKNodeId node_id_conv;
71658         node_id_conv.inner = untag_ptr(node_id);
71659         node_id_conv.is_owned = ptr_is_owned(node_id);
71660         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
71661         node_id_conv.is_owned = false;
71662         LDKNodeInfo ret_var = ReadOnlyNetworkGraph_node(&this_arg_conv, &node_id_conv);
71663         int64_t ret_ref = 0;
71664         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71665         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71666         return ret_ref;
71667 }
71668
71669 int64_tArray  CS_LDK_ReadOnlyNetworkGraph_list_nodes(int64_t this_arg) {
71670         LDKReadOnlyNetworkGraph this_arg_conv;
71671         this_arg_conv.inner = untag_ptr(this_arg);
71672         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71673         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71674         this_arg_conv.is_owned = false;
71675         LDKCVec_NodeIdZ ret_var = ReadOnlyNetworkGraph_list_nodes(&this_arg_conv);
71676         int64_tArray ret_arr = NULL;
71677         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
71678         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
71679         for (size_t i = 0; i < ret_var.datalen; i++) {
71680                 LDKNodeId ret_conv_8_var = ret_var.data[i];
71681                 int64_t ret_conv_8_ref = 0;
71682                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_8_var);
71683                 ret_conv_8_ref = tag_ptr(ret_conv_8_var.inner, ret_conv_8_var.is_owned);
71684                 ret_arr_ptr[i] = ret_conv_8_ref;
71685         }
71686         
71687         FREE(ret_var.data);
71688         return ret_arr;
71689 }
71690
71691 int64_t  CS_LDK_ReadOnlyNetworkGraph_get_addresses(int64_t this_arg, int8_tArray pubkey) {
71692         LDKReadOnlyNetworkGraph this_arg_conv;
71693         this_arg_conv.inner = untag_ptr(this_arg);
71694         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71695         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71696         this_arg_conv.is_owned = false;
71697         LDKPublicKey pubkey_ref;
71698         CHECK(pubkey->arr_len == 33);
71699         memcpy(pubkey_ref.compressed_form, pubkey->elems, 33); FREE(pubkey);
71700         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
71701         *ret_copy = ReadOnlyNetworkGraph_get_addresses(&this_arg_conv, pubkey_ref);
71702         int64_t ret_ref = tag_ptr(ret_copy, true);
71703         return ret_ref;
71704 }
71705
71706 void  CS_LDK_DefaultRouter_free(int64_t this_obj) {
71707         LDKDefaultRouter this_obj_conv;
71708         this_obj_conv.inner = untag_ptr(this_obj);
71709         this_obj_conv.is_owned = ptr_is_owned(this_obj);
71710         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
71711         DefaultRouter_free(this_obj_conv);
71712 }
71713
71714 int64_t  CS_LDK_DefaultRouter_new(int64_t network_graph, int64_t logger, int64_t entropy_source, int64_t scorer, int64_t score_params) {
71715         LDKNetworkGraph network_graph_conv;
71716         network_graph_conv.inner = untag_ptr(network_graph);
71717         network_graph_conv.is_owned = ptr_is_owned(network_graph);
71718         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
71719         network_graph_conv.is_owned = false;
71720         void* logger_ptr = untag_ptr(logger);
71721         CHECK_ACCESS(logger_ptr);
71722         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
71723         if (logger_conv.free == LDKLogger_JCalls_free) {
71724                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
71725                 LDKLogger_JCalls_cloned(&logger_conv);
71726         }
71727         void* entropy_source_ptr = untag_ptr(entropy_source);
71728         CHECK_ACCESS(entropy_source_ptr);
71729         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
71730         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
71731                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
71732                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
71733         }
71734         void* scorer_ptr = untag_ptr(scorer);
71735         CHECK_ACCESS(scorer_ptr);
71736         LDKLockableScore scorer_conv = *(LDKLockableScore*)(scorer_ptr);
71737         if (scorer_conv.free == LDKLockableScore_JCalls_free) {
71738                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
71739                 LDKLockableScore_JCalls_cloned(&scorer_conv);
71740         }
71741         LDKProbabilisticScoringFeeParameters score_params_conv;
71742         score_params_conv.inner = untag_ptr(score_params);
71743         score_params_conv.is_owned = ptr_is_owned(score_params);
71744         CHECK_INNER_FIELD_ACCESS_OR_NULL(score_params_conv);
71745         score_params_conv = ProbabilisticScoringFeeParameters_clone(&score_params_conv);
71746         LDKDefaultRouter ret_var = DefaultRouter_new(&network_graph_conv, logger_conv, entropy_source_conv, scorer_conv, score_params_conv);
71747         int64_t ret_ref = 0;
71748         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71749         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71750         return ret_ref;
71751 }
71752
71753 int64_t  CS_LDK_DefaultRouter_as_Router(int64_t this_arg) {
71754         LDKDefaultRouter this_arg_conv;
71755         this_arg_conv.inner = untag_ptr(this_arg);
71756         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71757         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71758         this_arg_conv.is_owned = false;
71759         LDKRouter* ret_ret = MALLOC(sizeof(LDKRouter), "LDKRouter");
71760         *ret_ret = DefaultRouter_as_Router(&this_arg_conv);
71761         return tag_ptr(ret_ret, true);
71762 }
71763
71764 int64_t  CS_LDK_DefaultRouter_as_MessageRouter(int64_t this_arg) {
71765         LDKDefaultRouter this_arg_conv;
71766         this_arg_conv.inner = untag_ptr(this_arg);
71767         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71768         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71769         this_arg_conv.is_owned = false;
71770         LDKMessageRouter* ret_ret = MALLOC(sizeof(LDKMessageRouter), "LDKMessageRouter");
71771         *ret_ret = DefaultRouter_as_MessageRouter(&this_arg_conv);
71772         return tag_ptr(ret_ret, true);
71773 }
71774
71775 void  CS_LDK_Router_free(int64_t this_ptr) {
71776         if (!ptr_is_owned(this_ptr)) return;
71777         void* this_ptr_ptr = untag_ptr(this_ptr);
71778         CHECK_ACCESS(this_ptr_ptr);
71779         LDKRouter this_ptr_conv = *(LDKRouter*)(this_ptr_ptr);
71780         FREE(untag_ptr(this_ptr));
71781         Router_free(this_ptr_conv);
71782 }
71783
71784 void  CS_LDK_ScorerAccountingForInFlightHtlcs_free(int64_t this_obj) {
71785         LDKScorerAccountingForInFlightHtlcs this_obj_conv;
71786         this_obj_conv.inner = untag_ptr(this_obj);
71787         this_obj_conv.is_owned = ptr_is_owned(this_obj);
71788         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
71789         ScorerAccountingForInFlightHtlcs_free(this_obj_conv);
71790 }
71791
71792 int64_t  CS_LDK_ScorerAccountingForInFlightHtlcs_new(int64_t scorer, int64_t inflight_htlcs) {
71793         void* scorer_ptr = untag_ptr(scorer);
71794         CHECK_ACCESS(scorer_ptr);
71795         LDKScoreLookUp scorer_conv = *(LDKScoreLookUp*)(scorer_ptr);
71796         if (scorer_conv.free == LDKScoreLookUp_JCalls_free) {
71797                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
71798                 LDKScoreLookUp_JCalls_cloned(&scorer_conv);
71799         }
71800         LDKInFlightHtlcs inflight_htlcs_conv;
71801         inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs);
71802         inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs);
71803         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv);
71804         inflight_htlcs_conv.is_owned = false;
71805         LDKScorerAccountingForInFlightHtlcs ret_var = ScorerAccountingForInFlightHtlcs_new(scorer_conv, &inflight_htlcs_conv);
71806         int64_t ret_ref = 0;
71807         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71808         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71809         return ret_ref;
71810 }
71811
71812 int64_t  CS_LDK_ScorerAccountingForInFlightHtlcs_as_ScoreLookUp(int64_t this_arg) {
71813         LDKScorerAccountingForInFlightHtlcs this_arg_conv;
71814         this_arg_conv.inner = untag_ptr(this_arg);
71815         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71816         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71817         this_arg_conv.is_owned = false;
71818         LDKScoreLookUp* ret_ret = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
71819         *ret_ret = ScorerAccountingForInFlightHtlcs_as_ScoreLookUp(&this_arg_conv);
71820         return tag_ptr(ret_ret, true);
71821 }
71822
71823 void  CS_LDK_InFlightHtlcs_free(int64_t this_obj) {
71824         LDKInFlightHtlcs this_obj_conv;
71825         this_obj_conv.inner = untag_ptr(this_obj);
71826         this_obj_conv.is_owned = ptr_is_owned(this_obj);
71827         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
71828         InFlightHtlcs_free(this_obj_conv);
71829 }
71830
71831 static inline uint64_t InFlightHtlcs_clone_ptr(LDKInFlightHtlcs *NONNULL_PTR arg) {
71832         LDKInFlightHtlcs ret_var = InFlightHtlcs_clone(arg);
71833         int64_t ret_ref = 0;
71834         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71835         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71836         return ret_ref;
71837 }
71838 int64_t  CS_LDK_InFlightHtlcs_clone_ptr(int64_t arg) {
71839         LDKInFlightHtlcs arg_conv;
71840         arg_conv.inner = untag_ptr(arg);
71841         arg_conv.is_owned = ptr_is_owned(arg);
71842         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
71843         arg_conv.is_owned = false;
71844         int64_t ret_conv = InFlightHtlcs_clone_ptr(&arg_conv);
71845         return ret_conv;
71846 }
71847
71848 int64_t  CS_LDK_InFlightHtlcs_clone(int64_t orig) {
71849         LDKInFlightHtlcs orig_conv;
71850         orig_conv.inner = untag_ptr(orig);
71851         orig_conv.is_owned = ptr_is_owned(orig);
71852         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
71853         orig_conv.is_owned = false;
71854         LDKInFlightHtlcs ret_var = InFlightHtlcs_clone(&orig_conv);
71855         int64_t ret_ref = 0;
71856         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71857         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71858         return ret_ref;
71859 }
71860
71861 int64_t  CS_LDK_InFlightHtlcs_new() {
71862         LDKInFlightHtlcs ret_var = InFlightHtlcs_new();
71863         int64_t ret_ref = 0;
71864         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71865         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71866         return ret_ref;
71867 }
71868
71869 void  CS_LDK_InFlightHtlcs_process_path(int64_t this_arg, int64_t path, int8_tArray payer_node_id) {
71870         LDKInFlightHtlcs this_arg_conv;
71871         this_arg_conv.inner = untag_ptr(this_arg);
71872         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71873         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71874         this_arg_conv.is_owned = false;
71875         LDKPath path_conv;
71876         path_conv.inner = untag_ptr(path);
71877         path_conv.is_owned = ptr_is_owned(path);
71878         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
71879         path_conv.is_owned = false;
71880         LDKPublicKey payer_node_id_ref;
71881         CHECK(payer_node_id->arr_len == 33);
71882         memcpy(payer_node_id_ref.compressed_form, payer_node_id->elems, 33); FREE(payer_node_id);
71883         InFlightHtlcs_process_path(&this_arg_conv, &path_conv, payer_node_id_ref);
71884 }
71885
71886 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) {
71887         LDKInFlightHtlcs this_arg_conv;
71888         this_arg_conv.inner = untag_ptr(this_arg);
71889         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71890         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71891         this_arg_conv.is_owned = false;
71892         LDKNodeId source_conv;
71893         source_conv.inner = untag_ptr(source);
71894         source_conv.is_owned = ptr_is_owned(source);
71895         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
71896         source_conv.is_owned = false;
71897         LDKNodeId target_conv;
71898         target_conv.inner = untag_ptr(target);
71899         target_conv.is_owned = ptr_is_owned(target);
71900         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
71901         target_conv.is_owned = false;
71902         InFlightHtlcs_add_inflight_htlc(&this_arg_conv, &source_conv, &target_conv, channel_scid, used_msat);
71903 }
71904
71905 int64_t  CS_LDK_InFlightHtlcs_used_liquidity_msat(int64_t this_arg, int64_t source, int64_t target, int64_t channel_scid) {
71906         LDKInFlightHtlcs this_arg_conv;
71907         this_arg_conv.inner = untag_ptr(this_arg);
71908         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71909         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71910         this_arg_conv.is_owned = false;
71911         LDKNodeId source_conv;
71912         source_conv.inner = untag_ptr(source);
71913         source_conv.is_owned = ptr_is_owned(source);
71914         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
71915         source_conv.is_owned = false;
71916         LDKNodeId target_conv;
71917         target_conv.inner = untag_ptr(target);
71918         target_conv.is_owned = ptr_is_owned(target);
71919         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
71920         target_conv.is_owned = false;
71921         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
71922         *ret_copy = InFlightHtlcs_used_liquidity_msat(&this_arg_conv, &source_conv, &target_conv, channel_scid);
71923         int64_t ret_ref = tag_ptr(ret_copy, true);
71924         return ret_ref;
71925 }
71926
71927 int8_tArray  CS_LDK_InFlightHtlcs_write(int64_t obj) {
71928         LDKInFlightHtlcs obj_conv;
71929         obj_conv.inner = untag_ptr(obj);
71930         obj_conv.is_owned = ptr_is_owned(obj);
71931         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
71932         obj_conv.is_owned = false;
71933         LDKCVec_u8Z ret_var = InFlightHtlcs_write(&obj_conv);
71934         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
71935         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
71936         CVec_u8Z_free(ret_var);
71937         return ret_arr;
71938 }
71939
71940 int64_t  CS_LDK_InFlightHtlcs_read(int8_tArray ser) {
71941         LDKu8slice ser_ref;
71942         ser_ref.datalen = ser->arr_len;
71943         ser_ref.data = ser->elems;
71944         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
71945         *ret_conv = InFlightHtlcs_read(ser_ref);
71946         FREE(ser);
71947         return tag_ptr(ret_conv, true);
71948 }
71949
71950 void  CS_LDK_RouteHop_free(int64_t this_obj) {
71951         LDKRouteHop this_obj_conv;
71952         this_obj_conv.inner = untag_ptr(this_obj);
71953         this_obj_conv.is_owned = ptr_is_owned(this_obj);
71954         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
71955         RouteHop_free(this_obj_conv);
71956 }
71957
71958 int8_tArray  CS_LDK_RouteHop_get_pubkey(int64_t this_ptr) {
71959         LDKRouteHop this_ptr_conv;
71960         this_ptr_conv.inner = untag_ptr(this_ptr);
71961         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71962         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71963         this_ptr_conv.is_owned = false;
71964         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
71965         memcpy(ret_arr->elems, RouteHop_get_pubkey(&this_ptr_conv).compressed_form, 33);
71966         return ret_arr;
71967 }
71968
71969 void  CS_LDK_RouteHop_set_pubkey(int64_t this_ptr, int8_tArray val) {
71970         LDKRouteHop this_ptr_conv;
71971         this_ptr_conv.inner = untag_ptr(this_ptr);
71972         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71973         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71974         this_ptr_conv.is_owned = false;
71975         LDKPublicKey val_ref;
71976         CHECK(val->arr_len == 33);
71977         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
71978         RouteHop_set_pubkey(&this_ptr_conv, val_ref);
71979 }
71980
71981 int64_t  CS_LDK_RouteHop_get_node_features(int64_t this_ptr) {
71982         LDKRouteHop this_ptr_conv;
71983         this_ptr_conv.inner = untag_ptr(this_ptr);
71984         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71985         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71986         this_ptr_conv.is_owned = false;
71987         LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
71988         int64_t ret_ref = 0;
71989         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71990         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71991         return ret_ref;
71992 }
71993
71994 void  CS_LDK_RouteHop_set_node_features(int64_t this_ptr, int64_t val) {
71995         LDKRouteHop this_ptr_conv;
71996         this_ptr_conv.inner = untag_ptr(this_ptr);
71997         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71998         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71999         this_ptr_conv.is_owned = false;
72000         LDKNodeFeatures val_conv;
72001         val_conv.inner = untag_ptr(val);
72002         val_conv.is_owned = ptr_is_owned(val);
72003         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
72004         val_conv = NodeFeatures_clone(&val_conv);
72005         RouteHop_set_node_features(&this_ptr_conv, val_conv);
72006 }
72007
72008 int64_t  CS_LDK_RouteHop_get_short_channel_id(int64_t this_ptr) {
72009         LDKRouteHop this_ptr_conv;
72010         this_ptr_conv.inner = untag_ptr(this_ptr);
72011         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72012         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72013         this_ptr_conv.is_owned = false;
72014         int64_t ret_conv = RouteHop_get_short_channel_id(&this_ptr_conv);
72015         return ret_conv;
72016 }
72017
72018 void  CS_LDK_RouteHop_set_short_channel_id(int64_t this_ptr, int64_t val) {
72019         LDKRouteHop this_ptr_conv;
72020         this_ptr_conv.inner = untag_ptr(this_ptr);
72021         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72022         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72023         this_ptr_conv.is_owned = false;
72024         RouteHop_set_short_channel_id(&this_ptr_conv, val);
72025 }
72026
72027 int64_t  CS_LDK_RouteHop_get_channel_features(int64_t this_ptr) {
72028         LDKRouteHop this_ptr_conv;
72029         this_ptr_conv.inner = untag_ptr(this_ptr);
72030         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72031         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72032         this_ptr_conv.is_owned = false;
72033         LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
72034         int64_t ret_ref = 0;
72035         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72036         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72037         return ret_ref;
72038 }
72039
72040 void  CS_LDK_RouteHop_set_channel_features(int64_t this_ptr, int64_t val) {
72041         LDKRouteHop this_ptr_conv;
72042         this_ptr_conv.inner = untag_ptr(this_ptr);
72043         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72044         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72045         this_ptr_conv.is_owned = false;
72046         LDKChannelFeatures val_conv;
72047         val_conv.inner = untag_ptr(val);
72048         val_conv.is_owned = ptr_is_owned(val);
72049         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
72050         val_conv = ChannelFeatures_clone(&val_conv);
72051         RouteHop_set_channel_features(&this_ptr_conv, val_conv);
72052 }
72053
72054 int64_t  CS_LDK_RouteHop_get_fee_msat(int64_t this_ptr) {
72055         LDKRouteHop this_ptr_conv;
72056         this_ptr_conv.inner = untag_ptr(this_ptr);
72057         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72058         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72059         this_ptr_conv.is_owned = false;
72060         int64_t ret_conv = RouteHop_get_fee_msat(&this_ptr_conv);
72061         return ret_conv;
72062 }
72063
72064 void  CS_LDK_RouteHop_set_fee_msat(int64_t this_ptr, int64_t val) {
72065         LDKRouteHop this_ptr_conv;
72066         this_ptr_conv.inner = untag_ptr(this_ptr);
72067         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72068         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72069         this_ptr_conv.is_owned = false;
72070         RouteHop_set_fee_msat(&this_ptr_conv, val);
72071 }
72072
72073 int32_t  CS_LDK_RouteHop_get_cltv_expiry_delta(int64_t this_ptr) {
72074         LDKRouteHop this_ptr_conv;
72075         this_ptr_conv.inner = untag_ptr(this_ptr);
72076         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72077         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72078         this_ptr_conv.is_owned = false;
72079         int32_t ret_conv = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
72080         return ret_conv;
72081 }
72082
72083 void  CS_LDK_RouteHop_set_cltv_expiry_delta(int64_t this_ptr, int32_t val) {
72084         LDKRouteHop this_ptr_conv;
72085         this_ptr_conv.inner = untag_ptr(this_ptr);
72086         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72087         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72088         this_ptr_conv.is_owned = false;
72089         RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
72090 }
72091
72092 jboolean  CS_LDK_RouteHop_get_maybe_announced_channel(int64_t this_ptr) {
72093         LDKRouteHop this_ptr_conv;
72094         this_ptr_conv.inner = untag_ptr(this_ptr);
72095         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72096         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72097         this_ptr_conv.is_owned = false;
72098         jboolean ret_conv = RouteHop_get_maybe_announced_channel(&this_ptr_conv);
72099         return ret_conv;
72100 }
72101
72102 void  CS_LDK_RouteHop_set_maybe_announced_channel(int64_t this_ptr, jboolean val) {
72103         LDKRouteHop this_ptr_conv;
72104         this_ptr_conv.inner = untag_ptr(this_ptr);
72105         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72106         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72107         this_ptr_conv.is_owned = false;
72108         RouteHop_set_maybe_announced_channel(&this_ptr_conv, val);
72109 }
72110
72111 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) {
72112         LDKPublicKey pubkey_arg_ref;
72113         CHECK(pubkey_arg->arr_len == 33);
72114         memcpy(pubkey_arg_ref.compressed_form, pubkey_arg->elems, 33); FREE(pubkey_arg);
72115         LDKNodeFeatures node_features_arg_conv;
72116         node_features_arg_conv.inner = untag_ptr(node_features_arg);
72117         node_features_arg_conv.is_owned = ptr_is_owned(node_features_arg);
72118         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_features_arg_conv);
72119         node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv);
72120         LDKChannelFeatures channel_features_arg_conv;
72121         channel_features_arg_conv.inner = untag_ptr(channel_features_arg);
72122         channel_features_arg_conv.is_owned = ptr_is_owned(channel_features_arg);
72123         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_features_arg_conv);
72124         channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv);
72125         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);
72126         int64_t ret_ref = 0;
72127         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72128         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72129         return ret_ref;
72130 }
72131
72132 static inline uint64_t RouteHop_clone_ptr(LDKRouteHop *NONNULL_PTR arg) {
72133         LDKRouteHop ret_var = RouteHop_clone(arg);
72134         int64_t ret_ref = 0;
72135         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72136         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72137         return ret_ref;
72138 }
72139 int64_t  CS_LDK_RouteHop_clone_ptr(int64_t arg) {
72140         LDKRouteHop arg_conv;
72141         arg_conv.inner = untag_ptr(arg);
72142         arg_conv.is_owned = ptr_is_owned(arg);
72143         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
72144         arg_conv.is_owned = false;
72145         int64_t ret_conv = RouteHop_clone_ptr(&arg_conv);
72146         return ret_conv;
72147 }
72148
72149 int64_t  CS_LDK_RouteHop_clone(int64_t orig) {
72150         LDKRouteHop orig_conv;
72151         orig_conv.inner = untag_ptr(orig);
72152         orig_conv.is_owned = ptr_is_owned(orig);
72153         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
72154         orig_conv.is_owned = false;
72155         LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
72156         int64_t ret_ref = 0;
72157         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72158         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72159         return ret_ref;
72160 }
72161
72162 int64_t  CS_LDK_RouteHop_hash(int64_t o) {
72163         LDKRouteHop o_conv;
72164         o_conv.inner = untag_ptr(o);
72165         o_conv.is_owned = ptr_is_owned(o);
72166         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
72167         o_conv.is_owned = false;
72168         int64_t ret_conv = RouteHop_hash(&o_conv);
72169         return ret_conv;
72170 }
72171
72172 jboolean  CS_LDK_RouteHop_eq(int64_t a, int64_t b) {
72173         LDKRouteHop a_conv;
72174         a_conv.inner = untag_ptr(a);
72175         a_conv.is_owned = ptr_is_owned(a);
72176         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
72177         a_conv.is_owned = false;
72178         LDKRouteHop b_conv;
72179         b_conv.inner = untag_ptr(b);
72180         b_conv.is_owned = ptr_is_owned(b);
72181         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
72182         b_conv.is_owned = false;
72183         jboolean ret_conv = RouteHop_eq(&a_conv, &b_conv);
72184         return ret_conv;
72185 }
72186
72187 int8_tArray  CS_LDK_RouteHop_write(int64_t obj) {
72188         LDKRouteHop obj_conv;
72189         obj_conv.inner = untag_ptr(obj);
72190         obj_conv.is_owned = ptr_is_owned(obj);
72191         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
72192         obj_conv.is_owned = false;
72193         LDKCVec_u8Z ret_var = RouteHop_write(&obj_conv);
72194         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
72195         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
72196         CVec_u8Z_free(ret_var);
72197         return ret_arr;
72198 }
72199
72200 int64_t  CS_LDK_RouteHop_read(int8_tArray ser) {
72201         LDKu8slice ser_ref;
72202         ser_ref.datalen = ser->arr_len;
72203         ser_ref.data = ser->elems;
72204         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
72205         *ret_conv = RouteHop_read(ser_ref);
72206         FREE(ser);
72207         return tag_ptr(ret_conv, true);
72208 }
72209
72210 void  CS_LDK_BlindedTail_free(int64_t this_obj) {
72211         LDKBlindedTail this_obj_conv;
72212         this_obj_conv.inner = untag_ptr(this_obj);
72213         this_obj_conv.is_owned = ptr_is_owned(this_obj);
72214         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
72215         BlindedTail_free(this_obj_conv);
72216 }
72217
72218 int64_tArray  CS_LDK_BlindedTail_get_hops(int64_t this_ptr) {
72219         LDKBlindedTail this_ptr_conv;
72220         this_ptr_conv.inner = untag_ptr(this_ptr);
72221         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72222         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72223         this_ptr_conv.is_owned = false;
72224         LDKCVec_BlindedHopZ ret_var = BlindedTail_get_hops(&this_ptr_conv);
72225         int64_tArray ret_arr = NULL;
72226         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
72227         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
72228         for (size_t m = 0; m < ret_var.datalen; m++) {
72229                 LDKBlindedHop ret_conv_12_var = ret_var.data[m];
72230                 int64_t ret_conv_12_ref = 0;
72231                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_12_var);
72232                 ret_conv_12_ref = tag_ptr(ret_conv_12_var.inner, ret_conv_12_var.is_owned);
72233                 ret_arr_ptr[m] = ret_conv_12_ref;
72234         }
72235         
72236         FREE(ret_var.data);
72237         return ret_arr;
72238 }
72239
72240 void  CS_LDK_BlindedTail_set_hops(int64_t this_ptr, int64_tArray val) {
72241         LDKBlindedTail this_ptr_conv;
72242         this_ptr_conv.inner = untag_ptr(this_ptr);
72243         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72244         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72245         this_ptr_conv.is_owned = false;
72246         LDKCVec_BlindedHopZ val_constr;
72247         val_constr.datalen = val->arr_len;
72248         if (val_constr.datalen > 0)
72249                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
72250         else
72251                 val_constr.data = NULL;
72252         int64_t* val_vals = val->elems;
72253         for (size_t m = 0; m < val_constr.datalen; m++) {
72254                 int64_t val_conv_12 = val_vals[m];
72255                 LDKBlindedHop val_conv_12_conv;
72256                 val_conv_12_conv.inner = untag_ptr(val_conv_12);
72257                 val_conv_12_conv.is_owned = ptr_is_owned(val_conv_12);
72258                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_12_conv);
72259                 val_conv_12_conv = BlindedHop_clone(&val_conv_12_conv);
72260                 val_constr.data[m] = val_conv_12_conv;
72261         }
72262         FREE(val);
72263         BlindedTail_set_hops(&this_ptr_conv, val_constr);
72264 }
72265
72266 int8_tArray  CS_LDK_BlindedTail_get_blinding_point(int64_t this_ptr) {
72267         LDKBlindedTail this_ptr_conv;
72268         this_ptr_conv.inner = untag_ptr(this_ptr);
72269         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72270         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72271         this_ptr_conv.is_owned = false;
72272         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
72273         memcpy(ret_arr->elems, BlindedTail_get_blinding_point(&this_ptr_conv).compressed_form, 33);
72274         return ret_arr;
72275 }
72276
72277 void  CS_LDK_BlindedTail_set_blinding_point(int64_t this_ptr, int8_tArray val) {
72278         LDKBlindedTail this_ptr_conv;
72279         this_ptr_conv.inner = untag_ptr(this_ptr);
72280         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72281         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72282         this_ptr_conv.is_owned = false;
72283         LDKPublicKey val_ref;
72284         CHECK(val->arr_len == 33);
72285         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
72286         BlindedTail_set_blinding_point(&this_ptr_conv, val_ref);
72287 }
72288
72289 int32_t  CS_LDK_BlindedTail_get_excess_final_cltv_expiry_delta(int64_t this_ptr) {
72290         LDKBlindedTail this_ptr_conv;
72291         this_ptr_conv.inner = untag_ptr(this_ptr);
72292         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72293         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72294         this_ptr_conv.is_owned = false;
72295         int32_t ret_conv = BlindedTail_get_excess_final_cltv_expiry_delta(&this_ptr_conv);
72296         return ret_conv;
72297 }
72298
72299 void  CS_LDK_BlindedTail_set_excess_final_cltv_expiry_delta(int64_t this_ptr, int32_t val) {
72300         LDKBlindedTail this_ptr_conv;
72301         this_ptr_conv.inner = untag_ptr(this_ptr);
72302         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72303         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72304         this_ptr_conv.is_owned = false;
72305         BlindedTail_set_excess_final_cltv_expiry_delta(&this_ptr_conv, val);
72306 }
72307
72308 int64_t  CS_LDK_BlindedTail_get_final_value_msat(int64_t this_ptr) {
72309         LDKBlindedTail this_ptr_conv;
72310         this_ptr_conv.inner = untag_ptr(this_ptr);
72311         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72312         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72313         this_ptr_conv.is_owned = false;
72314         int64_t ret_conv = BlindedTail_get_final_value_msat(&this_ptr_conv);
72315         return ret_conv;
72316 }
72317
72318 void  CS_LDK_BlindedTail_set_final_value_msat(int64_t this_ptr, int64_t val) {
72319         LDKBlindedTail this_ptr_conv;
72320         this_ptr_conv.inner = untag_ptr(this_ptr);
72321         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72322         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72323         this_ptr_conv.is_owned = false;
72324         BlindedTail_set_final_value_msat(&this_ptr_conv, val);
72325 }
72326
72327 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) {
72328         LDKCVec_BlindedHopZ hops_arg_constr;
72329         hops_arg_constr.datalen = hops_arg->arr_len;
72330         if (hops_arg_constr.datalen > 0)
72331                 hops_arg_constr.data = MALLOC(hops_arg_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
72332         else
72333                 hops_arg_constr.data = NULL;
72334         int64_t* hops_arg_vals = hops_arg->elems;
72335         for (size_t m = 0; m < hops_arg_constr.datalen; m++) {
72336                 int64_t hops_arg_conv_12 = hops_arg_vals[m];
72337                 LDKBlindedHop hops_arg_conv_12_conv;
72338                 hops_arg_conv_12_conv.inner = untag_ptr(hops_arg_conv_12);
72339                 hops_arg_conv_12_conv.is_owned = ptr_is_owned(hops_arg_conv_12);
72340                 CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_arg_conv_12_conv);
72341                 hops_arg_conv_12_conv = BlindedHop_clone(&hops_arg_conv_12_conv);
72342                 hops_arg_constr.data[m] = hops_arg_conv_12_conv;
72343         }
72344         FREE(hops_arg);
72345         LDKPublicKey blinding_point_arg_ref;
72346         CHECK(blinding_point_arg->arr_len == 33);
72347         memcpy(blinding_point_arg_ref.compressed_form, blinding_point_arg->elems, 33); FREE(blinding_point_arg);
72348         LDKBlindedTail ret_var = BlindedTail_new(hops_arg_constr, blinding_point_arg_ref, excess_final_cltv_expiry_delta_arg, final_value_msat_arg);
72349         int64_t ret_ref = 0;
72350         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72351         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72352         return ret_ref;
72353 }
72354
72355 static inline uint64_t BlindedTail_clone_ptr(LDKBlindedTail *NONNULL_PTR arg) {
72356         LDKBlindedTail ret_var = BlindedTail_clone(arg);
72357         int64_t ret_ref = 0;
72358         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72359         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72360         return ret_ref;
72361 }
72362 int64_t  CS_LDK_BlindedTail_clone_ptr(int64_t arg) {
72363         LDKBlindedTail arg_conv;
72364         arg_conv.inner = untag_ptr(arg);
72365         arg_conv.is_owned = ptr_is_owned(arg);
72366         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
72367         arg_conv.is_owned = false;
72368         int64_t ret_conv = BlindedTail_clone_ptr(&arg_conv);
72369         return ret_conv;
72370 }
72371
72372 int64_t  CS_LDK_BlindedTail_clone(int64_t orig) {
72373         LDKBlindedTail orig_conv;
72374         orig_conv.inner = untag_ptr(orig);
72375         orig_conv.is_owned = ptr_is_owned(orig);
72376         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
72377         orig_conv.is_owned = false;
72378         LDKBlindedTail ret_var = BlindedTail_clone(&orig_conv);
72379         int64_t ret_ref = 0;
72380         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72381         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72382         return ret_ref;
72383 }
72384
72385 int64_t  CS_LDK_BlindedTail_hash(int64_t o) {
72386         LDKBlindedTail o_conv;
72387         o_conv.inner = untag_ptr(o);
72388         o_conv.is_owned = ptr_is_owned(o);
72389         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
72390         o_conv.is_owned = false;
72391         int64_t ret_conv = BlindedTail_hash(&o_conv);
72392         return ret_conv;
72393 }
72394
72395 jboolean  CS_LDK_BlindedTail_eq(int64_t a, int64_t b) {
72396         LDKBlindedTail a_conv;
72397         a_conv.inner = untag_ptr(a);
72398         a_conv.is_owned = ptr_is_owned(a);
72399         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
72400         a_conv.is_owned = false;
72401         LDKBlindedTail b_conv;
72402         b_conv.inner = untag_ptr(b);
72403         b_conv.is_owned = ptr_is_owned(b);
72404         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
72405         b_conv.is_owned = false;
72406         jboolean ret_conv = BlindedTail_eq(&a_conv, &b_conv);
72407         return ret_conv;
72408 }
72409
72410 int8_tArray  CS_LDK_BlindedTail_write(int64_t obj) {
72411         LDKBlindedTail obj_conv;
72412         obj_conv.inner = untag_ptr(obj);
72413         obj_conv.is_owned = ptr_is_owned(obj);
72414         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
72415         obj_conv.is_owned = false;
72416         LDKCVec_u8Z ret_var = BlindedTail_write(&obj_conv);
72417         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
72418         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
72419         CVec_u8Z_free(ret_var);
72420         return ret_arr;
72421 }
72422
72423 int64_t  CS_LDK_BlindedTail_read(int8_tArray ser) {
72424         LDKu8slice ser_ref;
72425         ser_ref.datalen = ser->arr_len;
72426         ser_ref.data = ser->elems;
72427         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
72428         *ret_conv = BlindedTail_read(ser_ref);
72429         FREE(ser);
72430         return tag_ptr(ret_conv, true);
72431 }
72432
72433 void  CS_LDK_Path_free(int64_t this_obj) {
72434         LDKPath this_obj_conv;
72435         this_obj_conv.inner = untag_ptr(this_obj);
72436         this_obj_conv.is_owned = ptr_is_owned(this_obj);
72437         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
72438         Path_free(this_obj_conv);
72439 }
72440
72441 int64_tArray  CS_LDK_Path_get_hops(int64_t this_ptr) {
72442         LDKPath this_ptr_conv;
72443         this_ptr_conv.inner = untag_ptr(this_ptr);
72444         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72445         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72446         this_ptr_conv.is_owned = false;
72447         LDKCVec_RouteHopZ ret_var = Path_get_hops(&this_ptr_conv);
72448         int64_tArray ret_arr = NULL;
72449         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
72450         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
72451         for (size_t k = 0; k < ret_var.datalen; k++) {
72452                 LDKRouteHop ret_conv_10_var = ret_var.data[k];
72453                 int64_t ret_conv_10_ref = 0;
72454                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_10_var);
72455                 ret_conv_10_ref = tag_ptr(ret_conv_10_var.inner, ret_conv_10_var.is_owned);
72456                 ret_arr_ptr[k] = ret_conv_10_ref;
72457         }
72458         
72459         FREE(ret_var.data);
72460         return ret_arr;
72461 }
72462
72463 void  CS_LDK_Path_set_hops(int64_t this_ptr, int64_tArray val) {
72464         LDKPath this_ptr_conv;
72465         this_ptr_conv.inner = untag_ptr(this_ptr);
72466         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72467         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72468         this_ptr_conv.is_owned = false;
72469         LDKCVec_RouteHopZ val_constr;
72470         val_constr.datalen = val->arr_len;
72471         if (val_constr.datalen > 0)
72472                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
72473         else
72474                 val_constr.data = NULL;
72475         int64_t* val_vals = val->elems;
72476         for (size_t k = 0; k < val_constr.datalen; k++) {
72477                 int64_t val_conv_10 = val_vals[k];
72478                 LDKRouteHop val_conv_10_conv;
72479                 val_conv_10_conv.inner = untag_ptr(val_conv_10);
72480                 val_conv_10_conv.is_owned = ptr_is_owned(val_conv_10);
72481                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_10_conv);
72482                 val_conv_10_conv = RouteHop_clone(&val_conv_10_conv);
72483                 val_constr.data[k] = val_conv_10_conv;
72484         }
72485         FREE(val);
72486         Path_set_hops(&this_ptr_conv, val_constr);
72487 }
72488
72489 int64_t  CS_LDK_Path_get_blinded_tail(int64_t this_ptr) {
72490         LDKPath this_ptr_conv;
72491         this_ptr_conv.inner = untag_ptr(this_ptr);
72492         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72493         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72494         this_ptr_conv.is_owned = false;
72495         LDKBlindedTail ret_var = Path_get_blinded_tail(&this_ptr_conv);
72496         int64_t ret_ref = 0;
72497         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72498         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72499         return ret_ref;
72500 }
72501
72502 void  CS_LDK_Path_set_blinded_tail(int64_t this_ptr, int64_t val) {
72503         LDKPath this_ptr_conv;
72504         this_ptr_conv.inner = untag_ptr(this_ptr);
72505         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72506         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72507         this_ptr_conv.is_owned = false;
72508         LDKBlindedTail val_conv;
72509         val_conv.inner = untag_ptr(val);
72510         val_conv.is_owned = ptr_is_owned(val);
72511         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
72512         val_conv = BlindedTail_clone(&val_conv);
72513         Path_set_blinded_tail(&this_ptr_conv, val_conv);
72514 }
72515
72516 int64_t  CS_LDK_Path_new(int64_tArray hops_arg, int64_t blinded_tail_arg) {
72517         LDKCVec_RouteHopZ hops_arg_constr;
72518         hops_arg_constr.datalen = hops_arg->arr_len;
72519         if (hops_arg_constr.datalen > 0)
72520                 hops_arg_constr.data = MALLOC(hops_arg_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
72521         else
72522                 hops_arg_constr.data = NULL;
72523         int64_t* hops_arg_vals = hops_arg->elems;
72524         for (size_t k = 0; k < hops_arg_constr.datalen; k++) {
72525                 int64_t hops_arg_conv_10 = hops_arg_vals[k];
72526                 LDKRouteHop hops_arg_conv_10_conv;
72527                 hops_arg_conv_10_conv.inner = untag_ptr(hops_arg_conv_10);
72528                 hops_arg_conv_10_conv.is_owned = ptr_is_owned(hops_arg_conv_10);
72529                 CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_arg_conv_10_conv);
72530                 hops_arg_conv_10_conv = RouteHop_clone(&hops_arg_conv_10_conv);
72531                 hops_arg_constr.data[k] = hops_arg_conv_10_conv;
72532         }
72533         FREE(hops_arg);
72534         LDKBlindedTail blinded_tail_arg_conv;
72535         blinded_tail_arg_conv.inner = untag_ptr(blinded_tail_arg);
72536         blinded_tail_arg_conv.is_owned = ptr_is_owned(blinded_tail_arg);
72537         CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_tail_arg_conv);
72538         blinded_tail_arg_conv = BlindedTail_clone(&blinded_tail_arg_conv);
72539         LDKPath ret_var = Path_new(hops_arg_constr, blinded_tail_arg_conv);
72540         int64_t ret_ref = 0;
72541         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72542         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72543         return ret_ref;
72544 }
72545
72546 static inline uint64_t Path_clone_ptr(LDKPath *NONNULL_PTR arg) {
72547         LDKPath ret_var = Path_clone(arg);
72548         int64_t ret_ref = 0;
72549         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72550         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72551         return ret_ref;
72552 }
72553 int64_t  CS_LDK_Path_clone_ptr(int64_t arg) {
72554         LDKPath arg_conv;
72555         arg_conv.inner = untag_ptr(arg);
72556         arg_conv.is_owned = ptr_is_owned(arg);
72557         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
72558         arg_conv.is_owned = false;
72559         int64_t ret_conv = Path_clone_ptr(&arg_conv);
72560         return ret_conv;
72561 }
72562
72563 int64_t  CS_LDK_Path_clone(int64_t orig) {
72564         LDKPath orig_conv;
72565         orig_conv.inner = untag_ptr(orig);
72566         orig_conv.is_owned = ptr_is_owned(orig);
72567         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
72568         orig_conv.is_owned = false;
72569         LDKPath ret_var = Path_clone(&orig_conv);
72570         int64_t ret_ref = 0;
72571         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72572         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72573         return ret_ref;
72574 }
72575
72576 int64_t  CS_LDK_Path_hash(int64_t o) {
72577         LDKPath o_conv;
72578         o_conv.inner = untag_ptr(o);
72579         o_conv.is_owned = ptr_is_owned(o);
72580         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
72581         o_conv.is_owned = false;
72582         int64_t ret_conv = Path_hash(&o_conv);
72583         return ret_conv;
72584 }
72585
72586 jboolean  CS_LDK_Path_eq(int64_t a, int64_t b) {
72587         LDKPath a_conv;
72588         a_conv.inner = untag_ptr(a);
72589         a_conv.is_owned = ptr_is_owned(a);
72590         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
72591         a_conv.is_owned = false;
72592         LDKPath b_conv;
72593         b_conv.inner = untag_ptr(b);
72594         b_conv.is_owned = ptr_is_owned(b);
72595         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
72596         b_conv.is_owned = false;
72597         jboolean ret_conv = Path_eq(&a_conv, &b_conv);
72598         return ret_conv;
72599 }
72600
72601 int64_t  CS_LDK_Path_fee_msat(int64_t this_arg) {
72602         LDKPath this_arg_conv;
72603         this_arg_conv.inner = untag_ptr(this_arg);
72604         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72605         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72606         this_arg_conv.is_owned = false;
72607         int64_t ret_conv = Path_fee_msat(&this_arg_conv);
72608         return ret_conv;
72609 }
72610
72611 int64_t  CS_LDK_Path_final_value_msat(int64_t this_arg) {
72612         LDKPath this_arg_conv;
72613         this_arg_conv.inner = untag_ptr(this_arg);
72614         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72615         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72616         this_arg_conv.is_owned = false;
72617         int64_t ret_conv = Path_final_value_msat(&this_arg_conv);
72618         return ret_conv;
72619 }
72620
72621 int64_t  CS_LDK_Path_final_cltv_expiry_delta(int64_t this_arg) {
72622         LDKPath this_arg_conv;
72623         this_arg_conv.inner = untag_ptr(this_arg);
72624         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72625         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72626         this_arg_conv.is_owned = false;
72627         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
72628         *ret_copy = Path_final_cltv_expiry_delta(&this_arg_conv);
72629         int64_t ret_ref = tag_ptr(ret_copy, true);
72630         return ret_ref;
72631 }
72632
72633 void  CS_LDK_Route_free(int64_t this_obj) {
72634         LDKRoute this_obj_conv;
72635         this_obj_conv.inner = untag_ptr(this_obj);
72636         this_obj_conv.is_owned = ptr_is_owned(this_obj);
72637         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
72638         Route_free(this_obj_conv);
72639 }
72640
72641 int64_tArray  CS_LDK_Route_get_paths(int64_t this_ptr) {
72642         LDKRoute this_ptr_conv;
72643         this_ptr_conv.inner = untag_ptr(this_ptr);
72644         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72645         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72646         this_ptr_conv.is_owned = false;
72647         LDKCVec_PathZ ret_var = Route_get_paths(&this_ptr_conv);
72648         int64_tArray ret_arr = NULL;
72649         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
72650         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
72651         for (size_t g = 0; g < ret_var.datalen; g++) {
72652                 LDKPath ret_conv_6_var = ret_var.data[g];
72653                 int64_t ret_conv_6_ref = 0;
72654                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_6_var);
72655                 ret_conv_6_ref = tag_ptr(ret_conv_6_var.inner, ret_conv_6_var.is_owned);
72656                 ret_arr_ptr[g] = ret_conv_6_ref;
72657         }
72658         
72659         FREE(ret_var.data);
72660         return ret_arr;
72661 }
72662
72663 void  CS_LDK_Route_set_paths(int64_t this_ptr, int64_tArray val) {
72664         LDKRoute this_ptr_conv;
72665         this_ptr_conv.inner = untag_ptr(this_ptr);
72666         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72667         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72668         this_ptr_conv.is_owned = false;
72669         LDKCVec_PathZ val_constr;
72670         val_constr.datalen = val->arr_len;
72671         if (val_constr.datalen > 0)
72672                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKPath), "LDKCVec_PathZ Elements");
72673         else
72674                 val_constr.data = NULL;
72675         int64_t* val_vals = val->elems;
72676         for (size_t g = 0; g < val_constr.datalen; g++) {
72677                 int64_t val_conv_6 = val_vals[g];
72678                 LDKPath val_conv_6_conv;
72679                 val_conv_6_conv.inner = untag_ptr(val_conv_6);
72680                 val_conv_6_conv.is_owned = ptr_is_owned(val_conv_6);
72681                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_6_conv);
72682                 val_conv_6_conv = Path_clone(&val_conv_6_conv);
72683                 val_constr.data[g] = val_conv_6_conv;
72684         }
72685         FREE(val);
72686         Route_set_paths(&this_ptr_conv, val_constr);
72687 }
72688
72689 int64_t  CS_LDK_Route_get_route_params(int64_t this_ptr) {
72690         LDKRoute this_ptr_conv;
72691         this_ptr_conv.inner = untag_ptr(this_ptr);
72692         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72693         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72694         this_ptr_conv.is_owned = false;
72695         LDKRouteParameters ret_var = Route_get_route_params(&this_ptr_conv);
72696         int64_t ret_ref = 0;
72697         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72698         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72699         return ret_ref;
72700 }
72701
72702 void  CS_LDK_Route_set_route_params(int64_t this_ptr, int64_t val) {
72703         LDKRoute this_ptr_conv;
72704         this_ptr_conv.inner = untag_ptr(this_ptr);
72705         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72706         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72707         this_ptr_conv.is_owned = false;
72708         LDKRouteParameters val_conv;
72709         val_conv.inner = untag_ptr(val);
72710         val_conv.is_owned = ptr_is_owned(val);
72711         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
72712         val_conv = RouteParameters_clone(&val_conv);
72713         Route_set_route_params(&this_ptr_conv, val_conv);
72714 }
72715
72716 int64_t  CS_LDK_Route_new(int64_tArray paths_arg, int64_t route_params_arg) {
72717         LDKCVec_PathZ paths_arg_constr;
72718         paths_arg_constr.datalen = paths_arg->arr_len;
72719         if (paths_arg_constr.datalen > 0)
72720                 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKPath), "LDKCVec_PathZ Elements");
72721         else
72722                 paths_arg_constr.data = NULL;
72723         int64_t* paths_arg_vals = paths_arg->elems;
72724         for (size_t g = 0; g < paths_arg_constr.datalen; g++) {
72725                 int64_t paths_arg_conv_6 = paths_arg_vals[g];
72726                 LDKPath paths_arg_conv_6_conv;
72727                 paths_arg_conv_6_conv.inner = untag_ptr(paths_arg_conv_6);
72728                 paths_arg_conv_6_conv.is_owned = ptr_is_owned(paths_arg_conv_6);
72729                 CHECK_INNER_FIELD_ACCESS_OR_NULL(paths_arg_conv_6_conv);
72730                 paths_arg_conv_6_conv = Path_clone(&paths_arg_conv_6_conv);
72731                 paths_arg_constr.data[g] = paths_arg_conv_6_conv;
72732         }
72733         FREE(paths_arg);
72734         LDKRouteParameters route_params_arg_conv;
72735         route_params_arg_conv.inner = untag_ptr(route_params_arg);
72736         route_params_arg_conv.is_owned = ptr_is_owned(route_params_arg);
72737         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_arg_conv);
72738         route_params_arg_conv = RouteParameters_clone(&route_params_arg_conv);
72739         LDKRoute ret_var = Route_new(paths_arg_constr, route_params_arg_conv);
72740         int64_t ret_ref = 0;
72741         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72742         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72743         return ret_ref;
72744 }
72745
72746 static inline uint64_t Route_clone_ptr(LDKRoute *NONNULL_PTR arg) {
72747         LDKRoute ret_var = Route_clone(arg);
72748         int64_t ret_ref = 0;
72749         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72750         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72751         return ret_ref;
72752 }
72753 int64_t  CS_LDK_Route_clone_ptr(int64_t arg) {
72754         LDKRoute arg_conv;
72755         arg_conv.inner = untag_ptr(arg);
72756         arg_conv.is_owned = ptr_is_owned(arg);
72757         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
72758         arg_conv.is_owned = false;
72759         int64_t ret_conv = Route_clone_ptr(&arg_conv);
72760         return ret_conv;
72761 }
72762
72763 int64_t  CS_LDK_Route_clone(int64_t orig) {
72764         LDKRoute orig_conv;
72765         orig_conv.inner = untag_ptr(orig);
72766         orig_conv.is_owned = ptr_is_owned(orig);
72767         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
72768         orig_conv.is_owned = false;
72769         LDKRoute ret_var = Route_clone(&orig_conv);
72770         int64_t ret_ref = 0;
72771         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72772         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72773         return ret_ref;
72774 }
72775
72776 int64_t  CS_LDK_Route_hash(int64_t o) {
72777         LDKRoute o_conv;
72778         o_conv.inner = untag_ptr(o);
72779         o_conv.is_owned = ptr_is_owned(o);
72780         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
72781         o_conv.is_owned = false;
72782         int64_t ret_conv = Route_hash(&o_conv);
72783         return ret_conv;
72784 }
72785
72786 jboolean  CS_LDK_Route_eq(int64_t a, int64_t b) {
72787         LDKRoute a_conv;
72788         a_conv.inner = untag_ptr(a);
72789         a_conv.is_owned = ptr_is_owned(a);
72790         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
72791         a_conv.is_owned = false;
72792         LDKRoute b_conv;
72793         b_conv.inner = untag_ptr(b);
72794         b_conv.is_owned = ptr_is_owned(b);
72795         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
72796         b_conv.is_owned = false;
72797         jboolean ret_conv = Route_eq(&a_conv, &b_conv);
72798         return ret_conv;
72799 }
72800
72801 int64_t  CS_LDK_Route_get_total_fees(int64_t this_arg) {
72802         LDKRoute this_arg_conv;
72803         this_arg_conv.inner = untag_ptr(this_arg);
72804         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72805         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72806         this_arg_conv.is_owned = false;
72807         int64_t ret_conv = Route_get_total_fees(&this_arg_conv);
72808         return ret_conv;
72809 }
72810
72811 int64_t  CS_LDK_Route_get_total_amount(int64_t this_arg) {
72812         LDKRoute this_arg_conv;
72813         this_arg_conv.inner = untag_ptr(this_arg);
72814         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72815         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72816         this_arg_conv.is_owned = false;
72817         int64_t ret_conv = Route_get_total_amount(&this_arg_conv);
72818         return ret_conv;
72819 }
72820
72821 jstring  CS_LDK_Route_to_str(int64_t o) {
72822         LDKRoute o_conv;
72823         o_conv.inner = untag_ptr(o);
72824         o_conv.is_owned = ptr_is_owned(o);
72825         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
72826         o_conv.is_owned = false;
72827         LDKStr ret_str = Route_to_str(&o_conv);
72828         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
72829         Str_free(ret_str);
72830         return ret_conv;
72831 }
72832
72833 int8_tArray  CS_LDK_Route_write(int64_t obj) {
72834         LDKRoute obj_conv;
72835         obj_conv.inner = untag_ptr(obj);
72836         obj_conv.is_owned = ptr_is_owned(obj);
72837         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
72838         obj_conv.is_owned = false;
72839         LDKCVec_u8Z ret_var = Route_write(&obj_conv);
72840         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
72841         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
72842         CVec_u8Z_free(ret_var);
72843         return ret_arr;
72844 }
72845
72846 int64_t  CS_LDK_Route_read(int8_tArray ser) {
72847         LDKu8slice ser_ref;
72848         ser_ref.datalen = ser->arr_len;
72849         ser_ref.data = ser->elems;
72850         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
72851         *ret_conv = Route_read(ser_ref);
72852         FREE(ser);
72853         return tag_ptr(ret_conv, true);
72854 }
72855
72856 void  CS_LDK_RouteParameters_free(int64_t this_obj) {
72857         LDKRouteParameters this_obj_conv;
72858         this_obj_conv.inner = untag_ptr(this_obj);
72859         this_obj_conv.is_owned = ptr_is_owned(this_obj);
72860         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
72861         RouteParameters_free(this_obj_conv);
72862 }
72863
72864 int64_t  CS_LDK_RouteParameters_get_payment_params(int64_t this_ptr) {
72865         LDKRouteParameters this_ptr_conv;
72866         this_ptr_conv.inner = untag_ptr(this_ptr);
72867         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72868         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72869         this_ptr_conv.is_owned = false;
72870         LDKPaymentParameters ret_var = RouteParameters_get_payment_params(&this_ptr_conv);
72871         int64_t ret_ref = 0;
72872         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72873         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72874         return ret_ref;
72875 }
72876
72877 void  CS_LDK_RouteParameters_set_payment_params(int64_t this_ptr, int64_t val) {
72878         LDKRouteParameters this_ptr_conv;
72879         this_ptr_conv.inner = untag_ptr(this_ptr);
72880         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72881         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72882         this_ptr_conv.is_owned = false;
72883         LDKPaymentParameters val_conv;
72884         val_conv.inner = untag_ptr(val);
72885         val_conv.is_owned = ptr_is_owned(val);
72886         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
72887         val_conv = PaymentParameters_clone(&val_conv);
72888         RouteParameters_set_payment_params(&this_ptr_conv, val_conv);
72889 }
72890
72891 int64_t  CS_LDK_RouteParameters_get_final_value_msat(int64_t this_ptr) {
72892         LDKRouteParameters this_ptr_conv;
72893         this_ptr_conv.inner = untag_ptr(this_ptr);
72894         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72895         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72896         this_ptr_conv.is_owned = false;
72897         int64_t ret_conv = RouteParameters_get_final_value_msat(&this_ptr_conv);
72898         return ret_conv;
72899 }
72900
72901 void  CS_LDK_RouteParameters_set_final_value_msat(int64_t this_ptr, int64_t val) {
72902         LDKRouteParameters this_ptr_conv;
72903         this_ptr_conv.inner = untag_ptr(this_ptr);
72904         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72905         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72906         this_ptr_conv.is_owned = false;
72907         RouteParameters_set_final_value_msat(&this_ptr_conv, val);
72908 }
72909
72910 int64_t  CS_LDK_RouteParameters_get_max_total_routing_fee_msat(int64_t this_ptr) {
72911         LDKRouteParameters this_ptr_conv;
72912         this_ptr_conv.inner = untag_ptr(this_ptr);
72913         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72914         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72915         this_ptr_conv.is_owned = false;
72916         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
72917         *ret_copy = RouteParameters_get_max_total_routing_fee_msat(&this_ptr_conv);
72918         int64_t ret_ref = tag_ptr(ret_copy, true);
72919         return ret_ref;
72920 }
72921
72922 void  CS_LDK_RouteParameters_set_max_total_routing_fee_msat(int64_t this_ptr, int64_t val) {
72923         LDKRouteParameters this_ptr_conv;
72924         this_ptr_conv.inner = untag_ptr(this_ptr);
72925         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72926         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72927         this_ptr_conv.is_owned = false;
72928         void* val_ptr = untag_ptr(val);
72929         CHECK_ACCESS(val_ptr);
72930         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
72931         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
72932         RouteParameters_set_max_total_routing_fee_msat(&this_ptr_conv, val_conv);
72933 }
72934
72935 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) {
72936         LDKPaymentParameters payment_params_arg_conv;
72937         payment_params_arg_conv.inner = untag_ptr(payment_params_arg);
72938         payment_params_arg_conv.is_owned = ptr_is_owned(payment_params_arg);
72939         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_arg_conv);
72940         payment_params_arg_conv = PaymentParameters_clone(&payment_params_arg_conv);
72941         void* max_total_routing_fee_msat_arg_ptr = untag_ptr(max_total_routing_fee_msat_arg);
72942         CHECK_ACCESS(max_total_routing_fee_msat_arg_ptr);
72943         LDKCOption_u64Z max_total_routing_fee_msat_arg_conv = *(LDKCOption_u64Z*)(max_total_routing_fee_msat_arg_ptr);
72944         max_total_routing_fee_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(max_total_routing_fee_msat_arg));
72945         LDKRouteParameters ret_var = RouteParameters_new(payment_params_arg_conv, final_value_msat_arg, max_total_routing_fee_msat_arg_conv);
72946         int64_t ret_ref = 0;
72947         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72948         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72949         return ret_ref;
72950 }
72951
72952 static inline uint64_t RouteParameters_clone_ptr(LDKRouteParameters *NONNULL_PTR arg) {
72953         LDKRouteParameters ret_var = RouteParameters_clone(arg);
72954         int64_t ret_ref = 0;
72955         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72956         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72957         return ret_ref;
72958 }
72959 int64_t  CS_LDK_RouteParameters_clone_ptr(int64_t arg) {
72960         LDKRouteParameters arg_conv;
72961         arg_conv.inner = untag_ptr(arg);
72962         arg_conv.is_owned = ptr_is_owned(arg);
72963         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
72964         arg_conv.is_owned = false;
72965         int64_t ret_conv = RouteParameters_clone_ptr(&arg_conv);
72966         return ret_conv;
72967 }
72968
72969 int64_t  CS_LDK_RouteParameters_clone(int64_t orig) {
72970         LDKRouteParameters orig_conv;
72971         orig_conv.inner = untag_ptr(orig);
72972         orig_conv.is_owned = ptr_is_owned(orig);
72973         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
72974         orig_conv.is_owned = false;
72975         LDKRouteParameters ret_var = RouteParameters_clone(&orig_conv);
72976         int64_t ret_ref = 0;
72977         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72978         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72979         return ret_ref;
72980 }
72981
72982 int64_t  CS_LDK_RouteParameters_hash(int64_t o) {
72983         LDKRouteParameters o_conv;
72984         o_conv.inner = untag_ptr(o);
72985         o_conv.is_owned = ptr_is_owned(o);
72986         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
72987         o_conv.is_owned = false;
72988         int64_t ret_conv = RouteParameters_hash(&o_conv);
72989         return ret_conv;
72990 }
72991
72992 jboolean  CS_LDK_RouteParameters_eq(int64_t a, int64_t b) {
72993         LDKRouteParameters a_conv;
72994         a_conv.inner = untag_ptr(a);
72995         a_conv.is_owned = ptr_is_owned(a);
72996         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
72997         a_conv.is_owned = false;
72998         LDKRouteParameters b_conv;
72999         b_conv.inner = untag_ptr(b);
73000         b_conv.is_owned = ptr_is_owned(b);
73001         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
73002         b_conv.is_owned = false;
73003         jboolean ret_conv = RouteParameters_eq(&a_conv, &b_conv);
73004         return ret_conv;
73005 }
73006
73007 int64_t  CS_LDK_RouteParameters_from_payment_params_and_value(int64_t payment_params, int64_t final_value_msat) {
73008         LDKPaymentParameters payment_params_conv;
73009         payment_params_conv.inner = untag_ptr(payment_params);
73010         payment_params_conv.is_owned = ptr_is_owned(payment_params);
73011         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_conv);
73012         payment_params_conv = PaymentParameters_clone(&payment_params_conv);
73013         LDKRouteParameters ret_var = RouteParameters_from_payment_params_and_value(payment_params_conv, final_value_msat);
73014         int64_t ret_ref = 0;
73015         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73016         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73017         return ret_ref;
73018 }
73019
73020 int8_tArray  CS_LDK_RouteParameters_write(int64_t obj) {
73021         LDKRouteParameters obj_conv;
73022         obj_conv.inner = untag_ptr(obj);
73023         obj_conv.is_owned = ptr_is_owned(obj);
73024         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
73025         obj_conv.is_owned = false;
73026         LDKCVec_u8Z ret_var = RouteParameters_write(&obj_conv);
73027         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
73028         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
73029         CVec_u8Z_free(ret_var);
73030         return ret_arr;
73031 }
73032
73033 int64_t  CS_LDK_RouteParameters_read(int8_tArray ser) {
73034         LDKu8slice ser_ref;
73035         ser_ref.datalen = ser->arr_len;
73036         ser_ref.data = ser->elems;
73037         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
73038         *ret_conv = RouteParameters_read(ser_ref);
73039         FREE(ser);
73040         return tag_ptr(ret_conv, true);
73041 }
73042
73043 void  CS_LDK_PaymentParameters_free(int64_t this_obj) {
73044         LDKPaymentParameters this_obj_conv;
73045         this_obj_conv.inner = untag_ptr(this_obj);
73046         this_obj_conv.is_owned = ptr_is_owned(this_obj);
73047         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
73048         PaymentParameters_free(this_obj_conv);
73049 }
73050
73051 int64_t  CS_LDK_PaymentParameters_get_payee(int64_t this_ptr) {
73052         LDKPaymentParameters this_ptr_conv;
73053         this_ptr_conv.inner = untag_ptr(this_ptr);
73054         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73055         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73056         this_ptr_conv.is_owned = false;
73057         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
73058         *ret_copy = PaymentParameters_get_payee(&this_ptr_conv);
73059         int64_t ret_ref = tag_ptr(ret_copy, true);
73060         return ret_ref;
73061 }
73062
73063 void  CS_LDK_PaymentParameters_set_payee(int64_t this_ptr, int64_t val) {
73064         LDKPaymentParameters this_ptr_conv;
73065         this_ptr_conv.inner = untag_ptr(this_ptr);
73066         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73067         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73068         this_ptr_conv.is_owned = false;
73069         void* val_ptr = untag_ptr(val);
73070         CHECK_ACCESS(val_ptr);
73071         LDKPayee val_conv = *(LDKPayee*)(val_ptr);
73072         val_conv = Payee_clone((LDKPayee*)untag_ptr(val));
73073         PaymentParameters_set_payee(&this_ptr_conv, val_conv);
73074 }
73075
73076 int64_t  CS_LDK_PaymentParameters_get_expiry_time(int64_t this_ptr) {
73077         LDKPaymentParameters this_ptr_conv;
73078         this_ptr_conv.inner = untag_ptr(this_ptr);
73079         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73080         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73081         this_ptr_conv.is_owned = false;
73082         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
73083         *ret_copy = PaymentParameters_get_expiry_time(&this_ptr_conv);
73084         int64_t ret_ref = tag_ptr(ret_copy, true);
73085         return ret_ref;
73086 }
73087
73088 void  CS_LDK_PaymentParameters_set_expiry_time(int64_t this_ptr, int64_t val) {
73089         LDKPaymentParameters this_ptr_conv;
73090         this_ptr_conv.inner = untag_ptr(this_ptr);
73091         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73092         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73093         this_ptr_conv.is_owned = false;
73094         void* val_ptr = untag_ptr(val);
73095         CHECK_ACCESS(val_ptr);
73096         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
73097         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
73098         PaymentParameters_set_expiry_time(&this_ptr_conv, val_conv);
73099 }
73100
73101 int32_t  CS_LDK_PaymentParameters_get_max_total_cltv_expiry_delta(int64_t this_ptr) {
73102         LDKPaymentParameters this_ptr_conv;
73103         this_ptr_conv.inner = untag_ptr(this_ptr);
73104         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73105         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73106         this_ptr_conv.is_owned = false;
73107         int32_t ret_conv = PaymentParameters_get_max_total_cltv_expiry_delta(&this_ptr_conv);
73108         return ret_conv;
73109 }
73110
73111 void  CS_LDK_PaymentParameters_set_max_total_cltv_expiry_delta(int64_t this_ptr, int32_t val) {
73112         LDKPaymentParameters this_ptr_conv;
73113         this_ptr_conv.inner = untag_ptr(this_ptr);
73114         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73115         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73116         this_ptr_conv.is_owned = false;
73117         PaymentParameters_set_max_total_cltv_expiry_delta(&this_ptr_conv, val);
73118 }
73119
73120 int8_t  CS_LDK_PaymentParameters_get_max_path_count(int64_t this_ptr) {
73121         LDKPaymentParameters this_ptr_conv;
73122         this_ptr_conv.inner = untag_ptr(this_ptr);
73123         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73124         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73125         this_ptr_conv.is_owned = false;
73126         int8_t ret_conv = PaymentParameters_get_max_path_count(&this_ptr_conv);
73127         return ret_conv;
73128 }
73129
73130 void  CS_LDK_PaymentParameters_set_max_path_count(int64_t this_ptr, int8_t val) {
73131         LDKPaymentParameters this_ptr_conv;
73132         this_ptr_conv.inner = untag_ptr(this_ptr);
73133         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73134         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73135         this_ptr_conv.is_owned = false;
73136         PaymentParameters_set_max_path_count(&this_ptr_conv, val);
73137 }
73138
73139 int8_t  CS_LDK_PaymentParameters_get_max_channel_saturation_power_of_half(int64_t this_ptr) {
73140         LDKPaymentParameters this_ptr_conv;
73141         this_ptr_conv.inner = untag_ptr(this_ptr);
73142         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73143         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73144         this_ptr_conv.is_owned = false;
73145         int8_t ret_conv = PaymentParameters_get_max_channel_saturation_power_of_half(&this_ptr_conv);
73146         return ret_conv;
73147 }
73148
73149 void  CS_LDK_PaymentParameters_set_max_channel_saturation_power_of_half(int64_t this_ptr, int8_t val) {
73150         LDKPaymentParameters this_ptr_conv;
73151         this_ptr_conv.inner = untag_ptr(this_ptr);
73152         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73153         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73154         this_ptr_conv.is_owned = false;
73155         PaymentParameters_set_max_channel_saturation_power_of_half(&this_ptr_conv, val);
73156 }
73157
73158 int64_tArray  CS_LDK_PaymentParameters_get_previously_failed_channels(int64_t this_ptr) {
73159         LDKPaymentParameters this_ptr_conv;
73160         this_ptr_conv.inner = untag_ptr(this_ptr);
73161         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73162         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73163         this_ptr_conv.is_owned = false;
73164         LDKCVec_u64Z ret_var = PaymentParameters_get_previously_failed_channels(&this_ptr_conv);
73165         int64_tArray ret_arr = NULL;
73166         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
73167         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
73168         for (size_t g = 0; g < ret_var.datalen; g++) {
73169                 int64_t ret_conv_6_conv = ret_var.data[g];
73170                 ret_arr_ptr[g] = ret_conv_6_conv;
73171         }
73172         
73173         FREE(ret_var.data);
73174         return ret_arr;
73175 }
73176
73177 void  CS_LDK_PaymentParameters_set_previously_failed_channels(int64_t this_ptr, int64_tArray val) {
73178         LDKPaymentParameters this_ptr_conv;
73179         this_ptr_conv.inner = untag_ptr(this_ptr);
73180         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73181         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73182         this_ptr_conv.is_owned = false;
73183         LDKCVec_u64Z val_constr;
73184         val_constr.datalen = val->arr_len;
73185         if (val_constr.datalen > 0)
73186                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
73187         else
73188                 val_constr.data = NULL;
73189         int64_t* val_vals = val->elems;
73190         for (size_t g = 0; g < val_constr.datalen; g++) {
73191                 int64_t val_conv_6 = val_vals[g];
73192                 val_constr.data[g] = val_conv_6;
73193         }
73194         FREE(val);
73195         PaymentParameters_set_previously_failed_channels(&this_ptr_conv, val_constr);
73196 }
73197
73198 int64_tArray  CS_LDK_PaymentParameters_get_previously_failed_blinded_path_idxs(int64_t this_ptr) {
73199         LDKPaymentParameters this_ptr_conv;
73200         this_ptr_conv.inner = untag_ptr(this_ptr);
73201         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73202         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73203         this_ptr_conv.is_owned = false;
73204         LDKCVec_u64Z ret_var = PaymentParameters_get_previously_failed_blinded_path_idxs(&this_ptr_conv);
73205         int64_tArray ret_arr = NULL;
73206         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
73207         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
73208         for (size_t g = 0; g < ret_var.datalen; g++) {
73209                 int64_t ret_conv_6_conv = ret_var.data[g];
73210                 ret_arr_ptr[g] = ret_conv_6_conv;
73211         }
73212         
73213         FREE(ret_var.data);
73214         return ret_arr;
73215 }
73216
73217 void  CS_LDK_PaymentParameters_set_previously_failed_blinded_path_idxs(int64_t this_ptr, int64_tArray val) {
73218         LDKPaymentParameters this_ptr_conv;
73219         this_ptr_conv.inner = untag_ptr(this_ptr);
73220         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73221         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73222         this_ptr_conv.is_owned = false;
73223         LDKCVec_u64Z val_constr;
73224         val_constr.datalen = val->arr_len;
73225         if (val_constr.datalen > 0)
73226                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
73227         else
73228                 val_constr.data = NULL;
73229         int64_t* val_vals = val->elems;
73230         for (size_t g = 0; g < val_constr.datalen; g++) {
73231                 int64_t val_conv_6 = val_vals[g];
73232                 val_constr.data[g] = val_conv_6;
73233         }
73234         FREE(val);
73235         PaymentParameters_set_previously_failed_blinded_path_idxs(&this_ptr_conv, val_constr);
73236 }
73237
73238 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) {
73239         void* payee_arg_ptr = untag_ptr(payee_arg);
73240         CHECK_ACCESS(payee_arg_ptr);
73241         LDKPayee payee_arg_conv = *(LDKPayee*)(payee_arg_ptr);
73242         payee_arg_conv = Payee_clone((LDKPayee*)untag_ptr(payee_arg));
73243         void* expiry_time_arg_ptr = untag_ptr(expiry_time_arg);
73244         CHECK_ACCESS(expiry_time_arg_ptr);
73245         LDKCOption_u64Z expiry_time_arg_conv = *(LDKCOption_u64Z*)(expiry_time_arg_ptr);
73246         expiry_time_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(expiry_time_arg));
73247         LDKCVec_u64Z previously_failed_channels_arg_constr;
73248         previously_failed_channels_arg_constr.datalen = previously_failed_channels_arg->arr_len;
73249         if (previously_failed_channels_arg_constr.datalen > 0)
73250                 previously_failed_channels_arg_constr.data = MALLOC(previously_failed_channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
73251         else
73252                 previously_failed_channels_arg_constr.data = NULL;
73253         int64_t* previously_failed_channels_arg_vals = previously_failed_channels_arg->elems;
73254         for (size_t g = 0; g < previously_failed_channels_arg_constr.datalen; g++) {
73255                 int64_t previously_failed_channels_arg_conv_6 = previously_failed_channels_arg_vals[g];
73256                 previously_failed_channels_arg_constr.data[g] = previously_failed_channels_arg_conv_6;
73257         }
73258         FREE(previously_failed_channels_arg);
73259         LDKCVec_u64Z previously_failed_blinded_path_idxs_arg_constr;
73260         previously_failed_blinded_path_idxs_arg_constr.datalen = previously_failed_blinded_path_idxs_arg->arr_len;
73261         if (previously_failed_blinded_path_idxs_arg_constr.datalen > 0)
73262                 previously_failed_blinded_path_idxs_arg_constr.data = MALLOC(previously_failed_blinded_path_idxs_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
73263         else
73264                 previously_failed_blinded_path_idxs_arg_constr.data = NULL;
73265         int64_t* previously_failed_blinded_path_idxs_arg_vals = previously_failed_blinded_path_idxs_arg->elems;
73266         for (size_t g = 0; g < previously_failed_blinded_path_idxs_arg_constr.datalen; g++) {
73267                 int64_t previously_failed_blinded_path_idxs_arg_conv_6 = previously_failed_blinded_path_idxs_arg_vals[g];
73268                 previously_failed_blinded_path_idxs_arg_constr.data[g] = previously_failed_blinded_path_idxs_arg_conv_6;
73269         }
73270         FREE(previously_failed_blinded_path_idxs_arg);
73271         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);
73272         int64_t ret_ref = 0;
73273         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73274         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73275         return ret_ref;
73276 }
73277
73278 static inline uint64_t PaymentParameters_clone_ptr(LDKPaymentParameters *NONNULL_PTR arg) {
73279         LDKPaymentParameters ret_var = PaymentParameters_clone(arg);
73280         int64_t ret_ref = 0;
73281         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73282         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73283         return ret_ref;
73284 }
73285 int64_t  CS_LDK_PaymentParameters_clone_ptr(int64_t arg) {
73286         LDKPaymentParameters arg_conv;
73287         arg_conv.inner = untag_ptr(arg);
73288         arg_conv.is_owned = ptr_is_owned(arg);
73289         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
73290         arg_conv.is_owned = false;
73291         int64_t ret_conv = PaymentParameters_clone_ptr(&arg_conv);
73292         return ret_conv;
73293 }
73294
73295 int64_t  CS_LDK_PaymentParameters_clone(int64_t orig) {
73296         LDKPaymentParameters orig_conv;
73297         orig_conv.inner = untag_ptr(orig);
73298         orig_conv.is_owned = ptr_is_owned(orig);
73299         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
73300         orig_conv.is_owned = false;
73301         LDKPaymentParameters ret_var = PaymentParameters_clone(&orig_conv);
73302         int64_t ret_ref = 0;
73303         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73304         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73305         return ret_ref;
73306 }
73307
73308 int64_t  CS_LDK_PaymentParameters_hash(int64_t o) {
73309         LDKPaymentParameters o_conv;
73310         o_conv.inner = untag_ptr(o);
73311         o_conv.is_owned = ptr_is_owned(o);
73312         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
73313         o_conv.is_owned = false;
73314         int64_t ret_conv = PaymentParameters_hash(&o_conv);
73315         return ret_conv;
73316 }
73317
73318 jboolean  CS_LDK_PaymentParameters_eq(int64_t a, int64_t b) {
73319         LDKPaymentParameters a_conv;
73320         a_conv.inner = untag_ptr(a);
73321         a_conv.is_owned = ptr_is_owned(a);
73322         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
73323         a_conv.is_owned = false;
73324         LDKPaymentParameters b_conv;
73325         b_conv.inner = untag_ptr(b);
73326         b_conv.is_owned = ptr_is_owned(b);
73327         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
73328         b_conv.is_owned = false;
73329         jboolean ret_conv = PaymentParameters_eq(&a_conv, &b_conv);
73330         return ret_conv;
73331 }
73332
73333 int8_tArray  CS_LDK_PaymentParameters_write(int64_t obj) {
73334         LDKPaymentParameters obj_conv;
73335         obj_conv.inner = untag_ptr(obj);
73336         obj_conv.is_owned = ptr_is_owned(obj);
73337         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
73338         obj_conv.is_owned = false;
73339         LDKCVec_u8Z ret_var = PaymentParameters_write(&obj_conv);
73340         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
73341         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
73342         CVec_u8Z_free(ret_var);
73343         return ret_arr;
73344 }
73345
73346 int64_t  CS_LDK_PaymentParameters_read(int8_tArray ser, int32_t arg) {
73347         LDKu8slice ser_ref;
73348         ser_ref.datalen = ser->arr_len;
73349         ser_ref.data = ser->elems;
73350         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
73351         *ret_conv = PaymentParameters_read(ser_ref, arg);
73352         FREE(ser);
73353         return tag_ptr(ret_conv, true);
73354 }
73355
73356 int64_t  CS_LDK_PaymentParameters_from_node_id(int8_tArray payee_pubkey, int32_t final_cltv_expiry_delta) {
73357         LDKPublicKey payee_pubkey_ref;
73358         CHECK(payee_pubkey->arr_len == 33);
73359         memcpy(payee_pubkey_ref.compressed_form, payee_pubkey->elems, 33); FREE(payee_pubkey);
73360         LDKPaymentParameters ret_var = PaymentParameters_from_node_id(payee_pubkey_ref, final_cltv_expiry_delta);
73361         int64_t ret_ref = 0;
73362         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73363         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73364         return ret_ref;
73365 }
73366
73367 int64_t  CS_LDK_PaymentParameters_for_keysend(int8_tArray payee_pubkey, int32_t final_cltv_expiry_delta, jboolean allow_mpp) {
73368         LDKPublicKey payee_pubkey_ref;
73369         CHECK(payee_pubkey->arr_len == 33);
73370         memcpy(payee_pubkey_ref.compressed_form, payee_pubkey->elems, 33); FREE(payee_pubkey);
73371         LDKPaymentParameters ret_var = PaymentParameters_for_keysend(payee_pubkey_ref, final_cltv_expiry_delta, allow_mpp);
73372         int64_t ret_ref = 0;
73373         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73374         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73375         return ret_ref;
73376 }
73377
73378 int64_t  CS_LDK_PaymentParameters_from_bolt12_invoice(int64_t invoice) {
73379         LDKBolt12Invoice invoice_conv;
73380         invoice_conv.inner = untag_ptr(invoice);
73381         invoice_conv.is_owned = ptr_is_owned(invoice);
73382         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
73383         invoice_conv.is_owned = false;
73384         LDKPaymentParameters ret_var = PaymentParameters_from_bolt12_invoice(&invoice_conv);
73385         int64_t ret_ref = 0;
73386         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73387         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73388         return ret_ref;
73389 }
73390
73391 int64_t  CS_LDK_PaymentParameters_blinded(int64_tArray blinded_route_hints) {
73392         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ blinded_route_hints_constr;
73393         blinded_route_hints_constr.datalen = blinded_route_hints->arr_len;
73394         if (blinded_route_hints_constr.datalen > 0)
73395                 blinded_route_hints_constr.data = MALLOC(blinded_route_hints_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
73396         else
73397                 blinded_route_hints_constr.data = NULL;
73398         int64_t* blinded_route_hints_vals = blinded_route_hints->elems;
73399         for (size_t l = 0; l < blinded_route_hints_constr.datalen; l++) {
73400                 int64_t blinded_route_hints_conv_37 = blinded_route_hints_vals[l];
73401                 void* blinded_route_hints_conv_37_ptr = untag_ptr(blinded_route_hints_conv_37);
73402                 CHECK_ACCESS(blinded_route_hints_conv_37_ptr);
73403                 LDKC2Tuple_BlindedPayInfoBlindedPathZ blinded_route_hints_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(blinded_route_hints_conv_37_ptr);
73404                 blinded_route_hints_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(blinded_route_hints_conv_37));
73405                 blinded_route_hints_constr.data[l] = blinded_route_hints_conv_37_conv;
73406         }
73407         FREE(blinded_route_hints);
73408         LDKPaymentParameters ret_var = PaymentParameters_blinded(blinded_route_hints_constr);
73409         int64_t ret_ref = 0;
73410         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73411         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73412         return ret_ref;
73413 }
73414
73415 void  CS_LDK_Payee_free(int64_t this_ptr) {
73416         if (!ptr_is_owned(this_ptr)) return;
73417         void* this_ptr_ptr = untag_ptr(this_ptr);
73418         CHECK_ACCESS(this_ptr_ptr);
73419         LDKPayee this_ptr_conv = *(LDKPayee*)(this_ptr_ptr);
73420         FREE(untag_ptr(this_ptr));
73421         Payee_free(this_ptr_conv);
73422 }
73423
73424 static inline uint64_t Payee_clone_ptr(LDKPayee *NONNULL_PTR arg) {
73425         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
73426         *ret_copy = Payee_clone(arg);
73427         int64_t ret_ref = tag_ptr(ret_copy, true);
73428         return ret_ref;
73429 }
73430 int64_t  CS_LDK_Payee_clone_ptr(int64_t arg) {
73431         LDKPayee* arg_conv = (LDKPayee*)untag_ptr(arg);
73432         int64_t ret_conv = Payee_clone_ptr(arg_conv);
73433         return ret_conv;
73434 }
73435
73436 int64_t  CS_LDK_Payee_clone(int64_t orig) {
73437         LDKPayee* orig_conv = (LDKPayee*)untag_ptr(orig);
73438         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
73439         *ret_copy = Payee_clone(orig_conv);
73440         int64_t ret_ref = tag_ptr(ret_copy, true);
73441         return ret_ref;
73442 }
73443
73444 int64_t  CS_LDK_Payee_blinded(int64_tArray route_hints, int64_t features) {
73445         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ route_hints_constr;
73446         route_hints_constr.datalen = route_hints->arr_len;
73447         if (route_hints_constr.datalen > 0)
73448                 route_hints_constr.data = MALLOC(route_hints_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
73449         else
73450                 route_hints_constr.data = NULL;
73451         int64_t* route_hints_vals = route_hints->elems;
73452         for (size_t l = 0; l < route_hints_constr.datalen; l++) {
73453                 int64_t route_hints_conv_37 = route_hints_vals[l];
73454                 void* route_hints_conv_37_ptr = untag_ptr(route_hints_conv_37);
73455                 CHECK_ACCESS(route_hints_conv_37_ptr);
73456                 LDKC2Tuple_BlindedPayInfoBlindedPathZ route_hints_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(route_hints_conv_37_ptr);
73457                 route_hints_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(route_hints_conv_37));
73458                 route_hints_constr.data[l] = route_hints_conv_37_conv;
73459         }
73460         FREE(route_hints);
73461         LDKBolt12InvoiceFeatures features_conv;
73462         features_conv.inner = untag_ptr(features);
73463         features_conv.is_owned = ptr_is_owned(features);
73464         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
73465         features_conv = Bolt12InvoiceFeatures_clone(&features_conv);
73466         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
73467         *ret_copy = Payee_blinded(route_hints_constr, features_conv);
73468         int64_t ret_ref = tag_ptr(ret_copy, true);
73469         return ret_ref;
73470 }
73471
73472 int64_t  CS_LDK_Payee_clear(int8_tArray node_id, int64_tArray route_hints, int64_t features, int32_t final_cltv_expiry_delta) {
73473         LDKPublicKey node_id_ref;
73474         CHECK(node_id->arr_len == 33);
73475         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
73476         LDKCVec_RouteHintZ route_hints_constr;
73477         route_hints_constr.datalen = route_hints->arr_len;
73478         if (route_hints_constr.datalen > 0)
73479                 route_hints_constr.data = MALLOC(route_hints_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
73480         else
73481                 route_hints_constr.data = NULL;
73482         int64_t* route_hints_vals = route_hints->elems;
73483         for (size_t l = 0; l < route_hints_constr.datalen; l++) {
73484                 int64_t route_hints_conv_11 = route_hints_vals[l];
73485                 LDKRouteHint route_hints_conv_11_conv;
73486                 route_hints_conv_11_conv.inner = untag_ptr(route_hints_conv_11);
73487                 route_hints_conv_11_conv.is_owned = ptr_is_owned(route_hints_conv_11);
73488                 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_hints_conv_11_conv);
73489                 route_hints_conv_11_conv = RouteHint_clone(&route_hints_conv_11_conv);
73490                 route_hints_constr.data[l] = route_hints_conv_11_conv;
73491         }
73492         FREE(route_hints);
73493         LDKBolt11InvoiceFeatures features_conv;
73494         features_conv.inner = untag_ptr(features);
73495         features_conv.is_owned = ptr_is_owned(features);
73496         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
73497         features_conv = Bolt11InvoiceFeatures_clone(&features_conv);
73498         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
73499         *ret_copy = Payee_clear(node_id_ref, route_hints_constr, features_conv, final_cltv_expiry_delta);
73500         int64_t ret_ref = tag_ptr(ret_copy, true);
73501         return ret_ref;
73502 }
73503
73504 int64_t  CS_LDK_Payee_hash(int64_t o) {
73505         LDKPayee* o_conv = (LDKPayee*)untag_ptr(o);
73506         int64_t ret_conv = Payee_hash(o_conv);
73507         return ret_conv;
73508 }
73509
73510 jboolean  CS_LDK_Payee_eq(int64_t a, int64_t b) {
73511         LDKPayee* a_conv = (LDKPayee*)untag_ptr(a);
73512         LDKPayee* b_conv = (LDKPayee*)untag_ptr(b);
73513         jboolean ret_conv = Payee_eq(a_conv, b_conv);
73514         return ret_conv;
73515 }
73516
73517 void  CS_LDK_RouteHint_free(int64_t this_obj) {
73518         LDKRouteHint this_obj_conv;
73519         this_obj_conv.inner = untag_ptr(this_obj);
73520         this_obj_conv.is_owned = ptr_is_owned(this_obj);
73521         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
73522         RouteHint_free(this_obj_conv);
73523 }
73524
73525 int64_tArray  CS_LDK_RouteHint_get_a(int64_t this_ptr) {
73526         LDKRouteHint this_ptr_conv;
73527         this_ptr_conv.inner = untag_ptr(this_ptr);
73528         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73529         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73530         this_ptr_conv.is_owned = false;
73531         LDKCVec_RouteHintHopZ ret_var = RouteHint_get_a(&this_ptr_conv);
73532         int64_tArray ret_arr = NULL;
73533         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
73534         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
73535         for (size_t o = 0; o < ret_var.datalen; o++) {
73536                 LDKRouteHintHop ret_conv_14_var = ret_var.data[o];
73537                 int64_t ret_conv_14_ref = 0;
73538                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
73539                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
73540                 ret_arr_ptr[o] = ret_conv_14_ref;
73541         }
73542         
73543         FREE(ret_var.data);
73544         return ret_arr;
73545 }
73546
73547 void  CS_LDK_RouteHint_set_a(int64_t this_ptr, int64_tArray val) {
73548         LDKRouteHint this_ptr_conv;
73549         this_ptr_conv.inner = untag_ptr(this_ptr);
73550         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73551         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73552         this_ptr_conv.is_owned = false;
73553         LDKCVec_RouteHintHopZ val_constr;
73554         val_constr.datalen = val->arr_len;
73555         if (val_constr.datalen > 0)
73556                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
73557         else
73558                 val_constr.data = NULL;
73559         int64_t* val_vals = val->elems;
73560         for (size_t o = 0; o < val_constr.datalen; o++) {
73561                 int64_t val_conv_14 = val_vals[o];
73562                 LDKRouteHintHop val_conv_14_conv;
73563                 val_conv_14_conv.inner = untag_ptr(val_conv_14);
73564                 val_conv_14_conv.is_owned = ptr_is_owned(val_conv_14);
73565                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_14_conv);
73566                 val_conv_14_conv = RouteHintHop_clone(&val_conv_14_conv);
73567                 val_constr.data[o] = val_conv_14_conv;
73568         }
73569         FREE(val);
73570         RouteHint_set_a(&this_ptr_conv, val_constr);
73571 }
73572
73573 int64_t  CS_LDK_RouteHint_new(int64_tArray a_arg) {
73574         LDKCVec_RouteHintHopZ a_arg_constr;
73575         a_arg_constr.datalen = a_arg->arr_len;
73576         if (a_arg_constr.datalen > 0)
73577                 a_arg_constr.data = MALLOC(a_arg_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
73578         else
73579                 a_arg_constr.data = NULL;
73580         int64_t* a_arg_vals = a_arg->elems;
73581         for (size_t o = 0; o < a_arg_constr.datalen; o++) {
73582                 int64_t a_arg_conv_14 = a_arg_vals[o];
73583                 LDKRouteHintHop a_arg_conv_14_conv;
73584                 a_arg_conv_14_conv.inner = untag_ptr(a_arg_conv_14);
73585                 a_arg_conv_14_conv.is_owned = ptr_is_owned(a_arg_conv_14);
73586                 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_arg_conv_14_conv);
73587                 a_arg_conv_14_conv = RouteHintHop_clone(&a_arg_conv_14_conv);
73588                 a_arg_constr.data[o] = a_arg_conv_14_conv;
73589         }
73590         FREE(a_arg);
73591         LDKRouteHint ret_var = RouteHint_new(a_arg_constr);
73592         int64_t ret_ref = 0;
73593         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73594         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73595         return ret_ref;
73596 }
73597
73598 static inline uint64_t RouteHint_clone_ptr(LDKRouteHint *NONNULL_PTR arg) {
73599         LDKRouteHint ret_var = RouteHint_clone(arg);
73600         int64_t ret_ref = 0;
73601         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73602         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73603         return ret_ref;
73604 }
73605 int64_t  CS_LDK_RouteHint_clone_ptr(int64_t arg) {
73606         LDKRouteHint arg_conv;
73607         arg_conv.inner = untag_ptr(arg);
73608         arg_conv.is_owned = ptr_is_owned(arg);
73609         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
73610         arg_conv.is_owned = false;
73611         int64_t ret_conv = RouteHint_clone_ptr(&arg_conv);
73612         return ret_conv;
73613 }
73614
73615 int64_t  CS_LDK_RouteHint_clone(int64_t orig) {
73616         LDKRouteHint orig_conv;
73617         orig_conv.inner = untag_ptr(orig);
73618         orig_conv.is_owned = ptr_is_owned(orig);
73619         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
73620         orig_conv.is_owned = false;
73621         LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
73622         int64_t ret_ref = 0;
73623         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73624         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73625         return ret_ref;
73626 }
73627
73628 int64_t  CS_LDK_RouteHint_hash(int64_t o) {
73629         LDKRouteHint o_conv;
73630         o_conv.inner = untag_ptr(o);
73631         o_conv.is_owned = ptr_is_owned(o);
73632         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
73633         o_conv.is_owned = false;
73634         int64_t ret_conv = RouteHint_hash(&o_conv);
73635         return ret_conv;
73636 }
73637
73638 jboolean  CS_LDK_RouteHint_eq(int64_t a, int64_t b) {
73639         LDKRouteHint a_conv;
73640         a_conv.inner = untag_ptr(a);
73641         a_conv.is_owned = ptr_is_owned(a);
73642         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
73643         a_conv.is_owned = false;
73644         LDKRouteHint b_conv;
73645         b_conv.inner = untag_ptr(b);
73646         b_conv.is_owned = ptr_is_owned(b);
73647         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
73648         b_conv.is_owned = false;
73649         jboolean ret_conv = RouteHint_eq(&a_conv, &b_conv);
73650         return ret_conv;
73651 }
73652
73653 int8_tArray  CS_LDK_RouteHint_write(int64_t obj) {
73654         LDKRouteHint obj_conv;
73655         obj_conv.inner = untag_ptr(obj);
73656         obj_conv.is_owned = ptr_is_owned(obj);
73657         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
73658         obj_conv.is_owned = false;
73659         LDKCVec_u8Z ret_var = RouteHint_write(&obj_conv);
73660         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
73661         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
73662         CVec_u8Z_free(ret_var);
73663         return ret_arr;
73664 }
73665
73666 int64_t  CS_LDK_RouteHint_read(int8_tArray ser) {
73667         LDKu8slice ser_ref;
73668         ser_ref.datalen = ser->arr_len;
73669         ser_ref.data = ser->elems;
73670         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
73671         *ret_conv = RouteHint_read(ser_ref);
73672         FREE(ser);
73673         return tag_ptr(ret_conv, true);
73674 }
73675
73676 void  CS_LDK_RouteHintHop_free(int64_t this_obj) {
73677         LDKRouteHintHop this_obj_conv;
73678         this_obj_conv.inner = untag_ptr(this_obj);
73679         this_obj_conv.is_owned = ptr_is_owned(this_obj);
73680         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
73681         RouteHintHop_free(this_obj_conv);
73682 }
73683
73684 int8_tArray  CS_LDK_RouteHintHop_get_src_node_id(int64_t this_ptr) {
73685         LDKRouteHintHop this_ptr_conv;
73686         this_ptr_conv.inner = untag_ptr(this_ptr);
73687         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73688         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73689         this_ptr_conv.is_owned = false;
73690         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
73691         memcpy(ret_arr->elems, RouteHintHop_get_src_node_id(&this_ptr_conv).compressed_form, 33);
73692         return ret_arr;
73693 }
73694
73695 void  CS_LDK_RouteHintHop_set_src_node_id(int64_t this_ptr, int8_tArray val) {
73696         LDKRouteHintHop this_ptr_conv;
73697         this_ptr_conv.inner = untag_ptr(this_ptr);
73698         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73699         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73700         this_ptr_conv.is_owned = false;
73701         LDKPublicKey val_ref;
73702         CHECK(val->arr_len == 33);
73703         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
73704         RouteHintHop_set_src_node_id(&this_ptr_conv, val_ref);
73705 }
73706
73707 int64_t  CS_LDK_RouteHintHop_get_short_channel_id(int64_t this_ptr) {
73708         LDKRouteHintHop this_ptr_conv;
73709         this_ptr_conv.inner = untag_ptr(this_ptr);
73710         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73711         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73712         this_ptr_conv.is_owned = false;
73713         int64_t ret_conv = RouteHintHop_get_short_channel_id(&this_ptr_conv);
73714         return ret_conv;
73715 }
73716
73717 void  CS_LDK_RouteHintHop_set_short_channel_id(int64_t this_ptr, int64_t val) {
73718         LDKRouteHintHop this_ptr_conv;
73719         this_ptr_conv.inner = untag_ptr(this_ptr);
73720         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73721         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73722         this_ptr_conv.is_owned = false;
73723         RouteHintHop_set_short_channel_id(&this_ptr_conv, val);
73724 }
73725
73726 int64_t  CS_LDK_RouteHintHop_get_fees(int64_t this_ptr) {
73727         LDKRouteHintHop this_ptr_conv;
73728         this_ptr_conv.inner = untag_ptr(this_ptr);
73729         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73730         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73731         this_ptr_conv.is_owned = false;
73732         LDKRoutingFees ret_var = RouteHintHop_get_fees(&this_ptr_conv);
73733         int64_t ret_ref = 0;
73734         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73735         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73736         return ret_ref;
73737 }
73738
73739 void  CS_LDK_RouteHintHop_set_fees(int64_t this_ptr, int64_t val) {
73740         LDKRouteHintHop this_ptr_conv;
73741         this_ptr_conv.inner = untag_ptr(this_ptr);
73742         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73743         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73744         this_ptr_conv.is_owned = false;
73745         LDKRoutingFees val_conv;
73746         val_conv.inner = untag_ptr(val);
73747         val_conv.is_owned = ptr_is_owned(val);
73748         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
73749         val_conv = RoutingFees_clone(&val_conv);
73750         RouteHintHop_set_fees(&this_ptr_conv, val_conv);
73751 }
73752
73753 int16_t  CS_LDK_RouteHintHop_get_cltv_expiry_delta(int64_t this_ptr) {
73754         LDKRouteHintHop this_ptr_conv;
73755         this_ptr_conv.inner = untag_ptr(this_ptr);
73756         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73757         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73758         this_ptr_conv.is_owned = false;
73759         int16_t ret_conv = RouteHintHop_get_cltv_expiry_delta(&this_ptr_conv);
73760         return ret_conv;
73761 }
73762
73763 void  CS_LDK_RouteHintHop_set_cltv_expiry_delta(int64_t this_ptr, int16_t val) {
73764         LDKRouteHintHop this_ptr_conv;
73765         this_ptr_conv.inner = untag_ptr(this_ptr);
73766         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73767         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73768         this_ptr_conv.is_owned = false;
73769         RouteHintHop_set_cltv_expiry_delta(&this_ptr_conv, val);
73770 }
73771
73772 int64_t  CS_LDK_RouteHintHop_get_htlc_minimum_msat(int64_t this_ptr) {
73773         LDKRouteHintHop this_ptr_conv;
73774         this_ptr_conv.inner = untag_ptr(this_ptr);
73775         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73776         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73777         this_ptr_conv.is_owned = false;
73778         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
73779         *ret_copy = RouteHintHop_get_htlc_minimum_msat(&this_ptr_conv);
73780         int64_t ret_ref = tag_ptr(ret_copy, true);
73781         return ret_ref;
73782 }
73783
73784 void  CS_LDK_RouteHintHop_set_htlc_minimum_msat(int64_t this_ptr, int64_t val) {
73785         LDKRouteHintHop this_ptr_conv;
73786         this_ptr_conv.inner = untag_ptr(this_ptr);
73787         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73788         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73789         this_ptr_conv.is_owned = false;
73790         void* val_ptr = untag_ptr(val);
73791         CHECK_ACCESS(val_ptr);
73792         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
73793         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
73794         RouteHintHop_set_htlc_minimum_msat(&this_ptr_conv, val_conv);
73795 }
73796
73797 int64_t  CS_LDK_RouteHintHop_get_htlc_maximum_msat(int64_t this_ptr) {
73798         LDKRouteHintHop this_ptr_conv;
73799         this_ptr_conv.inner = untag_ptr(this_ptr);
73800         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73801         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73802         this_ptr_conv.is_owned = false;
73803         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
73804         *ret_copy = RouteHintHop_get_htlc_maximum_msat(&this_ptr_conv);
73805         int64_t ret_ref = tag_ptr(ret_copy, true);
73806         return ret_ref;
73807 }
73808
73809 void  CS_LDK_RouteHintHop_set_htlc_maximum_msat(int64_t this_ptr, int64_t val) {
73810         LDKRouteHintHop this_ptr_conv;
73811         this_ptr_conv.inner = untag_ptr(this_ptr);
73812         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73813         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73814         this_ptr_conv.is_owned = false;
73815         void* val_ptr = untag_ptr(val);
73816         CHECK_ACCESS(val_ptr);
73817         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
73818         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
73819         RouteHintHop_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
73820 }
73821
73822 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) {
73823         LDKPublicKey src_node_id_arg_ref;
73824         CHECK(src_node_id_arg->arr_len == 33);
73825         memcpy(src_node_id_arg_ref.compressed_form, src_node_id_arg->elems, 33); FREE(src_node_id_arg);
73826         LDKRoutingFees fees_arg_conv;
73827         fees_arg_conv.inner = untag_ptr(fees_arg);
73828         fees_arg_conv.is_owned = ptr_is_owned(fees_arg);
73829         CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
73830         fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
73831         void* htlc_minimum_msat_arg_ptr = untag_ptr(htlc_minimum_msat_arg);
73832         CHECK_ACCESS(htlc_minimum_msat_arg_ptr);
73833         LDKCOption_u64Z htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_minimum_msat_arg_ptr);
73834         htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(htlc_minimum_msat_arg));
73835         void* htlc_maximum_msat_arg_ptr = untag_ptr(htlc_maximum_msat_arg);
73836         CHECK_ACCESS(htlc_maximum_msat_arg_ptr);
73837         LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_arg_ptr);
73838         htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(htlc_maximum_msat_arg));
73839         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);
73840         int64_t ret_ref = 0;
73841         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73842         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73843         return ret_ref;
73844 }
73845
73846 static inline uint64_t RouteHintHop_clone_ptr(LDKRouteHintHop *NONNULL_PTR arg) {
73847         LDKRouteHintHop ret_var = RouteHintHop_clone(arg);
73848         int64_t ret_ref = 0;
73849         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73850         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73851         return ret_ref;
73852 }
73853 int64_t  CS_LDK_RouteHintHop_clone_ptr(int64_t arg) {
73854         LDKRouteHintHop arg_conv;
73855         arg_conv.inner = untag_ptr(arg);
73856         arg_conv.is_owned = ptr_is_owned(arg);
73857         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
73858         arg_conv.is_owned = false;
73859         int64_t ret_conv = RouteHintHop_clone_ptr(&arg_conv);
73860         return ret_conv;
73861 }
73862
73863 int64_t  CS_LDK_RouteHintHop_clone(int64_t orig) {
73864         LDKRouteHintHop orig_conv;
73865         orig_conv.inner = untag_ptr(orig);
73866         orig_conv.is_owned = ptr_is_owned(orig);
73867         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
73868         orig_conv.is_owned = false;
73869         LDKRouteHintHop ret_var = RouteHintHop_clone(&orig_conv);
73870         int64_t ret_ref = 0;
73871         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73872         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73873         return ret_ref;
73874 }
73875
73876 int64_t  CS_LDK_RouteHintHop_hash(int64_t o) {
73877         LDKRouteHintHop o_conv;
73878         o_conv.inner = untag_ptr(o);
73879         o_conv.is_owned = ptr_is_owned(o);
73880         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
73881         o_conv.is_owned = false;
73882         int64_t ret_conv = RouteHintHop_hash(&o_conv);
73883         return ret_conv;
73884 }
73885
73886 jboolean  CS_LDK_RouteHintHop_eq(int64_t a, int64_t b) {
73887         LDKRouteHintHop a_conv;
73888         a_conv.inner = untag_ptr(a);
73889         a_conv.is_owned = ptr_is_owned(a);
73890         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
73891         a_conv.is_owned = false;
73892         LDKRouteHintHop b_conv;
73893         b_conv.inner = untag_ptr(b);
73894         b_conv.is_owned = ptr_is_owned(b);
73895         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
73896         b_conv.is_owned = false;
73897         jboolean ret_conv = RouteHintHop_eq(&a_conv, &b_conv);
73898         return ret_conv;
73899 }
73900
73901 int8_tArray  CS_LDK_RouteHintHop_write(int64_t obj) {
73902         LDKRouteHintHop obj_conv;
73903         obj_conv.inner = untag_ptr(obj);
73904         obj_conv.is_owned = ptr_is_owned(obj);
73905         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
73906         obj_conv.is_owned = false;
73907         LDKCVec_u8Z ret_var = RouteHintHop_write(&obj_conv);
73908         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
73909         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
73910         CVec_u8Z_free(ret_var);
73911         return ret_arr;
73912 }
73913
73914 int64_t  CS_LDK_RouteHintHop_read(int8_tArray ser) {
73915         LDKu8slice ser_ref;
73916         ser_ref.datalen = ser->arr_len;
73917         ser_ref.data = ser->elems;
73918         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
73919         *ret_conv = RouteHintHop_read(ser_ref);
73920         FREE(ser);
73921         return tag_ptr(ret_conv, true);
73922 }
73923
73924 void  CS_LDK_FirstHopCandidate_free(int64_t this_obj) {
73925         LDKFirstHopCandidate this_obj_conv;
73926         this_obj_conv.inner = untag_ptr(this_obj);
73927         this_obj_conv.is_owned = ptr_is_owned(this_obj);
73928         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
73929         FirstHopCandidate_free(this_obj_conv);
73930 }
73931
73932 static inline uint64_t FirstHopCandidate_clone_ptr(LDKFirstHopCandidate *NONNULL_PTR arg) {
73933         LDKFirstHopCandidate ret_var = FirstHopCandidate_clone(arg);
73934         int64_t ret_ref = 0;
73935         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73936         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73937         return ret_ref;
73938 }
73939 int64_t  CS_LDK_FirstHopCandidate_clone_ptr(int64_t arg) {
73940         LDKFirstHopCandidate arg_conv;
73941         arg_conv.inner = untag_ptr(arg);
73942         arg_conv.is_owned = ptr_is_owned(arg);
73943         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
73944         arg_conv.is_owned = false;
73945         int64_t ret_conv = FirstHopCandidate_clone_ptr(&arg_conv);
73946         return ret_conv;
73947 }
73948
73949 int64_t  CS_LDK_FirstHopCandidate_clone(int64_t orig) {
73950         LDKFirstHopCandidate orig_conv;
73951         orig_conv.inner = untag_ptr(orig);
73952         orig_conv.is_owned = ptr_is_owned(orig);
73953         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
73954         orig_conv.is_owned = false;
73955         LDKFirstHopCandidate ret_var = FirstHopCandidate_clone(&orig_conv);
73956         int64_t ret_ref = 0;
73957         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73958         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73959         return ret_ref;
73960 }
73961
73962 void  CS_LDK_PublicHopCandidate_free(int64_t this_obj) {
73963         LDKPublicHopCandidate this_obj_conv;
73964         this_obj_conv.inner = untag_ptr(this_obj);
73965         this_obj_conv.is_owned = ptr_is_owned(this_obj);
73966         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
73967         PublicHopCandidate_free(this_obj_conv);
73968 }
73969
73970 int64_t  CS_LDK_PublicHopCandidate_get_short_channel_id(int64_t this_ptr) {
73971         LDKPublicHopCandidate this_ptr_conv;
73972         this_ptr_conv.inner = untag_ptr(this_ptr);
73973         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73974         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73975         this_ptr_conv.is_owned = false;
73976         int64_t ret_conv = PublicHopCandidate_get_short_channel_id(&this_ptr_conv);
73977         return ret_conv;
73978 }
73979
73980 void  CS_LDK_PublicHopCandidate_set_short_channel_id(int64_t this_ptr, int64_t val) {
73981         LDKPublicHopCandidate this_ptr_conv;
73982         this_ptr_conv.inner = untag_ptr(this_ptr);
73983         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
73984         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
73985         this_ptr_conv.is_owned = false;
73986         PublicHopCandidate_set_short_channel_id(&this_ptr_conv, val);
73987 }
73988
73989 static inline uint64_t PublicHopCandidate_clone_ptr(LDKPublicHopCandidate *NONNULL_PTR arg) {
73990         LDKPublicHopCandidate ret_var = PublicHopCandidate_clone(arg);
73991         int64_t ret_ref = 0;
73992         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73993         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73994         return ret_ref;
73995 }
73996 int64_t  CS_LDK_PublicHopCandidate_clone_ptr(int64_t arg) {
73997         LDKPublicHopCandidate arg_conv;
73998         arg_conv.inner = untag_ptr(arg);
73999         arg_conv.is_owned = ptr_is_owned(arg);
74000         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
74001         arg_conv.is_owned = false;
74002         int64_t ret_conv = PublicHopCandidate_clone_ptr(&arg_conv);
74003         return ret_conv;
74004 }
74005
74006 int64_t  CS_LDK_PublicHopCandidate_clone(int64_t orig) {
74007         LDKPublicHopCandidate orig_conv;
74008         orig_conv.inner = untag_ptr(orig);
74009         orig_conv.is_owned = ptr_is_owned(orig);
74010         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
74011         orig_conv.is_owned = false;
74012         LDKPublicHopCandidate ret_var = PublicHopCandidate_clone(&orig_conv);
74013         int64_t ret_ref = 0;
74014         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74015         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74016         return ret_ref;
74017 }
74018
74019 void  CS_LDK_PrivateHopCandidate_free(int64_t this_obj) {
74020         LDKPrivateHopCandidate this_obj_conv;
74021         this_obj_conv.inner = untag_ptr(this_obj);
74022         this_obj_conv.is_owned = ptr_is_owned(this_obj);
74023         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
74024         PrivateHopCandidate_free(this_obj_conv);
74025 }
74026
74027 static inline uint64_t PrivateHopCandidate_clone_ptr(LDKPrivateHopCandidate *NONNULL_PTR arg) {
74028         LDKPrivateHopCandidate ret_var = PrivateHopCandidate_clone(arg);
74029         int64_t ret_ref = 0;
74030         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74031         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74032         return ret_ref;
74033 }
74034 int64_t  CS_LDK_PrivateHopCandidate_clone_ptr(int64_t arg) {
74035         LDKPrivateHopCandidate arg_conv;
74036         arg_conv.inner = untag_ptr(arg);
74037         arg_conv.is_owned = ptr_is_owned(arg);
74038         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
74039         arg_conv.is_owned = false;
74040         int64_t ret_conv = PrivateHopCandidate_clone_ptr(&arg_conv);
74041         return ret_conv;
74042 }
74043
74044 int64_t  CS_LDK_PrivateHopCandidate_clone(int64_t orig) {
74045         LDKPrivateHopCandidate orig_conv;
74046         orig_conv.inner = untag_ptr(orig);
74047         orig_conv.is_owned = ptr_is_owned(orig);
74048         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
74049         orig_conv.is_owned = false;
74050         LDKPrivateHopCandidate ret_var = PrivateHopCandidate_clone(&orig_conv);
74051         int64_t ret_ref = 0;
74052         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74053         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74054         return ret_ref;
74055 }
74056
74057 void  CS_LDK_BlindedPathCandidate_free(int64_t this_obj) {
74058         LDKBlindedPathCandidate this_obj_conv;
74059         this_obj_conv.inner = untag_ptr(this_obj);
74060         this_obj_conv.is_owned = ptr_is_owned(this_obj);
74061         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
74062         BlindedPathCandidate_free(this_obj_conv);
74063 }
74064
74065 static inline uint64_t BlindedPathCandidate_clone_ptr(LDKBlindedPathCandidate *NONNULL_PTR arg) {
74066         LDKBlindedPathCandidate ret_var = BlindedPathCandidate_clone(arg);
74067         int64_t ret_ref = 0;
74068         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74069         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74070         return ret_ref;
74071 }
74072 int64_t  CS_LDK_BlindedPathCandidate_clone_ptr(int64_t arg) {
74073         LDKBlindedPathCandidate arg_conv;
74074         arg_conv.inner = untag_ptr(arg);
74075         arg_conv.is_owned = ptr_is_owned(arg);
74076         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
74077         arg_conv.is_owned = false;
74078         int64_t ret_conv = BlindedPathCandidate_clone_ptr(&arg_conv);
74079         return ret_conv;
74080 }
74081
74082 int64_t  CS_LDK_BlindedPathCandidate_clone(int64_t orig) {
74083         LDKBlindedPathCandidate orig_conv;
74084         orig_conv.inner = untag_ptr(orig);
74085         orig_conv.is_owned = ptr_is_owned(orig);
74086         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
74087         orig_conv.is_owned = false;
74088         LDKBlindedPathCandidate ret_var = BlindedPathCandidate_clone(&orig_conv);
74089         int64_t ret_ref = 0;
74090         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74091         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74092         return ret_ref;
74093 }
74094
74095 void  CS_LDK_OneHopBlindedPathCandidate_free(int64_t this_obj) {
74096         LDKOneHopBlindedPathCandidate this_obj_conv;
74097         this_obj_conv.inner = untag_ptr(this_obj);
74098         this_obj_conv.is_owned = ptr_is_owned(this_obj);
74099         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
74100         OneHopBlindedPathCandidate_free(this_obj_conv);
74101 }
74102
74103 static inline uint64_t OneHopBlindedPathCandidate_clone_ptr(LDKOneHopBlindedPathCandidate *NONNULL_PTR arg) {
74104         LDKOneHopBlindedPathCandidate ret_var = OneHopBlindedPathCandidate_clone(arg);
74105         int64_t ret_ref = 0;
74106         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74107         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74108         return ret_ref;
74109 }
74110 int64_t  CS_LDK_OneHopBlindedPathCandidate_clone_ptr(int64_t arg) {
74111         LDKOneHopBlindedPathCandidate arg_conv;
74112         arg_conv.inner = untag_ptr(arg);
74113         arg_conv.is_owned = ptr_is_owned(arg);
74114         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
74115         arg_conv.is_owned = false;
74116         int64_t ret_conv = OneHopBlindedPathCandidate_clone_ptr(&arg_conv);
74117         return ret_conv;
74118 }
74119
74120 int64_t  CS_LDK_OneHopBlindedPathCandidate_clone(int64_t orig) {
74121         LDKOneHopBlindedPathCandidate orig_conv;
74122         orig_conv.inner = untag_ptr(orig);
74123         orig_conv.is_owned = ptr_is_owned(orig);
74124         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
74125         orig_conv.is_owned = false;
74126         LDKOneHopBlindedPathCandidate ret_var = OneHopBlindedPathCandidate_clone(&orig_conv);
74127         int64_t ret_ref = 0;
74128         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74129         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74130         return ret_ref;
74131 }
74132
74133 void  CS_LDK_CandidateRouteHop_free(int64_t this_ptr) {
74134         if (!ptr_is_owned(this_ptr)) return;
74135         void* this_ptr_ptr = untag_ptr(this_ptr);
74136         CHECK_ACCESS(this_ptr_ptr);
74137         LDKCandidateRouteHop this_ptr_conv = *(LDKCandidateRouteHop*)(this_ptr_ptr);
74138         FREE(untag_ptr(this_ptr));
74139         CandidateRouteHop_free(this_ptr_conv);
74140 }
74141
74142 static inline uint64_t CandidateRouteHop_clone_ptr(LDKCandidateRouteHop *NONNULL_PTR arg) {
74143         LDKCandidateRouteHop *ret_copy = MALLOC(sizeof(LDKCandidateRouteHop), "LDKCandidateRouteHop");
74144         *ret_copy = CandidateRouteHop_clone(arg);
74145         int64_t ret_ref = tag_ptr(ret_copy, true);
74146         return ret_ref;
74147 }
74148 int64_t  CS_LDK_CandidateRouteHop_clone_ptr(int64_t arg) {
74149         LDKCandidateRouteHop* arg_conv = (LDKCandidateRouteHop*)untag_ptr(arg);
74150         int64_t ret_conv = CandidateRouteHop_clone_ptr(arg_conv);
74151         return ret_conv;
74152 }
74153
74154 int64_t  CS_LDK_CandidateRouteHop_clone(int64_t orig) {
74155         LDKCandidateRouteHop* orig_conv = (LDKCandidateRouteHop*)untag_ptr(orig);
74156         LDKCandidateRouteHop *ret_copy = MALLOC(sizeof(LDKCandidateRouteHop), "LDKCandidateRouteHop");
74157         *ret_copy = CandidateRouteHop_clone(orig_conv);
74158         int64_t ret_ref = tag_ptr(ret_copy, true);
74159         return ret_ref;
74160 }
74161
74162 int64_t  CS_LDK_CandidateRouteHop_first_hop(int64_t a) {
74163         LDKFirstHopCandidate a_conv;
74164         a_conv.inner = untag_ptr(a);
74165         a_conv.is_owned = ptr_is_owned(a);
74166         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
74167         a_conv = FirstHopCandidate_clone(&a_conv);
74168         LDKCandidateRouteHop *ret_copy = MALLOC(sizeof(LDKCandidateRouteHop), "LDKCandidateRouteHop");
74169         *ret_copy = CandidateRouteHop_first_hop(a_conv);
74170         int64_t ret_ref = tag_ptr(ret_copy, true);
74171         return ret_ref;
74172 }
74173
74174 int64_t  CS_LDK_CandidateRouteHop_public_hop(int64_t a) {
74175         LDKPublicHopCandidate a_conv;
74176         a_conv.inner = untag_ptr(a);
74177         a_conv.is_owned = ptr_is_owned(a);
74178         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
74179         a_conv = PublicHopCandidate_clone(&a_conv);
74180         LDKCandidateRouteHop *ret_copy = MALLOC(sizeof(LDKCandidateRouteHop), "LDKCandidateRouteHop");
74181         *ret_copy = CandidateRouteHop_public_hop(a_conv);
74182         int64_t ret_ref = tag_ptr(ret_copy, true);
74183         return ret_ref;
74184 }
74185
74186 int64_t  CS_LDK_CandidateRouteHop_private_hop(int64_t a) {
74187         LDKPrivateHopCandidate a_conv;
74188         a_conv.inner = untag_ptr(a);
74189         a_conv.is_owned = ptr_is_owned(a);
74190         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
74191         a_conv = PrivateHopCandidate_clone(&a_conv);
74192         LDKCandidateRouteHop *ret_copy = MALLOC(sizeof(LDKCandidateRouteHop), "LDKCandidateRouteHop");
74193         *ret_copy = CandidateRouteHop_private_hop(a_conv);
74194         int64_t ret_ref = tag_ptr(ret_copy, true);
74195         return ret_ref;
74196 }
74197
74198 int64_t  CS_LDK_CandidateRouteHop_blinded(int64_t a) {
74199         LDKBlindedPathCandidate a_conv;
74200         a_conv.inner = untag_ptr(a);
74201         a_conv.is_owned = ptr_is_owned(a);
74202         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
74203         a_conv = BlindedPathCandidate_clone(&a_conv);
74204         LDKCandidateRouteHop *ret_copy = MALLOC(sizeof(LDKCandidateRouteHop), "LDKCandidateRouteHop");
74205         *ret_copy = CandidateRouteHop_blinded(a_conv);
74206         int64_t ret_ref = tag_ptr(ret_copy, true);
74207         return ret_ref;
74208 }
74209
74210 int64_t  CS_LDK_CandidateRouteHop_one_hop_blinded(int64_t a) {
74211         LDKOneHopBlindedPathCandidate a_conv;
74212         a_conv.inner = untag_ptr(a);
74213         a_conv.is_owned = ptr_is_owned(a);
74214         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
74215         a_conv = OneHopBlindedPathCandidate_clone(&a_conv);
74216         LDKCandidateRouteHop *ret_copy = MALLOC(sizeof(LDKCandidateRouteHop), "LDKCandidateRouteHop");
74217         *ret_copy = CandidateRouteHop_one_hop_blinded(a_conv);
74218         int64_t ret_ref = tag_ptr(ret_copy, true);
74219         return ret_ref;
74220 }
74221
74222 int64_t  CS_LDK_CandidateRouteHop_globally_unique_short_channel_id(int64_t this_arg) {
74223         LDKCandidateRouteHop* this_arg_conv = (LDKCandidateRouteHop*)untag_ptr(this_arg);
74224         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
74225         *ret_copy = CandidateRouteHop_globally_unique_short_channel_id(this_arg_conv);
74226         int64_t ret_ref = tag_ptr(ret_copy, true);
74227         return ret_ref;
74228 }
74229
74230 int32_t  CS_LDK_CandidateRouteHop_cltv_expiry_delta(int64_t this_arg) {
74231         LDKCandidateRouteHop* this_arg_conv = (LDKCandidateRouteHop*)untag_ptr(this_arg);
74232         int32_t ret_conv = CandidateRouteHop_cltv_expiry_delta(this_arg_conv);
74233         return ret_conv;
74234 }
74235
74236 int64_t  CS_LDK_CandidateRouteHop_htlc_minimum_msat(int64_t this_arg) {
74237         LDKCandidateRouteHop* this_arg_conv = (LDKCandidateRouteHop*)untag_ptr(this_arg);
74238         int64_t ret_conv = CandidateRouteHop_htlc_minimum_msat(this_arg_conv);
74239         return ret_conv;
74240 }
74241
74242 int64_t  CS_LDK_CandidateRouteHop_fees(int64_t this_arg) {
74243         LDKCandidateRouteHop* this_arg_conv = (LDKCandidateRouteHop*)untag_ptr(this_arg);
74244         LDKRoutingFees ret_var = CandidateRouteHop_fees(this_arg_conv);
74245         int64_t ret_ref = 0;
74246         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74247         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74248         return ret_ref;
74249 }
74250
74251 int64_t  CS_LDK_CandidateRouteHop_source(int64_t this_arg) {
74252         LDKCandidateRouteHop* this_arg_conv = (LDKCandidateRouteHop*)untag_ptr(this_arg);
74253         LDKNodeId ret_var = CandidateRouteHop_source(this_arg_conv);
74254         int64_t ret_ref = 0;
74255         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74256         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74257         return ret_ref;
74258 }
74259
74260 int64_t  CS_LDK_CandidateRouteHop_target(int64_t this_arg) {
74261         LDKCandidateRouteHop* this_arg_conv = (LDKCandidateRouteHop*)untag_ptr(this_arg);
74262         LDKNodeId ret_var = CandidateRouteHop_target(this_arg_conv);
74263         int64_t ret_ref = 0;
74264         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74265         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74266         return ret_ref;
74267 }
74268
74269 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) {
74270         LDKPublicKey our_node_pubkey_ref;
74271         CHECK(our_node_pubkey->arr_len == 33);
74272         memcpy(our_node_pubkey_ref.compressed_form, our_node_pubkey->elems, 33); FREE(our_node_pubkey);
74273         LDKRouteParameters route_params_conv;
74274         route_params_conv.inner = untag_ptr(route_params);
74275         route_params_conv.is_owned = ptr_is_owned(route_params);
74276         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
74277         route_params_conv.is_owned = false;
74278         LDKNetworkGraph network_graph_conv;
74279         network_graph_conv.inner = untag_ptr(network_graph);
74280         network_graph_conv.is_owned = ptr_is_owned(network_graph);
74281         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
74282         network_graph_conv.is_owned = false;
74283         LDKCVec_ChannelDetailsZ first_hops_constr;
74284         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
74285         if (first_hops != NULL) {
74286                 first_hops_constr.datalen = first_hops->arr_len;
74287                 if (first_hops_constr.datalen > 0)
74288                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
74289                 else
74290                         first_hops_constr.data = NULL;
74291                 int64_t* first_hops_vals = first_hops->elems;
74292                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
74293                         int64_t first_hops_conv_16 = first_hops_vals[q];
74294                         LDKChannelDetails first_hops_conv_16_conv;
74295                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
74296                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
74297                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
74298                         first_hops_conv_16_conv.is_owned = false;
74299                         first_hops_constr.data[q] = first_hops_conv_16_conv;
74300                 }
74301                 FREE(first_hops);
74302                 first_hops_ptr = &first_hops_constr;
74303         }
74304         void* logger_ptr = untag_ptr(logger);
74305         CHECK_ACCESS(logger_ptr);
74306         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
74307         if (logger_conv.free == LDKLogger_JCalls_free) {
74308                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
74309                 LDKLogger_JCalls_cloned(&logger_conv);
74310         }
74311         void* scorer_ptr = untag_ptr(scorer);
74312         if (ptr_is_owned(scorer)) { CHECK_ACCESS(scorer_ptr); }
74313         LDKScoreLookUp* scorer_conv = (LDKScoreLookUp*)scorer_ptr;
74314         LDKProbabilisticScoringFeeParameters score_params_conv;
74315         score_params_conv.inner = untag_ptr(score_params);
74316         score_params_conv.is_owned = ptr_is_owned(score_params);
74317         CHECK_INNER_FIELD_ACCESS_OR_NULL(score_params_conv);
74318         score_params_conv.is_owned = false;
74319         uint8_t random_seed_bytes_arr[32];
74320         CHECK(random_seed_bytes->arr_len == 32);
74321         memcpy(random_seed_bytes_arr, random_seed_bytes->elems, 32); FREE(random_seed_bytes);
74322         uint8_t (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr;
74323         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
74324         *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);
74325         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
74326         return tag_ptr(ret_conv, true);
74327 }
74328
74329 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) {
74330         LDKPublicKey our_node_pubkey_ref;
74331         CHECK(our_node_pubkey->arr_len == 33);
74332         memcpy(our_node_pubkey_ref.compressed_form, our_node_pubkey->elems, 33); FREE(our_node_pubkey);
74333         LDKCVec_PublicKeyZ hops_constr;
74334         hops_constr.datalen = hops->arr_len;
74335         if (hops_constr.datalen > 0)
74336                 hops_constr.data = MALLOC(hops_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
74337         else
74338                 hops_constr.data = NULL;
74339         int8_tArray* hops_vals = (void*) hops->elems;
74340         for (size_t i = 0; i < hops_constr.datalen; i++) {
74341                 int8_tArray hops_conv_8 = hops_vals[i];
74342                 LDKPublicKey hops_conv_8_ref;
74343                 CHECK(hops_conv_8->arr_len == 33);
74344                 memcpy(hops_conv_8_ref.compressed_form, hops_conv_8->elems, 33); FREE(hops_conv_8);
74345                 hops_constr.data[i] = hops_conv_8_ref;
74346         }
74347         FREE(hops);
74348         LDKRouteParameters route_params_conv;
74349         route_params_conv.inner = untag_ptr(route_params);
74350         route_params_conv.is_owned = ptr_is_owned(route_params);
74351         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
74352         route_params_conv.is_owned = false;
74353         LDKNetworkGraph network_graph_conv;
74354         network_graph_conv.inner = untag_ptr(network_graph);
74355         network_graph_conv.is_owned = ptr_is_owned(network_graph);
74356         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
74357         network_graph_conv.is_owned = false;
74358         void* logger_ptr = untag_ptr(logger);
74359         CHECK_ACCESS(logger_ptr);
74360         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
74361         if (logger_conv.free == LDKLogger_JCalls_free) {
74362                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
74363                 LDKLogger_JCalls_cloned(&logger_conv);
74364         }
74365         uint8_t random_seed_bytes_arr[32];
74366         CHECK(random_seed_bytes->arr_len == 32);
74367         memcpy(random_seed_bytes_arr, random_seed_bytes->elems, 32); FREE(random_seed_bytes);
74368         uint8_t (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr;
74369         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
74370         *ret_conv = build_route_from_hops(our_node_pubkey_ref, hops_constr, &route_params_conv, &network_graph_conv, logger_conv, random_seed_bytes_ref);
74371         return tag_ptr(ret_conv, true);
74372 }
74373
74374 void  CS_LDK_ScoreLookUp_free(int64_t this_ptr) {
74375         if (!ptr_is_owned(this_ptr)) return;
74376         void* this_ptr_ptr = untag_ptr(this_ptr);
74377         CHECK_ACCESS(this_ptr_ptr);
74378         LDKScoreLookUp this_ptr_conv = *(LDKScoreLookUp*)(this_ptr_ptr);
74379         FREE(untag_ptr(this_ptr));
74380         ScoreLookUp_free(this_ptr_conv);
74381 }
74382
74383 void  CS_LDK_ScoreUpdate_free(int64_t this_ptr) {
74384         if (!ptr_is_owned(this_ptr)) return;
74385         void* this_ptr_ptr = untag_ptr(this_ptr);
74386         CHECK_ACCESS(this_ptr_ptr);
74387         LDKScoreUpdate this_ptr_conv = *(LDKScoreUpdate*)(this_ptr_ptr);
74388         FREE(untag_ptr(this_ptr));
74389         ScoreUpdate_free(this_ptr_conv);
74390 }
74391
74392 void  CS_LDK_Score_free(int64_t this_ptr) {
74393         if (!ptr_is_owned(this_ptr)) return;
74394         void* this_ptr_ptr = untag_ptr(this_ptr);
74395         CHECK_ACCESS(this_ptr_ptr);
74396         LDKScore this_ptr_conv = *(LDKScore*)(this_ptr_ptr);
74397         FREE(untag_ptr(this_ptr));
74398         Score_free(this_ptr_conv);
74399 }
74400
74401 void  CS_LDK_LockableScore_free(int64_t this_ptr) {
74402         if (!ptr_is_owned(this_ptr)) return;
74403         void* this_ptr_ptr = untag_ptr(this_ptr);
74404         CHECK_ACCESS(this_ptr_ptr);
74405         LDKLockableScore this_ptr_conv = *(LDKLockableScore*)(this_ptr_ptr);
74406         FREE(untag_ptr(this_ptr));
74407         LockableScore_free(this_ptr_conv);
74408 }
74409
74410 void  CS_LDK_WriteableScore_free(int64_t this_ptr) {
74411         if (!ptr_is_owned(this_ptr)) return;
74412         void* this_ptr_ptr = untag_ptr(this_ptr);
74413         CHECK_ACCESS(this_ptr_ptr);
74414         LDKWriteableScore this_ptr_conv = *(LDKWriteableScore*)(this_ptr_ptr);
74415         FREE(untag_ptr(this_ptr));
74416         WriteableScore_free(this_ptr_conv);
74417 }
74418
74419 void  CS_LDK_MultiThreadedLockableScore_free(int64_t this_obj) {
74420         LDKMultiThreadedLockableScore this_obj_conv;
74421         this_obj_conv.inner = untag_ptr(this_obj);
74422         this_obj_conv.is_owned = ptr_is_owned(this_obj);
74423         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
74424         MultiThreadedLockableScore_free(this_obj_conv);
74425 }
74426
74427 int64_t  CS_LDK_MultiThreadedLockableScore_as_LockableScore(int64_t this_arg) {
74428         LDKMultiThreadedLockableScore this_arg_conv;
74429         this_arg_conv.inner = untag_ptr(this_arg);
74430         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74431         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74432         this_arg_conv.is_owned = false;
74433         LDKLockableScore* ret_ret = MALLOC(sizeof(LDKLockableScore), "LDKLockableScore");
74434         *ret_ret = MultiThreadedLockableScore_as_LockableScore(&this_arg_conv);
74435         return tag_ptr(ret_ret, true);
74436 }
74437
74438 int8_tArray  CS_LDK_MultiThreadedLockableScore_write(int64_t obj) {
74439         LDKMultiThreadedLockableScore obj_conv;
74440         obj_conv.inner = untag_ptr(obj);
74441         obj_conv.is_owned = ptr_is_owned(obj);
74442         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
74443         obj_conv.is_owned = false;
74444         LDKCVec_u8Z ret_var = MultiThreadedLockableScore_write(&obj_conv);
74445         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
74446         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
74447         CVec_u8Z_free(ret_var);
74448         return ret_arr;
74449 }
74450
74451 int64_t  CS_LDK_MultiThreadedLockableScore_as_WriteableScore(int64_t this_arg) {
74452         LDKMultiThreadedLockableScore this_arg_conv;
74453         this_arg_conv.inner = untag_ptr(this_arg);
74454         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74455         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74456         this_arg_conv.is_owned = false;
74457         LDKWriteableScore* ret_ret = MALLOC(sizeof(LDKWriteableScore), "LDKWriteableScore");
74458         *ret_ret = MultiThreadedLockableScore_as_WriteableScore(&this_arg_conv);
74459         return tag_ptr(ret_ret, true);
74460 }
74461
74462 int64_t  CS_LDK_MultiThreadedLockableScore_new(int64_t score) {
74463         void* score_ptr = untag_ptr(score);
74464         CHECK_ACCESS(score_ptr);
74465         LDKScore score_conv = *(LDKScore*)(score_ptr);
74466         if (score_conv.free == LDKScore_JCalls_free) {
74467                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
74468                 LDKScore_JCalls_cloned(&score_conv);
74469         }
74470         LDKMultiThreadedLockableScore ret_var = MultiThreadedLockableScore_new(score_conv);
74471         int64_t ret_ref = 0;
74472         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74473         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74474         return ret_ref;
74475 }
74476
74477 void  CS_LDK_MultiThreadedScoreLockRead_free(int64_t this_obj) {
74478         LDKMultiThreadedScoreLockRead this_obj_conv;
74479         this_obj_conv.inner = untag_ptr(this_obj);
74480         this_obj_conv.is_owned = ptr_is_owned(this_obj);
74481         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
74482         MultiThreadedScoreLockRead_free(this_obj_conv);
74483 }
74484
74485 void  CS_LDK_MultiThreadedScoreLockWrite_free(int64_t this_obj) {
74486         LDKMultiThreadedScoreLockWrite this_obj_conv;
74487         this_obj_conv.inner = untag_ptr(this_obj);
74488         this_obj_conv.is_owned = ptr_is_owned(this_obj);
74489         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
74490         MultiThreadedScoreLockWrite_free(this_obj_conv);
74491 }
74492
74493 int64_t  CS_LDK_MultiThreadedScoreLockRead_as_ScoreLookUp(int64_t this_arg) {
74494         LDKMultiThreadedScoreLockRead this_arg_conv;
74495         this_arg_conv.inner = untag_ptr(this_arg);
74496         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74497         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74498         this_arg_conv.is_owned = false;
74499         LDKScoreLookUp* ret_ret = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
74500         *ret_ret = MultiThreadedScoreLockRead_as_ScoreLookUp(&this_arg_conv);
74501         return tag_ptr(ret_ret, true);
74502 }
74503
74504 int8_tArray  CS_LDK_MultiThreadedScoreLockWrite_write(int64_t obj) {
74505         LDKMultiThreadedScoreLockWrite obj_conv;
74506         obj_conv.inner = untag_ptr(obj);
74507         obj_conv.is_owned = ptr_is_owned(obj);
74508         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
74509         obj_conv.is_owned = false;
74510         LDKCVec_u8Z ret_var = MultiThreadedScoreLockWrite_write(&obj_conv);
74511         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
74512         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
74513         CVec_u8Z_free(ret_var);
74514         return ret_arr;
74515 }
74516
74517 int64_t  CS_LDK_MultiThreadedScoreLockWrite_as_ScoreUpdate(int64_t this_arg) {
74518         LDKMultiThreadedScoreLockWrite this_arg_conv;
74519         this_arg_conv.inner = untag_ptr(this_arg);
74520         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74521         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74522         this_arg_conv.is_owned = false;
74523         LDKScoreUpdate* ret_ret = MALLOC(sizeof(LDKScoreUpdate), "LDKScoreUpdate");
74524         *ret_ret = MultiThreadedScoreLockWrite_as_ScoreUpdate(&this_arg_conv);
74525         return tag_ptr(ret_ret, true);
74526 }
74527
74528 void  CS_LDK_ChannelUsage_free(int64_t this_obj) {
74529         LDKChannelUsage this_obj_conv;
74530         this_obj_conv.inner = untag_ptr(this_obj);
74531         this_obj_conv.is_owned = ptr_is_owned(this_obj);
74532         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
74533         ChannelUsage_free(this_obj_conv);
74534 }
74535
74536 int64_t  CS_LDK_ChannelUsage_get_amount_msat(int64_t this_ptr) {
74537         LDKChannelUsage this_ptr_conv;
74538         this_ptr_conv.inner = untag_ptr(this_ptr);
74539         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74540         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74541         this_ptr_conv.is_owned = false;
74542         int64_t ret_conv = ChannelUsage_get_amount_msat(&this_ptr_conv);
74543         return ret_conv;
74544 }
74545
74546 void  CS_LDK_ChannelUsage_set_amount_msat(int64_t this_ptr, int64_t val) {
74547         LDKChannelUsage this_ptr_conv;
74548         this_ptr_conv.inner = untag_ptr(this_ptr);
74549         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74550         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74551         this_ptr_conv.is_owned = false;
74552         ChannelUsage_set_amount_msat(&this_ptr_conv, val);
74553 }
74554
74555 int64_t  CS_LDK_ChannelUsage_get_inflight_htlc_msat(int64_t this_ptr) {
74556         LDKChannelUsage this_ptr_conv;
74557         this_ptr_conv.inner = untag_ptr(this_ptr);
74558         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74559         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74560         this_ptr_conv.is_owned = false;
74561         int64_t ret_conv = ChannelUsage_get_inflight_htlc_msat(&this_ptr_conv);
74562         return ret_conv;
74563 }
74564
74565 void  CS_LDK_ChannelUsage_set_inflight_htlc_msat(int64_t this_ptr, int64_t val) {
74566         LDKChannelUsage this_ptr_conv;
74567         this_ptr_conv.inner = untag_ptr(this_ptr);
74568         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74569         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74570         this_ptr_conv.is_owned = false;
74571         ChannelUsage_set_inflight_htlc_msat(&this_ptr_conv, val);
74572 }
74573
74574 int64_t  CS_LDK_ChannelUsage_get_effective_capacity(int64_t this_ptr) {
74575         LDKChannelUsage this_ptr_conv;
74576         this_ptr_conv.inner = untag_ptr(this_ptr);
74577         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74578         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74579         this_ptr_conv.is_owned = false;
74580         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
74581         *ret_copy = ChannelUsage_get_effective_capacity(&this_ptr_conv);
74582         int64_t ret_ref = tag_ptr(ret_copy, true);
74583         return ret_ref;
74584 }
74585
74586 void  CS_LDK_ChannelUsage_set_effective_capacity(int64_t this_ptr, int64_t val) {
74587         LDKChannelUsage this_ptr_conv;
74588         this_ptr_conv.inner = untag_ptr(this_ptr);
74589         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74590         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74591         this_ptr_conv.is_owned = false;
74592         void* val_ptr = untag_ptr(val);
74593         CHECK_ACCESS(val_ptr);
74594         LDKEffectiveCapacity val_conv = *(LDKEffectiveCapacity*)(val_ptr);
74595         val_conv = EffectiveCapacity_clone((LDKEffectiveCapacity*)untag_ptr(val));
74596         ChannelUsage_set_effective_capacity(&this_ptr_conv, val_conv);
74597 }
74598
74599 int64_t  CS_LDK_ChannelUsage_new(int64_t amount_msat_arg, int64_t inflight_htlc_msat_arg, int64_t effective_capacity_arg) {
74600         void* effective_capacity_arg_ptr = untag_ptr(effective_capacity_arg);
74601         CHECK_ACCESS(effective_capacity_arg_ptr);
74602         LDKEffectiveCapacity effective_capacity_arg_conv = *(LDKEffectiveCapacity*)(effective_capacity_arg_ptr);
74603         effective_capacity_arg_conv = EffectiveCapacity_clone((LDKEffectiveCapacity*)untag_ptr(effective_capacity_arg));
74604         LDKChannelUsage ret_var = ChannelUsage_new(amount_msat_arg, inflight_htlc_msat_arg, effective_capacity_arg_conv);
74605         int64_t ret_ref = 0;
74606         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74607         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74608         return ret_ref;
74609 }
74610
74611 static inline uint64_t ChannelUsage_clone_ptr(LDKChannelUsage *NONNULL_PTR arg) {
74612         LDKChannelUsage ret_var = ChannelUsage_clone(arg);
74613         int64_t ret_ref = 0;
74614         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74615         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74616         return ret_ref;
74617 }
74618 int64_t  CS_LDK_ChannelUsage_clone_ptr(int64_t arg) {
74619         LDKChannelUsage arg_conv;
74620         arg_conv.inner = untag_ptr(arg);
74621         arg_conv.is_owned = ptr_is_owned(arg);
74622         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
74623         arg_conv.is_owned = false;
74624         int64_t ret_conv = ChannelUsage_clone_ptr(&arg_conv);
74625         return ret_conv;
74626 }
74627
74628 int64_t  CS_LDK_ChannelUsage_clone(int64_t orig) {
74629         LDKChannelUsage orig_conv;
74630         orig_conv.inner = untag_ptr(orig);
74631         orig_conv.is_owned = ptr_is_owned(orig);
74632         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
74633         orig_conv.is_owned = false;
74634         LDKChannelUsage ret_var = ChannelUsage_clone(&orig_conv);
74635         int64_t ret_ref = 0;
74636         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74637         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74638         return ret_ref;
74639 }
74640
74641 void  CS_LDK_FixedPenaltyScorer_free(int64_t this_obj) {
74642         LDKFixedPenaltyScorer this_obj_conv;
74643         this_obj_conv.inner = untag_ptr(this_obj);
74644         this_obj_conv.is_owned = ptr_is_owned(this_obj);
74645         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
74646         FixedPenaltyScorer_free(this_obj_conv);
74647 }
74648
74649 static inline uint64_t FixedPenaltyScorer_clone_ptr(LDKFixedPenaltyScorer *NONNULL_PTR arg) {
74650         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(arg);
74651         int64_t ret_ref = 0;
74652         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74653         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74654         return ret_ref;
74655 }
74656 int64_t  CS_LDK_FixedPenaltyScorer_clone_ptr(int64_t arg) {
74657         LDKFixedPenaltyScorer arg_conv;
74658         arg_conv.inner = untag_ptr(arg);
74659         arg_conv.is_owned = ptr_is_owned(arg);
74660         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
74661         arg_conv.is_owned = false;
74662         int64_t ret_conv = FixedPenaltyScorer_clone_ptr(&arg_conv);
74663         return ret_conv;
74664 }
74665
74666 int64_t  CS_LDK_FixedPenaltyScorer_clone(int64_t orig) {
74667         LDKFixedPenaltyScorer orig_conv;
74668         orig_conv.inner = untag_ptr(orig);
74669         orig_conv.is_owned = ptr_is_owned(orig);
74670         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
74671         orig_conv.is_owned = false;
74672         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(&orig_conv);
74673         int64_t ret_ref = 0;
74674         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74675         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74676         return ret_ref;
74677 }
74678
74679 int64_t  CS_LDK_FixedPenaltyScorer_with_penalty(int64_t penalty_msat) {
74680         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_with_penalty(penalty_msat);
74681         int64_t ret_ref = 0;
74682         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74683         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74684         return ret_ref;
74685 }
74686
74687 int64_t  CS_LDK_FixedPenaltyScorer_as_ScoreLookUp(int64_t this_arg) {
74688         LDKFixedPenaltyScorer this_arg_conv;
74689         this_arg_conv.inner = untag_ptr(this_arg);
74690         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74691         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74692         this_arg_conv.is_owned = false;
74693         LDKScoreLookUp* ret_ret = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
74694         *ret_ret = FixedPenaltyScorer_as_ScoreLookUp(&this_arg_conv);
74695         return tag_ptr(ret_ret, true);
74696 }
74697
74698 int64_t  CS_LDK_FixedPenaltyScorer_as_ScoreUpdate(int64_t this_arg) {
74699         LDKFixedPenaltyScorer this_arg_conv;
74700         this_arg_conv.inner = untag_ptr(this_arg);
74701         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74702         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74703         this_arg_conv.is_owned = false;
74704         LDKScoreUpdate* ret_ret = MALLOC(sizeof(LDKScoreUpdate), "LDKScoreUpdate");
74705         *ret_ret = FixedPenaltyScorer_as_ScoreUpdate(&this_arg_conv);
74706         return tag_ptr(ret_ret, true);
74707 }
74708
74709 int8_tArray  CS_LDK_FixedPenaltyScorer_write(int64_t obj) {
74710         LDKFixedPenaltyScorer obj_conv;
74711         obj_conv.inner = untag_ptr(obj);
74712         obj_conv.is_owned = ptr_is_owned(obj);
74713         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
74714         obj_conv.is_owned = false;
74715         LDKCVec_u8Z ret_var = FixedPenaltyScorer_write(&obj_conv);
74716         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
74717         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
74718         CVec_u8Z_free(ret_var);
74719         return ret_arr;
74720 }
74721
74722 int64_t  CS_LDK_FixedPenaltyScorer_read(int8_tArray ser, int64_t arg) {
74723         LDKu8slice ser_ref;
74724         ser_ref.datalen = ser->arr_len;
74725         ser_ref.data = ser->elems;
74726         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
74727         *ret_conv = FixedPenaltyScorer_read(ser_ref, arg);
74728         FREE(ser);
74729         return tag_ptr(ret_conv, true);
74730 }
74731
74732 void  CS_LDK_ProbabilisticScorer_free(int64_t this_obj) {
74733         LDKProbabilisticScorer this_obj_conv;
74734         this_obj_conv.inner = untag_ptr(this_obj);
74735         this_obj_conv.is_owned = ptr_is_owned(this_obj);
74736         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
74737         ProbabilisticScorer_free(this_obj_conv);
74738 }
74739
74740 void  CS_LDK_ProbabilisticScoringFeeParameters_free(int64_t this_obj) {
74741         LDKProbabilisticScoringFeeParameters this_obj_conv;
74742         this_obj_conv.inner = untag_ptr(this_obj);
74743         this_obj_conv.is_owned = ptr_is_owned(this_obj);
74744         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
74745         ProbabilisticScoringFeeParameters_free(this_obj_conv);
74746 }
74747
74748 int64_t  CS_LDK_ProbabilisticScoringFeeParameters_get_base_penalty_msat(int64_t this_ptr) {
74749         LDKProbabilisticScoringFeeParameters this_ptr_conv;
74750         this_ptr_conv.inner = untag_ptr(this_ptr);
74751         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74752         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74753         this_ptr_conv.is_owned = false;
74754         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_base_penalty_msat(&this_ptr_conv);
74755         return ret_conv;
74756 }
74757
74758 void  CS_LDK_ProbabilisticScoringFeeParameters_set_base_penalty_msat(int64_t this_ptr, int64_t val) {
74759         LDKProbabilisticScoringFeeParameters this_ptr_conv;
74760         this_ptr_conv.inner = untag_ptr(this_ptr);
74761         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74762         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74763         this_ptr_conv.is_owned = false;
74764         ProbabilisticScoringFeeParameters_set_base_penalty_msat(&this_ptr_conv, val);
74765 }
74766
74767 int64_t  CS_LDK_ProbabilisticScoringFeeParameters_get_base_penalty_amount_multiplier_msat(int64_t this_ptr) {
74768         LDKProbabilisticScoringFeeParameters this_ptr_conv;
74769         this_ptr_conv.inner = untag_ptr(this_ptr);
74770         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74771         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74772         this_ptr_conv.is_owned = false;
74773         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_base_penalty_amount_multiplier_msat(&this_ptr_conv);
74774         return ret_conv;
74775 }
74776
74777 void  CS_LDK_ProbabilisticScoringFeeParameters_set_base_penalty_amount_multiplier_msat(int64_t this_ptr, int64_t val) {
74778         LDKProbabilisticScoringFeeParameters this_ptr_conv;
74779         this_ptr_conv.inner = untag_ptr(this_ptr);
74780         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74781         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74782         this_ptr_conv.is_owned = false;
74783         ProbabilisticScoringFeeParameters_set_base_penalty_amount_multiplier_msat(&this_ptr_conv, val);
74784 }
74785
74786 int64_t  CS_LDK_ProbabilisticScoringFeeParameters_get_liquidity_penalty_multiplier_msat(int64_t this_ptr) {
74787         LDKProbabilisticScoringFeeParameters this_ptr_conv;
74788         this_ptr_conv.inner = untag_ptr(this_ptr);
74789         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74790         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74791         this_ptr_conv.is_owned = false;
74792         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_liquidity_penalty_multiplier_msat(&this_ptr_conv);
74793         return ret_conv;
74794 }
74795
74796 void  CS_LDK_ProbabilisticScoringFeeParameters_set_liquidity_penalty_multiplier_msat(int64_t this_ptr, int64_t val) {
74797         LDKProbabilisticScoringFeeParameters this_ptr_conv;
74798         this_ptr_conv.inner = untag_ptr(this_ptr);
74799         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74800         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74801         this_ptr_conv.is_owned = false;
74802         ProbabilisticScoringFeeParameters_set_liquidity_penalty_multiplier_msat(&this_ptr_conv, val);
74803 }
74804
74805 int64_t  CS_LDK_ProbabilisticScoringFeeParameters_get_liquidity_penalty_amount_multiplier_msat(int64_t this_ptr) {
74806         LDKProbabilisticScoringFeeParameters this_ptr_conv;
74807         this_ptr_conv.inner = untag_ptr(this_ptr);
74808         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74809         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74810         this_ptr_conv.is_owned = false;
74811         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv);
74812         return ret_conv;
74813 }
74814
74815 void  CS_LDK_ProbabilisticScoringFeeParameters_set_liquidity_penalty_amount_multiplier_msat(int64_t this_ptr, int64_t val) {
74816         LDKProbabilisticScoringFeeParameters this_ptr_conv;
74817         this_ptr_conv.inner = untag_ptr(this_ptr);
74818         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74819         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74820         this_ptr_conv.is_owned = false;
74821         ProbabilisticScoringFeeParameters_set_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv, val);
74822 }
74823
74824 int64_t  CS_LDK_ProbabilisticScoringFeeParameters_get_historical_liquidity_penalty_multiplier_msat(int64_t this_ptr) {
74825         LDKProbabilisticScoringFeeParameters this_ptr_conv;
74826         this_ptr_conv.inner = untag_ptr(this_ptr);
74827         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74828         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74829         this_ptr_conv.is_owned = false;
74830         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_historical_liquidity_penalty_multiplier_msat(&this_ptr_conv);
74831         return ret_conv;
74832 }
74833
74834 void  CS_LDK_ProbabilisticScoringFeeParameters_set_historical_liquidity_penalty_multiplier_msat(int64_t this_ptr, int64_t val) {
74835         LDKProbabilisticScoringFeeParameters this_ptr_conv;
74836         this_ptr_conv.inner = untag_ptr(this_ptr);
74837         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74838         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74839         this_ptr_conv.is_owned = false;
74840         ProbabilisticScoringFeeParameters_set_historical_liquidity_penalty_multiplier_msat(&this_ptr_conv, val);
74841 }
74842
74843 int64_t  CS_LDK_ProbabilisticScoringFeeParameters_get_historical_liquidity_penalty_amount_multiplier_msat(int64_t this_ptr) {
74844         LDKProbabilisticScoringFeeParameters this_ptr_conv;
74845         this_ptr_conv.inner = untag_ptr(this_ptr);
74846         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74847         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74848         this_ptr_conv.is_owned = false;
74849         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_historical_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv);
74850         return ret_conv;
74851 }
74852
74853 void  CS_LDK_ProbabilisticScoringFeeParameters_set_historical_liquidity_penalty_amount_multiplier_msat(int64_t this_ptr, int64_t val) {
74854         LDKProbabilisticScoringFeeParameters this_ptr_conv;
74855         this_ptr_conv.inner = untag_ptr(this_ptr);
74856         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74857         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74858         this_ptr_conv.is_owned = false;
74859         ProbabilisticScoringFeeParameters_set_historical_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv, val);
74860 }
74861
74862 int64_t  CS_LDK_ProbabilisticScoringFeeParameters_get_anti_probing_penalty_msat(int64_t this_ptr) {
74863         LDKProbabilisticScoringFeeParameters this_ptr_conv;
74864         this_ptr_conv.inner = untag_ptr(this_ptr);
74865         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74866         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74867         this_ptr_conv.is_owned = false;
74868         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_anti_probing_penalty_msat(&this_ptr_conv);
74869         return ret_conv;
74870 }
74871
74872 void  CS_LDK_ProbabilisticScoringFeeParameters_set_anti_probing_penalty_msat(int64_t this_ptr, int64_t val) {
74873         LDKProbabilisticScoringFeeParameters this_ptr_conv;
74874         this_ptr_conv.inner = untag_ptr(this_ptr);
74875         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74876         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74877         this_ptr_conv.is_owned = false;
74878         ProbabilisticScoringFeeParameters_set_anti_probing_penalty_msat(&this_ptr_conv, val);
74879 }
74880
74881 int64_t  CS_LDK_ProbabilisticScoringFeeParameters_get_considered_impossible_penalty_msat(int64_t this_ptr) {
74882         LDKProbabilisticScoringFeeParameters this_ptr_conv;
74883         this_ptr_conv.inner = untag_ptr(this_ptr);
74884         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74885         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74886         this_ptr_conv.is_owned = false;
74887         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_considered_impossible_penalty_msat(&this_ptr_conv);
74888         return ret_conv;
74889 }
74890
74891 void  CS_LDK_ProbabilisticScoringFeeParameters_set_considered_impossible_penalty_msat(int64_t this_ptr, int64_t val) {
74892         LDKProbabilisticScoringFeeParameters this_ptr_conv;
74893         this_ptr_conv.inner = untag_ptr(this_ptr);
74894         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74895         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74896         this_ptr_conv.is_owned = false;
74897         ProbabilisticScoringFeeParameters_set_considered_impossible_penalty_msat(&this_ptr_conv, val);
74898 }
74899
74900 jboolean  CS_LDK_ProbabilisticScoringFeeParameters_get_linear_success_probability(int64_t this_ptr) {
74901         LDKProbabilisticScoringFeeParameters this_ptr_conv;
74902         this_ptr_conv.inner = untag_ptr(this_ptr);
74903         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74904         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74905         this_ptr_conv.is_owned = false;
74906         jboolean ret_conv = ProbabilisticScoringFeeParameters_get_linear_success_probability(&this_ptr_conv);
74907         return ret_conv;
74908 }
74909
74910 void  CS_LDK_ProbabilisticScoringFeeParameters_set_linear_success_probability(int64_t this_ptr, jboolean val) {
74911         LDKProbabilisticScoringFeeParameters this_ptr_conv;
74912         this_ptr_conv.inner = untag_ptr(this_ptr);
74913         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74914         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74915         this_ptr_conv.is_owned = false;
74916         ProbabilisticScoringFeeParameters_set_linear_success_probability(&this_ptr_conv, val);
74917 }
74918
74919 static inline uint64_t ProbabilisticScoringFeeParameters_clone_ptr(LDKProbabilisticScoringFeeParameters *NONNULL_PTR arg) {
74920         LDKProbabilisticScoringFeeParameters ret_var = ProbabilisticScoringFeeParameters_clone(arg);
74921         int64_t ret_ref = 0;
74922         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74923         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74924         return ret_ref;
74925 }
74926 int64_t  CS_LDK_ProbabilisticScoringFeeParameters_clone_ptr(int64_t arg) {
74927         LDKProbabilisticScoringFeeParameters arg_conv;
74928         arg_conv.inner = untag_ptr(arg);
74929         arg_conv.is_owned = ptr_is_owned(arg);
74930         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
74931         arg_conv.is_owned = false;
74932         int64_t ret_conv = ProbabilisticScoringFeeParameters_clone_ptr(&arg_conv);
74933         return ret_conv;
74934 }
74935
74936 int64_t  CS_LDK_ProbabilisticScoringFeeParameters_clone(int64_t orig) {
74937         LDKProbabilisticScoringFeeParameters orig_conv;
74938         orig_conv.inner = untag_ptr(orig);
74939         orig_conv.is_owned = ptr_is_owned(orig);
74940         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
74941         orig_conv.is_owned = false;
74942         LDKProbabilisticScoringFeeParameters ret_var = ProbabilisticScoringFeeParameters_clone(&orig_conv);
74943         int64_t ret_ref = 0;
74944         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74945         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74946         return ret_ref;
74947 }
74948
74949 int64_t  CS_LDK_ProbabilisticScoringFeeParameters_default() {
74950         LDKProbabilisticScoringFeeParameters ret_var = ProbabilisticScoringFeeParameters_default();
74951         int64_t ret_ref = 0;
74952         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74953         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74954         return ret_ref;
74955 }
74956
74957 void  CS_LDK_ProbabilisticScoringFeeParameters_add_banned(int64_t this_arg, int64_t node_id) {
74958         LDKProbabilisticScoringFeeParameters this_arg_conv;
74959         this_arg_conv.inner = untag_ptr(this_arg);
74960         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74961         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74962         this_arg_conv.is_owned = false;
74963         LDKNodeId node_id_conv;
74964         node_id_conv.inner = untag_ptr(node_id);
74965         node_id_conv.is_owned = ptr_is_owned(node_id);
74966         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
74967         node_id_conv.is_owned = false;
74968         ProbabilisticScoringFeeParameters_add_banned(&this_arg_conv, &node_id_conv);
74969 }
74970
74971 void  CS_LDK_ProbabilisticScoringFeeParameters_add_banned_from_list(int64_t this_arg, int64_tArray node_ids) {
74972         LDKProbabilisticScoringFeeParameters this_arg_conv;
74973         this_arg_conv.inner = untag_ptr(this_arg);
74974         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74975         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74976         this_arg_conv.is_owned = false;
74977         LDKCVec_NodeIdZ node_ids_constr;
74978         node_ids_constr.datalen = node_ids->arr_len;
74979         if (node_ids_constr.datalen > 0)
74980                 node_ids_constr.data = MALLOC(node_ids_constr.datalen * sizeof(LDKNodeId), "LDKCVec_NodeIdZ Elements");
74981         else
74982                 node_ids_constr.data = NULL;
74983         int64_t* node_ids_vals = node_ids->elems;
74984         for (size_t i = 0; i < node_ids_constr.datalen; i++) {
74985                 int64_t node_ids_conv_8 = node_ids_vals[i];
74986                 LDKNodeId node_ids_conv_8_conv;
74987                 node_ids_conv_8_conv.inner = untag_ptr(node_ids_conv_8);
74988                 node_ids_conv_8_conv.is_owned = ptr_is_owned(node_ids_conv_8);
74989                 CHECK_INNER_FIELD_ACCESS_OR_NULL(node_ids_conv_8_conv);
74990                 node_ids_conv_8_conv = NodeId_clone(&node_ids_conv_8_conv);
74991                 node_ids_constr.data[i] = node_ids_conv_8_conv;
74992         }
74993         FREE(node_ids);
74994         ProbabilisticScoringFeeParameters_add_banned_from_list(&this_arg_conv, node_ids_constr);
74995 }
74996
74997 void  CS_LDK_ProbabilisticScoringFeeParameters_remove_banned(int64_t this_arg, int64_t node_id) {
74998         LDKProbabilisticScoringFeeParameters this_arg_conv;
74999         this_arg_conv.inner = untag_ptr(this_arg);
75000         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75001         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75002         this_arg_conv.is_owned = false;
75003         LDKNodeId node_id_conv;
75004         node_id_conv.inner = untag_ptr(node_id);
75005         node_id_conv.is_owned = ptr_is_owned(node_id);
75006         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
75007         node_id_conv.is_owned = false;
75008         ProbabilisticScoringFeeParameters_remove_banned(&this_arg_conv, &node_id_conv);
75009 }
75010
75011 void  CS_LDK_ProbabilisticScoringFeeParameters_set_manual_penalty(int64_t this_arg, int64_t node_id, int64_t penalty) {
75012         LDKProbabilisticScoringFeeParameters this_arg_conv;
75013         this_arg_conv.inner = untag_ptr(this_arg);
75014         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75015         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75016         this_arg_conv.is_owned = false;
75017         LDKNodeId node_id_conv;
75018         node_id_conv.inner = untag_ptr(node_id);
75019         node_id_conv.is_owned = ptr_is_owned(node_id);
75020         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
75021         node_id_conv.is_owned = false;
75022         ProbabilisticScoringFeeParameters_set_manual_penalty(&this_arg_conv, &node_id_conv, penalty);
75023 }
75024
75025 void  CS_LDK_ProbabilisticScoringFeeParameters_remove_manual_penalty(int64_t this_arg, int64_t node_id) {
75026         LDKProbabilisticScoringFeeParameters this_arg_conv;
75027         this_arg_conv.inner = untag_ptr(this_arg);
75028         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75029         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75030         this_arg_conv.is_owned = false;
75031         LDKNodeId node_id_conv;
75032         node_id_conv.inner = untag_ptr(node_id);
75033         node_id_conv.is_owned = ptr_is_owned(node_id);
75034         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
75035         node_id_conv.is_owned = false;
75036         ProbabilisticScoringFeeParameters_remove_manual_penalty(&this_arg_conv, &node_id_conv);
75037 }
75038
75039 void  CS_LDK_ProbabilisticScoringFeeParameters_clear_manual_penalties(int64_t this_arg) {
75040         LDKProbabilisticScoringFeeParameters this_arg_conv;
75041         this_arg_conv.inner = untag_ptr(this_arg);
75042         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75043         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75044         this_arg_conv.is_owned = false;
75045         ProbabilisticScoringFeeParameters_clear_manual_penalties(&this_arg_conv);
75046 }
75047
75048 void  CS_LDK_ProbabilisticScoringDecayParameters_free(int64_t this_obj) {
75049         LDKProbabilisticScoringDecayParameters this_obj_conv;
75050         this_obj_conv.inner = untag_ptr(this_obj);
75051         this_obj_conv.is_owned = ptr_is_owned(this_obj);
75052         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
75053         ProbabilisticScoringDecayParameters_free(this_obj_conv);
75054 }
75055
75056 int64_t  CS_LDK_ProbabilisticScoringDecayParameters_get_historical_no_updates_half_life(int64_t this_ptr) {
75057         LDKProbabilisticScoringDecayParameters this_ptr_conv;
75058         this_ptr_conv.inner = untag_ptr(this_ptr);
75059         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75060         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75061         this_ptr_conv.is_owned = false;
75062         int64_t ret_conv = ProbabilisticScoringDecayParameters_get_historical_no_updates_half_life(&this_ptr_conv);
75063         return ret_conv;
75064 }
75065
75066 void  CS_LDK_ProbabilisticScoringDecayParameters_set_historical_no_updates_half_life(int64_t this_ptr, int64_t val) {
75067         LDKProbabilisticScoringDecayParameters this_ptr_conv;
75068         this_ptr_conv.inner = untag_ptr(this_ptr);
75069         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75070         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75071         this_ptr_conv.is_owned = false;
75072         ProbabilisticScoringDecayParameters_set_historical_no_updates_half_life(&this_ptr_conv, val);
75073 }
75074
75075 int64_t  CS_LDK_ProbabilisticScoringDecayParameters_get_liquidity_offset_half_life(int64_t this_ptr) {
75076         LDKProbabilisticScoringDecayParameters this_ptr_conv;
75077         this_ptr_conv.inner = untag_ptr(this_ptr);
75078         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75079         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75080         this_ptr_conv.is_owned = false;
75081         int64_t ret_conv = ProbabilisticScoringDecayParameters_get_liquidity_offset_half_life(&this_ptr_conv);
75082         return ret_conv;
75083 }
75084
75085 void  CS_LDK_ProbabilisticScoringDecayParameters_set_liquidity_offset_half_life(int64_t this_ptr, int64_t val) {
75086         LDKProbabilisticScoringDecayParameters this_ptr_conv;
75087         this_ptr_conv.inner = untag_ptr(this_ptr);
75088         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75089         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75090         this_ptr_conv.is_owned = false;
75091         ProbabilisticScoringDecayParameters_set_liquidity_offset_half_life(&this_ptr_conv, val);
75092 }
75093
75094 int64_t  CS_LDK_ProbabilisticScoringDecayParameters_new(int64_t historical_no_updates_half_life_arg, int64_t liquidity_offset_half_life_arg) {
75095         LDKProbabilisticScoringDecayParameters ret_var = ProbabilisticScoringDecayParameters_new(historical_no_updates_half_life_arg, liquidity_offset_half_life_arg);
75096         int64_t ret_ref = 0;
75097         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75098         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75099         return ret_ref;
75100 }
75101
75102 static inline uint64_t ProbabilisticScoringDecayParameters_clone_ptr(LDKProbabilisticScoringDecayParameters *NONNULL_PTR arg) {
75103         LDKProbabilisticScoringDecayParameters ret_var = ProbabilisticScoringDecayParameters_clone(arg);
75104         int64_t ret_ref = 0;
75105         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75106         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75107         return ret_ref;
75108 }
75109 int64_t  CS_LDK_ProbabilisticScoringDecayParameters_clone_ptr(int64_t arg) {
75110         LDKProbabilisticScoringDecayParameters arg_conv;
75111         arg_conv.inner = untag_ptr(arg);
75112         arg_conv.is_owned = ptr_is_owned(arg);
75113         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
75114         arg_conv.is_owned = false;
75115         int64_t ret_conv = ProbabilisticScoringDecayParameters_clone_ptr(&arg_conv);
75116         return ret_conv;
75117 }
75118
75119 int64_t  CS_LDK_ProbabilisticScoringDecayParameters_clone(int64_t orig) {
75120         LDKProbabilisticScoringDecayParameters orig_conv;
75121         orig_conv.inner = untag_ptr(orig);
75122         orig_conv.is_owned = ptr_is_owned(orig);
75123         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
75124         orig_conv.is_owned = false;
75125         LDKProbabilisticScoringDecayParameters ret_var = ProbabilisticScoringDecayParameters_clone(&orig_conv);
75126         int64_t ret_ref = 0;
75127         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75128         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75129         return ret_ref;
75130 }
75131
75132 int64_t  CS_LDK_ProbabilisticScoringDecayParameters_default() {
75133         LDKProbabilisticScoringDecayParameters ret_var = ProbabilisticScoringDecayParameters_default();
75134         int64_t ret_ref = 0;
75135         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75136         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75137         return ret_ref;
75138 }
75139
75140 int64_t  CS_LDK_ProbabilisticScorer_new(int64_t decay_params, int64_t network_graph, int64_t logger) {
75141         LDKProbabilisticScoringDecayParameters decay_params_conv;
75142         decay_params_conv.inner = untag_ptr(decay_params);
75143         decay_params_conv.is_owned = ptr_is_owned(decay_params);
75144         CHECK_INNER_FIELD_ACCESS_OR_NULL(decay_params_conv);
75145         decay_params_conv = ProbabilisticScoringDecayParameters_clone(&decay_params_conv);
75146         LDKNetworkGraph network_graph_conv;
75147         network_graph_conv.inner = untag_ptr(network_graph);
75148         network_graph_conv.is_owned = ptr_is_owned(network_graph);
75149         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
75150         network_graph_conv.is_owned = false;
75151         void* logger_ptr = untag_ptr(logger);
75152         CHECK_ACCESS(logger_ptr);
75153         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
75154         if (logger_conv.free == LDKLogger_JCalls_free) {
75155                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
75156                 LDKLogger_JCalls_cloned(&logger_conv);
75157         }
75158         LDKProbabilisticScorer ret_var = ProbabilisticScorer_new(decay_params_conv, &network_graph_conv, logger_conv);
75159         int64_t ret_ref = 0;
75160         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75161         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75162         return ret_ref;
75163 }
75164
75165 void  CS_LDK_ProbabilisticScorer_debug_log_liquidity_stats(int64_t this_arg) {
75166         LDKProbabilisticScorer this_arg_conv;
75167         this_arg_conv.inner = untag_ptr(this_arg);
75168         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75169         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75170         this_arg_conv.is_owned = false;
75171         ProbabilisticScorer_debug_log_liquidity_stats(&this_arg_conv);
75172 }
75173
75174 int64_t  CS_LDK_ProbabilisticScorer_estimated_channel_liquidity_range(int64_t this_arg, int64_t scid, int64_t target) {
75175         LDKProbabilisticScorer this_arg_conv;
75176         this_arg_conv.inner = untag_ptr(this_arg);
75177         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75178         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75179         this_arg_conv.is_owned = false;
75180         LDKNodeId target_conv;
75181         target_conv.inner = untag_ptr(target);
75182         target_conv.is_owned = ptr_is_owned(target);
75183         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
75184         target_conv.is_owned = false;
75185         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
75186         *ret_copy = ProbabilisticScorer_estimated_channel_liquidity_range(&this_arg_conv, scid, &target_conv);
75187         int64_t ret_ref = tag_ptr(ret_copy, true);
75188         return ret_ref;
75189 }
75190
75191 int64_t  CS_LDK_ProbabilisticScorer_historical_estimated_channel_liquidity_probabilities(int64_t this_arg, int64_t scid, int64_t target) {
75192         LDKProbabilisticScorer this_arg_conv;
75193         this_arg_conv.inner = untag_ptr(this_arg);
75194         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75195         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75196         this_arg_conv.is_owned = false;
75197         LDKNodeId target_conv;
75198         target_conv.inner = untag_ptr(target);
75199         target_conv.is_owned = ptr_is_owned(target);
75200         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
75201         target_conv.is_owned = false;
75202         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ), "LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ");
75203         *ret_copy = ProbabilisticScorer_historical_estimated_channel_liquidity_probabilities(&this_arg_conv, scid, &target_conv);
75204         int64_t ret_ref = tag_ptr(ret_copy, true);
75205         return ret_ref;
75206 }
75207
75208 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) {
75209         LDKProbabilisticScorer this_arg_conv;
75210         this_arg_conv.inner = untag_ptr(this_arg);
75211         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75212         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75213         this_arg_conv.is_owned = false;
75214         LDKNodeId target_conv;
75215         target_conv.inner = untag_ptr(target);
75216         target_conv.is_owned = ptr_is_owned(target);
75217         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
75218         target_conv.is_owned = false;
75219         LDKProbabilisticScoringFeeParameters params_conv;
75220         params_conv.inner = untag_ptr(params);
75221         params_conv.is_owned = ptr_is_owned(params);
75222         CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
75223         params_conv.is_owned = false;
75224         LDKCOption_f64Z *ret_copy = MALLOC(sizeof(LDKCOption_f64Z), "LDKCOption_f64Z");
75225         *ret_copy = ProbabilisticScorer_historical_estimated_payment_success_probability(&this_arg_conv, scid, &target_conv, amount_msat, &params_conv);
75226         int64_t ret_ref = tag_ptr(ret_copy, true);
75227         return ret_ref;
75228 }
75229
75230 int64_t  CS_LDK_ProbabilisticScorer_as_ScoreLookUp(int64_t this_arg) {
75231         LDKProbabilisticScorer this_arg_conv;
75232         this_arg_conv.inner = untag_ptr(this_arg);
75233         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75234         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75235         this_arg_conv.is_owned = false;
75236         LDKScoreLookUp* ret_ret = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
75237         *ret_ret = ProbabilisticScorer_as_ScoreLookUp(&this_arg_conv);
75238         return tag_ptr(ret_ret, true);
75239 }
75240
75241 int64_t  CS_LDK_ProbabilisticScorer_as_ScoreUpdate(int64_t this_arg) {
75242         LDKProbabilisticScorer this_arg_conv;
75243         this_arg_conv.inner = untag_ptr(this_arg);
75244         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75245         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75246         this_arg_conv.is_owned = false;
75247         LDKScoreUpdate* ret_ret = MALLOC(sizeof(LDKScoreUpdate), "LDKScoreUpdate");
75248         *ret_ret = ProbabilisticScorer_as_ScoreUpdate(&this_arg_conv);
75249         return tag_ptr(ret_ret, true);
75250 }
75251
75252 int64_t  CS_LDK_ProbabilisticScorer_as_Score(int64_t this_arg) {
75253         LDKProbabilisticScorer this_arg_conv;
75254         this_arg_conv.inner = untag_ptr(this_arg);
75255         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75256         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75257         this_arg_conv.is_owned = false;
75258         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
75259         *ret_ret = ProbabilisticScorer_as_Score(&this_arg_conv);
75260         return tag_ptr(ret_ret, true);
75261 }
75262
75263 int8_tArray  CS_LDK_ProbabilisticScorer_write(int64_t obj) {
75264         LDKProbabilisticScorer obj_conv;
75265         obj_conv.inner = untag_ptr(obj);
75266         obj_conv.is_owned = ptr_is_owned(obj);
75267         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
75268         obj_conv.is_owned = false;
75269         LDKCVec_u8Z ret_var = ProbabilisticScorer_write(&obj_conv);
75270         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
75271         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
75272         CVec_u8Z_free(ret_var);
75273         return ret_arr;
75274 }
75275
75276 int64_t  CS_LDK_ProbabilisticScorer_read(int8_tArray ser, int64_t arg_a, int64_t arg_b, int64_t arg_c) {
75277         LDKu8slice ser_ref;
75278         ser_ref.datalen = ser->arr_len;
75279         ser_ref.data = ser->elems;
75280         LDKProbabilisticScoringDecayParameters arg_a_conv;
75281         arg_a_conv.inner = untag_ptr(arg_a);
75282         arg_a_conv.is_owned = ptr_is_owned(arg_a);
75283         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_a_conv);
75284         arg_a_conv = ProbabilisticScoringDecayParameters_clone(&arg_a_conv);
75285         LDKNetworkGraph arg_b_conv;
75286         arg_b_conv.inner = untag_ptr(arg_b);
75287         arg_b_conv.is_owned = ptr_is_owned(arg_b);
75288         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_b_conv);
75289         arg_b_conv.is_owned = false;
75290         void* arg_c_ptr = untag_ptr(arg_c);
75291         CHECK_ACCESS(arg_c_ptr);
75292         LDKLogger arg_c_conv = *(LDKLogger*)(arg_c_ptr);
75293         if (arg_c_conv.free == LDKLogger_JCalls_free) {
75294                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
75295                 LDKLogger_JCalls_cloned(&arg_c_conv);
75296         }
75297         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
75298         *ret_conv = ProbabilisticScorer_read(ser_ref, arg_a_conv, &arg_b_conv, arg_c_conv);
75299         FREE(ser);
75300         return tag_ptr(ret_conv, true);
75301 }
75302
75303 void  CS_LDK_DelayedPaymentOutputDescriptor_free(int64_t this_obj) {
75304         LDKDelayedPaymentOutputDescriptor this_obj_conv;
75305         this_obj_conv.inner = untag_ptr(this_obj);
75306         this_obj_conv.is_owned = ptr_is_owned(this_obj);
75307         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
75308         DelayedPaymentOutputDescriptor_free(this_obj_conv);
75309 }
75310
75311 int64_t  CS_LDK_DelayedPaymentOutputDescriptor_get_outpoint(int64_t this_ptr) {
75312         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
75313         this_ptr_conv.inner = untag_ptr(this_ptr);
75314         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75315         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75316         this_ptr_conv.is_owned = false;
75317         LDKOutPoint ret_var = DelayedPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
75318         int64_t ret_ref = 0;
75319         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75320         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75321         return ret_ref;
75322 }
75323
75324 void  CS_LDK_DelayedPaymentOutputDescriptor_set_outpoint(int64_t this_ptr, int64_t val) {
75325         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
75326         this_ptr_conv.inner = untag_ptr(this_ptr);
75327         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75328         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75329         this_ptr_conv.is_owned = false;
75330         LDKOutPoint val_conv;
75331         val_conv.inner = untag_ptr(val);
75332         val_conv.is_owned = ptr_is_owned(val);
75333         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
75334         val_conv = OutPoint_clone(&val_conv);
75335         DelayedPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
75336 }
75337
75338 int8_tArray  CS_LDK_DelayedPaymentOutputDescriptor_get_per_commitment_point(int64_t this_ptr) {
75339         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
75340         this_ptr_conv.inner = untag_ptr(this_ptr);
75341         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75342         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75343         this_ptr_conv.is_owned = false;
75344         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
75345         memcpy(ret_arr->elems, DelayedPaymentOutputDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
75346         return ret_arr;
75347 }
75348
75349 void  CS_LDK_DelayedPaymentOutputDescriptor_set_per_commitment_point(int64_t this_ptr, int8_tArray val) {
75350         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
75351         this_ptr_conv.inner = untag_ptr(this_ptr);
75352         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75353         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75354         this_ptr_conv.is_owned = false;
75355         LDKPublicKey val_ref;
75356         CHECK(val->arr_len == 33);
75357         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
75358         DelayedPaymentOutputDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
75359 }
75360
75361 int16_t  CS_LDK_DelayedPaymentOutputDescriptor_get_to_self_delay(int64_t this_ptr) {
75362         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
75363         this_ptr_conv.inner = untag_ptr(this_ptr);
75364         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75365         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75366         this_ptr_conv.is_owned = false;
75367         int16_t ret_conv = DelayedPaymentOutputDescriptor_get_to_self_delay(&this_ptr_conv);
75368         return ret_conv;
75369 }
75370
75371 void  CS_LDK_DelayedPaymentOutputDescriptor_set_to_self_delay(int64_t this_ptr, int16_t val) {
75372         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
75373         this_ptr_conv.inner = untag_ptr(this_ptr);
75374         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75375         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75376         this_ptr_conv.is_owned = false;
75377         DelayedPaymentOutputDescriptor_set_to_self_delay(&this_ptr_conv, val);
75378 }
75379
75380 int64_t  CS_LDK_DelayedPaymentOutputDescriptor_get_output(int64_t this_ptr) {
75381         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
75382         this_ptr_conv.inner = untag_ptr(this_ptr);
75383         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75384         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75385         this_ptr_conv.is_owned = false;
75386         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
75387         *ret_ref = DelayedPaymentOutputDescriptor_get_output(&this_ptr_conv);
75388         return tag_ptr(ret_ref, true);
75389 }
75390
75391 void  CS_LDK_DelayedPaymentOutputDescriptor_set_output(int64_t this_ptr, int64_t val) {
75392         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
75393         this_ptr_conv.inner = untag_ptr(this_ptr);
75394         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75395         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75396         this_ptr_conv.is_owned = false;
75397         void* val_ptr = untag_ptr(val);
75398         CHECK_ACCESS(val_ptr);
75399         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
75400         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
75401         DelayedPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
75402 }
75403
75404 int64_t  CS_LDK_DelayedPaymentOutputDescriptor_get_revocation_pubkey(int64_t this_ptr) {
75405         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
75406         this_ptr_conv.inner = untag_ptr(this_ptr);
75407         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75408         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75409         this_ptr_conv.is_owned = false;
75410         LDKRevocationKey ret_var = DelayedPaymentOutputDescriptor_get_revocation_pubkey(&this_ptr_conv);
75411         int64_t ret_ref = 0;
75412         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75413         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75414         return ret_ref;
75415 }
75416
75417 void  CS_LDK_DelayedPaymentOutputDescriptor_set_revocation_pubkey(int64_t this_ptr, int64_t val) {
75418         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
75419         this_ptr_conv.inner = untag_ptr(this_ptr);
75420         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75421         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75422         this_ptr_conv.is_owned = false;
75423         LDKRevocationKey val_conv;
75424         val_conv.inner = untag_ptr(val);
75425         val_conv.is_owned = ptr_is_owned(val);
75426         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
75427         val_conv = RevocationKey_clone(&val_conv);
75428         DelayedPaymentOutputDescriptor_set_revocation_pubkey(&this_ptr_conv, val_conv);
75429 }
75430
75431 int8_tArray  CS_LDK_DelayedPaymentOutputDescriptor_get_channel_keys_id(int64_t this_ptr) {
75432         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
75433         this_ptr_conv.inner = untag_ptr(this_ptr);
75434         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75435         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75436         this_ptr_conv.is_owned = false;
75437         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
75438         memcpy(ret_arr->elems, *DelayedPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
75439         return ret_arr;
75440 }
75441
75442 void  CS_LDK_DelayedPaymentOutputDescriptor_set_channel_keys_id(int64_t this_ptr, int8_tArray val) {
75443         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
75444         this_ptr_conv.inner = untag_ptr(this_ptr);
75445         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75446         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75447         this_ptr_conv.is_owned = false;
75448         LDKThirtyTwoBytes val_ref;
75449         CHECK(val->arr_len == 32);
75450         memcpy(val_ref.data, val->elems, 32); FREE(val);
75451         DelayedPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
75452 }
75453
75454 int64_t  CS_LDK_DelayedPaymentOutputDescriptor_get_channel_value_satoshis(int64_t this_ptr) {
75455         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
75456         this_ptr_conv.inner = untag_ptr(this_ptr);
75457         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75458         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75459         this_ptr_conv.is_owned = false;
75460         int64_t ret_conv = DelayedPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
75461         return ret_conv;
75462 }
75463
75464 void  CS_LDK_DelayedPaymentOutputDescriptor_set_channel_value_satoshis(int64_t this_ptr, int64_t val) {
75465         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
75466         this_ptr_conv.inner = untag_ptr(this_ptr);
75467         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75468         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75469         this_ptr_conv.is_owned = false;
75470         DelayedPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
75471 }
75472
75473 int64_t  CS_LDK_DelayedPaymentOutputDescriptor_get_channel_transaction_parameters(int64_t this_ptr) {
75474         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
75475         this_ptr_conv.inner = untag_ptr(this_ptr);
75476         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75477         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75478         this_ptr_conv.is_owned = false;
75479         LDKChannelTransactionParameters ret_var = DelayedPaymentOutputDescriptor_get_channel_transaction_parameters(&this_ptr_conv);
75480         int64_t ret_ref = 0;
75481         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75482         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75483         return ret_ref;
75484 }
75485
75486 void  CS_LDK_DelayedPaymentOutputDescriptor_set_channel_transaction_parameters(int64_t this_ptr, int64_t val) {
75487         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
75488         this_ptr_conv.inner = untag_ptr(this_ptr);
75489         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75490         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75491         this_ptr_conv.is_owned = false;
75492         LDKChannelTransactionParameters val_conv;
75493         val_conv.inner = untag_ptr(val);
75494         val_conv.is_owned = ptr_is_owned(val);
75495         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
75496         val_conv = ChannelTransactionParameters_clone(&val_conv);
75497         DelayedPaymentOutputDescriptor_set_channel_transaction_parameters(&this_ptr_conv, val_conv);
75498 }
75499
75500 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, int64_t channel_transaction_parameters_arg) {
75501         LDKOutPoint outpoint_arg_conv;
75502         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
75503         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
75504         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
75505         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
75506         LDKPublicKey per_commitment_point_arg_ref;
75507         CHECK(per_commitment_point_arg->arr_len == 33);
75508         memcpy(per_commitment_point_arg_ref.compressed_form, per_commitment_point_arg->elems, 33); FREE(per_commitment_point_arg);
75509         void* output_arg_ptr = untag_ptr(output_arg);
75510         CHECK_ACCESS(output_arg_ptr);
75511         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
75512         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
75513         LDKRevocationKey revocation_pubkey_arg_conv;
75514         revocation_pubkey_arg_conv.inner = untag_ptr(revocation_pubkey_arg);
75515         revocation_pubkey_arg_conv.is_owned = ptr_is_owned(revocation_pubkey_arg);
75516         CHECK_INNER_FIELD_ACCESS_OR_NULL(revocation_pubkey_arg_conv);
75517         revocation_pubkey_arg_conv = RevocationKey_clone(&revocation_pubkey_arg_conv);
75518         LDKThirtyTwoBytes channel_keys_id_arg_ref;
75519         CHECK(channel_keys_id_arg->arr_len == 32);
75520         memcpy(channel_keys_id_arg_ref.data, channel_keys_id_arg->elems, 32); FREE(channel_keys_id_arg);
75521         LDKChannelTransactionParameters channel_transaction_parameters_arg_conv;
75522         channel_transaction_parameters_arg_conv.inner = untag_ptr(channel_transaction_parameters_arg);
75523         channel_transaction_parameters_arg_conv.is_owned = ptr_is_owned(channel_transaction_parameters_arg);
75524         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_transaction_parameters_arg_conv);
75525         channel_transaction_parameters_arg_conv = ChannelTransactionParameters_clone(&channel_transaction_parameters_arg_conv);
75526         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, channel_transaction_parameters_arg_conv);
75527         int64_t ret_ref = 0;
75528         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75529         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75530         return ret_ref;
75531 }
75532
75533 static inline uint64_t DelayedPaymentOutputDescriptor_clone_ptr(LDKDelayedPaymentOutputDescriptor *NONNULL_PTR arg) {
75534         LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(arg);
75535         int64_t ret_ref = 0;
75536         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75537         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75538         return ret_ref;
75539 }
75540 int64_t  CS_LDK_DelayedPaymentOutputDescriptor_clone_ptr(int64_t arg) {
75541         LDKDelayedPaymentOutputDescriptor arg_conv;
75542         arg_conv.inner = untag_ptr(arg);
75543         arg_conv.is_owned = ptr_is_owned(arg);
75544         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
75545         arg_conv.is_owned = false;
75546         int64_t ret_conv = DelayedPaymentOutputDescriptor_clone_ptr(&arg_conv);
75547         return ret_conv;
75548 }
75549
75550 int64_t  CS_LDK_DelayedPaymentOutputDescriptor_clone(int64_t orig) {
75551         LDKDelayedPaymentOutputDescriptor orig_conv;
75552         orig_conv.inner = untag_ptr(orig);
75553         orig_conv.is_owned = ptr_is_owned(orig);
75554         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
75555         orig_conv.is_owned = false;
75556         LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(&orig_conv);
75557         int64_t ret_ref = 0;
75558         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75559         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75560         return ret_ref;
75561 }
75562
75563 int64_t  CS_LDK_DelayedPaymentOutputDescriptor_hash(int64_t o) {
75564         LDKDelayedPaymentOutputDescriptor o_conv;
75565         o_conv.inner = untag_ptr(o);
75566         o_conv.is_owned = ptr_is_owned(o);
75567         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
75568         o_conv.is_owned = false;
75569         int64_t ret_conv = DelayedPaymentOutputDescriptor_hash(&o_conv);
75570         return ret_conv;
75571 }
75572
75573 jboolean  CS_LDK_DelayedPaymentOutputDescriptor_eq(int64_t a, int64_t b) {
75574         LDKDelayedPaymentOutputDescriptor a_conv;
75575         a_conv.inner = untag_ptr(a);
75576         a_conv.is_owned = ptr_is_owned(a);
75577         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
75578         a_conv.is_owned = false;
75579         LDKDelayedPaymentOutputDescriptor b_conv;
75580         b_conv.inner = untag_ptr(b);
75581         b_conv.is_owned = ptr_is_owned(b);
75582         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
75583         b_conv.is_owned = false;
75584         jboolean ret_conv = DelayedPaymentOutputDescriptor_eq(&a_conv, &b_conv);
75585         return ret_conv;
75586 }
75587
75588 int8_tArray  CS_LDK_DelayedPaymentOutputDescriptor_write(int64_t obj) {
75589         LDKDelayedPaymentOutputDescriptor obj_conv;
75590         obj_conv.inner = untag_ptr(obj);
75591         obj_conv.is_owned = ptr_is_owned(obj);
75592         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
75593         obj_conv.is_owned = false;
75594         LDKCVec_u8Z ret_var = DelayedPaymentOutputDescriptor_write(&obj_conv);
75595         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
75596         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
75597         CVec_u8Z_free(ret_var);
75598         return ret_arr;
75599 }
75600
75601 int64_t  CS_LDK_DelayedPaymentOutputDescriptor_read(int8_tArray ser) {
75602         LDKu8slice ser_ref;
75603         ser_ref.datalen = ser->arr_len;
75604         ser_ref.data = ser->elems;
75605         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
75606         *ret_conv = DelayedPaymentOutputDescriptor_read(ser_ref);
75607         FREE(ser);
75608         return tag_ptr(ret_conv, true);
75609 }
75610
75611 void  CS_LDK_StaticPaymentOutputDescriptor_free(int64_t this_obj) {
75612         LDKStaticPaymentOutputDescriptor this_obj_conv;
75613         this_obj_conv.inner = untag_ptr(this_obj);
75614         this_obj_conv.is_owned = ptr_is_owned(this_obj);
75615         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
75616         StaticPaymentOutputDescriptor_free(this_obj_conv);
75617 }
75618
75619 int64_t  CS_LDK_StaticPaymentOutputDescriptor_get_outpoint(int64_t this_ptr) {
75620         LDKStaticPaymentOutputDescriptor this_ptr_conv;
75621         this_ptr_conv.inner = untag_ptr(this_ptr);
75622         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75623         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75624         this_ptr_conv.is_owned = false;
75625         LDKOutPoint ret_var = StaticPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
75626         int64_t ret_ref = 0;
75627         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75628         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75629         return ret_ref;
75630 }
75631
75632 void  CS_LDK_StaticPaymentOutputDescriptor_set_outpoint(int64_t this_ptr, int64_t val) {
75633         LDKStaticPaymentOutputDescriptor this_ptr_conv;
75634         this_ptr_conv.inner = untag_ptr(this_ptr);
75635         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75636         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75637         this_ptr_conv.is_owned = false;
75638         LDKOutPoint val_conv;
75639         val_conv.inner = untag_ptr(val);
75640         val_conv.is_owned = ptr_is_owned(val);
75641         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
75642         val_conv = OutPoint_clone(&val_conv);
75643         StaticPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
75644 }
75645
75646 int64_t  CS_LDK_StaticPaymentOutputDescriptor_get_output(int64_t this_ptr) {
75647         LDKStaticPaymentOutputDescriptor this_ptr_conv;
75648         this_ptr_conv.inner = untag_ptr(this_ptr);
75649         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75650         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75651         this_ptr_conv.is_owned = false;
75652         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
75653         *ret_ref = StaticPaymentOutputDescriptor_get_output(&this_ptr_conv);
75654         return tag_ptr(ret_ref, true);
75655 }
75656
75657 void  CS_LDK_StaticPaymentOutputDescriptor_set_output(int64_t this_ptr, int64_t val) {
75658         LDKStaticPaymentOutputDescriptor this_ptr_conv;
75659         this_ptr_conv.inner = untag_ptr(this_ptr);
75660         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75661         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75662         this_ptr_conv.is_owned = false;
75663         void* val_ptr = untag_ptr(val);
75664         CHECK_ACCESS(val_ptr);
75665         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
75666         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
75667         StaticPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
75668 }
75669
75670 int8_tArray  CS_LDK_StaticPaymentOutputDescriptor_get_channel_keys_id(int64_t this_ptr) {
75671         LDKStaticPaymentOutputDescriptor this_ptr_conv;
75672         this_ptr_conv.inner = untag_ptr(this_ptr);
75673         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75674         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75675         this_ptr_conv.is_owned = false;
75676         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
75677         memcpy(ret_arr->elems, *StaticPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
75678         return ret_arr;
75679 }
75680
75681 void  CS_LDK_StaticPaymentOutputDescriptor_set_channel_keys_id(int64_t this_ptr, int8_tArray val) {
75682         LDKStaticPaymentOutputDescriptor this_ptr_conv;
75683         this_ptr_conv.inner = untag_ptr(this_ptr);
75684         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75685         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75686         this_ptr_conv.is_owned = false;
75687         LDKThirtyTwoBytes val_ref;
75688         CHECK(val->arr_len == 32);
75689         memcpy(val_ref.data, val->elems, 32); FREE(val);
75690         StaticPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
75691 }
75692
75693 int64_t  CS_LDK_StaticPaymentOutputDescriptor_get_channel_value_satoshis(int64_t this_ptr) {
75694         LDKStaticPaymentOutputDescriptor this_ptr_conv;
75695         this_ptr_conv.inner = untag_ptr(this_ptr);
75696         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75697         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75698         this_ptr_conv.is_owned = false;
75699         int64_t ret_conv = StaticPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
75700         return ret_conv;
75701 }
75702
75703 void  CS_LDK_StaticPaymentOutputDescriptor_set_channel_value_satoshis(int64_t this_ptr, int64_t val) {
75704         LDKStaticPaymentOutputDescriptor this_ptr_conv;
75705         this_ptr_conv.inner = untag_ptr(this_ptr);
75706         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75707         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75708         this_ptr_conv.is_owned = false;
75709         StaticPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
75710 }
75711
75712 int64_t  CS_LDK_StaticPaymentOutputDescriptor_get_channel_transaction_parameters(int64_t this_ptr) {
75713         LDKStaticPaymentOutputDescriptor this_ptr_conv;
75714         this_ptr_conv.inner = untag_ptr(this_ptr);
75715         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75716         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75717         this_ptr_conv.is_owned = false;
75718         LDKChannelTransactionParameters ret_var = StaticPaymentOutputDescriptor_get_channel_transaction_parameters(&this_ptr_conv);
75719         int64_t ret_ref = 0;
75720         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75721         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75722         return ret_ref;
75723 }
75724
75725 void  CS_LDK_StaticPaymentOutputDescriptor_set_channel_transaction_parameters(int64_t this_ptr, int64_t val) {
75726         LDKStaticPaymentOutputDescriptor this_ptr_conv;
75727         this_ptr_conv.inner = untag_ptr(this_ptr);
75728         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75729         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75730         this_ptr_conv.is_owned = false;
75731         LDKChannelTransactionParameters val_conv;
75732         val_conv.inner = untag_ptr(val);
75733         val_conv.is_owned = ptr_is_owned(val);
75734         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
75735         val_conv = ChannelTransactionParameters_clone(&val_conv);
75736         StaticPaymentOutputDescriptor_set_channel_transaction_parameters(&this_ptr_conv, val_conv);
75737 }
75738
75739 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) {
75740         LDKOutPoint outpoint_arg_conv;
75741         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
75742         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
75743         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
75744         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
75745         void* output_arg_ptr = untag_ptr(output_arg);
75746         CHECK_ACCESS(output_arg_ptr);
75747         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
75748         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
75749         LDKThirtyTwoBytes channel_keys_id_arg_ref;
75750         CHECK(channel_keys_id_arg->arr_len == 32);
75751         memcpy(channel_keys_id_arg_ref.data, channel_keys_id_arg->elems, 32); FREE(channel_keys_id_arg);
75752         LDKChannelTransactionParameters channel_transaction_parameters_arg_conv;
75753         channel_transaction_parameters_arg_conv.inner = untag_ptr(channel_transaction_parameters_arg);
75754         channel_transaction_parameters_arg_conv.is_owned = ptr_is_owned(channel_transaction_parameters_arg);
75755         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_transaction_parameters_arg_conv);
75756         channel_transaction_parameters_arg_conv = ChannelTransactionParameters_clone(&channel_transaction_parameters_arg_conv);
75757         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);
75758         int64_t ret_ref = 0;
75759         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75760         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75761         return ret_ref;
75762 }
75763
75764 static inline uint64_t StaticPaymentOutputDescriptor_clone_ptr(LDKStaticPaymentOutputDescriptor *NONNULL_PTR arg) {
75765         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(arg);
75766         int64_t ret_ref = 0;
75767         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75768         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75769         return ret_ref;
75770 }
75771 int64_t  CS_LDK_StaticPaymentOutputDescriptor_clone_ptr(int64_t arg) {
75772         LDKStaticPaymentOutputDescriptor arg_conv;
75773         arg_conv.inner = untag_ptr(arg);
75774         arg_conv.is_owned = ptr_is_owned(arg);
75775         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
75776         arg_conv.is_owned = false;
75777         int64_t ret_conv = StaticPaymentOutputDescriptor_clone_ptr(&arg_conv);
75778         return ret_conv;
75779 }
75780
75781 int64_t  CS_LDK_StaticPaymentOutputDescriptor_clone(int64_t orig) {
75782         LDKStaticPaymentOutputDescriptor orig_conv;
75783         orig_conv.inner = untag_ptr(orig);
75784         orig_conv.is_owned = ptr_is_owned(orig);
75785         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
75786         orig_conv.is_owned = false;
75787         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(&orig_conv);
75788         int64_t ret_ref = 0;
75789         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75790         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75791         return ret_ref;
75792 }
75793
75794 int64_t  CS_LDK_StaticPaymentOutputDescriptor_hash(int64_t o) {
75795         LDKStaticPaymentOutputDescriptor o_conv;
75796         o_conv.inner = untag_ptr(o);
75797         o_conv.is_owned = ptr_is_owned(o);
75798         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
75799         o_conv.is_owned = false;
75800         int64_t ret_conv = StaticPaymentOutputDescriptor_hash(&o_conv);
75801         return ret_conv;
75802 }
75803
75804 jboolean  CS_LDK_StaticPaymentOutputDescriptor_eq(int64_t a, int64_t b) {
75805         LDKStaticPaymentOutputDescriptor a_conv;
75806         a_conv.inner = untag_ptr(a);
75807         a_conv.is_owned = ptr_is_owned(a);
75808         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
75809         a_conv.is_owned = false;
75810         LDKStaticPaymentOutputDescriptor b_conv;
75811         b_conv.inner = untag_ptr(b);
75812         b_conv.is_owned = ptr_is_owned(b);
75813         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
75814         b_conv.is_owned = false;
75815         jboolean ret_conv = StaticPaymentOutputDescriptor_eq(&a_conv, &b_conv);
75816         return ret_conv;
75817 }
75818
75819 int64_t  CS_LDK_StaticPaymentOutputDescriptor_witness_script(int64_t this_arg) {
75820         LDKStaticPaymentOutputDescriptor this_arg_conv;
75821         this_arg_conv.inner = untag_ptr(this_arg);
75822         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75823         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75824         this_arg_conv.is_owned = false;
75825         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
75826         *ret_copy = StaticPaymentOutputDescriptor_witness_script(&this_arg_conv);
75827         int64_t ret_ref = tag_ptr(ret_copy, true);
75828         return ret_ref;
75829 }
75830
75831 int64_t  CS_LDK_StaticPaymentOutputDescriptor_max_witness_length(int64_t this_arg) {
75832         LDKStaticPaymentOutputDescriptor this_arg_conv;
75833         this_arg_conv.inner = untag_ptr(this_arg);
75834         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75835         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75836         this_arg_conv.is_owned = false;
75837         int64_t ret_conv = StaticPaymentOutputDescriptor_max_witness_length(&this_arg_conv);
75838         return ret_conv;
75839 }
75840
75841 int8_tArray  CS_LDK_StaticPaymentOutputDescriptor_write(int64_t obj) {
75842         LDKStaticPaymentOutputDescriptor obj_conv;
75843         obj_conv.inner = untag_ptr(obj);
75844         obj_conv.is_owned = ptr_is_owned(obj);
75845         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
75846         obj_conv.is_owned = false;
75847         LDKCVec_u8Z ret_var = StaticPaymentOutputDescriptor_write(&obj_conv);
75848         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
75849         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
75850         CVec_u8Z_free(ret_var);
75851         return ret_arr;
75852 }
75853
75854 int64_t  CS_LDK_StaticPaymentOutputDescriptor_read(int8_tArray ser) {
75855         LDKu8slice ser_ref;
75856         ser_ref.datalen = ser->arr_len;
75857         ser_ref.data = ser->elems;
75858         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
75859         *ret_conv = StaticPaymentOutputDescriptor_read(ser_ref);
75860         FREE(ser);
75861         return tag_ptr(ret_conv, true);
75862 }
75863
75864 void  CS_LDK_SpendableOutputDescriptor_free(int64_t this_ptr) {
75865         if (!ptr_is_owned(this_ptr)) return;
75866         void* this_ptr_ptr = untag_ptr(this_ptr);
75867         CHECK_ACCESS(this_ptr_ptr);
75868         LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)(this_ptr_ptr);
75869         FREE(untag_ptr(this_ptr));
75870         SpendableOutputDescriptor_free(this_ptr_conv);
75871 }
75872
75873 static inline uint64_t SpendableOutputDescriptor_clone_ptr(LDKSpendableOutputDescriptor *NONNULL_PTR arg) {
75874         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
75875         *ret_copy = SpendableOutputDescriptor_clone(arg);
75876         int64_t ret_ref = tag_ptr(ret_copy, true);
75877         return ret_ref;
75878 }
75879 int64_t  CS_LDK_SpendableOutputDescriptor_clone_ptr(int64_t arg) {
75880         LDKSpendableOutputDescriptor* arg_conv = (LDKSpendableOutputDescriptor*)untag_ptr(arg);
75881         int64_t ret_conv = SpendableOutputDescriptor_clone_ptr(arg_conv);
75882         return ret_conv;
75883 }
75884
75885 int64_t  CS_LDK_SpendableOutputDescriptor_clone(int64_t orig) {
75886         LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)untag_ptr(orig);
75887         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
75888         *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
75889         int64_t ret_ref = tag_ptr(ret_copy, true);
75890         return ret_ref;
75891 }
75892
75893 int64_t  CS_LDK_SpendableOutputDescriptor_static_output(int64_t outpoint, int64_t output, int8_tArray channel_keys_id) {
75894         LDKOutPoint outpoint_conv;
75895         outpoint_conv.inner = untag_ptr(outpoint);
75896         outpoint_conv.is_owned = ptr_is_owned(outpoint);
75897         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_conv);
75898         outpoint_conv = OutPoint_clone(&outpoint_conv);
75899         void* output_ptr = untag_ptr(output);
75900         CHECK_ACCESS(output_ptr);
75901         LDKTxOut output_conv = *(LDKTxOut*)(output_ptr);
75902         output_conv = TxOut_clone((LDKTxOut*)untag_ptr(output));
75903         LDKThirtyTwoBytes channel_keys_id_ref;
75904         CHECK(channel_keys_id->arr_len == 32);
75905         memcpy(channel_keys_id_ref.data, channel_keys_id->elems, 32); FREE(channel_keys_id);
75906         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
75907         *ret_copy = SpendableOutputDescriptor_static_output(outpoint_conv, output_conv, channel_keys_id_ref);
75908         int64_t ret_ref = tag_ptr(ret_copy, true);
75909         return ret_ref;
75910 }
75911
75912 int64_t  CS_LDK_SpendableOutputDescriptor_delayed_payment_output(int64_t a) {
75913         LDKDelayedPaymentOutputDescriptor a_conv;
75914         a_conv.inner = untag_ptr(a);
75915         a_conv.is_owned = ptr_is_owned(a);
75916         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
75917         a_conv = DelayedPaymentOutputDescriptor_clone(&a_conv);
75918         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
75919         *ret_copy = SpendableOutputDescriptor_delayed_payment_output(a_conv);
75920         int64_t ret_ref = tag_ptr(ret_copy, true);
75921         return ret_ref;
75922 }
75923
75924 int64_t  CS_LDK_SpendableOutputDescriptor_static_payment_output(int64_t a) {
75925         LDKStaticPaymentOutputDescriptor a_conv;
75926         a_conv.inner = untag_ptr(a);
75927         a_conv.is_owned = ptr_is_owned(a);
75928         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
75929         a_conv = StaticPaymentOutputDescriptor_clone(&a_conv);
75930         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
75931         *ret_copy = SpendableOutputDescriptor_static_payment_output(a_conv);
75932         int64_t ret_ref = tag_ptr(ret_copy, true);
75933         return ret_ref;
75934 }
75935
75936 int64_t  CS_LDK_SpendableOutputDescriptor_hash(int64_t o) {
75937         LDKSpendableOutputDescriptor* o_conv = (LDKSpendableOutputDescriptor*)untag_ptr(o);
75938         int64_t ret_conv = SpendableOutputDescriptor_hash(o_conv);
75939         return ret_conv;
75940 }
75941
75942 jboolean  CS_LDK_SpendableOutputDescriptor_eq(int64_t a, int64_t b) {
75943         LDKSpendableOutputDescriptor* a_conv = (LDKSpendableOutputDescriptor*)untag_ptr(a);
75944         LDKSpendableOutputDescriptor* b_conv = (LDKSpendableOutputDescriptor*)untag_ptr(b);
75945         jboolean ret_conv = SpendableOutputDescriptor_eq(a_conv, b_conv);
75946         return ret_conv;
75947 }
75948
75949 int8_tArray  CS_LDK_SpendableOutputDescriptor_write(int64_t obj) {
75950         LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)untag_ptr(obj);
75951         LDKCVec_u8Z ret_var = SpendableOutputDescriptor_write(obj_conv);
75952         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
75953         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
75954         CVec_u8Z_free(ret_var);
75955         return ret_arr;
75956 }
75957
75958 int64_t  CS_LDK_SpendableOutputDescriptor_read(int8_tArray ser) {
75959         LDKu8slice ser_ref;
75960         ser_ref.datalen = ser->arr_len;
75961         ser_ref.data = ser->elems;
75962         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
75963         *ret_conv = SpendableOutputDescriptor_read(ser_ref);
75964         FREE(ser);
75965         return tag_ptr(ret_conv, true);
75966 }
75967
75968 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) {
75969         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
75970         descriptors_constr.datalen = descriptors->arr_len;
75971         if (descriptors_constr.datalen > 0)
75972                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
75973         else
75974                 descriptors_constr.data = NULL;
75975         int64_t* descriptors_vals = descriptors->elems;
75976         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
75977                 int64_t descriptors_conv_27 = descriptors_vals[b];
75978                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
75979                 CHECK_ACCESS(descriptors_conv_27_ptr);
75980                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
75981                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
75982                 descriptors_constr.data[b] = descriptors_conv_27_conv;
75983         }
75984         FREE(descriptors);
75985         LDKCVec_TxOutZ outputs_constr;
75986         outputs_constr.datalen = outputs->arr_len;
75987         if (outputs_constr.datalen > 0)
75988                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
75989         else
75990                 outputs_constr.data = NULL;
75991         int64_t* outputs_vals = outputs->elems;
75992         for (size_t h = 0; h < outputs_constr.datalen; h++) {
75993                 int64_t outputs_conv_7 = outputs_vals[h];
75994                 void* outputs_conv_7_ptr = untag_ptr(outputs_conv_7);
75995                 CHECK_ACCESS(outputs_conv_7_ptr);
75996                 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
75997                 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(outputs_conv_7));
75998                 outputs_constr.data[h] = outputs_conv_7_conv;
75999         }
76000         FREE(outputs);
76001         LDKCVec_u8Z change_destination_script_ref;
76002         change_destination_script_ref.datalen = change_destination_script->arr_len;
76003         change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
76004         memcpy(change_destination_script_ref.data, change_destination_script->elems, change_destination_script_ref.datalen); FREE(change_destination_script);
76005         void* locktime_ptr = untag_ptr(locktime);
76006         CHECK_ACCESS(locktime_ptr);
76007         LDKCOption_u32Z locktime_conv = *(LDKCOption_u32Z*)(locktime_ptr);
76008         locktime_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(locktime));
76009         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ), "LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ");
76010         *ret_conv = SpendableOutputDescriptor_create_spendable_outputs_psbt(descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight, locktime_conv);
76011         return tag_ptr(ret_conv, true);
76012 }
76013
76014 void  CS_LDK_ChannelDerivationParameters_free(int64_t this_obj) {
76015         LDKChannelDerivationParameters this_obj_conv;
76016         this_obj_conv.inner = untag_ptr(this_obj);
76017         this_obj_conv.is_owned = ptr_is_owned(this_obj);
76018         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
76019         ChannelDerivationParameters_free(this_obj_conv);
76020 }
76021
76022 int64_t  CS_LDK_ChannelDerivationParameters_get_value_satoshis(int64_t this_ptr) {
76023         LDKChannelDerivationParameters this_ptr_conv;
76024         this_ptr_conv.inner = untag_ptr(this_ptr);
76025         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76026         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76027         this_ptr_conv.is_owned = false;
76028         int64_t ret_conv = ChannelDerivationParameters_get_value_satoshis(&this_ptr_conv);
76029         return ret_conv;
76030 }
76031
76032 void  CS_LDK_ChannelDerivationParameters_set_value_satoshis(int64_t this_ptr, int64_t val) {
76033         LDKChannelDerivationParameters this_ptr_conv;
76034         this_ptr_conv.inner = untag_ptr(this_ptr);
76035         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76036         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76037         this_ptr_conv.is_owned = false;
76038         ChannelDerivationParameters_set_value_satoshis(&this_ptr_conv, val);
76039 }
76040
76041 int8_tArray  CS_LDK_ChannelDerivationParameters_get_keys_id(int64_t this_ptr) {
76042         LDKChannelDerivationParameters this_ptr_conv;
76043         this_ptr_conv.inner = untag_ptr(this_ptr);
76044         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76045         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76046         this_ptr_conv.is_owned = false;
76047         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
76048         memcpy(ret_arr->elems, *ChannelDerivationParameters_get_keys_id(&this_ptr_conv), 32);
76049         return ret_arr;
76050 }
76051
76052 void  CS_LDK_ChannelDerivationParameters_set_keys_id(int64_t this_ptr, int8_tArray val) {
76053         LDKChannelDerivationParameters this_ptr_conv;
76054         this_ptr_conv.inner = untag_ptr(this_ptr);
76055         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76056         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76057         this_ptr_conv.is_owned = false;
76058         LDKThirtyTwoBytes val_ref;
76059         CHECK(val->arr_len == 32);
76060         memcpy(val_ref.data, val->elems, 32); FREE(val);
76061         ChannelDerivationParameters_set_keys_id(&this_ptr_conv, val_ref);
76062 }
76063
76064 int64_t  CS_LDK_ChannelDerivationParameters_get_transaction_parameters(int64_t this_ptr) {
76065         LDKChannelDerivationParameters this_ptr_conv;
76066         this_ptr_conv.inner = untag_ptr(this_ptr);
76067         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76068         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76069         this_ptr_conv.is_owned = false;
76070         LDKChannelTransactionParameters ret_var = ChannelDerivationParameters_get_transaction_parameters(&this_ptr_conv);
76071         int64_t ret_ref = 0;
76072         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76073         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76074         return ret_ref;
76075 }
76076
76077 void  CS_LDK_ChannelDerivationParameters_set_transaction_parameters(int64_t this_ptr, int64_t val) {
76078         LDKChannelDerivationParameters this_ptr_conv;
76079         this_ptr_conv.inner = untag_ptr(this_ptr);
76080         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76081         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76082         this_ptr_conv.is_owned = false;
76083         LDKChannelTransactionParameters val_conv;
76084         val_conv.inner = untag_ptr(val);
76085         val_conv.is_owned = ptr_is_owned(val);
76086         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
76087         val_conv = ChannelTransactionParameters_clone(&val_conv);
76088         ChannelDerivationParameters_set_transaction_parameters(&this_ptr_conv, val_conv);
76089 }
76090
76091 int64_t  CS_LDK_ChannelDerivationParameters_new(int64_t value_satoshis_arg, int8_tArray keys_id_arg, int64_t transaction_parameters_arg) {
76092         LDKThirtyTwoBytes keys_id_arg_ref;
76093         CHECK(keys_id_arg->arr_len == 32);
76094         memcpy(keys_id_arg_ref.data, keys_id_arg->elems, 32); FREE(keys_id_arg);
76095         LDKChannelTransactionParameters transaction_parameters_arg_conv;
76096         transaction_parameters_arg_conv.inner = untag_ptr(transaction_parameters_arg);
76097         transaction_parameters_arg_conv.is_owned = ptr_is_owned(transaction_parameters_arg);
76098         CHECK_INNER_FIELD_ACCESS_OR_NULL(transaction_parameters_arg_conv);
76099         transaction_parameters_arg_conv = ChannelTransactionParameters_clone(&transaction_parameters_arg_conv);
76100         LDKChannelDerivationParameters ret_var = ChannelDerivationParameters_new(value_satoshis_arg, keys_id_arg_ref, transaction_parameters_arg_conv);
76101         int64_t ret_ref = 0;
76102         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76103         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76104         return ret_ref;
76105 }
76106
76107 static inline uint64_t ChannelDerivationParameters_clone_ptr(LDKChannelDerivationParameters *NONNULL_PTR arg) {
76108         LDKChannelDerivationParameters ret_var = ChannelDerivationParameters_clone(arg);
76109         int64_t ret_ref = 0;
76110         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76111         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76112         return ret_ref;
76113 }
76114 int64_t  CS_LDK_ChannelDerivationParameters_clone_ptr(int64_t arg) {
76115         LDKChannelDerivationParameters arg_conv;
76116         arg_conv.inner = untag_ptr(arg);
76117         arg_conv.is_owned = ptr_is_owned(arg);
76118         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
76119         arg_conv.is_owned = false;
76120         int64_t ret_conv = ChannelDerivationParameters_clone_ptr(&arg_conv);
76121         return ret_conv;
76122 }
76123
76124 int64_t  CS_LDK_ChannelDerivationParameters_clone(int64_t orig) {
76125         LDKChannelDerivationParameters orig_conv;
76126         orig_conv.inner = untag_ptr(orig);
76127         orig_conv.is_owned = ptr_is_owned(orig);
76128         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
76129         orig_conv.is_owned = false;
76130         LDKChannelDerivationParameters ret_var = ChannelDerivationParameters_clone(&orig_conv);
76131         int64_t ret_ref = 0;
76132         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76133         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76134         return ret_ref;
76135 }
76136
76137 jboolean  CS_LDK_ChannelDerivationParameters_eq(int64_t a, int64_t b) {
76138         LDKChannelDerivationParameters a_conv;
76139         a_conv.inner = untag_ptr(a);
76140         a_conv.is_owned = ptr_is_owned(a);
76141         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
76142         a_conv.is_owned = false;
76143         LDKChannelDerivationParameters b_conv;
76144         b_conv.inner = untag_ptr(b);
76145         b_conv.is_owned = ptr_is_owned(b);
76146         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
76147         b_conv.is_owned = false;
76148         jboolean ret_conv = ChannelDerivationParameters_eq(&a_conv, &b_conv);
76149         return ret_conv;
76150 }
76151
76152 int8_tArray  CS_LDK_ChannelDerivationParameters_write(int64_t obj) {
76153         LDKChannelDerivationParameters obj_conv;
76154         obj_conv.inner = untag_ptr(obj);
76155         obj_conv.is_owned = ptr_is_owned(obj);
76156         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
76157         obj_conv.is_owned = false;
76158         LDKCVec_u8Z ret_var = ChannelDerivationParameters_write(&obj_conv);
76159         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
76160         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
76161         CVec_u8Z_free(ret_var);
76162         return ret_arr;
76163 }
76164
76165 int64_t  CS_LDK_ChannelDerivationParameters_read(int8_tArray ser) {
76166         LDKu8slice ser_ref;
76167         ser_ref.datalen = ser->arr_len;
76168         ser_ref.data = ser->elems;
76169         LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ");
76170         *ret_conv = ChannelDerivationParameters_read(ser_ref);
76171         FREE(ser);
76172         return tag_ptr(ret_conv, true);
76173 }
76174
76175 void  CS_LDK_HTLCDescriptor_free(int64_t this_obj) {
76176         LDKHTLCDescriptor this_obj_conv;
76177         this_obj_conv.inner = untag_ptr(this_obj);
76178         this_obj_conv.is_owned = ptr_is_owned(this_obj);
76179         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
76180         HTLCDescriptor_free(this_obj_conv);
76181 }
76182
76183 int64_t  CS_LDK_HTLCDescriptor_get_channel_derivation_parameters(int64_t this_ptr) {
76184         LDKHTLCDescriptor this_ptr_conv;
76185         this_ptr_conv.inner = untag_ptr(this_ptr);
76186         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76187         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76188         this_ptr_conv.is_owned = false;
76189         LDKChannelDerivationParameters ret_var = HTLCDescriptor_get_channel_derivation_parameters(&this_ptr_conv);
76190         int64_t ret_ref = 0;
76191         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76192         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76193         return ret_ref;
76194 }
76195
76196 void  CS_LDK_HTLCDescriptor_set_channel_derivation_parameters(int64_t this_ptr, int64_t val) {
76197         LDKHTLCDescriptor this_ptr_conv;
76198         this_ptr_conv.inner = untag_ptr(this_ptr);
76199         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76200         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76201         this_ptr_conv.is_owned = false;
76202         LDKChannelDerivationParameters val_conv;
76203         val_conv.inner = untag_ptr(val);
76204         val_conv.is_owned = ptr_is_owned(val);
76205         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
76206         val_conv = ChannelDerivationParameters_clone(&val_conv);
76207         HTLCDescriptor_set_channel_derivation_parameters(&this_ptr_conv, val_conv);
76208 }
76209
76210 int8_tArray  CS_LDK_HTLCDescriptor_get_commitment_txid(int64_t this_ptr) {
76211         LDKHTLCDescriptor this_ptr_conv;
76212         this_ptr_conv.inner = untag_ptr(this_ptr);
76213         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76214         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76215         this_ptr_conv.is_owned = false;
76216         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
76217         memcpy(ret_arr->elems, *HTLCDescriptor_get_commitment_txid(&this_ptr_conv), 32);
76218         return ret_arr;
76219 }
76220
76221 void  CS_LDK_HTLCDescriptor_set_commitment_txid(int64_t this_ptr, int8_tArray val) {
76222         LDKHTLCDescriptor this_ptr_conv;
76223         this_ptr_conv.inner = untag_ptr(this_ptr);
76224         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76225         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76226         this_ptr_conv.is_owned = false;
76227         LDKThirtyTwoBytes val_ref;
76228         CHECK(val->arr_len == 32);
76229         memcpy(val_ref.data, val->elems, 32); FREE(val);
76230         HTLCDescriptor_set_commitment_txid(&this_ptr_conv, val_ref);
76231 }
76232
76233 int64_t  CS_LDK_HTLCDescriptor_get_per_commitment_number(int64_t this_ptr) {
76234         LDKHTLCDescriptor this_ptr_conv;
76235         this_ptr_conv.inner = untag_ptr(this_ptr);
76236         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76237         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76238         this_ptr_conv.is_owned = false;
76239         int64_t ret_conv = HTLCDescriptor_get_per_commitment_number(&this_ptr_conv);
76240         return ret_conv;
76241 }
76242
76243 void  CS_LDK_HTLCDescriptor_set_per_commitment_number(int64_t this_ptr, int64_t val) {
76244         LDKHTLCDescriptor this_ptr_conv;
76245         this_ptr_conv.inner = untag_ptr(this_ptr);
76246         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76247         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76248         this_ptr_conv.is_owned = false;
76249         HTLCDescriptor_set_per_commitment_number(&this_ptr_conv, val);
76250 }
76251
76252 int8_tArray  CS_LDK_HTLCDescriptor_get_per_commitment_point(int64_t this_ptr) {
76253         LDKHTLCDescriptor this_ptr_conv;
76254         this_ptr_conv.inner = untag_ptr(this_ptr);
76255         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76256         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76257         this_ptr_conv.is_owned = false;
76258         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
76259         memcpy(ret_arr->elems, HTLCDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
76260         return ret_arr;
76261 }
76262
76263 void  CS_LDK_HTLCDescriptor_set_per_commitment_point(int64_t this_ptr, int8_tArray val) {
76264         LDKHTLCDescriptor this_ptr_conv;
76265         this_ptr_conv.inner = untag_ptr(this_ptr);
76266         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76267         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76268         this_ptr_conv.is_owned = false;
76269         LDKPublicKey val_ref;
76270         CHECK(val->arr_len == 33);
76271         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
76272         HTLCDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
76273 }
76274
76275 int32_t  CS_LDK_HTLCDescriptor_get_feerate_per_kw(int64_t this_ptr) {
76276         LDKHTLCDescriptor this_ptr_conv;
76277         this_ptr_conv.inner = untag_ptr(this_ptr);
76278         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76279         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76280         this_ptr_conv.is_owned = false;
76281         int32_t ret_conv = HTLCDescriptor_get_feerate_per_kw(&this_ptr_conv);
76282         return ret_conv;
76283 }
76284
76285 void  CS_LDK_HTLCDescriptor_set_feerate_per_kw(int64_t this_ptr, int32_t val) {
76286         LDKHTLCDescriptor this_ptr_conv;
76287         this_ptr_conv.inner = untag_ptr(this_ptr);
76288         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76289         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76290         this_ptr_conv.is_owned = false;
76291         HTLCDescriptor_set_feerate_per_kw(&this_ptr_conv, val);
76292 }
76293
76294 int64_t  CS_LDK_HTLCDescriptor_get_htlc(int64_t this_ptr) {
76295         LDKHTLCDescriptor this_ptr_conv;
76296         this_ptr_conv.inner = untag_ptr(this_ptr);
76297         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76298         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76299         this_ptr_conv.is_owned = false;
76300         LDKHTLCOutputInCommitment ret_var = HTLCDescriptor_get_htlc(&this_ptr_conv);
76301         int64_t ret_ref = 0;
76302         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76303         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76304         return ret_ref;
76305 }
76306
76307 void  CS_LDK_HTLCDescriptor_set_htlc(int64_t this_ptr, int64_t val) {
76308         LDKHTLCDescriptor this_ptr_conv;
76309         this_ptr_conv.inner = untag_ptr(this_ptr);
76310         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76311         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76312         this_ptr_conv.is_owned = false;
76313         LDKHTLCOutputInCommitment val_conv;
76314         val_conv.inner = untag_ptr(val);
76315         val_conv.is_owned = ptr_is_owned(val);
76316         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
76317         val_conv = HTLCOutputInCommitment_clone(&val_conv);
76318         HTLCDescriptor_set_htlc(&this_ptr_conv, val_conv);
76319 }
76320
76321 int64_t  CS_LDK_HTLCDescriptor_get_preimage(int64_t this_ptr) {
76322         LDKHTLCDescriptor this_ptr_conv;
76323         this_ptr_conv.inner = untag_ptr(this_ptr);
76324         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76325         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76326         this_ptr_conv.is_owned = false;
76327         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
76328         *ret_copy = HTLCDescriptor_get_preimage(&this_ptr_conv);
76329         int64_t ret_ref = tag_ptr(ret_copy, true);
76330         return ret_ref;
76331 }
76332
76333 void  CS_LDK_HTLCDescriptor_set_preimage(int64_t this_ptr, int64_t val) {
76334         LDKHTLCDescriptor this_ptr_conv;
76335         this_ptr_conv.inner = untag_ptr(this_ptr);
76336         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76337         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76338         this_ptr_conv.is_owned = false;
76339         void* val_ptr = untag_ptr(val);
76340         CHECK_ACCESS(val_ptr);
76341         LDKCOption_ThirtyTwoBytesZ val_conv = *(LDKCOption_ThirtyTwoBytesZ*)(val_ptr);
76342         val_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(val));
76343         HTLCDescriptor_set_preimage(&this_ptr_conv, val_conv);
76344 }
76345
76346 int8_tArray  CS_LDK_HTLCDescriptor_get_counterparty_sig(int64_t this_ptr) {
76347         LDKHTLCDescriptor this_ptr_conv;
76348         this_ptr_conv.inner = untag_ptr(this_ptr);
76349         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76350         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76351         this_ptr_conv.is_owned = false;
76352         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
76353         memcpy(ret_arr->elems, HTLCDescriptor_get_counterparty_sig(&this_ptr_conv).compact_form, 64);
76354         return ret_arr;
76355 }
76356
76357 void  CS_LDK_HTLCDescriptor_set_counterparty_sig(int64_t this_ptr, int8_tArray val) {
76358         LDKHTLCDescriptor this_ptr_conv;
76359         this_ptr_conv.inner = untag_ptr(this_ptr);
76360         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76361         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76362         this_ptr_conv.is_owned = false;
76363         LDKECDSASignature val_ref;
76364         CHECK(val->arr_len == 64);
76365         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
76366         HTLCDescriptor_set_counterparty_sig(&this_ptr_conv, val_ref);
76367 }
76368
76369 int64_t  CS_LDK_HTLCDescriptor_new(int64_t channel_derivation_parameters_arg, int8_tArray commitment_txid_arg, int64_t per_commitment_number_arg, int8_tArray per_commitment_point_arg, int32_t feerate_per_kw_arg, int64_t htlc_arg, int64_t preimage_arg, int8_tArray counterparty_sig_arg) {
76370         LDKChannelDerivationParameters channel_derivation_parameters_arg_conv;
76371         channel_derivation_parameters_arg_conv.inner = untag_ptr(channel_derivation_parameters_arg);
76372         channel_derivation_parameters_arg_conv.is_owned = ptr_is_owned(channel_derivation_parameters_arg);
76373         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_derivation_parameters_arg_conv);
76374         channel_derivation_parameters_arg_conv = ChannelDerivationParameters_clone(&channel_derivation_parameters_arg_conv);
76375         LDKThirtyTwoBytes commitment_txid_arg_ref;
76376         CHECK(commitment_txid_arg->arr_len == 32);
76377         memcpy(commitment_txid_arg_ref.data, commitment_txid_arg->elems, 32); FREE(commitment_txid_arg);
76378         LDKPublicKey per_commitment_point_arg_ref;
76379         CHECK(per_commitment_point_arg->arr_len == 33);
76380         memcpy(per_commitment_point_arg_ref.compressed_form, per_commitment_point_arg->elems, 33); FREE(per_commitment_point_arg);
76381         LDKHTLCOutputInCommitment htlc_arg_conv;
76382         htlc_arg_conv.inner = untag_ptr(htlc_arg);
76383         htlc_arg_conv.is_owned = ptr_is_owned(htlc_arg);
76384         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_arg_conv);
76385         htlc_arg_conv = HTLCOutputInCommitment_clone(&htlc_arg_conv);
76386         void* preimage_arg_ptr = untag_ptr(preimage_arg);
76387         CHECK_ACCESS(preimage_arg_ptr);
76388         LDKCOption_ThirtyTwoBytesZ preimage_arg_conv = *(LDKCOption_ThirtyTwoBytesZ*)(preimage_arg_ptr);
76389         preimage_arg_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(preimage_arg));
76390         LDKECDSASignature counterparty_sig_arg_ref;
76391         CHECK(counterparty_sig_arg->arr_len == 64);
76392         memcpy(counterparty_sig_arg_ref.compact_form, counterparty_sig_arg->elems, 64); FREE(counterparty_sig_arg);
76393         LDKHTLCDescriptor ret_var = HTLCDescriptor_new(channel_derivation_parameters_arg_conv, commitment_txid_arg_ref, per_commitment_number_arg, per_commitment_point_arg_ref, feerate_per_kw_arg, htlc_arg_conv, preimage_arg_conv, counterparty_sig_arg_ref);
76394         int64_t ret_ref = 0;
76395         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76396         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76397         return ret_ref;
76398 }
76399
76400 static inline uint64_t HTLCDescriptor_clone_ptr(LDKHTLCDescriptor *NONNULL_PTR arg) {
76401         LDKHTLCDescriptor ret_var = HTLCDescriptor_clone(arg);
76402         int64_t ret_ref = 0;
76403         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76404         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76405         return ret_ref;
76406 }
76407 int64_t  CS_LDK_HTLCDescriptor_clone_ptr(int64_t arg) {
76408         LDKHTLCDescriptor arg_conv;
76409         arg_conv.inner = untag_ptr(arg);
76410         arg_conv.is_owned = ptr_is_owned(arg);
76411         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
76412         arg_conv.is_owned = false;
76413         int64_t ret_conv = HTLCDescriptor_clone_ptr(&arg_conv);
76414         return ret_conv;
76415 }
76416
76417 int64_t  CS_LDK_HTLCDescriptor_clone(int64_t orig) {
76418         LDKHTLCDescriptor orig_conv;
76419         orig_conv.inner = untag_ptr(orig);
76420         orig_conv.is_owned = ptr_is_owned(orig);
76421         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
76422         orig_conv.is_owned = false;
76423         LDKHTLCDescriptor ret_var = HTLCDescriptor_clone(&orig_conv);
76424         int64_t ret_ref = 0;
76425         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76426         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76427         return ret_ref;
76428 }
76429
76430 jboolean  CS_LDK_HTLCDescriptor_eq(int64_t a, int64_t b) {
76431         LDKHTLCDescriptor a_conv;
76432         a_conv.inner = untag_ptr(a);
76433         a_conv.is_owned = ptr_is_owned(a);
76434         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
76435         a_conv.is_owned = false;
76436         LDKHTLCDescriptor b_conv;
76437         b_conv.inner = untag_ptr(b);
76438         b_conv.is_owned = ptr_is_owned(b);
76439         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
76440         b_conv.is_owned = false;
76441         jboolean ret_conv = HTLCDescriptor_eq(&a_conv, &b_conv);
76442         return ret_conv;
76443 }
76444
76445 int8_tArray  CS_LDK_HTLCDescriptor_write(int64_t obj) {
76446         LDKHTLCDescriptor obj_conv;
76447         obj_conv.inner = untag_ptr(obj);
76448         obj_conv.is_owned = ptr_is_owned(obj);
76449         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
76450         obj_conv.is_owned = false;
76451         LDKCVec_u8Z ret_var = HTLCDescriptor_write(&obj_conv);
76452         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
76453         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
76454         CVec_u8Z_free(ret_var);
76455         return ret_arr;
76456 }
76457
76458 int64_t  CS_LDK_HTLCDescriptor_read(int8_tArray ser) {
76459         LDKu8slice ser_ref;
76460         ser_ref.datalen = ser->arr_len;
76461         ser_ref.data = ser->elems;
76462         LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ");
76463         *ret_conv = HTLCDescriptor_read(ser_ref);
76464         FREE(ser);
76465         return tag_ptr(ret_conv, true);
76466 }
76467
76468 int64_t  CS_LDK_HTLCDescriptor_outpoint(int64_t this_arg) {
76469         LDKHTLCDescriptor this_arg_conv;
76470         this_arg_conv.inner = untag_ptr(this_arg);
76471         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76472         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76473         this_arg_conv.is_owned = false;
76474         LDKOutPoint ret_var = HTLCDescriptor_outpoint(&this_arg_conv);
76475         int64_t ret_ref = 0;
76476         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76477         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76478         return ret_ref;
76479 }
76480
76481 int64_t  CS_LDK_HTLCDescriptor_previous_utxo(int64_t this_arg) {
76482         LDKHTLCDescriptor this_arg_conv;
76483         this_arg_conv.inner = untag_ptr(this_arg);
76484         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76485         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76486         this_arg_conv.is_owned = false;
76487         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
76488         *ret_ref = HTLCDescriptor_previous_utxo(&this_arg_conv);
76489         return tag_ptr(ret_ref, true);
76490 }
76491
76492 int64_t  CS_LDK_HTLCDescriptor_unsigned_tx_input(int64_t this_arg) {
76493         LDKHTLCDescriptor this_arg_conv;
76494         this_arg_conv.inner = untag_ptr(this_arg);
76495         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76496         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76497         this_arg_conv.is_owned = false;
76498         LDKTxIn* ret_ref = MALLOC(sizeof(LDKTxIn), "LDKTxIn");
76499         *ret_ref = HTLCDescriptor_unsigned_tx_input(&this_arg_conv);
76500         return tag_ptr(ret_ref, true);
76501 }
76502
76503 int64_t  CS_LDK_HTLCDescriptor_tx_output(int64_t this_arg) {
76504         LDKHTLCDescriptor this_arg_conv;
76505         this_arg_conv.inner = untag_ptr(this_arg);
76506         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76507         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76508         this_arg_conv.is_owned = false;
76509         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
76510         *ret_ref = HTLCDescriptor_tx_output(&this_arg_conv);
76511         return tag_ptr(ret_ref, true);
76512 }
76513
76514 int8_tArray  CS_LDK_HTLCDescriptor_witness_script(int64_t this_arg) {
76515         LDKHTLCDescriptor this_arg_conv;
76516         this_arg_conv.inner = untag_ptr(this_arg);
76517         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76518         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76519         this_arg_conv.is_owned = false;
76520         LDKCVec_u8Z ret_var = HTLCDescriptor_witness_script(&this_arg_conv);
76521         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
76522         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
76523         CVec_u8Z_free(ret_var);
76524         return ret_arr;
76525 }
76526
76527 int8_tArray  CS_LDK_HTLCDescriptor_tx_input_witness(int64_t this_arg, int8_tArray signature, int8_tArray witness_script) {
76528         LDKHTLCDescriptor this_arg_conv;
76529         this_arg_conv.inner = untag_ptr(this_arg);
76530         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76531         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76532         this_arg_conv.is_owned = false;
76533         LDKECDSASignature signature_ref;
76534         CHECK(signature->arr_len == 64);
76535         memcpy(signature_ref.compact_form, signature->elems, 64); FREE(signature);
76536         LDKu8slice witness_script_ref;
76537         witness_script_ref.datalen = witness_script->arr_len;
76538         witness_script_ref.data = witness_script->elems;
76539         LDKWitness ret_var = HTLCDescriptor_tx_input_witness(&this_arg_conv, signature_ref, witness_script_ref);
76540         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
76541         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
76542         Witness_free(ret_var);
76543         FREE(witness_script);
76544         return ret_arr;
76545 }
76546
76547 int64_t  CS_LDK_HTLCDescriptor_derive_channel_signer(int64_t this_arg, int64_t signer_provider) {
76548         LDKHTLCDescriptor this_arg_conv;
76549         this_arg_conv.inner = untag_ptr(this_arg);
76550         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76551         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76552         this_arg_conv.is_owned = false;
76553         void* signer_provider_ptr = untag_ptr(signer_provider);
76554         if (ptr_is_owned(signer_provider)) { CHECK_ACCESS(signer_provider_ptr); }
76555         LDKSignerProvider* signer_provider_conv = (LDKSignerProvider*)signer_provider_ptr;
76556         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
76557         *ret_ret = HTLCDescriptor_derive_channel_signer(&this_arg_conv, signer_provider_conv);
76558         return tag_ptr(ret_ret, true);
76559 }
76560
76561 void  CS_LDK_ChannelSigner_free(int64_t this_ptr) {
76562         if (!ptr_is_owned(this_ptr)) return;
76563         void* this_ptr_ptr = untag_ptr(this_ptr);
76564         CHECK_ACCESS(this_ptr_ptr);
76565         LDKChannelSigner this_ptr_conv = *(LDKChannelSigner*)(this_ptr_ptr);
76566         FREE(untag_ptr(this_ptr));
76567         ChannelSigner_free(this_ptr_conv);
76568 }
76569
76570 int32_t  CS_LDK_Recipient_clone(int64_t orig) {
76571         LDKRecipient* orig_conv = (LDKRecipient*)untag_ptr(orig);
76572         int32_t ret_conv = LDKRecipient_to_cs(Recipient_clone(orig_conv));
76573         return ret_conv;
76574 }
76575
76576 int32_t  CS_LDK_Recipient_node() {
76577         int32_t ret_conv = LDKRecipient_to_cs(Recipient_node());
76578         return ret_conv;
76579 }
76580
76581 int32_t  CS_LDK_Recipient_phantom_node() {
76582         int32_t ret_conv = LDKRecipient_to_cs(Recipient_phantom_node());
76583         return ret_conv;
76584 }
76585
76586 void  CS_LDK_EntropySource_free(int64_t this_ptr) {
76587         if (!ptr_is_owned(this_ptr)) return;
76588         void* this_ptr_ptr = untag_ptr(this_ptr);
76589         CHECK_ACCESS(this_ptr_ptr);
76590         LDKEntropySource this_ptr_conv = *(LDKEntropySource*)(this_ptr_ptr);
76591         FREE(untag_ptr(this_ptr));
76592         EntropySource_free(this_ptr_conv);
76593 }
76594
76595 void  CS_LDK_NodeSigner_free(int64_t this_ptr) {
76596         if (!ptr_is_owned(this_ptr)) return;
76597         void* this_ptr_ptr = untag_ptr(this_ptr);
76598         CHECK_ACCESS(this_ptr_ptr);
76599         LDKNodeSigner this_ptr_conv = *(LDKNodeSigner*)(this_ptr_ptr);
76600         FREE(untag_ptr(this_ptr));
76601         NodeSigner_free(this_ptr_conv);
76602 }
76603
76604 void  CS_LDK_OutputSpender_free(int64_t this_ptr) {
76605         if (!ptr_is_owned(this_ptr)) return;
76606         void* this_ptr_ptr = untag_ptr(this_ptr);
76607         CHECK_ACCESS(this_ptr_ptr);
76608         LDKOutputSpender this_ptr_conv = *(LDKOutputSpender*)(this_ptr_ptr);
76609         FREE(untag_ptr(this_ptr));
76610         OutputSpender_free(this_ptr_conv);
76611 }
76612
76613 void  CS_LDK_SignerProvider_free(int64_t this_ptr) {
76614         if (!ptr_is_owned(this_ptr)) return;
76615         void* this_ptr_ptr = untag_ptr(this_ptr);
76616         CHECK_ACCESS(this_ptr_ptr);
76617         LDKSignerProvider this_ptr_conv = *(LDKSignerProvider*)(this_ptr_ptr);
76618         FREE(untag_ptr(this_ptr));
76619         SignerProvider_free(this_ptr_conv);
76620 }
76621
76622 void  CS_LDK_ChangeDestinationSource_free(int64_t this_ptr) {
76623         if (!ptr_is_owned(this_ptr)) return;
76624         void* this_ptr_ptr = untag_ptr(this_ptr);
76625         CHECK_ACCESS(this_ptr_ptr);
76626         LDKChangeDestinationSource this_ptr_conv = *(LDKChangeDestinationSource*)(this_ptr_ptr);
76627         FREE(untag_ptr(this_ptr));
76628         ChangeDestinationSource_free(this_ptr_conv);
76629 }
76630
76631 void  CS_LDK_InMemorySigner_free(int64_t this_obj) {
76632         LDKInMemorySigner this_obj_conv;
76633         this_obj_conv.inner = untag_ptr(this_obj);
76634         this_obj_conv.is_owned = ptr_is_owned(this_obj);
76635         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
76636         InMemorySigner_free(this_obj_conv);
76637 }
76638
76639 int8_tArray  CS_LDK_InMemorySigner_get_funding_key(int64_t this_ptr) {
76640         LDKInMemorySigner this_ptr_conv;
76641         this_ptr_conv.inner = untag_ptr(this_ptr);
76642         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76643         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76644         this_ptr_conv.is_owned = false;
76645         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
76646         memcpy(ret_arr->elems, *InMemorySigner_get_funding_key(&this_ptr_conv), 32);
76647         return ret_arr;
76648 }
76649
76650 void  CS_LDK_InMemorySigner_set_funding_key(int64_t this_ptr, int8_tArray val) {
76651         LDKInMemorySigner this_ptr_conv;
76652         this_ptr_conv.inner = untag_ptr(this_ptr);
76653         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76654         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76655         this_ptr_conv.is_owned = false;
76656         LDKSecretKey val_ref;
76657         CHECK(val->arr_len == 32);
76658         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
76659         InMemorySigner_set_funding_key(&this_ptr_conv, val_ref);
76660 }
76661
76662 int8_tArray  CS_LDK_InMemorySigner_get_revocation_base_key(int64_t this_ptr) {
76663         LDKInMemorySigner this_ptr_conv;
76664         this_ptr_conv.inner = untag_ptr(this_ptr);
76665         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76666         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76667         this_ptr_conv.is_owned = false;
76668         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
76669         memcpy(ret_arr->elems, *InMemorySigner_get_revocation_base_key(&this_ptr_conv), 32);
76670         return ret_arr;
76671 }
76672
76673 void  CS_LDK_InMemorySigner_set_revocation_base_key(int64_t this_ptr, int8_tArray val) {
76674         LDKInMemorySigner this_ptr_conv;
76675         this_ptr_conv.inner = untag_ptr(this_ptr);
76676         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76677         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76678         this_ptr_conv.is_owned = false;
76679         LDKSecretKey val_ref;
76680         CHECK(val->arr_len == 32);
76681         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
76682         InMemorySigner_set_revocation_base_key(&this_ptr_conv, val_ref);
76683 }
76684
76685 int8_tArray  CS_LDK_InMemorySigner_get_payment_key(int64_t this_ptr) {
76686         LDKInMemorySigner this_ptr_conv;
76687         this_ptr_conv.inner = untag_ptr(this_ptr);
76688         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76689         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76690         this_ptr_conv.is_owned = false;
76691         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
76692         memcpy(ret_arr->elems, *InMemorySigner_get_payment_key(&this_ptr_conv), 32);
76693         return ret_arr;
76694 }
76695
76696 void  CS_LDK_InMemorySigner_set_payment_key(int64_t this_ptr, int8_tArray val) {
76697         LDKInMemorySigner this_ptr_conv;
76698         this_ptr_conv.inner = untag_ptr(this_ptr);
76699         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76700         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76701         this_ptr_conv.is_owned = false;
76702         LDKSecretKey val_ref;
76703         CHECK(val->arr_len == 32);
76704         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
76705         InMemorySigner_set_payment_key(&this_ptr_conv, val_ref);
76706 }
76707
76708 int8_tArray  CS_LDK_InMemorySigner_get_delayed_payment_base_key(int64_t this_ptr) {
76709         LDKInMemorySigner this_ptr_conv;
76710         this_ptr_conv.inner = untag_ptr(this_ptr);
76711         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76712         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76713         this_ptr_conv.is_owned = false;
76714         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
76715         memcpy(ret_arr->elems, *InMemorySigner_get_delayed_payment_base_key(&this_ptr_conv), 32);
76716         return ret_arr;
76717 }
76718
76719 void  CS_LDK_InMemorySigner_set_delayed_payment_base_key(int64_t this_ptr, int8_tArray val) {
76720         LDKInMemorySigner this_ptr_conv;
76721         this_ptr_conv.inner = untag_ptr(this_ptr);
76722         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76723         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76724         this_ptr_conv.is_owned = false;
76725         LDKSecretKey val_ref;
76726         CHECK(val->arr_len == 32);
76727         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
76728         InMemorySigner_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
76729 }
76730
76731 int8_tArray  CS_LDK_InMemorySigner_get_htlc_base_key(int64_t this_ptr) {
76732         LDKInMemorySigner this_ptr_conv;
76733         this_ptr_conv.inner = untag_ptr(this_ptr);
76734         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76735         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76736         this_ptr_conv.is_owned = false;
76737         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
76738         memcpy(ret_arr->elems, *InMemorySigner_get_htlc_base_key(&this_ptr_conv), 32);
76739         return ret_arr;
76740 }
76741
76742 void  CS_LDK_InMemorySigner_set_htlc_base_key(int64_t this_ptr, int8_tArray val) {
76743         LDKInMemorySigner this_ptr_conv;
76744         this_ptr_conv.inner = untag_ptr(this_ptr);
76745         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76746         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76747         this_ptr_conv.is_owned = false;
76748         LDKSecretKey val_ref;
76749         CHECK(val->arr_len == 32);
76750         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
76751         InMemorySigner_set_htlc_base_key(&this_ptr_conv, val_ref);
76752 }
76753
76754 int8_tArray  CS_LDK_InMemorySigner_get_commitment_seed(int64_t this_ptr) {
76755         LDKInMemorySigner this_ptr_conv;
76756         this_ptr_conv.inner = untag_ptr(this_ptr);
76757         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76758         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76759         this_ptr_conv.is_owned = false;
76760         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
76761         memcpy(ret_arr->elems, *InMemorySigner_get_commitment_seed(&this_ptr_conv), 32);
76762         return ret_arr;
76763 }
76764
76765 void  CS_LDK_InMemorySigner_set_commitment_seed(int64_t this_ptr, int8_tArray val) {
76766         LDKInMemorySigner this_ptr_conv;
76767         this_ptr_conv.inner = untag_ptr(this_ptr);
76768         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76769         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76770         this_ptr_conv.is_owned = false;
76771         LDKThirtyTwoBytes val_ref;
76772         CHECK(val->arr_len == 32);
76773         memcpy(val_ref.data, val->elems, 32); FREE(val);
76774         InMemorySigner_set_commitment_seed(&this_ptr_conv, val_ref);
76775 }
76776
76777 static inline uint64_t InMemorySigner_clone_ptr(LDKInMemorySigner *NONNULL_PTR arg) {
76778         LDKInMemorySigner ret_var = InMemorySigner_clone(arg);
76779         int64_t ret_ref = 0;
76780         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76781         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76782         return ret_ref;
76783 }
76784 int64_t  CS_LDK_InMemorySigner_clone_ptr(int64_t arg) {
76785         LDKInMemorySigner arg_conv;
76786         arg_conv.inner = untag_ptr(arg);
76787         arg_conv.is_owned = ptr_is_owned(arg);
76788         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
76789         arg_conv.is_owned = false;
76790         int64_t ret_conv = InMemorySigner_clone_ptr(&arg_conv);
76791         return ret_conv;
76792 }
76793
76794 int64_t  CS_LDK_InMemorySigner_clone(int64_t orig) {
76795         LDKInMemorySigner orig_conv;
76796         orig_conv.inner = untag_ptr(orig);
76797         orig_conv.is_owned = ptr_is_owned(orig);
76798         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
76799         orig_conv.is_owned = false;
76800         LDKInMemorySigner ret_var = InMemorySigner_clone(&orig_conv);
76801         int64_t ret_ref = 0;
76802         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76803         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76804         return ret_ref;
76805 }
76806
76807 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) {
76808         LDKSecretKey funding_key_ref;
76809         CHECK(funding_key->arr_len == 32);
76810         memcpy(funding_key_ref.bytes, funding_key->elems, 32); FREE(funding_key);
76811         LDKSecretKey revocation_base_key_ref;
76812         CHECK(revocation_base_key->arr_len == 32);
76813         memcpy(revocation_base_key_ref.bytes, revocation_base_key->elems, 32); FREE(revocation_base_key);
76814         LDKSecretKey payment_key_ref;
76815         CHECK(payment_key->arr_len == 32);
76816         memcpy(payment_key_ref.bytes, payment_key->elems, 32); FREE(payment_key);
76817         LDKSecretKey delayed_payment_base_key_ref;
76818         CHECK(delayed_payment_base_key->arr_len == 32);
76819         memcpy(delayed_payment_base_key_ref.bytes, delayed_payment_base_key->elems, 32); FREE(delayed_payment_base_key);
76820         LDKSecretKey htlc_base_key_ref;
76821         CHECK(htlc_base_key->arr_len == 32);
76822         memcpy(htlc_base_key_ref.bytes, htlc_base_key->elems, 32); FREE(htlc_base_key);
76823         LDKThirtyTwoBytes commitment_seed_ref;
76824         CHECK(commitment_seed->arr_len == 32);
76825         memcpy(commitment_seed_ref.data, commitment_seed->elems, 32); FREE(commitment_seed);
76826         LDKThirtyTwoBytes channel_keys_id_ref;
76827         CHECK(channel_keys_id->arr_len == 32);
76828         memcpy(channel_keys_id_ref.data, channel_keys_id->elems, 32); FREE(channel_keys_id);
76829         LDKThirtyTwoBytes rand_bytes_unique_start_ref;
76830         CHECK(rand_bytes_unique_start->arr_len == 32);
76831         memcpy(rand_bytes_unique_start_ref.data, rand_bytes_unique_start->elems, 32); FREE(rand_bytes_unique_start);
76832         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);
76833         int64_t ret_ref = 0;
76834         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76835         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76836         return ret_ref;
76837 }
76838
76839 int64_t  CS_LDK_InMemorySigner_counterparty_pubkeys(int64_t this_arg) {
76840         LDKInMemorySigner this_arg_conv;
76841         this_arg_conv.inner = untag_ptr(this_arg);
76842         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76843         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76844         this_arg_conv.is_owned = false;
76845         LDKChannelPublicKeys ret_var = InMemorySigner_counterparty_pubkeys(&this_arg_conv);
76846         int64_t ret_ref = 0;
76847         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76848         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76849         return ret_ref;
76850 }
76851
76852 int64_t  CS_LDK_InMemorySigner_counterparty_selected_contest_delay(int64_t this_arg) {
76853         LDKInMemorySigner this_arg_conv;
76854         this_arg_conv.inner = untag_ptr(this_arg);
76855         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76856         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76857         this_arg_conv.is_owned = false;
76858         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
76859         *ret_copy = InMemorySigner_counterparty_selected_contest_delay(&this_arg_conv);
76860         int64_t ret_ref = tag_ptr(ret_copy, true);
76861         return ret_ref;
76862 }
76863
76864 int64_t  CS_LDK_InMemorySigner_holder_selected_contest_delay(int64_t this_arg) {
76865         LDKInMemorySigner this_arg_conv;
76866         this_arg_conv.inner = untag_ptr(this_arg);
76867         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76868         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76869         this_arg_conv.is_owned = false;
76870         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
76871         *ret_copy = InMemorySigner_holder_selected_contest_delay(&this_arg_conv);
76872         int64_t ret_ref = tag_ptr(ret_copy, true);
76873         return ret_ref;
76874 }
76875
76876 int64_t  CS_LDK_InMemorySigner_is_outbound(int64_t this_arg) {
76877         LDKInMemorySigner this_arg_conv;
76878         this_arg_conv.inner = untag_ptr(this_arg);
76879         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76880         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76881         this_arg_conv.is_owned = false;
76882         LDKCOption_boolZ *ret_copy = MALLOC(sizeof(LDKCOption_boolZ), "LDKCOption_boolZ");
76883         *ret_copy = InMemorySigner_is_outbound(&this_arg_conv);
76884         int64_t ret_ref = tag_ptr(ret_copy, true);
76885         return ret_ref;
76886 }
76887
76888 int64_t  CS_LDK_InMemorySigner_funding_outpoint(int64_t this_arg) {
76889         LDKInMemorySigner this_arg_conv;
76890         this_arg_conv.inner = untag_ptr(this_arg);
76891         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76892         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76893         this_arg_conv.is_owned = false;
76894         LDKOutPoint ret_var = InMemorySigner_funding_outpoint(&this_arg_conv);
76895         int64_t ret_ref = 0;
76896         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76897         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76898         return ret_ref;
76899 }
76900
76901 int64_t  CS_LDK_InMemorySigner_get_channel_parameters(int64_t this_arg) {
76902         LDKInMemorySigner this_arg_conv;
76903         this_arg_conv.inner = untag_ptr(this_arg);
76904         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76905         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76906         this_arg_conv.is_owned = false;
76907         LDKChannelTransactionParameters ret_var = InMemorySigner_get_channel_parameters(&this_arg_conv);
76908         int64_t ret_ref = 0;
76909         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76910         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76911         return ret_ref;
76912 }
76913
76914 int64_t  CS_LDK_InMemorySigner_channel_type_features(int64_t this_arg) {
76915         LDKInMemorySigner this_arg_conv;
76916         this_arg_conv.inner = untag_ptr(this_arg);
76917         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76918         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76919         this_arg_conv.is_owned = false;
76920         LDKChannelTypeFeatures ret_var = InMemorySigner_channel_type_features(&this_arg_conv);
76921         int64_t ret_ref = 0;
76922         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76923         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76924         return ret_ref;
76925 }
76926
76927 int64_t  CS_LDK_InMemorySigner_sign_counterparty_payment_input(int64_t this_arg, int8_tArray spend_tx, int64_t input_idx, int64_t descriptor) {
76928         LDKInMemorySigner this_arg_conv;
76929         this_arg_conv.inner = untag_ptr(this_arg);
76930         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76931         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76932         this_arg_conv.is_owned = false;
76933         LDKTransaction spend_tx_ref;
76934         spend_tx_ref.datalen = spend_tx->arr_len;
76935         spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
76936         memcpy(spend_tx_ref.data, spend_tx->elems, spend_tx_ref.datalen); FREE(spend_tx);
76937         spend_tx_ref.data_is_owned = true;
76938         LDKStaticPaymentOutputDescriptor descriptor_conv;
76939         descriptor_conv.inner = untag_ptr(descriptor);
76940         descriptor_conv.is_owned = ptr_is_owned(descriptor);
76941         CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
76942         descriptor_conv.is_owned = false;
76943         LDKCResult_WitnessNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_WitnessNoneZ), "LDKCResult_WitnessNoneZ");
76944         *ret_conv = InMemorySigner_sign_counterparty_payment_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
76945         return tag_ptr(ret_conv, true);
76946 }
76947
76948 int64_t  CS_LDK_InMemorySigner_sign_dynamic_p2wsh_input(int64_t this_arg, int8_tArray spend_tx, int64_t input_idx, int64_t descriptor) {
76949         LDKInMemorySigner this_arg_conv;
76950         this_arg_conv.inner = untag_ptr(this_arg);
76951         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76952         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76953         this_arg_conv.is_owned = false;
76954         LDKTransaction spend_tx_ref;
76955         spend_tx_ref.datalen = spend_tx->arr_len;
76956         spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
76957         memcpy(spend_tx_ref.data, spend_tx->elems, spend_tx_ref.datalen); FREE(spend_tx);
76958         spend_tx_ref.data_is_owned = true;
76959         LDKDelayedPaymentOutputDescriptor descriptor_conv;
76960         descriptor_conv.inner = untag_ptr(descriptor);
76961         descriptor_conv.is_owned = ptr_is_owned(descriptor);
76962         CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
76963         descriptor_conv.is_owned = false;
76964         LDKCResult_WitnessNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_WitnessNoneZ), "LDKCResult_WitnessNoneZ");
76965         *ret_conv = InMemorySigner_sign_dynamic_p2wsh_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
76966         return tag_ptr(ret_conv, true);
76967 }
76968
76969 int64_t  CS_LDK_InMemorySigner_as_EntropySource(int64_t this_arg) {
76970         LDKInMemorySigner this_arg_conv;
76971         this_arg_conv.inner = untag_ptr(this_arg);
76972         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76973         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76974         this_arg_conv.is_owned = false;
76975         LDKEntropySource* ret_ret = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
76976         *ret_ret = InMemorySigner_as_EntropySource(&this_arg_conv);
76977         return tag_ptr(ret_ret, true);
76978 }
76979
76980 int64_t  CS_LDK_InMemorySigner_as_ChannelSigner(int64_t this_arg) {
76981         LDKInMemorySigner this_arg_conv;
76982         this_arg_conv.inner = untag_ptr(this_arg);
76983         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76984         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76985         this_arg_conv.is_owned = false;
76986         LDKChannelSigner* ret_ret = MALLOC(sizeof(LDKChannelSigner), "LDKChannelSigner");
76987         *ret_ret = InMemorySigner_as_ChannelSigner(&this_arg_conv);
76988         return tag_ptr(ret_ret, true);
76989 }
76990
76991 int64_t  CS_LDK_InMemorySigner_as_EcdsaChannelSigner(int64_t this_arg) {
76992         LDKInMemorySigner this_arg_conv;
76993         this_arg_conv.inner = untag_ptr(this_arg);
76994         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76995         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76996         this_arg_conv.is_owned = false;
76997         LDKEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKEcdsaChannelSigner), "LDKEcdsaChannelSigner");
76998         *ret_ret = InMemorySigner_as_EcdsaChannelSigner(&this_arg_conv);
76999         return tag_ptr(ret_ret, true);
77000 }
77001
77002 int64_t  CS_LDK_InMemorySigner_as_WriteableEcdsaChannelSigner(int64_t this_arg) {
77003         LDKInMemorySigner this_arg_conv;
77004         this_arg_conv.inner = untag_ptr(this_arg);
77005         this_arg_conv.is_owned = ptr_is_owned(this_arg);
77006         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
77007         this_arg_conv.is_owned = false;
77008         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
77009         *ret_ret = InMemorySigner_as_WriteableEcdsaChannelSigner(&this_arg_conv);
77010         return tag_ptr(ret_ret, true);
77011 }
77012
77013 int8_tArray  CS_LDK_InMemorySigner_write(int64_t obj) {
77014         LDKInMemorySigner obj_conv;
77015         obj_conv.inner = untag_ptr(obj);
77016         obj_conv.is_owned = ptr_is_owned(obj);
77017         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
77018         obj_conv.is_owned = false;
77019         LDKCVec_u8Z ret_var = InMemorySigner_write(&obj_conv);
77020         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
77021         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
77022         CVec_u8Z_free(ret_var);
77023         return ret_arr;
77024 }
77025
77026 int64_t  CS_LDK_InMemorySigner_read(int8_tArray ser, int64_t arg) {
77027         LDKu8slice ser_ref;
77028         ser_ref.datalen = ser->arr_len;
77029         ser_ref.data = ser->elems;
77030         void* arg_ptr = untag_ptr(arg);
77031         CHECK_ACCESS(arg_ptr);
77032         LDKEntropySource arg_conv = *(LDKEntropySource*)(arg_ptr);
77033         if (arg_conv.free == LDKEntropySource_JCalls_free) {
77034                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
77035                 LDKEntropySource_JCalls_cloned(&arg_conv);
77036         }
77037         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
77038         *ret_conv = InMemorySigner_read(ser_ref, arg_conv);
77039         FREE(ser);
77040         return tag_ptr(ret_conv, true);
77041 }
77042
77043 void  CS_LDK_KeysManager_free(int64_t this_obj) {
77044         LDKKeysManager this_obj_conv;
77045         this_obj_conv.inner = untag_ptr(this_obj);
77046         this_obj_conv.is_owned = ptr_is_owned(this_obj);
77047         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
77048         KeysManager_free(this_obj_conv);
77049 }
77050
77051 int64_t  CS_LDK_KeysManager_new(int8_tArray seed, int64_t starting_time_secs, int32_t starting_time_nanos) {
77052         uint8_t seed_arr[32];
77053         CHECK(seed->arr_len == 32);
77054         memcpy(seed_arr, seed->elems, 32); FREE(seed);
77055         uint8_t (*seed_ref)[32] = &seed_arr;
77056         LDKKeysManager ret_var = KeysManager_new(seed_ref, starting_time_secs, starting_time_nanos);
77057         int64_t ret_ref = 0;
77058         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77059         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77060         return ret_ref;
77061 }
77062
77063 int8_tArray  CS_LDK_KeysManager_get_node_secret_key(int64_t this_arg) {
77064         LDKKeysManager this_arg_conv;
77065         this_arg_conv.inner = untag_ptr(this_arg);
77066         this_arg_conv.is_owned = ptr_is_owned(this_arg);
77067         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
77068         this_arg_conv.is_owned = false;
77069         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
77070         memcpy(ret_arr->elems, KeysManager_get_node_secret_key(&this_arg_conv).bytes, 32);
77071         return ret_arr;
77072 }
77073
77074 int64_t  CS_LDK_KeysManager_derive_channel_keys(int64_t this_arg, int64_t channel_value_satoshis, int8_tArray params) {
77075         LDKKeysManager this_arg_conv;
77076         this_arg_conv.inner = untag_ptr(this_arg);
77077         this_arg_conv.is_owned = ptr_is_owned(this_arg);
77078         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
77079         this_arg_conv.is_owned = false;
77080         uint8_t params_arr[32];
77081         CHECK(params->arr_len == 32);
77082         memcpy(params_arr, params->elems, 32); FREE(params);
77083         uint8_t (*params_ref)[32] = &params_arr;
77084         LDKInMemorySigner ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
77085         int64_t ret_ref = 0;
77086         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77087         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77088         return ret_ref;
77089 }
77090
77091 int64_t  CS_LDK_KeysManager_sign_spendable_outputs_psbt(int64_t this_arg, int64_tArray descriptors, int8_tArray psbt) {
77092         LDKKeysManager this_arg_conv;
77093         this_arg_conv.inner = untag_ptr(this_arg);
77094         this_arg_conv.is_owned = ptr_is_owned(this_arg);
77095         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
77096         this_arg_conv.is_owned = false;
77097         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
77098         descriptors_constr.datalen = descriptors->arr_len;
77099         if (descriptors_constr.datalen > 0)
77100                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
77101         else
77102                 descriptors_constr.data = NULL;
77103         int64_t* descriptors_vals = descriptors->elems;
77104         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
77105                 int64_t descriptors_conv_27 = descriptors_vals[b];
77106                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
77107                 CHECK_ACCESS(descriptors_conv_27_ptr);
77108                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
77109                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
77110                 descriptors_constr.data[b] = descriptors_conv_27_conv;
77111         }
77112         FREE(descriptors);
77113         LDKCVec_u8Z psbt_ref;
77114         psbt_ref.datalen = psbt->arr_len;
77115         psbt_ref.data = MALLOC(psbt_ref.datalen, "LDKCVec_u8Z Bytes");
77116         memcpy(psbt_ref.data, psbt->elems, psbt_ref.datalen); FREE(psbt);
77117         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
77118         *ret_conv = KeysManager_sign_spendable_outputs_psbt(&this_arg_conv, descriptors_constr, psbt_ref);
77119         return tag_ptr(ret_conv, true);
77120 }
77121
77122 int64_t  CS_LDK_KeysManager_as_EntropySource(int64_t this_arg) {
77123         LDKKeysManager this_arg_conv;
77124         this_arg_conv.inner = untag_ptr(this_arg);
77125         this_arg_conv.is_owned = ptr_is_owned(this_arg);
77126         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
77127         this_arg_conv.is_owned = false;
77128         LDKEntropySource* ret_ret = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
77129         *ret_ret = KeysManager_as_EntropySource(&this_arg_conv);
77130         return tag_ptr(ret_ret, true);
77131 }
77132
77133 int64_t  CS_LDK_KeysManager_as_NodeSigner(int64_t this_arg) {
77134         LDKKeysManager this_arg_conv;
77135         this_arg_conv.inner = untag_ptr(this_arg);
77136         this_arg_conv.is_owned = ptr_is_owned(this_arg);
77137         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
77138         this_arg_conv.is_owned = false;
77139         LDKNodeSigner* ret_ret = MALLOC(sizeof(LDKNodeSigner), "LDKNodeSigner");
77140         *ret_ret = KeysManager_as_NodeSigner(&this_arg_conv);
77141         return tag_ptr(ret_ret, true);
77142 }
77143
77144 int64_t  CS_LDK_KeysManager_as_OutputSpender(int64_t this_arg) {
77145         LDKKeysManager this_arg_conv;
77146         this_arg_conv.inner = untag_ptr(this_arg);
77147         this_arg_conv.is_owned = ptr_is_owned(this_arg);
77148         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
77149         this_arg_conv.is_owned = false;
77150         LDKOutputSpender* ret_ret = MALLOC(sizeof(LDKOutputSpender), "LDKOutputSpender");
77151         *ret_ret = KeysManager_as_OutputSpender(&this_arg_conv);
77152         return tag_ptr(ret_ret, true);
77153 }
77154
77155 int64_t  CS_LDK_KeysManager_as_SignerProvider(int64_t this_arg) {
77156         LDKKeysManager this_arg_conv;
77157         this_arg_conv.inner = untag_ptr(this_arg);
77158         this_arg_conv.is_owned = ptr_is_owned(this_arg);
77159         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
77160         this_arg_conv.is_owned = false;
77161         LDKSignerProvider* ret_ret = MALLOC(sizeof(LDKSignerProvider), "LDKSignerProvider");
77162         *ret_ret = KeysManager_as_SignerProvider(&this_arg_conv);
77163         return tag_ptr(ret_ret, true);
77164 }
77165
77166 void  CS_LDK_PhantomKeysManager_free(int64_t this_obj) {
77167         LDKPhantomKeysManager this_obj_conv;
77168         this_obj_conv.inner = untag_ptr(this_obj);
77169         this_obj_conv.is_owned = ptr_is_owned(this_obj);
77170         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
77171         PhantomKeysManager_free(this_obj_conv);
77172 }
77173
77174 int64_t  CS_LDK_PhantomKeysManager_as_EntropySource(int64_t this_arg) {
77175         LDKPhantomKeysManager this_arg_conv;
77176         this_arg_conv.inner = untag_ptr(this_arg);
77177         this_arg_conv.is_owned = ptr_is_owned(this_arg);
77178         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
77179         this_arg_conv.is_owned = false;
77180         LDKEntropySource* ret_ret = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
77181         *ret_ret = PhantomKeysManager_as_EntropySource(&this_arg_conv);
77182         return tag_ptr(ret_ret, true);
77183 }
77184
77185 int64_t  CS_LDK_PhantomKeysManager_as_NodeSigner(int64_t this_arg) {
77186         LDKPhantomKeysManager this_arg_conv;
77187         this_arg_conv.inner = untag_ptr(this_arg);
77188         this_arg_conv.is_owned = ptr_is_owned(this_arg);
77189         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
77190         this_arg_conv.is_owned = false;
77191         LDKNodeSigner* ret_ret = MALLOC(sizeof(LDKNodeSigner), "LDKNodeSigner");
77192         *ret_ret = PhantomKeysManager_as_NodeSigner(&this_arg_conv);
77193         return tag_ptr(ret_ret, true);
77194 }
77195
77196 int64_t  CS_LDK_PhantomKeysManager_as_OutputSpender(int64_t this_arg) {
77197         LDKPhantomKeysManager this_arg_conv;
77198         this_arg_conv.inner = untag_ptr(this_arg);
77199         this_arg_conv.is_owned = ptr_is_owned(this_arg);
77200         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
77201         this_arg_conv.is_owned = false;
77202         LDKOutputSpender* ret_ret = MALLOC(sizeof(LDKOutputSpender), "LDKOutputSpender");
77203         *ret_ret = PhantomKeysManager_as_OutputSpender(&this_arg_conv);
77204         return tag_ptr(ret_ret, true);
77205 }
77206
77207 int64_t  CS_LDK_PhantomKeysManager_as_SignerProvider(int64_t this_arg) {
77208         LDKPhantomKeysManager this_arg_conv;
77209         this_arg_conv.inner = untag_ptr(this_arg);
77210         this_arg_conv.is_owned = ptr_is_owned(this_arg);
77211         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
77212         this_arg_conv.is_owned = false;
77213         LDKSignerProvider* ret_ret = MALLOC(sizeof(LDKSignerProvider), "LDKSignerProvider");
77214         *ret_ret = PhantomKeysManager_as_SignerProvider(&this_arg_conv);
77215         return tag_ptr(ret_ret, true);
77216 }
77217
77218 int64_t  CS_LDK_PhantomKeysManager_new(int8_tArray seed, int64_t starting_time_secs, int32_t starting_time_nanos, int8_tArray cross_node_seed) {
77219         uint8_t seed_arr[32];
77220         CHECK(seed->arr_len == 32);
77221         memcpy(seed_arr, seed->elems, 32); FREE(seed);
77222         uint8_t (*seed_ref)[32] = &seed_arr;
77223         uint8_t cross_node_seed_arr[32];
77224         CHECK(cross_node_seed->arr_len == 32);
77225         memcpy(cross_node_seed_arr, cross_node_seed->elems, 32); FREE(cross_node_seed);
77226         uint8_t (*cross_node_seed_ref)[32] = &cross_node_seed_arr;
77227         LDKPhantomKeysManager ret_var = PhantomKeysManager_new(seed_ref, starting_time_secs, starting_time_nanos, cross_node_seed_ref);
77228         int64_t ret_ref = 0;
77229         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77230         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77231         return ret_ref;
77232 }
77233
77234 int64_t  CS_LDK_PhantomKeysManager_derive_channel_keys(int64_t this_arg, int64_t channel_value_satoshis, int8_tArray params) {
77235         LDKPhantomKeysManager this_arg_conv;
77236         this_arg_conv.inner = untag_ptr(this_arg);
77237         this_arg_conv.is_owned = ptr_is_owned(this_arg);
77238         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
77239         this_arg_conv.is_owned = false;
77240         uint8_t params_arr[32];
77241         CHECK(params->arr_len == 32);
77242         memcpy(params_arr, params->elems, 32); FREE(params);
77243         uint8_t (*params_ref)[32] = &params_arr;
77244         LDKInMemorySigner ret_var = PhantomKeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
77245         int64_t ret_ref = 0;
77246         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77247         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77248         return ret_ref;
77249 }
77250
77251 int8_tArray  CS_LDK_PhantomKeysManager_get_node_secret_key(int64_t this_arg) {
77252         LDKPhantomKeysManager this_arg_conv;
77253         this_arg_conv.inner = untag_ptr(this_arg);
77254         this_arg_conv.is_owned = ptr_is_owned(this_arg);
77255         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
77256         this_arg_conv.is_owned = false;
77257         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
77258         memcpy(ret_arr->elems, PhantomKeysManager_get_node_secret_key(&this_arg_conv).bytes, 32);
77259         return ret_arr;
77260 }
77261
77262 int8_tArray  CS_LDK_PhantomKeysManager_get_phantom_node_secret_key(int64_t this_arg) {
77263         LDKPhantomKeysManager this_arg_conv;
77264         this_arg_conv.inner = untag_ptr(this_arg);
77265         this_arg_conv.is_owned = ptr_is_owned(this_arg);
77266         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
77267         this_arg_conv.is_owned = false;
77268         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
77269         memcpy(ret_arr->elems, PhantomKeysManager_get_phantom_node_secret_key(&this_arg_conv).bytes, 32);
77270         return ret_arr;
77271 }
77272
77273 void  CS_LDK_RandomBytes_free(int64_t this_obj) {
77274         LDKRandomBytes this_obj_conv;
77275         this_obj_conv.inner = untag_ptr(this_obj);
77276         this_obj_conv.is_owned = ptr_is_owned(this_obj);
77277         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
77278         RandomBytes_free(this_obj_conv);
77279 }
77280
77281 int64_t  CS_LDK_RandomBytes_new(int8_tArray seed) {
77282         LDKThirtyTwoBytes seed_ref;
77283         CHECK(seed->arr_len == 32);
77284         memcpy(seed_ref.data, seed->elems, 32); FREE(seed);
77285         LDKRandomBytes ret_var = RandomBytes_new(seed_ref);
77286         int64_t ret_ref = 0;
77287         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77288         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77289         return ret_ref;
77290 }
77291
77292 int64_t  CS_LDK_RandomBytes_as_EntropySource(int64_t this_arg) {
77293         LDKRandomBytes this_arg_conv;
77294         this_arg_conv.inner = untag_ptr(this_arg);
77295         this_arg_conv.is_owned = ptr_is_owned(this_arg);
77296         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
77297         this_arg_conv.is_owned = false;
77298         LDKEntropySource* ret_ret = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
77299         *ret_ret = RandomBytes_as_EntropySource(&this_arg_conv);
77300         return tag_ptr(ret_ret, true);
77301 }
77302
77303 void  CS_LDK_EcdsaChannelSigner_free(int64_t this_ptr) {
77304         if (!ptr_is_owned(this_ptr)) return;
77305         void* this_ptr_ptr = untag_ptr(this_ptr);
77306         CHECK_ACCESS(this_ptr_ptr);
77307         LDKEcdsaChannelSigner this_ptr_conv = *(LDKEcdsaChannelSigner*)(this_ptr_ptr);
77308         FREE(untag_ptr(this_ptr));
77309         EcdsaChannelSigner_free(this_ptr_conv);
77310 }
77311
77312 static inline uint64_t WriteableEcdsaChannelSigner_clone_ptr(LDKWriteableEcdsaChannelSigner *NONNULL_PTR arg) {
77313         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
77314         *ret_ret = WriteableEcdsaChannelSigner_clone(arg);
77315         return tag_ptr(ret_ret, true);
77316 }
77317 int64_t  CS_LDK_WriteableEcdsaChannelSigner_clone_ptr(int64_t arg) {
77318         void* arg_ptr = untag_ptr(arg);
77319         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
77320         LDKWriteableEcdsaChannelSigner* arg_conv = (LDKWriteableEcdsaChannelSigner*)arg_ptr;
77321         int64_t ret_conv = WriteableEcdsaChannelSigner_clone_ptr(arg_conv);
77322         return ret_conv;
77323 }
77324
77325 int64_t  CS_LDK_WriteableEcdsaChannelSigner_clone(int64_t orig) {
77326         void* orig_ptr = untag_ptr(orig);
77327         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
77328         LDKWriteableEcdsaChannelSigner* orig_conv = (LDKWriteableEcdsaChannelSigner*)orig_ptr;
77329         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
77330         *ret_ret = WriteableEcdsaChannelSigner_clone(orig_conv);
77331         return tag_ptr(ret_ret, true);
77332 }
77333
77334 void  CS_LDK_WriteableEcdsaChannelSigner_free(int64_t this_ptr) {
77335         if (!ptr_is_owned(this_ptr)) return;
77336         void* this_ptr_ptr = untag_ptr(this_ptr);
77337         CHECK_ACCESS(this_ptr_ptr);
77338         LDKWriteableEcdsaChannelSigner this_ptr_conv = *(LDKWriteableEcdsaChannelSigner*)(this_ptr_ptr);
77339         FREE(untag_ptr(this_ptr));
77340         WriteableEcdsaChannelSigner_free(this_ptr_conv);
77341 }
77342
77343 void  CS_LDK_OnionMessenger_free(int64_t this_obj) {
77344         LDKOnionMessenger this_obj_conv;
77345         this_obj_conv.inner = untag_ptr(this_obj);
77346         this_obj_conv.is_owned = ptr_is_owned(this_obj);
77347         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
77348         OnionMessenger_free(this_obj_conv);
77349 }
77350
77351 void  CS_LDK_MessageRouter_free(int64_t this_ptr) {
77352         if (!ptr_is_owned(this_ptr)) return;
77353         void* this_ptr_ptr = untag_ptr(this_ptr);
77354         CHECK_ACCESS(this_ptr_ptr);
77355         LDKMessageRouter this_ptr_conv = *(LDKMessageRouter*)(this_ptr_ptr);
77356         FREE(untag_ptr(this_ptr));
77357         MessageRouter_free(this_ptr_conv);
77358 }
77359
77360 void  CS_LDK_DefaultMessageRouter_free(int64_t this_obj) {
77361         LDKDefaultMessageRouter this_obj_conv;
77362         this_obj_conv.inner = untag_ptr(this_obj);
77363         this_obj_conv.is_owned = ptr_is_owned(this_obj);
77364         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
77365         DefaultMessageRouter_free(this_obj_conv);
77366 }
77367
77368 int64_t  CS_LDK_DefaultMessageRouter_new(int64_t network_graph, int64_t entropy_source) {
77369         LDKNetworkGraph network_graph_conv;
77370         network_graph_conv.inner = untag_ptr(network_graph);
77371         network_graph_conv.is_owned = ptr_is_owned(network_graph);
77372         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
77373         network_graph_conv.is_owned = false;
77374         void* entropy_source_ptr = untag_ptr(entropy_source);
77375         CHECK_ACCESS(entropy_source_ptr);
77376         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
77377         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
77378                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
77379                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
77380         }
77381         LDKDefaultMessageRouter ret_var = DefaultMessageRouter_new(&network_graph_conv, entropy_source_conv);
77382         int64_t ret_ref = 0;
77383         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77384         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77385         return ret_ref;
77386 }
77387
77388 int64_t  CS_LDK_DefaultMessageRouter_as_MessageRouter(int64_t this_arg) {
77389         LDKDefaultMessageRouter this_arg_conv;
77390         this_arg_conv.inner = untag_ptr(this_arg);
77391         this_arg_conv.is_owned = ptr_is_owned(this_arg);
77392         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
77393         this_arg_conv.is_owned = false;
77394         LDKMessageRouter* ret_ret = MALLOC(sizeof(LDKMessageRouter), "LDKMessageRouter");
77395         *ret_ret = DefaultMessageRouter_as_MessageRouter(&this_arg_conv);
77396         return tag_ptr(ret_ret, true);
77397 }
77398
77399 void  CS_LDK_OnionMessagePath_free(int64_t this_obj) {
77400         LDKOnionMessagePath this_obj_conv;
77401         this_obj_conv.inner = untag_ptr(this_obj);
77402         this_obj_conv.is_owned = ptr_is_owned(this_obj);
77403         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
77404         OnionMessagePath_free(this_obj_conv);
77405 }
77406
77407 ptrArray  CS_LDK_OnionMessagePath_get_intermediate_nodes(int64_t this_ptr) {
77408         LDKOnionMessagePath this_ptr_conv;
77409         this_ptr_conv.inner = untag_ptr(this_ptr);
77410         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77411         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77412         this_ptr_conv.is_owned = false;
77413         LDKCVec_PublicKeyZ ret_var = OnionMessagePath_get_intermediate_nodes(&this_ptr_conv);
77414         ptrArray ret_arr = NULL;
77415         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
77416         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
77417         for (size_t i = 0; i < ret_var.datalen; i++) {
77418                 int8_tArray ret_conv_8_arr = init_int8_tArray(33, __LINE__);
77419                 memcpy(ret_conv_8_arr->elems, ret_var.data[i].compressed_form, 33);
77420                 ret_arr_ptr[i] = ret_conv_8_arr;
77421         }
77422         
77423         FREE(ret_var.data);
77424         return ret_arr;
77425 }
77426
77427 void  CS_LDK_OnionMessagePath_set_intermediate_nodes(int64_t this_ptr, ptrArray val) {
77428         LDKOnionMessagePath this_ptr_conv;
77429         this_ptr_conv.inner = untag_ptr(this_ptr);
77430         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77431         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77432         this_ptr_conv.is_owned = false;
77433         LDKCVec_PublicKeyZ val_constr;
77434         val_constr.datalen = val->arr_len;
77435         if (val_constr.datalen > 0)
77436                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
77437         else
77438                 val_constr.data = NULL;
77439         int8_tArray* val_vals = (void*) val->elems;
77440         for (size_t i = 0; i < val_constr.datalen; i++) {
77441                 int8_tArray val_conv_8 = val_vals[i];
77442                 LDKPublicKey val_conv_8_ref;
77443                 CHECK(val_conv_8->arr_len == 33);
77444                 memcpy(val_conv_8_ref.compressed_form, val_conv_8->elems, 33); FREE(val_conv_8);
77445                 val_constr.data[i] = val_conv_8_ref;
77446         }
77447         FREE(val);
77448         OnionMessagePath_set_intermediate_nodes(&this_ptr_conv, val_constr);
77449 }
77450
77451 int64_t  CS_LDK_OnionMessagePath_get_destination(int64_t this_ptr) {
77452         LDKOnionMessagePath this_ptr_conv;
77453         this_ptr_conv.inner = untag_ptr(this_ptr);
77454         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77455         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77456         this_ptr_conv.is_owned = false;
77457         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
77458         *ret_copy = OnionMessagePath_get_destination(&this_ptr_conv);
77459         int64_t ret_ref = tag_ptr(ret_copy, true);
77460         return ret_ref;
77461 }
77462
77463 void  CS_LDK_OnionMessagePath_set_destination(int64_t this_ptr, int64_t val) {
77464         LDKOnionMessagePath this_ptr_conv;
77465         this_ptr_conv.inner = untag_ptr(this_ptr);
77466         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77467         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77468         this_ptr_conv.is_owned = false;
77469         void* val_ptr = untag_ptr(val);
77470         CHECK_ACCESS(val_ptr);
77471         LDKDestination val_conv = *(LDKDestination*)(val_ptr);
77472         val_conv = Destination_clone((LDKDestination*)untag_ptr(val));
77473         OnionMessagePath_set_destination(&this_ptr_conv, val_conv);
77474 }
77475
77476 int64_t  CS_LDK_OnionMessagePath_get_first_node_addresses(int64_t this_ptr) {
77477         LDKOnionMessagePath this_ptr_conv;
77478         this_ptr_conv.inner = untag_ptr(this_ptr);
77479         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77480         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77481         this_ptr_conv.is_owned = false;
77482         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
77483         *ret_copy = OnionMessagePath_get_first_node_addresses(&this_ptr_conv);
77484         int64_t ret_ref = tag_ptr(ret_copy, true);
77485         return ret_ref;
77486 }
77487
77488 void  CS_LDK_OnionMessagePath_set_first_node_addresses(int64_t this_ptr, int64_t val) {
77489         LDKOnionMessagePath this_ptr_conv;
77490         this_ptr_conv.inner = untag_ptr(this_ptr);
77491         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77492         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77493         this_ptr_conv.is_owned = false;
77494         void* val_ptr = untag_ptr(val);
77495         CHECK_ACCESS(val_ptr);
77496         LDKCOption_CVec_SocketAddressZZ val_conv = *(LDKCOption_CVec_SocketAddressZZ*)(val_ptr);
77497         val_conv = COption_CVec_SocketAddressZZ_clone((LDKCOption_CVec_SocketAddressZZ*)untag_ptr(val));
77498         OnionMessagePath_set_first_node_addresses(&this_ptr_conv, val_conv);
77499 }
77500
77501 int64_t  CS_LDK_OnionMessagePath_new(ptrArray intermediate_nodes_arg, int64_t destination_arg, int64_t first_node_addresses_arg) {
77502         LDKCVec_PublicKeyZ intermediate_nodes_arg_constr;
77503         intermediate_nodes_arg_constr.datalen = intermediate_nodes_arg->arr_len;
77504         if (intermediate_nodes_arg_constr.datalen > 0)
77505                 intermediate_nodes_arg_constr.data = MALLOC(intermediate_nodes_arg_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
77506         else
77507                 intermediate_nodes_arg_constr.data = NULL;
77508         int8_tArray* intermediate_nodes_arg_vals = (void*) intermediate_nodes_arg->elems;
77509         for (size_t i = 0; i < intermediate_nodes_arg_constr.datalen; i++) {
77510                 int8_tArray intermediate_nodes_arg_conv_8 = intermediate_nodes_arg_vals[i];
77511                 LDKPublicKey intermediate_nodes_arg_conv_8_ref;
77512                 CHECK(intermediate_nodes_arg_conv_8->arr_len == 33);
77513                 memcpy(intermediate_nodes_arg_conv_8_ref.compressed_form, intermediate_nodes_arg_conv_8->elems, 33); FREE(intermediate_nodes_arg_conv_8);
77514                 intermediate_nodes_arg_constr.data[i] = intermediate_nodes_arg_conv_8_ref;
77515         }
77516         FREE(intermediate_nodes_arg);
77517         void* destination_arg_ptr = untag_ptr(destination_arg);
77518         CHECK_ACCESS(destination_arg_ptr);
77519         LDKDestination destination_arg_conv = *(LDKDestination*)(destination_arg_ptr);
77520         destination_arg_conv = Destination_clone((LDKDestination*)untag_ptr(destination_arg));
77521         void* first_node_addresses_arg_ptr = untag_ptr(first_node_addresses_arg);
77522         CHECK_ACCESS(first_node_addresses_arg_ptr);
77523         LDKCOption_CVec_SocketAddressZZ first_node_addresses_arg_conv = *(LDKCOption_CVec_SocketAddressZZ*)(first_node_addresses_arg_ptr);
77524         LDKOnionMessagePath ret_var = OnionMessagePath_new(intermediate_nodes_arg_constr, destination_arg_conv, first_node_addresses_arg_conv);
77525         int64_t ret_ref = 0;
77526         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77527         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77528         return ret_ref;
77529 }
77530
77531 static inline uint64_t OnionMessagePath_clone_ptr(LDKOnionMessagePath *NONNULL_PTR arg) {
77532         LDKOnionMessagePath ret_var = OnionMessagePath_clone(arg);
77533         int64_t ret_ref = 0;
77534         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77535         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77536         return ret_ref;
77537 }
77538 int64_t  CS_LDK_OnionMessagePath_clone_ptr(int64_t arg) {
77539         LDKOnionMessagePath arg_conv;
77540         arg_conv.inner = untag_ptr(arg);
77541         arg_conv.is_owned = ptr_is_owned(arg);
77542         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
77543         arg_conv.is_owned = false;
77544         int64_t ret_conv = OnionMessagePath_clone_ptr(&arg_conv);
77545         return ret_conv;
77546 }
77547
77548 int64_t  CS_LDK_OnionMessagePath_clone(int64_t orig) {
77549         LDKOnionMessagePath orig_conv;
77550         orig_conv.inner = untag_ptr(orig);
77551         orig_conv.is_owned = ptr_is_owned(orig);
77552         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
77553         orig_conv.is_owned = false;
77554         LDKOnionMessagePath ret_var = OnionMessagePath_clone(&orig_conv);
77555         int64_t ret_ref = 0;
77556         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77557         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77558         return ret_ref;
77559 }
77560
77561 int8_tArray  CS_LDK_OnionMessagePath_first_node(int64_t this_arg) {
77562         LDKOnionMessagePath this_arg_conv;
77563         this_arg_conv.inner = untag_ptr(this_arg);
77564         this_arg_conv.is_owned = ptr_is_owned(this_arg);
77565         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
77566         this_arg_conv.is_owned = false;
77567         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
77568         memcpy(ret_arr->elems, OnionMessagePath_first_node(&this_arg_conv).compressed_form, 33);
77569         return ret_arr;
77570 }
77571
77572 void  CS_LDK_Destination_free(int64_t this_ptr) {
77573         if (!ptr_is_owned(this_ptr)) return;
77574         void* this_ptr_ptr = untag_ptr(this_ptr);
77575         CHECK_ACCESS(this_ptr_ptr);
77576         LDKDestination this_ptr_conv = *(LDKDestination*)(this_ptr_ptr);
77577         FREE(untag_ptr(this_ptr));
77578         Destination_free(this_ptr_conv);
77579 }
77580
77581 static inline uint64_t Destination_clone_ptr(LDKDestination *NONNULL_PTR arg) {
77582         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
77583         *ret_copy = Destination_clone(arg);
77584         int64_t ret_ref = tag_ptr(ret_copy, true);
77585         return ret_ref;
77586 }
77587 int64_t  CS_LDK_Destination_clone_ptr(int64_t arg) {
77588         LDKDestination* arg_conv = (LDKDestination*)untag_ptr(arg);
77589         int64_t ret_conv = Destination_clone_ptr(arg_conv);
77590         return ret_conv;
77591 }
77592
77593 int64_t  CS_LDK_Destination_clone(int64_t orig) {
77594         LDKDestination* orig_conv = (LDKDestination*)untag_ptr(orig);
77595         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
77596         *ret_copy = Destination_clone(orig_conv);
77597         int64_t ret_ref = tag_ptr(ret_copy, true);
77598         return ret_ref;
77599 }
77600
77601 int64_t  CS_LDK_Destination_node(int8_tArray a) {
77602         LDKPublicKey a_ref;
77603         CHECK(a->arr_len == 33);
77604         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
77605         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
77606         *ret_copy = Destination_node(a_ref);
77607         int64_t ret_ref = tag_ptr(ret_copy, true);
77608         return ret_ref;
77609 }
77610
77611 int64_t  CS_LDK_Destination_blinded_path(int64_t a) {
77612         LDKBlindedPath a_conv;
77613         a_conv.inner = untag_ptr(a);
77614         a_conv.is_owned = ptr_is_owned(a);
77615         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
77616         a_conv = BlindedPath_clone(&a_conv);
77617         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
77618         *ret_copy = Destination_blinded_path(a_conv);
77619         int64_t ret_ref = tag_ptr(ret_copy, true);
77620         return ret_ref;
77621 }
77622
77623 int64_t  CS_LDK_Destination_hash(int64_t o) {
77624         LDKDestination* o_conv = (LDKDestination*)untag_ptr(o);
77625         int64_t ret_conv = Destination_hash(o_conv);
77626         return ret_conv;
77627 }
77628
77629 jboolean  CS_LDK_Destination_eq(int64_t a, int64_t b) {
77630         LDKDestination* a_conv = (LDKDestination*)untag_ptr(a);
77631         LDKDestination* b_conv = (LDKDestination*)untag_ptr(b);
77632         jboolean ret_conv = Destination_eq(a_conv, b_conv);
77633         return ret_conv;
77634 }
77635
77636 void  CS_LDK_Destination_resolve(int64_t this_arg, int64_t network_graph) {
77637         LDKDestination* this_arg_conv = (LDKDestination*)untag_ptr(this_arg);
77638         LDKReadOnlyNetworkGraph network_graph_conv;
77639         network_graph_conv.inner = untag_ptr(network_graph);
77640         network_graph_conv.is_owned = ptr_is_owned(network_graph);
77641         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
77642         network_graph_conv.is_owned = false;
77643         Destination_resolve(this_arg_conv, &network_graph_conv);
77644 }
77645
77646 void  CS_LDK_SendSuccess_free(int64_t this_ptr) {
77647         if (!ptr_is_owned(this_ptr)) return;
77648         void* this_ptr_ptr = untag_ptr(this_ptr);
77649         CHECK_ACCESS(this_ptr_ptr);
77650         LDKSendSuccess this_ptr_conv = *(LDKSendSuccess*)(this_ptr_ptr);
77651         FREE(untag_ptr(this_ptr));
77652         SendSuccess_free(this_ptr_conv);
77653 }
77654
77655 static inline uint64_t SendSuccess_clone_ptr(LDKSendSuccess *NONNULL_PTR arg) {
77656         LDKSendSuccess *ret_copy = MALLOC(sizeof(LDKSendSuccess), "LDKSendSuccess");
77657         *ret_copy = SendSuccess_clone(arg);
77658         int64_t ret_ref = tag_ptr(ret_copy, true);
77659         return ret_ref;
77660 }
77661 int64_t  CS_LDK_SendSuccess_clone_ptr(int64_t arg) {
77662         LDKSendSuccess* arg_conv = (LDKSendSuccess*)untag_ptr(arg);
77663         int64_t ret_conv = SendSuccess_clone_ptr(arg_conv);
77664         return ret_conv;
77665 }
77666
77667 int64_t  CS_LDK_SendSuccess_clone(int64_t orig) {
77668         LDKSendSuccess* orig_conv = (LDKSendSuccess*)untag_ptr(orig);
77669         LDKSendSuccess *ret_copy = MALLOC(sizeof(LDKSendSuccess), "LDKSendSuccess");
77670         *ret_copy = SendSuccess_clone(orig_conv);
77671         int64_t ret_ref = tag_ptr(ret_copy, true);
77672         return ret_ref;
77673 }
77674
77675 int64_t  CS_LDK_SendSuccess_buffered() {
77676         LDKSendSuccess *ret_copy = MALLOC(sizeof(LDKSendSuccess), "LDKSendSuccess");
77677         *ret_copy = SendSuccess_buffered();
77678         int64_t ret_ref = tag_ptr(ret_copy, true);
77679         return ret_ref;
77680 }
77681
77682 int64_t  CS_LDK_SendSuccess_buffered_awaiting_connection(int8_tArray a) {
77683         LDKPublicKey a_ref;
77684         CHECK(a->arr_len == 33);
77685         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
77686         LDKSendSuccess *ret_copy = MALLOC(sizeof(LDKSendSuccess), "LDKSendSuccess");
77687         *ret_copy = SendSuccess_buffered_awaiting_connection(a_ref);
77688         int64_t ret_ref = tag_ptr(ret_copy, true);
77689         return ret_ref;
77690 }
77691
77692 int64_t  CS_LDK_SendSuccess_hash(int64_t o) {
77693         LDKSendSuccess* o_conv = (LDKSendSuccess*)untag_ptr(o);
77694         int64_t ret_conv = SendSuccess_hash(o_conv);
77695         return ret_conv;
77696 }
77697
77698 jboolean  CS_LDK_SendSuccess_eq(int64_t a, int64_t b) {
77699         LDKSendSuccess* a_conv = (LDKSendSuccess*)untag_ptr(a);
77700         LDKSendSuccess* b_conv = (LDKSendSuccess*)untag_ptr(b);
77701         jboolean ret_conv = SendSuccess_eq(a_conv, b_conv);
77702         return ret_conv;
77703 }
77704
77705 void  CS_LDK_SendError_free(int64_t this_ptr) {
77706         if (!ptr_is_owned(this_ptr)) return;
77707         void* this_ptr_ptr = untag_ptr(this_ptr);
77708         CHECK_ACCESS(this_ptr_ptr);
77709         LDKSendError this_ptr_conv = *(LDKSendError*)(this_ptr_ptr);
77710         FREE(untag_ptr(this_ptr));
77711         SendError_free(this_ptr_conv);
77712 }
77713
77714 static inline uint64_t SendError_clone_ptr(LDKSendError *NONNULL_PTR arg) {
77715         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
77716         *ret_copy = SendError_clone(arg);
77717         int64_t ret_ref = tag_ptr(ret_copy, true);
77718         return ret_ref;
77719 }
77720 int64_t  CS_LDK_SendError_clone_ptr(int64_t arg) {
77721         LDKSendError* arg_conv = (LDKSendError*)untag_ptr(arg);
77722         int64_t ret_conv = SendError_clone_ptr(arg_conv);
77723         return ret_conv;
77724 }
77725
77726 int64_t  CS_LDK_SendError_clone(int64_t orig) {
77727         LDKSendError* orig_conv = (LDKSendError*)untag_ptr(orig);
77728         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
77729         *ret_copy = SendError_clone(orig_conv);
77730         int64_t ret_ref = tag_ptr(ret_copy, true);
77731         return ret_ref;
77732 }
77733
77734 int64_t  CS_LDK_SendError_secp256k1(int32_t a) {
77735         LDKSecp256k1Error a_conv = LDKSecp256k1Error_from_cs(a);
77736         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
77737         *ret_copy = SendError_secp256k1(a_conv);
77738         int64_t ret_ref = tag_ptr(ret_copy, true);
77739         return ret_ref;
77740 }
77741
77742 int64_t  CS_LDK_SendError_too_big_packet() {
77743         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
77744         *ret_copy = SendError_too_big_packet();
77745         int64_t ret_ref = tag_ptr(ret_copy, true);
77746         return ret_ref;
77747 }
77748
77749 int64_t  CS_LDK_SendError_too_few_blinded_hops() {
77750         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
77751         *ret_copy = SendError_too_few_blinded_hops();
77752         int64_t ret_ref = tag_ptr(ret_copy, true);
77753         return ret_ref;
77754 }
77755
77756 int64_t  CS_LDK_SendError_invalid_first_hop(int8_tArray a) {
77757         LDKPublicKey a_ref;
77758         CHECK(a->arr_len == 33);
77759         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
77760         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
77761         *ret_copy = SendError_invalid_first_hop(a_ref);
77762         int64_t ret_ref = tag_ptr(ret_copy, true);
77763         return ret_ref;
77764 }
77765
77766 int64_t  CS_LDK_SendError_path_not_found() {
77767         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
77768         *ret_copy = SendError_path_not_found();
77769         int64_t ret_ref = tag_ptr(ret_copy, true);
77770         return ret_ref;
77771 }
77772
77773 int64_t  CS_LDK_SendError_invalid_message() {
77774         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
77775         *ret_copy = SendError_invalid_message();
77776         int64_t ret_ref = tag_ptr(ret_copy, true);
77777         return ret_ref;
77778 }
77779
77780 int64_t  CS_LDK_SendError_buffer_full() {
77781         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
77782         *ret_copy = SendError_buffer_full();
77783         int64_t ret_ref = tag_ptr(ret_copy, true);
77784         return ret_ref;
77785 }
77786
77787 int64_t  CS_LDK_SendError_get_node_id_failed() {
77788         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
77789         *ret_copy = SendError_get_node_id_failed();
77790         int64_t ret_ref = tag_ptr(ret_copy, true);
77791         return ret_ref;
77792 }
77793
77794 int64_t  CS_LDK_SendError_unresolved_introduction_node() {
77795         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
77796         *ret_copy = SendError_unresolved_introduction_node();
77797         int64_t ret_ref = tag_ptr(ret_copy, true);
77798         return ret_ref;
77799 }
77800
77801 int64_t  CS_LDK_SendError_blinded_path_advance_failed() {
77802         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
77803         *ret_copy = SendError_blinded_path_advance_failed();
77804         int64_t ret_ref = tag_ptr(ret_copy, true);
77805         return ret_ref;
77806 }
77807
77808 int64_t  CS_LDK_SendError_hash(int64_t o) {
77809         LDKSendError* o_conv = (LDKSendError*)untag_ptr(o);
77810         int64_t ret_conv = SendError_hash(o_conv);
77811         return ret_conv;
77812 }
77813
77814 jboolean  CS_LDK_SendError_eq(int64_t a, int64_t b) {
77815         LDKSendError* a_conv = (LDKSendError*)untag_ptr(a);
77816         LDKSendError* b_conv = (LDKSendError*)untag_ptr(b);
77817         jboolean ret_conv = SendError_eq(a_conv, b_conv);
77818         return ret_conv;
77819 }
77820
77821 void  CS_LDK_CustomOnionMessageHandler_free(int64_t this_ptr) {
77822         if (!ptr_is_owned(this_ptr)) return;
77823         void* this_ptr_ptr = untag_ptr(this_ptr);
77824         CHECK_ACCESS(this_ptr_ptr);
77825         LDKCustomOnionMessageHandler this_ptr_conv = *(LDKCustomOnionMessageHandler*)(this_ptr_ptr);
77826         FREE(untag_ptr(this_ptr));
77827         CustomOnionMessageHandler_free(this_ptr_conv);
77828 }
77829
77830 void  CS_LDK_PeeledOnion_free(int64_t this_ptr) {
77831         if (!ptr_is_owned(this_ptr)) return;
77832         void* this_ptr_ptr = untag_ptr(this_ptr);
77833         CHECK_ACCESS(this_ptr_ptr);
77834         LDKPeeledOnion this_ptr_conv = *(LDKPeeledOnion*)(this_ptr_ptr);
77835         FREE(untag_ptr(this_ptr));
77836         PeeledOnion_free(this_ptr_conv);
77837 }
77838
77839 static inline uint64_t PeeledOnion_clone_ptr(LDKPeeledOnion *NONNULL_PTR arg) {
77840         LDKPeeledOnion *ret_copy = MALLOC(sizeof(LDKPeeledOnion), "LDKPeeledOnion");
77841         *ret_copy = PeeledOnion_clone(arg);
77842         int64_t ret_ref = tag_ptr(ret_copy, true);
77843         return ret_ref;
77844 }
77845 int64_t  CS_LDK_PeeledOnion_clone_ptr(int64_t arg) {
77846         LDKPeeledOnion* arg_conv = (LDKPeeledOnion*)untag_ptr(arg);
77847         int64_t ret_conv = PeeledOnion_clone_ptr(arg_conv);
77848         return ret_conv;
77849 }
77850
77851 int64_t  CS_LDK_PeeledOnion_clone(int64_t orig) {
77852         LDKPeeledOnion* orig_conv = (LDKPeeledOnion*)untag_ptr(orig);
77853         LDKPeeledOnion *ret_copy = MALLOC(sizeof(LDKPeeledOnion), "LDKPeeledOnion");
77854         *ret_copy = PeeledOnion_clone(orig_conv);
77855         int64_t ret_ref = tag_ptr(ret_copy, true);
77856         return ret_ref;
77857 }
77858
77859 int64_t  CS_LDK_PeeledOnion_forward(int64_t a, int64_t b) {
77860         void* a_ptr = untag_ptr(a);
77861         CHECK_ACCESS(a_ptr);
77862         LDKNextMessageHop a_conv = *(LDKNextMessageHop*)(a_ptr);
77863         a_conv = NextMessageHop_clone((LDKNextMessageHop*)untag_ptr(a));
77864         LDKOnionMessage b_conv;
77865         b_conv.inner = untag_ptr(b);
77866         b_conv.is_owned = ptr_is_owned(b);
77867         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
77868         b_conv = OnionMessage_clone(&b_conv);
77869         LDKPeeledOnion *ret_copy = MALLOC(sizeof(LDKPeeledOnion), "LDKPeeledOnion");
77870         *ret_copy = PeeledOnion_forward(a_conv, b_conv);
77871         int64_t ret_ref = tag_ptr(ret_copy, true);
77872         return ret_ref;
77873 }
77874
77875 int64_t  CS_LDK_PeeledOnion_receive(int64_t a, int8_tArray b, int64_t c) {
77876         void* a_ptr = untag_ptr(a);
77877         CHECK_ACCESS(a_ptr);
77878         LDKParsedOnionMessageContents a_conv = *(LDKParsedOnionMessageContents*)(a_ptr);
77879         a_conv = ParsedOnionMessageContents_clone((LDKParsedOnionMessageContents*)untag_ptr(a));
77880         LDKThirtyTwoBytes b_ref;
77881         CHECK(b->arr_len == 32);
77882         memcpy(b_ref.data, b->elems, 32); FREE(b);
77883         LDKBlindedPath c_conv;
77884         c_conv.inner = untag_ptr(c);
77885         c_conv.is_owned = ptr_is_owned(c);
77886         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
77887         c_conv = BlindedPath_clone(&c_conv);
77888         LDKPeeledOnion *ret_copy = MALLOC(sizeof(LDKPeeledOnion), "LDKPeeledOnion");
77889         *ret_copy = PeeledOnion_receive(a_conv, b_ref, c_conv);
77890         int64_t ret_ref = tag_ptr(ret_copy, true);
77891         return ret_ref;
77892 }
77893
77894 int64_t  CS_LDK_create_onion_message_resolving_destination(int64_t entropy_source, int64_t node_signer, int64_t node_id_lookup, int64_t network_graph, int64_t path, int64_t contents, int64_t reply_path) {
77895         void* entropy_source_ptr = untag_ptr(entropy_source);
77896         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
77897         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
77898         void* node_signer_ptr = untag_ptr(node_signer);
77899         if (ptr_is_owned(node_signer)) { CHECK_ACCESS(node_signer_ptr); }
77900         LDKNodeSigner* node_signer_conv = (LDKNodeSigner*)node_signer_ptr;
77901         void* node_id_lookup_ptr = untag_ptr(node_id_lookup);
77902         if (ptr_is_owned(node_id_lookup)) { CHECK_ACCESS(node_id_lookup_ptr); }
77903         LDKNodeIdLookUp* node_id_lookup_conv = (LDKNodeIdLookUp*)node_id_lookup_ptr;
77904         LDKReadOnlyNetworkGraph network_graph_conv;
77905         network_graph_conv.inner = untag_ptr(network_graph);
77906         network_graph_conv.is_owned = ptr_is_owned(network_graph);
77907         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
77908         network_graph_conv.is_owned = false;
77909         LDKOnionMessagePath path_conv;
77910         path_conv.inner = untag_ptr(path);
77911         path_conv.is_owned = ptr_is_owned(path);
77912         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
77913         path_conv = OnionMessagePath_clone(&path_conv);
77914         void* contents_ptr = untag_ptr(contents);
77915         CHECK_ACCESS(contents_ptr);
77916         LDKOnionMessageContents contents_conv = *(LDKOnionMessageContents*)(contents_ptr);
77917         if (contents_conv.free == LDKOnionMessageContents_JCalls_free) {
77918                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
77919                 LDKOnionMessageContents_JCalls_cloned(&contents_conv);
77920         }
77921         LDKBlindedPath reply_path_conv;
77922         reply_path_conv.inner = untag_ptr(reply_path);
77923         reply_path_conv.is_owned = ptr_is_owned(reply_path);
77924         CHECK_INNER_FIELD_ACCESS_OR_NULL(reply_path_conv);
77925         reply_path_conv = BlindedPath_clone(&reply_path_conv);
77926         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ), "LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ");
77927         *ret_conv = create_onion_message_resolving_destination(entropy_source_conv, node_signer_conv, node_id_lookup_conv, &network_graph_conv, path_conv, contents_conv, reply_path_conv);
77928         return tag_ptr(ret_conv, true);
77929 }
77930
77931 int64_t  CS_LDK_create_onion_message(int64_t entropy_source, int64_t node_signer, int64_t node_id_lookup, int64_t path, int64_t contents, int64_t reply_path) {
77932         void* entropy_source_ptr = untag_ptr(entropy_source);
77933         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
77934         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
77935         void* node_signer_ptr = untag_ptr(node_signer);
77936         if (ptr_is_owned(node_signer)) { CHECK_ACCESS(node_signer_ptr); }
77937         LDKNodeSigner* node_signer_conv = (LDKNodeSigner*)node_signer_ptr;
77938         void* node_id_lookup_ptr = untag_ptr(node_id_lookup);
77939         if (ptr_is_owned(node_id_lookup)) { CHECK_ACCESS(node_id_lookup_ptr); }
77940         LDKNodeIdLookUp* node_id_lookup_conv = (LDKNodeIdLookUp*)node_id_lookup_ptr;
77941         LDKOnionMessagePath path_conv;
77942         path_conv.inner = untag_ptr(path);
77943         path_conv.is_owned = ptr_is_owned(path);
77944         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
77945         path_conv = OnionMessagePath_clone(&path_conv);
77946         void* contents_ptr = untag_ptr(contents);
77947         CHECK_ACCESS(contents_ptr);
77948         LDKOnionMessageContents contents_conv = *(LDKOnionMessageContents*)(contents_ptr);
77949         if (contents_conv.free == LDKOnionMessageContents_JCalls_free) {
77950                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
77951                 LDKOnionMessageContents_JCalls_cloned(&contents_conv);
77952         }
77953         LDKBlindedPath reply_path_conv;
77954         reply_path_conv.inner = untag_ptr(reply_path);
77955         reply_path_conv.is_owned = ptr_is_owned(reply_path);
77956         CHECK_INNER_FIELD_ACCESS_OR_NULL(reply_path_conv);
77957         reply_path_conv = BlindedPath_clone(&reply_path_conv);
77958         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ), "LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ");
77959         *ret_conv = create_onion_message(entropy_source_conv, node_signer_conv, node_id_lookup_conv, path_conv, contents_conv, reply_path_conv);
77960         return tag_ptr(ret_conv, true);
77961 }
77962
77963 int64_t  CS_LDK_peel_onion_message(int64_t msg, int64_t node_signer, int64_t logger, int64_t custom_handler) {
77964         LDKOnionMessage msg_conv;
77965         msg_conv.inner = untag_ptr(msg);
77966         msg_conv.is_owned = ptr_is_owned(msg);
77967         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
77968         msg_conv.is_owned = false;
77969         void* node_signer_ptr = untag_ptr(node_signer);
77970         CHECK_ACCESS(node_signer_ptr);
77971         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
77972         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
77973                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
77974                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
77975         }
77976         void* logger_ptr = untag_ptr(logger);
77977         CHECK_ACCESS(logger_ptr);
77978         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
77979         if (logger_conv.free == LDKLogger_JCalls_free) {
77980                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
77981                 LDKLogger_JCalls_cloned(&logger_conv);
77982         }
77983         void* custom_handler_ptr = untag_ptr(custom_handler);
77984         CHECK_ACCESS(custom_handler_ptr);
77985         LDKCustomOnionMessageHandler custom_handler_conv = *(LDKCustomOnionMessageHandler*)(custom_handler_ptr);
77986         if (custom_handler_conv.free == LDKCustomOnionMessageHandler_JCalls_free) {
77987                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
77988                 LDKCustomOnionMessageHandler_JCalls_cloned(&custom_handler_conv);
77989         }
77990         LDKCResult_PeeledOnionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PeeledOnionNoneZ), "LDKCResult_PeeledOnionNoneZ");
77991         *ret_conv = peel_onion_message(&msg_conv, node_signer_conv, logger_conv, custom_handler_conv);
77992         return tag_ptr(ret_conv, true);
77993 }
77994
77995 int64_t  CS_LDK_OnionMessenger_new(int64_t entropy_source, int64_t node_signer, int64_t logger, int64_t node_id_lookup, int64_t message_router, int64_t offers_handler, int64_t custom_handler) {
77996         void* entropy_source_ptr = untag_ptr(entropy_source);
77997         CHECK_ACCESS(entropy_source_ptr);
77998         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
77999         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
78000                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
78001                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
78002         }
78003         void* node_signer_ptr = untag_ptr(node_signer);
78004         CHECK_ACCESS(node_signer_ptr);
78005         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
78006         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
78007                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
78008                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
78009         }
78010         void* logger_ptr = untag_ptr(logger);
78011         CHECK_ACCESS(logger_ptr);
78012         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
78013         if (logger_conv.free == LDKLogger_JCalls_free) {
78014                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
78015                 LDKLogger_JCalls_cloned(&logger_conv);
78016         }
78017         void* node_id_lookup_ptr = untag_ptr(node_id_lookup);
78018         CHECK_ACCESS(node_id_lookup_ptr);
78019         LDKNodeIdLookUp node_id_lookup_conv = *(LDKNodeIdLookUp*)(node_id_lookup_ptr);
78020         if (node_id_lookup_conv.free == LDKNodeIdLookUp_JCalls_free) {
78021                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
78022                 LDKNodeIdLookUp_JCalls_cloned(&node_id_lookup_conv);
78023         }
78024         void* message_router_ptr = untag_ptr(message_router);
78025         CHECK_ACCESS(message_router_ptr);
78026         LDKMessageRouter message_router_conv = *(LDKMessageRouter*)(message_router_ptr);
78027         if (message_router_conv.free == LDKMessageRouter_JCalls_free) {
78028                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
78029                 LDKMessageRouter_JCalls_cloned(&message_router_conv);
78030         }
78031         void* offers_handler_ptr = untag_ptr(offers_handler);
78032         CHECK_ACCESS(offers_handler_ptr);
78033         LDKOffersMessageHandler offers_handler_conv = *(LDKOffersMessageHandler*)(offers_handler_ptr);
78034         if (offers_handler_conv.free == LDKOffersMessageHandler_JCalls_free) {
78035                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
78036                 LDKOffersMessageHandler_JCalls_cloned(&offers_handler_conv);
78037         }
78038         void* custom_handler_ptr = untag_ptr(custom_handler);
78039         CHECK_ACCESS(custom_handler_ptr);
78040         LDKCustomOnionMessageHandler custom_handler_conv = *(LDKCustomOnionMessageHandler*)(custom_handler_ptr);
78041         if (custom_handler_conv.free == LDKCustomOnionMessageHandler_JCalls_free) {
78042                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
78043                 LDKCustomOnionMessageHandler_JCalls_cloned(&custom_handler_conv);
78044         }
78045         LDKOnionMessenger ret_var = OnionMessenger_new(entropy_source_conv, node_signer_conv, logger_conv, node_id_lookup_conv, message_router_conv, offers_handler_conv, custom_handler_conv);
78046         int64_t ret_ref = 0;
78047         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78048         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78049         return ret_ref;
78050 }
78051
78052 int64_t  CS_LDK_OnionMessenger_send_onion_message(int64_t this_arg, int64_t contents, int64_t destination, int64_t reply_path) {
78053         LDKOnionMessenger this_arg_conv;
78054         this_arg_conv.inner = untag_ptr(this_arg);
78055         this_arg_conv.is_owned = ptr_is_owned(this_arg);
78056         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
78057         this_arg_conv.is_owned = false;
78058         void* contents_ptr = untag_ptr(contents);
78059         CHECK_ACCESS(contents_ptr);
78060         LDKOnionMessageContents contents_conv = *(LDKOnionMessageContents*)(contents_ptr);
78061         if (contents_conv.free == LDKOnionMessageContents_JCalls_free) {
78062                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
78063                 LDKOnionMessageContents_JCalls_cloned(&contents_conv);
78064         }
78065         void* destination_ptr = untag_ptr(destination);
78066         CHECK_ACCESS(destination_ptr);
78067         LDKDestination destination_conv = *(LDKDestination*)(destination_ptr);
78068         destination_conv = Destination_clone((LDKDestination*)untag_ptr(destination));
78069         LDKBlindedPath reply_path_conv;
78070         reply_path_conv.inner = untag_ptr(reply_path);
78071         reply_path_conv.is_owned = ptr_is_owned(reply_path);
78072         CHECK_INNER_FIELD_ACCESS_OR_NULL(reply_path_conv);
78073         reply_path_conv = BlindedPath_clone(&reply_path_conv);
78074         LDKCResult_SendSuccessSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SendSuccessSendErrorZ), "LDKCResult_SendSuccessSendErrorZ");
78075         *ret_conv = OnionMessenger_send_onion_message(&this_arg_conv, contents_conv, destination_conv, reply_path_conv);
78076         return tag_ptr(ret_conv, true);
78077 }
78078
78079 int64_t  CS_LDK_OnionMessenger_as_OnionMessageHandler(int64_t this_arg) {
78080         LDKOnionMessenger this_arg_conv;
78081         this_arg_conv.inner = untag_ptr(this_arg);
78082         this_arg_conv.is_owned = ptr_is_owned(this_arg);
78083         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
78084         this_arg_conv.is_owned = false;
78085         LDKOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
78086         *ret_ret = OnionMessenger_as_OnionMessageHandler(&this_arg_conv);
78087         return tag_ptr(ret_ret, true);
78088 }
78089
78090 void  CS_LDK_OffersMessageHandler_free(int64_t this_ptr) {
78091         if (!ptr_is_owned(this_ptr)) return;
78092         void* this_ptr_ptr = untag_ptr(this_ptr);
78093         CHECK_ACCESS(this_ptr_ptr);
78094         LDKOffersMessageHandler this_ptr_conv = *(LDKOffersMessageHandler*)(this_ptr_ptr);
78095         FREE(untag_ptr(this_ptr));
78096         OffersMessageHandler_free(this_ptr_conv);
78097 }
78098
78099 void  CS_LDK_OffersMessage_free(int64_t this_ptr) {
78100         if (!ptr_is_owned(this_ptr)) return;
78101         void* this_ptr_ptr = untag_ptr(this_ptr);
78102         CHECK_ACCESS(this_ptr_ptr);
78103         LDKOffersMessage this_ptr_conv = *(LDKOffersMessage*)(this_ptr_ptr);
78104         FREE(untag_ptr(this_ptr));
78105         OffersMessage_free(this_ptr_conv);
78106 }
78107
78108 static inline uint64_t OffersMessage_clone_ptr(LDKOffersMessage *NONNULL_PTR arg) {
78109         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
78110         *ret_copy = OffersMessage_clone(arg);
78111         int64_t ret_ref = tag_ptr(ret_copy, true);
78112         return ret_ref;
78113 }
78114 int64_t  CS_LDK_OffersMessage_clone_ptr(int64_t arg) {
78115         LDKOffersMessage* arg_conv = (LDKOffersMessage*)untag_ptr(arg);
78116         int64_t ret_conv = OffersMessage_clone_ptr(arg_conv);
78117         return ret_conv;
78118 }
78119
78120 int64_t  CS_LDK_OffersMessage_clone(int64_t orig) {
78121         LDKOffersMessage* orig_conv = (LDKOffersMessage*)untag_ptr(orig);
78122         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
78123         *ret_copy = OffersMessage_clone(orig_conv);
78124         int64_t ret_ref = tag_ptr(ret_copy, true);
78125         return ret_ref;
78126 }
78127
78128 int64_t  CS_LDK_OffersMessage_invoice_request(int64_t a) {
78129         LDKInvoiceRequest a_conv;
78130         a_conv.inner = untag_ptr(a);
78131         a_conv.is_owned = ptr_is_owned(a);
78132         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
78133         a_conv = InvoiceRequest_clone(&a_conv);
78134         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
78135         *ret_copy = OffersMessage_invoice_request(a_conv);
78136         int64_t ret_ref = tag_ptr(ret_copy, true);
78137         return ret_ref;
78138 }
78139
78140 int64_t  CS_LDK_OffersMessage_invoice(int64_t a) {
78141         LDKBolt12Invoice a_conv;
78142         a_conv.inner = untag_ptr(a);
78143         a_conv.is_owned = ptr_is_owned(a);
78144         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
78145         a_conv = Bolt12Invoice_clone(&a_conv);
78146         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
78147         *ret_copy = OffersMessage_invoice(a_conv);
78148         int64_t ret_ref = tag_ptr(ret_copy, true);
78149         return ret_ref;
78150 }
78151
78152 int64_t  CS_LDK_OffersMessage_invoice_error(int64_t a) {
78153         LDKInvoiceError a_conv;
78154         a_conv.inner = untag_ptr(a);
78155         a_conv.is_owned = ptr_is_owned(a);
78156         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
78157         a_conv = InvoiceError_clone(&a_conv);
78158         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
78159         *ret_copy = OffersMessage_invoice_error(a_conv);
78160         int64_t ret_ref = tag_ptr(ret_copy, true);
78161         return ret_ref;
78162 }
78163
78164 jboolean  CS_LDK_OffersMessage_is_known_type(int64_t tlv_type) {
78165         jboolean ret_conv = OffersMessage_is_known_type(tlv_type);
78166         return ret_conv;
78167 }
78168
78169 int64_t  CS_LDK_OffersMessage_as_OnionMessageContents(int64_t this_arg) {
78170         LDKOffersMessage* this_arg_conv = (LDKOffersMessage*)untag_ptr(this_arg);
78171         LDKOnionMessageContents* ret_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
78172         *ret_ret = OffersMessage_as_OnionMessageContents(this_arg_conv);
78173         return tag_ptr(ret_ret, true);
78174 }
78175
78176 int8_tArray  CS_LDK_OffersMessage_write(int64_t obj) {
78177         LDKOffersMessage* obj_conv = (LDKOffersMessage*)untag_ptr(obj);
78178         LDKCVec_u8Z ret_var = OffersMessage_write(obj_conv);
78179         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
78180         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
78181         CVec_u8Z_free(ret_var);
78182         return ret_arr;
78183 }
78184
78185 int64_t  CS_LDK_OffersMessage_read(int8_tArray ser, int64_t arg_a, int64_t arg_b) {
78186         LDKu8slice ser_ref;
78187         ser_ref.datalen = ser->arr_len;
78188         ser_ref.data = ser->elems;
78189         void* arg_b_ptr = untag_ptr(arg_b);
78190         if (ptr_is_owned(arg_b)) { CHECK_ACCESS(arg_b_ptr); }
78191         LDKLogger* arg_b_conv = (LDKLogger*)arg_b_ptr;
78192         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
78193         *ret_conv = OffersMessage_read(ser_ref, arg_a, arg_b_conv);
78194         FREE(ser);
78195         return tag_ptr(ret_conv, true);
78196 }
78197
78198 void  CS_LDK_Packet_free(int64_t this_obj) {
78199         LDKPacket this_obj_conv;
78200         this_obj_conv.inner = untag_ptr(this_obj);
78201         this_obj_conv.is_owned = ptr_is_owned(this_obj);
78202         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
78203         Packet_free(this_obj_conv);
78204 }
78205
78206 int8_t  CS_LDK_Packet_get_version(int64_t this_ptr) {
78207         LDKPacket this_ptr_conv;
78208         this_ptr_conv.inner = untag_ptr(this_ptr);
78209         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78210         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78211         this_ptr_conv.is_owned = false;
78212         int8_t ret_conv = Packet_get_version(&this_ptr_conv);
78213         return ret_conv;
78214 }
78215
78216 void  CS_LDK_Packet_set_version(int64_t this_ptr, int8_t val) {
78217         LDKPacket this_ptr_conv;
78218         this_ptr_conv.inner = untag_ptr(this_ptr);
78219         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78220         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78221         this_ptr_conv.is_owned = false;
78222         Packet_set_version(&this_ptr_conv, val);
78223 }
78224
78225 int8_tArray  CS_LDK_Packet_get_public_key(int64_t this_ptr) {
78226         LDKPacket this_ptr_conv;
78227         this_ptr_conv.inner = untag_ptr(this_ptr);
78228         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78229         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78230         this_ptr_conv.is_owned = false;
78231         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
78232         memcpy(ret_arr->elems, Packet_get_public_key(&this_ptr_conv).compressed_form, 33);
78233         return ret_arr;
78234 }
78235
78236 void  CS_LDK_Packet_set_public_key(int64_t this_ptr, int8_tArray val) {
78237         LDKPacket this_ptr_conv;
78238         this_ptr_conv.inner = untag_ptr(this_ptr);
78239         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78240         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78241         this_ptr_conv.is_owned = false;
78242         LDKPublicKey val_ref;
78243         CHECK(val->arr_len == 33);
78244         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
78245         Packet_set_public_key(&this_ptr_conv, val_ref);
78246 }
78247
78248 int8_tArray  CS_LDK_Packet_get_hop_data(int64_t this_ptr) {
78249         LDKPacket this_ptr_conv;
78250         this_ptr_conv.inner = untag_ptr(this_ptr);
78251         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78252         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78253         this_ptr_conv.is_owned = false;
78254         LDKCVec_u8Z ret_var = Packet_get_hop_data(&this_ptr_conv);
78255         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
78256         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
78257         CVec_u8Z_free(ret_var);
78258         return ret_arr;
78259 }
78260
78261 void  CS_LDK_Packet_set_hop_data(int64_t this_ptr, int8_tArray val) {
78262         LDKPacket this_ptr_conv;
78263         this_ptr_conv.inner = untag_ptr(this_ptr);
78264         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78265         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78266         this_ptr_conv.is_owned = false;
78267         LDKCVec_u8Z val_ref;
78268         val_ref.datalen = val->arr_len;
78269         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
78270         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
78271         Packet_set_hop_data(&this_ptr_conv, val_ref);
78272 }
78273
78274 int8_tArray  CS_LDK_Packet_get_hmac(int64_t this_ptr) {
78275         LDKPacket this_ptr_conv;
78276         this_ptr_conv.inner = untag_ptr(this_ptr);
78277         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78278         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78279         this_ptr_conv.is_owned = false;
78280         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
78281         memcpy(ret_arr->elems, *Packet_get_hmac(&this_ptr_conv), 32);
78282         return ret_arr;
78283 }
78284
78285 void  CS_LDK_Packet_set_hmac(int64_t this_ptr, int8_tArray val) {
78286         LDKPacket this_ptr_conv;
78287         this_ptr_conv.inner = untag_ptr(this_ptr);
78288         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78289         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78290         this_ptr_conv.is_owned = false;
78291         LDKThirtyTwoBytes val_ref;
78292         CHECK(val->arr_len == 32);
78293         memcpy(val_ref.data, val->elems, 32); FREE(val);
78294         Packet_set_hmac(&this_ptr_conv, val_ref);
78295 }
78296
78297 int64_t  CS_LDK_Packet_new(int8_t version_arg, int8_tArray public_key_arg, int8_tArray hop_data_arg, int8_tArray hmac_arg) {
78298         LDKPublicKey public_key_arg_ref;
78299         CHECK(public_key_arg->arr_len == 33);
78300         memcpy(public_key_arg_ref.compressed_form, public_key_arg->elems, 33); FREE(public_key_arg);
78301         LDKCVec_u8Z hop_data_arg_ref;
78302         hop_data_arg_ref.datalen = hop_data_arg->arr_len;
78303         hop_data_arg_ref.data = MALLOC(hop_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
78304         memcpy(hop_data_arg_ref.data, hop_data_arg->elems, hop_data_arg_ref.datalen); FREE(hop_data_arg);
78305         LDKThirtyTwoBytes hmac_arg_ref;
78306         CHECK(hmac_arg->arr_len == 32);
78307         memcpy(hmac_arg_ref.data, hmac_arg->elems, 32); FREE(hmac_arg);
78308         LDKPacket ret_var = Packet_new(version_arg, public_key_arg_ref, hop_data_arg_ref, hmac_arg_ref);
78309         int64_t ret_ref = 0;
78310         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78311         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78312         return ret_ref;
78313 }
78314
78315 static inline uint64_t Packet_clone_ptr(LDKPacket *NONNULL_PTR arg) {
78316         LDKPacket ret_var = Packet_clone(arg);
78317         int64_t ret_ref = 0;
78318         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78319         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78320         return ret_ref;
78321 }
78322 int64_t  CS_LDK_Packet_clone_ptr(int64_t arg) {
78323         LDKPacket arg_conv;
78324         arg_conv.inner = untag_ptr(arg);
78325         arg_conv.is_owned = ptr_is_owned(arg);
78326         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
78327         arg_conv.is_owned = false;
78328         int64_t ret_conv = Packet_clone_ptr(&arg_conv);
78329         return ret_conv;
78330 }
78331
78332 int64_t  CS_LDK_Packet_clone(int64_t orig) {
78333         LDKPacket orig_conv;
78334         orig_conv.inner = untag_ptr(orig);
78335         orig_conv.is_owned = ptr_is_owned(orig);
78336         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
78337         orig_conv.is_owned = false;
78338         LDKPacket ret_var = Packet_clone(&orig_conv);
78339         int64_t ret_ref = 0;
78340         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78341         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78342         return ret_ref;
78343 }
78344
78345 int64_t  CS_LDK_Packet_hash(int64_t o) {
78346         LDKPacket o_conv;
78347         o_conv.inner = untag_ptr(o);
78348         o_conv.is_owned = ptr_is_owned(o);
78349         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
78350         o_conv.is_owned = false;
78351         int64_t ret_conv = Packet_hash(&o_conv);
78352         return ret_conv;
78353 }
78354
78355 jboolean  CS_LDK_Packet_eq(int64_t a, int64_t b) {
78356         LDKPacket a_conv;
78357         a_conv.inner = untag_ptr(a);
78358         a_conv.is_owned = ptr_is_owned(a);
78359         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
78360         a_conv.is_owned = false;
78361         LDKPacket b_conv;
78362         b_conv.inner = untag_ptr(b);
78363         b_conv.is_owned = ptr_is_owned(b);
78364         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
78365         b_conv.is_owned = false;
78366         jboolean ret_conv = Packet_eq(&a_conv, &b_conv);
78367         return ret_conv;
78368 }
78369
78370 int8_tArray  CS_LDK_Packet_write(int64_t obj) {
78371         LDKPacket obj_conv;
78372         obj_conv.inner = untag_ptr(obj);
78373         obj_conv.is_owned = ptr_is_owned(obj);
78374         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
78375         obj_conv.is_owned = false;
78376         LDKCVec_u8Z ret_var = Packet_write(&obj_conv);
78377         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
78378         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
78379         CVec_u8Z_free(ret_var);
78380         return ret_arr;
78381 }
78382
78383 void  CS_LDK_ParsedOnionMessageContents_free(int64_t this_ptr) {
78384         if (!ptr_is_owned(this_ptr)) return;
78385         void* this_ptr_ptr = untag_ptr(this_ptr);
78386         CHECK_ACCESS(this_ptr_ptr);
78387         LDKParsedOnionMessageContents this_ptr_conv = *(LDKParsedOnionMessageContents*)(this_ptr_ptr);
78388         FREE(untag_ptr(this_ptr));
78389         ParsedOnionMessageContents_free(this_ptr_conv);
78390 }
78391
78392 static inline uint64_t ParsedOnionMessageContents_clone_ptr(LDKParsedOnionMessageContents *NONNULL_PTR arg) {
78393         LDKParsedOnionMessageContents *ret_copy = MALLOC(sizeof(LDKParsedOnionMessageContents), "LDKParsedOnionMessageContents");
78394         *ret_copy = ParsedOnionMessageContents_clone(arg);
78395         int64_t ret_ref = tag_ptr(ret_copy, true);
78396         return ret_ref;
78397 }
78398 int64_t  CS_LDK_ParsedOnionMessageContents_clone_ptr(int64_t arg) {
78399         LDKParsedOnionMessageContents* arg_conv = (LDKParsedOnionMessageContents*)untag_ptr(arg);
78400         int64_t ret_conv = ParsedOnionMessageContents_clone_ptr(arg_conv);
78401         return ret_conv;
78402 }
78403
78404 int64_t  CS_LDK_ParsedOnionMessageContents_clone(int64_t orig) {
78405         LDKParsedOnionMessageContents* orig_conv = (LDKParsedOnionMessageContents*)untag_ptr(orig);
78406         LDKParsedOnionMessageContents *ret_copy = MALLOC(sizeof(LDKParsedOnionMessageContents), "LDKParsedOnionMessageContents");
78407         *ret_copy = ParsedOnionMessageContents_clone(orig_conv);
78408         int64_t ret_ref = tag_ptr(ret_copy, true);
78409         return ret_ref;
78410 }
78411
78412 int64_t  CS_LDK_ParsedOnionMessageContents_offers(int64_t a) {
78413         void* a_ptr = untag_ptr(a);
78414         CHECK_ACCESS(a_ptr);
78415         LDKOffersMessage a_conv = *(LDKOffersMessage*)(a_ptr);
78416         a_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(a));
78417         LDKParsedOnionMessageContents *ret_copy = MALLOC(sizeof(LDKParsedOnionMessageContents), "LDKParsedOnionMessageContents");
78418         *ret_copy = ParsedOnionMessageContents_offers(a_conv);
78419         int64_t ret_ref = tag_ptr(ret_copy, true);
78420         return ret_ref;
78421 }
78422
78423 int64_t  CS_LDK_ParsedOnionMessageContents_custom(int64_t a) {
78424         void* a_ptr = untag_ptr(a);
78425         CHECK_ACCESS(a_ptr);
78426         LDKOnionMessageContents a_conv = *(LDKOnionMessageContents*)(a_ptr);
78427         if (a_conv.free == LDKOnionMessageContents_JCalls_free) {
78428                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
78429                 LDKOnionMessageContents_JCalls_cloned(&a_conv);
78430         }
78431         LDKParsedOnionMessageContents *ret_copy = MALLOC(sizeof(LDKParsedOnionMessageContents), "LDKParsedOnionMessageContents");
78432         *ret_copy = ParsedOnionMessageContents_custom(a_conv);
78433         int64_t ret_ref = tag_ptr(ret_copy, true);
78434         return ret_ref;
78435 }
78436
78437 int64_t  CS_LDK_ParsedOnionMessageContents_as_OnionMessageContents(int64_t this_arg) {
78438         LDKParsedOnionMessageContents* this_arg_conv = (LDKParsedOnionMessageContents*)untag_ptr(this_arg);
78439         LDKOnionMessageContents* ret_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
78440         *ret_ret = ParsedOnionMessageContents_as_OnionMessageContents(this_arg_conv);
78441         return tag_ptr(ret_ret, true);
78442 }
78443
78444 int8_tArray  CS_LDK_ParsedOnionMessageContents_write(int64_t obj) {
78445         LDKParsedOnionMessageContents* obj_conv = (LDKParsedOnionMessageContents*)untag_ptr(obj);
78446         LDKCVec_u8Z ret_var = ParsedOnionMessageContents_write(obj_conv);
78447         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
78448         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
78449         CVec_u8Z_free(ret_var);
78450         return ret_arr;
78451 }
78452
78453 static inline uint64_t OnionMessageContents_clone_ptr(LDKOnionMessageContents *NONNULL_PTR arg) {
78454         LDKOnionMessageContents* ret_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
78455         *ret_ret = OnionMessageContents_clone(arg);
78456         return tag_ptr(ret_ret, true);
78457 }
78458 int64_t  CS_LDK_OnionMessageContents_clone_ptr(int64_t arg) {
78459         void* arg_ptr = untag_ptr(arg);
78460         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
78461         LDKOnionMessageContents* arg_conv = (LDKOnionMessageContents*)arg_ptr;
78462         int64_t ret_conv = OnionMessageContents_clone_ptr(arg_conv);
78463         return ret_conv;
78464 }
78465
78466 int64_t  CS_LDK_OnionMessageContents_clone(int64_t orig) {
78467         void* orig_ptr = untag_ptr(orig);
78468         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
78469         LDKOnionMessageContents* orig_conv = (LDKOnionMessageContents*)orig_ptr;
78470         LDKOnionMessageContents* ret_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
78471         *ret_ret = OnionMessageContents_clone(orig_conv);
78472         return tag_ptr(ret_ret, true);
78473 }
78474
78475 void  CS_LDK_OnionMessageContents_free(int64_t this_ptr) {
78476         if (!ptr_is_owned(this_ptr)) return;
78477         void* this_ptr_ptr = untag_ptr(this_ptr);
78478         CHECK_ACCESS(this_ptr_ptr);
78479         LDKOnionMessageContents this_ptr_conv = *(LDKOnionMessageContents*)(this_ptr_ptr);
78480         FREE(untag_ptr(this_ptr));
78481         OnionMessageContents_free(this_ptr_conv);
78482 }
78483
78484 void  CS_LDK_NextMessageHop_free(int64_t this_ptr) {
78485         if (!ptr_is_owned(this_ptr)) return;
78486         void* this_ptr_ptr = untag_ptr(this_ptr);
78487         CHECK_ACCESS(this_ptr_ptr);
78488         LDKNextMessageHop this_ptr_conv = *(LDKNextMessageHop*)(this_ptr_ptr);
78489         FREE(untag_ptr(this_ptr));
78490         NextMessageHop_free(this_ptr_conv);
78491 }
78492
78493 static inline uint64_t NextMessageHop_clone_ptr(LDKNextMessageHop *NONNULL_PTR arg) {
78494         LDKNextMessageHop *ret_copy = MALLOC(sizeof(LDKNextMessageHop), "LDKNextMessageHop");
78495         *ret_copy = NextMessageHop_clone(arg);
78496         int64_t ret_ref = tag_ptr(ret_copy, true);
78497         return ret_ref;
78498 }
78499 int64_t  CS_LDK_NextMessageHop_clone_ptr(int64_t arg) {
78500         LDKNextMessageHop* arg_conv = (LDKNextMessageHop*)untag_ptr(arg);
78501         int64_t ret_conv = NextMessageHop_clone_ptr(arg_conv);
78502         return ret_conv;
78503 }
78504
78505 int64_t  CS_LDK_NextMessageHop_clone(int64_t orig) {
78506         LDKNextMessageHop* orig_conv = (LDKNextMessageHop*)untag_ptr(orig);
78507         LDKNextMessageHop *ret_copy = MALLOC(sizeof(LDKNextMessageHop), "LDKNextMessageHop");
78508         *ret_copy = NextMessageHop_clone(orig_conv);
78509         int64_t ret_ref = tag_ptr(ret_copy, true);
78510         return ret_ref;
78511 }
78512
78513 int64_t  CS_LDK_NextMessageHop_node_id(int8_tArray a) {
78514         LDKPublicKey a_ref;
78515         CHECK(a->arr_len == 33);
78516         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
78517         LDKNextMessageHop *ret_copy = MALLOC(sizeof(LDKNextMessageHop), "LDKNextMessageHop");
78518         *ret_copy = NextMessageHop_node_id(a_ref);
78519         int64_t ret_ref = tag_ptr(ret_copy, true);
78520         return ret_ref;
78521 }
78522
78523 int64_t  CS_LDK_NextMessageHop_short_channel_id(int64_t a) {
78524         LDKNextMessageHop *ret_copy = MALLOC(sizeof(LDKNextMessageHop), "LDKNextMessageHop");
78525         *ret_copy = NextMessageHop_short_channel_id(a);
78526         int64_t ret_ref = tag_ptr(ret_copy, true);
78527         return ret_ref;
78528 }
78529
78530 int64_t  CS_LDK_NextMessageHop_hash(int64_t o) {
78531         LDKNextMessageHop* o_conv = (LDKNextMessageHop*)untag_ptr(o);
78532         int64_t ret_conv = NextMessageHop_hash(o_conv);
78533         return ret_conv;
78534 }
78535
78536 jboolean  CS_LDK_NextMessageHop_eq(int64_t a, int64_t b) {
78537         LDKNextMessageHop* a_conv = (LDKNextMessageHop*)untag_ptr(a);
78538         LDKNextMessageHop* b_conv = (LDKNextMessageHop*)untag_ptr(b);
78539         jboolean ret_conv = NextMessageHop_eq(a_conv, b_conv);
78540         return ret_conv;
78541 }
78542
78543 void  CS_LDK_BlindedPath_free(int64_t this_obj) {
78544         LDKBlindedPath this_obj_conv;
78545         this_obj_conv.inner = untag_ptr(this_obj);
78546         this_obj_conv.is_owned = ptr_is_owned(this_obj);
78547         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
78548         BlindedPath_free(this_obj_conv);
78549 }
78550
78551 int64_t  CS_LDK_BlindedPath_get_introduction_node(int64_t this_ptr) {
78552         LDKBlindedPath this_ptr_conv;
78553         this_ptr_conv.inner = untag_ptr(this_ptr);
78554         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78555         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78556         this_ptr_conv.is_owned = false;
78557         LDKIntroductionNode *ret_copy = MALLOC(sizeof(LDKIntroductionNode), "LDKIntroductionNode");
78558         *ret_copy = BlindedPath_get_introduction_node(&this_ptr_conv);
78559         int64_t ret_ref = tag_ptr(ret_copy, true);
78560         return ret_ref;
78561 }
78562
78563 void  CS_LDK_BlindedPath_set_introduction_node(int64_t this_ptr, int64_t val) {
78564         LDKBlindedPath this_ptr_conv;
78565         this_ptr_conv.inner = untag_ptr(this_ptr);
78566         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78567         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78568         this_ptr_conv.is_owned = false;
78569         void* val_ptr = untag_ptr(val);
78570         CHECK_ACCESS(val_ptr);
78571         LDKIntroductionNode val_conv = *(LDKIntroductionNode*)(val_ptr);
78572         val_conv = IntroductionNode_clone((LDKIntroductionNode*)untag_ptr(val));
78573         BlindedPath_set_introduction_node(&this_ptr_conv, val_conv);
78574 }
78575
78576 int8_tArray  CS_LDK_BlindedPath_get_blinding_point(int64_t this_ptr) {
78577         LDKBlindedPath this_ptr_conv;
78578         this_ptr_conv.inner = untag_ptr(this_ptr);
78579         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78580         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78581         this_ptr_conv.is_owned = false;
78582         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
78583         memcpy(ret_arr->elems, BlindedPath_get_blinding_point(&this_ptr_conv).compressed_form, 33);
78584         return ret_arr;
78585 }
78586
78587 void  CS_LDK_BlindedPath_set_blinding_point(int64_t this_ptr, int8_tArray val) {
78588         LDKBlindedPath this_ptr_conv;
78589         this_ptr_conv.inner = untag_ptr(this_ptr);
78590         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78591         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78592         this_ptr_conv.is_owned = false;
78593         LDKPublicKey val_ref;
78594         CHECK(val->arr_len == 33);
78595         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
78596         BlindedPath_set_blinding_point(&this_ptr_conv, val_ref);
78597 }
78598
78599 int64_tArray  CS_LDK_BlindedPath_get_blinded_hops(int64_t this_ptr) {
78600         LDKBlindedPath this_ptr_conv;
78601         this_ptr_conv.inner = untag_ptr(this_ptr);
78602         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78603         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78604         this_ptr_conv.is_owned = false;
78605         LDKCVec_BlindedHopZ ret_var = BlindedPath_get_blinded_hops(&this_ptr_conv);
78606         int64_tArray ret_arr = NULL;
78607         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
78608         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
78609         for (size_t m = 0; m < ret_var.datalen; m++) {
78610                 LDKBlindedHop ret_conv_12_var = ret_var.data[m];
78611                 int64_t ret_conv_12_ref = 0;
78612                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_12_var);
78613                 ret_conv_12_ref = tag_ptr(ret_conv_12_var.inner, ret_conv_12_var.is_owned);
78614                 ret_arr_ptr[m] = ret_conv_12_ref;
78615         }
78616         
78617         FREE(ret_var.data);
78618         return ret_arr;
78619 }
78620
78621 void  CS_LDK_BlindedPath_set_blinded_hops(int64_t this_ptr, int64_tArray val) {
78622         LDKBlindedPath this_ptr_conv;
78623         this_ptr_conv.inner = untag_ptr(this_ptr);
78624         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78625         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78626         this_ptr_conv.is_owned = false;
78627         LDKCVec_BlindedHopZ val_constr;
78628         val_constr.datalen = val->arr_len;
78629         if (val_constr.datalen > 0)
78630                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
78631         else
78632                 val_constr.data = NULL;
78633         int64_t* val_vals = val->elems;
78634         for (size_t m = 0; m < val_constr.datalen; m++) {
78635                 int64_t val_conv_12 = val_vals[m];
78636                 LDKBlindedHop val_conv_12_conv;
78637                 val_conv_12_conv.inner = untag_ptr(val_conv_12);
78638                 val_conv_12_conv.is_owned = ptr_is_owned(val_conv_12);
78639                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_12_conv);
78640                 val_conv_12_conv = BlindedHop_clone(&val_conv_12_conv);
78641                 val_constr.data[m] = val_conv_12_conv;
78642         }
78643         FREE(val);
78644         BlindedPath_set_blinded_hops(&this_ptr_conv, val_constr);
78645 }
78646
78647 int64_t  CS_LDK_BlindedPath_new(int64_t introduction_node_arg, int8_tArray blinding_point_arg, int64_tArray blinded_hops_arg) {
78648         void* introduction_node_arg_ptr = untag_ptr(introduction_node_arg);
78649         CHECK_ACCESS(introduction_node_arg_ptr);
78650         LDKIntroductionNode introduction_node_arg_conv = *(LDKIntroductionNode*)(introduction_node_arg_ptr);
78651         introduction_node_arg_conv = IntroductionNode_clone((LDKIntroductionNode*)untag_ptr(introduction_node_arg));
78652         LDKPublicKey blinding_point_arg_ref;
78653         CHECK(blinding_point_arg->arr_len == 33);
78654         memcpy(blinding_point_arg_ref.compressed_form, blinding_point_arg->elems, 33); FREE(blinding_point_arg);
78655         LDKCVec_BlindedHopZ blinded_hops_arg_constr;
78656         blinded_hops_arg_constr.datalen = blinded_hops_arg->arr_len;
78657         if (blinded_hops_arg_constr.datalen > 0)
78658                 blinded_hops_arg_constr.data = MALLOC(blinded_hops_arg_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
78659         else
78660                 blinded_hops_arg_constr.data = NULL;
78661         int64_t* blinded_hops_arg_vals = blinded_hops_arg->elems;
78662         for (size_t m = 0; m < blinded_hops_arg_constr.datalen; m++) {
78663                 int64_t blinded_hops_arg_conv_12 = blinded_hops_arg_vals[m];
78664                 LDKBlindedHop blinded_hops_arg_conv_12_conv;
78665                 blinded_hops_arg_conv_12_conv.inner = untag_ptr(blinded_hops_arg_conv_12);
78666                 blinded_hops_arg_conv_12_conv.is_owned = ptr_is_owned(blinded_hops_arg_conv_12);
78667                 CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_hops_arg_conv_12_conv);
78668                 blinded_hops_arg_conv_12_conv = BlindedHop_clone(&blinded_hops_arg_conv_12_conv);
78669                 blinded_hops_arg_constr.data[m] = blinded_hops_arg_conv_12_conv;
78670         }
78671         FREE(blinded_hops_arg);
78672         LDKBlindedPath ret_var = BlindedPath_new(introduction_node_arg_conv, blinding_point_arg_ref, blinded_hops_arg_constr);
78673         int64_t ret_ref = 0;
78674         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78675         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78676         return ret_ref;
78677 }
78678
78679 static inline uint64_t BlindedPath_clone_ptr(LDKBlindedPath *NONNULL_PTR arg) {
78680         LDKBlindedPath ret_var = BlindedPath_clone(arg);
78681         int64_t ret_ref = 0;
78682         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78683         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78684         return ret_ref;
78685 }
78686 int64_t  CS_LDK_BlindedPath_clone_ptr(int64_t arg) {
78687         LDKBlindedPath arg_conv;
78688         arg_conv.inner = untag_ptr(arg);
78689         arg_conv.is_owned = ptr_is_owned(arg);
78690         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
78691         arg_conv.is_owned = false;
78692         int64_t ret_conv = BlindedPath_clone_ptr(&arg_conv);
78693         return ret_conv;
78694 }
78695
78696 int64_t  CS_LDK_BlindedPath_clone(int64_t orig) {
78697         LDKBlindedPath orig_conv;
78698         orig_conv.inner = untag_ptr(orig);
78699         orig_conv.is_owned = ptr_is_owned(orig);
78700         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
78701         orig_conv.is_owned = false;
78702         LDKBlindedPath ret_var = BlindedPath_clone(&orig_conv);
78703         int64_t ret_ref = 0;
78704         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78705         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78706         return ret_ref;
78707 }
78708
78709 int64_t  CS_LDK_BlindedPath_hash(int64_t o) {
78710         LDKBlindedPath o_conv;
78711         o_conv.inner = untag_ptr(o);
78712         o_conv.is_owned = ptr_is_owned(o);
78713         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
78714         o_conv.is_owned = false;
78715         int64_t ret_conv = BlindedPath_hash(&o_conv);
78716         return ret_conv;
78717 }
78718
78719 jboolean  CS_LDK_BlindedPath_eq(int64_t a, int64_t b) {
78720         LDKBlindedPath a_conv;
78721         a_conv.inner = untag_ptr(a);
78722         a_conv.is_owned = ptr_is_owned(a);
78723         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
78724         a_conv.is_owned = false;
78725         LDKBlindedPath b_conv;
78726         b_conv.inner = untag_ptr(b);
78727         b_conv.is_owned = ptr_is_owned(b);
78728         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
78729         b_conv.is_owned = false;
78730         jboolean ret_conv = BlindedPath_eq(&a_conv, &b_conv);
78731         return ret_conv;
78732 }
78733
78734 void  CS_LDK_IntroductionNode_free(int64_t this_ptr) {
78735         if (!ptr_is_owned(this_ptr)) return;
78736         void* this_ptr_ptr = untag_ptr(this_ptr);
78737         CHECK_ACCESS(this_ptr_ptr);
78738         LDKIntroductionNode this_ptr_conv = *(LDKIntroductionNode*)(this_ptr_ptr);
78739         FREE(untag_ptr(this_ptr));
78740         IntroductionNode_free(this_ptr_conv);
78741 }
78742
78743 static inline uint64_t IntroductionNode_clone_ptr(LDKIntroductionNode *NONNULL_PTR arg) {
78744         LDKIntroductionNode *ret_copy = MALLOC(sizeof(LDKIntroductionNode), "LDKIntroductionNode");
78745         *ret_copy = IntroductionNode_clone(arg);
78746         int64_t ret_ref = tag_ptr(ret_copy, true);
78747         return ret_ref;
78748 }
78749 int64_t  CS_LDK_IntroductionNode_clone_ptr(int64_t arg) {
78750         LDKIntroductionNode* arg_conv = (LDKIntroductionNode*)untag_ptr(arg);
78751         int64_t ret_conv = IntroductionNode_clone_ptr(arg_conv);
78752         return ret_conv;
78753 }
78754
78755 int64_t  CS_LDK_IntroductionNode_clone(int64_t orig) {
78756         LDKIntroductionNode* orig_conv = (LDKIntroductionNode*)untag_ptr(orig);
78757         LDKIntroductionNode *ret_copy = MALLOC(sizeof(LDKIntroductionNode), "LDKIntroductionNode");
78758         *ret_copy = IntroductionNode_clone(orig_conv);
78759         int64_t ret_ref = tag_ptr(ret_copy, true);
78760         return ret_ref;
78761 }
78762
78763 int64_t  CS_LDK_IntroductionNode_node_id(int8_tArray a) {
78764         LDKPublicKey a_ref;
78765         CHECK(a->arr_len == 33);
78766         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
78767         LDKIntroductionNode *ret_copy = MALLOC(sizeof(LDKIntroductionNode), "LDKIntroductionNode");
78768         *ret_copy = IntroductionNode_node_id(a_ref);
78769         int64_t ret_ref = tag_ptr(ret_copy, true);
78770         return ret_ref;
78771 }
78772
78773 int64_t  CS_LDK_IntroductionNode_directed_short_channel_id(int32_t a, int64_t b) {
78774         LDKDirection a_conv = LDKDirection_from_cs(a);
78775         LDKIntroductionNode *ret_copy = MALLOC(sizeof(LDKIntroductionNode), "LDKIntroductionNode");
78776         *ret_copy = IntroductionNode_directed_short_channel_id(a_conv, b);
78777         int64_t ret_ref = tag_ptr(ret_copy, true);
78778         return ret_ref;
78779 }
78780
78781 int64_t  CS_LDK_IntroductionNode_hash(int64_t o) {
78782         LDKIntroductionNode* o_conv = (LDKIntroductionNode*)untag_ptr(o);
78783         int64_t ret_conv = IntroductionNode_hash(o_conv);
78784         return ret_conv;
78785 }
78786
78787 jboolean  CS_LDK_IntroductionNode_eq(int64_t a, int64_t b) {
78788         LDKIntroductionNode* a_conv = (LDKIntroductionNode*)untag_ptr(a);
78789         LDKIntroductionNode* b_conv = (LDKIntroductionNode*)untag_ptr(b);
78790         jboolean ret_conv = IntroductionNode_eq(a_conv, b_conv);
78791         return ret_conv;
78792 }
78793
78794 int32_t  CS_LDK_Direction_clone(int64_t orig) {
78795         LDKDirection* orig_conv = (LDKDirection*)untag_ptr(orig);
78796         int32_t ret_conv = LDKDirection_to_cs(Direction_clone(orig_conv));
78797         return ret_conv;
78798 }
78799
78800 int32_t  CS_LDK_Direction_node_one() {
78801         int32_t ret_conv = LDKDirection_to_cs(Direction_node_one());
78802         return ret_conv;
78803 }
78804
78805 int32_t  CS_LDK_Direction_node_two() {
78806         int32_t ret_conv = LDKDirection_to_cs(Direction_node_two());
78807         return ret_conv;
78808 }
78809
78810 int64_t  CS_LDK_Direction_hash(int64_t o) {
78811         LDKDirection* o_conv = (LDKDirection*)untag_ptr(o);
78812         int64_t ret_conv = Direction_hash(o_conv);
78813         return ret_conv;
78814 }
78815
78816 jboolean  CS_LDK_Direction_eq(int64_t a, int64_t b) {
78817         LDKDirection* a_conv = (LDKDirection*)untag_ptr(a);
78818         LDKDirection* b_conv = (LDKDirection*)untag_ptr(b);
78819         jboolean ret_conv = Direction_eq(a_conv, b_conv);
78820         return ret_conv;
78821 }
78822
78823 void  CS_LDK_NodeIdLookUp_free(int64_t this_ptr) {
78824         if (!ptr_is_owned(this_ptr)) return;
78825         void* this_ptr_ptr = untag_ptr(this_ptr);
78826         CHECK_ACCESS(this_ptr_ptr);
78827         LDKNodeIdLookUp this_ptr_conv = *(LDKNodeIdLookUp*)(this_ptr_ptr);
78828         FREE(untag_ptr(this_ptr));
78829         NodeIdLookUp_free(this_ptr_conv);
78830 }
78831
78832 void  CS_LDK_EmptyNodeIdLookUp_free(int64_t this_obj) {
78833         LDKEmptyNodeIdLookUp this_obj_conv;
78834         this_obj_conv.inner = untag_ptr(this_obj);
78835         this_obj_conv.is_owned = ptr_is_owned(this_obj);
78836         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
78837         EmptyNodeIdLookUp_free(this_obj_conv);
78838 }
78839
78840 int64_t  CS_LDK_EmptyNodeIdLookUp_new() {
78841         LDKEmptyNodeIdLookUp ret_var = EmptyNodeIdLookUp_new();
78842         int64_t ret_ref = 0;
78843         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78844         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78845         return ret_ref;
78846 }
78847
78848 int64_t  CS_LDK_EmptyNodeIdLookUp_as_NodeIdLookUp(int64_t this_arg) {
78849         LDKEmptyNodeIdLookUp this_arg_conv;
78850         this_arg_conv.inner = untag_ptr(this_arg);
78851         this_arg_conv.is_owned = ptr_is_owned(this_arg);
78852         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
78853         this_arg_conv.is_owned = false;
78854         LDKNodeIdLookUp* ret_ret = MALLOC(sizeof(LDKNodeIdLookUp), "LDKNodeIdLookUp");
78855         *ret_ret = EmptyNodeIdLookUp_as_NodeIdLookUp(&this_arg_conv);
78856         return tag_ptr(ret_ret, true);
78857 }
78858
78859 void  CS_LDK_BlindedHop_free(int64_t this_obj) {
78860         LDKBlindedHop this_obj_conv;
78861         this_obj_conv.inner = untag_ptr(this_obj);
78862         this_obj_conv.is_owned = ptr_is_owned(this_obj);
78863         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
78864         BlindedHop_free(this_obj_conv);
78865 }
78866
78867 int8_tArray  CS_LDK_BlindedHop_get_blinded_node_id(int64_t this_ptr) {
78868         LDKBlindedHop this_ptr_conv;
78869         this_ptr_conv.inner = untag_ptr(this_ptr);
78870         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78871         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78872         this_ptr_conv.is_owned = false;
78873         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
78874         memcpy(ret_arr->elems, BlindedHop_get_blinded_node_id(&this_ptr_conv).compressed_form, 33);
78875         return ret_arr;
78876 }
78877
78878 void  CS_LDK_BlindedHop_set_blinded_node_id(int64_t this_ptr, int8_tArray val) {
78879         LDKBlindedHop this_ptr_conv;
78880         this_ptr_conv.inner = untag_ptr(this_ptr);
78881         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78882         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78883         this_ptr_conv.is_owned = false;
78884         LDKPublicKey val_ref;
78885         CHECK(val->arr_len == 33);
78886         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
78887         BlindedHop_set_blinded_node_id(&this_ptr_conv, val_ref);
78888 }
78889
78890 int8_tArray  CS_LDK_BlindedHop_get_encrypted_payload(int64_t this_ptr) {
78891         LDKBlindedHop this_ptr_conv;
78892         this_ptr_conv.inner = untag_ptr(this_ptr);
78893         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78894         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78895         this_ptr_conv.is_owned = false;
78896         LDKCVec_u8Z ret_var = BlindedHop_get_encrypted_payload(&this_ptr_conv);
78897         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
78898         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
78899         CVec_u8Z_free(ret_var);
78900         return ret_arr;
78901 }
78902
78903 void  CS_LDK_BlindedHop_set_encrypted_payload(int64_t this_ptr, int8_tArray val) {
78904         LDKBlindedHop this_ptr_conv;
78905         this_ptr_conv.inner = untag_ptr(this_ptr);
78906         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78907         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78908         this_ptr_conv.is_owned = false;
78909         LDKCVec_u8Z val_ref;
78910         val_ref.datalen = val->arr_len;
78911         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
78912         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
78913         BlindedHop_set_encrypted_payload(&this_ptr_conv, val_ref);
78914 }
78915
78916 int64_t  CS_LDK_BlindedHop_new(int8_tArray blinded_node_id_arg, int8_tArray encrypted_payload_arg) {
78917         LDKPublicKey blinded_node_id_arg_ref;
78918         CHECK(blinded_node_id_arg->arr_len == 33);
78919         memcpy(blinded_node_id_arg_ref.compressed_form, blinded_node_id_arg->elems, 33); FREE(blinded_node_id_arg);
78920         LDKCVec_u8Z encrypted_payload_arg_ref;
78921         encrypted_payload_arg_ref.datalen = encrypted_payload_arg->arr_len;
78922         encrypted_payload_arg_ref.data = MALLOC(encrypted_payload_arg_ref.datalen, "LDKCVec_u8Z Bytes");
78923         memcpy(encrypted_payload_arg_ref.data, encrypted_payload_arg->elems, encrypted_payload_arg_ref.datalen); FREE(encrypted_payload_arg);
78924         LDKBlindedHop ret_var = BlindedHop_new(blinded_node_id_arg_ref, encrypted_payload_arg_ref);
78925         int64_t ret_ref = 0;
78926         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78927         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78928         return ret_ref;
78929 }
78930
78931 static inline uint64_t BlindedHop_clone_ptr(LDKBlindedHop *NONNULL_PTR arg) {
78932         LDKBlindedHop ret_var = BlindedHop_clone(arg);
78933         int64_t ret_ref = 0;
78934         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78935         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78936         return ret_ref;
78937 }
78938 int64_t  CS_LDK_BlindedHop_clone_ptr(int64_t arg) {
78939         LDKBlindedHop arg_conv;
78940         arg_conv.inner = untag_ptr(arg);
78941         arg_conv.is_owned = ptr_is_owned(arg);
78942         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
78943         arg_conv.is_owned = false;
78944         int64_t ret_conv = BlindedHop_clone_ptr(&arg_conv);
78945         return ret_conv;
78946 }
78947
78948 int64_t  CS_LDK_BlindedHop_clone(int64_t orig) {
78949         LDKBlindedHop orig_conv;
78950         orig_conv.inner = untag_ptr(orig);
78951         orig_conv.is_owned = ptr_is_owned(orig);
78952         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
78953         orig_conv.is_owned = false;
78954         LDKBlindedHop ret_var = BlindedHop_clone(&orig_conv);
78955         int64_t ret_ref = 0;
78956         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78957         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78958         return ret_ref;
78959 }
78960
78961 int64_t  CS_LDK_BlindedHop_hash(int64_t o) {
78962         LDKBlindedHop o_conv;
78963         o_conv.inner = untag_ptr(o);
78964         o_conv.is_owned = ptr_is_owned(o);
78965         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
78966         o_conv.is_owned = false;
78967         int64_t ret_conv = BlindedHop_hash(&o_conv);
78968         return ret_conv;
78969 }
78970
78971 jboolean  CS_LDK_BlindedHop_eq(int64_t a, int64_t b) {
78972         LDKBlindedHop a_conv;
78973         a_conv.inner = untag_ptr(a);
78974         a_conv.is_owned = ptr_is_owned(a);
78975         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
78976         a_conv.is_owned = false;
78977         LDKBlindedHop b_conv;
78978         b_conv.inner = untag_ptr(b);
78979         b_conv.is_owned = ptr_is_owned(b);
78980         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
78981         b_conv.is_owned = false;
78982         jboolean ret_conv = BlindedHop_eq(&a_conv, &b_conv);
78983         return ret_conv;
78984 }
78985
78986 int64_t  CS_LDK_BlindedPath_one_hop_for_message(int8_tArray recipient_node_id, int64_t entropy_source) {
78987         LDKPublicKey recipient_node_id_ref;
78988         CHECK(recipient_node_id->arr_len == 33);
78989         memcpy(recipient_node_id_ref.compressed_form, recipient_node_id->elems, 33); FREE(recipient_node_id);
78990         void* entropy_source_ptr = untag_ptr(entropy_source);
78991         CHECK_ACCESS(entropy_source_ptr);
78992         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
78993         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
78994                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
78995                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
78996         }
78997         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
78998         *ret_conv = BlindedPath_one_hop_for_message(recipient_node_id_ref, entropy_source_conv);
78999         return tag_ptr(ret_conv, true);
79000 }
79001
79002 int64_t  CS_LDK_BlindedPath_new_for_message(ptrArray node_pks, int64_t entropy_source) {
79003         LDKCVec_PublicKeyZ node_pks_constr;
79004         node_pks_constr.datalen = node_pks->arr_len;
79005         if (node_pks_constr.datalen > 0)
79006                 node_pks_constr.data = MALLOC(node_pks_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
79007         else
79008                 node_pks_constr.data = NULL;
79009         int8_tArray* node_pks_vals = (void*) node_pks->elems;
79010         for (size_t i = 0; i < node_pks_constr.datalen; i++) {
79011                 int8_tArray node_pks_conv_8 = node_pks_vals[i];
79012                 LDKPublicKey node_pks_conv_8_ref;
79013                 CHECK(node_pks_conv_8->arr_len == 33);
79014                 memcpy(node_pks_conv_8_ref.compressed_form, node_pks_conv_8->elems, 33); FREE(node_pks_conv_8);
79015                 node_pks_constr.data[i] = node_pks_conv_8_ref;
79016         }
79017         FREE(node_pks);
79018         void* entropy_source_ptr = untag_ptr(entropy_source);
79019         CHECK_ACCESS(entropy_source_ptr);
79020         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
79021         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
79022                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
79023                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
79024         }
79025         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
79026         *ret_conv = BlindedPath_new_for_message(node_pks_constr, entropy_source_conv);
79027         return tag_ptr(ret_conv, true);
79028 }
79029
79030 int64_t  CS_LDK_BlindedPath_one_hop_for_payment(int8_tArray payee_node_id, int64_t payee_tlvs, int16_t min_final_cltv_expiry_delta, int64_t entropy_source) {
79031         LDKPublicKey payee_node_id_ref;
79032         CHECK(payee_node_id->arr_len == 33);
79033         memcpy(payee_node_id_ref.compressed_form, payee_node_id->elems, 33); FREE(payee_node_id);
79034         LDKReceiveTlvs payee_tlvs_conv;
79035         payee_tlvs_conv.inner = untag_ptr(payee_tlvs);
79036         payee_tlvs_conv.is_owned = ptr_is_owned(payee_tlvs);
79037         CHECK_INNER_FIELD_ACCESS_OR_NULL(payee_tlvs_conv);
79038         payee_tlvs_conv = ReceiveTlvs_clone(&payee_tlvs_conv);
79039         void* entropy_source_ptr = untag_ptr(entropy_source);
79040         CHECK_ACCESS(entropy_source_ptr);
79041         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
79042         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
79043                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
79044                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
79045         }
79046         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
79047         *ret_conv = BlindedPath_one_hop_for_payment(payee_node_id_ref, payee_tlvs_conv, min_final_cltv_expiry_delta, entropy_source_conv);
79048         return tag_ptr(ret_conv, true);
79049 }
79050
79051 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, int16_t min_final_cltv_expiry_delta, int64_t entropy_source) {
79052         LDKCVec_ForwardNodeZ intermediate_nodes_constr;
79053         intermediate_nodes_constr.datalen = intermediate_nodes->arr_len;
79054         if (intermediate_nodes_constr.datalen > 0)
79055                 intermediate_nodes_constr.data = MALLOC(intermediate_nodes_constr.datalen * sizeof(LDKForwardNode), "LDKCVec_ForwardNodeZ Elements");
79056         else
79057                 intermediate_nodes_constr.data = NULL;
79058         int64_t* intermediate_nodes_vals = intermediate_nodes->elems;
79059         for (size_t n = 0; n < intermediate_nodes_constr.datalen; n++) {
79060                 int64_t intermediate_nodes_conv_13 = intermediate_nodes_vals[n];
79061                 LDKForwardNode intermediate_nodes_conv_13_conv;
79062                 intermediate_nodes_conv_13_conv.inner = untag_ptr(intermediate_nodes_conv_13);
79063                 intermediate_nodes_conv_13_conv.is_owned = ptr_is_owned(intermediate_nodes_conv_13);
79064                 CHECK_INNER_FIELD_ACCESS_OR_NULL(intermediate_nodes_conv_13_conv);
79065                 intermediate_nodes_conv_13_conv = ForwardNode_clone(&intermediate_nodes_conv_13_conv);
79066                 intermediate_nodes_constr.data[n] = intermediate_nodes_conv_13_conv;
79067         }
79068         FREE(intermediate_nodes);
79069         LDKPublicKey payee_node_id_ref;
79070         CHECK(payee_node_id->arr_len == 33);
79071         memcpy(payee_node_id_ref.compressed_form, payee_node_id->elems, 33); FREE(payee_node_id);
79072         LDKReceiveTlvs payee_tlvs_conv;
79073         payee_tlvs_conv.inner = untag_ptr(payee_tlvs);
79074         payee_tlvs_conv.is_owned = ptr_is_owned(payee_tlvs);
79075         CHECK_INNER_FIELD_ACCESS_OR_NULL(payee_tlvs_conv);
79076         payee_tlvs_conv = ReceiveTlvs_clone(&payee_tlvs_conv);
79077         void* entropy_source_ptr = untag_ptr(entropy_source);
79078         CHECK_ACCESS(entropy_source_ptr);
79079         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
79080         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
79081                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
79082                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
79083         }
79084         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
79085         *ret_conv = BlindedPath_new_for_payment(intermediate_nodes_constr, payee_node_id_ref, payee_tlvs_conv, htlc_maximum_msat, min_final_cltv_expiry_delta, entropy_source_conv);
79086         return tag_ptr(ret_conv, true);
79087 }
79088
79089 int64_t  CS_LDK_BlindedPath_public_introduction_node_id(int64_t this_arg, int64_t network_graph) {
79090         LDKBlindedPath this_arg_conv;
79091         this_arg_conv.inner = untag_ptr(this_arg);
79092         this_arg_conv.is_owned = ptr_is_owned(this_arg);
79093         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
79094         this_arg_conv.is_owned = false;
79095         LDKReadOnlyNetworkGraph network_graph_conv;
79096         network_graph_conv.inner = untag_ptr(network_graph);
79097         network_graph_conv.is_owned = ptr_is_owned(network_graph);
79098         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
79099         network_graph_conv.is_owned = false;
79100         LDKNodeId ret_var = BlindedPath_public_introduction_node_id(&this_arg_conv, &network_graph_conv);
79101         int64_t ret_ref = 0;
79102         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79103         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79104         return ret_ref;
79105 }
79106
79107 int8_tArray  CS_LDK_BlindedPath_write(int64_t obj) {
79108         LDKBlindedPath obj_conv;
79109         obj_conv.inner = untag_ptr(obj);
79110         obj_conv.is_owned = ptr_is_owned(obj);
79111         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
79112         obj_conv.is_owned = false;
79113         LDKCVec_u8Z ret_var = BlindedPath_write(&obj_conv);
79114         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
79115         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
79116         CVec_u8Z_free(ret_var);
79117         return ret_arr;
79118 }
79119
79120 int64_t  CS_LDK_BlindedPath_read(int8_tArray ser) {
79121         LDKu8slice ser_ref;
79122         ser_ref.datalen = ser->arr_len;
79123         ser_ref.data = ser->elems;
79124         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
79125         *ret_conv = BlindedPath_read(ser_ref);
79126         FREE(ser);
79127         return tag_ptr(ret_conv, true);
79128 }
79129
79130 int8_tArray  CS_LDK_BlindedHop_write(int64_t obj) {
79131         LDKBlindedHop obj_conv;
79132         obj_conv.inner = untag_ptr(obj);
79133         obj_conv.is_owned = ptr_is_owned(obj);
79134         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
79135         obj_conv.is_owned = false;
79136         LDKCVec_u8Z ret_var = BlindedHop_write(&obj_conv);
79137         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
79138         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
79139         CVec_u8Z_free(ret_var);
79140         return ret_arr;
79141 }
79142
79143 int64_t  CS_LDK_BlindedHop_read(int8_tArray ser) {
79144         LDKu8slice ser_ref;
79145         ser_ref.datalen = ser->arr_len;
79146         ser_ref.data = ser->elems;
79147         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
79148         *ret_conv = BlindedHop_read(ser_ref);
79149         FREE(ser);
79150         return tag_ptr(ret_conv, true);
79151 }
79152
79153 void  CS_LDK_ForwardNode_free(int64_t this_obj) {
79154         LDKForwardNode this_obj_conv;
79155         this_obj_conv.inner = untag_ptr(this_obj);
79156         this_obj_conv.is_owned = ptr_is_owned(this_obj);
79157         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
79158         ForwardNode_free(this_obj_conv);
79159 }
79160
79161 int64_t  CS_LDK_ForwardNode_get_tlvs(int64_t this_ptr) {
79162         LDKForwardNode this_ptr_conv;
79163         this_ptr_conv.inner = untag_ptr(this_ptr);
79164         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79165         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79166         this_ptr_conv.is_owned = false;
79167         LDKForwardTlvs ret_var = ForwardNode_get_tlvs(&this_ptr_conv);
79168         int64_t ret_ref = 0;
79169         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79170         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79171         return ret_ref;
79172 }
79173
79174 void  CS_LDK_ForwardNode_set_tlvs(int64_t this_ptr, int64_t val) {
79175         LDKForwardNode this_ptr_conv;
79176         this_ptr_conv.inner = untag_ptr(this_ptr);
79177         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79178         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79179         this_ptr_conv.is_owned = false;
79180         LDKForwardTlvs val_conv;
79181         val_conv.inner = untag_ptr(val);
79182         val_conv.is_owned = ptr_is_owned(val);
79183         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
79184         val_conv = ForwardTlvs_clone(&val_conv);
79185         ForwardNode_set_tlvs(&this_ptr_conv, val_conv);
79186 }
79187
79188 int8_tArray  CS_LDK_ForwardNode_get_node_id(int64_t this_ptr) {
79189         LDKForwardNode this_ptr_conv;
79190         this_ptr_conv.inner = untag_ptr(this_ptr);
79191         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79192         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79193         this_ptr_conv.is_owned = false;
79194         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
79195         memcpy(ret_arr->elems, ForwardNode_get_node_id(&this_ptr_conv).compressed_form, 33);
79196         return ret_arr;
79197 }
79198
79199 void  CS_LDK_ForwardNode_set_node_id(int64_t this_ptr, int8_tArray val) {
79200         LDKForwardNode this_ptr_conv;
79201         this_ptr_conv.inner = untag_ptr(this_ptr);
79202         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79203         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79204         this_ptr_conv.is_owned = false;
79205         LDKPublicKey val_ref;
79206         CHECK(val->arr_len == 33);
79207         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
79208         ForwardNode_set_node_id(&this_ptr_conv, val_ref);
79209 }
79210
79211 int64_t  CS_LDK_ForwardNode_get_htlc_maximum_msat(int64_t this_ptr) {
79212         LDKForwardNode this_ptr_conv;
79213         this_ptr_conv.inner = untag_ptr(this_ptr);
79214         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79215         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79216         this_ptr_conv.is_owned = false;
79217         int64_t ret_conv = ForwardNode_get_htlc_maximum_msat(&this_ptr_conv);
79218         return ret_conv;
79219 }
79220
79221 void  CS_LDK_ForwardNode_set_htlc_maximum_msat(int64_t this_ptr, int64_t val) {
79222         LDKForwardNode this_ptr_conv;
79223         this_ptr_conv.inner = untag_ptr(this_ptr);
79224         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79225         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79226         this_ptr_conv.is_owned = false;
79227         ForwardNode_set_htlc_maximum_msat(&this_ptr_conv, val);
79228 }
79229
79230 int64_t  CS_LDK_ForwardNode_new(int64_t tlvs_arg, int8_tArray node_id_arg, int64_t htlc_maximum_msat_arg) {
79231         LDKForwardTlvs tlvs_arg_conv;
79232         tlvs_arg_conv.inner = untag_ptr(tlvs_arg);
79233         tlvs_arg_conv.is_owned = ptr_is_owned(tlvs_arg);
79234         CHECK_INNER_FIELD_ACCESS_OR_NULL(tlvs_arg_conv);
79235         tlvs_arg_conv = ForwardTlvs_clone(&tlvs_arg_conv);
79236         LDKPublicKey node_id_arg_ref;
79237         CHECK(node_id_arg->arr_len == 33);
79238         memcpy(node_id_arg_ref.compressed_form, node_id_arg->elems, 33); FREE(node_id_arg);
79239         LDKForwardNode ret_var = ForwardNode_new(tlvs_arg_conv, node_id_arg_ref, htlc_maximum_msat_arg);
79240         int64_t ret_ref = 0;
79241         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79242         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79243         return ret_ref;
79244 }
79245
79246 static inline uint64_t ForwardNode_clone_ptr(LDKForwardNode *NONNULL_PTR arg) {
79247         LDKForwardNode ret_var = ForwardNode_clone(arg);
79248         int64_t ret_ref = 0;
79249         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79250         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79251         return ret_ref;
79252 }
79253 int64_t  CS_LDK_ForwardNode_clone_ptr(int64_t arg) {
79254         LDKForwardNode arg_conv;
79255         arg_conv.inner = untag_ptr(arg);
79256         arg_conv.is_owned = ptr_is_owned(arg);
79257         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
79258         arg_conv.is_owned = false;
79259         int64_t ret_conv = ForwardNode_clone_ptr(&arg_conv);
79260         return ret_conv;
79261 }
79262
79263 int64_t  CS_LDK_ForwardNode_clone(int64_t orig) {
79264         LDKForwardNode orig_conv;
79265         orig_conv.inner = untag_ptr(orig);
79266         orig_conv.is_owned = ptr_is_owned(orig);
79267         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
79268         orig_conv.is_owned = false;
79269         LDKForwardNode ret_var = ForwardNode_clone(&orig_conv);
79270         int64_t ret_ref = 0;
79271         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79272         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79273         return ret_ref;
79274 }
79275
79276 void  CS_LDK_ForwardTlvs_free(int64_t this_obj) {
79277         LDKForwardTlvs this_obj_conv;
79278         this_obj_conv.inner = untag_ptr(this_obj);
79279         this_obj_conv.is_owned = ptr_is_owned(this_obj);
79280         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
79281         ForwardTlvs_free(this_obj_conv);
79282 }
79283
79284 int64_t  CS_LDK_ForwardTlvs_get_short_channel_id(int64_t this_ptr) {
79285         LDKForwardTlvs this_ptr_conv;
79286         this_ptr_conv.inner = untag_ptr(this_ptr);
79287         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79288         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79289         this_ptr_conv.is_owned = false;
79290         int64_t ret_conv = ForwardTlvs_get_short_channel_id(&this_ptr_conv);
79291         return ret_conv;
79292 }
79293
79294 void  CS_LDK_ForwardTlvs_set_short_channel_id(int64_t this_ptr, int64_t val) {
79295         LDKForwardTlvs this_ptr_conv;
79296         this_ptr_conv.inner = untag_ptr(this_ptr);
79297         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79298         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79299         this_ptr_conv.is_owned = false;
79300         ForwardTlvs_set_short_channel_id(&this_ptr_conv, val);
79301 }
79302
79303 int64_t  CS_LDK_ForwardTlvs_get_payment_relay(int64_t this_ptr) {
79304         LDKForwardTlvs this_ptr_conv;
79305         this_ptr_conv.inner = untag_ptr(this_ptr);
79306         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79307         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79308         this_ptr_conv.is_owned = false;
79309         LDKPaymentRelay ret_var = ForwardTlvs_get_payment_relay(&this_ptr_conv);
79310         int64_t ret_ref = 0;
79311         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79312         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79313         return ret_ref;
79314 }
79315
79316 void  CS_LDK_ForwardTlvs_set_payment_relay(int64_t this_ptr, int64_t val) {
79317         LDKForwardTlvs this_ptr_conv;
79318         this_ptr_conv.inner = untag_ptr(this_ptr);
79319         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79320         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79321         this_ptr_conv.is_owned = false;
79322         LDKPaymentRelay val_conv;
79323         val_conv.inner = untag_ptr(val);
79324         val_conv.is_owned = ptr_is_owned(val);
79325         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
79326         val_conv = PaymentRelay_clone(&val_conv);
79327         ForwardTlvs_set_payment_relay(&this_ptr_conv, val_conv);
79328 }
79329
79330 int64_t  CS_LDK_ForwardTlvs_get_payment_constraints(int64_t this_ptr) {
79331         LDKForwardTlvs this_ptr_conv;
79332         this_ptr_conv.inner = untag_ptr(this_ptr);
79333         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79334         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79335         this_ptr_conv.is_owned = false;
79336         LDKPaymentConstraints ret_var = ForwardTlvs_get_payment_constraints(&this_ptr_conv);
79337         int64_t ret_ref = 0;
79338         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79339         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79340         return ret_ref;
79341 }
79342
79343 void  CS_LDK_ForwardTlvs_set_payment_constraints(int64_t this_ptr, int64_t val) {
79344         LDKForwardTlvs this_ptr_conv;
79345         this_ptr_conv.inner = untag_ptr(this_ptr);
79346         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79347         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79348         this_ptr_conv.is_owned = false;
79349         LDKPaymentConstraints val_conv;
79350         val_conv.inner = untag_ptr(val);
79351         val_conv.is_owned = ptr_is_owned(val);
79352         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
79353         val_conv = PaymentConstraints_clone(&val_conv);
79354         ForwardTlvs_set_payment_constraints(&this_ptr_conv, val_conv);
79355 }
79356
79357 int64_t  CS_LDK_ForwardTlvs_get_features(int64_t this_ptr) {
79358         LDKForwardTlvs this_ptr_conv;
79359         this_ptr_conv.inner = untag_ptr(this_ptr);
79360         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79361         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79362         this_ptr_conv.is_owned = false;
79363         LDKBlindedHopFeatures ret_var = ForwardTlvs_get_features(&this_ptr_conv);
79364         int64_t ret_ref = 0;
79365         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79366         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79367         return ret_ref;
79368 }
79369
79370 void  CS_LDK_ForwardTlvs_set_features(int64_t this_ptr, int64_t val) {
79371         LDKForwardTlvs this_ptr_conv;
79372         this_ptr_conv.inner = untag_ptr(this_ptr);
79373         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79374         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79375         this_ptr_conv.is_owned = false;
79376         LDKBlindedHopFeatures val_conv;
79377         val_conv.inner = untag_ptr(val);
79378         val_conv.is_owned = ptr_is_owned(val);
79379         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
79380         val_conv = BlindedHopFeatures_clone(&val_conv);
79381         ForwardTlvs_set_features(&this_ptr_conv, val_conv);
79382 }
79383
79384 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) {
79385         LDKPaymentRelay payment_relay_arg_conv;
79386         payment_relay_arg_conv.inner = untag_ptr(payment_relay_arg);
79387         payment_relay_arg_conv.is_owned = ptr_is_owned(payment_relay_arg);
79388         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_relay_arg_conv);
79389         payment_relay_arg_conv = PaymentRelay_clone(&payment_relay_arg_conv);
79390         LDKPaymentConstraints payment_constraints_arg_conv;
79391         payment_constraints_arg_conv.inner = untag_ptr(payment_constraints_arg);
79392         payment_constraints_arg_conv.is_owned = ptr_is_owned(payment_constraints_arg);
79393         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_constraints_arg_conv);
79394         payment_constraints_arg_conv = PaymentConstraints_clone(&payment_constraints_arg_conv);
79395         LDKBlindedHopFeatures features_arg_conv;
79396         features_arg_conv.inner = untag_ptr(features_arg);
79397         features_arg_conv.is_owned = ptr_is_owned(features_arg);
79398         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
79399         features_arg_conv = BlindedHopFeatures_clone(&features_arg_conv);
79400         LDKForwardTlvs ret_var = ForwardTlvs_new(short_channel_id_arg, payment_relay_arg_conv, payment_constraints_arg_conv, features_arg_conv);
79401         int64_t ret_ref = 0;
79402         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79403         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79404         return ret_ref;
79405 }
79406
79407 static inline uint64_t ForwardTlvs_clone_ptr(LDKForwardTlvs *NONNULL_PTR arg) {
79408         LDKForwardTlvs ret_var = ForwardTlvs_clone(arg);
79409         int64_t ret_ref = 0;
79410         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79411         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79412         return ret_ref;
79413 }
79414 int64_t  CS_LDK_ForwardTlvs_clone_ptr(int64_t arg) {
79415         LDKForwardTlvs arg_conv;
79416         arg_conv.inner = untag_ptr(arg);
79417         arg_conv.is_owned = ptr_is_owned(arg);
79418         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
79419         arg_conv.is_owned = false;
79420         int64_t ret_conv = ForwardTlvs_clone_ptr(&arg_conv);
79421         return ret_conv;
79422 }
79423
79424 int64_t  CS_LDK_ForwardTlvs_clone(int64_t orig) {
79425         LDKForwardTlvs orig_conv;
79426         orig_conv.inner = untag_ptr(orig);
79427         orig_conv.is_owned = ptr_is_owned(orig);
79428         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
79429         orig_conv.is_owned = false;
79430         LDKForwardTlvs ret_var = ForwardTlvs_clone(&orig_conv);
79431         int64_t ret_ref = 0;
79432         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79433         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79434         return ret_ref;
79435 }
79436
79437 void  CS_LDK_ReceiveTlvs_free(int64_t this_obj) {
79438         LDKReceiveTlvs this_obj_conv;
79439         this_obj_conv.inner = untag_ptr(this_obj);
79440         this_obj_conv.is_owned = ptr_is_owned(this_obj);
79441         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
79442         ReceiveTlvs_free(this_obj_conv);
79443 }
79444
79445 int8_tArray  CS_LDK_ReceiveTlvs_get_payment_secret(int64_t this_ptr) {
79446         LDKReceiveTlvs this_ptr_conv;
79447         this_ptr_conv.inner = untag_ptr(this_ptr);
79448         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79449         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79450         this_ptr_conv.is_owned = false;
79451         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
79452         memcpy(ret_arr->elems, *ReceiveTlvs_get_payment_secret(&this_ptr_conv), 32);
79453         return ret_arr;
79454 }
79455
79456 void  CS_LDK_ReceiveTlvs_set_payment_secret(int64_t this_ptr, int8_tArray val) {
79457         LDKReceiveTlvs this_ptr_conv;
79458         this_ptr_conv.inner = untag_ptr(this_ptr);
79459         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79460         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79461         this_ptr_conv.is_owned = false;
79462         LDKThirtyTwoBytes val_ref;
79463         CHECK(val->arr_len == 32);
79464         memcpy(val_ref.data, val->elems, 32); FREE(val);
79465         ReceiveTlvs_set_payment_secret(&this_ptr_conv, val_ref);
79466 }
79467
79468 int64_t  CS_LDK_ReceiveTlvs_get_payment_constraints(int64_t this_ptr) {
79469         LDKReceiveTlvs this_ptr_conv;
79470         this_ptr_conv.inner = untag_ptr(this_ptr);
79471         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79472         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79473         this_ptr_conv.is_owned = false;
79474         LDKPaymentConstraints ret_var = ReceiveTlvs_get_payment_constraints(&this_ptr_conv);
79475         int64_t ret_ref = 0;
79476         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79477         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79478         return ret_ref;
79479 }
79480
79481 void  CS_LDK_ReceiveTlvs_set_payment_constraints(int64_t this_ptr, int64_t val) {
79482         LDKReceiveTlvs this_ptr_conv;
79483         this_ptr_conv.inner = untag_ptr(this_ptr);
79484         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79485         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79486         this_ptr_conv.is_owned = false;
79487         LDKPaymentConstraints val_conv;
79488         val_conv.inner = untag_ptr(val);
79489         val_conv.is_owned = ptr_is_owned(val);
79490         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
79491         val_conv = PaymentConstraints_clone(&val_conv);
79492         ReceiveTlvs_set_payment_constraints(&this_ptr_conv, val_conv);
79493 }
79494
79495 int64_t  CS_LDK_ReceiveTlvs_get_payment_context(int64_t this_ptr) {
79496         LDKReceiveTlvs this_ptr_conv;
79497         this_ptr_conv.inner = untag_ptr(this_ptr);
79498         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79499         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79500         this_ptr_conv.is_owned = false;
79501         LDKPaymentContext *ret_copy = MALLOC(sizeof(LDKPaymentContext), "LDKPaymentContext");
79502         *ret_copy = ReceiveTlvs_get_payment_context(&this_ptr_conv);
79503         int64_t ret_ref = tag_ptr(ret_copy, true);
79504         return ret_ref;
79505 }
79506
79507 void  CS_LDK_ReceiveTlvs_set_payment_context(int64_t this_ptr, int64_t val) {
79508         LDKReceiveTlvs this_ptr_conv;
79509         this_ptr_conv.inner = untag_ptr(this_ptr);
79510         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79511         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79512         this_ptr_conv.is_owned = false;
79513         void* val_ptr = untag_ptr(val);
79514         CHECK_ACCESS(val_ptr);
79515         LDKPaymentContext val_conv = *(LDKPaymentContext*)(val_ptr);
79516         val_conv = PaymentContext_clone((LDKPaymentContext*)untag_ptr(val));
79517         ReceiveTlvs_set_payment_context(&this_ptr_conv, val_conv);
79518 }
79519
79520 int64_t  CS_LDK_ReceiveTlvs_new(int8_tArray payment_secret_arg, int64_t payment_constraints_arg, int64_t payment_context_arg) {
79521         LDKThirtyTwoBytes payment_secret_arg_ref;
79522         CHECK(payment_secret_arg->arr_len == 32);
79523         memcpy(payment_secret_arg_ref.data, payment_secret_arg->elems, 32); FREE(payment_secret_arg);
79524         LDKPaymentConstraints payment_constraints_arg_conv;
79525         payment_constraints_arg_conv.inner = untag_ptr(payment_constraints_arg);
79526         payment_constraints_arg_conv.is_owned = ptr_is_owned(payment_constraints_arg);
79527         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_constraints_arg_conv);
79528         payment_constraints_arg_conv = PaymentConstraints_clone(&payment_constraints_arg_conv);
79529         void* payment_context_arg_ptr = untag_ptr(payment_context_arg);
79530         CHECK_ACCESS(payment_context_arg_ptr);
79531         LDKPaymentContext payment_context_arg_conv = *(LDKPaymentContext*)(payment_context_arg_ptr);
79532         payment_context_arg_conv = PaymentContext_clone((LDKPaymentContext*)untag_ptr(payment_context_arg));
79533         LDKReceiveTlvs ret_var = ReceiveTlvs_new(payment_secret_arg_ref, payment_constraints_arg_conv, payment_context_arg_conv);
79534         int64_t ret_ref = 0;
79535         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79536         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79537         return ret_ref;
79538 }
79539
79540 static inline uint64_t ReceiveTlvs_clone_ptr(LDKReceiveTlvs *NONNULL_PTR arg) {
79541         LDKReceiveTlvs ret_var = ReceiveTlvs_clone(arg);
79542         int64_t ret_ref = 0;
79543         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79544         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79545         return ret_ref;
79546 }
79547 int64_t  CS_LDK_ReceiveTlvs_clone_ptr(int64_t arg) {
79548         LDKReceiveTlvs arg_conv;
79549         arg_conv.inner = untag_ptr(arg);
79550         arg_conv.is_owned = ptr_is_owned(arg);
79551         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
79552         arg_conv.is_owned = false;
79553         int64_t ret_conv = ReceiveTlvs_clone_ptr(&arg_conv);
79554         return ret_conv;
79555 }
79556
79557 int64_t  CS_LDK_ReceiveTlvs_clone(int64_t orig) {
79558         LDKReceiveTlvs orig_conv;
79559         orig_conv.inner = untag_ptr(orig);
79560         orig_conv.is_owned = ptr_is_owned(orig);
79561         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
79562         orig_conv.is_owned = false;
79563         LDKReceiveTlvs ret_var = ReceiveTlvs_clone(&orig_conv);
79564         int64_t ret_ref = 0;
79565         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79566         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79567         return ret_ref;
79568 }
79569
79570 void  CS_LDK_PaymentRelay_free(int64_t this_obj) {
79571         LDKPaymentRelay this_obj_conv;
79572         this_obj_conv.inner = untag_ptr(this_obj);
79573         this_obj_conv.is_owned = ptr_is_owned(this_obj);
79574         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
79575         PaymentRelay_free(this_obj_conv);
79576 }
79577
79578 int16_t  CS_LDK_PaymentRelay_get_cltv_expiry_delta(int64_t this_ptr) {
79579         LDKPaymentRelay this_ptr_conv;
79580         this_ptr_conv.inner = untag_ptr(this_ptr);
79581         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79582         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79583         this_ptr_conv.is_owned = false;
79584         int16_t ret_conv = PaymentRelay_get_cltv_expiry_delta(&this_ptr_conv);
79585         return ret_conv;
79586 }
79587
79588 void  CS_LDK_PaymentRelay_set_cltv_expiry_delta(int64_t this_ptr, int16_t val) {
79589         LDKPaymentRelay this_ptr_conv;
79590         this_ptr_conv.inner = untag_ptr(this_ptr);
79591         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79592         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79593         this_ptr_conv.is_owned = false;
79594         PaymentRelay_set_cltv_expiry_delta(&this_ptr_conv, val);
79595 }
79596
79597 int32_t  CS_LDK_PaymentRelay_get_fee_proportional_millionths(int64_t this_ptr) {
79598         LDKPaymentRelay this_ptr_conv;
79599         this_ptr_conv.inner = untag_ptr(this_ptr);
79600         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79601         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79602         this_ptr_conv.is_owned = false;
79603         int32_t ret_conv = PaymentRelay_get_fee_proportional_millionths(&this_ptr_conv);
79604         return ret_conv;
79605 }
79606
79607 void  CS_LDK_PaymentRelay_set_fee_proportional_millionths(int64_t this_ptr, int32_t val) {
79608         LDKPaymentRelay this_ptr_conv;
79609         this_ptr_conv.inner = untag_ptr(this_ptr);
79610         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79611         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79612         this_ptr_conv.is_owned = false;
79613         PaymentRelay_set_fee_proportional_millionths(&this_ptr_conv, val);
79614 }
79615
79616 int32_t  CS_LDK_PaymentRelay_get_fee_base_msat(int64_t this_ptr) {
79617         LDKPaymentRelay this_ptr_conv;
79618         this_ptr_conv.inner = untag_ptr(this_ptr);
79619         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79620         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79621         this_ptr_conv.is_owned = false;
79622         int32_t ret_conv = PaymentRelay_get_fee_base_msat(&this_ptr_conv);
79623         return ret_conv;
79624 }
79625
79626 void  CS_LDK_PaymentRelay_set_fee_base_msat(int64_t this_ptr, int32_t val) {
79627         LDKPaymentRelay this_ptr_conv;
79628         this_ptr_conv.inner = untag_ptr(this_ptr);
79629         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79630         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79631         this_ptr_conv.is_owned = false;
79632         PaymentRelay_set_fee_base_msat(&this_ptr_conv, val);
79633 }
79634
79635 int64_t  CS_LDK_PaymentRelay_new(int16_t cltv_expiry_delta_arg, int32_t fee_proportional_millionths_arg, int32_t fee_base_msat_arg) {
79636         LDKPaymentRelay ret_var = PaymentRelay_new(cltv_expiry_delta_arg, fee_proportional_millionths_arg, fee_base_msat_arg);
79637         int64_t ret_ref = 0;
79638         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79639         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79640         return ret_ref;
79641 }
79642
79643 static inline uint64_t PaymentRelay_clone_ptr(LDKPaymentRelay *NONNULL_PTR arg) {
79644         LDKPaymentRelay ret_var = PaymentRelay_clone(arg);
79645         int64_t ret_ref = 0;
79646         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79647         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79648         return ret_ref;
79649 }
79650 int64_t  CS_LDK_PaymentRelay_clone_ptr(int64_t arg) {
79651         LDKPaymentRelay arg_conv;
79652         arg_conv.inner = untag_ptr(arg);
79653         arg_conv.is_owned = ptr_is_owned(arg);
79654         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
79655         arg_conv.is_owned = false;
79656         int64_t ret_conv = PaymentRelay_clone_ptr(&arg_conv);
79657         return ret_conv;
79658 }
79659
79660 int64_t  CS_LDK_PaymentRelay_clone(int64_t orig) {
79661         LDKPaymentRelay orig_conv;
79662         orig_conv.inner = untag_ptr(orig);
79663         orig_conv.is_owned = ptr_is_owned(orig);
79664         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
79665         orig_conv.is_owned = false;
79666         LDKPaymentRelay ret_var = PaymentRelay_clone(&orig_conv);
79667         int64_t ret_ref = 0;
79668         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79669         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79670         return ret_ref;
79671 }
79672
79673 void  CS_LDK_PaymentConstraints_free(int64_t this_obj) {
79674         LDKPaymentConstraints this_obj_conv;
79675         this_obj_conv.inner = untag_ptr(this_obj);
79676         this_obj_conv.is_owned = ptr_is_owned(this_obj);
79677         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
79678         PaymentConstraints_free(this_obj_conv);
79679 }
79680
79681 int32_t  CS_LDK_PaymentConstraints_get_max_cltv_expiry(int64_t this_ptr) {
79682         LDKPaymentConstraints this_ptr_conv;
79683         this_ptr_conv.inner = untag_ptr(this_ptr);
79684         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79685         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79686         this_ptr_conv.is_owned = false;
79687         int32_t ret_conv = PaymentConstraints_get_max_cltv_expiry(&this_ptr_conv);
79688         return ret_conv;
79689 }
79690
79691 void  CS_LDK_PaymentConstraints_set_max_cltv_expiry(int64_t this_ptr, int32_t val) {
79692         LDKPaymentConstraints this_ptr_conv;
79693         this_ptr_conv.inner = untag_ptr(this_ptr);
79694         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79695         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79696         this_ptr_conv.is_owned = false;
79697         PaymentConstraints_set_max_cltv_expiry(&this_ptr_conv, val);
79698 }
79699
79700 int64_t  CS_LDK_PaymentConstraints_get_htlc_minimum_msat(int64_t this_ptr) {
79701         LDKPaymentConstraints this_ptr_conv;
79702         this_ptr_conv.inner = untag_ptr(this_ptr);
79703         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79704         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79705         this_ptr_conv.is_owned = false;
79706         int64_t ret_conv = PaymentConstraints_get_htlc_minimum_msat(&this_ptr_conv);
79707         return ret_conv;
79708 }
79709
79710 void  CS_LDK_PaymentConstraints_set_htlc_minimum_msat(int64_t this_ptr, int64_t val) {
79711         LDKPaymentConstraints this_ptr_conv;
79712         this_ptr_conv.inner = untag_ptr(this_ptr);
79713         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79714         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79715         this_ptr_conv.is_owned = false;
79716         PaymentConstraints_set_htlc_minimum_msat(&this_ptr_conv, val);
79717 }
79718
79719 int64_t  CS_LDK_PaymentConstraints_new(int32_t max_cltv_expiry_arg, int64_t htlc_minimum_msat_arg) {
79720         LDKPaymentConstraints ret_var = PaymentConstraints_new(max_cltv_expiry_arg, htlc_minimum_msat_arg);
79721         int64_t ret_ref = 0;
79722         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79723         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79724         return ret_ref;
79725 }
79726
79727 static inline uint64_t PaymentConstraints_clone_ptr(LDKPaymentConstraints *NONNULL_PTR arg) {
79728         LDKPaymentConstraints ret_var = PaymentConstraints_clone(arg);
79729         int64_t ret_ref = 0;
79730         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79731         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79732         return ret_ref;
79733 }
79734 int64_t  CS_LDK_PaymentConstraints_clone_ptr(int64_t arg) {
79735         LDKPaymentConstraints arg_conv;
79736         arg_conv.inner = untag_ptr(arg);
79737         arg_conv.is_owned = ptr_is_owned(arg);
79738         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
79739         arg_conv.is_owned = false;
79740         int64_t ret_conv = PaymentConstraints_clone_ptr(&arg_conv);
79741         return ret_conv;
79742 }
79743
79744 int64_t  CS_LDK_PaymentConstraints_clone(int64_t orig) {
79745         LDKPaymentConstraints orig_conv;
79746         orig_conv.inner = untag_ptr(orig);
79747         orig_conv.is_owned = ptr_is_owned(orig);
79748         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
79749         orig_conv.is_owned = false;
79750         LDKPaymentConstraints ret_var = PaymentConstraints_clone(&orig_conv);
79751         int64_t ret_ref = 0;
79752         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79753         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79754         return ret_ref;
79755 }
79756
79757 void  CS_LDK_PaymentContext_free(int64_t this_ptr) {
79758         if (!ptr_is_owned(this_ptr)) return;
79759         void* this_ptr_ptr = untag_ptr(this_ptr);
79760         CHECK_ACCESS(this_ptr_ptr);
79761         LDKPaymentContext this_ptr_conv = *(LDKPaymentContext*)(this_ptr_ptr);
79762         FREE(untag_ptr(this_ptr));
79763         PaymentContext_free(this_ptr_conv);
79764 }
79765
79766 static inline uint64_t PaymentContext_clone_ptr(LDKPaymentContext *NONNULL_PTR arg) {
79767         LDKPaymentContext *ret_copy = MALLOC(sizeof(LDKPaymentContext), "LDKPaymentContext");
79768         *ret_copy = PaymentContext_clone(arg);
79769         int64_t ret_ref = tag_ptr(ret_copy, true);
79770         return ret_ref;
79771 }
79772 int64_t  CS_LDK_PaymentContext_clone_ptr(int64_t arg) {
79773         LDKPaymentContext* arg_conv = (LDKPaymentContext*)untag_ptr(arg);
79774         int64_t ret_conv = PaymentContext_clone_ptr(arg_conv);
79775         return ret_conv;
79776 }
79777
79778 int64_t  CS_LDK_PaymentContext_clone(int64_t orig) {
79779         LDKPaymentContext* orig_conv = (LDKPaymentContext*)untag_ptr(orig);
79780         LDKPaymentContext *ret_copy = MALLOC(sizeof(LDKPaymentContext), "LDKPaymentContext");
79781         *ret_copy = PaymentContext_clone(orig_conv);
79782         int64_t ret_ref = tag_ptr(ret_copy, true);
79783         return ret_ref;
79784 }
79785
79786 int64_t  CS_LDK_PaymentContext_unknown(int64_t a) {
79787         LDKUnknownPaymentContext a_conv;
79788         a_conv.inner = untag_ptr(a);
79789         a_conv.is_owned = ptr_is_owned(a);
79790         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
79791         a_conv = UnknownPaymentContext_clone(&a_conv);
79792         LDKPaymentContext *ret_copy = MALLOC(sizeof(LDKPaymentContext), "LDKPaymentContext");
79793         *ret_copy = PaymentContext_unknown(a_conv);
79794         int64_t ret_ref = tag_ptr(ret_copy, true);
79795         return ret_ref;
79796 }
79797
79798 int64_t  CS_LDK_PaymentContext_bolt12_offer(int64_t a) {
79799         LDKBolt12OfferContext a_conv;
79800         a_conv.inner = untag_ptr(a);
79801         a_conv.is_owned = ptr_is_owned(a);
79802         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
79803         a_conv = Bolt12OfferContext_clone(&a_conv);
79804         LDKPaymentContext *ret_copy = MALLOC(sizeof(LDKPaymentContext), "LDKPaymentContext");
79805         *ret_copy = PaymentContext_bolt12_offer(a_conv);
79806         int64_t ret_ref = tag_ptr(ret_copy, true);
79807         return ret_ref;
79808 }
79809
79810 int64_t  CS_LDK_PaymentContext_bolt12_refund(int64_t a) {
79811         LDKBolt12RefundContext a_conv;
79812         a_conv.inner = untag_ptr(a);
79813         a_conv.is_owned = ptr_is_owned(a);
79814         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
79815         a_conv = Bolt12RefundContext_clone(&a_conv);
79816         LDKPaymentContext *ret_copy = MALLOC(sizeof(LDKPaymentContext), "LDKPaymentContext");
79817         *ret_copy = PaymentContext_bolt12_refund(a_conv);
79818         int64_t ret_ref = tag_ptr(ret_copy, true);
79819         return ret_ref;
79820 }
79821
79822 jboolean  CS_LDK_PaymentContext_eq(int64_t a, int64_t b) {
79823         LDKPaymentContext* a_conv = (LDKPaymentContext*)untag_ptr(a);
79824         LDKPaymentContext* b_conv = (LDKPaymentContext*)untag_ptr(b);
79825         jboolean ret_conv = PaymentContext_eq(a_conv, b_conv);
79826         return ret_conv;
79827 }
79828
79829 void  CS_LDK_UnknownPaymentContext_free(int64_t this_obj) {
79830         LDKUnknownPaymentContext this_obj_conv;
79831         this_obj_conv.inner = untag_ptr(this_obj);
79832         this_obj_conv.is_owned = ptr_is_owned(this_obj);
79833         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
79834         UnknownPaymentContext_free(this_obj_conv);
79835 }
79836
79837 static inline uint64_t UnknownPaymentContext_clone_ptr(LDKUnknownPaymentContext *NONNULL_PTR arg) {
79838         LDKUnknownPaymentContext ret_var = UnknownPaymentContext_clone(arg);
79839         int64_t ret_ref = 0;
79840         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79841         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79842         return ret_ref;
79843 }
79844 int64_t  CS_LDK_UnknownPaymentContext_clone_ptr(int64_t arg) {
79845         LDKUnknownPaymentContext arg_conv;
79846         arg_conv.inner = untag_ptr(arg);
79847         arg_conv.is_owned = ptr_is_owned(arg);
79848         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
79849         arg_conv.is_owned = false;
79850         int64_t ret_conv = UnknownPaymentContext_clone_ptr(&arg_conv);
79851         return ret_conv;
79852 }
79853
79854 int64_t  CS_LDK_UnknownPaymentContext_clone(int64_t orig) {
79855         LDKUnknownPaymentContext orig_conv;
79856         orig_conv.inner = untag_ptr(orig);
79857         orig_conv.is_owned = ptr_is_owned(orig);
79858         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
79859         orig_conv.is_owned = false;
79860         LDKUnknownPaymentContext ret_var = UnknownPaymentContext_clone(&orig_conv);
79861         int64_t ret_ref = 0;
79862         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79863         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79864         return ret_ref;
79865 }
79866
79867 jboolean  CS_LDK_UnknownPaymentContext_eq(int64_t a, int64_t b) {
79868         LDKUnknownPaymentContext a_conv;
79869         a_conv.inner = untag_ptr(a);
79870         a_conv.is_owned = ptr_is_owned(a);
79871         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
79872         a_conv.is_owned = false;
79873         LDKUnknownPaymentContext b_conv;
79874         b_conv.inner = untag_ptr(b);
79875         b_conv.is_owned = ptr_is_owned(b);
79876         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
79877         b_conv.is_owned = false;
79878         jboolean ret_conv = UnknownPaymentContext_eq(&a_conv, &b_conv);
79879         return ret_conv;
79880 }
79881
79882 void  CS_LDK_Bolt12OfferContext_free(int64_t this_obj) {
79883         LDKBolt12OfferContext this_obj_conv;
79884         this_obj_conv.inner = untag_ptr(this_obj);
79885         this_obj_conv.is_owned = ptr_is_owned(this_obj);
79886         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
79887         Bolt12OfferContext_free(this_obj_conv);
79888 }
79889
79890 int64_t  CS_LDK_Bolt12OfferContext_get_offer_id(int64_t this_ptr) {
79891         LDKBolt12OfferContext this_ptr_conv;
79892         this_ptr_conv.inner = untag_ptr(this_ptr);
79893         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79894         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79895         this_ptr_conv.is_owned = false;
79896         LDKOfferId ret_var = Bolt12OfferContext_get_offer_id(&this_ptr_conv);
79897         int64_t ret_ref = 0;
79898         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79899         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79900         return ret_ref;
79901 }
79902
79903 void  CS_LDK_Bolt12OfferContext_set_offer_id(int64_t this_ptr, int64_t val) {
79904         LDKBolt12OfferContext this_ptr_conv;
79905         this_ptr_conv.inner = untag_ptr(this_ptr);
79906         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79907         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79908         this_ptr_conv.is_owned = false;
79909         LDKOfferId val_conv;
79910         val_conv.inner = untag_ptr(val);
79911         val_conv.is_owned = ptr_is_owned(val);
79912         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
79913         val_conv = OfferId_clone(&val_conv);
79914         Bolt12OfferContext_set_offer_id(&this_ptr_conv, val_conv);
79915 }
79916
79917 int64_t  CS_LDK_Bolt12OfferContext_get_invoice_request(int64_t this_ptr) {
79918         LDKBolt12OfferContext this_ptr_conv;
79919         this_ptr_conv.inner = untag_ptr(this_ptr);
79920         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79921         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79922         this_ptr_conv.is_owned = false;
79923         LDKInvoiceRequestFields ret_var = Bolt12OfferContext_get_invoice_request(&this_ptr_conv);
79924         int64_t ret_ref = 0;
79925         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79926         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79927         return ret_ref;
79928 }
79929
79930 void  CS_LDK_Bolt12OfferContext_set_invoice_request(int64_t this_ptr, int64_t val) {
79931         LDKBolt12OfferContext this_ptr_conv;
79932         this_ptr_conv.inner = untag_ptr(this_ptr);
79933         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79934         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79935         this_ptr_conv.is_owned = false;
79936         LDKInvoiceRequestFields val_conv;
79937         val_conv.inner = untag_ptr(val);
79938         val_conv.is_owned = ptr_is_owned(val);
79939         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
79940         val_conv = InvoiceRequestFields_clone(&val_conv);
79941         Bolt12OfferContext_set_invoice_request(&this_ptr_conv, val_conv);
79942 }
79943
79944 int64_t  CS_LDK_Bolt12OfferContext_new(int64_t offer_id_arg, int64_t invoice_request_arg) {
79945         LDKOfferId offer_id_arg_conv;
79946         offer_id_arg_conv.inner = untag_ptr(offer_id_arg);
79947         offer_id_arg_conv.is_owned = ptr_is_owned(offer_id_arg);
79948         CHECK_INNER_FIELD_ACCESS_OR_NULL(offer_id_arg_conv);
79949         offer_id_arg_conv = OfferId_clone(&offer_id_arg_conv);
79950         LDKInvoiceRequestFields invoice_request_arg_conv;
79951         invoice_request_arg_conv.inner = untag_ptr(invoice_request_arg);
79952         invoice_request_arg_conv.is_owned = ptr_is_owned(invoice_request_arg);
79953         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_request_arg_conv);
79954         invoice_request_arg_conv = InvoiceRequestFields_clone(&invoice_request_arg_conv);
79955         LDKBolt12OfferContext ret_var = Bolt12OfferContext_new(offer_id_arg_conv, invoice_request_arg_conv);
79956         int64_t ret_ref = 0;
79957         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79958         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79959         return ret_ref;
79960 }
79961
79962 static inline uint64_t Bolt12OfferContext_clone_ptr(LDKBolt12OfferContext *NONNULL_PTR arg) {
79963         LDKBolt12OfferContext ret_var = Bolt12OfferContext_clone(arg);
79964         int64_t ret_ref = 0;
79965         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79966         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79967         return ret_ref;
79968 }
79969 int64_t  CS_LDK_Bolt12OfferContext_clone_ptr(int64_t arg) {
79970         LDKBolt12OfferContext arg_conv;
79971         arg_conv.inner = untag_ptr(arg);
79972         arg_conv.is_owned = ptr_is_owned(arg);
79973         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
79974         arg_conv.is_owned = false;
79975         int64_t ret_conv = Bolt12OfferContext_clone_ptr(&arg_conv);
79976         return ret_conv;
79977 }
79978
79979 int64_t  CS_LDK_Bolt12OfferContext_clone(int64_t orig) {
79980         LDKBolt12OfferContext orig_conv;
79981         orig_conv.inner = untag_ptr(orig);
79982         orig_conv.is_owned = ptr_is_owned(orig);
79983         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
79984         orig_conv.is_owned = false;
79985         LDKBolt12OfferContext ret_var = Bolt12OfferContext_clone(&orig_conv);
79986         int64_t ret_ref = 0;
79987         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79988         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79989         return ret_ref;
79990 }
79991
79992 jboolean  CS_LDK_Bolt12OfferContext_eq(int64_t a, int64_t b) {
79993         LDKBolt12OfferContext a_conv;
79994         a_conv.inner = untag_ptr(a);
79995         a_conv.is_owned = ptr_is_owned(a);
79996         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
79997         a_conv.is_owned = false;
79998         LDKBolt12OfferContext b_conv;
79999         b_conv.inner = untag_ptr(b);
80000         b_conv.is_owned = ptr_is_owned(b);
80001         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
80002         b_conv.is_owned = false;
80003         jboolean ret_conv = Bolt12OfferContext_eq(&a_conv, &b_conv);
80004         return ret_conv;
80005 }
80006
80007 void  CS_LDK_Bolt12RefundContext_free(int64_t this_obj) {
80008         LDKBolt12RefundContext this_obj_conv;
80009         this_obj_conv.inner = untag_ptr(this_obj);
80010         this_obj_conv.is_owned = ptr_is_owned(this_obj);
80011         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
80012         Bolt12RefundContext_free(this_obj_conv);
80013 }
80014
80015 int64_t  CS_LDK_Bolt12RefundContext_new() {
80016         LDKBolt12RefundContext ret_var = Bolt12RefundContext_new();
80017         int64_t ret_ref = 0;
80018         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80019         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80020         return ret_ref;
80021 }
80022
80023 static inline uint64_t Bolt12RefundContext_clone_ptr(LDKBolt12RefundContext *NONNULL_PTR arg) {
80024         LDKBolt12RefundContext ret_var = Bolt12RefundContext_clone(arg);
80025         int64_t ret_ref = 0;
80026         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80027         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80028         return ret_ref;
80029 }
80030 int64_t  CS_LDK_Bolt12RefundContext_clone_ptr(int64_t arg) {
80031         LDKBolt12RefundContext arg_conv;
80032         arg_conv.inner = untag_ptr(arg);
80033         arg_conv.is_owned = ptr_is_owned(arg);
80034         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
80035         arg_conv.is_owned = false;
80036         int64_t ret_conv = Bolt12RefundContext_clone_ptr(&arg_conv);
80037         return ret_conv;
80038 }
80039
80040 int64_t  CS_LDK_Bolt12RefundContext_clone(int64_t orig) {
80041         LDKBolt12RefundContext orig_conv;
80042         orig_conv.inner = untag_ptr(orig);
80043         orig_conv.is_owned = ptr_is_owned(orig);
80044         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
80045         orig_conv.is_owned = false;
80046         LDKBolt12RefundContext ret_var = Bolt12RefundContext_clone(&orig_conv);
80047         int64_t ret_ref = 0;
80048         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80049         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80050         return ret_ref;
80051 }
80052
80053 jboolean  CS_LDK_Bolt12RefundContext_eq(int64_t a, int64_t b) {
80054         LDKBolt12RefundContext a_conv;
80055         a_conv.inner = untag_ptr(a);
80056         a_conv.is_owned = ptr_is_owned(a);
80057         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
80058         a_conv.is_owned = false;
80059         LDKBolt12RefundContext b_conv;
80060         b_conv.inner = untag_ptr(b);
80061         b_conv.is_owned = ptr_is_owned(b);
80062         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
80063         b_conv.is_owned = false;
80064         jboolean ret_conv = Bolt12RefundContext_eq(&a_conv, &b_conv);
80065         return ret_conv;
80066 }
80067
80068 int8_tArray  CS_LDK_ForwardTlvs_write(int64_t obj) {
80069         LDKForwardTlvs obj_conv;
80070         obj_conv.inner = untag_ptr(obj);
80071         obj_conv.is_owned = ptr_is_owned(obj);
80072         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
80073         obj_conv.is_owned = false;
80074         LDKCVec_u8Z ret_var = ForwardTlvs_write(&obj_conv);
80075         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
80076         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
80077         CVec_u8Z_free(ret_var);
80078         return ret_arr;
80079 }
80080
80081 int8_tArray  CS_LDK_ReceiveTlvs_write(int64_t obj) {
80082         LDKReceiveTlvs obj_conv;
80083         obj_conv.inner = untag_ptr(obj);
80084         obj_conv.is_owned = ptr_is_owned(obj);
80085         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
80086         obj_conv.is_owned = false;
80087         LDKCVec_u8Z ret_var = ReceiveTlvs_write(&obj_conv);
80088         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
80089         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
80090         CVec_u8Z_free(ret_var);
80091         return ret_arr;
80092 }
80093
80094 int8_tArray  CS_LDK_PaymentRelay_write(int64_t obj) {
80095         LDKPaymentRelay obj_conv;
80096         obj_conv.inner = untag_ptr(obj);
80097         obj_conv.is_owned = ptr_is_owned(obj);
80098         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
80099         obj_conv.is_owned = false;
80100         LDKCVec_u8Z ret_var = PaymentRelay_write(&obj_conv);
80101         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
80102         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
80103         CVec_u8Z_free(ret_var);
80104         return ret_arr;
80105 }
80106
80107 int64_t  CS_LDK_PaymentRelay_read(int8_tArray ser) {
80108         LDKu8slice ser_ref;
80109         ser_ref.datalen = ser->arr_len;
80110         ser_ref.data = ser->elems;
80111         LDKCResult_PaymentRelayDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentRelayDecodeErrorZ), "LDKCResult_PaymentRelayDecodeErrorZ");
80112         *ret_conv = PaymentRelay_read(ser_ref);
80113         FREE(ser);
80114         return tag_ptr(ret_conv, true);
80115 }
80116
80117 int8_tArray  CS_LDK_PaymentConstraints_write(int64_t obj) {
80118         LDKPaymentConstraints obj_conv;
80119         obj_conv.inner = untag_ptr(obj);
80120         obj_conv.is_owned = ptr_is_owned(obj);
80121         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
80122         obj_conv.is_owned = false;
80123         LDKCVec_u8Z ret_var = PaymentConstraints_write(&obj_conv);
80124         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
80125         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
80126         CVec_u8Z_free(ret_var);
80127         return ret_arr;
80128 }
80129
80130 int64_t  CS_LDK_PaymentConstraints_read(int8_tArray ser) {
80131         LDKu8slice ser_ref;
80132         ser_ref.datalen = ser->arr_len;
80133         ser_ref.data = ser->elems;
80134         LDKCResult_PaymentConstraintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ), "LDKCResult_PaymentConstraintsDecodeErrorZ");
80135         *ret_conv = PaymentConstraints_read(ser_ref);
80136         FREE(ser);
80137         return tag_ptr(ret_conv, true);
80138 }
80139
80140 int8_tArray  CS_LDK_PaymentContext_write(int64_t obj) {
80141         LDKPaymentContext* obj_conv = (LDKPaymentContext*)untag_ptr(obj);
80142         LDKCVec_u8Z ret_var = PaymentContext_write(obj_conv);
80143         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
80144         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
80145         CVec_u8Z_free(ret_var);
80146         return ret_arr;
80147 }
80148
80149 int64_t  CS_LDK_PaymentContext_read(int8_tArray ser) {
80150         LDKu8slice ser_ref;
80151         ser_ref.datalen = ser->arr_len;
80152         ser_ref.data = ser->elems;
80153         LDKCResult_PaymentContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentContextDecodeErrorZ), "LDKCResult_PaymentContextDecodeErrorZ");
80154         *ret_conv = PaymentContext_read(ser_ref);
80155         FREE(ser);
80156         return tag_ptr(ret_conv, true);
80157 }
80158
80159 int8_tArray  CS_LDK_UnknownPaymentContext_write(int64_t obj) {
80160         LDKUnknownPaymentContext obj_conv;
80161         obj_conv.inner = untag_ptr(obj);
80162         obj_conv.is_owned = ptr_is_owned(obj);
80163         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
80164         obj_conv.is_owned = false;
80165         LDKCVec_u8Z ret_var = UnknownPaymentContext_write(&obj_conv);
80166         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
80167         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
80168         CVec_u8Z_free(ret_var);
80169         return ret_arr;
80170 }
80171
80172 int64_t  CS_LDK_UnknownPaymentContext_read(int8_tArray ser) {
80173         LDKu8slice ser_ref;
80174         ser_ref.datalen = ser->arr_len;
80175         ser_ref.data = ser->elems;
80176         LDKCResult_UnknownPaymentContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnknownPaymentContextDecodeErrorZ), "LDKCResult_UnknownPaymentContextDecodeErrorZ");
80177         *ret_conv = UnknownPaymentContext_read(ser_ref);
80178         FREE(ser);
80179         return tag_ptr(ret_conv, true);
80180 }
80181
80182 int8_tArray  CS_LDK_Bolt12OfferContext_write(int64_t obj) {
80183         LDKBolt12OfferContext obj_conv;
80184         obj_conv.inner = untag_ptr(obj);
80185         obj_conv.is_owned = ptr_is_owned(obj);
80186         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
80187         obj_conv.is_owned = false;
80188         LDKCVec_u8Z ret_var = Bolt12OfferContext_write(&obj_conv);
80189         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
80190         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
80191         CVec_u8Z_free(ret_var);
80192         return ret_arr;
80193 }
80194
80195 int64_t  CS_LDK_Bolt12OfferContext_read(int8_tArray ser) {
80196         LDKu8slice ser_ref;
80197         ser_ref.datalen = ser->arr_len;
80198         ser_ref.data = ser->elems;
80199         LDKCResult_Bolt12OfferContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12OfferContextDecodeErrorZ), "LDKCResult_Bolt12OfferContextDecodeErrorZ");
80200         *ret_conv = Bolt12OfferContext_read(ser_ref);
80201         FREE(ser);
80202         return tag_ptr(ret_conv, true);
80203 }
80204
80205 int8_tArray  CS_LDK_Bolt12RefundContext_write(int64_t obj) {
80206         LDKBolt12RefundContext obj_conv;
80207         obj_conv.inner = untag_ptr(obj);
80208         obj_conv.is_owned = ptr_is_owned(obj);
80209         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
80210         obj_conv.is_owned = false;
80211         LDKCVec_u8Z ret_var = Bolt12RefundContext_write(&obj_conv);
80212         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
80213         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
80214         CVec_u8Z_free(ret_var);
80215         return ret_arr;
80216 }
80217
80218 int64_t  CS_LDK_Bolt12RefundContext_read(int8_tArray ser) {
80219         LDKu8slice ser_ref;
80220         ser_ref.datalen = ser->arr_len;
80221         ser_ref.data = ser->elems;
80222         LDKCResult_Bolt12RefundContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12RefundContextDecodeErrorZ), "LDKCResult_Bolt12RefundContextDecodeErrorZ");
80223         *ret_conv = Bolt12RefundContext_read(ser_ref);
80224         FREE(ser);
80225         return tag_ptr(ret_conv, true);
80226 }
80227
80228 void  CS_LDK_PaymentPurpose_free(int64_t this_ptr) {
80229         if (!ptr_is_owned(this_ptr)) return;
80230         void* this_ptr_ptr = untag_ptr(this_ptr);
80231         CHECK_ACCESS(this_ptr_ptr);
80232         LDKPaymentPurpose this_ptr_conv = *(LDKPaymentPurpose*)(this_ptr_ptr);
80233         FREE(untag_ptr(this_ptr));
80234         PaymentPurpose_free(this_ptr_conv);
80235 }
80236
80237 static inline uint64_t PaymentPurpose_clone_ptr(LDKPaymentPurpose *NONNULL_PTR arg) {
80238         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
80239         *ret_copy = PaymentPurpose_clone(arg);
80240         int64_t ret_ref = tag_ptr(ret_copy, true);
80241         return ret_ref;
80242 }
80243 int64_t  CS_LDK_PaymentPurpose_clone_ptr(int64_t arg) {
80244         LDKPaymentPurpose* arg_conv = (LDKPaymentPurpose*)untag_ptr(arg);
80245         int64_t ret_conv = PaymentPurpose_clone_ptr(arg_conv);
80246         return ret_conv;
80247 }
80248
80249 int64_t  CS_LDK_PaymentPurpose_clone(int64_t orig) {
80250         LDKPaymentPurpose* orig_conv = (LDKPaymentPurpose*)untag_ptr(orig);
80251         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
80252         *ret_copy = PaymentPurpose_clone(orig_conv);
80253         int64_t ret_ref = tag_ptr(ret_copy, true);
80254         return ret_ref;
80255 }
80256
80257 int64_t  CS_LDK_PaymentPurpose_bolt11_invoice_payment(int64_t payment_preimage, int8_tArray payment_secret) {
80258         void* payment_preimage_ptr = untag_ptr(payment_preimage);
80259         CHECK_ACCESS(payment_preimage_ptr);
80260         LDKCOption_ThirtyTwoBytesZ payment_preimage_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_preimage_ptr);
80261         payment_preimage_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_preimage));
80262         LDKThirtyTwoBytes payment_secret_ref;
80263         CHECK(payment_secret->arr_len == 32);
80264         memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
80265         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
80266         *ret_copy = PaymentPurpose_bolt11_invoice_payment(payment_preimage_conv, payment_secret_ref);
80267         int64_t ret_ref = tag_ptr(ret_copy, true);
80268         return ret_ref;
80269 }
80270
80271 int64_t  CS_LDK_PaymentPurpose_bolt12_offer_payment(int64_t payment_preimage, int8_tArray payment_secret, int64_t payment_context) {
80272         void* payment_preimage_ptr = untag_ptr(payment_preimage);
80273         CHECK_ACCESS(payment_preimage_ptr);
80274         LDKCOption_ThirtyTwoBytesZ payment_preimage_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_preimage_ptr);
80275         payment_preimage_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_preimage));
80276         LDKThirtyTwoBytes payment_secret_ref;
80277         CHECK(payment_secret->arr_len == 32);
80278         memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
80279         LDKBolt12OfferContext payment_context_conv;
80280         payment_context_conv.inner = untag_ptr(payment_context);
80281         payment_context_conv.is_owned = ptr_is_owned(payment_context);
80282         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_context_conv);
80283         payment_context_conv = Bolt12OfferContext_clone(&payment_context_conv);
80284         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
80285         *ret_copy = PaymentPurpose_bolt12_offer_payment(payment_preimage_conv, payment_secret_ref, payment_context_conv);
80286         int64_t ret_ref = tag_ptr(ret_copy, true);
80287         return ret_ref;
80288 }
80289
80290 int64_t  CS_LDK_PaymentPurpose_bolt12_refund_payment(int64_t payment_preimage, int8_tArray payment_secret, int64_t payment_context) {
80291         void* payment_preimage_ptr = untag_ptr(payment_preimage);
80292         CHECK_ACCESS(payment_preimage_ptr);
80293         LDKCOption_ThirtyTwoBytesZ payment_preimage_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_preimage_ptr);
80294         payment_preimage_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_preimage));
80295         LDKThirtyTwoBytes payment_secret_ref;
80296         CHECK(payment_secret->arr_len == 32);
80297         memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
80298         LDKBolt12RefundContext payment_context_conv;
80299         payment_context_conv.inner = untag_ptr(payment_context);
80300         payment_context_conv.is_owned = ptr_is_owned(payment_context);
80301         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_context_conv);
80302         payment_context_conv = Bolt12RefundContext_clone(&payment_context_conv);
80303         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
80304         *ret_copy = PaymentPurpose_bolt12_refund_payment(payment_preimage_conv, payment_secret_ref, payment_context_conv);
80305         int64_t ret_ref = tag_ptr(ret_copy, true);
80306         return ret_ref;
80307 }
80308
80309 int64_t  CS_LDK_PaymentPurpose_spontaneous_payment(int8_tArray a) {
80310         LDKThirtyTwoBytes a_ref;
80311         CHECK(a->arr_len == 32);
80312         memcpy(a_ref.data, a->elems, 32); FREE(a);
80313         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
80314         *ret_copy = PaymentPurpose_spontaneous_payment(a_ref);
80315         int64_t ret_ref = tag_ptr(ret_copy, true);
80316         return ret_ref;
80317 }
80318
80319 jboolean  CS_LDK_PaymentPurpose_eq(int64_t a, int64_t b) {
80320         LDKPaymentPurpose* a_conv = (LDKPaymentPurpose*)untag_ptr(a);
80321         LDKPaymentPurpose* b_conv = (LDKPaymentPurpose*)untag_ptr(b);
80322         jboolean ret_conv = PaymentPurpose_eq(a_conv, b_conv);
80323         return ret_conv;
80324 }
80325
80326 int64_t  CS_LDK_PaymentPurpose_preimage(int64_t this_arg) {
80327         LDKPaymentPurpose* this_arg_conv = (LDKPaymentPurpose*)untag_ptr(this_arg);
80328         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
80329         *ret_copy = PaymentPurpose_preimage(this_arg_conv);
80330         int64_t ret_ref = tag_ptr(ret_copy, true);
80331         return ret_ref;
80332 }
80333
80334 int8_tArray  CS_LDK_PaymentPurpose_write(int64_t obj) {
80335         LDKPaymentPurpose* obj_conv = (LDKPaymentPurpose*)untag_ptr(obj);
80336         LDKCVec_u8Z ret_var = PaymentPurpose_write(obj_conv);
80337         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
80338         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
80339         CVec_u8Z_free(ret_var);
80340         return ret_arr;
80341 }
80342
80343 int64_t  CS_LDK_PaymentPurpose_read(int8_tArray ser) {
80344         LDKu8slice ser_ref;
80345         ser_ref.datalen = ser->arr_len;
80346         ser_ref.data = ser->elems;
80347         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
80348         *ret_conv = PaymentPurpose_read(ser_ref);
80349         FREE(ser);
80350         return tag_ptr(ret_conv, true);
80351 }
80352
80353 void  CS_LDK_ClaimedHTLC_free(int64_t this_obj) {
80354         LDKClaimedHTLC this_obj_conv;
80355         this_obj_conv.inner = untag_ptr(this_obj);
80356         this_obj_conv.is_owned = ptr_is_owned(this_obj);
80357         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
80358         ClaimedHTLC_free(this_obj_conv);
80359 }
80360
80361 int64_t  CS_LDK_ClaimedHTLC_get_channel_id(int64_t this_ptr) {
80362         LDKClaimedHTLC this_ptr_conv;
80363         this_ptr_conv.inner = untag_ptr(this_ptr);
80364         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80365         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80366         this_ptr_conv.is_owned = false;
80367         LDKChannelId ret_var = ClaimedHTLC_get_channel_id(&this_ptr_conv);
80368         int64_t ret_ref = 0;
80369         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80370         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80371         return ret_ref;
80372 }
80373
80374 void  CS_LDK_ClaimedHTLC_set_channel_id(int64_t this_ptr, int64_t val) {
80375         LDKClaimedHTLC this_ptr_conv;
80376         this_ptr_conv.inner = untag_ptr(this_ptr);
80377         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80378         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80379         this_ptr_conv.is_owned = false;
80380         LDKChannelId val_conv;
80381         val_conv.inner = untag_ptr(val);
80382         val_conv.is_owned = ptr_is_owned(val);
80383         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
80384         val_conv = ChannelId_clone(&val_conv);
80385         ClaimedHTLC_set_channel_id(&this_ptr_conv, val_conv);
80386 }
80387
80388 int8_tArray  CS_LDK_ClaimedHTLC_get_user_channel_id(int64_t this_ptr) {
80389         LDKClaimedHTLC this_ptr_conv;
80390         this_ptr_conv.inner = untag_ptr(this_ptr);
80391         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80392         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80393         this_ptr_conv.is_owned = false;
80394         int8_tArray ret_arr = init_int8_tArray(16, __LINE__);
80395         memcpy(ret_arr->elems, ClaimedHTLC_get_user_channel_id(&this_ptr_conv).le_bytes, 16);
80396         return ret_arr;
80397 }
80398
80399 void  CS_LDK_ClaimedHTLC_set_user_channel_id(int64_t this_ptr, int8_tArray val) {
80400         LDKClaimedHTLC this_ptr_conv;
80401         this_ptr_conv.inner = untag_ptr(this_ptr);
80402         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80403         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80404         this_ptr_conv.is_owned = false;
80405         LDKU128 val_ref;
80406         CHECK(val->arr_len == 16);
80407         memcpy(val_ref.le_bytes, val->elems, 16); FREE(val);
80408         ClaimedHTLC_set_user_channel_id(&this_ptr_conv, val_ref);
80409 }
80410
80411 int32_t  CS_LDK_ClaimedHTLC_get_cltv_expiry(int64_t this_ptr) {
80412         LDKClaimedHTLC this_ptr_conv;
80413         this_ptr_conv.inner = untag_ptr(this_ptr);
80414         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80415         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80416         this_ptr_conv.is_owned = false;
80417         int32_t ret_conv = ClaimedHTLC_get_cltv_expiry(&this_ptr_conv);
80418         return ret_conv;
80419 }
80420
80421 void  CS_LDK_ClaimedHTLC_set_cltv_expiry(int64_t this_ptr, int32_t val) {
80422         LDKClaimedHTLC this_ptr_conv;
80423         this_ptr_conv.inner = untag_ptr(this_ptr);
80424         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80425         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80426         this_ptr_conv.is_owned = false;
80427         ClaimedHTLC_set_cltv_expiry(&this_ptr_conv, val);
80428 }
80429
80430 int64_t  CS_LDK_ClaimedHTLC_get_value_msat(int64_t this_ptr) {
80431         LDKClaimedHTLC this_ptr_conv;
80432         this_ptr_conv.inner = untag_ptr(this_ptr);
80433         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80434         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80435         this_ptr_conv.is_owned = false;
80436         int64_t ret_conv = ClaimedHTLC_get_value_msat(&this_ptr_conv);
80437         return ret_conv;
80438 }
80439
80440 void  CS_LDK_ClaimedHTLC_set_value_msat(int64_t this_ptr, int64_t val) {
80441         LDKClaimedHTLC this_ptr_conv;
80442         this_ptr_conv.inner = untag_ptr(this_ptr);
80443         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80444         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80445         this_ptr_conv.is_owned = false;
80446         ClaimedHTLC_set_value_msat(&this_ptr_conv, val);
80447 }
80448
80449 int64_t  CS_LDK_ClaimedHTLC_get_counterparty_skimmed_fee_msat(int64_t this_ptr) {
80450         LDKClaimedHTLC this_ptr_conv;
80451         this_ptr_conv.inner = untag_ptr(this_ptr);
80452         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80453         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80454         this_ptr_conv.is_owned = false;
80455         int64_t ret_conv = ClaimedHTLC_get_counterparty_skimmed_fee_msat(&this_ptr_conv);
80456         return ret_conv;
80457 }
80458
80459 void  CS_LDK_ClaimedHTLC_set_counterparty_skimmed_fee_msat(int64_t this_ptr, int64_t val) {
80460         LDKClaimedHTLC this_ptr_conv;
80461         this_ptr_conv.inner = untag_ptr(this_ptr);
80462         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80463         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80464         this_ptr_conv.is_owned = false;
80465         ClaimedHTLC_set_counterparty_skimmed_fee_msat(&this_ptr_conv, val);
80466 }
80467
80468 int64_t  CS_LDK_ClaimedHTLC_new(int64_t 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) {
80469         LDKChannelId channel_id_arg_conv;
80470         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
80471         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
80472         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
80473         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
80474         LDKU128 user_channel_id_arg_ref;
80475         CHECK(user_channel_id_arg->arr_len == 16);
80476         memcpy(user_channel_id_arg_ref.le_bytes, user_channel_id_arg->elems, 16); FREE(user_channel_id_arg);
80477         LDKClaimedHTLC ret_var = ClaimedHTLC_new(channel_id_arg_conv, user_channel_id_arg_ref, cltv_expiry_arg, value_msat_arg, counterparty_skimmed_fee_msat_arg);
80478         int64_t ret_ref = 0;
80479         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80480         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80481         return ret_ref;
80482 }
80483
80484 static inline uint64_t ClaimedHTLC_clone_ptr(LDKClaimedHTLC *NONNULL_PTR arg) {
80485         LDKClaimedHTLC ret_var = ClaimedHTLC_clone(arg);
80486         int64_t ret_ref = 0;
80487         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80488         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80489         return ret_ref;
80490 }
80491 int64_t  CS_LDK_ClaimedHTLC_clone_ptr(int64_t arg) {
80492         LDKClaimedHTLC arg_conv;
80493         arg_conv.inner = untag_ptr(arg);
80494         arg_conv.is_owned = ptr_is_owned(arg);
80495         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
80496         arg_conv.is_owned = false;
80497         int64_t ret_conv = ClaimedHTLC_clone_ptr(&arg_conv);
80498         return ret_conv;
80499 }
80500
80501 int64_t  CS_LDK_ClaimedHTLC_clone(int64_t orig) {
80502         LDKClaimedHTLC orig_conv;
80503         orig_conv.inner = untag_ptr(orig);
80504         orig_conv.is_owned = ptr_is_owned(orig);
80505         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
80506         orig_conv.is_owned = false;
80507         LDKClaimedHTLC ret_var = ClaimedHTLC_clone(&orig_conv);
80508         int64_t ret_ref = 0;
80509         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80510         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80511         return ret_ref;
80512 }
80513
80514 jboolean  CS_LDK_ClaimedHTLC_eq(int64_t a, int64_t b) {
80515         LDKClaimedHTLC a_conv;
80516         a_conv.inner = untag_ptr(a);
80517         a_conv.is_owned = ptr_is_owned(a);
80518         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
80519         a_conv.is_owned = false;
80520         LDKClaimedHTLC b_conv;
80521         b_conv.inner = untag_ptr(b);
80522         b_conv.is_owned = ptr_is_owned(b);
80523         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
80524         b_conv.is_owned = false;
80525         jboolean ret_conv = ClaimedHTLC_eq(&a_conv, &b_conv);
80526         return ret_conv;
80527 }
80528
80529 int8_tArray  CS_LDK_ClaimedHTLC_write(int64_t obj) {
80530         LDKClaimedHTLC obj_conv;
80531         obj_conv.inner = untag_ptr(obj);
80532         obj_conv.is_owned = ptr_is_owned(obj);
80533         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
80534         obj_conv.is_owned = false;
80535         LDKCVec_u8Z ret_var = ClaimedHTLC_write(&obj_conv);
80536         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
80537         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
80538         CVec_u8Z_free(ret_var);
80539         return ret_arr;
80540 }
80541
80542 int64_t  CS_LDK_ClaimedHTLC_read(int8_tArray ser) {
80543         LDKu8slice ser_ref;
80544         ser_ref.datalen = ser->arr_len;
80545         ser_ref.data = ser->elems;
80546         LDKCResult_ClaimedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClaimedHTLCDecodeErrorZ), "LDKCResult_ClaimedHTLCDecodeErrorZ");
80547         *ret_conv = ClaimedHTLC_read(ser_ref);
80548         FREE(ser);
80549         return tag_ptr(ret_conv, true);
80550 }
80551
80552 void  CS_LDK_PathFailure_free(int64_t this_ptr) {
80553         if (!ptr_is_owned(this_ptr)) return;
80554         void* this_ptr_ptr = untag_ptr(this_ptr);
80555         CHECK_ACCESS(this_ptr_ptr);
80556         LDKPathFailure this_ptr_conv = *(LDKPathFailure*)(this_ptr_ptr);
80557         FREE(untag_ptr(this_ptr));
80558         PathFailure_free(this_ptr_conv);
80559 }
80560
80561 static inline uint64_t PathFailure_clone_ptr(LDKPathFailure *NONNULL_PTR arg) {
80562         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
80563         *ret_copy = PathFailure_clone(arg);
80564         int64_t ret_ref = tag_ptr(ret_copy, true);
80565         return ret_ref;
80566 }
80567 int64_t  CS_LDK_PathFailure_clone_ptr(int64_t arg) {
80568         LDKPathFailure* arg_conv = (LDKPathFailure*)untag_ptr(arg);
80569         int64_t ret_conv = PathFailure_clone_ptr(arg_conv);
80570         return ret_conv;
80571 }
80572
80573 int64_t  CS_LDK_PathFailure_clone(int64_t orig) {
80574         LDKPathFailure* orig_conv = (LDKPathFailure*)untag_ptr(orig);
80575         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
80576         *ret_copy = PathFailure_clone(orig_conv);
80577         int64_t ret_ref = tag_ptr(ret_copy, true);
80578         return ret_ref;
80579 }
80580
80581 int64_t  CS_LDK_PathFailure_initial_send(int64_t err) {
80582         void* err_ptr = untag_ptr(err);
80583         CHECK_ACCESS(err_ptr);
80584         LDKAPIError err_conv = *(LDKAPIError*)(err_ptr);
80585         err_conv = APIError_clone((LDKAPIError*)untag_ptr(err));
80586         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
80587         *ret_copy = PathFailure_initial_send(err_conv);
80588         int64_t ret_ref = tag_ptr(ret_copy, true);
80589         return ret_ref;
80590 }
80591
80592 int64_t  CS_LDK_PathFailure_on_path(int64_t network_update) {
80593         void* network_update_ptr = untag_ptr(network_update);
80594         CHECK_ACCESS(network_update_ptr);
80595         LDKCOption_NetworkUpdateZ network_update_conv = *(LDKCOption_NetworkUpdateZ*)(network_update_ptr);
80596         network_update_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)untag_ptr(network_update));
80597         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
80598         *ret_copy = PathFailure_on_path(network_update_conv);
80599         int64_t ret_ref = tag_ptr(ret_copy, true);
80600         return ret_ref;
80601 }
80602
80603 jboolean  CS_LDK_PathFailure_eq(int64_t a, int64_t b) {
80604         LDKPathFailure* a_conv = (LDKPathFailure*)untag_ptr(a);
80605         LDKPathFailure* b_conv = (LDKPathFailure*)untag_ptr(b);
80606         jboolean ret_conv = PathFailure_eq(a_conv, b_conv);
80607         return ret_conv;
80608 }
80609
80610 int8_tArray  CS_LDK_PathFailure_write(int64_t obj) {
80611         LDKPathFailure* obj_conv = (LDKPathFailure*)untag_ptr(obj);
80612         LDKCVec_u8Z ret_var = PathFailure_write(obj_conv);
80613         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
80614         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
80615         CVec_u8Z_free(ret_var);
80616         return ret_arr;
80617 }
80618
80619 int64_t  CS_LDK_PathFailure_read(int8_tArray ser) {
80620         LDKu8slice ser_ref;
80621         ser_ref.datalen = ser->arr_len;
80622         ser_ref.data = ser->elems;
80623         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
80624         *ret_conv = PathFailure_read(ser_ref);
80625         FREE(ser);
80626         return tag_ptr(ret_conv, true);
80627 }
80628
80629 void  CS_LDK_ClosureReason_free(int64_t this_ptr) {
80630         if (!ptr_is_owned(this_ptr)) return;
80631         void* this_ptr_ptr = untag_ptr(this_ptr);
80632         CHECK_ACCESS(this_ptr_ptr);
80633         LDKClosureReason this_ptr_conv = *(LDKClosureReason*)(this_ptr_ptr);
80634         FREE(untag_ptr(this_ptr));
80635         ClosureReason_free(this_ptr_conv);
80636 }
80637
80638 static inline uint64_t ClosureReason_clone_ptr(LDKClosureReason *NONNULL_PTR arg) {
80639         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
80640         *ret_copy = ClosureReason_clone(arg);
80641         int64_t ret_ref = tag_ptr(ret_copy, true);
80642         return ret_ref;
80643 }
80644 int64_t  CS_LDK_ClosureReason_clone_ptr(int64_t arg) {
80645         LDKClosureReason* arg_conv = (LDKClosureReason*)untag_ptr(arg);
80646         int64_t ret_conv = ClosureReason_clone_ptr(arg_conv);
80647         return ret_conv;
80648 }
80649
80650 int64_t  CS_LDK_ClosureReason_clone(int64_t orig) {
80651         LDKClosureReason* orig_conv = (LDKClosureReason*)untag_ptr(orig);
80652         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
80653         *ret_copy = ClosureReason_clone(orig_conv);
80654         int64_t ret_ref = tag_ptr(ret_copy, true);
80655         return ret_ref;
80656 }
80657
80658 int64_t  CS_LDK_ClosureReason_counterparty_force_closed(int64_t peer_msg) {
80659         LDKUntrustedString peer_msg_conv;
80660         peer_msg_conv.inner = untag_ptr(peer_msg);
80661         peer_msg_conv.is_owned = ptr_is_owned(peer_msg);
80662         CHECK_INNER_FIELD_ACCESS_OR_NULL(peer_msg_conv);
80663         peer_msg_conv = UntrustedString_clone(&peer_msg_conv);
80664         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
80665         *ret_copy = ClosureReason_counterparty_force_closed(peer_msg_conv);
80666         int64_t ret_ref = tag_ptr(ret_copy, true);
80667         return ret_ref;
80668 }
80669
80670 int64_t  CS_LDK_ClosureReason_holder_force_closed() {
80671         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
80672         *ret_copy = ClosureReason_holder_force_closed();
80673         int64_t ret_ref = tag_ptr(ret_copy, true);
80674         return ret_ref;
80675 }
80676
80677 int64_t  CS_LDK_ClosureReason_legacy_cooperative_closure() {
80678         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
80679         *ret_copy = ClosureReason_legacy_cooperative_closure();
80680         int64_t ret_ref = tag_ptr(ret_copy, true);
80681         return ret_ref;
80682 }
80683
80684 int64_t  CS_LDK_ClosureReason_counterparty_initiated_cooperative_closure() {
80685         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
80686         *ret_copy = ClosureReason_counterparty_initiated_cooperative_closure();
80687         int64_t ret_ref = tag_ptr(ret_copy, true);
80688         return ret_ref;
80689 }
80690
80691 int64_t  CS_LDK_ClosureReason_locally_initiated_cooperative_closure() {
80692         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
80693         *ret_copy = ClosureReason_locally_initiated_cooperative_closure();
80694         int64_t ret_ref = tag_ptr(ret_copy, true);
80695         return ret_ref;
80696 }
80697
80698 int64_t  CS_LDK_ClosureReason_commitment_tx_confirmed() {
80699         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
80700         *ret_copy = ClosureReason_commitment_tx_confirmed();
80701         int64_t ret_ref = tag_ptr(ret_copy, true);
80702         return ret_ref;
80703 }
80704
80705 int64_t  CS_LDK_ClosureReason_funding_timed_out() {
80706         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
80707         *ret_copy = ClosureReason_funding_timed_out();
80708         int64_t ret_ref = tag_ptr(ret_copy, true);
80709         return ret_ref;
80710 }
80711
80712 int64_t  CS_LDK_ClosureReason_processing_error(jstring err) {
80713         LDKStr err_conv = str_ref_to_owned_c(err);
80714         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
80715         *ret_copy = ClosureReason_processing_error(err_conv);
80716         int64_t ret_ref = tag_ptr(ret_copy, true);
80717         return ret_ref;
80718 }
80719
80720 int64_t  CS_LDK_ClosureReason_disconnected_peer() {
80721         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
80722         *ret_copy = ClosureReason_disconnected_peer();
80723         int64_t ret_ref = tag_ptr(ret_copy, true);
80724         return ret_ref;
80725 }
80726
80727 int64_t  CS_LDK_ClosureReason_outdated_channel_manager() {
80728         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
80729         *ret_copy = ClosureReason_outdated_channel_manager();
80730         int64_t ret_ref = tag_ptr(ret_copy, true);
80731         return ret_ref;
80732 }
80733
80734 int64_t  CS_LDK_ClosureReason_counterparty_coop_closed_unfunded_channel() {
80735         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
80736         *ret_copy = ClosureReason_counterparty_coop_closed_unfunded_channel();
80737         int64_t ret_ref = tag_ptr(ret_copy, true);
80738         return ret_ref;
80739 }
80740
80741 int64_t  CS_LDK_ClosureReason_funding_batch_closure() {
80742         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
80743         *ret_copy = ClosureReason_funding_batch_closure();
80744         int64_t ret_ref = tag_ptr(ret_copy, true);
80745         return ret_ref;
80746 }
80747
80748 int64_t  CS_LDK_ClosureReason_htlcs_timed_out() {
80749         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
80750         *ret_copy = ClosureReason_htlcs_timed_out();
80751         int64_t ret_ref = tag_ptr(ret_copy, true);
80752         return ret_ref;
80753 }
80754
80755 jboolean  CS_LDK_ClosureReason_eq(int64_t a, int64_t b) {
80756         LDKClosureReason* a_conv = (LDKClosureReason*)untag_ptr(a);
80757         LDKClosureReason* b_conv = (LDKClosureReason*)untag_ptr(b);
80758         jboolean ret_conv = ClosureReason_eq(a_conv, b_conv);
80759         return ret_conv;
80760 }
80761
80762 jstring  CS_LDK_ClosureReason_to_str(int64_t o) {
80763         LDKClosureReason* o_conv = (LDKClosureReason*)untag_ptr(o);
80764         LDKStr ret_str = ClosureReason_to_str(o_conv);
80765         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
80766         Str_free(ret_str);
80767         return ret_conv;
80768 }
80769
80770 int8_tArray  CS_LDK_ClosureReason_write(int64_t obj) {
80771         LDKClosureReason* obj_conv = (LDKClosureReason*)untag_ptr(obj);
80772         LDKCVec_u8Z ret_var = ClosureReason_write(obj_conv);
80773         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
80774         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
80775         CVec_u8Z_free(ret_var);
80776         return ret_arr;
80777 }
80778
80779 int64_t  CS_LDK_ClosureReason_read(int8_tArray ser) {
80780         LDKu8slice ser_ref;
80781         ser_ref.datalen = ser->arr_len;
80782         ser_ref.data = ser->elems;
80783         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
80784         *ret_conv = ClosureReason_read(ser_ref);
80785         FREE(ser);
80786         return tag_ptr(ret_conv, true);
80787 }
80788
80789 void  CS_LDK_HTLCDestination_free(int64_t this_ptr) {
80790         if (!ptr_is_owned(this_ptr)) return;
80791         void* this_ptr_ptr = untag_ptr(this_ptr);
80792         CHECK_ACCESS(this_ptr_ptr);
80793         LDKHTLCDestination this_ptr_conv = *(LDKHTLCDestination*)(this_ptr_ptr);
80794         FREE(untag_ptr(this_ptr));
80795         HTLCDestination_free(this_ptr_conv);
80796 }
80797
80798 static inline uint64_t HTLCDestination_clone_ptr(LDKHTLCDestination *NONNULL_PTR arg) {
80799         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
80800         *ret_copy = HTLCDestination_clone(arg);
80801         int64_t ret_ref = tag_ptr(ret_copy, true);
80802         return ret_ref;
80803 }
80804 int64_t  CS_LDK_HTLCDestination_clone_ptr(int64_t arg) {
80805         LDKHTLCDestination* arg_conv = (LDKHTLCDestination*)untag_ptr(arg);
80806         int64_t ret_conv = HTLCDestination_clone_ptr(arg_conv);
80807         return ret_conv;
80808 }
80809
80810 int64_t  CS_LDK_HTLCDestination_clone(int64_t orig) {
80811         LDKHTLCDestination* orig_conv = (LDKHTLCDestination*)untag_ptr(orig);
80812         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
80813         *ret_copy = HTLCDestination_clone(orig_conv);
80814         int64_t ret_ref = tag_ptr(ret_copy, true);
80815         return ret_ref;
80816 }
80817
80818 int64_t  CS_LDK_HTLCDestination_next_hop_channel(int8_tArray node_id, int64_t channel_id) {
80819         LDKPublicKey node_id_ref;
80820         CHECK(node_id->arr_len == 33);
80821         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
80822         LDKChannelId channel_id_conv;
80823         channel_id_conv.inner = untag_ptr(channel_id);
80824         channel_id_conv.is_owned = ptr_is_owned(channel_id);
80825         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
80826         channel_id_conv = ChannelId_clone(&channel_id_conv);
80827         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
80828         *ret_copy = HTLCDestination_next_hop_channel(node_id_ref, channel_id_conv);
80829         int64_t ret_ref = tag_ptr(ret_copy, true);
80830         return ret_ref;
80831 }
80832
80833 int64_t  CS_LDK_HTLCDestination_unknown_next_hop(int64_t requested_forward_scid) {
80834         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
80835         *ret_copy = HTLCDestination_unknown_next_hop(requested_forward_scid);
80836         int64_t ret_ref = tag_ptr(ret_copy, true);
80837         return ret_ref;
80838 }
80839
80840 int64_t  CS_LDK_HTLCDestination_invalid_forward(int64_t requested_forward_scid) {
80841         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
80842         *ret_copy = HTLCDestination_invalid_forward(requested_forward_scid);
80843         int64_t ret_ref = tag_ptr(ret_copy, true);
80844         return ret_ref;
80845 }
80846
80847 int64_t  CS_LDK_HTLCDestination_invalid_onion() {
80848         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
80849         *ret_copy = HTLCDestination_invalid_onion();
80850         int64_t ret_ref = tag_ptr(ret_copy, true);
80851         return ret_ref;
80852 }
80853
80854 int64_t  CS_LDK_HTLCDestination_failed_payment(int8_tArray payment_hash) {
80855         LDKThirtyTwoBytes payment_hash_ref;
80856         CHECK(payment_hash->arr_len == 32);
80857         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
80858         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
80859         *ret_copy = HTLCDestination_failed_payment(payment_hash_ref);
80860         int64_t ret_ref = tag_ptr(ret_copy, true);
80861         return ret_ref;
80862 }
80863
80864 jboolean  CS_LDK_HTLCDestination_eq(int64_t a, int64_t b) {
80865         LDKHTLCDestination* a_conv = (LDKHTLCDestination*)untag_ptr(a);
80866         LDKHTLCDestination* b_conv = (LDKHTLCDestination*)untag_ptr(b);
80867         jboolean ret_conv = HTLCDestination_eq(a_conv, b_conv);
80868         return ret_conv;
80869 }
80870
80871 int8_tArray  CS_LDK_HTLCDestination_write(int64_t obj) {
80872         LDKHTLCDestination* obj_conv = (LDKHTLCDestination*)untag_ptr(obj);
80873         LDKCVec_u8Z ret_var = HTLCDestination_write(obj_conv);
80874         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
80875         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
80876         CVec_u8Z_free(ret_var);
80877         return ret_arr;
80878 }
80879
80880 int64_t  CS_LDK_HTLCDestination_read(int8_tArray ser) {
80881         LDKu8slice ser_ref;
80882         ser_ref.datalen = ser->arr_len;
80883         ser_ref.data = ser->elems;
80884         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
80885         *ret_conv = HTLCDestination_read(ser_ref);
80886         FREE(ser);
80887         return tag_ptr(ret_conv, true);
80888 }
80889
80890 int32_t  CS_LDK_PaymentFailureReason_clone(int64_t orig) {
80891         LDKPaymentFailureReason* orig_conv = (LDKPaymentFailureReason*)untag_ptr(orig);
80892         int32_t ret_conv = LDKPaymentFailureReason_to_cs(PaymentFailureReason_clone(orig_conv));
80893         return ret_conv;
80894 }
80895
80896 int32_t  CS_LDK_PaymentFailureReason_recipient_rejected() {
80897         int32_t ret_conv = LDKPaymentFailureReason_to_cs(PaymentFailureReason_recipient_rejected());
80898         return ret_conv;
80899 }
80900
80901 int32_t  CS_LDK_PaymentFailureReason_user_abandoned() {
80902         int32_t ret_conv = LDKPaymentFailureReason_to_cs(PaymentFailureReason_user_abandoned());
80903         return ret_conv;
80904 }
80905
80906 int32_t  CS_LDK_PaymentFailureReason_retries_exhausted() {
80907         int32_t ret_conv = LDKPaymentFailureReason_to_cs(PaymentFailureReason_retries_exhausted());
80908         return ret_conv;
80909 }
80910
80911 int32_t  CS_LDK_PaymentFailureReason_payment_expired() {
80912         int32_t ret_conv = LDKPaymentFailureReason_to_cs(PaymentFailureReason_payment_expired());
80913         return ret_conv;
80914 }
80915
80916 int32_t  CS_LDK_PaymentFailureReason_route_not_found() {
80917         int32_t ret_conv = LDKPaymentFailureReason_to_cs(PaymentFailureReason_route_not_found());
80918         return ret_conv;
80919 }
80920
80921 int32_t  CS_LDK_PaymentFailureReason_unexpected_error() {
80922         int32_t ret_conv = LDKPaymentFailureReason_to_cs(PaymentFailureReason_unexpected_error());
80923         return ret_conv;
80924 }
80925
80926 jboolean  CS_LDK_PaymentFailureReason_eq(int64_t a, int64_t b) {
80927         LDKPaymentFailureReason* a_conv = (LDKPaymentFailureReason*)untag_ptr(a);
80928         LDKPaymentFailureReason* b_conv = (LDKPaymentFailureReason*)untag_ptr(b);
80929         jboolean ret_conv = PaymentFailureReason_eq(a_conv, b_conv);
80930         return ret_conv;
80931 }
80932
80933 int8_tArray  CS_LDK_PaymentFailureReason_write(int64_t obj) {
80934         LDKPaymentFailureReason* obj_conv = (LDKPaymentFailureReason*)untag_ptr(obj);
80935         LDKCVec_u8Z ret_var = PaymentFailureReason_write(obj_conv);
80936         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
80937         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
80938         CVec_u8Z_free(ret_var);
80939         return ret_arr;
80940 }
80941
80942 int64_t  CS_LDK_PaymentFailureReason_read(int8_tArray ser) {
80943         LDKu8slice ser_ref;
80944         ser_ref.datalen = ser->arr_len;
80945         ser_ref.data = ser->elems;
80946         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
80947         *ret_conv = PaymentFailureReason_read(ser_ref);
80948         FREE(ser);
80949         return tag_ptr(ret_conv, true);
80950 }
80951
80952 void  CS_LDK_Event_free(int64_t this_ptr) {
80953         if (!ptr_is_owned(this_ptr)) return;
80954         void* this_ptr_ptr = untag_ptr(this_ptr);
80955         CHECK_ACCESS(this_ptr_ptr);
80956         LDKEvent this_ptr_conv = *(LDKEvent*)(this_ptr_ptr);
80957         FREE(untag_ptr(this_ptr));
80958         Event_free(this_ptr_conv);
80959 }
80960
80961 static inline uint64_t Event_clone_ptr(LDKEvent *NONNULL_PTR arg) {
80962         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
80963         *ret_copy = Event_clone(arg);
80964         int64_t ret_ref = tag_ptr(ret_copy, true);
80965         return ret_ref;
80966 }
80967 int64_t  CS_LDK_Event_clone_ptr(int64_t arg) {
80968         LDKEvent* arg_conv = (LDKEvent*)untag_ptr(arg);
80969         int64_t ret_conv = Event_clone_ptr(arg_conv);
80970         return ret_conv;
80971 }
80972
80973 int64_t  CS_LDK_Event_clone(int64_t orig) {
80974         LDKEvent* orig_conv = (LDKEvent*)untag_ptr(orig);
80975         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
80976         *ret_copy = Event_clone(orig_conv);
80977         int64_t ret_ref = tag_ptr(ret_copy, true);
80978         return ret_ref;
80979 }
80980
80981 int64_t  CS_LDK_Event_funding_generation_ready(int64_t temporary_channel_id, int8_tArray counterparty_node_id, int64_t channel_value_satoshis, int8_tArray output_script, int8_tArray user_channel_id) {
80982         LDKChannelId temporary_channel_id_conv;
80983         temporary_channel_id_conv.inner = untag_ptr(temporary_channel_id);
80984         temporary_channel_id_conv.is_owned = ptr_is_owned(temporary_channel_id);
80985         CHECK_INNER_FIELD_ACCESS_OR_NULL(temporary_channel_id_conv);
80986         temporary_channel_id_conv = ChannelId_clone(&temporary_channel_id_conv);
80987         LDKPublicKey counterparty_node_id_ref;
80988         CHECK(counterparty_node_id->arr_len == 33);
80989         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
80990         LDKCVec_u8Z output_script_ref;
80991         output_script_ref.datalen = output_script->arr_len;
80992         output_script_ref.data = MALLOC(output_script_ref.datalen, "LDKCVec_u8Z Bytes");
80993         memcpy(output_script_ref.data, output_script->elems, output_script_ref.datalen); FREE(output_script);
80994         LDKU128 user_channel_id_ref;
80995         CHECK(user_channel_id->arr_len == 16);
80996         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
80997         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
80998         *ret_copy = Event_funding_generation_ready(temporary_channel_id_conv, counterparty_node_id_ref, channel_value_satoshis, output_script_ref, user_channel_id_ref);
80999         int64_t ret_ref = tag_ptr(ret_copy, true);
81000         return ret_ref;
81001 }
81002
81003 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) {
81004         LDKPublicKey receiver_node_id_ref;
81005         CHECK(receiver_node_id->arr_len == 33);
81006         memcpy(receiver_node_id_ref.compressed_form, receiver_node_id->elems, 33); FREE(receiver_node_id);
81007         LDKThirtyTwoBytes payment_hash_ref;
81008         CHECK(payment_hash->arr_len == 32);
81009         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
81010         LDKRecipientOnionFields onion_fields_conv;
81011         onion_fields_conv.inner = untag_ptr(onion_fields);
81012         onion_fields_conv.is_owned = ptr_is_owned(onion_fields);
81013         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_fields_conv);
81014         onion_fields_conv = RecipientOnionFields_clone(&onion_fields_conv);
81015         void* purpose_ptr = untag_ptr(purpose);
81016         CHECK_ACCESS(purpose_ptr);
81017         LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
81018         purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(purpose));
81019         LDKChannelId via_channel_id_conv;
81020         via_channel_id_conv.inner = untag_ptr(via_channel_id);
81021         via_channel_id_conv.is_owned = ptr_is_owned(via_channel_id);
81022         CHECK_INNER_FIELD_ACCESS_OR_NULL(via_channel_id_conv);
81023         via_channel_id_conv = ChannelId_clone(&via_channel_id_conv);
81024         void* via_user_channel_id_ptr = untag_ptr(via_user_channel_id);
81025         CHECK_ACCESS(via_user_channel_id_ptr);
81026         LDKCOption_U128Z via_user_channel_id_conv = *(LDKCOption_U128Z*)(via_user_channel_id_ptr);
81027         via_user_channel_id_conv = COption_U128Z_clone((LDKCOption_U128Z*)untag_ptr(via_user_channel_id));
81028         void* claim_deadline_ptr = untag_ptr(claim_deadline);
81029         CHECK_ACCESS(claim_deadline_ptr);
81030         LDKCOption_u32Z claim_deadline_conv = *(LDKCOption_u32Z*)(claim_deadline_ptr);
81031         claim_deadline_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(claim_deadline));
81032         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
81033         *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);
81034         int64_t ret_ref = tag_ptr(ret_copy, true);
81035         return ret_ref;
81036 }
81037
81038 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) {
81039         LDKPublicKey receiver_node_id_ref;
81040         CHECK(receiver_node_id->arr_len == 33);
81041         memcpy(receiver_node_id_ref.compressed_form, receiver_node_id->elems, 33); FREE(receiver_node_id);
81042         LDKThirtyTwoBytes payment_hash_ref;
81043         CHECK(payment_hash->arr_len == 32);
81044         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
81045         void* purpose_ptr = untag_ptr(purpose);
81046         CHECK_ACCESS(purpose_ptr);
81047         LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
81048         purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(purpose));
81049         LDKCVec_ClaimedHTLCZ htlcs_constr;
81050         htlcs_constr.datalen = htlcs->arr_len;
81051         if (htlcs_constr.datalen > 0)
81052                 htlcs_constr.data = MALLOC(htlcs_constr.datalen * sizeof(LDKClaimedHTLC), "LDKCVec_ClaimedHTLCZ Elements");
81053         else
81054                 htlcs_constr.data = NULL;
81055         int64_t* htlcs_vals = htlcs->elems;
81056         for (size_t n = 0; n < htlcs_constr.datalen; n++) {
81057                 int64_t htlcs_conv_13 = htlcs_vals[n];
81058                 LDKClaimedHTLC htlcs_conv_13_conv;
81059                 htlcs_conv_13_conv.inner = untag_ptr(htlcs_conv_13);
81060                 htlcs_conv_13_conv.is_owned = ptr_is_owned(htlcs_conv_13);
81061                 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlcs_conv_13_conv);
81062                 htlcs_conv_13_conv = ClaimedHTLC_clone(&htlcs_conv_13_conv);
81063                 htlcs_constr.data[n] = htlcs_conv_13_conv;
81064         }
81065         FREE(htlcs);
81066         void* sender_intended_total_msat_ptr = untag_ptr(sender_intended_total_msat);
81067         CHECK_ACCESS(sender_intended_total_msat_ptr);
81068         LDKCOption_u64Z sender_intended_total_msat_conv = *(LDKCOption_u64Z*)(sender_intended_total_msat_ptr);
81069         sender_intended_total_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(sender_intended_total_msat));
81070         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
81071         *ret_copy = Event_payment_claimed(receiver_node_id_ref, payment_hash_ref, amount_msat, purpose_conv, htlcs_constr, sender_intended_total_msat_conv);
81072         int64_t ret_ref = tag_ptr(ret_copy, true);
81073         return ret_ref;
81074 }
81075
81076 int64_t  CS_LDK_Event_connection_needed(int8_tArray node_id, int64_tArray addresses) {
81077         LDKPublicKey node_id_ref;
81078         CHECK(node_id->arr_len == 33);
81079         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
81080         LDKCVec_SocketAddressZ addresses_constr;
81081         addresses_constr.datalen = addresses->arr_len;
81082         if (addresses_constr.datalen > 0)
81083                 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
81084         else
81085                 addresses_constr.data = NULL;
81086         int64_t* addresses_vals = addresses->elems;
81087         for (size_t p = 0; p < addresses_constr.datalen; p++) {
81088                 int64_t addresses_conv_15 = addresses_vals[p];
81089                 void* addresses_conv_15_ptr = untag_ptr(addresses_conv_15);
81090                 CHECK_ACCESS(addresses_conv_15_ptr);
81091                 LDKSocketAddress addresses_conv_15_conv = *(LDKSocketAddress*)(addresses_conv_15_ptr);
81092                 addresses_constr.data[p] = addresses_conv_15_conv;
81093         }
81094         FREE(addresses);
81095         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
81096         *ret_copy = Event_connection_needed(node_id_ref, addresses_constr);
81097         int64_t ret_ref = tag_ptr(ret_copy, true);
81098         return ret_ref;
81099 }
81100
81101 int64_t  CS_LDK_Event_invoice_request_failed(int8_tArray payment_id) {
81102         LDKThirtyTwoBytes payment_id_ref;
81103         CHECK(payment_id->arr_len == 32);
81104         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
81105         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
81106         *ret_copy = Event_invoice_request_failed(payment_id_ref);
81107         int64_t ret_ref = tag_ptr(ret_copy, true);
81108         return ret_ref;
81109 }
81110
81111 int64_t  CS_LDK_Event_payment_sent(int64_t payment_id, int8_tArray payment_preimage, int8_tArray payment_hash, int64_t fee_paid_msat) {
81112         void* payment_id_ptr = untag_ptr(payment_id);
81113         CHECK_ACCESS(payment_id_ptr);
81114         LDKCOption_ThirtyTwoBytesZ payment_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_id_ptr);
81115         payment_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_id));
81116         LDKThirtyTwoBytes payment_preimage_ref;
81117         CHECK(payment_preimage->arr_len == 32);
81118         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
81119         LDKThirtyTwoBytes payment_hash_ref;
81120         CHECK(payment_hash->arr_len == 32);
81121         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
81122         void* fee_paid_msat_ptr = untag_ptr(fee_paid_msat);
81123         CHECK_ACCESS(fee_paid_msat_ptr);
81124         LDKCOption_u64Z fee_paid_msat_conv = *(LDKCOption_u64Z*)(fee_paid_msat_ptr);
81125         fee_paid_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(fee_paid_msat));
81126         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
81127         *ret_copy = Event_payment_sent(payment_id_conv, payment_preimage_ref, payment_hash_ref, fee_paid_msat_conv);
81128         int64_t ret_ref = tag_ptr(ret_copy, true);
81129         return ret_ref;
81130 }
81131
81132 int64_t  CS_LDK_Event_payment_failed(int8_tArray payment_id, int8_tArray payment_hash, int64_t reason) {
81133         LDKThirtyTwoBytes payment_id_ref;
81134         CHECK(payment_id->arr_len == 32);
81135         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
81136         LDKThirtyTwoBytes payment_hash_ref;
81137         CHECK(payment_hash->arr_len == 32);
81138         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
81139         void* reason_ptr = untag_ptr(reason);
81140         CHECK_ACCESS(reason_ptr);
81141         LDKCOption_PaymentFailureReasonZ reason_conv = *(LDKCOption_PaymentFailureReasonZ*)(reason_ptr);
81142         reason_conv = COption_PaymentFailureReasonZ_clone((LDKCOption_PaymentFailureReasonZ*)untag_ptr(reason));
81143         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
81144         *ret_copy = Event_payment_failed(payment_id_ref, payment_hash_ref, reason_conv);
81145         int64_t ret_ref = tag_ptr(ret_copy, true);
81146         return ret_ref;
81147 }
81148
81149 int64_t  CS_LDK_Event_payment_path_successful(int8_tArray payment_id, int64_t payment_hash, int64_t path) {
81150         LDKThirtyTwoBytes payment_id_ref;
81151         CHECK(payment_id->arr_len == 32);
81152         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
81153         void* payment_hash_ptr = untag_ptr(payment_hash);
81154         CHECK_ACCESS(payment_hash_ptr);
81155         LDKCOption_ThirtyTwoBytesZ payment_hash_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_hash_ptr);
81156         payment_hash_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_hash));
81157         LDKPath path_conv;
81158         path_conv.inner = untag_ptr(path);
81159         path_conv.is_owned = ptr_is_owned(path);
81160         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
81161         path_conv = Path_clone(&path_conv);
81162         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
81163         *ret_copy = Event_payment_path_successful(payment_id_ref, payment_hash_conv, path_conv);
81164         int64_t ret_ref = tag_ptr(ret_copy, true);
81165         return ret_ref;
81166 }
81167
81168 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) {
81169         void* payment_id_ptr = untag_ptr(payment_id);
81170         CHECK_ACCESS(payment_id_ptr);
81171         LDKCOption_ThirtyTwoBytesZ payment_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_id_ptr);
81172         payment_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_id));
81173         LDKThirtyTwoBytes payment_hash_ref;
81174         CHECK(payment_hash->arr_len == 32);
81175         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
81176         void* failure_ptr = untag_ptr(failure);
81177         CHECK_ACCESS(failure_ptr);
81178         LDKPathFailure failure_conv = *(LDKPathFailure*)(failure_ptr);
81179         failure_conv = PathFailure_clone((LDKPathFailure*)untag_ptr(failure));
81180         LDKPath path_conv;
81181         path_conv.inner = untag_ptr(path);
81182         path_conv.is_owned = ptr_is_owned(path);
81183         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
81184         path_conv = Path_clone(&path_conv);
81185         void* short_channel_id_ptr = untag_ptr(short_channel_id);
81186         CHECK_ACCESS(short_channel_id_ptr);
81187         LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
81188         short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id));
81189         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
81190         *ret_copy = Event_payment_path_failed(payment_id_conv, payment_hash_ref, payment_failed_permanently, failure_conv, path_conv, short_channel_id_conv);
81191         int64_t ret_ref = tag_ptr(ret_copy, true);
81192         return ret_ref;
81193 }
81194
81195 int64_t  CS_LDK_Event_probe_successful(int8_tArray payment_id, int8_tArray payment_hash, int64_t path) {
81196         LDKThirtyTwoBytes payment_id_ref;
81197         CHECK(payment_id->arr_len == 32);
81198         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
81199         LDKThirtyTwoBytes payment_hash_ref;
81200         CHECK(payment_hash->arr_len == 32);
81201         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
81202         LDKPath path_conv;
81203         path_conv.inner = untag_ptr(path);
81204         path_conv.is_owned = ptr_is_owned(path);
81205         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
81206         path_conv = Path_clone(&path_conv);
81207         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
81208         *ret_copy = Event_probe_successful(payment_id_ref, payment_hash_ref, path_conv);
81209         int64_t ret_ref = tag_ptr(ret_copy, true);
81210         return ret_ref;
81211 }
81212
81213 int64_t  CS_LDK_Event_probe_failed(int8_tArray payment_id, int8_tArray payment_hash, int64_t path, int64_t short_channel_id) {
81214         LDKThirtyTwoBytes payment_id_ref;
81215         CHECK(payment_id->arr_len == 32);
81216         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
81217         LDKThirtyTwoBytes payment_hash_ref;
81218         CHECK(payment_hash->arr_len == 32);
81219         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
81220         LDKPath path_conv;
81221         path_conv.inner = untag_ptr(path);
81222         path_conv.is_owned = ptr_is_owned(path);
81223         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
81224         path_conv = Path_clone(&path_conv);
81225         void* short_channel_id_ptr = untag_ptr(short_channel_id);
81226         CHECK_ACCESS(short_channel_id_ptr);
81227         LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
81228         short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id));
81229         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
81230         *ret_copy = Event_probe_failed(payment_id_ref, payment_hash_ref, path_conv, short_channel_id_conv);
81231         int64_t ret_ref = tag_ptr(ret_copy, true);
81232         return ret_ref;
81233 }
81234
81235 int64_t  CS_LDK_Event_pending_htlcs_forwardable(int64_t time_forwardable) {
81236         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
81237         *ret_copy = Event_pending_htlcs_forwardable(time_forwardable);
81238         int64_t ret_ref = tag_ptr(ret_copy, true);
81239         return ret_ref;
81240 }
81241
81242 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) {
81243         LDKThirtyTwoBytes intercept_id_ref;
81244         CHECK(intercept_id->arr_len == 32);
81245         memcpy(intercept_id_ref.data, intercept_id->elems, 32); FREE(intercept_id);
81246         LDKThirtyTwoBytes payment_hash_ref;
81247         CHECK(payment_hash->arr_len == 32);
81248         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
81249         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
81250         *ret_copy = Event_htlcintercepted(intercept_id_ref, requested_next_hop_scid, payment_hash_ref, inbound_amount_msat, expected_outbound_amount_msat);
81251         int64_t ret_ref = tag_ptr(ret_copy, true);
81252         return ret_ref;
81253 }
81254
81255 int64_t  CS_LDK_Event_spendable_outputs(int64_tArray outputs, int64_t channel_id) {
81256         LDKCVec_SpendableOutputDescriptorZ outputs_constr;
81257         outputs_constr.datalen = outputs->arr_len;
81258         if (outputs_constr.datalen > 0)
81259                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
81260         else
81261                 outputs_constr.data = NULL;
81262         int64_t* outputs_vals = outputs->elems;
81263         for (size_t b = 0; b < outputs_constr.datalen; b++) {
81264                 int64_t outputs_conv_27 = outputs_vals[b];
81265                 void* outputs_conv_27_ptr = untag_ptr(outputs_conv_27);
81266                 CHECK_ACCESS(outputs_conv_27_ptr);
81267                 LDKSpendableOutputDescriptor outputs_conv_27_conv = *(LDKSpendableOutputDescriptor*)(outputs_conv_27_ptr);
81268                 outputs_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(outputs_conv_27));
81269                 outputs_constr.data[b] = outputs_conv_27_conv;
81270         }
81271         FREE(outputs);
81272         LDKChannelId channel_id_conv;
81273         channel_id_conv.inner = untag_ptr(channel_id);
81274         channel_id_conv.is_owned = ptr_is_owned(channel_id);
81275         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
81276         channel_id_conv = ChannelId_clone(&channel_id_conv);
81277         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
81278         *ret_copy = Event_spendable_outputs(outputs_constr, channel_id_conv);
81279         int64_t ret_ref = tag_ptr(ret_copy, true);
81280         return ret_ref;
81281 }
81282
81283 int64_t  CS_LDK_Event_payment_forwarded(int64_t prev_channel_id, int64_t next_channel_id, int64_t prev_user_channel_id, int64_t next_user_channel_id, int64_t total_fee_earned_msat, int64_t skimmed_fee_msat, jboolean claim_from_onchain_tx, int64_t outbound_amount_forwarded_msat) {
81284         LDKChannelId prev_channel_id_conv;
81285         prev_channel_id_conv.inner = untag_ptr(prev_channel_id);
81286         prev_channel_id_conv.is_owned = ptr_is_owned(prev_channel_id);
81287         CHECK_INNER_FIELD_ACCESS_OR_NULL(prev_channel_id_conv);
81288         prev_channel_id_conv = ChannelId_clone(&prev_channel_id_conv);
81289         LDKChannelId next_channel_id_conv;
81290         next_channel_id_conv.inner = untag_ptr(next_channel_id);
81291         next_channel_id_conv.is_owned = ptr_is_owned(next_channel_id);
81292         CHECK_INNER_FIELD_ACCESS_OR_NULL(next_channel_id_conv);
81293         next_channel_id_conv = ChannelId_clone(&next_channel_id_conv);
81294         void* prev_user_channel_id_ptr = untag_ptr(prev_user_channel_id);
81295         CHECK_ACCESS(prev_user_channel_id_ptr);
81296         LDKCOption_U128Z prev_user_channel_id_conv = *(LDKCOption_U128Z*)(prev_user_channel_id_ptr);
81297         prev_user_channel_id_conv = COption_U128Z_clone((LDKCOption_U128Z*)untag_ptr(prev_user_channel_id));
81298         void* next_user_channel_id_ptr = untag_ptr(next_user_channel_id);
81299         CHECK_ACCESS(next_user_channel_id_ptr);
81300         LDKCOption_U128Z next_user_channel_id_conv = *(LDKCOption_U128Z*)(next_user_channel_id_ptr);
81301         next_user_channel_id_conv = COption_U128Z_clone((LDKCOption_U128Z*)untag_ptr(next_user_channel_id));
81302         void* total_fee_earned_msat_ptr = untag_ptr(total_fee_earned_msat);
81303         CHECK_ACCESS(total_fee_earned_msat_ptr);
81304         LDKCOption_u64Z total_fee_earned_msat_conv = *(LDKCOption_u64Z*)(total_fee_earned_msat_ptr);
81305         total_fee_earned_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(total_fee_earned_msat));
81306         void* skimmed_fee_msat_ptr = untag_ptr(skimmed_fee_msat);
81307         CHECK_ACCESS(skimmed_fee_msat_ptr);
81308         LDKCOption_u64Z skimmed_fee_msat_conv = *(LDKCOption_u64Z*)(skimmed_fee_msat_ptr);
81309         skimmed_fee_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(skimmed_fee_msat));
81310         void* outbound_amount_forwarded_msat_ptr = untag_ptr(outbound_amount_forwarded_msat);
81311         CHECK_ACCESS(outbound_amount_forwarded_msat_ptr);
81312         LDKCOption_u64Z outbound_amount_forwarded_msat_conv = *(LDKCOption_u64Z*)(outbound_amount_forwarded_msat_ptr);
81313         outbound_amount_forwarded_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_amount_forwarded_msat));
81314         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
81315         *ret_copy = Event_payment_forwarded(prev_channel_id_conv, next_channel_id_conv, prev_user_channel_id_conv, next_user_channel_id_conv, total_fee_earned_msat_conv, skimmed_fee_msat_conv, claim_from_onchain_tx, outbound_amount_forwarded_msat_conv);
81316         int64_t ret_ref = tag_ptr(ret_copy, true);
81317         return ret_ref;
81318 }
81319
81320 int64_t  CS_LDK_Event_channel_pending(int64_t channel_id, int8_tArray user_channel_id, int64_t former_temporary_channel_id, int8_tArray counterparty_node_id, int64_t funding_txo, int64_t channel_type) {
81321         LDKChannelId channel_id_conv;
81322         channel_id_conv.inner = untag_ptr(channel_id);
81323         channel_id_conv.is_owned = ptr_is_owned(channel_id);
81324         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
81325         channel_id_conv = ChannelId_clone(&channel_id_conv);
81326         LDKU128 user_channel_id_ref;
81327         CHECK(user_channel_id->arr_len == 16);
81328         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
81329         LDKChannelId former_temporary_channel_id_conv;
81330         former_temporary_channel_id_conv.inner = untag_ptr(former_temporary_channel_id);
81331         former_temporary_channel_id_conv.is_owned = ptr_is_owned(former_temporary_channel_id);
81332         CHECK_INNER_FIELD_ACCESS_OR_NULL(former_temporary_channel_id_conv);
81333         former_temporary_channel_id_conv = ChannelId_clone(&former_temporary_channel_id_conv);
81334         LDKPublicKey counterparty_node_id_ref;
81335         CHECK(counterparty_node_id->arr_len == 33);
81336         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
81337         LDKOutPoint funding_txo_conv;
81338         funding_txo_conv.inner = untag_ptr(funding_txo);
81339         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
81340         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
81341         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
81342         LDKChannelTypeFeatures channel_type_conv;
81343         channel_type_conv.inner = untag_ptr(channel_type);
81344         channel_type_conv.is_owned = ptr_is_owned(channel_type);
81345         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_conv);
81346         channel_type_conv = ChannelTypeFeatures_clone(&channel_type_conv);
81347         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
81348         *ret_copy = Event_channel_pending(channel_id_conv, user_channel_id_ref, former_temporary_channel_id_conv, counterparty_node_id_ref, funding_txo_conv, channel_type_conv);
81349         int64_t ret_ref = tag_ptr(ret_copy, true);
81350         return ret_ref;
81351 }
81352
81353 int64_t  CS_LDK_Event_channel_ready(int64_t channel_id, int8_tArray user_channel_id, int8_tArray counterparty_node_id, int64_t channel_type) {
81354         LDKChannelId channel_id_conv;
81355         channel_id_conv.inner = untag_ptr(channel_id);
81356         channel_id_conv.is_owned = ptr_is_owned(channel_id);
81357         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
81358         channel_id_conv = ChannelId_clone(&channel_id_conv);
81359         LDKU128 user_channel_id_ref;
81360         CHECK(user_channel_id->arr_len == 16);
81361         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
81362         LDKPublicKey counterparty_node_id_ref;
81363         CHECK(counterparty_node_id->arr_len == 33);
81364         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
81365         LDKChannelTypeFeatures channel_type_conv;
81366         channel_type_conv.inner = untag_ptr(channel_type);
81367         channel_type_conv.is_owned = ptr_is_owned(channel_type);
81368         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_conv);
81369         channel_type_conv = ChannelTypeFeatures_clone(&channel_type_conv);
81370         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
81371         *ret_copy = Event_channel_ready(channel_id_conv, user_channel_id_ref, counterparty_node_id_ref, channel_type_conv);
81372         int64_t ret_ref = tag_ptr(ret_copy, true);
81373         return ret_ref;
81374 }
81375
81376 int64_t  CS_LDK_Event_channel_closed(int64_t 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) {
81377         LDKChannelId channel_id_conv;
81378         channel_id_conv.inner = untag_ptr(channel_id);
81379         channel_id_conv.is_owned = ptr_is_owned(channel_id);
81380         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
81381         channel_id_conv = ChannelId_clone(&channel_id_conv);
81382         LDKU128 user_channel_id_ref;
81383         CHECK(user_channel_id->arr_len == 16);
81384         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
81385         void* reason_ptr = untag_ptr(reason);
81386         CHECK_ACCESS(reason_ptr);
81387         LDKClosureReason reason_conv = *(LDKClosureReason*)(reason_ptr);
81388         reason_conv = ClosureReason_clone((LDKClosureReason*)untag_ptr(reason));
81389         LDKPublicKey counterparty_node_id_ref;
81390         CHECK(counterparty_node_id->arr_len == 33);
81391         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
81392         void* channel_capacity_sats_ptr = untag_ptr(channel_capacity_sats);
81393         CHECK_ACCESS(channel_capacity_sats_ptr);
81394         LDKCOption_u64Z channel_capacity_sats_conv = *(LDKCOption_u64Z*)(channel_capacity_sats_ptr);
81395         channel_capacity_sats_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(channel_capacity_sats));
81396         LDKOutPoint channel_funding_txo_conv;
81397         channel_funding_txo_conv.inner = untag_ptr(channel_funding_txo);
81398         channel_funding_txo_conv.is_owned = ptr_is_owned(channel_funding_txo);
81399         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_funding_txo_conv);
81400         channel_funding_txo_conv = OutPoint_clone(&channel_funding_txo_conv);
81401         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
81402         *ret_copy = Event_channel_closed(channel_id_conv, user_channel_id_ref, reason_conv, counterparty_node_id_ref, channel_capacity_sats_conv, channel_funding_txo_conv);
81403         int64_t ret_ref = tag_ptr(ret_copy, true);
81404         return ret_ref;
81405 }
81406
81407 int64_t  CS_LDK_Event_discard_funding(int64_t channel_id, int8_tArray transaction) {
81408         LDKChannelId channel_id_conv;
81409         channel_id_conv.inner = untag_ptr(channel_id);
81410         channel_id_conv.is_owned = ptr_is_owned(channel_id);
81411         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
81412         channel_id_conv = ChannelId_clone(&channel_id_conv);
81413         LDKTransaction transaction_ref;
81414         transaction_ref.datalen = transaction->arr_len;
81415         transaction_ref.data = MALLOC(transaction_ref.datalen, "LDKTransaction Bytes");
81416         memcpy(transaction_ref.data, transaction->elems, transaction_ref.datalen); FREE(transaction);
81417         transaction_ref.data_is_owned = true;
81418         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
81419         *ret_copy = Event_discard_funding(channel_id_conv, transaction_ref);
81420         int64_t ret_ref = tag_ptr(ret_copy, true);
81421         return ret_ref;
81422 }
81423
81424 int64_t  CS_LDK_Event_open_channel_request(int64_t temporary_channel_id, int8_tArray counterparty_node_id, int64_t funding_satoshis, int64_t push_msat, int64_t channel_type) {
81425         LDKChannelId temporary_channel_id_conv;
81426         temporary_channel_id_conv.inner = untag_ptr(temporary_channel_id);
81427         temporary_channel_id_conv.is_owned = ptr_is_owned(temporary_channel_id);
81428         CHECK_INNER_FIELD_ACCESS_OR_NULL(temporary_channel_id_conv);
81429         temporary_channel_id_conv = ChannelId_clone(&temporary_channel_id_conv);
81430         LDKPublicKey counterparty_node_id_ref;
81431         CHECK(counterparty_node_id->arr_len == 33);
81432         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
81433         LDKChannelTypeFeatures channel_type_conv;
81434         channel_type_conv.inner = untag_ptr(channel_type);
81435         channel_type_conv.is_owned = ptr_is_owned(channel_type);
81436         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_conv);
81437         channel_type_conv = ChannelTypeFeatures_clone(&channel_type_conv);
81438         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
81439         *ret_copy = Event_open_channel_request(temporary_channel_id_conv, counterparty_node_id_ref, funding_satoshis, push_msat, channel_type_conv);
81440         int64_t ret_ref = tag_ptr(ret_copy, true);
81441         return ret_ref;
81442 }
81443
81444 int64_t  CS_LDK_Event_htlchandling_failed(int64_t prev_channel_id, int64_t failed_next_destination) {
81445         LDKChannelId prev_channel_id_conv;
81446         prev_channel_id_conv.inner = untag_ptr(prev_channel_id);
81447         prev_channel_id_conv.is_owned = ptr_is_owned(prev_channel_id);
81448         CHECK_INNER_FIELD_ACCESS_OR_NULL(prev_channel_id_conv);
81449         prev_channel_id_conv = ChannelId_clone(&prev_channel_id_conv);
81450         void* failed_next_destination_ptr = untag_ptr(failed_next_destination);
81451         CHECK_ACCESS(failed_next_destination_ptr);
81452         LDKHTLCDestination failed_next_destination_conv = *(LDKHTLCDestination*)(failed_next_destination_ptr);
81453         failed_next_destination_conv = HTLCDestination_clone((LDKHTLCDestination*)untag_ptr(failed_next_destination));
81454         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
81455         *ret_copy = Event_htlchandling_failed(prev_channel_id_conv, failed_next_destination_conv);
81456         int64_t ret_ref = tag_ptr(ret_copy, true);
81457         return ret_ref;
81458 }
81459
81460 int64_t  CS_LDK_Event_bump_transaction(int64_t a) {
81461         void* a_ptr = untag_ptr(a);
81462         CHECK_ACCESS(a_ptr);
81463         LDKBumpTransactionEvent a_conv = *(LDKBumpTransactionEvent*)(a_ptr);
81464         a_conv = BumpTransactionEvent_clone((LDKBumpTransactionEvent*)untag_ptr(a));
81465         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
81466         *ret_copy = Event_bump_transaction(a_conv);
81467         int64_t ret_ref = tag_ptr(ret_copy, true);
81468         return ret_ref;
81469 }
81470
81471 jboolean  CS_LDK_Event_eq(int64_t a, int64_t b) {
81472         LDKEvent* a_conv = (LDKEvent*)untag_ptr(a);
81473         LDKEvent* b_conv = (LDKEvent*)untag_ptr(b);
81474         jboolean ret_conv = Event_eq(a_conv, b_conv);
81475         return ret_conv;
81476 }
81477
81478 int8_tArray  CS_LDK_Event_write(int64_t obj) {
81479         LDKEvent* obj_conv = (LDKEvent*)untag_ptr(obj);
81480         LDKCVec_u8Z ret_var = Event_write(obj_conv);
81481         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
81482         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
81483         CVec_u8Z_free(ret_var);
81484         return ret_arr;
81485 }
81486
81487 int64_t  CS_LDK_Event_read(int8_tArray ser) {
81488         LDKu8slice ser_ref;
81489         ser_ref.datalen = ser->arr_len;
81490         ser_ref.data = ser->elems;
81491         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
81492         *ret_conv = Event_read(ser_ref);
81493         FREE(ser);
81494         return tag_ptr(ret_conv, true);
81495 }
81496
81497 void  CS_LDK_MessageSendEvent_free(int64_t this_ptr) {
81498         if (!ptr_is_owned(this_ptr)) return;
81499         void* this_ptr_ptr = untag_ptr(this_ptr);
81500         CHECK_ACCESS(this_ptr_ptr);
81501         LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)(this_ptr_ptr);
81502         FREE(untag_ptr(this_ptr));
81503         MessageSendEvent_free(this_ptr_conv);
81504 }
81505
81506 static inline uint64_t MessageSendEvent_clone_ptr(LDKMessageSendEvent *NONNULL_PTR arg) {
81507         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
81508         *ret_copy = MessageSendEvent_clone(arg);
81509         int64_t ret_ref = tag_ptr(ret_copy, true);
81510         return ret_ref;
81511 }
81512 int64_t  CS_LDK_MessageSendEvent_clone_ptr(int64_t arg) {
81513         LDKMessageSendEvent* arg_conv = (LDKMessageSendEvent*)untag_ptr(arg);
81514         int64_t ret_conv = MessageSendEvent_clone_ptr(arg_conv);
81515         return ret_conv;
81516 }
81517
81518 int64_t  CS_LDK_MessageSendEvent_clone(int64_t orig) {
81519         LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)untag_ptr(orig);
81520         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
81521         *ret_copy = MessageSendEvent_clone(orig_conv);
81522         int64_t ret_ref = tag_ptr(ret_copy, true);
81523         return ret_ref;
81524 }
81525
81526 int64_t  CS_LDK_MessageSendEvent_send_accept_channel(int8_tArray node_id, int64_t msg) {
81527         LDKPublicKey node_id_ref;
81528         CHECK(node_id->arr_len == 33);
81529         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
81530         LDKAcceptChannel msg_conv;
81531         msg_conv.inner = untag_ptr(msg);
81532         msg_conv.is_owned = ptr_is_owned(msg);
81533         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
81534         msg_conv = AcceptChannel_clone(&msg_conv);
81535         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
81536         *ret_copy = MessageSendEvent_send_accept_channel(node_id_ref, msg_conv);
81537         int64_t ret_ref = tag_ptr(ret_copy, true);
81538         return ret_ref;
81539 }
81540
81541 int64_t  CS_LDK_MessageSendEvent_send_accept_channel_v2(int8_tArray node_id, int64_t msg) {
81542         LDKPublicKey node_id_ref;
81543         CHECK(node_id->arr_len == 33);
81544         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
81545         LDKAcceptChannelV2 msg_conv;
81546         msg_conv.inner = untag_ptr(msg);
81547         msg_conv.is_owned = ptr_is_owned(msg);
81548         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
81549         msg_conv = AcceptChannelV2_clone(&msg_conv);
81550         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
81551         *ret_copy = MessageSendEvent_send_accept_channel_v2(node_id_ref, msg_conv);
81552         int64_t ret_ref = tag_ptr(ret_copy, true);
81553         return ret_ref;
81554 }
81555
81556 int64_t  CS_LDK_MessageSendEvent_send_open_channel(int8_tArray node_id, int64_t msg) {
81557         LDKPublicKey node_id_ref;
81558         CHECK(node_id->arr_len == 33);
81559         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
81560         LDKOpenChannel msg_conv;
81561         msg_conv.inner = untag_ptr(msg);
81562         msg_conv.is_owned = ptr_is_owned(msg);
81563         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
81564         msg_conv = OpenChannel_clone(&msg_conv);
81565         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
81566         *ret_copy = MessageSendEvent_send_open_channel(node_id_ref, msg_conv);
81567         int64_t ret_ref = tag_ptr(ret_copy, true);
81568         return ret_ref;
81569 }
81570
81571 int64_t  CS_LDK_MessageSendEvent_send_open_channel_v2(int8_tArray node_id, int64_t msg) {
81572         LDKPublicKey node_id_ref;
81573         CHECK(node_id->arr_len == 33);
81574         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
81575         LDKOpenChannelV2 msg_conv;
81576         msg_conv.inner = untag_ptr(msg);
81577         msg_conv.is_owned = ptr_is_owned(msg);
81578         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
81579         msg_conv = OpenChannelV2_clone(&msg_conv);
81580         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
81581         *ret_copy = MessageSendEvent_send_open_channel_v2(node_id_ref, msg_conv);
81582         int64_t ret_ref = tag_ptr(ret_copy, true);
81583         return ret_ref;
81584 }
81585
81586 int64_t  CS_LDK_MessageSendEvent_send_funding_created(int8_tArray node_id, int64_t msg) {
81587         LDKPublicKey node_id_ref;
81588         CHECK(node_id->arr_len == 33);
81589         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
81590         LDKFundingCreated msg_conv;
81591         msg_conv.inner = untag_ptr(msg);
81592         msg_conv.is_owned = ptr_is_owned(msg);
81593         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
81594         msg_conv = FundingCreated_clone(&msg_conv);
81595         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
81596         *ret_copy = MessageSendEvent_send_funding_created(node_id_ref, msg_conv);
81597         int64_t ret_ref = tag_ptr(ret_copy, true);
81598         return ret_ref;
81599 }
81600
81601 int64_t  CS_LDK_MessageSendEvent_send_funding_signed(int8_tArray node_id, int64_t msg) {
81602         LDKPublicKey node_id_ref;
81603         CHECK(node_id->arr_len == 33);
81604         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
81605         LDKFundingSigned msg_conv;
81606         msg_conv.inner = untag_ptr(msg);
81607         msg_conv.is_owned = ptr_is_owned(msg);
81608         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
81609         msg_conv = FundingSigned_clone(&msg_conv);
81610         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
81611         *ret_copy = MessageSendEvent_send_funding_signed(node_id_ref, msg_conv);
81612         int64_t ret_ref = tag_ptr(ret_copy, true);
81613         return ret_ref;
81614 }
81615
81616 int64_t  CS_LDK_MessageSendEvent_send_stfu(int8_tArray node_id, int64_t msg) {
81617         LDKPublicKey node_id_ref;
81618         CHECK(node_id->arr_len == 33);
81619         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
81620         LDKStfu msg_conv;
81621         msg_conv.inner = untag_ptr(msg);
81622         msg_conv.is_owned = ptr_is_owned(msg);
81623         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
81624         msg_conv = Stfu_clone(&msg_conv);
81625         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
81626         *ret_copy = MessageSendEvent_send_stfu(node_id_ref, msg_conv);
81627         int64_t ret_ref = tag_ptr(ret_copy, true);
81628         return ret_ref;
81629 }
81630
81631 int64_t  CS_LDK_MessageSendEvent_send_splice(int8_tArray node_id, int64_t msg) {
81632         LDKPublicKey node_id_ref;
81633         CHECK(node_id->arr_len == 33);
81634         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
81635         LDKSplice msg_conv;
81636         msg_conv.inner = untag_ptr(msg);
81637         msg_conv.is_owned = ptr_is_owned(msg);
81638         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
81639         msg_conv = Splice_clone(&msg_conv);
81640         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
81641         *ret_copy = MessageSendEvent_send_splice(node_id_ref, msg_conv);
81642         int64_t ret_ref = tag_ptr(ret_copy, true);
81643         return ret_ref;
81644 }
81645
81646 int64_t  CS_LDK_MessageSendEvent_send_splice_ack(int8_tArray node_id, int64_t msg) {
81647         LDKPublicKey node_id_ref;
81648         CHECK(node_id->arr_len == 33);
81649         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
81650         LDKSpliceAck msg_conv;
81651         msg_conv.inner = untag_ptr(msg);
81652         msg_conv.is_owned = ptr_is_owned(msg);
81653         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
81654         msg_conv = SpliceAck_clone(&msg_conv);
81655         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
81656         *ret_copy = MessageSendEvent_send_splice_ack(node_id_ref, msg_conv);
81657         int64_t ret_ref = tag_ptr(ret_copy, true);
81658         return ret_ref;
81659 }
81660
81661 int64_t  CS_LDK_MessageSendEvent_send_splice_locked(int8_tArray node_id, int64_t msg) {
81662         LDKPublicKey node_id_ref;
81663         CHECK(node_id->arr_len == 33);
81664         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
81665         LDKSpliceLocked msg_conv;
81666         msg_conv.inner = untag_ptr(msg);
81667         msg_conv.is_owned = ptr_is_owned(msg);
81668         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
81669         msg_conv = SpliceLocked_clone(&msg_conv);
81670         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
81671         *ret_copy = MessageSendEvent_send_splice_locked(node_id_ref, msg_conv);
81672         int64_t ret_ref = tag_ptr(ret_copy, true);
81673         return ret_ref;
81674 }
81675
81676 int64_t  CS_LDK_MessageSendEvent_send_tx_add_input(int8_tArray node_id, int64_t msg) {
81677         LDKPublicKey node_id_ref;
81678         CHECK(node_id->arr_len == 33);
81679         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
81680         LDKTxAddInput msg_conv;
81681         msg_conv.inner = untag_ptr(msg);
81682         msg_conv.is_owned = ptr_is_owned(msg);
81683         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
81684         msg_conv = TxAddInput_clone(&msg_conv);
81685         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
81686         *ret_copy = MessageSendEvent_send_tx_add_input(node_id_ref, msg_conv);
81687         int64_t ret_ref = tag_ptr(ret_copy, true);
81688         return ret_ref;
81689 }
81690
81691 int64_t  CS_LDK_MessageSendEvent_send_tx_add_output(int8_tArray node_id, int64_t msg) {
81692         LDKPublicKey node_id_ref;
81693         CHECK(node_id->arr_len == 33);
81694         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
81695         LDKTxAddOutput msg_conv;
81696         msg_conv.inner = untag_ptr(msg);
81697         msg_conv.is_owned = ptr_is_owned(msg);
81698         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
81699         msg_conv = TxAddOutput_clone(&msg_conv);
81700         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
81701         *ret_copy = MessageSendEvent_send_tx_add_output(node_id_ref, msg_conv);
81702         int64_t ret_ref = tag_ptr(ret_copy, true);
81703         return ret_ref;
81704 }
81705
81706 int64_t  CS_LDK_MessageSendEvent_send_tx_remove_input(int8_tArray node_id, int64_t msg) {
81707         LDKPublicKey node_id_ref;
81708         CHECK(node_id->arr_len == 33);
81709         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
81710         LDKTxRemoveInput msg_conv;
81711         msg_conv.inner = untag_ptr(msg);
81712         msg_conv.is_owned = ptr_is_owned(msg);
81713         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
81714         msg_conv = TxRemoveInput_clone(&msg_conv);
81715         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
81716         *ret_copy = MessageSendEvent_send_tx_remove_input(node_id_ref, msg_conv);
81717         int64_t ret_ref = tag_ptr(ret_copy, true);
81718         return ret_ref;
81719 }
81720
81721 int64_t  CS_LDK_MessageSendEvent_send_tx_remove_output(int8_tArray node_id, int64_t msg) {
81722         LDKPublicKey node_id_ref;
81723         CHECK(node_id->arr_len == 33);
81724         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
81725         LDKTxRemoveOutput msg_conv;
81726         msg_conv.inner = untag_ptr(msg);
81727         msg_conv.is_owned = ptr_is_owned(msg);
81728         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
81729         msg_conv = TxRemoveOutput_clone(&msg_conv);
81730         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
81731         *ret_copy = MessageSendEvent_send_tx_remove_output(node_id_ref, msg_conv);
81732         int64_t ret_ref = tag_ptr(ret_copy, true);
81733         return ret_ref;
81734 }
81735
81736 int64_t  CS_LDK_MessageSendEvent_send_tx_complete(int8_tArray node_id, int64_t msg) {
81737         LDKPublicKey node_id_ref;
81738         CHECK(node_id->arr_len == 33);
81739         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
81740         LDKTxComplete msg_conv;
81741         msg_conv.inner = untag_ptr(msg);
81742         msg_conv.is_owned = ptr_is_owned(msg);
81743         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
81744         msg_conv = TxComplete_clone(&msg_conv);
81745         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
81746         *ret_copy = MessageSendEvent_send_tx_complete(node_id_ref, msg_conv);
81747         int64_t ret_ref = tag_ptr(ret_copy, true);
81748         return ret_ref;
81749 }
81750
81751 int64_t  CS_LDK_MessageSendEvent_send_tx_signatures(int8_tArray node_id, int64_t msg) {
81752         LDKPublicKey node_id_ref;
81753         CHECK(node_id->arr_len == 33);
81754         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
81755         LDKTxSignatures msg_conv;
81756         msg_conv.inner = untag_ptr(msg);
81757         msg_conv.is_owned = ptr_is_owned(msg);
81758         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
81759         msg_conv = TxSignatures_clone(&msg_conv);
81760         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
81761         *ret_copy = MessageSendEvent_send_tx_signatures(node_id_ref, msg_conv);
81762         int64_t ret_ref = tag_ptr(ret_copy, true);
81763         return ret_ref;
81764 }
81765
81766 int64_t  CS_LDK_MessageSendEvent_send_tx_init_rbf(int8_tArray node_id, int64_t msg) {
81767         LDKPublicKey node_id_ref;
81768         CHECK(node_id->arr_len == 33);
81769         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
81770         LDKTxInitRbf msg_conv;
81771         msg_conv.inner = untag_ptr(msg);
81772         msg_conv.is_owned = ptr_is_owned(msg);
81773         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
81774         msg_conv = TxInitRbf_clone(&msg_conv);
81775         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
81776         *ret_copy = MessageSendEvent_send_tx_init_rbf(node_id_ref, msg_conv);
81777         int64_t ret_ref = tag_ptr(ret_copy, true);
81778         return ret_ref;
81779 }
81780
81781 int64_t  CS_LDK_MessageSendEvent_send_tx_ack_rbf(int8_tArray node_id, int64_t msg) {
81782         LDKPublicKey node_id_ref;
81783         CHECK(node_id->arr_len == 33);
81784         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
81785         LDKTxAckRbf msg_conv;
81786         msg_conv.inner = untag_ptr(msg);
81787         msg_conv.is_owned = ptr_is_owned(msg);
81788         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
81789         msg_conv = TxAckRbf_clone(&msg_conv);
81790         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
81791         *ret_copy = MessageSendEvent_send_tx_ack_rbf(node_id_ref, msg_conv);
81792         int64_t ret_ref = tag_ptr(ret_copy, true);
81793         return ret_ref;
81794 }
81795
81796 int64_t  CS_LDK_MessageSendEvent_send_tx_abort(int8_tArray node_id, int64_t msg) {
81797         LDKPublicKey node_id_ref;
81798         CHECK(node_id->arr_len == 33);
81799         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
81800         LDKTxAbort msg_conv;
81801         msg_conv.inner = untag_ptr(msg);
81802         msg_conv.is_owned = ptr_is_owned(msg);
81803         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
81804         msg_conv = TxAbort_clone(&msg_conv);
81805         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
81806         *ret_copy = MessageSendEvent_send_tx_abort(node_id_ref, msg_conv);
81807         int64_t ret_ref = tag_ptr(ret_copy, true);
81808         return ret_ref;
81809 }
81810
81811 int64_t  CS_LDK_MessageSendEvent_send_channel_ready(int8_tArray node_id, int64_t msg) {
81812         LDKPublicKey node_id_ref;
81813         CHECK(node_id->arr_len == 33);
81814         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
81815         LDKChannelReady msg_conv;
81816         msg_conv.inner = untag_ptr(msg);
81817         msg_conv.is_owned = ptr_is_owned(msg);
81818         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
81819         msg_conv = ChannelReady_clone(&msg_conv);
81820         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
81821         *ret_copy = MessageSendEvent_send_channel_ready(node_id_ref, msg_conv);
81822         int64_t ret_ref = tag_ptr(ret_copy, true);
81823         return ret_ref;
81824 }
81825
81826 int64_t  CS_LDK_MessageSendEvent_send_announcement_signatures(int8_tArray node_id, int64_t msg) {
81827         LDKPublicKey node_id_ref;
81828         CHECK(node_id->arr_len == 33);
81829         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
81830         LDKAnnouncementSignatures msg_conv;
81831         msg_conv.inner = untag_ptr(msg);
81832         msg_conv.is_owned = ptr_is_owned(msg);
81833         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
81834         msg_conv = AnnouncementSignatures_clone(&msg_conv);
81835         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
81836         *ret_copy = MessageSendEvent_send_announcement_signatures(node_id_ref, msg_conv);
81837         int64_t ret_ref = tag_ptr(ret_copy, true);
81838         return ret_ref;
81839 }
81840
81841 int64_t  CS_LDK_MessageSendEvent_update_htlcs(int8_tArray node_id, int64_t updates) {
81842         LDKPublicKey node_id_ref;
81843         CHECK(node_id->arr_len == 33);
81844         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
81845         LDKCommitmentUpdate updates_conv;
81846         updates_conv.inner = untag_ptr(updates);
81847         updates_conv.is_owned = ptr_is_owned(updates);
81848         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
81849         updates_conv = CommitmentUpdate_clone(&updates_conv);
81850         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
81851         *ret_copy = MessageSendEvent_update_htlcs(node_id_ref, updates_conv);
81852         int64_t ret_ref = tag_ptr(ret_copy, true);
81853         return ret_ref;
81854 }
81855
81856 int64_t  CS_LDK_MessageSendEvent_send_revoke_and_ack(int8_tArray node_id, int64_t msg) {
81857         LDKPublicKey node_id_ref;
81858         CHECK(node_id->arr_len == 33);
81859         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
81860         LDKRevokeAndACK msg_conv;
81861         msg_conv.inner = untag_ptr(msg);
81862         msg_conv.is_owned = ptr_is_owned(msg);
81863         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
81864         msg_conv = RevokeAndACK_clone(&msg_conv);
81865         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
81866         *ret_copy = MessageSendEvent_send_revoke_and_ack(node_id_ref, msg_conv);
81867         int64_t ret_ref = tag_ptr(ret_copy, true);
81868         return ret_ref;
81869 }
81870
81871 int64_t  CS_LDK_MessageSendEvent_send_closing_signed(int8_tArray node_id, int64_t msg) {
81872         LDKPublicKey node_id_ref;
81873         CHECK(node_id->arr_len == 33);
81874         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
81875         LDKClosingSigned msg_conv;
81876         msg_conv.inner = untag_ptr(msg);
81877         msg_conv.is_owned = ptr_is_owned(msg);
81878         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
81879         msg_conv = ClosingSigned_clone(&msg_conv);
81880         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
81881         *ret_copy = MessageSendEvent_send_closing_signed(node_id_ref, msg_conv);
81882         int64_t ret_ref = tag_ptr(ret_copy, true);
81883         return ret_ref;
81884 }
81885
81886 int64_t  CS_LDK_MessageSendEvent_send_shutdown(int8_tArray node_id, int64_t msg) {
81887         LDKPublicKey node_id_ref;
81888         CHECK(node_id->arr_len == 33);
81889         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
81890         LDKShutdown msg_conv;
81891         msg_conv.inner = untag_ptr(msg);
81892         msg_conv.is_owned = ptr_is_owned(msg);
81893         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
81894         msg_conv = Shutdown_clone(&msg_conv);
81895         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
81896         *ret_copy = MessageSendEvent_send_shutdown(node_id_ref, msg_conv);
81897         int64_t ret_ref = tag_ptr(ret_copy, true);
81898         return ret_ref;
81899 }
81900
81901 int64_t  CS_LDK_MessageSendEvent_send_channel_reestablish(int8_tArray node_id, int64_t msg) {
81902         LDKPublicKey node_id_ref;
81903         CHECK(node_id->arr_len == 33);
81904         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
81905         LDKChannelReestablish msg_conv;
81906         msg_conv.inner = untag_ptr(msg);
81907         msg_conv.is_owned = ptr_is_owned(msg);
81908         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
81909         msg_conv = ChannelReestablish_clone(&msg_conv);
81910         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
81911         *ret_copy = MessageSendEvent_send_channel_reestablish(node_id_ref, msg_conv);
81912         int64_t ret_ref = tag_ptr(ret_copy, true);
81913         return ret_ref;
81914 }
81915
81916 int64_t  CS_LDK_MessageSendEvent_send_channel_announcement(int8_tArray node_id, int64_t msg, int64_t update_msg) {
81917         LDKPublicKey node_id_ref;
81918         CHECK(node_id->arr_len == 33);
81919         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
81920         LDKChannelAnnouncement msg_conv;
81921         msg_conv.inner = untag_ptr(msg);
81922         msg_conv.is_owned = ptr_is_owned(msg);
81923         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
81924         msg_conv = ChannelAnnouncement_clone(&msg_conv);
81925         LDKChannelUpdate update_msg_conv;
81926         update_msg_conv.inner = untag_ptr(update_msg);
81927         update_msg_conv.is_owned = ptr_is_owned(update_msg);
81928         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_conv);
81929         update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
81930         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
81931         *ret_copy = MessageSendEvent_send_channel_announcement(node_id_ref, msg_conv, update_msg_conv);
81932         int64_t ret_ref = tag_ptr(ret_copy, true);
81933         return ret_ref;
81934 }
81935
81936 int64_t  CS_LDK_MessageSendEvent_broadcast_channel_announcement(int64_t msg, int64_t update_msg) {
81937         LDKChannelAnnouncement msg_conv;
81938         msg_conv.inner = untag_ptr(msg);
81939         msg_conv.is_owned = ptr_is_owned(msg);
81940         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
81941         msg_conv = ChannelAnnouncement_clone(&msg_conv);
81942         LDKChannelUpdate update_msg_conv;
81943         update_msg_conv.inner = untag_ptr(update_msg);
81944         update_msg_conv.is_owned = ptr_is_owned(update_msg);
81945         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_conv);
81946         update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
81947         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
81948         *ret_copy = MessageSendEvent_broadcast_channel_announcement(msg_conv, update_msg_conv);
81949         int64_t ret_ref = tag_ptr(ret_copy, true);
81950         return ret_ref;
81951 }
81952
81953 int64_t  CS_LDK_MessageSendEvent_broadcast_channel_update(int64_t msg) {
81954         LDKChannelUpdate msg_conv;
81955         msg_conv.inner = untag_ptr(msg);
81956         msg_conv.is_owned = ptr_is_owned(msg);
81957         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
81958         msg_conv = ChannelUpdate_clone(&msg_conv);
81959         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
81960         *ret_copy = MessageSendEvent_broadcast_channel_update(msg_conv);
81961         int64_t ret_ref = tag_ptr(ret_copy, true);
81962         return ret_ref;
81963 }
81964
81965 int64_t  CS_LDK_MessageSendEvent_broadcast_node_announcement(int64_t msg) {
81966         LDKNodeAnnouncement msg_conv;
81967         msg_conv.inner = untag_ptr(msg);
81968         msg_conv.is_owned = ptr_is_owned(msg);
81969         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
81970         msg_conv = NodeAnnouncement_clone(&msg_conv);
81971         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
81972         *ret_copy = MessageSendEvent_broadcast_node_announcement(msg_conv);
81973         int64_t ret_ref = tag_ptr(ret_copy, true);
81974         return ret_ref;
81975 }
81976
81977 int64_t  CS_LDK_MessageSendEvent_send_channel_update(int8_tArray node_id, int64_t msg) {
81978         LDKPublicKey node_id_ref;
81979         CHECK(node_id->arr_len == 33);
81980         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
81981         LDKChannelUpdate msg_conv;
81982         msg_conv.inner = untag_ptr(msg);
81983         msg_conv.is_owned = ptr_is_owned(msg);
81984         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
81985         msg_conv = ChannelUpdate_clone(&msg_conv);
81986         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
81987         *ret_copy = MessageSendEvent_send_channel_update(node_id_ref, msg_conv);
81988         int64_t ret_ref = tag_ptr(ret_copy, true);
81989         return ret_ref;
81990 }
81991
81992 int64_t  CS_LDK_MessageSendEvent_handle_error(int8_tArray node_id, int64_t action) {
81993         LDKPublicKey node_id_ref;
81994         CHECK(node_id->arr_len == 33);
81995         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
81996         void* action_ptr = untag_ptr(action);
81997         CHECK_ACCESS(action_ptr);
81998         LDKErrorAction action_conv = *(LDKErrorAction*)(action_ptr);
81999         action_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(action));
82000         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
82001         *ret_copy = MessageSendEvent_handle_error(node_id_ref, action_conv);
82002         int64_t ret_ref = tag_ptr(ret_copy, true);
82003         return ret_ref;
82004 }
82005
82006 int64_t  CS_LDK_MessageSendEvent_send_channel_range_query(int8_tArray node_id, int64_t msg) {
82007         LDKPublicKey node_id_ref;
82008         CHECK(node_id->arr_len == 33);
82009         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
82010         LDKQueryChannelRange msg_conv;
82011         msg_conv.inner = untag_ptr(msg);
82012         msg_conv.is_owned = ptr_is_owned(msg);
82013         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
82014         msg_conv = QueryChannelRange_clone(&msg_conv);
82015         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
82016         *ret_copy = MessageSendEvent_send_channel_range_query(node_id_ref, msg_conv);
82017         int64_t ret_ref = tag_ptr(ret_copy, true);
82018         return ret_ref;
82019 }
82020
82021 int64_t  CS_LDK_MessageSendEvent_send_short_ids_query(int8_tArray node_id, int64_t msg) {
82022         LDKPublicKey node_id_ref;
82023         CHECK(node_id->arr_len == 33);
82024         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
82025         LDKQueryShortChannelIds msg_conv;
82026         msg_conv.inner = untag_ptr(msg);
82027         msg_conv.is_owned = ptr_is_owned(msg);
82028         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
82029         msg_conv = QueryShortChannelIds_clone(&msg_conv);
82030         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
82031         *ret_copy = MessageSendEvent_send_short_ids_query(node_id_ref, msg_conv);
82032         int64_t ret_ref = tag_ptr(ret_copy, true);
82033         return ret_ref;
82034 }
82035
82036 int64_t  CS_LDK_MessageSendEvent_send_reply_channel_range(int8_tArray node_id, int64_t msg) {
82037         LDKPublicKey node_id_ref;
82038         CHECK(node_id->arr_len == 33);
82039         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
82040         LDKReplyChannelRange msg_conv;
82041         msg_conv.inner = untag_ptr(msg);
82042         msg_conv.is_owned = ptr_is_owned(msg);
82043         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
82044         msg_conv = ReplyChannelRange_clone(&msg_conv);
82045         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
82046         *ret_copy = MessageSendEvent_send_reply_channel_range(node_id_ref, msg_conv);
82047         int64_t ret_ref = tag_ptr(ret_copy, true);
82048         return ret_ref;
82049 }
82050
82051 int64_t  CS_LDK_MessageSendEvent_send_gossip_timestamp_filter(int8_tArray node_id, int64_t msg) {
82052         LDKPublicKey node_id_ref;
82053         CHECK(node_id->arr_len == 33);
82054         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
82055         LDKGossipTimestampFilter msg_conv;
82056         msg_conv.inner = untag_ptr(msg);
82057         msg_conv.is_owned = ptr_is_owned(msg);
82058         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
82059         msg_conv = GossipTimestampFilter_clone(&msg_conv);
82060         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
82061         *ret_copy = MessageSendEvent_send_gossip_timestamp_filter(node_id_ref, msg_conv);
82062         int64_t ret_ref = tag_ptr(ret_copy, true);
82063         return ret_ref;
82064 }
82065
82066 void  CS_LDK_MessageSendEventsProvider_free(int64_t this_ptr) {
82067         if (!ptr_is_owned(this_ptr)) return;
82068         void* this_ptr_ptr = untag_ptr(this_ptr);
82069         CHECK_ACCESS(this_ptr_ptr);
82070         LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)(this_ptr_ptr);
82071         FREE(untag_ptr(this_ptr));
82072         MessageSendEventsProvider_free(this_ptr_conv);
82073 }
82074
82075 void  CS_LDK_EventsProvider_free(int64_t this_ptr) {
82076         if (!ptr_is_owned(this_ptr)) return;
82077         void* this_ptr_ptr = untag_ptr(this_ptr);
82078         CHECK_ACCESS(this_ptr_ptr);
82079         LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)(this_ptr_ptr);
82080         FREE(untag_ptr(this_ptr));
82081         EventsProvider_free(this_ptr_conv);
82082 }
82083
82084 void  CS_LDK_EventHandler_free(int64_t this_ptr) {
82085         if (!ptr_is_owned(this_ptr)) return;
82086         void* this_ptr_ptr = untag_ptr(this_ptr);
82087         CHECK_ACCESS(this_ptr_ptr);
82088         LDKEventHandler this_ptr_conv = *(LDKEventHandler*)(this_ptr_ptr);
82089         FREE(untag_ptr(this_ptr));
82090         EventHandler_free(this_ptr_conv);
82091 }
82092
82093 void  CS_LDK_AnchorDescriptor_free(int64_t this_obj) {
82094         LDKAnchorDescriptor this_obj_conv;
82095         this_obj_conv.inner = untag_ptr(this_obj);
82096         this_obj_conv.is_owned = ptr_is_owned(this_obj);
82097         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
82098         AnchorDescriptor_free(this_obj_conv);
82099 }
82100
82101 int64_t  CS_LDK_AnchorDescriptor_get_channel_derivation_parameters(int64_t this_ptr) {
82102         LDKAnchorDescriptor this_ptr_conv;
82103         this_ptr_conv.inner = untag_ptr(this_ptr);
82104         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
82105         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
82106         this_ptr_conv.is_owned = false;
82107         LDKChannelDerivationParameters ret_var = AnchorDescriptor_get_channel_derivation_parameters(&this_ptr_conv);
82108         int64_t ret_ref = 0;
82109         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82110         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82111         return ret_ref;
82112 }
82113
82114 void  CS_LDK_AnchorDescriptor_set_channel_derivation_parameters(int64_t this_ptr, int64_t val) {
82115         LDKAnchorDescriptor this_ptr_conv;
82116         this_ptr_conv.inner = untag_ptr(this_ptr);
82117         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
82118         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
82119         this_ptr_conv.is_owned = false;
82120         LDKChannelDerivationParameters val_conv;
82121         val_conv.inner = untag_ptr(val);
82122         val_conv.is_owned = ptr_is_owned(val);
82123         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
82124         val_conv = ChannelDerivationParameters_clone(&val_conv);
82125         AnchorDescriptor_set_channel_derivation_parameters(&this_ptr_conv, val_conv);
82126 }
82127
82128 int64_t  CS_LDK_AnchorDescriptor_get_outpoint(int64_t this_ptr) {
82129         LDKAnchorDescriptor this_ptr_conv;
82130         this_ptr_conv.inner = untag_ptr(this_ptr);
82131         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
82132         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
82133         this_ptr_conv.is_owned = false;
82134         LDKOutPoint ret_var = AnchorDescriptor_get_outpoint(&this_ptr_conv);
82135         int64_t ret_ref = 0;
82136         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82137         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82138         return ret_ref;
82139 }
82140
82141 void  CS_LDK_AnchorDescriptor_set_outpoint(int64_t this_ptr, int64_t val) {
82142         LDKAnchorDescriptor this_ptr_conv;
82143         this_ptr_conv.inner = untag_ptr(this_ptr);
82144         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
82145         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
82146         this_ptr_conv.is_owned = false;
82147         LDKOutPoint val_conv;
82148         val_conv.inner = untag_ptr(val);
82149         val_conv.is_owned = ptr_is_owned(val);
82150         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
82151         val_conv = OutPoint_clone(&val_conv);
82152         AnchorDescriptor_set_outpoint(&this_ptr_conv, val_conv);
82153 }
82154
82155 int64_t  CS_LDK_AnchorDescriptor_new(int64_t channel_derivation_parameters_arg, int64_t outpoint_arg) {
82156         LDKChannelDerivationParameters channel_derivation_parameters_arg_conv;
82157         channel_derivation_parameters_arg_conv.inner = untag_ptr(channel_derivation_parameters_arg);
82158         channel_derivation_parameters_arg_conv.is_owned = ptr_is_owned(channel_derivation_parameters_arg);
82159         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_derivation_parameters_arg_conv);
82160         channel_derivation_parameters_arg_conv = ChannelDerivationParameters_clone(&channel_derivation_parameters_arg_conv);
82161         LDKOutPoint outpoint_arg_conv;
82162         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
82163         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
82164         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
82165         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
82166         LDKAnchorDescriptor ret_var = AnchorDescriptor_new(channel_derivation_parameters_arg_conv, outpoint_arg_conv);
82167         int64_t ret_ref = 0;
82168         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82169         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82170         return ret_ref;
82171 }
82172
82173 static inline uint64_t AnchorDescriptor_clone_ptr(LDKAnchorDescriptor *NONNULL_PTR arg) {
82174         LDKAnchorDescriptor ret_var = AnchorDescriptor_clone(arg);
82175         int64_t ret_ref = 0;
82176         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82177         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82178         return ret_ref;
82179 }
82180 int64_t  CS_LDK_AnchorDescriptor_clone_ptr(int64_t arg) {
82181         LDKAnchorDescriptor arg_conv;
82182         arg_conv.inner = untag_ptr(arg);
82183         arg_conv.is_owned = ptr_is_owned(arg);
82184         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
82185         arg_conv.is_owned = false;
82186         int64_t ret_conv = AnchorDescriptor_clone_ptr(&arg_conv);
82187         return ret_conv;
82188 }
82189
82190 int64_t  CS_LDK_AnchorDescriptor_clone(int64_t orig) {
82191         LDKAnchorDescriptor orig_conv;
82192         orig_conv.inner = untag_ptr(orig);
82193         orig_conv.is_owned = ptr_is_owned(orig);
82194         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
82195         orig_conv.is_owned = false;
82196         LDKAnchorDescriptor ret_var = AnchorDescriptor_clone(&orig_conv);
82197         int64_t ret_ref = 0;
82198         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82199         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82200         return ret_ref;
82201 }
82202
82203 jboolean  CS_LDK_AnchorDescriptor_eq(int64_t a, int64_t b) {
82204         LDKAnchorDescriptor a_conv;
82205         a_conv.inner = untag_ptr(a);
82206         a_conv.is_owned = ptr_is_owned(a);
82207         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
82208         a_conv.is_owned = false;
82209         LDKAnchorDescriptor b_conv;
82210         b_conv.inner = untag_ptr(b);
82211         b_conv.is_owned = ptr_is_owned(b);
82212         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
82213         b_conv.is_owned = false;
82214         jboolean ret_conv = AnchorDescriptor_eq(&a_conv, &b_conv);
82215         return ret_conv;
82216 }
82217
82218 int64_t  CS_LDK_AnchorDescriptor_previous_utxo(int64_t this_arg) {
82219         LDKAnchorDescriptor this_arg_conv;
82220         this_arg_conv.inner = untag_ptr(this_arg);
82221         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82222         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82223         this_arg_conv.is_owned = false;
82224         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
82225         *ret_ref = AnchorDescriptor_previous_utxo(&this_arg_conv);
82226         return tag_ptr(ret_ref, true);
82227 }
82228
82229 int64_t  CS_LDK_AnchorDescriptor_unsigned_tx_input(int64_t this_arg) {
82230         LDKAnchorDescriptor this_arg_conv;
82231         this_arg_conv.inner = untag_ptr(this_arg);
82232         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82233         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82234         this_arg_conv.is_owned = false;
82235         LDKTxIn* ret_ref = MALLOC(sizeof(LDKTxIn), "LDKTxIn");
82236         *ret_ref = AnchorDescriptor_unsigned_tx_input(&this_arg_conv);
82237         return tag_ptr(ret_ref, true);
82238 }
82239
82240 int8_tArray  CS_LDK_AnchorDescriptor_witness_script(int64_t this_arg) {
82241         LDKAnchorDescriptor this_arg_conv;
82242         this_arg_conv.inner = untag_ptr(this_arg);
82243         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82244         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82245         this_arg_conv.is_owned = false;
82246         LDKCVec_u8Z ret_var = AnchorDescriptor_witness_script(&this_arg_conv);
82247         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
82248         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
82249         CVec_u8Z_free(ret_var);
82250         return ret_arr;
82251 }
82252
82253 int8_tArray  CS_LDK_AnchorDescriptor_tx_input_witness(int64_t this_arg, int8_tArray signature) {
82254         LDKAnchorDescriptor this_arg_conv;
82255         this_arg_conv.inner = untag_ptr(this_arg);
82256         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82257         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82258         this_arg_conv.is_owned = false;
82259         LDKECDSASignature signature_ref;
82260         CHECK(signature->arr_len == 64);
82261         memcpy(signature_ref.compact_form, signature->elems, 64); FREE(signature);
82262         LDKWitness ret_var = AnchorDescriptor_tx_input_witness(&this_arg_conv, signature_ref);
82263         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
82264         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
82265         Witness_free(ret_var);
82266         return ret_arr;
82267 }
82268
82269 int64_t  CS_LDK_AnchorDescriptor_derive_channel_signer(int64_t this_arg, int64_t signer_provider) {
82270         LDKAnchorDescriptor this_arg_conv;
82271         this_arg_conv.inner = untag_ptr(this_arg);
82272         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82273         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82274         this_arg_conv.is_owned = false;
82275         void* signer_provider_ptr = untag_ptr(signer_provider);
82276         if (ptr_is_owned(signer_provider)) { CHECK_ACCESS(signer_provider_ptr); }
82277         LDKSignerProvider* signer_provider_conv = (LDKSignerProvider*)signer_provider_ptr;
82278         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
82279         *ret_ret = AnchorDescriptor_derive_channel_signer(&this_arg_conv, signer_provider_conv);
82280         return tag_ptr(ret_ret, true);
82281 }
82282
82283 void  CS_LDK_BumpTransactionEvent_free(int64_t this_ptr) {
82284         if (!ptr_is_owned(this_ptr)) return;
82285         void* this_ptr_ptr = untag_ptr(this_ptr);
82286         CHECK_ACCESS(this_ptr_ptr);
82287         LDKBumpTransactionEvent this_ptr_conv = *(LDKBumpTransactionEvent*)(this_ptr_ptr);
82288         FREE(untag_ptr(this_ptr));
82289         BumpTransactionEvent_free(this_ptr_conv);
82290 }
82291
82292 static inline uint64_t BumpTransactionEvent_clone_ptr(LDKBumpTransactionEvent *NONNULL_PTR arg) {
82293         LDKBumpTransactionEvent *ret_copy = MALLOC(sizeof(LDKBumpTransactionEvent), "LDKBumpTransactionEvent");
82294         *ret_copy = BumpTransactionEvent_clone(arg);
82295         int64_t ret_ref = tag_ptr(ret_copy, true);
82296         return ret_ref;
82297 }
82298 int64_t  CS_LDK_BumpTransactionEvent_clone_ptr(int64_t arg) {
82299         LDKBumpTransactionEvent* arg_conv = (LDKBumpTransactionEvent*)untag_ptr(arg);
82300         int64_t ret_conv = BumpTransactionEvent_clone_ptr(arg_conv);
82301         return ret_conv;
82302 }
82303
82304 int64_t  CS_LDK_BumpTransactionEvent_clone(int64_t orig) {
82305         LDKBumpTransactionEvent* orig_conv = (LDKBumpTransactionEvent*)untag_ptr(orig);
82306         LDKBumpTransactionEvent *ret_copy = MALLOC(sizeof(LDKBumpTransactionEvent), "LDKBumpTransactionEvent");
82307         *ret_copy = BumpTransactionEvent_clone(orig_conv);
82308         int64_t ret_ref = tag_ptr(ret_copy, true);
82309         return ret_ref;
82310 }
82311
82312 int64_t  CS_LDK_BumpTransactionEvent_channel_close(int64_t channel_id, int8_tArray counterparty_node_id, 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) {
82313         LDKChannelId channel_id_conv;
82314         channel_id_conv.inner = untag_ptr(channel_id);
82315         channel_id_conv.is_owned = ptr_is_owned(channel_id);
82316         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
82317         channel_id_conv = ChannelId_clone(&channel_id_conv);
82318         LDKPublicKey counterparty_node_id_ref;
82319         CHECK(counterparty_node_id->arr_len == 33);
82320         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
82321         LDKThirtyTwoBytes claim_id_ref;
82322         CHECK(claim_id->arr_len == 32);
82323         memcpy(claim_id_ref.data, claim_id->elems, 32); FREE(claim_id);
82324         LDKTransaction commitment_tx_ref;
82325         commitment_tx_ref.datalen = commitment_tx->arr_len;
82326         commitment_tx_ref.data = MALLOC(commitment_tx_ref.datalen, "LDKTransaction Bytes");
82327         memcpy(commitment_tx_ref.data, commitment_tx->elems, commitment_tx_ref.datalen); FREE(commitment_tx);
82328         commitment_tx_ref.data_is_owned = true;
82329         LDKAnchorDescriptor anchor_descriptor_conv;
82330         anchor_descriptor_conv.inner = untag_ptr(anchor_descriptor);
82331         anchor_descriptor_conv.is_owned = ptr_is_owned(anchor_descriptor);
82332         CHECK_INNER_FIELD_ACCESS_OR_NULL(anchor_descriptor_conv);
82333         anchor_descriptor_conv = AnchorDescriptor_clone(&anchor_descriptor_conv);
82334         LDKCVec_HTLCOutputInCommitmentZ pending_htlcs_constr;
82335         pending_htlcs_constr.datalen = pending_htlcs->arr_len;
82336         if (pending_htlcs_constr.datalen > 0)
82337                 pending_htlcs_constr.data = MALLOC(pending_htlcs_constr.datalen * sizeof(LDKHTLCOutputInCommitment), "LDKCVec_HTLCOutputInCommitmentZ Elements");
82338         else
82339                 pending_htlcs_constr.data = NULL;
82340         int64_t* pending_htlcs_vals = pending_htlcs->elems;
82341         for (size_t y = 0; y < pending_htlcs_constr.datalen; y++) {
82342                 int64_t pending_htlcs_conv_24 = pending_htlcs_vals[y];
82343                 LDKHTLCOutputInCommitment pending_htlcs_conv_24_conv;
82344                 pending_htlcs_conv_24_conv.inner = untag_ptr(pending_htlcs_conv_24);
82345                 pending_htlcs_conv_24_conv.is_owned = ptr_is_owned(pending_htlcs_conv_24);
82346                 CHECK_INNER_FIELD_ACCESS_OR_NULL(pending_htlcs_conv_24_conv);
82347                 pending_htlcs_conv_24_conv = HTLCOutputInCommitment_clone(&pending_htlcs_conv_24_conv);
82348                 pending_htlcs_constr.data[y] = pending_htlcs_conv_24_conv;
82349         }
82350         FREE(pending_htlcs);
82351         LDKBumpTransactionEvent *ret_copy = MALLOC(sizeof(LDKBumpTransactionEvent), "LDKBumpTransactionEvent");
82352         *ret_copy = BumpTransactionEvent_channel_close(channel_id_conv, counterparty_node_id_ref, claim_id_ref, package_target_feerate_sat_per_1000_weight, commitment_tx_ref, commitment_tx_fee_satoshis, anchor_descriptor_conv, pending_htlcs_constr);
82353         int64_t ret_ref = tag_ptr(ret_copy, true);
82354         return ret_ref;
82355 }
82356
82357 int64_t  CS_LDK_BumpTransactionEvent_htlcresolution(int64_t channel_id, int8_tArray counterparty_node_id, int8_tArray claim_id, int32_t target_feerate_sat_per_1000_weight, int64_tArray htlc_descriptors, int32_t tx_lock_time) {
82358         LDKChannelId channel_id_conv;
82359         channel_id_conv.inner = untag_ptr(channel_id);
82360         channel_id_conv.is_owned = ptr_is_owned(channel_id);
82361         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
82362         channel_id_conv = ChannelId_clone(&channel_id_conv);
82363         LDKPublicKey counterparty_node_id_ref;
82364         CHECK(counterparty_node_id->arr_len == 33);
82365         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
82366         LDKThirtyTwoBytes claim_id_ref;
82367         CHECK(claim_id->arr_len == 32);
82368         memcpy(claim_id_ref.data, claim_id->elems, 32); FREE(claim_id);
82369         LDKCVec_HTLCDescriptorZ htlc_descriptors_constr;
82370         htlc_descriptors_constr.datalen = htlc_descriptors->arr_len;
82371         if (htlc_descriptors_constr.datalen > 0)
82372                 htlc_descriptors_constr.data = MALLOC(htlc_descriptors_constr.datalen * sizeof(LDKHTLCDescriptor), "LDKCVec_HTLCDescriptorZ Elements");
82373         else
82374                 htlc_descriptors_constr.data = NULL;
82375         int64_t* htlc_descriptors_vals = htlc_descriptors->elems;
82376         for (size_t q = 0; q < htlc_descriptors_constr.datalen; q++) {
82377                 int64_t htlc_descriptors_conv_16 = htlc_descriptors_vals[q];
82378                 LDKHTLCDescriptor htlc_descriptors_conv_16_conv;
82379                 htlc_descriptors_conv_16_conv.inner = untag_ptr(htlc_descriptors_conv_16);
82380                 htlc_descriptors_conv_16_conv.is_owned = ptr_is_owned(htlc_descriptors_conv_16);
82381                 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_descriptors_conv_16_conv);
82382                 htlc_descriptors_conv_16_conv = HTLCDescriptor_clone(&htlc_descriptors_conv_16_conv);
82383                 htlc_descriptors_constr.data[q] = htlc_descriptors_conv_16_conv;
82384         }
82385         FREE(htlc_descriptors);
82386         LDKBumpTransactionEvent *ret_copy = MALLOC(sizeof(LDKBumpTransactionEvent), "LDKBumpTransactionEvent");
82387         *ret_copy = BumpTransactionEvent_htlcresolution(channel_id_conv, counterparty_node_id_ref, claim_id_ref, target_feerate_sat_per_1000_weight, htlc_descriptors_constr, tx_lock_time);
82388         int64_t ret_ref = tag_ptr(ret_copy, true);
82389         return ret_ref;
82390 }
82391
82392 jboolean  CS_LDK_BumpTransactionEvent_eq(int64_t a, int64_t b) {
82393         LDKBumpTransactionEvent* a_conv = (LDKBumpTransactionEvent*)untag_ptr(a);
82394         LDKBumpTransactionEvent* b_conv = (LDKBumpTransactionEvent*)untag_ptr(b);
82395         jboolean ret_conv = BumpTransactionEvent_eq(a_conv, b_conv);
82396         return ret_conv;
82397 }
82398
82399 void  CS_LDK_Input_free(int64_t this_obj) {
82400         LDKInput this_obj_conv;
82401         this_obj_conv.inner = untag_ptr(this_obj);
82402         this_obj_conv.is_owned = ptr_is_owned(this_obj);
82403         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
82404         Input_free(this_obj_conv);
82405 }
82406
82407 int64_t  CS_LDK_Input_get_outpoint(int64_t this_ptr) {
82408         LDKInput this_ptr_conv;
82409         this_ptr_conv.inner = untag_ptr(this_ptr);
82410         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
82411         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
82412         this_ptr_conv.is_owned = false;
82413         LDKOutPoint ret_var = Input_get_outpoint(&this_ptr_conv);
82414         int64_t ret_ref = 0;
82415         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82416         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82417         return ret_ref;
82418 }
82419
82420 void  CS_LDK_Input_set_outpoint(int64_t this_ptr, int64_t val) {
82421         LDKInput this_ptr_conv;
82422         this_ptr_conv.inner = untag_ptr(this_ptr);
82423         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
82424         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
82425         this_ptr_conv.is_owned = false;
82426         LDKOutPoint val_conv;
82427         val_conv.inner = untag_ptr(val);
82428         val_conv.is_owned = ptr_is_owned(val);
82429         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
82430         val_conv = OutPoint_clone(&val_conv);
82431         Input_set_outpoint(&this_ptr_conv, val_conv);
82432 }
82433
82434 int64_t  CS_LDK_Input_get_previous_utxo(int64_t this_ptr) {
82435         LDKInput this_ptr_conv;
82436         this_ptr_conv.inner = untag_ptr(this_ptr);
82437         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
82438         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
82439         this_ptr_conv.is_owned = false;
82440         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
82441         *ret_ref = Input_get_previous_utxo(&this_ptr_conv);
82442         return tag_ptr(ret_ref, true);
82443 }
82444
82445 void  CS_LDK_Input_set_previous_utxo(int64_t this_ptr, int64_t val) {
82446         LDKInput this_ptr_conv;
82447         this_ptr_conv.inner = untag_ptr(this_ptr);
82448         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
82449         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
82450         this_ptr_conv.is_owned = false;
82451         void* val_ptr = untag_ptr(val);
82452         CHECK_ACCESS(val_ptr);
82453         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
82454         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
82455         Input_set_previous_utxo(&this_ptr_conv, val_conv);
82456 }
82457
82458 int64_t  CS_LDK_Input_get_satisfaction_weight(int64_t this_ptr) {
82459         LDKInput this_ptr_conv;
82460         this_ptr_conv.inner = untag_ptr(this_ptr);
82461         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
82462         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
82463         this_ptr_conv.is_owned = false;
82464         int64_t ret_conv = Input_get_satisfaction_weight(&this_ptr_conv);
82465         return ret_conv;
82466 }
82467
82468 void  CS_LDK_Input_set_satisfaction_weight(int64_t this_ptr, int64_t val) {
82469         LDKInput this_ptr_conv;
82470         this_ptr_conv.inner = untag_ptr(this_ptr);
82471         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
82472         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
82473         this_ptr_conv.is_owned = false;
82474         Input_set_satisfaction_weight(&this_ptr_conv, val);
82475 }
82476
82477 int64_t  CS_LDK_Input_new(int64_t outpoint_arg, int64_t previous_utxo_arg, int64_t satisfaction_weight_arg) {
82478         LDKOutPoint outpoint_arg_conv;
82479         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
82480         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
82481         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
82482         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
82483         void* previous_utxo_arg_ptr = untag_ptr(previous_utxo_arg);
82484         CHECK_ACCESS(previous_utxo_arg_ptr);
82485         LDKTxOut previous_utxo_arg_conv = *(LDKTxOut*)(previous_utxo_arg_ptr);
82486         previous_utxo_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(previous_utxo_arg));
82487         LDKInput ret_var = Input_new(outpoint_arg_conv, previous_utxo_arg_conv, satisfaction_weight_arg);
82488         int64_t ret_ref = 0;
82489         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82490         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82491         return ret_ref;
82492 }
82493
82494 static inline uint64_t Input_clone_ptr(LDKInput *NONNULL_PTR arg) {
82495         LDKInput ret_var = Input_clone(arg);
82496         int64_t ret_ref = 0;
82497         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82498         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82499         return ret_ref;
82500 }
82501 int64_t  CS_LDK_Input_clone_ptr(int64_t arg) {
82502         LDKInput arg_conv;
82503         arg_conv.inner = untag_ptr(arg);
82504         arg_conv.is_owned = ptr_is_owned(arg);
82505         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
82506         arg_conv.is_owned = false;
82507         int64_t ret_conv = Input_clone_ptr(&arg_conv);
82508         return ret_conv;
82509 }
82510
82511 int64_t  CS_LDK_Input_clone(int64_t orig) {
82512         LDKInput orig_conv;
82513         orig_conv.inner = untag_ptr(orig);
82514         orig_conv.is_owned = ptr_is_owned(orig);
82515         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
82516         orig_conv.is_owned = false;
82517         LDKInput ret_var = Input_clone(&orig_conv);
82518         int64_t ret_ref = 0;
82519         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82520         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82521         return ret_ref;
82522 }
82523
82524 int64_t  CS_LDK_Input_hash(int64_t o) {
82525         LDKInput o_conv;
82526         o_conv.inner = untag_ptr(o);
82527         o_conv.is_owned = ptr_is_owned(o);
82528         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
82529         o_conv.is_owned = false;
82530         int64_t ret_conv = Input_hash(&o_conv);
82531         return ret_conv;
82532 }
82533
82534 jboolean  CS_LDK_Input_eq(int64_t a, int64_t b) {
82535         LDKInput a_conv;
82536         a_conv.inner = untag_ptr(a);
82537         a_conv.is_owned = ptr_is_owned(a);
82538         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
82539         a_conv.is_owned = false;
82540         LDKInput b_conv;
82541         b_conv.inner = untag_ptr(b);
82542         b_conv.is_owned = ptr_is_owned(b);
82543         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
82544         b_conv.is_owned = false;
82545         jboolean ret_conv = Input_eq(&a_conv, &b_conv);
82546         return ret_conv;
82547 }
82548
82549 void  CS_LDK_Utxo_free(int64_t this_obj) {
82550         LDKUtxo this_obj_conv;
82551         this_obj_conv.inner = untag_ptr(this_obj);
82552         this_obj_conv.is_owned = ptr_is_owned(this_obj);
82553         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
82554         Utxo_free(this_obj_conv);
82555 }
82556
82557 int64_t  CS_LDK_Utxo_get_outpoint(int64_t this_ptr) {
82558         LDKUtxo this_ptr_conv;
82559         this_ptr_conv.inner = untag_ptr(this_ptr);
82560         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
82561         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
82562         this_ptr_conv.is_owned = false;
82563         LDKOutPoint ret_var = Utxo_get_outpoint(&this_ptr_conv);
82564         int64_t ret_ref = 0;
82565         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82566         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82567         return ret_ref;
82568 }
82569
82570 void  CS_LDK_Utxo_set_outpoint(int64_t this_ptr, int64_t val) {
82571         LDKUtxo this_ptr_conv;
82572         this_ptr_conv.inner = untag_ptr(this_ptr);
82573         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
82574         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
82575         this_ptr_conv.is_owned = false;
82576         LDKOutPoint val_conv;
82577         val_conv.inner = untag_ptr(val);
82578         val_conv.is_owned = ptr_is_owned(val);
82579         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
82580         val_conv = OutPoint_clone(&val_conv);
82581         Utxo_set_outpoint(&this_ptr_conv, val_conv);
82582 }
82583
82584 int64_t  CS_LDK_Utxo_get_output(int64_t this_ptr) {
82585         LDKUtxo this_ptr_conv;
82586         this_ptr_conv.inner = untag_ptr(this_ptr);
82587         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
82588         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
82589         this_ptr_conv.is_owned = false;
82590         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
82591         *ret_ref = Utxo_get_output(&this_ptr_conv);
82592         return tag_ptr(ret_ref, true);
82593 }
82594
82595 void  CS_LDK_Utxo_set_output(int64_t this_ptr, int64_t val) {
82596         LDKUtxo this_ptr_conv;
82597         this_ptr_conv.inner = untag_ptr(this_ptr);
82598         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
82599         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
82600         this_ptr_conv.is_owned = false;
82601         void* val_ptr = untag_ptr(val);
82602         CHECK_ACCESS(val_ptr);
82603         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
82604         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
82605         Utxo_set_output(&this_ptr_conv, val_conv);
82606 }
82607
82608 int64_t  CS_LDK_Utxo_get_satisfaction_weight(int64_t this_ptr) {
82609         LDKUtxo this_ptr_conv;
82610         this_ptr_conv.inner = untag_ptr(this_ptr);
82611         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
82612         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
82613         this_ptr_conv.is_owned = false;
82614         int64_t ret_conv = Utxo_get_satisfaction_weight(&this_ptr_conv);
82615         return ret_conv;
82616 }
82617
82618 void  CS_LDK_Utxo_set_satisfaction_weight(int64_t this_ptr, int64_t val) {
82619         LDKUtxo this_ptr_conv;
82620         this_ptr_conv.inner = untag_ptr(this_ptr);
82621         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
82622         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
82623         this_ptr_conv.is_owned = false;
82624         Utxo_set_satisfaction_weight(&this_ptr_conv, val);
82625 }
82626
82627 int64_t  CS_LDK_Utxo_new(int64_t outpoint_arg, int64_t output_arg, int64_t satisfaction_weight_arg) {
82628         LDKOutPoint outpoint_arg_conv;
82629         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
82630         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
82631         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
82632         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
82633         void* output_arg_ptr = untag_ptr(output_arg);
82634         CHECK_ACCESS(output_arg_ptr);
82635         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
82636         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
82637         LDKUtxo ret_var = Utxo_new(outpoint_arg_conv, output_arg_conv, satisfaction_weight_arg);
82638         int64_t ret_ref = 0;
82639         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82640         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82641         return ret_ref;
82642 }
82643
82644 static inline uint64_t Utxo_clone_ptr(LDKUtxo *NONNULL_PTR arg) {
82645         LDKUtxo ret_var = Utxo_clone(arg);
82646         int64_t ret_ref = 0;
82647         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82648         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82649         return ret_ref;
82650 }
82651 int64_t  CS_LDK_Utxo_clone_ptr(int64_t arg) {
82652         LDKUtxo arg_conv;
82653         arg_conv.inner = untag_ptr(arg);
82654         arg_conv.is_owned = ptr_is_owned(arg);
82655         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
82656         arg_conv.is_owned = false;
82657         int64_t ret_conv = Utxo_clone_ptr(&arg_conv);
82658         return ret_conv;
82659 }
82660
82661 int64_t  CS_LDK_Utxo_clone(int64_t orig) {
82662         LDKUtxo orig_conv;
82663         orig_conv.inner = untag_ptr(orig);
82664         orig_conv.is_owned = ptr_is_owned(orig);
82665         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
82666         orig_conv.is_owned = false;
82667         LDKUtxo ret_var = Utxo_clone(&orig_conv);
82668         int64_t ret_ref = 0;
82669         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82670         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82671         return ret_ref;
82672 }
82673
82674 int64_t  CS_LDK_Utxo_hash(int64_t o) {
82675         LDKUtxo o_conv;
82676         o_conv.inner = untag_ptr(o);
82677         o_conv.is_owned = ptr_is_owned(o);
82678         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
82679         o_conv.is_owned = false;
82680         int64_t ret_conv = Utxo_hash(&o_conv);
82681         return ret_conv;
82682 }
82683
82684 jboolean  CS_LDK_Utxo_eq(int64_t a, int64_t b) {
82685         LDKUtxo a_conv;
82686         a_conv.inner = untag_ptr(a);
82687         a_conv.is_owned = ptr_is_owned(a);
82688         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
82689         a_conv.is_owned = false;
82690         LDKUtxo b_conv;
82691         b_conv.inner = untag_ptr(b);
82692         b_conv.is_owned = ptr_is_owned(b);
82693         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
82694         b_conv.is_owned = false;
82695         jboolean ret_conv = Utxo_eq(&a_conv, &b_conv);
82696         return ret_conv;
82697 }
82698
82699 int64_t  CS_LDK_Utxo_new_p2pkh(int64_t outpoint, int64_t value, int8_tArray pubkey_hash) {
82700         LDKOutPoint outpoint_conv;
82701         outpoint_conv.inner = untag_ptr(outpoint);
82702         outpoint_conv.is_owned = ptr_is_owned(outpoint);
82703         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_conv);
82704         outpoint_conv = OutPoint_clone(&outpoint_conv);
82705         uint8_t pubkey_hash_arr[20];
82706         CHECK(pubkey_hash->arr_len == 20);
82707         memcpy(pubkey_hash_arr, pubkey_hash->elems, 20); FREE(pubkey_hash);
82708         uint8_t (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
82709         LDKUtxo ret_var = Utxo_new_p2pkh(outpoint_conv, value, pubkey_hash_ref);
82710         int64_t ret_ref = 0;
82711         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82712         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82713         return ret_ref;
82714 }
82715
82716 void  CS_LDK_CoinSelection_free(int64_t this_obj) {
82717         LDKCoinSelection this_obj_conv;
82718         this_obj_conv.inner = untag_ptr(this_obj);
82719         this_obj_conv.is_owned = ptr_is_owned(this_obj);
82720         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
82721         CoinSelection_free(this_obj_conv);
82722 }
82723
82724 int64_tArray  CS_LDK_CoinSelection_get_confirmed_utxos(int64_t this_ptr) {
82725         LDKCoinSelection this_ptr_conv;
82726         this_ptr_conv.inner = untag_ptr(this_ptr);
82727         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
82728         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
82729         this_ptr_conv.is_owned = false;
82730         LDKCVec_UtxoZ ret_var = CoinSelection_get_confirmed_utxos(&this_ptr_conv);
82731         int64_tArray ret_arr = NULL;
82732         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
82733         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
82734         for (size_t g = 0; g < ret_var.datalen; g++) {
82735                 LDKUtxo ret_conv_6_var = ret_var.data[g];
82736                 int64_t ret_conv_6_ref = 0;
82737                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_6_var);
82738                 ret_conv_6_ref = tag_ptr(ret_conv_6_var.inner, ret_conv_6_var.is_owned);
82739                 ret_arr_ptr[g] = ret_conv_6_ref;
82740         }
82741         
82742         FREE(ret_var.data);
82743         return ret_arr;
82744 }
82745
82746 void  CS_LDK_CoinSelection_set_confirmed_utxos(int64_t this_ptr, int64_tArray val) {
82747         LDKCoinSelection this_ptr_conv;
82748         this_ptr_conv.inner = untag_ptr(this_ptr);
82749         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
82750         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
82751         this_ptr_conv.is_owned = false;
82752         LDKCVec_UtxoZ val_constr;
82753         val_constr.datalen = val->arr_len;
82754         if (val_constr.datalen > 0)
82755                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUtxo), "LDKCVec_UtxoZ Elements");
82756         else
82757                 val_constr.data = NULL;
82758         int64_t* val_vals = val->elems;
82759         for (size_t g = 0; g < val_constr.datalen; g++) {
82760                 int64_t val_conv_6 = val_vals[g];
82761                 LDKUtxo val_conv_6_conv;
82762                 val_conv_6_conv.inner = untag_ptr(val_conv_6);
82763                 val_conv_6_conv.is_owned = ptr_is_owned(val_conv_6);
82764                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_6_conv);
82765                 val_conv_6_conv = Utxo_clone(&val_conv_6_conv);
82766                 val_constr.data[g] = val_conv_6_conv;
82767         }
82768         FREE(val);
82769         CoinSelection_set_confirmed_utxos(&this_ptr_conv, val_constr);
82770 }
82771
82772 int64_t  CS_LDK_CoinSelection_get_change_output(int64_t this_ptr) {
82773         LDKCoinSelection this_ptr_conv;
82774         this_ptr_conv.inner = untag_ptr(this_ptr);
82775         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
82776         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
82777         this_ptr_conv.is_owned = false;
82778         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
82779         *ret_copy = CoinSelection_get_change_output(&this_ptr_conv);
82780         int64_t ret_ref = tag_ptr(ret_copy, true);
82781         return ret_ref;
82782 }
82783
82784 void  CS_LDK_CoinSelection_set_change_output(int64_t this_ptr, int64_t val) {
82785         LDKCoinSelection this_ptr_conv;
82786         this_ptr_conv.inner = untag_ptr(this_ptr);
82787         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
82788         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
82789         this_ptr_conv.is_owned = false;
82790         void* val_ptr = untag_ptr(val);
82791         CHECK_ACCESS(val_ptr);
82792         LDKCOption_TxOutZ val_conv = *(LDKCOption_TxOutZ*)(val_ptr);
82793         val_conv = COption_TxOutZ_clone((LDKCOption_TxOutZ*)untag_ptr(val));
82794         CoinSelection_set_change_output(&this_ptr_conv, val_conv);
82795 }
82796
82797 int64_t  CS_LDK_CoinSelection_new(int64_tArray confirmed_utxos_arg, int64_t change_output_arg) {
82798         LDKCVec_UtxoZ confirmed_utxos_arg_constr;
82799         confirmed_utxos_arg_constr.datalen = confirmed_utxos_arg->arr_len;
82800         if (confirmed_utxos_arg_constr.datalen > 0)
82801                 confirmed_utxos_arg_constr.data = MALLOC(confirmed_utxos_arg_constr.datalen * sizeof(LDKUtxo), "LDKCVec_UtxoZ Elements");
82802         else
82803                 confirmed_utxos_arg_constr.data = NULL;
82804         int64_t* confirmed_utxos_arg_vals = confirmed_utxos_arg->elems;
82805         for (size_t g = 0; g < confirmed_utxos_arg_constr.datalen; g++) {
82806                 int64_t confirmed_utxos_arg_conv_6 = confirmed_utxos_arg_vals[g];
82807                 LDKUtxo confirmed_utxos_arg_conv_6_conv;
82808                 confirmed_utxos_arg_conv_6_conv.inner = untag_ptr(confirmed_utxos_arg_conv_6);
82809                 confirmed_utxos_arg_conv_6_conv.is_owned = ptr_is_owned(confirmed_utxos_arg_conv_6);
82810                 CHECK_INNER_FIELD_ACCESS_OR_NULL(confirmed_utxos_arg_conv_6_conv);
82811                 confirmed_utxos_arg_conv_6_conv = Utxo_clone(&confirmed_utxos_arg_conv_6_conv);
82812                 confirmed_utxos_arg_constr.data[g] = confirmed_utxos_arg_conv_6_conv;
82813         }
82814         FREE(confirmed_utxos_arg);
82815         void* change_output_arg_ptr = untag_ptr(change_output_arg);
82816         CHECK_ACCESS(change_output_arg_ptr);
82817         LDKCOption_TxOutZ change_output_arg_conv = *(LDKCOption_TxOutZ*)(change_output_arg_ptr);
82818         change_output_arg_conv = COption_TxOutZ_clone((LDKCOption_TxOutZ*)untag_ptr(change_output_arg));
82819         LDKCoinSelection ret_var = CoinSelection_new(confirmed_utxos_arg_constr, change_output_arg_conv);
82820         int64_t ret_ref = 0;
82821         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82822         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82823         return ret_ref;
82824 }
82825
82826 static inline uint64_t CoinSelection_clone_ptr(LDKCoinSelection *NONNULL_PTR arg) {
82827         LDKCoinSelection ret_var = CoinSelection_clone(arg);
82828         int64_t ret_ref = 0;
82829         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82830         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82831         return ret_ref;
82832 }
82833 int64_t  CS_LDK_CoinSelection_clone_ptr(int64_t arg) {
82834         LDKCoinSelection arg_conv;
82835         arg_conv.inner = untag_ptr(arg);
82836         arg_conv.is_owned = ptr_is_owned(arg);
82837         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
82838         arg_conv.is_owned = false;
82839         int64_t ret_conv = CoinSelection_clone_ptr(&arg_conv);
82840         return ret_conv;
82841 }
82842
82843 int64_t  CS_LDK_CoinSelection_clone(int64_t orig) {
82844         LDKCoinSelection orig_conv;
82845         orig_conv.inner = untag_ptr(orig);
82846         orig_conv.is_owned = ptr_is_owned(orig);
82847         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
82848         orig_conv.is_owned = false;
82849         LDKCoinSelection ret_var = CoinSelection_clone(&orig_conv);
82850         int64_t ret_ref = 0;
82851         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82852         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82853         return ret_ref;
82854 }
82855
82856 void  CS_LDK_CoinSelectionSource_free(int64_t this_ptr) {
82857         if (!ptr_is_owned(this_ptr)) return;
82858         void* this_ptr_ptr = untag_ptr(this_ptr);
82859         CHECK_ACCESS(this_ptr_ptr);
82860         LDKCoinSelectionSource this_ptr_conv = *(LDKCoinSelectionSource*)(this_ptr_ptr);
82861         FREE(untag_ptr(this_ptr));
82862         CoinSelectionSource_free(this_ptr_conv);
82863 }
82864
82865 void  CS_LDK_WalletSource_free(int64_t this_ptr) {
82866         if (!ptr_is_owned(this_ptr)) return;
82867         void* this_ptr_ptr = untag_ptr(this_ptr);
82868         CHECK_ACCESS(this_ptr_ptr);
82869         LDKWalletSource this_ptr_conv = *(LDKWalletSource*)(this_ptr_ptr);
82870         FREE(untag_ptr(this_ptr));
82871         WalletSource_free(this_ptr_conv);
82872 }
82873
82874 void  CS_LDK_Wallet_free(int64_t this_obj) {
82875         LDKWallet this_obj_conv;
82876         this_obj_conv.inner = untag_ptr(this_obj);
82877         this_obj_conv.is_owned = ptr_is_owned(this_obj);
82878         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
82879         Wallet_free(this_obj_conv);
82880 }
82881
82882 int64_t  CS_LDK_Wallet_new(int64_t source, int64_t logger) {
82883         void* source_ptr = untag_ptr(source);
82884         CHECK_ACCESS(source_ptr);
82885         LDKWalletSource source_conv = *(LDKWalletSource*)(source_ptr);
82886         if (source_conv.free == LDKWalletSource_JCalls_free) {
82887                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
82888                 LDKWalletSource_JCalls_cloned(&source_conv);
82889         }
82890         void* logger_ptr = untag_ptr(logger);
82891         CHECK_ACCESS(logger_ptr);
82892         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
82893         if (logger_conv.free == LDKLogger_JCalls_free) {
82894                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
82895                 LDKLogger_JCalls_cloned(&logger_conv);
82896         }
82897         LDKWallet ret_var = Wallet_new(source_conv, logger_conv);
82898         int64_t ret_ref = 0;
82899         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82900         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82901         return ret_ref;
82902 }
82903
82904 int64_t  CS_LDK_Wallet_as_CoinSelectionSource(int64_t this_arg) {
82905         LDKWallet this_arg_conv;
82906         this_arg_conv.inner = untag_ptr(this_arg);
82907         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82908         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82909         this_arg_conv.is_owned = false;
82910         LDKCoinSelectionSource* ret_ret = MALLOC(sizeof(LDKCoinSelectionSource), "LDKCoinSelectionSource");
82911         *ret_ret = Wallet_as_CoinSelectionSource(&this_arg_conv);
82912         return tag_ptr(ret_ret, true);
82913 }
82914
82915 void  CS_LDK_BumpTransactionEventHandler_free(int64_t this_obj) {
82916         LDKBumpTransactionEventHandler this_obj_conv;
82917         this_obj_conv.inner = untag_ptr(this_obj);
82918         this_obj_conv.is_owned = ptr_is_owned(this_obj);
82919         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
82920         BumpTransactionEventHandler_free(this_obj_conv);
82921 }
82922
82923 int64_t  CS_LDK_BumpTransactionEventHandler_new(int64_t broadcaster, int64_t utxo_source, int64_t signer_provider, int64_t logger) {
82924         void* broadcaster_ptr = untag_ptr(broadcaster);
82925         CHECK_ACCESS(broadcaster_ptr);
82926         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
82927         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
82928                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
82929                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
82930         }
82931         void* utxo_source_ptr = untag_ptr(utxo_source);
82932         CHECK_ACCESS(utxo_source_ptr);
82933         LDKCoinSelectionSource utxo_source_conv = *(LDKCoinSelectionSource*)(utxo_source_ptr);
82934         if (utxo_source_conv.free == LDKCoinSelectionSource_JCalls_free) {
82935                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
82936                 LDKCoinSelectionSource_JCalls_cloned(&utxo_source_conv);
82937         }
82938         void* signer_provider_ptr = untag_ptr(signer_provider);
82939         CHECK_ACCESS(signer_provider_ptr);
82940         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
82941         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
82942                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
82943                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
82944         }
82945         void* logger_ptr = untag_ptr(logger);
82946         CHECK_ACCESS(logger_ptr);
82947         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
82948         if (logger_conv.free == LDKLogger_JCalls_free) {
82949                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
82950                 LDKLogger_JCalls_cloned(&logger_conv);
82951         }
82952         LDKBumpTransactionEventHandler ret_var = BumpTransactionEventHandler_new(broadcaster_conv, utxo_source_conv, signer_provider_conv, logger_conv);
82953         int64_t ret_ref = 0;
82954         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82955         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82956         return ret_ref;
82957 }
82958
82959 void  CS_LDK_BumpTransactionEventHandler_handle_event(int64_t this_arg, int64_t event) {
82960         LDKBumpTransactionEventHandler this_arg_conv;
82961         this_arg_conv.inner = untag_ptr(this_arg);
82962         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82963         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82964         this_arg_conv.is_owned = false;
82965         LDKBumpTransactionEvent* event_conv = (LDKBumpTransactionEvent*)untag_ptr(event);
82966         BumpTransactionEventHandler_handle_event(&this_arg_conv, event_conv);
82967 }
82968
82969 void  CS_LDK_FilesystemStore_free(int64_t this_obj) {
82970         LDKFilesystemStore this_obj_conv;
82971         this_obj_conv.inner = untag_ptr(this_obj);
82972         this_obj_conv.is_owned = ptr_is_owned(this_obj);
82973         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
82974         FilesystemStore_free(this_obj_conv);
82975 }
82976
82977 int64_t  CS_LDK_FilesystemStore_new(jstring data_dir) {
82978         LDKStr data_dir_conv = str_ref_to_owned_c(data_dir);
82979         LDKFilesystemStore ret_var = FilesystemStore_new(data_dir_conv);
82980         int64_t ret_ref = 0;
82981         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82982         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82983         return ret_ref;
82984 }
82985
82986 jstring  CS_LDK_FilesystemStore_get_data_dir(int64_t this_arg) {
82987         LDKFilesystemStore this_arg_conv;
82988         this_arg_conv.inner = untag_ptr(this_arg);
82989         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82990         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82991         this_arg_conv.is_owned = false;
82992         LDKStr ret_str = FilesystemStore_get_data_dir(&this_arg_conv);
82993         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
82994         Str_free(ret_str);
82995         return ret_conv;
82996 }
82997
82998 int64_t  CS_LDK_FilesystemStore_as_KVStore(int64_t this_arg) {
82999         LDKFilesystemStore this_arg_conv;
83000         this_arg_conv.inner = untag_ptr(this_arg);
83001         this_arg_conv.is_owned = ptr_is_owned(this_arg);
83002         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
83003         this_arg_conv.is_owned = false;
83004         LDKKVStore* ret_ret = MALLOC(sizeof(LDKKVStore), "LDKKVStore");
83005         *ret_ret = FilesystemStore_as_KVStore(&this_arg_conv);
83006         return tag_ptr(ret_ret, true);
83007 }
83008
83009 void  CS_LDK_BackgroundProcessor_free(int64_t this_obj) {
83010         LDKBackgroundProcessor this_obj_conv;
83011         this_obj_conv.inner = untag_ptr(this_obj);
83012         this_obj_conv.is_owned = ptr_is_owned(this_obj);
83013         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
83014         BackgroundProcessor_free(this_obj_conv);
83015 }
83016
83017 void  CS_LDK_GossipSync_free(int64_t this_ptr) {
83018         if (!ptr_is_owned(this_ptr)) return;
83019         void* this_ptr_ptr = untag_ptr(this_ptr);
83020         CHECK_ACCESS(this_ptr_ptr);
83021         LDKGossipSync this_ptr_conv = *(LDKGossipSync*)(this_ptr_ptr);
83022         FREE(untag_ptr(this_ptr));
83023         GossipSync_free(this_ptr_conv);
83024 }
83025
83026 int64_t  CS_LDK_GossipSync_p2_p(int64_t a) {
83027         LDKP2PGossipSync a_conv;
83028         a_conv.inner = untag_ptr(a);
83029         a_conv.is_owned = ptr_is_owned(a);
83030         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
83031         a_conv.is_owned = false;
83032         LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
83033         *ret_copy = GossipSync_p2_p(&a_conv);
83034         int64_t ret_ref = tag_ptr(ret_copy, true);
83035         return ret_ref;
83036 }
83037
83038 int64_t  CS_LDK_GossipSync_rapid(int64_t a) {
83039         LDKRapidGossipSync a_conv;
83040         a_conv.inner = untag_ptr(a);
83041         a_conv.is_owned = ptr_is_owned(a);
83042         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
83043         a_conv.is_owned = false;
83044         LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
83045         *ret_copy = GossipSync_rapid(&a_conv);
83046         int64_t ret_ref = tag_ptr(ret_copy, true);
83047         return ret_ref;
83048 }
83049
83050 int64_t  CS_LDK_GossipSync_none() {
83051         LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
83052         *ret_copy = GossipSync_none();
83053         int64_t ret_ref = tag_ptr(ret_copy, true);
83054         return ret_ref;
83055 }
83056
83057 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) {
83058         void* persister_ptr = untag_ptr(persister);
83059         CHECK_ACCESS(persister_ptr);
83060         LDKPersister persister_conv = *(LDKPersister*)(persister_ptr);
83061         if (persister_conv.free == LDKPersister_JCalls_free) {
83062                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
83063                 LDKPersister_JCalls_cloned(&persister_conv);
83064         }
83065         void* event_handler_ptr = untag_ptr(event_handler);
83066         CHECK_ACCESS(event_handler_ptr);
83067         LDKEventHandler event_handler_conv = *(LDKEventHandler*)(event_handler_ptr);
83068         if (event_handler_conv.free == LDKEventHandler_JCalls_free) {
83069                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
83070                 LDKEventHandler_JCalls_cloned(&event_handler_conv);
83071         }
83072         LDKChainMonitor chain_monitor_conv;
83073         chain_monitor_conv.inner = untag_ptr(chain_monitor);
83074         chain_monitor_conv.is_owned = ptr_is_owned(chain_monitor);
83075         CHECK_INNER_FIELD_ACCESS_OR_NULL(chain_monitor_conv);
83076         chain_monitor_conv.is_owned = false;
83077         LDKChannelManager channel_manager_conv;
83078         channel_manager_conv.inner = untag_ptr(channel_manager);
83079         channel_manager_conv.is_owned = ptr_is_owned(channel_manager);
83080         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_conv);
83081         channel_manager_conv.is_owned = false;
83082         void* gossip_sync_ptr = untag_ptr(gossip_sync);
83083         CHECK_ACCESS(gossip_sync_ptr);
83084         LDKGossipSync gossip_sync_conv = *(LDKGossipSync*)(gossip_sync_ptr);
83085         // WARNING: we may need a move here but no clone is available for LDKGossipSync
83086         LDKPeerManager peer_manager_conv;
83087         peer_manager_conv.inner = untag_ptr(peer_manager);
83088         peer_manager_conv.is_owned = ptr_is_owned(peer_manager);
83089         CHECK_INNER_FIELD_ACCESS_OR_NULL(peer_manager_conv);
83090         peer_manager_conv.is_owned = false;
83091         void* logger_ptr = untag_ptr(logger);
83092         CHECK_ACCESS(logger_ptr);
83093         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
83094         if (logger_conv.free == LDKLogger_JCalls_free) {
83095                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
83096                 LDKLogger_JCalls_cloned(&logger_conv);
83097         }
83098         void* scorer_ptr = untag_ptr(scorer);
83099         CHECK_ACCESS(scorer_ptr);
83100         LDKCOption_WriteableScoreZ scorer_conv = *(LDKCOption_WriteableScoreZ*)(scorer_ptr);
83101         // WARNING: we may need a move here but no clone is available for LDKCOption_WriteableScoreZ
83102         if (scorer_conv.tag == LDKCOption_WriteableScoreZ_Some) {
83103                 // Manually implement clone for Java trait instances
83104                 if (scorer_conv.some.free == LDKWriteableScore_JCalls_free) {
83105                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
83106                         LDKWriteableScore_JCalls_cloned(&scorer_conv.some);
83107                 }
83108         }
83109         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);
83110         int64_t ret_ref = 0;
83111         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83112         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83113         return ret_ref;
83114 }
83115
83116 int64_t  CS_LDK_BackgroundProcessor_join(int64_t this_arg) {
83117         LDKBackgroundProcessor this_arg_conv;
83118         this_arg_conv.inner = untag_ptr(this_arg);
83119         this_arg_conv.is_owned = ptr_is_owned(this_arg);
83120         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
83121         // WARNING: we need a move here but no clone is available for LDKBackgroundProcessor
83122         
83123         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
83124         *ret_conv = BackgroundProcessor_join(this_arg_conv);
83125         return tag_ptr(ret_conv, true);
83126 }
83127
83128 int64_t  CS_LDK_BackgroundProcessor_stop(int64_t this_arg) {
83129         LDKBackgroundProcessor this_arg_conv;
83130         this_arg_conv.inner = untag_ptr(this_arg);
83131         this_arg_conv.is_owned = ptr_is_owned(this_arg);
83132         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
83133         // WARNING: we need a move here but no clone is available for LDKBackgroundProcessor
83134         
83135         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
83136         *ret_conv = BackgroundProcessor_stop(this_arg_conv);
83137         return tag_ptr(ret_conv, true);
83138 }
83139
83140 void  CS_LDK_Bolt11ParseError_free(int64_t this_ptr) {
83141         if (!ptr_is_owned(this_ptr)) return;
83142         void* this_ptr_ptr = untag_ptr(this_ptr);
83143         CHECK_ACCESS(this_ptr_ptr);
83144         LDKBolt11ParseError this_ptr_conv = *(LDKBolt11ParseError*)(this_ptr_ptr);
83145         FREE(untag_ptr(this_ptr));
83146         Bolt11ParseError_free(this_ptr_conv);
83147 }
83148
83149 static inline uint64_t Bolt11ParseError_clone_ptr(LDKBolt11ParseError *NONNULL_PTR arg) {
83150         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
83151         *ret_copy = Bolt11ParseError_clone(arg);
83152         int64_t ret_ref = tag_ptr(ret_copy, true);
83153         return ret_ref;
83154 }
83155 int64_t  CS_LDK_Bolt11ParseError_clone_ptr(int64_t arg) {
83156         LDKBolt11ParseError* arg_conv = (LDKBolt11ParseError*)untag_ptr(arg);
83157         int64_t ret_conv = Bolt11ParseError_clone_ptr(arg_conv);
83158         return ret_conv;
83159 }
83160
83161 int64_t  CS_LDK_Bolt11ParseError_clone(int64_t orig) {
83162         LDKBolt11ParseError* orig_conv = (LDKBolt11ParseError*)untag_ptr(orig);
83163         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
83164         *ret_copy = Bolt11ParseError_clone(orig_conv);
83165         int64_t ret_ref = tag_ptr(ret_copy, true);
83166         return ret_ref;
83167 }
83168
83169 int64_t  CS_LDK_Bolt11ParseError_bech32_error(int64_t a) {
83170         void* a_ptr = untag_ptr(a);
83171         CHECK_ACCESS(a_ptr);
83172         LDKBech32Error a_conv = *(LDKBech32Error*)(a_ptr);
83173         a_conv = Bech32Error_clone((LDKBech32Error*)untag_ptr(a));
83174         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
83175         *ret_copy = Bolt11ParseError_bech32_error(a_conv);
83176         int64_t ret_ref = tag_ptr(ret_copy, true);
83177         return ret_ref;
83178 }
83179
83180 int64_t  CS_LDK_Bolt11ParseError_parse_amount_error(int32_t a) {
83181         
83182         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
83183         *ret_copy = Bolt11ParseError_parse_amount_error((LDKError){ ._dummy = 0 });
83184         int64_t ret_ref = tag_ptr(ret_copy, true);
83185         return ret_ref;
83186 }
83187
83188 int64_t  CS_LDK_Bolt11ParseError_malformed_signature(int32_t a) {
83189         LDKSecp256k1Error a_conv = LDKSecp256k1Error_from_cs(a);
83190         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
83191         *ret_copy = Bolt11ParseError_malformed_signature(a_conv);
83192         int64_t ret_ref = tag_ptr(ret_copy, true);
83193         return ret_ref;
83194 }
83195
83196 int64_t  CS_LDK_Bolt11ParseError_bad_prefix() {
83197         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
83198         *ret_copy = Bolt11ParseError_bad_prefix();
83199         int64_t ret_ref = tag_ptr(ret_copy, true);
83200         return ret_ref;
83201 }
83202
83203 int64_t  CS_LDK_Bolt11ParseError_unknown_currency() {
83204         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
83205         *ret_copy = Bolt11ParseError_unknown_currency();
83206         int64_t ret_ref = tag_ptr(ret_copy, true);
83207         return ret_ref;
83208 }
83209
83210 int64_t  CS_LDK_Bolt11ParseError_unknown_si_prefix() {
83211         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
83212         *ret_copy = Bolt11ParseError_unknown_si_prefix();
83213         int64_t ret_ref = tag_ptr(ret_copy, true);
83214         return ret_ref;
83215 }
83216
83217 int64_t  CS_LDK_Bolt11ParseError_malformed_hrp() {
83218         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
83219         *ret_copy = Bolt11ParseError_malformed_hrp();
83220         int64_t ret_ref = tag_ptr(ret_copy, true);
83221         return ret_ref;
83222 }
83223
83224 int64_t  CS_LDK_Bolt11ParseError_too_short_data_part() {
83225         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
83226         *ret_copy = Bolt11ParseError_too_short_data_part();
83227         int64_t ret_ref = tag_ptr(ret_copy, true);
83228         return ret_ref;
83229 }
83230
83231 int64_t  CS_LDK_Bolt11ParseError_unexpected_end_of_tagged_fields() {
83232         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
83233         *ret_copy = Bolt11ParseError_unexpected_end_of_tagged_fields();
83234         int64_t ret_ref = tag_ptr(ret_copy, true);
83235         return ret_ref;
83236 }
83237
83238 int64_t  CS_LDK_Bolt11ParseError_description_decode_error(int32_t a) {
83239         
83240         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
83241         *ret_copy = Bolt11ParseError_description_decode_error((LDKError){ ._dummy = 0 });
83242         int64_t ret_ref = tag_ptr(ret_copy, true);
83243         return ret_ref;
83244 }
83245
83246 int64_t  CS_LDK_Bolt11ParseError_padding_error() {
83247         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
83248         *ret_copy = Bolt11ParseError_padding_error();
83249         int64_t ret_ref = tag_ptr(ret_copy, true);
83250         return ret_ref;
83251 }
83252
83253 int64_t  CS_LDK_Bolt11ParseError_integer_overflow_error() {
83254         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
83255         *ret_copy = Bolt11ParseError_integer_overflow_error();
83256         int64_t ret_ref = tag_ptr(ret_copy, true);
83257         return ret_ref;
83258 }
83259
83260 int64_t  CS_LDK_Bolt11ParseError_invalid_seg_wit_program_length() {
83261         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
83262         *ret_copy = Bolt11ParseError_invalid_seg_wit_program_length();
83263         int64_t ret_ref = tag_ptr(ret_copy, true);
83264         return ret_ref;
83265 }
83266
83267 int64_t  CS_LDK_Bolt11ParseError_invalid_pub_key_hash_length() {
83268         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
83269         *ret_copy = Bolt11ParseError_invalid_pub_key_hash_length();
83270         int64_t ret_ref = tag_ptr(ret_copy, true);
83271         return ret_ref;
83272 }
83273
83274 int64_t  CS_LDK_Bolt11ParseError_invalid_script_hash_length() {
83275         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
83276         *ret_copy = Bolt11ParseError_invalid_script_hash_length();
83277         int64_t ret_ref = tag_ptr(ret_copy, true);
83278         return ret_ref;
83279 }
83280
83281 int64_t  CS_LDK_Bolt11ParseError_invalid_recovery_id() {
83282         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
83283         *ret_copy = Bolt11ParseError_invalid_recovery_id();
83284         int64_t ret_ref = tag_ptr(ret_copy, true);
83285         return ret_ref;
83286 }
83287
83288 int64_t  CS_LDK_Bolt11ParseError_invalid_slice_length(jstring a) {
83289         LDKStr a_conv = str_ref_to_owned_c(a);
83290         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
83291         *ret_copy = Bolt11ParseError_invalid_slice_length(a_conv);
83292         int64_t ret_ref = tag_ptr(ret_copy, true);
83293         return ret_ref;
83294 }
83295
83296 int64_t  CS_LDK_Bolt11ParseError_skip() {
83297         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
83298         *ret_copy = Bolt11ParseError_skip();
83299         int64_t ret_ref = tag_ptr(ret_copy, true);
83300         return ret_ref;
83301 }
83302
83303 jboolean  CS_LDK_Bolt11ParseError_eq(int64_t a, int64_t b) {
83304         LDKBolt11ParseError* a_conv = (LDKBolt11ParseError*)untag_ptr(a);
83305         LDKBolt11ParseError* b_conv = (LDKBolt11ParseError*)untag_ptr(b);
83306         jboolean ret_conv = Bolt11ParseError_eq(a_conv, b_conv);
83307         return ret_conv;
83308 }
83309
83310 void  CS_LDK_ParseOrSemanticError_free(int64_t this_ptr) {
83311         if (!ptr_is_owned(this_ptr)) return;
83312         void* this_ptr_ptr = untag_ptr(this_ptr);
83313         CHECK_ACCESS(this_ptr_ptr);
83314         LDKParseOrSemanticError this_ptr_conv = *(LDKParseOrSemanticError*)(this_ptr_ptr);
83315         FREE(untag_ptr(this_ptr));
83316         ParseOrSemanticError_free(this_ptr_conv);
83317 }
83318
83319 static inline uint64_t ParseOrSemanticError_clone_ptr(LDKParseOrSemanticError *NONNULL_PTR arg) {
83320         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
83321         *ret_copy = ParseOrSemanticError_clone(arg);
83322         int64_t ret_ref = tag_ptr(ret_copy, true);
83323         return ret_ref;
83324 }
83325 int64_t  CS_LDK_ParseOrSemanticError_clone_ptr(int64_t arg) {
83326         LDKParseOrSemanticError* arg_conv = (LDKParseOrSemanticError*)untag_ptr(arg);
83327         int64_t ret_conv = ParseOrSemanticError_clone_ptr(arg_conv);
83328         return ret_conv;
83329 }
83330
83331 int64_t  CS_LDK_ParseOrSemanticError_clone(int64_t orig) {
83332         LDKParseOrSemanticError* orig_conv = (LDKParseOrSemanticError*)untag_ptr(orig);
83333         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
83334         *ret_copy = ParseOrSemanticError_clone(orig_conv);
83335         int64_t ret_ref = tag_ptr(ret_copy, true);
83336         return ret_ref;
83337 }
83338
83339 int64_t  CS_LDK_ParseOrSemanticError_parse_error(int64_t a) {
83340         void* a_ptr = untag_ptr(a);
83341         CHECK_ACCESS(a_ptr);
83342         LDKBolt11ParseError a_conv = *(LDKBolt11ParseError*)(a_ptr);
83343         a_conv = Bolt11ParseError_clone((LDKBolt11ParseError*)untag_ptr(a));
83344         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
83345         *ret_copy = ParseOrSemanticError_parse_error(a_conv);
83346         int64_t ret_ref = tag_ptr(ret_copy, true);
83347         return ret_ref;
83348 }
83349
83350 int64_t  CS_LDK_ParseOrSemanticError_semantic_error(int32_t a) {
83351         LDKBolt11SemanticError a_conv = LDKBolt11SemanticError_from_cs(a);
83352         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
83353         *ret_copy = ParseOrSemanticError_semantic_error(a_conv);
83354         int64_t ret_ref = tag_ptr(ret_copy, true);
83355         return ret_ref;
83356 }
83357
83358 jboolean  CS_LDK_ParseOrSemanticError_eq(int64_t a, int64_t b) {
83359         LDKParseOrSemanticError* a_conv = (LDKParseOrSemanticError*)untag_ptr(a);
83360         LDKParseOrSemanticError* b_conv = (LDKParseOrSemanticError*)untag_ptr(b);
83361         jboolean ret_conv = ParseOrSemanticError_eq(a_conv, b_conv);
83362         return ret_conv;
83363 }
83364
83365 void  CS_LDK_Bolt11Invoice_free(int64_t this_obj) {
83366         LDKBolt11Invoice this_obj_conv;
83367         this_obj_conv.inner = untag_ptr(this_obj);
83368         this_obj_conv.is_owned = ptr_is_owned(this_obj);
83369         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
83370         Bolt11Invoice_free(this_obj_conv);
83371 }
83372
83373 jboolean  CS_LDK_Bolt11Invoice_eq(int64_t a, int64_t b) {
83374         LDKBolt11Invoice a_conv;
83375         a_conv.inner = untag_ptr(a);
83376         a_conv.is_owned = ptr_is_owned(a);
83377         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
83378         a_conv.is_owned = false;
83379         LDKBolt11Invoice b_conv;
83380         b_conv.inner = untag_ptr(b);
83381         b_conv.is_owned = ptr_is_owned(b);
83382         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
83383         b_conv.is_owned = false;
83384         jboolean ret_conv = Bolt11Invoice_eq(&a_conv, &b_conv);
83385         return ret_conv;
83386 }
83387
83388 static inline uint64_t Bolt11Invoice_clone_ptr(LDKBolt11Invoice *NONNULL_PTR arg) {
83389         LDKBolt11Invoice ret_var = Bolt11Invoice_clone(arg);
83390         int64_t ret_ref = 0;
83391         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83392         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83393         return ret_ref;
83394 }
83395 int64_t  CS_LDK_Bolt11Invoice_clone_ptr(int64_t arg) {
83396         LDKBolt11Invoice arg_conv;
83397         arg_conv.inner = untag_ptr(arg);
83398         arg_conv.is_owned = ptr_is_owned(arg);
83399         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
83400         arg_conv.is_owned = false;
83401         int64_t ret_conv = Bolt11Invoice_clone_ptr(&arg_conv);
83402         return ret_conv;
83403 }
83404
83405 int64_t  CS_LDK_Bolt11Invoice_clone(int64_t orig) {
83406         LDKBolt11Invoice orig_conv;
83407         orig_conv.inner = untag_ptr(orig);
83408         orig_conv.is_owned = ptr_is_owned(orig);
83409         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
83410         orig_conv.is_owned = false;
83411         LDKBolt11Invoice ret_var = Bolt11Invoice_clone(&orig_conv);
83412         int64_t ret_ref = 0;
83413         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83414         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83415         return ret_ref;
83416 }
83417
83418 int64_t  CS_LDK_Bolt11Invoice_hash(int64_t o) {
83419         LDKBolt11Invoice o_conv;
83420         o_conv.inner = untag_ptr(o);
83421         o_conv.is_owned = ptr_is_owned(o);
83422         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
83423         o_conv.is_owned = false;
83424         int64_t ret_conv = Bolt11Invoice_hash(&o_conv);
83425         return ret_conv;
83426 }
83427
83428 void  CS_LDK_SignedRawBolt11Invoice_free(int64_t this_obj) {
83429         LDKSignedRawBolt11Invoice this_obj_conv;
83430         this_obj_conv.inner = untag_ptr(this_obj);
83431         this_obj_conv.is_owned = ptr_is_owned(this_obj);
83432         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
83433         SignedRawBolt11Invoice_free(this_obj_conv);
83434 }
83435
83436 jboolean  CS_LDK_SignedRawBolt11Invoice_eq(int64_t a, int64_t b) {
83437         LDKSignedRawBolt11Invoice a_conv;
83438         a_conv.inner = untag_ptr(a);
83439         a_conv.is_owned = ptr_is_owned(a);
83440         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
83441         a_conv.is_owned = false;
83442         LDKSignedRawBolt11Invoice b_conv;
83443         b_conv.inner = untag_ptr(b);
83444         b_conv.is_owned = ptr_is_owned(b);
83445         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
83446         b_conv.is_owned = false;
83447         jboolean ret_conv = SignedRawBolt11Invoice_eq(&a_conv, &b_conv);
83448         return ret_conv;
83449 }
83450
83451 static inline uint64_t SignedRawBolt11Invoice_clone_ptr(LDKSignedRawBolt11Invoice *NONNULL_PTR arg) {
83452         LDKSignedRawBolt11Invoice ret_var = SignedRawBolt11Invoice_clone(arg);
83453         int64_t ret_ref = 0;
83454         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83455         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83456         return ret_ref;
83457 }
83458 int64_t  CS_LDK_SignedRawBolt11Invoice_clone_ptr(int64_t arg) {
83459         LDKSignedRawBolt11Invoice arg_conv;
83460         arg_conv.inner = untag_ptr(arg);
83461         arg_conv.is_owned = ptr_is_owned(arg);
83462         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
83463         arg_conv.is_owned = false;
83464         int64_t ret_conv = SignedRawBolt11Invoice_clone_ptr(&arg_conv);
83465         return ret_conv;
83466 }
83467
83468 int64_t  CS_LDK_SignedRawBolt11Invoice_clone(int64_t orig) {
83469         LDKSignedRawBolt11Invoice orig_conv;
83470         orig_conv.inner = untag_ptr(orig);
83471         orig_conv.is_owned = ptr_is_owned(orig);
83472         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
83473         orig_conv.is_owned = false;
83474         LDKSignedRawBolt11Invoice ret_var = SignedRawBolt11Invoice_clone(&orig_conv);
83475         int64_t ret_ref = 0;
83476         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83477         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83478         return ret_ref;
83479 }
83480
83481 int64_t  CS_LDK_SignedRawBolt11Invoice_hash(int64_t o) {
83482         LDKSignedRawBolt11Invoice o_conv;
83483         o_conv.inner = untag_ptr(o);
83484         o_conv.is_owned = ptr_is_owned(o);
83485         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
83486         o_conv.is_owned = false;
83487         int64_t ret_conv = SignedRawBolt11Invoice_hash(&o_conv);
83488         return ret_conv;
83489 }
83490
83491 void  CS_LDK_RawBolt11Invoice_free(int64_t this_obj) {
83492         LDKRawBolt11Invoice this_obj_conv;
83493         this_obj_conv.inner = untag_ptr(this_obj);
83494         this_obj_conv.is_owned = ptr_is_owned(this_obj);
83495         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
83496         RawBolt11Invoice_free(this_obj_conv);
83497 }
83498
83499 int64_t  CS_LDK_RawBolt11Invoice_get_data(int64_t this_ptr) {
83500         LDKRawBolt11Invoice this_ptr_conv;
83501         this_ptr_conv.inner = untag_ptr(this_ptr);
83502         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
83503         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
83504         this_ptr_conv.is_owned = false;
83505         LDKRawDataPart ret_var = RawBolt11Invoice_get_data(&this_ptr_conv);
83506         int64_t ret_ref = 0;
83507         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83508         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83509         return ret_ref;
83510 }
83511
83512 void  CS_LDK_RawBolt11Invoice_set_data(int64_t this_ptr, int64_t val) {
83513         LDKRawBolt11Invoice this_ptr_conv;
83514         this_ptr_conv.inner = untag_ptr(this_ptr);
83515         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
83516         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
83517         this_ptr_conv.is_owned = false;
83518         LDKRawDataPart val_conv;
83519         val_conv.inner = untag_ptr(val);
83520         val_conv.is_owned = ptr_is_owned(val);
83521         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
83522         val_conv = RawDataPart_clone(&val_conv);
83523         RawBolt11Invoice_set_data(&this_ptr_conv, val_conv);
83524 }
83525
83526 jboolean  CS_LDK_RawBolt11Invoice_eq(int64_t a, int64_t b) {
83527         LDKRawBolt11Invoice a_conv;
83528         a_conv.inner = untag_ptr(a);
83529         a_conv.is_owned = ptr_is_owned(a);
83530         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
83531         a_conv.is_owned = false;
83532         LDKRawBolt11Invoice b_conv;
83533         b_conv.inner = untag_ptr(b);
83534         b_conv.is_owned = ptr_is_owned(b);
83535         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
83536         b_conv.is_owned = false;
83537         jboolean ret_conv = RawBolt11Invoice_eq(&a_conv, &b_conv);
83538         return ret_conv;
83539 }
83540
83541 static inline uint64_t RawBolt11Invoice_clone_ptr(LDKRawBolt11Invoice *NONNULL_PTR arg) {
83542         LDKRawBolt11Invoice ret_var = RawBolt11Invoice_clone(arg);
83543         int64_t ret_ref = 0;
83544         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83545         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83546         return ret_ref;
83547 }
83548 int64_t  CS_LDK_RawBolt11Invoice_clone_ptr(int64_t arg) {
83549         LDKRawBolt11Invoice arg_conv;
83550         arg_conv.inner = untag_ptr(arg);
83551         arg_conv.is_owned = ptr_is_owned(arg);
83552         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
83553         arg_conv.is_owned = false;
83554         int64_t ret_conv = RawBolt11Invoice_clone_ptr(&arg_conv);
83555         return ret_conv;
83556 }
83557
83558 int64_t  CS_LDK_RawBolt11Invoice_clone(int64_t orig) {
83559         LDKRawBolt11Invoice orig_conv;
83560         orig_conv.inner = untag_ptr(orig);
83561         orig_conv.is_owned = ptr_is_owned(orig);
83562         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
83563         orig_conv.is_owned = false;
83564         LDKRawBolt11Invoice ret_var = RawBolt11Invoice_clone(&orig_conv);
83565         int64_t ret_ref = 0;
83566         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83567         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83568         return ret_ref;
83569 }
83570
83571 int64_t  CS_LDK_RawBolt11Invoice_hash(int64_t o) {
83572         LDKRawBolt11Invoice o_conv;
83573         o_conv.inner = untag_ptr(o);
83574         o_conv.is_owned = ptr_is_owned(o);
83575         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
83576         o_conv.is_owned = false;
83577         int64_t ret_conv = RawBolt11Invoice_hash(&o_conv);
83578         return ret_conv;
83579 }
83580
83581 void  CS_LDK_RawDataPart_free(int64_t this_obj) {
83582         LDKRawDataPart this_obj_conv;
83583         this_obj_conv.inner = untag_ptr(this_obj);
83584         this_obj_conv.is_owned = ptr_is_owned(this_obj);
83585         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
83586         RawDataPart_free(this_obj_conv);
83587 }
83588
83589 int64_t  CS_LDK_RawDataPart_get_timestamp(int64_t this_ptr) {
83590         LDKRawDataPart this_ptr_conv;
83591         this_ptr_conv.inner = untag_ptr(this_ptr);
83592         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
83593         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
83594         this_ptr_conv.is_owned = false;
83595         LDKPositiveTimestamp ret_var = RawDataPart_get_timestamp(&this_ptr_conv);
83596         int64_t ret_ref = 0;
83597         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83598         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83599         return ret_ref;
83600 }
83601
83602 void  CS_LDK_RawDataPart_set_timestamp(int64_t this_ptr, int64_t val) {
83603         LDKRawDataPart this_ptr_conv;
83604         this_ptr_conv.inner = untag_ptr(this_ptr);
83605         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
83606         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
83607         this_ptr_conv.is_owned = false;
83608         LDKPositiveTimestamp val_conv;
83609         val_conv.inner = untag_ptr(val);
83610         val_conv.is_owned = ptr_is_owned(val);
83611         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
83612         val_conv = PositiveTimestamp_clone(&val_conv);
83613         RawDataPart_set_timestamp(&this_ptr_conv, val_conv);
83614 }
83615
83616 jboolean  CS_LDK_RawDataPart_eq(int64_t a, int64_t b) {
83617         LDKRawDataPart a_conv;
83618         a_conv.inner = untag_ptr(a);
83619         a_conv.is_owned = ptr_is_owned(a);
83620         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
83621         a_conv.is_owned = false;
83622         LDKRawDataPart b_conv;
83623         b_conv.inner = untag_ptr(b);
83624         b_conv.is_owned = ptr_is_owned(b);
83625         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
83626         b_conv.is_owned = false;
83627         jboolean ret_conv = RawDataPart_eq(&a_conv, &b_conv);
83628         return ret_conv;
83629 }
83630
83631 static inline uint64_t RawDataPart_clone_ptr(LDKRawDataPart *NONNULL_PTR arg) {
83632         LDKRawDataPart ret_var = RawDataPart_clone(arg);
83633         int64_t ret_ref = 0;
83634         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83635         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83636         return ret_ref;
83637 }
83638 int64_t  CS_LDK_RawDataPart_clone_ptr(int64_t arg) {
83639         LDKRawDataPart arg_conv;
83640         arg_conv.inner = untag_ptr(arg);
83641         arg_conv.is_owned = ptr_is_owned(arg);
83642         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
83643         arg_conv.is_owned = false;
83644         int64_t ret_conv = RawDataPart_clone_ptr(&arg_conv);
83645         return ret_conv;
83646 }
83647
83648 int64_t  CS_LDK_RawDataPart_clone(int64_t orig) {
83649         LDKRawDataPart orig_conv;
83650         orig_conv.inner = untag_ptr(orig);
83651         orig_conv.is_owned = ptr_is_owned(orig);
83652         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
83653         orig_conv.is_owned = false;
83654         LDKRawDataPart ret_var = RawDataPart_clone(&orig_conv);
83655         int64_t ret_ref = 0;
83656         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83657         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83658         return ret_ref;
83659 }
83660
83661 int64_t  CS_LDK_RawDataPart_hash(int64_t o) {
83662         LDKRawDataPart o_conv;
83663         o_conv.inner = untag_ptr(o);
83664         o_conv.is_owned = ptr_is_owned(o);
83665         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
83666         o_conv.is_owned = false;
83667         int64_t ret_conv = RawDataPart_hash(&o_conv);
83668         return ret_conv;
83669 }
83670
83671 void  CS_LDK_PositiveTimestamp_free(int64_t this_obj) {
83672         LDKPositiveTimestamp this_obj_conv;
83673         this_obj_conv.inner = untag_ptr(this_obj);
83674         this_obj_conv.is_owned = ptr_is_owned(this_obj);
83675         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
83676         PositiveTimestamp_free(this_obj_conv);
83677 }
83678
83679 jboolean  CS_LDK_PositiveTimestamp_eq(int64_t a, int64_t b) {
83680         LDKPositiveTimestamp a_conv;
83681         a_conv.inner = untag_ptr(a);
83682         a_conv.is_owned = ptr_is_owned(a);
83683         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
83684         a_conv.is_owned = false;
83685         LDKPositiveTimestamp b_conv;
83686         b_conv.inner = untag_ptr(b);
83687         b_conv.is_owned = ptr_is_owned(b);
83688         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
83689         b_conv.is_owned = false;
83690         jboolean ret_conv = PositiveTimestamp_eq(&a_conv, &b_conv);
83691         return ret_conv;
83692 }
83693
83694 static inline uint64_t PositiveTimestamp_clone_ptr(LDKPositiveTimestamp *NONNULL_PTR arg) {
83695         LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(arg);
83696         int64_t ret_ref = 0;
83697         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83698         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83699         return ret_ref;
83700 }
83701 int64_t  CS_LDK_PositiveTimestamp_clone_ptr(int64_t arg) {
83702         LDKPositiveTimestamp arg_conv;
83703         arg_conv.inner = untag_ptr(arg);
83704         arg_conv.is_owned = ptr_is_owned(arg);
83705         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
83706         arg_conv.is_owned = false;
83707         int64_t ret_conv = PositiveTimestamp_clone_ptr(&arg_conv);
83708         return ret_conv;
83709 }
83710
83711 int64_t  CS_LDK_PositiveTimestamp_clone(int64_t orig) {
83712         LDKPositiveTimestamp orig_conv;
83713         orig_conv.inner = untag_ptr(orig);
83714         orig_conv.is_owned = ptr_is_owned(orig);
83715         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
83716         orig_conv.is_owned = false;
83717         LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(&orig_conv);
83718         int64_t ret_ref = 0;
83719         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83720         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83721         return ret_ref;
83722 }
83723
83724 int64_t  CS_LDK_PositiveTimestamp_hash(int64_t o) {
83725         LDKPositiveTimestamp o_conv;
83726         o_conv.inner = untag_ptr(o);
83727         o_conv.is_owned = ptr_is_owned(o);
83728         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
83729         o_conv.is_owned = false;
83730         int64_t ret_conv = PositiveTimestamp_hash(&o_conv);
83731         return ret_conv;
83732 }
83733
83734 int32_t  CS_LDK_SiPrefix_clone(int64_t orig) {
83735         LDKSiPrefix* orig_conv = (LDKSiPrefix*)untag_ptr(orig);
83736         int32_t ret_conv = LDKSiPrefix_to_cs(SiPrefix_clone(orig_conv));
83737         return ret_conv;
83738 }
83739
83740 int32_t  CS_LDK_SiPrefix_milli() {
83741         int32_t ret_conv = LDKSiPrefix_to_cs(SiPrefix_milli());
83742         return ret_conv;
83743 }
83744
83745 int32_t  CS_LDK_SiPrefix_micro() {
83746         int32_t ret_conv = LDKSiPrefix_to_cs(SiPrefix_micro());
83747         return ret_conv;
83748 }
83749
83750 int32_t  CS_LDK_SiPrefix_nano() {
83751         int32_t ret_conv = LDKSiPrefix_to_cs(SiPrefix_nano());
83752         return ret_conv;
83753 }
83754
83755 int32_t  CS_LDK_SiPrefix_pico() {
83756         int32_t ret_conv = LDKSiPrefix_to_cs(SiPrefix_pico());
83757         return ret_conv;
83758 }
83759
83760 jboolean  CS_LDK_SiPrefix_eq(int64_t a, int64_t b) {
83761         LDKSiPrefix* a_conv = (LDKSiPrefix*)untag_ptr(a);
83762         LDKSiPrefix* b_conv = (LDKSiPrefix*)untag_ptr(b);
83763         jboolean ret_conv = SiPrefix_eq(a_conv, b_conv);
83764         return ret_conv;
83765 }
83766
83767 int64_t  CS_LDK_SiPrefix_hash(int64_t o) {
83768         LDKSiPrefix* o_conv = (LDKSiPrefix*)untag_ptr(o);
83769         int64_t ret_conv = SiPrefix_hash(o_conv);
83770         return ret_conv;
83771 }
83772
83773 int64_t  CS_LDK_SiPrefix_multiplier(int64_t this_arg) {
83774         LDKSiPrefix* this_arg_conv = (LDKSiPrefix*)untag_ptr(this_arg);
83775         int64_t ret_conv = SiPrefix_multiplier(this_arg_conv);
83776         return ret_conv;
83777 }
83778
83779 int32_t  CS_LDK_Currency_clone(int64_t orig) {
83780         LDKCurrency* orig_conv = (LDKCurrency*)untag_ptr(orig);
83781         int32_t ret_conv = LDKCurrency_to_cs(Currency_clone(orig_conv));
83782         return ret_conv;
83783 }
83784
83785 int32_t  CS_LDK_Currency_bitcoin() {
83786         int32_t ret_conv = LDKCurrency_to_cs(Currency_bitcoin());
83787         return ret_conv;
83788 }
83789
83790 int32_t  CS_LDK_Currency_bitcoin_testnet() {
83791         int32_t ret_conv = LDKCurrency_to_cs(Currency_bitcoin_testnet());
83792         return ret_conv;
83793 }
83794
83795 int32_t  CS_LDK_Currency_regtest() {
83796         int32_t ret_conv = LDKCurrency_to_cs(Currency_regtest());
83797         return ret_conv;
83798 }
83799
83800 int32_t  CS_LDK_Currency_simnet() {
83801         int32_t ret_conv = LDKCurrency_to_cs(Currency_simnet());
83802         return ret_conv;
83803 }
83804
83805 int32_t  CS_LDK_Currency_signet() {
83806         int32_t ret_conv = LDKCurrency_to_cs(Currency_signet());
83807         return ret_conv;
83808 }
83809
83810 int64_t  CS_LDK_Currency_hash(int64_t o) {
83811         LDKCurrency* o_conv = (LDKCurrency*)untag_ptr(o);
83812         int64_t ret_conv = Currency_hash(o_conv);
83813         return ret_conv;
83814 }
83815
83816 jboolean  CS_LDK_Currency_eq(int64_t a, int64_t b) {
83817         LDKCurrency* a_conv = (LDKCurrency*)untag_ptr(a);
83818         LDKCurrency* b_conv = (LDKCurrency*)untag_ptr(b);
83819         jboolean ret_conv = Currency_eq(a_conv, b_conv);
83820         return ret_conv;
83821 }
83822
83823 void  CS_LDK_Sha256_free(int64_t this_obj) {
83824         LDKSha256 this_obj_conv;
83825         this_obj_conv.inner = untag_ptr(this_obj);
83826         this_obj_conv.is_owned = ptr_is_owned(this_obj);
83827         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
83828         Sha256_free(this_obj_conv);
83829 }
83830
83831 static inline uint64_t Sha256_clone_ptr(LDKSha256 *NONNULL_PTR arg) {
83832         LDKSha256 ret_var = Sha256_clone(arg);
83833         int64_t ret_ref = 0;
83834         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83835         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83836         return ret_ref;
83837 }
83838 int64_t  CS_LDK_Sha256_clone_ptr(int64_t arg) {
83839         LDKSha256 arg_conv;
83840         arg_conv.inner = untag_ptr(arg);
83841         arg_conv.is_owned = ptr_is_owned(arg);
83842         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
83843         arg_conv.is_owned = false;
83844         int64_t ret_conv = Sha256_clone_ptr(&arg_conv);
83845         return ret_conv;
83846 }
83847
83848 int64_t  CS_LDK_Sha256_clone(int64_t orig) {
83849         LDKSha256 orig_conv;
83850         orig_conv.inner = untag_ptr(orig);
83851         orig_conv.is_owned = ptr_is_owned(orig);
83852         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
83853         orig_conv.is_owned = false;
83854         LDKSha256 ret_var = Sha256_clone(&orig_conv);
83855         int64_t ret_ref = 0;
83856         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83857         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83858         return ret_ref;
83859 }
83860
83861 int64_t  CS_LDK_Sha256_hash(int64_t o) {
83862         LDKSha256 o_conv;
83863         o_conv.inner = untag_ptr(o);
83864         o_conv.is_owned = ptr_is_owned(o);
83865         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
83866         o_conv.is_owned = false;
83867         int64_t ret_conv = Sha256_hash(&o_conv);
83868         return ret_conv;
83869 }
83870
83871 jboolean  CS_LDK_Sha256_eq(int64_t a, int64_t b) {
83872         LDKSha256 a_conv;
83873         a_conv.inner = untag_ptr(a);
83874         a_conv.is_owned = ptr_is_owned(a);
83875         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
83876         a_conv.is_owned = false;
83877         LDKSha256 b_conv;
83878         b_conv.inner = untag_ptr(b);
83879         b_conv.is_owned = ptr_is_owned(b);
83880         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
83881         b_conv.is_owned = false;
83882         jboolean ret_conv = Sha256_eq(&a_conv, &b_conv);
83883         return ret_conv;
83884 }
83885
83886 int64_t  CS_LDK_Sha256_from_bytes(int8_tArray bytes) {
83887         uint8_t bytes_arr[32];
83888         CHECK(bytes->arr_len == 32);
83889         memcpy(bytes_arr, bytes->elems, 32); FREE(bytes);
83890         uint8_t (*bytes_ref)[32] = &bytes_arr;
83891         LDKSha256 ret_var = Sha256_from_bytes(bytes_ref);
83892         int64_t ret_ref = 0;
83893         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83894         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83895         return ret_ref;
83896 }
83897
83898 void  CS_LDK_Description_free(int64_t this_obj) {
83899         LDKDescription this_obj_conv;
83900         this_obj_conv.inner = untag_ptr(this_obj);
83901         this_obj_conv.is_owned = ptr_is_owned(this_obj);
83902         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
83903         Description_free(this_obj_conv);
83904 }
83905
83906 static inline uint64_t Description_clone_ptr(LDKDescription *NONNULL_PTR arg) {
83907         LDKDescription ret_var = Description_clone(arg);
83908         int64_t ret_ref = 0;
83909         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83910         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83911         return ret_ref;
83912 }
83913 int64_t  CS_LDK_Description_clone_ptr(int64_t arg) {
83914         LDKDescription arg_conv;
83915         arg_conv.inner = untag_ptr(arg);
83916         arg_conv.is_owned = ptr_is_owned(arg);
83917         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
83918         arg_conv.is_owned = false;
83919         int64_t ret_conv = Description_clone_ptr(&arg_conv);
83920         return ret_conv;
83921 }
83922
83923 int64_t  CS_LDK_Description_clone(int64_t orig) {
83924         LDKDescription orig_conv;
83925         orig_conv.inner = untag_ptr(orig);
83926         orig_conv.is_owned = ptr_is_owned(orig);
83927         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
83928         orig_conv.is_owned = false;
83929         LDKDescription ret_var = Description_clone(&orig_conv);
83930         int64_t ret_ref = 0;
83931         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83932         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83933         return ret_ref;
83934 }
83935
83936 int64_t  CS_LDK_Description_hash(int64_t o) {
83937         LDKDescription o_conv;
83938         o_conv.inner = untag_ptr(o);
83939         o_conv.is_owned = ptr_is_owned(o);
83940         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
83941         o_conv.is_owned = false;
83942         int64_t ret_conv = Description_hash(&o_conv);
83943         return ret_conv;
83944 }
83945
83946 jboolean  CS_LDK_Description_eq(int64_t a, int64_t b) {
83947         LDKDescription a_conv;
83948         a_conv.inner = untag_ptr(a);
83949         a_conv.is_owned = ptr_is_owned(a);
83950         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
83951         a_conv.is_owned = false;
83952         LDKDescription b_conv;
83953         b_conv.inner = untag_ptr(b);
83954         b_conv.is_owned = ptr_is_owned(b);
83955         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
83956         b_conv.is_owned = false;
83957         jboolean ret_conv = Description_eq(&a_conv, &b_conv);
83958         return ret_conv;
83959 }
83960
83961 void  CS_LDK_PayeePubKey_free(int64_t this_obj) {
83962         LDKPayeePubKey this_obj_conv;
83963         this_obj_conv.inner = untag_ptr(this_obj);
83964         this_obj_conv.is_owned = ptr_is_owned(this_obj);
83965         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
83966         PayeePubKey_free(this_obj_conv);
83967 }
83968
83969 int8_tArray  CS_LDK_PayeePubKey_get_a(int64_t this_ptr) {
83970         LDKPayeePubKey this_ptr_conv;
83971         this_ptr_conv.inner = untag_ptr(this_ptr);
83972         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
83973         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
83974         this_ptr_conv.is_owned = false;
83975         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
83976         memcpy(ret_arr->elems, PayeePubKey_get_a(&this_ptr_conv).compressed_form, 33);
83977         return ret_arr;
83978 }
83979
83980 void  CS_LDK_PayeePubKey_set_a(int64_t this_ptr, int8_tArray val) {
83981         LDKPayeePubKey this_ptr_conv;
83982         this_ptr_conv.inner = untag_ptr(this_ptr);
83983         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
83984         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
83985         this_ptr_conv.is_owned = false;
83986         LDKPublicKey val_ref;
83987         CHECK(val->arr_len == 33);
83988         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
83989         PayeePubKey_set_a(&this_ptr_conv, val_ref);
83990 }
83991
83992 int64_t  CS_LDK_PayeePubKey_new(int8_tArray a_arg) {
83993         LDKPublicKey a_arg_ref;
83994         CHECK(a_arg->arr_len == 33);
83995         memcpy(a_arg_ref.compressed_form, a_arg->elems, 33); FREE(a_arg);
83996         LDKPayeePubKey ret_var = PayeePubKey_new(a_arg_ref);
83997         int64_t ret_ref = 0;
83998         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83999         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
84000         return ret_ref;
84001 }
84002
84003 static inline uint64_t PayeePubKey_clone_ptr(LDKPayeePubKey *NONNULL_PTR arg) {
84004         LDKPayeePubKey ret_var = PayeePubKey_clone(arg);
84005         int64_t ret_ref = 0;
84006         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
84007         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
84008         return ret_ref;
84009 }
84010 int64_t  CS_LDK_PayeePubKey_clone_ptr(int64_t arg) {
84011         LDKPayeePubKey arg_conv;
84012         arg_conv.inner = untag_ptr(arg);
84013         arg_conv.is_owned = ptr_is_owned(arg);
84014         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
84015         arg_conv.is_owned = false;
84016         int64_t ret_conv = PayeePubKey_clone_ptr(&arg_conv);
84017         return ret_conv;
84018 }
84019
84020 int64_t  CS_LDK_PayeePubKey_clone(int64_t orig) {
84021         LDKPayeePubKey orig_conv;
84022         orig_conv.inner = untag_ptr(orig);
84023         orig_conv.is_owned = ptr_is_owned(orig);
84024         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
84025         orig_conv.is_owned = false;
84026         LDKPayeePubKey ret_var = PayeePubKey_clone(&orig_conv);
84027         int64_t ret_ref = 0;
84028         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
84029         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
84030         return ret_ref;
84031 }
84032
84033 int64_t  CS_LDK_PayeePubKey_hash(int64_t o) {
84034         LDKPayeePubKey o_conv;
84035         o_conv.inner = untag_ptr(o);
84036         o_conv.is_owned = ptr_is_owned(o);
84037         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
84038         o_conv.is_owned = false;
84039         int64_t ret_conv = PayeePubKey_hash(&o_conv);
84040         return ret_conv;
84041 }
84042
84043 jboolean  CS_LDK_PayeePubKey_eq(int64_t a, int64_t b) {
84044         LDKPayeePubKey a_conv;
84045         a_conv.inner = untag_ptr(a);
84046         a_conv.is_owned = ptr_is_owned(a);
84047         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
84048         a_conv.is_owned = false;
84049         LDKPayeePubKey b_conv;
84050         b_conv.inner = untag_ptr(b);
84051         b_conv.is_owned = ptr_is_owned(b);
84052         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
84053         b_conv.is_owned = false;
84054         jboolean ret_conv = PayeePubKey_eq(&a_conv, &b_conv);
84055         return ret_conv;
84056 }
84057
84058 void  CS_LDK_ExpiryTime_free(int64_t this_obj) {
84059         LDKExpiryTime this_obj_conv;
84060         this_obj_conv.inner = untag_ptr(this_obj);
84061         this_obj_conv.is_owned = ptr_is_owned(this_obj);
84062         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
84063         ExpiryTime_free(this_obj_conv);
84064 }
84065
84066 static inline uint64_t ExpiryTime_clone_ptr(LDKExpiryTime *NONNULL_PTR arg) {
84067         LDKExpiryTime ret_var = ExpiryTime_clone(arg);
84068         int64_t ret_ref = 0;
84069         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
84070         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
84071         return ret_ref;
84072 }
84073 int64_t  CS_LDK_ExpiryTime_clone_ptr(int64_t arg) {
84074         LDKExpiryTime arg_conv;
84075         arg_conv.inner = untag_ptr(arg);
84076         arg_conv.is_owned = ptr_is_owned(arg);
84077         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
84078         arg_conv.is_owned = false;
84079         int64_t ret_conv = ExpiryTime_clone_ptr(&arg_conv);
84080         return ret_conv;
84081 }
84082
84083 int64_t  CS_LDK_ExpiryTime_clone(int64_t orig) {
84084         LDKExpiryTime orig_conv;
84085         orig_conv.inner = untag_ptr(orig);
84086         orig_conv.is_owned = ptr_is_owned(orig);
84087         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
84088         orig_conv.is_owned = false;
84089         LDKExpiryTime ret_var = ExpiryTime_clone(&orig_conv);
84090         int64_t ret_ref = 0;
84091         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
84092         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
84093         return ret_ref;
84094 }
84095
84096 int64_t  CS_LDK_ExpiryTime_hash(int64_t o) {
84097         LDKExpiryTime o_conv;
84098         o_conv.inner = untag_ptr(o);
84099         o_conv.is_owned = ptr_is_owned(o);
84100         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
84101         o_conv.is_owned = false;
84102         int64_t ret_conv = ExpiryTime_hash(&o_conv);
84103         return ret_conv;
84104 }
84105
84106 jboolean  CS_LDK_ExpiryTime_eq(int64_t a, int64_t b) {
84107         LDKExpiryTime a_conv;
84108         a_conv.inner = untag_ptr(a);
84109         a_conv.is_owned = ptr_is_owned(a);
84110         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
84111         a_conv.is_owned = false;
84112         LDKExpiryTime b_conv;
84113         b_conv.inner = untag_ptr(b);
84114         b_conv.is_owned = ptr_is_owned(b);
84115         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
84116         b_conv.is_owned = false;
84117         jboolean ret_conv = ExpiryTime_eq(&a_conv, &b_conv);
84118         return ret_conv;
84119 }
84120
84121 void  CS_LDK_MinFinalCltvExpiryDelta_free(int64_t this_obj) {
84122         LDKMinFinalCltvExpiryDelta this_obj_conv;
84123         this_obj_conv.inner = untag_ptr(this_obj);
84124         this_obj_conv.is_owned = ptr_is_owned(this_obj);
84125         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
84126         MinFinalCltvExpiryDelta_free(this_obj_conv);
84127 }
84128
84129 int64_t  CS_LDK_MinFinalCltvExpiryDelta_get_a(int64_t this_ptr) {
84130         LDKMinFinalCltvExpiryDelta this_ptr_conv;
84131         this_ptr_conv.inner = untag_ptr(this_ptr);
84132         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
84133         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
84134         this_ptr_conv.is_owned = false;
84135         int64_t ret_conv = MinFinalCltvExpiryDelta_get_a(&this_ptr_conv);
84136         return ret_conv;
84137 }
84138
84139 void  CS_LDK_MinFinalCltvExpiryDelta_set_a(int64_t this_ptr, int64_t val) {
84140         LDKMinFinalCltvExpiryDelta this_ptr_conv;
84141         this_ptr_conv.inner = untag_ptr(this_ptr);
84142         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
84143         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
84144         this_ptr_conv.is_owned = false;
84145         MinFinalCltvExpiryDelta_set_a(&this_ptr_conv, val);
84146 }
84147
84148 int64_t  CS_LDK_MinFinalCltvExpiryDelta_new(int64_t a_arg) {
84149         LDKMinFinalCltvExpiryDelta ret_var = MinFinalCltvExpiryDelta_new(a_arg);
84150         int64_t ret_ref = 0;
84151         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
84152         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
84153         return ret_ref;
84154 }
84155
84156 static inline uint64_t MinFinalCltvExpiryDelta_clone_ptr(LDKMinFinalCltvExpiryDelta *NONNULL_PTR arg) {
84157         LDKMinFinalCltvExpiryDelta ret_var = MinFinalCltvExpiryDelta_clone(arg);
84158         int64_t ret_ref = 0;
84159         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
84160         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
84161         return ret_ref;
84162 }
84163 int64_t  CS_LDK_MinFinalCltvExpiryDelta_clone_ptr(int64_t arg) {
84164         LDKMinFinalCltvExpiryDelta arg_conv;
84165         arg_conv.inner = untag_ptr(arg);
84166         arg_conv.is_owned = ptr_is_owned(arg);
84167         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
84168         arg_conv.is_owned = false;
84169         int64_t ret_conv = MinFinalCltvExpiryDelta_clone_ptr(&arg_conv);
84170         return ret_conv;
84171 }
84172
84173 int64_t  CS_LDK_MinFinalCltvExpiryDelta_clone(int64_t orig) {
84174         LDKMinFinalCltvExpiryDelta orig_conv;
84175         orig_conv.inner = untag_ptr(orig);
84176         orig_conv.is_owned = ptr_is_owned(orig);
84177         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
84178         orig_conv.is_owned = false;
84179         LDKMinFinalCltvExpiryDelta ret_var = MinFinalCltvExpiryDelta_clone(&orig_conv);
84180         int64_t ret_ref = 0;
84181         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
84182         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
84183         return ret_ref;
84184 }
84185
84186 int64_t  CS_LDK_MinFinalCltvExpiryDelta_hash(int64_t o) {
84187         LDKMinFinalCltvExpiryDelta o_conv;
84188         o_conv.inner = untag_ptr(o);
84189         o_conv.is_owned = ptr_is_owned(o);
84190         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
84191         o_conv.is_owned = false;
84192         int64_t ret_conv = MinFinalCltvExpiryDelta_hash(&o_conv);
84193         return ret_conv;
84194 }
84195
84196 jboolean  CS_LDK_MinFinalCltvExpiryDelta_eq(int64_t a, int64_t b) {
84197         LDKMinFinalCltvExpiryDelta a_conv;
84198         a_conv.inner = untag_ptr(a);
84199         a_conv.is_owned = ptr_is_owned(a);
84200         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
84201         a_conv.is_owned = false;
84202         LDKMinFinalCltvExpiryDelta b_conv;
84203         b_conv.inner = untag_ptr(b);
84204         b_conv.is_owned = ptr_is_owned(b);
84205         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
84206         b_conv.is_owned = false;
84207         jboolean ret_conv = MinFinalCltvExpiryDelta_eq(&a_conv, &b_conv);
84208         return ret_conv;
84209 }
84210
84211 void  CS_LDK_Fallback_free(int64_t this_ptr) {
84212         if (!ptr_is_owned(this_ptr)) return;
84213         void* this_ptr_ptr = untag_ptr(this_ptr);
84214         CHECK_ACCESS(this_ptr_ptr);
84215         LDKFallback this_ptr_conv = *(LDKFallback*)(this_ptr_ptr);
84216         FREE(untag_ptr(this_ptr));
84217         Fallback_free(this_ptr_conv);
84218 }
84219
84220 static inline uint64_t Fallback_clone_ptr(LDKFallback *NONNULL_PTR arg) {
84221         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
84222         *ret_copy = Fallback_clone(arg);
84223         int64_t ret_ref = tag_ptr(ret_copy, true);
84224         return ret_ref;
84225 }
84226 int64_t  CS_LDK_Fallback_clone_ptr(int64_t arg) {
84227         LDKFallback* arg_conv = (LDKFallback*)untag_ptr(arg);
84228         int64_t ret_conv = Fallback_clone_ptr(arg_conv);
84229         return ret_conv;
84230 }
84231
84232 int64_t  CS_LDK_Fallback_clone(int64_t orig) {
84233         LDKFallback* orig_conv = (LDKFallback*)untag_ptr(orig);
84234         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
84235         *ret_copy = Fallback_clone(orig_conv);
84236         int64_t ret_ref = tag_ptr(ret_copy, true);
84237         return ret_ref;
84238 }
84239
84240 int64_t  CS_LDK_Fallback_seg_wit_program(int8_t version, int8_tArray program) {
84241         
84242         LDKCVec_u8Z program_ref;
84243         program_ref.datalen = program->arr_len;
84244         program_ref.data = MALLOC(program_ref.datalen, "LDKCVec_u8Z Bytes");
84245         memcpy(program_ref.data, program->elems, program_ref.datalen); FREE(program);
84246         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
84247         *ret_copy = Fallback_seg_wit_program((LDKWitnessVersion){ ._0 = version }, program_ref);
84248         int64_t ret_ref = tag_ptr(ret_copy, true);
84249         return ret_ref;
84250 }
84251
84252 int64_t  CS_LDK_Fallback_pub_key_hash(int8_tArray a) {
84253         LDKTwentyBytes a_ref;
84254         CHECK(a->arr_len == 20);
84255         memcpy(a_ref.data, a->elems, 20); FREE(a);
84256         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
84257         *ret_copy = Fallback_pub_key_hash(a_ref);
84258         int64_t ret_ref = tag_ptr(ret_copy, true);
84259         return ret_ref;
84260 }
84261
84262 int64_t  CS_LDK_Fallback_script_hash(int8_tArray a) {
84263         LDKTwentyBytes a_ref;
84264         CHECK(a->arr_len == 20);
84265         memcpy(a_ref.data, a->elems, 20); FREE(a);
84266         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
84267         *ret_copy = Fallback_script_hash(a_ref);
84268         int64_t ret_ref = tag_ptr(ret_copy, true);
84269         return ret_ref;
84270 }
84271
84272 int64_t  CS_LDK_Fallback_hash(int64_t o) {
84273         LDKFallback* o_conv = (LDKFallback*)untag_ptr(o);
84274         int64_t ret_conv = Fallback_hash(o_conv);
84275         return ret_conv;
84276 }
84277
84278 jboolean  CS_LDK_Fallback_eq(int64_t a, int64_t b) {
84279         LDKFallback* a_conv = (LDKFallback*)untag_ptr(a);
84280         LDKFallback* b_conv = (LDKFallback*)untag_ptr(b);
84281         jboolean ret_conv = Fallback_eq(a_conv, b_conv);
84282         return ret_conv;
84283 }
84284
84285 void  CS_LDK_Bolt11InvoiceSignature_free(int64_t this_obj) {
84286         LDKBolt11InvoiceSignature this_obj_conv;
84287         this_obj_conv.inner = untag_ptr(this_obj);
84288         this_obj_conv.is_owned = ptr_is_owned(this_obj);
84289         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
84290         Bolt11InvoiceSignature_free(this_obj_conv);
84291 }
84292
84293 static inline uint64_t Bolt11InvoiceSignature_clone_ptr(LDKBolt11InvoiceSignature *NONNULL_PTR arg) {
84294         LDKBolt11InvoiceSignature ret_var = Bolt11InvoiceSignature_clone(arg);
84295         int64_t ret_ref = 0;
84296         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
84297         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
84298         return ret_ref;
84299 }
84300 int64_t  CS_LDK_Bolt11InvoiceSignature_clone_ptr(int64_t arg) {
84301         LDKBolt11InvoiceSignature arg_conv;
84302         arg_conv.inner = untag_ptr(arg);
84303         arg_conv.is_owned = ptr_is_owned(arg);
84304         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
84305         arg_conv.is_owned = false;
84306         int64_t ret_conv = Bolt11InvoiceSignature_clone_ptr(&arg_conv);
84307         return ret_conv;
84308 }
84309
84310 int64_t  CS_LDK_Bolt11InvoiceSignature_clone(int64_t orig) {
84311         LDKBolt11InvoiceSignature orig_conv;
84312         orig_conv.inner = untag_ptr(orig);
84313         orig_conv.is_owned = ptr_is_owned(orig);
84314         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
84315         orig_conv.is_owned = false;
84316         LDKBolt11InvoiceSignature ret_var = Bolt11InvoiceSignature_clone(&orig_conv);
84317         int64_t ret_ref = 0;
84318         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
84319         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
84320         return ret_ref;
84321 }
84322
84323 int64_t  CS_LDK_Bolt11InvoiceSignature_hash(int64_t o) {
84324         LDKBolt11InvoiceSignature o_conv;
84325         o_conv.inner = untag_ptr(o);
84326         o_conv.is_owned = ptr_is_owned(o);
84327         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
84328         o_conv.is_owned = false;
84329         int64_t ret_conv = Bolt11InvoiceSignature_hash(&o_conv);
84330         return ret_conv;
84331 }
84332
84333 jboolean  CS_LDK_Bolt11InvoiceSignature_eq(int64_t a, int64_t b) {
84334         LDKBolt11InvoiceSignature a_conv;
84335         a_conv.inner = untag_ptr(a);
84336         a_conv.is_owned = ptr_is_owned(a);
84337         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
84338         a_conv.is_owned = false;
84339         LDKBolt11InvoiceSignature b_conv;
84340         b_conv.inner = untag_ptr(b);
84341         b_conv.is_owned = ptr_is_owned(b);
84342         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
84343         b_conv.is_owned = false;
84344         jboolean ret_conv = Bolt11InvoiceSignature_eq(&a_conv, &b_conv);
84345         return ret_conv;
84346 }
84347
84348 void  CS_LDK_PrivateRoute_free(int64_t this_obj) {
84349         LDKPrivateRoute this_obj_conv;
84350         this_obj_conv.inner = untag_ptr(this_obj);
84351         this_obj_conv.is_owned = ptr_is_owned(this_obj);
84352         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
84353         PrivateRoute_free(this_obj_conv);
84354 }
84355
84356 static inline uint64_t PrivateRoute_clone_ptr(LDKPrivateRoute *NONNULL_PTR arg) {
84357         LDKPrivateRoute ret_var = PrivateRoute_clone(arg);
84358         int64_t ret_ref = 0;
84359         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
84360         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
84361         return ret_ref;
84362 }
84363 int64_t  CS_LDK_PrivateRoute_clone_ptr(int64_t arg) {
84364         LDKPrivateRoute arg_conv;
84365         arg_conv.inner = untag_ptr(arg);
84366         arg_conv.is_owned = ptr_is_owned(arg);
84367         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
84368         arg_conv.is_owned = false;
84369         int64_t ret_conv = PrivateRoute_clone_ptr(&arg_conv);
84370         return ret_conv;
84371 }
84372
84373 int64_t  CS_LDK_PrivateRoute_clone(int64_t orig) {
84374         LDKPrivateRoute orig_conv;
84375         orig_conv.inner = untag_ptr(orig);
84376         orig_conv.is_owned = ptr_is_owned(orig);
84377         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
84378         orig_conv.is_owned = false;
84379         LDKPrivateRoute ret_var = PrivateRoute_clone(&orig_conv);
84380         int64_t ret_ref = 0;
84381         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
84382         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
84383         return ret_ref;
84384 }
84385
84386 int64_t  CS_LDK_PrivateRoute_hash(int64_t o) {
84387         LDKPrivateRoute o_conv;
84388         o_conv.inner = untag_ptr(o);
84389         o_conv.is_owned = ptr_is_owned(o);
84390         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
84391         o_conv.is_owned = false;
84392         int64_t ret_conv = PrivateRoute_hash(&o_conv);
84393         return ret_conv;
84394 }
84395
84396 jboolean  CS_LDK_PrivateRoute_eq(int64_t a, int64_t b) {
84397         LDKPrivateRoute a_conv;
84398         a_conv.inner = untag_ptr(a);
84399         a_conv.is_owned = ptr_is_owned(a);
84400         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
84401         a_conv.is_owned = false;
84402         LDKPrivateRoute b_conv;
84403         b_conv.inner = untag_ptr(b);
84404         b_conv.is_owned = ptr_is_owned(b);
84405         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
84406         b_conv.is_owned = false;
84407         jboolean ret_conv = PrivateRoute_eq(&a_conv, &b_conv);
84408         return ret_conv;
84409 }
84410
84411 int64_t  CS_LDK_SignedRawBolt11Invoice_into_parts(int64_t this_arg) {
84412         LDKSignedRawBolt11Invoice this_arg_conv;
84413         this_arg_conv.inner = untag_ptr(this_arg);
84414         this_arg_conv.is_owned = ptr_is_owned(this_arg);
84415         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
84416         this_arg_conv = SignedRawBolt11Invoice_clone(&this_arg_conv);
84417         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ), "LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ");
84418         *ret_conv = SignedRawBolt11Invoice_into_parts(this_arg_conv);
84419         return tag_ptr(ret_conv, true);
84420 }
84421
84422 int64_t  CS_LDK_SignedRawBolt11Invoice_raw_invoice(int64_t this_arg) {
84423         LDKSignedRawBolt11Invoice this_arg_conv;
84424         this_arg_conv.inner = untag_ptr(this_arg);
84425         this_arg_conv.is_owned = ptr_is_owned(this_arg);
84426         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
84427         this_arg_conv.is_owned = false;
84428         LDKRawBolt11Invoice ret_var = SignedRawBolt11Invoice_raw_invoice(&this_arg_conv);
84429         int64_t ret_ref = 0;
84430         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
84431         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
84432         return ret_ref;
84433 }
84434
84435 int8_tArray  CS_LDK_SignedRawBolt11Invoice_signable_hash(int64_t this_arg) {
84436         LDKSignedRawBolt11Invoice this_arg_conv;
84437         this_arg_conv.inner = untag_ptr(this_arg);
84438         this_arg_conv.is_owned = ptr_is_owned(this_arg);
84439         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
84440         this_arg_conv.is_owned = false;
84441         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
84442         memcpy(ret_arr->elems, *SignedRawBolt11Invoice_signable_hash(&this_arg_conv), 32);
84443         return ret_arr;
84444 }
84445
84446 int64_t  CS_LDK_SignedRawBolt11Invoice_signature(int64_t this_arg) {
84447         LDKSignedRawBolt11Invoice this_arg_conv;
84448         this_arg_conv.inner = untag_ptr(this_arg);
84449         this_arg_conv.is_owned = ptr_is_owned(this_arg);
84450         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
84451         this_arg_conv.is_owned = false;
84452         LDKBolt11InvoiceSignature ret_var = SignedRawBolt11Invoice_signature(&this_arg_conv);
84453         int64_t ret_ref = 0;
84454         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
84455         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
84456         return ret_ref;
84457 }
84458
84459 int64_t  CS_LDK_SignedRawBolt11Invoice_recover_payee_pub_key(int64_t this_arg) {
84460         LDKSignedRawBolt11Invoice this_arg_conv;
84461         this_arg_conv.inner = untag_ptr(this_arg);
84462         this_arg_conv.is_owned = ptr_is_owned(this_arg);
84463         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
84464         this_arg_conv.is_owned = false;
84465         LDKCResult_PayeePubKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeySecp256k1ErrorZ), "LDKCResult_PayeePubKeySecp256k1ErrorZ");
84466         *ret_conv = SignedRawBolt11Invoice_recover_payee_pub_key(&this_arg_conv);
84467         return tag_ptr(ret_conv, true);
84468 }
84469
84470 jboolean  CS_LDK_SignedRawBolt11Invoice_check_signature(int64_t this_arg) {
84471         LDKSignedRawBolt11Invoice this_arg_conv;
84472         this_arg_conv.inner = untag_ptr(this_arg);
84473         this_arg_conv.is_owned = ptr_is_owned(this_arg);
84474         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
84475         this_arg_conv.is_owned = false;
84476         jboolean ret_conv = SignedRawBolt11Invoice_check_signature(&this_arg_conv);
84477         return ret_conv;
84478 }
84479
84480 int8_tArray  CS_LDK_RawBolt11Invoice_signable_hash(int64_t this_arg) {
84481         LDKRawBolt11Invoice this_arg_conv;
84482         this_arg_conv.inner = untag_ptr(this_arg);
84483         this_arg_conv.is_owned = ptr_is_owned(this_arg);
84484         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
84485         this_arg_conv.is_owned = false;
84486         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
84487         memcpy(ret_arr->elems, RawBolt11Invoice_signable_hash(&this_arg_conv).data, 32);
84488         return ret_arr;
84489 }
84490
84491 int64_t  CS_LDK_RawBolt11Invoice_payment_hash(int64_t this_arg) {
84492         LDKRawBolt11Invoice this_arg_conv;
84493         this_arg_conv.inner = untag_ptr(this_arg);
84494         this_arg_conv.is_owned = ptr_is_owned(this_arg);
84495         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
84496         this_arg_conv.is_owned = false;
84497         LDKSha256 ret_var = RawBolt11Invoice_payment_hash(&this_arg_conv);
84498         int64_t ret_ref = 0;
84499         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
84500         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
84501         return ret_ref;
84502 }
84503
84504 int64_t  CS_LDK_RawBolt11Invoice_description(int64_t this_arg) {
84505         LDKRawBolt11Invoice this_arg_conv;
84506         this_arg_conv.inner = untag_ptr(this_arg);
84507         this_arg_conv.is_owned = ptr_is_owned(this_arg);
84508         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
84509         this_arg_conv.is_owned = false;
84510         LDKDescription ret_var = RawBolt11Invoice_description(&this_arg_conv);
84511         int64_t ret_ref = 0;
84512         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
84513         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
84514         return ret_ref;
84515 }
84516
84517 int64_t  CS_LDK_RawBolt11Invoice_payee_pub_key(int64_t this_arg) {
84518         LDKRawBolt11Invoice this_arg_conv;
84519         this_arg_conv.inner = untag_ptr(this_arg);
84520         this_arg_conv.is_owned = ptr_is_owned(this_arg);
84521         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
84522         this_arg_conv.is_owned = false;
84523         LDKPayeePubKey ret_var = RawBolt11Invoice_payee_pub_key(&this_arg_conv);
84524         int64_t ret_ref = 0;
84525         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
84526         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
84527         return ret_ref;
84528 }
84529
84530 int64_t  CS_LDK_RawBolt11Invoice_description_hash(int64_t this_arg) {
84531         LDKRawBolt11Invoice this_arg_conv;
84532         this_arg_conv.inner = untag_ptr(this_arg);
84533         this_arg_conv.is_owned = ptr_is_owned(this_arg);
84534         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
84535         this_arg_conv.is_owned = false;
84536         LDKSha256 ret_var = RawBolt11Invoice_description_hash(&this_arg_conv);
84537         int64_t ret_ref = 0;
84538         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
84539         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
84540         return ret_ref;
84541 }
84542
84543 int64_t  CS_LDK_RawBolt11Invoice_expiry_time(int64_t this_arg) {
84544         LDKRawBolt11Invoice this_arg_conv;
84545         this_arg_conv.inner = untag_ptr(this_arg);
84546         this_arg_conv.is_owned = ptr_is_owned(this_arg);
84547         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
84548         this_arg_conv.is_owned = false;
84549         LDKExpiryTime ret_var = RawBolt11Invoice_expiry_time(&this_arg_conv);
84550         int64_t ret_ref = 0;
84551         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
84552         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
84553         return ret_ref;
84554 }
84555
84556 int64_t  CS_LDK_RawBolt11Invoice_min_final_cltv_expiry_delta(int64_t this_arg) {
84557         LDKRawBolt11Invoice this_arg_conv;
84558         this_arg_conv.inner = untag_ptr(this_arg);
84559         this_arg_conv.is_owned = ptr_is_owned(this_arg);
84560         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
84561         this_arg_conv.is_owned = false;
84562         LDKMinFinalCltvExpiryDelta ret_var = RawBolt11Invoice_min_final_cltv_expiry_delta(&this_arg_conv);
84563         int64_t ret_ref = 0;
84564         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
84565         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
84566         return ret_ref;
84567 }
84568
84569 int64_t  CS_LDK_RawBolt11Invoice_payment_secret(int64_t this_arg) {
84570         LDKRawBolt11Invoice this_arg_conv;
84571         this_arg_conv.inner = untag_ptr(this_arg);
84572         this_arg_conv.is_owned = ptr_is_owned(this_arg);
84573         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
84574         this_arg_conv.is_owned = false;
84575         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
84576         *ret_copy = RawBolt11Invoice_payment_secret(&this_arg_conv);
84577         int64_t ret_ref = tag_ptr(ret_copy, true);
84578         return ret_ref;
84579 }
84580
84581 int64_t  CS_LDK_RawBolt11Invoice_payment_metadata(int64_t this_arg) {
84582         LDKRawBolt11Invoice this_arg_conv;
84583         this_arg_conv.inner = untag_ptr(this_arg);
84584         this_arg_conv.is_owned = ptr_is_owned(this_arg);
84585         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
84586         this_arg_conv.is_owned = false;
84587         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
84588         *ret_copy = RawBolt11Invoice_payment_metadata(&this_arg_conv);
84589         int64_t ret_ref = tag_ptr(ret_copy, true);
84590         return ret_ref;
84591 }
84592
84593 int64_t  CS_LDK_RawBolt11Invoice_features(int64_t this_arg) {
84594         LDKRawBolt11Invoice this_arg_conv;
84595         this_arg_conv.inner = untag_ptr(this_arg);
84596         this_arg_conv.is_owned = ptr_is_owned(this_arg);
84597         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
84598         this_arg_conv.is_owned = false;
84599         LDKBolt11InvoiceFeatures ret_var = RawBolt11Invoice_features(&this_arg_conv);
84600         int64_t ret_ref = 0;
84601         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
84602         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
84603         return ret_ref;
84604 }
84605
84606 int64_tArray  CS_LDK_RawBolt11Invoice_private_routes(int64_t this_arg) {
84607         LDKRawBolt11Invoice this_arg_conv;
84608         this_arg_conv.inner = untag_ptr(this_arg);
84609         this_arg_conv.is_owned = ptr_is_owned(this_arg);
84610         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
84611         this_arg_conv.is_owned = false;
84612         LDKCVec_PrivateRouteZ ret_var = RawBolt11Invoice_private_routes(&this_arg_conv);
84613         int64_tArray ret_arr = NULL;
84614         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
84615         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
84616         for (size_t o = 0; o < ret_var.datalen; o++) {
84617                 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
84618                 int64_t ret_conv_14_ref = 0;
84619                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
84620                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
84621                 ret_arr_ptr[o] = ret_conv_14_ref;
84622         }
84623         
84624         FREE(ret_var.data);
84625         return ret_arr;
84626 }
84627
84628 int64_t  CS_LDK_RawBolt11Invoice_amount_pico_btc(int64_t this_arg) {
84629         LDKRawBolt11Invoice this_arg_conv;
84630         this_arg_conv.inner = untag_ptr(this_arg);
84631         this_arg_conv.is_owned = ptr_is_owned(this_arg);
84632         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
84633         this_arg_conv.is_owned = false;
84634         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
84635         *ret_copy = RawBolt11Invoice_amount_pico_btc(&this_arg_conv);
84636         int64_t ret_ref = tag_ptr(ret_copy, true);
84637         return ret_ref;
84638 }
84639
84640 int32_t  CS_LDK_RawBolt11Invoice_currency(int64_t this_arg) {
84641         LDKRawBolt11Invoice this_arg_conv;
84642         this_arg_conv.inner = untag_ptr(this_arg);
84643         this_arg_conv.is_owned = ptr_is_owned(this_arg);
84644         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
84645         this_arg_conv.is_owned = false;
84646         int32_t ret_conv = LDKCurrency_to_cs(RawBolt11Invoice_currency(&this_arg_conv));
84647         return ret_conv;
84648 }
84649
84650 int64_t  CS_LDK_PositiveTimestamp_from_unix_timestamp(int64_t unix_seconds) {
84651         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
84652         *ret_conv = PositiveTimestamp_from_unix_timestamp(unix_seconds);
84653         return tag_ptr(ret_conv, true);
84654 }
84655
84656 int64_t  CS_LDK_PositiveTimestamp_from_system_time(int64_t time) {
84657         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
84658         *ret_conv = PositiveTimestamp_from_system_time(time);
84659         return tag_ptr(ret_conv, true);
84660 }
84661
84662 int64_t  CS_LDK_PositiveTimestamp_from_duration_since_epoch(int64_t duration) {
84663         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
84664         *ret_conv = PositiveTimestamp_from_duration_since_epoch(duration);
84665         return tag_ptr(ret_conv, true);
84666 }
84667
84668 int64_t  CS_LDK_PositiveTimestamp_as_unix_timestamp(int64_t this_arg) {
84669         LDKPositiveTimestamp this_arg_conv;
84670         this_arg_conv.inner = untag_ptr(this_arg);
84671         this_arg_conv.is_owned = ptr_is_owned(this_arg);
84672         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
84673         this_arg_conv.is_owned = false;
84674         int64_t ret_conv = PositiveTimestamp_as_unix_timestamp(&this_arg_conv);
84675         return ret_conv;
84676 }
84677
84678 int64_t  CS_LDK_PositiveTimestamp_as_duration_since_epoch(int64_t this_arg) {
84679         LDKPositiveTimestamp this_arg_conv;
84680         this_arg_conv.inner = untag_ptr(this_arg);
84681         this_arg_conv.is_owned = ptr_is_owned(this_arg);
84682         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
84683         this_arg_conv.is_owned = false;
84684         int64_t ret_conv = PositiveTimestamp_as_duration_since_epoch(&this_arg_conv);
84685         return ret_conv;
84686 }
84687
84688 int64_t  CS_LDK_PositiveTimestamp_as_time(int64_t this_arg) {
84689         LDKPositiveTimestamp this_arg_conv;
84690         this_arg_conv.inner = untag_ptr(this_arg);
84691         this_arg_conv.is_owned = ptr_is_owned(this_arg);
84692         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
84693         this_arg_conv.is_owned = false;
84694         int64_t ret_conv = PositiveTimestamp_as_time(&this_arg_conv);
84695         return ret_conv;
84696 }
84697
84698 int8_tArray  CS_LDK_Bolt11Invoice_signable_hash(int64_t this_arg) {
84699         LDKBolt11Invoice this_arg_conv;
84700         this_arg_conv.inner = untag_ptr(this_arg);
84701         this_arg_conv.is_owned = ptr_is_owned(this_arg);
84702         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
84703         this_arg_conv.is_owned = false;
84704         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
84705         memcpy(ret_arr->elems, Bolt11Invoice_signable_hash(&this_arg_conv).data, 32);
84706         return ret_arr;
84707 }
84708
84709 int64_t  CS_LDK_Bolt11Invoice_into_signed_raw(int64_t this_arg) {
84710         LDKBolt11Invoice this_arg_conv;
84711         this_arg_conv.inner = untag_ptr(this_arg);
84712         this_arg_conv.is_owned = ptr_is_owned(this_arg);
84713         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
84714         this_arg_conv = Bolt11Invoice_clone(&this_arg_conv);
84715         LDKSignedRawBolt11Invoice ret_var = Bolt11Invoice_into_signed_raw(this_arg_conv);
84716         int64_t ret_ref = 0;
84717         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
84718         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
84719         return ret_ref;
84720 }
84721
84722 int64_t  CS_LDK_Bolt11Invoice_check_signature(int64_t this_arg) {
84723         LDKBolt11Invoice this_arg_conv;
84724         this_arg_conv.inner = untag_ptr(this_arg);
84725         this_arg_conv.is_owned = ptr_is_owned(this_arg);
84726         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
84727         this_arg_conv.is_owned = false;
84728         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
84729         *ret_conv = Bolt11Invoice_check_signature(&this_arg_conv);
84730         return tag_ptr(ret_conv, true);
84731 }
84732
84733 int64_t  CS_LDK_Bolt11Invoice_from_signed(int64_t signed_invoice) {
84734         LDKSignedRawBolt11Invoice signed_invoice_conv;
84735         signed_invoice_conv.inner = untag_ptr(signed_invoice);
84736         signed_invoice_conv.is_owned = ptr_is_owned(signed_invoice);
84737         CHECK_INNER_FIELD_ACCESS_OR_NULL(signed_invoice_conv);
84738         signed_invoice_conv = SignedRawBolt11Invoice_clone(&signed_invoice_conv);
84739         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
84740         *ret_conv = Bolt11Invoice_from_signed(signed_invoice_conv);
84741         return tag_ptr(ret_conv, true);
84742 }
84743
84744 int64_t  CS_LDK_Bolt11Invoice_timestamp(int64_t this_arg) {
84745         LDKBolt11Invoice this_arg_conv;
84746         this_arg_conv.inner = untag_ptr(this_arg);
84747         this_arg_conv.is_owned = ptr_is_owned(this_arg);
84748         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
84749         this_arg_conv.is_owned = false;
84750         int64_t ret_conv = Bolt11Invoice_timestamp(&this_arg_conv);
84751         return ret_conv;
84752 }
84753
84754 int64_t  CS_LDK_Bolt11Invoice_duration_since_epoch(int64_t this_arg) {
84755         LDKBolt11Invoice this_arg_conv;
84756         this_arg_conv.inner = untag_ptr(this_arg);
84757         this_arg_conv.is_owned = ptr_is_owned(this_arg);
84758         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
84759         this_arg_conv.is_owned = false;
84760         int64_t ret_conv = Bolt11Invoice_duration_since_epoch(&this_arg_conv);
84761         return ret_conv;
84762 }
84763
84764 int8_tArray  CS_LDK_Bolt11Invoice_payment_hash(int64_t this_arg) {
84765         LDKBolt11Invoice this_arg_conv;
84766         this_arg_conv.inner = untag_ptr(this_arg);
84767         this_arg_conv.is_owned = ptr_is_owned(this_arg);
84768         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
84769         this_arg_conv.is_owned = false;
84770         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
84771         memcpy(ret_arr->elems, *Bolt11Invoice_payment_hash(&this_arg_conv), 32);
84772         return ret_arr;
84773 }
84774
84775 int8_tArray  CS_LDK_Bolt11Invoice_payee_pub_key(int64_t this_arg) {
84776         LDKBolt11Invoice this_arg_conv;
84777         this_arg_conv.inner = untag_ptr(this_arg);
84778         this_arg_conv.is_owned = ptr_is_owned(this_arg);
84779         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
84780         this_arg_conv.is_owned = false;
84781         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
84782         memcpy(ret_arr->elems, Bolt11Invoice_payee_pub_key(&this_arg_conv).compressed_form, 33);
84783         return ret_arr;
84784 }
84785
84786 int8_tArray  CS_LDK_Bolt11Invoice_payment_secret(int64_t this_arg) {
84787         LDKBolt11Invoice this_arg_conv;
84788         this_arg_conv.inner = untag_ptr(this_arg);
84789         this_arg_conv.is_owned = ptr_is_owned(this_arg);
84790         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
84791         this_arg_conv.is_owned = false;
84792         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
84793         memcpy(ret_arr->elems, *Bolt11Invoice_payment_secret(&this_arg_conv), 32);
84794         return ret_arr;
84795 }
84796
84797 int64_t  CS_LDK_Bolt11Invoice_payment_metadata(int64_t this_arg) {
84798         LDKBolt11Invoice this_arg_conv;
84799         this_arg_conv.inner = untag_ptr(this_arg);
84800         this_arg_conv.is_owned = ptr_is_owned(this_arg);
84801         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
84802         this_arg_conv.is_owned = false;
84803         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
84804         *ret_copy = Bolt11Invoice_payment_metadata(&this_arg_conv);
84805         int64_t ret_ref = tag_ptr(ret_copy, true);
84806         return ret_ref;
84807 }
84808
84809 int64_t  CS_LDK_Bolt11Invoice_features(int64_t this_arg) {
84810         LDKBolt11Invoice this_arg_conv;
84811         this_arg_conv.inner = untag_ptr(this_arg);
84812         this_arg_conv.is_owned = ptr_is_owned(this_arg);
84813         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
84814         this_arg_conv.is_owned = false;
84815         LDKBolt11InvoiceFeatures ret_var = Bolt11Invoice_features(&this_arg_conv);
84816         int64_t ret_ref = 0;
84817         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
84818         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
84819         return ret_ref;
84820 }
84821
84822 int8_tArray  CS_LDK_Bolt11Invoice_recover_payee_pub_key(int64_t this_arg) {
84823         LDKBolt11Invoice this_arg_conv;
84824         this_arg_conv.inner = untag_ptr(this_arg);
84825         this_arg_conv.is_owned = ptr_is_owned(this_arg);
84826         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
84827         this_arg_conv.is_owned = false;
84828         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
84829         memcpy(ret_arr->elems, Bolt11Invoice_recover_payee_pub_key(&this_arg_conv).compressed_form, 33);
84830         return ret_arr;
84831 }
84832
84833 int8_tArray  CS_LDK_Bolt11Invoice_get_payee_pub_key(int64_t this_arg) {
84834         LDKBolt11Invoice this_arg_conv;
84835         this_arg_conv.inner = untag_ptr(this_arg);
84836         this_arg_conv.is_owned = ptr_is_owned(this_arg);
84837         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
84838         this_arg_conv.is_owned = false;
84839         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
84840         memcpy(ret_arr->elems, Bolt11Invoice_get_payee_pub_key(&this_arg_conv).compressed_form, 33);
84841         return ret_arr;
84842 }
84843
84844 int64_t  CS_LDK_Bolt11Invoice_expires_at(int64_t this_arg) {
84845         LDKBolt11Invoice this_arg_conv;
84846         this_arg_conv.inner = untag_ptr(this_arg);
84847         this_arg_conv.is_owned = ptr_is_owned(this_arg);
84848         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
84849         this_arg_conv.is_owned = false;
84850         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
84851         *ret_copy = Bolt11Invoice_expires_at(&this_arg_conv);
84852         int64_t ret_ref = tag_ptr(ret_copy, true);
84853         return ret_ref;
84854 }
84855
84856 int64_t  CS_LDK_Bolt11Invoice_expiry_time(int64_t this_arg) {
84857         LDKBolt11Invoice this_arg_conv;
84858         this_arg_conv.inner = untag_ptr(this_arg);
84859         this_arg_conv.is_owned = ptr_is_owned(this_arg);
84860         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
84861         this_arg_conv.is_owned = false;
84862         int64_t ret_conv = Bolt11Invoice_expiry_time(&this_arg_conv);
84863         return ret_conv;
84864 }
84865
84866 jboolean  CS_LDK_Bolt11Invoice_is_expired(int64_t this_arg) {
84867         LDKBolt11Invoice this_arg_conv;
84868         this_arg_conv.inner = untag_ptr(this_arg);
84869         this_arg_conv.is_owned = ptr_is_owned(this_arg);
84870         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
84871         this_arg_conv.is_owned = false;
84872         jboolean ret_conv = Bolt11Invoice_is_expired(&this_arg_conv);
84873         return ret_conv;
84874 }
84875
84876 int64_t  CS_LDK_Bolt11Invoice_duration_until_expiry(int64_t this_arg) {
84877         LDKBolt11Invoice this_arg_conv;
84878         this_arg_conv.inner = untag_ptr(this_arg);
84879         this_arg_conv.is_owned = ptr_is_owned(this_arg);
84880         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
84881         this_arg_conv.is_owned = false;
84882         int64_t ret_conv = Bolt11Invoice_duration_until_expiry(&this_arg_conv);
84883         return ret_conv;
84884 }
84885
84886 int64_t  CS_LDK_Bolt11Invoice_expiration_remaining_from_epoch(int64_t this_arg, int64_t time) {
84887         LDKBolt11Invoice this_arg_conv;
84888         this_arg_conv.inner = untag_ptr(this_arg);
84889         this_arg_conv.is_owned = ptr_is_owned(this_arg);
84890         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
84891         this_arg_conv.is_owned = false;
84892         int64_t ret_conv = Bolt11Invoice_expiration_remaining_from_epoch(&this_arg_conv, time);
84893         return ret_conv;
84894 }
84895
84896 jboolean  CS_LDK_Bolt11Invoice_would_expire(int64_t this_arg, int64_t at_time) {
84897         LDKBolt11Invoice this_arg_conv;
84898         this_arg_conv.inner = untag_ptr(this_arg);
84899         this_arg_conv.is_owned = ptr_is_owned(this_arg);
84900         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
84901         this_arg_conv.is_owned = false;
84902         jboolean ret_conv = Bolt11Invoice_would_expire(&this_arg_conv, at_time);
84903         return ret_conv;
84904 }
84905
84906 int64_t  CS_LDK_Bolt11Invoice_min_final_cltv_expiry_delta(int64_t this_arg) {
84907         LDKBolt11Invoice this_arg_conv;
84908         this_arg_conv.inner = untag_ptr(this_arg);
84909         this_arg_conv.is_owned = ptr_is_owned(this_arg);
84910         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
84911         this_arg_conv.is_owned = false;
84912         int64_t ret_conv = Bolt11Invoice_min_final_cltv_expiry_delta(&this_arg_conv);
84913         return ret_conv;
84914 }
84915
84916 ptrArray  CS_LDK_Bolt11Invoice_fallback_addresses(int64_t this_arg) {
84917         LDKBolt11Invoice this_arg_conv;
84918         this_arg_conv.inner = untag_ptr(this_arg);
84919         this_arg_conv.is_owned = ptr_is_owned(this_arg);
84920         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
84921         this_arg_conv.is_owned = false;
84922         LDKCVec_StrZ ret_var = Bolt11Invoice_fallback_addresses(&this_arg_conv);
84923         ptrArray ret_arr = NULL;
84924         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
84925         jstring *ret_arr_ptr = (jstring*)(((uint8_t*)ret_arr) + 8);
84926         for (size_t i = 0; i < ret_var.datalen; i++) {
84927                 LDKStr ret_conv_8_str = ret_var.data[i];
84928                 jstring ret_conv_8_conv = str_ref_to_cs(ret_conv_8_str.chars, ret_conv_8_str.len);
84929                 Str_free(ret_conv_8_str);
84930                 ret_arr_ptr[i] = ret_conv_8_conv;
84931         }
84932         
84933         FREE(ret_var.data);
84934         return ret_arr;
84935 }
84936
84937 int64_tArray  CS_LDK_Bolt11Invoice_private_routes(int64_t this_arg) {
84938         LDKBolt11Invoice this_arg_conv;
84939         this_arg_conv.inner = untag_ptr(this_arg);
84940         this_arg_conv.is_owned = ptr_is_owned(this_arg);
84941         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
84942         this_arg_conv.is_owned = false;
84943         LDKCVec_PrivateRouteZ ret_var = Bolt11Invoice_private_routes(&this_arg_conv);
84944         int64_tArray ret_arr = NULL;
84945         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
84946         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
84947         for (size_t o = 0; o < ret_var.datalen; o++) {
84948                 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
84949                 int64_t ret_conv_14_ref = 0;
84950                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
84951                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
84952                 ret_arr_ptr[o] = ret_conv_14_ref;
84953         }
84954         
84955         FREE(ret_var.data);
84956         return ret_arr;
84957 }
84958
84959 int64_tArray  CS_LDK_Bolt11Invoice_route_hints(int64_t this_arg) {
84960         LDKBolt11Invoice this_arg_conv;
84961         this_arg_conv.inner = untag_ptr(this_arg);
84962         this_arg_conv.is_owned = ptr_is_owned(this_arg);
84963         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
84964         this_arg_conv.is_owned = false;
84965         LDKCVec_RouteHintZ ret_var = Bolt11Invoice_route_hints(&this_arg_conv);
84966         int64_tArray ret_arr = NULL;
84967         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
84968         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
84969         for (size_t l = 0; l < ret_var.datalen; l++) {
84970                 LDKRouteHint ret_conv_11_var = ret_var.data[l];
84971                 int64_t ret_conv_11_ref = 0;
84972                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_11_var);
84973                 ret_conv_11_ref = tag_ptr(ret_conv_11_var.inner, ret_conv_11_var.is_owned);
84974                 ret_arr_ptr[l] = ret_conv_11_ref;
84975         }
84976         
84977         FREE(ret_var.data);
84978         return ret_arr;
84979 }
84980
84981 int32_t  CS_LDK_Bolt11Invoice_currency(int64_t this_arg) {
84982         LDKBolt11Invoice this_arg_conv;
84983         this_arg_conv.inner = untag_ptr(this_arg);
84984         this_arg_conv.is_owned = ptr_is_owned(this_arg);
84985         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
84986         this_arg_conv.is_owned = false;
84987         int32_t ret_conv = LDKCurrency_to_cs(Bolt11Invoice_currency(&this_arg_conv));
84988         return ret_conv;
84989 }
84990
84991 int64_t  CS_LDK_Bolt11Invoice_amount_milli_satoshis(int64_t this_arg) {
84992         LDKBolt11Invoice this_arg_conv;
84993         this_arg_conv.inner = untag_ptr(this_arg);
84994         this_arg_conv.is_owned = ptr_is_owned(this_arg);
84995         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
84996         this_arg_conv.is_owned = false;
84997         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
84998         *ret_copy = Bolt11Invoice_amount_milli_satoshis(&this_arg_conv);
84999         int64_t ret_ref = tag_ptr(ret_copy, true);
85000         return ret_ref;
85001 }
85002
85003 int64_t  CS_LDK_Description_new(jstring description) {
85004         LDKStr description_conv = str_ref_to_owned_c(description);
85005         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
85006         *ret_conv = Description_new(description_conv);
85007         return tag_ptr(ret_conv, true);
85008 }
85009
85010 int64_t  CS_LDK_Description_into_inner(int64_t this_arg) {
85011         LDKDescription this_arg_conv;
85012         this_arg_conv.inner = untag_ptr(this_arg);
85013         this_arg_conv.is_owned = ptr_is_owned(this_arg);
85014         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
85015         this_arg_conv = Description_clone(&this_arg_conv);
85016         LDKUntrustedString ret_var = Description_into_inner(this_arg_conv);
85017         int64_t ret_ref = 0;
85018         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
85019         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
85020         return ret_ref;
85021 }
85022
85023 jstring  CS_LDK_Description_to_str(int64_t o) {
85024         LDKDescription o_conv;
85025         o_conv.inner = untag_ptr(o);
85026         o_conv.is_owned = ptr_is_owned(o);
85027         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
85028         o_conv.is_owned = false;
85029         LDKStr ret_str = Description_to_str(&o_conv);
85030         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
85031         Str_free(ret_str);
85032         return ret_conv;
85033 }
85034
85035 int64_t  CS_LDK_ExpiryTime_from_seconds(int64_t seconds) {
85036         LDKExpiryTime ret_var = ExpiryTime_from_seconds(seconds);
85037         int64_t ret_ref = 0;
85038         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
85039         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
85040         return ret_ref;
85041 }
85042
85043 int64_t  CS_LDK_ExpiryTime_from_duration(int64_t duration) {
85044         LDKExpiryTime ret_var = ExpiryTime_from_duration(duration);
85045         int64_t ret_ref = 0;
85046         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
85047         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
85048         return ret_ref;
85049 }
85050
85051 int64_t  CS_LDK_ExpiryTime_as_seconds(int64_t this_arg) {
85052         LDKExpiryTime this_arg_conv;
85053         this_arg_conv.inner = untag_ptr(this_arg);
85054         this_arg_conv.is_owned = ptr_is_owned(this_arg);
85055         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
85056         this_arg_conv.is_owned = false;
85057         int64_t ret_conv = ExpiryTime_as_seconds(&this_arg_conv);
85058         return ret_conv;
85059 }
85060
85061 int64_t  CS_LDK_ExpiryTime_as_duration(int64_t this_arg) {
85062         LDKExpiryTime this_arg_conv;
85063         this_arg_conv.inner = untag_ptr(this_arg);
85064         this_arg_conv.is_owned = ptr_is_owned(this_arg);
85065         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
85066         this_arg_conv.is_owned = false;
85067         int64_t ret_conv = ExpiryTime_as_duration(&this_arg_conv);
85068         return ret_conv;
85069 }
85070
85071 int64_t  CS_LDK_PrivateRoute_new(int64_t hops) {
85072         LDKRouteHint hops_conv;
85073         hops_conv.inner = untag_ptr(hops);
85074         hops_conv.is_owned = ptr_is_owned(hops);
85075         CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_conv);
85076         hops_conv = RouteHint_clone(&hops_conv);
85077         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
85078         *ret_conv = PrivateRoute_new(hops_conv);
85079         return tag_ptr(ret_conv, true);
85080 }
85081
85082 int64_t  CS_LDK_PrivateRoute_into_inner(int64_t this_arg) {
85083         LDKPrivateRoute this_arg_conv;
85084         this_arg_conv.inner = untag_ptr(this_arg);
85085         this_arg_conv.is_owned = ptr_is_owned(this_arg);
85086         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
85087         this_arg_conv = PrivateRoute_clone(&this_arg_conv);
85088         LDKRouteHint ret_var = PrivateRoute_into_inner(this_arg_conv);
85089         int64_t ret_ref = 0;
85090         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
85091         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
85092         return ret_ref;
85093 }
85094
85095 int32_t  CS_LDK_CreationError_clone(int64_t orig) {
85096         LDKCreationError* orig_conv = (LDKCreationError*)untag_ptr(orig);
85097         int32_t ret_conv = LDKCreationError_to_cs(CreationError_clone(orig_conv));
85098         return ret_conv;
85099 }
85100
85101 int32_t  CS_LDK_CreationError_description_too_long() {
85102         int32_t ret_conv = LDKCreationError_to_cs(CreationError_description_too_long());
85103         return ret_conv;
85104 }
85105
85106 int32_t  CS_LDK_CreationError_route_too_long() {
85107         int32_t ret_conv = LDKCreationError_to_cs(CreationError_route_too_long());
85108         return ret_conv;
85109 }
85110
85111 int32_t  CS_LDK_CreationError_timestamp_out_of_bounds() {
85112         int32_t ret_conv = LDKCreationError_to_cs(CreationError_timestamp_out_of_bounds());
85113         return ret_conv;
85114 }
85115
85116 int32_t  CS_LDK_CreationError_invalid_amount() {
85117         int32_t ret_conv = LDKCreationError_to_cs(CreationError_invalid_amount());
85118         return ret_conv;
85119 }
85120
85121 int32_t  CS_LDK_CreationError_missing_route_hints() {
85122         int32_t ret_conv = LDKCreationError_to_cs(CreationError_missing_route_hints());
85123         return ret_conv;
85124 }
85125
85126 int32_t  CS_LDK_CreationError_min_final_cltv_expiry_delta_too_short() {
85127         int32_t ret_conv = LDKCreationError_to_cs(CreationError_min_final_cltv_expiry_delta_too_short());
85128         return ret_conv;
85129 }
85130
85131 jboolean  CS_LDK_CreationError_eq(int64_t a, int64_t b) {
85132         LDKCreationError* a_conv = (LDKCreationError*)untag_ptr(a);
85133         LDKCreationError* b_conv = (LDKCreationError*)untag_ptr(b);
85134         jboolean ret_conv = CreationError_eq(a_conv, b_conv);
85135         return ret_conv;
85136 }
85137
85138 jstring  CS_LDK_CreationError_to_str(int64_t o) {
85139         LDKCreationError* o_conv = (LDKCreationError*)untag_ptr(o);
85140         LDKStr ret_str = CreationError_to_str(o_conv);
85141         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
85142         Str_free(ret_str);
85143         return ret_conv;
85144 }
85145
85146 int32_t  CS_LDK_Bolt11SemanticError_clone(int64_t orig) {
85147         LDKBolt11SemanticError* orig_conv = (LDKBolt11SemanticError*)untag_ptr(orig);
85148         int32_t ret_conv = LDKBolt11SemanticError_to_cs(Bolt11SemanticError_clone(orig_conv));
85149         return ret_conv;
85150 }
85151
85152 int32_t  CS_LDK_Bolt11SemanticError_no_payment_hash() {
85153         int32_t ret_conv = LDKBolt11SemanticError_to_cs(Bolt11SemanticError_no_payment_hash());
85154         return ret_conv;
85155 }
85156
85157 int32_t  CS_LDK_Bolt11SemanticError_multiple_payment_hashes() {
85158         int32_t ret_conv = LDKBolt11SemanticError_to_cs(Bolt11SemanticError_multiple_payment_hashes());
85159         return ret_conv;
85160 }
85161
85162 int32_t  CS_LDK_Bolt11SemanticError_no_description() {
85163         int32_t ret_conv = LDKBolt11SemanticError_to_cs(Bolt11SemanticError_no_description());
85164         return ret_conv;
85165 }
85166
85167 int32_t  CS_LDK_Bolt11SemanticError_multiple_descriptions() {
85168         int32_t ret_conv = LDKBolt11SemanticError_to_cs(Bolt11SemanticError_multiple_descriptions());
85169         return ret_conv;
85170 }
85171
85172 int32_t  CS_LDK_Bolt11SemanticError_no_payment_secret() {
85173         int32_t ret_conv = LDKBolt11SemanticError_to_cs(Bolt11SemanticError_no_payment_secret());
85174         return ret_conv;
85175 }
85176
85177 int32_t  CS_LDK_Bolt11SemanticError_multiple_payment_secrets() {
85178         int32_t ret_conv = LDKBolt11SemanticError_to_cs(Bolt11SemanticError_multiple_payment_secrets());
85179         return ret_conv;
85180 }
85181
85182 int32_t  CS_LDK_Bolt11SemanticError_invalid_features() {
85183         int32_t ret_conv = LDKBolt11SemanticError_to_cs(Bolt11SemanticError_invalid_features());
85184         return ret_conv;
85185 }
85186
85187 int32_t  CS_LDK_Bolt11SemanticError_invalid_recovery_id() {
85188         int32_t ret_conv = LDKBolt11SemanticError_to_cs(Bolt11SemanticError_invalid_recovery_id());
85189         return ret_conv;
85190 }
85191
85192 int32_t  CS_LDK_Bolt11SemanticError_invalid_signature() {
85193         int32_t ret_conv = LDKBolt11SemanticError_to_cs(Bolt11SemanticError_invalid_signature());
85194         return ret_conv;
85195 }
85196
85197 int32_t  CS_LDK_Bolt11SemanticError_imprecise_amount() {
85198         int32_t ret_conv = LDKBolt11SemanticError_to_cs(Bolt11SemanticError_imprecise_amount());
85199         return ret_conv;
85200 }
85201
85202 jboolean  CS_LDK_Bolt11SemanticError_eq(int64_t a, int64_t b) {
85203         LDKBolt11SemanticError* a_conv = (LDKBolt11SemanticError*)untag_ptr(a);
85204         LDKBolt11SemanticError* b_conv = (LDKBolt11SemanticError*)untag_ptr(b);
85205         jboolean ret_conv = Bolt11SemanticError_eq(a_conv, b_conv);
85206         return ret_conv;
85207 }
85208
85209 jstring  CS_LDK_Bolt11SemanticError_to_str(int64_t o) {
85210         LDKBolt11SemanticError* o_conv = (LDKBolt11SemanticError*)untag_ptr(o);
85211         LDKStr ret_str = Bolt11SemanticError_to_str(o_conv);
85212         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
85213         Str_free(ret_str);
85214         return ret_conv;
85215 }
85216
85217 void  CS_LDK_SignOrCreationError_free(int64_t this_ptr) {
85218         if (!ptr_is_owned(this_ptr)) return;
85219         void* this_ptr_ptr = untag_ptr(this_ptr);
85220         CHECK_ACCESS(this_ptr_ptr);
85221         LDKSignOrCreationError this_ptr_conv = *(LDKSignOrCreationError*)(this_ptr_ptr);
85222         FREE(untag_ptr(this_ptr));
85223         SignOrCreationError_free(this_ptr_conv);
85224 }
85225
85226 static inline uint64_t SignOrCreationError_clone_ptr(LDKSignOrCreationError *NONNULL_PTR arg) {
85227         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
85228         *ret_copy = SignOrCreationError_clone(arg);
85229         int64_t ret_ref = tag_ptr(ret_copy, true);
85230         return ret_ref;
85231 }
85232 int64_t  CS_LDK_SignOrCreationError_clone_ptr(int64_t arg) {
85233         LDKSignOrCreationError* arg_conv = (LDKSignOrCreationError*)untag_ptr(arg);
85234         int64_t ret_conv = SignOrCreationError_clone_ptr(arg_conv);
85235         return ret_conv;
85236 }
85237
85238 int64_t  CS_LDK_SignOrCreationError_clone(int64_t orig) {
85239         LDKSignOrCreationError* orig_conv = (LDKSignOrCreationError*)untag_ptr(orig);
85240         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
85241         *ret_copy = SignOrCreationError_clone(orig_conv);
85242         int64_t ret_ref = tag_ptr(ret_copy, true);
85243         return ret_ref;
85244 }
85245
85246 int64_t  CS_LDK_SignOrCreationError_sign_error() {
85247         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
85248         *ret_copy = SignOrCreationError_sign_error();
85249         int64_t ret_ref = tag_ptr(ret_copy, true);
85250         return ret_ref;
85251 }
85252
85253 int64_t  CS_LDK_SignOrCreationError_creation_error(int32_t a) {
85254         LDKCreationError a_conv = LDKCreationError_from_cs(a);
85255         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
85256         *ret_copy = SignOrCreationError_creation_error(a_conv);
85257         int64_t ret_ref = tag_ptr(ret_copy, true);
85258         return ret_ref;
85259 }
85260
85261 jboolean  CS_LDK_SignOrCreationError_eq(int64_t a, int64_t b) {
85262         LDKSignOrCreationError* a_conv = (LDKSignOrCreationError*)untag_ptr(a);
85263         LDKSignOrCreationError* b_conv = (LDKSignOrCreationError*)untag_ptr(b);
85264         jboolean ret_conv = SignOrCreationError_eq(a_conv, b_conv);
85265         return ret_conv;
85266 }
85267
85268 jstring  CS_LDK_SignOrCreationError_to_str(int64_t o) {
85269         LDKSignOrCreationError* o_conv = (LDKSignOrCreationError*)untag_ptr(o);
85270         LDKStr ret_str = SignOrCreationError_to_str(o_conv);
85271         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
85272         Str_free(ret_str);
85273         return ret_conv;
85274 }
85275
85276 int64_t  CS_LDK_payment_parameters_from_zero_amount_invoice(int64_t invoice, int64_t amount_msat) {
85277         LDKBolt11Invoice invoice_conv;
85278         invoice_conv.inner = untag_ptr(invoice);
85279         invoice_conv.is_owned = ptr_is_owned(invoice);
85280         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
85281         invoice_conv.is_owned = false;
85282         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ), "LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ");
85283         *ret_conv = payment_parameters_from_zero_amount_invoice(&invoice_conv, amount_msat);
85284         return tag_ptr(ret_conv, true);
85285 }
85286
85287 int64_t  CS_LDK_payment_parameters_from_invoice(int64_t invoice) {
85288         LDKBolt11Invoice invoice_conv;
85289         invoice_conv.inner = untag_ptr(invoice);
85290         invoice_conv.is_owned = ptr_is_owned(invoice);
85291         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
85292         invoice_conv.is_owned = false;
85293         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ), "LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ");
85294         *ret_conv = payment_parameters_from_invoice(&invoice_conv);
85295         return tag_ptr(ret_conv, true);
85296 }
85297
85298 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) {
85299         void* amt_msat_ptr = untag_ptr(amt_msat);
85300         CHECK_ACCESS(amt_msat_ptr);
85301         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
85302         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
85303         void* payment_hash_ptr = untag_ptr(payment_hash);
85304         CHECK_ACCESS(payment_hash_ptr);
85305         LDKCOption_ThirtyTwoBytesZ payment_hash_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_hash_ptr);
85306         payment_hash_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_hash));
85307         LDKStr description_conv = str_ref_to_owned_c(description);
85308         LDKCVec_PhantomRouteHintsZ phantom_route_hints_constr;
85309         phantom_route_hints_constr.datalen = phantom_route_hints->arr_len;
85310         if (phantom_route_hints_constr.datalen > 0)
85311                 phantom_route_hints_constr.data = MALLOC(phantom_route_hints_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
85312         else
85313                 phantom_route_hints_constr.data = NULL;
85314         int64_t* phantom_route_hints_vals = phantom_route_hints->elems;
85315         for (size_t t = 0; t < phantom_route_hints_constr.datalen; t++) {
85316                 int64_t phantom_route_hints_conv_19 = phantom_route_hints_vals[t];
85317                 LDKPhantomRouteHints phantom_route_hints_conv_19_conv;
85318                 phantom_route_hints_conv_19_conv.inner = untag_ptr(phantom_route_hints_conv_19);
85319                 phantom_route_hints_conv_19_conv.is_owned = ptr_is_owned(phantom_route_hints_conv_19);
85320                 CHECK_INNER_FIELD_ACCESS_OR_NULL(phantom_route_hints_conv_19_conv);
85321                 phantom_route_hints_conv_19_conv = PhantomRouteHints_clone(&phantom_route_hints_conv_19_conv);
85322                 phantom_route_hints_constr.data[t] = phantom_route_hints_conv_19_conv;
85323         }
85324         FREE(phantom_route_hints);
85325         void* entropy_source_ptr = untag_ptr(entropy_source);
85326         CHECK_ACCESS(entropy_source_ptr);
85327         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
85328         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
85329                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
85330                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
85331         }
85332         void* node_signer_ptr = untag_ptr(node_signer);
85333         CHECK_ACCESS(node_signer_ptr);
85334         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
85335         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
85336                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
85337                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
85338         }
85339         void* logger_ptr = untag_ptr(logger);
85340         CHECK_ACCESS(logger_ptr);
85341         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
85342         if (logger_conv.free == LDKLogger_JCalls_free) {
85343                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
85344                 LDKLogger_JCalls_cloned(&logger_conv);
85345         }
85346         LDKCurrency network_conv = LDKCurrency_from_cs(network);
85347         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
85348         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
85349         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
85350         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
85351         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
85352         *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);
85353         return tag_ptr(ret_conv, true);
85354 }
85355
85356 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) {
85357         void* amt_msat_ptr = untag_ptr(amt_msat);
85358         CHECK_ACCESS(amt_msat_ptr);
85359         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
85360         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
85361         void* payment_hash_ptr = untag_ptr(payment_hash);
85362         CHECK_ACCESS(payment_hash_ptr);
85363         LDKCOption_ThirtyTwoBytesZ payment_hash_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_hash_ptr);
85364         payment_hash_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_hash));
85365         LDKSha256 description_hash_conv;
85366         description_hash_conv.inner = untag_ptr(description_hash);
85367         description_hash_conv.is_owned = ptr_is_owned(description_hash);
85368         CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
85369         description_hash_conv = Sha256_clone(&description_hash_conv);
85370         LDKCVec_PhantomRouteHintsZ phantom_route_hints_constr;
85371         phantom_route_hints_constr.datalen = phantom_route_hints->arr_len;
85372         if (phantom_route_hints_constr.datalen > 0)
85373                 phantom_route_hints_constr.data = MALLOC(phantom_route_hints_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
85374         else
85375                 phantom_route_hints_constr.data = NULL;
85376         int64_t* phantom_route_hints_vals = phantom_route_hints->elems;
85377         for (size_t t = 0; t < phantom_route_hints_constr.datalen; t++) {
85378                 int64_t phantom_route_hints_conv_19 = phantom_route_hints_vals[t];
85379                 LDKPhantomRouteHints phantom_route_hints_conv_19_conv;
85380                 phantom_route_hints_conv_19_conv.inner = untag_ptr(phantom_route_hints_conv_19);
85381                 phantom_route_hints_conv_19_conv.is_owned = ptr_is_owned(phantom_route_hints_conv_19);
85382                 CHECK_INNER_FIELD_ACCESS_OR_NULL(phantom_route_hints_conv_19_conv);
85383                 phantom_route_hints_conv_19_conv = PhantomRouteHints_clone(&phantom_route_hints_conv_19_conv);
85384                 phantom_route_hints_constr.data[t] = phantom_route_hints_conv_19_conv;
85385         }
85386         FREE(phantom_route_hints);
85387         void* entropy_source_ptr = untag_ptr(entropy_source);
85388         CHECK_ACCESS(entropy_source_ptr);
85389         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
85390         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
85391                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
85392                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
85393         }
85394         void* node_signer_ptr = untag_ptr(node_signer);
85395         CHECK_ACCESS(node_signer_ptr);
85396         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
85397         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
85398                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
85399                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
85400         }
85401         void* logger_ptr = untag_ptr(logger);
85402         CHECK_ACCESS(logger_ptr);
85403         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
85404         if (logger_conv.free == LDKLogger_JCalls_free) {
85405                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
85406                 LDKLogger_JCalls_cloned(&logger_conv);
85407         }
85408         LDKCurrency network_conv = LDKCurrency_from_cs(network);
85409         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
85410         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
85411         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
85412         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
85413         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
85414         *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);
85415         return tag_ptr(ret_conv, true);
85416 }
85417
85418 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) {
85419         LDKChannelManager channelmanager_conv;
85420         channelmanager_conv.inner = untag_ptr(channelmanager);
85421         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
85422         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
85423         channelmanager_conv.is_owned = false;
85424         void* node_signer_ptr = untag_ptr(node_signer);
85425         CHECK_ACCESS(node_signer_ptr);
85426         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
85427         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
85428                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
85429                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
85430         }
85431         void* logger_ptr = untag_ptr(logger);
85432         CHECK_ACCESS(logger_ptr);
85433         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
85434         if (logger_conv.free == LDKLogger_JCalls_free) {
85435                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
85436                 LDKLogger_JCalls_cloned(&logger_conv);
85437         }
85438         LDKCurrency network_conv = LDKCurrency_from_cs(network);
85439         void* amt_msat_ptr = untag_ptr(amt_msat);
85440         CHECK_ACCESS(amt_msat_ptr);
85441         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
85442         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
85443         LDKStr description_conv = str_ref_to_owned_c(description);
85444         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
85445         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
85446         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
85447         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
85448         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
85449         *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);
85450         return tag_ptr(ret_conv, true);
85451 }
85452
85453 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) {
85454         LDKChannelManager channelmanager_conv;
85455         channelmanager_conv.inner = untag_ptr(channelmanager);
85456         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
85457         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
85458         channelmanager_conv.is_owned = false;
85459         void* node_signer_ptr = untag_ptr(node_signer);
85460         CHECK_ACCESS(node_signer_ptr);
85461         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
85462         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
85463                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
85464                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
85465         }
85466         void* logger_ptr = untag_ptr(logger);
85467         CHECK_ACCESS(logger_ptr);
85468         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
85469         if (logger_conv.free == LDKLogger_JCalls_free) {
85470                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
85471                 LDKLogger_JCalls_cloned(&logger_conv);
85472         }
85473         LDKCurrency network_conv = LDKCurrency_from_cs(network);
85474         void* amt_msat_ptr = untag_ptr(amt_msat);
85475         CHECK_ACCESS(amt_msat_ptr);
85476         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
85477         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
85478         LDKSha256 description_hash_conv;
85479         description_hash_conv.inner = untag_ptr(description_hash);
85480         description_hash_conv.is_owned = ptr_is_owned(description_hash);
85481         CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
85482         description_hash_conv = Sha256_clone(&description_hash_conv);
85483         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
85484         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
85485         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
85486         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
85487         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
85488         *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);
85489         return tag_ptr(ret_conv, true);
85490 }
85491
85492 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) {
85493         LDKChannelManager channelmanager_conv;
85494         channelmanager_conv.inner = untag_ptr(channelmanager);
85495         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
85496         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
85497         channelmanager_conv.is_owned = false;
85498         void* node_signer_ptr = untag_ptr(node_signer);
85499         CHECK_ACCESS(node_signer_ptr);
85500         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
85501         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
85502                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
85503                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
85504         }
85505         void* logger_ptr = untag_ptr(logger);
85506         CHECK_ACCESS(logger_ptr);
85507         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
85508         if (logger_conv.free == LDKLogger_JCalls_free) {
85509                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
85510                 LDKLogger_JCalls_cloned(&logger_conv);
85511         }
85512         LDKCurrency network_conv = LDKCurrency_from_cs(network);
85513         void* amt_msat_ptr = untag_ptr(amt_msat);
85514         CHECK_ACCESS(amt_msat_ptr);
85515         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
85516         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
85517         LDKSha256 description_hash_conv;
85518         description_hash_conv.inner = untag_ptr(description_hash);
85519         description_hash_conv.is_owned = ptr_is_owned(description_hash);
85520         CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
85521         description_hash_conv = Sha256_clone(&description_hash_conv);
85522         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
85523         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
85524         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
85525         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
85526         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
85527         *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);
85528         return tag_ptr(ret_conv, true);
85529 }
85530
85531 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) {
85532         LDKChannelManager channelmanager_conv;
85533         channelmanager_conv.inner = untag_ptr(channelmanager);
85534         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
85535         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
85536         channelmanager_conv.is_owned = false;
85537         void* node_signer_ptr = untag_ptr(node_signer);
85538         CHECK_ACCESS(node_signer_ptr);
85539         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
85540         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
85541                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
85542                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
85543         }
85544         void* logger_ptr = untag_ptr(logger);
85545         CHECK_ACCESS(logger_ptr);
85546         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
85547         if (logger_conv.free == LDKLogger_JCalls_free) {
85548                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
85549                 LDKLogger_JCalls_cloned(&logger_conv);
85550         }
85551         LDKCurrency network_conv = LDKCurrency_from_cs(network);
85552         void* amt_msat_ptr = untag_ptr(amt_msat);
85553         CHECK_ACCESS(amt_msat_ptr);
85554         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
85555         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
85556         LDKStr description_conv = str_ref_to_owned_c(description);
85557         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
85558         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
85559         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
85560         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
85561         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
85562         *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);
85563         return tag_ptr(ret_conv, true);
85564 }
85565
85566 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) {
85567         LDKChannelManager channelmanager_conv;
85568         channelmanager_conv.inner = untag_ptr(channelmanager);
85569         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
85570         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
85571         channelmanager_conv.is_owned = false;
85572         void* node_signer_ptr = untag_ptr(node_signer);
85573         CHECK_ACCESS(node_signer_ptr);
85574         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
85575         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
85576                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
85577                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
85578         }
85579         void* logger_ptr = untag_ptr(logger);
85580         CHECK_ACCESS(logger_ptr);
85581         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
85582         if (logger_conv.free == LDKLogger_JCalls_free) {
85583                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
85584                 LDKLogger_JCalls_cloned(&logger_conv);
85585         }
85586         LDKCurrency network_conv = LDKCurrency_from_cs(network);
85587         void* amt_msat_ptr = untag_ptr(amt_msat);
85588         CHECK_ACCESS(amt_msat_ptr);
85589         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
85590         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
85591         LDKStr description_conv = str_ref_to_owned_c(description);
85592         LDKThirtyTwoBytes payment_hash_ref;
85593         CHECK(payment_hash->arr_len == 32);
85594         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
85595         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
85596         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
85597         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
85598         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
85599         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
85600         *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);
85601         return tag_ptr(ret_conv, true);
85602 }
85603
85604 int64_t  CS_LDK_SiPrefix_from_str(jstring s) {
85605         LDKStr s_conv = str_ref_to_owned_c(s);
85606         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
85607         *ret_conv = SiPrefix_from_str(s_conv);
85608         return tag_ptr(ret_conv, true);
85609 }
85610
85611 int64_t  CS_LDK_Bolt11Invoice_from_str(jstring s) {
85612         LDKStr s_conv = str_ref_to_owned_c(s);
85613         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
85614         *ret_conv = Bolt11Invoice_from_str(s_conv);
85615         return tag_ptr(ret_conv, true);
85616 }
85617
85618 int64_t  CS_LDK_SignedRawBolt11Invoice_from_str(jstring s) {
85619         LDKStr s_conv = str_ref_to_owned_c(s);
85620         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
85621         *ret_conv = SignedRawBolt11Invoice_from_str(s_conv);
85622         return tag_ptr(ret_conv, true);
85623 }
85624
85625 jstring  CS_LDK_Bolt11ParseError_to_str(int64_t o) {
85626         LDKBolt11ParseError* o_conv = (LDKBolt11ParseError*)untag_ptr(o);
85627         LDKStr ret_str = Bolt11ParseError_to_str(o_conv);
85628         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
85629         Str_free(ret_str);
85630         return ret_conv;
85631 }
85632
85633 jstring  CS_LDK_ParseOrSemanticError_to_str(int64_t o) {
85634         LDKParseOrSemanticError* o_conv = (LDKParseOrSemanticError*)untag_ptr(o);
85635         LDKStr ret_str = ParseOrSemanticError_to_str(o_conv);
85636         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
85637         Str_free(ret_str);
85638         return ret_conv;
85639 }
85640
85641 jstring  CS_LDK_Bolt11Invoice_to_str(int64_t o) {
85642         LDKBolt11Invoice o_conv;
85643         o_conv.inner = untag_ptr(o);
85644         o_conv.is_owned = ptr_is_owned(o);
85645         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
85646         o_conv.is_owned = false;
85647         LDKStr ret_str = Bolt11Invoice_to_str(&o_conv);
85648         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
85649         Str_free(ret_str);
85650         return ret_conv;
85651 }
85652
85653 jstring  CS_LDK_SignedRawBolt11Invoice_to_str(int64_t o) {
85654         LDKSignedRawBolt11Invoice o_conv;
85655         o_conv.inner = untag_ptr(o);
85656         o_conv.is_owned = ptr_is_owned(o);
85657         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
85658         o_conv.is_owned = false;
85659         LDKStr ret_str = SignedRawBolt11Invoice_to_str(&o_conv);
85660         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
85661         Str_free(ret_str);
85662         return ret_conv;
85663 }
85664
85665 jstring  CS_LDK_Currency_to_str(int64_t o) {
85666         LDKCurrency* o_conv = (LDKCurrency*)untag_ptr(o);
85667         LDKStr ret_str = Currency_to_str(o_conv);
85668         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
85669         Str_free(ret_str);
85670         return ret_conv;
85671 }
85672
85673 jstring  CS_LDK_SiPrefix_to_str(int64_t o) {
85674         LDKSiPrefix* o_conv = (LDKSiPrefix*)untag_ptr(o);
85675         LDKStr ret_str = SiPrefix_to_str(o_conv);
85676         jstring ret_conv = str_ref_to_cs(ret_str.chars, ret_str.len);
85677         Str_free(ret_str);
85678         return ret_conv;
85679 }
85680
85681 void  CS_LDK_GraphSyncError_free(int64_t this_ptr) {
85682         if (!ptr_is_owned(this_ptr)) return;
85683         void* this_ptr_ptr = untag_ptr(this_ptr);
85684         CHECK_ACCESS(this_ptr_ptr);
85685         LDKGraphSyncError this_ptr_conv = *(LDKGraphSyncError*)(this_ptr_ptr);
85686         FREE(untag_ptr(this_ptr));
85687         GraphSyncError_free(this_ptr_conv);
85688 }
85689
85690 static inline uint64_t GraphSyncError_clone_ptr(LDKGraphSyncError *NONNULL_PTR arg) {
85691         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
85692         *ret_copy = GraphSyncError_clone(arg);
85693         int64_t ret_ref = tag_ptr(ret_copy, true);
85694         return ret_ref;
85695 }
85696 int64_t  CS_LDK_GraphSyncError_clone_ptr(int64_t arg) {
85697         LDKGraphSyncError* arg_conv = (LDKGraphSyncError*)untag_ptr(arg);
85698         int64_t ret_conv = GraphSyncError_clone_ptr(arg_conv);
85699         return ret_conv;
85700 }
85701
85702 int64_t  CS_LDK_GraphSyncError_clone(int64_t orig) {
85703         LDKGraphSyncError* orig_conv = (LDKGraphSyncError*)untag_ptr(orig);
85704         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
85705         *ret_copy = GraphSyncError_clone(orig_conv);
85706         int64_t ret_ref = tag_ptr(ret_copy, true);
85707         return ret_ref;
85708 }
85709
85710 int64_t  CS_LDK_GraphSyncError_decode_error(int64_t a) {
85711         void* a_ptr = untag_ptr(a);
85712         CHECK_ACCESS(a_ptr);
85713         LDKDecodeError a_conv = *(LDKDecodeError*)(a_ptr);
85714         a_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(a));
85715         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
85716         *ret_copy = GraphSyncError_decode_error(a_conv);
85717         int64_t ret_ref = tag_ptr(ret_copy, true);
85718         return ret_ref;
85719 }
85720
85721 int64_t  CS_LDK_GraphSyncError_lightning_error(int64_t a) {
85722         LDKLightningError a_conv;
85723         a_conv.inner = untag_ptr(a);
85724         a_conv.is_owned = ptr_is_owned(a);
85725         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
85726         a_conv = LightningError_clone(&a_conv);
85727         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
85728         *ret_copy = GraphSyncError_lightning_error(a_conv);
85729         int64_t ret_ref = tag_ptr(ret_copy, true);
85730         return ret_ref;
85731 }
85732
85733 void  CS_LDK_RapidGossipSync_free(int64_t this_obj) {
85734         LDKRapidGossipSync this_obj_conv;
85735         this_obj_conv.inner = untag_ptr(this_obj);
85736         this_obj_conv.is_owned = ptr_is_owned(this_obj);
85737         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
85738         RapidGossipSync_free(this_obj_conv);
85739 }
85740
85741 int64_t  CS_LDK_RapidGossipSync_new(int64_t network_graph, int64_t logger) {
85742         LDKNetworkGraph network_graph_conv;
85743         network_graph_conv.inner = untag_ptr(network_graph);
85744         network_graph_conv.is_owned = ptr_is_owned(network_graph);
85745         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
85746         network_graph_conv.is_owned = false;
85747         void* logger_ptr = untag_ptr(logger);
85748         CHECK_ACCESS(logger_ptr);
85749         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
85750         if (logger_conv.free == LDKLogger_JCalls_free) {
85751                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
85752                 LDKLogger_JCalls_cloned(&logger_conv);
85753         }
85754         LDKRapidGossipSync ret_var = RapidGossipSync_new(&network_graph_conv, logger_conv);
85755         int64_t ret_ref = 0;
85756         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
85757         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
85758         return ret_ref;
85759 }
85760
85761 int64_t  CS_LDK_RapidGossipSync_sync_network_graph_with_file_path(int64_t this_arg, jstring sync_path) {
85762         LDKRapidGossipSync this_arg_conv;
85763         this_arg_conv.inner = untag_ptr(this_arg);
85764         this_arg_conv.is_owned = ptr_is_owned(this_arg);
85765         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
85766         this_arg_conv.is_owned = false;
85767         LDKStr sync_path_conv = str_ref_to_owned_c(sync_path);
85768         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
85769         *ret_conv = RapidGossipSync_sync_network_graph_with_file_path(&this_arg_conv, sync_path_conv);
85770         return tag_ptr(ret_conv, true);
85771 }
85772
85773 int64_t  CS_LDK_RapidGossipSync_update_network_graph(int64_t this_arg, int8_tArray update_data) {
85774         LDKRapidGossipSync this_arg_conv;
85775         this_arg_conv.inner = untag_ptr(this_arg);
85776         this_arg_conv.is_owned = ptr_is_owned(this_arg);
85777         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
85778         this_arg_conv.is_owned = false;
85779         LDKu8slice update_data_ref;
85780         update_data_ref.datalen = update_data->arr_len;
85781         update_data_ref.data = update_data->elems;
85782         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
85783         *ret_conv = RapidGossipSync_update_network_graph(&this_arg_conv, update_data_ref);
85784         FREE(update_data);
85785         return tag_ptr(ret_conv, true);
85786 }
85787
85788 int64_t  CS_LDK_RapidGossipSync_update_network_graph_no_std(int64_t this_arg, int8_tArray update_data, int64_t current_time_unix) {
85789         LDKRapidGossipSync this_arg_conv;
85790         this_arg_conv.inner = untag_ptr(this_arg);
85791         this_arg_conv.is_owned = ptr_is_owned(this_arg);
85792         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
85793         this_arg_conv.is_owned = false;
85794         LDKu8slice update_data_ref;
85795         update_data_ref.datalen = update_data->arr_len;
85796         update_data_ref.data = update_data->elems;
85797         void* current_time_unix_ptr = untag_ptr(current_time_unix);
85798         CHECK_ACCESS(current_time_unix_ptr);
85799         LDKCOption_u64Z current_time_unix_conv = *(LDKCOption_u64Z*)(current_time_unix_ptr);
85800         current_time_unix_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(current_time_unix));
85801         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
85802         *ret_conv = RapidGossipSync_update_network_graph_no_std(&this_arg_conv, update_data_ref, current_time_unix_conv);
85803         FREE(update_data);
85804         return tag_ptr(ret_conv, true);
85805 }
85806
85807 jboolean  CS_LDK_RapidGossipSync_is_initial_sync_complete(int64_t this_arg) {
85808         LDKRapidGossipSync this_arg_conv;
85809         this_arg_conv.inner = untag_ptr(this_arg);
85810         this_arg_conv.is_owned = ptr_is_owned(this_arg);
85811         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
85812         this_arg_conv.is_owned = false;
85813         jboolean ret_conv = RapidGossipSync_is_initial_sync_complete(&this_arg_conv);
85814         return ret_conv;
85815 }
85816