Update auto-generated bindings with new module structure
[ldk-c-bindings] / lightning-c-bindings / include / lightning.h
1 /* Text to put at the beginning of the generated file. Probably a license. */
2
3 /* Generated with cbindgen:0.16.0 */
4
5 /* Warning, this file is autogenerated by cbindgen. Don't modify this manually. */
6
7 #include <stdarg.h>
8 #include <stdbool.h>
9 #include <stdint.h>
10
11
12 /**
13  * An error when accessing the chain via [`Access`].
14  */
15 typedef enum LDKAccessError {
16    /**
17     * The requested chain is unknown.
18     */
19    LDKAccessError_UnknownChain,
20    /**
21     * The requested transaction doesn't exist or hasn't confirmed.
22     */
23    LDKAccessError_UnknownTx,
24    /**
25     * Must be last for serialization purposes
26     */
27    LDKAccessError_Sentinel,
28 } LDKAccessError;
29
30 /**
31  * An error enum representing a failure to persist a channel monitor update.
32  */
33 typedef enum LDKChannelMonitorUpdateErr {
34    /**
35     * Used to indicate a temporary failure (eg connection to a watchtower or remote backup of
36     * our state failed, but is expected to succeed at some point in the future).
37     *
38     * Such a failure will \"freeze\" a channel, preventing us from revoking old states or
39     * submitting new commitment transactions to the counterparty. Once the update(s) which failed
40     * have been successfully applied, ChannelManager::channel_monitor_updated can be used to
41     * restore the channel to an operational state.
42     *
43     * Note that a given ChannelManager will *never* re-generate a given ChannelMonitorUpdate. If
44     * you return a TemporaryFailure you must ensure that it is written to disk safely before
45     * writing out the latest ChannelManager state.
46     *
47     * Even when a channel has been \"frozen\" updates to the ChannelMonitor can continue to occur
48     * (eg if an inbound HTLC which we forwarded was claimed upstream resulting in us attempting
49     * to claim it on this channel) and those updates must be applied wherever they can be. At
50     * least one such updated ChannelMonitor must be persisted otherwise PermanentFailure should
51     * be returned to get things on-chain ASAP using only the in-memory copy. Obviously updates to
52     * the channel which would invalidate previous ChannelMonitors are not made when a channel has
53     * been \"frozen\".
54     *
55     * Note that even if updates made after TemporaryFailure succeed you must still call
56     * channel_monitor_updated to ensure you have the latest monitor and re-enable normal channel
57     * operation.
58     *
59     * Note that the update being processed here will not be replayed for you when you call
60     * ChannelManager::channel_monitor_updated, so you must store the update itself along
61     * with the persisted ChannelMonitor on your own local disk prior to returning a
62     * TemporaryFailure. You may, of course, employ a journaling approach, storing only the
63     * ChannelMonitorUpdate on disk without updating the monitor itself, replaying the journal at
64     * reload-time.
65     *
66     * For deployments where a copy of ChannelMonitors and other local state are backed up in a
67     * remote location (with local copies persisted immediately), it is anticipated that all
68     * updates will return TemporaryFailure until the remote copies could be updated.
69     */
70    LDKChannelMonitorUpdateErr_TemporaryFailure,
71    /**
72     * Used to indicate no further channel monitor updates will be allowed (eg we've moved on to a
73     * different watchtower and cannot update with all watchtowers that were previously informed
74     * of this channel).
75     *
76     * At reception of this error, ChannelManager will force-close the channel and return at
77     * least a final ChannelMonitorUpdate::ChannelForceClosed which must be delivered to at
78     * least one ChannelMonitor copy. Revocation secret MUST NOT be released and offchain channel
79     * update must be rejected.
80     *
81     * This failure may also signal a failure to update the local persisted copy of one of
82     * the channel monitor instance.
83     *
84     * Note that even when you fail a holder commitment transaction update, you must store the
85     * update to ensure you can claim from it in case of a duplicate copy of this ChannelMonitor
86     * broadcasts it (e.g distributed channel-monitor deployment)
87     *
88     * In case of distributed watchtowers deployment, the new version must be written to disk, as
89     * state may have been stored but rejected due to a block forcing a commitment broadcast. This
90     * storage is used to claim outputs of rejected state confirmed onchain by another watchtower,
91     * lagging behind on block processing.
92     */
93    LDKChannelMonitorUpdateErr_PermanentFailure,
94    /**
95     * Must be last for serialization purposes
96     */
97    LDKChannelMonitorUpdateErr_Sentinel,
98 } LDKChannelMonitorUpdateErr;
99
100 /**
101  * An enum that represents the speed at which we want a transaction to confirm used for feerate
102  * estimation.
103  */
104 typedef enum LDKConfirmationTarget {
105    /**
106     * We are happy with this transaction confirming slowly when feerate drops some.
107     */
108    LDKConfirmationTarget_Background,
109    /**
110     * We'd like this transaction to confirm without major delay, but 12-18 blocks is fine.
111     */
112    LDKConfirmationTarget_Normal,
113    /**
114     * We'd like this transaction to confirm in the next few blocks.
115     */
116    LDKConfirmationTarget_HighPriority,
117    /**
118     * Must be last for serialization purposes
119     */
120    LDKConfirmationTarget_Sentinel,
121 } LDKConfirmationTarget;
122
123 /**
124  * An enum representing the available verbosity levels of the logger.
125  */
126 typedef enum LDKLevel {
127    /**
128     *Designates logger being silent
129     */
130    LDKLevel_Off,
131    /**
132     * Designates very serious errors
133     */
134    LDKLevel_Error,
135    /**
136     * Designates hazardous situations
137     */
138    LDKLevel_Warn,
139    /**
140     * Designates useful information
141     */
142    LDKLevel_Info,
143    /**
144     * Designates lower priority information
145     */
146    LDKLevel_Debug,
147    /**
148     * Designates very low priority, often extremely verbose, information
149     */
150    LDKLevel_Trace,
151    /**
152     * Must be last for serialization purposes
153     */
154    LDKLevel_Sentinel,
155 } LDKLevel;
156
157 /**
158  * An enum representing the possible Bitcoin or test networks which we can run on
159  */
160 typedef enum LDKNetwork {
161    /**
162     * The main Bitcoin blockchain.
163     */
164    LDKNetwork_Bitcoin,
165    /**
166     * The testnet3 blockchain.
167     */
168    LDKNetwork_Testnet,
169    /**
170     * A local test blockchain.
171     */
172    LDKNetwork_Regtest,
173    /**
174     * A blockchain on which blocks are signed instead of mined.
175     */
176    LDKNetwork_Signet,
177    /**
178     * Must be last for serialization purposes
179     */
180    LDKNetwork_Sentinel,
181 } LDKNetwork;
182
183 /**
184  * Represents an error returned from libsecp256k1 during validation of some secp256k1 data
185  */
186 typedef enum LDKSecp256k1Error {
187    /**
188     * Signature failed verification
189     */
190    LDKSecp256k1Error_IncorrectSignature,
191    /**
192     * Badly sized message ("messages" are actually fixed-sized digests; see the MESSAGE_SIZE constant)
193     */
194    LDKSecp256k1Error_InvalidMessage,
195    /**
196     * Bad public key
197     */
198    LDKSecp256k1Error_InvalidPublicKey,
199    /**
200     * Bad signature
201     */
202    LDKSecp256k1Error_InvalidSignature,
203    /**
204     * Bad secret key
205     */
206    LDKSecp256k1Error_InvalidSecretKey,
207    /**
208     * Bad recovery id
209     */
210    LDKSecp256k1Error_InvalidRecoveryId,
211    /**
212     * Invalid tweak for add_assign or mul_assign
213     */
214    LDKSecp256k1Error_InvalidTweak,
215    /**
216     * tweak_add_check failed on an xonly public key
217     */
218    LDKSecp256k1Error_TweakCheckFailed,
219    /**
220     * Didn't pass enough memory to context creation with preallocated memory
221     */
222    LDKSecp256k1Error_NotEnoughMemory,
223    /**
224     * Must be last for serialization purposes
225     */
226    LDKSecp256k1Error_Sentinel,
227 } LDKSecp256k1Error;
228
229 /**
230  * A serialized transaction, in (pointer, length) form.
231  *
232  * This type optionally owns its own memory, and thus the semantics around access change based on
233  * the `data_is_owned` flag. If `data_is_owned` is set, you must call `Transaction_free` to free
234  * the underlying buffer before the object goes out of scope. If `data_is_owned` is not set, any
235  * access to the buffer after the scope in which the object was provided to you is invalid. eg,
236  * access after you return from the call in which a `!data_is_owned` `Transaction` is provided to
237  * you would be invalid.
238  *
239  * Note that, while it may change in the future, because transactions on the Rust side are stored
240  * in a deserialized form, all `Transaction`s generated on the Rust side will have `data_is_owned`
241  * set. Similarly, while it may change in the future, all `Transaction`s you pass to Rust may have
242  * `data_is_owned` either set or unset at your discretion.
243  */
244 typedef struct LDKTransaction {
245    /**
246     * The serialized transaction data.
247     *
248     * This is non-const for your convenience, an object passed to Rust is never written to.
249     */
250    uint8_t *data;
251    /**
252     * The length of the serialized transaction
253     */
254    uintptr_t datalen;
255    /**
256     * Whether the data pointed to by `data` should be freed or not.
257     */
258    bool data_is_owned;
259 } LDKTransaction;
260
261 /**
262  * A dynamically-allocated array of u8s of arbitrary size.
263  * This corresponds to std::vector in C++
264  */
265 typedef struct LDKCVec_u8Z {
266    /**
267     * The elements in the array.
268     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
269     */
270    uint8_t *data;
271    /**
272     * The number of elements pointed to by `data`.
273     */
274    uintptr_t datalen;
275 } LDKCVec_u8Z;
276
277 /**
278  * A transaction output including a scriptPubKey and value.
279  * This type *does* own its own memory, so must be free'd appropriately.
280  */
281 typedef struct LDKTxOut {
282    /**
283     * The script_pubkey in this output
284     */
285    struct LDKCVec_u8Z script_pubkey;
286    /**
287     * The value, in satoshis, of this output
288     */
289    uint64_t value;
290 } LDKTxOut;
291
292
293
294 /**
295  * Options which apply on a per-channel basis and may change at runtime or based on negotiation
296  * with our counterparty.
297  */
298 typedef struct MUST_USE_STRUCT LDKChannelConfig {
299    /**
300     * A pointer to the opaque Rust object.
301     * Nearly everywhere, inner must be non-null, however in places where
302     * the Rust equivalent takes an Option, it may be set to null to indicate None.
303     */
304    LDKnativeChannelConfig *inner;
305    /**
306     * Indicates that this is the only struct which contains the same pointer.
307     * Rust functions which take ownership of an object provided via an argument require
308     * this to be true and invalidate the object pointed to by inner.
309     */
310    bool is_owned;
311 } LDKChannelConfig;
312
313
314
315 /**
316  * An error in decoding a message or struct.
317  */
318 typedef struct MUST_USE_STRUCT LDKDecodeError {
319    /**
320     * A pointer to the opaque Rust object.
321     * Nearly everywhere, inner must be non-null, however in places where
322     * the Rust equivalent takes an Option, it may be set to null to indicate None.
323     */
324    LDKnativeDecodeError *inner;
325    /**
326     * Indicates that this is the only struct which contains the same pointer.
327     * Rust functions which take ownership of an object provided via an argument require
328     * this to be true and invalidate the object pointed to by inner.
329     */
330    bool is_owned;
331 } LDKDecodeError;
332
333 /**
334  * The contents of CResult_ChannelConfigDecodeErrorZ
335  */
336 typedef union LDKCResult_ChannelConfigDecodeErrorZPtr {
337    /**
338     * A pointer to the contents in the success state.
339     * Reading from this pointer when `result_ok` is not set is undefined.
340     */
341    struct LDKChannelConfig *result;
342    /**
343     * A pointer to the contents in the error state.
344     * Reading from this pointer when `result_ok` is set is undefined.
345     */
346    struct LDKDecodeError *err;
347 } LDKCResult_ChannelConfigDecodeErrorZPtr;
348
349 /**
350  * A CResult_ChannelConfigDecodeErrorZ represents the result of a fallible operation,
351  * containing a crate::lightning::util::config::ChannelConfig on success and a crate::lightning::ln::msgs::DecodeError on failure.
352  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
353  */
354 typedef struct LDKCResult_ChannelConfigDecodeErrorZ {
355    /**
356     * The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either
357     * `err` or `result` depending on the state of `result_ok`.
358     */
359    union LDKCResult_ChannelConfigDecodeErrorZPtr contents;
360    /**
361     * Whether this CResult_ChannelConfigDecodeErrorZ represents a success state.
362     */
363    bool result_ok;
364 } LDKCResult_ChannelConfigDecodeErrorZ;
365
366
367
368 /**
369  * A reference to a transaction output.
370  *
371  * Differs from bitcoin::blockdata::transaction::OutPoint as the index is a u16 instead of u32
372  * due to LN's restrictions on index values. Should reduce (possibly) unsafe conversions this way.
373  */
374 typedef struct MUST_USE_STRUCT LDKOutPoint {
375    /**
376     * A pointer to the opaque Rust object.
377     * Nearly everywhere, inner must be non-null, however in places where
378     * the Rust equivalent takes an Option, it may be set to null to indicate None.
379     */
380    LDKnativeOutPoint *inner;
381    /**
382     * Indicates that this is the only struct which contains the same pointer.
383     * Rust functions which take ownership of an object provided via an argument require
384     * this to be true and invalidate the object pointed to by inner.
385     */
386    bool is_owned;
387 } LDKOutPoint;
388
389 /**
390  * The contents of CResult_OutPointDecodeErrorZ
391  */
392 typedef union LDKCResult_OutPointDecodeErrorZPtr {
393    /**
394     * A pointer to the contents in the success state.
395     * Reading from this pointer when `result_ok` is not set is undefined.
396     */
397    struct LDKOutPoint *result;
398    /**
399     * A pointer to the contents in the error state.
400     * Reading from this pointer when `result_ok` is set is undefined.
401     */
402    struct LDKDecodeError *err;
403 } LDKCResult_OutPointDecodeErrorZPtr;
404
405 /**
406  * A CResult_OutPointDecodeErrorZ represents the result of a fallible operation,
407  * containing a crate::lightning::chain::transaction::OutPoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
408  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
409  */
410 typedef struct LDKCResult_OutPointDecodeErrorZ {
411    /**
412     * The contents of this CResult_OutPointDecodeErrorZ, accessible via either
413     * `err` or `result` depending on the state of `result_ok`.
414     */
415    union LDKCResult_OutPointDecodeErrorZPtr contents;
416    /**
417     * Whether this CResult_OutPointDecodeErrorZ represents a success state.
418     */
419    bool result_ok;
420 } LDKCResult_OutPointDecodeErrorZ;
421
422 /**
423  * Represents a valid secp256k1 secret key serialized as a 32 byte array.
424  */
425 typedef struct LDKSecretKey {
426    /**
427     * The bytes of the secret key
428     */
429    uint8_t bytes[32];
430 } LDKSecretKey;
431
432 /**
433  * The contents of CResult_SecretKeyErrorZ
434  */
435 typedef union LDKCResult_SecretKeyErrorZPtr {
436    /**
437     * A pointer to the contents in the success state.
438     * Reading from this pointer when `result_ok` is not set is undefined.
439     */
440    struct LDKSecretKey *result;
441    /**
442     * A pointer to the contents in the error state.
443     * Reading from this pointer when `result_ok` is set is undefined.
444     */
445    enum LDKSecp256k1Error *err;
446 } LDKCResult_SecretKeyErrorZPtr;
447
448 /**
449  * A CResult_SecretKeyErrorZ represents the result of a fallible operation,
450  * containing a crate::c_types::SecretKey on success and a crate::c_types::Secp256k1Error on failure.
451  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
452  */
453 typedef struct LDKCResult_SecretKeyErrorZ {
454    /**
455     * The contents of this CResult_SecretKeyErrorZ, accessible via either
456     * `err` or `result` depending on the state of `result_ok`.
457     */
458    union LDKCResult_SecretKeyErrorZPtr contents;
459    /**
460     * Whether this CResult_SecretKeyErrorZ represents a success state.
461     */
462    bool result_ok;
463 } LDKCResult_SecretKeyErrorZ;
464
465 /**
466  * Represents a valid secp256k1 public key serialized in "compressed form" as a 33 byte array.
467  */
468 typedef struct LDKPublicKey {
469    /**
470     * The bytes of the public key
471     */
472    uint8_t compressed_form[33];
473 } LDKPublicKey;
474
475 /**
476  * The contents of CResult_PublicKeyErrorZ
477  */
478 typedef union LDKCResult_PublicKeyErrorZPtr {
479    /**
480     * A pointer to the contents in the success state.
481     * Reading from this pointer when `result_ok` is not set is undefined.
482     */
483    struct LDKPublicKey *result;
484    /**
485     * A pointer to the contents in the error state.
486     * Reading from this pointer when `result_ok` is set is undefined.
487     */
488    enum LDKSecp256k1Error *err;
489 } LDKCResult_PublicKeyErrorZPtr;
490
491 /**
492  * A CResult_PublicKeyErrorZ represents the result of a fallible operation,
493  * containing a crate::c_types::PublicKey on success and a crate::c_types::Secp256k1Error on failure.
494  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
495  */
496 typedef struct LDKCResult_PublicKeyErrorZ {
497    /**
498     * The contents of this CResult_PublicKeyErrorZ, accessible via either
499     * `err` or `result` depending on the state of `result_ok`.
500     */
501    union LDKCResult_PublicKeyErrorZPtr contents;
502    /**
503     * Whether this CResult_PublicKeyErrorZ represents a success state.
504     */
505    bool result_ok;
506 } LDKCResult_PublicKeyErrorZ;
507
508
509
510 /**
511  * The set of public keys which are used in the creation of one commitment transaction.
512  * These are derived from the channel base keys and per-commitment data.
513  *
514  * A broadcaster key is provided from potential broadcaster of the computed transaction.
515  * A countersignatory key is coming from a protocol participant unable to broadcast the
516  * transaction.
517  *
518  * These keys are assumed to be good, either because the code derived them from
519  * channel basepoints via the new function, or they were obtained via
520  * CommitmentTransaction.trust().keys() because we trusted the source of the
521  * pre-calculated keys.
522  */
523 typedef struct MUST_USE_STRUCT LDKTxCreationKeys {
524    /**
525     * A pointer to the opaque Rust object.
526     * Nearly everywhere, inner must be non-null, however in places where
527     * the Rust equivalent takes an Option, it may be set to null to indicate None.
528     */
529    LDKnativeTxCreationKeys *inner;
530    /**
531     * Indicates that this is the only struct which contains the same pointer.
532     * Rust functions which take ownership of an object provided via an argument require
533     * this to be true and invalidate the object pointed to by inner.
534     */
535    bool is_owned;
536 } LDKTxCreationKeys;
537
538 /**
539  * The contents of CResult_TxCreationKeysDecodeErrorZ
540  */
541 typedef union LDKCResult_TxCreationKeysDecodeErrorZPtr {
542    /**
543     * A pointer to the contents in the success state.
544     * Reading from this pointer when `result_ok` is not set is undefined.
545     */
546    struct LDKTxCreationKeys *result;
547    /**
548     * A pointer to the contents in the error state.
549     * Reading from this pointer when `result_ok` is set is undefined.
550     */
551    struct LDKDecodeError *err;
552 } LDKCResult_TxCreationKeysDecodeErrorZPtr;
553
554 /**
555  * A CResult_TxCreationKeysDecodeErrorZ represents the result of a fallible operation,
556  * containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
557  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
558  */
559 typedef struct LDKCResult_TxCreationKeysDecodeErrorZ {
560    /**
561     * The contents of this CResult_TxCreationKeysDecodeErrorZ, accessible via either
562     * `err` or `result` depending on the state of `result_ok`.
563     */
564    union LDKCResult_TxCreationKeysDecodeErrorZPtr contents;
565    /**
566     * Whether this CResult_TxCreationKeysDecodeErrorZ represents a success state.
567     */
568    bool result_ok;
569 } LDKCResult_TxCreationKeysDecodeErrorZ;
570
571
572
573 /**
574  * One counterparty's public keys which do not change over the life of a channel.
575  */
576 typedef struct MUST_USE_STRUCT LDKChannelPublicKeys {
577    /**
578     * A pointer to the opaque Rust object.
579     * Nearly everywhere, inner must be non-null, however in places where
580     * the Rust equivalent takes an Option, it may be set to null to indicate None.
581     */
582    LDKnativeChannelPublicKeys *inner;
583    /**
584     * Indicates that this is the only struct which contains the same pointer.
585     * Rust functions which take ownership of an object provided via an argument require
586     * this to be true and invalidate the object pointed to by inner.
587     */
588    bool is_owned;
589 } LDKChannelPublicKeys;
590
591 /**
592  * The contents of CResult_ChannelPublicKeysDecodeErrorZ
593  */
594 typedef union LDKCResult_ChannelPublicKeysDecodeErrorZPtr {
595    /**
596     * A pointer to the contents in the success state.
597     * Reading from this pointer when `result_ok` is not set is undefined.
598     */
599    struct LDKChannelPublicKeys *result;
600    /**
601     * A pointer to the contents in the error state.
602     * Reading from this pointer when `result_ok` is set is undefined.
603     */
604    struct LDKDecodeError *err;
605 } LDKCResult_ChannelPublicKeysDecodeErrorZPtr;
606
607 /**
608  * A CResult_ChannelPublicKeysDecodeErrorZ represents the result of a fallible operation,
609  * containing a crate::lightning::ln::chan_utils::ChannelPublicKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
610  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
611  */
612 typedef struct LDKCResult_ChannelPublicKeysDecodeErrorZ {
613    /**
614     * The contents of this CResult_ChannelPublicKeysDecodeErrorZ, accessible via either
615     * `err` or `result` depending on the state of `result_ok`.
616     */
617    union LDKCResult_ChannelPublicKeysDecodeErrorZPtr contents;
618    /**
619     * Whether this CResult_ChannelPublicKeysDecodeErrorZ represents a success state.
620     */
621    bool result_ok;
622 } LDKCResult_ChannelPublicKeysDecodeErrorZ;
623
624 /**
625  * The contents of CResult_TxCreationKeysErrorZ
626  */
627 typedef union LDKCResult_TxCreationKeysErrorZPtr {
628    /**
629     * A pointer to the contents in the success state.
630     * Reading from this pointer when `result_ok` is not set is undefined.
631     */
632    struct LDKTxCreationKeys *result;
633    /**
634     * A pointer to the contents in the error state.
635     * Reading from this pointer when `result_ok` is set is undefined.
636     */
637    enum LDKSecp256k1Error *err;
638 } LDKCResult_TxCreationKeysErrorZPtr;
639
640 /**
641  * A CResult_TxCreationKeysErrorZ represents the result of a fallible operation,
642  * containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::c_types::Secp256k1Error on failure.
643  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
644  */
645 typedef struct LDKCResult_TxCreationKeysErrorZ {
646    /**
647     * The contents of this CResult_TxCreationKeysErrorZ, accessible via either
648     * `err` or `result` depending on the state of `result_ok`.
649     */
650    union LDKCResult_TxCreationKeysErrorZPtr contents;
651    /**
652     * Whether this CResult_TxCreationKeysErrorZ represents a success state.
653     */
654    bool result_ok;
655 } LDKCResult_TxCreationKeysErrorZ;
656
657 /**
658  * An enum which can either contain a u32 or not
659  */
660 typedef enum LDKCOption_u32Z_Tag {
661    /**
662     * When we're in this state, this COption_u32Z contains a u32
663     */
664    LDKCOption_u32Z_Some,
665    /**
666     * When we're in this state, this COption_u32Z contains nothing
667     */
668    LDKCOption_u32Z_None,
669    /**
670     * Must be last for serialization purposes
671     */
672    LDKCOption_u32Z_Sentinel,
673 } LDKCOption_u32Z_Tag;
674
675 typedef struct LDKCOption_u32Z {
676    LDKCOption_u32Z_Tag tag;
677    union {
678       struct {
679          uint32_t some;
680       };
681    };
682 } LDKCOption_u32Z;
683
684
685
686 /**
687  * Information about an HTLC as it appears in a commitment transaction
688  */
689 typedef struct MUST_USE_STRUCT LDKHTLCOutputInCommitment {
690    /**
691     * A pointer to the opaque Rust object.
692     * Nearly everywhere, inner must be non-null, however in places where
693     * the Rust equivalent takes an Option, it may be set to null to indicate None.
694     */
695    LDKnativeHTLCOutputInCommitment *inner;
696    /**
697     * Indicates that this is the only struct which contains the same pointer.
698     * Rust functions which take ownership of an object provided via an argument require
699     * this to be true and invalidate the object pointed to by inner.
700     */
701    bool is_owned;
702 } LDKHTLCOutputInCommitment;
703
704 /**
705  * The contents of CResult_HTLCOutputInCommitmentDecodeErrorZ
706  */
707 typedef union LDKCResult_HTLCOutputInCommitmentDecodeErrorZPtr {
708    /**
709     * A pointer to the contents in the success state.
710     * Reading from this pointer when `result_ok` is not set is undefined.
711     */
712    struct LDKHTLCOutputInCommitment *result;
713    /**
714     * A pointer to the contents in the error state.
715     * Reading from this pointer when `result_ok` is set is undefined.
716     */
717    struct LDKDecodeError *err;
718 } LDKCResult_HTLCOutputInCommitmentDecodeErrorZPtr;
719
720 /**
721  * A CResult_HTLCOutputInCommitmentDecodeErrorZ represents the result of a fallible operation,
722  * containing a crate::lightning::ln::chan_utils::HTLCOutputInCommitment on success and a crate::lightning::ln::msgs::DecodeError on failure.
723  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
724  */
725 typedef struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ {
726    /**
727     * The contents of this CResult_HTLCOutputInCommitmentDecodeErrorZ, accessible via either
728     * `err` or `result` depending on the state of `result_ok`.
729     */
730    union LDKCResult_HTLCOutputInCommitmentDecodeErrorZPtr contents;
731    /**
732     * Whether this CResult_HTLCOutputInCommitmentDecodeErrorZ represents a success state.
733     */
734    bool result_ok;
735 } LDKCResult_HTLCOutputInCommitmentDecodeErrorZ;
736
737
738
739 /**
740  * Late-bound per-channel counterparty data used to build transactions.
741  */
742 typedef struct MUST_USE_STRUCT LDKCounterpartyChannelTransactionParameters {
743    /**
744     * A pointer to the opaque Rust object.
745     * Nearly everywhere, inner must be non-null, however in places where
746     * the Rust equivalent takes an Option, it may be set to null to indicate None.
747     */
748    LDKnativeCounterpartyChannelTransactionParameters *inner;
749    /**
750     * Indicates that this is the only struct which contains the same pointer.
751     * Rust functions which take ownership of an object provided via an argument require
752     * this to be true and invalidate the object pointed to by inner.
753     */
754    bool is_owned;
755 } LDKCounterpartyChannelTransactionParameters;
756
757 /**
758  * The contents of CResult_CounterpartyChannelTransactionParametersDecodeErrorZ
759  */
760 typedef union LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
761    /**
762     * A pointer to the contents in the success state.
763     * Reading from this pointer when `result_ok` is not set is undefined.
764     */
765    struct LDKCounterpartyChannelTransactionParameters *result;
766    /**
767     * A pointer to the contents in the error state.
768     * Reading from this pointer when `result_ok` is set is undefined.
769     */
770    struct LDKDecodeError *err;
771 } LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr;
772
773 /**
774  * A CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
775  * containing a crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
776  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
777  */
778 typedef struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
779    /**
780     * The contents of this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ, accessible via either
781     * `err` or `result` depending on the state of `result_ok`.
782     */
783    union LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr contents;
784    /**
785     * Whether this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents a success state.
786     */
787    bool result_ok;
788 } LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ;
789
790
791
792 /**
793  * Per-channel data used to build transactions in conjunction with the per-commitment data (CommitmentTransaction).
794  * The fields are organized by holder/counterparty.
795  *
796  * Normally, this is converted to the broadcaster/countersignatory-organized DirectedChannelTransactionParameters
797  * before use, via the as_holder_broadcastable and as_counterparty_broadcastable functions.
798  */
799 typedef struct MUST_USE_STRUCT LDKChannelTransactionParameters {
800    /**
801     * A pointer to the opaque Rust object.
802     * Nearly everywhere, inner must be non-null, however in places where
803     * the Rust equivalent takes an Option, it may be set to null to indicate None.
804     */
805    LDKnativeChannelTransactionParameters *inner;
806    /**
807     * Indicates that this is the only struct which contains the same pointer.
808     * Rust functions which take ownership of an object provided via an argument require
809     * this to be true and invalidate the object pointed to by inner.
810     */
811    bool is_owned;
812 } LDKChannelTransactionParameters;
813
814 /**
815  * The contents of CResult_ChannelTransactionParametersDecodeErrorZ
816  */
817 typedef union LDKCResult_ChannelTransactionParametersDecodeErrorZPtr {
818    /**
819     * A pointer to the contents in the success state.
820     * Reading from this pointer when `result_ok` is not set is undefined.
821     */
822    struct LDKChannelTransactionParameters *result;
823    /**
824     * A pointer to the contents in the error state.
825     * Reading from this pointer when `result_ok` is set is undefined.
826     */
827    struct LDKDecodeError *err;
828 } LDKCResult_ChannelTransactionParametersDecodeErrorZPtr;
829
830 /**
831  * A CResult_ChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
832  * containing a crate::lightning::ln::chan_utils::ChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
833  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
834  */
835 typedef struct LDKCResult_ChannelTransactionParametersDecodeErrorZ {
836    /**
837     * The contents of this CResult_ChannelTransactionParametersDecodeErrorZ, accessible via either
838     * `err` or `result` depending on the state of `result_ok`.
839     */
840    union LDKCResult_ChannelTransactionParametersDecodeErrorZPtr contents;
841    /**
842     * Whether this CResult_ChannelTransactionParametersDecodeErrorZ represents a success state.
843     */
844    bool result_ok;
845 } LDKCResult_ChannelTransactionParametersDecodeErrorZ;
846
847 /**
848  * Represents a secp256k1 signature serialized as two 32-byte numbers
849  */
850 typedef struct LDKSignature {
851    /**
852     * The bytes of the signature in "compact" form
853     */
854    uint8_t compact_form[64];
855 } LDKSignature;
856
857 /**
858  * A dynamically-allocated array of crate::c_types::Signatures of arbitrary size.
859  * This corresponds to std::vector in C++
860  */
861 typedef struct LDKCVec_SignatureZ {
862    /**
863     * The elements in the array.
864     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
865     */
866    struct LDKSignature *data;
867    /**
868     * The number of elements pointed to by `data`.
869     */
870    uintptr_t datalen;
871 } LDKCVec_SignatureZ;
872
873
874
875 /**
876  * Information needed to build and sign a holder's commitment transaction.
877  *
878  * The transaction is only signed once we are ready to broadcast.
879  */
880 typedef struct MUST_USE_STRUCT LDKHolderCommitmentTransaction {
881    /**
882     * A pointer to the opaque Rust object.
883     * Nearly everywhere, inner must be non-null, however in places where
884     * the Rust equivalent takes an Option, it may be set to null to indicate None.
885     */
886    LDKnativeHolderCommitmentTransaction *inner;
887    /**
888     * Indicates that this is the only struct which contains the same pointer.
889     * Rust functions which take ownership of an object provided via an argument require
890     * this to be true and invalidate the object pointed to by inner.
891     */
892    bool is_owned;
893 } LDKHolderCommitmentTransaction;
894
895 /**
896  * The contents of CResult_HolderCommitmentTransactionDecodeErrorZ
897  */
898 typedef union LDKCResult_HolderCommitmentTransactionDecodeErrorZPtr {
899    /**
900     * A pointer to the contents in the success state.
901     * Reading from this pointer when `result_ok` is not set is undefined.
902     */
903    struct LDKHolderCommitmentTransaction *result;
904    /**
905     * A pointer to the contents in the error state.
906     * Reading from this pointer when `result_ok` is set is undefined.
907     */
908    struct LDKDecodeError *err;
909 } LDKCResult_HolderCommitmentTransactionDecodeErrorZPtr;
910
911 /**
912  * A CResult_HolderCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
913  * containing a crate::lightning::ln::chan_utils::HolderCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
914  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
915  */
916 typedef struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ {
917    /**
918     * The contents of this CResult_HolderCommitmentTransactionDecodeErrorZ, accessible via either
919     * `err` or `result` depending on the state of `result_ok`.
920     */
921    union LDKCResult_HolderCommitmentTransactionDecodeErrorZPtr contents;
922    /**
923     * Whether this CResult_HolderCommitmentTransactionDecodeErrorZ represents a success state.
924     */
925    bool result_ok;
926 } LDKCResult_HolderCommitmentTransactionDecodeErrorZ;
927
928
929
930 /**
931  * A pre-built Bitcoin commitment transaction and its txid.
932  */
933 typedef struct MUST_USE_STRUCT LDKBuiltCommitmentTransaction {
934    /**
935     * A pointer to the opaque Rust object.
936     * Nearly everywhere, inner must be non-null, however in places where
937     * the Rust equivalent takes an Option, it may be set to null to indicate None.
938     */
939    LDKnativeBuiltCommitmentTransaction *inner;
940    /**
941     * Indicates that this is the only struct which contains the same pointer.
942     * Rust functions which take ownership of an object provided via an argument require
943     * this to be true and invalidate the object pointed to by inner.
944     */
945    bool is_owned;
946 } LDKBuiltCommitmentTransaction;
947
948 /**
949  * The contents of CResult_BuiltCommitmentTransactionDecodeErrorZ
950  */
951 typedef union LDKCResult_BuiltCommitmentTransactionDecodeErrorZPtr {
952    /**
953     * A pointer to the contents in the success state.
954     * Reading from this pointer when `result_ok` is not set is undefined.
955     */
956    struct LDKBuiltCommitmentTransaction *result;
957    /**
958     * A pointer to the contents in the error state.
959     * Reading from this pointer when `result_ok` is set is undefined.
960     */
961    struct LDKDecodeError *err;
962 } LDKCResult_BuiltCommitmentTransactionDecodeErrorZPtr;
963
964 /**
965  * A CResult_BuiltCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
966  * containing a crate::lightning::ln::chan_utils::BuiltCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
967  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
968  */
969 typedef struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ {
970    /**
971     * The contents of this CResult_BuiltCommitmentTransactionDecodeErrorZ, accessible via either
972     * `err` or `result` depending on the state of `result_ok`.
973     */
974    union LDKCResult_BuiltCommitmentTransactionDecodeErrorZPtr contents;
975    /**
976     * Whether this CResult_BuiltCommitmentTransactionDecodeErrorZ represents a success state.
977     */
978    bool result_ok;
979 } LDKCResult_BuiltCommitmentTransactionDecodeErrorZ;
980
981
982
983 /**
984  * This class tracks the per-transaction information needed to build a commitment transaction and to
985  * actually build it and sign.  It is used for holder transactions that we sign only when needed
986  * and for transactions we sign for the counterparty.
987  *
988  * This class can be used inside a signer implementation to generate a signature given the relevant
989  * secret key.
990  */
991 typedef struct MUST_USE_STRUCT LDKCommitmentTransaction {
992    /**
993     * A pointer to the opaque Rust object.
994     * Nearly everywhere, inner must be non-null, however in places where
995     * the Rust equivalent takes an Option, it may be set to null to indicate None.
996     */
997    LDKnativeCommitmentTransaction *inner;
998    /**
999     * Indicates that this is the only struct which contains the same pointer.
1000     * Rust functions which take ownership of an object provided via an argument require
1001     * this to be true and invalidate the object pointed to by inner.
1002     */
1003    bool is_owned;
1004 } LDKCommitmentTransaction;
1005
1006 /**
1007  * The contents of CResult_CommitmentTransactionDecodeErrorZ
1008  */
1009 typedef union LDKCResult_CommitmentTransactionDecodeErrorZPtr {
1010    /**
1011     * A pointer to the contents in the success state.
1012     * Reading from this pointer when `result_ok` is not set is undefined.
1013     */
1014    struct LDKCommitmentTransaction *result;
1015    /**
1016     * A pointer to the contents in the error state.
1017     * Reading from this pointer when `result_ok` is set is undefined.
1018     */
1019    struct LDKDecodeError *err;
1020 } LDKCResult_CommitmentTransactionDecodeErrorZPtr;
1021
1022 /**
1023  * A CResult_CommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1024  * containing a crate::lightning::ln::chan_utils::CommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1025  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1026  */
1027 typedef struct LDKCResult_CommitmentTransactionDecodeErrorZ {
1028    /**
1029     * The contents of this CResult_CommitmentTransactionDecodeErrorZ, accessible via either
1030     * `err` or `result` depending on the state of `result_ok`.
1031     */
1032    union LDKCResult_CommitmentTransactionDecodeErrorZPtr contents;
1033    /**
1034     * Whether this CResult_CommitmentTransactionDecodeErrorZ represents a success state.
1035     */
1036    bool result_ok;
1037 } LDKCResult_CommitmentTransactionDecodeErrorZ;
1038
1039
1040
1041 /**
1042  * A wrapper on CommitmentTransaction indicating that the derived fields (the built bitcoin
1043  * transaction and the transaction creation keys) are trusted.
1044  *
1045  * See trust() and verify() functions on CommitmentTransaction.
1046  *
1047  * This structure implements Deref.
1048  */
1049 typedef struct MUST_USE_STRUCT LDKTrustedCommitmentTransaction {
1050    /**
1051     * A pointer to the opaque Rust object.
1052     * Nearly everywhere, inner must be non-null, however in places where
1053     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1054     */
1055    LDKnativeTrustedCommitmentTransaction *inner;
1056    /**
1057     * Indicates that this is the only struct which contains the same pointer.
1058     * Rust functions which take ownership of an object provided via an argument require
1059     * this to be true and invalidate the object pointed to by inner.
1060     */
1061    bool is_owned;
1062 } LDKTrustedCommitmentTransaction;
1063
1064 /**
1065  * The contents of CResult_TrustedCommitmentTransactionNoneZ
1066  */
1067 typedef union LDKCResult_TrustedCommitmentTransactionNoneZPtr {
1068    /**
1069     * A pointer to the contents in the success state.
1070     * Reading from this pointer when `result_ok` is not set is undefined.
1071     */
1072    struct LDKTrustedCommitmentTransaction *result;
1073    /**
1074     * Note that this value is always NULL, as there are no contents in the Err variant
1075     */
1076    void *err;
1077 } LDKCResult_TrustedCommitmentTransactionNoneZPtr;
1078
1079 /**
1080  * A CResult_TrustedCommitmentTransactionNoneZ represents the result of a fallible operation,
1081  * containing a crate::lightning::ln::chan_utils::TrustedCommitmentTransaction on success and a () on failure.
1082  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1083  */
1084 typedef struct LDKCResult_TrustedCommitmentTransactionNoneZ {
1085    /**
1086     * The contents of this CResult_TrustedCommitmentTransactionNoneZ, accessible via either
1087     * `err` or `result` depending on the state of `result_ok`.
1088     */
1089    union LDKCResult_TrustedCommitmentTransactionNoneZPtr contents;
1090    /**
1091     * Whether this CResult_TrustedCommitmentTransactionNoneZ represents a success state.
1092     */
1093    bool result_ok;
1094 } LDKCResult_TrustedCommitmentTransactionNoneZ;
1095
1096 /**
1097  * The contents of CResult_CVec_SignatureZNoneZ
1098  */
1099 typedef union LDKCResult_CVec_SignatureZNoneZPtr {
1100    /**
1101     * A pointer to the contents in the success state.
1102     * Reading from this pointer when `result_ok` is not set is undefined.
1103     */
1104    struct LDKCVec_SignatureZ *result;
1105    /**
1106     * Note that this value is always NULL, as there are no contents in the Err variant
1107     */
1108    void *err;
1109 } LDKCResult_CVec_SignatureZNoneZPtr;
1110
1111 /**
1112  * A CResult_CVec_SignatureZNoneZ represents the result of a fallible operation,
1113  * containing a crate::c_types::derived::CVec_SignatureZ on success and a () on failure.
1114  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1115  */
1116 typedef struct LDKCResult_CVec_SignatureZNoneZ {
1117    /**
1118     * The contents of this CResult_CVec_SignatureZNoneZ, accessible via either
1119     * `err` or `result` depending on the state of `result_ok`.
1120     */
1121    union LDKCResult_CVec_SignatureZNoneZPtr contents;
1122    /**
1123     * Whether this CResult_CVec_SignatureZNoneZ represents a success state.
1124     */
1125    bool result_ok;
1126 } LDKCResult_CVec_SignatureZNoneZ;
1127
1128
1129
1130 /**
1131  * An update generated by the underlying Channel itself which contains some new information the
1132  * ChannelMonitor should be made aware of.
1133  */
1134 typedef struct MUST_USE_STRUCT LDKChannelMonitorUpdate {
1135    /**
1136     * A pointer to the opaque Rust object.
1137     * Nearly everywhere, inner must be non-null, however in places where
1138     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1139     */
1140    LDKnativeChannelMonitorUpdate *inner;
1141    /**
1142     * Indicates that this is the only struct which contains the same pointer.
1143     * Rust functions which take ownership of an object provided via an argument require
1144     * this to be true and invalidate the object pointed to by inner.
1145     */
1146    bool is_owned;
1147 } LDKChannelMonitorUpdate;
1148
1149 /**
1150  * The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
1151  */
1152 typedef union LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr {
1153    /**
1154     * A pointer to the contents in the success state.
1155     * Reading from this pointer when `result_ok` is not set is undefined.
1156     */
1157    struct LDKChannelMonitorUpdate *result;
1158    /**
1159     * A pointer to the contents in the error state.
1160     * Reading from this pointer when `result_ok` is set is undefined.
1161     */
1162    struct LDKDecodeError *err;
1163 } LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr;
1164
1165 /**
1166  * A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
1167  * containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
1168  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1169  */
1170 typedef struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ {
1171    /**
1172     * The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
1173     * `err` or `result` depending on the state of `result_ok`.
1174     */
1175    union LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr contents;
1176    /**
1177     * Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
1178     */
1179    bool result_ok;
1180 } LDKCResult_ChannelMonitorUpdateDecodeErrorZ;
1181
1182
1183
1184 /**
1185  * Simple structure sent back by `chain::Watch` when an HTLC from a forward channel is detected on
1186  * chain. Used to update the corresponding HTLC in the backward channel. Failing to pass the
1187  * preimage claim backward will lead to loss of funds.
1188  */
1189 typedef struct MUST_USE_STRUCT LDKHTLCUpdate {
1190    /**
1191     * A pointer to the opaque Rust object.
1192     * Nearly everywhere, inner must be non-null, however in places where
1193     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1194     */
1195    LDKnativeHTLCUpdate *inner;
1196    /**
1197     * Indicates that this is the only struct which contains the same pointer.
1198     * Rust functions which take ownership of an object provided via an argument require
1199     * this to be true and invalidate the object pointed to by inner.
1200     */
1201    bool is_owned;
1202 } LDKHTLCUpdate;
1203
1204 /**
1205  * The contents of CResult_HTLCUpdateDecodeErrorZ
1206  */
1207 typedef union LDKCResult_HTLCUpdateDecodeErrorZPtr {
1208    /**
1209     * A pointer to the contents in the success state.
1210     * Reading from this pointer when `result_ok` is not set is undefined.
1211     */
1212    struct LDKHTLCUpdate *result;
1213    /**
1214     * A pointer to the contents in the error state.
1215     * Reading from this pointer when `result_ok` is set is undefined.
1216     */
1217    struct LDKDecodeError *err;
1218 } LDKCResult_HTLCUpdateDecodeErrorZPtr;
1219
1220 /**
1221  * A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
1222  * containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
1223  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1224  */
1225 typedef struct LDKCResult_HTLCUpdateDecodeErrorZ {
1226    /**
1227     * The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
1228     * `err` or `result` depending on the state of `result_ok`.
1229     */
1230    union LDKCResult_HTLCUpdateDecodeErrorZPtr contents;
1231    /**
1232     * Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
1233     */
1234    bool result_ok;
1235 } LDKCResult_HTLCUpdateDecodeErrorZ;
1236
1237
1238
1239 /**
1240  * General Err type for ChannelMonitor actions. Generally, this implies that the data provided is
1241  * inconsistent with the ChannelMonitor being called. eg for ChannelMonitor::update_monitor this
1242  * means you tried to update a monitor for a different channel or the ChannelMonitorUpdate was
1243  * corrupted.
1244  * Contains a developer-readable error message.
1245  */
1246 typedef struct MUST_USE_STRUCT LDKMonitorUpdateError {
1247    /**
1248     * A pointer to the opaque Rust object.
1249     * Nearly everywhere, inner must be non-null, however in places where
1250     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1251     */
1252    LDKnativeMonitorUpdateError *inner;
1253    /**
1254     * Indicates that this is the only struct which contains the same pointer.
1255     * Rust functions which take ownership of an object provided via an argument require
1256     * this to be true and invalidate the object pointed to by inner.
1257     */
1258    bool is_owned;
1259 } LDKMonitorUpdateError;
1260
1261 /**
1262  * The contents of CResult_NoneMonitorUpdateErrorZ
1263  */
1264 typedef union LDKCResult_NoneMonitorUpdateErrorZPtr {
1265    /**
1266     * Note that this value is always NULL, as there are no contents in the OK variant
1267     */
1268    void *result;
1269    /**
1270     * A pointer to the contents in the error state.
1271     * Reading from this pointer when `result_ok` is set is undefined.
1272     */
1273    struct LDKMonitorUpdateError *err;
1274 } LDKCResult_NoneMonitorUpdateErrorZPtr;
1275
1276 /**
1277  * A CResult_NoneMonitorUpdateErrorZ represents the result of a fallible operation,
1278  * containing a () on success and a crate::lightning::chain::channelmonitor::MonitorUpdateError on failure.
1279  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1280  */
1281 typedef struct LDKCResult_NoneMonitorUpdateErrorZ {
1282    /**
1283     * The contents of this CResult_NoneMonitorUpdateErrorZ, accessible via either
1284     * `err` or `result` depending on the state of `result_ok`.
1285     */
1286    union LDKCResult_NoneMonitorUpdateErrorZPtr contents;
1287    /**
1288     * Whether this CResult_NoneMonitorUpdateErrorZ represents a success state.
1289     */
1290    bool result_ok;
1291 } LDKCResult_NoneMonitorUpdateErrorZ;
1292
1293 /**
1294  * A tuple of 2 elements. See the individual fields for the types contained.
1295  */
1296 typedef struct LDKC2Tuple_OutPointScriptZ {
1297    /**
1298     * The element at position 0
1299     */
1300    struct LDKOutPoint a;
1301    /**
1302     * The element at position 1
1303     */
1304    struct LDKCVec_u8Z b;
1305 } LDKC2Tuple_OutPointScriptZ;
1306
1307 /**
1308  * A tuple of 2 elements. See the individual fields for the types contained.
1309  */
1310 typedef struct LDKC2Tuple_u32ScriptZ {
1311    /**
1312     * The element at position 0
1313     */
1314    uint32_t a;
1315    /**
1316     * The element at position 1
1317     */
1318    struct LDKCVec_u8Z b;
1319 } LDKC2Tuple_u32ScriptZ;
1320
1321 /**
1322  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size.
1323  * This corresponds to std::vector in C++
1324  */
1325 typedef struct LDKCVec_C2Tuple_u32ScriptZZ {
1326    /**
1327     * The elements in the array.
1328     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1329     */
1330    struct LDKC2Tuple_u32ScriptZ *data;
1331    /**
1332     * The number of elements pointed to by `data`.
1333     */
1334    uintptr_t datalen;
1335 } LDKCVec_C2Tuple_u32ScriptZZ;
1336
1337 /**
1338  * Arbitrary 32 bytes, which could represent one of a few different things. You probably want to
1339  * look up the corresponding function in rust-lightning's docs.
1340  */
1341 typedef struct LDKThirtyTwoBytes {
1342    /**
1343     * The thirty-two bytes
1344     */
1345    uint8_t data[32];
1346 } LDKThirtyTwoBytes;
1347
1348 /**
1349  * A tuple of 2 elements. See the individual fields for the types contained.
1350  */
1351 typedef struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
1352    /**
1353     * The element at position 0
1354     */
1355    struct LDKThirtyTwoBytes a;
1356    /**
1357     * The element at position 1
1358     */
1359    struct LDKCVec_C2Tuple_u32ScriptZZ b;
1360 } LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ;
1361
1362 /**
1363  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size.
1364  * This corresponds to std::vector in C++
1365  */
1366 typedef struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
1367    /**
1368     * The elements in the array.
1369     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1370     */
1371    struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *data;
1372    /**
1373     * The number of elements pointed to by `data`.
1374     */
1375    uintptr_t datalen;
1376 } LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ;
1377
1378 /**
1379  * An event to be processed by the ChannelManager.
1380  */
1381 typedef enum LDKMonitorEvent_Tag {
1382    /**
1383     * A monitor event containing an HTLCUpdate.
1384     */
1385    LDKMonitorEvent_HTLCEvent,
1386    /**
1387     * A monitor event that the Channel's commitment transaction was broadcasted.
1388     */
1389    LDKMonitorEvent_CommitmentTxBroadcasted,
1390    /**
1391     * Must be last for serialization purposes
1392     */
1393    LDKMonitorEvent_Sentinel,
1394 } LDKMonitorEvent_Tag;
1395
1396 typedef struct MUST_USE_STRUCT LDKMonitorEvent {
1397    LDKMonitorEvent_Tag tag;
1398    union {
1399       struct {
1400          struct LDKHTLCUpdate htlc_event;
1401       };
1402       struct {
1403          struct LDKOutPoint commitment_tx_broadcasted;
1404       };
1405    };
1406 } LDKMonitorEvent;
1407
1408 /**
1409  * A dynamically-allocated array of crate::lightning::chain::channelmonitor::MonitorEvents of arbitrary size.
1410  * This corresponds to std::vector in C++
1411  */
1412 typedef struct LDKCVec_MonitorEventZ {
1413    /**
1414     * The elements in the array.
1415     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1416     */
1417    struct LDKMonitorEvent *data;
1418    /**
1419     * The number of elements pointed to by `data`.
1420     */
1421    uintptr_t datalen;
1422 } LDKCVec_MonitorEventZ;
1423
1424
1425
1426 /**
1427  * Information about a spendable output to a P2WSH script. See
1428  * SpendableOutputDescriptor::DelayedPaymentOutput for more details on how to spend this.
1429  */
1430 typedef struct MUST_USE_STRUCT LDKDelayedPaymentOutputDescriptor {
1431    /**
1432     * A pointer to the opaque Rust object.
1433     * Nearly everywhere, inner must be non-null, however in places where
1434     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1435     */
1436    LDKnativeDelayedPaymentOutputDescriptor *inner;
1437    /**
1438     * Indicates that this is the only struct which contains the same pointer.
1439     * Rust functions which take ownership of an object provided via an argument require
1440     * this to be true and invalidate the object pointed to by inner.
1441     */
1442    bool is_owned;
1443 } LDKDelayedPaymentOutputDescriptor;
1444
1445
1446
1447 /**
1448  * Information about a spendable output to our \"payment key\". See
1449  * SpendableOutputDescriptor::StaticPaymentOutput for more details on how to spend this.
1450  */
1451 typedef struct MUST_USE_STRUCT LDKStaticPaymentOutputDescriptor {
1452    /**
1453     * A pointer to the opaque Rust object.
1454     * Nearly everywhere, inner must be non-null, however in places where
1455     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1456     */
1457    LDKnativeStaticPaymentOutputDescriptor *inner;
1458    /**
1459     * Indicates that this is the only struct which contains the same pointer.
1460     * Rust functions which take ownership of an object provided via an argument require
1461     * this to be true and invalidate the object pointed to by inner.
1462     */
1463    bool is_owned;
1464 } LDKStaticPaymentOutputDescriptor;
1465
1466 /**
1467  * When on-chain outputs are created by rust-lightning (which our counterparty is not able to
1468  * claim at any point in the future) an event is generated which you must track and be able to
1469  * spend on-chain. The information needed to do this is provided in this enum, including the
1470  * outpoint describing which txid and output index is available, the full output which exists at
1471  * that txid/index, and any keys or other information required to sign.
1472  */
1473 typedef enum LDKSpendableOutputDescriptor_Tag {
1474    /**
1475     * An output to a script which was provided via KeysInterface directly, either from
1476     * `get_destination_script()` or `get_shutdown_pubkey()`, thus you should already know how to
1477     * spend it. No secret keys are provided as rust-lightning was never given any key.
1478     * These may include outputs from a transaction punishing our counterparty or claiming an HTLC
1479     * on-chain using the payment preimage or after it has timed out.
1480     */
1481    LDKSpendableOutputDescriptor_StaticOutput,
1482    /**
1483     * An output to a P2WSH script which can be spent with a single signature after a CSV delay.
1484     *
1485     * The witness in the spending input should be:
1486     * <BIP 143 signature> <empty vector> (MINIMALIF standard rule) <provided witnessScript>
1487     *
1488     * Note that the nSequence field in the spending input must be set to to_self_delay
1489     * (which means the transaction is not broadcastable until at least to_self_delay
1490     * blocks after the outpoint confirms).
1491     *
1492     * These are generally the result of a \"revocable\" output to us, spendable only by us unless
1493     * it is an output from an old state which we broadcast (which should never happen).
1494     *
1495     * To derive the delayed_payment key which is used to sign for this input, you must pass the
1496     * holder delayed_payment_base_key (ie the private key which corresponds to the pubkey in
1497     * Sign::pubkeys().delayed_payment_basepoint) and the provided per_commitment_point to
1498     * chan_utils::derive_private_key. The public key can be generated without the secret key
1499     * using chan_utils::derive_public_key and only the delayed_payment_basepoint which appears in
1500     * Sign::pubkeys().
1501     *
1502     * To derive the revocation_pubkey provided here (which is used in the witness
1503     * script generation), you must pass the counterparty revocation_basepoint (which appears in the
1504     * call to Sign::ready_channel) and the provided per_commitment point
1505     * to chan_utils::derive_public_revocation_key.
1506     *
1507     * The witness script which is hashed and included in the output script_pubkey may be
1508     * regenerated by passing the revocation_pubkey (derived as above), our delayed_payment pubkey
1509     * (derived as above), and the to_self_delay contained here to
1510     * chan_utils::get_revokeable_redeemscript.
1511     */
1512    LDKSpendableOutputDescriptor_DelayedPaymentOutput,
1513    /**
1514     * An output to a P2WPKH, spendable exclusively by our payment key (ie the private key which
1515     * corresponds to the public key in Sign::pubkeys().payment_point).
1516     * The witness in the spending input, is, thus, simply:
1517     * <BIP 143 signature> <payment key>
1518     *
1519     * These are generally the result of our counterparty having broadcast the current state,
1520     * allowing us to claim the non-HTLC-encumbered outputs immediately.
1521     */
1522    LDKSpendableOutputDescriptor_StaticPaymentOutput,
1523    /**
1524     * Must be last for serialization purposes
1525     */
1526    LDKSpendableOutputDescriptor_Sentinel,
1527 } LDKSpendableOutputDescriptor_Tag;
1528
1529 typedef struct LDKSpendableOutputDescriptor_LDKStaticOutput_Body {
1530    /**
1531     * The outpoint which is spendable
1532     */
1533    struct LDKOutPoint outpoint;
1534    /**
1535     * The output which is referenced by the given outpoint.
1536     */
1537    struct LDKTxOut output;
1538 } LDKSpendableOutputDescriptor_LDKStaticOutput_Body;
1539
1540 typedef struct MUST_USE_STRUCT LDKSpendableOutputDescriptor {
1541    LDKSpendableOutputDescriptor_Tag tag;
1542    union {
1543       LDKSpendableOutputDescriptor_LDKStaticOutput_Body static_output;
1544       struct {
1545          struct LDKDelayedPaymentOutputDescriptor delayed_payment_output;
1546       };
1547       struct {
1548          struct LDKStaticPaymentOutputDescriptor static_payment_output;
1549       };
1550    };
1551 } LDKSpendableOutputDescriptor;
1552
1553 /**
1554  * A dynamically-allocated array of crate::lightning::chain::keysinterface::SpendableOutputDescriptors of arbitrary size.
1555  * This corresponds to std::vector in C++
1556  */
1557 typedef struct LDKCVec_SpendableOutputDescriptorZ {
1558    /**
1559     * The elements in the array.
1560     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1561     */
1562    struct LDKSpendableOutputDescriptor *data;
1563    /**
1564     * The number of elements pointed to by `data`.
1565     */
1566    uintptr_t datalen;
1567 } LDKCVec_SpendableOutputDescriptorZ;
1568
1569 /**
1570  * An Event which you should probably take some action in response to.
1571  *
1572  * Note that while Writeable and Readable are implemented for Event, you probably shouldn't use
1573  * them directly as they don't round-trip exactly (for example FundingGenerationReady is never
1574  * written as it makes no sense to respond to it after reconnecting to peers).
1575  */
1576 typedef enum LDKEvent_Tag {
1577    /**
1578     * Used to indicate that the client should generate a funding transaction with the given
1579     * parameters and then call ChannelManager::funding_transaction_generated.
1580     * Generated in ChannelManager message handling.
1581     * Note that *all inputs* in the funding transaction must spend SegWit outputs or your
1582     * counterparty can steal your funds!
1583     */
1584    LDKEvent_FundingGenerationReady,
1585    /**
1586     * Indicates we've received money! Just gotta dig out that payment preimage and feed it to
1587     * ChannelManager::claim_funds to get it....
1588     * Note that if the preimage is not known or the amount paid is incorrect, you should call
1589     * ChannelManager::fail_htlc_backwards to free up resources for this HTLC and avoid
1590     * network congestion.
1591     * The amount paid should be considered 'incorrect' when it is less than or more than twice
1592     * the amount expected.
1593     * If you fail to call either ChannelManager::claim_funds or
1594     * ChannelManager::fail_htlc_backwards within the HTLC's timeout, the HTLC will be
1595     * automatically failed.
1596     */
1597    LDKEvent_PaymentReceived,
1598    /**
1599     * Indicates an outbound payment we made succeeded (ie it made it all the way to its target
1600     * and we got back the payment preimage for it).
1601     * Note that duplicative PaymentSent Events may be generated - it is your responsibility to
1602     * deduplicate them by payment_preimage (which MUST be unique)!
1603     */
1604    LDKEvent_PaymentSent,
1605    /**
1606     * Indicates an outbound payment we made failed. Probably some intermediary node dropped
1607     * something. You may wish to retry with a different route.
1608     * Note that duplicative PaymentFailed Events may be generated - it is your responsibility to
1609     * deduplicate them by payment_hash (which MUST be unique)!
1610     */
1611    LDKEvent_PaymentFailed,
1612    /**
1613     * Used to indicate that ChannelManager::process_pending_htlc_forwards should be called at a
1614     * time in the future.
1615     */
1616    LDKEvent_PendingHTLCsForwardable,
1617    /**
1618     * Used to indicate that an output was generated on-chain which you should know how to spend.
1619     * Such an output will *not* ever be spent by rust-lightning, and are not at risk of your
1620     * counterparty spending them due to some kind of timeout. Thus, you need to store them
1621     * somewhere and spend them when you create on-chain transactions.
1622     */
1623    LDKEvent_SpendableOutputs,
1624    /**
1625     * Must be last for serialization purposes
1626     */
1627    LDKEvent_Sentinel,
1628 } LDKEvent_Tag;
1629
1630 typedef struct LDKEvent_LDKFundingGenerationReady_Body {
1631    /**
1632     * The random channel_id we picked which you'll need to pass into
1633     * ChannelManager::funding_transaction_generated.
1634     */
1635    struct LDKThirtyTwoBytes temporary_channel_id;
1636    /**
1637     * The value, in satoshis, that the output should have.
1638     */
1639    uint64_t channel_value_satoshis;
1640    /**
1641     * The script which should be used in the transaction output.
1642     */
1643    struct LDKCVec_u8Z output_script;
1644    /**
1645     * The value passed in to ChannelManager::create_channel
1646     */
1647    uint64_t user_channel_id;
1648 } LDKEvent_LDKFundingGenerationReady_Body;
1649
1650 typedef struct LDKEvent_LDKPaymentReceived_Body {
1651    /**
1652     * The hash for which the preimage should be handed to the ChannelManager.
1653     */
1654    struct LDKThirtyTwoBytes payment_hash;
1655    /**
1656     * The \"payment secret\". This authenticates the sender to the recipient, preventing a
1657     * number of deanonymization attacks during the routing process.
1658     * As nodes upgrade, the invoices you provide should likely migrate to setting the
1659     * payment_secret feature to required, at which point you should fail_backwards any HTLCs
1660     * which have a None here.
1661     * Until then, however, values of None should be ignored, and only incorrect Some values
1662     * should result in an HTLC fail_backwards.
1663     * Note that, in any case, this value must be passed as-is to any fail or claim calls as
1664     * the HTLC index includes this value.
1665     */
1666    struct LDKThirtyTwoBytes payment_secret;
1667    /**
1668     * The value, in thousandths of a satoshi, that this payment is for. Note that you must
1669     * compare this to the expected value before accepting the payment (as otherwise you are
1670     * providing proof-of-payment for less than the value you expected!).
1671     */
1672    uint64_t amt;
1673 } LDKEvent_LDKPaymentReceived_Body;
1674
1675 typedef struct LDKEvent_LDKPaymentSent_Body {
1676    /**
1677     * The preimage to the hash given to ChannelManager::send_payment.
1678     * Note that this serves as a payment receipt, if you wish to have such a thing, you must
1679     * store it somehow!
1680     */
1681    struct LDKThirtyTwoBytes payment_preimage;
1682 } LDKEvent_LDKPaymentSent_Body;
1683
1684 typedef struct LDKEvent_LDKPaymentFailed_Body {
1685    /**
1686     * The hash which was given to ChannelManager::send_payment.
1687     */
1688    struct LDKThirtyTwoBytes payment_hash;
1689    /**
1690     * Indicates the payment was rejected for some reason by the recipient. This implies that
1691     * the payment has failed, not just the route in question. If this is not set, you may
1692     * retry the payment via a different route.
1693     */
1694    bool rejected_by_dest;
1695 } LDKEvent_LDKPaymentFailed_Body;
1696
1697 typedef struct LDKEvent_LDKPendingHTLCsForwardable_Body {
1698    /**
1699     * The minimum amount of time that should be waited prior to calling
1700     * process_pending_htlc_forwards. To increase the effort required to correlate payments,
1701     * you should wait a random amount of time in roughly the range (now + time_forwardable,
1702     * now + 5*time_forwardable).
1703     */
1704    uint64_t time_forwardable;
1705 } LDKEvent_LDKPendingHTLCsForwardable_Body;
1706
1707 typedef struct LDKEvent_LDKSpendableOutputs_Body {
1708    /**
1709     * The outputs which you should store as spendable by you.
1710     */
1711    struct LDKCVec_SpendableOutputDescriptorZ outputs;
1712 } LDKEvent_LDKSpendableOutputs_Body;
1713
1714 typedef struct MUST_USE_STRUCT LDKEvent {
1715    LDKEvent_Tag tag;
1716    union {
1717       LDKEvent_LDKFundingGenerationReady_Body funding_generation_ready;
1718       LDKEvent_LDKPaymentReceived_Body payment_received;
1719       LDKEvent_LDKPaymentSent_Body payment_sent;
1720       LDKEvent_LDKPaymentFailed_Body payment_failed;
1721       LDKEvent_LDKPendingHTLCsForwardable_Body pending_htl_cs_forwardable;
1722       LDKEvent_LDKSpendableOutputs_Body spendable_outputs;
1723    };
1724 } LDKEvent;
1725
1726 /**
1727  * A dynamically-allocated array of crate::lightning::util::events::Events of arbitrary size.
1728  * This corresponds to std::vector in C++
1729  */
1730 typedef struct LDKCVec_EventZ {
1731    /**
1732     * The elements in the array.
1733     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1734     */
1735    struct LDKEvent *data;
1736    /**
1737     * The number of elements pointed to by `data`.
1738     */
1739    uintptr_t datalen;
1740 } LDKCVec_EventZ;
1741
1742 /**
1743  * A dynamically-allocated array of crate::c_types::Transactions of arbitrary size.
1744  * This corresponds to std::vector in C++
1745  */
1746 typedef struct LDKCVec_TransactionZ {
1747    /**
1748     * The elements in the array.
1749     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1750     */
1751    struct LDKTransaction *data;
1752    /**
1753     * The number of elements pointed to by `data`.
1754     */
1755    uintptr_t datalen;
1756 } LDKCVec_TransactionZ;
1757
1758 /**
1759  * A tuple of 2 elements. See the individual fields for the types contained.
1760  */
1761 typedef struct LDKC2Tuple_usizeTransactionZ {
1762    /**
1763     * The element at position 0
1764     */
1765    uintptr_t a;
1766    /**
1767     * The element at position 1
1768     */
1769    struct LDKTransaction b;
1770 } LDKC2Tuple_usizeTransactionZ;
1771
1772 /**
1773  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_usizeTransactionZs of arbitrary size.
1774  * This corresponds to std::vector in C++
1775  */
1776 typedef struct LDKCVec_C2Tuple_usizeTransactionZZ {
1777    /**
1778     * The elements in the array.
1779     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1780     */
1781    struct LDKC2Tuple_usizeTransactionZ *data;
1782    /**
1783     * The number of elements pointed to by `data`.
1784     */
1785    uintptr_t datalen;
1786 } LDKCVec_C2Tuple_usizeTransactionZZ;
1787
1788 /**
1789  * A tuple of 2 elements. See the individual fields for the types contained.
1790  */
1791 typedef struct LDKC2Tuple_u32TxOutZ {
1792    /**
1793     * The element at position 0
1794     */
1795    uint32_t a;
1796    /**
1797     * The element at position 1
1798     */
1799    struct LDKTxOut b;
1800 } LDKC2Tuple_u32TxOutZ;
1801
1802 /**
1803  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size.
1804  * This corresponds to std::vector in C++
1805  */
1806 typedef struct LDKCVec_C2Tuple_u32TxOutZZ {
1807    /**
1808     * The elements in the array.
1809     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1810     */
1811    struct LDKC2Tuple_u32TxOutZ *data;
1812    /**
1813     * The number of elements pointed to by `data`.
1814     */
1815    uintptr_t datalen;
1816 } LDKCVec_C2Tuple_u32TxOutZZ;
1817
1818 /**
1819  * A tuple of 2 elements. See the individual fields for the types contained.
1820  */
1821 typedef struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
1822    /**
1823     * The element at position 0
1824     */
1825    struct LDKThirtyTwoBytes a;
1826    /**
1827     * The element at position 1
1828     */
1829    struct LDKCVec_C2Tuple_u32TxOutZZ b;
1830 } LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ;
1831
1832 /**
1833  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZs of arbitrary size.
1834  * This corresponds to std::vector in C++
1835  */
1836 typedef struct LDKCVec_TransactionOutputsZ {
1837    /**
1838     * The elements in the array.
1839     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1840     */
1841    struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *data;
1842    /**
1843     * The number of elements pointed to by `data`.
1844     */
1845    uintptr_t datalen;
1846 } LDKCVec_TransactionOutputsZ;
1847
1848 /**
1849  * A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
1850  * This corresponds to std::vector in C++
1851  */
1852 typedef struct LDKCVec_TxidZ {
1853    /**
1854     * The elements in the array.
1855     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1856     */
1857    struct LDKThirtyTwoBytes *data;
1858    /**
1859     * The number of elements pointed to by `data`.
1860     */
1861    uintptr_t datalen;
1862 } LDKCVec_TxidZ;
1863
1864 /**
1865  * The contents of CResult_NoneChannelMonitorUpdateErrZ
1866  */
1867 typedef union LDKCResult_NoneChannelMonitorUpdateErrZPtr {
1868    /**
1869     * Note that this value is always NULL, as there are no contents in the OK variant
1870     */
1871    void *result;
1872    /**
1873     * A pointer to the contents in the error state.
1874     * Reading from this pointer when `result_ok` is set is undefined.
1875     */
1876    enum LDKChannelMonitorUpdateErr *err;
1877 } LDKCResult_NoneChannelMonitorUpdateErrZPtr;
1878
1879 /**
1880  * A CResult_NoneChannelMonitorUpdateErrZ represents the result of a fallible operation,
1881  * containing a () on success and a crate::lightning::chain::channelmonitor::ChannelMonitorUpdateErr on failure.
1882  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1883  */
1884 typedef struct LDKCResult_NoneChannelMonitorUpdateErrZ {
1885    /**
1886     * The contents of this CResult_NoneChannelMonitorUpdateErrZ, accessible via either
1887     * `err` or `result` depending on the state of `result_ok`.
1888     */
1889    union LDKCResult_NoneChannelMonitorUpdateErrZPtr contents;
1890    /**
1891     * Whether this CResult_NoneChannelMonitorUpdateErrZ represents a success state.
1892     */
1893    bool result_ok;
1894 } LDKCResult_NoneChannelMonitorUpdateErrZ;
1895
1896 /**
1897  * A tuple of 2 elements. See the individual fields for the types contained.
1898  */
1899 typedef struct LDKC2Tuple_SignatureCVec_SignatureZZ {
1900    /**
1901     * The element at position 0
1902     */
1903    struct LDKSignature a;
1904    /**
1905     * The element at position 1
1906     */
1907    struct LDKCVec_SignatureZ b;
1908 } LDKC2Tuple_SignatureCVec_SignatureZZ;
1909
1910 /**
1911  * The contents of CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ
1912  */
1913 typedef union LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
1914    /**
1915     * A pointer to the contents in the success state.
1916     * Reading from this pointer when `result_ok` is not set is undefined.
1917     */
1918    struct LDKC2Tuple_SignatureCVec_SignatureZZ *result;
1919    /**
1920     * Note that this value is always NULL, as there are no contents in the Err variant
1921     */
1922    void *err;
1923 } LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr;
1924
1925 /**
1926  * A CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents the result of a fallible operation,
1927  * containing a crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ on success and a () on failure.
1928  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1929  */
1930 typedef struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
1931    /**
1932     * The contents of this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ, accessible via either
1933     * `err` or `result` depending on the state of `result_ok`.
1934     */
1935    union LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr contents;
1936    /**
1937     * Whether this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents a success state.
1938     */
1939    bool result_ok;
1940 } LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ;
1941
1942 /**
1943  * The contents of CResult_SignatureNoneZ
1944  */
1945 typedef union LDKCResult_SignatureNoneZPtr {
1946    /**
1947     * A pointer to the contents in the success state.
1948     * Reading from this pointer when `result_ok` is not set is undefined.
1949     */
1950    struct LDKSignature *result;
1951    /**
1952     * Note that this value is always NULL, as there are no contents in the Err variant
1953     */
1954    void *err;
1955 } LDKCResult_SignatureNoneZPtr;
1956
1957 /**
1958  * A CResult_SignatureNoneZ represents the result of a fallible operation,
1959  * containing a crate::c_types::Signature on success and a () on failure.
1960  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1961  */
1962 typedef struct LDKCResult_SignatureNoneZ {
1963    /**
1964     * The contents of this CResult_SignatureNoneZ, accessible via either
1965     * `err` or `result` depending on the state of `result_ok`.
1966     */
1967    union LDKCResult_SignatureNoneZPtr contents;
1968    /**
1969     * Whether this CResult_SignatureNoneZ represents a success state.
1970     */
1971    bool result_ok;
1972 } LDKCResult_SignatureNoneZ;
1973
1974
1975
1976 /**
1977  * The unsigned part of a channel_announcement
1978  */
1979 typedef struct MUST_USE_STRUCT LDKUnsignedChannelAnnouncement {
1980    /**
1981     * A pointer to the opaque Rust object.
1982     * Nearly everywhere, inner must be non-null, however in places where
1983     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1984     */
1985    LDKnativeUnsignedChannelAnnouncement *inner;
1986    /**
1987     * Indicates that this is the only struct which contains the same pointer.
1988     * Rust functions which take ownership of an object provided via an argument require
1989     * this to be true and invalidate the object pointed to by inner.
1990     */
1991    bool is_owned;
1992 } LDKUnsignedChannelAnnouncement;
1993
1994 /**
1995  * A trait to sign lightning channel transactions as described in BOLT 3.
1996  *
1997  * Signing services could be implemented on a hardware wallet. In this case,
1998  * the current Sign would be a front-end on top of a communication
1999  * channel connected to your secure device and lightning key material wouldn't
2000  * reside on a hot server. Nevertheless, a this deployment would still need
2001  * to trust the ChannelManager to avoid loss of funds as this latest component
2002  * could ask to sign commitment transaction with HTLCs paying to attacker pubkeys.
2003  *
2004  * A more secure iteration would be to use hashlock (or payment points) to pair
2005  * invoice/incoming HTLCs with outgoing HTLCs to implement a no-trust-ChannelManager
2006  * at the price of more state and computation on the hardware wallet side. In the future,
2007  * we are looking forward to design such interface.
2008  *
2009  * In any case, ChannelMonitor or fallback watchtowers are always going to be trusted
2010  * to act, as liveness and breach reply correctness are always going to be hard requirements
2011  * of LN security model, orthogonal of key management issues.
2012  */
2013 typedef struct LDKBaseSign {
2014    /**
2015     * An opaque pointer which is passed to your function implementations as an argument.
2016     * This has no meaning in the LDK, and can be NULL or any other value.
2017     */
2018    void *this_arg;
2019    /**
2020     * Gets the per-commitment point for a specific commitment number
2021     *
2022     * Note that the commitment number starts at (1 << 48) - 1 and counts backwards.
2023     */
2024    struct LDKPublicKey (*get_per_commitment_point)(const void *this_arg, uint64_t idx);
2025    /**
2026     * Gets the commitment secret for a specific commitment number as part of the revocation process
2027     *
2028     * An external signer implementation should error here if the commitment was already signed
2029     * and should refuse to sign it in the future.
2030     *
2031     * May be called more than once for the same index.
2032     *
2033     * Note that the commitment number starts at (1 << 48) - 1 and counts backwards.
2034     */
2035    struct LDKThirtyTwoBytes (*release_commitment_secret)(const void *this_arg, uint64_t idx);
2036    /**
2037     * Gets the holder's channel public keys and basepoints
2038     */
2039    struct LDKChannelPublicKeys pubkeys;
2040    /**
2041     * Fill in the pubkeys field as a reference to it will be given to Rust after this returns
2042     * Note that this takes a pointer to this object, not the this_ptr like other methods do
2043     * This function pointer may be NULL if pubkeys is filled in when this object is created and never needs updating.
2044     */
2045    void (*set_pubkeys)(const struct LDKBaseSign*NONNULL_PTR );
2046    /**
2047     * Gets an arbitrary identifier describing the set of keys which are provided back to you in
2048     * some SpendableOutputDescriptor types. This should be sufficient to identify this
2049     * Sign object uniquely and lookup or re-derive its keys.
2050     */
2051    struct LDKThirtyTwoBytes (*channel_keys_id)(const void *this_arg);
2052    /**
2053     * Create a signature for a counterparty's commitment transaction and associated HTLC transactions.
2054     *
2055     * Note that if signing fails or is rejected, the channel will be force-closed.
2056     */
2057    struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*sign_counterparty_commitment)(const void *this_arg, const struct LDKCommitmentTransaction *NONNULL_PTR commitment_tx);
2058    /**
2059     * Create a signatures for a holder's commitment transaction and its claiming HTLC transactions.
2060     * This will only ever be called with a non-revoked commitment_tx.  This will be called with the
2061     * latest commitment_tx when we initiate a force-close.
2062     * This will be called with the previous latest, just to get claiming HTLC signatures, if we are
2063     * reacting to a ChannelMonitor replica that decided to broadcast before it had been updated to
2064     * the latest.
2065     * This may be called multiple times for the same transaction.
2066     *
2067     * An external signer implementation should check that the commitment has not been revoked.
2068     *
2069     * May return Err if key derivation fails.  Callers, such as ChannelMonitor, will panic in such a case.
2070     */
2071    struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*sign_holder_commitment_and_htlcs)(const void *this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR commitment_tx);
2072    /**
2073     * Create a signature for the given input in a transaction spending an HTLC or commitment
2074     * transaction output when our counterparty broadcasts an old state.
2075     *
2076     * A justice transaction may claim multiples outputs at the same time if timelocks are
2077     * similar, but only a signature for the input at index `input` should be signed for here.
2078     * It may be called multiples time for same output(s) if a fee-bump is needed with regards
2079     * to an upcoming timelock expiration.
2080     *
2081     * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
2082     *
2083     * per_commitment_key is revocation secret which was provided by our counterparty when they
2084     * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does
2085     * not allow the spending of any funds by itself (you need our holder revocation_secret to do
2086     * so).
2087     *
2088     * htlc holds HTLC elements (hash, timelock) if the output being spent is a HTLC output, thus
2089     * changing the format of the witness script (which is committed to in the BIP 143
2090     * signatures).
2091     */
2092    struct LDKCResult_SignatureNoneZ (*sign_justice_transaction)(const void *this_arg, struct LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (*per_commitment_key)[32], const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc);
2093    /**
2094     * Create a signature for a claiming transaction for a HTLC output on a counterparty's commitment
2095     * transaction, either offered or received.
2096     *
2097     * Such a transaction may claim multiples offered outputs at same time if we know the
2098     * preimage for each when we create it, but only the input at index `input` should be
2099     * signed for here. It may be called multiple times for same output(s) if a fee-bump is
2100     * needed with regards to an upcoming timelock expiration.
2101     *
2102     * Witness_script is either a offered or received script as defined in BOLT3 for HTLC
2103     * outputs.
2104     *
2105     * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
2106     *
2107     * Per_commitment_point is the dynamic point corresponding to the channel state
2108     * detected onchain. It has been generated by our counterparty and is used to derive
2109     * channel state keys, which are then included in the witness script and committed to in the
2110     * BIP 143 signature.
2111     */
2112    struct LDKCResult_SignatureNoneZ (*sign_counterparty_htlc_transaction)(const void *this_arg, struct LDKTransaction htlc_tx, uintptr_t input, uint64_t amount, struct LDKPublicKey per_commitment_point, const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc);
2113    /**
2114     * Create a signature for a (proposed) closing transaction.
2115     *
2116     * Note that, due to rounding, there may be one \"missing\" satoshi, and either party may have
2117     * chosen to forgo their output as dust.
2118     */
2119    struct LDKCResult_SignatureNoneZ (*sign_closing_transaction)(const void *this_arg, struct LDKTransaction closing_tx);
2120    /**
2121     * Signs a channel announcement message with our funding key, proving it comes from one
2122     * of the channel participants.
2123     *
2124     * Note that if this fails or is rejected, the channel will not be publicly announced and
2125     * our counterparty may (though likely will not) close the channel on us for violating the
2126     * protocol.
2127     */
2128    struct LDKCResult_SignatureNoneZ (*sign_channel_announcement)(const void *this_arg, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR msg);
2129    /**
2130     * Set the counterparty static channel data, including basepoints,
2131     * counterparty_selected/holder_selected_contest_delay and funding outpoint.
2132     * This is done as soon as the funding outpoint is known.  Since these are static channel data,
2133     * they MUST NOT be allowed to change to different values once set.
2134     *
2135     * channel_parameters.is_populated() MUST be true.
2136     *
2137     * We bind holder_selected_contest_delay late here for API convenience.
2138     *
2139     * Will be called before any signatures are applied.
2140     */
2141    void (*ready_channel)(void *this_arg, const struct LDKChannelTransactionParameters *NONNULL_PTR channel_parameters);
2142    /**
2143     * Frees any resources associated with this object given its this_arg pointer.
2144     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
2145     */
2146    void (*free)(void *this_arg);
2147 } LDKBaseSign;
2148
2149 /**
2150  * A cloneable signer.
2151  *
2152  * Although we require signers to be cloneable, it may be useful for developers to be able to use
2153  * signers in an un-sized way, for example as `dyn BaseSign`. Therefore we separate the Clone trait,
2154  * which implies Sized, into this derived trait.
2155  */
2156 typedef struct LDKSign {
2157    /**
2158     * An opaque pointer which is passed to your function implementations as an argument.
2159     * This has no meaning in the LDK, and can be NULL or any other value.
2160     */
2161    void *this_arg;
2162    /**
2163     * Implementation of BaseSign for this object.
2164     */
2165    struct LDKBaseSign BaseSign;
2166    /**
2167     * Creates a copy of the BaseSign, for a copy of this Sign.
2168     * Because BaseSign doesn't natively support copying itself, you have to provide a full copy implementation here.
2169     */
2170    struct LDKBaseSign (*BaseSign_clone)(const struct LDKBaseSign *NONNULL_PTR orig_BaseSign);
2171    /**
2172     * Serialize the object into a byte array
2173     */
2174    struct LDKCVec_u8Z (*write)(const void *this_arg);
2175    /**
2176     * Creates a copy of the object pointed to by this_arg, for a copy of this Sign.
2177     * Note that the ultimate copy of the Sign will have all function pointers the same as the original.
2178     * May be NULL if no action needs to be taken, the this_arg pointer will be copied into the new Sign.
2179     */
2180    void *(*clone)(const void *this_arg);
2181    /**
2182     * Frees any resources associated with this object given its this_arg pointer.
2183     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
2184     */
2185    void (*free)(void *this_arg);
2186 } LDKSign;
2187
2188
2189
2190 /**
2191  * A ChannelMonitor handles chain events (blocks connected and disconnected) and generates
2192  * on-chain transactions to ensure no loss of funds occurs.
2193  *
2194  * You MUST ensure that no ChannelMonitors for a given channel anywhere contain out-of-date
2195  * information and are actively monitoring the chain.
2196  *
2197  * Pending Events or updated HTLCs which have not yet been read out by
2198  * get_and_clear_pending_monitor_events or get_and_clear_pending_events are serialized to disk and
2199  * reloaded at deserialize-time. Thus, you must ensure that, when handling events, all events
2200  * gotten are fully handled before re-serializing the new state.
2201  *
2202  * Note that the deserializer is only implemented for (BlockHash, ChannelMonitor), which
2203  * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along
2204  * the \"reorg path\" (ie disconnecting blocks until you find a common ancestor from both the
2205  * returned block hash and the the current chain and then reconnecting blocks to get to the
2206  * best chain) upon deserializing the object!
2207  */
2208 typedef struct MUST_USE_STRUCT LDKChannelMonitor {
2209    /**
2210     * A pointer to the opaque Rust object.
2211     * Nearly everywhere, inner must be non-null, however in places where
2212     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2213     */
2214    LDKnativeChannelMonitor *inner;
2215    /**
2216     * Indicates that this is the only struct which contains the same pointer.
2217     * Rust functions which take ownership of an object provided via an argument require
2218     * this to be true and invalidate the object pointed to by inner.
2219     */
2220    bool is_owned;
2221 } LDKChannelMonitor;
2222
2223 /**
2224  * A tuple of 2 elements. See the individual fields for the types contained.
2225  */
2226 typedef struct LDKC2Tuple_BlockHashChannelMonitorZ {
2227    /**
2228     * The element at position 0
2229     */
2230    struct LDKThirtyTwoBytes a;
2231    /**
2232     * The element at position 1
2233     */
2234    struct LDKChannelMonitor b;
2235 } LDKC2Tuple_BlockHashChannelMonitorZ;
2236
2237 /**
2238  * The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ
2239  */
2240 typedef union LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
2241    /**
2242     * A pointer to the contents in the success state.
2243     * Reading from this pointer when `result_ok` is not set is undefined.
2244     */
2245    struct LDKC2Tuple_BlockHashChannelMonitorZ *result;
2246    /**
2247     * A pointer to the contents in the error state.
2248     * Reading from this pointer when `result_ok` is set is undefined.
2249     */
2250    struct LDKDecodeError *err;
2251 } LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr;
2252
2253 /**
2254  * A CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents the result of a fallible operation,
2255  * containing a crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
2256  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2257  */
2258 typedef struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
2259    /**
2260     * The contents of this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either
2261     * `err` or `result` depending on the state of `result_ok`.
2262     */
2263    union LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr contents;
2264    /**
2265     * Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state.
2266     */
2267    bool result_ok;
2268 } LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ;
2269
2270
2271
2272 /**
2273  * A hop in a route
2274  */
2275 typedef struct MUST_USE_STRUCT LDKRouteHop {
2276    /**
2277     * A pointer to the opaque Rust object.
2278     * Nearly everywhere, inner must be non-null, however in places where
2279     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2280     */
2281    LDKnativeRouteHop *inner;
2282    /**
2283     * Indicates that this is the only struct which contains the same pointer.
2284     * Rust functions which take ownership of an object provided via an argument require
2285     * this to be true and invalidate the object pointed to by inner.
2286     */
2287    bool is_owned;
2288 } LDKRouteHop;
2289
2290 /**
2291  * A dynamically-allocated array of crate::lightning::routing::router::RouteHops of arbitrary size.
2292  * This corresponds to std::vector in C++
2293  */
2294 typedef struct LDKCVec_RouteHopZ {
2295    /**
2296     * The elements in the array.
2297     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2298     */
2299    struct LDKRouteHop *data;
2300    /**
2301     * The number of elements pointed to by `data`.
2302     */
2303    uintptr_t datalen;
2304 } LDKCVec_RouteHopZ;
2305
2306 /**
2307  * A dynamically-allocated array of crate::c_types::derived::CVec_RouteHopZs of arbitrary size.
2308  * This corresponds to std::vector in C++
2309  */
2310 typedef struct LDKCVec_CVec_RouteHopZZ {
2311    /**
2312     * The elements in the array.
2313     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2314     */
2315    struct LDKCVec_RouteHopZ *data;
2316    /**
2317     * The number of elements pointed to by `data`.
2318     */
2319    uintptr_t datalen;
2320 } LDKCVec_CVec_RouteHopZZ;
2321
2322
2323
2324 /**
2325  * A route directs a payment from the sender (us) to the recipient. If the recipient supports MPP,
2326  * it can take multiple paths. Each path is composed of one or more hops through the network.
2327  */
2328 typedef struct MUST_USE_STRUCT LDKRoute {
2329    /**
2330     * A pointer to the opaque Rust object.
2331     * Nearly everywhere, inner must be non-null, however in places where
2332     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2333     */
2334    LDKnativeRoute *inner;
2335    /**
2336     * Indicates that this is the only struct which contains the same pointer.
2337     * Rust functions which take ownership of an object provided via an argument require
2338     * this to be true and invalidate the object pointed to by inner.
2339     */
2340    bool is_owned;
2341 } LDKRoute;
2342
2343 /**
2344  * The contents of CResult_RouteDecodeErrorZ
2345  */
2346 typedef union LDKCResult_RouteDecodeErrorZPtr {
2347    /**
2348     * A pointer to the contents in the success state.
2349     * Reading from this pointer when `result_ok` is not set is undefined.
2350     */
2351    struct LDKRoute *result;
2352    /**
2353     * A pointer to the contents in the error state.
2354     * Reading from this pointer when `result_ok` is set is undefined.
2355     */
2356    struct LDKDecodeError *err;
2357 } LDKCResult_RouteDecodeErrorZPtr;
2358
2359 /**
2360  * A CResult_RouteDecodeErrorZ represents the result of a fallible operation,
2361  * containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::DecodeError on failure.
2362  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2363  */
2364 typedef struct LDKCResult_RouteDecodeErrorZ {
2365    /**
2366     * The contents of this CResult_RouteDecodeErrorZ, accessible via either
2367     * `err` or `result` depending on the state of `result_ok`.
2368     */
2369    union LDKCResult_RouteDecodeErrorZPtr contents;
2370    /**
2371     * Whether this CResult_RouteDecodeErrorZ represents a success state.
2372     */
2373    bool result_ok;
2374 } LDKCResult_RouteDecodeErrorZ;
2375
2376 /**
2377  * An enum which can either contain a u64 or not
2378  */
2379 typedef enum LDKCOption_u64Z_Tag {
2380    /**
2381     * When we're in this state, this COption_u64Z contains a u64
2382     */
2383    LDKCOption_u64Z_Some,
2384    /**
2385     * When we're in this state, this COption_u64Z contains nothing
2386     */
2387    LDKCOption_u64Z_None,
2388    /**
2389     * Must be last for serialization purposes
2390     */
2391    LDKCOption_u64Z_Sentinel,
2392 } LDKCOption_u64Z_Tag;
2393
2394 typedef struct LDKCOption_u64Z {
2395    LDKCOption_u64Z_Tag tag;
2396    union {
2397       struct {
2398          uint64_t some;
2399       };
2400    };
2401 } LDKCOption_u64Z;
2402
2403
2404
2405 /**
2406  * Details of a channel, as returned by ChannelManager::list_channels and ChannelManager::list_usable_channels
2407  */
2408 typedef struct MUST_USE_STRUCT LDKChannelDetails {
2409    /**
2410     * A pointer to the opaque Rust object.
2411     * Nearly everywhere, inner must be non-null, however in places where
2412     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2413     */
2414    LDKnativeChannelDetails *inner;
2415    /**
2416     * Indicates that this is the only struct which contains the same pointer.
2417     * Rust functions which take ownership of an object provided via an argument require
2418     * this to be true and invalidate the object pointed to by inner.
2419     */
2420    bool is_owned;
2421 } LDKChannelDetails;
2422
2423 /**
2424  * A dynamically-allocated array of crate::lightning::ln::channelmanager::ChannelDetailss of arbitrary size.
2425  * This corresponds to std::vector in C++
2426  */
2427 typedef struct LDKCVec_ChannelDetailsZ {
2428    /**
2429     * The elements in the array.
2430     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2431     */
2432    struct LDKChannelDetails *data;
2433    /**
2434     * The number of elements pointed to by `data`.
2435     */
2436    uintptr_t datalen;
2437 } LDKCVec_ChannelDetailsZ;
2438
2439
2440
2441 /**
2442  * A channel descriptor which provides a last-hop route to get_route
2443  */
2444 typedef struct MUST_USE_STRUCT LDKRouteHint {
2445    /**
2446     * A pointer to the opaque Rust object.
2447     * Nearly everywhere, inner must be non-null, however in places where
2448     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2449     */
2450    LDKnativeRouteHint *inner;
2451    /**
2452     * Indicates that this is the only struct which contains the same pointer.
2453     * Rust functions which take ownership of an object provided via an argument require
2454     * this to be true and invalidate the object pointed to by inner.
2455     */
2456    bool is_owned;
2457 } LDKRouteHint;
2458
2459 /**
2460  * A dynamically-allocated array of crate::lightning::routing::router::RouteHints of arbitrary size.
2461  * This corresponds to std::vector in C++
2462  */
2463 typedef struct LDKCVec_RouteHintZ {
2464    /**
2465     * The elements in the array.
2466     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2467     */
2468    struct LDKRouteHint *data;
2469    /**
2470     * The number of elements pointed to by `data`.
2471     */
2472    uintptr_t datalen;
2473 } LDKCVec_RouteHintZ;
2474
2475
2476
2477 /**
2478  * An Err type for failure to process messages.
2479  */
2480 typedef struct MUST_USE_STRUCT LDKLightningError {
2481    /**
2482     * A pointer to the opaque Rust object.
2483     * Nearly everywhere, inner must be non-null, however in places where
2484     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2485     */
2486    LDKnativeLightningError *inner;
2487    /**
2488     * Indicates that this is the only struct which contains the same pointer.
2489     * Rust functions which take ownership of an object provided via an argument require
2490     * this to be true and invalidate the object pointed to by inner.
2491     */
2492    bool is_owned;
2493 } LDKLightningError;
2494
2495 /**
2496  * The contents of CResult_RouteLightningErrorZ
2497  */
2498 typedef union LDKCResult_RouteLightningErrorZPtr {
2499    /**
2500     * A pointer to the contents in the success state.
2501     * Reading from this pointer when `result_ok` is not set is undefined.
2502     */
2503    struct LDKRoute *result;
2504    /**
2505     * A pointer to the contents in the error state.
2506     * Reading from this pointer when `result_ok` is set is undefined.
2507     */
2508    struct LDKLightningError *err;
2509 } LDKCResult_RouteLightningErrorZPtr;
2510
2511 /**
2512  * A CResult_RouteLightningErrorZ represents the result of a fallible operation,
2513  * containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::LightningError on failure.
2514  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2515  */
2516 typedef struct LDKCResult_RouteLightningErrorZ {
2517    /**
2518     * The contents of this CResult_RouteLightningErrorZ, accessible via either
2519     * `err` or `result` depending on the state of `result_ok`.
2520     */
2521    union LDKCResult_RouteLightningErrorZPtr contents;
2522    /**
2523     * Whether this CResult_RouteLightningErrorZ represents a success state.
2524     */
2525    bool result_ok;
2526 } LDKCResult_RouteLightningErrorZ;
2527
2528
2529
2530 /**
2531  * An accept_channel message to be sent or received from a peer
2532  */
2533 typedef struct MUST_USE_STRUCT LDKAcceptChannel {
2534    /**
2535     * A pointer to the opaque Rust object.
2536     * Nearly everywhere, inner must be non-null, however in places where
2537     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2538     */
2539    LDKnativeAcceptChannel *inner;
2540    /**
2541     * Indicates that this is the only struct which contains the same pointer.
2542     * Rust functions which take ownership of an object provided via an argument require
2543     * this to be true and invalidate the object pointed to by inner.
2544     */
2545    bool is_owned;
2546 } LDKAcceptChannel;
2547
2548
2549
2550 /**
2551  * An open_channel message to be sent or received from a peer
2552  */
2553 typedef struct MUST_USE_STRUCT LDKOpenChannel {
2554    /**
2555     * A pointer to the opaque Rust object.
2556     * Nearly everywhere, inner must be non-null, however in places where
2557     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2558     */
2559    LDKnativeOpenChannel *inner;
2560    /**
2561     * Indicates that this is the only struct which contains the same pointer.
2562     * Rust functions which take ownership of an object provided via an argument require
2563     * this to be true and invalidate the object pointed to by inner.
2564     */
2565    bool is_owned;
2566 } LDKOpenChannel;
2567
2568
2569
2570 /**
2571  * A funding_created message to be sent or received from a peer
2572  */
2573 typedef struct MUST_USE_STRUCT LDKFundingCreated {
2574    /**
2575     * A pointer to the opaque Rust object.
2576     * Nearly everywhere, inner must be non-null, however in places where
2577     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2578     */
2579    LDKnativeFundingCreated *inner;
2580    /**
2581     * Indicates that this is the only struct which contains the same pointer.
2582     * Rust functions which take ownership of an object provided via an argument require
2583     * this to be true and invalidate the object pointed to by inner.
2584     */
2585    bool is_owned;
2586 } LDKFundingCreated;
2587
2588
2589
2590 /**
2591  * A funding_signed message to be sent or received from a peer
2592  */
2593 typedef struct MUST_USE_STRUCT LDKFundingSigned {
2594    /**
2595     * A pointer to the opaque Rust object.
2596     * Nearly everywhere, inner must be non-null, however in places where
2597     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2598     */
2599    LDKnativeFundingSigned *inner;
2600    /**
2601     * Indicates that this is the only struct which contains the same pointer.
2602     * Rust functions which take ownership of an object provided via an argument require
2603     * this to be true and invalidate the object pointed to by inner.
2604     */
2605    bool is_owned;
2606 } LDKFundingSigned;
2607
2608
2609
2610 /**
2611  * A funding_locked message to be sent or received from a peer
2612  */
2613 typedef struct MUST_USE_STRUCT LDKFundingLocked {
2614    /**
2615     * A pointer to the opaque Rust object.
2616     * Nearly everywhere, inner must be non-null, however in places where
2617     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2618     */
2619    LDKnativeFundingLocked *inner;
2620    /**
2621     * Indicates that this is the only struct which contains the same pointer.
2622     * Rust functions which take ownership of an object provided via an argument require
2623     * this to be true and invalidate the object pointed to by inner.
2624     */
2625    bool is_owned;
2626 } LDKFundingLocked;
2627
2628
2629
2630 /**
2631  * An announcement_signatures message to be sent or received from a peer
2632  */
2633 typedef struct MUST_USE_STRUCT LDKAnnouncementSignatures {
2634    /**
2635     * A pointer to the opaque Rust object.
2636     * Nearly everywhere, inner must be non-null, however in places where
2637     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2638     */
2639    LDKnativeAnnouncementSignatures *inner;
2640    /**
2641     * Indicates that this is the only struct which contains the same pointer.
2642     * Rust functions which take ownership of an object provided via an argument require
2643     * this to be true and invalidate the object pointed to by inner.
2644     */
2645    bool is_owned;
2646 } LDKAnnouncementSignatures;
2647
2648
2649
2650 /**
2651  * Struct used to return values from revoke_and_ack messages, containing a bunch of commitment
2652  * transaction updates if they were pending.
2653  */
2654 typedef struct MUST_USE_STRUCT LDKCommitmentUpdate {
2655    /**
2656     * A pointer to the opaque Rust object.
2657     * Nearly everywhere, inner must be non-null, however in places where
2658     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2659     */
2660    LDKnativeCommitmentUpdate *inner;
2661    /**
2662     * Indicates that this is the only struct which contains the same pointer.
2663     * Rust functions which take ownership of an object provided via an argument require
2664     * this to be true and invalidate the object pointed to by inner.
2665     */
2666    bool is_owned;
2667 } LDKCommitmentUpdate;
2668
2669
2670
2671 /**
2672  * A revoke_and_ack message to be sent or received from a peer
2673  */
2674 typedef struct MUST_USE_STRUCT LDKRevokeAndACK {
2675    /**
2676     * A pointer to the opaque Rust object.
2677     * Nearly everywhere, inner must be non-null, however in places where
2678     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2679     */
2680    LDKnativeRevokeAndACK *inner;
2681    /**
2682     * Indicates that this is the only struct which contains the same pointer.
2683     * Rust functions which take ownership of an object provided via an argument require
2684     * this to be true and invalidate the object pointed to by inner.
2685     */
2686    bool is_owned;
2687 } LDKRevokeAndACK;
2688
2689
2690
2691 /**
2692  * A closing_signed message to be sent or received from a peer
2693  */
2694 typedef struct MUST_USE_STRUCT LDKClosingSigned {
2695    /**
2696     * A pointer to the opaque Rust object.
2697     * Nearly everywhere, inner must be non-null, however in places where
2698     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2699     */
2700    LDKnativeClosingSigned *inner;
2701    /**
2702     * Indicates that this is the only struct which contains the same pointer.
2703     * Rust functions which take ownership of an object provided via an argument require
2704     * this to be true and invalidate the object pointed to by inner.
2705     */
2706    bool is_owned;
2707 } LDKClosingSigned;
2708
2709
2710
2711 /**
2712  * A shutdown message to be sent or received from a peer
2713  */
2714 typedef struct MUST_USE_STRUCT LDKShutdown {
2715    /**
2716     * A pointer to the opaque Rust object.
2717     * Nearly everywhere, inner must be non-null, however in places where
2718     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2719     */
2720    LDKnativeShutdown *inner;
2721    /**
2722     * Indicates that this is the only struct which contains the same pointer.
2723     * Rust functions which take ownership of an object provided via an argument require
2724     * this to be true and invalidate the object pointed to by inner.
2725     */
2726    bool is_owned;
2727 } LDKShutdown;
2728
2729
2730
2731 /**
2732  * A channel_reestablish message to be sent or received from a peer
2733  */
2734 typedef struct MUST_USE_STRUCT LDKChannelReestablish {
2735    /**
2736     * A pointer to the opaque Rust object.
2737     * Nearly everywhere, inner must be non-null, however in places where
2738     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2739     */
2740    LDKnativeChannelReestablish *inner;
2741    /**
2742     * Indicates that this is the only struct which contains the same pointer.
2743     * Rust functions which take ownership of an object provided via an argument require
2744     * this to be true and invalidate the object pointed to by inner.
2745     */
2746    bool is_owned;
2747 } LDKChannelReestablish;
2748
2749
2750
2751 /**
2752  * A channel_announcement message to be sent or received from a peer
2753  */
2754 typedef struct MUST_USE_STRUCT LDKChannelAnnouncement {
2755    /**
2756     * A pointer to the opaque Rust object.
2757     * Nearly everywhere, inner must be non-null, however in places where
2758     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2759     */
2760    LDKnativeChannelAnnouncement *inner;
2761    /**
2762     * Indicates that this is the only struct which contains the same pointer.
2763     * Rust functions which take ownership of an object provided via an argument require
2764     * this to be true and invalidate the object pointed to by inner.
2765     */
2766    bool is_owned;
2767 } LDKChannelAnnouncement;
2768
2769
2770
2771 /**
2772  * A channel_update message to be sent or received from a peer
2773  */
2774 typedef struct MUST_USE_STRUCT LDKChannelUpdate {
2775    /**
2776     * A pointer to the opaque Rust object.
2777     * Nearly everywhere, inner must be non-null, however in places where
2778     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2779     */
2780    LDKnativeChannelUpdate *inner;
2781    /**
2782     * Indicates that this is the only struct which contains the same pointer.
2783     * Rust functions which take ownership of an object provided via an argument require
2784     * this to be true and invalidate the object pointed to by inner.
2785     */
2786    bool is_owned;
2787 } LDKChannelUpdate;
2788
2789
2790
2791 /**
2792  * A node_announcement message to be sent or received from a peer
2793  */
2794 typedef struct MUST_USE_STRUCT LDKNodeAnnouncement {
2795    /**
2796     * A pointer to the opaque Rust object.
2797     * Nearly everywhere, inner must be non-null, however in places where
2798     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2799     */
2800    LDKnativeNodeAnnouncement *inner;
2801    /**
2802     * Indicates that this is the only struct which contains the same pointer.
2803     * Rust functions which take ownership of an object provided via an argument require
2804     * this to be true and invalidate the object pointed to by inner.
2805     */
2806    bool is_owned;
2807 } LDKNodeAnnouncement;
2808
2809
2810
2811 /**
2812  * An error message to be sent or received from a peer
2813  */
2814 typedef struct MUST_USE_STRUCT LDKErrorMessage {
2815    /**
2816     * A pointer to the opaque Rust object.
2817     * Nearly everywhere, inner must be non-null, however in places where
2818     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2819     */
2820    LDKnativeErrorMessage *inner;
2821    /**
2822     * Indicates that this is the only struct which contains the same pointer.
2823     * Rust functions which take ownership of an object provided via an argument require
2824     * this to be true and invalidate the object pointed to by inner.
2825     */
2826    bool is_owned;
2827 } LDKErrorMessage;
2828
2829 /**
2830  * Used to put an error message in a LightningError
2831  */
2832 typedef enum LDKErrorAction_Tag {
2833    /**
2834     * The peer took some action which made us think they were useless. Disconnect them.
2835     */
2836    LDKErrorAction_DisconnectPeer,
2837    /**
2838     * The peer did something harmless that we weren't able to process, just log and ignore
2839     */
2840    LDKErrorAction_IgnoreError,
2841    /**
2842     * The peer did something incorrect. Tell them.
2843     */
2844    LDKErrorAction_SendErrorMessage,
2845    /**
2846     * Must be last for serialization purposes
2847     */
2848    LDKErrorAction_Sentinel,
2849 } LDKErrorAction_Tag;
2850
2851 typedef struct LDKErrorAction_LDKDisconnectPeer_Body {
2852    /**
2853     * An error message which we should make an effort to send before we disconnect.
2854     */
2855    struct LDKErrorMessage msg;
2856 } LDKErrorAction_LDKDisconnectPeer_Body;
2857
2858 typedef struct LDKErrorAction_LDKSendErrorMessage_Body {
2859    /**
2860     * The message to send.
2861     */
2862    struct LDKErrorMessage msg;
2863 } LDKErrorAction_LDKSendErrorMessage_Body;
2864
2865 typedef struct MUST_USE_STRUCT LDKErrorAction {
2866    LDKErrorAction_Tag tag;
2867    union {
2868       LDKErrorAction_LDKDisconnectPeer_Body disconnect_peer;
2869       LDKErrorAction_LDKSendErrorMessage_Body send_error_message;
2870    };
2871 } LDKErrorAction;
2872
2873 /**
2874  * The information we received from a peer along the route of a payment we originated. This is
2875  * returned by ChannelMessageHandler::handle_update_fail_htlc to be passed into
2876  * RoutingMessageHandler::handle_htlc_fail_channel_update to update our network map.
2877  */
2878 typedef enum LDKHTLCFailChannelUpdate_Tag {
2879    /**
2880     * We received an error which included a full ChannelUpdate message.
2881     */
2882    LDKHTLCFailChannelUpdate_ChannelUpdateMessage,
2883    /**
2884     * We received an error which indicated only that a channel has been closed
2885     */
2886    LDKHTLCFailChannelUpdate_ChannelClosed,
2887    /**
2888     * We received an error which indicated only that a node has failed
2889     */
2890    LDKHTLCFailChannelUpdate_NodeFailure,
2891    /**
2892     * Must be last for serialization purposes
2893     */
2894    LDKHTLCFailChannelUpdate_Sentinel,
2895 } LDKHTLCFailChannelUpdate_Tag;
2896
2897 typedef struct LDKHTLCFailChannelUpdate_LDKChannelUpdateMessage_Body {
2898    /**
2899     * The unwrapped message we received
2900     */
2901    struct LDKChannelUpdate msg;
2902 } LDKHTLCFailChannelUpdate_LDKChannelUpdateMessage_Body;
2903
2904 typedef struct LDKHTLCFailChannelUpdate_LDKChannelClosed_Body {
2905    /**
2906     * The short_channel_id which has now closed.
2907     */
2908    uint64_t short_channel_id;
2909    /**
2910     * when this true, this channel should be permanently removed from the
2911     * consideration. Otherwise, this channel can be restored as new channel_update is received
2912     */
2913    bool is_permanent;
2914 } LDKHTLCFailChannelUpdate_LDKChannelClosed_Body;
2915
2916 typedef struct LDKHTLCFailChannelUpdate_LDKNodeFailure_Body {
2917    /**
2918     * The node_id that has failed.
2919     */
2920    struct LDKPublicKey node_id;
2921    /**
2922     * when this true, node should be permanently removed from the
2923     * consideration. Otherwise, the channels connected to this node can be
2924     * restored as new channel_update is received
2925     */
2926    bool is_permanent;
2927 } LDKHTLCFailChannelUpdate_LDKNodeFailure_Body;
2928
2929 typedef struct MUST_USE_STRUCT LDKHTLCFailChannelUpdate {
2930    LDKHTLCFailChannelUpdate_Tag tag;
2931    union {
2932       LDKHTLCFailChannelUpdate_LDKChannelUpdateMessage_Body channel_update_message;
2933       LDKHTLCFailChannelUpdate_LDKChannelClosed_Body channel_closed;
2934       LDKHTLCFailChannelUpdate_LDKNodeFailure_Body node_failure;
2935    };
2936 } LDKHTLCFailChannelUpdate;
2937
2938
2939
2940 /**
2941  * A query_channel_range message is used to query a peer for channel
2942  * UTXOs in a range of blocks. The recipient of a query makes a best
2943  * effort to reply to the query using one or more reply_channel_range
2944  * messages.
2945  */
2946 typedef struct MUST_USE_STRUCT LDKQueryChannelRange {
2947    /**
2948     * A pointer to the opaque Rust object.
2949     * Nearly everywhere, inner must be non-null, however in places where
2950     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2951     */
2952    LDKnativeQueryChannelRange *inner;
2953    /**
2954     * Indicates that this is the only struct which contains the same pointer.
2955     * Rust functions which take ownership of an object provided via an argument require
2956     * this to be true and invalidate the object pointed to by inner.
2957     */
2958    bool is_owned;
2959 } LDKQueryChannelRange;
2960
2961
2962
2963 /**
2964  * A query_short_channel_ids message is used to query a peer for
2965  * routing gossip messages related to one or more short_channel_ids.
2966  * The query recipient will reply with the latest, if available,
2967  * channel_announcement, channel_update and node_announcement messages
2968  * it maintains for the requested short_channel_ids followed by a
2969  * reply_short_channel_ids_end message. The short_channel_ids sent in
2970  * this query are encoded. We only support encoding_type=0 uncompressed
2971  * serialization and do not support encoding_type=1 zlib serialization.
2972  */
2973 typedef struct MUST_USE_STRUCT LDKQueryShortChannelIds {
2974    /**
2975     * A pointer to the opaque Rust object.
2976     * Nearly everywhere, inner must be non-null, however in places where
2977     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2978     */
2979    LDKnativeQueryShortChannelIds *inner;
2980    /**
2981     * Indicates that this is the only struct which contains the same pointer.
2982     * Rust functions which take ownership of an object provided via an argument require
2983     * this to be true and invalidate the object pointed to by inner.
2984     */
2985    bool is_owned;
2986 } LDKQueryShortChannelIds;
2987
2988
2989
2990 /**
2991  * A reply_channel_range message is a reply to a query_channel_range
2992  * message. Multiple reply_channel_range messages can be sent in reply
2993  * to a single query_channel_range message. The query recipient makes a
2994  * best effort to respond based on their local network view which may
2995  * not be a perfect view of the network. The short_channel_ids in the
2996  * reply are encoded. We only support encoding_type=0 uncompressed
2997  * serialization and do not support encoding_type=1 zlib serialization.
2998  */
2999 typedef struct MUST_USE_STRUCT LDKReplyChannelRange {
3000    /**
3001     * A pointer to the opaque Rust object.
3002     * Nearly everywhere, inner must be non-null, however in places where
3003     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3004     */
3005    LDKnativeReplyChannelRange *inner;
3006    /**
3007     * Indicates that this is the only struct which contains the same pointer.
3008     * Rust functions which take ownership of an object provided via an argument require
3009     * this to be true and invalidate the object pointed to by inner.
3010     */
3011    bool is_owned;
3012 } LDKReplyChannelRange;
3013
3014 /**
3015  * An event generated by ChannelManager which indicates a message should be sent to a peer (or
3016  * broadcast to most peers).
3017  * These events are handled by PeerManager::process_events if you are using a PeerManager.
3018  */
3019 typedef enum LDKMessageSendEvent_Tag {
3020    /**
3021     * Used to indicate that we've accepted a channel open and should send the accept_channel
3022     * message provided to the given peer.
3023     */
3024    LDKMessageSendEvent_SendAcceptChannel,
3025    /**
3026     * Used to indicate that we've initiated a channel open and should send the open_channel
3027     * message provided to the given peer.
3028     */
3029    LDKMessageSendEvent_SendOpenChannel,
3030    /**
3031     * Used to indicate that a funding_created message should be sent to the peer with the given node_id.
3032     */
3033    LDKMessageSendEvent_SendFundingCreated,
3034    /**
3035     * Used to indicate that a funding_signed message should be sent to the peer with the given node_id.
3036     */
3037    LDKMessageSendEvent_SendFundingSigned,
3038    /**
3039     * Used to indicate that a funding_locked message should be sent to the peer with the given node_id.
3040     */
3041    LDKMessageSendEvent_SendFundingLocked,
3042    /**
3043     * Used to indicate that an announcement_signatures message should be sent to the peer with the given node_id.
3044     */
3045    LDKMessageSendEvent_SendAnnouncementSignatures,
3046    /**
3047     * Used to indicate that a series of HTLC update messages, as well as a commitment_signed
3048     * message should be sent to the peer with the given node_id.
3049     */
3050    LDKMessageSendEvent_UpdateHTLCs,
3051    /**
3052     * Used to indicate that a revoke_and_ack message should be sent to the peer with the given node_id.
3053     */
3054    LDKMessageSendEvent_SendRevokeAndACK,
3055    /**
3056     * Used to indicate that a closing_signed message should be sent to the peer with the given node_id.
3057     */
3058    LDKMessageSendEvent_SendClosingSigned,
3059    /**
3060     * Used to indicate that a shutdown message should be sent to the peer with the given node_id.
3061     */
3062    LDKMessageSendEvent_SendShutdown,
3063    /**
3064     * Used to indicate that a channel_reestablish message should be sent to the peer with the given node_id.
3065     */
3066    LDKMessageSendEvent_SendChannelReestablish,
3067    /**
3068     * Used to indicate that a channel_announcement and channel_update should be broadcast to all
3069     * peers (except the peer with node_id either msg.contents.node_id_1 or msg.contents.node_id_2).
3070     *
3071     * Note that after doing so, you very likely (unless you did so very recently) want to call
3072     * ChannelManager::broadcast_node_announcement to trigger a BroadcastNodeAnnouncement event.
3073     * This ensures that any nodes which see our channel_announcement also have a relevant
3074     * node_announcement, including relevant feature flags which may be important for routing
3075     * through or to us.
3076     */
3077    LDKMessageSendEvent_BroadcastChannelAnnouncement,
3078    /**
3079     * Used to indicate that a node_announcement should be broadcast to all peers.
3080     */
3081    LDKMessageSendEvent_BroadcastNodeAnnouncement,
3082    /**
3083     * Used to indicate that a channel_update should be broadcast to all peers.
3084     */
3085    LDKMessageSendEvent_BroadcastChannelUpdate,
3086    /**
3087     * Broadcast an error downstream to be handled
3088     */
3089    LDKMessageSendEvent_HandleError,
3090    /**
3091     * When a payment fails we may receive updates back from the hop where it failed. In such
3092     * cases this event is generated so that we can inform the network graph of this information.
3093     */
3094    LDKMessageSendEvent_PaymentFailureNetworkUpdate,
3095    /**
3096     * Query a peer for channels with funding transaction UTXOs in a block range.
3097     */
3098    LDKMessageSendEvent_SendChannelRangeQuery,
3099    /**
3100     * Request routing gossip messages from a peer for a list of channels identified by
3101     * their short_channel_ids.
3102     */
3103    LDKMessageSendEvent_SendShortIdsQuery,
3104    /**
3105     * Sends a reply to a channel range query. This may be one of several SendReplyChannelRange events
3106     * emitted during processing of the query.
3107     */
3108    LDKMessageSendEvent_SendReplyChannelRange,
3109    /**
3110     * Must be last for serialization purposes
3111     */
3112    LDKMessageSendEvent_Sentinel,
3113 } LDKMessageSendEvent_Tag;
3114
3115 typedef struct LDKMessageSendEvent_LDKSendAcceptChannel_Body {
3116    /**
3117     * The node_id of the node which should receive this message
3118     */
3119    struct LDKPublicKey node_id;
3120    /**
3121     * The message which should be sent.
3122     */
3123    struct LDKAcceptChannel msg;
3124 } LDKMessageSendEvent_LDKSendAcceptChannel_Body;
3125
3126 typedef struct LDKMessageSendEvent_LDKSendOpenChannel_Body {
3127    /**
3128     * The node_id of the node which should receive this message
3129     */
3130    struct LDKPublicKey node_id;
3131    /**
3132     * The message which should be sent.
3133     */
3134    struct LDKOpenChannel msg;
3135 } LDKMessageSendEvent_LDKSendOpenChannel_Body;
3136
3137 typedef struct LDKMessageSendEvent_LDKSendFundingCreated_Body {
3138    /**
3139     * The node_id of the node which should receive this message
3140     */
3141    struct LDKPublicKey node_id;
3142    /**
3143     * The message which should be sent.
3144     */
3145    struct LDKFundingCreated msg;
3146 } LDKMessageSendEvent_LDKSendFundingCreated_Body;
3147
3148 typedef struct LDKMessageSendEvent_LDKSendFundingSigned_Body {
3149    /**
3150     * The node_id of the node which should receive this message
3151     */
3152    struct LDKPublicKey node_id;
3153    /**
3154     * The message which should be sent.
3155     */
3156    struct LDKFundingSigned msg;
3157 } LDKMessageSendEvent_LDKSendFundingSigned_Body;
3158
3159 typedef struct LDKMessageSendEvent_LDKSendFundingLocked_Body {
3160    /**
3161     * The node_id of the node which should receive these message(s)
3162     */
3163    struct LDKPublicKey node_id;
3164    /**
3165     * The funding_locked message which should be sent.
3166     */
3167    struct LDKFundingLocked msg;
3168 } LDKMessageSendEvent_LDKSendFundingLocked_Body;
3169
3170 typedef struct LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body {
3171    /**
3172     * The node_id of the node which should receive these message(s)
3173     */
3174    struct LDKPublicKey node_id;
3175    /**
3176     * The announcement_signatures message which should be sent.
3177     */
3178    struct LDKAnnouncementSignatures msg;
3179 } LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body;
3180
3181 typedef struct LDKMessageSendEvent_LDKUpdateHTLCs_Body {
3182    /**
3183     * The node_id of the node which should receive these message(s)
3184     */
3185    struct LDKPublicKey node_id;
3186    /**
3187     * The update messages which should be sent. ALL messages in the struct should be sent!
3188     */
3189    struct LDKCommitmentUpdate updates;
3190 } LDKMessageSendEvent_LDKUpdateHTLCs_Body;
3191
3192 typedef struct LDKMessageSendEvent_LDKSendRevokeAndACK_Body {
3193    /**
3194     * The node_id of the node which should receive this message
3195     */
3196    struct LDKPublicKey node_id;
3197    /**
3198     * The message which should be sent.
3199     */
3200    struct LDKRevokeAndACK msg;
3201 } LDKMessageSendEvent_LDKSendRevokeAndACK_Body;
3202
3203 typedef struct LDKMessageSendEvent_LDKSendClosingSigned_Body {
3204    /**
3205     * The node_id of the node which should receive this message
3206     */
3207    struct LDKPublicKey node_id;
3208    /**
3209     * The message which should be sent.
3210     */
3211    struct LDKClosingSigned msg;
3212 } LDKMessageSendEvent_LDKSendClosingSigned_Body;
3213
3214 typedef struct LDKMessageSendEvent_LDKSendShutdown_Body {
3215    /**
3216     * The node_id of the node which should receive this message
3217     */
3218    struct LDKPublicKey node_id;
3219    /**
3220     * The message which should be sent.
3221     */
3222    struct LDKShutdown msg;
3223 } LDKMessageSendEvent_LDKSendShutdown_Body;
3224
3225 typedef struct LDKMessageSendEvent_LDKSendChannelReestablish_Body {
3226    /**
3227     * The node_id of the node which should receive this message
3228     */
3229    struct LDKPublicKey node_id;
3230    /**
3231     * The message which should be sent.
3232     */
3233    struct LDKChannelReestablish msg;
3234 } LDKMessageSendEvent_LDKSendChannelReestablish_Body;
3235
3236 typedef struct LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body {
3237    /**
3238     * The channel_announcement which should be sent.
3239     */
3240    struct LDKChannelAnnouncement msg;
3241    /**
3242     * The followup channel_update which should be sent.
3243     */
3244    struct LDKChannelUpdate update_msg;
3245 } LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body;
3246
3247 typedef struct LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body {
3248    /**
3249     * The node_announcement which should be sent.
3250     */
3251    struct LDKNodeAnnouncement msg;
3252 } LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body;
3253
3254 typedef struct LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body {
3255    /**
3256     * The channel_update which should be sent.
3257     */
3258    struct LDKChannelUpdate msg;
3259 } LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body;
3260
3261 typedef struct LDKMessageSendEvent_LDKHandleError_Body {
3262    /**
3263     * The node_id of the node which should receive this message
3264     */
3265    struct LDKPublicKey node_id;
3266    /**
3267     * The action which should be taken.
3268     */
3269    struct LDKErrorAction action;
3270 } LDKMessageSendEvent_LDKHandleError_Body;
3271
3272 typedef struct LDKMessageSendEvent_LDKPaymentFailureNetworkUpdate_Body {
3273    /**
3274     * The channel/node update which should be sent to NetGraphMsgHandler
3275     */
3276    struct LDKHTLCFailChannelUpdate update;
3277 } LDKMessageSendEvent_LDKPaymentFailureNetworkUpdate_Body;
3278
3279 typedef struct LDKMessageSendEvent_LDKSendChannelRangeQuery_Body {
3280    /**
3281     * The node_id of this message recipient
3282     */
3283    struct LDKPublicKey node_id;
3284    /**
3285     * The query_channel_range which should be sent.
3286     */
3287    struct LDKQueryChannelRange msg;
3288 } LDKMessageSendEvent_LDKSendChannelRangeQuery_Body;
3289
3290 typedef struct LDKMessageSendEvent_LDKSendShortIdsQuery_Body {
3291    /**
3292     * The node_id of this message recipient
3293     */
3294    struct LDKPublicKey node_id;
3295    /**
3296     * The query_short_channel_ids which should be sent.
3297     */
3298    struct LDKQueryShortChannelIds msg;
3299 } LDKMessageSendEvent_LDKSendShortIdsQuery_Body;
3300
3301 typedef struct LDKMessageSendEvent_LDKSendReplyChannelRange_Body {
3302    /**
3303     * The node_id of this message recipient
3304     */
3305    struct LDKPublicKey node_id;
3306    /**
3307     * The reply_channel_range which should be sent.
3308     */
3309    struct LDKReplyChannelRange msg;
3310 } LDKMessageSendEvent_LDKSendReplyChannelRange_Body;
3311
3312 typedef struct MUST_USE_STRUCT LDKMessageSendEvent {
3313    LDKMessageSendEvent_Tag tag;
3314    union {
3315       LDKMessageSendEvent_LDKSendAcceptChannel_Body send_accept_channel;
3316       LDKMessageSendEvent_LDKSendOpenChannel_Body send_open_channel;
3317       LDKMessageSendEvent_LDKSendFundingCreated_Body send_funding_created;
3318       LDKMessageSendEvent_LDKSendFundingSigned_Body send_funding_signed;
3319       LDKMessageSendEvent_LDKSendFundingLocked_Body send_funding_locked;
3320       LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body send_announcement_signatures;
3321       LDKMessageSendEvent_LDKUpdateHTLCs_Body update_htl_cs;
3322       LDKMessageSendEvent_LDKSendRevokeAndACK_Body send_revoke_and_ack;
3323       LDKMessageSendEvent_LDKSendClosingSigned_Body send_closing_signed;
3324       LDKMessageSendEvent_LDKSendShutdown_Body send_shutdown;
3325       LDKMessageSendEvent_LDKSendChannelReestablish_Body send_channel_reestablish;
3326       LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body broadcast_channel_announcement;
3327       LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body broadcast_node_announcement;
3328       LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body broadcast_channel_update;
3329       LDKMessageSendEvent_LDKHandleError_Body handle_error;
3330       LDKMessageSendEvent_LDKPaymentFailureNetworkUpdate_Body payment_failure_network_update;
3331       LDKMessageSendEvent_LDKSendChannelRangeQuery_Body send_channel_range_query;
3332       LDKMessageSendEvent_LDKSendShortIdsQuery_Body send_short_ids_query;
3333       LDKMessageSendEvent_LDKSendReplyChannelRange_Body send_reply_channel_range;
3334    };
3335 } LDKMessageSendEvent;
3336
3337 /**
3338  * A dynamically-allocated array of crate::lightning::util::events::MessageSendEvents of arbitrary size.
3339  * This corresponds to std::vector in C++
3340  */
3341 typedef struct LDKCVec_MessageSendEventZ {
3342    /**
3343     * The elements in the array.
3344     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3345     */
3346    struct LDKMessageSendEvent *data;
3347    /**
3348     * The number of elements pointed to by `data`.
3349     */
3350    uintptr_t datalen;
3351 } LDKCVec_MessageSendEventZ;
3352
3353 /**
3354  * The contents of CResult_boolLightningErrorZ
3355  */
3356 typedef union LDKCResult_boolLightningErrorZPtr {
3357    /**
3358     * A pointer to the contents in the success state.
3359     * Reading from this pointer when `result_ok` is not set is undefined.
3360     */
3361    bool *result;
3362    /**
3363     * A pointer to the contents in the error state.
3364     * Reading from this pointer when `result_ok` is set is undefined.
3365     */
3366    struct LDKLightningError *err;
3367 } LDKCResult_boolLightningErrorZPtr;
3368
3369 /**
3370  * A CResult_boolLightningErrorZ represents the result of a fallible operation,
3371  * containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure.
3372  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3373  */
3374 typedef struct LDKCResult_boolLightningErrorZ {
3375    /**
3376     * The contents of this CResult_boolLightningErrorZ, accessible via either
3377     * `err` or `result` depending on the state of `result_ok`.
3378     */
3379    union LDKCResult_boolLightningErrorZPtr contents;
3380    /**
3381     * Whether this CResult_boolLightningErrorZ represents a success state.
3382     */
3383    bool result_ok;
3384 } LDKCResult_boolLightningErrorZ;
3385
3386 /**
3387  * A tuple of 3 elements. See the individual fields for the types contained.
3388  */
3389 typedef struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
3390    /**
3391     * The element at position 0
3392     */
3393    struct LDKChannelAnnouncement a;
3394    /**
3395     * The element at position 1
3396     */
3397    struct LDKChannelUpdate b;
3398    /**
3399     * The element at position 2
3400     */
3401    struct LDKChannelUpdate c;
3402 } LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ;
3403
3404 /**
3405  * A dynamically-allocated array of crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZs of arbitrary size.
3406  * This corresponds to std::vector in C++
3407  */
3408 typedef struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
3409    /**
3410     * The elements in the array.
3411     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3412     */
3413    struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *data;
3414    /**
3415     * The number of elements pointed to by `data`.
3416     */
3417    uintptr_t datalen;
3418 } LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ;
3419
3420 /**
3421  * A dynamically-allocated array of crate::lightning::ln::msgs::NodeAnnouncements of arbitrary size.
3422  * This corresponds to std::vector in C++
3423  */
3424 typedef struct LDKCVec_NodeAnnouncementZ {
3425    /**
3426     * The elements in the array.
3427     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3428     */
3429    struct LDKNodeAnnouncement *data;
3430    /**
3431     * The number of elements pointed to by `data`.
3432     */
3433    uintptr_t datalen;
3434 } LDKCVec_NodeAnnouncementZ;
3435
3436 /**
3437  * The contents of CResult_NoneLightningErrorZ
3438  */
3439 typedef union LDKCResult_NoneLightningErrorZPtr {
3440    /**
3441     * Note that this value is always NULL, as there are no contents in the OK variant
3442     */
3443    void *result;
3444    /**
3445     * A pointer to the contents in the error state.
3446     * Reading from this pointer when `result_ok` is set is undefined.
3447     */
3448    struct LDKLightningError *err;
3449 } LDKCResult_NoneLightningErrorZPtr;
3450
3451 /**
3452  * A CResult_NoneLightningErrorZ represents the result of a fallible operation,
3453  * containing a () on success and a crate::lightning::ln::msgs::LightningError on failure.
3454  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3455  */
3456 typedef struct LDKCResult_NoneLightningErrorZ {
3457    /**
3458     * The contents of this CResult_NoneLightningErrorZ, accessible via either
3459     * `err` or `result` depending on the state of `result_ok`.
3460     */
3461    union LDKCResult_NoneLightningErrorZPtr contents;
3462    /**
3463     * Whether this CResult_NoneLightningErrorZ represents a success state.
3464     */
3465    bool result_ok;
3466 } LDKCResult_NoneLightningErrorZ;
3467
3468 /**
3469  * A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size.
3470  * This corresponds to std::vector in C++
3471  */
3472 typedef struct LDKCVec_PublicKeyZ {
3473    /**
3474     * The elements in the array.
3475     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3476     */
3477    struct LDKPublicKey *data;
3478    /**
3479     * The number of elements pointed to by `data`.
3480     */
3481    uintptr_t datalen;
3482 } LDKCVec_PublicKeyZ;
3483
3484
3485
3486 /**
3487  * Error for PeerManager errors. If you get one of these, you must disconnect the socket and
3488  * generate no further read_event/write_buffer_space_avail/socket_disconnected calls for the
3489  * descriptor.
3490  */
3491 typedef struct MUST_USE_STRUCT LDKPeerHandleError {
3492    /**
3493     * A pointer to the opaque Rust object.
3494     * Nearly everywhere, inner must be non-null, however in places where
3495     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3496     */
3497    LDKnativePeerHandleError *inner;
3498    /**
3499     * Indicates that this is the only struct which contains the same pointer.
3500     * Rust functions which take ownership of an object provided via an argument require
3501     * this to be true and invalidate the object pointed to by inner.
3502     */
3503    bool is_owned;
3504 } LDKPeerHandleError;
3505
3506 /**
3507  * The contents of CResult_CVec_u8ZPeerHandleErrorZ
3508  */
3509 typedef union LDKCResult_CVec_u8ZPeerHandleErrorZPtr {
3510    /**
3511     * A pointer to the contents in the success state.
3512     * Reading from this pointer when `result_ok` is not set is undefined.
3513     */
3514    struct LDKCVec_u8Z *result;
3515    /**
3516     * A pointer to the contents in the error state.
3517     * Reading from this pointer when `result_ok` is set is undefined.
3518     */
3519    struct LDKPeerHandleError *err;
3520 } LDKCResult_CVec_u8ZPeerHandleErrorZPtr;
3521
3522 /**
3523  * A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
3524  * containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
3525  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3526  */
3527 typedef struct LDKCResult_CVec_u8ZPeerHandleErrorZ {
3528    /**
3529     * The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
3530     * `err` or `result` depending on the state of `result_ok`.
3531     */
3532    union LDKCResult_CVec_u8ZPeerHandleErrorZPtr contents;
3533    /**
3534     * Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
3535     */
3536    bool result_ok;
3537 } LDKCResult_CVec_u8ZPeerHandleErrorZ;
3538
3539 /**
3540  * The contents of CResult_NonePeerHandleErrorZ
3541  */
3542 typedef union LDKCResult_NonePeerHandleErrorZPtr {
3543    /**
3544     * Note that this value is always NULL, as there are no contents in the OK variant
3545     */
3546    void *result;
3547    /**
3548     * A pointer to the contents in the error state.
3549     * Reading from this pointer when `result_ok` is set is undefined.
3550     */
3551    struct LDKPeerHandleError *err;
3552 } LDKCResult_NonePeerHandleErrorZPtr;
3553
3554 /**
3555  * A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
3556  * containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
3557  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3558  */
3559 typedef struct LDKCResult_NonePeerHandleErrorZ {
3560    /**
3561     * The contents of this CResult_NonePeerHandleErrorZ, accessible via either
3562     * `err` or `result` depending on the state of `result_ok`.
3563     */
3564    union LDKCResult_NonePeerHandleErrorZPtr contents;
3565    /**
3566     * Whether this CResult_NonePeerHandleErrorZ represents a success state.
3567     */
3568    bool result_ok;
3569 } LDKCResult_NonePeerHandleErrorZ;
3570
3571 /**
3572  * The contents of CResult_boolPeerHandleErrorZ
3573  */
3574 typedef union LDKCResult_boolPeerHandleErrorZPtr {
3575    /**
3576     * A pointer to the contents in the success state.
3577     * Reading from this pointer when `result_ok` is not set is undefined.
3578     */
3579    bool *result;
3580    /**
3581     * A pointer to the contents in the error state.
3582     * Reading from this pointer when `result_ok` is set is undefined.
3583     */
3584    struct LDKPeerHandleError *err;
3585 } LDKCResult_boolPeerHandleErrorZPtr;
3586
3587 /**
3588  * A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
3589  * containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
3590  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3591  */
3592 typedef struct LDKCResult_boolPeerHandleErrorZ {
3593    /**
3594     * The contents of this CResult_boolPeerHandleErrorZ, accessible via either
3595     * `err` or `result` depending on the state of `result_ok`.
3596     */
3597    union LDKCResult_boolPeerHandleErrorZPtr contents;
3598    /**
3599     * Whether this CResult_boolPeerHandleErrorZ represents a success state.
3600     */
3601    bool result_ok;
3602 } LDKCResult_boolPeerHandleErrorZ;
3603
3604 /**
3605  * The contents of CResult_TxOutAccessErrorZ
3606  */
3607 typedef union LDKCResult_TxOutAccessErrorZPtr {
3608    /**
3609     * A pointer to the contents in the success state.
3610     * Reading from this pointer when `result_ok` is not set is undefined.
3611     */
3612    struct LDKTxOut *result;
3613    /**
3614     * A pointer to the contents in the error state.
3615     * Reading from this pointer when `result_ok` is set is undefined.
3616     */
3617    enum LDKAccessError *err;
3618 } LDKCResult_TxOutAccessErrorZPtr;
3619
3620 /**
3621  * A CResult_TxOutAccessErrorZ represents the result of a fallible operation,
3622  * containing a crate::c_types::TxOut on success and a crate::lightning::chain::AccessError on failure.
3623  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3624  */
3625 typedef struct LDKCResult_TxOutAccessErrorZ {
3626    /**
3627     * The contents of this CResult_TxOutAccessErrorZ, accessible via either
3628     * `err` or `result` depending on the state of `result_ok`.
3629     */
3630    union LDKCResult_TxOutAccessErrorZPtr contents;
3631    /**
3632     * Whether this CResult_TxOutAccessErrorZ represents a success state.
3633     */
3634    bool result_ok;
3635 } LDKCResult_TxOutAccessErrorZ;
3636
3637 /**
3638  * An enum which can either contain a crate::c_types::derived::C2Tuple_usizeTransactionZ or not
3639  */
3640 typedef enum LDKCOption_C2Tuple_usizeTransactionZZ_Tag {
3641    /**
3642     * When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains a crate::c_types::derived::C2Tuple_usizeTransactionZ
3643     */
3644    LDKCOption_C2Tuple_usizeTransactionZZ_Some,
3645    /**
3646     * When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains nothing
3647     */
3648    LDKCOption_C2Tuple_usizeTransactionZZ_None,
3649    /**
3650     * Must be last for serialization purposes
3651     */
3652    LDKCOption_C2Tuple_usizeTransactionZZ_Sentinel,
3653 } LDKCOption_C2Tuple_usizeTransactionZZ_Tag;
3654
3655 typedef struct LDKCOption_C2Tuple_usizeTransactionZZ {
3656    LDKCOption_C2Tuple_usizeTransactionZZ_Tag tag;
3657    union {
3658       struct {
3659          struct LDKC2Tuple_usizeTransactionZ some;
3660       };
3661    };
3662 } LDKCOption_C2Tuple_usizeTransactionZZ;
3663
3664
3665
3666 /**
3667  * Details about one direction of a channel. Received
3668  * within a channel update.
3669  */
3670 typedef struct MUST_USE_STRUCT LDKDirectionalChannelInfo {
3671    /**
3672     * A pointer to the opaque Rust object.
3673     * Nearly everywhere, inner must be non-null, however in places where
3674     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3675     */
3676    LDKnativeDirectionalChannelInfo *inner;
3677    /**
3678     * Indicates that this is the only struct which contains the same pointer.
3679     * Rust functions which take ownership of an object provided via an argument require
3680     * this to be true and invalidate the object pointed to by inner.
3681     */
3682    bool is_owned;
3683 } LDKDirectionalChannelInfo;
3684
3685 /**
3686  * The contents of CResult_DirectionalChannelInfoDecodeErrorZ
3687  */
3688 typedef union LDKCResult_DirectionalChannelInfoDecodeErrorZPtr {
3689    /**
3690     * A pointer to the contents in the success state.
3691     * Reading from this pointer when `result_ok` is not set is undefined.
3692     */
3693    struct LDKDirectionalChannelInfo *result;
3694    /**
3695     * A pointer to the contents in the error state.
3696     * Reading from this pointer when `result_ok` is set is undefined.
3697     */
3698    struct LDKDecodeError *err;
3699 } LDKCResult_DirectionalChannelInfoDecodeErrorZPtr;
3700
3701 /**
3702  * A CResult_DirectionalChannelInfoDecodeErrorZ represents the result of a fallible operation,
3703  * containing a crate::lightning::routing::network_graph::DirectionalChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
3704  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3705  */
3706 typedef struct LDKCResult_DirectionalChannelInfoDecodeErrorZ {
3707    /**
3708     * The contents of this CResult_DirectionalChannelInfoDecodeErrorZ, accessible via either
3709     * `err` or `result` depending on the state of `result_ok`.
3710     */
3711    union LDKCResult_DirectionalChannelInfoDecodeErrorZPtr contents;
3712    /**
3713     * Whether this CResult_DirectionalChannelInfoDecodeErrorZ represents a success state.
3714     */
3715    bool result_ok;
3716 } LDKCResult_DirectionalChannelInfoDecodeErrorZ;
3717
3718
3719
3720 /**
3721  * Details about a channel (both directions).
3722  * Received within a channel announcement.
3723  */
3724 typedef struct MUST_USE_STRUCT LDKChannelInfo {
3725    /**
3726     * A pointer to the opaque Rust object.
3727     * Nearly everywhere, inner must be non-null, however in places where
3728     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3729     */
3730    LDKnativeChannelInfo *inner;
3731    /**
3732     * Indicates that this is the only struct which contains the same pointer.
3733     * Rust functions which take ownership of an object provided via an argument require
3734     * this to be true and invalidate the object pointed to by inner.
3735     */
3736    bool is_owned;
3737 } LDKChannelInfo;
3738
3739 /**
3740  * The contents of CResult_ChannelInfoDecodeErrorZ
3741  */
3742 typedef union LDKCResult_ChannelInfoDecodeErrorZPtr {
3743    /**
3744     * A pointer to the contents in the success state.
3745     * Reading from this pointer when `result_ok` is not set is undefined.
3746     */
3747    struct LDKChannelInfo *result;
3748    /**
3749     * A pointer to the contents in the error state.
3750     * Reading from this pointer when `result_ok` is set is undefined.
3751     */
3752    struct LDKDecodeError *err;
3753 } LDKCResult_ChannelInfoDecodeErrorZPtr;
3754
3755 /**
3756  * A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation,
3757  * containing a crate::lightning::routing::network_graph::ChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
3758  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3759  */
3760 typedef struct LDKCResult_ChannelInfoDecodeErrorZ {
3761    /**
3762     * The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either
3763     * `err` or `result` depending on the state of `result_ok`.
3764     */
3765    union LDKCResult_ChannelInfoDecodeErrorZPtr contents;
3766    /**
3767     * Whether this CResult_ChannelInfoDecodeErrorZ represents a success state.
3768     */
3769    bool result_ok;
3770 } LDKCResult_ChannelInfoDecodeErrorZ;
3771
3772
3773
3774 /**
3775  * Fees for routing via a given channel or a node
3776  */
3777 typedef struct MUST_USE_STRUCT LDKRoutingFees {
3778    /**
3779     * A pointer to the opaque Rust object.
3780     * Nearly everywhere, inner must be non-null, however in places where
3781     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3782     */
3783    LDKnativeRoutingFees *inner;
3784    /**
3785     * Indicates that this is the only struct which contains the same pointer.
3786     * Rust functions which take ownership of an object provided via an argument require
3787     * this to be true and invalidate the object pointed to by inner.
3788     */
3789    bool is_owned;
3790 } LDKRoutingFees;
3791
3792 /**
3793  * The contents of CResult_RoutingFeesDecodeErrorZ
3794  */
3795 typedef union LDKCResult_RoutingFeesDecodeErrorZPtr {
3796    /**
3797     * A pointer to the contents in the success state.
3798     * Reading from this pointer when `result_ok` is not set is undefined.
3799     */
3800    struct LDKRoutingFees *result;
3801    /**
3802     * A pointer to the contents in the error state.
3803     * Reading from this pointer when `result_ok` is set is undefined.
3804     */
3805    struct LDKDecodeError *err;
3806 } LDKCResult_RoutingFeesDecodeErrorZPtr;
3807
3808 /**
3809  * A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation,
3810  * containing a crate::lightning::routing::network_graph::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure.
3811  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3812  */
3813 typedef struct LDKCResult_RoutingFeesDecodeErrorZ {
3814    /**
3815     * The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either
3816     * `err` or `result` depending on the state of `result_ok`.
3817     */
3818    union LDKCResult_RoutingFeesDecodeErrorZPtr contents;
3819    /**
3820     * Whether this CResult_RoutingFeesDecodeErrorZ represents a success state.
3821     */
3822    bool result_ok;
3823 } LDKCResult_RoutingFeesDecodeErrorZ;
3824
3825 /**
3826  * A 4-byte byte array.
3827  */
3828 typedef struct LDKFourBytes {
3829    /**
3830     * The four bytes
3831     */
3832    uint8_t data[4];
3833 } LDKFourBytes;
3834
3835 /**
3836  * A 16-byte byte array.
3837  */
3838 typedef struct LDKSixteenBytes {
3839    /**
3840     * The sixteen bytes
3841     */
3842    uint8_t data[16];
3843 } LDKSixteenBytes;
3844
3845 /**
3846  * A 10-byte byte array.
3847  */
3848 typedef struct LDKTenBytes {
3849    /**
3850     * The ten bytes
3851     */
3852    uint8_t data[10];
3853 } LDKTenBytes;
3854
3855 /**
3856  * An address which can be used to connect to a remote peer
3857  */
3858 typedef enum LDKNetAddress_Tag {
3859    /**
3860     * An IPv4 address/port on which the peer is listening.
3861     */
3862    LDKNetAddress_IPv4,
3863    /**
3864     * An IPv6 address/port on which the peer is listening.
3865     */
3866    LDKNetAddress_IPv6,
3867    /**
3868     * An old-style Tor onion address/port on which the peer is listening.
3869     */
3870    LDKNetAddress_OnionV2,
3871    /**
3872     * A new-style Tor onion address/port on which the peer is listening.
3873     * To create the human-readable \"hostname\", concatenate ed25519_pubkey, checksum, and version,
3874     * wrap as base32 and append \".onion\".
3875     */
3876    LDKNetAddress_OnionV3,
3877    /**
3878     * Must be last for serialization purposes
3879     */
3880    LDKNetAddress_Sentinel,
3881 } LDKNetAddress_Tag;
3882
3883 typedef struct LDKNetAddress_LDKIPv4_Body {
3884    /**
3885     * The 4-byte IPv4 address
3886     */
3887    struct LDKFourBytes addr;
3888    /**
3889     * The port on which the node is listening
3890     */
3891    uint16_t port;
3892 } LDKNetAddress_LDKIPv4_Body;
3893
3894 typedef struct LDKNetAddress_LDKIPv6_Body {
3895    /**
3896     * The 16-byte IPv6 address
3897     */
3898    struct LDKSixteenBytes addr;
3899    /**
3900     * The port on which the node is listening
3901     */
3902    uint16_t port;
3903 } LDKNetAddress_LDKIPv6_Body;
3904
3905 typedef struct LDKNetAddress_LDKOnionV2_Body {
3906    /**
3907     * The bytes (usually encoded in base32 with \".onion\" appended)
3908     */
3909    struct LDKTenBytes addr;
3910    /**
3911     * The port on which the node is listening
3912     */
3913    uint16_t port;
3914 } LDKNetAddress_LDKOnionV2_Body;
3915
3916 typedef struct LDKNetAddress_LDKOnionV3_Body {
3917    /**
3918     * The ed25519 long-term public key of the peer
3919     */
3920    struct LDKThirtyTwoBytes ed25519_pubkey;
3921    /**
3922     * The checksum of the pubkey and version, as included in the onion address
3923     */
3924    uint16_t checksum;
3925    /**
3926     * The version byte, as defined by the Tor Onion v3 spec.
3927     */
3928    uint8_t version;
3929    /**
3930     * The port on which the node is listening
3931     */
3932    uint16_t port;
3933 } LDKNetAddress_LDKOnionV3_Body;
3934
3935 typedef struct MUST_USE_STRUCT LDKNetAddress {
3936    LDKNetAddress_Tag tag;
3937    union {
3938       LDKNetAddress_LDKIPv4_Body i_pv4;
3939       LDKNetAddress_LDKIPv6_Body i_pv6;
3940       LDKNetAddress_LDKOnionV2_Body onion_v2;
3941       LDKNetAddress_LDKOnionV3_Body onion_v3;
3942    };
3943 } LDKNetAddress;
3944
3945 /**
3946  * A dynamically-allocated array of crate::lightning::ln::msgs::NetAddresss of arbitrary size.
3947  * This corresponds to std::vector in C++
3948  */
3949 typedef struct LDKCVec_NetAddressZ {
3950    /**
3951     * The elements in the array.
3952     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3953     */
3954    struct LDKNetAddress *data;
3955    /**
3956     * The number of elements pointed to by `data`.
3957     */
3958    uintptr_t datalen;
3959 } LDKCVec_NetAddressZ;
3960
3961
3962
3963 /**
3964  * Information received in the latest node_announcement from this node.
3965  */
3966 typedef struct MUST_USE_STRUCT LDKNodeAnnouncementInfo {
3967    /**
3968     * A pointer to the opaque Rust object.
3969     * Nearly everywhere, inner must be non-null, however in places where
3970     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3971     */
3972    LDKnativeNodeAnnouncementInfo *inner;
3973    /**
3974     * Indicates that this is the only struct which contains the same pointer.
3975     * Rust functions which take ownership of an object provided via an argument require
3976     * this to be true and invalidate the object pointed to by inner.
3977     */
3978    bool is_owned;
3979 } LDKNodeAnnouncementInfo;
3980
3981 /**
3982  * The contents of CResult_NodeAnnouncementInfoDecodeErrorZ
3983  */
3984 typedef union LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr {
3985    /**
3986     * A pointer to the contents in the success state.
3987     * Reading from this pointer when `result_ok` is not set is undefined.
3988     */
3989    struct LDKNodeAnnouncementInfo *result;
3990    /**
3991     * A pointer to the contents in the error state.
3992     * Reading from this pointer when `result_ok` is set is undefined.
3993     */
3994    struct LDKDecodeError *err;
3995 } LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr;
3996
3997 /**
3998  * A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation,
3999  * containing a crate::lightning::routing::network_graph::NodeAnnouncementInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
4000  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4001  */
4002 typedef struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ {
4003    /**
4004     * The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either
4005     * `err` or `result` depending on the state of `result_ok`.
4006     */
4007    union LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr contents;
4008    /**
4009     * Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state.
4010     */
4011    bool result_ok;
4012 } LDKCResult_NodeAnnouncementInfoDecodeErrorZ;
4013
4014 /**
4015  * A dynamically-allocated array of u64s of arbitrary size.
4016  * This corresponds to std::vector in C++
4017  */
4018 typedef struct LDKCVec_u64Z {
4019    /**
4020     * The elements in the array.
4021     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4022     */
4023    uint64_t *data;
4024    /**
4025     * The number of elements pointed to by `data`.
4026     */
4027    uintptr_t datalen;
4028 } LDKCVec_u64Z;
4029
4030
4031
4032 /**
4033  * Details about a node in the network, known from the network announcement.
4034  */
4035 typedef struct MUST_USE_STRUCT LDKNodeInfo {
4036    /**
4037     * A pointer to the opaque Rust object.
4038     * Nearly everywhere, inner must be non-null, however in places where
4039     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4040     */
4041    LDKnativeNodeInfo *inner;
4042    /**
4043     * Indicates that this is the only struct which contains the same pointer.
4044     * Rust functions which take ownership of an object provided via an argument require
4045     * this to be true and invalidate the object pointed to by inner.
4046     */
4047    bool is_owned;
4048 } LDKNodeInfo;
4049
4050 /**
4051  * The contents of CResult_NodeInfoDecodeErrorZ
4052  */
4053 typedef union LDKCResult_NodeInfoDecodeErrorZPtr {
4054    /**
4055     * A pointer to the contents in the success state.
4056     * Reading from this pointer when `result_ok` is not set is undefined.
4057     */
4058    struct LDKNodeInfo *result;
4059    /**
4060     * A pointer to the contents in the error state.
4061     * Reading from this pointer when `result_ok` is set is undefined.
4062     */
4063    struct LDKDecodeError *err;
4064 } LDKCResult_NodeInfoDecodeErrorZPtr;
4065
4066 /**
4067  * A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation,
4068  * containing a crate::lightning::routing::network_graph::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
4069  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4070  */
4071 typedef struct LDKCResult_NodeInfoDecodeErrorZ {
4072    /**
4073     * The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either
4074     * `err` or `result` depending on the state of `result_ok`.
4075     */
4076    union LDKCResult_NodeInfoDecodeErrorZPtr contents;
4077    /**
4078     * Whether this CResult_NodeInfoDecodeErrorZ represents a success state.
4079     */
4080    bool result_ok;
4081 } LDKCResult_NodeInfoDecodeErrorZ;
4082
4083
4084
4085 /**
4086  * Represents the network as nodes and channels between them
4087  */
4088 typedef struct MUST_USE_STRUCT LDKNetworkGraph {
4089    /**
4090     * A pointer to the opaque Rust object.
4091     * Nearly everywhere, inner must be non-null, however in places where
4092     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4093     */
4094    LDKnativeNetworkGraph *inner;
4095    /**
4096     * Indicates that this is the only struct which contains the same pointer.
4097     * Rust functions which take ownership of an object provided via an argument require
4098     * this to be true and invalidate the object pointed to by inner.
4099     */
4100    bool is_owned;
4101 } LDKNetworkGraph;
4102
4103 /**
4104  * The contents of CResult_NetworkGraphDecodeErrorZ
4105  */
4106 typedef union LDKCResult_NetworkGraphDecodeErrorZPtr {
4107    /**
4108     * A pointer to the contents in the success state.
4109     * Reading from this pointer when `result_ok` is not set is undefined.
4110     */
4111    struct LDKNetworkGraph *result;
4112    /**
4113     * A pointer to the contents in the error state.
4114     * Reading from this pointer when `result_ok` is set is undefined.
4115     */
4116    struct LDKDecodeError *err;
4117 } LDKCResult_NetworkGraphDecodeErrorZPtr;
4118
4119 /**
4120  * A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation,
4121  * containing a crate::lightning::routing::network_graph::NetworkGraph on success and a crate::lightning::ln::msgs::DecodeError on failure.
4122  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4123  */
4124 typedef struct LDKCResult_NetworkGraphDecodeErrorZ {
4125    /**
4126     * The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either
4127     * `err` or `result` depending on the state of `result_ok`.
4128     */
4129    union LDKCResult_NetworkGraphDecodeErrorZPtr contents;
4130    /**
4131     * Whether this CResult_NetworkGraphDecodeErrorZ represents a success state.
4132     */
4133    bool result_ok;
4134 } LDKCResult_NetworkGraphDecodeErrorZ;
4135
4136
4137
4138 /**
4139  * Features used within an `init` message.
4140  */
4141 typedef struct MUST_USE_STRUCT LDKInitFeatures {
4142    /**
4143     * A pointer to the opaque Rust object.
4144     * Nearly everywhere, inner must be non-null, however in places where
4145     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4146     */
4147    LDKnativeInitFeatures *inner;
4148    /**
4149     * Indicates that this is the only struct which contains the same pointer.
4150     * Rust functions which take ownership of an object provided via an argument require
4151     * this to be true and invalidate the object pointed to by inner.
4152     */
4153    bool is_owned;
4154 } LDKInitFeatures;
4155
4156 /**
4157  * The contents of CResult_InitFeaturesDecodeErrorZ
4158  */
4159 typedef union LDKCResult_InitFeaturesDecodeErrorZPtr {
4160    /**
4161     * A pointer to the contents in the success state.
4162     * Reading from this pointer when `result_ok` is not set is undefined.
4163     */
4164    struct LDKInitFeatures *result;
4165    /**
4166     * A pointer to the contents in the error state.
4167     * Reading from this pointer when `result_ok` is set is undefined.
4168     */
4169    struct LDKDecodeError *err;
4170 } LDKCResult_InitFeaturesDecodeErrorZPtr;
4171
4172 /**
4173  * A CResult_InitFeaturesDecodeErrorZ represents the result of a fallible operation,
4174  * containing a crate::lightning::ln::features::InitFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4175  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4176  */
4177 typedef struct LDKCResult_InitFeaturesDecodeErrorZ {
4178    /**
4179     * The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either
4180     * `err` or `result` depending on the state of `result_ok`.
4181     */
4182    union LDKCResult_InitFeaturesDecodeErrorZPtr contents;
4183    /**
4184     * Whether this CResult_InitFeaturesDecodeErrorZ represents a success state.
4185     */
4186    bool result_ok;
4187 } LDKCResult_InitFeaturesDecodeErrorZ;
4188
4189
4190
4191 /**
4192  * Features used within a `node_announcement` message.
4193  */
4194 typedef struct MUST_USE_STRUCT LDKNodeFeatures {
4195    /**
4196     * A pointer to the opaque Rust object.
4197     * Nearly everywhere, inner must be non-null, however in places where
4198     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4199     */
4200    LDKnativeNodeFeatures *inner;
4201    /**
4202     * Indicates that this is the only struct which contains the same pointer.
4203     * Rust functions which take ownership of an object provided via an argument require
4204     * this to be true and invalidate the object pointed to by inner.
4205     */
4206    bool is_owned;
4207 } LDKNodeFeatures;
4208
4209 /**
4210  * The contents of CResult_NodeFeaturesDecodeErrorZ
4211  */
4212 typedef union LDKCResult_NodeFeaturesDecodeErrorZPtr {
4213    /**
4214     * A pointer to the contents in the success state.
4215     * Reading from this pointer when `result_ok` is not set is undefined.
4216     */
4217    struct LDKNodeFeatures *result;
4218    /**
4219     * A pointer to the contents in the error state.
4220     * Reading from this pointer when `result_ok` is set is undefined.
4221     */
4222    struct LDKDecodeError *err;
4223 } LDKCResult_NodeFeaturesDecodeErrorZPtr;
4224
4225 /**
4226  * A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation,
4227  * containing a crate::lightning::ln::features::NodeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4228  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4229  */
4230 typedef struct LDKCResult_NodeFeaturesDecodeErrorZ {
4231    /**
4232     * The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either
4233     * `err` or `result` depending on the state of `result_ok`.
4234     */
4235    union LDKCResult_NodeFeaturesDecodeErrorZPtr contents;
4236    /**
4237     * Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state.
4238     */
4239    bool result_ok;
4240 } LDKCResult_NodeFeaturesDecodeErrorZ;
4241
4242
4243
4244 /**
4245  * Features used within a `channel_announcement` message.
4246  */
4247 typedef struct MUST_USE_STRUCT LDKChannelFeatures {
4248    /**
4249     * A pointer to the opaque Rust object.
4250     * Nearly everywhere, inner must be non-null, however in places where
4251     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4252     */
4253    LDKnativeChannelFeatures *inner;
4254    /**
4255     * Indicates that this is the only struct which contains the same pointer.
4256     * Rust functions which take ownership of an object provided via an argument require
4257     * this to be true and invalidate the object pointed to by inner.
4258     */
4259    bool is_owned;
4260 } LDKChannelFeatures;
4261
4262 /**
4263  * The contents of CResult_ChannelFeaturesDecodeErrorZ
4264  */
4265 typedef union LDKCResult_ChannelFeaturesDecodeErrorZPtr {
4266    /**
4267     * A pointer to the contents in the success state.
4268     * Reading from this pointer when `result_ok` is not set is undefined.
4269     */
4270    struct LDKChannelFeatures *result;
4271    /**
4272     * A pointer to the contents in the error state.
4273     * Reading from this pointer when `result_ok` is set is undefined.
4274     */
4275    struct LDKDecodeError *err;
4276 } LDKCResult_ChannelFeaturesDecodeErrorZPtr;
4277
4278 /**
4279  * A CResult_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation,
4280  * containing a crate::lightning::ln::features::ChannelFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4281  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4282  */
4283 typedef struct LDKCResult_ChannelFeaturesDecodeErrorZ {
4284    /**
4285     * The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either
4286     * `err` or `result` depending on the state of `result_ok`.
4287     */
4288    union LDKCResult_ChannelFeaturesDecodeErrorZPtr contents;
4289    /**
4290     * Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state.
4291     */
4292    bool result_ok;
4293 } LDKCResult_ChannelFeaturesDecodeErrorZ;
4294
4295
4296
4297 /**
4298  * Features used within an invoice.
4299  */
4300 typedef struct MUST_USE_STRUCT LDKInvoiceFeatures {
4301    /**
4302     * A pointer to the opaque Rust object.
4303     * Nearly everywhere, inner must be non-null, however in places where
4304     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4305     */
4306    LDKnativeInvoiceFeatures *inner;
4307    /**
4308     * Indicates that this is the only struct which contains the same pointer.
4309     * Rust functions which take ownership of an object provided via an argument require
4310     * this to be true and invalidate the object pointed to by inner.
4311     */
4312    bool is_owned;
4313 } LDKInvoiceFeatures;
4314
4315 /**
4316  * The contents of CResult_InvoiceFeaturesDecodeErrorZ
4317  */
4318 typedef union LDKCResult_InvoiceFeaturesDecodeErrorZPtr {
4319    /**
4320     * A pointer to the contents in the success state.
4321     * Reading from this pointer when `result_ok` is not set is undefined.
4322     */
4323    struct LDKInvoiceFeatures *result;
4324    /**
4325     * A pointer to the contents in the error state.
4326     * Reading from this pointer when `result_ok` is set is undefined.
4327     */
4328    struct LDKDecodeError *err;
4329 } LDKCResult_InvoiceFeaturesDecodeErrorZPtr;
4330
4331 /**
4332  * A CResult_InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
4333  * containing a crate::lightning::ln::features::InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4334  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4335  */
4336 typedef struct LDKCResult_InvoiceFeaturesDecodeErrorZ {
4337    /**
4338     * The contents of this CResult_InvoiceFeaturesDecodeErrorZ, accessible via either
4339     * `err` or `result` depending on the state of `result_ok`.
4340     */
4341    union LDKCResult_InvoiceFeaturesDecodeErrorZPtr contents;
4342    /**
4343     * Whether this CResult_InvoiceFeaturesDecodeErrorZ represents a success state.
4344     */
4345    bool result_ok;
4346 } LDKCResult_InvoiceFeaturesDecodeErrorZ;
4347
4348 /**
4349  * The contents of CResult_NetAddressu8Z
4350  */
4351 typedef union LDKCResult_NetAddressu8ZPtr {
4352    /**
4353     * A pointer to the contents in the success state.
4354     * Reading from this pointer when `result_ok` is not set is undefined.
4355     */
4356    struct LDKNetAddress *result;
4357    /**
4358     * A pointer to the contents in the error state.
4359     * Reading from this pointer when `result_ok` is set is undefined.
4360     */
4361    uint8_t *err;
4362 } LDKCResult_NetAddressu8ZPtr;
4363
4364 /**
4365  * A CResult_NetAddressu8Z represents the result of a fallible operation,
4366  * containing a crate::lightning::ln::msgs::NetAddress on success and a u8 on failure.
4367  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4368  */
4369 typedef struct LDKCResult_NetAddressu8Z {
4370    /**
4371     * The contents of this CResult_NetAddressu8Z, accessible via either
4372     * `err` or `result` depending on the state of `result_ok`.
4373     */
4374    union LDKCResult_NetAddressu8ZPtr contents;
4375    /**
4376     * Whether this CResult_NetAddressu8Z represents a success state.
4377     */
4378    bool result_ok;
4379 } LDKCResult_NetAddressu8Z;
4380
4381 /**
4382  * The contents of CResult_CResult_NetAddressu8ZDecodeErrorZ
4383  */
4384 typedef union LDKCResult_CResult_NetAddressu8ZDecodeErrorZPtr {
4385    /**
4386     * A pointer to the contents in the success state.
4387     * Reading from this pointer when `result_ok` is not set is undefined.
4388     */
4389    struct LDKCResult_NetAddressu8Z *result;
4390    /**
4391     * A pointer to the contents in the error state.
4392     * Reading from this pointer when `result_ok` is set is undefined.
4393     */
4394    struct LDKDecodeError *err;
4395 } LDKCResult_CResult_NetAddressu8ZDecodeErrorZPtr;
4396
4397 /**
4398  * A CResult_CResult_NetAddressu8ZDecodeErrorZ represents the result of a fallible operation,
4399  * containing a crate::c_types::derived::CResult_NetAddressu8Z on success and a crate::lightning::ln::msgs::DecodeError on failure.
4400  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4401  */
4402 typedef struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ {
4403    /**
4404     * The contents of this CResult_CResult_NetAddressu8ZDecodeErrorZ, accessible via either
4405     * `err` or `result` depending on the state of `result_ok`.
4406     */
4407    union LDKCResult_CResult_NetAddressu8ZDecodeErrorZPtr contents;
4408    /**
4409     * Whether this CResult_CResult_NetAddressu8ZDecodeErrorZ represents a success state.
4410     */
4411    bool result_ok;
4412 } LDKCResult_CResult_NetAddressu8ZDecodeErrorZ;
4413
4414
4415
4416 /**
4417  * An update_add_htlc message to be sent or received from a peer
4418  */
4419 typedef struct MUST_USE_STRUCT LDKUpdateAddHTLC {
4420    /**
4421     * A pointer to the opaque Rust object.
4422     * Nearly everywhere, inner must be non-null, however in places where
4423     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4424     */
4425    LDKnativeUpdateAddHTLC *inner;
4426    /**
4427     * Indicates that this is the only struct which contains the same pointer.
4428     * Rust functions which take ownership of an object provided via an argument require
4429     * this to be true and invalidate the object pointed to by inner.
4430     */
4431    bool is_owned;
4432 } LDKUpdateAddHTLC;
4433
4434 /**
4435  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size.
4436  * This corresponds to std::vector in C++
4437  */
4438 typedef struct LDKCVec_UpdateAddHTLCZ {
4439    /**
4440     * The elements in the array.
4441     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4442     */
4443    struct LDKUpdateAddHTLC *data;
4444    /**
4445     * The number of elements pointed to by `data`.
4446     */
4447    uintptr_t datalen;
4448 } LDKCVec_UpdateAddHTLCZ;
4449
4450
4451
4452 /**
4453  * An update_fulfill_htlc message to be sent or received from a peer
4454  */
4455 typedef struct MUST_USE_STRUCT LDKUpdateFulfillHTLC {
4456    /**
4457     * A pointer to the opaque Rust object.
4458     * Nearly everywhere, inner must be non-null, however in places where
4459     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4460     */
4461    LDKnativeUpdateFulfillHTLC *inner;
4462    /**
4463     * Indicates that this is the only struct which contains the same pointer.
4464     * Rust functions which take ownership of an object provided via an argument require
4465     * this to be true and invalidate the object pointed to by inner.
4466     */
4467    bool is_owned;
4468 } LDKUpdateFulfillHTLC;
4469
4470 /**
4471  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
4472  * This corresponds to std::vector in C++
4473  */
4474 typedef struct LDKCVec_UpdateFulfillHTLCZ {
4475    /**
4476     * The elements in the array.
4477     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4478     */
4479    struct LDKUpdateFulfillHTLC *data;
4480    /**
4481     * The number of elements pointed to by `data`.
4482     */
4483    uintptr_t datalen;
4484 } LDKCVec_UpdateFulfillHTLCZ;
4485
4486
4487
4488 /**
4489  * An update_fail_htlc message to be sent or received from a peer
4490  */
4491 typedef struct MUST_USE_STRUCT LDKUpdateFailHTLC {
4492    /**
4493     * A pointer to the opaque Rust object.
4494     * Nearly everywhere, inner must be non-null, however in places where
4495     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4496     */
4497    LDKnativeUpdateFailHTLC *inner;
4498    /**
4499     * Indicates that this is the only struct which contains the same pointer.
4500     * Rust functions which take ownership of an object provided via an argument require
4501     * this to be true and invalidate the object pointed to by inner.
4502     */
4503    bool is_owned;
4504 } LDKUpdateFailHTLC;
4505
4506 /**
4507  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size.
4508  * This corresponds to std::vector in C++
4509  */
4510 typedef struct LDKCVec_UpdateFailHTLCZ {
4511    /**
4512     * The elements in the array.
4513     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4514     */
4515    struct LDKUpdateFailHTLC *data;
4516    /**
4517     * The number of elements pointed to by `data`.
4518     */
4519    uintptr_t datalen;
4520 } LDKCVec_UpdateFailHTLCZ;
4521
4522
4523
4524 /**
4525  * An update_fail_malformed_htlc message to be sent or received from a peer
4526  */
4527 typedef struct MUST_USE_STRUCT LDKUpdateFailMalformedHTLC {
4528    /**
4529     * A pointer to the opaque Rust object.
4530     * Nearly everywhere, inner must be non-null, however in places where
4531     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4532     */
4533    LDKnativeUpdateFailMalformedHTLC *inner;
4534    /**
4535     * Indicates that this is the only struct which contains the same pointer.
4536     * Rust functions which take ownership of an object provided via an argument require
4537     * this to be true and invalidate the object pointed to by inner.
4538     */
4539    bool is_owned;
4540 } LDKUpdateFailMalformedHTLC;
4541
4542 /**
4543  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
4544  * This corresponds to std::vector in C++
4545  */
4546 typedef struct LDKCVec_UpdateFailMalformedHTLCZ {
4547    /**
4548     * The elements in the array.
4549     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4550     */
4551    struct LDKUpdateFailMalformedHTLC *data;
4552    /**
4553     * The number of elements pointed to by `data`.
4554     */
4555    uintptr_t datalen;
4556 } LDKCVec_UpdateFailMalformedHTLCZ;
4557
4558 /**
4559  * The contents of CResult_AcceptChannelDecodeErrorZ
4560  */
4561 typedef union LDKCResult_AcceptChannelDecodeErrorZPtr {
4562    /**
4563     * A pointer to the contents in the success state.
4564     * Reading from this pointer when `result_ok` is not set is undefined.
4565     */
4566    struct LDKAcceptChannel *result;
4567    /**
4568     * A pointer to the contents in the error state.
4569     * Reading from this pointer when `result_ok` is set is undefined.
4570     */
4571    struct LDKDecodeError *err;
4572 } LDKCResult_AcceptChannelDecodeErrorZPtr;
4573
4574 /**
4575  * A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
4576  * containing a crate::lightning::ln::msgs::AcceptChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
4577  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4578  */
4579 typedef struct LDKCResult_AcceptChannelDecodeErrorZ {
4580    /**
4581     * The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
4582     * `err` or `result` depending on the state of `result_ok`.
4583     */
4584    union LDKCResult_AcceptChannelDecodeErrorZPtr contents;
4585    /**
4586     * Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
4587     */
4588    bool result_ok;
4589 } LDKCResult_AcceptChannelDecodeErrorZ;
4590
4591 /**
4592  * The contents of CResult_AnnouncementSignaturesDecodeErrorZ
4593  */
4594 typedef union LDKCResult_AnnouncementSignaturesDecodeErrorZPtr {
4595    /**
4596     * A pointer to the contents in the success state.
4597     * Reading from this pointer when `result_ok` is not set is undefined.
4598     */
4599    struct LDKAnnouncementSignatures *result;
4600    /**
4601     * A pointer to the contents in the error state.
4602     * Reading from this pointer when `result_ok` is set is undefined.
4603     */
4604    struct LDKDecodeError *err;
4605 } LDKCResult_AnnouncementSignaturesDecodeErrorZPtr;
4606
4607 /**
4608  * A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
4609  * containing a crate::lightning::ln::msgs::AnnouncementSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4610  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4611  */
4612 typedef struct LDKCResult_AnnouncementSignaturesDecodeErrorZ {
4613    /**
4614     * The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
4615     * `err` or `result` depending on the state of `result_ok`.
4616     */
4617    union LDKCResult_AnnouncementSignaturesDecodeErrorZPtr contents;
4618    /**
4619     * Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
4620     */
4621    bool result_ok;
4622 } LDKCResult_AnnouncementSignaturesDecodeErrorZ;
4623
4624 /**
4625  * The contents of CResult_ChannelReestablishDecodeErrorZ
4626  */
4627 typedef union LDKCResult_ChannelReestablishDecodeErrorZPtr {
4628    /**
4629     * A pointer to the contents in the success state.
4630     * Reading from this pointer when `result_ok` is not set is undefined.
4631     */
4632    struct LDKChannelReestablish *result;
4633    /**
4634     * A pointer to the contents in the error state.
4635     * Reading from this pointer when `result_ok` is set is undefined.
4636     */
4637    struct LDKDecodeError *err;
4638 } LDKCResult_ChannelReestablishDecodeErrorZPtr;
4639
4640 /**
4641  * A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
4642  * containing a crate::lightning::ln::msgs::ChannelReestablish on success and a crate::lightning::ln::msgs::DecodeError on failure.
4643  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4644  */
4645 typedef struct LDKCResult_ChannelReestablishDecodeErrorZ {
4646    /**
4647     * The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
4648     * `err` or `result` depending on the state of `result_ok`.
4649     */
4650    union LDKCResult_ChannelReestablishDecodeErrorZPtr contents;
4651    /**
4652     * Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
4653     */
4654    bool result_ok;
4655 } LDKCResult_ChannelReestablishDecodeErrorZ;
4656
4657 /**
4658  * The contents of CResult_ClosingSignedDecodeErrorZ
4659  */
4660 typedef union LDKCResult_ClosingSignedDecodeErrorZPtr {
4661    /**
4662     * A pointer to the contents in the success state.
4663     * Reading from this pointer when `result_ok` is not set is undefined.
4664     */
4665    struct LDKClosingSigned *result;
4666    /**
4667     * A pointer to the contents in the error state.
4668     * Reading from this pointer when `result_ok` is set is undefined.
4669     */
4670    struct LDKDecodeError *err;
4671 } LDKCResult_ClosingSignedDecodeErrorZPtr;
4672
4673 /**
4674  * A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
4675  * containing a crate::lightning::ln::msgs::ClosingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
4676  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4677  */
4678 typedef struct LDKCResult_ClosingSignedDecodeErrorZ {
4679    /**
4680     * The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
4681     * `err` or `result` depending on the state of `result_ok`.
4682     */
4683    union LDKCResult_ClosingSignedDecodeErrorZPtr contents;
4684    /**
4685     * Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
4686     */
4687    bool result_ok;
4688 } LDKCResult_ClosingSignedDecodeErrorZ;
4689
4690
4691
4692 /**
4693  * A commitment_signed message to be sent or received from a peer
4694  */
4695 typedef struct MUST_USE_STRUCT LDKCommitmentSigned {
4696    /**
4697     * A pointer to the opaque Rust object.
4698     * Nearly everywhere, inner must be non-null, however in places where
4699     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4700     */
4701    LDKnativeCommitmentSigned *inner;
4702    /**
4703     * Indicates that this is the only struct which contains the same pointer.
4704     * Rust functions which take ownership of an object provided via an argument require
4705     * this to be true and invalidate the object pointed to by inner.
4706     */
4707    bool is_owned;
4708 } LDKCommitmentSigned;
4709
4710 /**
4711  * The contents of CResult_CommitmentSignedDecodeErrorZ
4712  */
4713 typedef union LDKCResult_CommitmentSignedDecodeErrorZPtr {
4714    /**
4715     * A pointer to the contents in the success state.
4716     * Reading from this pointer when `result_ok` is not set is undefined.
4717     */
4718    struct LDKCommitmentSigned *result;
4719    /**
4720     * A pointer to the contents in the error state.
4721     * Reading from this pointer when `result_ok` is set is undefined.
4722     */
4723    struct LDKDecodeError *err;
4724 } LDKCResult_CommitmentSignedDecodeErrorZPtr;
4725
4726 /**
4727  * A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
4728  * containing a crate::lightning::ln::msgs::CommitmentSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
4729  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4730  */
4731 typedef struct LDKCResult_CommitmentSignedDecodeErrorZ {
4732    /**
4733     * The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
4734     * `err` or `result` depending on the state of `result_ok`.
4735     */
4736    union LDKCResult_CommitmentSignedDecodeErrorZPtr contents;
4737    /**
4738     * Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
4739     */
4740    bool result_ok;
4741 } LDKCResult_CommitmentSignedDecodeErrorZ;
4742
4743 /**
4744  * The contents of CResult_FundingCreatedDecodeErrorZ
4745  */
4746 typedef union LDKCResult_FundingCreatedDecodeErrorZPtr {
4747    /**
4748     * A pointer to the contents in the success state.
4749     * Reading from this pointer when `result_ok` is not set is undefined.
4750     */
4751    struct LDKFundingCreated *result;
4752    /**
4753     * A pointer to the contents in the error state.
4754     * Reading from this pointer when `result_ok` is set is undefined.
4755     */
4756    struct LDKDecodeError *err;
4757 } LDKCResult_FundingCreatedDecodeErrorZPtr;
4758
4759 /**
4760  * A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
4761  * containing a crate::lightning::ln::msgs::FundingCreated on success and a crate::lightning::ln::msgs::DecodeError on failure.
4762  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4763  */
4764 typedef struct LDKCResult_FundingCreatedDecodeErrorZ {
4765    /**
4766     * The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
4767     * `err` or `result` depending on the state of `result_ok`.
4768     */
4769    union LDKCResult_FundingCreatedDecodeErrorZPtr contents;
4770    /**
4771     * Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
4772     */
4773    bool result_ok;
4774 } LDKCResult_FundingCreatedDecodeErrorZ;
4775
4776 /**
4777  * The contents of CResult_FundingSignedDecodeErrorZ
4778  */
4779 typedef union LDKCResult_FundingSignedDecodeErrorZPtr {
4780    /**
4781     * A pointer to the contents in the success state.
4782     * Reading from this pointer when `result_ok` is not set is undefined.
4783     */
4784    struct LDKFundingSigned *result;
4785    /**
4786     * A pointer to the contents in the error state.
4787     * Reading from this pointer when `result_ok` is set is undefined.
4788     */
4789    struct LDKDecodeError *err;
4790 } LDKCResult_FundingSignedDecodeErrorZPtr;
4791
4792 /**
4793  * A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation,
4794  * containing a crate::lightning::ln::msgs::FundingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
4795  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4796  */
4797 typedef struct LDKCResult_FundingSignedDecodeErrorZ {
4798    /**
4799     * The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
4800     * `err` or `result` depending on the state of `result_ok`.
4801     */
4802    union LDKCResult_FundingSignedDecodeErrorZPtr contents;
4803    /**
4804     * Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
4805     */
4806    bool result_ok;
4807 } LDKCResult_FundingSignedDecodeErrorZ;
4808
4809 /**
4810  * The contents of CResult_FundingLockedDecodeErrorZ
4811  */
4812 typedef union LDKCResult_FundingLockedDecodeErrorZPtr {
4813    /**
4814     * A pointer to the contents in the success state.
4815     * Reading from this pointer when `result_ok` is not set is undefined.
4816     */
4817    struct LDKFundingLocked *result;
4818    /**
4819     * A pointer to the contents in the error state.
4820     * Reading from this pointer when `result_ok` is set is undefined.
4821     */
4822    struct LDKDecodeError *err;
4823 } LDKCResult_FundingLockedDecodeErrorZPtr;
4824
4825 /**
4826  * A CResult_FundingLockedDecodeErrorZ represents the result of a fallible operation,
4827  * containing a crate::lightning::ln::msgs::FundingLocked on success and a crate::lightning::ln::msgs::DecodeError on failure.
4828  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4829  */
4830 typedef struct LDKCResult_FundingLockedDecodeErrorZ {
4831    /**
4832     * The contents of this CResult_FundingLockedDecodeErrorZ, accessible via either
4833     * `err` or `result` depending on the state of `result_ok`.
4834     */
4835    union LDKCResult_FundingLockedDecodeErrorZPtr contents;
4836    /**
4837     * Whether this CResult_FundingLockedDecodeErrorZ represents a success state.
4838     */
4839    bool result_ok;
4840 } LDKCResult_FundingLockedDecodeErrorZ;
4841
4842
4843
4844 /**
4845  * An init message to be sent or received from a peer
4846  */
4847 typedef struct MUST_USE_STRUCT LDKInit {
4848    /**
4849     * A pointer to the opaque Rust object.
4850     * Nearly everywhere, inner must be non-null, however in places where
4851     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4852     */
4853    LDKnativeInit *inner;
4854    /**
4855     * Indicates that this is the only struct which contains the same pointer.
4856     * Rust functions which take ownership of an object provided via an argument require
4857     * this to be true and invalidate the object pointed to by inner.
4858     */
4859    bool is_owned;
4860 } LDKInit;
4861
4862 /**
4863  * The contents of CResult_InitDecodeErrorZ
4864  */
4865 typedef union LDKCResult_InitDecodeErrorZPtr {
4866    /**
4867     * A pointer to the contents in the success state.
4868     * Reading from this pointer when `result_ok` is not set is undefined.
4869     */
4870    struct LDKInit *result;
4871    /**
4872     * A pointer to the contents in the error state.
4873     * Reading from this pointer when `result_ok` is set is undefined.
4874     */
4875    struct LDKDecodeError *err;
4876 } LDKCResult_InitDecodeErrorZPtr;
4877
4878 /**
4879  * A CResult_InitDecodeErrorZ represents the result of a fallible operation,
4880  * containing a crate::lightning::ln::msgs::Init on success and a crate::lightning::ln::msgs::DecodeError on failure.
4881  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4882  */
4883 typedef struct LDKCResult_InitDecodeErrorZ {
4884    /**
4885     * The contents of this CResult_InitDecodeErrorZ, accessible via either
4886     * `err` or `result` depending on the state of `result_ok`.
4887     */
4888    union LDKCResult_InitDecodeErrorZPtr contents;
4889    /**
4890     * Whether this CResult_InitDecodeErrorZ represents a success state.
4891     */
4892    bool result_ok;
4893 } LDKCResult_InitDecodeErrorZ;
4894
4895 /**
4896  * The contents of CResult_OpenChannelDecodeErrorZ
4897  */
4898 typedef union LDKCResult_OpenChannelDecodeErrorZPtr {
4899    /**
4900     * A pointer to the contents in the success state.
4901     * Reading from this pointer when `result_ok` is not set is undefined.
4902     */
4903    struct LDKOpenChannel *result;
4904    /**
4905     * A pointer to the contents in the error state.
4906     * Reading from this pointer when `result_ok` is set is undefined.
4907     */
4908    struct LDKDecodeError *err;
4909 } LDKCResult_OpenChannelDecodeErrorZPtr;
4910
4911 /**
4912  * A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation,
4913  * containing a crate::lightning::ln::msgs::OpenChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
4914  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4915  */
4916 typedef struct LDKCResult_OpenChannelDecodeErrorZ {
4917    /**
4918     * The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
4919     * `err` or `result` depending on the state of `result_ok`.
4920     */
4921    union LDKCResult_OpenChannelDecodeErrorZPtr contents;
4922    /**
4923     * Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
4924     */
4925    bool result_ok;
4926 } LDKCResult_OpenChannelDecodeErrorZ;
4927
4928 /**
4929  * The contents of CResult_RevokeAndACKDecodeErrorZ
4930  */
4931 typedef union LDKCResult_RevokeAndACKDecodeErrorZPtr {
4932    /**
4933     * A pointer to the contents in the success state.
4934     * Reading from this pointer when `result_ok` is not set is undefined.
4935     */
4936    struct LDKRevokeAndACK *result;
4937    /**
4938     * A pointer to the contents in the error state.
4939     * Reading from this pointer when `result_ok` is set is undefined.
4940     */
4941    struct LDKDecodeError *err;
4942 } LDKCResult_RevokeAndACKDecodeErrorZPtr;
4943
4944 /**
4945  * A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
4946  * containing a crate::lightning::ln::msgs::RevokeAndACK on success and a crate::lightning::ln::msgs::DecodeError on failure.
4947  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4948  */
4949 typedef struct LDKCResult_RevokeAndACKDecodeErrorZ {
4950    /**
4951     * The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
4952     * `err` or `result` depending on the state of `result_ok`.
4953     */
4954    union LDKCResult_RevokeAndACKDecodeErrorZPtr contents;
4955    /**
4956     * Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
4957     */
4958    bool result_ok;
4959 } LDKCResult_RevokeAndACKDecodeErrorZ;
4960
4961 /**
4962  * The contents of CResult_ShutdownDecodeErrorZ
4963  */
4964 typedef union LDKCResult_ShutdownDecodeErrorZPtr {
4965    /**
4966     * A pointer to the contents in the success state.
4967     * Reading from this pointer when `result_ok` is not set is undefined.
4968     */
4969    struct LDKShutdown *result;
4970    /**
4971     * A pointer to the contents in the error state.
4972     * Reading from this pointer when `result_ok` is set is undefined.
4973     */
4974    struct LDKDecodeError *err;
4975 } LDKCResult_ShutdownDecodeErrorZPtr;
4976
4977 /**
4978  * A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation,
4979  * containing a crate::lightning::ln::msgs::Shutdown on success and a crate::lightning::ln::msgs::DecodeError on failure.
4980  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4981  */
4982 typedef struct LDKCResult_ShutdownDecodeErrorZ {
4983    /**
4984     * The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
4985     * `err` or `result` depending on the state of `result_ok`.
4986     */
4987    union LDKCResult_ShutdownDecodeErrorZPtr contents;
4988    /**
4989     * Whether this CResult_ShutdownDecodeErrorZ represents a success state.
4990     */
4991    bool result_ok;
4992 } LDKCResult_ShutdownDecodeErrorZ;
4993
4994 /**
4995  * The contents of CResult_UpdateFailHTLCDecodeErrorZ
4996  */
4997 typedef union LDKCResult_UpdateFailHTLCDecodeErrorZPtr {
4998    /**
4999     * A pointer to the contents in the success state.
5000     * Reading from this pointer when `result_ok` is not set is undefined.
5001     */
5002    struct LDKUpdateFailHTLC *result;
5003    /**
5004     * A pointer to the contents in the error state.
5005     * Reading from this pointer when `result_ok` is set is undefined.
5006     */
5007    struct LDKDecodeError *err;
5008 } LDKCResult_UpdateFailHTLCDecodeErrorZPtr;
5009
5010 /**
5011  * A CResult_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
5012  * containing a crate::lightning::ln::msgs::UpdateFailHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
5013  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5014  */
5015 typedef struct LDKCResult_UpdateFailHTLCDecodeErrorZ {
5016    /**
5017     * The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
5018     * `err` or `result` depending on the state of `result_ok`.
5019     */
5020    union LDKCResult_UpdateFailHTLCDecodeErrorZPtr contents;
5021    /**
5022     * Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
5023     */
5024    bool result_ok;
5025 } LDKCResult_UpdateFailHTLCDecodeErrorZ;
5026
5027 /**
5028  * The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
5029  */
5030 typedef union LDKCResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
5031    /**
5032     * A pointer to the contents in the success state.
5033     * Reading from this pointer when `result_ok` is not set is undefined.
5034     */
5035    struct LDKUpdateFailMalformedHTLC *result;
5036    /**
5037     * A pointer to the contents in the error state.
5038     * Reading from this pointer when `result_ok` is set is undefined.
5039     */
5040    struct LDKDecodeError *err;
5041 } LDKCResult_UpdateFailMalformedHTLCDecodeErrorZPtr;
5042
5043 /**
5044  * A CResult_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
5045  * containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
5046  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5047  */
5048 typedef struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ {
5049    /**
5050     * The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
5051     * `err` or `result` depending on the state of `result_ok`.
5052     */
5053    union LDKCResult_UpdateFailMalformedHTLCDecodeErrorZPtr contents;
5054    /**
5055     * Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
5056     */
5057    bool result_ok;
5058 } LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ;
5059
5060
5061
5062 /**
5063  * An update_fee message to be sent or received from a peer
5064  */
5065 typedef struct MUST_USE_STRUCT LDKUpdateFee {
5066    /**
5067     * A pointer to the opaque Rust object.
5068     * Nearly everywhere, inner must be non-null, however in places where
5069     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5070     */
5071    LDKnativeUpdateFee *inner;
5072    /**
5073     * Indicates that this is the only struct which contains the same pointer.
5074     * Rust functions which take ownership of an object provided via an argument require
5075     * this to be true and invalidate the object pointed to by inner.
5076     */
5077    bool is_owned;
5078 } LDKUpdateFee;
5079
5080 /**
5081  * The contents of CResult_UpdateFeeDecodeErrorZ
5082  */
5083 typedef union LDKCResult_UpdateFeeDecodeErrorZPtr {
5084    /**
5085     * A pointer to the contents in the success state.
5086     * Reading from this pointer when `result_ok` is not set is undefined.
5087     */
5088    struct LDKUpdateFee *result;
5089    /**
5090     * A pointer to the contents in the error state.
5091     * Reading from this pointer when `result_ok` is set is undefined.
5092     */
5093    struct LDKDecodeError *err;
5094 } LDKCResult_UpdateFeeDecodeErrorZPtr;
5095
5096 /**
5097  * A CResult_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
5098  * containing a crate::lightning::ln::msgs::UpdateFee on success and a crate::lightning::ln::msgs::DecodeError on failure.
5099  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5100  */
5101 typedef struct LDKCResult_UpdateFeeDecodeErrorZ {
5102    /**
5103     * The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
5104     * `err` or `result` depending on the state of `result_ok`.
5105     */
5106    union LDKCResult_UpdateFeeDecodeErrorZPtr contents;
5107    /**
5108     * Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
5109     */
5110    bool result_ok;
5111 } LDKCResult_UpdateFeeDecodeErrorZ;
5112
5113 /**
5114  * The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
5115  */
5116 typedef union LDKCResult_UpdateFulfillHTLCDecodeErrorZPtr {
5117    /**
5118     * A pointer to the contents in the success state.
5119     * Reading from this pointer when `result_ok` is not set is undefined.
5120     */
5121    struct LDKUpdateFulfillHTLC *result;
5122    /**
5123     * A pointer to the contents in the error state.
5124     * Reading from this pointer when `result_ok` is set is undefined.
5125     */
5126    struct LDKDecodeError *err;
5127 } LDKCResult_UpdateFulfillHTLCDecodeErrorZPtr;
5128
5129 /**
5130  * A CResult_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
5131  * containing a crate::lightning::ln::msgs::UpdateFulfillHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
5132  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5133  */
5134 typedef struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ {
5135    /**
5136     * The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
5137     * `err` or `result` depending on the state of `result_ok`.
5138     */
5139    union LDKCResult_UpdateFulfillHTLCDecodeErrorZPtr contents;
5140    /**
5141     * Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
5142     */
5143    bool result_ok;
5144 } LDKCResult_UpdateFulfillHTLCDecodeErrorZ;
5145
5146 /**
5147  * The contents of CResult_UpdateAddHTLCDecodeErrorZ
5148  */
5149 typedef union LDKCResult_UpdateAddHTLCDecodeErrorZPtr {
5150    /**
5151     * A pointer to the contents in the success state.
5152     * Reading from this pointer when `result_ok` is not set is undefined.
5153     */
5154    struct LDKUpdateAddHTLC *result;
5155    /**
5156     * A pointer to the contents in the error state.
5157     * Reading from this pointer when `result_ok` is set is undefined.
5158     */
5159    struct LDKDecodeError *err;
5160 } LDKCResult_UpdateAddHTLCDecodeErrorZPtr;
5161
5162 /**
5163  * A CResult_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
5164  * containing a crate::lightning::ln::msgs::UpdateAddHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
5165  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5166  */
5167 typedef struct LDKCResult_UpdateAddHTLCDecodeErrorZ {
5168    /**
5169     * The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
5170     * `err` or `result` depending on the state of `result_ok`.
5171     */
5172    union LDKCResult_UpdateAddHTLCDecodeErrorZPtr contents;
5173    /**
5174     * Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
5175     */
5176    bool result_ok;
5177 } LDKCResult_UpdateAddHTLCDecodeErrorZ;
5178
5179
5180
5181 /**
5182  * A ping message to be sent or received from a peer
5183  */
5184 typedef struct MUST_USE_STRUCT LDKPing {
5185    /**
5186     * A pointer to the opaque Rust object.
5187     * Nearly everywhere, inner must be non-null, however in places where
5188     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5189     */
5190    LDKnativePing *inner;
5191    /**
5192     * Indicates that this is the only struct which contains the same pointer.
5193     * Rust functions which take ownership of an object provided via an argument require
5194     * this to be true and invalidate the object pointed to by inner.
5195     */
5196    bool is_owned;
5197 } LDKPing;
5198
5199 /**
5200  * The contents of CResult_PingDecodeErrorZ
5201  */
5202 typedef union LDKCResult_PingDecodeErrorZPtr {
5203    /**
5204     * A pointer to the contents in the success state.
5205     * Reading from this pointer when `result_ok` is not set is undefined.
5206     */
5207    struct LDKPing *result;
5208    /**
5209     * A pointer to the contents in the error state.
5210     * Reading from this pointer when `result_ok` is set is undefined.
5211     */
5212    struct LDKDecodeError *err;
5213 } LDKCResult_PingDecodeErrorZPtr;
5214
5215 /**
5216  * A CResult_PingDecodeErrorZ represents the result of a fallible operation,
5217  * containing a crate::lightning::ln::msgs::Ping on success and a crate::lightning::ln::msgs::DecodeError on failure.
5218  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5219  */
5220 typedef struct LDKCResult_PingDecodeErrorZ {
5221    /**
5222     * The contents of this CResult_PingDecodeErrorZ, accessible via either
5223     * `err` or `result` depending on the state of `result_ok`.
5224     */
5225    union LDKCResult_PingDecodeErrorZPtr contents;
5226    /**
5227     * Whether this CResult_PingDecodeErrorZ represents a success state.
5228     */
5229    bool result_ok;
5230 } LDKCResult_PingDecodeErrorZ;
5231
5232
5233
5234 /**
5235  * A pong message to be sent or received from a peer
5236  */
5237 typedef struct MUST_USE_STRUCT LDKPong {
5238    /**
5239     * A pointer to the opaque Rust object.
5240     * Nearly everywhere, inner must be non-null, however in places where
5241     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5242     */
5243    LDKnativePong *inner;
5244    /**
5245     * Indicates that this is the only struct which contains the same pointer.
5246     * Rust functions which take ownership of an object provided via an argument require
5247     * this to be true and invalidate the object pointed to by inner.
5248     */
5249    bool is_owned;
5250 } LDKPong;
5251
5252 /**
5253  * The contents of CResult_PongDecodeErrorZ
5254  */
5255 typedef union LDKCResult_PongDecodeErrorZPtr {
5256    /**
5257     * A pointer to the contents in the success state.
5258     * Reading from this pointer when `result_ok` is not set is undefined.
5259     */
5260    struct LDKPong *result;
5261    /**
5262     * A pointer to the contents in the error state.
5263     * Reading from this pointer when `result_ok` is set is undefined.
5264     */
5265    struct LDKDecodeError *err;
5266 } LDKCResult_PongDecodeErrorZPtr;
5267
5268 /**
5269  * A CResult_PongDecodeErrorZ represents the result of a fallible operation,
5270  * containing a crate::lightning::ln::msgs::Pong on success and a crate::lightning::ln::msgs::DecodeError on failure.
5271  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5272  */
5273 typedef struct LDKCResult_PongDecodeErrorZ {
5274    /**
5275     * The contents of this CResult_PongDecodeErrorZ, accessible via either
5276     * `err` or `result` depending on the state of `result_ok`.
5277     */
5278    union LDKCResult_PongDecodeErrorZPtr contents;
5279    /**
5280     * Whether this CResult_PongDecodeErrorZ represents a success state.
5281     */
5282    bool result_ok;
5283 } LDKCResult_PongDecodeErrorZ;
5284
5285 /**
5286  * The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
5287  */
5288 typedef union LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
5289    /**
5290     * A pointer to the contents in the success state.
5291     * Reading from this pointer when `result_ok` is not set is undefined.
5292     */
5293    struct LDKUnsignedChannelAnnouncement *result;
5294    /**
5295     * A pointer to the contents in the error state.
5296     * Reading from this pointer when `result_ok` is set is undefined.
5297     */
5298    struct LDKDecodeError *err;
5299 } LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr;
5300
5301 /**
5302  * A CResult_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
5303  * containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
5304  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5305  */
5306 typedef struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ {
5307    /**
5308     * The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
5309     * `err` or `result` depending on the state of `result_ok`.
5310     */
5311    union LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr contents;
5312    /**
5313     * Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
5314     */
5315    bool result_ok;
5316 } LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ;
5317
5318 /**
5319  * The contents of CResult_ChannelAnnouncementDecodeErrorZ
5320  */
5321 typedef union LDKCResult_ChannelAnnouncementDecodeErrorZPtr {
5322    /**
5323     * A pointer to the contents in the success state.
5324     * Reading from this pointer when `result_ok` is not set is undefined.
5325     */
5326    struct LDKChannelAnnouncement *result;
5327    /**
5328     * A pointer to the contents in the error state.
5329     * Reading from this pointer when `result_ok` is set is undefined.
5330     */
5331    struct LDKDecodeError *err;
5332 } LDKCResult_ChannelAnnouncementDecodeErrorZPtr;
5333
5334 /**
5335  * A CResult_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
5336  * containing a crate::lightning::ln::msgs::ChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
5337  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5338  */
5339 typedef struct LDKCResult_ChannelAnnouncementDecodeErrorZ {
5340    /**
5341     * The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
5342     * `err` or `result` depending on the state of `result_ok`.
5343     */
5344    union LDKCResult_ChannelAnnouncementDecodeErrorZPtr contents;
5345    /**
5346     * Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
5347     */
5348    bool result_ok;
5349 } LDKCResult_ChannelAnnouncementDecodeErrorZ;
5350
5351
5352
5353 /**
5354  * The unsigned part of a channel_update
5355  */
5356 typedef struct MUST_USE_STRUCT LDKUnsignedChannelUpdate {
5357    /**
5358     * A pointer to the opaque Rust object.
5359     * Nearly everywhere, inner must be non-null, however in places where
5360     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5361     */
5362    LDKnativeUnsignedChannelUpdate *inner;
5363    /**
5364     * Indicates that this is the only struct which contains the same pointer.
5365     * Rust functions which take ownership of an object provided via an argument require
5366     * this to be true and invalidate the object pointed to by inner.
5367     */
5368    bool is_owned;
5369 } LDKUnsignedChannelUpdate;
5370
5371 /**
5372  * The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
5373  */
5374 typedef union LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr {
5375    /**
5376     * A pointer to the contents in the success state.
5377     * Reading from this pointer when `result_ok` is not set is undefined.
5378     */
5379    struct LDKUnsignedChannelUpdate *result;
5380    /**
5381     * A pointer to the contents in the error state.
5382     * Reading from this pointer when `result_ok` is set is undefined.
5383     */
5384    struct LDKDecodeError *err;
5385 } LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr;
5386
5387 /**
5388  * A CResult_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
5389  * containing a crate::lightning::ln::msgs::UnsignedChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
5390  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5391  */
5392 typedef struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ {
5393    /**
5394     * The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
5395     * `err` or `result` depending on the state of `result_ok`.
5396     */
5397    union LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr contents;
5398    /**
5399     * Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
5400     */
5401    bool result_ok;
5402 } LDKCResult_UnsignedChannelUpdateDecodeErrorZ;
5403
5404 /**
5405  * The contents of CResult_ChannelUpdateDecodeErrorZ
5406  */
5407 typedef union LDKCResult_ChannelUpdateDecodeErrorZPtr {
5408    /**
5409     * A pointer to the contents in the success state.
5410     * Reading from this pointer when `result_ok` is not set is undefined.
5411     */
5412    struct LDKChannelUpdate *result;
5413    /**
5414     * A pointer to the contents in the error state.
5415     * Reading from this pointer when `result_ok` is set is undefined.
5416     */
5417    struct LDKDecodeError *err;
5418 } LDKCResult_ChannelUpdateDecodeErrorZPtr;
5419
5420 /**
5421  * A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
5422  * containing a crate::lightning::ln::msgs::ChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
5423  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5424  */
5425 typedef struct LDKCResult_ChannelUpdateDecodeErrorZ {
5426    /**
5427     * The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
5428     * `err` or `result` depending on the state of `result_ok`.
5429     */
5430    union LDKCResult_ChannelUpdateDecodeErrorZPtr contents;
5431    /**
5432     * Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
5433     */
5434    bool result_ok;
5435 } LDKCResult_ChannelUpdateDecodeErrorZ;
5436
5437 /**
5438  * The contents of CResult_ErrorMessageDecodeErrorZ
5439  */
5440 typedef union LDKCResult_ErrorMessageDecodeErrorZPtr {
5441    /**
5442     * A pointer to the contents in the success state.
5443     * Reading from this pointer when `result_ok` is not set is undefined.
5444     */
5445    struct LDKErrorMessage *result;
5446    /**
5447     * A pointer to the contents in the error state.
5448     * Reading from this pointer when `result_ok` is set is undefined.
5449     */
5450    struct LDKDecodeError *err;
5451 } LDKCResult_ErrorMessageDecodeErrorZPtr;
5452
5453 /**
5454  * A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
5455  * containing a crate::lightning::ln::msgs::ErrorMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
5456  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5457  */
5458 typedef struct LDKCResult_ErrorMessageDecodeErrorZ {
5459    /**
5460     * The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
5461     * `err` or `result` depending on the state of `result_ok`.
5462     */
5463    union LDKCResult_ErrorMessageDecodeErrorZPtr contents;
5464    /**
5465     * Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
5466     */
5467    bool result_ok;
5468 } LDKCResult_ErrorMessageDecodeErrorZ;
5469
5470
5471
5472 /**
5473  * The unsigned part of a node_announcement
5474  */
5475 typedef struct MUST_USE_STRUCT LDKUnsignedNodeAnnouncement {
5476    /**
5477     * A pointer to the opaque Rust object.
5478     * Nearly everywhere, inner must be non-null, however in places where
5479     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5480     */
5481    LDKnativeUnsignedNodeAnnouncement *inner;
5482    /**
5483     * Indicates that this is the only struct which contains the same pointer.
5484     * Rust functions which take ownership of an object provided via an argument require
5485     * this to be true and invalidate the object pointed to by inner.
5486     */
5487    bool is_owned;
5488 } LDKUnsignedNodeAnnouncement;
5489
5490 /**
5491  * The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
5492  */
5493 typedef union LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
5494    /**
5495     * A pointer to the contents in the success state.
5496     * Reading from this pointer when `result_ok` is not set is undefined.
5497     */
5498    struct LDKUnsignedNodeAnnouncement *result;
5499    /**
5500     * A pointer to the contents in the error state.
5501     * Reading from this pointer when `result_ok` is set is undefined.
5502     */
5503    struct LDKDecodeError *err;
5504 } LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr;
5505
5506 /**
5507  * A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
5508  * containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
5509  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5510  */
5511 typedef struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ {
5512    /**
5513     * The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
5514     * `err` or `result` depending on the state of `result_ok`.
5515     */
5516    union LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr contents;
5517    /**
5518     * Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
5519     */
5520    bool result_ok;
5521 } LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ;
5522
5523 /**
5524  * The contents of CResult_NodeAnnouncementDecodeErrorZ
5525  */
5526 typedef union LDKCResult_NodeAnnouncementDecodeErrorZPtr {
5527    /**
5528     * A pointer to the contents in the success state.
5529     * Reading from this pointer when `result_ok` is not set is undefined.
5530     */
5531    struct LDKNodeAnnouncement *result;
5532    /**
5533     * A pointer to the contents in the error state.
5534     * Reading from this pointer when `result_ok` is set is undefined.
5535     */
5536    struct LDKDecodeError *err;
5537 } LDKCResult_NodeAnnouncementDecodeErrorZPtr;
5538
5539 /**
5540  * A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
5541  * containing a crate::lightning::ln::msgs::NodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
5542  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5543  */
5544 typedef struct LDKCResult_NodeAnnouncementDecodeErrorZ {
5545    /**
5546     * The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
5547     * `err` or `result` depending on the state of `result_ok`.
5548     */
5549    union LDKCResult_NodeAnnouncementDecodeErrorZPtr contents;
5550    /**
5551     * Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
5552     */
5553    bool result_ok;
5554 } LDKCResult_NodeAnnouncementDecodeErrorZ;
5555
5556 /**
5557  * The contents of CResult_QueryShortChannelIdsDecodeErrorZ
5558  */
5559 typedef union LDKCResult_QueryShortChannelIdsDecodeErrorZPtr {
5560    /**
5561     * A pointer to the contents in the success state.
5562     * Reading from this pointer when `result_ok` is not set is undefined.
5563     */
5564    struct LDKQueryShortChannelIds *result;
5565    /**
5566     * A pointer to the contents in the error state.
5567     * Reading from this pointer when `result_ok` is set is undefined.
5568     */
5569    struct LDKDecodeError *err;
5570 } LDKCResult_QueryShortChannelIdsDecodeErrorZPtr;
5571
5572 /**
5573  * A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
5574  * containing a crate::lightning::ln::msgs::QueryShortChannelIds on success and a crate::lightning::ln::msgs::DecodeError on failure.
5575  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5576  */
5577 typedef struct LDKCResult_QueryShortChannelIdsDecodeErrorZ {
5578    /**
5579     * The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
5580     * `err` or `result` depending on the state of `result_ok`.
5581     */
5582    union LDKCResult_QueryShortChannelIdsDecodeErrorZPtr contents;
5583    /**
5584     * Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
5585     */
5586    bool result_ok;
5587 } LDKCResult_QueryShortChannelIdsDecodeErrorZ;
5588
5589
5590
5591 /**
5592  * A reply_short_channel_ids_end message is sent as a reply to a
5593  * query_short_channel_ids message. The query recipient makes a best
5594  * effort to respond based on their local network view which may not be
5595  * a perfect view of the network.
5596  */
5597 typedef struct MUST_USE_STRUCT LDKReplyShortChannelIdsEnd {
5598    /**
5599     * A pointer to the opaque Rust object.
5600     * Nearly everywhere, inner must be non-null, however in places where
5601     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5602     */
5603    LDKnativeReplyShortChannelIdsEnd *inner;
5604    /**
5605     * Indicates that this is the only struct which contains the same pointer.
5606     * Rust functions which take ownership of an object provided via an argument require
5607     * this to be true and invalidate the object pointed to by inner.
5608     */
5609    bool is_owned;
5610 } LDKReplyShortChannelIdsEnd;
5611
5612 /**
5613  * The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
5614  */
5615 typedef union LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
5616    /**
5617     * A pointer to the contents in the success state.
5618     * Reading from this pointer when `result_ok` is not set is undefined.
5619     */
5620    struct LDKReplyShortChannelIdsEnd *result;
5621    /**
5622     * A pointer to the contents in the error state.
5623     * Reading from this pointer when `result_ok` is set is undefined.
5624     */
5625    struct LDKDecodeError *err;
5626 } LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr;
5627
5628 /**
5629  * A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
5630  * containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::lightning::ln::msgs::DecodeError on failure.
5631  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5632  */
5633 typedef struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ {
5634    /**
5635     * The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
5636     * `err` or `result` depending on the state of `result_ok`.
5637     */
5638    union LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr contents;
5639    /**
5640     * Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
5641     */
5642    bool result_ok;
5643 } LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ;
5644
5645 /**
5646  * The contents of CResult_QueryChannelRangeDecodeErrorZ
5647  */
5648 typedef union LDKCResult_QueryChannelRangeDecodeErrorZPtr {
5649    /**
5650     * A pointer to the contents in the success state.
5651     * Reading from this pointer when `result_ok` is not set is undefined.
5652     */
5653    struct LDKQueryChannelRange *result;
5654    /**
5655     * A pointer to the contents in the error state.
5656     * Reading from this pointer when `result_ok` is set is undefined.
5657     */
5658    struct LDKDecodeError *err;
5659 } LDKCResult_QueryChannelRangeDecodeErrorZPtr;
5660
5661 /**
5662  * A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
5663  * containing a crate::lightning::ln::msgs::QueryChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
5664  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5665  */
5666 typedef struct LDKCResult_QueryChannelRangeDecodeErrorZ {
5667    /**
5668     * The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
5669     * `err` or `result` depending on the state of `result_ok`.
5670     */
5671    union LDKCResult_QueryChannelRangeDecodeErrorZPtr contents;
5672    /**
5673     * Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
5674     */
5675    bool result_ok;
5676 } LDKCResult_QueryChannelRangeDecodeErrorZ;
5677
5678 /**
5679  * The contents of CResult_ReplyChannelRangeDecodeErrorZ
5680  */
5681 typedef union LDKCResult_ReplyChannelRangeDecodeErrorZPtr {
5682    /**
5683     * A pointer to the contents in the success state.
5684     * Reading from this pointer when `result_ok` is not set is undefined.
5685     */
5686    struct LDKReplyChannelRange *result;
5687    /**
5688     * A pointer to the contents in the error state.
5689     * Reading from this pointer when `result_ok` is set is undefined.
5690     */
5691    struct LDKDecodeError *err;
5692 } LDKCResult_ReplyChannelRangeDecodeErrorZPtr;
5693
5694 /**
5695  * A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
5696  * containing a crate::lightning::ln::msgs::ReplyChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
5697  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5698  */
5699 typedef struct LDKCResult_ReplyChannelRangeDecodeErrorZ {
5700    /**
5701     * The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
5702     * `err` or `result` depending on the state of `result_ok`.
5703     */
5704    union LDKCResult_ReplyChannelRangeDecodeErrorZPtr contents;
5705    /**
5706     * Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
5707     */
5708    bool result_ok;
5709 } LDKCResult_ReplyChannelRangeDecodeErrorZ;
5710
5711
5712
5713 /**
5714  * A gossip_timestamp_filter message is used by a node to request
5715  * gossip relay for messages in the requested time range when the
5716  * gossip_queries feature has been negotiated.
5717  */
5718 typedef struct MUST_USE_STRUCT LDKGossipTimestampFilter {
5719    /**
5720     * A pointer to the opaque Rust object.
5721     * Nearly everywhere, inner must be non-null, however in places where
5722     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5723     */
5724    LDKnativeGossipTimestampFilter *inner;
5725    /**
5726     * Indicates that this is the only struct which contains the same pointer.
5727     * Rust functions which take ownership of an object provided via an argument require
5728     * this to be true and invalidate the object pointed to by inner.
5729     */
5730    bool is_owned;
5731 } LDKGossipTimestampFilter;
5732
5733 /**
5734  * The contents of CResult_GossipTimestampFilterDecodeErrorZ
5735  */
5736 typedef union LDKCResult_GossipTimestampFilterDecodeErrorZPtr {
5737    /**
5738     * A pointer to the contents in the success state.
5739     * Reading from this pointer when `result_ok` is not set is undefined.
5740     */
5741    struct LDKGossipTimestampFilter *result;
5742    /**
5743     * A pointer to the contents in the error state.
5744     * Reading from this pointer when `result_ok` is set is undefined.
5745     */
5746    struct LDKDecodeError *err;
5747 } LDKCResult_GossipTimestampFilterDecodeErrorZPtr;
5748
5749 /**
5750  * A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
5751  * containing a crate::lightning::ln::msgs::GossipTimestampFilter on success and a crate::lightning::ln::msgs::DecodeError on failure.
5752  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5753  */
5754 typedef struct LDKCResult_GossipTimestampFilterDecodeErrorZ {
5755    /**
5756     * The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
5757     * `err` or `result` depending on the state of `result_ok`.
5758     */
5759    union LDKCResult_GossipTimestampFilterDecodeErrorZPtr contents;
5760    /**
5761     * Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
5762     */
5763    bool result_ok;
5764 } LDKCResult_GossipTimestampFilterDecodeErrorZ;
5765
5766 /**
5767  * The contents of CResult_SpendableOutputDescriptorDecodeErrorZ
5768  */
5769 typedef union LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr {
5770    /**
5771     * A pointer to the contents in the success state.
5772     * Reading from this pointer when `result_ok` is not set is undefined.
5773     */
5774    struct LDKSpendableOutputDescriptor *result;
5775    /**
5776     * A pointer to the contents in the error state.
5777     * Reading from this pointer when `result_ok` is set is undefined.
5778     */
5779    struct LDKDecodeError *err;
5780 } LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr;
5781
5782 /**
5783  * A CResult_SpendableOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
5784  * containing a crate::lightning::chain::keysinterface::SpendableOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
5785  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5786  */
5787 typedef struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ {
5788    /**
5789     * The contents of this CResult_SpendableOutputDescriptorDecodeErrorZ, accessible via either
5790     * `err` or `result` depending on the state of `result_ok`.
5791     */
5792    union LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr contents;
5793    /**
5794     * Whether this CResult_SpendableOutputDescriptorDecodeErrorZ represents a success state.
5795     */
5796    bool result_ok;
5797 } LDKCResult_SpendableOutputDescriptorDecodeErrorZ;
5798
5799 /**
5800  * The contents of CResult_SignDecodeErrorZ
5801  */
5802 typedef union LDKCResult_SignDecodeErrorZPtr {
5803    /**
5804     * A pointer to the contents in the success state.
5805     * Reading from this pointer when `result_ok` is not set is undefined.
5806     */
5807    struct LDKSign *result;
5808    /**
5809     * A pointer to the contents in the error state.
5810     * Reading from this pointer when `result_ok` is set is undefined.
5811     */
5812    struct LDKDecodeError *err;
5813 } LDKCResult_SignDecodeErrorZPtr;
5814
5815 /**
5816  * A CResult_SignDecodeErrorZ represents the result of a fallible operation,
5817  * containing a crate::lightning::chain::keysinterface::Sign on success and a crate::lightning::ln::msgs::DecodeError on failure.
5818  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5819  */
5820 typedef struct LDKCResult_SignDecodeErrorZ {
5821    /**
5822     * The contents of this CResult_SignDecodeErrorZ, accessible via either
5823     * `err` or `result` depending on the state of `result_ok`.
5824     */
5825    union LDKCResult_SignDecodeErrorZPtr contents;
5826    /**
5827     * Whether this CResult_SignDecodeErrorZ represents a success state.
5828     */
5829    bool result_ok;
5830 } LDKCResult_SignDecodeErrorZ;
5831
5832 /**
5833  * A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size.
5834  * This corresponds to std::vector in C++
5835  */
5836 typedef struct LDKCVec_CVec_u8ZZ {
5837    /**
5838     * The elements in the array.
5839     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5840     */
5841    struct LDKCVec_u8Z *data;
5842    /**
5843     * The number of elements pointed to by `data`.
5844     */
5845    uintptr_t datalen;
5846 } LDKCVec_CVec_u8ZZ;
5847
5848 /**
5849  * The contents of CResult_CVec_CVec_u8ZZNoneZ
5850  */
5851 typedef union LDKCResult_CVec_CVec_u8ZZNoneZPtr {
5852    /**
5853     * A pointer to the contents in the success state.
5854     * Reading from this pointer when `result_ok` is not set is undefined.
5855     */
5856    struct LDKCVec_CVec_u8ZZ *result;
5857    /**
5858     * Note that this value is always NULL, as there are no contents in the Err variant
5859     */
5860    void *err;
5861 } LDKCResult_CVec_CVec_u8ZZNoneZPtr;
5862
5863 /**
5864  * A CResult_CVec_CVec_u8ZZNoneZ represents the result of a fallible operation,
5865  * containing a crate::c_types::derived::CVec_CVec_u8ZZ on success and a () on failure.
5866  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5867  */
5868 typedef struct LDKCResult_CVec_CVec_u8ZZNoneZ {
5869    /**
5870     * The contents of this CResult_CVec_CVec_u8ZZNoneZ, accessible via either
5871     * `err` or `result` depending on the state of `result_ok`.
5872     */
5873    union LDKCResult_CVec_CVec_u8ZZNoneZPtr contents;
5874    /**
5875     * Whether this CResult_CVec_CVec_u8ZZNoneZ represents a success state.
5876     */
5877    bool result_ok;
5878 } LDKCResult_CVec_CVec_u8ZZNoneZ;
5879
5880
5881
5882 /**
5883  * A simple implementation of Sign that just keeps the private keys in memory.
5884  *
5885  * This implementation performs no policy checks and is insufficient by itself as
5886  * a secure external signer.
5887  */
5888 typedef struct MUST_USE_STRUCT LDKInMemorySigner {
5889    /**
5890     * A pointer to the opaque Rust object.
5891     * Nearly everywhere, inner must be non-null, however in places where
5892     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5893     */
5894    LDKnativeInMemorySigner *inner;
5895    /**
5896     * Indicates that this is the only struct which contains the same pointer.
5897     * Rust functions which take ownership of an object provided via an argument require
5898     * this to be true and invalidate the object pointed to by inner.
5899     */
5900    bool is_owned;
5901 } LDKInMemorySigner;
5902
5903 /**
5904  * The contents of CResult_InMemorySignerDecodeErrorZ
5905  */
5906 typedef union LDKCResult_InMemorySignerDecodeErrorZPtr {
5907    /**
5908     * A pointer to the contents in the success state.
5909     * Reading from this pointer when `result_ok` is not set is undefined.
5910     */
5911    struct LDKInMemorySigner *result;
5912    /**
5913     * A pointer to the contents in the error state.
5914     * Reading from this pointer when `result_ok` is set is undefined.
5915     */
5916    struct LDKDecodeError *err;
5917 } LDKCResult_InMemorySignerDecodeErrorZPtr;
5918
5919 /**
5920  * A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation,
5921  * containing a crate::lightning::chain::keysinterface::InMemorySigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
5922  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5923  */
5924 typedef struct LDKCResult_InMemorySignerDecodeErrorZ {
5925    /**
5926     * The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either
5927     * `err` or `result` depending on the state of `result_ok`.
5928     */
5929    union LDKCResult_InMemorySignerDecodeErrorZPtr contents;
5930    /**
5931     * Whether this CResult_InMemorySignerDecodeErrorZ represents a success state.
5932     */
5933    bool result_ok;
5934 } LDKCResult_InMemorySignerDecodeErrorZ;
5935
5936 /**
5937  * A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size.
5938  * This corresponds to std::vector in C++
5939  */
5940 typedef struct LDKCVec_TxOutZ {
5941    /**
5942     * The elements in the array.
5943     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5944     */
5945    struct LDKTxOut *data;
5946    /**
5947     * The number of elements pointed to by `data`.
5948     */
5949    uintptr_t datalen;
5950 } LDKCVec_TxOutZ;
5951
5952 /**
5953  * The contents of CResult_TransactionNoneZ
5954  */
5955 typedef union LDKCResult_TransactionNoneZPtr {
5956    /**
5957     * A pointer to the contents in the success state.
5958     * Reading from this pointer when `result_ok` is not set is undefined.
5959     */
5960    struct LDKTransaction *result;
5961    /**
5962     * Note that this value is always NULL, as there are no contents in the Err variant
5963     */
5964    void *err;
5965 } LDKCResult_TransactionNoneZPtr;
5966
5967 /**
5968  * A CResult_TransactionNoneZ represents the result of a fallible operation,
5969  * containing a crate::c_types::Transaction on success and a () on failure.
5970  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5971  */
5972 typedef struct LDKCResult_TransactionNoneZ {
5973    /**
5974     * The contents of this CResult_TransactionNoneZ, accessible via either
5975     * `err` or `result` depending on the state of `result_ok`.
5976     */
5977    union LDKCResult_TransactionNoneZPtr contents;
5978    /**
5979     * Whether this CResult_TransactionNoneZ represents a success state.
5980     */
5981    bool result_ok;
5982 } LDKCResult_TransactionNoneZ;
5983
5984 /**
5985  * A Rust str object, ie a reference to a UTF8-valid string.
5986  * This is *not* null-terminated so cannot be used directly as a C string!
5987  */
5988 typedef struct LDKStr {
5989    /**
5990     * A pointer to the string's bytes, in UTF8 encoding
5991     */
5992    const uint8_t *chars;
5993    /**
5994     * The number of bytes (not characters!) pointed to by `chars`
5995     */
5996    uintptr_t len;
5997 } LDKStr;
5998
5999 /**
6000  * Indicates an error on the client's part (usually some variant of attempting to use too-low or
6001  * too-high values)
6002  */
6003 typedef enum LDKAPIError_Tag {
6004    /**
6005     * Indicates the API was wholly misused (see err for more). Cases where these can be returned
6006     * are documented, but generally indicates some precondition of a function was violated.
6007     */
6008    LDKAPIError_APIMisuseError,
6009    /**
6010     * Due to a high feerate, we were unable to complete the request.
6011     * For example, this may be returned if the feerate implies we cannot open a channel at the
6012     * requested value, but opening a larger channel would succeed.
6013     */
6014    LDKAPIError_FeeRateTooHigh,
6015    /**
6016     * A malformed Route was provided (eg overflowed value, node id mismatch, overly-looped route,
6017     * too-many-hops, etc).
6018     */
6019    LDKAPIError_RouteError,
6020    /**
6021     * We were unable to complete the request as the Channel required to do so is unable to
6022     * complete the request (or was not found). This can take many forms, including disconnected
6023     * peer, channel at capacity, channel shutting down, etc.
6024     */
6025    LDKAPIError_ChannelUnavailable,
6026    /**
6027     * An attempt to call watch/update_channel returned an Err (ie you did this!), causing the
6028     * attempted action to fail.
6029     */
6030    LDKAPIError_MonitorUpdateFailed,
6031    /**
6032     * Must be last for serialization purposes
6033     */
6034    LDKAPIError_Sentinel,
6035 } LDKAPIError_Tag;
6036
6037 typedef struct LDKAPIError_LDKAPIMisuseError_Body {
6038    /**
6039     * A human-readable error message
6040     */
6041    struct LDKCVec_u8Z err;
6042 } LDKAPIError_LDKAPIMisuseError_Body;
6043
6044 typedef struct LDKAPIError_LDKFeeRateTooHigh_Body {
6045    /**
6046     * A human-readable error message
6047     */
6048    struct LDKCVec_u8Z err;
6049    /**
6050     * The feerate which was too high.
6051     */
6052    uint32_t feerate;
6053 } LDKAPIError_LDKFeeRateTooHigh_Body;
6054
6055 typedef struct LDKAPIError_LDKRouteError_Body {
6056    /**
6057     * A human-readable error message
6058     */
6059    struct LDKStr err;
6060 } LDKAPIError_LDKRouteError_Body;
6061
6062 typedef struct LDKAPIError_LDKChannelUnavailable_Body {
6063    /**
6064     * A human-readable error message
6065     */
6066    struct LDKCVec_u8Z err;
6067 } LDKAPIError_LDKChannelUnavailable_Body;
6068
6069 typedef struct MUST_USE_STRUCT LDKAPIError {
6070    LDKAPIError_Tag tag;
6071    union {
6072       LDKAPIError_LDKAPIMisuseError_Body api_misuse_error;
6073       LDKAPIError_LDKFeeRateTooHigh_Body fee_rate_too_high;
6074       LDKAPIError_LDKRouteError_Body route_error;
6075       LDKAPIError_LDKChannelUnavailable_Body channel_unavailable;
6076    };
6077 } LDKAPIError;
6078
6079 /**
6080  * The contents of CResult_NoneAPIErrorZ
6081  */
6082 typedef union LDKCResult_NoneAPIErrorZPtr {
6083    /**
6084     * Note that this value is always NULL, as there are no contents in the OK variant
6085     */
6086    void *result;
6087    /**
6088     * A pointer to the contents in the error state.
6089     * Reading from this pointer when `result_ok` is set is undefined.
6090     */
6091    struct LDKAPIError *err;
6092 } LDKCResult_NoneAPIErrorZPtr;
6093
6094 /**
6095  * A CResult_NoneAPIErrorZ represents the result of a fallible operation,
6096  * containing a () on success and a crate::lightning::util::errors::APIError on failure.
6097  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6098  */
6099 typedef struct LDKCResult_NoneAPIErrorZ {
6100    /**
6101     * The contents of this CResult_NoneAPIErrorZ, accessible via either
6102     * `err` or `result` depending on the state of `result_ok`.
6103     */
6104    union LDKCResult_NoneAPIErrorZPtr contents;
6105    /**
6106     * Whether this CResult_NoneAPIErrorZ represents a success state.
6107     */
6108    bool result_ok;
6109 } LDKCResult_NoneAPIErrorZ;
6110
6111 /**
6112  * A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size.
6113  * This corresponds to std::vector in C++
6114  */
6115 typedef struct LDKCVec_CResult_NoneAPIErrorZZ {
6116    /**
6117     * The elements in the array.
6118     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6119     */
6120    struct LDKCResult_NoneAPIErrorZ *data;
6121    /**
6122     * The number of elements pointed to by `data`.
6123     */
6124    uintptr_t datalen;
6125 } LDKCVec_CResult_NoneAPIErrorZZ;
6126
6127 /**
6128  * A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size.
6129  * This corresponds to std::vector in C++
6130  */
6131 typedef struct LDKCVec_APIErrorZ {
6132    /**
6133     * The elements in the array.
6134     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6135     */
6136    struct LDKAPIError *data;
6137    /**
6138     * The number of elements pointed to by `data`.
6139     */
6140    uintptr_t datalen;
6141 } LDKCVec_APIErrorZ;
6142
6143 /**
6144  * If a payment fails to send, it can be in one of several states. This enum is returned as the
6145  * Err() type describing which state the payment is in, see the description of individual enum
6146  * states for more.
6147  */
6148 typedef enum LDKPaymentSendFailure_Tag {
6149    /**
6150     * A parameter which was passed to send_payment was invalid, preventing us from attempting to
6151     * send the payment at all. No channel state has been changed or messages sent to peers, and
6152     * once you've changed the parameter at error, you can freely retry the payment in full.
6153     */
6154    LDKPaymentSendFailure_ParameterError,
6155    /**
6156     * A parameter in a single path which was passed to send_payment was invalid, preventing us
6157     * from attempting to send the payment at all. No channel state has been changed or messages
6158     * sent to peers, and once you've changed the parameter at error, you can freely retry the
6159     * payment in full.
6160     *
6161     * The results here are ordered the same as the paths in the route object which was passed to
6162     * send_payment.
6163     */
6164    LDKPaymentSendFailure_PathParameterError,
6165    /**
6166     * All paths which were attempted failed to send, with no channel state change taking place.
6167     * You can freely retry the payment in full (though you probably want to do so over different
6168     * paths than the ones selected).
6169     */
6170    LDKPaymentSendFailure_AllFailedRetrySafe,
6171    /**
6172     * Some paths which were attempted failed to send, though possibly not all. At least some
6173     * paths have irrevocably committed to the HTLC and retrying the payment in full would result
6174     * in over-/re-payment.
6175     *
6176     * The results here are ordered the same as the paths in the route object which was passed to
6177     * send_payment, and any Errs which are not APIError::MonitorUpdateFailed can be safely
6178     * retried (though there is currently no API with which to do so).
6179     *
6180     * Any entries which contain Err(APIError::MonitorUpdateFailed) or Ok(()) MUST NOT be retried
6181     * as they will result in over-/re-payment. These HTLCs all either successfully sent (in the
6182     * case of Ok(())) or will send once channel_monitor_updated is called on the next-hop channel
6183     * with the latest update_id.
6184     */
6185    LDKPaymentSendFailure_PartialFailure,
6186    /**
6187     * Must be last for serialization purposes
6188     */
6189    LDKPaymentSendFailure_Sentinel,
6190 } LDKPaymentSendFailure_Tag;
6191
6192 typedef struct MUST_USE_STRUCT LDKPaymentSendFailure {
6193    LDKPaymentSendFailure_Tag tag;
6194    union {
6195       struct {
6196          struct LDKAPIError parameter_error;
6197       };
6198       struct {
6199          struct LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error;
6200       };
6201       struct {
6202          struct LDKCVec_APIErrorZ all_failed_retry_safe;
6203       };
6204       struct {
6205          struct LDKCVec_CResult_NoneAPIErrorZZ partial_failure;
6206       };
6207    };
6208 } LDKPaymentSendFailure;
6209
6210 /**
6211  * The contents of CResult_NonePaymentSendFailureZ
6212  */
6213 typedef union LDKCResult_NonePaymentSendFailureZPtr {
6214    /**
6215     * Note that this value is always NULL, as there are no contents in the OK variant
6216     */
6217    void *result;
6218    /**
6219     * A pointer to the contents in the error state.
6220     * Reading from this pointer when `result_ok` is set is undefined.
6221     */
6222    struct LDKPaymentSendFailure *err;
6223 } LDKCResult_NonePaymentSendFailureZPtr;
6224
6225 /**
6226  * A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
6227  * containing a () on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
6228  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6229  */
6230 typedef struct LDKCResult_NonePaymentSendFailureZ {
6231    /**
6232     * The contents of this CResult_NonePaymentSendFailureZ, accessible via either
6233     * `err` or `result` depending on the state of `result_ok`.
6234     */
6235    union LDKCResult_NonePaymentSendFailureZPtr contents;
6236    /**
6237     * Whether this CResult_NonePaymentSendFailureZ represents a success state.
6238     */
6239    bool result_ok;
6240 } LDKCResult_NonePaymentSendFailureZ;
6241
6242 /**
6243  * A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
6244  * This corresponds to std::vector in C++
6245  */
6246 typedef struct LDKCVec_ChannelMonitorZ {
6247    /**
6248     * The elements in the array.
6249     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6250     */
6251    struct LDKChannelMonitor *data;
6252    /**
6253     * The number of elements pointed to by `data`.
6254     */
6255    uintptr_t datalen;
6256 } LDKCVec_ChannelMonitorZ;
6257
6258 /**
6259  * The `Watch` trait defines behavior for watching on-chain activity pertaining to channels as
6260  * blocks are connected and disconnected.
6261  *
6262  * Each channel is associated with a [`ChannelMonitor`]. Implementations of this trait are
6263  * responsible for maintaining a set of monitors such that they can be updated accordingly as
6264  * channel state changes and HTLCs are resolved. See method documentation for specific
6265  * requirements.
6266  *
6267  * Implementations **must** ensure that updates are successfully applied and persisted upon method
6268  * completion. If an update fails with a [`PermanentFailure`], then it must immediately shut down
6269  * without taking any further action such as persisting the current state.
6270  *
6271  * If an implementation maintains multiple instances of a channel's monitor (e.g., by storing
6272  * backup copies), then it must ensure that updates are applied across all instances. Otherwise, it
6273  * could result in a revoked transaction being broadcast, allowing the counterparty to claim all
6274  * funds in the channel. See [`ChannelMonitorUpdateErr`] for more details about how to handle
6275  * multiple instances.
6276  *
6277  * [`ChannelMonitor`]: channelmonitor::ChannelMonitor
6278  * [`ChannelMonitorUpdateErr`]: channelmonitor::ChannelMonitorUpdateErr
6279  * [`PermanentFailure`]: channelmonitor::ChannelMonitorUpdateErr::PermanentFailure
6280  */
6281 typedef struct LDKWatch {
6282    /**
6283     * An opaque pointer which is passed to your function implementations as an argument.
6284     * This has no meaning in the LDK, and can be NULL or any other value.
6285     */
6286    void *this_arg;
6287    /**
6288     * Watches a channel identified by `funding_txo` using `monitor`.
6289     *
6290     * Implementations are responsible for watching the chain for the funding transaction along
6291     * with any spends of outputs returned by [`get_outputs_to_watch`]. In practice, this means
6292     * calling [`block_connected`] and [`block_disconnected`] on the monitor.
6293     *
6294     * [`get_outputs_to_watch`]: channelmonitor::ChannelMonitor::get_outputs_to_watch
6295     * [`block_connected`]: channelmonitor::ChannelMonitor::block_connected
6296     * [`block_disconnected`]: channelmonitor::ChannelMonitor::block_disconnected
6297     */
6298    struct LDKCResult_NoneChannelMonitorUpdateErrZ (*watch_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitor monitor);
6299    /**
6300     * Updates a channel identified by `funding_txo` by applying `update` to its monitor.
6301     *
6302     * Implementations must call [`update_monitor`] with the given update. See
6303     * [`ChannelMonitorUpdateErr`] for invariants around returning an error.
6304     *
6305     * [`update_monitor`]: channelmonitor::ChannelMonitor::update_monitor
6306     * [`ChannelMonitorUpdateErr`]: channelmonitor::ChannelMonitorUpdateErr
6307     */
6308    struct LDKCResult_NoneChannelMonitorUpdateErrZ (*update_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitorUpdate update);
6309    /**
6310     * Returns any monitor events since the last call. Subsequent calls must only return new
6311     * events.
6312     */
6313    struct LDKCVec_MonitorEventZ (*release_pending_monitor_events)(const void *this_arg);
6314    /**
6315     * Frees any resources associated with this object given its this_arg pointer.
6316     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
6317     */
6318    void (*free)(void *this_arg);
6319 } LDKWatch;
6320
6321 /**
6322  * An interface to send a transaction to the Bitcoin network.
6323  */
6324 typedef struct LDKBroadcasterInterface {
6325    /**
6326     * An opaque pointer which is passed to your function implementations as an argument.
6327     * This has no meaning in the LDK, and can be NULL or any other value.
6328     */
6329    void *this_arg;
6330    /**
6331     * Sends a transaction out to (hopefully) be mined.
6332     */
6333    void (*broadcast_transaction)(const void *this_arg, struct LDKTransaction tx);
6334    /**
6335     * Frees any resources associated with this object given its this_arg pointer.
6336     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
6337     */
6338    void (*free)(void *this_arg);
6339 } LDKBroadcasterInterface;
6340
6341 /**
6342  * A "slice" referencing some byte array. This is simply a length-tagged pointer which does not
6343  * own the memory pointed to by data.
6344  */
6345 typedef struct LDKu8slice {
6346    /**
6347     * A pointer to the byte buffer
6348     */
6349    const uint8_t *data;
6350    /**
6351     * The number of bytes pointed to by `data`.
6352     */
6353    uintptr_t datalen;
6354 } LDKu8slice;
6355
6356 /**
6357  * A trait to describe an object which can get user secrets and key material.
6358  */
6359 typedef struct LDKKeysInterface {
6360    /**
6361     * An opaque pointer which is passed to your function implementations as an argument.
6362     * This has no meaning in the LDK, and can be NULL or any other value.
6363     */
6364    void *this_arg;
6365    /**
6366     * Get node secret key (aka node_id or network_key).
6367     *
6368     * This method must return the same value each time it is called.
6369     */
6370    struct LDKSecretKey (*get_node_secret)(const void *this_arg);
6371    /**
6372     * Get a script pubkey which we send funds to when claiming on-chain contestable outputs.
6373     *
6374     * This method should return a different value each time it is called, to avoid linking
6375     * on-chain funds across channels as controlled to the same user.
6376     */
6377    struct LDKCVec_u8Z (*get_destination_script)(const void *this_arg);
6378    /**
6379     * Get a public key which we will send funds to (in the form of a P2WPKH output) when closing
6380     * a channel.
6381     *
6382     * This method should return a different value each time it is called, to avoid linking
6383     * on-chain funds across channels as controlled to the same user.
6384     */
6385    struct LDKPublicKey (*get_shutdown_pubkey)(const void *this_arg);
6386    /**
6387     * Get a new set of Sign for per-channel secrets. These MUST be unique even if you
6388     * restarted with some stale data!
6389     *
6390     * This method must return a different value each time it is called.
6391     */
6392    struct LDKSign (*get_channel_signer)(const void *this_arg, bool inbound, uint64_t channel_value_satoshis);
6393    /**
6394     * Gets a unique, cryptographically-secure, random 32 byte value. This is used for encrypting
6395     * onion packets and for temporary channel IDs. There is no requirement that these be
6396     * persisted anywhere, though they must be unique across restarts.
6397     *
6398     * This method must return a different value each time it is called.
6399     */
6400    struct LDKThirtyTwoBytes (*get_secure_random_bytes)(const void *this_arg);
6401    /**
6402     * Reads a `Signer` for this `KeysInterface` from the given input stream.
6403     * This is only called during deserialization of other objects which contain
6404     * `Sign`-implementing objects (ie `ChannelMonitor`s and `ChannelManager`s).
6405     * The bytes are exactly those which `<Self::Signer as Writeable>::write()` writes, and
6406     * contain no versioning scheme. You may wish to include your own version prefix and ensure
6407     * you've read all of the provided bytes to ensure no corruption occurred.
6408     */
6409    struct LDKCResult_SignDecodeErrorZ (*read_chan_signer)(const void *this_arg, struct LDKu8slice reader);
6410    /**
6411     * Frees any resources associated with this object given its this_arg pointer.
6412     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
6413     */
6414    void (*free)(void *this_arg);
6415 } LDKKeysInterface;
6416
6417 /**
6418  * A trait which should be implemented to provide feerate information on a number of time
6419  * horizons.
6420  *
6421  * Note that all of the functions implemented here *must* be reentrant-safe (obviously - they're
6422  * called from inside the library in response to chain events, P2P events, or timer events).
6423  */
6424 typedef struct LDKFeeEstimator {
6425    /**
6426     * An opaque pointer which is passed to your function implementations as an argument.
6427     * This has no meaning in the LDK, and can be NULL or any other value.
6428     */
6429    void *this_arg;
6430    /**
6431     * Gets estimated satoshis of fee required per 1000 Weight-Units.
6432     *
6433     * Must be no smaller than 253 (ie 1 satoshi-per-byte rounded up to ensure later round-downs
6434     * don't put us below 1 satoshi-per-byte).
6435     *
6436     * This translates to:
6437     *  * satoshis-per-byte * 250
6438     *  * ceil(satoshis-per-kbyte / 4)
6439     */
6440    uint32_t (*get_est_sat_per_1000_weight)(const void *this_arg, enum LDKConfirmationTarget confirmation_target);
6441    /**
6442     * Frees any resources associated with this object given its this_arg pointer.
6443     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
6444     */
6445    void (*free)(void *this_arg);
6446 } LDKFeeEstimator;
6447
6448 /**
6449  * A trait encapsulating the operations required of a logger
6450  */
6451 typedef struct LDKLogger {
6452    /**
6453     * An opaque pointer which is passed to your function implementations as an argument.
6454     * This has no meaning in the LDK, and can be NULL or any other value.
6455     */
6456    void *this_arg;
6457    /**
6458     * Logs the `Record`
6459     */
6460    void (*log)(const void *this_arg, const char *record);
6461    /**
6462     * Frees any resources associated with this object given its this_arg pointer.
6463     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
6464     */
6465    void (*free)(void *this_arg);
6466 } LDKLogger;
6467
6468
6469
6470 /**
6471  * Manager which keeps track of a number of channels and sends messages to the appropriate
6472  * channel, also tracking HTLC preimages and forwarding onion packets appropriately.
6473  *
6474  * Implements ChannelMessageHandler, handling the multi-channel parts and passing things through
6475  * to individual Channels.
6476  *
6477  * Implements Writeable to write out all channel state to disk. Implies peer_disconnected() for
6478  * all peers during write/read (though does not modify this instance, only the instance being
6479  * serialized). This will result in any channels which have not yet exchanged funding_created (ie
6480  * called funding_transaction_generated for outbound channels).
6481  *
6482  * Note that you can be a bit lazier about writing out ChannelManager than you can be with
6483  * ChannelMonitors. With ChannelMonitors you MUST write each monitor update out to disk before
6484  * returning from chain::Watch::watch_/update_channel, with ChannelManagers, writing updates
6485  * happens out-of-band (and will prevent any other ChannelManager operations from occurring during
6486  * the serialization process). If the deserialized version is out-of-date compared to the
6487  * ChannelMonitors passed by reference to read(), those channels will be force-closed based on the
6488  * ChannelMonitor state and no funds will be lost (mod on-chain transaction fees).
6489  *
6490  * Note that the deserializer is only implemented for (BlockHash, ChannelManager), which
6491  * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along
6492  * the \"reorg path\" (ie call block_disconnected() until you get to a common block and then call
6493  * block_connected() to step towards your best block) upon deserialization before using the
6494  * object!
6495  *
6496  * Note that ChannelManager is responsible for tracking liveness of its channels and generating
6497  * ChannelUpdate messages informing peers that the channel is temporarily disabled. To avoid
6498  * spam due to quick disconnection/reconnection, updates are not sent until the channel has been
6499  * offline for a full minute. In order to track this, you must call
6500  * timer_tick_occurred roughly once per minute, though it doesn't have to be perfect.
6501  *
6502  * Rather than using a plain ChannelManager, it is preferable to use either a SimpleArcChannelManager
6503  * a SimpleRefChannelManager, for conciseness. See their documentation for more details, but
6504  * essentially you should default to using a SimpleRefChannelManager, and use a
6505  * SimpleArcChannelManager when you require a ChannelManager with a static lifetime, such as when
6506  * you're using lightning-net-tokio.
6507  */
6508 typedef struct MUST_USE_STRUCT LDKChannelManager {
6509    /**
6510     * A pointer to the opaque Rust object.
6511     * Nearly everywhere, inner must be non-null, however in places where
6512     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6513     */
6514    LDKnativeChannelManager *inner;
6515    /**
6516     * Indicates that this is the only struct which contains the same pointer.
6517     * Rust functions which take ownership of an object provided via an argument require
6518     * this to be true and invalidate the object pointed to by inner.
6519     */
6520    bool is_owned;
6521 } LDKChannelManager;
6522
6523 /**
6524  * A tuple of 2 elements. See the individual fields for the types contained.
6525  */
6526 typedef struct LDKC2Tuple_BlockHashChannelManagerZ {
6527    /**
6528     * The element at position 0
6529     */
6530    struct LDKThirtyTwoBytes a;
6531    /**
6532     * The element at position 1
6533     */
6534    struct LDKChannelManager b;
6535 } LDKC2Tuple_BlockHashChannelManagerZ;
6536
6537 /**
6538  * The contents of CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ
6539  */
6540 typedef union LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
6541    /**
6542     * A pointer to the contents in the success state.
6543     * Reading from this pointer when `result_ok` is not set is undefined.
6544     */
6545    struct LDKC2Tuple_BlockHashChannelManagerZ *result;
6546    /**
6547     * A pointer to the contents in the error state.
6548     * Reading from this pointer when `result_ok` is set is undefined.
6549     */
6550    struct LDKDecodeError *err;
6551 } LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr;
6552
6553 /**
6554  * A CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents the result of a fallible operation,
6555  * containing a crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
6556  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6557  */
6558 typedef struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
6559    /**
6560     * The contents of this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ, accessible via either
6561     * `err` or `result` depending on the state of `result_ok`.
6562     */
6563    union LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr contents;
6564    /**
6565     * Whether this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents a success state.
6566     */
6567    bool result_ok;
6568 } LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ;
6569
6570 /**
6571  * A trait indicating an object may generate message send events
6572  */
6573 typedef struct LDKMessageSendEventsProvider {
6574    /**
6575     * An opaque pointer which is passed to your function implementations as an argument.
6576     * This has no meaning in the LDK, and can be NULL or any other value.
6577     */
6578    void *this_arg;
6579    /**
6580     * Gets the list of pending events which were generated by previous actions, clearing the list
6581     * in the process.
6582     */
6583    struct LDKCVec_MessageSendEventZ (*get_and_clear_pending_msg_events)(const void *this_arg);
6584    /**
6585     * Frees any resources associated with this object given its this_arg pointer.
6586     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
6587     */
6588    void (*free)(void *this_arg);
6589 } LDKMessageSendEventsProvider;
6590
6591 /**
6592  * A trait indicating an object may generate events
6593  */
6594 typedef struct LDKEventsProvider {
6595    /**
6596     * An opaque pointer which is passed to your function implementations as an argument.
6597     * This has no meaning in the LDK, and can be NULL or any other value.
6598     */
6599    void *this_arg;
6600    /**
6601     * Gets the list of pending events which were generated by previous actions, clearing the list
6602     * in the process.
6603     */
6604    struct LDKCVec_EventZ (*get_and_clear_pending_events)(const void *this_arg);
6605    /**
6606     * Frees any resources associated with this object given its this_arg pointer.
6607     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
6608     */
6609    void (*free)(void *this_arg);
6610 } LDKEventsProvider;
6611
6612
6613
6614 /**
6615  * Configuration we set when applicable.
6616  *
6617  * Default::default() provides sane defaults.
6618  */
6619 typedef struct MUST_USE_STRUCT LDKChannelHandshakeConfig {
6620    /**
6621     * A pointer to the opaque Rust object.
6622     * Nearly everywhere, inner must be non-null, however in places where
6623     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6624     */
6625    LDKnativeChannelHandshakeConfig *inner;
6626    /**
6627     * Indicates that this is the only struct which contains the same pointer.
6628     * Rust functions which take ownership of an object provided via an argument require
6629     * this to be true and invalidate the object pointed to by inner.
6630     */
6631    bool is_owned;
6632 } LDKChannelHandshakeConfig;
6633
6634
6635
6636 /**
6637  * Optional channel limits which are applied during channel creation.
6638  *
6639  * These limits are only applied to our counterparty's limits, not our own.
6640  *
6641  * Use 0/<type>::max_value() as appropriate to skip checking.
6642  *
6643  * Provides sane defaults for most configurations.
6644  *
6645  * Most additional limits are disabled except those with which specify a default in individual
6646  * field documentation. Note that this may result in barely-usable channels, but since they
6647  * are applied mostly only to incoming channels that's not much of a problem.
6648  */
6649 typedef struct MUST_USE_STRUCT LDKChannelHandshakeLimits {
6650    /**
6651     * A pointer to the opaque Rust object.
6652     * Nearly everywhere, inner must be non-null, however in places where
6653     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6654     */
6655    LDKnativeChannelHandshakeLimits *inner;
6656    /**
6657     * Indicates that this is the only struct which contains the same pointer.
6658     * Rust functions which take ownership of an object provided via an argument require
6659     * this to be true and invalidate the object pointed to by inner.
6660     */
6661    bool is_owned;
6662 } LDKChannelHandshakeLimits;
6663
6664
6665
6666 /**
6667  * Top-level config which holds ChannelHandshakeLimits and ChannelConfig.
6668  *
6669  * Default::default() provides sane defaults for most configurations
6670  * (but currently with 0 relay fees!)
6671  */
6672 typedef struct MUST_USE_STRUCT LDKUserConfig {
6673    /**
6674     * A pointer to the opaque Rust object.
6675     * Nearly everywhere, inner must be non-null, however in places where
6676     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6677     */
6678    LDKnativeUserConfig *inner;
6679    /**
6680     * Indicates that this is the only struct which contains the same pointer.
6681     * Rust functions which take ownership of an object provided via an argument require
6682     * this to be true and invalidate the object pointed to by inner.
6683     */
6684    bool is_owned;
6685 } LDKUserConfig;
6686
6687 /**
6688  * The `Access` trait defines behavior for accessing chain data and state, such as blocks and
6689  * UTXOs.
6690  */
6691 typedef struct LDKAccess {
6692    /**
6693     * An opaque pointer which is passed to your function implementations as an argument.
6694     * This has no meaning in the LDK, and can be NULL or any other value.
6695     */
6696    void *this_arg;
6697    /**
6698     * Returns the transaction output of a funding transaction encoded by [`short_channel_id`].
6699     * Returns an error if `genesis_hash` is for a different chain or if such a transaction output
6700     * is unknown.
6701     *
6702     * [`short_channel_id`]: https://github.com/lightningnetwork/lightning-rfc/blob/master/07-routing-gossip.md#definition-of-short_channel_id
6703     */
6704    struct LDKCResult_TxOutAccessErrorZ (*get_utxo)(const void *this_arg, const uint8_t (*genesis_hash)[32], uint64_t short_channel_id);
6705    /**
6706     * Frees any resources associated with this object given its this_arg pointer.
6707     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
6708     */
6709    void (*free)(void *this_arg);
6710 } LDKAccess;
6711
6712 /**
6713  * The `Listen` trait is used to be notified of when blocks have been connected or disconnected
6714  * from the chain.
6715  *
6716  * Useful when needing to replay chain data upon startup or as new chain events occur.
6717  */
6718 typedef struct LDKListen {
6719    /**
6720     * An opaque pointer which is passed to your function implementations as an argument.
6721     * This has no meaning in the LDK, and can be NULL or any other value.
6722     */
6723    void *this_arg;
6724    /**
6725     * Notifies the listener that a block was added at the given height.
6726     */
6727    void (*block_connected)(const void *this_arg, struct LDKu8slice block, uint32_t height);
6728    /**
6729     * Notifies the listener that a block was removed at the given height.
6730     */
6731    void (*block_disconnected)(const void *this_arg, const uint8_t (*header)[80], uint32_t height);
6732    /**
6733     * Frees any resources associated with this object given its this_arg pointer.
6734     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
6735     */
6736    void (*free)(void *this_arg);
6737 } LDKListen;
6738
6739
6740
6741 /**
6742  * A transaction output watched by a [`ChannelMonitor`] for spends on-chain.
6743  *
6744  * Used to convey to a [`Filter`] such an output with a given spending condition. Any transaction
6745  * spending the output must be given to [`ChannelMonitor::block_connected`] either directly or via
6746  * the return value of [`Filter::register_output`].
6747  *
6748  * If `block_hash` is `Some`, this indicates the output was created in the corresponding block and
6749  * may have been spent there. See [`Filter::register_output`] for details.
6750  *
6751  * [`ChannelMonitor`]: channelmonitor::ChannelMonitor
6752  * [`ChannelMonitor::block_connected`]: channelmonitor::ChannelMonitor::block_connected
6753  */
6754 typedef struct MUST_USE_STRUCT LDKWatchedOutput {
6755    /**
6756     * A pointer to the opaque Rust object.
6757     * Nearly everywhere, inner must be non-null, however in places where
6758     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6759     */
6760    LDKnativeWatchedOutput *inner;
6761    /**
6762     * Indicates that this is the only struct which contains the same pointer.
6763     * Rust functions which take ownership of an object provided via an argument require
6764     * this to be true and invalidate the object pointed to by inner.
6765     */
6766    bool is_owned;
6767 } LDKWatchedOutput;
6768
6769 /**
6770  * The `Filter` trait defines behavior for indicating chain activity of interest pertaining to
6771  * channels.
6772  *
6773  * This is useful in order to have a [`Watch`] implementation convey to a chain source which
6774  * transactions to be notified of. Notification may take the form of pre-filtering blocks or, in
6775  * the case of [BIP 157]/[BIP 158], only fetching a block if the compact filter matches. If
6776  * receiving full blocks from a chain source, any further filtering is unnecessary.
6777  *
6778  * After an output has been registered, subsequent block retrievals from the chain source must not
6779  * exclude any transactions matching the new criteria nor any in-block descendants of such
6780  * transactions.
6781  *
6782  * Note that use as part of a [`Watch`] implementation involves reentrancy. Therefore, the `Filter`
6783  * should not block on I/O. Implementations should instead queue the newly monitored data to be
6784  * processed later. Then, in order to block until the data has been processed, any [`Watch`]
6785  * invocation that has called the `Filter` must return [`TemporaryFailure`].
6786  *
6787  * [`TemporaryFailure`]: channelmonitor::ChannelMonitorUpdateErr::TemporaryFailure
6788  * [BIP 157]: https://github.com/bitcoin/bips/blob/master/bip-0157.mediawiki
6789  * [BIP 158]: https://github.com/bitcoin/bips/blob/master/bip-0158.mediawiki
6790  */
6791 typedef struct LDKFilter {
6792    /**
6793     * An opaque pointer which is passed to your function implementations as an argument.
6794     * This has no meaning in the LDK, and can be NULL or any other value.
6795     */
6796    void *this_arg;
6797    /**
6798     * Registers interest in a transaction with `txid` and having an output with `script_pubkey` as
6799     * a spending condition.
6800     */
6801    void (*register_tx)(const void *this_arg, const uint8_t (*txid)[32], struct LDKu8slice script_pubkey);
6802    /**
6803     * Registers interest in spends of a transaction output.
6804     *
6805     * Optionally, when `output.block_hash` is set, should return any transaction spending the
6806     * output that is found in the corresponding block along with its index.
6807     *
6808     * This return value is useful for Electrum clients in order to supply in-block descendant
6809     * transactions which otherwise were not included. This is not necessary for other clients if
6810     * such descendant transactions were already included (e.g., when a BIP 157 client provides the
6811     * full block).
6812     */
6813    struct LDKCOption_C2Tuple_usizeTransactionZZ (*register_output)(const void *this_arg, struct LDKWatchedOutput output);
6814    /**
6815     * Frees any resources associated with this object given its this_arg pointer.
6816     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
6817     */
6818    void (*free)(void *this_arg);
6819 } LDKFilter;
6820
6821 /**
6822  * `Persist` defines behavior for persisting channel monitors: this could mean
6823  * writing once to disk, and/or uploading to one or more backup services.
6824  *
6825  * Note that for every new monitor, you **must** persist the new `ChannelMonitor`
6826  * to disk/backups. And, on every update, you **must** persist either the
6827  * `ChannelMonitorUpdate` or the updated monitor itself. Otherwise, there is risk
6828  * of situations such as revoking a transaction, then crashing before this
6829  * revocation can be persisted, then unintentionally broadcasting a revoked
6830  * transaction and losing money. This is a risk because previous channel states
6831  * are toxic, so it's important that whatever channel state is persisted is
6832  * kept up-to-date.
6833  */
6834 typedef struct LDKPersist {
6835    /**
6836     * An opaque pointer which is passed to your function implementations as an argument.
6837     * This has no meaning in the LDK, and can be NULL or any other value.
6838     */
6839    void *this_arg;
6840    /**
6841     * Persist a new channel's data. The data can be stored any way you want, but
6842     * the identifier provided by Rust-Lightning is the channel's outpoint (and
6843     * it is up to you to maintain a correct mapping between the outpoint and the
6844     * stored channel data). Note that you **must** persist every new monitor to
6845     * disk. See the `Persist` trait documentation for more details.
6846     *
6847     * See [`ChannelMonitor::write`] for writing out a `ChannelMonitor`,
6848     * and [`ChannelMonitorUpdateErr`] for requirements when returning errors.
6849     */
6850    struct LDKCResult_NoneChannelMonitorUpdateErrZ (*persist_new_channel)(const void *this_arg, struct LDKOutPoint id, const struct LDKChannelMonitor *NONNULL_PTR data);
6851    /**
6852     * Update one channel's data. The provided `ChannelMonitor` has already
6853     * applied the given update.
6854     *
6855     * Note that on every update, you **must** persist either the
6856     * `ChannelMonitorUpdate` or the updated monitor itself to disk/backups. See
6857     * the `Persist` trait documentation for more details.
6858     *
6859     * If an implementer chooses to persist the updates only, they need to make
6860     * sure that all the updates are applied to the `ChannelMonitors` *before*
6861     * the set of channel monitors is given to the `ChannelManager`
6862     * deserialization routine. See [`ChannelMonitor::update_monitor`] for
6863     * applying a monitor update to a monitor. If full `ChannelMonitors` are
6864     * persisted, then there is no need to persist individual updates.
6865     *
6866     * Note that there could be a performance tradeoff between persisting complete
6867     * channel monitors on every update vs. persisting only updates and applying
6868     * them in batches. The size of each monitor grows `O(number of state updates)`
6869     * whereas updates are small and `O(1)`.
6870     *
6871     * See [`ChannelMonitor::write`] for writing out a `ChannelMonitor`,
6872     * [`ChannelMonitorUpdate::write`] for writing out an update, and
6873     * [`ChannelMonitorUpdateErr`] for requirements when returning errors.
6874     */
6875    struct LDKCResult_NoneChannelMonitorUpdateErrZ (*update_persisted_channel)(const void *this_arg, struct LDKOutPoint id, const struct LDKChannelMonitorUpdate *NONNULL_PTR update, const struct LDKChannelMonitor *NONNULL_PTR data);
6876    /**
6877     * Frees any resources associated with this object given its this_arg pointer.
6878     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
6879     */
6880    void (*free)(void *this_arg);
6881 } LDKPersist;
6882
6883
6884
6885 /**
6886  * An implementation of [`chain::Watch`] for monitoring channels.
6887  *
6888  * Connected and disconnected blocks must be provided to `ChainMonitor` as documented by
6889  * [`chain::Watch`]. May be used in conjunction with [`ChannelManager`] to monitor channels locally
6890  * or used independently to monitor channels remotely. See the [module-level documentation] for
6891  * details.
6892  *
6893  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
6894  * [module-level documentation]: crate::chain::chainmonitor
6895  */
6896 typedef struct MUST_USE_STRUCT LDKChainMonitor {
6897    /**
6898     * A pointer to the opaque Rust object.
6899     * Nearly everywhere, inner must be non-null, however in places where
6900     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6901     */
6902    LDKnativeChainMonitor *inner;
6903    /**
6904     * Indicates that this is the only struct which contains the same pointer.
6905     * Rust functions which take ownership of an object provided via an argument require
6906     * this to be true and invalidate the object pointed to by inner.
6907     */
6908    bool is_owned;
6909 } LDKChainMonitor;
6910
6911
6912
6913 /**
6914  * Simple KeysInterface implementor that takes a 32-byte seed for use as a BIP 32 extended key
6915  * and derives keys from that.
6916  *
6917  * Your node_id is seed/0'
6918  * ChannelMonitor closes may use seed/1'
6919  * Cooperative closes may use seed/2'
6920  * The two close keys may be needed to claim on-chain funds!
6921  */
6922 typedef struct MUST_USE_STRUCT LDKKeysManager {
6923    /**
6924     * A pointer to the opaque Rust object.
6925     * Nearly everywhere, inner must be non-null, however in places where
6926     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6927     */
6928    LDKnativeKeysManager *inner;
6929    /**
6930     * Indicates that this is the only struct which contains the same pointer.
6931     * Rust functions which take ownership of an object provided via an argument require
6932     * this to be true and invalidate the object pointed to by inner.
6933     */
6934    bool is_owned;
6935 } LDKKeysManager;
6936
6937
6938
6939 /**
6940  * Chain-related parameters used to construct a new `ChannelManager`.
6941  *
6942  * Typically, the block-specific parameters are derived from the best block hash for the network,
6943  * as a newly constructed `ChannelManager` will not have created any channels yet. These parameters
6944  * are not needed when deserializing a previously constructed `ChannelManager`.
6945  */
6946 typedef struct MUST_USE_STRUCT LDKChainParameters {
6947    /**
6948     * A pointer to the opaque Rust object.
6949     * Nearly everywhere, inner must be non-null, however in places where
6950     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6951     */
6952    LDKnativeChainParameters *inner;
6953    /**
6954     * Indicates that this is the only struct which contains the same pointer.
6955     * Rust functions which take ownership of an object provided via an argument require
6956     * this to be true and invalidate the object pointed to by inner.
6957     */
6958    bool is_owned;
6959 } LDKChainParameters;
6960
6961
6962
6963 /**
6964  * The best known block as identified by its hash and height.
6965  */
6966 typedef struct MUST_USE_STRUCT LDKBestBlock {
6967    /**
6968     * A pointer to the opaque Rust object.
6969     * Nearly everywhere, inner must be non-null, however in places where
6970     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6971     */
6972    LDKnativeBestBlock *inner;
6973    /**
6974     * Indicates that this is the only struct which contains the same pointer.
6975     * Rust functions which take ownership of an object provided via an argument require
6976     * this to be true and invalidate the object pointed to by inner.
6977     */
6978    bool is_owned;
6979 } LDKBestBlock;
6980
6981 /**
6982  * A 3-byte byte array.
6983  */
6984 typedef struct LDKThreeBytes {
6985    /**
6986     * The three bytes
6987     */
6988    uint8_t data[3];
6989 } LDKThreeBytes;
6990
6991 /**
6992  * A trait to describe an object which can receive channel messages.
6993  *
6994  * Messages MAY be called in parallel when they originate from different their_node_ids, however
6995  * they MUST NOT be called in parallel when the two calls have the same their_node_id.
6996  */
6997 typedef struct LDKChannelMessageHandler {
6998    /**
6999     * An opaque pointer which is passed to your function implementations as an argument.
7000     * This has no meaning in the LDK, and can be NULL or any other value.
7001     */
7002    void *this_arg;
7003    /**
7004     * Handle an incoming open_channel message from the given peer.
7005     */
7006    void (*handle_open_channel)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKInitFeatures their_features, const struct LDKOpenChannel *NONNULL_PTR msg);
7007    /**
7008     * Handle an incoming accept_channel message from the given peer.
7009     */
7010    void (*handle_accept_channel)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKInitFeatures their_features, const struct LDKAcceptChannel *NONNULL_PTR msg);
7011    /**
7012     * Handle an incoming funding_created message from the given peer.
7013     */
7014    void (*handle_funding_created)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingCreated *NONNULL_PTR msg);
7015    /**
7016     * Handle an incoming funding_signed message from the given peer.
7017     */
7018    void (*handle_funding_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingSigned *NONNULL_PTR msg);
7019    /**
7020     * Handle an incoming funding_locked message from the given peer.
7021     */
7022    void (*handle_funding_locked)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingLocked *NONNULL_PTR msg);
7023    /**
7024     * Handle an incoming shutdown message from the given peer.
7025     */
7026    void (*handle_shutdown)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInitFeatures *NONNULL_PTR their_features, const struct LDKShutdown *NONNULL_PTR msg);
7027    /**
7028     * Handle an incoming closing_signed message from the given peer.
7029     */
7030    void (*handle_closing_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKClosingSigned *NONNULL_PTR msg);
7031    /**
7032     * Handle an incoming update_add_htlc message from the given peer.
7033     */
7034    void (*handle_update_add_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateAddHTLC *NONNULL_PTR msg);
7035    /**
7036     * Handle an incoming update_fulfill_htlc message from the given peer.
7037     */
7038    void (*handle_update_fulfill_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFulfillHTLC *NONNULL_PTR msg);
7039    /**
7040     * Handle an incoming update_fail_htlc message from the given peer.
7041     */
7042    void (*handle_update_fail_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFailHTLC *NONNULL_PTR msg);
7043    /**
7044     * Handle an incoming update_fail_malformed_htlc message from the given peer.
7045     */
7046    void (*handle_update_fail_malformed_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR msg);
7047    /**
7048     * Handle an incoming commitment_signed message from the given peer.
7049     */
7050    void (*handle_commitment_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKCommitmentSigned *NONNULL_PTR msg);
7051    /**
7052     * Handle an incoming revoke_and_ack message from the given peer.
7053     */
7054    void (*handle_revoke_and_ack)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKRevokeAndACK *NONNULL_PTR msg);
7055    /**
7056     * Handle an incoming update_fee message from the given peer.
7057     */
7058    void (*handle_update_fee)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFee *NONNULL_PTR msg);
7059    /**
7060     * Handle an incoming announcement_signatures message from the given peer.
7061     */
7062    void (*handle_announcement_signatures)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKAnnouncementSignatures *NONNULL_PTR msg);
7063    /**
7064     * Indicates a connection to the peer failed/an existing connection was lost. If no connection
7065     * is believed to be possible in the future (eg they're sending us messages we don't
7066     * understand or indicate they require unknown feature bits), no_connection_possible is set
7067     * and any outstanding channels should be failed.
7068     */
7069    void (*peer_disconnected)(const void *this_arg, struct LDKPublicKey their_node_id, bool no_connection_possible);
7070    /**
7071     * Handle a peer reconnecting, possibly generating channel_reestablish message(s).
7072     */
7073    void (*peer_connected)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR msg);
7074    /**
7075     * Handle an incoming channel_reestablish message from the given peer.
7076     */
7077    void (*handle_channel_reestablish)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelReestablish *NONNULL_PTR msg);
7078    /**
7079     * Handle an incoming channel update from the given peer.
7080     */
7081    void (*handle_channel_update)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelUpdate *NONNULL_PTR msg);
7082    /**
7083     * Handle an incoming error message from the given peer.
7084     */
7085    void (*handle_error)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKErrorMessage *NONNULL_PTR msg);
7086    /**
7087     * Implementation of MessageSendEventsProvider for this object.
7088     */
7089    struct LDKMessageSendEventsProvider MessageSendEventsProvider;
7090    /**
7091     * Frees any resources associated with this object given its this_arg pointer.
7092     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7093     */
7094    void (*free)(void *this_arg);
7095 } LDKChannelMessageHandler;
7096
7097
7098
7099 /**
7100  * Arguments for the creation of a ChannelManager that are not deserialized.
7101  *
7102  * At a high-level, the process for deserializing a ChannelManager and resuming normal operation
7103  * is:
7104  * 1) Deserialize all stored ChannelMonitors.
7105  * 2) Deserialize the ChannelManager by filling in this struct and calling:
7106  *    <(BlockHash, ChannelManager)>::read(reader, args)
7107  *    This may result in closing some Channels if the ChannelMonitor is newer than the stored
7108  *    ChannelManager state to ensure no loss of funds. Thus, transactions may be broadcasted.
7109  * 3) If you are not fetching full blocks, register all relevant ChannelMonitor outpoints the same
7110  *    way you would handle a `chain::Filter` call using ChannelMonitor::get_outputs_to_watch() and
7111  *    ChannelMonitor::get_funding_txo().
7112  * 4) Reconnect blocks on your ChannelMonitors.
7113  * 5) Disconnect/connect blocks on the ChannelManager.
7114  * 6) Move the ChannelMonitors into your local chain::Watch.
7115  *
7116  * Note that the ordering of #4-6 is not of importance, however all three must occur before you
7117  * call any other methods on the newly-deserialized ChannelManager.
7118  *
7119  * Note that because some channels may be closed during deserialization, it is critical that you
7120  * always deserialize only the latest version of a ChannelManager and ChannelMonitors available to
7121  * you. If you deserialize an old ChannelManager (during which force-closure transactions may be
7122  * broadcast), and then later deserialize a newer version of the same ChannelManager (which will
7123  * not force-close the same channels but consider them live), you may end up revoking a state for
7124  * which you've already broadcasted the transaction.
7125  */
7126 typedef struct MUST_USE_STRUCT LDKChannelManagerReadArgs {
7127    /**
7128     * A pointer to the opaque Rust object.
7129     * Nearly everywhere, inner must be non-null, however in places where
7130     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7131     */
7132    LDKnativeChannelManagerReadArgs *inner;
7133    /**
7134     * Indicates that this is the only struct which contains the same pointer.
7135     * Rust functions which take ownership of an object provided via an argument require
7136     * this to be true and invalidate the object pointed to by inner.
7137     */
7138    bool is_owned;
7139 } LDKChannelManagerReadArgs;
7140
7141
7142
7143 /**
7144  * Proof that the sender knows the per-commitment secret of the previous commitment transaction.
7145  * This is used to convince the recipient that the channel is at a certain commitment
7146  * number even if they lost that data due to a local failure.  Of course, the peer may lie
7147  * and even later commitments may have been revoked.
7148  */
7149 typedef struct MUST_USE_STRUCT LDKDataLossProtect {
7150    /**
7151     * A pointer to the opaque Rust object.
7152     * Nearly everywhere, inner must be non-null, however in places where
7153     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7154     */
7155    LDKnativeDataLossProtect *inner;
7156    /**
7157     * Indicates that this is the only struct which contains the same pointer.
7158     * Rust functions which take ownership of an object provided via an argument require
7159     * this to be true and invalidate the object pointed to by inner.
7160     */
7161    bool is_owned;
7162 } LDKDataLossProtect;
7163
7164 /**
7165  * A trait to describe an object which can receive routing messages.
7166  *
7167  * # Implementor DoS Warnings
7168  *
7169  * For `gossip_queries` messages there are potential DoS vectors when handling
7170  * inbound queries. Implementors using an on-disk network graph should be aware of
7171  * repeated disk I/O for queries accessing different parts of the network graph.
7172  */
7173 typedef struct LDKRoutingMessageHandler {
7174    /**
7175     * An opaque pointer which is passed to your function implementations as an argument.
7176     * This has no meaning in the LDK, and can be NULL or any other value.
7177     */
7178    void *this_arg;
7179    /**
7180     * Handle an incoming node_announcement message, returning true if it should be forwarded on,
7181     * false or returning an Err otherwise.
7182     */
7183    struct LDKCResult_boolLightningErrorZ (*handle_node_announcement)(const void *this_arg, const struct LDKNodeAnnouncement *NONNULL_PTR msg);
7184    /**
7185     * Handle a channel_announcement message, returning true if it should be forwarded on, false
7186     * or returning an Err otherwise.
7187     */
7188    struct LDKCResult_boolLightningErrorZ (*handle_channel_announcement)(const void *this_arg, const struct LDKChannelAnnouncement *NONNULL_PTR msg);
7189    /**
7190     * Handle an incoming channel_update message, returning true if it should be forwarded on,
7191     * false or returning an Err otherwise.
7192     */
7193    struct LDKCResult_boolLightningErrorZ (*handle_channel_update)(const void *this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg);
7194    /**
7195     * Handle some updates to the route graph that we learned due to an outbound failed payment.
7196     */
7197    void (*handle_htlc_fail_channel_update)(const void *this_arg, const struct LDKHTLCFailChannelUpdate *NONNULL_PTR update);
7198    /**
7199     * Gets a subset of the channel announcements and updates required to dump our routing table
7200     * to a remote node, starting at the short_channel_id indicated by starting_point and
7201     * including the batch_amount entries immediately higher in numerical value than starting_point.
7202     */
7203    struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ (*get_next_channel_announcements)(const void *this_arg, uint64_t starting_point, uint8_t batch_amount);
7204    /**
7205     * Gets a subset of the node announcements required to dump our routing table to a remote node,
7206     * starting at the node *after* the provided publickey and including batch_amount entries
7207     * immediately higher (as defined by <PublicKey as Ord>::cmp) than starting_point.
7208     * If None is provided for starting_point, we start at the first node.
7209     */
7210    struct LDKCVec_NodeAnnouncementZ (*get_next_node_announcements)(const void *this_arg, struct LDKPublicKey starting_point, uint8_t batch_amount);
7211    /**
7212     * Called when a connection is established with a peer. This can be used to
7213     * perform routing table synchronization using a strategy defined by the
7214     * implementor.
7215     */
7216    void (*sync_routing_table)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR init);
7217    /**
7218     * Handles the reply of a query we initiated to learn about channels
7219     * for a given range of blocks. We can expect to receive one or more
7220     * replies to a single query.
7221     */
7222    struct LDKCResult_NoneLightningErrorZ (*handle_reply_channel_range)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKReplyChannelRange msg);
7223    /**
7224     * Handles the reply of a query we initiated asking for routing gossip
7225     * messages for a list of channels. We should receive this message when
7226     * a node has completed its best effort to send us the pertaining routing
7227     * gossip messages.
7228     */
7229    struct LDKCResult_NoneLightningErrorZ (*handle_reply_short_channel_ids_end)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKReplyShortChannelIdsEnd msg);
7230    /**
7231     * Handles when a peer asks us to send a list of short_channel_ids
7232     * for the requested range of blocks.
7233     */
7234    struct LDKCResult_NoneLightningErrorZ (*handle_query_channel_range)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKQueryChannelRange msg);
7235    /**
7236     * Handles when a peer asks us to send routing gossip messages for a
7237     * list of short_channel_ids.
7238     */
7239    struct LDKCResult_NoneLightningErrorZ (*handle_query_short_channel_ids)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKQueryShortChannelIds msg);
7240    /**
7241     * Implementation of MessageSendEventsProvider for this object.
7242     */
7243    struct LDKMessageSendEventsProvider MessageSendEventsProvider;
7244    /**
7245     * Frees any resources associated with this object given its this_arg pointer.
7246     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7247     */
7248    void (*free)(void *this_arg);
7249 } LDKRoutingMessageHandler;
7250
7251
7252
7253 /**
7254  * A dummy struct which implements `RoutingMessageHandler` without storing any routing information
7255  * or doing any processing. You can provide one of these as the route_handler in a MessageHandler.
7256  */
7257 typedef struct MUST_USE_STRUCT LDKIgnoringMessageHandler {
7258    /**
7259     * A pointer to the opaque Rust object.
7260     * Nearly everywhere, inner must be non-null, however in places where
7261     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7262     */
7263    LDKnativeIgnoringMessageHandler *inner;
7264    /**
7265     * Indicates that this is the only struct which contains the same pointer.
7266     * Rust functions which take ownership of an object provided via an argument require
7267     * this to be true and invalidate the object pointed to by inner.
7268     */
7269    bool is_owned;
7270 } LDKIgnoringMessageHandler;
7271
7272
7273
7274 /**
7275  * A dummy struct which implements `ChannelMessageHandler` without having any channels.
7276  * You can provide one of these as the route_handler in a MessageHandler.
7277  */
7278 typedef struct MUST_USE_STRUCT LDKErroringMessageHandler {
7279    /**
7280     * A pointer to the opaque Rust object.
7281     * Nearly everywhere, inner must be non-null, however in places where
7282     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7283     */
7284    LDKnativeErroringMessageHandler *inner;
7285    /**
7286     * Indicates that this is the only struct which contains the same pointer.
7287     * Rust functions which take ownership of an object provided via an argument require
7288     * this to be true and invalidate the object pointed to by inner.
7289     */
7290    bool is_owned;
7291 } LDKErroringMessageHandler;
7292
7293
7294
7295 /**
7296  * Provides references to trait impls which handle different types of messages.
7297  */
7298 typedef struct MUST_USE_STRUCT LDKMessageHandler {
7299    /**
7300     * A pointer to the opaque Rust object.
7301     * Nearly everywhere, inner must be non-null, however in places where
7302     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7303     */
7304    LDKnativeMessageHandler *inner;
7305    /**
7306     * Indicates that this is the only struct which contains the same pointer.
7307     * Rust functions which take ownership of an object provided via an argument require
7308     * this to be true and invalidate the object pointed to by inner.
7309     */
7310    bool is_owned;
7311 } LDKMessageHandler;
7312
7313 /**
7314  * Provides an object which can be used to send data to and which uniquely identifies a connection
7315  * to a remote host. You will need to be able to generate multiple of these which meet Eq and
7316  * implement Hash to meet the PeerManager API.
7317  *
7318  * For efficiency, Clone should be relatively cheap for this type.
7319  *
7320  * You probably want to just extend an int and put a file descriptor in a struct and implement
7321  * send_data. Note that if you are using a higher-level net library that may call close() itself,
7322  * be careful to ensure you don't have races whereby you might register a new connection with an
7323  * fd which is the same as a previous one which has yet to be removed via
7324  * PeerManager::socket_disconnected().
7325  */
7326 typedef struct LDKSocketDescriptor {
7327    /**
7328     * An opaque pointer which is passed to your function implementations as an argument.
7329     * This has no meaning in the LDK, and can be NULL or any other value.
7330     */
7331    void *this_arg;
7332    /**
7333     * Attempts to send some data from the given slice to the peer.
7334     *
7335     * Returns the amount of data which was sent, possibly 0 if the socket has since disconnected.
7336     * Note that in the disconnected case, socket_disconnected must still fire and further write
7337     * attempts may occur until that time.
7338     *
7339     * If the returned size is smaller than data.len(), a write_available event must
7340     * trigger the next time more data can be written. Additionally, until the a send_data event
7341     * completes fully, no further read_events should trigger on the same peer!
7342     *
7343     * If a read_event on this descriptor had previously returned true (indicating that read
7344     * events should be paused to prevent DoS in the send buffer), resume_read may be set
7345     * indicating that read events on this descriptor should resume. A resume_read of false does
7346     * *not* imply that further read events should be paused.
7347     */
7348    uintptr_t (*send_data)(void *this_arg, struct LDKu8slice data, bool resume_read);
7349    /**
7350     * Disconnect the socket pointed to by this SocketDescriptor. Once this function returns, no
7351     * more calls to write_buffer_space_avail, read_event or socket_disconnected may be made with
7352     * this descriptor. No socket_disconnected call should be generated as a result of this call,
7353     * though races may occur whereby disconnect_socket is called after a call to
7354     * socket_disconnected but prior to socket_disconnected returning.
7355     */
7356    void (*disconnect_socket)(void *this_arg);
7357    /**
7358     * Checks if two objects are equal given this object's this_arg pointer and another object.
7359     */
7360    bool (*eq)(const void *this_arg, const struct LDKSocketDescriptor *NONNULL_PTR other_arg);
7361    /**
7362     * Calculate a succinct non-cryptographic hash for an object given its this_arg pointer.
7363     * This is used, for example, for inclusion of this object in a hash map.
7364     */
7365    uint64_t (*hash)(const void *this_arg);
7366    /**
7367     * Creates a copy of the object pointed to by this_arg, for a copy of this SocketDescriptor.
7368     * Note that the ultimate copy of the SocketDescriptor will have all function pointers the same as the original.
7369     * May be NULL if no action needs to be taken, the this_arg pointer will be copied into the new SocketDescriptor.
7370     */
7371    void *(*clone)(const void *this_arg);
7372    /**
7373     * Frees any resources associated with this object given its this_arg pointer.
7374     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7375     */
7376    void (*free)(void *this_arg);
7377 } LDKSocketDescriptor;
7378
7379
7380
7381 /**
7382  * A PeerManager manages a set of peers, described by their SocketDescriptor and marshalls socket
7383  * events into messages which it passes on to its MessageHandlers.
7384  *
7385  * Rather than using a plain PeerManager, it is preferable to use either a SimpleArcPeerManager
7386  * a SimpleRefPeerManager, for conciseness. See their documentation for more details, but
7387  * essentially you should default to using a SimpleRefPeerManager, and use a
7388  * SimpleArcPeerManager when you require a PeerManager with a static lifetime, such as when
7389  * you're using lightning-net-tokio.
7390  */
7391 typedef struct MUST_USE_STRUCT LDKPeerManager {
7392    /**
7393     * A pointer to the opaque Rust object.
7394     * Nearly everywhere, inner must be non-null, however in places where
7395     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7396     */
7397    LDKnativePeerManager *inner;
7398    /**
7399     * Indicates that this is the only struct which contains the same pointer.
7400     * Rust functions which take ownership of an object provided via an argument require
7401     * this to be true and invalidate the object pointed to by inner.
7402     */
7403    bool is_owned;
7404 } LDKPeerManager;
7405
7406
7407
7408 /**
7409  * Static channel fields used to build transactions given per-commitment fields, organized by
7410  * broadcaster/countersignatory.
7411  *
7412  * This is derived from the holder/counterparty-organized ChannelTransactionParameters via the
7413  * as_holder_broadcastable and as_counterparty_broadcastable functions.
7414  */
7415 typedef struct MUST_USE_STRUCT LDKDirectedChannelTransactionParameters {
7416    /**
7417     * A pointer to the opaque Rust object.
7418     * Nearly everywhere, inner must be non-null, however in places where
7419     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7420     */
7421    LDKnativeDirectedChannelTransactionParameters *inner;
7422    /**
7423     * Indicates that this is the only struct which contains the same pointer.
7424     * Rust functions which take ownership of an object provided via an argument require
7425     * this to be true and invalidate the object pointed to by inner.
7426     */
7427    bool is_owned;
7428 } LDKDirectedChannelTransactionParameters;
7429
7430
7431
7432 /**
7433  * A simple newtype for RwLockReadGuard<'a, NetworkGraph>.
7434  * This exists only to make accessing a RwLock<NetworkGraph> possible from
7435  * the C bindings, as it can be done directly in Rust code.
7436  */
7437 typedef struct MUST_USE_STRUCT LDKLockedNetworkGraph {
7438    /**
7439     * A pointer to the opaque Rust object.
7440     * Nearly everywhere, inner must be non-null, however in places where
7441     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7442     */
7443    LDKnativeLockedNetworkGraph *inner;
7444    /**
7445     * Indicates that this is the only struct which contains the same pointer.
7446     * Rust functions which take ownership of an object provided via an argument require
7447     * this to be true and invalidate the object pointed to by inner.
7448     */
7449    bool is_owned;
7450 } LDKLockedNetworkGraph;
7451
7452
7453
7454 /**
7455  * Receives and validates network updates from peers,
7456  * stores authentic and relevant data as a network graph.
7457  * This network graph is then used for routing payments.
7458  * Provides interface to help with initial routing sync by
7459  * serving historical announcements.
7460  */
7461 typedef struct MUST_USE_STRUCT LDKNetGraphMsgHandler {
7462    /**
7463     * A pointer to the opaque Rust object.
7464     * Nearly everywhere, inner must be non-null, however in places where
7465     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7466     */
7467    LDKnativeNetGraphMsgHandler *inner;
7468    /**
7469     * Indicates that this is the only struct which contains the same pointer.
7470     * Rust functions which take ownership of an object provided via an argument require
7471     * this to be true and invalidate the object pointed to by inner.
7472     */
7473    bool is_owned;
7474 } LDKNetGraphMsgHandler;
7475
7476 extern const uintptr_t MAX_BUF_SIZE;
7477
7478 extern const uint64_t MIN_RELAY_FEE_SAT_PER_1000_WEIGHT;
7479
7480 extern const uint64_t CLOSED_CHANNEL_UPDATE_ID;
7481
7482 extern const uint16_t BREAKDOWN_TIMEOUT;
7483
7484 extern const uint16_t MIN_CLTV_EXPIRY_DELTA;
7485
7486 extern const uintptr_t REVOKEABLE_REDEEMSCRIPT_MAX_LENGTH;
7487
7488 /**
7489  * Frees the data buffer, if data_is_owned is set and datalen > 0.
7490  */
7491 void Transaction_free(struct LDKTransaction _res);
7492
7493 /**
7494  * Frees the data pointed to by script_pubkey.
7495  */
7496 void TxOut_free(struct LDKTxOut _res);
7497
7498 /**
7499  * Creates a new TxOut which has the same data as `orig` but with a new script buffer.
7500  */
7501 struct LDKTxOut TxOut_clone(const struct LDKTxOut *NONNULL_PTR orig);
7502
7503 /**
7504  * Creates a new CResult_ChannelConfigDecodeErrorZ in the success state.
7505  */
7506 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_ok(struct LDKChannelConfig o);
7507
7508 /**
7509  * Creates a new CResult_ChannelConfigDecodeErrorZ in the error state.
7510  */
7511 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_err(struct LDKDecodeError e);
7512
7513 /**
7514  * Frees any resources used by the CResult_ChannelConfigDecodeErrorZ.
7515  */
7516 void CResult_ChannelConfigDecodeErrorZ_free(struct LDKCResult_ChannelConfigDecodeErrorZ _res);
7517
7518 /**
7519  * Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig`
7520  * but with all dynamically-allocated buffers duplicated in new buffers.
7521  */
7522 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_clone(const struct LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR orig);
7523
7524 /**
7525  * Creates a new CResult_OutPointDecodeErrorZ in the success state.
7526  */
7527 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_ok(struct LDKOutPoint o);
7528
7529 /**
7530  * Creates a new CResult_OutPointDecodeErrorZ in the error state.
7531  */
7532 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_err(struct LDKDecodeError e);
7533
7534 /**
7535  * Frees any resources used by the CResult_OutPointDecodeErrorZ.
7536  */
7537 void CResult_OutPointDecodeErrorZ_free(struct LDKCResult_OutPointDecodeErrorZ _res);
7538
7539 /**
7540  * Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig`
7541  * but with all dynamically-allocated buffers duplicated in new buffers.
7542  */
7543 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_clone(const struct LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR orig);
7544
7545 /**
7546  * Creates a new CResult_SecretKeyErrorZ in the success state.
7547  */
7548 struct LDKCResult_SecretKeyErrorZ CResult_SecretKeyErrorZ_ok(struct LDKSecretKey o);
7549
7550 /**
7551  * Creates a new CResult_SecretKeyErrorZ in the error state.
7552  */
7553 struct LDKCResult_SecretKeyErrorZ CResult_SecretKeyErrorZ_err(enum LDKSecp256k1Error e);
7554
7555 /**
7556  * Frees any resources used by the CResult_SecretKeyErrorZ.
7557  */
7558 void CResult_SecretKeyErrorZ_free(struct LDKCResult_SecretKeyErrorZ _res);
7559
7560 /**
7561  * Creates a new CResult_PublicKeyErrorZ in the success state.
7562  */
7563 struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_ok(struct LDKPublicKey o);
7564
7565 /**
7566  * Creates a new CResult_PublicKeyErrorZ in the error state.
7567  */
7568 struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_err(enum LDKSecp256k1Error e);
7569
7570 /**
7571  * Frees any resources used by the CResult_PublicKeyErrorZ.
7572  */
7573 void CResult_PublicKeyErrorZ_free(struct LDKCResult_PublicKeyErrorZ _res);
7574
7575 /**
7576  * Creates a new CResult_TxCreationKeysDecodeErrorZ in the success state.
7577  */
7578 struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_ok(struct LDKTxCreationKeys o);
7579
7580 /**
7581  * Creates a new CResult_TxCreationKeysDecodeErrorZ in the error state.
7582  */
7583 struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_err(struct LDKDecodeError e);
7584
7585 /**
7586  * Frees any resources used by the CResult_TxCreationKeysDecodeErrorZ.
7587  */
7588 void CResult_TxCreationKeysDecodeErrorZ_free(struct LDKCResult_TxCreationKeysDecodeErrorZ _res);
7589
7590 /**
7591  * Creates a new CResult_TxCreationKeysDecodeErrorZ which has the same data as `orig`
7592  * but with all dynamically-allocated buffers duplicated in new buffers.
7593  */
7594 struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_clone(const struct LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR orig);
7595
7596 /**
7597  * Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the success state.
7598  */
7599 struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_ok(struct LDKChannelPublicKeys o);
7600
7601 /**
7602  * Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the error state.
7603  */
7604 struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_err(struct LDKDecodeError e);
7605
7606 /**
7607  * Frees any resources used by the CResult_ChannelPublicKeysDecodeErrorZ.
7608  */
7609 void CResult_ChannelPublicKeysDecodeErrorZ_free(struct LDKCResult_ChannelPublicKeysDecodeErrorZ _res);
7610
7611 /**
7612  * Creates a new CResult_ChannelPublicKeysDecodeErrorZ which has the same data as `orig`
7613  * but with all dynamically-allocated buffers duplicated in new buffers.
7614  */
7615 struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_clone(const struct LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR orig);
7616
7617 /**
7618  * Creates a new CResult_TxCreationKeysErrorZ in the success state.
7619  */
7620 struct LDKCResult_TxCreationKeysErrorZ CResult_TxCreationKeysErrorZ_ok(struct LDKTxCreationKeys o);
7621
7622 /**
7623  * Creates a new CResult_TxCreationKeysErrorZ in the error state.
7624  */
7625 struct LDKCResult_TxCreationKeysErrorZ CResult_TxCreationKeysErrorZ_err(enum LDKSecp256k1Error e);
7626
7627 /**
7628  * Frees any resources used by the CResult_TxCreationKeysErrorZ.
7629  */
7630 void CResult_TxCreationKeysErrorZ_free(struct LDKCResult_TxCreationKeysErrorZ _res);
7631
7632 /**
7633  * Constructs a new COption_u32Z containing a u32
7634  */
7635 struct LDKCOption_u32Z COption_u32Z_some(uint32_t o);
7636
7637 /**
7638  * Constructs a new COption_u32Z containing nothing
7639  */
7640 struct LDKCOption_u32Z COption_u32Z_none(void);
7641
7642 /**
7643  * Frees any resources associated with the u32, if we are in the Some state
7644  */
7645 void COption_u32Z_free(struct LDKCOption_u32Z _res);
7646
7647 /**
7648  * Creates a new COption_u32Z which has the same data as `orig`
7649  * but with all dynamically-allocated buffers duplicated in new buffers.
7650  */
7651 struct LDKCOption_u32Z COption_u32Z_clone(const struct LDKCOption_u32Z *NONNULL_PTR orig);
7652
7653 /**
7654  * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the success state.
7655  */
7656 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(struct LDKHTLCOutputInCommitment o);
7657
7658 /**
7659  * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the error state.
7660  */
7661 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_err(struct LDKDecodeError e);
7662
7663 /**
7664  * Frees any resources used by the CResult_HTLCOutputInCommitmentDecodeErrorZ.
7665  */
7666 void CResult_HTLCOutputInCommitmentDecodeErrorZ_free(struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res);
7667
7668 /**
7669  * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ which has the same data as `orig`
7670  * but with all dynamically-allocated buffers duplicated in new buffers.
7671  */
7672 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(const struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR orig);
7673
7674 /**
7675  * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the success state.
7676  */
7677 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(struct LDKCounterpartyChannelTransactionParameters o);
7678
7679 /**
7680  * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the error state.
7681  */
7682 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(struct LDKDecodeError e);
7683
7684 /**
7685  * Frees any resources used by the CResult_CounterpartyChannelTransactionParametersDecodeErrorZ.
7686  */
7687 void CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res);
7688
7689 /**
7690  * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
7691  * but with all dynamically-allocated buffers duplicated in new buffers.
7692  */
7693 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(const struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR orig);
7694
7695 /**
7696  * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the success state.
7697  */
7698 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_ok(struct LDKChannelTransactionParameters o);
7699
7700 /**
7701  * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the error state.
7702  */
7703 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_err(struct LDKDecodeError e);
7704
7705 /**
7706  * Frees any resources used by the CResult_ChannelTransactionParametersDecodeErrorZ.
7707  */
7708 void CResult_ChannelTransactionParametersDecodeErrorZ_free(struct LDKCResult_ChannelTransactionParametersDecodeErrorZ _res);
7709
7710 /**
7711  * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
7712  * but with all dynamically-allocated buffers duplicated in new buffers.
7713  */
7714 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_clone(const struct LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR orig);
7715
7716 /**
7717  * Frees the buffer pointed to by `data` if `datalen` is non-0.
7718  */
7719 void CVec_SignatureZ_free(struct LDKCVec_SignatureZ _res);
7720
7721 /**
7722  * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the success state.
7723  */
7724 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_ok(struct LDKHolderCommitmentTransaction o);
7725
7726 /**
7727  * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the error state.
7728  */
7729 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
7730
7731 /**
7732  * Frees any resources used by the CResult_HolderCommitmentTransactionDecodeErrorZ.
7733  */
7734 void CResult_HolderCommitmentTransactionDecodeErrorZ_free(struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res);
7735
7736 /**
7737  * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ which has the same data as `orig`
7738  * but with all dynamically-allocated buffers duplicated in new buffers.
7739  */
7740 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
7741
7742 /**
7743  * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the success state.
7744  */
7745 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(struct LDKBuiltCommitmentTransaction o);
7746
7747 /**
7748  * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the error state.
7749  */
7750 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
7751
7752 /**
7753  * Frees any resources used by the CResult_BuiltCommitmentTransactionDecodeErrorZ.
7754  */
7755 void CResult_BuiltCommitmentTransactionDecodeErrorZ_free(struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res);
7756
7757 /**
7758  * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ which has the same data as `orig`
7759  * but with all dynamically-allocated buffers duplicated in new buffers.
7760  */
7761 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
7762
7763 /**
7764  * Creates a new CResult_CommitmentTransactionDecodeErrorZ in the success state.
7765  */
7766 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_ok(struct LDKCommitmentTransaction o);
7767
7768 /**
7769  * Creates a new CResult_CommitmentTransactionDecodeErrorZ in the error state.
7770  */
7771 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
7772
7773 /**
7774  * Frees any resources used by the CResult_CommitmentTransactionDecodeErrorZ.
7775  */
7776 void CResult_CommitmentTransactionDecodeErrorZ_free(struct LDKCResult_CommitmentTransactionDecodeErrorZ _res);
7777
7778 /**
7779  * Creates a new CResult_CommitmentTransactionDecodeErrorZ which has the same data as `orig`
7780  * but with all dynamically-allocated buffers duplicated in new buffers.
7781  */
7782 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
7783
7784 /**
7785  * Creates a new CResult_TrustedCommitmentTransactionNoneZ in the success state.
7786  */
7787 struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_ok(struct LDKTrustedCommitmentTransaction o);
7788
7789 /**
7790  * Creates a new CResult_TrustedCommitmentTransactionNoneZ in the error state.
7791  */
7792 struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_err(void);
7793
7794 /**
7795  * Frees any resources used by the CResult_TrustedCommitmentTransactionNoneZ.
7796  */
7797 void CResult_TrustedCommitmentTransactionNoneZ_free(struct LDKCResult_TrustedCommitmentTransactionNoneZ _res);
7798
7799 /**
7800  * Creates a new CResult_CVec_SignatureZNoneZ in the success state.
7801  */
7802 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_ok(struct LDKCVec_SignatureZ o);
7803
7804 /**
7805  * Creates a new CResult_CVec_SignatureZNoneZ in the error state.
7806  */
7807 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_err(void);
7808
7809 /**
7810  * Frees any resources used by the CResult_CVec_SignatureZNoneZ.
7811  */
7812 void CResult_CVec_SignatureZNoneZ_free(struct LDKCResult_CVec_SignatureZNoneZ _res);
7813
7814 /**
7815  * Creates a new CResult_CVec_SignatureZNoneZ which has the same data as `orig`
7816  * but with all dynamically-allocated buffers duplicated in new buffers.
7817  */
7818 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_clone(const struct LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR orig);
7819
7820 /**
7821  * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
7822  */
7823 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_ok(struct LDKChannelMonitorUpdate o);
7824
7825 /**
7826  * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
7827  */
7828 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_err(struct LDKDecodeError e);
7829
7830 /**
7831  * Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
7832  */
7833 void CResult_ChannelMonitorUpdateDecodeErrorZ_free(struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res);
7834
7835 /**
7836  * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
7837  * but with all dynamically-allocated buffers duplicated in new buffers.
7838  */
7839 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_clone(const struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR orig);
7840
7841 /**
7842  * Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
7843  */
7844 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_ok(struct LDKHTLCUpdate o);
7845
7846 /**
7847  * Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
7848  */
7849 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_err(struct LDKDecodeError e);
7850
7851 /**
7852  * Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
7853  */
7854 void CResult_HTLCUpdateDecodeErrorZ_free(struct LDKCResult_HTLCUpdateDecodeErrorZ _res);
7855
7856 /**
7857  * Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
7858  * but with all dynamically-allocated buffers duplicated in new buffers.
7859  */
7860 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_clone(const struct LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR orig);
7861
7862 /**
7863  * Creates a new CResult_NoneMonitorUpdateErrorZ in the success state.
7864  */
7865 struct LDKCResult_NoneMonitorUpdateErrorZ CResult_NoneMonitorUpdateErrorZ_ok(void);
7866
7867 /**
7868  * Creates a new CResult_NoneMonitorUpdateErrorZ in the error state.
7869  */
7870 struct LDKCResult_NoneMonitorUpdateErrorZ CResult_NoneMonitorUpdateErrorZ_err(struct LDKMonitorUpdateError e);
7871
7872 /**
7873  * Frees any resources used by the CResult_NoneMonitorUpdateErrorZ.
7874  */
7875 void CResult_NoneMonitorUpdateErrorZ_free(struct LDKCResult_NoneMonitorUpdateErrorZ _res);
7876
7877 /**
7878  * Creates a new CResult_NoneMonitorUpdateErrorZ which has the same data as `orig`
7879  * but with all dynamically-allocated buffers duplicated in new buffers.
7880  */
7881 struct LDKCResult_NoneMonitorUpdateErrorZ CResult_NoneMonitorUpdateErrorZ_clone(const struct LDKCResult_NoneMonitorUpdateErrorZ *NONNULL_PTR orig);
7882
7883 /**
7884  * Creates a new C2Tuple_OutPointScriptZ from the contained elements.
7885  */
7886 struct LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_new(struct LDKOutPoint a, struct LDKCVec_u8Z b);
7887
7888 /**
7889  * Frees any resources used by the C2Tuple_OutPointScriptZ.
7890  */
7891 void C2Tuple_OutPointScriptZ_free(struct LDKC2Tuple_OutPointScriptZ _res);
7892
7893 /**
7894  * Creates a new C2Tuple_u32ScriptZ from the contained elements.
7895  */
7896 struct LDKC2Tuple_u32ScriptZ C2Tuple_u32ScriptZ_new(uint32_t a, struct LDKCVec_u8Z b);
7897
7898 /**
7899  * Frees any resources used by the C2Tuple_u32ScriptZ.
7900  */
7901 void C2Tuple_u32ScriptZ_free(struct LDKC2Tuple_u32ScriptZ _res);
7902
7903 /**
7904  * Frees the buffer pointed to by `data` if `datalen` is non-0.
7905  */
7906 void CVec_C2Tuple_u32ScriptZZ_free(struct LDKCVec_C2Tuple_u32ScriptZZ _res);
7907
7908 /**
7909  * Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements.
7910  */
7911 struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32ScriptZZ b);
7912
7913 /**
7914  * Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ.
7915  */
7916 void C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res);
7917
7918 /**
7919  * Frees the buffer pointed to by `data` if `datalen` is non-0.
7920  */
7921 void CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res);
7922
7923 /**
7924  * Frees the buffer pointed to by `data` if `datalen` is non-0.
7925  */
7926 void CVec_MonitorEventZ_free(struct LDKCVec_MonitorEventZ _res);
7927
7928 /**
7929  * Frees the buffer pointed to by `data` if `datalen` is non-0.
7930  */
7931 void CVec_EventZ_free(struct LDKCVec_EventZ _res);
7932
7933 /**
7934  * Frees the buffer pointed to by `data` if `datalen` is non-0.
7935  */
7936 void CVec_TransactionZ_free(struct LDKCVec_TransactionZ _res);
7937
7938 /**
7939  * Creates a new C2Tuple_usizeTransactionZ from the contained elements.
7940  */
7941 struct LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_new(uintptr_t a, struct LDKTransaction b);
7942
7943 /**
7944  * Frees any resources used by the C2Tuple_usizeTransactionZ.
7945  */
7946 void C2Tuple_usizeTransactionZ_free(struct LDKC2Tuple_usizeTransactionZ _res);
7947
7948 /**
7949  * Frees the buffer pointed to by `data` if `datalen` is non-0.
7950  */
7951 void CVec_C2Tuple_usizeTransactionZZ_free(struct LDKCVec_C2Tuple_usizeTransactionZZ _res);
7952
7953 /**
7954  * Creates a new tuple which has the same data as `orig`
7955  * but with all dynamically-allocated buffers duplicated in new buffers.
7956  */
7957 struct LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_clone(const struct LDKC2Tuple_u32TxOutZ *NONNULL_PTR orig);
7958
7959 /**
7960  * Creates a new C2Tuple_u32TxOutZ from the contained elements.
7961  */
7962 struct LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_new(uint32_t a, struct LDKTxOut b);
7963
7964 /**
7965  * Frees any resources used by the C2Tuple_u32TxOutZ.
7966  */
7967 void C2Tuple_u32TxOutZ_free(struct LDKC2Tuple_u32TxOutZ _res);
7968
7969 /**
7970  * Frees the buffer pointed to by `data` if `datalen` is non-0.
7971  */
7972 void CVec_C2Tuple_u32TxOutZZ_free(struct LDKCVec_C2Tuple_u32TxOutZZ _res);
7973
7974 /**
7975  * Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements.
7976  */
7977 struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32TxOutZZ b);
7978
7979 /**
7980  * Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ.
7981  */
7982 void C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res);
7983
7984 /**
7985  * Frees the buffer pointed to by `data` if `datalen` is non-0.
7986  */
7987 void CVec_TransactionOutputsZ_free(struct LDKCVec_TransactionOutputsZ _res);
7988
7989 /**
7990  * Frees the buffer pointed to by `data` if `datalen` is non-0.
7991  */
7992 void CVec_TxidZ_free(struct LDKCVec_TxidZ _res);
7993
7994 /**
7995  * Creates a new CResult_NoneChannelMonitorUpdateErrZ in the success state.
7996  */
7997 struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_ok(void);
7998
7999 /**
8000  * Creates a new CResult_NoneChannelMonitorUpdateErrZ in the error state.
8001  */
8002 struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_err(enum LDKChannelMonitorUpdateErr e);
8003
8004 /**
8005  * Frees any resources used by the CResult_NoneChannelMonitorUpdateErrZ.
8006  */
8007 void CResult_NoneChannelMonitorUpdateErrZ_free(struct LDKCResult_NoneChannelMonitorUpdateErrZ _res);
8008
8009 /**
8010  * Creates a new CResult_NoneChannelMonitorUpdateErrZ which has the same data as `orig`
8011  * but with all dynamically-allocated buffers duplicated in new buffers.
8012  */
8013 struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_clone(const struct LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR orig);
8014
8015 /**
8016  * Creates a new C2Tuple_BlockHashChannelMonitorZ from the contained elements.
8017  */
8018 struct LDKC2Tuple_BlockHashChannelMonitorZ C2Tuple_BlockHashChannelMonitorZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelMonitor b);
8019
8020 /**
8021  * Frees any resources used by the C2Tuple_BlockHashChannelMonitorZ.
8022  */
8023 void C2Tuple_BlockHashChannelMonitorZ_free(struct LDKC2Tuple_BlockHashChannelMonitorZ _res);
8024
8025 /**
8026  * Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state.
8027  */
8028 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelMonitorZ o);
8029
8030 /**
8031  * Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state.
8032  */
8033 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(struct LDKDecodeError e);
8034
8035 /**
8036  * Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.
8037  */
8038 void CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res);
8039
8040 /**
8041  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8042  */
8043 void CVec_RouteHopZ_free(struct LDKCVec_RouteHopZ _res);
8044
8045 /**
8046  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8047  */
8048 void CVec_CVec_RouteHopZZ_free(struct LDKCVec_CVec_RouteHopZZ _res);
8049
8050 /**
8051  * Creates a new CResult_RouteDecodeErrorZ in the success state.
8052  */
8053 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_ok(struct LDKRoute o);
8054
8055 /**
8056  * Creates a new CResult_RouteDecodeErrorZ in the error state.
8057  */
8058 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_err(struct LDKDecodeError e);
8059
8060 /**
8061  * Frees any resources used by the CResult_RouteDecodeErrorZ.
8062  */
8063 void CResult_RouteDecodeErrorZ_free(struct LDKCResult_RouteDecodeErrorZ _res);
8064
8065 /**
8066  * Creates a new CResult_RouteDecodeErrorZ which has the same data as `orig`
8067  * but with all dynamically-allocated buffers duplicated in new buffers.
8068  */
8069 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_clone(const struct LDKCResult_RouteDecodeErrorZ *NONNULL_PTR orig);
8070
8071 /**
8072  * Constructs a new COption_u64Z containing a u64
8073  */
8074 struct LDKCOption_u64Z COption_u64Z_some(uint64_t o);
8075
8076 /**
8077  * Constructs a new COption_u64Z containing nothing
8078  */
8079 struct LDKCOption_u64Z COption_u64Z_none(void);
8080
8081 /**
8082  * Frees any resources associated with the u64, if we are in the Some state
8083  */
8084 void COption_u64Z_free(struct LDKCOption_u64Z _res);
8085
8086 /**
8087  * Creates a new COption_u64Z which has the same data as `orig`
8088  * but with all dynamically-allocated buffers duplicated in new buffers.
8089  */
8090 struct LDKCOption_u64Z COption_u64Z_clone(const struct LDKCOption_u64Z *NONNULL_PTR orig);
8091
8092 /**
8093  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8094  */
8095 void CVec_ChannelDetailsZ_free(struct LDKCVec_ChannelDetailsZ _res);
8096
8097 /**
8098  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8099  */
8100 void CVec_RouteHintZ_free(struct LDKCVec_RouteHintZ _res);
8101
8102 /**
8103  * Creates a new CResult_RouteLightningErrorZ in the success state.
8104  */
8105 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_ok(struct LDKRoute o);
8106
8107 /**
8108  * Creates a new CResult_RouteLightningErrorZ in the error state.
8109  */
8110 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_err(struct LDKLightningError e);
8111
8112 /**
8113  * Frees any resources used by the CResult_RouteLightningErrorZ.
8114  */
8115 void CResult_RouteLightningErrorZ_free(struct LDKCResult_RouteLightningErrorZ _res);
8116
8117 /**
8118  * Creates a new CResult_RouteLightningErrorZ which has the same data as `orig`
8119  * but with all dynamically-allocated buffers duplicated in new buffers.
8120  */
8121 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_clone(const struct LDKCResult_RouteLightningErrorZ *NONNULL_PTR orig);
8122
8123 /**
8124  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8125  */
8126 void CVec_MessageSendEventZ_free(struct LDKCVec_MessageSendEventZ _res);
8127
8128 /**
8129  * Creates a new CResult_boolLightningErrorZ in the success state.
8130  */
8131 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_ok(bool o);
8132
8133 /**
8134  * Creates a new CResult_boolLightningErrorZ in the error state.
8135  */
8136 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_err(struct LDKLightningError e);
8137
8138 /**
8139  * Frees any resources used by the CResult_boolLightningErrorZ.
8140  */
8141 void CResult_boolLightningErrorZ_free(struct LDKCResult_boolLightningErrorZ _res);
8142
8143 /**
8144  * Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
8145  * but with all dynamically-allocated buffers duplicated in new buffers.
8146  */
8147 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_clone(const struct LDKCResult_boolLightningErrorZ *NONNULL_PTR orig);
8148
8149 /**
8150  * Creates a new tuple which has the same data as `orig`
8151  * but with all dynamically-allocated buffers duplicated in new buffers.
8152  */
8153 struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(const struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR orig);
8154
8155 /**
8156  * Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
8157  */
8158 struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(struct LDKChannelAnnouncement a, struct LDKChannelUpdate b, struct LDKChannelUpdate c);
8159
8160 /**
8161  * Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
8162  */
8163 void C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res);
8164
8165 /**
8166  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8167  */
8168 void CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res);
8169
8170 /**
8171  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8172  */
8173 void CVec_NodeAnnouncementZ_free(struct LDKCVec_NodeAnnouncementZ _res);
8174
8175 /**
8176  * Creates a new CResult_NoneLightningErrorZ in the success state.
8177  */
8178 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_ok(void);
8179
8180 /**
8181  * Creates a new CResult_NoneLightningErrorZ in the error state.
8182  */
8183 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_err(struct LDKLightningError e);
8184
8185 /**
8186  * Frees any resources used by the CResult_NoneLightningErrorZ.
8187  */
8188 void CResult_NoneLightningErrorZ_free(struct LDKCResult_NoneLightningErrorZ _res);
8189
8190 /**
8191  * Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
8192  * but with all dynamically-allocated buffers duplicated in new buffers.
8193  */
8194 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_clone(const struct LDKCResult_NoneLightningErrorZ *NONNULL_PTR orig);
8195
8196 /**
8197  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8198  */
8199 void CVec_PublicKeyZ_free(struct LDKCVec_PublicKeyZ _res);
8200
8201 /**
8202  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8203  */
8204 void CVec_u8Z_free(struct LDKCVec_u8Z _res);
8205
8206 /**
8207  * Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
8208  */
8209 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_ok(struct LDKCVec_u8Z o);
8210
8211 /**
8212  * Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
8213  */
8214 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_err(struct LDKPeerHandleError e);
8215
8216 /**
8217  * Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
8218  */
8219 void CResult_CVec_u8ZPeerHandleErrorZ_free(struct LDKCResult_CVec_u8ZPeerHandleErrorZ _res);
8220
8221 /**
8222  * Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
8223  * but with all dynamically-allocated buffers duplicated in new buffers.
8224  */
8225 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_clone(const struct LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR orig);
8226
8227 /**
8228  * Creates a new CResult_NonePeerHandleErrorZ in the success state.
8229  */
8230 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_ok(void);
8231
8232 /**
8233  * Creates a new CResult_NonePeerHandleErrorZ in the error state.
8234  */
8235 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_err(struct LDKPeerHandleError e);
8236
8237 /**
8238  * Frees any resources used by the CResult_NonePeerHandleErrorZ.
8239  */
8240 void CResult_NonePeerHandleErrorZ_free(struct LDKCResult_NonePeerHandleErrorZ _res);
8241
8242 /**
8243  * Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
8244  * but with all dynamically-allocated buffers duplicated in new buffers.
8245  */
8246 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_clone(const struct LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR orig);
8247
8248 /**
8249  * Creates a new CResult_boolPeerHandleErrorZ in the success state.
8250  */
8251 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_ok(bool o);
8252
8253 /**
8254  * Creates a new CResult_boolPeerHandleErrorZ in the error state.
8255  */
8256 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_err(struct LDKPeerHandleError e);
8257
8258 /**
8259  * Frees any resources used by the CResult_boolPeerHandleErrorZ.
8260  */
8261 void CResult_boolPeerHandleErrorZ_free(struct LDKCResult_boolPeerHandleErrorZ _res);
8262
8263 /**
8264  * Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
8265  * but with all dynamically-allocated buffers duplicated in new buffers.
8266  */
8267 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_clone(const struct LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR orig);
8268
8269 /**
8270  * Creates a new CResult_TxOutAccessErrorZ in the success state.
8271  */
8272 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_ok(struct LDKTxOut o);
8273
8274 /**
8275  * Creates a new CResult_TxOutAccessErrorZ in the error state.
8276  */
8277 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_err(enum LDKAccessError e);
8278
8279 /**
8280  * Frees any resources used by the CResult_TxOutAccessErrorZ.
8281  */
8282 void CResult_TxOutAccessErrorZ_free(struct LDKCResult_TxOutAccessErrorZ _res);
8283
8284 /**
8285  * Creates a new CResult_TxOutAccessErrorZ which has the same data as `orig`
8286  * but with all dynamically-allocated buffers duplicated in new buffers.
8287  */
8288 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_clone(const struct LDKCResult_TxOutAccessErrorZ *NONNULL_PTR orig);
8289
8290 /**
8291  * Constructs a new COption_C2Tuple_usizeTransactionZZ containing a crate::c_types::derived::C2Tuple_usizeTransactionZ
8292  */
8293 struct LDKCOption_C2Tuple_usizeTransactionZZ COption_C2Tuple_usizeTransactionZZ_some(struct LDKC2Tuple_usizeTransactionZ o);
8294
8295 /**
8296  * Constructs a new COption_C2Tuple_usizeTransactionZZ containing nothing
8297  */
8298 struct LDKCOption_C2Tuple_usizeTransactionZZ COption_C2Tuple_usizeTransactionZZ_none(void);
8299
8300 /**
8301  * Frees any resources associated with the crate::c_types::derived::C2Tuple_usizeTransactionZ, if we are in the Some state
8302  */
8303 void COption_C2Tuple_usizeTransactionZZ_free(struct LDKCOption_C2Tuple_usizeTransactionZZ _res);
8304
8305 /**
8306  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8307  */
8308 void CVec_SpendableOutputDescriptorZ_free(struct LDKCVec_SpendableOutputDescriptorZ _res);
8309
8310 /**
8311  * Creates a new CResult_DirectionalChannelInfoDecodeErrorZ in the success state.
8312  */
8313 struct LDKCResult_DirectionalChannelInfoDecodeErrorZ CResult_DirectionalChannelInfoDecodeErrorZ_ok(struct LDKDirectionalChannelInfo o);
8314
8315 /**
8316  * Creates a new CResult_DirectionalChannelInfoDecodeErrorZ in the error state.
8317  */
8318 struct LDKCResult_DirectionalChannelInfoDecodeErrorZ CResult_DirectionalChannelInfoDecodeErrorZ_err(struct LDKDecodeError e);
8319
8320 /**
8321  * Frees any resources used by the CResult_DirectionalChannelInfoDecodeErrorZ.
8322  */
8323 void CResult_DirectionalChannelInfoDecodeErrorZ_free(struct LDKCResult_DirectionalChannelInfoDecodeErrorZ _res);
8324
8325 /**
8326  * Creates a new CResult_DirectionalChannelInfoDecodeErrorZ which has the same data as `orig`
8327  * but with all dynamically-allocated buffers duplicated in new buffers.
8328  */
8329 struct LDKCResult_DirectionalChannelInfoDecodeErrorZ CResult_DirectionalChannelInfoDecodeErrorZ_clone(const struct LDKCResult_DirectionalChannelInfoDecodeErrorZ *NONNULL_PTR orig);
8330
8331 /**
8332  * Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
8333  */
8334 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_ok(struct LDKChannelInfo o);
8335
8336 /**
8337  * Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
8338  */
8339 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_err(struct LDKDecodeError e);
8340
8341 /**
8342  * Frees any resources used by the CResult_ChannelInfoDecodeErrorZ.
8343  */
8344 void CResult_ChannelInfoDecodeErrorZ_free(struct LDKCResult_ChannelInfoDecodeErrorZ _res);
8345
8346 /**
8347  * Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig`
8348  * but with all dynamically-allocated buffers duplicated in new buffers.
8349  */
8350 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_clone(const struct LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR orig);
8351
8352 /**
8353  * Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
8354  */
8355 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_ok(struct LDKRoutingFees o);
8356
8357 /**
8358  * Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
8359  */
8360 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_err(struct LDKDecodeError e);
8361
8362 /**
8363  * Frees any resources used by the CResult_RoutingFeesDecodeErrorZ.
8364  */
8365 void CResult_RoutingFeesDecodeErrorZ_free(struct LDKCResult_RoutingFeesDecodeErrorZ _res);
8366
8367 /**
8368  * Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig`
8369  * but with all dynamically-allocated buffers duplicated in new buffers.
8370  */
8371 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_clone(const struct LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR orig);
8372
8373 /**
8374  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8375  */
8376 void CVec_NetAddressZ_free(struct LDKCVec_NetAddressZ _res);
8377
8378 /**
8379  * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
8380  */
8381 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_ok(struct LDKNodeAnnouncementInfo o);
8382
8383 /**
8384  * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
8385  */
8386 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_err(struct LDKDecodeError e);
8387
8388 /**
8389  * Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
8390  */
8391 void CResult_NodeAnnouncementInfoDecodeErrorZ_free(struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res);
8392
8393 /**
8394  * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
8395  * but with all dynamically-allocated buffers duplicated in new buffers.
8396  */
8397 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_clone(const struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR orig);
8398
8399 /**
8400  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8401  */
8402 void CVec_u64Z_free(struct LDKCVec_u64Z _res);
8403
8404 /**
8405  * Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
8406  */
8407 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_ok(struct LDKNodeInfo o);
8408
8409 /**
8410  * Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
8411  */
8412 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_err(struct LDKDecodeError e);
8413
8414 /**
8415  * Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
8416  */
8417 void CResult_NodeInfoDecodeErrorZ_free(struct LDKCResult_NodeInfoDecodeErrorZ _res);
8418
8419 /**
8420  * Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
8421  * but with all dynamically-allocated buffers duplicated in new buffers.
8422  */
8423 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_clone(const struct LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR orig);
8424
8425 /**
8426  * Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
8427  */
8428 struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_ok(struct LDKNetworkGraph o);
8429
8430 /**
8431  * Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
8432  */
8433 struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_err(struct LDKDecodeError e);
8434
8435 /**
8436  * Frees any resources used by the CResult_NetworkGraphDecodeErrorZ.
8437  */
8438 void CResult_NetworkGraphDecodeErrorZ_free(struct LDKCResult_NetworkGraphDecodeErrorZ _res);
8439
8440 /**
8441  * Creates a new CResult_NetworkGraphDecodeErrorZ which has the same data as `orig`
8442  * but with all dynamically-allocated buffers duplicated in new buffers.
8443  */
8444 struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_clone(const struct LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR orig);
8445
8446 /**
8447  * Creates a new CResult_InitFeaturesDecodeErrorZ in the success state.
8448  */
8449 struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_ok(struct LDKInitFeatures o);
8450
8451 /**
8452  * Creates a new CResult_InitFeaturesDecodeErrorZ in the error state.
8453  */
8454 struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
8455
8456 /**
8457  * Frees any resources used by the CResult_InitFeaturesDecodeErrorZ.
8458  */
8459 void CResult_InitFeaturesDecodeErrorZ_free(struct LDKCResult_InitFeaturesDecodeErrorZ _res);
8460
8461 /**
8462  * Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state.
8463  */
8464 struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_ok(struct LDKNodeFeatures o);
8465
8466 /**
8467  * Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state.
8468  */
8469 struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
8470
8471 /**
8472  * Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ.
8473  */
8474 void CResult_NodeFeaturesDecodeErrorZ_free(struct LDKCResult_NodeFeaturesDecodeErrorZ _res);
8475
8476 /**
8477  * Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state.
8478  */
8479 struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_ok(struct LDKChannelFeatures o);
8480
8481 /**
8482  * Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state.
8483  */
8484 struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
8485
8486 /**
8487  * Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ.
8488  */
8489 void CResult_ChannelFeaturesDecodeErrorZ_free(struct LDKCResult_ChannelFeaturesDecodeErrorZ _res);
8490
8491 /**
8492  * Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the success state.
8493  */
8494 struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_ok(struct LDKInvoiceFeatures o);
8495
8496 /**
8497  * Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the error state.
8498  */
8499 struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
8500
8501 /**
8502  * Frees any resources used by the CResult_InvoiceFeaturesDecodeErrorZ.
8503  */
8504 void CResult_InvoiceFeaturesDecodeErrorZ_free(struct LDKCResult_InvoiceFeaturesDecodeErrorZ _res);
8505
8506 /**
8507  * Creates a new CResult_NetAddressu8Z in the success state.
8508  */
8509 struct LDKCResult_NetAddressu8Z CResult_NetAddressu8Z_ok(struct LDKNetAddress o);
8510
8511 /**
8512  * Creates a new CResult_NetAddressu8Z in the error state.
8513  */
8514 struct LDKCResult_NetAddressu8Z CResult_NetAddressu8Z_err(uint8_t e);
8515
8516 /**
8517  * Frees any resources used by the CResult_NetAddressu8Z.
8518  */
8519 void CResult_NetAddressu8Z_free(struct LDKCResult_NetAddressu8Z _res);
8520
8521 /**
8522  * Creates a new CResult_NetAddressu8Z which has the same data as `orig`
8523  * but with all dynamically-allocated buffers duplicated in new buffers.
8524  */
8525 struct LDKCResult_NetAddressu8Z CResult_NetAddressu8Z_clone(const struct LDKCResult_NetAddressu8Z *NONNULL_PTR orig);
8526
8527 /**
8528  * Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ in the success state.
8529  */
8530 struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(struct LDKCResult_NetAddressu8Z o);
8531
8532 /**
8533  * Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ in the error state.
8534  */
8535 struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ CResult_CResult_NetAddressu8ZDecodeErrorZ_err(struct LDKDecodeError e);
8536
8537 /**
8538  * Frees any resources used by the CResult_CResult_NetAddressu8ZDecodeErrorZ.
8539  */
8540 void CResult_CResult_NetAddressu8ZDecodeErrorZ_free(struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ _res);
8541
8542 /**
8543  * Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ which has the same data as `orig`
8544  * but with all dynamically-allocated buffers duplicated in new buffers.
8545  */
8546 struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ CResult_CResult_NetAddressu8ZDecodeErrorZ_clone(const struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *NONNULL_PTR orig);
8547
8548 /**
8549  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8550  */
8551 void CVec_UpdateAddHTLCZ_free(struct LDKCVec_UpdateAddHTLCZ _res);
8552
8553 /**
8554  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8555  */
8556 void CVec_UpdateFulfillHTLCZ_free(struct LDKCVec_UpdateFulfillHTLCZ _res);
8557
8558 /**
8559  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8560  */
8561 void CVec_UpdateFailHTLCZ_free(struct LDKCVec_UpdateFailHTLCZ _res);
8562
8563 /**
8564  * Frees the buffer pointed to by `data` if `datalen` is non-0.
8565  */
8566 void CVec_UpdateFailMalformedHTLCZ_free(struct LDKCVec_UpdateFailMalformedHTLCZ _res);
8567
8568 /**
8569  * Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
8570  */
8571 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_ok(struct LDKAcceptChannel o);
8572
8573 /**
8574  * Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
8575  */
8576 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_err(struct LDKDecodeError e);
8577
8578 /**
8579  * Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
8580  */
8581 void CResult_AcceptChannelDecodeErrorZ_free(struct LDKCResult_AcceptChannelDecodeErrorZ _res);
8582
8583 /**
8584  * Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
8585  * but with all dynamically-allocated buffers duplicated in new buffers.
8586  */
8587 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_clone(const struct LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR orig);
8588
8589 /**
8590  * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
8591  */
8592 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_ok(struct LDKAnnouncementSignatures o);
8593
8594 /**
8595  * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
8596  */
8597 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_err(struct LDKDecodeError e);
8598
8599 /**
8600  * Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
8601  */
8602 void CResult_AnnouncementSignaturesDecodeErrorZ_free(struct LDKCResult_AnnouncementSignaturesDecodeErrorZ _res);
8603
8604 /**
8605  * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
8606  * but with all dynamically-allocated buffers duplicated in new buffers.
8607  */
8608 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_clone(const struct LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR orig);
8609
8610 /**
8611  * Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
8612  */
8613 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_ok(struct LDKChannelReestablish o);
8614
8615 /**
8616  * Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
8617  */
8618 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_err(struct LDKDecodeError e);
8619
8620 /**
8621  * Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
8622  */
8623 void CResult_ChannelReestablishDecodeErrorZ_free(struct LDKCResult_ChannelReestablishDecodeErrorZ _res);
8624
8625 /**
8626  * Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig`
8627  * but with all dynamically-allocated buffers duplicated in new buffers.
8628  */
8629 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_clone(const struct LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR orig);
8630
8631 /**
8632  * Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
8633  */
8634 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_ok(struct LDKClosingSigned o);
8635
8636 /**
8637  * Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
8638  */
8639 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_err(struct LDKDecodeError e);
8640
8641 /**
8642  * Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
8643  */
8644 void CResult_ClosingSignedDecodeErrorZ_free(struct LDKCResult_ClosingSignedDecodeErrorZ _res);
8645
8646 /**
8647  * Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig`
8648  * but with all dynamically-allocated buffers duplicated in new buffers.
8649  */
8650 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_clone(const struct LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR orig);
8651
8652 /**
8653  * Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
8654  */
8655 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_ok(struct LDKCommitmentSigned o);
8656
8657 /**
8658  * Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
8659  */
8660 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_err(struct LDKDecodeError e);
8661
8662 /**
8663  * Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
8664  */
8665 void CResult_CommitmentSignedDecodeErrorZ_free(struct LDKCResult_CommitmentSignedDecodeErrorZ _res);
8666
8667 /**
8668  * Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig`
8669  * but with all dynamically-allocated buffers duplicated in new buffers.
8670  */
8671 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_clone(const struct LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR orig);
8672
8673 /**
8674  * Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
8675  */
8676 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_ok(struct LDKFundingCreated o);
8677
8678 /**
8679  * Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
8680  */
8681 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_err(struct LDKDecodeError e);
8682
8683 /**
8684  * Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
8685  */
8686 void CResult_FundingCreatedDecodeErrorZ_free(struct LDKCResult_FundingCreatedDecodeErrorZ _res);
8687
8688 /**
8689  * Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig`
8690  * but with all dynamically-allocated buffers duplicated in new buffers.
8691  */
8692 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_clone(const struct LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR orig);
8693
8694 /**
8695  * Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
8696  */
8697 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_ok(struct LDKFundingSigned o);
8698
8699 /**
8700  * Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
8701  */
8702 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_err(struct LDKDecodeError e);
8703
8704 /**
8705  * Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
8706  */
8707 void CResult_FundingSignedDecodeErrorZ_free(struct LDKCResult_FundingSignedDecodeErrorZ _res);
8708
8709 /**
8710  * Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
8711  * but with all dynamically-allocated buffers duplicated in new buffers.
8712  */
8713 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_clone(const struct LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR orig);
8714
8715 /**
8716  * Creates a new CResult_FundingLockedDecodeErrorZ in the success state.
8717  */
8718 struct LDKCResult_FundingLockedDecodeErrorZ CResult_FundingLockedDecodeErrorZ_ok(struct LDKFundingLocked o);
8719
8720 /**
8721  * Creates a new CResult_FundingLockedDecodeErrorZ in the error state.
8722  */
8723 struct LDKCResult_FundingLockedDecodeErrorZ CResult_FundingLockedDecodeErrorZ_err(struct LDKDecodeError e);
8724
8725 /**
8726  * Frees any resources used by the CResult_FundingLockedDecodeErrorZ.
8727  */
8728 void CResult_FundingLockedDecodeErrorZ_free(struct LDKCResult_FundingLockedDecodeErrorZ _res);
8729
8730 /**
8731  * Creates a new CResult_FundingLockedDecodeErrorZ which has the same data as `orig`
8732  * but with all dynamically-allocated buffers duplicated in new buffers.
8733  */
8734 struct LDKCResult_FundingLockedDecodeErrorZ CResult_FundingLockedDecodeErrorZ_clone(const struct LDKCResult_FundingLockedDecodeErrorZ *NONNULL_PTR orig);
8735
8736 /**
8737  * Creates a new CResult_InitDecodeErrorZ in the success state.
8738  */
8739 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_ok(struct LDKInit o);
8740
8741 /**
8742  * Creates a new CResult_InitDecodeErrorZ in the error state.
8743  */
8744 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_err(struct LDKDecodeError e);
8745
8746 /**
8747  * Frees any resources used by the CResult_InitDecodeErrorZ.
8748  */
8749 void CResult_InitDecodeErrorZ_free(struct LDKCResult_InitDecodeErrorZ _res);
8750
8751 /**
8752  * Creates a new CResult_InitDecodeErrorZ which has the same data as `orig`
8753  * but with all dynamically-allocated buffers duplicated in new buffers.
8754  */
8755 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_clone(const struct LDKCResult_InitDecodeErrorZ *NONNULL_PTR orig);
8756
8757 /**
8758  * Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
8759  */
8760 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_ok(struct LDKOpenChannel o);
8761
8762 /**
8763  * Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
8764  */
8765 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_err(struct LDKDecodeError e);
8766
8767 /**
8768  * Frees any resources used by the CResult_OpenChannelDecodeErrorZ.
8769  */
8770 void CResult_OpenChannelDecodeErrorZ_free(struct LDKCResult_OpenChannelDecodeErrorZ _res);
8771
8772 /**
8773  * Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig`
8774  * but with all dynamically-allocated buffers duplicated in new buffers.
8775  */
8776 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_clone(const struct LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR orig);
8777
8778 /**
8779  * Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
8780  */
8781 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_ok(struct LDKRevokeAndACK o);
8782
8783 /**
8784  * Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
8785  */
8786 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_err(struct LDKDecodeError e);
8787
8788 /**
8789  * Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ.
8790  */
8791 void CResult_RevokeAndACKDecodeErrorZ_free(struct LDKCResult_RevokeAndACKDecodeErrorZ _res);
8792
8793 /**
8794  * Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig`
8795  * but with all dynamically-allocated buffers duplicated in new buffers.
8796  */
8797 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_clone(const struct LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR orig);
8798
8799 /**
8800  * Creates a new CResult_ShutdownDecodeErrorZ in the success state.
8801  */
8802 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_ok(struct LDKShutdown o);
8803
8804 /**
8805  * Creates a new CResult_ShutdownDecodeErrorZ in the error state.
8806  */
8807 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_err(struct LDKDecodeError e);
8808
8809 /**
8810  * Frees any resources used by the CResult_ShutdownDecodeErrorZ.
8811  */
8812 void CResult_ShutdownDecodeErrorZ_free(struct LDKCResult_ShutdownDecodeErrorZ _res);
8813
8814 /**
8815  * Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig`
8816  * but with all dynamically-allocated buffers duplicated in new buffers.
8817  */
8818 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_clone(const struct LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR orig);
8819
8820 /**
8821  * Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
8822  */
8823 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_ok(struct LDKUpdateFailHTLC o);
8824
8825 /**
8826  * Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
8827  */
8828 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_err(struct LDKDecodeError e);
8829
8830 /**
8831  * Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ.
8832  */
8833 void CResult_UpdateFailHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFailHTLCDecodeErrorZ _res);
8834
8835 /**
8836  * Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
8837  * but with all dynamically-allocated buffers duplicated in new buffers.
8838  */
8839 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR orig);
8840
8841 /**
8842  * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
8843  */
8844 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(struct LDKUpdateFailMalformedHTLC o);
8845
8846 /**
8847  * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
8848  */
8849 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(struct LDKDecodeError e);
8850
8851 /**
8852  * Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ.
8853  */
8854 void CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res);
8855
8856 /**
8857  * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
8858  * but with all dynamically-allocated buffers duplicated in new buffers.
8859  */
8860 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR orig);
8861
8862 /**
8863  * Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
8864  */
8865 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_ok(struct LDKUpdateFee o);
8866
8867 /**
8868  * Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
8869  */
8870 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_err(struct LDKDecodeError e);
8871
8872 /**
8873  * Frees any resources used by the CResult_UpdateFeeDecodeErrorZ.
8874  */
8875 void CResult_UpdateFeeDecodeErrorZ_free(struct LDKCResult_UpdateFeeDecodeErrorZ _res);
8876
8877 /**
8878  * Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig`
8879  * but with all dynamically-allocated buffers duplicated in new buffers.
8880  */
8881 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_clone(const struct LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR orig);
8882
8883 /**
8884  * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
8885  */
8886 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_ok(struct LDKUpdateFulfillHTLC o);
8887
8888 /**
8889  * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
8890  */
8891 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_err(struct LDKDecodeError e);
8892
8893 /**
8894  * Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ.
8895  */
8896 void CResult_UpdateFulfillHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res);
8897
8898 /**
8899  * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
8900  * but with all dynamically-allocated buffers duplicated in new buffers.
8901  */
8902 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR orig);
8903
8904 /**
8905  * Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
8906  */
8907 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_ok(struct LDKUpdateAddHTLC o);
8908
8909 /**
8910  * Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
8911  */
8912 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_err(struct LDKDecodeError e);
8913
8914 /**
8915  * Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ.
8916  */
8917 void CResult_UpdateAddHTLCDecodeErrorZ_free(struct LDKCResult_UpdateAddHTLCDecodeErrorZ _res);
8918
8919 /**
8920  * Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
8921  * but with all dynamically-allocated buffers duplicated in new buffers.
8922  */
8923 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR orig);
8924
8925 /**
8926  * Creates a new CResult_PingDecodeErrorZ in the success state.
8927  */
8928 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_ok(struct LDKPing o);
8929
8930 /**
8931  * Creates a new CResult_PingDecodeErrorZ in the error state.
8932  */
8933 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_err(struct LDKDecodeError e);
8934
8935 /**
8936  * Frees any resources used by the CResult_PingDecodeErrorZ.
8937  */
8938 void CResult_PingDecodeErrorZ_free(struct LDKCResult_PingDecodeErrorZ _res);
8939
8940 /**
8941  * Creates a new CResult_PingDecodeErrorZ which has the same data as `orig`
8942  * but with all dynamically-allocated buffers duplicated in new buffers.
8943  */
8944 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_clone(const struct LDKCResult_PingDecodeErrorZ *NONNULL_PTR orig);
8945
8946 /**
8947  * Creates a new CResult_PongDecodeErrorZ in the success state.
8948  */
8949 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_ok(struct LDKPong o);
8950
8951 /**
8952  * Creates a new CResult_PongDecodeErrorZ in the error state.
8953  */
8954 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_err(struct LDKDecodeError e);
8955
8956 /**
8957  * Frees any resources used by the CResult_PongDecodeErrorZ.
8958  */
8959 void CResult_PongDecodeErrorZ_free(struct LDKCResult_PongDecodeErrorZ _res);
8960
8961 /**
8962  * Creates a new CResult_PongDecodeErrorZ which has the same data as `orig`
8963  * but with all dynamically-allocated buffers duplicated in new buffers.
8964  */
8965 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_clone(const struct LDKCResult_PongDecodeErrorZ *NONNULL_PTR orig);
8966
8967 /**
8968  * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
8969  */
8970 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(struct LDKUnsignedChannelAnnouncement o);
8971
8972 /**
8973  * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
8974  */
8975 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
8976
8977 /**
8978  * Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
8979  */
8980 void CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res);
8981
8982 /**
8983  * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
8984  * but with all dynamically-allocated buffers duplicated in new buffers.
8985  */
8986 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(const struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR orig);
8987
8988 /**
8989  * Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
8990  */
8991 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_ok(struct LDKChannelAnnouncement o);
8992
8993 /**
8994  * Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
8995  */
8996 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
8997
8998 /**
8999  * Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
9000  */
9001 void CResult_ChannelAnnouncementDecodeErrorZ_free(struct LDKCResult_ChannelAnnouncementDecodeErrorZ _res);
9002
9003 /**
9004  * Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
9005  * but with all dynamically-allocated buffers duplicated in new buffers.
9006  */
9007 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_clone(const struct LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR orig);
9008
9009 /**
9010  * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
9011  */
9012 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_ok(struct LDKUnsignedChannelUpdate o);
9013
9014 /**
9015  * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
9016  */
9017 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_err(struct LDKDecodeError e);
9018
9019 /**
9020  * Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
9021  */
9022 void CResult_UnsignedChannelUpdateDecodeErrorZ_free(struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res);
9023
9024 /**
9025  * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
9026  * but with all dynamically-allocated buffers duplicated in new buffers.
9027  */
9028 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_clone(const struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR orig);
9029
9030 /**
9031  * Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
9032  */
9033 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_ok(struct LDKChannelUpdate o);
9034
9035 /**
9036  * Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
9037  */
9038 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_err(struct LDKDecodeError e);
9039
9040 /**
9041  * Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
9042  */
9043 void CResult_ChannelUpdateDecodeErrorZ_free(struct LDKCResult_ChannelUpdateDecodeErrorZ _res);
9044
9045 /**
9046  * Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
9047  * but with all dynamically-allocated buffers duplicated in new buffers.
9048  */
9049 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_clone(const struct LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR orig);
9050
9051 /**
9052  * Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
9053  */
9054 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_ok(struct LDKErrorMessage o);
9055
9056 /**
9057  * Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
9058  */
9059 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_err(struct LDKDecodeError e);
9060
9061 /**
9062  * Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
9063  */
9064 void CResult_ErrorMessageDecodeErrorZ_free(struct LDKCResult_ErrorMessageDecodeErrorZ _res);
9065
9066 /**
9067  * Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
9068  * but with all dynamically-allocated buffers duplicated in new buffers.
9069  */
9070 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_clone(const struct LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR orig);
9071
9072 /**
9073  * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
9074  */
9075 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(struct LDKUnsignedNodeAnnouncement o);
9076
9077 /**
9078  * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
9079  */
9080 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
9081
9082 /**
9083  * Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
9084  */
9085 void CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res);
9086
9087 /**
9088  * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
9089  * but with all dynamically-allocated buffers duplicated in new buffers.
9090  */
9091 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(const struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR orig);
9092
9093 /**
9094  * Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
9095  */
9096 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_ok(struct LDKNodeAnnouncement o);
9097
9098 /**
9099  * Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
9100  */
9101 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
9102
9103 /**
9104  * Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
9105  */
9106 void CResult_NodeAnnouncementDecodeErrorZ_free(struct LDKCResult_NodeAnnouncementDecodeErrorZ _res);
9107
9108 /**
9109  * Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
9110  * but with all dynamically-allocated buffers duplicated in new buffers.
9111  */
9112 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_clone(const struct LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR orig);
9113
9114 /**
9115  * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
9116  */
9117 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_ok(struct LDKQueryShortChannelIds o);
9118
9119 /**
9120  * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
9121  */
9122 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_err(struct LDKDecodeError e);
9123
9124 /**
9125  * Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
9126  */
9127 void CResult_QueryShortChannelIdsDecodeErrorZ_free(struct LDKCResult_QueryShortChannelIdsDecodeErrorZ _res);
9128
9129 /**
9130  * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
9131  * but with all dynamically-allocated buffers duplicated in new buffers.
9132  */
9133 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_clone(const struct LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR orig);
9134
9135 /**
9136  * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
9137  */
9138 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(struct LDKReplyShortChannelIdsEnd o);
9139
9140 /**
9141  * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
9142  */
9143 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(struct LDKDecodeError e);
9144
9145 /**
9146  * Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
9147  */
9148 void CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res);
9149
9150 /**
9151  * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
9152  * but with all dynamically-allocated buffers duplicated in new buffers.
9153  */
9154 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(const struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR orig);
9155
9156 /**
9157  * Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
9158  */
9159 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_ok(struct LDKQueryChannelRange o);
9160
9161 /**
9162  * Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
9163  */
9164 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_err(struct LDKDecodeError e);
9165
9166 /**
9167  * Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
9168  */
9169 void CResult_QueryChannelRangeDecodeErrorZ_free(struct LDKCResult_QueryChannelRangeDecodeErrorZ _res);
9170
9171 /**
9172  * Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
9173  * but with all dynamically-allocated buffers duplicated in new buffers.
9174  */
9175 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_clone(const struct LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR orig);
9176
9177 /**
9178  * Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
9179  */
9180 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_ok(struct LDKReplyChannelRange o);
9181
9182 /**
9183  * Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
9184  */
9185 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_err(struct LDKDecodeError e);
9186
9187 /**
9188  * Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
9189  */
9190 void CResult_ReplyChannelRangeDecodeErrorZ_free(struct LDKCResult_ReplyChannelRangeDecodeErrorZ _res);
9191
9192 /**
9193  * Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
9194  * but with all dynamically-allocated buffers duplicated in new buffers.
9195  */
9196 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_clone(const struct LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR orig);
9197
9198 /**
9199  * Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
9200  */
9201 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_ok(struct LDKGossipTimestampFilter o);
9202
9203 /**
9204  * Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
9205  */
9206 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_err(struct LDKDecodeError e);
9207
9208 /**
9209  * Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
9210  */
9211 void CResult_GossipTimestampFilterDecodeErrorZ_free(struct LDKCResult_GossipTimestampFilterDecodeErrorZ _res);
9212
9213 /**
9214  * Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
9215  * but with all dynamically-allocated buffers duplicated in new buffers.
9216  */
9217 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_clone(const struct LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR orig);
9218
9219 /**
9220  * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state.
9221  */
9222 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_ok(struct LDKSpendableOutputDescriptor o);
9223
9224 /**
9225  * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state.
9226  */
9227 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e);
9228
9229 /**
9230  * Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ.
9231  */
9232 void CResult_SpendableOutputDescriptorDecodeErrorZ_free(struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res);
9233
9234 /**
9235  * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig`
9236  * but with all dynamically-allocated buffers duplicated in new buffers.
9237  */
9238 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR orig);
9239
9240 /**
9241  * Creates a new tuple which has the same data as `orig`
9242  * but with all dynamically-allocated buffers duplicated in new buffers.
9243  */
9244 struct LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_clone(const struct LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR orig);
9245
9246 /**
9247  * Creates a new C2Tuple_SignatureCVec_SignatureZZ from the contained elements.
9248  */
9249 struct LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_new(struct LDKSignature a, struct LDKCVec_SignatureZ b);
9250
9251 /**
9252  * Frees any resources used by the C2Tuple_SignatureCVec_SignatureZZ.
9253  */
9254 void C2Tuple_SignatureCVec_SignatureZZ_free(struct LDKC2Tuple_SignatureCVec_SignatureZZ _res);
9255
9256 /**
9257  * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the success state.
9258  */
9259 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(struct LDKC2Tuple_SignatureCVec_SignatureZZ o);
9260
9261 /**
9262  * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the error state.
9263  */
9264 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err(void);
9265
9266 /**
9267  * Frees any resources used by the CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ.
9268  */
9269 void CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res);
9270
9271 /**
9272  * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ which has the same data as `orig`
9273  * but with all dynamically-allocated buffers duplicated in new buffers.
9274  */
9275 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(const struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR orig);
9276
9277 /**
9278  * Creates a new CResult_SignatureNoneZ in the success state.
9279  */
9280 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_ok(struct LDKSignature o);
9281
9282 /**
9283  * Creates a new CResult_SignatureNoneZ in the error state.
9284  */
9285 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_err(void);
9286
9287 /**
9288  * Frees any resources used by the CResult_SignatureNoneZ.
9289  */
9290 void CResult_SignatureNoneZ_free(struct LDKCResult_SignatureNoneZ _res);
9291
9292 /**
9293  * Creates a new CResult_SignatureNoneZ which has the same data as `orig`
9294  * but with all dynamically-allocated buffers duplicated in new buffers.
9295  */
9296 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_clone(const struct LDKCResult_SignatureNoneZ *NONNULL_PTR orig);
9297
9298 /**
9299  * Creates a new CResult_SignDecodeErrorZ in the success state.
9300  */
9301 struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_ok(struct LDKSign o);
9302
9303 /**
9304  * Creates a new CResult_SignDecodeErrorZ in the error state.
9305  */
9306 struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_err(struct LDKDecodeError e);
9307
9308 /**
9309  * Frees any resources used by the CResult_SignDecodeErrorZ.
9310  */
9311 void CResult_SignDecodeErrorZ_free(struct LDKCResult_SignDecodeErrorZ _res);
9312
9313 /**
9314  * Creates a new CResult_SignDecodeErrorZ which has the same data as `orig`
9315  * but with all dynamically-allocated buffers duplicated in new buffers.
9316  */
9317 struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_clone(const struct LDKCResult_SignDecodeErrorZ *NONNULL_PTR orig);
9318
9319 /**
9320  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9321  */
9322 void CVec_CVec_u8ZZ_free(struct LDKCVec_CVec_u8ZZ _res);
9323
9324 /**
9325  * Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state.
9326  */
9327 struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_ok(struct LDKCVec_CVec_u8ZZ o);
9328
9329 /**
9330  * Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state.
9331  */
9332 struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_err(void);
9333
9334 /**
9335  * Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ.
9336  */
9337 void CResult_CVec_CVec_u8ZZNoneZ_free(struct LDKCResult_CVec_CVec_u8ZZNoneZ _res);
9338
9339 /**
9340  * Creates a new CResult_CVec_CVec_u8ZZNoneZ which has the same data as `orig`
9341  * but with all dynamically-allocated buffers duplicated in new buffers.
9342  */
9343 struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_clone(const struct LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR orig);
9344
9345 /**
9346  * Creates a new CResult_InMemorySignerDecodeErrorZ in the success state.
9347  */
9348 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_ok(struct LDKInMemorySigner o);
9349
9350 /**
9351  * Creates a new CResult_InMemorySignerDecodeErrorZ in the error state.
9352  */
9353 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_err(struct LDKDecodeError e);
9354
9355 /**
9356  * Frees any resources used by the CResult_InMemorySignerDecodeErrorZ.
9357  */
9358 void CResult_InMemorySignerDecodeErrorZ_free(struct LDKCResult_InMemorySignerDecodeErrorZ _res);
9359
9360 /**
9361  * Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig`
9362  * but with all dynamically-allocated buffers duplicated in new buffers.
9363  */
9364 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_clone(const struct LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR orig);
9365
9366 /**
9367  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9368  */
9369 void CVec_TxOutZ_free(struct LDKCVec_TxOutZ _res);
9370
9371 /**
9372  * Creates a new CResult_TransactionNoneZ in the success state.
9373  */
9374 struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_ok(struct LDKTransaction o);
9375
9376 /**
9377  * Creates a new CResult_TransactionNoneZ in the error state.
9378  */
9379 struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_err(void);
9380
9381 /**
9382  * Frees any resources used by the CResult_TransactionNoneZ.
9383  */
9384 void CResult_TransactionNoneZ_free(struct LDKCResult_TransactionNoneZ _res);
9385
9386 /**
9387  * Creates a new CResult_NoneAPIErrorZ in the success state.
9388  */
9389 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_ok(void);
9390
9391 /**
9392  * Creates a new CResult_NoneAPIErrorZ in the error state.
9393  */
9394 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_err(struct LDKAPIError e);
9395
9396 /**
9397  * Frees any resources used by the CResult_NoneAPIErrorZ.
9398  */
9399 void CResult_NoneAPIErrorZ_free(struct LDKCResult_NoneAPIErrorZ _res);
9400
9401 /**
9402  * Creates a new CResult_NoneAPIErrorZ which has the same data as `orig`
9403  * but with all dynamically-allocated buffers duplicated in new buffers.
9404  */
9405 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_clone(const struct LDKCResult_NoneAPIErrorZ *NONNULL_PTR orig);
9406
9407 /**
9408  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9409  */
9410 void CVec_CResult_NoneAPIErrorZZ_free(struct LDKCVec_CResult_NoneAPIErrorZZ _res);
9411
9412 /**
9413  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9414  */
9415 void CVec_APIErrorZ_free(struct LDKCVec_APIErrorZ _res);
9416
9417 /**
9418  * Creates a new CResult_NonePaymentSendFailureZ in the success state.
9419  */
9420 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_ok(void);
9421
9422 /**
9423  * Creates a new CResult_NonePaymentSendFailureZ in the error state.
9424  */
9425 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_err(struct LDKPaymentSendFailure e);
9426
9427 /**
9428  * Frees any resources used by the CResult_NonePaymentSendFailureZ.
9429  */
9430 void CResult_NonePaymentSendFailureZ_free(struct LDKCResult_NonePaymentSendFailureZ _res);
9431
9432 /**
9433  * Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
9434  * but with all dynamically-allocated buffers duplicated in new buffers.
9435  */
9436 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_clone(const struct LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR orig);
9437
9438 /**
9439  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9440  */
9441 void CVec_ChannelMonitorZ_free(struct LDKCVec_ChannelMonitorZ _res);
9442
9443 /**
9444  * Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements.
9445  */
9446 struct LDKC2Tuple_BlockHashChannelManagerZ C2Tuple_BlockHashChannelManagerZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelManager b);
9447
9448 /**
9449  * Frees any resources used by the C2Tuple_BlockHashChannelManagerZ.
9450  */
9451 void C2Tuple_BlockHashChannelManagerZ_free(struct LDKC2Tuple_BlockHashChannelManagerZ _res);
9452
9453 /**
9454  * Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state.
9455  */
9456 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelManagerZ o);
9457
9458 /**
9459  * Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state.
9460  */
9461 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(struct LDKDecodeError e);
9462
9463 /**
9464  * Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.
9465  */
9466 void CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res);
9467
9468 /**
9469  * Frees any resources used by the Event
9470  */
9471 void Event_free(struct LDKEvent this_ptr);
9472
9473 /**
9474  * Creates a copy of the Event
9475  */
9476 struct LDKEvent Event_clone(const struct LDKEvent *NONNULL_PTR orig);
9477
9478 /**
9479  * Serialize the Event object into a byte array which can be read by Event_read
9480  */
9481 struct LDKCVec_u8Z Event_write(const struct LDKEvent *NONNULL_PTR obj);
9482
9483 /**
9484  * Frees any resources used by the MessageSendEvent
9485  */
9486 void MessageSendEvent_free(struct LDKMessageSendEvent this_ptr);
9487
9488 /**
9489  * Creates a copy of the MessageSendEvent
9490  */
9491 struct LDKMessageSendEvent MessageSendEvent_clone(const struct LDKMessageSendEvent *NONNULL_PTR orig);
9492
9493 /**
9494  * Calls the free function if one is set
9495  */
9496 void MessageSendEventsProvider_free(struct LDKMessageSendEventsProvider this_ptr);
9497
9498 /**
9499  * Calls the free function if one is set
9500  */
9501 void EventsProvider_free(struct LDKEventsProvider this_ptr);
9502
9503 /**
9504  * Frees any resources used by the APIError
9505  */
9506 void APIError_free(struct LDKAPIError this_ptr);
9507
9508 /**
9509  * Creates a copy of the APIError
9510  */
9511 struct LDKAPIError APIError_clone(const struct LDKAPIError *NONNULL_PTR orig);
9512
9513 /**
9514  * Creates a copy of the Level
9515  */
9516 enum LDKLevel Level_clone(const enum LDKLevel *NONNULL_PTR orig);
9517
9518 /**
9519  * Returns the most verbose logging level.
9520  */
9521 MUST_USE_RES enum LDKLevel Level_max(void);
9522
9523 /**
9524  * Calls the free function if one is set
9525  */
9526 void Logger_free(struct LDKLogger this_ptr);
9527
9528 /**
9529  * Frees any resources used by the ChannelHandshakeConfig, if is_owned is set and inner is non-NULL.
9530  */
9531 void ChannelHandshakeConfig_free(struct LDKChannelHandshakeConfig this_obj);
9532
9533 /**
9534  * Confirmations we will wait for before considering the channel locked in.
9535  * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
9536  * equivalent limit applied to outbound channels).
9537  *
9538  * Default value: 6.
9539  */
9540 uint32_t ChannelHandshakeConfig_get_minimum_depth(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
9541
9542 /**
9543  * Confirmations we will wait for before considering the channel locked in.
9544  * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
9545  * equivalent limit applied to outbound channels).
9546  *
9547  * Default value: 6.
9548  */
9549 void ChannelHandshakeConfig_set_minimum_depth(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint32_t val);
9550
9551 /**
9552  * Set to the number of blocks we require our counterparty to wait to claim their money (ie
9553  * the number of blocks we have to punish our counterparty if they broadcast a revoked
9554  * transaction).
9555  *
9556  * This is one of the main parameters of our security model. We (or one of our watchtowers) MUST
9557  * be online to check for revoked transactions on-chain at least once every our_to_self_delay
9558  * blocks (minus some margin to allow us enough time to broadcast and confirm a transaction,
9559  * possibly with time in between to RBF the spending transaction).
9560  *
9561  * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in
9562  * case of an honest unilateral channel close, which implicitly decrease the economic value of
9563  * our channel.
9564  *
9565  * Default value: [`BREAKDOWN_TIMEOUT`], we enforce it as a minimum at channel opening so you
9566  * can tweak config to ask for more security, not less.
9567  */
9568 uint16_t ChannelHandshakeConfig_get_our_to_self_delay(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
9569
9570 /**
9571  * Set to the number of blocks we require our counterparty to wait to claim their money (ie
9572  * the number of blocks we have to punish our counterparty if they broadcast a revoked
9573  * transaction).
9574  *
9575  * This is one of the main parameters of our security model. We (or one of our watchtowers) MUST
9576  * be online to check for revoked transactions on-chain at least once every our_to_self_delay
9577  * blocks (minus some margin to allow us enough time to broadcast and confirm a transaction,
9578  * possibly with time in between to RBF the spending transaction).
9579  *
9580  * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in
9581  * case of an honest unilateral channel close, which implicitly decrease the economic value of
9582  * our channel.
9583  *
9584  * Default value: [`BREAKDOWN_TIMEOUT`], we enforce it as a minimum at channel opening so you
9585  * can tweak config to ask for more security, not less.
9586  */
9587 void ChannelHandshakeConfig_set_our_to_self_delay(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint16_t val);
9588
9589 /**
9590  * Set to the smallest value HTLC we will accept to process.
9591  *
9592  * This value is sent to our counterparty on channel-open and we close the channel any time
9593  * our counterparty misbehaves by sending us an HTLC with a value smaller than this.
9594  *
9595  * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required
9596  * by the protocol.
9597  */
9598 uint64_t ChannelHandshakeConfig_get_our_htlc_minimum_msat(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
9599
9600 /**
9601  * Set to the smallest value HTLC we will accept to process.
9602  *
9603  * This value is sent to our counterparty on channel-open and we close the channel any time
9604  * our counterparty misbehaves by sending us an HTLC with a value smaller than this.
9605  *
9606  * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required
9607  * by the protocol.
9608  */
9609 void ChannelHandshakeConfig_set_our_htlc_minimum_msat(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint64_t val);
9610
9611 /**
9612  * Constructs a new ChannelHandshakeConfig given each field
9613  */
9614 MUST_USE_RES struct LDKChannelHandshakeConfig ChannelHandshakeConfig_new(uint32_t minimum_depth_arg, uint16_t our_to_self_delay_arg, uint64_t our_htlc_minimum_msat_arg);
9615
9616 /**
9617  * Creates a copy of the ChannelHandshakeConfig
9618  */
9619 struct LDKChannelHandshakeConfig ChannelHandshakeConfig_clone(const struct LDKChannelHandshakeConfig *NONNULL_PTR orig);
9620
9621 /**
9622  * Creates a "default" ChannelHandshakeConfig. See struct and individual field documentaiton for details on which values are used.
9623  */
9624 MUST_USE_RES struct LDKChannelHandshakeConfig ChannelHandshakeConfig_default(void);
9625
9626 /**
9627  * Frees any resources used by the ChannelHandshakeLimits, if is_owned is set and inner is non-NULL.
9628  */
9629 void ChannelHandshakeLimits_free(struct LDKChannelHandshakeLimits this_obj);
9630
9631 /**
9632  * Minimum allowed satoshis when a channel is funded, this is supplied by the sender and so
9633  * only applies to inbound channels.
9634  *
9635  * Default value: 0.
9636  */
9637 uint64_t ChannelHandshakeLimits_get_min_funding_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
9638
9639 /**
9640  * Minimum allowed satoshis when a channel is funded, this is supplied by the sender and so
9641  * only applies to inbound channels.
9642  *
9643  * Default value: 0.
9644  */
9645 void ChannelHandshakeLimits_set_min_funding_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
9646
9647 /**
9648  * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows
9649  * you to limit the maximum minimum-size they can require.
9650  *
9651  * Default value: u64::max_value.
9652  */
9653 uint64_t ChannelHandshakeLimits_get_max_htlc_minimum_msat(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
9654
9655 /**
9656  * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows
9657  * you to limit the maximum minimum-size they can require.
9658  *
9659  * Default value: u64::max_value.
9660  */
9661 void ChannelHandshakeLimits_set_max_htlc_minimum_msat(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
9662
9663 /**
9664  * The remote node sets a limit on the maximum value of pending HTLCs to them at any given
9665  * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value.
9666  *
9667  * Default value: 0.
9668  */
9669 uint64_t ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
9670
9671 /**
9672  * The remote node sets a limit on the maximum value of pending HTLCs to them at any given
9673  * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value.
9674  *
9675  * Default value: 0.
9676  */
9677 void ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
9678
9679 /**
9680  * The remote node will require we keep a certain amount in direct payment to ourselves at all
9681  * time, ensuring that we are able to be punished if we broadcast an old state. This allows to
9682  * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs).
9683  *
9684  * Default value: u64::max_value.
9685  */
9686 uint64_t ChannelHandshakeLimits_get_max_channel_reserve_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
9687
9688 /**
9689  * The remote node will require we keep a certain amount in direct payment to ourselves at all
9690  * time, ensuring that we are able to be punished if we broadcast an old state. This allows to
9691  * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs).
9692  *
9693  * Default value: u64::max_value.
9694  */
9695 void ChannelHandshakeLimits_set_max_channel_reserve_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
9696
9697 /**
9698  * The remote node sets a limit on the maximum number of pending HTLCs to them at any given
9699  * time. This allows you to set a minimum such value.
9700  *
9701  * Default value: 0.
9702  */
9703 uint16_t ChannelHandshakeLimits_get_min_max_accepted_htlcs(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
9704
9705 /**
9706  * The remote node sets a limit on the maximum number of pending HTLCs to them at any given
9707  * time. This allows you to set a minimum such value.
9708  *
9709  * Default value: 0.
9710  */
9711 void ChannelHandshakeLimits_set_min_max_accepted_htlcs(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint16_t val);
9712
9713 /**
9714  * Outputs below a certain value will not be added to on-chain transactions. The dust value is
9715  * required to always be higher than this value so this only applies to HTLC outputs (and
9716  * potentially to-self outputs before any payments have been made).
9717  * Thus, HTLCs below this amount plus HTLC transaction fees are not enforceable on-chain.
9718  * This setting allows you to set a minimum dust limit for their commitment transactions,
9719  * reflecting the reality that tiny outputs are not considered standard transactions and will
9720  * not propagate through the Bitcoin network.
9721  *
9722  * Default value: 546, the current dust limit on the Bitcoin network.
9723  */
9724 uint64_t ChannelHandshakeLimits_get_min_dust_limit_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
9725
9726 /**
9727  * Outputs below a certain value will not be added to on-chain transactions. The dust value is
9728  * required to always be higher than this value so this only applies to HTLC outputs (and
9729  * potentially to-self outputs before any payments have been made).
9730  * Thus, HTLCs below this amount plus HTLC transaction fees are not enforceable on-chain.
9731  * This setting allows you to set a minimum dust limit for their commitment transactions,
9732  * reflecting the reality that tiny outputs are not considered standard transactions and will
9733  * not propagate through the Bitcoin network.
9734  *
9735  * Default value: 546, the current dust limit on the Bitcoin network.
9736  */
9737 void ChannelHandshakeLimits_set_min_dust_limit_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
9738
9739 /**
9740  * Maximum allowed threshold above which outputs will not be generated in their commitment
9741  * transactions.
9742  * HTLCs below this amount plus HTLC transaction fees are not enforceable on-chain.
9743  *
9744  * Default value: u64::max_value.
9745  */
9746 uint64_t ChannelHandshakeLimits_get_max_dust_limit_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
9747
9748 /**
9749  * Maximum allowed threshold above which outputs will not be generated in their commitment
9750  * transactions.
9751  * HTLCs below this amount plus HTLC transaction fees are not enforceable on-chain.
9752  *
9753  * Default value: u64::max_value.
9754  */
9755 void ChannelHandshakeLimits_set_max_dust_limit_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
9756
9757 /**
9758  * Before a channel is usable the funding transaction will need to be confirmed by at least a
9759  * certain number of blocks, specified by the node which is not the funder (as the funder can
9760  * assume they aren't going to double-spend themselves).
9761  * This config allows you to set a limit on the maximum amount of time to wait.
9762  *
9763  * Default value: 144, or roughly one day and only applies to outbound channels.
9764  */
9765 uint32_t ChannelHandshakeLimits_get_max_minimum_depth(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
9766
9767 /**
9768  * Before a channel is usable the funding transaction will need to be confirmed by at least a
9769  * certain number of blocks, specified by the node which is not the funder (as the funder can
9770  * assume they aren't going to double-spend themselves).
9771  * This config allows you to set a limit on the maximum amount of time to wait.
9772  *
9773  * Default value: 144, or roughly one day and only applies to outbound channels.
9774  */
9775 void ChannelHandshakeLimits_set_max_minimum_depth(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint32_t val);
9776
9777 /**
9778  * Set to force the incoming channel to match our announced channel preference in
9779  * ChannelConfig.
9780  *
9781  * Default value: true, to make the default that no announced channels are possible (which is
9782  * appropriate for any nodes which are not online very reliably).
9783  */
9784 bool ChannelHandshakeLimits_get_force_announced_channel_preference(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
9785
9786 /**
9787  * Set to force the incoming channel to match our announced channel preference in
9788  * ChannelConfig.
9789  *
9790  * Default value: true, to make the default that no announced channels are possible (which is
9791  * appropriate for any nodes which are not online very reliably).
9792  */
9793 void ChannelHandshakeLimits_set_force_announced_channel_preference(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, bool val);
9794
9795 /**
9796  * Set to the amount of time we're willing to wait to claim money back to us.
9797  *
9798  * Not checking this value would be a security issue, as our peer would be able to set it to
9799  * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time.
9800  *
9801  * Default value: 2016, which we also enforce as a maximum value so you can tweak config to
9802  * reduce the loss of having useless locked funds (if your peer accepts)
9803  */
9804 uint16_t ChannelHandshakeLimits_get_their_to_self_delay(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
9805
9806 /**
9807  * Set to the amount of time we're willing to wait to claim money back to us.
9808  *
9809  * Not checking this value would be a security issue, as our peer would be able to set it to
9810  * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time.
9811  *
9812  * Default value: 2016, which we also enforce as a maximum value so you can tweak config to
9813  * reduce the loss of having useless locked funds (if your peer accepts)
9814  */
9815 void ChannelHandshakeLimits_set_their_to_self_delay(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint16_t val);
9816
9817 /**
9818  * Constructs a new ChannelHandshakeLimits given each field
9819  */
9820 MUST_USE_RES struct LDKChannelHandshakeLimits ChannelHandshakeLimits_new(uint64_t min_funding_satoshis_arg, uint64_t max_htlc_minimum_msat_arg, uint64_t min_max_htlc_value_in_flight_msat_arg, uint64_t max_channel_reserve_satoshis_arg, uint16_t min_max_accepted_htlcs_arg, uint64_t min_dust_limit_satoshis_arg, uint64_t max_dust_limit_satoshis_arg, uint32_t max_minimum_depth_arg, bool force_announced_channel_preference_arg, uint16_t their_to_self_delay_arg);
9821
9822 /**
9823  * Creates a copy of the ChannelHandshakeLimits
9824  */
9825 struct LDKChannelHandshakeLimits ChannelHandshakeLimits_clone(const struct LDKChannelHandshakeLimits *NONNULL_PTR orig);
9826
9827 /**
9828  * Creates a "default" ChannelHandshakeLimits. See struct and individual field documentaiton for details on which values are used.
9829  */
9830 MUST_USE_RES struct LDKChannelHandshakeLimits ChannelHandshakeLimits_default(void);
9831
9832 /**
9833  * Frees any resources used by the ChannelConfig, if is_owned is set and inner is non-NULL.
9834  */
9835 void ChannelConfig_free(struct LDKChannelConfig this_obj);
9836
9837 /**
9838  * Amount (in millionths of a satoshi) the channel will charge per transferred satoshi.
9839  * This may be allowed to change at runtime in a later update, however doing so must result in
9840  * update messages sent to notify all nodes of our updated relay fee.
9841  *
9842  * Default value: 0.
9843  */
9844 uint32_t ChannelConfig_get_fee_proportional_millionths(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
9845
9846 /**
9847  * Amount (in millionths of a satoshi) the channel will charge per transferred satoshi.
9848  * This may be allowed to change at runtime in a later update, however doing so must result in
9849  * update messages sent to notify all nodes of our updated relay fee.
9850  *
9851  * Default value: 0.
9852  */
9853 void ChannelConfig_set_fee_proportional_millionths(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint32_t val);
9854
9855 /**
9856  * The difference in the CLTV value between incoming HTLCs and an outbound HTLC forwarded over
9857  * the channel this config applies to.
9858  *
9859  * This is analogous to [`ChannelHandshakeConfig::our_to_self_delay`] but applies to in-flight
9860  * HTLC balance when a channel appears on-chain whereas
9861  * [`ChannelHandshakeConfig::our_to_self_delay`] applies to the remaining
9862  * (non-HTLC-encumbered) balance.
9863  *
9864  * Thus, for HTLC-encumbered balances to be enforced on-chain when a channel is force-closed,
9865  * we (or one of our watchtowers) MUST be online to check for broadcast of the current
9866  * commitment transaction at least once per this many blocks (minus some margin to allow us
9867  * enough time to broadcast and confirm a transaction, possibly with time in between to RBF
9868  * the spending transaction).
9869  *
9870  * Default value: 72 (12 hours at an average of 6 blocks/hour).
9871  * Minimum value: [`MIN_CLTV_EXPIRY_DELTA`], any values less than this will be treated as
9872  *                [`MIN_CLTV_EXPIRY_DELTA`] instead.
9873  *
9874  * [`MIN_CLTV_EXPIRY_DELTA`]: crate::ln::channelmanager::MIN_CLTV_EXPIRY_DELTA
9875  */
9876 uint16_t ChannelConfig_get_cltv_expiry_delta(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
9877
9878 /**
9879  * The difference in the CLTV value between incoming HTLCs and an outbound HTLC forwarded over
9880  * the channel this config applies to.
9881  *
9882  * This is analogous to [`ChannelHandshakeConfig::our_to_self_delay`] but applies to in-flight
9883  * HTLC balance when a channel appears on-chain whereas
9884  * [`ChannelHandshakeConfig::our_to_self_delay`] applies to the remaining
9885  * (non-HTLC-encumbered) balance.
9886  *
9887  * Thus, for HTLC-encumbered balances to be enforced on-chain when a channel is force-closed,
9888  * we (or one of our watchtowers) MUST be online to check for broadcast of the current
9889  * commitment transaction at least once per this many blocks (minus some margin to allow us
9890  * enough time to broadcast and confirm a transaction, possibly with time in between to RBF
9891  * the spending transaction).
9892  *
9893  * Default value: 72 (12 hours at an average of 6 blocks/hour).
9894  * Minimum value: [`MIN_CLTV_EXPIRY_DELTA`], any values less than this will be treated as
9895  *                [`MIN_CLTV_EXPIRY_DELTA`] instead.
9896  *
9897  * [`MIN_CLTV_EXPIRY_DELTA`]: crate::ln::channelmanager::MIN_CLTV_EXPIRY_DELTA
9898  */
9899 void ChannelConfig_set_cltv_expiry_delta(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint16_t val);
9900
9901 /**
9902  * Set to announce the channel publicly and notify all nodes that they can route via this
9903  * channel.
9904  *
9905  * This should only be set to true for nodes which expect to be online reliably.
9906  *
9907  * As the node which funds a channel picks this value this will only apply for new outbound
9908  * channels unless ChannelHandshakeLimits::force_announced_channel_preferences is set.
9909  *
9910  * This cannot be changed after the initial channel handshake.
9911  *
9912  * Default value: false.
9913  */
9914 bool ChannelConfig_get_announced_channel(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
9915
9916 /**
9917  * Set to announce the channel publicly and notify all nodes that they can route via this
9918  * channel.
9919  *
9920  * This should only be set to true for nodes which expect to be online reliably.
9921  *
9922  * As the node which funds a channel picks this value this will only apply for new outbound
9923  * channels unless ChannelHandshakeLimits::force_announced_channel_preferences is set.
9924  *
9925  * This cannot be changed after the initial channel handshake.
9926  *
9927  * Default value: false.
9928  */
9929 void ChannelConfig_set_announced_channel(struct LDKChannelConfig *NONNULL_PTR this_ptr, bool val);
9930
9931 /**
9932  * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty
9933  * supports it, they will then enforce the mutual-close output to us matches what we provided
9934  * at intialization, preventing us from closing to an alternate pubkey.
9935  *
9936  * This is set to true by default to provide a slight increase in security, though ultimately
9937  * any attacker who is able to take control of a channel can just as easily send the funds via
9938  * lightning payments, so we never require that our counterparties support this option.
9939  *
9940  * This cannot be changed after a channel has been initialized.
9941  *
9942  * Default value: true.
9943  */
9944 bool ChannelConfig_get_commit_upfront_shutdown_pubkey(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
9945
9946 /**
9947  * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty
9948  * supports it, they will then enforce the mutual-close output to us matches what we provided
9949  * at intialization, preventing us from closing to an alternate pubkey.
9950  *
9951  * This is set to true by default to provide a slight increase in security, though ultimately
9952  * any attacker who is able to take control of a channel can just as easily send the funds via
9953  * lightning payments, so we never require that our counterparties support this option.
9954  *
9955  * This cannot be changed after a channel has been initialized.
9956  *
9957  * Default value: true.
9958  */
9959 void ChannelConfig_set_commit_upfront_shutdown_pubkey(struct LDKChannelConfig *NONNULL_PTR this_ptr, bool val);
9960
9961 /**
9962  * Constructs a new ChannelConfig given each field
9963  */
9964 MUST_USE_RES struct LDKChannelConfig ChannelConfig_new(uint32_t fee_proportional_millionths_arg, uint16_t cltv_expiry_delta_arg, bool announced_channel_arg, bool commit_upfront_shutdown_pubkey_arg);
9965
9966 /**
9967  * Creates a copy of the ChannelConfig
9968  */
9969 struct LDKChannelConfig ChannelConfig_clone(const struct LDKChannelConfig *NONNULL_PTR orig);
9970
9971 /**
9972  * Creates a "default" ChannelConfig. See struct and individual field documentaiton for details on which values are used.
9973  */
9974 MUST_USE_RES struct LDKChannelConfig ChannelConfig_default(void);
9975
9976 /**
9977  * Serialize the ChannelConfig object into a byte array which can be read by ChannelConfig_read
9978  */
9979 struct LDKCVec_u8Z ChannelConfig_write(const struct LDKChannelConfig *NONNULL_PTR obj);
9980
9981 /**
9982  * Read a ChannelConfig from a byte array, created by ChannelConfig_write
9983  */
9984 struct LDKCResult_ChannelConfigDecodeErrorZ ChannelConfig_read(struct LDKu8slice ser);
9985
9986 /**
9987  * Frees any resources used by the UserConfig, if is_owned is set and inner is non-NULL.
9988  */
9989 void UserConfig_free(struct LDKUserConfig this_obj);
9990
9991 /**
9992  * Channel config that we propose to our counterparty.
9993  */
9994 struct LDKChannelHandshakeConfig UserConfig_get_own_channel_config(const struct LDKUserConfig *NONNULL_PTR this_ptr);
9995
9996 /**
9997  * Channel config that we propose to our counterparty.
9998  */
9999 void UserConfig_set_own_channel_config(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeConfig val);
10000
10001 /**
10002  * Limits applied to our counterparty's proposed channel config settings.
10003  */
10004 struct LDKChannelHandshakeLimits UserConfig_get_peer_channel_config_limits(const struct LDKUserConfig *NONNULL_PTR this_ptr);
10005
10006 /**
10007  * Limits applied to our counterparty's proposed channel config settings.
10008  */
10009 void UserConfig_set_peer_channel_config_limits(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeLimits val);
10010
10011 /**
10012  * Channel config which affects behavior during channel lifetime.
10013  */
10014 struct LDKChannelConfig UserConfig_get_channel_options(const struct LDKUserConfig *NONNULL_PTR this_ptr);
10015
10016 /**
10017  * Channel config which affects behavior during channel lifetime.
10018  */
10019 void UserConfig_set_channel_options(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelConfig val);
10020
10021 /**
10022  * Constructs a new UserConfig given each field
10023  */
10024 MUST_USE_RES struct LDKUserConfig UserConfig_new(struct LDKChannelHandshakeConfig own_channel_config_arg, struct LDKChannelHandshakeLimits peer_channel_config_limits_arg, struct LDKChannelConfig channel_options_arg);
10025
10026 /**
10027  * Creates a copy of the UserConfig
10028  */
10029 struct LDKUserConfig UserConfig_clone(const struct LDKUserConfig *NONNULL_PTR orig);
10030
10031 /**
10032  * Creates a "default" UserConfig. See struct and individual field documentaiton for details on which values are used.
10033  */
10034 MUST_USE_RES struct LDKUserConfig UserConfig_default(void);
10035
10036 /**
10037  * Creates a copy of the AccessError
10038  */
10039 enum LDKAccessError AccessError_clone(const enum LDKAccessError *NONNULL_PTR orig);
10040
10041 /**
10042  * Calls the free function if one is set
10043  */
10044 void Access_free(struct LDKAccess this_ptr);
10045
10046 /**
10047  * Calls the free function if one is set
10048  */
10049 void Listen_free(struct LDKListen this_ptr);
10050
10051 /**
10052  * Calls the free function if one is set
10053  */
10054 void Watch_free(struct LDKWatch this_ptr);
10055
10056 /**
10057  * Calls the free function if one is set
10058  */
10059 void Filter_free(struct LDKFilter this_ptr);
10060
10061 /**
10062  * Frees any resources used by the WatchedOutput, if is_owned is set and inner is non-NULL.
10063  */
10064 void WatchedOutput_free(struct LDKWatchedOutput this_obj);
10065
10066 /**
10067  * First block where the transaction output may have been spent.
10068  */
10069 struct LDKThirtyTwoBytes WatchedOutput_get_block_hash(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
10070
10071 /**
10072  * First block where the transaction output may have been spent.
10073  */
10074 void WatchedOutput_set_block_hash(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
10075
10076 /**
10077  * Outpoint identifying the transaction output.
10078  */
10079 struct LDKOutPoint WatchedOutput_get_outpoint(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
10080
10081 /**
10082  * Outpoint identifying the transaction output.
10083  */
10084 void WatchedOutput_set_outpoint(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKOutPoint val);
10085
10086 /**
10087  * Spending condition of the transaction output.
10088  */
10089 struct LDKu8slice WatchedOutput_get_script_pubkey(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
10090
10091 /**
10092  * Spending condition of the transaction output.
10093  */
10094 void WatchedOutput_set_script_pubkey(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
10095
10096 /**
10097  * Constructs a new WatchedOutput given each field
10098  */
10099 MUST_USE_RES struct LDKWatchedOutput WatchedOutput_new(struct LDKThirtyTwoBytes block_hash_arg, struct LDKOutPoint outpoint_arg, struct LDKCVec_u8Z script_pubkey_arg);
10100
10101 /**
10102  * Calls the free function if one is set
10103  */
10104 void BroadcasterInterface_free(struct LDKBroadcasterInterface this_ptr);
10105
10106 /**
10107  * Creates a copy of the ConfirmationTarget
10108  */
10109 enum LDKConfirmationTarget ConfirmationTarget_clone(const enum LDKConfirmationTarget *NONNULL_PTR orig);
10110
10111 /**
10112  * Calls the free function if one is set
10113  */
10114 void FeeEstimator_free(struct LDKFeeEstimator this_ptr);
10115
10116 /**
10117  * Frees any resources used by the ChainMonitor, if is_owned is set and inner is non-NULL.
10118  */
10119 void ChainMonitor_free(struct LDKChainMonitor this_obj);
10120
10121 /**
10122  * Dispatches to per-channel monitors, which are responsible for updating their on-chain view
10123  * of a channel and reacting accordingly based on transactions in the connected block. See
10124  * [`ChannelMonitor::block_connected`] for details. Any HTLCs that were resolved on chain will
10125  * be returned by [`chain::Watch::release_pending_monitor_events`].
10126  *
10127  * Calls back to [`chain::Filter`] if any monitor indicated new outputs to watch. Subsequent
10128  * calls must not exclude any transactions matching the new outputs nor any in-block
10129  * descendants of such transactions. It is not necessary to re-fetch the block to obtain
10130  * updated `txdata`.
10131  */
10132 void ChainMonitor_block_connected(const struct LDKChainMonitor *NONNULL_PTR this_arg, const uint8_t (*header)[80], struct LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height);
10133
10134 /**
10135  * Dispatches to per-channel monitors, which are responsible for updating their on-chain view
10136  * of a channel and reacting accordingly to newly confirmed transactions. For details, see
10137  * [`ChannelMonitor::transactions_confirmed`].
10138  *
10139  * Used instead of [`block_connected`] by clients that are notified of transactions rather than
10140  * blocks. May be called before or after [`update_best_block`] for transactions in the
10141  * corresponding block. See [`update_best_block`] for further calling expectations.
10142  *
10143  * [`block_connected`]: Self::block_connected
10144  * [`update_best_block`]: Self::update_best_block
10145  */
10146 void ChainMonitor_transactions_confirmed(const struct LDKChainMonitor *NONNULL_PTR this_arg, const uint8_t (*header)[80], struct LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height);
10147
10148 /**
10149  * Dispatches to per-channel monitors, which are responsible for updating their on-chain view
10150  * of a channel and reacting accordingly based on the new chain tip. For details, see
10151  * [`ChannelMonitor::update_best_block`].
10152  *
10153  * Used instead of [`block_connected`] by clients that are notified of transactions rather than
10154  * blocks. May be called before or after [`transactions_confirmed`] for the corresponding
10155  * block.
10156  *
10157  * Must be called after new blocks become available for the most recent block. Intermediary
10158  * blocks, however, may be safely skipped. In the event of a chain re-organization, this only
10159  * needs to be called for the most recent block assuming `transaction_unconfirmed` is called
10160  * for any affected transactions.
10161  *
10162  * [`block_connected`]: Self::block_connected
10163  * [`transactions_confirmed`]: Self::transactions_confirmed
10164  * [`transaction_unconfirmed`]: Self::transaction_unconfirmed
10165  */
10166 void ChainMonitor_update_best_block(const struct LDKChainMonitor *NONNULL_PTR this_arg, const uint8_t (*header)[80], uint32_t height);
10167
10168 /**
10169  * Dispatches to per-channel monitors, which are responsible for updating their on-chain view
10170  * of a channel based on the disconnected block. See [`ChannelMonitor::block_disconnected`] for
10171  * details.
10172  */
10173 void ChainMonitor_block_disconnected(const struct LDKChainMonitor *NONNULL_PTR this_arg, const uint8_t (*header)[80], uint32_t disconnected_height);
10174
10175 /**
10176  * Dispatches to per-channel monitors, which are responsible for updating their on-chain view
10177  * of a channel based on transactions unconfirmed as a result of a chain reorganization. See
10178  * [`ChannelMonitor::transaction_unconfirmed`] for details.
10179  *
10180  * Used instead of [`block_disconnected`] by clients that are notified of transactions rather
10181  * than blocks. May be called before or after [`update_best_block`] for transactions in the
10182  * corresponding block. See [`update_best_block`] for further calling expectations.
10183  *
10184  * [`block_disconnected`]: Self::block_disconnected
10185  * [`update_best_block`]: Self::update_best_block
10186  */
10187 void ChainMonitor_transaction_unconfirmed(const struct LDKChainMonitor *NONNULL_PTR this_arg, const uint8_t (*txid)[32]);
10188
10189 /**
10190  * Returns the set of txids that should be monitored for re-organization out of the chain.
10191  */
10192 MUST_USE_RES struct LDKCVec_TxidZ ChainMonitor_get_relevant_txids(const struct LDKChainMonitor *NONNULL_PTR this_arg);
10193
10194 /**
10195  * Creates a new `ChainMonitor` used to watch on-chain activity pertaining to channels.
10196  *
10197  * When an optional chain source implementing [`chain::Filter`] is provided, the chain monitor
10198  * will call back to it indicating transactions and outputs of interest. This allows clients to
10199  * pre-filter blocks or only fetch blocks matching a compact filter. Otherwise, clients may
10200  * always need to fetch full blocks absent another means for determining which blocks contain
10201  * transactions relevant to the watched channels.
10202  */
10203 MUST_USE_RES struct LDKChainMonitor ChainMonitor_new(struct LDKFilter *chain_source, struct LDKBroadcasterInterface broadcaster, struct LDKLogger logger, struct LDKFeeEstimator feeest, struct LDKPersist persister);
10204
10205 /**
10206  * Constructs a new Watch which calls the relevant methods on this_arg.
10207  * This copies the `inner` pointer in this_arg and thus the returned Watch must be freed before this_arg is
10208  */
10209 struct LDKWatch ChainMonitor_as_Watch(const struct LDKChainMonitor *NONNULL_PTR this_arg);
10210
10211 /**
10212  * Constructs a new EventsProvider which calls the relevant methods on this_arg.
10213  * This copies the `inner` pointer in this_arg and thus the returned EventsProvider must be freed before this_arg is
10214  */
10215 struct LDKEventsProvider ChainMonitor_as_EventsProvider(const struct LDKChainMonitor *NONNULL_PTR this_arg);
10216
10217 /**
10218  * Frees any resources used by the ChannelMonitorUpdate, if is_owned is set and inner is non-NULL.
10219  */
10220 void ChannelMonitorUpdate_free(struct LDKChannelMonitorUpdate this_obj);
10221
10222 /**
10223  * The sequence number of this update. Updates *must* be replayed in-order according to this
10224  * sequence number (and updates may panic if they are not). The update_id values are strictly
10225  * increasing and increase by one for each new update, with one exception specified below.
10226  *
10227  * This sequence number is also used to track up to which points updates which returned
10228  * ChannelMonitorUpdateErr::TemporaryFailure have been applied to all copies of a given
10229  * ChannelMonitor when ChannelManager::channel_monitor_updated is called.
10230  *
10231  * The only instance where update_id values are not strictly increasing is the case where we
10232  * allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See
10233  * its docs for more details.
10234  */
10235 uint64_t ChannelMonitorUpdate_get_update_id(const struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr);
10236
10237 /**
10238  * The sequence number of this update. Updates *must* be replayed in-order according to this
10239  * sequence number (and updates may panic if they are not). The update_id values are strictly
10240  * increasing and increase by one for each new update, with one exception specified below.
10241  *
10242  * This sequence number is also used to track up to which points updates which returned
10243  * ChannelMonitorUpdateErr::TemporaryFailure have been applied to all copies of a given
10244  * ChannelMonitor when ChannelManager::channel_monitor_updated is called.
10245  *
10246  * The only instance where update_id values are not strictly increasing is the case where we
10247  * allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See
10248  * its docs for more details.
10249  */
10250 void ChannelMonitorUpdate_set_update_id(struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr, uint64_t val);
10251
10252 /**
10253  * Creates a copy of the ChannelMonitorUpdate
10254  */
10255 struct LDKChannelMonitorUpdate ChannelMonitorUpdate_clone(const struct LDKChannelMonitorUpdate *NONNULL_PTR orig);
10256
10257 /**
10258  * Serialize the ChannelMonitorUpdate object into a byte array which can be read by ChannelMonitorUpdate_read
10259  */
10260 struct LDKCVec_u8Z ChannelMonitorUpdate_write(const struct LDKChannelMonitorUpdate *NONNULL_PTR obj);
10261
10262 /**
10263  * Read a ChannelMonitorUpdate from a byte array, created by ChannelMonitorUpdate_write
10264  */
10265 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ ChannelMonitorUpdate_read(struct LDKu8slice ser);
10266
10267 /**
10268  * Creates a copy of the ChannelMonitorUpdateErr
10269  */
10270 enum LDKChannelMonitorUpdateErr ChannelMonitorUpdateErr_clone(const enum LDKChannelMonitorUpdateErr *NONNULL_PTR orig);
10271
10272 /**
10273  * Frees any resources used by the MonitorUpdateError, if is_owned is set and inner is non-NULL.
10274  */
10275 void MonitorUpdateError_free(struct LDKMonitorUpdateError this_obj);
10276
10277 /**
10278  * Creates a copy of the MonitorUpdateError
10279  */
10280 struct LDKMonitorUpdateError MonitorUpdateError_clone(const struct LDKMonitorUpdateError *NONNULL_PTR orig);
10281
10282 /**
10283  * Frees any resources used by the MonitorEvent
10284  */
10285 void MonitorEvent_free(struct LDKMonitorEvent this_ptr);
10286
10287 /**
10288  * Creates a copy of the MonitorEvent
10289  */
10290 struct LDKMonitorEvent MonitorEvent_clone(const struct LDKMonitorEvent *NONNULL_PTR orig);
10291
10292 /**
10293  * Frees any resources used by the HTLCUpdate, if is_owned is set and inner is non-NULL.
10294  */
10295 void HTLCUpdate_free(struct LDKHTLCUpdate this_obj);
10296
10297 /**
10298  * Creates a copy of the HTLCUpdate
10299  */
10300 struct LDKHTLCUpdate HTLCUpdate_clone(const struct LDKHTLCUpdate *NONNULL_PTR orig);
10301
10302 /**
10303  * Serialize the HTLCUpdate object into a byte array which can be read by HTLCUpdate_read
10304  */
10305 struct LDKCVec_u8Z HTLCUpdate_write(const struct LDKHTLCUpdate *NONNULL_PTR obj);
10306
10307 /**
10308  * Read a HTLCUpdate from a byte array, created by HTLCUpdate_write
10309  */
10310 struct LDKCResult_HTLCUpdateDecodeErrorZ HTLCUpdate_read(struct LDKu8slice ser);
10311
10312 /**
10313  * Frees any resources used by the ChannelMonitor, if is_owned is set and inner is non-NULL.
10314  */
10315 void ChannelMonitor_free(struct LDKChannelMonitor this_obj);
10316
10317 /**
10318  * Serialize the ChannelMonitor object into a byte array which can be read by ChannelMonitor_read
10319  */
10320 struct LDKCVec_u8Z ChannelMonitor_write(const struct LDKChannelMonitor *NONNULL_PTR obj);
10321
10322 /**
10323  * Updates a ChannelMonitor on the basis of some new information provided by the Channel
10324  * itself.
10325  *
10326  * panics if the given update is not the next update by update_id.
10327  */
10328 MUST_USE_RES struct LDKCResult_NoneMonitorUpdateErrorZ ChannelMonitor_update_monitor(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKChannelMonitorUpdate *NONNULL_PTR updates, const struct LDKBroadcasterInterface *NONNULL_PTR broadcaster, const struct LDKFeeEstimator *NONNULL_PTR fee_estimator, const struct LDKLogger *NONNULL_PTR logger);
10329
10330 /**
10331  * Gets the update_id from the latest ChannelMonitorUpdate which was applied to this
10332  * ChannelMonitor.
10333  */
10334 MUST_USE_RES uint64_t ChannelMonitor_get_latest_update_id(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
10335
10336 /**
10337  * Gets the funding transaction outpoint of the channel this ChannelMonitor is monitoring for.
10338  */
10339 MUST_USE_RES struct LDKC2Tuple_OutPointScriptZ ChannelMonitor_get_funding_txo(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
10340
10341 /**
10342  * Gets a list of txids, with their output scripts (in the order they appear in the
10343  * transaction), which we must learn about spends of via block_connected().
10344  */
10345 MUST_USE_RES struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ChannelMonitor_get_outputs_to_watch(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
10346
10347 /**
10348  * Loads the funding txo and outputs to watch into the given `chain::Filter` by repeatedly
10349  * calling `chain::Filter::register_output` and `chain::Filter::register_tx` until all outputs
10350  * have been registered.
10351  */
10352 void ChannelMonitor_load_outputs_to_watch(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKFilter *NONNULL_PTR filter);
10353
10354 /**
10355  * Get the list of HTLCs who's status has been updated on chain. This should be called by
10356  * ChannelManager via [`chain::Watch::release_pending_monitor_events`].
10357  */
10358 MUST_USE_RES struct LDKCVec_MonitorEventZ ChannelMonitor_get_and_clear_pending_monitor_events(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
10359
10360 /**
10361  * Gets the list of pending events which were generated by previous actions, clearing the list
10362  * in the process.
10363  *
10364  * This is called by ChainMonitor::get_and_clear_pending_events() and is equivalent to
10365  * EventsProvider::get_and_clear_pending_events() except that it requires &mut self as we do
10366  * no internal locking in ChannelMonitors.
10367  */
10368 MUST_USE_RES struct LDKCVec_EventZ ChannelMonitor_get_and_clear_pending_events(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
10369
10370 /**
10371  * Used by ChannelManager deserialization to broadcast the latest holder state if its copy of
10372  * the Channel was out-of-date. You may use it to get a broadcastable holder toxic tx in case of
10373  * fallen-behind, i.e when receiving a channel_reestablish with a proof that our counterparty side knows
10374  * a higher revocation secret than the holder commitment number we are aware of. Broadcasting these
10375  * transactions are UNSAFE, as they allow counterparty side to punish you. Nevertheless you may want to
10376  * broadcast them if counterparty don't close channel with his higher commitment transaction after a
10377  * substantial amount of time (a month or even a year) to get back funds. Best may be to contact
10378  * out-of-band the other node operator to coordinate with him if option is available to you.
10379  * In any-case, choice is up to the user.
10380  */
10381 MUST_USE_RES struct LDKCVec_TransactionZ ChannelMonitor_get_latest_holder_commitment_txn(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKLogger *NONNULL_PTR logger);
10382
10383 /**
10384  * Processes transactions in a newly connected block, which may result in any of the following:
10385  * - update the monitor's state against resolved HTLCs
10386  * - punish the counterparty in the case of seeing a revoked commitment transaction
10387  * - force close the channel and claim/timeout incoming/outgoing HTLCs if near expiration
10388  * - detect settled outputs for later spending
10389  * - schedule and bump any in-flight claims
10390  *
10391  * Returns any new outputs to watch from `txdata`; after called, these are also included in
10392  * [`get_outputs_to_watch`].
10393  *
10394  * [`get_outputs_to_watch`]: #method.get_outputs_to_watch
10395  */
10396 MUST_USE_RES struct LDKCVec_TransactionOutputsZ ChannelMonitor_block_connected(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const uint8_t (*header)[80], struct LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height, struct LDKBroadcasterInterface broadcaster, struct LDKFeeEstimator fee_estimator, struct LDKLogger logger);
10397
10398 /**
10399  * Determines if the disconnected block contained any transactions of interest and updates
10400  * appropriately.
10401  */
10402 void ChannelMonitor_block_disconnected(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const uint8_t (*header)[80], uint32_t height, struct LDKBroadcasterInterface broadcaster, struct LDKFeeEstimator fee_estimator, struct LDKLogger logger);
10403
10404 /**
10405  * Processes transactions confirmed in a block with the given header and height, returning new
10406  * outputs to watch. See [`block_connected`] for details.
10407  *
10408  * Used instead of [`block_connected`] by clients that are notified of transactions rather than
10409  * blocks. May be called before or after [`update_best_block`] for transactions in the
10410  * corresponding block. See [`update_best_block`] for further calling expectations.
10411  *
10412  * [`block_connected`]: Self::block_connected
10413  * [`update_best_block`]: Self::update_best_block
10414  */
10415 MUST_USE_RES struct LDKCVec_TransactionOutputsZ ChannelMonitor_transactions_confirmed(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const uint8_t (*header)[80], struct LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height, struct LDKBroadcasterInterface broadcaster, struct LDKFeeEstimator fee_estimator, struct LDKLogger logger);
10416
10417 /**
10418  * Processes a transaction that was reorganized out of the chain.
10419  *
10420  * Used instead of [`block_disconnected`] by clients that are notified of transactions rather
10421  * than blocks. May be called before or after [`update_best_block`] for transactions in the
10422  * corresponding block. See [`update_best_block`] for further calling expectations.
10423  *
10424  * [`block_disconnected`]: Self::block_disconnected
10425  * [`update_best_block`]: Self::update_best_block
10426  */
10427 void ChannelMonitor_transaction_unconfirmed(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const uint8_t (*txid)[32], struct LDKBroadcasterInterface broadcaster, struct LDKFeeEstimator fee_estimator, struct LDKLogger logger);
10428
10429 /**
10430  * Updates the monitor with the current best chain tip, returning new outputs to watch. See
10431  * [`block_connected`] for details.
10432  *
10433  * Used instead of [`block_connected`] by clients that are notified of transactions rather than
10434  * blocks. May be called before or after [`transactions_confirmed`] for the corresponding
10435  * block.
10436  *
10437  * Must be called after new blocks become available for the most recent block. Intermediary
10438  * blocks, however, may be safely skipped. In the event of a chain re-organization, this only
10439  * needs to be called for the most recent block assuming `transaction_unconfirmed` is called
10440  * for any affected transactions.
10441  *
10442  * [`block_connected`]: Self::block_connected
10443  * [`transactions_confirmed`]: Self::transactions_confirmed
10444  * [`transaction_unconfirmed`]: Self::transaction_unconfirmed
10445  */
10446 MUST_USE_RES struct LDKCVec_TransactionOutputsZ ChannelMonitor_update_best_block(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const uint8_t (*header)[80], uint32_t height, struct LDKBroadcasterInterface broadcaster, struct LDKFeeEstimator fee_estimator, struct LDKLogger logger);
10447
10448 /**
10449  * Returns the set of txids that should be monitored for re-organization out of the chain.
10450  */
10451 MUST_USE_RES struct LDKCVec_TxidZ ChannelMonitor_get_relevant_txids(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
10452
10453 /**
10454  * Calls the free function if one is set
10455  */
10456 void Persist_free(struct LDKPersist this_ptr);
10457
10458 /**
10459  * Read a C2Tuple_BlockHashChannelMonitorZ from a byte array, created by C2Tuple_BlockHashChannelMonitorZ_write
10460  */
10461 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ C2Tuple_BlockHashChannelMonitorZ_read(struct LDKu8slice ser, const struct LDKKeysInterface *NONNULL_PTR arg);
10462
10463 /**
10464  * Frees any resources used by the OutPoint, if is_owned is set and inner is non-NULL.
10465  */
10466 void OutPoint_free(struct LDKOutPoint this_obj);
10467
10468 /**
10469  * The referenced transaction's txid.
10470  */
10471 const uint8_t (*OutPoint_get_txid(const struct LDKOutPoint *NONNULL_PTR this_ptr))[32];
10472
10473 /**
10474  * The referenced transaction's txid.
10475  */
10476 void OutPoint_set_txid(struct LDKOutPoint *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
10477
10478 /**
10479  * The index of the referenced output in its transaction's vout.
10480  */
10481 uint16_t OutPoint_get_index(const struct LDKOutPoint *NONNULL_PTR this_ptr);
10482
10483 /**
10484  * The index of the referenced output in its transaction's vout.
10485  */
10486 void OutPoint_set_index(struct LDKOutPoint *NONNULL_PTR this_ptr, uint16_t val);
10487
10488 /**
10489  * Constructs a new OutPoint given each field
10490  */
10491 MUST_USE_RES struct LDKOutPoint OutPoint_new(struct LDKThirtyTwoBytes txid_arg, uint16_t index_arg);
10492
10493 /**
10494  * Creates a copy of the OutPoint
10495  */
10496 struct LDKOutPoint OutPoint_clone(const struct LDKOutPoint *NONNULL_PTR orig);
10497
10498 /**
10499  * Convert an `OutPoint` to a lightning channel id.
10500  */
10501 MUST_USE_RES struct LDKThirtyTwoBytes OutPoint_to_channel_id(const struct LDKOutPoint *NONNULL_PTR this_arg);
10502
10503 /**
10504  * Serialize the OutPoint object into a byte array which can be read by OutPoint_read
10505  */
10506 struct LDKCVec_u8Z OutPoint_write(const struct LDKOutPoint *NONNULL_PTR obj);
10507
10508 /**
10509  * Read a OutPoint from a byte array, created by OutPoint_write
10510  */
10511 struct LDKCResult_OutPointDecodeErrorZ OutPoint_read(struct LDKu8slice ser);
10512
10513 /**
10514  * Frees any resources used by the DelayedPaymentOutputDescriptor, if is_owned is set and inner is non-NULL.
10515  */
10516 void DelayedPaymentOutputDescriptor_free(struct LDKDelayedPaymentOutputDescriptor this_obj);
10517
10518 /**
10519  * The outpoint which is spendable
10520  */
10521 struct LDKOutPoint DelayedPaymentOutputDescriptor_get_outpoint(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
10522
10523 /**
10524  * The outpoint which is spendable
10525  */
10526 void DelayedPaymentOutputDescriptor_set_outpoint(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKOutPoint val);
10527
10528 /**
10529  * Per commitment point to derive delayed_payment_key by key holder
10530  */
10531 struct LDKPublicKey DelayedPaymentOutputDescriptor_get_per_commitment_point(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
10532
10533 /**
10534  * Per commitment point to derive delayed_payment_key by key holder
10535  */
10536 void DelayedPaymentOutputDescriptor_set_per_commitment_point(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val);
10537
10538 /**
10539  * The nSequence value which must be set in the spending input to satisfy the OP_CSV in
10540  * the witness_script.
10541  */
10542 uint16_t DelayedPaymentOutputDescriptor_get_to_self_delay(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
10543
10544 /**
10545  * The nSequence value which must be set in the spending input to satisfy the OP_CSV in
10546  * the witness_script.
10547  */
10548 void DelayedPaymentOutputDescriptor_set_to_self_delay(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint16_t val);
10549
10550 /**
10551  * The output which is referenced by the given outpoint
10552  */
10553 void DelayedPaymentOutputDescriptor_set_output(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKTxOut val);
10554
10555 /**
10556  * The revocation point specific to the commitment transaction which was broadcast. Used to
10557  * derive the witnessScript for this output.
10558  */
10559 struct LDKPublicKey DelayedPaymentOutputDescriptor_get_revocation_pubkey(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
10560
10561 /**
10562  * The revocation point specific to the commitment transaction which was broadcast. Used to
10563  * derive the witnessScript for this output.
10564  */
10565 void DelayedPaymentOutputDescriptor_set_revocation_pubkey(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val);
10566
10567 /**
10568  * Arbitrary identification information returned by a call to
10569  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
10570  * the channel to spend the output.
10571  */
10572 const uint8_t (*DelayedPaymentOutputDescriptor_get_channel_keys_id(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr))[32];
10573
10574 /**
10575  * Arbitrary identification information returned by a call to
10576  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
10577  * the channel to spend the output.
10578  */
10579 void DelayedPaymentOutputDescriptor_set_channel_keys_id(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
10580
10581 /**
10582  * The value of the channel which this output originated from, possibly indirectly.
10583  */
10584 uint64_t DelayedPaymentOutputDescriptor_get_channel_value_satoshis(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
10585
10586 /**
10587  * The value of the channel which this output originated from, possibly indirectly.
10588  */
10589 void DelayedPaymentOutputDescriptor_set_channel_value_satoshis(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint64_t val);
10590
10591 /**
10592  * Constructs a new DelayedPaymentOutputDescriptor given each field
10593  */
10594 MUST_USE_RES struct LDKDelayedPaymentOutputDescriptor DelayedPaymentOutputDescriptor_new(struct LDKOutPoint outpoint_arg, struct LDKPublicKey per_commitment_point_arg, uint16_t to_self_delay_arg, struct LDKTxOut output_arg, struct LDKPublicKey revocation_pubkey_arg, struct LDKThirtyTwoBytes channel_keys_id_arg, uint64_t channel_value_satoshis_arg);
10595
10596 /**
10597  * Creates a copy of the DelayedPaymentOutputDescriptor
10598  */
10599 struct LDKDelayedPaymentOutputDescriptor DelayedPaymentOutputDescriptor_clone(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR orig);
10600
10601 /**
10602  * Frees any resources used by the StaticPaymentOutputDescriptor, if is_owned is set and inner is non-NULL.
10603  */
10604 void StaticPaymentOutputDescriptor_free(struct LDKStaticPaymentOutputDescriptor this_obj);
10605
10606 /**
10607  * The outpoint which is spendable
10608  */
10609 struct LDKOutPoint StaticPaymentOutputDescriptor_get_outpoint(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr);
10610
10611 /**
10612  * The outpoint which is spendable
10613  */
10614 void StaticPaymentOutputDescriptor_set_outpoint(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKOutPoint val);
10615
10616 /**
10617  * The output which is referenced by the given outpoint
10618  */
10619 void StaticPaymentOutputDescriptor_set_output(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKTxOut val);
10620
10621 /**
10622  * Arbitrary identification information returned by a call to
10623  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
10624  * the channel to spend the output.
10625  */
10626 const uint8_t (*StaticPaymentOutputDescriptor_get_channel_keys_id(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr))[32];
10627
10628 /**
10629  * Arbitrary identification information returned by a call to
10630  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
10631  * the channel to spend the output.
10632  */
10633 void StaticPaymentOutputDescriptor_set_channel_keys_id(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
10634
10635 /**
10636  * The value of the channel which this transactions spends.
10637  */
10638 uint64_t StaticPaymentOutputDescriptor_get_channel_value_satoshis(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr);
10639
10640 /**
10641  * The value of the channel which this transactions spends.
10642  */
10643 void StaticPaymentOutputDescriptor_set_channel_value_satoshis(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint64_t val);
10644
10645 /**
10646  * Constructs a new StaticPaymentOutputDescriptor given each field
10647  */
10648 MUST_USE_RES struct LDKStaticPaymentOutputDescriptor StaticPaymentOutputDescriptor_new(struct LDKOutPoint outpoint_arg, struct LDKTxOut output_arg, struct LDKThirtyTwoBytes channel_keys_id_arg, uint64_t channel_value_satoshis_arg);
10649
10650 /**
10651  * Creates a copy of the StaticPaymentOutputDescriptor
10652  */
10653 struct LDKStaticPaymentOutputDescriptor StaticPaymentOutputDescriptor_clone(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR orig);
10654
10655 /**
10656  * Frees any resources used by the SpendableOutputDescriptor
10657  */
10658 void SpendableOutputDescriptor_free(struct LDKSpendableOutputDescriptor this_ptr);
10659
10660 /**
10661  * Creates a copy of the SpendableOutputDescriptor
10662  */
10663 struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_clone(const struct LDKSpendableOutputDescriptor *NONNULL_PTR orig);
10664
10665 /**
10666  * Serialize the SpendableOutputDescriptor object into a byte array which can be read by SpendableOutputDescriptor_read
10667  */
10668 struct LDKCVec_u8Z SpendableOutputDescriptor_write(const struct LDKSpendableOutputDescriptor *NONNULL_PTR obj);
10669
10670 /**
10671  * Read a SpendableOutputDescriptor from a byte array, created by SpendableOutputDescriptor_write
10672  */
10673 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ SpendableOutputDescriptor_read(struct LDKu8slice ser);
10674
10675 /**
10676  * Calls the free function if one is set
10677  */
10678 void BaseSign_free(struct LDKBaseSign this_ptr);
10679
10680 /**
10681  * Creates a copy of a Sign
10682  */
10683 struct LDKSign Sign_clone(const struct LDKSign *NONNULL_PTR orig);
10684
10685 /**
10686  * Calls the free function if one is set
10687  */
10688 void Sign_free(struct LDKSign this_ptr);
10689
10690 /**
10691  * Calls the free function if one is set
10692  */
10693 void KeysInterface_free(struct LDKKeysInterface this_ptr);
10694
10695 /**
10696  * Frees any resources used by the InMemorySigner, if is_owned is set and inner is non-NULL.
10697  */
10698 void InMemorySigner_free(struct LDKInMemorySigner this_obj);
10699
10700 /**
10701  * Private key of anchor tx
10702  */
10703 const uint8_t (*InMemorySigner_get_funding_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
10704
10705 /**
10706  * Private key of anchor tx
10707  */
10708 void InMemorySigner_set_funding_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
10709
10710 /**
10711  * Holder secret key for blinded revocation pubkey
10712  */
10713 const uint8_t (*InMemorySigner_get_revocation_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
10714
10715 /**
10716  * Holder secret key for blinded revocation pubkey
10717  */
10718 void InMemorySigner_set_revocation_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
10719
10720 /**
10721  * Holder secret key used for our balance in counterparty-broadcasted commitment transactions
10722  */
10723 const uint8_t (*InMemorySigner_get_payment_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
10724
10725 /**
10726  * Holder secret key used for our balance in counterparty-broadcasted commitment transactions
10727  */
10728 void InMemorySigner_set_payment_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
10729
10730 /**
10731  * Holder secret key used in HTLC tx
10732  */
10733 const uint8_t (*InMemorySigner_get_delayed_payment_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
10734
10735 /**
10736  * Holder secret key used in HTLC tx
10737  */
10738 void InMemorySigner_set_delayed_payment_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
10739
10740 /**
10741  * Holder htlc secret key used in commitment tx htlc outputs
10742  */
10743 const uint8_t (*InMemorySigner_get_htlc_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
10744
10745 /**
10746  * Holder htlc secret key used in commitment tx htlc outputs
10747  */
10748 void InMemorySigner_set_htlc_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
10749
10750 /**
10751  * Commitment seed
10752  */
10753 const uint8_t (*InMemorySigner_get_commitment_seed(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
10754
10755 /**
10756  * Commitment seed
10757  */
10758 void InMemorySigner_set_commitment_seed(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
10759
10760 /**
10761  * Creates a copy of the InMemorySigner
10762  */
10763 struct LDKInMemorySigner InMemorySigner_clone(const struct LDKInMemorySigner *NONNULL_PTR orig);
10764
10765 /**
10766  * Create a new InMemorySigner
10767  */
10768 MUST_USE_RES struct LDKInMemorySigner InMemorySigner_new(struct LDKSecretKey funding_key, struct LDKSecretKey revocation_base_key, struct LDKSecretKey payment_key, struct LDKSecretKey delayed_payment_base_key, struct LDKSecretKey htlc_base_key, struct LDKThirtyTwoBytes commitment_seed, uint64_t channel_value_satoshis, struct LDKThirtyTwoBytes channel_keys_id);
10769
10770 /**
10771  * Counterparty pubkeys.
10772  * Will panic if ready_channel wasn't called.
10773  */
10774 MUST_USE_RES struct LDKChannelPublicKeys InMemorySigner_counterparty_pubkeys(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
10775
10776 /**
10777  * The contest_delay value specified by our counterparty and applied on holder-broadcastable
10778  * transactions, ie the amount of time that we have to wait to recover our funds if we
10779  * broadcast a transaction.
10780  * Will panic if ready_channel wasn't called.
10781  */
10782 MUST_USE_RES uint16_t InMemorySigner_counterparty_selected_contest_delay(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
10783
10784 /**
10785  * The contest_delay value specified by us and applied on transactions broadcastable
10786  * by our counterparty, ie the amount of time that they have to wait to recover their funds
10787  * if they broadcast a transaction.
10788  * Will panic if ready_channel wasn't called.
10789  */
10790 MUST_USE_RES uint16_t InMemorySigner_holder_selected_contest_delay(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
10791
10792 /**
10793  * Whether the holder is the initiator
10794  * Will panic if ready_channel wasn't called.
10795  */
10796 MUST_USE_RES bool InMemorySigner_is_outbound(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
10797
10798 /**
10799  * Funding outpoint
10800  * Will panic if ready_channel wasn't called.
10801  */
10802 MUST_USE_RES struct LDKOutPoint InMemorySigner_funding_outpoint(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
10803
10804 /**
10805  * Obtain a ChannelTransactionParameters for this channel, to be used when verifying or
10806  * building transactions.
10807  *
10808  * Will panic if ready_channel wasn't called.
10809  */
10810 MUST_USE_RES struct LDKChannelTransactionParameters InMemorySigner_get_channel_parameters(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
10811
10812 /**
10813  * Sign the single input of spend_tx at index `input_idx` which spends the output
10814  * described by descriptor, returning the witness stack for the input.
10815  *
10816  * Returns an Err if the input at input_idx does not exist, has a non-empty script_sig,
10817  * or is not spending the outpoint described by `descriptor.outpoint`.
10818  */
10819 MUST_USE_RES struct LDKCResult_CVec_CVec_u8ZZNoneZ InMemorySigner_sign_counterparty_payment_input(const struct LDKInMemorySigner *NONNULL_PTR this_arg, struct LDKTransaction spend_tx, uintptr_t input_idx, const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR descriptor);
10820
10821 /**
10822  * Sign the single input of spend_tx at index `input_idx` which spends the output
10823  * described by descriptor, returning the witness stack for the input.
10824  *
10825  * Returns an Err if the input at input_idx does not exist, has a non-empty script_sig,
10826  * is not spending the outpoint described by `descriptor.outpoint`, or does not have a
10827  * sequence set to `descriptor.to_self_delay`.
10828  */
10829 MUST_USE_RES struct LDKCResult_CVec_CVec_u8ZZNoneZ InMemorySigner_sign_dynamic_p2wsh_input(const struct LDKInMemorySigner *NONNULL_PTR this_arg, struct LDKTransaction spend_tx, uintptr_t input_idx, const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR descriptor);
10830
10831 /**
10832  * Constructs a new BaseSign which calls the relevant methods on this_arg.
10833  * This copies the `inner` pointer in this_arg and thus the returned BaseSign must be freed before this_arg is
10834  */
10835 struct LDKBaseSign InMemorySigner_as_BaseSign(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
10836
10837 /**
10838  * Constructs a new Sign which calls the relevant methods on this_arg.
10839  * This copies the `inner` pointer in this_arg and thus the returned Sign must be freed before this_arg is
10840  */
10841 struct LDKSign InMemorySigner_as_Sign(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
10842
10843 /**
10844  * Serialize the InMemorySigner object into a byte array which can be read by InMemorySigner_read
10845  */
10846 struct LDKCVec_u8Z InMemorySigner_write(const struct LDKInMemorySigner *NONNULL_PTR obj);
10847
10848 /**
10849  * Read a InMemorySigner from a byte array, created by InMemorySigner_write
10850  */
10851 struct LDKCResult_InMemorySignerDecodeErrorZ InMemorySigner_read(struct LDKu8slice ser);
10852
10853 /**
10854  * Frees any resources used by the KeysManager, if is_owned is set and inner is non-NULL.
10855  */
10856 void KeysManager_free(struct LDKKeysManager this_obj);
10857
10858 /**
10859  * Constructs a KeysManager from a 32-byte seed. If the seed is in some way biased (eg your
10860  * CSRNG is busted) this may panic (but more importantly, you will possibly lose funds).
10861  * starting_time isn't strictly required to actually be a time, but it must absolutely,
10862  * without a doubt, be unique to this instance. ie if you start multiple times with the same
10863  * seed, starting_time must be unique to each run. Thus, the easiest way to achieve this is to
10864  * simply use the current time (with very high precision).
10865  *
10866  * The seed MUST be backed up safely prior to use so that the keys can be re-created, however,
10867  * obviously, starting_time should be unique every time you reload the library - it is only
10868  * used to generate new ephemeral key data (which will be stored by the individual channel if
10869  * necessary).
10870  *
10871  * Note that the seed is required to recover certain on-chain funds independent of
10872  * ChannelMonitor data, though a current copy of ChannelMonitor data is also required for any
10873  * channel, and some on-chain during-closing funds.
10874  *
10875  * Note that until the 0.1 release there is no guarantee of backward compatibility between
10876  * versions. Once the library is more fully supported, the docs will be updated to include a
10877  * detailed description of the guarantee.
10878  */
10879 MUST_USE_RES struct LDKKeysManager KeysManager_new(const uint8_t (*seed)[32], uint64_t starting_time_secs, uint32_t starting_time_nanos);
10880
10881 /**
10882  * Derive an old Sign containing per-channel secrets based on a key derivation parameters.
10883  *
10884  * Key derivation parameters are accessible through a per-channel secrets
10885  * Sign::channel_keys_id and is provided inside DynamicOuputP2WSH in case of
10886  * onchain output detection for which a corresponding delayed_payment_key must be derived.
10887  */
10888 MUST_USE_RES struct LDKInMemorySigner KeysManager_derive_channel_keys(const struct LDKKeysManager *NONNULL_PTR this_arg, uint64_t channel_value_satoshis, const uint8_t (*params)[32]);
10889
10890 /**
10891  * Creates a Transaction which spends the given descriptors to the given outputs, plus an
10892  * output to the given change destination (if sufficient change value remains). The
10893  * transaction will have a feerate, at least, of the given value.
10894  *
10895  * Returns `Err(())` if the output value is greater than the input value minus required fee or
10896  * if a descriptor was duplicated.
10897  *
10898  * We do not enforce that outputs meet the dust limit or that any output scripts are standard.
10899  *
10900  * May panic if the `SpendableOutputDescriptor`s were not generated by Channels which used
10901  * this KeysManager or one of the `InMemorySigner` created by this KeysManager.
10902  */
10903 MUST_USE_RES struct LDKCResult_TransactionNoneZ KeysManager_spend_spendable_outputs(const struct LDKKeysManager *NONNULL_PTR this_arg, struct LDKCVec_SpendableOutputDescriptorZ descriptors, struct LDKCVec_TxOutZ outputs, struct LDKCVec_u8Z change_destination_script, uint32_t feerate_sat_per_1000_weight);
10904
10905 /**
10906  * Constructs a new KeysInterface which calls the relevant methods on this_arg.
10907  * This copies the `inner` pointer in this_arg and thus the returned KeysInterface must be freed before this_arg is
10908  */
10909 struct LDKKeysInterface KeysManager_as_KeysInterface(const struct LDKKeysManager *NONNULL_PTR this_arg);
10910
10911 /**
10912  * Frees any resources used by the ChannelManager, if is_owned is set and inner is non-NULL.
10913  */
10914 void ChannelManager_free(struct LDKChannelManager this_obj);
10915
10916 /**
10917  * Frees any resources used by the ChainParameters, if is_owned is set and inner is non-NULL.
10918  */
10919 void ChainParameters_free(struct LDKChainParameters this_obj);
10920
10921 /**
10922  * The network for determining the `chain_hash` in Lightning messages.
10923  */
10924 enum LDKNetwork ChainParameters_get_network(const struct LDKChainParameters *NONNULL_PTR this_ptr);
10925
10926 /**
10927  * The network for determining the `chain_hash` in Lightning messages.
10928  */
10929 void ChainParameters_set_network(struct LDKChainParameters *NONNULL_PTR this_ptr, enum LDKNetwork val);
10930
10931 /**
10932  * The hash and height of the latest block successfully connected.
10933  *
10934  * Used to track on-chain channel funding outputs and send payments with reliable timelocks.
10935  */
10936 struct LDKBestBlock ChainParameters_get_best_block(const struct LDKChainParameters *NONNULL_PTR this_ptr);
10937
10938 /**
10939  * The hash and height of the latest block successfully connected.
10940  *
10941  * Used to track on-chain channel funding outputs and send payments with reliable timelocks.
10942  */
10943 void ChainParameters_set_best_block(struct LDKChainParameters *NONNULL_PTR this_ptr, struct LDKBestBlock val);
10944
10945 /**
10946  * Constructs a new ChainParameters given each field
10947  */
10948 MUST_USE_RES struct LDKChainParameters ChainParameters_new(enum LDKNetwork network_arg, struct LDKBestBlock best_block_arg);
10949
10950 /**
10951  * Frees any resources used by the BestBlock, if is_owned is set and inner is non-NULL.
10952  */
10953 void BestBlock_free(struct LDKBestBlock this_obj);
10954
10955 /**
10956  * Creates a copy of the BestBlock
10957  */
10958 struct LDKBestBlock BestBlock_clone(const struct LDKBestBlock *NONNULL_PTR orig);
10959
10960 /**
10961  * Returns the best block from the genesis of the given network.
10962  */
10963 MUST_USE_RES struct LDKBestBlock BestBlock_from_genesis(enum LDKNetwork network);
10964
10965 /**
10966  * Returns the best block as identified by the given block hash and height.
10967  */
10968 MUST_USE_RES struct LDKBestBlock BestBlock_new(struct LDKThirtyTwoBytes block_hash, uint32_t height);
10969
10970 /**
10971  * Returns the best block hash.
10972  */
10973 MUST_USE_RES struct LDKThirtyTwoBytes BestBlock_block_hash(const struct LDKBestBlock *NONNULL_PTR this_arg);
10974
10975 /**
10976  * Returns the best block height.
10977  */
10978 MUST_USE_RES uint32_t BestBlock_height(const struct LDKBestBlock *NONNULL_PTR this_arg);
10979
10980 /**
10981  * Frees any resources used by the ChannelDetails, if is_owned is set and inner is non-NULL.
10982  */
10983 void ChannelDetails_free(struct LDKChannelDetails this_obj);
10984
10985 /**
10986  * The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
10987  * thereafter this is the txid of the funding transaction xor the funding transaction output).
10988  * Note that this means this value is *not* persistent - it can change once during the
10989  * lifetime of the channel.
10990  */
10991 const uint8_t (*ChannelDetails_get_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr))[32];
10992
10993 /**
10994  * The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
10995  * thereafter this is the txid of the funding transaction xor the funding transaction output).
10996  * Note that this means this value is *not* persistent - it can change once during the
10997  * lifetime of the channel.
10998  */
10999 void ChannelDetails_set_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
11000
11001 /**
11002  * The position of the funding transaction in the chain. None if the funding transaction has
11003  * not yet been confirmed and the channel fully opened.
11004  */
11005 struct LDKCOption_u64Z ChannelDetails_get_short_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
11006
11007 /**
11008  * The position of the funding transaction in the chain. None if the funding transaction has
11009  * not yet been confirmed and the channel fully opened.
11010  */
11011 void ChannelDetails_set_short_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
11012
11013 /**
11014  * The node_id of our counterparty
11015  */
11016 struct LDKPublicKey ChannelDetails_get_remote_network_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
11017
11018 /**
11019  * The node_id of our counterparty
11020  */
11021 void ChannelDetails_set_remote_network_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKPublicKey val);
11022
11023 /**
11024  * The Features the channel counterparty provided upon last connection.
11025  * Useful for routing as it is the most up-to-date copy of the counterparty's features and
11026  * many routing-relevant features are present in the init context.
11027  */
11028 struct LDKInitFeatures ChannelDetails_get_counterparty_features(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
11029
11030 /**
11031  * The Features the channel counterparty provided upon last connection.
11032  * Useful for routing as it is the most up-to-date copy of the counterparty's features and
11033  * many routing-relevant features are present in the init context.
11034  */
11035 void ChannelDetails_set_counterparty_features(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKInitFeatures val);
11036
11037 /**
11038  * The value, in satoshis, of this channel as appears in the funding output
11039  */
11040 uint64_t ChannelDetails_get_channel_value_satoshis(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
11041
11042 /**
11043  * The value, in satoshis, of this channel as appears in the funding output
11044  */
11045 void ChannelDetails_set_channel_value_satoshis(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
11046
11047 /**
11048  * The user_id passed in to create_channel, or 0 if the channel was inbound.
11049  */
11050 uint64_t ChannelDetails_get_user_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
11051
11052 /**
11053  * The user_id passed in to create_channel, or 0 if the channel was inbound.
11054  */
11055 void ChannelDetails_set_user_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
11056
11057 /**
11058  * The available outbound capacity for sending HTLCs to the remote peer. This does not include
11059  * any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
11060  * available for inclusion in new outbound HTLCs). This further does not include any pending
11061  * outgoing HTLCs which are awaiting some other resolution to be sent.
11062  */
11063 uint64_t ChannelDetails_get_outbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
11064
11065 /**
11066  * The available outbound capacity for sending HTLCs to the remote peer. This does not include
11067  * any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
11068  * available for inclusion in new outbound HTLCs). This further does not include any pending
11069  * outgoing HTLCs which are awaiting some other resolution to be sent.
11070  */
11071 void ChannelDetails_set_outbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
11072
11073 /**
11074  * The available inbound capacity for the remote peer to send HTLCs to us. This does not
11075  * include any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
11076  * available for inclusion in new inbound HTLCs).
11077  * Note that there are some corner cases not fully handled here, so the actual available
11078  * inbound capacity may be slightly higher than this.
11079  */
11080 uint64_t ChannelDetails_get_inbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
11081
11082 /**
11083  * The available inbound capacity for the remote peer to send HTLCs to us. This does not
11084  * include any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
11085  * available for inclusion in new inbound HTLCs).
11086  * Note that there are some corner cases not fully handled here, so the actual available
11087  * inbound capacity may be slightly higher than this.
11088  */
11089 void ChannelDetails_set_inbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
11090
11091 /**
11092  * True if the channel is (a) confirmed and funding_locked messages have been exchanged, (b)
11093  * the peer is connected, and (c) no monitor update failure is pending resolution.
11094  */
11095 bool ChannelDetails_get_is_live(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
11096
11097 /**
11098  * True if the channel is (a) confirmed and funding_locked messages have been exchanged, (b)
11099  * the peer is connected, and (c) no monitor update failure is pending resolution.
11100  */
11101 void ChannelDetails_set_is_live(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
11102
11103 /**
11104  * Creates a copy of the ChannelDetails
11105  */
11106 struct LDKChannelDetails ChannelDetails_clone(const struct LDKChannelDetails *NONNULL_PTR orig);
11107
11108 /**
11109  * Frees any resources used by the PaymentSendFailure
11110  */
11111 void PaymentSendFailure_free(struct LDKPaymentSendFailure this_ptr);
11112
11113 /**
11114  * Creates a copy of the PaymentSendFailure
11115  */
11116 struct LDKPaymentSendFailure PaymentSendFailure_clone(const struct LDKPaymentSendFailure *NONNULL_PTR orig);
11117
11118 /**
11119  * Constructs a new ChannelManager to hold several channels and route between them.
11120  *
11121  * This is the main \"logic hub\" for all channel-related actions, and implements
11122  * ChannelMessageHandler.
11123  *
11124  * Non-proportional fees are fixed according to our risk using the provided fee estimator.
11125  *
11126  * panics if channel_value_satoshis is >= `MAX_FUNDING_SATOSHIS`!
11127  *
11128  * Users need to notify the new ChannelManager when a new block is connected or
11129  * disconnected using its `block_connected` and `block_disconnected` methods, starting
11130  * from after `params.latest_hash`.
11131  */
11132 MUST_USE_RES struct LDKChannelManager ChannelManager_new(struct LDKFeeEstimator fee_est, struct LDKWatch chain_monitor, struct LDKBroadcasterInterface tx_broadcaster, struct LDKLogger logger, struct LDKKeysInterface keys_manager, struct LDKUserConfig config, struct LDKChainParameters params);
11133
11134 /**
11135  * Gets the current configuration applied to all new channels,  as
11136  */
11137 MUST_USE_RES struct LDKUserConfig ChannelManager_get_current_default_configuration(const struct LDKChannelManager *NONNULL_PTR this_arg);
11138
11139 /**
11140  * Creates a new outbound channel to the given remote node and with the given value.
11141  *
11142  * user_id will be provided back as user_channel_id in FundingGenerationReady events to allow
11143  * tracking of which events correspond with which create_channel call. Note that the
11144  * user_channel_id defaults to 0 for inbound channels, so you may wish to avoid using 0 for
11145  * user_id here. user_id has no meaning inside of LDK, it is simply copied to events and
11146  * otherwise ignored.
11147  *
11148  * If successful, will generate a SendOpenChannel message event, so you should probably poll
11149  * PeerManager::process_events afterwards.
11150  *
11151  * Raises APIError::APIMisuseError when channel_value_satoshis > 2**24 or push_msat is
11152  * greater than channel_value_satoshis * 1k or channel_value_satoshis is < 1000.
11153  */
11154 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_create_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKPublicKey their_network_key, uint64_t channel_value_satoshis, uint64_t push_msat, uint64_t user_id, struct LDKUserConfig override_config);
11155
11156 /**
11157  * Gets the list of open channels, in random order. See ChannelDetail field documentation for
11158  * more information.
11159  */
11160 MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
11161
11162 /**
11163  * Gets the list of usable channels, in random order. Useful as an argument to
11164  * get_route to ensure non-announced channels are used.
11165  *
11166  * These are guaranteed to have their is_live value set to true, see the documentation for
11167  * ChannelDetails::is_live for more info on exactly what the criteria are.
11168  */
11169 MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_usable_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
11170
11171 /**
11172  * Begins the process of closing a channel. After this call (plus some timeout), no new HTLCs
11173  * will be accepted on the given channel, and after additional timeout/the closing of all
11174  * pending HTLCs, the channel will be closed on chain.
11175  *
11176  * May generate a SendShutdown message event on success, which should be relayed.
11177  */
11178 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_close_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32]);
11179
11180 /**
11181  * Force closes a channel, immediately broadcasting the latest local commitment transaction to
11182  * the chain and rejecting new HTLCs on the given channel. Fails if channel_id is unknown to the manager.
11183  */
11184 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_force_close_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32]);
11185
11186 /**
11187  * Force close all channels, immediately broadcasting the latest local commitment transaction
11188  * for each to the chain and rejecting new HTLCs on each.
11189  */
11190 void ChannelManager_force_close_all_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
11191
11192 /**
11193  * Sends a payment along a given route.
11194  *
11195  * Value parameters are provided via the last hop in route, see documentation for RouteHop
11196  * fields for more info.
11197  *
11198  * Note that if the payment_hash already exists elsewhere (eg you're sending a duplicative
11199  * payment), we don't do anything to stop you! We always try to ensure that if the provided
11200  * next hop knows the preimage to payment_hash they can claim an additional amount as
11201  * specified in the last hop in the route! Thus, you should probably do your own
11202  * payment_preimage tracking (which you should already be doing as they represent \"proof of
11203  * payment\") and prevent double-sends yourself.
11204  *
11205  * May generate SendHTLCs message(s) event on success, which should be relayed.
11206  *
11207  * Each path may have a different return value, and PaymentSendValue may return a Vec with
11208  * each entry matching the corresponding-index entry in the route paths, see
11209  * PaymentSendFailure for more info.
11210  *
11211  * In general, a path may raise:
11212  *  * APIError::RouteError when an invalid route or forwarding parameter (cltv_delta, fee,
11213  *    node public key) is specified.
11214  *  * APIError::ChannelUnavailable if the next-hop channel is not available for updates
11215  *    (including due to previous monitor update failure or new permanent monitor update
11216  *    failure).
11217  *  * APIError::MonitorUpdateFailed if a new monitor update failure prevented sending the
11218  *    relevant updates.
11219  *
11220  * Note that depending on the type of the PaymentSendFailure the HTLC may have been
11221  * irrevocably committed to on our end. In such a case, do NOT retry the payment with a
11222  * different route unless you intend to pay twice!
11223  *
11224  * payment_secret is unrelated to payment_hash (or PaymentPreimage) and exists to authenticate
11225  * the sender to the recipient and prevent payment-probing (deanonymization) attacks. For
11226  * newer nodes, it will be provided to you in the invoice. If you do not have one, the Route
11227  * must not contain multiple paths as multi-path payments require a recipient-provided
11228  * payment_secret.
11229  * If a payment_secret *is* provided, we assume that the invoice had the payment_secret feature
11230  * bit set (either as required or as available). If multiple paths are present in the Route,
11231  * we assume the invoice had the basic_mpp feature set.
11232  */
11233 MUST_USE_RES struct LDKCResult_NonePaymentSendFailureZ ChannelManager_send_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_hash, struct LDKThirtyTwoBytes payment_secret);
11234
11235 /**
11236  * Call this upon creation of a funding transaction for the given channel.
11237  *
11238  * Returns an [`APIError::APIMisuseError`] if the funding_transaction spent non-SegWit outputs
11239  * or if no output was found which matches the parameters in [`Event::FundingGenerationReady`].
11240  *
11241  * Panics if a funding transaction has already been provided for this channel.
11242  *
11243  * May panic if the output found in the funding transaction is duplicative with some other
11244  * channel (note that this should be trivially prevented by using unique funding transaction
11245  * keys per-channel).
11246  *
11247  * Do NOT broadcast the funding transaction yourself. When we have safely received our
11248  * counterparty's signature the funding transaction will automatically be broadcast via the
11249  * [`BroadcasterInterface`] provided when this `ChannelManager` was constructed.
11250  *
11251  * Note that this includes RBF or similar transaction replacement strategies - lightning does
11252  * not currently support replacing a funding transaction on an existing channel. Instead,
11253  * create a new channel with a conflicting funding transaction.
11254  */
11255 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_funding_transaction_generated(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*temporary_channel_id)[32], struct LDKTransaction funding_transaction);
11256
11257 /**
11258  * Generates a signed node_announcement from the given arguments and creates a
11259  * BroadcastNodeAnnouncement event. Note that such messages will be ignored unless peers have
11260  * seen a channel_announcement from us (ie unless we have public channels open).
11261  *
11262  * RGB is a node \"color\" and alias is a printable human-readable string to describe this node
11263  * to humans. They carry no in-protocol meaning.
11264  *
11265  * addresses represent the set (possibly empty) of socket addresses on which this node accepts
11266  * incoming connections. These will be broadcast to the network, publicly tying these
11267  * addresses together. If you wish to preserve user privacy, addresses should likely contain
11268  * only Tor Onion addresses.
11269  *
11270  * Panics if addresses is absurdly large (more than 500).
11271  */
11272 void ChannelManager_broadcast_node_announcement(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThreeBytes rgb, struct LDKThirtyTwoBytes alias, struct LDKCVec_NetAddressZ addresses);
11273
11274 /**
11275  * Processes HTLCs which are pending waiting on random forward delay.
11276  *
11277  * Should only really ever be called in response to a PendingHTLCsForwardable event.
11278  * Will likely generate further events.
11279  */
11280 void ChannelManager_process_pending_htlc_forwards(const struct LDKChannelManager *NONNULL_PTR this_arg);
11281
11282 /**
11283  * If a peer is disconnected we mark any channels with that peer as 'disabled'.
11284  * After some time, if channels are still disabled we need to broadcast a ChannelUpdate
11285  * to inform the network about the uselessness of these channels.
11286  *
11287  * This method handles all the details, and must be called roughly once per minute.
11288  *
11289  * Note that in some rare cases this may generate a `chain::Watch::update_channel` call.
11290  */
11291 void ChannelManager_timer_tick_occurred(const struct LDKChannelManager *NONNULL_PTR this_arg);
11292
11293 /**
11294  * Indicates that the preimage for payment_hash is unknown or the received amount is incorrect
11295  * after a PaymentReceived event, failing the HTLC back to its origin and freeing resources
11296  * along the path (including in our own channel on which we received it).
11297  * Returns false if no payment was found to fail backwards, true if the process of failing the
11298  * HTLC backwards has been started.
11299  */
11300 MUST_USE_RES bool ChannelManager_fail_htlc_backwards(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*payment_hash)[32], struct LDKThirtyTwoBytes payment_secret);
11301
11302 /**
11303  * Provides a payment preimage in response to a PaymentReceived event, returning true and
11304  * generating message events for the net layer to claim the payment, if possible. Thus, you
11305  * should probably kick the net layer to go send messages if this returns true!
11306  *
11307  * You must specify the expected amounts for this HTLC, and we will only claim HTLCs
11308  * available within a few percent of the expected amount. This is critical for several
11309  * reasons : a) it avoids providing senders with `proof-of-payment` (in the form of the
11310  * payment_preimage without having provided the full value and b) it avoids certain
11311  * privacy-breaking recipient-probing attacks which may reveal payment activity to
11312  * motivated attackers.
11313  *
11314  * Note that the privacy concerns in (b) are not relevant in payments with a payment_secret
11315  * set. Thus, for such payments we will claim any payments which do not under-pay.
11316  *
11317  * May panic if called except in response to a PaymentReceived event.
11318  */
11319 MUST_USE_RES bool ChannelManager_claim_funds(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_preimage, struct LDKThirtyTwoBytes payment_secret, uint64_t expected_amount);
11320
11321 /**
11322  * Gets the node_id held by this ChannelManager
11323  */
11324 MUST_USE_RES struct LDKPublicKey ChannelManager_get_our_node_id(const struct LDKChannelManager *NONNULL_PTR this_arg);
11325
11326 /**
11327  * Restores a single, given channel to normal operation after a
11328  * ChannelMonitorUpdateErr::TemporaryFailure was returned from a channel monitor update
11329  * operation.
11330  *
11331  * All ChannelMonitor updates up to and including highest_applied_update_id must have been
11332  * fully committed in every copy of the given channels' ChannelMonitors.
11333  *
11334  * Note that there is no effect to calling with a highest_applied_update_id other than the
11335  * current latest ChannelMonitorUpdate and one call to this function after multiple
11336  * ChannelMonitorUpdateErr::TemporaryFailures is fine. The highest_applied_update_id field
11337  * exists largely only to prevent races between this and concurrent update_monitor calls.
11338  *
11339  * Thus, the anticipated use is, at a high level:
11340  *  1) You register a chain::Watch with this ChannelManager,
11341  *  2) it stores each update to disk, and begins updating any remote (eg watchtower) copies of
11342  *     said ChannelMonitors as it can, returning ChannelMonitorUpdateErr::TemporaryFailures
11343  *     any time it cannot do so instantly,
11344  *  3) update(s) are applied to each remote copy of a ChannelMonitor,
11345  *  4) once all remote copies are updated, you call this function with the update_id that
11346  *     completed, and once it is the latest the Channel will be re-enabled.
11347  */
11348 void ChannelManager_channel_monitor_updated(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKOutPoint *NONNULL_PTR funding_txo, uint64_t highest_applied_update_id);
11349
11350 /**
11351  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
11352  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
11353  */
11354 struct LDKMessageSendEventsProvider ChannelManager_as_MessageSendEventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg);
11355
11356 /**
11357  * Constructs a new EventsProvider which calls the relevant methods on this_arg.
11358  * This copies the `inner` pointer in this_arg and thus the returned EventsProvider must be freed before this_arg is
11359  */
11360 struct LDKEventsProvider ChannelManager_as_EventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg);
11361
11362 /**
11363  * Constructs a new Listen which calls the relevant methods on this_arg.
11364  * This copies the `inner` pointer in this_arg and thus the returned Listen must be freed before this_arg is
11365  */
11366 struct LDKListen ChannelManager_as_Listen(const struct LDKChannelManager *NONNULL_PTR this_arg);
11367
11368 /**
11369  * Updates channel state to take note of transactions which were confirmed in the given block
11370  * at the given height.
11371  *
11372  * Note that you must still call (or have called) [`update_best_block`] with the block
11373  * information which is included here.
11374  *
11375  * This method may be called before or after [`update_best_block`] for a given block's
11376  * transaction data and may be called multiple times with additional transaction data for a
11377  * given block.
11378  *
11379  * This method may be called for a previous block after an [`update_best_block`] call has
11380  * been made for a later block, however it must *not* be called with transaction data from a
11381  * block which is no longer in the best chain (ie where [`update_best_block`] has already
11382  * been informed about a blockchain reorganization which no longer includes the block which
11383  * corresponds to `header`).
11384  *
11385  * [`update_best_block`]: `Self::update_best_block`
11386  */
11387 void ChannelManager_transactions_confirmed(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*header)[80], uint32_t height, struct LDKCVec_C2Tuple_usizeTransactionZZ txdata);
11388
11389 /**
11390  * Updates channel state with the current best blockchain tip. You should attempt to call this
11391  * quickly after a new block becomes available, however if multiple new blocks become
11392  * available at the same time, only a single `update_best_block()` call needs to be made.
11393  *
11394  * This method should also be called immediately after any block disconnections, once at the
11395  * reorganization fork point, and once with the new chain tip. Calling this method at the
11396  * blockchain reorganization fork point ensures we learn when a funding transaction which was
11397  * previously confirmed is reorganized out of the blockchain, ensuring we do not continue to
11398  * accept payments which cannot be enforced on-chain.
11399  *
11400  * In both the block-connection and block-disconnection case, this method may be called either
11401  * once per block connected or disconnected, or simply at the fork point and new tip(s),
11402  * skipping any intermediary blocks.
11403  */
11404 void ChannelManager_update_best_block(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*header)[80], uint32_t height);
11405
11406 /**
11407  * Gets the set of txids which should be monitored for their confirmation state.
11408  *
11409  * If you're providing information about reorganizations via [`transaction_unconfirmed`], this
11410  * is the set of transactions which you may need to call [`transaction_unconfirmed`] for.
11411  *
11412  * This may be useful to poll to determine the set of transactions which must be registered
11413  * with an Electrum server or for which an Electrum server needs to be polled to determine
11414  * transaction confirmation state.
11415  *
11416  * This may update after any [`transactions_confirmed`] or [`block_connected`] call.
11417  *
11418  * Note that this is NOT the set of transactions which must be included in calls to
11419  * [`transactions_confirmed`] if they are confirmed, but a small subset of it.
11420  *
11421  * [`transactions_confirmed`]: Self::transactions_confirmed
11422  * [`transaction_unconfirmed`]: Self::transaction_unconfirmed
11423  * [`block_connected`]: chain::Listen::block_connected
11424  */
11425 MUST_USE_RES struct LDKCVec_TxidZ ChannelManager_get_relevant_txids(const struct LDKChannelManager *NONNULL_PTR this_arg);
11426
11427 /**
11428  * Marks a transaction as having been reorganized out of the blockchain.
11429  *
11430  * If a transaction is included in [`get_relevant_txids`], and is no longer in the main branch
11431  * of the blockchain, this function should be called to indicate that the transaction should
11432  * be considered reorganized out.
11433  *
11434  * Once this is called, the given transaction will no longer appear on [`get_relevant_txids`],
11435  * though this may be called repeatedly for a given transaction without issue.
11436  *
11437  * Note that if the transaction is confirmed on the main chain in a different block (indicated
11438  * via a call to [`transactions_confirmed`]), it may re-appear in [`get_relevant_txids`], thus
11439  * be very wary of race-conditions wherein the final state of a transaction indicated via
11440  * these APIs is not the same as its state on the blockchain.
11441  *
11442  * [`transactions_confirmed`]: Self::transactions_confirmed
11443  * [`get_relevant_txids`]: Self::get_relevant_txids
11444  */
11445 void ChannelManager_transaction_unconfirmed(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*txid)[32]);
11446
11447 /**
11448  * Blocks until ChannelManager needs to be persisted or a timeout is reached. It returns a bool
11449  * indicating whether persistence is necessary. Only one listener on
11450  * `await_persistable_update` or `await_persistable_update_timeout` is guaranteed to be woken
11451  * up.
11452  * Note that the feature `allow_wallclock_use` must be enabled to use this function.
11453  */
11454 MUST_USE_RES bool ChannelManager_await_persistable_update_timeout(const struct LDKChannelManager *NONNULL_PTR this_arg, uint64_t max_wait);
11455
11456 /**
11457  * Blocks until ChannelManager needs to be persisted. Only one listener on
11458  * `await_persistable_update` or `await_persistable_update_timeout` is guaranteed to be woken
11459  * up.
11460  */
11461 void ChannelManager_await_persistable_update(const struct LDKChannelManager *NONNULL_PTR this_arg);
11462
11463 /**
11464  * Constructs a new ChannelMessageHandler which calls the relevant methods on this_arg.
11465  * This copies the `inner` pointer in this_arg and thus the returned ChannelMessageHandler must be freed before this_arg is
11466  */
11467 struct LDKChannelMessageHandler ChannelManager_as_ChannelMessageHandler(const struct LDKChannelManager *NONNULL_PTR this_arg);
11468
11469 /**
11470  * Serialize the ChannelManager object into a byte array which can be read by ChannelManager_read
11471  */
11472 struct LDKCVec_u8Z ChannelManager_write(const struct LDKChannelManager *NONNULL_PTR obj);
11473
11474 /**
11475  * Frees any resources used by the ChannelManagerReadArgs, if is_owned is set and inner is non-NULL.
11476  */
11477 void ChannelManagerReadArgs_free(struct LDKChannelManagerReadArgs this_obj);
11478
11479 /**
11480  * The keys provider which will give us relevant keys. Some keys will be loaded during
11481  * deserialization and KeysInterface::read_chan_signer will be used to read per-Channel
11482  * signing data.
11483  */
11484 const struct LDKKeysInterface *ChannelManagerReadArgs_get_keys_manager(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
11485
11486 /**
11487  * The keys provider which will give us relevant keys. Some keys will be loaded during
11488  * deserialization and KeysInterface::read_chan_signer will be used to read per-Channel
11489  * signing data.
11490  */
11491 void ChannelManagerReadArgs_set_keys_manager(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKKeysInterface val);
11492
11493 /**
11494  * The fee_estimator for use in the ChannelManager in the future.
11495  *
11496  * No calls to the FeeEstimator will be made during deserialization.
11497  */
11498 const struct LDKFeeEstimator *ChannelManagerReadArgs_get_fee_estimator(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
11499
11500 /**
11501  * The fee_estimator for use in the ChannelManager in the future.
11502  *
11503  * No calls to the FeeEstimator will be made during deserialization.
11504  */
11505 void ChannelManagerReadArgs_set_fee_estimator(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKFeeEstimator val);
11506
11507 /**
11508  * The chain::Watch for use in the ChannelManager in the future.
11509  *
11510  * No calls to the chain::Watch will be made during deserialization. It is assumed that
11511  * you have deserialized ChannelMonitors separately and will add them to your
11512  * chain::Watch after deserializing this ChannelManager.
11513  */
11514 const struct LDKWatch *ChannelManagerReadArgs_get_chain_monitor(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
11515
11516 /**
11517  * The chain::Watch for use in the ChannelManager in the future.
11518  *
11519  * No calls to the chain::Watch will be made during deserialization. It is assumed that
11520  * you have deserialized ChannelMonitors separately and will add them to your
11521  * chain::Watch after deserializing this ChannelManager.
11522  */
11523 void ChannelManagerReadArgs_set_chain_monitor(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKWatch val);
11524
11525 /**
11526  * The BroadcasterInterface which will be used in the ChannelManager in the future and may be
11527  * used to broadcast the latest local commitment transactions of channels which must be
11528  * force-closed during deserialization.
11529  */
11530 const struct LDKBroadcasterInterface *ChannelManagerReadArgs_get_tx_broadcaster(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
11531
11532 /**
11533  * The BroadcasterInterface which will be used in the ChannelManager in the future and may be
11534  * used to broadcast the latest local commitment transactions of channels which must be
11535  * force-closed during deserialization.
11536  */
11537 void ChannelManagerReadArgs_set_tx_broadcaster(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKBroadcasterInterface val);
11538
11539 /**
11540  * The Logger for use in the ChannelManager and which may be used to log information during
11541  * deserialization.
11542  */
11543 const struct LDKLogger *ChannelManagerReadArgs_get_logger(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
11544
11545 /**
11546  * The Logger for use in the ChannelManager and which may be used to log information during
11547  * deserialization.
11548  */
11549 void ChannelManagerReadArgs_set_logger(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKLogger val);
11550
11551 /**
11552  * Default settings used for new channels. Any existing channels will continue to use the
11553  * runtime settings which were stored when the ChannelManager was serialized.
11554  */
11555 struct LDKUserConfig ChannelManagerReadArgs_get_default_config(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
11556
11557 /**
11558  * Default settings used for new channels. Any existing channels will continue to use the
11559  * runtime settings which were stored when the ChannelManager was serialized.
11560  */
11561 void ChannelManagerReadArgs_set_default_config(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKUserConfig val);
11562
11563 /**
11564  * Simple utility function to create a ChannelManagerReadArgs which creates the monitor
11565  * HashMap for you. This is primarily useful for C bindings where it is not practical to
11566  * populate a HashMap directly from C.
11567  */
11568 MUST_USE_RES struct LDKChannelManagerReadArgs ChannelManagerReadArgs_new(struct LDKKeysInterface keys_manager, struct LDKFeeEstimator fee_estimator, struct LDKWatch chain_monitor, struct LDKBroadcasterInterface tx_broadcaster, struct LDKLogger logger, struct LDKUserConfig default_config, struct LDKCVec_ChannelMonitorZ channel_monitors);
11569
11570 /**
11571  * Read a C2Tuple_BlockHashChannelManagerZ from a byte array, created by C2Tuple_BlockHashChannelManagerZ_write
11572  */
11573 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ C2Tuple_BlockHashChannelManagerZ_read(struct LDKu8slice ser, struct LDKChannelManagerReadArgs arg);
11574
11575 /**
11576  * Frees any resources used by the DecodeError, if is_owned is set and inner is non-NULL.
11577  */
11578 void DecodeError_free(struct LDKDecodeError this_obj);
11579
11580 /**
11581  * Creates a copy of the DecodeError
11582  */
11583 struct LDKDecodeError DecodeError_clone(const struct LDKDecodeError *NONNULL_PTR orig);
11584
11585 /**
11586  * Frees any resources used by the Init, if is_owned is set and inner is non-NULL.
11587  */
11588 void Init_free(struct LDKInit this_obj);
11589
11590 /**
11591  * The relevant features which the sender supports
11592  */
11593 struct LDKInitFeatures Init_get_features(const struct LDKInit *NONNULL_PTR this_ptr);
11594
11595 /**
11596  * The relevant features which the sender supports
11597  */
11598 void Init_set_features(struct LDKInit *NONNULL_PTR this_ptr, struct LDKInitFeatures val);
11599
11600 /**
11601  * Constructs a new Init given each field
11602  */
11603 MUST_USE_RES struct LDKInit Init_new(struct LDKInitFeatures features_arg);
11604
11605 /**
11606  * Creates a copy of the Init
11607  */
11608 struct LDKInit Init_clone(const struct LDKInit *NONNULL_PTR orig);
11609
11610 /**
11611  * Frees any resources used by the ErrorMessage, if is_owned is set and inner is non-NULL.
11612  */
11613 void ErrorMessage_free(struct LDKErrorMessage this_obj);
11614
11615 /**
11616  * The channel ID involved in the error
11617  */
11618 const uint8_t (*ErrorMessage_get_channel_id(const struct LDKErrorMessage *NONNULL_PTR this_ptr))[32];
11619
11620 /**
11621  * The channel ID involved in the error
11622  */
11623 void ErrorMessage_set_channel_id(struct LDKErrorMessage *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
11624
11625 /**
11626  * A possibly human-readable error description.
11627  * The string should be sanitized before it is used (e.g. emitted to logs
11628  * or printed to stdout).  Otherwise, a well crafted error message may trigger a security
11629  * vulnerability in the terminal emulator or the logging subsystem.
11630  */
11631 struct LDKStr ErrorMessage_get_data(const struct LDKErrorMessage *NONNULL_PTR this_ptr);
11632
11633 /**
11634  * A possibly human-readable error description.
11635  * The string should be sanitized before it is used (e.g. emitted to logs
11636  * or printed to stdout).  Otherwise, a well crafted error message may trigger a security
11637  * vulnerability in the terminal emulator or the logging subsystem.
11638  */
11639 void ErrorMessage_set_data(struct LDKErrorMessage *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
11640
11641 /**
11642  * Constructs a new ErrorMessage given each field
11643  */
11644 MUST_USE_RES struct LDKErrorMessage ErrorMessage_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKCVec_u8Z data_arg);
11645
11646 /**
11647  * Creates a copy of the ErrorMessage
11648  */
11649 struct LDKErrorMessage ErrorMessage_clone(const struct LDKErrorMessage *NONNULL_PTR orig);
11650
11651 /**
11652  * Frees any resources used by the Ping, if is_owned is set and inner is non-NULL.
11653  */
11654 void Ping_free(struct LDKPing this_obj);
11655
11656 /**
11657  * The desired response length
11658  */
11659 uint16_t Ping_get_ponglen(const struct LDKPing *NONNULL_PTR this_ptr);
11660
11661 /**
11662  * The desired response length
11663  */
11664 void Ping_set_ponglen(struct LDKPing *NONNULL_PTR this_ptr, uint16_t val);
11665
11666 /**
11667  * The ping packet size.
11668  * This field is not sent on the wire. byteslen zeros are sent.
11669  */
11670 uint16_t Ping_get_byteslen(const struct LDKPing *NONNULL_PTR this_ptr);
11671
11672 /**
11673  * The ping packet size.
11674  * This field is not sent on the wire. byteslen zeros are sent.
11675  */
11676 void Ping_set_byteslen(struct LDKPing *NONNULL_PTR this_ptr, uint16_t val);
11677
11678 /**
11679  * Constructs a new Ping given each field
11680  */
11681 MUST_USE_RES struct LDKPing Ping_new(uint16_t ponglen_arg, uint16_t byteslen_arg);
11682
11683 /**
11684  * Creates a copy of the Ping
11685  */
11686 struct LDKPing Ping_clone(const struct LDKPing *NONNULL_PTR orig);
11687
11688 /**
11689  * Frees any resources used by the Pong, if is_owned is set and inner is non-NULL.
11690  */
11691 void Pong_free(struct LDKPong this_obj);
11692
11693 /**
11694  * The pong packet size.
11695  * This field is not sent on the wire. byteslen zeros are sent.
11696  */
11697 uint16_t Pong_get_byteslen(const struct LDKPong *NONNULL_PTR this_ptr);
11698
11699 /**
11700  * The pong packet size.
11701  * This field is not sent on the wire. byteslen zeros are sent.
11702  */
11703 void Pong_set_byteslen(struct LDKPong *NONNULL_PTR this_ptr, uint16_t val);
11704
11705 /**
11706  * Constructs a new Pong given each field
11707  */
11708 MUST_USE_RES struct LDKPong Pong_new(uint16_t byteslen_arg);
11709
11710 /**
11711  * Creates a copy of the Pong
11712  */
11713 struct LDKPong Pong_clone(const struct LDKPong *NONNULL_PTR orig);
11714
11715 /**
11716  * Frees any resources used by the OpenChannel, if is_owned is set and inner is non-NULL.
11717  */
11718 void OpenChannel_free(struct LDKOpenChannel this_obj);
11719
11720 /**
11721  * The genesis hash of the blockchain where the channel is to be opened
11722  */
11723 const uint8_t (*OpenChannel_get_chain_hash(const struct LDKOpenChannel *NONNULL_PTR this_ptr))[32];
11724
11725 /**
11726  * The genesis hash of the blockchain where the channel is to be opened
11727  */
11728 void OpenChannel_set_chain_hash(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
11729
11730 /**
11731  * A temporary channel ID, until the funding outpoint is announced
11732  */
11733 const uint8_t (*OpenChannel_get_temporary_channel_id(const struct LDKOpenChannel *NONNULL_PTR this_ptr))[32];
11734
11735 /**
11736  * A temporary channel ID, until the funding outpoint is announced
11737  */
11738 void OpenChannel_set_temporary_channel_id(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
11739
11740 /**
11741  * The channel value
11742  */
11743 uint64_t OpenChannel_get_funding_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
11744
11745 /**
11746  * The channel value
11747  */
11748 void OpenChannel_set_funding_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
11749
11750 /**
11751  * The amount to push to the counterparty as part of the open, in milli-satoshi
11752  */
11753 uint64_t OpenChannel_get_push_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
11754
11755 /**
11756  * The amount to push to the counterparty as part of the open, in milli-satoshi
11757  */
11758 void OpenChannel_set_push_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
11759
11760 /**
11761  * The threshold below which outputs on transactions broadcast by sender will be omitted
11762  */
11763 uint64_t OpenChannel_get_dust_limit_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
11764
11765 /**
11766  * The threshold below which outputs on transactions broadcast by sender will be omitted
11767  */
11768 void OpenChannel_set_dust_limit_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
11769
11770 /**
11771  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
11772  */
11773 uint64_t OpenChannel_get_max_htlc_value_in_flight_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
11774
11775 /**
11776  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
11777  */
11778 void OpenChannel_set_max_htlc_value_in_flight_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
11779
11780 /**
11781  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
11782  */
11783 uint64_t OpenChannel_get_channel_reserve_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
11784
11785 /**
11786  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
11787  */
11788 void OpenChannel_set_channel_reserve_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
11789
11790 /**
11791  * The minimum HTLC size incoming to sender, in milli-satoshi
11792  */
11793 uint64_t OpenChannel_get_htlc_minimum_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
11794
11795 /**
11796  * The minimum HTLC size incoming to sender, in milli-satoshi
11797  */
11798 void OpenChannel_set_htlc_minimum_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
11799
11800 /**
11801  * The feerate per 1000-weight of sender generated transactions, until updated by update_fee
11802  */
11803 uint32_t OpenChannel_get_feerate_per_kw(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
11804
11805 /**
11806  * The feerate per 1000-weight of sender generated transactions, until updated by update_fee
11807  */
11808 void OpenChannel_set_feerate_per_kw(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint32_t val);
11809
11810 /**
11811  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
11812  */
11813 uint16_t OpenChannel_get_to_self_delay(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
11814
11815 /**
11816  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
11817  */
11818 void OpenChannel_set_to_self_delay(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint16_t val);
11819
11820 /**
11821  * The maximum number of inbound HTLCs towards sender
11822  */
11823 uint16_t OpenChannel_get_max_accepted_htlcs(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
11824
11825 /**
11826  * The maximum number of inbound HTLCs towards sender
11827  */
11828 void OpenChannel_set_max_accepted_htlcs(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint16_t val);
11829
11830 /**
11831  * The sender's key controlling the funding transaction
11832  */
11833 struct LDKPublicKey OpenChannel_get_funding_pubkey(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
11834
11835 /**
11836  * The sender's key controlling the funding transaction
11837  */
11838 void OpenChannel_set_funding_pubkey(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
11839
11840 /**
11841  * Used to derive a revocation key for transactions broadcast by counterparty
11842  */
11843 struct LDKPublicKey OpenChannel_get_revocation_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
11844
11845 /**
11846  * Used to derive a revocation key for transactions broadcast by counterparty
11847  */
11848 void OpenChannel_set_revocation_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
11849
11850 /**
11851  * A payment key to sender for transactions broadcast by counterparty
11852  */
11853 struct LDKPublicKey OpenChannel_get_payment_point(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
11854
11855 /**
11856  * A payment key to sender for transactions broadcast by counterparty
11857  */
11858 void OpenChannel_set_payment_point(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
11859
11860 /**
11861  * Used to derive a payment key to sender for transactions broadcast by sender
11862  */
11863 struct LDKPublicKey OpenChannel_get_delayed_payment_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
11864
11865 /**
11866  * Used to derive a payment key to sender for transactions broadcast by sender
11867  */
11868 void OpenChannel_set_delayed_payment_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
11869
11870 /**
11871  * Used to derive an HTLC payment key to sender
11872  */
11873 struct LDKPublicKey OpenChannel_get_htlc_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
11874
11875 /**
11876  * Used to derive an HTLC payment key to sender
11877  */
11878 void OpenChannel_set_htlc_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
11879
11880 /**
11881  * The first to-be-broadcast-by-sender transaction's per commitment point
11882  */
11883 struct LDKPublicKey OpenChannel_get_first_per_commitment_point(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
11884
11885 /**
11886  * The first to-be-broadcast-by-sender transaction's per commitment point
11887  */
11888 void OpenChannel_set_first_per_commitment_point(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
11889
11890 /**
11891  * Channel flags
11892  */
11893 uint8_t OpenChannel_get_channel_flags(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
11894
11895 /**
11896  * Channel flags
11897  */
11898 void OpenChannel_set_channel_flags(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint8_t val);
11899
11900 /**
11901  * Creates a copy of the OpenChannel
11902  */
11903 struct LDKOpenChannel OpenChannel_clone(const struct LDKOpenChannel *NONNULL_PTR orig);
11904
11905 /**
11906  * Frees any resources used by the AcceptChannel, if is_owned is set and inner is non-NULL.
11907  */
11908 void AcceptChannel_free(struct LDKAcceptChannel this_obj);
11909
11910 /**
11911  * A temporary channel ID, until the funding outpoint is announced
11912  */
11913 const uint8_t (*AcceptChannel_get_temporary_channel_id(const struct LDKAcceptChannel *NONNULL_PTR this_ptr))[32];
11914
11915 /**
11916  * A temporary channel ID, until the funding outpoint is announced
11917  */
11918 void AcceptChannel_set_temporary_channel_id(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
11919
11920 /**
11921  * The threshold below which outputs on transactions broadcast by sender will be omitted
11922  */
11923 uint64_t AcceptChannel_get_dust_limit_satoshis(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
11924
11925 /**
11926  * The threshold below which outputs on transactions broadcast by sender will be omitted
11927  */
11928 void AcceptChannel_set_dust_limit_satoshis(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
11929
11930 /**
11931  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
11932  */
11933 uint64_t AcceptChannel_get_max_htlc_value_in_flight_msat(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
11934
11935 /**
11936  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
11937  */
11938 void AcceptChannel_set_max_htlc_value_in_flight_msat(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
11939
11940 /**
11941  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
11942  */
11943 uint64_t AcceptChannel_get_channel_reserve_satoshis(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
11944
11945 /**
11946  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
11947  */
11948 void AcceptChannel_set_channel_reserve_satoshis(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
11949
11950 /**
11951  * The minimum HTLC size incoming to sender, in milli-satoshi
11952  */
11953 uint64_t AcceptChannel_get_htlc_minimum_msat(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
11954
11955 /**
11956  * The minimum HTLC size incoming to sender, in milli-satoshi
11957  */
11958 void AcceptChannel_set_htlc_minimum_msat(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
11959
11960 /**
11961  * Minimum depth of the funding transaction before the channel is considered open
11962  */
11963 uint32_t AcceptChannel_get_minimum_depth(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
11964
11965 /**
11966  * Minimum depth of the funding transaction before the channel is considered open
11967  */
11968 void AcceptChannel_set_minimum_depth(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint32_t val);
11969
11970 /**
11971  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
11972  */
11973 uint16_t AcceptChannel_get_to_self_delay(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
11974
11975 /**
11976  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
11977  */
11978 void AcceptChannel_set_to_self_delay(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint16_t val);
11979
11980 /**
11981  * The maximum number of inbound HTLCs towards sender
11982  */
11983 uint16_t AcceptChannel_get_max_accepted_htlcs(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
11984
11985 /**
11986  * The maximum number of inbound HTLCs towards sender
11987  */
11988 void AcceptChannel_set_max_accepted_htlcs(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint16_t val);
11989
11990 /**
11991  * The sender's key controlling the funding transaction
11992  */
11993 struct LDKPublicKey AcceptChannel_get_funding_pubkey(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
11994
11995 /**
11996  * The sender's key controlling the funding transaction
11997  */
11998 void AcceptChannel_set_funding_pubkey(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
11999
12000 /**
12001  * Used to derive a revocation key for transactions broadcast by counterparty
12002  */
12003 struct LDKPublicKey AcceptChannel_get_revocation_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
12004
12005 /**
12006  * Used to derive a revocation key for transactions broadcast by counterparty
12007  */
12008 void AcceptChannel_set_revocation_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
12009
12010 /**
12011  * A payment key to sender for transactions broadcast by counterparty
12012  */
12013 struct LDKPublicKey AcceptChannel_get_payment_point(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
12014
12015 /**
12016  * A payment key to sender for transactions broadcast by counterparty
12017  */
12018 void AcceptChannel_set_payment_point(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
12019
12020 /**
12021  * Used to derive a payment key to sender for transactions broadcast by sender
12022  */
12023 struct LDKPublicKey AcceptChannel_get_delayed_payment_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
12024
12025 /**
12026  * Used to derive a payment key to sender for transactions broadcast by sender
12027  */
12028 void AcceptChannel_set_delayed_payment_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
12029
12030 /**
12031  * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
12032  */
12033 struct LDKPublicKey AcceptChannel_get_htlc_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
12034
12035 /**
12036  * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
12037  */
12038 void AcceptChannel_set_htlc_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
12039
12040 /**
12041  * The first to-be-broadcast-by-sender transaction's per commitment point
12042  */
12043 struct LDKPublicKey AcceptChannel_get_first_per_commitment_point(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
12044
12045 /**
12046  * The first to-be-broadcast-by-sender transaction's per commitment point
12047  */
12048 void AcceptChannel_set_first_per_commitment_point(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
12049
12050 /**
12051  * Creates a copy of the AcceptChannel
12052  */
12053 struct LDKAcceptChannel AcceptChannel_clone(const struct LDKAcceptChannel *NONNULL_PTR orig);
12054
12055 /**
12056  * Frees any resources used by the FundingCreated, if is_owned is set and inner is non-NULL.
12057  */
12058 void FundingCreated_free(struct LDKFundingCreated this_obj);
12059
12060 /**
12061  * A temporary channel ID, until the funding is established
12062  */
12063 const uint8_t (*FundingCreated_get_temporary_channel_id(const struct LDKFundingCreated *NONNULL_PTR this_ptr))[32];
12064
12065 /**
12066  * A temporary channel ID, until the funding is established
12067  */
12068 void FundingCreated_set_temporary_channel_id(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12069
12070 /**
12071  * The funding transaction ID
12072  */
12073 const uint8_t (*FundingCreated_get_funding_txid(const struct LDKFundingCreated *NONNULL_PTR this_ptr))[32];
12074
12075 /**
12076  * The funding transaction ID
12077  */
12078 void FundingCreated_set_funding_txid(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12079
12080 /**
12081  * The specific output index funding this channel
12082  */
12083 uint16_t FundingCreated_get_funding_output_index(const struct LDKFundingCreated *NONNULL_PTR this_ptr);
12084
12085 /**
12086  * The specific output index funding this channel
12087  */
12088 void FundingCreated_set_funding_output_index(struct LDKFundingCreated *NONNULL_PTR this_ptr, uint16_t val);
12089
12090 /**
12091  * The signature of the channel initiator (funder) on the funding transaction
12092  */
12093 struct LDKSignature FundingCreated_get_signature(const struct LDKFundingCreated *NONNULL_PTR this_ptr);
12094
12095 /**
12096  * The signature of the channel initiator (funder) on the funding transaction
12097  */
12098 void FundingCreated_set_signature(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKSignature val);
12099
12100 /**
12101  * Constructs a new FundingCreated given each field
12102  */
12103 MUST_USE_RES struct LDKFundingCreated FundingCreated_new(struct LDKThirtyTwoBytes temporary_channel_id_arg, struct LDKThirtyTwoBytes funding_txid_arg, uint16_t funding_output_index_arg, struct LDKSignature signature_arg);
12104
12105 /**
12106  * Creates a copy of the FundingCreated
12107  */
12108 struct LDKFundingCreated FundingCreated_clone(const struct LDKFundingCreated *NONNULL_PTR orig);
12109
12110 /**
12111  * Frees any resources used by the FundingSigned, if is_owned is set and inner is non-NULL.
12112  */
12113 void FundingSigned_free(struct LDKFundingSigned this_obj);
12114
12115 /**
12116  * The channel ID
12117  */
12118 const uint8_t (*FundingSigned_get_channel_id(const struct LDKFundingSigned *NONNULL_PTR this_ptr))[32];
12119
12120 /**
12121  * The channel ID
12122  */
12123 void FundingSigned_set_channel_id(struct LDKFundingSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12124
12125 /**
12126  * The signature of the channel acceptor (fundee) on the funding transaction
12127  */
12128 struct LDKSignature FundingSigned_get_signature(const struct LDKFundingSigned *NONNULL_PTR this_ptr);
12129
12130 /**
12131  * The signature of the channel acceptor (fundee) on the funding transaction
12132  */
12133 void FundingSigned_set_signature(struct LDKFundingSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
12134
12135 /**
12136  * Constructs a new FundingSigned given each field
12137  */
12138 MUST_USE_RES struct LDKFundingSigned FundingSigned_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKSignature signature_arg);
12139
12140 /**
12141  * Creates a copy of the FundingSigned
12142  */
12143 struct LDKFundingSigned FundingSigned_clone(const struct LDKFundingSigned *NONNULL_PTR orig);
12144
12145 /**
12146  * Frees any resources used by the FundingLocked, if is_owned is set and inner is non-NULL.
12147  */
12148 void FundingLocked_free(struct LDKFundingLocked this_obj);
12149
12150 /**
12151  * The channel ID
12152  */
12153 const uint8_t (*FundingLocked_get_channel_id(const struct LDKFundingLocked *NONNULL_PTR this_ptr))[32];
12154
12155 /**
12156  * The channel ID
12157  */
12158 void FundingLocked_set_channel_id(struct LDKFundingLocked *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12159
12160 /**
12161  * The per-commitment point of the second commitment transaction
12162  */
12163 struct LDKPublicKey FundingLocked_get_next_per_commitment_point(const struct LDKFundingLocked *NONNULL_PTR this_ptr);
12164
12165 /**
12166  * The per-commitment point of the second commitment transaction
12167  */
12168 void FundingLocked_set_next_per_commitment_point(struct LDKFundingLocked *NONNULL_PTR this_ptr, struct LDKPublicKey val);
12169
12170 /**
12171  * Constructs a new FundingLocked given each field
12172  */
12173 MUST_USE_RES struct LDKFundingLocked FundingLocked_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKPublicKey next_per_commitment_point_arg);
12174
12175 /**
12176  * Creates a copy of the FundingLocked
12177  */
12178 struct LDKFundingLocked FundingLocked_clone(const struct LDKFundingLocked *NONNULL_PTR orig);
12179
12180 /**
12181  * Frees any resources used by the Shutdown, if is_owned is set and inner is non-NULL.
12182  */
12183 void Shutdown_free(struct LDKShutdown this_obj);
12184
12185 /**
12186  * The channel ID
12187  */
12188 const uint8_t (*Shutdown_get_channel_id(const struct LDKShutdown *NONNULL_PTR this_ptr))[32];
12189
12190 /**
12191  * The channel ID
12192  */
12193 void Shutdown_set_channel_id(struct LDKShutdown *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12194
12195 /**
12196  * The destination of this peer's funds on closing.
12197  * Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh.
12198  */
12199 struct LDKu8slice Shutdown_get_scriptpubkey(const struct LDKShutdown *NONNULL_PTR this_ptr);
12200
12201 /**
12202  * The destination of this peer's funds on closing.
12203  * Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh.
12204  */
12205 void Shutdown_set_scriptpubkey(struct LDKShutdown *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
12206
12207 /**
12208  * Constructs a new Shutdown given each field
12209  */
12210 MUST_USE_RES struct LDKShutdown Shutdown_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKCVec_u8Z scriptpubkey_arg);
12211
12212 /**
12213  * Creates a copy of the Shutdown
12214  */
12215 struct LDKShutdown Shutdown_clone(const struct LDKShutdown *NONNULL_PTR orig);
12216
12217 /**
12218  * Frees any resources used by the ClosingSigned, if is_owned is set and inner is non-NULL.
12219  */
12220 void ClosingSigned_free(struct LDKClosingSigned this_obj);
12221
12222 /**
12223  * The channel ID
12224  */
12225 const uint8_t (*ClosingSigned_get_channel_id(const struct LDKClosingSigned *NONNULL_PTR this_ptr))[32];
12226
12227 /**
12228  * The channel ID
12229  */
12230 void ClosingSigned_set_channel_id(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12231
12232 /**
12233  * The proposed total fee for the closing transaction
12234  */
12235 uint64_t ClosingSigned_get_fee_satoshis(const struct LDKClosingSigned *NONNULL_PTR this_ptr);
12236
12237 /**
12238  * The proposed total fee for the closing transaction
12239  */
12240 void ClosingSigned_set_fee_satoshis(struct LDKClosingSigned *NONNULL_PTR this_ptr, uint64_t val);
12241
12242 /**
12243  * A signature on the closing transaction
12244  */
12245 struct LDKSignature ClosingSigned_get_signature(const struct LDKClosingSigned *NONNULL_PTR this_ptr);
12246
12247 /**
12248  * A signature on the closing transaction
12249  */
12250 void ClosingSigned_set_signature(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
12251
12252 /**
12253  * Constructs a new ClosingSigned given each field
12254  */
12255 MUST_USE_RES struct LDKClosingSigned ClosingSigned_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t fee_satoshis_arg, struct LDKSignature signature_arg);
12256
12257 /**
12258  * Creates a copy of the ClosingSigned
12259  */
12260 struct LDKClosingSigned ClosingSigned_clone(const struct LDKClosingSigned *NONNULL_PTR orig);
12261
12262 /**
12263  * Frees any resources used by the UpdateAddHTLC, if is_owned is set and inner is non-NULL.
12264  */
12265 void UpdateAddHTLC_free(struct LDKUpdateAddHTLC this_obj);
12266
12267 /**
12268  * The channel ID
12269  */
12270 const uint8_t (*UpdateAddHTLC_get_channel_id(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr))[32];
12271
12272 /**
12273  * The channel ID
12274  */
12275 void UpdateAddHTLC_set_channel_id(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12276
12277 /**
12278  * The HTLC ID
12279  */
12280 uint64_t UpdateAddHTLC_get_htlc_id(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
12281
12282 /**
12283  * The HTLC ID
12284  */
12285 void UpdateAddHTLC_set_htlc_id(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint64_t val);
12286
12287 /**
12288  * The HTLC value in milli-satoshi
12289  */
12290 uint64_t UpdateAddHTLC_get_amount_msat(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
12291
12292 /**
12293  * The HTLC value in milli-satoshi
12294  */
12295 void UpdateAddHTLC_set_amount_msat(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint64_t val);
12296
12297 /**
12298  * The payment hash, the pre-image of which controls HTLC redemption
12299  */
12300 const uint8_t (*UpdateAddHTLC_get_payment_hash(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr))[32];
12301
12302 /**
12303  * The payment hash, the pre-image of which controls HTLC redemption
12304  */
12305 void UpdateAddHTLC_set_payment_hash(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12306
12307 /**
12308  * The expiry height of the HTLC
12309  */
12310 uint32_t UpdateAddHTLC_get_cltv_expiry(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
12311
12312 /**
12313  * The expiry height of the HTLC
12314  */
12315 void UpdateAddHTLC_set_cltv_expiry(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint32_t val);
12316
12317 /**
12318  * Creates a copy of the UpdateAddHTLC
12319  */
12320 struct LDKUpdateAddHTLC UpdateAddHTLC_clone(const struct LDKUpdateAddHTLC *NONNULL_PTR orig);
12321
12322 /**
12323  * Frees any resources used by the UpdateFulfillHTLC, if is_owned is set and inner is non-NULL.
12324  */
12325 void UpdateFulfillHTLC_free(struct LDKUpdateFulfillHTLC this_obj);
12326
12327 /**
12328  * The channel ID
12329  */
12330 const uint8_t (*UpdateFulfillHTLC_get_channel_id(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr))[32];
12331
12332 /**
12333  * The channel ID
12334  */
12335 void UpdateFulfillHTLC_set_channel_id(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12336
12337 /**
12338  * The HTLC ID
12339  */
12340 uint64_t UpdateFulfillHTLC_get_htlc_id(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr);
12341
12342 /**
12343  * The HTLC ID
12344  */
12345 void UpdateFulfillHTLC_set_htlc_id(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, uint64_t val);
12346
12347 /**
12348  * The pre-image of the payment hash, allowing HTLC redemption
12349  */
12350 const uint8_t (*UpdateFulfillHTLC_get_payment_preimage(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr))[32];
12351
12352 /**
12353  * The pre-image of the payment hash, allowing HTLC redemption
12354  */
12355 void UpdateFulfillHTLC_set_payment_preimage(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12356
12357 /**
12358  * Constructs a new UpdateFulfillHTLC given each field
12359  */
12360 MUST_USE_RES struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t htlc_id_arg, struct LDKThirtyTwoBytes payment_preimage_arg);
12361
12362 /**
12363  * Creates a copy of the UpdateFulfillHTLC
12364  */
12365 struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_clone(const struct LDKUpdateFulfillHTLC *NONNULL_PTR orig);
12366
12367 /**
12368  * Frees any resources used by the UpdateFailHTLC, if is_owned is set and inner is non-NULL.
12369  */
12370 void UpdateFailHTLC_free(struct LDKUpdateFailHTLC this_obj);
12371
12372 /**
12373  * The channel ID
12374  */
12375 const uint8_t (*UpdateFailHTLC_get_channel_id(const struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr))[32];
12376
12377 /**
12378  * The channel ID
12379  */
12380 void UpdateFailHTLC_set_channel_id(struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12381
12382 /**
12383  * The HTLC ID
12384  */
12385 uint64_t UpdateFailHTLC_get_htlc_id(const struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr);
12386
12387 /**
12388  * The HTLC ID
12389  */
12390 void UpdateFailHTLC_set_htlc_id(struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr, uint64_t val);
12391
12392 /**
12393  * Creates a copy of the UpdateFailHTLC
12394  */
12395 struct LDKUpdateFailHTLC UpdateFailHTLC_clone(const struct LDKUpdateFailHTLC *NONNULL_PTR orig);
12396
12397 /**
12398  * Frees any resources used by the UpdateFailMalformedHTLC, if is_owned is set and inner is non-NULL.
12399  */
12400 void UpdateFailMalformedHTLC_free(struct LDKUpdateFailMalformedHTLC this_obj);
12401
12402 /**
12403  * The channel ID
12404  */
12405 const uint8_t (*UpdateFailMalformedHTLC_get_channel_id(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr))[32];
12406
12407 /**
12408  * The channel ID
12409  */
12410 void UpdateFailMalformedHTLC_set_channel_id(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12411
12412 /**
12413  * The HTLC ID
12414  */
12415 uint64_t UpdateFailMalformedHTLC_get_htlc_id(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr);
12416
12417 /**
12418  * The HTLC ID
12419  */
12420 void UpdateFailMalformedHTLC_set_htlc_id(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, uint64_t val);
12421
12422 /**
12423  * The failure code
12424  */
12425 uint16_t UpdateFailMalformedHTLC_get_failure_code(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr);
12426
12427 /**
12428  * The failure code
12429  */
12430 void UpdateFailMalformedHTLC_set_failure_code(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, uint16_t val);
12431
12432 /**
12433  * Creates a copy of the UpdateFailMalformedHTLC
12434  */
12435 struct LDKUpdateFailMalformedHTLC UpdateFailMalformedHTLC_clone(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR orig);
12436
12437 /**
12438  * Frees any resources used by the CommitmentSigned, if is_owned is set and inner is non-NULL.
12439  */
12440 void CommitmentSigned_free(struct LDKCommitmentSigned this_obj);
12441
12442 /**
12443  * The channel ID
12444  */
12445 const uint8_t (*CommitmentSigned_get_channel_id(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr))[32];
12446
12447 /**
12448  * The channel ID
12449  */
12450 void CommitmentSigned_set_channel_id(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12451
12452 /**
12453  * A signature on the commitment transaction
12454  */
12455 struct LDKSignature CommitmentSigned_get_signature(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr);
12456
12457 /**
12458  * A signature on the commitment transaction
12459  */
12460 void CommitmentSigned_set_signature(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
12461
12462 /**
12463  * Signatures on the HTLC transactions
12464  */
12465 void CommitmentSigned_set_htlc_signatures(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKCVec_SignatureZ val);
12466
12467 /**
12468  * Constructs a new CommitmentSigned given each field
12469  */
12470 MUST_USE_RES struct LDKCommitmentSigned CommitmentSigned_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKSignature signature_arg, struct LDKCVec_SignatureZ htlc_signatures_arg);
12471
12472 /**
12473  * Creates a copy of the CommitmentSigned
12474  */
12475 struct LDKCommitmentSigned CommitmentSigned_clone(const struct LDKCommitmentSigned *NONNULL_PTR orig);
12476
12477 /**
12478  * Frees any resources used by the RevokeAndACK, if is_owned is set and inner is non-NULL.
12479  */
12480 void RevokeAndACK_free(struct LDKRevokeAndACK this_obj);
12481
12482 /**
12483  * The channel ID
12484  */
12485 const uint8_t (*RevokeAndACK_get_channel_id(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr))[32];
12486
12487 /**
12488  * The channel ID
12489  */
12490 void RevokeAndACK_set_channel_id(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12491
12492 /**
12493  * The secret corresponding to the per-commitment point
12494  */
12495 const uint8_t (*RevokeAndACK_get_per_commitment_secret(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr))[32];
12496
12497 /**
12498  * The secret corresponding to the per-commitment point
12499  */
12500 void RevokeAndACK_set_per_commitment_secret(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12501
12502 /**
12503  * The next sender-broadcast commitment transaction's per-commitment point
12504  */
12505 struct LDKPublicKey RevokeAndACK_get_next_per_commitment_point(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr);
12506
12507 /**
12508  * The next sender-broadcast commitment transaction's per-commitment point
12509  */
12510 void RevokeAndACK_set_next_per_commitment_point(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKPublicKey val);
12511
12512 /**
12513  * Constructs a new RevokeAndACK given each field
12514  */
12515 MUST_USE_RES struct LDKRevokeAndACK RevokeAndACK_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKThirtyTwoBytes per_commitment_secret_arg, struct LDKPublicKey next_per_commitment_point_arg);
12516
12517 /**
12518  * Creates a copy of the RevokeAndACK
12519  */
12520 struct LDKRevokeAndACK RevokeAndACK_clone(const struct LDKRevokeAndACK *NONNULL_PTR orig);
12521
12522 /**
12523  * Frees any resources used by the UpdateFee, if is_owned is set and inner is non-NULL.
12524  */
12525 void UpdateFee_free(struct LDKUpdateFee this_obj);
12526
12527 /**
12528  * The channel ID
12529  */
12530 const uint8_t (*UpdateFee_get_channel_id(const struct LDKUpdateFee *NONNULL_PTR this_ptr))[32];
12531
12532 /**
12533  * The channel ID
12534  */
12535 void UpdateFee_set_channel_id(struct LDKUpdateFee *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12536
12537 /**
12538  * Fee rate per 1000-weight of the transaction
12539  */
12540 uint32_t UpdateFee_get_feerate_per_kw(const struct LDKUpdateFee *NONNULL_PTR this_ptr);
12541
12542 /**
12543  * Fee rate per 1000-weight of the transaction
12544  */
12545 void UpdateFee_set_feerate_per_kw(struct LDKUpdateFee *NONNULL_PTR this_ptr, uint32_t val);
12546
12547 /**
12548  * Constructs a new UpdateFee given each field
12549  */
12550 MUST_USE_RES struct LDKUpdateFee UpdateFee_new(struct LDKThirtyTwoBytes channel_id_arg, uint32_t feerate_per_kw_arg);
12551
12552 /**
12553  * Creates a copy of the UpdateFee
12554  */
12555 struct LDKUpdateFee UpdateFee_clone(const struct LDKUpdateFee *NONNULL_PTR orig);
12556
12557 /**
12558  * Frees any resources used by the DataLossProtect, if is_owned is set and inner is non-NULL.
12559  */
12560 void DataLossProtect_free(struct LDKDataLossProtect this_obj);
12561
12562 /**
12563  * Proof that the sender knows the per-commitment secret of a specific commitment transaction
12564  * belonging to the recipient
12565  */
12566 const uint8_t (*DataLossProtect_get_your_last_per_commitment_secret(const struct LDKDataLossProtect *NONNULL_PTR this_ptr))[32];
12567
12568 /**
12569  * Proof that the sender knows the per-commitment secret of a specific commitment transaction
12570  * belonging to the recipient
12571  */
12572 void DataLossProtect_set_your_last_per_commitment_secret(struct LDKDataLossProtect *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12573
12574 /**
12575  * The sender's per-commitment point for their current commitment transaction
12576  */
12577 struct LDKPublicKey DataLossProtect_get_my_current_per_commitment_point(const struct LDKDataLossProtect *NONNULL_PTR this_ptr);
12578
12579 /**
12580  * The sender's per-commitment point for their current commitment transaction
12581  */
12582 void DataLossProtect_set_my_current_per_commitment_point(struct LDKDataLossProtect *NONNULL_PTR this_ptr, struct LDKPublicKey val);
12583
12584 /**
12585  * Constructs a new DataLossProtect given each field
12586  */
12587 MUST_USE_RES struct LDKDataLossProtect DataLossProtect_new(struct LDKThirtyTwoBytes your_last_per_commitment_secret_arg, struct LDKPublicKey my_current_per_commitment_point_arg);
12588
12589 /**
12590  * Creates a copy of the DataLossProtect
12591  */
12592 struct LDKDataLossProtect DataLossProtect_clone(const struct LDKDataLossProtect *NONNULL_PTR orig);
12593
12594 /**
12595  * Frees any resources used by the ChannelReestablish, if is_owned is set and inner is non-NULL.
12596  */
12597 void ChannelReestablish_free(struct LDKChannelReestablish this_obj);
12598
12599 /**
12600  * The channel ID
12601  */
12602 const uint8_t (*ChannelReestablish_get_channel_id(const struct LDKChannelReestablish *NONNULL_PTR this_ptr))[32];
12603
12604 /**
12605  * The channel ID
12606  */
12607 void ChannelReestablish_set_channel_id(struct LDKChannelReestablish *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12608
12609 /**
12610  * The next commitment number for the sender
12611  */
12612 uint64_t ChannelReestablish_get_next_local_commitment_number(const struct LDKChannelReestablish *NONNULL_PTR this_ptr);
12613
12614 /**
12615  * The next commitment number for the sender
12616  */
12617 void ChannelReestablish_set_next_local_commitment_number(struct LDKChannelReestablish *NONNULL_PTR this_ptr, uint64_t val);
12618
12619 /**
12620  * The next commitment number for the recipient
12621  */
12622 uint64_t ChannelReestablish_get_next_remote_commitment_number(const struct LDKChannelReestablish *NONNULL_PTR this_ptr);
12623
12624 /**
12625  * The next commitment number for the recipient
12626  */
12627 void ChannelReestablish_set_next_remote_commitment_number(struct LDKChannelReestablish *NONNULL_PTR this_ptr, uint64_t val);
12628
12629 /**
12630  * Creates a copy of the ChannelReestablish
12631  */
12632 struct LDKChannelReestablish ChannelReestablish_clone(const struct LDKChannelReestablish *NONNULL_PTR orig);
12633
12634 /**
12635  * Frees any resources used by the AnnouncementSignatures, if is_owned is set and inner is non-NULL.
12636  */
12637 void AnnouncementSignatures_free(struct LDKAnnouncementSignatures this_obj);
12638
12639 /**
12640  * The channel ID
12641  */
12642 const uint8_t (*AnnouncementSignatures_get_channel_id(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr))[32];
12643
12644 /**
12645  * The channel ID
12646  */
12647 void AnnouncementSignatures_set_channel_id(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12648
12649 /**
12650  * The short channel ID
12651  */
12652 uint64_t AnnouncementSignatures_get_short_channel_id(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
12653
12654 /**
12655  * The short channel ID
12656  */
12657 void AnnouncementSignatures_set_short_channel_id(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, uint64_t val);
12658
12659 /**
12660  * A signature by the node key
12661  */
12662 struct LDKSignature AnnouncementSignatures_get_node_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
12663
12664 /**
12665  * A signature by the node key
12666  */
12667 void AnnouncementSignatures_set_node_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKSignature val);
12668
12669 /**
12670  * A signature by the funding key
12671  */
12672 struct LDKSignature AnnouncementSignatures_get_bitcoin_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
12673
12674 /**
12675  * A signature by the funding key
12676  */
12677 void AnnouncementSignatures_set_bitcoin_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKSignature val);
12678
12679 /**
12680  * Constructs a new AnnouncementSignatures given each field
12681  */
12682 MUST_USE_RES struct LDKAnnouncementSignatures AnnouncementSignatures_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t short_channel_id_arg, struct LDKSignature node_signature_arg, struct LDKSignature bitcoin_signature_arg);
12683
12684 /**
12685  * Creates a copy of the AnnouncementSignatures
12686  */
12687 struct LDKAnnouncementSignatures AnnouncementSignatures_clone(const struct LDKAnnouncementSignatures *NONNULL_PTR orig);
12688
12689 /**
12690  * Frees any resources used by the NetAddress
12691  */
12692 void NetAddress_free(struct LDKNetAddress this_ptr);
12693
12694 /**
12695  * Creates a copy of the NetAddress
12696  */
12697 struct LDKNetAddress NetAddress_clone(const struct LDKNetAddress *NONNULL_PTR orig);
12698
12699 /**
12700  * Serialize the NetAddress object into a byte array which can be read by NetAddress_read
12701  */
12702 struct LDKCVec_u8Z NetAddress_write(const struct LDKNetAddress *NONNULL_PTR obj);
12703
12704 /**
12705  * Read a Result from a byte array, created by Result_write
12706  */
12707 struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ Result_read(struct LDKu8slice ser);
12708
12709 /**
12710  * Frees any resources used by the UnsignedNodeAnnouncement, if is_owned is set and inner is non-NULL.
12711  */
12712 void UnsignedNodeAnnouncement_free(struct LDKUnsignedNodeAnnouncement this_obj);
12713
12714 /**
12715  * The advertised features
12716  */
12717 struct LDKNodeFeatures UnsignedNodeAnnouncement_get_features(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
12718
12719 /**
12720  * The advertised features
12721  */
12722 void UnsignedNodeAnnouncement_set_features(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
12723
12724 /**
12725  * A strictly monotonic announcement counter, with gaps allowed
12726  */
12727 uint32_t UnsignedNodeAnnouncement_get_timestamp(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
12728
12729 /**
12730  * A strictly monotonic announcement counter, with gaps allowed
12731  */
12732 void UnsignedNodeAnnouncement_set_timestamp(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, uint32_t val);
12733
12734 /**
12735  * The node_id this announcement originated from (don't rebroadcast the node_announcement back
12736  * to this node).
12737  */
12738 struct LDKPublicKey UnsignedNodeAnnouncement_get_node_id(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
12739
12740 /**
12741  * The node_id this announcement originated from (don't rebroadcast the node_announcement back
12742  * to this node).
12743  */
12744 void UnsignedNodeAnnouncement_set_node_id(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
12745
12746 /**
12747  * An RGB color for UI purposes
12748  */
12749 const uint8_t (*UnsignedNodeAnnouncement_get_rgb(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr))[3];
12750
12751 /**
12752  * An RGB color for UI purposes
12753  */
12754 void UnsignedNodeAnnouncement_set_rgb(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKThreeBytes val);
12755
12756 /**
12757  * An alias, for UI purposes.  This should be sanitized before use.  There is no guarantee
12758  * of uniqueness.
12759  */
12760 const uint8_t (*UnsignedNodeAnnouncement_get_alias(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr))[32];
12761
12762 /**
12763  * An alias, for UI purposes.  This should be sanitized before use.  There is no guarantee
12764  * of uniqueness.
12765  */
12766 void UnsignedNodeAnnouncement_set_alias(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12767
12768 /**
12769  * List of addresses on which this node is reachable
12770  */
12771 void UnsignedNodeAnnouncement_set_addresses(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKCVec_NetAddressZ val);
12772
12773 /**
12774  * Creates a copy of the UnsignedNodeAnnouncement
12775  */
12776 struct LDKUnsignedNodeAnnouncement UnsignedNodeAnnouncement_clone(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR orig);
12777
12778 /**
12779  * Frees any resources used by the NodeAnnouncement, if is_owned is set and inner is non-NULL.
12780  */
12781 void NodeAnnouncement_free(struct LDKNodeAnnouncement this_obj);
12782
12783 /**
12784  * The signature by the node key
12785  */
12786 struct LDKSignature NodeAnnouncement_get_signature(const struct LDKNodeAnnouncement *NONNULL_PTR this_ptr);
12787
12788 /**
12789  * The signature by the node key
12790  */
12791 void NodeAnnouncement_set_signature(struct LDKNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
12792
12793 /**
12794  * The actual content of the announcement
12795  */
12796 struct LDKUnsignedNodeAnnouncement NodeAnnouncement_get_contents(const struct LDKNodeAnnouncement *NONNULL_PTR this_ptr);
12797
12798 /**
12799  * The actual content of the announcement
12800  */
12801 void NodeAnnouncement_set_contents(struct LDKNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKUnsignedNodeAnnouncement val);
12802
12803 /**
12804  * Constructs a new NodeAnnouncement given each field
12805  */
12806 MUST_USE_RES struct LDKNodeAnnouncement NodeAnnouncement_new(struct LDKSignature signature_arg, struct LDKUnsignedNodeAnnouncement contents_arg);
12807
12808 /**
12809  * Creates a copy of the NodeAnnouncement
12810  */
12811 struct LDKNodeAnnouncement NodeAnnouncement_clone(const struct LDKNodeAnnouncement *NONNULL_PTR orig);
12812
12813 /**
12814  * Frees any resources used by the UnsignedChannelAnnouncement, if is_owned is set and inner is non-NULL.
12815  */
12816 void UnsignedChannelAnnouncement_free(struct LDKUnsignedChannelAnnouncement this_obj);
12817
12818 /**
12819  * The advertised channel features
12820  */
12821 struct LDKChannelFeatures UnsignedChannelAnnouncement_get_features(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
12822
12823 /**
12824  * The advertised channel features
12825  */
12826 void UnsignedChannelAnnouncement_set_features(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
12827
12828 /**
12829  * The genesis hash of the blockchain where the channel is to be opened
12830  */
12831 const uint8_t (*UnsignedChannelAnnouncement_get_chain_hash(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr))[32];
12832
12833 /**
12834  * The genesis hash of the blockchain where the channel is to be opened
12835  */
12836 void UnsignedChannelAnnouncement_set_chain_hash(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12837
12838 /**
12839  * The short channel ID
12840  */
12841 uint64_t UnsignedChannelAnnouncement_get_short_channel_id(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
12842
12843 /**
12844  * The short channel ID
12845  */
12846 void UnsignedChannelAnnouncement_set_short_channel_id(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, uint64_t val);
12847
12848 /**
12849  * One of the two node_ids which are endpoints of this channel
12850  */
12851 struct LDKPublicKey UnsignedChannelAnnouncement_get_node_id_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
12852
12853 /**
12854  * One of the two node_ids which are endpoints of this channel
12855  */
12856 void UnsignedChannelAnnouncement_set_node_id_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
12857
12858 /**
12859  * The other of the two node_ids which are endpoints of this channel
12860  */
12861 struct LDKPublicKey UnsignedChannelAnnouncement_get_node_id_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
12862
12863 /**
12864  * The other of the two node_ids which are endpoints of this channel
12865  */
12866 void UnsignedChannelAnnouncement_set_node_id_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
12867
12868 /**
12869  * The funding key for the first node
12870  */
12871 struct LDKPublicKey UnsignedChannelAnnouncement_get_bitcoin_key_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
12872
12873 /**
12874  * The funding key for the first node
12875  */
12876 void UnsignedChannelAnnouncement_set_bitcoin_key_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
12877
12878 /**
12879  * The funding key for the second node
12880  */
12881 struct LDKPublicKey UnsignedChannelAnnouncement_get_bitcoin_key_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
12882
12883 /**
12884  * The funding key for the second node
12885  */
12886 void UnsignedChannelAnnouncement_set_bitcoin_key_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
12887
12888 /**
12889  * Creates a copy of the UnsignedChannelAnnouncement
12890  */
12891 struct LDKUnsignedChannelAnnouncement UnsignedChannelAnnouncement_clone(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR orig);
12892
12893 /**
12894  * Frees any resources used by the ChannelAnnouncement, if is_owned is set and inner is non-NULL.
12895  */
12896 void ChannelAnnouncement_free(struct LDKChannelAnnouncement this_obj);
12897
12898 /**
12899  * Authentication of the announcement by the first public node
12900  */
12901 struct LDKSignature ChannelAnnouncement_get_node_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
12902
12903 /**
12904  * Authentication of the announcement by the first public node
12905  */
12906 void ChannelAnnouncement_set_node_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
12907
12908 /**
12909  * Authentication of the announcement by the second public node
12910  */
12911 struct LDKSignature ChannelAnnouncement_get_node_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
12912
12913 /**
12914  * Authentication of the announcement by the second public node
12915  */
12916 void ChannelAnnouncement_set_node_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
12917
12918 /**
12919  * Proof of funding UTXO ownership by the first public node
12920  */
12921 struct LDKSignature ChannelAnnouncement_get_bitcoin_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
12922
12923 /**
12924  * Proof of funding UTXO ownership by the first public node
12925  */
12926 void ChannelAnnouncement_set_bitcoin_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
12927
12928 /**
12929  * Proof of funding UTXO ownership by the second public node
12930  */
12931 struct LDKSignature ChannelAnnouncement_get_bitcoin_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
12932
12933 /**
12934  * Proof of funding UTXO ownership by the second public node
12935  */
12936 void ChannelAnnouncement_set_bitcoin_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
12937
12938 /**
12939  * The actual announcement
12940  */
12941 struct LDKUnsignedChannelAnnouncement ChannelAnnouncement_get_contents(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
12942
12943 /**
12944  * The actual announcement
12945  */
12946 void ChannelAnnouncement_set_contents(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKUnsignedChannelAnnouncement val);
12947
12948 /**
12949  * Constructs a new ChannelAnnouncement given each field
12950  */
12951 MUST_USE_RES struct LDKChannelAnnouncement ChannelAnnouncement_new(struct LDKSignature node_signature_1_arg, struct LDKSignature node_signature_2_arg, struct LDKSignature bitcoin_signature_1_arg, struct LDKSignature bitcoin_signature_2_arg, struct LDKUnsignedChannelAnnouncement contents_arg);
12952
12953 /**
12954  * Creates a copy of the ChannelAnnouncement
12955  */
12956 struct LDKChannelAnnouncement ChannelAnnouncement_clone(const struct LDKChannelAnnouncement *NONNULL_PTR orig);
12957
12958 /**
12959  * Frees any resources used by the UnsignedChannelUpdate, if is_owned is set and inner is non-NULL.
12960  */
12961 void UnsignedChannelUpdate_free(struct LDKUnsignedChannelUpdate this_obj);
12962
12963 /**
12964  * The genesis hash of the blockchain where the channel is to be opened
12965  */
12966 const uint8_t (*UnsignedChannelUpdate_get_chain_hash(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr))[32];
12967
12968 /**
12969  * The genesis hash of the blockchain where the channel is to be opened
12970  */
12971 void UnsignedChannelUpdate_set_chain_hash(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12972
12973 /**
12974  * The short channel ID
12975  */
12976 uint64_t UnsignedChannelUpdate_get_short_channel_id(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
12977
12978 /**
12979  * The short channel ID
12980  */
12981 void UnsignedChannelUpdate_set_short_channel_id(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val);
12982
12983 /**
12984  * A strictly monotonic announcement counter, with gaps allowed, specific to this channel
12985  */
12986 uint32_t UnsignedChannelUpdate_get_timestamp(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
12987
12988 /**
12989  * A strictly monotonic announcement counter, with gaps allowed, specific to this channel
12990  */
12991 void UnsignedChannelUpdate_set_timestamp(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
12992
12993 /**
12994  * Channel flags
12995  */
12996 uint8_t UnsignedChannelUpdate_get_flags(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
12997
12998 /**
12999  * Channel flags
13000  */
13001 void UnsignedChannelUpdate_set_flags(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint8_t val);
13002
13003 /**
13004  * The number of blocks such that if:
13005  * `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta`
13006  * then we need to fail the HTLC backwards. When forwarding an HTLC, cltv_expiry_delta determines
13007  * the outgoing HTLC's minimum cltv_expiry value -- so, if an incoming HTLC comes in with a
13008  * cltv_expiry of 100000, and the node we're forwarding to has a cltv_expiry_delta value of 10,
13009  * then we'll check that the outgoing HTLC's cltv_expiry value is at least 100010 before
13010  * forwarding. Note that the HTLC sender is the one who originally sets this value when
13011  * constructing the route.
13012  */
13013 uint16_t UnsignedChannelUpdate_get_cltv_expiry_delta(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
13014
13015 /**
13016  * The number of blocks such that if:
13017  * `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta`
13018  * then we need to fail the HTLC backwards. When forwarding an HTLC, cltv_expiry_delta determines
13019  * the outgoing HTLC's minimum cltv_expiry value -- so, if an incoming HTLC comes in with a
13020  * cltv_expiry of 100000, and the node we're forwarding to has a cltv_expiry_delta value of 10,
13021  * then we'll check that the outgoing HTLC's cltv_expiry value is at least 100010 before
13022  * forwarding. Note that the HTLC sender is the one who originally sets this value when
13023  * constructing the route.
13024  */
13025 void UnsignedChannelUpdate_set_cltv_expiry_delta(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint16_t val);
13026
13027 /**
13028  * The minimum HTLC size incoming to sender, in milli-satoshi
13029  */
13030 uint64_t UnsignedChannelUpdate_get_htlc_minimum_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
13031
13032 /**
13033  * The minimum HTLC size incoming to sender, in milli-satoshi
13034  */
13035 void UnsignedChannelUpdate_set_htlc_minimum_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val);
13036
13037 /**
13038  * The base HTLC fee charged by sender, in milli-satoshi
13039  */
13040 uint32_t UnsignedChannelUpdate_get_fee_base_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
13041
13042 /**
13043  * The base HTLC fee charged by sender, in milli-satoshi
13044  */
13045 void UnsignedChannelUpdate_set_fee_base_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
13046
13047 /**
13048  * The amount to fee multiplier, in micro-satoshi
13049  */
13050 uint32_t UnsignedChannelUpdate_get_fee_proportional_millionths(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
13051
13052 /**
13053  * The amount to fee multiplier, in micro-satoshi
13054  */
13055 void UnsignedChannelUpdate_set_fee_proportional_millionths(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
13056
13057 /**
13058  * Creates a copy of the UnsignedChannelUpdate
13059  */
13060 struct LDKUnsignedChannelUpdate UnsignedChannelUpdate_clone(const struct LDKUnsignedChannelUpdate *NONNULL_PTR orig);
13061
13062 /**
13063  * Frees any resources used by the ChannelUpdate, if is_owned is set and inner is non-NULL.
13064  */
13065 void ChannelUpdate_free(struct LDKChannelUpdate this_obj);
13066
13067 /**
13068  * A signature of the channel update
13069  */
13070 struct LDKSignature ChannelUpdate_get_signature(const struct LDKChannelUpdate *NONNULL_PTR this_ptr);
13071
13072 /**
13073  * A signature of the channel update
13074  */
13075 void ChannelUpdate_set_signature(struct LDKChannelUpdate *NONNULL_PTR this_ptr, struct LDKSignature val);
13076
13077 /**
13078  * The actual channel update
13079  */
13080 struct LDKUnsignedChannelUpdate ChannelUpdate_get_contents(const struct LDKChannelUpdate *NONNULL_PTR this_ptr);
13081
13082 /**
13083  * The actual channel update
13084  */
13085 void ChannelUpdate_set_contents(struct LDKChannelUpdate *NONNULL_PTR this_ptr, struct LDKUnsignedChannelUpdate val);
13086
13087 /**
13088  * Constructs a new ChannelUpdate given each field
13089  */
13090 MUST_USE_RES struct LDKChannelUpdate ChannelUpdate_new(struct LDKSignature signature_arg, struct LDKUnsignedChannelUpdate contents_arg);
13091
13092 /**
13093  * Creates a copy of the ChannelUpdate
13094  */
13095 struct LDKChannelUpdate ChannelUpdate_clone(const struct LDKChannelUpdate *NONNULL_PTR orig);
13096
13097 /**
13098  * Frees any resources used by the QueryChannelRange, if is_owned is set and inner is non-NULL.
13099  */
13100 void QueryChannelRange_free(struct LDKQueryChannelRange this_obj);
13101
13102 /**
13103  * The genesis hash of the blockchain being queried
13104  */
13105 const uint8_t (*QueryChannelRange_get_chain_hash(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr))[32];
13106
13107 /**
13108  * The genesis hash of the blockchain being queried
13109  */
13110 void QueryChannelRange_set_chain_hash(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13111
13112 /**
13113  * The height of the first block for the channel UTXOs being queried
13114  */
13115 uint32_t QueryChannelRange_get_first_blocknum(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr);
13116
13117 /**
13118  * The height of the first block for the channel UTXOs being queried
13119  */
13120 void QueryChannelRange_set_first_blocknum(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, uint32_t val);
13121
13122 /**
13123  * The number of blocks to include in the query results
13124  */
13125 uint32_t QueryChannelRange_get_number_of_blocks(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr);
13126
13127 /**
13128  * The number of blocks to include in the query results
13129  */
13130 void QueryChannelRange_set_number_of_blocks(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, uint32_t val);
13131
13132 /**
13133  * Constructs a new QueryChannelRange given each field
13134  */
13135 MUST_USE_RES struct LDKQueryChannelRange QueryChannelRange_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_blocknum_arg, uint32_t number_of_blocks_arg);
13136
13137 /**
13138  * Creates a copy of the QueryChannelRange
13139  */
13140 struct LDKQueryChannelRange QueryChannelRange_clone(const struct LDKQueryChannelRange *NONNULL_PTR orig);
13141
13142 /**
13143  * Frees any resources used by the ReplyChannelRange, if is_owned is set and inner is non-NULL.
13144  */
13145 void ReplyChannelRange_free(struct LDKReplyChannelRange this_obj);
13146
13147 /**
13148  * The genesis hash of the blockchain being queried
13149  */
13150 const uint8_t (*ReplyChannelRange_get_chain_hash(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr))[32];
13151
13152 /**
13153  * The genesis hash of the blockchain being queried
13154  */
13155 void ReplyChannelRange_set_chain_hash(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13156
13157 /**
13158  * The height of the first block in the range of the reply
13159  */
13160 uint32_t ReplyChannelRange_get_first_blocknum(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
13161
13162 /**
13163  * The height of the first block in the range of the reply
13164  */
13165 void ReplyChannelRange_set_first_blocknum(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, uint32_t val);
13166
13167 /**
13168  * The number of blocks included in the range of the reply
13169  */
13170 uint32_t ReplyChannelRange_get_number_of_blocks(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
13171
13172 /**
13173  * The number of blocks included in the range of the reply
13174  */
13175 void ReplyChannelRange_set_number_of_blocks(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, uint32_t val);
13176
13177 /**
13178  * True when this is the final reply for a query
13179  */
13180 bool ReplyChannelRange_get_sync_complete(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
13181
13182 /**
13183  * True when this is the final reply for a query
13184  */
13185 void ReplyChannelRange_set_sync_complete(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, bool val);
13186
13187 /**
13188  * The short_channel_ids in the channel range
13189  */
13190 void ReplyChannelRange_set_short_channel_ids(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
13191
13192 /**
13193  * Constructs a new ReplyChannelRange given each field
13194  */
13195 MUST_USE_RES struct LDKReplyChannelRange ReplyChannelRange_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_blocknum_arg, uint32_t number_of_blocks_arg, bool sync_complete_arg, struct LDKCVec_u64Z short_channel_ids_arg);
13196
13197 /**
13198  * Creates a copy of the ReplyChannelRange
13199  */
13200 struct LDKReplyChannelRange ReplyChannelRange_clone(const struct LDKReplyChannelRange *NONNULL_PTR orig);
13201
13202 /**
13203  * Frees any resources used by the QueryShortChannelIds, if is_owned is set and inner is non-NULL.
13204  */
13205 void QueryShortChannelIds_free(struct LDKQueryShortChannelIds this_obj);
13206
13207 /**
13208  * The genesis hash of the blockchain being queried
13209  */
13210 const uint8_t (*QueryShortChannelIds_get_chain_hash(const struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr))[32];
13211
13212 /**
13213  * The genesis hash of the blockchain being queried
13214  */
13215 void QueryShortChannelIds_set_chain_hash(struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13216
13217 /**
13218  * The short_channel_ids that are being queried
13219  */
13220 void QueryShortChannelIds_set_short_channel_ids(struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
13221
13222 /**
13223  * Constructs a new QueryShortChannelIds given each field
13224  */
13225 MUST_USE_RES struct LDKQueryShortChannelIds QueryShortChannelIds_new(struct LDKThirtyTwoBytes chain_hash_arg, struct LDKCVec_u64Z short_channel_ids_arg);
13226
13227 /**
13228  * Creates a copy of the QueryShortChannelIds
13229  */
13230 struct LDKQueryShortChannelIds QueryShortChannelIds_clone(const struct LDKQueryShortChannelIds *NONNULL_PTR orig);
13231
13232 /**
13233  * Frees any resources used by the ReplyShortChannelIdsEnd, if is_owned is set and inner is non-NULL.
13234  */
13235 void ReplyShortChannelIdsEnd_free(struct LDKReplyShortChannelIdsEnd this_obj);
13236
13237 /**
13238  * The genesis hash of the blockchain that was queried
13239  */
13240 const uint8_t (*ReplyShortChannelIdsEnd_get_chain_hash(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr))[32];
13241
13242 /**
13243  * The genesis hash of the blockchain that was queried
13244  */
13245 void ReplyShortChannelIdsEnd_set_chain_hash(struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13246
13247 /**
13248  * Indicates if the query recipient maintains up-to-date channel
13249  * information for the chain_hash
13250  */
13251 bool ReplyShortChannelIdsEnd_get_full_information(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr);
13252
13253 /**
13254  * Indicates if the query recipient maintains up-to-date channel
13255  * information for the chain_hash
13256  */
13257 void ReplyShortChannelIdsEnd_set_full_information(struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr, bool val);
13258
13259 /**
13260  * Constructs a new ReplyShortChannelIdsEnd given each field
13261  */
13262 MUST_USE_RES struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_new(struct LDKThirtyTwoBytes chain_hash_arg, bool full_information_arg);
13263
13264 /**
13265  * Creates a copy of the ReplyShortChannelIdsEnd
13266  */
13267 struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_clone(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR orig);
13268
13269 /**
13270  * Frees any resources used by the GossipTimestampFilter, if is_owned is set and inner is non-NULL.
13271  */
13272 void GossipTimestampFilter_free(struct LDKGossipTimestampFilter this_obj);
13273
13274 /**
13275  * The genesis hash of the blockchain for channel and node information
13276  */
13277 const uint8_t (*GossipTimestampFilter_get_chain_hash(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr))[32];
13278
13279 /**
13280  * The genesis hash of the blockchain for channel and node information
13281  */
13282 void GossipTimestampFilter_set_chain_hash(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13283
13284 /**
13285  * The starting unix timestamp
13286  */
13287 uint32_t GossipTimestampFilter_get_first_timestamp(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr);
13288
13289 /**
13290  * The starting unix timestamp
13291  */
13292 void GossipTimestampFilter_set_first_timestamp(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, uint32_t val);
13293
13294 /**
13295  * The range of information in seconds
13296  */
13297 uint32_t GossipTimestampFilter_get_timestamp_range(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr);
13298
13299 /**
13300  * The range of information in seconds
13301  */
13302 void GossipTimestampFilter_set_timestamp_range(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, uint32_t val);
13303
13304 /**
13305  * Constructs a new GossipTimestampFilter given each field
13306  */
13307 MUST_USE_RES struct LDKGossipTimestampFilter GossipTimestampFilter_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_timestamp_arg, uint32_t timestamp_range_arg);
13308
13309 /**
13310  * Creates a copy of the GossipTimestampFilter
13311  */
13312 struct LDKGossipTimestampFilter GossipTimestampFilter_clone(const struct LDKGossipTimestampFilter *NONNULL_PTR orig);
13313
13314 /**
13315  * Frees any resources used by the ErrorAction
13316  */
13317 void ErrorAction_free(struct LDKErrorAction this_ptr);
13318
13319 /**
13320  * Creates a copy of the ErrorAction
13321  */
13322 struct LDKErrorAction ErrorAction_clone(const struct LDKErrorAction *NONNULL_PTR orig);
13323
13324 /**
13325  * Frees any resources used by the LightningError, if is_owned is set and inner is non-NULL.
13326  */
13327 void LightningError_free(struct LDKLightningError this_obj);
13328
13329 /**
13330  * A human-readable message describing the error
13331  */
13332 struct LDKStr LightningError_get_err(const struct LDKLightningError *NONNULL_PTR this_ptr);
13333
13334 /**
13335  * A human-readable message describing the error
13336  */
13337 void LightningError_set_err(struct LDKLightningError *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
13338
13339 /**
13340  * The action which should be taken against the offending peer.
13341  */
13342 struct LDKErrorAction LightningError_get_action(const struct LDKLightningError *NONNULL_PTR this_ptr);
13343
13344 /**
13345  * The action which should be taken against the offending peer.
13346  */
13347 void LightningError_set_action(struct LDKLightningError *NONNULL_PTR this_ptr, struct LDKErrorAction val);
13348
13349 /**
13350  * Constructs a new LightningError given each field
13351  */
13352 MUST_USE_RES struct LDKLightningError LightningError_new(struct LDKCVec_u8Z err_arg, struct LDKErrorAction action_arg);
13353
13354 /**
13355  * Creates a copy of the LightningError
13356  */
13357 struct LDKLightningError LightningError_clone(const struct LDKLightningError *NONNULL_PTR orig);
13358
13359 /**
13360  * Frees any resources used by the CommitmentUpdate, if is_owned is set and inner is non-NULL.
13361  */
13362 void CommitmentUpdate_free(struct LDKCommitmentUpdate this_obj);
13363
13364 /**
13365  * update_add_htlc messages which should be sent
13366  */
13367 void CommitmentUpdate_set_update_add_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateAddHTLCZ val);
13368
13369 /**
13370  * update_fulfill_htlc messages which should be sent
13371  */
13372 void CommitmentUpdate_set_update_fulfill_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFulfillHTLCZ val);
13373
13374 /**
13375  * update_fail_htlc messages which should be sent
13376  */
13377 void CommitmentUpdate_set_update_fail_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFailHTLCZ val);
13378
13379 /**
13380  * update_fail_malformed_htlc messages which should be sent
13381  */
13382 void CommitmentUpdate_set_update_fail_malformed_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFailMalformedHTLCZ val);
13383
13384 /**
13385  * An update_fee message which should be sent
13386  */
13387 struct LDKUpdateFee CommitmentUpdate_get_update_fee(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
13388
13389 /**
13390  * An update_fee message which should be sent
13391  */
13392 void CommitmentUpdate_set_update_fee(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKUpdateFee val);
13393
13394 /**
13395  * Finally, the commitment_signed message which should be sent
13396  */
13397 struct LDKCommitmentSigned CommitmentUpdate_get_commitment_signed(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
13398
13399 /**
13400  * Finally, the commitment_signed message which should be sent
13401  */
13402 void CommitmentUpdate_set_commitment_signed(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCommitmentSigned val);
13403
13404 /**
13405  * Constructs a new CommitmentUpdate given each field
13406  */
13407 MUST_USE_RES struct LDKCommitmentUpdate CommitmentUpdate_new(struct LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg, struct LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg, struct LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg, struct LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg, struct LDKUpdateFee update_fee_arg, struct LDKCommitmentSigned commitment_signed_arg);
13408
13409 /**
13410  * Creates a copy of the CommitmentUpdate
13411  */
13412 struct LDKCommitmentUpdate CommitmentUpdate_clone(const struct LDKCommitmentUpdate *NONNULL_PTR orig);
13413
13414 /**
13415  * Frees any resources used by the HTLCFailChannelUpdate
13416  */
13417 void HTLCFailChannelUpdate_free(struct LDKHTLCFailChannelUpdate this_ptr);
13418
13419 /**
13420  * Creates a copy of the HTLCFailChannelUpdate
13421  */
13422 struct LDKHTLCFailChannelUpdate HTLCFailChannelUpdate_clone(const struct LDKHTLCFailChannelUpdate *NONNULL_PTR orig);
13423
13424 /**
13425  * Calls the free function if one is set
13426  */
13427 void ChannelMessageHandler_free(struct LDKChannelMessageHandler this_ptr);
13428
13429 /**
13430  * Calls the free function if one is set
13431  */
13432 void RoutingMessageHandler_free(struct LDKRoutingMessageHandler this_ptr);
13433
13434 /**
13435  * Serialize the AcceptChannel object into a byte array which can be read by AcceptChannel_read
13436  */
13437 struct LDKCVec_u8Z AcceptChannel_write(const struct LDKAcceptChannel *NONNULL_PTR obj);
13438
13439 /**
13440  * Read a AcceptChannel from a byte array, created by AcceptChannel_write
13441  */
13442 struct LDKCResult_AcceptChannelDecodeErrorZ AcceptChannel_read(struct LDKu8slice ser);
13443
13444 /**
13445  * Serialize the AnnouncementSignatures object into a byte array which can be read by AnnouncementSignatures_read
13446  */
13447 struct LDKCVec_u8Z AnnouncementSignatures_write(const struct LDKAnnouncementSignatures *NONNULL_PTR obj);
13448
13449 /**
13450  * Read a AnnouncementSignatures from a byte array, created by AnnouncementSignatures_write
13451  */
13452 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ AnnouncementSignatures_read(struct LDKu8slice ser);
13453
13454 /**
13455  * Serialize the ChannelReestablish object into a byte array which can be read by ChannelReestablish_read
13456  */
13457 struct LDKCVec_u8Z ChannelReestablish_write(const struct LDKChannelReestablish *NONNULL_PTR obj);
13458
13459 /**
13460  * Read a ChannelReestablish from a byte array, created by ChannelReestablish_write
13461  */
13462 struct LDKCResult_ChannelReestablishDecodeErrorZ ChannelReestablish_read(struct LDKu8slice ser);
13463
13464 /**
13465  * Serialize the ClosingSigned object into a byte array which can be read by ClosingSigned_read
13466  */
13467 struct LDKCVec_u8Z ClosingSigned_write(const struct LDKClosingSigned *NONNULL_PTR obj);
13468
13469 /**
13470  * Read a ClosingSigned from a byte array, created by ClosingSigned_write
13471  */
13472 struct LDKCResult_ClosingSignedDecodeErrorZ ClosingSigned_read(struct LDKu8slice ser);
13473
13474 /**
13475  * Serialize the CommitmentSigned object into a byte array which can be read by CommitmentSigned_read
13476  */
13477 struct LDKCVec_u8Z CommitmentSigned_write(const struct LDKCommitmentSigned *NONNULL_PTR obj);
13478
13479 /**
13480  * Read a CommitmentSigned from a byte array, created by CommitmentSigned_write
13481  */
13482 struct LDKCResult_CommitmentSignedDecodeErrorZ CommitmentSigned_read(struct LDKu8slice ser);
13483
13484 /**
13485  * Serialize the FundingCreated object into a byte array which can be read by FundingCreated_read
13486  */
13487 struct LDKCVec_u8Z FundingCreated_write(const struct LDKFundingCreated *NONNULL_PTR obj);
13488
13489 /**
13490  * Read a FundingCreated from a byte array, created by FundingCreated_write
13491  */
13492 struct LDKCResult_FundingCreatedDecodeErrorZ FundingCreated_read(struct LDKu8slice ser);
13493
13494 /**
13495  * Serialize the FundingSigned object into a byte array which can be read by FundingSigned_read
13496  */
13497 struct LDKCVec_u8Z FundingSigned_write(const struct LDKFundingSigned *NONNULL_PTR obj);
13498
13499 /**
13500  * Read a FundingSigned from a byte array, created by FundingSigned_write
13501  */
13502 struct LDKCResult_FundingSignedDecodeErrorZ FundingSigned_read(struct LDKu8slice ser);
13503
13504 /**
13505  * Serialize the FundingLocked object into a byte array which can be read by FundingLocked_read
13506  */
13507 struct LDKCVec_u8Z FundingLocked_write(const struct LDKFundingLocked *NONNULL_PTR obj);
13508
13509 /**
13510  * Read a FundingLocked from a byte array, created by FundingLocked_write
13511  */
13512 struct LDKCResult_FundingLockedDecodeErrorZ FundingLocked_read(struct LDKu8slice ser);
13513
13514 /**
13515  * Serialize the Init object into a byte array which can be read by Init_read
13516  */
13517 struct LDKCVec_u8Z Init_write(const struct LDKInit *NONNULL_PTR obj);
13518
13519 /**
13520  * Read a Init from a byte array, created by Init_write
13521  */
13522 struct LDKCResult_InitDecodeErrorZ Init_read(struct LDKu8slice ser);
13523
13524 /**
13525  * Serialize the OpenChannel object into a byte array which can be read by OpenChannel_read
13526  */
13527 struct LDKCVec_u8Z OpenChannel_write(const struct LDKOpenChannel *NONNULL_PTR obj);
13528
13529 /**
13530  * Read a OpenChannel from a byte array, created by OpenChannel_write
13531  */
13532 struct LDKCResult_OpenChannelDecodeErrorZ OpenChannel_read(struct LDKu8slice ser);
13533
13534 /**
13535  * Serialize the RevokeAndACK object into a byte array which can be read by RevokeAndACK_read
13536  */
13537 struct LDKCVec_u8Z RevokeAndACK_write(const struct LDKRevokeAndACK *NONNULL_PTR obj);
13538
13539 /**
13540  * Read a RevokeAndACK from a byte array, created by RevokeAndACK_write
13541  */
13542 struct LDKCResult_RevokeAndACKDecodeErrorZ RevokeAndACK_read(struct LDKu8slice ser);
13543
13544 /**
13545  * Serialize the Shutdown object into a byte array which can be read by Shutdown_read
13546  */
13547 struct LDKCVec_u8Z Shutdown_write(const struct LDKShutdown *NONNULL_PTR obj);
13548
13549 /**
13550  * Read a Shutdown from a byte array, created by Shutdown_write
13551  */
13552 struct LDKCResult_ShutdownDecodeErrorZ Shutdown_read(struct LDKu8slice ser);
13553
13554 /**
13555  * Serialize the UpdateFailHTLC object into a byte array which can be read by UpdateFailHTLC_read
13556  */
13557 struct LDKCVec_u8Z UpdateFailHTLC_write(const struct LDKUpdateFailHTLC *NONNULL_PTR obj);
13558
13559 /**
13560  * Read a UpdateFailHTLC from a byte array, created by UpdateFailHTLC_write
13561  */
13562 struct LDKCResult_UpdateFailHTLCDecodeErrorZ UpdateFailHTLC_read(struct LDKu8slice ser);
13563
13564 /**
13565  * Serialize the UpdateFailMalformedHTLC object into a byte array which can be read by UpdateFailMalformedHTLC_read
13566  */
13567 struct LDKCVec_u8Z UpdateFailMalformedHTLC_write(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR obj);
13568
13569 /**
13570  * Read a UpdateFailMalformedHTLC from a byte array, created by UpdateFailMalformedHTLC_write
13571  */
13572 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ UpdateFailMalformedHTLC_read(struct LDKu8slice ser);
13573
13574 /**
13575  * Serialize the UpdateFee object into a byte array which can be read by UpdateFee_read
13576  */
13577 struct LDKCVec_u8Z UpdateFee_write(const struct LDKUpdateFee *NONNULL_PTR obj);
13578
13579 /**
13580  * Read a UpdateFee from a byte array, created by UpdateFee_write
13581  */
13582 struct LDKCResult_UpdateFeeDecodeErrorZ UpdateFee_read(struct LDKu8slice ser);
13583
13584 /**
13585  * Serialize the UpdateFulfillHTLC object into a byte array which can be read by UpdateFulfillHTLC_read
13586  */
13587 struct LDKCVec_u8Z UpdateFulfillHTLC_write(const struct LDKUpdateFulfillHTLC *NONNULL_PTR obj);
13588
13589 /**
13590  * Read a UpdateFulfillHTLC from a byte array, created by UpdateFulfillHTLC_write
13591  */
13592 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ UpdateFulfillHTLC_read(struct LDKu8slice ser);
13593
13594 /**
13595  * Serialize the UpdateAddHTLC object into a byte array which can be read by UpdateAddHTLC_read
13596  */
13597 struct LDKCVec_u8Z UpdateAddHTLC_write(const struct LDKUpdateAddHTLC *NONNULL_PTR obj);
13598
13599 /**
13600  * Read a UpdateAddHTLC from a byte array, created by UpdateAddHTLC_write
13601  */
13602 struct LDKCResult_UpdateAddHTLCDecodeErrorZ UpdateAddHTLC_read(struct LDKu8slice ser);
13603
13604 /**
13605  * Serialize the Ping object into a byte array which can be read by Ping_read
13606  */
13607 struct LDKCVec_u8Z Ping_write(const struct LDKPing *NONNULL_PTR obj);
13608
13609 /**
13610  * Read a Ping from a byte array, created by Ping_write
13611  */
13612 struct LDKCResult_PingDecodeErrorZ Ping_read(struct LDKu8slice ser);
13613
13614 /**
13615  * Serialize the Pong object into a byte array which can be read by Pong_read
13616  */
13617 struct LDKCVec_u8Z Pong_write(const struct LDKPong *NONNULL_PTR obj);
13618
13619 /**
13620  * Read a Pong from a byte array, created by Pong_write
13621  */
13622 struct LDKCResult_PongDecodeErrorZ Pong_read(struct LDKu8slice ser);
13623
13624 /**
13625  * Serialize the UnsignedChannelAnnouncement object into a byte array which can be read by UnsignedChannelAnnouncement_read
13626  */
13627 struct LDKCVec_u8Z UnsignedChannelAnnouncement_write(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR obj);
13628
13629 /**
13630  * Read a UnsignedChannelAnnouncement from a byte array, created by UnsignedChannelAnnouncement_write
13631  */
13632 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ UnsignedChannelAnnouncement_read(struct LDKu8slice ser);
13633
13634 /**
13635  * Serialize the ChannelAnnouncement object into a byte array which can be read by ChannelAnnouncement_read
13636  */
13637 struct LDKCVec_u8Z ChannelAnnouncement_write(const struct LDKChannelAnnouncement *NONNULL_PTR obj);
13638
13639 /**
13640  * Read a ChannelAnnouncement from a byte array, created by ChannelAnnouncement_write
13641  */
13642 struct LDKCResult_ChannelAnnouncementDecodeErrorZ ChannelAnnouncement_read(struct LDKu8slice ser);
13643
13644 /**
13645  * Serialize the UnsignedChannelUpdate object into a byte array which can be read by UnsignedChannelUpdate_read
13646  */
13647 struct LDKCVec_u8Z UnsignedChannelUpdate_write(const struct LDKUnsignedChannelUpdate *NONNULL_PTR obj);
13648
13649 /**
13650  * Read a UnsignedChannelUpdate from a byte array, created by UnsignedChannelUpdate_write
13651  */
13652 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ UnsignedChannelUpdate_read(struct LDKu8slice ser);
13653
13654 /**
13655  * Serialize the ChannelUpdate object into a byte array which can be read by ChannelUpdate_read
13656  */
13657 struct LDKCVec_u8Z ChannelUpdate_write(const struct LDKChannelUpdate *NONNULL_PTR obj);
13658
13659 /**
13660  * Read a ChannelUpdate from a byte array, created by ChannelUpdate_write
13661  */
13662 struct LDKCResult_ChannelUpdateDecodeErrorZ ChannelUpdate_read(struct LDKu8slice ser);
13663
13664 /**
13665  * Serialize the ErrorMessage object into a byte array which can be read by ErrorMessage_read
13666  */
13667 struct LDKCVec_u8Z ErrorMessage_write(const struct LDKErrorMessage *NONNULL_PTR obj);
13668
13669 /**
13670  * Read a ErrorMessage from a byte array, created by ErrorMessage_write
13671  */
13672 struct LDKCResult_ErrorMessageDecodeErrorZ ErrorMessage_read(struct LDKu8slice ser);
13673
13674 /**
13675  * Serialize the UnsignedNodeAnnouncement object into a byte array which can be read by UnsignedNodeAnnouncement_read
13676  */
13677 struct LDKCVec_u8Z UnsignedNodeAnnouncement_write(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR obj);
13678
13679 /**
13680  * Read a UnsignedNodeAnnouncement from a byte array, created by UnsignedNodeAnnouncement_write
13681  */
13682 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ UnsignedNodeAnnouncement_read(struct LDKu8slice ser);
13683
13684 /**
13685  * Serialize the NodeAnnouncement object into a byte array which can be read by NodeAnnouncement_read
13686  */
13687 struct LDKCVec_u8Z NodeAnnouncement_write(const struct LDKNodeAnnouncement *NONNULL_PTR obj);
13688
13689 /**
13690  * Read a NodeAnnouncement from a byte array, created by NodeAnnouncement_write
13691  */
13692 struct LDKCResult_NodeAnnouncementDecodeErrorZ NodeAnnouncement_read(struct LDKu8slice ser);
13693
13694 /**
13695  * Read a QueryShortChannelIds from a byte array, created by QueryShortChannelIds_write
13696  */
13697 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ QueryShortChannelIds_read(struct LDKu8slice ser);
13698
13699 /**
13700  * Serialize the QueryShortChannelIds object into a byte array which can be read by QueryShortChannelIds_read
13701  */
13702 struct LDKCVec_u8Z QueryShortChannelIds_write(const struct LDKQueryShortChannelIds *NONNULL_PTR obj);
13703
13704 /**
13705  * Read a ReplyShortChannelIdsEnd from a byte array, created by ReplyShortChannelIdsEnd_write
13706  */
13707 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ ReplyShortChannelIdsEnd_read(struct LDKu8slice ser);
13708
13709 /**
13710  * Serialize the ReplyShortChannelIdsEnd object into a byte array which can be read by ReplyShortChannelIdsEnd_read
13711  */
13712 struct LDKCVec_u8Z ReplyShortChannelIdsEnd_write(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR obj);
13713
13714 /**
13715  *\n\t * Calculates the overflow safe ending block height for the query.\n\t * Overflow returns `0xffffffff`, otherwise returns `first_blocknum + number_of_blocks`\n\t
13716  */
13717 MUST_USE_RES uint32_t QueryChannelRange_end_blocknum(const struct LDKQueryChannelRange *NONNULL_PTR this_arg);
13718
13719 /**
13720  * Read a QueryChannelRange from a byte array, created by QueryChannelRange_write
13721  */
13722 struct LDKCResult_QueryChannelRangeDecodeErrorZ QueryChannelRange_read(struct LDKu8slice ser);
13723
13724 /**
13725  * Serialize the QueryChannelRange object into a byte array which can be read by QueryChannelRange_read
13726  */
13727 struct LDKCVec_u8Z QueryChannelRange_write(const struct LDKQueryChannelRange *NONNULL_PTR obj);
13728
13729 /**
13730  * Read a ReplyChannelRange from a byte array, created by ReplyChannelRange_write
13731  */
13732 struct LDKCResult_ReplyChannelRangeDecodeErrorZ ReplyChannelRange_read(struct LDKu8slice ser);
13733
13734 /**
13735  * Serialize the ReplyChannelRange object into a byte array which can be read by ReplyChannelRange_read
13736  */
13737 struct LDKCVec_u8Z ReplyChannelRange_write(const struct LDKReplyChannelRange *NONNULL_PTR obj);
13738
13739 /**
13740  * Read a GossipTimestampFilter from a byte array, created by GossipTimestampFilter_write
13741  */
13742 struct LDKCResult_GossipTimestampFilterDecodeErrorZ GossipTimestampFilter_read(struct LDKu8slice ser);
13743
13744 /**
13745  * Serialize the GossipTimestampFilter object into a byte array which can be read by GossipTimestampFilter_read
13746  */
13747 struct LDKCVec_u8Z GossipTimestampFilter_write(const struct LDKGossipTimestampFilter *NONNULL_PTR obj);
13748
13749 /**
13750  * Frees any resources used by the IgnoringMessageHandler, if is_owned is set and inner is non-NULL.
13751  */
13752 void IgnoringMessageHandler_free(struct LDKIgnoringMessageHandler this_obj);
13753
13754 /**
13755  * Constructs a new IgnoringMessageHandler given each field
13756  */
13757 MUST_USE_RES struct LDKIgnoringMessageHandler IgnoringMessageHandler_new(void);
13758
13759 /**
13760  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
13761  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
13762  */
13763 struct LDKMessageSendEventsProvider IgnoringMessageHandler_as_MessageSendEventsProvider(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
13764
13765 /**
13766  * Constructs a new RoutingMessageHandler which calls the relevant methods on this_arg.
13767  * This copies the `inner` pointer in this_arg and thus the returned RoutingMessageHandler must be freed before this_arg is
13768  */
13769 struct LDKRoutingMessageHandler IgnoringMessageHandler_as_RoutingMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
13770
13771 /**
13772  * Frees any resources used by the ErroringMessageHandler, if is_owned is set and inner is non-NULL.
13773  */
13774 void ErroringMessageHandler_free(struct LDKErroringMessageHandler this_obj);
13775
13776 /**
13777  * Constructs a new ErroringMessageHandler
13778  */
13779 MUST_USE_RES struct LDKErroringMessageHandler ErroringMessageHandler_new(void);
13780
13781 /**
13782  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
13783  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
13784  */
13785 struct LDKMessageSendEventsProvider ErroringMessageHandler_as_MessageSendEventsProvider(const struct LDKErroringMessageHandler *NONNULL_PTR this_arg);
13786
13787 /**
13788  * Constructs a new ChannelMessageHandler which calls the relevant methods on this_arg.
13789  * This copies the `inner` pointer in this_arg and thus the returned ChannelMessageHandler must be freed before this_arg is
13790  */
13791 struct LDKChannelMessageHandler ErroringMessageHandler_as_ChannelMessageHandler(const struct LDKErroringMessageHandler *NONNULL_PTR this_arg);
13792
13793 /**
13794  * Frees any resources used by the MessageHandler, if is_owned is set and inner is non-NULL.
13795  */
13796 void MessageHandler_free(struct LDKMessageHandler this_obj);
13797
13798 /**
13799  * A message handler which handles messages specific to channels. Usually this is just a
13800  * ChannelManager object or a ErroringMessageHandler.
13801  */
13802 const struct LDKChannelMessageHandler *MessageHandler_get_chan_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr);
13803
13804 /**
13805  * A message handler which handles messages specific to channels. Usually this is just a
13806  * ChannelManager object or a ErroringMessageHandler.
13807  */
13808 void MessageHandler_set_chan_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKChannelMessageHandler val);
13809
13810 /**
13811  * A message handler which handles messages updating our knowledge of the network channel
13812  * graph. Usually this is just a NetGraphMsgHandlerMonitor object or an IgnoringMessageHandler.
13813  */
13814 const struct LDKRoutingMessageHandler *MessageHandler_get_route_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr);
13815
13816 /**
13817  * A message handler which handles messages updating our knowledge of the network channel
13818  * graph. Usually this is just a NetGraphMsgHandlerMonitor object or an IgnoringMessageHandler.
13819  */
13820 void MessageHandler_set_route_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKRoutingMessageHandler val);
13821
13822 /**
13823  * Constructs a new MessageHandler given each field
13824  */
13825 MUST_USE_RES struct LDKMessageHandler MessageHandler_new(struct LDKChannelMessageHandler chan_handler_arg, struct LDKRoutingMessageHandler route_handler_arg);
13826
13827 /**
13828  * Creates a copy of a SocketDescriptor
13829  */
13830 struct LDKSocketDescriptor SocketDescriptor_clone(const struct LDKSocketDescriptor *NONNULL_PTR orig);
13831
13832 /**
13833  * Calls the free function if one is set
13834  */
13835 void SocketDescriptor_free(struct LDKSocketDescriptor this_ptr);
13836
13837 /**
13838  * Frees any resources used by the PeerHandleError, if is_owned is set and inner is non-NULL.
13839  */
13840 void PeerHandleError_free(struct LDKPeerHandleError this_obj);
13841
13842 /**
13843  * Used to indicate that we probably can't make any future connections to this peer, implying
13844  * we should go ahead and force-close any channels we have with it.
13845  */
13846 bool PeerHandleError_get_no_connection_possible(const struct LDKPeerHandleError *NONNULL_PTR this_ptr);
13847
13848 /**
13849  * Used to indicate that we probably can't make any future connections to this peer, implying
13850  * we should go ahead and force-close any channels we have with it.
13851  */
13852 void PeerHandleError_set_no_connection_possible(struct LDKPeerHandleError *NONNULL_PTR this_ptr, bool val);
13853
13854 /**
13855  * Constructs a new PeerHandleError given each field
13856  */
13857 MUST_USE_RES struct LDKPeerHandleError PeerHandleError_new(bool no_connection_possible_arg);
13858
13859 /**
13860  * Creates a copy of the PeerHandleError
13861  */
13862 struct LDKPeerHandleError PeerHandleError_clone(const struct LDKPeerHandleError *NONNULL_PTR orig);
13863
13864 /**
13865  * Frees any resources used by the PeerManager, if is_owned is set and inner is non-NULL.
13866  */
13867 void PeerManager_free(struct LDKPeerManager this_obj);
13868
13869 /**
13870  * Constructs a new PeerManager with the given message handlers and node_id secret key
13871  * ephemeral_random_data is used to derive per-connection ephemeral keys and must be
13872  * cryptographically secure random bytes.
13873  */
13874 MUST_USE_RES struct LDKPeerManager PeerManager_new(struct LDKMessageHandler message_handler, struct LDKSecretKey our_node_secret, const uint8_t (*ephemeral_random_data)[32], struct LDKLogger logger);
13875
13876 /**
13877  * Get the list of node ids for peers which have completed the initial handshake.
13878  *
13879  * For outbound connections, this will be the same as the their_node_id parameter passed in to
13880  * new_outbound_connection, however entries will only appear once the initial handshake has
13881  * completed and we are sure the remote peer has the private key for the given node_id.
13882  */
13883 MUST_USE_RES struct LDKCVec_PublicKeyZ PeerManager_get_peer_node_ids(const struct LDKPeerManager *NONNULL_PTR this_arg);
13884
13885 /**
13886  * Indicates a new outbound connection has been established to a node with the given node_id.
13887  * Note that if an Err is returned here you MUST NOT call socket_disconnected for the new
13888  * descriptor but must disconnect the connection immediately.
13889  *
13890  * Returns a small number of bytes to send to the remote node (currently always 50).
13891  *
13892  * Panics if descriptor is duplicative with some other descriptor which has not yet had a
13893  * socket_disconnected().
13894  */
13895 MUST_USE_RES struct LDKCResult_CVec_u8ZPeerHandleErrorZ PeerManager_new_outbound_connection(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKPublicKey their_node_id, struct LDKSocketDescriptor descriptor);
13896
13897 /**
13898  * Indicates a new inbound connection has been established.
13899  *
13900  * May refuse the connection by returning an Err, but will never write bytes to the remote end
13901  * (outbound connector always speaks first). Note that if an Err is returned here you MUST NOT
13902  * call socket_disconnected for the new descriptor but must disconnect the connection
13903  * immediately.
13904  *
13905  * Panics if descriptor is duplicative with some other descriptor which has not yet had
13906  * socket_disconnected called.
13907  */
13908 MUST_USE_RES struct LDKCResult_NonePeerHandleErrorZ PeerManager_new_inbound_connection(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor descriptor);
13909
13910 /**
13911  * Indicates that there is room to write data to the given socket descriptor.
13912  *
13913  * May return an Err to indicate that the connection should be closed.
13914  *
13915  * Will most likely call send_data on the descriptor passed in (or the descriptor handed into
13916  * new_*\\_connection) before returning. Thus, be very careful with reentrancy issues! The
13917  * invariants around calling write_buffer_space_avail in case a write did not fully complete
13918  * must still hold - be ready to call write_buffer_space_avail again if a write call generated
13919  * here isn't sufficient! Panics if the descriptor was not previously registered in a
13920  * new_\\*_connection event.
13921  */
13922 MUST_USE_RES struct LDKCResult_NonePeerHandleErrorZ PeerManager_write_buffer_space_avail(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor *NONNULL_PTR descriptor);
13923
13924 /**
13925  * Indicates that data was read from the given socket descriptor.
13926  *
13927  * May return an Err to indicate that the connection should be closed.
13928  *
13929  * Will *not* call back into send_data on any descriptors to avoid reentrancy complexity.
13930  * Thus, however, you almost certainly want to call process_events() after any read_event to
13931  * generate send_data calls to handle responses.
13932  *
13933  * If Ok(true) is returned, further read_events should not be triggered until a send_data call
13934  * on this file descriptor has resume_read set (preventing DoS issues in the send buffer).
13935  *
13936  * Panics if the descriptor was not previously registered in a new_*_connection event.
13937  */
13938 MUST_USE_RES struct LDKCResult_boolPeerHandleErrorZ PeerManager_read_event(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor *NONNULL_PTR peer_descriptor, struct LDKu8slice data);
13939
13940 /**
13941  * Checks for any events generated by our handlers and processes them. Includes sending most
13942  * response messages as well as messages generated by calls to handler functions directly (eg
13943  * functions like ChannelManager::process_pending_htlc_forward or send_payment).
13944  */
13945 void PeerManager_process_events(const struct LDKPeerManager *NONNULL_PTR this_arg);
13946
13947 /**
13948  * Indicates that the given socket descriptor's connection is now closed.
13949  *
13950  * This must only be called if the socket has been disconnected by the peer or your own
13951  * decision to disconnect it and must NOT be called in any case where other parts of this
13952  * library (eg PeerHandleError, explicit disconnect_socket calls) instruct you to disconnect
13953  * the peer.
13954  *
13955  * Panics if the descriptor was not previously registered in a successful new_*_connection event.
13956  */
13957 void PeerManager_socket_disconnected(const struct LDKPeerManager *NONNULL_PTR this_arg, const struct LDKSocketDescriptor *NONNULL_PTR descriptor);
13958
13959 /**
13960  * Disconnect a peer given its node id.
13961  *
13962  * Set no_connection_possible to true to prevent any further connection with this peer,
13963  * force-closing any channels we have with it.
13964  *
13965  * If a peer is connected, this will call `disconnect_socket` on the descriptor for the peer,
13966  * so be careful about reentrancy issues.
13967  */
13968 void PeerManager_disconnect_by_node_id(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKPublicKey node_id, bool no_connection_possible);
13969
13970 /**
13971  * This function should be called roughly once every 30 seconds.
13972  * It will send pings to each peer and disconnect those which did not respond to the last round of pings.
13973  * Will most likely call send_data on all of the registered descriptors, thus, be very careful with reentrancy issues!
13974  */
13975 void PeerManager_timer_tick_occurred(const struct LDKPeerManager *NONNULL_PTR this_arg);
13976
13977 /**
13978  * Build the commitment secret from the seed and the commitment number
13979  */
13980 struct LDKThirtyTwoBytes build_commitment_secret(const uint8_t (*commitment_seed)[32], uint64_t idx);
13981
13982 /**
13983  * Derives a per-commitment-transaction private key (eg an htlc key or delayed_payment key)
13984  * from the base secret and the per_commitment_point.
13985  *
13986  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
13987  * generated (ie our own).
13988  */
13989 struct LDKCResult_SecretKeyErrorZ derive_private_key(struct LDKPublicKey per_commitment_point, const uint8_t (*base_secret)[32]);
13990
13991 /**
13992  * Derives a per-commitment-transaction public key (eg an htlc key or a delayed_payment key)
13993  * from the base point and the per_commitment_key. This is the public equivalent of
13994  * derive_private_key - using only public keys to derive a public key instead of private keys.
13995  *
13996  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
13997  * generated (ie our own).
13998  */
13999 struct LDKCResult_PublicKeyErrorZ derive_public_key(struct LDKPublicKey per_commitment_point, struct LDKPublicKey base_point);
14000
14001 /**
14002  * Derives a per-commitment-transaction revocation key from its constituent parts.
14003  *
14004  * Only the cheating participant owns a valid witness to propagate a revoked
14005  * commitment transaction, thus per_commitment_secret always come from cheater
14006  * and revocation_base_secret always come from punisher, which is the broadcaster
14007  * of the transaction spending with this key knowledge.
14008  *
14009  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
14010  * generated (ie our own).
14011  */
14012 struct LDKCResult_SecretKeyErrorZ derive_private_revocation_key(const uint8_t (*per_commitment_secret)[32], const uint8_t (*countersignatory_revocation_base_secret)[32]);
14013
14014 /**
14015  * Derives a per-commitment-transaction revocation public key from its constituent parts. This is
14016  * the public equivalend of derive_private_revocation_key - using only public keys to derive a
14017  * public key instead of private keys.
14018  *
14019  * Only the cheating participant owns a valid witness to propagate a revoked
14020  * commitment transaction, thus per_commitment_point always come from cheater
14021  * and revocation_base_point always come from punisher, which is the broadcaster
14022  * of the transaction spending with this key knowledge.
14023  *
14024  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
14025  * generated (ie our own).
14026  */
14027 struct LDKCResult_PublicKeyErrorZ derive_public_revocation_key(struct LDKPublicKey per_commitment_point, struct LDKPublicKey countersignatory_revocation_base_point);
14028
14029 /**
14030  * Frees any resources used by the TxCreationKeys, if is_owned is set and inner is non-NULL.
14031  */
14032 void TxCreationKeys_free(struct LDKTxCreationKeys this_obj);
14033
14034 /**
14035  * The broadcaster's per-commitment public key which was used to derive the other keys.
14036  */
14037 struct LDKPublicKey TxCreationKeys_get_per_commitment_point(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
14038
14039 /**
14040  * The broadcaster's per-commitment public key which was used to derive the other keys.
14041  */
14042 void TxCreationKeys_set_per_commitment_point(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14043
14044 /**
14045  * The revocation key which is used to allow the broadcaster of the commitment
14046  * transaction to provide their counterparty the ability to punish them if they broadcast
14047  * an old state.
14048  */
14049 struct LDKPublicKey TxCreationKeys_get_revocation_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
14050
14051 /**
14052  * The revocation key which is used to allow the broadcaster of the commitment
14053  * transaction to provide their counterparty the ability to punish them if they broadcast
14054  * an old state.
14055  */
14056 void TxCreationKeys_set_revocation_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14057
14058 /**
14059  * Broadcaster's HTLC Key
14060  */
14061 struct LDKPublicKey TxCreationKeys_get_broadcaster_htlc_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
14062
14063 /**
14064  * Broadcaster's HTLC Key
14065  */
14066 void TxCreationKeys_set_broadcaster_htlc_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14067
14068 /**
14069  * Countersignatory's HTLC Key
14070  */
14071 struct LDKPublicKey TxCreationKeys_get_countersignatory_htlc_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
14072
14073 /**
14074  * Countersignatory's HTLC Key
14075  */
14076 void TxCreationKeys_set_countersignatory_htlc_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14077
14078 /**
14079  * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay)
14080  */
14081 struct LDKPublicKey TxCreationKeys_get_broadcaster_delayed_payment_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
14082
14083 /**
14084  * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay)
14085  */
14086 void TxCreationKeys_set_broadcaster_delayed_payment_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14087
14088 /**
14089  * Constructs a new TxCreationKeys given each field
14090  */
14091 MUST_USE_RES struct LDKTxCreationKeys TxCreationKeys_new(struct LDKPublicKey per_commitment_point_arg, struct LDKPublicKey revocation_key_arg, struct LDKPublicKey broadcaster_htlc_key_arg, struct LDKPublicKey countersignatory_htlc_key_arg, struct LDKPublicKey broadcaster_delayed_payment_key_arg);
14092
14093 /**
14094  * Creates a copy of the TxCreationKeys
14095  */
14096 struct LDKTxCreationKeys TxCreationKeys_clone(const struct LDKTxCreationKeys *NONNULL_PTR orig);
14097
14098 /**
14099  * Serialize the TxCreationKeys object into a byte array which can be read by TxCreationKeys_read
14100  */
14101 struct LDKCVec_u8Z TxCreationKeys_write(const struct LDKTxCreationKeys *NONNULL_PTR obj);
14102
14103 /**
14104  * Read a TxCreationKeys from a byte array, created by TxCreationKeys_write
14105  */
14106 struct LDKCResult_TxCreationKeysDecodeErrorZ TxCreationKeys_read(struct LDKu8slice ser);
14107
14108 /**
14109  * Frees any resources used by the ChannelPublicKeys, if is_owned is set and inner is non-NULL.
14110  */
14111 void ChannelPublicKeys_free(struct LDKChannelPublicKeys this_obj);
14112
14113 /**
14114  * The public key which is used to sign all commitment transactions, as it appears in the
14115  * on-chain channel lock-in 2-of-2 multisig output.
14116  */
14117 struct LDKPublicKey ChannelPublicKeys_get_funding_pubkey(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
14118
14119 /**
14120  * The public key which is used to sign all commitment transactions, as it appears in the
14121  * on-chain channel lock-in 2-of-2 multisig output.
14122  */
14123 void ChannelPublicKeys_set_funding_pubkey(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14124
14125 /**
14126  * The base point which is used (with derive_public_revocation_key) to derive per-commitment
14127  * revocation keys. This is combined with the per-commitment-secret generated by the
14128  * counterparty to create a secret which the counterparty can reveal to revoke previous
14129  * states.
14130  */
14131 struct LDKPublicKey ChannelPublicKeys_get_revocation_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
14132
14133 /**
14134  * The base point which is used (with derive_public_revocation_key) to derive per-commitment
14135  * revocation keys. This is combined with the per-commitment-secret generated by the
14136  * counterparty to create a secret which the counterparty can reveal to revoke previous
14137  * states.
14138  */
14139 void ChannelPublicKeys_set_revocation_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14140
14141 /**
14142  * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
14143  * spendable primary channel balance on the broadcaster's commitment transaction. This key is
14144  * static across every commitment transaction.
14145  */
14146 struct LDKPublicKey ChannelPublicKeys_get_payment_point(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
14147
14148 /**
14149  * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
14150  * spendable primary channel balance on the broadcaster's commitment transaction. This key is
14151  * static across every commitment transaction.
14152  */
14153 void ChannelPublicKeys_set_payment_point(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14154
14155 /**
14156  * The base point which is used (with derive_public_key) to derive a per-commitment payment
14157  * public key which receives non-HTLC-encumbered funds which are only available for spending
14158  * after some delay (or can be claimed via the revocation path).
14159  */
14160 struct LDKPublicKey ChannelPublicKeys_get_delayed_payment_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
14161
14162 /**
14163  * The base point which is used (with derive_public_key) to derive a per-commitment payment
14164  * public key which receives non-HTLC-encumbered funds which are only available for spending
14165  * after some delay (or can be claimed via the revocation path).
14166  */
14167 void ChannelPublicKeys_set_delayed_payment_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14168
14169 /**
14170  * The base point which is used (with derive_public_key) to derive a per-commitment public key
14171  * which is used to encumber HTLC-in-flight outputs.
14172  */
14173 struct LDKPublicKey ChannelPublicKeys_get_htlc_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
14174
14175 /**
14176  * The base point which is used (with derive_public_key) to derive a per-commitment public key
14177  * which is used to encumber HTLC-in-flight outputs.
14178  */
14179 void ChannelPublicKeys_set_htlc_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14180
14181 /**
14182  * Constructs a new ChannelPublicKeys given each field
14183  */
14184 MUST_USE_RES struct LDKChannelPublicKeys ChannelPublicKeys_new(struct LDKPublicKey funding_pubkey_arg, struct LDKPublicKey revocation_basepoint_arg, struct LDKPublicKey payment_point_arg, struct LDKPublicKey delayed_payment_basepoint_arg, struct LDKPublicKey htlc_basepoint_arg);
14185
14186 /**
14187  * Creates a copy of the ChannelPublicKeys
14188  */
14189 struct LDKChannelPublicKeys ChannelPublicKeys_clone(const struct LDKChannelPublicKeys *NONNULL_PTR orig);
14190
14191 /**
14192  * Serialize the ChannelPublicKeys object into a byte array which can be read by ChannelPublicKeys_read
14193  */
14194 struct LDKCVec_u8Z ChannelPublicKeys_write(const struct LDKChannelPublicKeys *NONNULL_PTR obj);
14195
14196 /**
14197  * Read a ChannelPublicKeys from a byte array, created by ChannelPublicKeys_write
14198  */
14199 struct LDKCResult_ChannelPublicKeysDecodeErrorZ ChannelPublicKeys_read(struct LDKu8slice ser);
14200
14201 /**
14202  * Create per-state keys from channel base points and the per-commitment point.
14203  * Key set is asymmetric and can't be used as part of counter-signatory set of transactions.
14204  */
14205 MUST_USE_RES struct LDKCResult_TxCreationKeysErrorZ TxCreationKeys_derive_new(struct LDKPublicKey per_commitment_point, struct LDKPublicKey broadcaster_delayed_payment_base, struct LDKPublicKey broadcaster_htlc_base, struct LDKPublicKey countersignatory_revocation_base, struct LDKPublicKey countersignatory_htlc_base);
14206
14207 /**
14208  * Generate per-state keys from channel static keys.
14209  * Key set is asymmetric and can't be used as part of counter-signatory set of transactions.
14210  */
14211 MUST_USE_RES struct LDKCResult_TxCreationKeysErrorZ TxCreationKeys_from_channel_static_keys(struct LDKPublicKey per_commitment_point, const struct LDKChannelPublicKeys *NONNULL_PTR broadcaster_keys, const struct LDKChannelPublicKeys *NONNULL_PTR countersignatory_keys);
14212
14213 /**
14214  * A script either spendable by the revocation
14215  * key or the broadcaster_delayed_payment_key and satisfying the relative-locktime OP_CSV constrain.
14216  * Encumbering a `to_holder` output on a commitment transaction or 2nd-stage HTLC transactions.
14217  */
14218 struct LDKCVec_u8Z get_revokeable_redeemscript(struct LDKPublicKey revocation_key, uint16_t contest_delay, struct LDKPublicKey broadcaster_delayed_payment_key);
14219
14220 /**
14221  * Frees any resources used by the HTLCOutputInCommitment, if is_owned is set and inner is non-NULL.
14222  */
14223 void HTLCOutputInCommitment_free(struct LDKHTLCOutputInCommitment this_obj);
14224
14225 /**
14226  * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction).
14227  * Note that this is not the same as whether it is ountbound *from us*. To determine that you
14228  * need to compare this value to whether the commitment transaction in question is that of
14229  * the counterparty or our own.
14230  */
14231 bool HTLCOutputInCommitment_get_offered(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
14232
14233 /**
14234  * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction).
14235  * Note that this is not the same as whether it is ountbound *from us*. To determine that you
14236  * need to compare this value to whether the commitment transaction in question is that of
14237  * the counterparty or our own.
14238  */
14239 void HTLCOutputInCommitment_set_offered(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, bool val);
14240
14241 /**
14242  * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is
14243  * this divided by 1000.
14244  */
14245 uint64_t HTLCOutputInCommitment_get_amount_msat(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
14246
14247 /**
14248  * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is
14249  * this divided by 1000.
14250  */
14251 void HTLCOutputInCommitment_set_amount_msat(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, uint64_t val);
14252
14253 /**
14254  * The CLTV lock-time at which this HTLC expires.
14255  */
14256 uint32_t HTLCOutputInCommitment_get_cltv_expiry(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
14257
14258 /**
14259  * The CLTV lock-time at which this HTLC expires.
14260  */
14261 void HTLCOutputInCommitment_set_cltv_expiry(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, uint32_t val);
14262
14263 /**
14264  * The hash of the preimage which unlocks this HTLC.
14265  */
14266 const uint8_t (*HTLCOutputInCommitment_get_payment_hash(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr))[32];
14267
14268 /**
14269  * The hash of the preimage which unlocks this HTLC.
14270  */
14271 void HTLCOutputInCommitment_set_payment_hash(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14272
14273 /**
14274  * The position within the commitment transactions' outputs. This may be None if the value is
14275  * below the dust limit (in which case no output appears in the commitment transaction and the
14276  * value is spent to additional transaction fees).
14277  */
14278 struct LDKCOption_u32Z HTLCOutputInCommitment_get_transaction_output_index(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
14279
14280 /**
14281  * The position within the commitment transactions' outputs. This may be None if the value is
14282  * below the dust limit (in which case no output appears in the commitment transaction and the
14283  * value is spent to additional transaction fees).
14284  */
14285 void HTLCOutputInCommitment_set_transaction_output_index(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val);
14286
14287 /**
14288  * Constructs a new HTLCOutputInCommitment given each field
14289  */
14290 MUST_USE_RES struct LDKHTLCOutputInCommitment HTLCOutputInCommitment_new(bool offered_arg, uint64_t amount_msat_arg, uint32_t cltv_expiry_arg, struct LDKThirtyTwoBytes payment_hash_arg, struct LDKCOption_u32Z transaction_output_index_arg);
14291
14292 /**
14293  * Creates a copy of the HTLCOutputInCommitment
14294  */
14295 struct LDKHTLCOutputInCommitment HTLCOutputInCommitment_clone(const struct LDKHTLCOutputInCommitment *NONNULL_PTR orig);
14296
14297 /**
14298  * Serialize the HTLCOutputInCommitment object into a byte array which can be read by HTLCOutputInCommitment_read
14299  */
14300 struct LDKCVec_u8Z HTLCOutputInCommitment_write(const struct LDKHTLCOutputInCommitment *NONNULL_PTR obj);
14301
14302 /**
14303  * Read a HTLCOutputInCommitment from a byte array, created by HTLCOutputInCommitment_write
14304  */
14305 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ HTLCOutputInCommitment_read(struct LDKu8slice ser);
14306
14307 /**
14308  * Gets the witness redeemscript for an HTLC output in a commitment transaction. Note that htlc
14309  * does not need to have its previous_output_index filled.
14310  */
14311 struct LDKCVec_u8Z get_htlc_redeemscript(const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc, const struct LDKTxCreationKeys *NONNULL_PTR keys);
14312
14313 /**
14314  * Gets the redeemscript for a funding output from the two funding public keys.
14315  * Note that the order of funding public keys does not matter.
14316  */
14317 struct LDKCVec_u8Z make_funding_redeemscript(struct LDKPublicKey broadcaster, struct LDKPublicKey countersignatory);
14318
14319 /**
14320  * panics if htlc.transaction_output_index.is_none()!
14321  */
14322 struct LDKTransaction build_htlc_transaction(const uint8_t (*prev_hash)[32], uint32_t feerate_per_kw, uint16_t contest_delay, const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc, struct LDKPublicKey broadcaster_delayed_payment_key, struct LDKPublicKey revocation_key);
14323
14324 /**
14325  * Frees any resources used by the ChannelTransactionParameters, if is_owned is set and inner is non-NULL.
14326  */
14327 void ChannelTransactionParameters_free(struct LDKChannelTransactionParameters this_obj);
14328
14329 /**
14330  * Holder public keys
14331  */
14332 struct LDKChannelPublicKeys ChannelTransactionParameters_get_holder_pubkeys(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
14333
14334 /**
14335  * Holder public keys
14336  */
14337 void ChannelTransactionParameters_set_holder_pubkeys(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelPublicKeys val);
14338
14339 /**
14340  * The contest delay selected by the holder, which applies to counterparty-broadcast transactions
14341  */
14342 uint16_t ChannelTransactionParameters_get_holder_selected_contest_delay(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
14343
14344 /**
14345  * The contest delay selected by the holder, which applies to counterparty-broadcast transactions
14346  */
14347 void ChannelTransactionParameters_set_holder_selected_contest_delay(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, uint16_t val);
14348
14349 /**
14350  * Whether the holder is the initiator of this channel.
14351  * This is an input to the commitment number obscure factor computation.
14352  */
14353 bool ChannelTransactionParameters_get_is_outbound_from_holder(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
14354
14355 /**
14356  * Whether the holder is the initiator of this channel.
14357  * This is an input to the commitment number obscure factor computation.
14358  */
14359 void ChannelTransactionParameters_set_is_outbound_from_holder(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, bool val);
14360
14361 /**
14362  * The late-bound counterparty channel transaction parameters.
14363  * These parameters are populated at the point in the protocol where the counterparty provides them.
14364  */
14365 struct LDKCounterpartyChannelTransactionParameters ChannelTransactionParameters_get_counterparty_parameters(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
14366
14367 /**
14368  * The late-bound counterparty channel transaction parameters.
14369  * These parameters are populated at the point in the protocol where the counterparty provides them.
14370  */
14371 void ChannelTransactionParameters_set_counterparty_parameters(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKCounterpartyChannelTransactionParameters val);
14372
14373 /**
14374  * The late-bound funding outpoint
14375  */
14376 struct LDKOutPoint ChannelTransactionParameters_get_funding_outpoint(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
14377
14378 /**
14379  * The late-bound funding outpoint
14380  */
14381 void ChannelTransactionParameters_set_funding_outpoint(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKOutPoint val);
14382
14383 /**
14384  * Constructs a new ChannelTransactionParameters given each field
14385  */
14386 MUST_USE_RES struct LDKChannelTransactionParameters ChannelTransactionParameters_new(struct LDKChannelPublicKeys holder_pubkeys_arg, uint16_t holder_selected_contest_delay_arg, bool is_outbound_from_holder_arg, struct LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg, struct LDKOutPoint funding_outpoint_arg);
14387
14388 /**
14389  * Creates a copy of the ChannelTransactionParameters
14390  */
14391 struct LDKChannelTransactionParameters ChannelTransactionParameters_clone(const struct LDKChannelTransactionParameters *NONNULL_PTR orig);
14392
14393 /**
14394  * Frees any resources used by the CounterpartyChannelTransactionParameters, if is_owned is set and inner is non-NULL.
14395  */
14396 void CounterpartyChannelTransactionParameters_free(struct LDKCounterpartyChannelTransactionParameters this_obj);
14397
14398 /**
14399  * Counter-party public keys
14400  */
14401 struct LDKChannelPublicKeys CounterpartyChannelTransactionParameters_get_pubkeys(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr);
14402
14403 /**
14404  * Counter-party public keys
14405  */
14406 void CounterpartyChannelTransactionParameters_set_pubkeys(struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelPublicKeys val);
14407
14408 /**
14409  * The contest delay selected by the counterparty, which applies to holder-broadcast transactions
14410  */
14411 uint16_t CounterpartyChannelTransactionParameters_get_selected_contest_delay(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr);
14412
14413 /**
14414  * The contest delay selected by the counterparty, which applies to holder-broadcast transactions
14415  */
14416 void CounterpartyChannelTransactionParameters_set_selected_contest_delay(struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr, uint16_t val);
14417
14418 /**
14419  * Constructs a new CounterpartyChannelTransactionParameters given each field
14420  */
14421 MUST_USE_RES struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_new(struct LDKChannelPublicKeys pubkeys_arg, uint16_t selected_contest_delay_arg);
14422
14423 /**
14424  * Creates a copy of the CounterpartyChannelTransactionParameters
14425  */
14426 struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_clone(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR orig);
14427
14428 /**
14429  * Whether the late bound parameters are populated.
14430  */
14431 MUST_USE_RES bool ChannelTransactionParameters_is_populated(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
14432
14433 /**
14434  * Convert the holder/counterparty parameters to broadcaster/countersignatory-organized parameters,
14435  * given that the holder is the broadcaster.
14436  *
14437  * self.is_populated() must be true before calling this function.
14438  */
14439 MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionParameters_as_holder_broadcastable(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
14440
14441 /**
14442  * Convert the holder/counterparty parameters to broadcaster/countersignatory-organized parameters,
14443  * given that the counterparty is the broadcaster.
14444  *
14445  * self.is_populated() must be true before calling this function.
14446  */
14447 MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionParameters_as_counterparty_broadcastable(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
14448
14449 /**
14450  * Serialize the CounterpartyChannelTransactionParameters object into a byte array which can be read by CounterpartyChannelTransactionParameters_read
14451  */
14452 struct LDKCVec_u8Z CounterpartyChannelTransactionParameters_write(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR obj);
14453
14454 /**
14455  * Read a CounterpartyChannelTransactionParameters from a byte array, created by CounterpartyChannelTransactionParameters_write
14456  */
14457 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CounterpartyChannelTransactionParameters_read(struct LDKu8slice ser);
14458
14459 /**
14460  * Serialize the ChannelTransactionParameters object into a byte array which can be read by ChannelTransactionParameters_read
14461  */
14462 struct LDKCVec_u8Z ChannelTransactionParameters_write(const struct LDKChannelTransactionParameters *NONNULL_PTR obj);
14463
14464 /**
14465  * Read a ChannelTransactionParameters from a byte array, created by ChannelTransactionParameters_write
14466  */
14467 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ ChannelTransactionParameters_read(struct LDKu8slice ser);
14468
14469 /**
14470  * Frees any resources used by the DirectedChannelTransactionParameters, if is_owned is set and inner is non-NULL.
14471  */
14472 void DirectedChannelTransactionParameters_free(struct LDKDirectedChannelTransactionParameters this_obj);
14473
14474 /**
14475  * Get the channel pubkeys for the broadcaster
14476  */
14477 MUST_USE_RES struct LDKChannelPublicKeys DirectedChannelTransactionParameters_broadcaster_pubkeys(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
14478
14479 /**
14480  * Get the channel pubkeys for the countersignatory
14481  */
14482 MUST_USE_RES struct LDKChannelPublicKeys DirectedChannelTransactionParameters_countersignatory_pubkeys(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
14483
14484 /**
14485  * Get the contest delay applicable to the transactions.
14486  * Note that the contest delay was selected by the countersignatory.
14487  */
14488 MUST_USE_RES uint16_t DirectedChannelTransactionParameters_contest_delay(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
14489
14490 /**
14491  * Whether the channel is outbound from the broadcaster.
14492  *
14493  * The boolean representing the side that initiated the channel is
14494  * an input to the commitment number obscure factor computation.
14495  */
14496 MUST_USE_RES bool DirectedChannelTransactionParameters_is_outbound(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
14497
14498 /**
14499  * The funding outpoint
14500  */
14501 MUST_USE_RES struct LDKOutPoint DirectedChannelTransactionParameters_funding_outpoint(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
14502
14503 /**
14504  * Frees any resources used by the HolderCommitmentTransaction, if is_owned is set and inner is non-NULL.
14505  */
14506 void HolderCommitmentTransaction_free(struct LDKHolderCommitmentTransaction this_obj);
14507
14508 /**
14509  * Our counterparty's signature for the transaction
14510  */
14511 struct LDKSignature HolderCommitmentTransaction_get_counterparty_sig(const struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr);
14512
14513 /**
14514  * Our counterparty's signature for the transaction
14515  */
14516 void HolderCommitmentTransaction_set_counterparty_sig(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKSignature val);
14517
14518 /**
14519  * All non-dust counterparty HTLC signatures, in the order they appear in the transaction
14520  */
14521 void HolderCommitmentTransaction_set_counterparty_htlc_sigs(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKCVec_SignatureZ val);
14522
14523 /**
14524  * Creates a copy of the HolderCommitmentTransaction
14525  */
14526 struct LDKHolderCommitmentTransaction HolderCommitmentTransaction_clone(const struct LDKHolderCommitmentTransaction *NONNULL_PTR orig);
14527
14528 /**
14529  * Serialize the HolderCommitmentTransaction object into a byte array which can be read by HolderCommitmentTransaction_read
14530  */
14531 struct LDKCVec_u8Z HolderCommitmentTransaction_write(const struct LDKHolderCommitmentTransaction *NONNULL_PTR obj);
14532
14533 /**
14534  * Read a HolderCommitmentTransaction from a byte array, created by HolderCommitmentTransaction_write
14535  */
14536 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ HolderCommitmentTransaction_read(struct LDKu8slice ser);
14537
14538 /**
14539  * Create a new holder transaction with the given counterparty signatures.
14540  * The funding keys are used to figure out which signature should go first when building the transaction for broadcast.
14541  */
14542 MUST_USE_RES struct LDKHolderCommitmentTransaction HolderCommitmentTransaction_new(struct LDKCommitmentTransaction commitment_tx, struct LDKSignature counterparty_sig, struct LDKCVec_SignatureZ counterparty_htlc_sigs, struct LDKPublicKey holder_funding_key, struct LDKPublicKey counterparty_funding_key);
14543
14544 /**
14545  * Frees any resources used by the BuiltCommitmentTransaction, if is_owned is set and inner is non-NULL.
14546  */
14547 void BuiltCommitmentTransaction_free(struct LDKBuiltCommitmentTransaction this_obj);
14548
14549 /**
14550  * The commitment transaction
14551  */
14552 struct LDKTransaction BuiltCommitmentTransaction_get_transaction(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr);
14553
14554 /**
14555  * The commitment transaction
14556  */
14557 void BuiltCommitmentTransaction_set_transaction(struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKTransaction val);
14558
14559 /**
14560  * The txid for the commitment transaction.
14561  *
14562  * This is provided as a performance optimization, instead of calling transaction.txid()
14563  * multiple times.
14564  */
14565 const uint8_t (*BuiltCommitmentTransaction_get_txid(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr))[32];
14566
14567 /**
14568  * The txid for the commitment transaction.
14569  *
14570  * This is provided as a performance optimization, instead of calling transaction.txid()
14571  * multiple times.
14572  */
14573 void BuiltCommitmentTransaction_set_txid(struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14574
14575 /**
14576  * Constructs a new BuiltCommitmentTransaction given each field
14577  */
14578 MUST_USE_RES struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_new(struct LDKTransaction transaction_arg, struct LDKThirtyTwoBytes txid_arg);
14579
14580 /**
14581  * Creates a copy of the BuiltCommitmentTransaction
14582  */
14583 struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_clone(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR orig);
14584
14585 /**
14586  * Serialize the BuiltCommitmentTransaction object into a byte array which can be read by BuiltCommitmentTransaction_read
14587  */
14588 struct LDKCVec_u8Z BuiltCommitmentTransaction_write(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR obj);
14589
14590 /**
14591  * Read a BuiltCommitmentTransaction from a byte array, created by BuiltCommitmentTransaction_write
14592  */
14593 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ BuiltCommitmentTransaction_read(struct LDKu8slice ser);
14594
14595 /**
14596  * Get the SIGHASH_ALL sighash value of the transaction.
14597  *
14598  * This can be used to verify a signature.
14599  */
14600 MUST_USE_RES struct LDKThirtyTwoBytes BuiltCommitmentTransaction_get_sighash_all(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_arg, struct LDKu8slice funding_redeemscript, uint64_t channel_value_satoshis);
14601
14602 /**
14603  * Sign a transaction, either because we are counter-signing the counterparty's transaction or
14604  * because we are about to broadcast a holder transaction.
14605  */
14606 MUST_USE_RES struct LDKSignature BuiltCommitmentTransaction_sign(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_arg, const uint8_t (*funding_key)[32], struct LDKu8slice funding_redeemscript, uint64_t channel_value_satoshis);
14607
14608 /**
14609  * Frees any resources used by the CommitmentTransaction, if is_owned is set and inner is non-NULL.
14610  */
14611 void CommitmentTransaction_free(struct LDKCommitmentTransaction this_obj);
14612
14613 /**
14614  * Creates a copy of the CommitmentTransaction
14615  */
14616 struct LDKCommitmentTransaction CommitmentTransaction_clone(const struct LDKCommitmentTransaction *NONNULL_PTR orig);
14617
14618 /**
14619  * Serialize the CommitmentTransaction object into a byte array which can be read by CommitmentTransaction_read
14620  */
14621 struct LDKCVec_u8Z CommitmentTransaction_write(const struct LDKCommitmentTransaction *NONNULL_PTR obj);
14622
14623 /**
14624  * Read a CommitmentTransaction from a byte array, created by CommitmentTransaction_write
14625  */
14626 struct LDKCResult_CommitmentTransactionDecodeErrorZ CommitmentTransaction_read(struct LDKu8slice ser);
14627
14628 /**
14629  * The backwards-counting commitment number
14630  */
14631 MUST_USE_RES uint64_t CommitmentTransaction_commitment_number(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
14632
14633 /**
14634  * The value to be sent to the broadcaster
14635  */
14636 MUST_USE_RES uint64_t CommitmentTransaction_to_broadcaster_value_sat(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
14637
14638 /**
14639  * The value to be sent to the counterparty
14640  */
14641 MUST_USE_RES uint64_t CommitmentTransaction_to_countersignatory_value_sat(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
14642
14643 /**
14644  * The feerate paid per 1000-weight-unit in this commitment transaction.
14645  */
14646 MUST_USE_RES uint32_t CommitmentTransaction_feerate_per_kw(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
14647
14648 /**
14649  * Trust our pre-built transaction and derived transaction creation public keys.
14650  *
14651  * Applies a wrapper which allows access to these fields.
14652  *
14653  * This should only be used if you fully trust the builder of this object.  It should not
14654  *\tbe used by an external signer - instead use the verify function.
14655  */
14656 MUST_USE_RES struct LDKTrustedCommitmentTransaction CommitmentTransaction_trust(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
14657
14658 /**
14659  * Verify our pre-built transaction and derived transaction creation public keys.
14660  *
14661  * Applies a wrapper which allows access to these fields.
14662  *
14663  * An external validating signer must call this method before signing
14664  * or using the built transaction.
14665  */
14666 MUST_USE_RES struct LDKCResult_TrustedCommitmentTransactionNoneZ CommitmentTransaction_verify(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg, const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR channel_parameters, const struct LDKChannelPublicKeys *NONNULL_PTR broadcaster_keys, const struct LDKChannelPublicKeys *NONNULL_PTR countersignatory_keys);
14667
14668 /**
14669  * Frees any resources used by the TrustedCommitmentTransaction, if is_owned is set and inner is non-NULL.
14670  */
14671 void TrustedCommitmentTransaction_free(struct LDKTrustedCommitmentTransaction this_obj);
14672
14673 /**
14674  * The transaction ID of the built Bitcoin transaction
14675  */
14676 MUST_USE_RES struct LDKThirtyTwoBytes TrustedCommitmentTransaction_txid(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
14677
14678 /**
14679  * The pre-built Bitcoin commitment transaction
14680  */
14681 MUST_USE_RES struct LDKBuiltCommitmentTransaction TrustedCommitmentTransaction_built_transaction(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
14682
14683 /**
14684  * The pre-calculated transaction creation public keys.
14685  */
14686 MUST_USE_RES struct LDKTxCreationKeys TrustedCommitmentTransaction_keys(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
14687
14688 /**
14689  * Get a signature for each HTLC which was included in the commitment transaction (ie for
14690  * which HTLCOutputInCommitment::transaction_output_index.is_some()).
14691  *
14692  * The returned Vec has one entry for each HTLC, and in the same order.
14693  */
14694 MUST_USE_RES struct LDKCResult_CVec_SignatureZNoneZ TrustedCommitmentTransaction_get_htlc_sigs(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg, const uint8_t (*htlc_base_key)[32], const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR channel_parameters);
14695
14696 /**
14697  * Get the transaction number obscure factor
14698  */
14699 uint64_t get_commitment_transaction_number_obscure_factor(struct LDKPublicKey broadcaster_payment_basepoint, struct LDKPublicKey countersignatory_payment_basepoint, bool outbound_from_broadcaster);
14700
14701 /**
14702  * Creates a copy of the InitFeatures
14703  */
14704 struct LDKInitFeatures InitFeatures_clone(const struct LDKInitFeatures *NONNULL_PTR orig);
14705
14706 /**
14707  * Creates a copy of the NodeFeatures
14708  */
14709 struct LDKNodeFeatures NodeFeatures_clone(const struct LDKNodeFeatures *NONNULL_PTR orig);
14710
14711 /**
14712  * Creates a copy of the ChannelFeatures
14713  */
14714 struct LDKChannelFeatures ChannelFeatures_clone(const struct LDKChannelFeatures *NONNULL_PTR orig);
14715
14716 /**
14717  * Creates a copy of the InvoiceFeatures
14718  */
14719 struct LDKInvoiceFeatures InvoiceFeatures_clone(const struct LDKInvoiceFeatures *NONNULL_PTR orig);
14720
14721 /**
14722  * Frees any resources used by the InitFeatures, if is_owned is set and inner is non-NULL.
14723  */
14724 void InitFeatures_free(struct LDKInitFeatures this_obj);
14725
14726 /**
14727  * Frees any resources used by the NodeFeatures, if is_owned is set and inner is non-NULL.
14728  */
14729 void NodeFeatures_free(struct LDKNodeFeatures this_obj);
14730
14731 /**
14732  * Frees any resources used by the ChannelFeatures, if is_owned is set and inner is non-NULL.
14733  */
14734 void ChannelFeatures_free(struct LDKChannelFeatures this_obj);
14735
14736 /**
14737  * Frees any resources used by the InvoiceFeatures, if is_owned is set and inner is non-NULL.
14738  */
14739 void InvoiceFeatures_free(struct LDKInvoiceFeatures this_obj);
14740
14741 /**
14742  * Create a blank Features with no features set
14743  */
14744 MUST_USE_RES struct LDKInitFeatures InitFeatures_empty(void);
14745
14746 /**
14747  * Creates a Features with the bits set which are known by the implementation
14748  */
14749 MUST_USE_RES struct LDKInitFeatures InitFeatures_known(void);
14750
14751 /**
14752  * Create a blank Features with no features set
14753  */
14754 MUST_USE_RES struct LDKNodeFeatures NodeFeatures_empty(void);
14755
14756 /**
14757  * Creates a Features with the bits set which are known by the implementation
14758  */
14759 MUST_USE_RES struct LDKNodeFeatures NodeFeatures_known(void);
14760
14761 /**
14762  * Create a blank Features with no features set
14763  */
14764 MUST_USE_RES struct LDKChannelFeatures ChannelFeatures_empty(void);
14765
14766 /**
14767  * Creates a Features with the bits set which are known by the implementation
14768  */
14769 MUST_USE_RES struct LDKChannelFeatures ChannelFeatures_known(void);
14770
14771 /**
14772  * Create a blank Features with no features set
14773  */
14774 MUST_USE_RES struct LDKInvoiceFeatures InvoiceFeatures_empty(void);
14775
14776 /**
14777  * Creates a Features with the bits set which are known by the implementation
14778  */
14779 MUST_USE_RES struct LDKInvoiceFeatures InvoiceFeatures_known(void);
14780
14781 /**
14782  * Serialize the InitFeatures object into a byte array which can be read by InitFeatures_read
14783  */
14784 struct LDKCVec_u8Z InitFeatures_write(const struct LDKInitFeatures *NONNULL_PTR obj);
14785
14786 /**
14787  * Serialize the NodeFeatures object into a byte array which can be read by NodeFeatures_read
14788  */
14789 struct LDKCVec_u8Z NodeFeatures_write(const struct LDKNodeFeatures *NONNULL_PTR obj);
14790
14791 /**
14792  * Serialize the ChannelFeatures object into a byte array which can be read by ChannelFeatures_read
14793  */
14794 struct LDKCVec_u8Z ChannelFeatures_write(const struct LDKChannelFeatures *NONNULL_PTR obj);
14795
14796 /**
14797  * Serialize the InvoiceFeatures object into a byte array which can be read by InvoiceFeatures_read
14798  */
14799 struct LDKCVec_u8Z InvoiceFeatures_write(const struct LDKInvoiceFeatures *NONNULL_PTR obj);
14800
14801 /**
14802  * Read a InitFeatures from a byte array, created by InitFeatures_write
14803  */
14804 struct LDKCResult_InitFeaturesDecodeErrorZ InitFeatures_read(struct LDKu8slice ser);
14805
14806 /**
14807  * Read a NodeFeatures from a byte array, created by NodeFeatures_write
14808  */
14809 struct LDKCResult_NodeFeaturesDecodeErrorZ NodeFeatures_read(struct LDKu8slice ser);
14810
14811 /**
14812  * Read a ChannelFeatures from a byte array, created by ChannelFeatures_write
14813  */
14814 struct LDKCResult_ChannelFeaturesDecodeErrorZ ChannelFeatures_read(struct LDKu8slice ser);
14815
14816 /**
14817  * Read a InvoiceFeatures from a byte array, created by InvoiceFeatures_write
14818  */
14819 struct LDKCResult_InvoiceFeaturesDecodeErrorZ InvoiceFeatures_read(struct LDKu8slice ser);
14820
14821 /**
14822  * Frees any resources used by the RouteHop, if is_owned is set and inner is non-NULL.
14823  */
14824 void RouteHop_free(struct LDKRouteHop this_obj);
14825
14826 /**
14827  * The node_id of the node at this hop.
14828  */
14829 struct LDKPublicKey RouteHop_get_pubkey(const struct LDKRouteHop *NONNULL_PTR this_ptr);
14830
14831 /**
14832  * The node_id of the node at this hop.
14833  */
14834 void RouteHop_set_pubkey(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14835
14836 /**
14837  * The node_announcement features of the node at this hop. For the last hop, these may be
14838  * amended to match the features present in the invoice this node generated.
14839  */
14840 struct LDKNodeFeatures RouteHop_get_node_features(const struct LDKRouteHop *NONNULL_PTR this_ptr);
14841
14842 /**
14843  * The node_announcement features of the node at this hop. For the last hop, these may be
14844  * amended to match the features present in the invoice this node generated.
14845  */
14846 void RouteHop_set_node_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
14847
14848 /**
14849  * The channel that should be used from the previous hop to reach this node.
14850  */
14851 uint64_t RouteHop_get_short_channel_id(const struct LDKRouteHop *NONNULL_PTR this_ptr);
14852
14853 /**
14854  * The channel that should be used from the previous hop to reach this node.
14855  */
14856 void RouteHop_set_short_channel_id(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val);
14857
14858 /**
14859  * The channel_announcement features of the channel that should be used from the previous hop
14860  * to reach this node.
14861  */
14862 struct LDKChannelFeatures RouteHop_get_channel_features(const struct LDKRouteHop *NONNULL_PTR this_ptr);
14863
14864 /**
14865  * The channel_announcement features of the channel that should be used from the previous hop
14866  * to reach this node.
14867  */
14868 void RouteHop_set_channel_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
14869
14870 /**
14871  * The fee taken on this hop (for paying for the use of the *next* channel in the path).
14872  * For the last hop, this should be the full value of the payment (might be more than
14873  * requested if we had to match htlc_minimum_msat).
14874  */
14875 uint64_t RouteHop_get_fee_msat(const struct LDKRouteHop *NONNULL_PTR this_ptr);
14876
14877 /**
14878  * The fee taken on this hop (for paying for the use of the *next* channel in the path).
14879  * For the last hop, this should be the full value of the payment (might be more than
14880  * requested if we had to match htlc_minimum_msat).
14881  */
14882 void RouteHop_set_fee_msat(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val);
14883
14884 /**
14885  * The CLTV delta added for this hop. For the last hop, this should be the full CLTV value
14886  * expected at the destination, in excess of the current block height.
14887  */
14888 uint32_t RouteHop_get_cltv_expiry_delta(const struct LDKRouteHop *NONNULL_PTR this_ptr);
14889
14890 /**
14891  * The CLTV delta added for this hop. For the last hop, this should be the full CLTV value
14892  * expected at the destination, in excess of the current block height.
14893  */
14894 void RouteHop_set_cltv_expiry_delta(struct LDKRouteHop *NONNULL_PTR this_ptr, uint32_t val);
14895
14896 /**
14897  * Constructs a new RouteHop given each field
14898  */
14899 MUST_USE_RES struct LDKRouteHop RouteHop_new(struct LDKPublicKey pubkey_arg, struct LDKNodeFeatures node_features_arg, uint64_t short_channel_id_arg, struct LDKChannelFeatures channel_features_arg, uint64_t fee_msat_arg, uint32_t cltv_expiry_delta_arg);
14900
14901 /**
14902  * Creates a copy of the RouteHop
14903  */
14904 struct LDKRouteHop RouteHop_clone(const struct LDKRouteHop *NONNULL_PTR orig);
14905
14906 /**
14907  * Frees any resources used by the Route, if is_owned is set and inner is non-NULL.
14908  */
14909 void Route_free(struct LDKRoute this_obj);
14910
14911 /**
14912  * The list of routes taken for a single (potentially-)multi-part payment. The pubkey of the
14913  * last RouteHop in each path must be the same.
14914  * Each entry represents a list of hops, NOT INCLUDING our own, where the last hop is the
14915  * destination. Thus, this must always be at least length one. While the maximum length of any
14916  * given path is variable, keeping the length of any path to less than 20 should currently
14917  * ensure it is viable.
14918  */
14919 void Route_set_paths(struct LDKRoute *NONNULL_PTR this_ptr, struct LDKCVec_CVec_RouteHopZZ val);
14920
14921 /**
14922  * Constructs a new Route given each field
14923  */
14924 MUST_USE_RES struct LDKRoute Route_new(struct LDKCVec_CVec_RouteHopZZ paths_arg);
14925
14926 /**
14927  * Creates a copy of the Route
14928  */
14929 struct LDKRoute Route_clone(const struct LDKRoute *NONNULL_PTR orig);
14930
14931 /**
14932  * Serialize the Route object into a byte array which can be read by Route_read
14933  */
14934 struct LDKCVec_u8Z Route_write(const struct LDKRoute *NONNULL_PTR obj);
14935
14936 /**
14937  * Read a Route from a byte array, created by Route_write
14938  */
14939 struct LDKCResult_RouteDecodeErrorZ Route_read(struct LDKu8slice ser);
14940
14941 /**
14942  * Frees any resources used by the RouteHint, if is_owned is set and inner is non-NULL.
14943  */
14944 void RouteHint_free(struct LDKRouteHint this_obj);
14945
14946 /**
14947  * The node_id of the non-target end of the route
14948  */
14949 struct LDKPublicKey RouteHint_get_src_node_id(const struct LDKRouteHint *NONNULL_PTR this_ptr);
14950
14951 /**
14952  * The node_id of the non-target end of the route
14953  */
14954 void RouteHint_set_src_node_id(struct LDKRouteHint *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14955
14956 /**
14957  * The short_channel_id of this channel
14958  */
14959 uint64_t RouteHint_get_short_channel_id(const struct LDKRouteHint *NONNULL_PTR this_ptr);
14960
14961 /**
14962  * The short_channel_id of this channel
14963  */
14964 void RouteHint_set_short_channel_id(struct LDKRouteHint *NONNULL_PTR this_ptr, uint64_t val);
14965
14966 /**
14967  * The fees which must be paid to use this channel
14968  */
14969 struct LDKRoutingFees RouteHint_get_fees(const struct LDKRouteHint *NONNULL_PTR this_ptr);
14970
14971 /**
14972  * The fees which must be paid to use this channel
14973  */
14974 void RouteHint_set_fees(struct LDKRouteHint *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
14975
14976 /**
14977  * The difference in CLTV values between this node and the next node.
14978  */
14979 uint16_t RouteHint_get_cltv_expiry_delta(const struct LDKRouteHint *NONNULL_PTR this_ptr);
14980
14981 /**
14982  * The difference in CLTV values between this node and the next node.
14983  */
14984 void RouteHint_set_cltv_expiry_delta(struct LDKRouteHint *NONNULL_PTR this_ptr, uint16_t val);
14985
14986 /**
14987  * The minimum value, in msat, which must be relayed to the next hop.
14988  */
14989 struct LDKCOption_u64Z RouteHint_get_htlc_minimum_msat(const struct LDKRouteHint *NONNULL_PTR this_ptr);
14990
14991 /**
14992  * The minimum value, in msat, which must be relayed to the next hop.
14993  */
14994 void RouteHint_set_htlc_minimum_msat(struct LDKRouteHint *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
14995
14996 /**
14997  * The maximum value in msat available for routing with a single HTLC.
14998  */
14999 struct LDKCOption_u64Z RouteHint_get_htlc_maximum_msat(const struct LDKRouteHint *NONNULL_PTR this_ptr);
15000
15001 /**
15002  * The maximum value in msat available for routing with a single HTLC.
15003  */
15004 void RouteHint_set_htlc_maximum_msat(struct LDKRouteHint *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
15005
15006 /**
15007  * Constructs a new RouteHint given each field
15008  */
15009 MUST_USE_RES struct LDKRouteHint RouteHint_new(struct LDKPublicKey src_node_id_arg, uint64_t short_channel_id_arg, struct LDKRoutingFees fees_arg, uint16_t cltv_expiry_delta_arg, struct LDKCOption_u64Z htlc_minimum_msat_arg, struct LDKCOption_u64Z htlc_maximum_msat_arg);
15010
15011 /**
15012  * Creates a copy of the RouteHint
15013  */
15014 struct LDKRouteHint RouteHint_clone(const struct LDKRouteHint *NONNULL_PTR orig);
15015
15016 /**
15017  * Gets a route from us (payer) to the given target node (payee).
15018  *
15019  * If the payee provided features in their invoice, they should be provided via payee_features.
15020  * Without this, MPP will only be used if the payee's features are available in the network graph.
15021  *
15022  * Extra routing hops between known nodes and the target will be used if they are included in
15023  * last_hops.
15024  *
15025  * If some channels aren't announced, it may be useful to fill in a first_hops with the
15026  * results from a local ChannelManager::list_usable_channels() call. If it is filled in, our
15027  * view of our local channels (from net_graph_msg_handler) will be ignored, and only those
15028  * in first_hops will be used.
15029  *
15030  * Panics if first_hops contains channels without short_channel_ids
15031  * (ChannelManager::list_usable_channels will never include such channels).
15032  *
15033  * The fees on channels from us to next-hops are ignored (as they are assumed to all be
15034  * equal), however the enabled/disabled bit on such channels as well as the
15035  * htlc_minimum_msat/htlc_maximum_msat *are* checked as they may change based on the receiving node.
15036  */
15037 struct LDKCResult_RouteLightningErrorZ get_route(struct LDKPublicKey our_node_id, const struct LDKNetworkGraph *NONNULL_PTR network, struct LDKPublicKey payee, struct LDKInvoiceFeatures payee_features, struct LDKCVec_ChannelDetailsZ *first_hops, struct LDKCVec_RouteHintZ last_hops, uint64_t final_value_msat, uint32_t final_cltv, struct LDKLogger logger);
15038
15039 /**
15040  * Frees any resources used by the NetworkGraph, if is_owned is set and inner is non-NULL.
15041  */
15042 void NetworkGraph_free(struct LDKNetworkGraph this_obj);
15043
15044 /**
15045  * Creates a copy of the NetworkGraph
15046  */
15047 struct LDKNetworkGraph NetworkGraph_clone(const struct LDKNetworkGraph *NONNULL_PTR orig);
15048
15049 /**
15050  * Frees any resources used by the LockedNetworkGraph, if is_owned is set and inner is non-NULL.
15051  */
15052 void LockedNetworkGraph_free(struct LDKLockedNetworkGraph this_obj);
15053
15054 /**
15055  * Frees any resources used by the NetGraphMsgHandler, if is_owned is set and inner is non-NULL.
15056  */
15057 void NetGraphMsgHandler_free(struct LDKNetGraphMsgHandler this_obj);
15058
15059 /**
15060  * Creates a new tracker of the actual state of the network of channels and nodes,
15061  * assuming a fresh network graph.
15062  * Chain monitor is used to make sure announced channels exist on-chain,
15063  * channel data is correct, and that the announcement is signed with
15064  * channel owners' keys.
15065  */
15066 MUST_USE_RES struct LDKNetGraphMsgHandler NetGraphMsgHandler_new(struct LDKThirtyTwoBytes genesis_hash, struct LDKAccess *chain_access, struct LDKLogger logger);
15067
15068 /**
15069  * Creates a new tracker of the actual state of the network of channels and nodes,
15070  * assuming an existing Network Graph.
15071  */
15072 MUST_USE_RES struct LDKNetGraphMsgHandler NetGraphMsgHandler_from_net_graph(struct LDKAccess *chain_access, struct LDKLogger logger, struct LDKNetworkGraph network_graph);
15073
15074 /**
15075  * Adds a provider used to check new announcements. Does not affect
15076  * existing announcements unless they are updated.
15077  * Add, update or remove the provider would replace the current one.
15078  */
15079 void NetGraphMsgHandler_add_chain_access(struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg, struct LDKAccess *chain_access);
15080
15081 /**
15082  * Take a read lock on the network_graph and return it in the C-bindings
15083  * newtype helper. This is likely only useful when called via the C
15084  * bindings as you can call `self.network_graph.read().unwrap()` in Rust
15085  * yourself.
15086  */
15087 MUST_USE_RES struct LDKLockedNetworkGraph NetGraphMsgHandler_read_locked_graph(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg);
15088
15089 /**
15090  * Get a reference to the NetworkGraph which this read-lock contains.
15091  */
15092 MUST_USE_RES struct LDKNetworkGraph LockedNetworkGraph_graph(const struct LDKLockedNetworkGraph *NONNULL_PTR this_arg);
15093
15094 /**
15095  * Constructs a new RoutingMessageHandler which calls the relevant methods on this_arg.
15096  * This copies the `inner` pointer in this_arg and thus the returned RoutingMessageHandler must be freed before this_arg is
15097  */
15098 struct LDKRoutingMessageHandler NetGraphMsgHandler_as_RoutingMessageHandler(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg);
15099
15100 /**
15101  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
15102  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
15103  */
15104 struct LDKMessageSendEventsProvider NetGraphMsgHandler_as_MessageSendEventsProvider(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg);
15105
15106 /**
15107  * Frees any resources used by the DirectionalChannelInfo, if is_owned is set and inner is non-NULL.
15108  */
15109 void DirectionalChannelInfo_free(struct LDKDirectionalChannelInfo this_obj);
15110
15111 /**
15112  * When the last update to the channel direction was issued.
15113  * Value is opaque, as set in the announcement.
15114  */
15115 uint32_t DirectionalChannelInfo_get_last_update(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
15116
15117 /**
15118  * When the last update to the channel direction was issued.
15119  * Value is opaque, as set in the announcement.
15120  */
15121 void DirectionalChannelInfo_set_last_update(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, uint32_t val);
15122
15123 /**
15124  * Whether the channel can be currently used for payments (in this one direction).
15125  */
15126 bool DirectionalChannelInfo_get_enabled(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
15127
15128 /**
15129  * Whether the channel can be currently used for payments (in this one direction).
15130  */
15131 void DirectionalChannelInfo_set_enabled(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, bool val);
15132
15133 /**
15134  * The difference in CLTV values that you must have when routing through this channel.
15135  */
15136 uint16_t DirectionalChannelInfo_get_cltv_expiry_delta(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
15137
15138 /**
15139  * The difference in CLTV values that you must have when routing through this channel.
15140  */
15141 void DirectionalChannelInfo_set_cltv_expiry_delta(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, uint16_t val);
15142
15143 /**
15144  * The minimum value, which must be relayed to the next hop via the channel
15145  */
15146 uint64_t DirectionalChannelInfo_get_htlc_minimum_msat(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
15147
15148 /**
15149  * The minimum value, which must be relayed to the next hop via the channel
15150  */
15151 void DirectionalChannelInfo_set_htlc_minimum_msat(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, uint64_t val);
15152
15153 /**
15154  * The maximum value which may be relayed to the next hop via the channel.
15155  */
15156 struct LDKCOption_u64Z DirectionalChannelInfo_get_htlc_maximum_msat(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
15157
15158 /**
15159  * The maximum value which may be relayed to the next hop via the channel.
15160  */
15161 void DirectionalChannelInfo_set_htlc_maximum_msat(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
15162
15163 /**
15164  * Fees charged when the channel is used for routing
15165  */
15166 struct LDKRoutingFees DirectionalChannelInfo_get_fees(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
15167
15168 /**
15169  * Fees charged when the channel is used for routing
15170  */
15171 void DirectionalChannelInfo_set_fees(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
15172
15173 /**
15174  * Most recent update for the channel received from the network
15175  * Mostly redundant with the data we store in fields explicitly.
15176  * Everything else is useful only for sending out for initial routing sync.
15177  * Not stored if contains excess data to prevent DoS.
15178  */
15179 struct LDKChannelUpdate DirectionalChannelInfo_get_last_update_message(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
15180
15181 /**
15182  * Most recent update for the channel received from the network
15183  * Mostly redundant with the data we store in fields explicitly.
15184  * Everything else is useful only for sending out for initial routing sync.
15185  * Not stored if contains excess data to prevent DoS.
15186  */
15187 void DirectionalChannelInfo_set_last_update_message(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelUpdate val);
15188
15189 /**
15190  * Constructs a new DirectionalChannelInfo given each field
15191  */
15192 MUST_USE_RES struct LDKDirectionalChannelInfo DirectionalChannelInfo_new(uint32_t last_update_arg, bool enabled_arg, uint16_t cltv_expiry_delta_arg, uint64_t htlc_minimum_msat_arg, struct LDKCOption_u64Z htlc_maximum_msat_arg, struct LDKRoutingFees fees_arg, struct LDKChannelUpdate last_update_message_arg);
15193
15194 /**
15195  * Creates a copy of the DirectionalChannelInfo
15196  */
15197 struct LDKDirectionalChannelInfo DirectionalChannelInfo_clone(const struct LDKDirectionalChannelInfo *NONNULL_PTR orig);
15198
15199 /**
15200  * Serialize the DirectionalChannelInfo object into a byte array which can be read by DirectionalChannelInfo_read
15201  */
15202 struct LDKCVec_u8Z DirectionalChannelInfo_write(const struct LDKDirectionalChannelInfo *NONNULL_PTR obj);
15203
15204 /**
15205  * Read a DirectionalChannelInfo from a byte array, created by DirectionalChannelInfo_write
15206  */
15207 struct LDKCResult_DirectionalChannelInfoDecodeErrorZ DirectionalChannelInfo_read(struct LDKu8slice ser);
15208
15209 /**
15210  * Frees any resources used by the ChannelInfo, if is_owned is set and inner is non-NULL.
15211  */
15212 void ChannelInfo_free(struct LDKChannelInfo this_obj);
15213
15214 /**
15215  * Protocol features of a channel communicated during its announcement
15216  */
15217 struct LDKChannelFeatures ChannelInfo_get_features(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
15218
15219 /**
15220  * Protocol features of a channel communicated during its announcement
15221  */
15222 void ChannelInfo_set_features(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
15223
15224 /**
15225  * Source node of the first direction of a channel
15226  */
15227 struct LDKPublicKey ChannelInfo_get_node_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
15228
15229 /**
15230  * Source node of the first direction of a channel
15231  */
15232 void ChannelInfo_set_node_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKPublicKey val);
15233
15234 /**
15235  * Details about the first direction of a channel
15236  */
15237 struct LDKDirectionalChannelInfo ChannelInfo_get_one_to_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
15238
15239 /**
15240  * Details about the first direction of a channel
15241  */
15242 void ChannelInfo_set_one_to_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKDirectionalChannelInfo val);
15243
15244 /**
15245  * Source node of the second direction of a channel
15246  */
15247 struct LDKPublicKey ChannelInfo_get_node_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
15248
15249 /**
15250  * Source node of the second direction of a channel
15251  */
15252 void ChannelInfo_set_node_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKPublicKey val);
15253
15254 /**
15255  * Details about the second direction of a channel
15256  */
15257 struct LDKDirectionalChannelInfo ChannelInfo_get_two_to_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
15258
15259 /**
15260  * Details about the second direction of a channel
15261  */
15262 void ChannelInfo_set_two_to_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKDirectionalChannelInfo val);
15263
15264 /**
15265  * The channel capacity as seen on-chain, if chain lookup is available.
15266  */
15267 struct LDKCOption_u64Z ChannelInfo_get_capacity_sats(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
15268
15269 /**
15270  * The channel capacity as seen on-chain, if chain lookup is available.
15271  */
15272 void ChannelInfo_set_capacity_sats(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
15273
15274 /**
15275  * An initial announcement of the channel
15276  * Mostly redundant with the data we store in fields explicitly.
15277  * Everything else is useful only for sending out for initial routing sync.
15278  * Not stored if contains excess data to prevent DoS.
15279  */
15280 struct LDKChannelAnnouncement ChannelInfo_get_announcement_message(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
15281
15282 /**
15283  * An initial announcement of the channel
15284  * Mostly redundant with the data we store in fields explicitly.
15285  * Everything else is useful only for sending out for initial routing sync.
15286  * Not stored if contains excess data to prevent DoS.
15287  */
15288 void ChannelInfo_set_announcement_message(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelAnnouncement val);
15289
15290 /**
15291  * Constructs a new ChannelInfo given each field
15292  */
15293 MUST_USE_RES struct LDKChannelInfo ChannelInfo_new(struct LDKChannelFeatures features_arg, struct LDKPublicKey node_one_arg, struct LDKDirectionalChannelInfo one_to_two_arg, struct LDKPublicKey node_two_arg, struct LDKDirectionalChannelInfo two_to_one_arg, struct LDKCOption_u64Z capacity_sats_arg, struct LDKChannelAnnouncement announcement_message_arg);
15294
15295 /**
15296  * Creates a copy of the ChannelInfo
15297  */
15298 struct LDKChannelInfo ChannelInfo_clone(const struct LDKChannelInfo *NONNULL_PTR orig);
15299
15300 /**
15301  * Serialize the ChannelInfo object into a byte array which can be read by ChannelInfo_read
15302  */
15303 struct LDKCVec_u8Z ChannelInfo_write(const struct LDKChannelInfo *NONNULL_PTR obj);
15304
15305 /**
15306  * Read a ChannelInfo from a byte array, created by ChannelInfo_write
15307  */
15308 struct LDKCResult_ChannelInfoDecodeErrorZ ChannelInfo_read(struct LDKu8slice ser);
15309
15310 /**
15311  * Frees any resources used by the RoutingFees, if is_owned is set and inner is non-NULL.
15312  */
15313 void RoutingFees_free(struct LDKRoutingFees this_obj);
15314
15315 /**
15316  * Flat routing fee in satoshis
15317  */
15318 uint32_t RoutingFees_get_base_msat(const struct LDKRoutingFees *NONNULL_PTR this_ptr);
15319
15320 /**
15321  * Flat routing fee in satoshis
15322  */
15323 void RoutingFees_set_base_msat(struct LDKRoutingFees *NONNULL_PTR this_ptr, uint32_t val);
15324
15325 /**
15326  * Liquidity-based routing fee in millionths of a routed amount.
15327  * In other words, 10000 is 1%.
15328  */
15329 uint32_t RoutingFees_get_proportional_millionths(const struct LDKRoutingFees *NONNULL_PTR this_ptr);
15330
15331 /**
15332  * Liquidity-based routing fee in millionths of a routed amount.
15333  * In other words, 10000 is 1%.
15334  */
15335 void RoutingFees_set_proportional_millionths(struct LDKRoutingFees *NONNULL_PTR this_ptr, uint32_t val);
15336
15337 /**
15338  * Constructs a new RoutingFees given each field
15339  */
15340 MUST_USE_RES struct LDKRoutingFees RoutingFees_new(uint32_t base_msat_arg, uint32_t proportional_millionths_arg);
15341
15342 /**
15343  * Creates a copy of the RoutingFees
15344  */
15345 struct LDKRoutingFees RoutingFees_clone(const struct LDKRoutingFees *NONNULL_PTR orig);
15346
15347 /**
15348  * Read a RoutingFees from a byte array, created by RoutingFees_write
15349  */
15350 struct LDKCResult_RoutingFeesDecodeErrorZ RoutingFees_read(struct LDKu8slice ser);
15351
15352 /**
15353  * Serialize the RoutingFees object into a byte array which can be read by RoutingFees_read
15354  */
15355 struct LDKCVec_u8Z RoutingFees_write(const struct LDKRoutingFees *NONNULL_PTR obj);
15356
15357 /**
15358  * Frees any resources used by the NodeAnnouncementInfo, if is_owned is set and inner is non-NULL.
15359  */
15360 void NodeAnnouncementInfo_free(struct LDKNodeAnnouncementInfo this_obj);
15361
15362 /**
15363  * Protocol features the node announced support for
15364  */
15365 struct LDKNodeFeatures NodeAnnouncementInfo_get_features(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
15366
15367 /**
15368  * Protocol features the node announced support for
15369  */
15370 void NodeAnnouncementInfo_set_features(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
15371
15372 /**
15373  * When the last known update to the node state was issued.
15374  * Value is opaque, as set in the announcement.
15375  */
15376 uint32_t NodeAnnouncementInfo_get_last_update(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
15377
15378 /**
15379  * When the last known update to the node state was issued.
15380  * Value is opaque, as set in the announcement.
15381  */
15382 void NodeAnnouncementInfo_set_last_update(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, uint32_t val);
15383
15384 /**
15385  * Color assigned to the node
15386  */
15387 const uint8_t (*NodeAnnouncementInfo_get_rgb(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr))[3];
15388
15389 /**
15390  * Color assigned to the node
15391  */
15392 void NodeAnnouncementInfo_set_rgb(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKThreeBytes val);
15393
15394 /**
15395  * Moniker assigned to the node.
15396  * May be invalid or malicious (eg control chars),
15397  * should not be exposed to the user.
15398  */
15399 const uint8_t (*NodeAnnouncementInfo_get_alias(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr))[32];
15400
15401 /**
15402  * Moniker assigned to the node.
15403  * May be invalid or malicious (eg control chars),
15404  * should not be exposed to the user.
15405  */
15406 void NodeAnnouncementInfo_set_alias(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
15407
15408 /**
15409  * Internet-level addresses via which one can connect to the node
15410  */
15411 void NodeAnnouncementInfo_set_addresses(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKCVec_NetAddressZ val);
15412
15413 /**
15414  * An initial announcement of the node
15415  * Mostly redundant with the data we store in fields explicitly.
15416  * Everything else is useful only for sending out for initial routing sync.
15417  * Not stored if contains excess data to prevent DoS.
15418  */
15419 struct LDKNodeAnnouncement NodeAnnouncementInfo_get_announcement_message(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
15420
15421 /**
15422  * An initial announcement of the node
15423  * Mostly redundant with the data we store in fields explicitly.
15424  * Everything else is useful only for sending out for initial routing sync.
15425  * Not stored if contains excess data to prevent DoS.
15426  */
15427 void NodeAnnouncementInfo_set_announcement_message(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeAnnouncement val);
15428
15429 /**
15430  * Constructs a new NodeAnnouncementInfo given each field
15431  */
15432 MUST_USE_RES struct LDKNodeAnnouncementInfo NodeAnnouncementInfo_new(struct LDKNodeFeatures features_arg, uint32_t last_update_arg, struct LDKThreeBytes rgb_arg, struct LDKThirtyTwoBytes alias_arg, struct LDKCVec_NetAddressZ addresses_arg, struct LDKNodeAnnouncement announcement_message_arg);
15433
15434 /**
15435  * Creates a copy of the NodeAnnouncementInfo
15436  */
15437 struct LDKNodeAnnouncementInfo NodeAnnouncementInfo_clone(const struct LDKNodeAnnouncementInfo *NONNULL_PTR orig);
15438
15439 /**
15440  * Serialize the NodeAnnouncementInfo object into a byte array which can be read by NodeAnnouncementInfo_read
15441  */
15442 struct LDKCVec_u8Z NodeAnnouncementInfo_write(const struct LDKNodeAnnouncementInfo *NONNULL_PTR obj);
15443
15444 /**
15445  * Read a NodeAnnouncementInfo from a byte array, created by NodeAnnouncementInfo_write
15446  */
15447 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ NodeAnnouncementInfo_read(struct LDKu8slice ser);
15448
15449 /**
15450  * Frees any resources used by the NodeInfo, if is_owned is set and inner is non-NULL.
15451  */
15452 void NodeInfo_free(struct LDKNodeInfo this_obj);
15453
15454 /**
15455  * All valid channels a node has announced
15456  */
15457 void NodeInfo_set_channels(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
15458
15459 /**
15460  * Lowest fees enabling routing via any of the enabled, known channels to a node.
15461  * The two fields (flat and proportional fee) are independent,
15462  * meaning they don't have to refer to the same channel.
15463  */
15464 struct LDKRoutingFees NodeInfo_get_lowest_inbound_channel_fees(const struct LDKNodeInfo *NONNULL_PTR this_ptr);
15465
15466 /**
15467  * Lowest fees enabling routing via any of the enabled, known channels to a node.
15468  * The two fields (flat and proportional fee) are independent,
15469  * meaning they don't have to refer to the same channel.
15470  */
15471 void NodeInfo_set_lowest_inbound_channel_fees(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
15472
15473 /**
15474  * More information about a node from node_announcement.
15475  * Optional because we store a Node entry after learning about it from
15476  * a channel announcement, but before receiving a node announcement.
15477  */
15478 struct LDKNodeAnnouncementInfo NodeInfo_get_announcement_info(const struct LDKNodeInfo *NONNULL_PTR this_ptr);
15479
15480 /**
15481  * More information about a node from node_announcement.
15482  * Optional because we store a Node entry after learning about it from
15483  * a channel announcement, but before receiving a node announcement.
15484  */
15485 void NodeInfo_set_announcement_info(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKNodeAnnouncementInfo val);
15486
15487 /**
15488  * Constructs a new NodeInfo given each field
15489  */
15490 MUST_USE_RES struct LDKNodeInfo NodeInfo_new(struct LDKCVec_u64Z channels_arg, struct LDKRoutingFees lowest_inbound_channel_fees_arg, struct LDKNodeAnnouncementInfo announcement_info_arg);
15491
15492 /**
15493  * Creates a copy of the NodeInfo
15494  */
15495 struct LDKNodeInfo NodeInfo_clone(const struct LDKNodeInfo *NONNULL_PTR orig);
15496
15497 /**
15498  * Serialize the NodeInfo object into a byte array which can be read by NodeInfo_read
15499  */
15500 struct LDKCVec_u8Z NodeInfo_write(const struct LDKNodeInfo *NONNULL_PTR obj);
15501
15502 /**
15503  * Read a NodeInfo from a byte array, created by NodeInfo_write
15504  */
15505 struct LDKCResult_NodeInfoDecodeErrorZ NodeInfo_read(struct LDKu8slice ser);
15506
15507 /**
15508  * Serialize the NetworkGraph object into a byte array which can be read by NetworkGraph_read
15509  */
15510 struct LDKCVec_u8Z NetworkGraph_write(const struct LDKNetworkGraph *NONNULL_PTR obj);
15511
15512 /**
15513  * Read a NetworkGraph from a byte array, created by NetworkGraph_write
15514  */
15515 struct LDKCResult_NetworkGraphDecodeErrorZ NetworkGraph_read(struct LDKu8slice ser);
15516
15517 /**
15518  * Creates a new, empty, network graph.
15519  */
15520 MUST_USE_RES struct LDKNetworkGraph NetworkGraph_new(struct LDKThirtyTwoBytes genesis_hash);
15521
15522 /**
15523  * For an already known node (from channel announcements), update its stored properties from a
15524  * given node announcement.
15525  *
15526  * You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's
15527  * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
15528  * routing messages from a source using a protocol other than the lightning P2P protocol.
15529  */
15530 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_node_from_announcement(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKNodeAnnouncement *NONNULL_PTR msg);
15531
15532 /**
15533  * For an already known node (from channel announcements), update its stored properties from a
15534  * given node announcement without verifying the associated signatures. Because we aren't
15535  * given the associated signatures here we cannot relay the node announcement to any of our
15536  * peers.
15537  */
15538 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_node_from_unsigned_announcement(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR msg);
15539
15540 /**
15541  * Store or update channel info from a channel announcement.
15542  *
15543  * You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's
15544  * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
15545  * routing messages from a source using a protocol other than the lightning P2P protocol.
15546  *
15547  * If a `chain::Access` object is provided via `chain_access`, it will be called to verify
15548  * the corresponding UTXO exists on chain and is correctly-formatted.
15549  */
15550 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_from_announcement(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKChannelAnnouncement *NONNULL_PTR msg, struct LDKAccess *chain_access);
15551
15552 /**
15553  * Store or update channel info from a channel announcement without verifying the associated
15554  * signatures. Because we aren't given the associated signatures here we cannot relay the
15555  * channel announcement to any of our peers.
15556  *
15557  * If a `chain::Access` object is provided via `chain_access`, it will be called to verify
15558  * the corresponding UTXO exists on chain and is correctly-formatted.
15559  */
15560 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_from_unsigned_announcement(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR msg, struct LDKAccess *chain_access);
15561
15562 /**
15563  * Close a channel if a corresponding HTLC fail was sent.
15564  * If permanent, removes a channel from the local storage.
15565  * May cause the removal of nodes too, if this was their last channel.
15566  * If not permanent, makes channels unavailable for routing.
15567  */
15568 void NetworkGraph_close_channel_from_update(struct LDKNetworkGraph *NONNULL_PTR this_arg, uint64_t short_channel_id, bool is_permanent);
15569
15570 /**
15571  * For an already known (from announcement) channel, update info about one of the directions
15572  * of the channel.
15573  *
15574  * You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's
15575  * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
15576  * routing messages from a source using a protocol other than the lightning P2P protocol.
15577  */
15578 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg);
15579
15580 /**
15581  * For an already known (from announcement) channel, update info about one of the directions
15582  * of the channel without verifying the associated signatures. Because we aren't given the
15583  * associated signatures here we cannot relay the channel update to any of our peers.
15584  */
15585 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_unsigned(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedChannelUpdate *NONNULL_PTR msg);
15586
15587 /* Text to put at the end of the generated file */