Fix race in C++ demo where num_txs_broadcasted ++s before =0s
[ldk-c-bindings] / lightning-c-bindings / include / lightning.h
1 #ifndef LDK_C_BINDINGS_H
2 #define LDK_C_BINDINGS_H
3
4 /* Generated with cbindgen:0.19.0 */
5
6 /* Warning, this file is autogenerated by cbindgen. Don't modify this manually. */
7
8 #include <stdarg.h>
9 #include <stdbool.h>
10 #include <stdint.h>
11 #include <ldk_rust_types.h>
12
13 /**
14  * An error when accessing the chain via [`Access`].
15  */
16 typedef enum LDKAccessError {
17    /**
18     * The requested chain is unknown.
19     */
20    LDKAccessError_UnknownChain,
21    /**
22     * The requested transaction doesn't exist or hasn't confirmed.
23     */
24    LDKAccessError_UnknownTx,
25    /**
26     * Must be last for serialization purposes
27     */
28    LDKAccessError_Sentinel,
29 } LDKAccessError;
30
31 /**
32  * An error enum representing a failure to persist a channel monitor update.
33  */
34 typedef enum LDKChannelMonitorUpdateErr {
35    /**
36     * Used to indicate a temporary failure (eg connection to a watchtower or remote backup of
37     * our state failed, but is expected to succeed at some point in the future).
38     *
39     * Such a failure will \"freeze\" a channel, preventing us from revoking old states or
40     * submitting new commitment transactions to the counterparty. Once the update(s) which failed
41     * have been successfully applied, ChannelManager::channel_monitor_updated can be used to
42     * restore the channel to an operational state.
43     *
44     * Note that a given ChannelManager will *never* re-generate a given ChannelMonitorUpdate. If
45     * you return a TemporaryFailure you must ensure that it is written to disk safely before
46     * writing out the latest ChannelManager state.
47     *
48     * Even when a channel has been \"frozen\" updates to the ChannelMonitor can continue to occur
49     * (eg if an inbound HTLC which we forwarded was claimed upstream resulting in us attempting
50     * to claim it on this channel) and those updates must be applied wherever they can be. At
51     * least one such updated ChannelMonitor must be persisted otherwise PermanentFailure should
52     * be returned to get things on-chain ASAP using only the in-memory copy. Obviously updates to
53     * the channel which would invalidate previous ChannelMonitors are not made when a channel has
54     * been \"frozen\".
55     *
56     * Note that even if updates made after TemporaryFailure succeed you must still call
57     * channel_monitor_updated to ensure you have the latest monitor and re-enable normal channel
58     * operation.
59     *
60     * Note that the update being processed here will not be replayed for you when you call
61     * ChannelManager::channel_monitor_updated, so you must store the update itself along
62     * with the persisted ChannelMonitor on your own local disk prior to returning a
63     * TemporaryFailure. You may, of course, employ a journaling approach, storing only the
64     * ChannelMonitorUpdate on disk without updating the monitor itself, replaying the journal at
65     * reload-time.
66     *
67     * For deployments where a copy of ChannelMonitors and other local state are backed up in a
68     * remote location (with local copies persisted immediately), it is anticipated that all
69     * updates will return TemporaryFailure until the remote copies could be updated.
70     */
71    LDKChannelMonitorUpdateErr_TemporaryFailure,
72    /**
73     * Used to indicate no further channel monitor updates will be allowed (eg we've moved on to a
74     * different watchtower and cannot update with all watchtowers that were previously informed
75     * of this channel).
76     *
77     * At reception of this error, ChannelManager will force-close the channel and return at
78     * least a final ChannelMonitorUpdate::ChannelForceClosed which must be delivered to at
79     * least one ChannelMonitor copy. Revocation secret MUST NOT be released and offchain channel
80     * update must be rejected.
81     *
82     * This failure may also signal a failure to update the local persisted copy of one of
83     * the channel monitor instance.
84     *
85     * Note that even when you fail a holder commitment transaction update, you must store the
86     * update to ensure you can claim from it in case of a duplicate copy of this ChannelMonitor
87     * broadcasts it (e.g distributed channel-monitor deployment)
88     *
89     * In case of distributed watchtowers deployment, the new version must be written to disk, as
90     * state may have been stored but rejected due to a block forcing a commitment broadcast. This
91     * storage is used to claim outputs of rejected state confirmed onchain by another watchtower,
92     * lagging behind on block processing.
93     */
94    LDKChannelMonitorUpdateErr_PermanentFailure,
95    /**
96     * Must be last for serialization purposes
97     */
98    LDKChannelMonitorUpdateErr_Sentinel,
99 } LDKChannelMonitorUpdateErr;
100
101 /**
102  * An enum that represents the speed at which we want a transaction to confirm used for feerate
103  * estimation.
104  */
105 typedef enum LDKConfirmationTarget {
106    /**
107     * We are happy with this transaction confirming slowly when feerate drops some.
108     */
109    LDKConfirmationTarget_Background,
110    /**
111     * We'd like this transaction to confirm without major delay, but 12-18 blocks is fine.
112     */
113    LDKConfirmationTarget_Normal,
114    /**
115     * We'd like this transaction to confirm in the next few blocks.
116     */
117    LDKConfirmationTarget_HighPriority,
118    /**
119     * Must be last for serialization purposes
120     */
121    LDKConfirmationTarget_Sentinel,
122 } LDKConfirmationTarget;
123
124 /**
125  * Errors that may occur when constructing a new `RawInvoice` or `Invoice`
126  */
127 typedef enum LDKCreationError {
128    /**
129     * The supplied description string was longer than 639 __bytes__ (see [`Description::new(…)`](./struct.Description.html#method.new))
130     */
131    LDKCreationError_DescriptionTooLong,
132    /**
133     * The specified route has too many hops and can't be encoded
134     */
135    LDKCreationError_RouteTooLong,
136    /**
137     * The unix timestamp of the supplied date is <0 or can't be represented as `SystemTime`
138     */
139    LDKCreationError_TimestampOutOfBounds,
140    /**
141     * The supplied expiry time could cause an overflow if added to a `PositiveTimestamp`
142     */
143    LDKCreationError_ExpiryTimeOutOfBounds,
144    /**
145     * Must be last for serialization purposes
146     */
147    LDKCreationError_Sentinel,
148 } LDKCreationError;
149
150 /**
151  * Enum representing the crypto currencies (or networks) supported by this library
152  */
153 typedef enum LDKCurrency {
154    /**
155     * Bitcoin mainnet
156     */
157    LDKCurrency_Bitcoin,
158    /**
159     * Bitcoin testnet
160     */
161    LDKCurrency_BitcoinTestnet,
162    /**
163     * Bitcoin regtest
164     */
165    LDKCurrency_Regtest,
166    /**
167     * Bitcoin simnet/signet
168     */
169    LDKCurrency_Simnet,
170    /**
171     * Must be last for serialization purposes
172     */
173    LDKCurrency_Sentinel,
174 } LDKCurrency;
175
176 /**
177  * Represents an IO Error. Note that some information is lost in the conversion from Rust.
178  */
179 typedef enum LDKIOError {
180    LDKIOError_NotFound,
181    LDKIOError_PermissionDenied,
182    LDKIOError_ConnectionRefused,
183    LDKIOError_ConnectionReset,
184    LDKIOError_ConnectionAborted,
185    LDKIOError_NotConnected,
186    LDKIOError_AddrInUse,
187    LDKIOError_AddrNotAvailable,
188    LDKIOError_BrokenPipe,
189    LDKIOError_AlreadyExists,
190    LDKIOError_WouldBlock,
191    LDKIOError_InvalidInput,
192    LDKIOError_InvalidData,
193    LDKIOError_TimedOut,
194    LDKIOError_WriteZero,
195    LDKIOError_Interrupted,
196    LDKIOError_Other,
197    LDKIOError_UnexpectedEof,
198    /**
199     * Must be last for serialization purposes
200     */
201    LDKIOError_Sentinel,
202 } LDKIOError;
203
204 /**
205  * An enum representing the available verbosity levels of the logger.
206  */
207 typedef enum LDKLevel {
208    /**
209     *Designates logger being silent
210     */
211    LDKLevel_Off,
212    /**
213     * Designates very serious errors
214     */
215    LDKLevel_Error,
216    /**
217     * Designates hazardous situations
218     */
219    LDKLevel_Warn,
220    /**
221     * Designates useful information
222     */
223    LDKLevel_Info,
224    /**
225     * Designates lower priority information
226     */
227    LDKLevel_Debug,
228    /**
229     * Designates very low priority, often extremely verbose, information
230     */
231    LDKLevel_Trace,
232    /**
233     * Must be last for serialization purposes
234     */
235    LDKLevel_Sentinel,
236 } LDKLevel;
237
238 /**
239  * An enum representing the possible Bitcoin or test networks which we can run on
240  */
241 typedef enum LDKNetwork {
242    /**
243     * The main Bitcoin blockchain.
244     */
245    LDKNetwork_Bitcoin,
246    /**
247     * The testnet3 blockchain.
248     */
249    LDKNetwork_Testnet,
250    /**
251     * A local test blockchain.
252     */
253    LDKNetwork_Regtest,
254    /**
255     * A blockchain on which blocks are signed instead of mined.
256     */
257    LDKNetwork_Signet,
258    /**
259     * Must be last for serialization purposes
260     */
261    LDKNetwork_Sentinel,
262 } LDKNetwork;
263
264 /**
265  * Represents an error returned from libsecp256k1 during validation of some secp256k1 data
266  */
267 typedef enum LDKSecp256k1Error {
268    /**
269     * Signature failed verification
270     */
271    LDKSecp256k1Error_IncorrectSignature,
272    /**
273     * Badly sized message ("messages" are actually fixed-sized digests; see the MESSAGE_SIZE constant)
274     */
275    LDKSecp256k1Error_InvalidMessage,
276    /**
277     * Bad public key
278     */
279    LDKSecp256k1Error_InvalidPublicKey,
280    /**
281     * Bad signature
282     */
283    LDKSecp256k1Error_InvalidSignature,
284    /**
285     * Bad secret key
286     */
287    LDKSecp256k1Error_InvalidSecretKey,
288    /**
289     * Bad recovery id
290     */
291    LDKSecp256k1Error_InvalidRecoveryId,
292    /**
293     * Invalid tweak for add_assign or mul_assign
294     */
295    LDKSecp256k1Error_InvalidTweak,
296    /**
297     * tweak_add_check failed on an xonly public key
298     */
299    LDKSecp256k1Error_TweakCheckFailed,
300    /**
301     * Didn't pass enough memory to context creation with preallocated memory
302     */
303    LDKSecp256k1Error_NotEnoughMemory,
304    /**
305     * Must be last for serialization purposes
306     */
307    LDKSecp256k1Error_Sentinel,
308 } LDKSecp256k1Error;
309
310 /**
311  * Errors that may occur when converting a `RawInvoice` to an `Invoice`. They relate to the
312  * requirements sections in BOLT #11
313  */
314 typedef enum LDKSemanticError {
315    /**
316     * The invoice is missing the mandatory payment hash
317     */
318    LDKSemanticError_NoPaymentHash,
319    /**
320     * The invoice has multiple payment hashes which isn't allowed
321     */
322    LDKSemanticError_MultiplePaymentHashes,
323    /**
324     * No description or description hash are part of the invoice
325     */
326    LDKSemanticError_NoDescription,
327    /**
328     * The invoice contains multiple descriptions and/or description hashes which isn't allowed
329     */
330    LDKSemanticError_MultipleDescriptions,
331    /**
332     * The invoice contains multiple payment secrets
333     */
334    LDKSemanticError_MultiplePaymentSecrets,
335    /**
336     * The invoice's features are invalid
337     */
338    LDKSemanticError_InvalidFeatures,
339    /**
340     * The recovery id doesn't fit the signature/pub key
341     */
342    LDKSemanticError_InvalidRecoveryId,
343    /**
344     * The invoice's signature is invalid
345     */
346    LDKSemanticError_InvalidSignature,
347    /**
348     * Must be last for serialization purposes
349     */
350    LDKSemanticError_Sentinel,
351 } LDKSemanticError;
352
353 /**
354  * SI prefixes for the human readable part
355  */
356 typedef enum LDKSiPrefix {
357    /**
358     * 10^-3
359     */
360    LDKSiPrefix_Milli,
361    /**
362     * 10^-6
363     */
364    LDKSiPrefix_Micro,
365    /**
366     * 10^-9
367     */
368    LDKSiPrefix_Nano,
369    /**
370     * 10^-12
371     */
372    LDKSiPrefix_Pico,
373    /**
374     * Must be last for serialization purposes
375     */
376    LDKSiPrefix_Sentinel,
377 } LDKSiPrefix;
378
379 /**
380  * A Rust str object, ie a reference to a UTF8-valid string.
381  * This is *not* null-terminated so cannot be used directly as a C string!
382  */
383 typedef struct LDKStr {
384    /**
385     * A pointer to the string's bytes, in UTF8 encoding
386     */
387    const uint8_t *chars;
388    /**
389     * The number of bytes (not characters!) pointed to by `chars`
390     */
391    uintptr_t len;
392    /**
393     * Whether the data pointed to by `chars` should be freed or not.
394     */
395    bool chars_is_owned;
396 } LDKStr;
397
398 /**
399  * A serialized transaction, in (pointer, length) form.
400  *
401  * This type optionally owns its own memory, and thus the semantics around access change based on
402  * the `data_is_owned` flag. If `data_is_owned` is set, you must call `Transaction_free` to free
403  * the underlying buffer before the object goes out of scope. If `data_is_owned` is not set, any
404  * access to the buffer after the scope in which the object was provided to you is invalid. eg,
405  * access after you return from the call in which a `!data_is_owned` `Transaction` is provided to
406  * you would be invalid.
407  *
408  * Note that, while it may change in the future, because transactions on the Rust side are stored
409  * in a deserialized form, all `Transaction`s generated on the Rust side will have `data_is_owned`
410  * set. Similarly, while it may change in the future, all `Transaction`s you pass to Rust may have
411  * `data_is_owned` either set or unset at your discretion.
412  */
413 typedef struct LDKTransaction {
414    /**
415     * The serialized transaction data.
416     *
417     * This is non-const for your convenience, an object passed to Rust is never written to.
418     */
419    uint8_t *data;
420    /**
421     * The length of the serialized transaction
422     */
423    uintptr_t datalen;
424    /**
425     * Whether the data pointed to by `data` should be freed or not.
426     */
427    bool data_is_owned;
428 } LDKTransaction;
429
430 /**
431  * A dynamically-allocated array of u8s of arbitrary size.
432  * This corresponds to std::vector in C++
433  */
434 typedef struct LDKCVec_u8Z {
435    /**
436     * The elements in the array.
437     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
438     */
439    uint8_t *data;
440    /**
441     * The number of elements pointed to by `data`.
442     */
443    uintptr_t datalen;
444 } LDKCVec_u8Z;
445
446 /**
447  * A transaction output including a scriptPubKey and value.
448  * This type *does* own its own memory, so must be free'd appropriately.
449  */
450 typedef struct LDKTxOut {
451    /**
452     * The script_pubkey in this output
453     */
454    struct LDKCVec_u8Z script_pubkey;
455    /**
456     * The value, in satoshis, of this output
457     */
458    uint64_t value;
459 } LDKTxOut;
460
461 /**
462  * Represents a valid secp256k1 secret key serialized as a 32 byte array.
463  */
464 typedef struct LDKSecretKey {
465    /**
466     * The bytes of the secret key
467     */
468    uint8_t bytes[32];
469 } LDKSecretKey;
470
471 /**
472  * The contents of CResult_SecretKeyErrorZ
473  */
474 typedef union LDKCResult_SecretKeyErrorZPtr {
475    /**
476     * A pointer to the contents in the success state.
477     * Reading from this pointer when `result_ok` is not set is undefined.
478     */
479    struct LDKSecretKey *result;
480    /**
481     * A pointer to the contents in the error state.
482     * Reading from this pointer when `result_ok` is set is undefined.
483     */
484    enum LDKSecp256k1Error *err;
485 } LDKCResult_SecretKeyErrorZPtr;
486
487 /**
488  * A CResult_SecretKeyErrorZ represents the result of a fallible operation,
489  * containing a crate::c_types::SecretKey on success and a crate::c_types::Secp256k1Error on failure.
490  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
491  */
492 typedef struct LDKCResult_SecretKeyErrorZ {
493    /**
494     * The contents of this CResult_SecretKeyErrorZ, accessible via either
495     * `err` or `result` depending on the state of `result_ok`.
496     */
497    union LDKCResult_SecretKeyErrorZPtr contents;
498    /**
499     * Whether this CResult_SecretKeyErrorZ represents a success state.
500     */
501    bool result_ok;
502 } LDKCResult_SecretKeyErrorZ;
503
504 /**
505  * Represents a valid secp256k1 public key serialized in "compressed form" as a 33 byte array.
506  */
507 typedef struct LDKPublicKey {
508    /**
509     * The bytes of the public key
510     */
511    uint8_t compressed_form[33];
512 } LDKPublicKey;
513
514 /**
515  * The contents of CResult_PublicKeyErrorZ
516  */
517 typedef union LDKCResult_PublicKeyErrorZPtr {
518    /**
519     * A pointer to the contents in the success state.
520     * Reading from this pointer when `result_ok` is not set is undefined.
521     */
522    struct LDKPublicKey *result;
523    /**
524     * A pointer to the contents in the error state.
525     * Reading from this pointer when `result_ok` is set is undefined.
526     */
527    enum LDKSecp256k1Error *err;
528 } LDKCResult_PublicKeyErrorZPtr;
529
530 /**
531  * A CResult_PublicKeyErrorZ represents the result of a fallible operation,
532  * containing a crate::c_types::PublicKey on success and a crate::c_types::Secp256k1Error on failure.
533  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
534  */
535 typedef struct LDKCResult_PublicKeyErrorZ {
536    /**
537     * The contents of this CResult_PublicKeyErrorZ, accessible via either
538     * `err` or `result` depending on the state of `result_ok`.
539     */
540    union LDKCResult_PublicKeyErrorZPtr contents;
541    /**
542     * Whether this CResult_PublicKeyErrorZ represents a success state.
543     */
544    bool result_ok;
545 } LDKCResult_PublicKeyErrorZ;
546
547
548
549 /**
550  * The set of public keys which are used in the creation of one commitment transaction.
551  * These are derived from the channel base keys and per-commitment data.
552  *
553  * A broadcaster key is provided from potential broadcaster of the computed transaction.
554  * A countersignatory key is coming from a protocol participant unable to broadcast the
555  * transaction.
556  *
557  * These keys are assumed to be good, either because the code derived them from
558  * channel basepoints via the new function, or they were obtained via
559  * CommitmentTransaction.trust().keys() because we trusted the source of the
560  * pre-calculated keys.
561  */
562 typedef struct MUST_USE_STRUCT LDKTxCreationKeys {
563    /**
564     * A pointer to the opaque Rust object.
565     * Nearly everywhere, inner must be non-null, however in places where
566     * the Rust equivalent takes an Option, it may be set to null to indicate None.
567     */
568    LDKnativeTxCreationKeys *inner;
569    /**
570     * Indicates that this is the only struct which contains the same pointer.
571     * Rust functions which take ownership of an object provided via an argument require
572     * this to be true and invalidate the object pointed to by inner.
573     */
574    bool is_owned;
575 } LDKTxCreationKeys;
576
577
578
579 /**
580  * An error in decoding a message or struct.
581  */
582 typedef struct MUST_USE_STRUCT LDKDecodeError {
583    /**
584     * A pointer to the opaque Rust object.
585     * Nearly everywhere, inner must be non-null, however in places where
586     * the Rust equivalent takes an Option, it may be set to null to indicate None.
587     */
588    LDKnativeDecodeError *inner;
589    /**
590     * Indicates that this is the only struct which contains the same pointer.
591     * Rust functions which take ownership of an object provided via an argument require
592     * this to be true and invalidate the object pointed to by inner.
593     */
594    bool is_owned;
595 } LDKDecodeError;
596
597 /**
598  * The contents of CResult_TxCreationKeysDecodeErrorZ
599  */
600 typedef union LDKCResult_TxCreationKeysDecodeErrorZPtr {
601    /**
602     * A pointer to the contents in the success state.
603     * Reading from this pointer when `result_ok` is not set is undefined.
604     */
605    struct LDKTxCreationKeys *result;
606    /**
607     * A pointer to the contents in the error state.
608     * Reading from this pointer when `result_ok` is set is undefined.
609     */
610    struct LDKDecodeError *err;
611 } LDKCResult_TxCreationKeysDecodeErrorZPtr;
612
613 /**
614  * A CResult_TxCreationKeysDecodeErrorZ represents the result of a fallible operation,
615  * containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
616  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
617  */
618 typedef struct LDKCResult_TxCreationKeysDecodeErrorZ {
619    /**
620     * The contents of this CResult_TxCreationKeysDecodeErrorZ, accessible via either
621     * `err` or `result` depending on the state of `result_ok`.
622     */
623    union LDKCResult_TxCreationKeysDecodeErrorZPtr contents;
624    /**
625     * Whether this CResult_TxCreationKeysDecodeErrorZ represents a success state.
626     */
627    bool result_ok;
628 } LDKCResult_TxCreationKeysDecodeErrorZ;
629
630
631
632 /**
633  * One counterparty's public keys which do not change over the life of a channel.
634  */
635 typedef struct MUST_USE_STRUCT LDKChannelPublicKeys {
636    /**
637     * A pointer to the opaque Rust object.
638     * Nearly everywhere, inner must be non-null, however in places where
639     * the Rust equivalent takes an Option, it may be set to null to indicate None.
640     */
641    LDKnativeChannelPublicKeys *inner;
642    /**
643     * Indicates that this is the only struct which contains the same pointer.
644     * Rust functions which take ownership of an object provided via an argument require
645     * this to be true and invalidate the object pointed to by inner.
646     */
647    bool is_owned;
648 } LDKChannelPublicKeys;
649
650 /**
651  * The contents of CResult_ChannelPublicKeysDecodeErrorZ
652  */
653 typedef union LDKCResult_ChannelPublicKeysDecodeErrorZPtr {
654    /**
655     * A pointer to the contents in the success state.
656     * Reading from this pointer when `result_ok` is not set is undefined.
657     */
658    struct LDKChannelPublicKeys *result;
659    /**
660     * A pointer to the contents in the error state.
661     * Reading from this pointer when `result_ok` is set is undefined.
662     */
663    struct LDKDecodeError *err;
664 } LDKCResult_ChannelPublicKeysDecodeErrorZPtr;
665
666 /**
667  * A CResult_ChannelPublicKeysDecodeErrorZ represents the result of a fallible operation,
668  * containing a crate::lightning::ln::chan_utils::ChannelPublicKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
669  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
670  */
671 typedef struct LDKCResult_ChannelPublicKeysDecodeErrorZ {
672    /**
673     * The contents of this CResult_ChannelPublicKeysDecodeErrorZ, accessible via either
674     * `err` or `result` depending on the state of `result_ok`.
675     */
676    union LDKCResult_ChannelPublicKeysDecodeErrorZPtr contents;
677    /**
678     * Whether this CResult_ChannelPublicKeysDecodeErrorZ represents a success state.
679     */
680    bool result_ok;
681 } LDKCResult_ChannelPublicKeysDecodeErrorZ;
682
683 /**
684  * The contents of CResult_TxCreationKeysErrorZ
685  */
686 typedef union LDKCResult_TxCreationKeysErrorZPtr {
687    /**
688     * A pointer to the contents in the success state.
689     * Reading from this pointer when `result_ok` is not set is undefined.
690     */
691    struct LDKTxCreationKeys *result;
692    /**
693     * A pointer to the contents in the error state.
694     * Reading from this pointer when `result_ok` is set is undefined.
695     */
696    enum LDKSecp256k1Error *err;
697 } LDKCResult_TxCreationKeysErrorZPtr;
698
699 /**
700  * A CResult_TxCreationKeysErrorZ represents the result of a fallible operation,
701  * containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::c_types::Secp256k1Error on failure.
702  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
703  */
704 typedef struct LDKCResult_TxCreationKeysErrorZ {
705    /**
706     * The contents of this CResult_TxCreationKeysErrorZ, accessible via either
707     * `err` or `result` depending on the state of `result_ok`.
708     */
709    union LDKCResult_TxCreationKeysErrorZPtr contents;
710    /**
711     * Whether this CResult_TxCreationKeysErrorZ represents a success state.
712     */
713    bool result_ok;
714 } LDKCResult_TxCreationKeysErrorZ;
715
716 /**
717  * An enum which can either contain a u32 or not
718  */
719 typedef enum LDKCOption_u32Z_Tag {
720    /**
721     * When we're in this state, this COption_u32Z contains a u32
722     */
723    LDKCOption_u32Z_Some,
724    /**
725     * When we're in this state, this COption_u32Z contains nothing
726     */
727    LDKCOption_u32Z_None,
728    /**
729     * Must be last for serialization purposes
730     */
731    LDKCOption_u32Z_Sentinel,
732 } LDKCOption_u32Z_Tag;
733
734 typedef struct LDKCOption_u32Z {
735    LDKCOption_u32Z_Tag tag;
736    union {
737       struct {
738          uint32_t some;
739       };
740    };
741 } LDKCOption_u32Z;
742
743
744
745 /**
746  * Information about an HTLC as it appears in a commitment transaction
747  */
748 typedef struct MUST_USE_STRUCT LDKHTLCOutputInCommitment {
749    /**
750     * A pointer to the opaque Rust object.
751     * Nearly everywhere, inner must be non-null, however in places where
752     * the Rust equivalent takes an Option, it may be set to null to indicate None.
753     */
754    LDKnativeHTLCOutputInCommitment *inner;
755    /**
756     * Indicates that this is the only struct which contains the same pointer.
757     * Rust functions which take ownership of an object provided via an argument require
758     * this to be true and invalidate the object pointed to by inner.
759     */
760    bool is_owned;
761 } LDKHTLCOutputInCommitment;
762
763 /**
764  * The contents of CResult_HTLCOutputInCommitmentDecodeErrorZ
765  */
766 typedef union LDKCResult_HTLCOutputInCommitmentDecodeErrorZPtr {
767    /**
768     * A pointer to the contents in the success state.
769     * Reading from this pointer when `result_ok` is not set is undefined.
770     */
771    struct LDKHTLCOutputInCommitment *result;
772    /**
773     * A pointer to the contents in the error state.
774     * Reading from this pointer when `result_ok` is set is undefined.
775     */
776    struct LDKDecodeError *err;
777 } LDKCResult_HTLCOutputInCommitmentDecodeErrorZPtr;
778
779 /**
780  * A CResult_HTLCOutputInCommitmentDecodeErrorZ represents the result of a fallible operation,
781  * containing a crate::lightning::ln::chan_utils::HTLCOutputInCommitment on success and a crate::lightning::ln::msgs::DecodeError on failure.
782  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
783  */
784 typedef struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ {
785    /**
786     * The contents of this CResult_HTLCOutputInCommitmentDecodeErrorZ, accessible via either
787     * `err` or `result` depending on the state of `result_ok`.
788     */
789    union LDKCResult_HTLCOutputInCommitmentDecodeErrorZPtr contents;
790    /**
791     * Whether this CResult_HTLCOutputInCommitmentDecodeErrorZ represents a success state.
792     */
793    bool result_ok;
794 } LDKCResult_HTLCOutputInCommitmentDecodeErrorZ;
795
796
797
798 /**
799  * Late-bound per-channel counterparty data used to build transactions.
800  */
801 typedef struct MUST_USE_STRUCT LDKCounterpartyChannelTransactionParameters {
802    /**
803     * A pointer to the opaque Rust object.
804     * Nearly everywhere, inner must be non-null, however in places where
805     * the Rust equivalent takes an Option, it may be set to null to indicate None.
806     */
807    LDKnativeCounterpartyChannelTransactionParameters *inner;
808    /**
809     * Indicates that this is the only struct which contains the same pointer.
810     * Rust functions which take ownership of an object provided via an argument require
811     * this to be true and invalidate the object pointed to by inner.
812     */
813    bool is_owned;
814 } LDKCounterpartyChannelTransactionParameters;
815
816 /**
817  * The contents of CResult_CounterpartyChannelTransactionParametersDecodeErrorZ
818  */
819 typedef union LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
820    /**
821     * A pointer to the contents in the success state.
822     * Reading from this pointer when `result_ok` is not set is undefined.
823     */
824    struct LDKCounterpartyChannelTransactionParameters *result;
825    /**
826     * A pointer to the contents in the error state.
827     * Reading from this pointer when `result_ok` is set is undefined.
828     */
829    struct LDKDecodeError *err;
830 } LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr;
831
832 /**
833  * A CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
834  * containing a crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
835  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
836  */
837 typedef struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
838    /**
839     * The contents of this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ, accessible via either
840     * `err` or `result` depending on the state of `result_ok`.
841     */
842    union LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr contents;
843    /**
844     * Whether this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents a success state.
845     */
846    bool result_ok;
847 } LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ;
848
849
850
851 /**
852  * Per-channel data used to build transactions in conjunction with the per-commitment data (CommitmentTransaction).
853  * The fields are organized by holder/counterparty.
854  *
855  * Normally, this is converted to the broadcaster/countersignatory-organized DirectedChannelTransactionParameters
856  * before use, via the as_holder_broadcastable and as_counterparty_broadcastable functions.
857  */
858 typedef struct MUST_USE_STRUCT LDKChannelTransactionParameters {
859    /**
860     * A pointer to the opaque Rust object.
861     * Nearly everywhere, inner must be non-null, however in places where
862     * the Rust equivalent takes an Option, it may be set to null to indicate None.
863     */
864    LDKnativeChannelTransactionParameters *inner;
865    /**
866     * Indicates that this is the only struct which contains the same pointer.
867     * Rust functions which take ownership of an object provided via an argument require
868     * this to be true and invalidate the object pointed to by inner.
869     */
870    bool is_owned;
871 } LDKChannelTransactionParameters;
872
873 /**
874  * The contents of CResult_ChannelTransactionParametersDecodeErrorZ
875  */
876 typedef union LDKCResult_ChannelTransactionParametersDecodeErrorZPtr {
877    /**
878     * A pointer to the contents in the success state.
879     * Reading from this pointer when `result_ok` is not set is undefined.
880     */
881    struct LDKChannelTransactionParameters *result;
882    /**
883     * A pointer to the contents in the error state.
884     * Reading from this pointer when `result_ok` is set is undefined.
885     */
886    struct LDKDecodeError *err;
887 } LDKCResult_ChannelTransactionParametersDecodeErrorZPtr;
888
889 /**
890  * A CResult_ChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
891  * containing a crate::lightning::ln::chan_utils::ChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
892  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
893  */
894 typedef struct LDKCResult_ChannelTransactionParametersDecodeErrorZ {
895    /**
896     * The contents of this CResult_ChannelTransactionParametersDecodeErrorZ, accessible via either
897     * `err` or `result` depending on the state of `result_ok`.
898     */
899    union LDKCResult_ChannelTransactionParametersDecodeErrorZPtr contents;
900    /**
901     * Whether this CResult_ChannelTransactionParametersDecodeErrorZ represents a success state.
902     */
903    bool result_ok;
904 } LDKCResult_ChannelTransactionParametersDecodeErrorZ;
905
906 /**
907  * Represents a secp256k1 signature serialized as two 32-byte numbers
908  */
909 typedef struct LDKSignature {
910    /**
911     * The bytes of the signature in "compact" form
912     */
913    uint8_t compact_form[64];
914 } LDKSignature;
915
916 /**
917  * A dynamically-allocated array of crate::c_types::Signatures of arbitrary size.
918  * This corresponds to std::vector in C++
919  */
920 typedef struct LDKCVec_SignatureZ {
921    /**
922     * The elements in the array.
923     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
924     */
925    struct LDKSignature *data;
926    /**
927     * The number of elements pointed to by `data`.
928     */
929    uintptr_t datalen;
930 } LDKCVec_SignatureZ;
931
932
933
934 /**
935  * Information needed to build and sign a holder's commitment transaction.
936  *
937  * The transaction is only signed once we are ready to broadcast.
938  */
939 typedef struct MUST_USE_STRUCT LDKHolderCommitmentTransaction {
940    /**
941     * A pointer to the opaque Rust object.
942     * Nearly everywhere, inner must be non-null, however in places where
943     * the Rust equivalent takes an Option, it may be set to null to indicate None.
944     */
945    LDKnativeHolderCommitmentTransaction *inner;
946    /**
947     * Indicates that this is the only struct which contains the same pointer.
948     * Rust functions which take ownership of an object provided via an argument require
949     * this to be true and invalidate the object pointed to by inner.
950     */
951    bool is_owned;
952 } LDKHolderCommitmentTransaction;
953
954 /**
955  * The contents of CResult_HolderCommitmentTransactionDecodeErrorZ
956  */
957 typedef union LDKCResult_HolderCommitmentTransactionDecodeErrorZPtr {
958    /**
959     * A pointer to the contents in the success state.
960     * Reading from this pointer when `result_ok` is not set is undefined.
961     */
962    struct LDKHolderCommitmentTransaction *result;
963    /**
964     * A pointer to the contents in the error state.
965     * Reading from this pointer when `result_ok` is set is undefined.
966     */
967    struct LDKDecodeError *err;
968 } LDKCResult_HolderCommitmentTransactionDecodeErrorZPtr;
969
970 /**
971  * A CResult_HolderCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
972  * containing a crate::lightning::ln::chan_utils::HolderCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
973  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
974  */
975 typedef struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ {
976    /**
977     * The contents of this CResult_HolderCommitmentTransactionDecodeErrorZ, accessible via either
978     * `err` or `result` depending on the state of `result_ok`.
979     */
980    union LDKCResult_HolderCommitmentTransactionDecodeErrorZPtr contents;
981    /**
982     * Whether this CResult_HolderCommitmentTransactionDecodeErrorZ represents a success state.
983     */
984    bool result_ok;
985 } LDKCResult_HolderCommitmentTransactionDecodeErrorZ;
986
987
988
989 /**
990  * A pre-built Bitcoin commitment transaction and its txid.
991  */
992 typedef struct MUST_USE_STRUCT LDKBuiltCommitmentTransaction {
993    /**
994     * A pointer to the opaque Rust object.
995     * Nearly everywhere, inner must be non-null, however in places where
996     * the Rust equivalent takes an Option, it may be set to null to indicate None.
997     */
998    LDKnativeBuiltCommitmentTransaction *inner;
999    /**
1000     * Indicates that this is the only struct which contains the same pointer.
1001     * Rust functions which take ownership of an object provided via an argument require
1002     * this to be true and invalidate the object pointed to by inner.
1003     */
1004    bool is_owned;
1005 } LDKBuiltCommitmentTransaction;
1006
1007 /**
1008  * The contents of CResult_BuiltCommitmentTransactionDecodeErrorZ
1009  */
1010 typedef union LDKCResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1011    /**
1012     * A pointer to the contents in the success state.
1013     * Reading from this pointer when `result_ok` is not set is undefined.
1014     */
1015    struct LDKBuiltCommitmentTransaction *result;
1016    /**
1017     * A pointer to the contents in the error state.
1018     * Reading from this pointer when `result_ok` is set is undefined.
1019     */
1020    struct LDKDecodeError *err;
1021 } LDKCResult_BuiltCommitmentTransactionDecodeErrorZPtr;
1022
1023 /**
1024  * A CResult_BuiltCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1025  * containing a crate::lightning::ln::chan_utils::BuiltCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1026  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1027  */
1028 typedef struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ {
1029    /**
1030     * The contents of this CResult_BuiltCommitmentTransactionDecodeErrorZ, accessible via either
1031     * `err` or `result` depending on the state of `result_ok`.
1032     */
1033    union LDKCResult_BuiltCommitmentTransactionDecodeErrorZPtr contents;
1034    /**
1035     * Whether this CResult_BuiltCommitmentTransactionDecodeErrorZ represents a success state.
1036     */
1037    bool result_ok;
1038 } LDKCResult_BuiltCommitmentTransactionDecodeErrorZ;
1039
1040
1041
1042 /**
1043  * This class tracks the per-transaction information needed to build a commitment transaction and to
1044  * actually build it and sign.  It is used for holder transactions that we sign only when needed
1045  * and for transactions we sign for the counterparty.
1046  *
1047  * This class can be used inside a signer implementation to generate a signature given the relevant
1048  * secret key.
1049  */
1050 typedef struct MUST_USE_STRUCT LDKCommitmentTransaction {
1051    /**
1052     * A pointer to the opaque Rust object.
1053     * Nearly everywhere, inner must be non-null, however in places where
1054     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1055     */
1056    LDKnativeCommitmentTransaction *inner;
1057    /**
1058     * Indicates that this is the only struct which contains the same pointer.
1059     * Rust functions which take ownership of an object provided via an argument require
1060     * this to be true and invalidate the object pointed to by inner.
1061     */
1062    bool is_owned;
1063 } LDKCommitmentTransaction;
1064
1065 /**
1066  * The contents of CResult_CommitmentTransactionDecodeErrorZ
1067  */
1068 typedef union LDKCResult_CommitmentTransactionDecodeErrorZPtr {
1069    /**
1070     * A pointer to the contents in the success state.
1071     * Reading from this pointer when `result_ok` is not set is undefined.
1072     */
1073    struct LDKCommitmentTransaction *result;
1074    /**
1075     * A pointer to the contents in the error state.
1076     * Reading from this pointer when `result_ok` is set is undefined.
1077     */
1078    struct LDKDecodeError *err;
1079 } LDKCResult_CommitmentTransactionDecodeErrorZPtr;
1080
1081 /**
1082  * A CResult_CommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1083  * containing a crate::lightning::ln::chan_utils::CommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1084  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1085  */
1086 typedef struct LDKCResult_CommitmentTransactionDecodeErrorZ {
1087    /**
1088     * The contents of this CResult_CommitmentTransactionDecodeErrorZ, accessible via either
1089     * `err` or `result` depending on the state of `result_ok`.
1090     */
1091    union LDKCResult_CommitmentTransactionDecodeErrorZPtr contents;
1092    /**
1093     * Whether this CResult_CommitmentTransactionDecodeErrorZ represents a success state.
1094     */
1095    bool result_ok;
1096 } LDKCResult_CommitmentTransactionDecodeErrorZ;
1097
1098
1099
1100 /**
1101  * A wrapper on CommitmentTransaction indicating that the derived fields (the built bitcoin
1102  * transaction and the transaction creation keys) are trusted.
1103  *
1104  * See trust() and verify() functions on CommitmentTransaction.
1105  *
1106  * This structure implements Deref.
1107  */
1108 typedef struct MUST_USE_STRUCT LDKTrustedCommitmentTransaction {
1109    /**
1110     * A pointer to the opaque Rust object.
1111     * Nearly everywhere, inner must be non-null, however in places where
1112     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1113     */
1114    LDKnativeTrustedCommitmentTransaction *inner;
1115    /**
1116     * Indicates that this is the only struct which contains the same pointer.
1117     * Rust functions which take ownership of an object provided via an argument require
1118     * this to be true and invalidate the object pointed to by inner.
1119     */
1120    bool is_owned;
1121 } LDKTrustedCommitmentTransaction;
1122
1123 /**
1124  * The contents of CResult_TrustedCommitmentTransactionNoneZ
1125  */
1126 typedef union LDKCResult_TrustedCommitmentTransactionNoneZPtr {
1127    /**
1128     * A pointer to the contents in the success state.
1129     * Reading from this pointer when `result_ok` is not set is undefined.
1130     */
1131    struct LDKTrustedCommitmentTransaction *result;
1132    /**
1133     * Note that this value is always NULL, as there are no contents in the Err variant
1134     */
1135    void *err;
1136 } LDKCResult_TrustedCommitmentTransactionNoneZPtr;
1137
1138 /**
1139  * A CResult_TrustedCommitmentTransactionNoneZ represents the result of a fallible operation,
1140  * containing a crate::lightning::ln::chan_utils::TrustedCommitmentTransaction on success and a () on failure.
1141  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1142  */
1143 typedef struct LDKCResult_TrustedCommitmentTransactionNoneZ {
1144    /**
1145     * The contents of this CResult_TrustedCommitmentTransactionNoneZ, accessible via either
1146     * `err` or `result` depending on the state of `result_ok`.
1147     */
1148    union LDKCResult_TrustedCommitmentTransactionNoneZPtr contents;
1149    /**
1150     * Whether this CResult_TrustedCommitmentTransactionNoneZ represents a success state.
1151     */
1152    bool result_ok;
1153 } LDKCResult_TrustedCommitmentTransactionNoneZ;
1154
1155 /**
1156  * The contents of CResult_CVec_SignatureZNoneZ
1157  */
1158 typedef union LDKCResult_CVec_SignatureZNoneZPtr {
1159    /**
1160     * A pointer to the contents in the success state.
1161     * Reading from this pointer when `result_ok` is not set is undefined.
1162     */
1163    struct LDKCVec_SignatureZ *result;
1164    /**
1165     * Note that this value is always NULL, as there are no contents in the Err variant
1166     */
1167    void *err;
1168 } LDKCResult_CVec_SignatureZNoneZPtr;
1169
1170 /**
1171  * A CResult_CVec_SignatureZNoneZ represents the result of a fallible operation,
1172  * containing a crate::c_types::derived::CVec_SignatureZ on success and a () on failure.
1173  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1174  */
1175 typedef struct LDKCResult_CVec_SignatureZNoneZ {
1176    /**
1177     * The contents of this CResult_CVec_SignatureZNoneZ, accessible via either
1178     * `err` or `result` depending on the state of `result_ok`.
1179     */
1180    union LDKCResult_CVec_SignatureZNoneZPtr contents;
1181    /**
1182     * Whether this CResult_CVec_SignatureZNoneZ represents a success state.
1183     */
1184    bool result_ok;
1185 } LDKCResult_CVec_SignatureZNoneZ;
1186
1187 /**
1188  * The contents of CResult_NoneErrorZ
1189  */
1190 typedef union LDKCResult_NoneErrorZPtr {
1191    /**
1192     * Note that this value is always NULL, as there are no contents in the OK variant
1193     */
1194    void *result;
1195    /**
1196     * A pointer to the contents in the error state.
1197     * Reading from this pointer when `result_ok` is set is undefined.
1198     */
1199    enum LDKIOError *err;
1200 } LDKCResult_NoneErrorZPtr;
1201
1202 /**
1203  * A CResult_NoneErrorZ represents the result of a fallible operation,
1204  * containing a () on success and a crate::c_types::IOError on failure.
1205  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1206  */
1207 typedef struct LDKCResult_NoneErrorZ {
1208    /**
1209     * The contents of this CResult_NoneErrorZ, accessible via either
1210     * `err` or `result` depending on the state of `result_ok`.
1211     */
1212    union LDKCResult_NoneErrorZPtr contents;
1213    /**
1214     * Whether this CResult_NoneErrorZ represents a success state.
1215     */
1216    bool result_ok;
1217 } LDKCResult_NoneErrorZ;
1218
1219
1220
1221 /**
1222  * A hop in a route
1223  */
1224 typedef struct MUST_USE_STRUCT LDKRouteHop {
1225    /**
1226     * A pointer to the opaque Rust object.
1227     * Nearly everywhere, inner must be non-null, however in places where
1228     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1229     */
1230    LDKnativeRouteHop *inner;
1231    /**
1232     * Indicates that this is the only struct which contains the same pointer.
1233     * Rust functions which take ownership of an object provided via an argument require
1234     * this to be true and invalidate the object pointed to by inner.
1235     */
1236    bool is_owned;
1237 } LDKRouteHop;
1238
1239 /**
1240  * The contents of CResult_RouteHopDecodeErrorZ
1241  */
1242 typedef union LDKCResult_RouteHopDecodeErrorZPtr {
1243    /**
1244     * A pointer to the contents in the success state.
1245     * Reading from this pointer when `result_ok` is not set is undefined.
1246     */
1247    struct LDKRouteHop *result;
1248    /**
1249     * A pointer to the contents in the error state.
1250     * Reading from this pointer when `result_ok` is set is undefined.
1251     */
1252    struct LDKDecodeError *err;
1253 } LDKCResult_RouteHopDecodeErrorZPtr;
1254
1255 /**
1256  * A CResult_RouteHopDecodeErrorZ represents the result of a fallible operation,
1257  * containing a crate::lightning::routing::router::RouteHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
1258  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1259  */
1260 typedef struct LDKCResult_RouteHopDecodeErrorZ {
1261    /**
1262     * The contents of this CResult_RouteHopDecodeErrorZ, accessible via either
1263     * `err` or `result` depending on the state of `result_ok`.
1264     */
1265    union LDKCResult_RouteHopDecodeErrorZPtr contents;
1266    /**
1267     * Whether this CResult_RouteHopDecodeErrorZ represents a success state.
1268     */
1269    bool result_ok;
1270 } LDKCResult_RouteHopDecodeErrorZ;
1271
1272 /**
1273  * A dynamically-allocated array of crate::lightning::routing::router::RouteHops of arbitrary size.
1274  * This corresponds to std::vector in C++
1275  */
1276 typedef struct LDKCVec_RouteHopZ {
1277    /**
1278     * The elements in the array.
1279     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1280     */
1281    struct LDKRouteHop *data;
1282    /**
1283     * The number of elements pointed to by `data`.
1284     */
1285    uintptr_t datalen;
1286 } LDKCVec_RouteHopZ;
1287
1288 /**
1289  * A dynamically-allocated array of crate::c_types::derived::CVec_RouteHopZs of arbitrary size.
1290  * This corresponds to std::vector in C++
1291  */
1292 typedef struct LDKCVec_CVec_RouteHopZZ {
1293    /**
1294     * The elements in the array.
1295     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1296     */
1297    struct LDKCVec_RouteHopZ *data;
1298    /**
1299     * The number of elements pointed to by `data`.
1300     */
1301    uintptr_t datalen;
1302 } LDKCVec_CVec_RouteHopZZ;
1303
1304
1305
1306 /**
1307  * A route directs a payment from the sender (us) to the recipient. If the recipient supports MPP,
1308  * it can take multiple paths. Each path is composed of one or more hops through the network.
1309  */
1310 typedef struct MUST_USE_STRUCT LDKRoute {
1311    /**
1312     * A pointer to the opaque Rust object.
1313     * Nearly everywhere, inner must be non-null, however in places where
1314     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1315     */
1316    LDKnativeRoute *inner;
1317    /**
1318     * Indicates that this is the only struct which contains the same pointer.
1319     * Rust functions which take ownership of an object provided via an argument require
1320     * this to be true and invalidate the object pointed to by inner.
1321     */
1322    bool is_owned;
1323 } LDKRoute;
1324
1325 /**
1326  * The contents of CResult_RouteDecodeErrorZ
1327  */
1328 typedef union LDKCResult_RouteDecodeErrorZPtr {
1329    /**
1330     * A pointer to the contents in the success state.
1331     * Reading from this pointer when `result_ok` is not set is undefined.
1332     */
1333    struct LDKRoute *result;
1334    /**
1335     * A pointer to the contents in the error state.
1336     * Reading from this pointer when `result_ok` is set is undefined.
1337     */
1338    struct LDKDecodeError *err;
1339 } LDKCResult_RouteDecodeErrorZPtr;
1340
1341 /**
1342  * A CResult_RouteDecodeErrorZ represents the result of a fallible operation,
1343  * containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::DecodeError on failure.
1344  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1345  */
1346 typedef struct LDKCResult_RouteDecodeErrorZ {
1347    /**
1348     * The contents of this CResult_RouteDecodeErrorZ, accessible via either
1349     * `err` or `result` depending on the state of `result_ok`.
1350     */
1351    union LDKCResult_RouteDecodeErrorZPtr contents;
1352    /**
1353     * Whether this CResult_RouteDecodeErrorZ represents a success state.
1354     */
1355    bool result_ok;
1356 } LDKCResult_RouteDecodeErrorZ;
1357
1358 /**
1359  * An enum which can either contain a u64 or not
1360  */
1361 typedef enum LDKCOption_u64Z_Tag {
1362    /**
1363     * When we're in this state, this COption_u64Z contains a u64
1364     */
1365    LDKCOption_u64Z_Some,
1366    /**
1367     * When we're in this state, this COption_u64Z contains nothing
1368     */
1369    LDKCOption_u64Z_None,
1370    /**
1371     * Must be last for serialization purposes
1372     */
1373    LDKCOption_u64Z_Sentinel,
1374 } LDKCOption_u64Z_Tag;
1375
1376 typedef struct LDKCOption_u64Z {
1377    LDKCOption_u64Z_Tag tag;
1378    union {
1379       struct {
1380          uint64_t some;
1381       };
1382    };
1383 } LDKCOption_u64Z;
1384
1385
1386
1387 /**
1388  * Details of a channel, as returned by ChannelManager::list_channels and ChannelManager::list_usable_channels
1389  */
1390 typedef struct MUST_USE_STRUCT LDKChannelDetails {
1391    /**
1392     * A pointer to the opaque Rust object.
1393     * Nearly everywhere, inner must be non-null, however in places where
1394     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1395     */
1396    LDKnativeChannelDetails *inner;
1397    /**
1398     * Indicates that this is the only struct which contains the same pointer.
1399     * Rust functions which take ownership of an object provided via an argument require
1400     * this to be true and invalidate the object pointed to by inner.
1401     */
1402    bool is_owned;
1403 } LDKChannelDetails;
1404
1405 /**
1406  * A dynamically-allocated array of crate::lightning::ln::channelmanager::ChannelDetailss of arbitrary size.
1407  * This corresponds to std::vector in C++
1408  */
1409 typedef struct LDKCVec_ChannelDetailsZ {
1410    /**
1411     * The elements in the array.
1412     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1413     */
1414    struct LDKChannelDetails *data;
1415    /**
1416     * The number of elements pointed to by `data`.
1417     */
1418    uintptr_t datalen;
1419 } LDKCVec_ChannelDetailsZ;
1420
1421
1422
1423 /**
1424  * A channel descriptor which provides a last-hop route to get_route
1425  */
1426 typedef struct MUST_USE_STRUCT LDKRouteHintHop {
1427    /**
1428     * A pointer to the opaque Rust object.
1429     * Nearly everywhere, inner must be non-null, however in places where
1430     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1431     */
1432    LDKnativeRouteHintHop *inner;
1433    /**
1434     * Indicates that this is the only struct which contains the same pointer.
1435     * Rust functions which take ownership of an object provided via an argument require
1436     * this to be true and invalidate the object pointed to by inner.
1437     */
1438    bool is_owned;
1439 } LDKRouteHintHop;
1440
1441 /**
1442  * A dynamically-allocated array of crate::lightning::routing::router::RouteHintHops of arbitrary size.
1443  * This corresponds to std::vector in C++
1444  */
1445 typedef struct LDKCVec_RouteHintHopZ {
1446    /**
1447     * The elements in the array.
1448     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1449     */
1450    struct LDKRouteHintHop *data;
1451    /**
1452     * The number of elements pointed to by `data`.
1453     */
1454    uintptr_t datalen;
1455 } LDKCVec_RouteHintHopZ;
1456
1457
1458
1459 /**
1460  * An Err type for failure to process messages.
1461  */
1462 typedef struct MUST_USE_STRUCT LDKLightningError {
1463    /**
1464     * A pointer to the opaque Rust object.
1465     * Nearly everywhere, inner must be non-null, however in places where
1466     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1467     */
1468    LDKnativeLightningError *inner;
1469    /**
1470     * Indicates that this is the only struct which contains the same pointer.
1471     * Rust functions which take ownership of an object provided via an argument require
1472     * this to be true and invalidate the object pointed to by inner.
1473     */
1474    bool is_owned;
1475 } LDKLightningError;
1476
1477 /**
1478  * The contents of CResult_RouteLightningErrorZ
1479  */
1480 typedef union LDKCResult_RouteLightningErrorZPtr {
1481    /**
1482     * A pointer to the contents in the success state.
1483     * Reading from this pointer when `result_ok` is not set is undefined.
1484     */
1485    struct LDKRoute *result;
1486    /**
1487     * A pointer to the contents in the error state.
1488     * Reading from this pointer when `result_ok` is set is undefined.
1489     */
1490    struct LDKLightningError *err;
1491 } LDKCResult_RouteLightningErrorZPtr;
1492
1493 /**
1494  * A CResult_RouteLightningErrorZ represents the result of a fallible operation,
1495  * containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::LightningError on failure.
1496  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1497  */
1498 typedef struct LDKCResult_RouteLightningErrorZ {
1499    /**
1500     * The contents of this CResult_RouteLightningErrorZ, accessible via either
1501     * `err` or `result` depending on the state of `result_ok`.
1502     */
1503    union LDKCResult_RouteLightningErrorZPtr contents;
1504    /**
1505     * Whether this CResult_RouteLightningErrorZ represents a success state.
1506     */
1507    bool result_ok;
1508 } LDKCResult_RouteLightningErrorZ;
1509
1510 /**
1511  * The contents of CResult_TxOutAccessErrorZ
1512  */
1513 typedef union LDKCResult_TxOutAccessErrorZPtr {
1514    /**
1515     * A pointer to the contents in the success state.
1516     * Reading from this pointer when `result_ok` is not set is undefined.
1517     */
1518    struct LDKTxOut *result;
1519    /**
1520     * A pointer to the contents in the error state.
1521     * Reading from this pointer when `result_ok` is set is undefined.
1522     */
1523    enum LDKAccessError *err;
1524 } LDKCResult_TxOutAccessErrorZPtr;
1525
1526 /**
1527  * A CResult_TxOutAccessErrorZ represents the result of a fallible operation,
1528  * containing a crate::c_types::TxOut on success and a crate::lightning::chain::AccessError on failure.
1529  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1530  */
1531 typedef struct LDKCResult_TxOutAccessErrorZ {
1532    /**
1533     * The contents of this CResult_TxOutAccessErrorZ, accessible via either
1534     * `err` or `result` depending on the state of `result_ok`.
1535     */
1536    union LDKCResult_TxOutAccessErrorZPtr contents;
1537    /**
1538     * Whether this CResult_TxOutAccessErrorZ represents a success state.
1539     */
1540    bool result_ok;
1541 } LDKCResult_TxOutAccessErrorZ;
1542
1543 /**
1544  * A tuple of 2 elements. See the individual fields for the types contained.
1545  */
1546 typedef struct LDKC2Tuple_usizeTransactionZ {
1547    /**
1548     * The element at position 0
1549     */
1550    uintptr_t a;
1551    /**
1552     * The element at position 1
1553     */
1554    struct LDKTransaction b;
1555 } LDKC2Tuple_usizeTransactionZ;
1556
1557 /**
1558  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_usizeTransactionZs of arbitrary size.
1559  * This corresponds to std::vector in C++
1560  */
1561 typedef struct LDKCVec_C2Tuple_usizeTransactionZZ {
1562    /**
1563     * The elements in the array.
1564     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1565     */
1566    struct LDKC2Tuple_usizeTransactionZ *data;
1567    /**
1568     * The number of elements pointed to by `data`.
1569     */
1570    uintptr_t datalen;
1571 } LDKCVec_C2Tuple_usizeTransactionZZ;
1572
1573 /**
1574  * Arbitrary 32 bytes, which could represent one of a few different things. You probably want to
1575  * look up the corresponding function in rust-lightning's docs.
1576  */
1577 typedef struct LDKThirtyTwoBytes {
1578    /**
1579     * The thirty-two bytes
1580     */
1581    uint8_t data[32];
1582 } LDKThirtyTwoBytes;
1583
1584 /**
1585  * A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
1586  * This corresponds to std::vector in C++
1587  */
1588 typedef struct LDKCVec_TxidZ {
1589    /**
1590     * The elements in the array.
1591     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1592     */
1593    struct LDKThirtyTwoBytes *data;
1594    /**
1595     * The number of elements pointed to by `data`.
1596     */
1597    uintptr_t datalen;
1598 } LDKCVec_TxidZ;
1599
1600 /**
1601  * The contents of CResult_NoneChannelMonitorUpdateErrZ
1602  */
1603 typedef union LDKCResult_NoneChannelMonitorUpdateErrZPtr {
1604    /**
1605     * Note that this value is always NULL, as there are no contents in the OK variant
1606     */
1607    void *result;
1608    /**
1609     * A pointer to the contents in the error state.
1610     * Reading from this pointer when `result_ok` is set is undefined.
1611     */
1612    enum LDKChannelMonitorUpdateErr *err;
1613 } LDKCResult_NoneChannelMonitorUpdateErrZPtr;
1614
1615 /**
1616  * A CResult_NoneChannelMonitorUpdateErrZ represents the result of a fallible operation,
1617  * containing a () on success and a crate::lightning::chain::channelmonitor::ChannelMonitorUpdateErr on failure.
1618  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1619  */
1620 typedef struct LDKCResult_NoneChannelMonitorUpdateErrZ {
1621    /**
1622     * The contents of this CResult_NoneChannelMonitorUpdateErrZ, accessible via either
1623     * `err` or `result` depending on the state of `result_ok`.
1624     */
1625    union LDKCResult_NoneChannelMonitorUpdateErrZPtr contents;
1626    /**
1627     * Whether this CResult_NoneChannelMonitorUpdateErrZ represents a success state.
1628     */
1629    bool result_ok;
1630 } LDKCResult_NoneChannelMonitorUpdateErrZ;
1631
1632
1633
1634 /**
1635  * Simple structure sent back by `chain::Watch` when an HTLC from a forward channel is detected on
1636  * chain. Used to update the corresponding HTLC in the backward channel. Failing to pass the
1637  * preimage claim backward will lead to loss of funds.
1638  */
1639 typedef struct MUST_USE_STRUCT LDKHTLCUpdate {
1640    /**
1641     * A pointer to the opaque Rust object.
1642     * Nearly everywhere, inner must be non-null, however in places where
1643     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1644     */
1645    LDKnativeHTLCUpdate *inner;
1646    /**
1647     * Indicates that this is the only struct which contains the same pointer.
1648     * Rust functions which take ownership of an object provided via an argument require
1649     * this to be true and invalidate the object pointed to by inner.
1650     */
1651    bool is_owned;
1652 } LDKHTLCUpdate;
1653
1654
1655
1656 /**
1657  * A reference to a transaction output.
1658  *
1659  * Differs from bitcoin::blockdata::transaction::OutPoint as the index is a u16 instead of u32
1660  * due to LN's restrictions on index values. Should reduce (possibly) unsafe conversions this way.
1661  */
1662 typedef struct MUST_USE_STRUCT LDKOutPoint {
1663    /**
1664     * A pointer to the opaque Rust object.
1665     * Nearly everywhere, inner must be non-null, however in places where
1666     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1667     */
1668    LDKnativeOutPoint *inner;
1669    /**
1670     * Indicates that this is the only struct which contains the same pointer.
1671     * Rust functions which take ownership of an object provided via an argument require
1672     * this to be true and invalidate the object pointed to by inner.
1673     */
1674    bool is_owned;
1675 } LDKOutPoint;
1676
1677 /**
1678  * An event to be processed by the ChannelManager.
1679  */
1680 typedef enum LDKMonitorEvent_Tag {
1681    /**
1682     * A monitor event containing an HTLCUpdate.
1683     */
1684    LDKMonitorEvent_HTLCEvent,
1685    /**
1686     * A monitor event that the Channel's commitment transaction was broadcasted.
1687     */
1688    LDKMonitorEvent_CommitmentTxBroadcasted,
1689    /**
1690     * Must be last for serialization purposes
1691     */
1692    LDKMonitorEvent_Sentinel,
1693 } LDKMonitorEvent_Tag;
1694
1695 typedef struct MUST_USE_STRUCT LDKMonitorEvent {
1696    LDKMonitorEvent_Tag tag;
1697    union {
1698       struct {
1699          struct LDKHTLCUpdate htlc_event;
1700       };
1701       struct {
1702          struct LDKOutPoint commitment_tx_broadcasted;
1703       };
1704    };
1705 } LDKMonitorEvent;
1706
1707 /**
1708  * A dynamically-allocated array of crate::lightning::chain::channelmonitor::MonitorEvents of arbitrary size.
1709  * This corresponds to std::vector in C++
1710  */
1711 typedef struct LDKCVec_MonitorEventZ {
1712    /**
1713     * The elements in the array.
1714     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1715     */
1716    struct LDKMonitorEvent *data;
1717    /**
1718     * The number of elements pointed to by `data`.
1719     */
1720    uintptr_t datalen;
1721 } LDKCVec_MonitorEventZ;
1722
1723 /**
1724  * An enum which can either contain a crate::c_types::derived::C2Tuple_usizeTransactionZ or not
1725  */
1726 typedef enum LDKCOption_C2Tuple_usizeTransactionZZ_Tag {
1727    /**
1728     * When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains a crate::c_types::derived::C2Tuple_usizeTransactionZ
1729     */
1730    LDKCOption_C2Tuple_usizeTransactionZZ_Some,
1731    /**
1732     * When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains nothing
1733     */
1734    LDKCOption_C2Tuple_usizeTransactionZZ_None,
1735    /**
1736     * Must be last for serialization purposes
1737     */
1738    LDKCOption_C2Tuple_usizeTransactionZZ_Sentinel,
1739 } LDKCOption_C2Tuple_usizeTransactionZZ_Tag;
1740
1741 typedef struct LDKCOption_C2Tuple_usizeTransactionZZ {
1742    LDKCOption_C2Tuple_usizeTransactionZZ_Tag tag;
1743    union {
1744       struct {
1745          struct LDKC2Tuple_usizeTransactionZ some;
1746       };
1747    };
1748 } LDKCOption_C2Tuple_usizeTransactionZZ;
1749
1750
1751
1752 /**
1753  * Information about a spendable output to a P2WSH script. See
1754  * SpendableOutputDescriptor::DelayedPaymentOutput for more details on how to spend this.
1755  */
1756 typedef struct MUST_USE_STRUCT LDKDelayedPaymentOutputDescriptor {
1757    /**
1758     * A pointer to the opaque Rust object.
1759     * Nearly everywhere, inner must be non-null, however in places where
1760     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1761     */
1762    LDKnativeDelayedPaymentOutputDescriptor *inner;
1763    /**
1764     * Indicates that this is the only struct which contains the same pointer.
1765     * Rust functions which take ownership of an object provided via an argument require
1766     * this to be true and invalidate the object pointed to by inner.
1767     */
1768    bool is_owned;
1769 } LDKDelayedPaymentOutputDescriptor;
1770
1771
1772
1773 /**
1774  * Information about a spendable output to our \"payment key\". See
1775  * SpendableOutputDescriptor::StaticPaymentOutput for more details on how to spend this.
1776  */
1777 typedef struct MUST_USE_STRUCT LDKStaticPaymentOutputDescriptor {
1778    /**
1779     * A pointer to the opaque Rust object.
1780     * Nearly everywhere, inner must be non-null, however in places where
1781     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1782     */
1783    LDKnativeStaticPaymentOutputDescriptor *inner;
1784    /**
1785     * Indicates that this is the only struct which contains the same pointer.
1786     * Rust functions which take ownership of an object provided via an argument require
1787     * this to be true and invalidate the object pointed to by inner.
1788     */
1789    bool is_owned;
1790 } LDKStaticPaymentOutputDescriptor;
1791
1792 /**
1793  * When on-chain outputs are created by rust-lightning (which our counterparty is not able to
1794  * claim at any point in the future) an event is generated which you must track and be able to
1795  * spend on-chain. The information needed to do this is provided in this enum, including the
1796  * outpoint describing which txid and output index is available, the full output which exists at
1797  * that txid/index, and any keys or other information required to sign.
1798  */
1799 typedef enum LDKSpendableOutputDescriptor_Tag {
1800    /**
1801     * An output to a script which was provided via KeysInterface directly, either from
1802     * `get_destination_script()` or `get_shutdown_pubkey()`, thus you should already know how to
1803     * spend it. No secret keys are provided as rust-lightning was never given any key.
1804     * These may include outputs from a transaction punishing our counterparty or claiming an HTLC
1805     * on-chain using the payment preimage or after it has timed out.
1806     */
1807    LDKSpendableOutputDescriptor_StaticOutput,
1808    /**
1809     * An output to a P2WSH script which can be spent with a single signature after a CSV delay.
1810     *
1811     * The witness in the spending input should be:
1812     * <BIP 143 signature> <empty vector> (MINIMALIF standard rule) <provided witnessScript>
1813     *
1814     * Note that the nSequence field in the spending input must be set to to_self_delay
1815     * (which means the transaction is not broadcastable until at least to_self_delay
1816     * blocks after the outpoint confirms).
1817     *
1818     * These are generally the result of a \"revocable\" output to us, spendable only by us unless
1819     * it is an output from an old state which we broadcast (which should never happen).
1820     *
1821     * To derive the delayed_payment key which is used to sign for this input, you must pass the
1822     * holder delayed_payment_base_key (ie the private key which corresponds to the pubkey in
1823     * Sign::pubkeys().delayed_payment_basepoint) and the provided per_commitment_point to
1824     * chan_utils::derive_private_key. The public key can be generated without the secret key
1825     * using chan_utils::derive_public_key and only the delayed_payment_basepoint which appears in
1826     * Sign::pubkeys().
1827     *
1828     * To derive the revocation_pubkey provided here (which is used in the witness
1829     * script generation), you must pass the counterparty revocation_basepoint (which appears in the
1830     * call to Sign::ready_channel) and the provided per_commitment point
1831     * to chan_utils::derive_public_revocation_key.
1832     *
1833     * The witness script which is hashed and included in the output script_pubkey may be
1834     * regenerated by passing the revocation_pubkey (derived as above), our delayed_payment pubkey
1835     * (derived as above), and the to_self_delay contained here to
1836     * chan_utils::get_revokeable_redeemscript.
1837     */
1838    LDKSpendableOutputDescriptor_DelayedPaymentOutput,
1839    /**
1840     * An output to a P2WPKH, spendable exclusively by our payment key (ie the private key which
1841     * corresponds to the public key in Sign::pubkeys().payment_point).
1842     * The witness in the spending input, is, thus, simply:
1843     * <BIP 143 signature> <payment key>
1844     *
1845     * These are generally the result of our counterparty having broadcast the current state,
1846     * allowing us to claim the non-HTLC-encumbered outputs immediately.
1847     */
1848    LDKSpendableOutputDescriptor_StaticPaymentOutput,
1849    /**
1850     * Must be last for serialization purposes
1851     */
1852    LDKSpendableOutputDescriptor_Sentinel,
1853 } LDKSpendableOutputDescriptor_Tag;
1854
1855 typedef struct LDKSpendableOutputDescriptor_LDKStaticOutput_Body {
1856    /**
1857     * The outpoint which is spendable
1858     */
1859    struct LDKOutPoint outpoint;
1860    /**
1861     * The output which is referenced by the given outpoint.
1862     */
1863    struct LDKTxOut output;
1864 } LDKSpendableOutputDescriptor_LDKStaticOutput_Body;
1865
1866 typedef struct MUST_USE_STRUCT LDKSpendableOutputDescriptor {
1867    LDKSpendableOutputDescriptor_Tag tag;
1868    union {
1869       LDKSpendableOutputDescriptor_LDKStaticOutput_Body static_output;
1870       struct {
1871          struct LDKDelayedPaymentOutputDescriptor delayed_payment_output;
1872       };
1873       struct {
1874          struct LDKStaticPaymentOutputDescriptor static_payment_output;
1875       };
1876    };
1877 } LDKSpendableOutputDescriptor;
1878
1879 /**
1880  * A dynamically-allocated array of crate::lightning::chain::keysinterface::SpendableOutputDescriptors of arbitrary size.
1881  * This corresponds to std::vector in C++
1882  */
1883 typedef struct LDKCVec_SpendableOutputDescriptorZ {
1884    /**
1885     * The elements in the array.
1886     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1887     */
1888    struct LDKSpendableOutputDescriptor *data;
1889    /**
1890     * The number of elements pointed to by `data`.
1891     */
1892    uintptr_t datalen;
1893 } LDKCVec_SpendableOutputDescriptorZ;
1894
1895
1896
1897 /**
1898  * An accept_channel message to be sent or received from a peer
1899  */
1900 typedef struct MUST_USE_STRUCT LDKAcceptChannel {
1901    /**
1902     * A pointer to the opaque Rust object.
1903     * Nearly everywhere, inner must be non-null, however in places where
1904     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1905     */
1906    LDKnativeAcceptChannel *inner;
1907    /**
1908     * Indicates that this is the only struct which contains the same pointer.
1909     * Rust functions which take ownership of an object provided via an argument require
1910     * this to be true and invalidate the object pointed to by inner.
1911     */
1912    bool is_owned;
1913 } LDKAcceptChannel;
1914
1915
1916
1917 /**
1918  * An open_channel message to be sent or received from a peer
1919  */
1920 typedef struct MUST_USE_STRUCT LDKOpenChannel {
1921    /**
1922     * A pointer to the opaque Rust object.
1923     * Nearly everywhere, inner must be non-null, however in places where
1924     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1925     */
1926    LDKnativeOpenChannel *inner;
1927    /**
1928     * Indicates that this is the only struct which contains the same pointer.
1929     * Rust functions which take ownership of an object provided via an argument require
1930     * this to be true and invalidate the object pointed to by inner.
1931     */
1932    bool is_owned;
1933 } LDKOpenChannel;
1934
1935
1936
1937 /**
1938  * A funding_created message to be sent or received from a peer
1939  */
1940 typedef struct MUST_USE_STRUCT LDKFundingCreated {
1941    /**
1942     * A pointer to the opaque Rust object.
1943     * Nearly everywhere, inner must be non-null, however in places where
1944     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1945     */
1946    LDKnativeFundingCreated *inner;
1947    /**
1948     * Indicates that this is the only struct which contains the same pointer.
1949     * Rust functions which take ownership of an object provided via an argument require
1950     * this to be true and invalidate the object pointed to by inner.
1951     */
1952    bool is_owned;
1953 } LDKFundingCreated;
1954
1955
1956
1957 /**
1958  * A funding_signed message to be sent or received from a peer
1959  */
1960 typedef struct MUST_USE_STRUCT LDKFundingSigned {
1961    /**
1962     * A pointer to the opaque Rust object.
1963     * Nearly everywhere, inner must be non-null, however in places where
1964     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1965     */
1966    LDKnativeFundingSigned *inner;
1967    /**
1968     * Indicates that this is the only struct which contains the same pointer.
1969     * Rust functions which take ownership of an object provided via an argument require
1970     * this to be true and invalidate the object pointed to by inner.
1971     */
1972    bool is_owned;
1973 } LDKFundingSigned;
1974
1975
1976
1977 /**
1978  * A funding_locked message to be sent or received from a peer
1979  */
1980 typedef struct MUST_USE_STRUCT LDKFundingLocked {
1981    /**
1982     * A pointer to the opaque Rust object.
1983     * Nearly everywhere, inner must be non-null, however in places where
1984     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1985     */
1986    LDKnativeFundingLocked *inner;
1987    /**
1988     * Indicates that this is the only struct which contains the same pointer.
1989     * Rust functions which take ownership of an object provided via an argument require
1990     * this to be true and invalidate the object pointed to by inner.
1991     */
1992    bool is_owned;
1993 } LDKFundingLocked;
1994
1995
1996
1997 /**
1998  * An announcement_signatures message to be sent or received from a peer
1999  */
2000 typedef struct MUST_USE_STRUCT LDKAnnouncementSignatures {
2001    /**
2002     * A pointer to the opaque Rust object.
2003     * Nearly everywhere, inner must be non-null, however in places where
2004     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2005     */
2006    LDKnativeAnnouncementSignatures *inner;
2007    /**
2008     * Indicates that this is the only struct which contains the same pointer.
2009     * Rust functions which take ownership of an object provided via an argument require
2010     * this to be true and invalidate the object pointed to by inner.
2011     */
2012    bool is_owned;
2013 } LDKAnnouncementSignatures;
2014
2015
2016
2017 /**
2018  * Struct used to return values from revoke_and_ack messages, containing a bunch of commitment
2019  * transaction updates if they were pending.
2020  */
2021 typedef struct MUST_USE_STRUCT LDKCommitmentUpdate {
2022    /**
2023     * A pointer to the opaque Rust object.
2024     * Nearly everywhere, inner must be non-null, however in places where
2025     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2026     */
2027    LDKnativeCommitmentUpdate *inner;
2028    /**
2029     * Indicates that this is the only struct which contains the same pointer.
2030     * Rust functions which take ownership of an object provided via an argument require
2031     * this to be true and invalidate the object pointed to by inner.
2032     */
2033    bool is_owned;
2034 } LDKCommitmentUpdate;
2035
2036
2037
2038 /**
2039  * A revoke_and_ack message to be sent or received from a peer
2040  */
2041 typedef struct MUST_USE_STRUCT LDKRevokeAndACK {
2042    /**
2043     * A pointer to the opaque Rust object.
2044     * Nearly everywhere, inner must be non-null, however in places where
2045     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2046     */
2047    LDKnativeRevokeAndACK *inner;
2048    /**
2049     * Indicates that this is the only struct which contains the same pointer.
2050     * Rust functions which take ownership of an object provided via an argument require
2051     * this to be true and invalidate the object pointed to by inner.
2052     */
2053    bool is_owned;
2054 } LDKRevokeAndACK;
2055
2056
2057
2058 /**
2059  * A closing_signed message to be sent or received from a peer
2060  */
2061 typedef struct MUST_USE_STRUCT LDKClosingSigned {
2062    /**
2063     * A pointer to the opaque Rust object.
2064     * Nearly everywhere, inner must be non-null, however in places where
2065     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2066     */
2067    LDKnativeClosingSigned *inner;
2068    /**
2069     * Indicates that this is the only struct which contains the same pointer.
2070     * Rust functions which take ownership of an object provided via an argument require
2071     * this to be true and invalidate the object pointed to by inner.
2072     */
2073    bool is_owned;
2074 } LDKClosingSigned;
2075
2076
2077
2078 /**
2079  * A shutdown message to be sent or received from a peer
2080  */
2081 typedef struct MUST_USE_STRUCT LDKShutdown {
2082    /**
2083     * A pointer to the opaque Rust object.
2084     * Nearly everywhere, inner must be non-null, however in places where
2085     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2086     */
2087    LDKnativeShutdown *inner;
2088    /**
2089     * Indicates that this is the only struct which contains the same pointer.
2090     * Rust functions which take ownership of an object provided via an argument require
2091     * this to be true and invalidate the object pointed to by inner.
2092     */
2093    bool is_owned;
2094 } LDKShutdown;
2095
2096
2097
2098 /**
2099  * A channel_reestablish message to be sent or received from a peer
2100  */
2101 typedef struct MUST_USE_STRUCT LDKChannelReestablish {
2102    /**
2103     * A pointer to the opaque Rust object.
2104     * Nearly everywhere, inner must be non-null, however in places where
2105     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2106     */
2107    LDKnativeChannelReestablish *inner;
2108    /**
2109     * Indicates that this is the only struct which contains the same pointer.
2110     * Rust functions which take ownership of an object provided via an argument require
2111     * this to be true and invalidate the object pointed to by inner.
2112     */
2113    bool is_owned;
2114 } LDKChannelReestablish;
2115
2116
2117
2118 /**
2119  * A channel_announcement message to be sent or received from a peer
2120  */
2121 typedef struct MUST_USE_STRUCT LDKChannelAnnouncement {
2122    /**
2123     * A pointer to the opaque Rust object.
2124     * Nearly everywhere, inner must be non-null, however in places where
2125     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2126     */
2127    LDKnativeChannelAnnouncement *inner;
2128    /**
2129     * Indicates that this is the only struct which contains the same pointer.
2130     * Rust functions which take ownership of an object provided via an argument require
2131     * this to be true and invalidate the object pointed to by inner.
2132     */
2133    bool is_owned;
2134 } LDKChannelAnnouncement;
2135
2136
2137
2138 /**
2139  * A channel_update message to be sent or received from a peer
2140  */
2141 typedef struct MUST_USE_STRUCT LDKChannelUpdate {
2142    /**
2143     * A pointer to the opaque Rust object.
2144     * Nearly everywhere, inner must be non-null, however in places where
2145     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2146     */
2147    LDKnativeChannelUpdate *inner;
2148    /**
2149     * Indicates that this is the only struct which contains the same pointer.
2150     * Rust functions which take ownership of an object provided via an argument require
2151     * this to be true and invalidate the object pointed to by inner.
2152     */
2153    bool is_owned;
2154 } LDKChannelUpdate;
2155
2156
2157
2158 /**
2159  * A node_announcement message to be sent or received from a peer
2160  */
2161 typedef struct MUST_USE_STRUCT LDKNodeAnnouncement {
2162    /**
2163     * A pointer to the opaque Rust object.
2164     * Nearly everywhere, inner must be non-null, however in places where
2165     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2166     */
2167    LDKnativeNodeAnnouncement *inner;
2168    /**
2169     * Indicates that this is the only struct which contains the same pointer.
2170     * Rust functions which take ownership of an object provided via an argument require
2171     * this to be true and invalidate the object pointed to by inner.
2172     */
2173    bool is_owned;
2174 } LDKNodeAnnouncement;
2175
2176
2177
2178 /**
2179  * An error message to be sent or received from a peer
2180  */
2181 typedef struct MUST_USE_STRUCT LDKErrorMessage {
2182    /**
2183     * A pointer to the opaque Rust object.
2184     * Nearly everywhere, inner must be non-null, however in places where
2185     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2186     */
2187    LDKnativeErrorMessage *inner;
2188    /**
2189     * Indicates that this is the only struct which contains the same pointer.
2190     * Rust functions which take ownership of an object provided via an argument require
2191     * this to be true and invalidate the object pointed to by inner.
2192     */
2193    bool is_owned;
2194 } LDKErrorMessage;
2195
2196 /**
2197  * Used to put an error message in a LightningError
2198  */
2199 typedef enum LDKErrorAction_Tag {
2200    /**
2201     * The peer took some action which made us think they were useless. Disconnect them.
2202     */
2203    LDKErrorAction_DisconnectPeer,
2204    /**
2205     * The peer did something harmless that we weren't able to process, just log and ignore
2206     */
2207    LDKErrorAction_IgnoreError,
2208    /**
2209     * The peer did something incorrect. Tell them.
2210     */
2211    LDKErrorAction_SendErrorMessage,
2212    /**
2213     * Must be last for serialization purposes
2214     */
2215    LDKErrorAction_Sentinel,
2216 } LDKErrorAction_Tag;
2217
2218 typedef struct LDKErrorAction_LDKDisconnectPeer_Body {
2219    /**
2220     * An error message which we should make an effort to send before we disconnect.
2221     */
2222    struct LDKErrorMessage msg;
2223 } LDKErrorAction_LDKDisconnectPeer_Body;
2224
2225 typedef struct LDKErrorAction_LDKSendErrorMessage_Body {
2226    /**
2227     * The message to send.
2228     */
2229    struct LDKErrorMessage msg;
2230 } LDKErrorAction_LDKSendErrorMessage_Body;
2231
2232 typedef struct MUST_USE_STRUCT LDKErrorAction {
2233    LDKErrorAction_Tag tag;
2234    union {
2235       LDKErrorAction_LDKDisconnectPeer_Body disconnect_peer;
2236       LDKErrorAction_LDKSendErrorMessage_Body send_error_message;
2237    };
2238 } LDKErrorAction;
2239
2240 /**
2241  * The information we received from a peer along the route of a payment we originated. This is
2242  * returned by ChannelMessageHandler::handle_update_fail_htlc to be passed into
2243  * RoutingMessageHandler::handle_htlc_fail_channel_update to update our network map.
2244  */
2245 typedef enum LDKHTLCFailChannelUpdate_Tag {
2246    /**
2247     * We received an error which included a full ChannelUpdate message.
2248     */
2249    LDKHTLCFailChannelUpdate_ChannelUpdateMessage,
2250    /**
2251     * We received an error which indicated only that a channel has been closed
2252     */
2253    LDKHTLCFailChannelUpdate_ChannelClosed,
2254    /**
2255     * We received an error which indicated only that a node has failed
2256     */
2257    LDKHTLCFailChannelUpdate_NodeFailure,
2258    /**
2259     * Must be last for serialization purposes
2260     */
2261    LDKHTLCFailChannelUpdate_Sentinel,
2262 } LDKHTLCFailChannelUpdate_Tag;
2263
2264 typedef struct LDKHTLCFailChannelUpdate_LDKChannelUpdateMessage_Body {
2265    /**
2266     * The unwrapped message we received
2267     */
2268    struct LDKChannelUpdate msg;
2269 } LDKHTLCFailChannelUpdate_LDKChannelUpdateMessage_Body;
2270
2271 typedef struct LDKHTLCFailChannelUpdate_LDKChannelClosed_Body {
2272    /**
2273     * The short_channel_id which has now closed.
2274     */
2275    uint64_t short_channel_id;
2276    /**
2277     * when this true, this channel should be permanently removed from the
2278     * consideration. Otherwise, this channel can be restored as new channel_update is received
2279     */
2280    bool is_permanent;
2281 } LDKHTLCFailChannelUpdate_LDKChannelClosed_Body;
2282
2283 typedef struct LDKHTLCFailChannelUpdate_LDKNodeFailure_Body {
2284    /**
2285     * The node_id that has failed.
2286     */
2287    struct LDKPublicKey node_id;
2288    /**
2289     * when this true, node should be permanently removed from the
2290     * consideration. Otherwise, the channels connected to this node can be
2291     * restored as new channel_update is received
2292     */
2293    bool is_permanent;
2294 } LDKHTLCFailChannelUpdate_LDKNodeFailure_Body;
2295
2296 typedef struct MUST_USE_STRUCT LDKHTLCFailChannelUpdate {
2297    LDKHTLCFailChannelUpdate_Tag tag;
2298    union {
2299       LDKHTLCFailChannelUpdate_LDKChannelUpdateMessage_Body channel_update_message;
2300       LDKHTLCFailChannelUpdate_LDKChannelClosed_Body channel_closed;
2301       LDKHTLCFailChannelUpdate_LDKNodeFailure_Body node_failure;
2302    };
2303 } LDKHTLCFailChannelUpdate;
2304
2305
2306
2307 /**
2308  * A query_channel_range message is used to query a peer for channel
2309  * UTXOs in a range of blocks. The recipient of a query makes a best
2310  * effort to reply to the query using one or more reply_channel_range
2311  * messages.
2312  */
2313 typedef struct MUST_USE_STRUCT LDKQueryChannelRange {
2314    /**
2315     * A pointer to the opaque Rust object.
2316     * Nearly everywhere, inner must be non-null, however in places where
2317     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2318     */
2319    LDKnativeQueryChannelRange *inner;
2320    /**
2321     * Indicates that this is the only struct which contains the same pointer.
2322     * Rust functions which take ownership of an object provided via an argument require
2323     * this to be true and invalidate the object pointed to by inner.
2324     */
2325    bool is_owned;
2326 } LDKQueryChannelRange;
2327
2328
2329
2330 /**
2331  * A query_short_channel_ids message is used to query a peer for
2332  * routing gossip messages related to one or more short_channel_ids.
2333  * The query recipient will reply with the latest, if available,
2334  * channel_announcement, channel_update and node_announcement messages
2335  * it maintains for the requested short_channel_ids followed by a
2336  * reply_short_channel_ids_end message. The short_channel_ids sent in
2337  * this query are encoded. We only support encoding_type=0 uncompressed
2338  * serialization and do not support encoding_type=1 zlib serialization.
2339  */
2340 typedef struct MUST_USE_STRUCT LDKQueryShortChannelIds {
2341    /**
2342     * A pointer to the opaque Rust object.
2343     * Nearly everywhere, inner must be non-null, however in places where
2344     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2345     */
2346    LDKnativeQueryShortChannelIds *inner;
2347    /**
2348     * Indicates that this is the only struct which contains the same pointer.
2349     * Rust functions which take ownership of an object provided via an argument require
2350     * this to be true and invalidate the object pointed to by inner.
2351     */
2352    bool is_owned;
2353 } LDKQueryShortChannelIds;
2354
2355
2356
2357 /**
2358  * A reply_channel_range message is a reply to a query_channel_range
2359  * message. Multiple reply_channel_range messages can be sent in reply
2360  * to a single query_channel_range message. The query recipient makes a
2361  * best effort to respond based on their local network view which may
2362  * not be a perfect view of the network. The short_channel_ids in the
2363  * reply are encoded. We only support encoding_type=0 uncompressed
2364  * serialization and do not support encoding_type=1 zlib serialization.
2365  */
2366 typedef struct MUST_USE_STRUCT LDKReplyChannelRange {
2367    /**
2368     * A pointer to the opaque Rust object.
2369     * Nearly everywhere, inner must be non-null, however in places where
2370     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2371     */
2372    LDKnativeReplyChannelRange *inner;
2373    /**
2374     * Indicates that this is the only struct which contains the same pointer.
2375     * Rust functions which take ownership of an object provided via an argument require
2376     * this to be true and invalidate the object pointed to by inner.
2377     */
2378    bool is_owned;
2379 } LDKReplyChannelRange;
2380
2381 /**
2382  * An event generated by ChannelManager which indicates a message should be sent to a peer (or
2383  * broadcast to most peers).
2384  * These events are handled by PeerManager::process_events if you are using a PeerManager.
2385  */
2386 typedef enum LDKMessageSendEvent_Tag {
2387    /**
2388     * Used to indicate that we've accepted a channel open and should send the accept_channel
2389     * message provided to the given peer.
2390     */
2391    LDKMessageSendEvent_SendAcceptChannel,
2392    /**
2393     * Used to indicate that we've initiated a channel open and should send the open_channel
2394     * message provided to the given peer.
2395     */
2396    LDKMessageSendEvent_SendOpenChannel,
2397    /**
2398     * Used to indicate that a funding_created message should be sent to the peer with the given node_id.
2399     */
2400    LDKMessageSendEvent_SendFundingCreated,
2401    /**
2402     * Used to indicate that a funding_signed message should be sent to the peer with the given node_id.
2403     */
2404    LDKMessageSendEvent_SendFundingSigned,
2405    /**
2406     * Used to indicate that a funding_locked message should be sent to the peer with the given node_id.
2407     */
2408    LDKMessageSendEvent_SendFundingLocked,
2409    /**
2410     * Used to indicate that an announcement_signatures message should be sent to the peer with the given node_id.
2411     */
2412    LDKMessageSendEvent_SendAnnouncementSignatures,
2413    /**
2414     * Used to indicate that a series of HTLC update messages, as well as a commitment_signed
2415     * message should be sent to the peer with the given node_id.
2416     */
2417    LDKMessageSendEvent_UpdateHTLCs,
2418    /**
2419     * Used to indicate that a revoke_and_ack message should be sent to the peer with the given node_id.
2420     */
2421    LDKMessageSendEvent_SendRevokeAndACK,
2422    /**
2423     * Used to indicate that a closing_signed message should be sent to the peer with the given node_id.
2424     */
2425    LDKMessageSendEvent_SendClosingSigned,
2426    /**
2427     * Used to indicate that a shutdown message should be sent to the peer with the given node_id.
2428     */
2429    LDKMessageSendEvent_SendShutdown,
2430    /**
2431     * Used to indicate that a channel_reestablish message should be sent to the peer with the given node_id.
2432     */
2433    LDKMessageSendEvent_SendChannelReestablish,
2434    /**
2435     * Used to indicate that a channel_announcement and channel_update should be broadcast to all
2436     * peers (except the peer with node_id either msg.contents.node_id_1 or msg.contents.node_id_2).
2437     *
2438     * Note that after doing so, you very likely (unless you did so very recently) want to call
2439     * ChannelManager::broadcast_node_announcement to trigger a BroadcastNodeAnnouncement event.
2440     * This ensures that any nodes which see our channel_announcement also have a relevant
2441     * node_announcement, including relevant feature flags which may be important for routing
2442     * through or to us.
2443     */
2444    LDKMessageSendEvent_BroadcastChannelAnnouncement,
2445    /**
2446     * Used to indicate that a node_announcement should be broadcast to all peers.
2447     */
2448    LDKMessageSendEvent_BroadcastNodeAnnouncement,
2449    /**
2450     * Used to indicate that a channel_update should be broadcast to all peers.
2451     */
2452    LDKMessageSendEvent_BroadcastChannelUpdate,
2453    /**
2454     * Broadcast an error downstream to be handled
2455     */
2456    LDKMessageSendEvent_HandleError,
2457    /**
2458     * When a payment fails we may receive updates back from the hop where it failed. In such
2459     * cases this event is generated so that we can inform the network graph of this information.
2460     */
2461    LDKMessageSendEvent_PaymentFailureNetworkUpdate,
2462    /**
2463     * Query a peer for channels with funding transaction UTXOs in a block range.
2464     */
2465    LDKMessageSendEvent_SendChannelRangeQuery,
2466    /**
2467     * Request routing gossip messages from a peer for a list of channels identified by
2468     * their short_channel_ids.
2469     */
2470    LDKMessageSendEvent_SendShortIdsQuery,
2471    /**
2472     * Sends a reply to a channel range query. This may be one of several SendReplyChannelRange events
2473     * emitted during processing of the query.
2474     */
2475    LDKMessageSendEvent_SendReplyChannelRange,
2476    /**
2477     * Must be last for serialization purposes
2478     */
2479    LDKMessageSendEvent_Sentinel,
2480 } LDKMessageSendEvent_Tag;
2481
2482 typedef struct LDKMessageSendEvent_LDKSendAcceptChannel_Body {
2483    /**
2484     * The node_id of the node which should receive this message
2485     */
2486    struct LDKPublicKey node_id;
2487    /**
2488     * The message which should be sent.
2489     */
2490    struct LDKAcceptChannel msg;
2491 } LDKMessageSendEvent_LDKSendAcceptChannel_Body;
2492
2493 typedef struct LDKMessageSendEvent_LDKSendOpenChannel_Body {
2494    /**
2495     * The node_id of the node which should receive this message
2496     */
2497    struct LDKPublicKey node_id;
2498    /**
2499     * The message which should be sent.
2500     */
2501    struct LDKOpenChannel msg;
2502 } LDKMessageSendEvent_LDKSendOpenChannel_Body;
2503
2504 typedef struct LDKMessageSendEvent_LDKSendFundingCreated_Body {
2505    /**
2506     * The node_id of the node which should receive this message
2507     */
2508    struct LDKPublicKey node_id;
2509    /**
2510     * The message which should be sent.
2511     */
2512    struct LDKFundingCreated msg;
2513 } LDKMessageSendEvent_LDKSendFundingCreated_Body;
2514
2515 typedef struct LDKMessageSendEvent_LDKSendFundingSigned_Body {
2516    /**
2517     * The node_id of the node which should receive this message
2518     */
2519    struct LDKPublicKey node_id;
2520    /**
2521     * The message which should be sent.
2522     */
2523    struct LDKFundingSigned msg;
2524 } LDKMessageSendEvent_LDKSendFundingSigned_Body;
2525
2526 typedef struct LDKMessageSendEvent_LDKSendFundingLocked_Body {
2527    /**
2528     * The node_id of the node which should receive these message(s)
2529     */
2530    struct LDKPublicKey node_id;
2531    /**
2532     * The funding_locked message which should be sent.
2533     */
2534    struct LDKFundingLocked msg;
2535 } LDKMessageSendEvent_LDKSendFundingLocked_Body;
2536
2537 typedef struct LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body {
2538    /**
2539     * The node_id of the node which should receive these message(s)
2540     */
2541    struct LDKPublicKey node_id;
2542    /**
2543     * The announcement_signatures message which should be sent.
2544     */
2545    struct LDKAnnouncementSignatures msg;
2546 } LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body;
2547
2548 typedef struct LDKMessageSendEvent_LDKUpdateHTLCs_Body {
2549    /**
2550     * The node_id of the node which should receive these message(s)
2551     */
2552    struct LDKPublicKey node_id;
2553    /**
2554     * The update messages which should be sent. ALL messages in the struct should be sent!
2555     */
2556    struct LDKCommitmentUpdate updates;
2557 } LDKMessageSendEvent_LDKUpdateHTLCs_Body;
2558
2559 typedef struct LDKMessageSendEvent_LDKSendRevokeAndACK_Body {
2560    /**
2561     * The node_id of the node which should receive this message
2562     */
2563    struct LDKPublicKey node_id;
2564    /**
2565     * The message which should be sent.
2566     */
2567    struct LDKRevokeAndACK msg;
2568 } LDKMessageSendEvent_LDKSendRevokeAndACK_Body;
2569
2570 typedef struct LDKMessageSendEvent_LDKSendClosingSigned_Body {
2571    /**
2572     * The node_id of the node which should receive this message
2573     */
2574    struct LDKPublicKey node_id;
2575    /**
2576     * The message which should be sent.
2577     */
2578    struct LDKClosingSigned msg;
2579 } LDKMessageSendEvent_LDKSendClosingSigned_Body;
2580
2581 typedef struct LDKMessageSendEvent_LDKSendShutdown_Body {
2582    /**
2583     * The node_id of the node which should receive this message
2584     */
2585    struct LDKPublicKey node_id;
2586    /**
2587     * The message which should be sent.
2588     */
2589    struct LDKShutdown msg;
2590 } LDKMessageSendEvent_LDKSendShutdown_Body;
2591
2592 typedef struct LDKMessageSendEvent_LDKSendChannelReestablish_Body {
2593    /**
2594     * The node_id of the node which should receive this message
2595     */
2596    struct LDKPublicKey node_id;
2597    /**
2598     * The message which should be sent.
2599     */
2600    struct LDKChannelReestablish msg;
2601 } LDKMessageSendEvent_LDKSendChannelReestablish_Body;
2602
2603 typedef struct LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body {
2604    /**
2605     * The channel_announcement which should be sent.
2606     */
2607    struct LDKChannelAnnouncement msg;
2608    /**
2609     * The followup channel_update which should be sent.
2610     */
2611    struct LDKChannelUpdate update_msg;
2612 } LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body;
2613
2614 typedef struct LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body {
2615    /**
2616     * The node_announcement which should be sent.
2617     */
2618    struct LDKNodeAnnouncement msg;
2619 } LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body;
2620
2621 typedef struct LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body {
2622    /**
2623     * The channel_update which should be sent.
2624     */
2625    struct LDKChannelUpdate msg;
2626 } LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body;
2627
2628 typedef struct LDKMessageSendEvent_LDKHandleError_Body {
2629    /**
2630     * The node_id of the node which should receive this message
2631     */
2632    struct LDKPublicKey node_id;
2633    /**
2634     * The action which should be taken.
2635     */
2636    struct LDKErrorAction action;
2637 } LDKMessageSendEvent_LDKHandleError_Body;
2638
2639 typedef struct LDKMessageSendEvent_LDKPaymentFailureNetworkUpdate_Body {
2640    /**
2641     * The channel/node update which should be sent to NetGraphMsgHandler
2642     */
2643    struct LDKHTLCFailChannelUpdate update;
2644 } LDKMessageSendEvent_LDKPaymentFailureNetworkUpdate_Body;
2645
2646 typedef struct LDKMessageSendEvent_LDKSendChannelRangeQuery_Body {
2647    /**
2648     * The node_id of this message recipient
2649     */
2650    struct LDKPublicKey node_id;
2651    /**
2652     * The query_channel_range which should be sent.
2653     */
2654    struct LDKQueryChannelRange msg;
2655 } LDKMessageSendEvent_LDKSendChannelRangeQuery_Body;
2656
2657 typedef struct LDKMessageSendEvent_LDKSendShortIdsQuery_Body {
2658    /**
2659     * The node_id of this message recipient
2660     */
2661    struct LDKPublicKey node_id;
2662    /**
2663     * The query_short_channel_ids which should be sent.
2664     */
2665    struct LDKQueryShortChannelIds msg;
2666 } LDKMessageSendEvent_LDKSendShortIdsQuery_Body;
2667
2668 typedef struct LDKMessageSendEvent_LDKSendReplyChannelRange_Body {
2669    /**
2670     * The node_id of this message recipient
2671     */
2672    struct LDKPublicKey node_id;
2673    /**
2674     * The reply_channel_range which should be sent.
2675     */
2676    struct LDKReplyChannelRange msg;
2677 } LDKMessageSendEvent_LDKSendReplyChannelRange_Body;
2678
2679 typedef struct MUST_USE_STRUCT LDKMessageSendEvent {
2680    LDKMessageSendEvent_Tag tag;
2681    union {
2682       LDKMessageSendEvent_LDKSendAcceptChannel_Body send_accept_channel;
2683       LDKMessageSendEvent_LDKSendOpenChannel_Body send_open_channel;
2684       LDKMessageSendEvent_LDKSendFundingCreated_Body send_funding_created;
2685       LDKMessageSendEvent_LDKSendFundingSigned_Body send_funding_signed;
2686       LDKMessageSendEvent_LDKSendFundingLocked_Body send_funding_locked;
2687       LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body send_announcement_signatures;
2688       LDKMessageSendEvent_LDKUpdateHTLCs_Body update_htl_cs;
2689       LDKMessageSendEvent_LDKSendRevokeAndACK_Body send_revoke_and_ack;
2690       LDKMessageSendEvent_LDKSendClosingSigned_Body send_closing_signed;
2691       LDKMessageSendEvent_LDKSendShutdown_Body send_shutdown;
2692       LDKMessageSendEvent_LDKSendChannelReestablish_Body send_channel_reestablish;
2693       LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body broadcast_channel_announcement;
2694       LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body broadcast_node_announcement;
2695       LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body broadcast_channel_update;
2696       LDKMessageSendEvent_LDKHandleError_Body handle_error;
2697       LDKMessageSendEvent_LDKPaymentFailureNetworkUpdate_Body payment_failure_network_update;
2698       LDKMessageSendEvent_LDKSendChannelRangeQuery_Body send_channel_range_query;
2699       LDKMessageSendEvent_LDKSendShortIdsQuery_Body send_short_ids_query;
2700       LDKMessageSendEvent_LDKSendReplyChannelRange_Body send_reply_channel_range;
2701    };
2702 } LDKMessageSendEvent;
2703
2704 /**
2705  * A dynamically-allocated array of crate::lightning::util::events::MessageSendEvents of arbitrary size.
2706  * This corresponds to std::vector in C++
2707  */
2708 typedef struct LDKCVec_MessageSendEventZ {
2709    /**
2710     * The elements in the array.
2711     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2712     */
2713    struct LDKMessageSendEvent *data;
2714    /**
2715     * The number of elements pointed to by `data`.
2716     */
2717    uintptr_t datalen;
2718 } LDKCVec_MessageSendEventZ;
2719
2720
2721
2722 /**
2723  * Features used within an `init` message.
2724  */
2725 typedef struct MUST_USE_STRUCT LDKInitFeatures {
2726    /**
2727     * A pointer to the opaque Rust object.
2728     * Nearly everywhere, inner must be non-null, however in places where
2729     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2730     */
2731    LDKnativeInitFeatures *inner;
2732    /**
2733     * Indicates that this is the only struct which contains the same pointer.
2734     * Rust functions which take ownership of an object provided via an argument require
2735     * this to be true and invalidate the object pointed to by inner.
2736     */
2737    bool is_owned;
2738 } LDKInitFeatures;
2739
2740 /**
2741  * The contents of CResult_InitFeaturesDecodeErrorZ
2742  */
2743 typedef union LDKCResult_InitFeaturesDecodeErrorZPtr {
2744    /**
2745     * A pointer to the contents in the success state.
2746     * Reading from this pointer when `result_ok` is not set is undefined.
2747     */
2748    struct LDKInitFeatures *result;
2749    /**
2750     * A pointer to the contents in the error state.
2751     * Reading from this pointer when `result_ok` is set is undefined.
2752     */
2753    struct LDKDecodeError *err;
2754 } LDKCResult_InitFeaturesDecodeErrorZPtr;
2755
2756 /**
2757  * A CResult_InitFeaturesDecodeErrorZ represents the result of a fallible operation,
2758  * containing a crate::lightning::ln::features::InitFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
2759  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2760  */
2761 typedef struct LDKCResult_InitFeaturesDecodeErrorZ {
2762    /**
2763     * The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either
2764     * `err` or `result` depending on the state of `result_ok`.
2765     */
2766    union LDKCResult_InitFeaturesDecodeErrorZPtr contents;
2767    /**
2768     * Whether this CResult_InitFeaturesDecodeErrorZ represents a success state.
2769     */
2770    bool result_ok;
2771 } LDKCResult_InitFeaturesDecodeErrorZ;
2772
2773
2774
2775 /**
2776  * Features used within a `node_announcement` message.
2777  */
2778 typedef struct MUST_USE_STRUCT LDKNodeFeatures {
2779    /**
2780     * A pointer to the opaque Rust object.
2781     * Nearly everywhere, inner must be non-null, however in places where
2782     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2783     */
2784    LDKnativeNodeFeatures *inner;
2785    /**
2786     * Indicates that this is the only struct which contains the same pointer.
2787     * Rust functions which take ownership of an object provided via an argument require
2788     * this to be true and invalidate the object pointed to by inner.
2789     */
2790    bool is_owned;
2791 } LDKNodeFeatures;
2792
2793 /**
2794  * The contents of CResult_NodeFeaturesDecodeErrorZ
2795  */
2796 typedef union LDKCResult_NodeFeaturesDecodeErrorZPtr {
2797    /**
2798     * A pointer to the contents in the success state.
2799     * Reading from this pointer when `result_ok` is not set is undefined.
2800     */
2801    struct LDKNodeFeatures *result;
2802    /**
2803     * A pointer to the contents in the error state.
2804     * Reading from this pointer when `result_ok` is set is undefined.
2805     */
2806    struct LDKDecodeError *err;
2807 } LDKCResult_NodeFeaturesDecodeErrorZPtr;
2808
2809 /**
2810  * A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation,
2811  * containing a crate::lightning::ln::features::NodeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
2812  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2813  */
2814 typedef struct LDKCResult_NodeFeaturesDecodeErrorZ {
2815    /**
2816     * The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either
2817     * `err` or `result` depending on the state of `result_ok`.
2818     */
2819    union LDKCResult_NodeFeaturesDecodeErrorZPtr contents;
2820    /**
2821     * Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state.
2822     */
2823    bool result_ok;
2824 } LDKCResult_NodeFeaturesDecodeErrorZ;
2825
2826
2827
2828 /**
2829  * Features used within a `channel_announcement` message.
2830  */
2831 typedef struct MUST_USE_STRUCT LDKChannelFeatures {
2832    /**
2833     * A pointer to the opaque Rust object.
2834     * Nearly everywhere, inner must be non-null, however in places where
2835     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2836     */
2837    LDKnativeChannelFeatures *inner;
2838    /**
2839     * Indicates that this is the only struct which contains the same pointer.
2840     * Rust functions which take ownership of an object provided via an argument require
2841     * this to be true and invalidate the object pointed to by inner.
2842     */
2843    bool is_owned;
2844 } LDKChannelFeatures;
2845
2846 /**
2847  * The contents of CResult_ChannelFeaturesDecodeErrorZ
2848  */
2849 typedef union LDKCResult_ChannelFeaturesDecodeErrorZPtr {
2850    /**
2851     * A pointer to the contents in the success state.
2852     * Reading from this pointer when `result_ok` is not set is undefined.
2853     */
2854    struct LDKChannelFeatures *result;
2855    /**
2856     * A pointer to the contents in the error state.
2857     * Reading from this pointer when `result_ok` is set is undefined.
2858     */
2859    struct LDKDecodeError *err;
2860 } LDKCResult_ChannelFeaturesDecodeErrorZPtr;
2861
2862 /**
2863  * A CResult_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation,
2864  * containing a crate::lightning::ln::features::ChannelFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
2865  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2866  */
2867 typedef struct LDKCResult_ChannelFeaturesDecodeErrorZ {
2868    /**
2869     * The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either
2870     * `err` or `result` depending on the state of `result_ok`.
2871     */
2872    union LDKCResult_ChannelFeaturesDecodeErrorZPtr contents;
2873    /**
2874     * Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state.
2875     */
2876    bool result_ok;
2877 } LDKCResult_ChannelFeaturesDecodeErrorZ;
2878
2879
2880
2881 /**
2882  * Features used within an invoice.
2883  */
2884 typedef struct MUST_USE_STRUCT LDKInvoiceFeatures {
2885    /**
2886     * A pointer to the opaque Rust object.
2887     * Nearly everywhere, inner must be non-null, however in places where
2888     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2889     */
2890    LDKnativeInvoiceFeatures *inner;
2891    /**
2892     * Indicates that this is the only struct which contains the same pointer.
2893     * Rust functions which take ownership of an object provided via an argument require
2894     * this to be true and invalidate the object pointed to by inner.
2895     */
2896    bool is_owned;
2897 } LDKInvoiceFeatures;
2898
2899 /**
2900  * The contents of CResult_InvoiceFeaturesDecodeErrorZ
2901  */
2902 typedef union LDKCResult_InvoiceFeaturesDecodeErrorZPtr {
2903    /**
2904     * A pointer to the contents in the success state.
2905     * Reading from this pointer when `result_ok` is not set is undefined.
2906     */
2907    struct LDKInvoiceFeatures *result;
2908    /**
2909     * A pointer to the contents in the error state.
2910     * Reading from this pointer when `result_ok` is set is undefined.
2911     */
2912    struct LDKDecodeError *err;
2913 } LDKCResult_InvoiceFeaturesDecodeErrorZPtr;
2914
2915 /**
2916  * A CResult_InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
2917  * containing a crate::lightning::ln::features::InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
2918  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2919  */
2920 typedef struct LDKCResult_InvoiceFeaturesDecodeErrorZ {
2921    /**
2922     * The contents of this CResult_InvoiceFeaturesDecodeErrorZ, accessible via either
2923     * `err` or `result` depending on the state of `result_ok`.
2924     */
2925    union LDKCResult_InvoiceFeaturesDecodeErrorZPtr contents;
2926    /**
2927     * Whether this CResult_InvoiceFeaturesDecodeErrorZ represents a success state.
2928     */
2929    bool result_ok;
2930 } LDKCResult_InvoiceFeaturesDecodeErrorZ;
2931
2932 /**
2933  * The contents of CResult_DelayedPaymentOutputDescriptorDecodeErrorZ
2934  */
2935 typedef union LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
2936    /**
2937     * A pointer to the contents in the success state.
2938     * Reading from this pointer when `result_ok` is not set is undefined.
2939     */
2940    struct LDKDelayedPaymentOutputDescriptor *result;
2941    /**
2942     * A pointer to the contents in the error state.
2943     * Reading from this pointer when `result_ok` is set is undefined.
2944     */
2945    struct LDKDecodeError *err;
2946 } LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr;
2947
2948 /**
2949  * A CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
2950  * containing a crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
2951  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2952  */
2953 typedef struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
2954    /**
2955     * The contents of this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ, accessible via either
2956     * `err` or `result` depending on the state of `result_ok`.
2957     */
2958    union LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr contents;
2959    /**
2960     * Whether this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents a success state.
2961     */
2962    bool result_ok;
2963 } LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ;
2964
2965 /**
2966  * The contents of CResult_StaticPaymentOutputDescriptorDecodeErrorZ
2967  */
2968 typedef union LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
2969    /**
2970     * A pointer to the contents in the success state.
2971     * Reading from this pointer when `result_ok` is not set is undefined.
2972     */
2973    struct LDKStaticPaymentOutputDescriptor *result;
2974    /**
2975     * A pointer to the contents in the error state.
2976     * Reading from this pointer when `result_ok` is set is undefined.
2977     */
2978    struct LDKDecodeError *err;
2979 } LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZPtr;
2980
2981 /**
2982  * A CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
2983  * containing a crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
2984  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2985  */
2986 typedef struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ {
2987    /**
2988     * The contents of this CResult_StaticPaymentOutputDescriptorDecodeErrorZ, accessible via either
2989     * `err` or `result` depending on the state of `result_ok`.
2990     */
2991    union LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZPtr contents;
2992    /**
2993     * Whether this CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents a success state.
2994     */
2995    bool result_ok;
2996 } LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ;
2997
2998 /**
2999  * The contents of CResult_SpendableOutputDescriptorDecodeErrorZ
3000  */
3001 typedef union LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr {
3002    /**
3003     * A pointer to the contents in the success state.
3004     * Reading from this pointer when `result_ok` is not set is undefined.
3005     */
3006    struct LDKSpendableOutputDescriptor *result;
3007    /**
3008     * A pointer to the contents in the error state.
3009     * Reading from this pointer when `result_ok` is set is undefined.
3010     */
3011    struct LDKDecodeError *err;
3012 } LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr;
3013
3014 /**
3015  * A CResult_SpendableOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
3016  * containing a crate::lightning::chain::keysinterface::SpendableOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
3017  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3018  */
3019 typedef struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ {
3020    /**
3021     * The contents of this CResult_SpendableOutputDescriptorDecodeErrorZ, accessible via either
3022     * `err` or `result` depending on the state of `result_ok`.
3023     */
3024    union LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr contents;
3025    /**
3026     * Whether this CResult_SpendableOutputDescriptorDecodeErrorZ represents a success state.
3027     */
3028    bool result_ok;
3029 } LDKCResult_SpendableOutputDescriptorDecodeErrorZ;
3030
3031 /**
3032  * A tuple of 2 elements. See the individual fields for the types contained.
3033  */
3034 typedef struct LDKC2Tuple_SignatureCVec_SignatureZZ {
3035    /**
3036     * The element at position 0
3037     */
3038    struct LDKSignature a;
3039    /**
3040     * The element at position 1
3041     */
3042    struct LDKCVec_SignatureZ b;
3043 } LDKC2Tuple_SignatureCVec_SignatureZZ;
3044
3045 /**
3046  * The contents of CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ
3047  */
3048 typedef union LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
3049    /**
3050     * A pointer to the contents in the success state.
3051     * Reading from this pointer when `result_ok` is not set is undefined.
3052     */
3053    struct LDKC2Tuple_SignatureCVec_SignatureZZ *result;
3054    /**
3055     * Note that this value is always NULL, as there are no contents in the Err variant
3056     */
3057    void *err;
3058 } LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr;
3059
3060 /**
3061  * A CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents the result of a fallible operation,
3062  * containing a crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ on success and a () on failure.
3063  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3064  */
3065 typedef struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
3066    /**
3067     * The contents of this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ, accessible via either
3068     * `err` or `result` depending on the state of `result_ok`.
3069     */
3070    union LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr contents;
3071    /**
3072     * Whether this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents a success state.
3073     */
3074    bool result_ok;
3075 } LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ;
3076
3077 /**
3078  * The contents of CResult_SignatureNoneZ
3079  */
3080 typedef union LDKCResult_SignatureNoneZPtr {
3081    /**
3082     * A pointer to the contents in the success state.
3083     * Reading from this pointer when `result_ok` is not set is undefined.
3084     */
3085    struct LDKSignature *result;
3086    /**
3087     * Note that this value is always NULL, as there are no contents in the Err variant
3088     */
3089    void *err;
3090 } LDKCResult_SignatureNoneZPtr;
3091
3092 /**
3093  * A CResult_SignatureNoneZ represents the result of a fallible operation,
3094  * containing a crate::c_types::Signature on success and a () on failure.
3095  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3096  */
3097 typedef struct LDKCResult_SignatureNoneZ {
3098    /**
3099     * The contents of this CResult_SignatureNoneZ, accessible via either
3100     * `err` or `result` depending on the state of `result_ok`.
3101     */
3102    union LDKCResult_SignatureNoneZPtr contents;
3103    /**
3104     * Whether this CResult_SignatureNoneZ represents a success state.
3105     */
3106    bool result_ok;
3107 } LDKCResult_SignatureNoneZ;
3108
3109
3110
3111 /**
3112  * The unsigned part of a channel_announcement
3113  */
3114 typedef struct MUST_USE_STRUCT LDKUnsignedChannelAnnouncement {
3115    /**
3116     * A pointer to the opaque Rust object.
3117     * Nearly everywhere, inner must be non-null, however in places where
3118     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3119     */
3120    LDKnativeUnsignedChannelAnnouncement *inner;
3121    /**
3122     * Indicates that this is the only struct which contains the same pointer.
3123     * Rust functions which take ownership of an object provided via an argument require
3124     * this to be true and invalidate the object pointed to by inner.
3125     */
3126    bool is_owned;
3127 } LDKUnsignedChannelAnnouncement;
3128
3129 /**
3130  * A trait to sign lightning channel transactions as described in BOLT 3.
3131  *
3132  * Signing services could be implemented on a hardware wallet. In this case,
3133  * the current Sign would be a front-end on top of a communication
3134  * channel connected to your secure device and lightning key material wouldn't
3135  * reside on a hot server. Nevertheless, a this deployment would still need
3136  * to trust the ChannelManager to avoid loss of funds as this latest component
3137  * could ask to sign commitment transaction with HTLCs paying to attacker pubkeys.
3138  *
3139  * A more secure iteration would be to use hashlock (or payment points) to pair
3140  * invoice/incoming HTLCs with outgoing HTLCs to implement a no-trust-ChannelManager
3141  * at the price of more state and computation on the hardware wallet side. In the future,
3142  * we are looking forward to design such interface.
3143  *
3144  * In any case, ChannelMonitor or fallback watchtowers are always going to be trusted
3145  * to act, as liveness and breach reply correctness are always going to be hard requirements
3146  * of LN security model, orthogonal of key management issues.
3147  */
3148 typedef struct LDKBaseSign {
3149    /**
3150     * An opaque pointer which is passed to your function implementations as an argument.
3151     * This has no meaning in the LDK, and can be NULL or any other value.
3152     */
3153    void *this_arg;
3154    /**
3155     * Gets the per-commitment point for a specific commitment number
3156     *
3157     * Note that the commitment number starts at (1 << 48) - 1 and counts backwards.
3158     */
3159    struct LDKPublicKey (*get_per_commitment_point)(const void *this_arg, uint64_t idx);
3160    /**
3161     * Gets the commitment secret for a specific commitment number as part of the revocation process
3162     *
3163     * An external signer implementation should error here if the commitment was already signed
3164     * and should refuse to sign it in the future.
3165     *
3166     * May be called more than once for the same index.
3167     *
3168     * Note that the commitment number starts at (1 << 48) - 1 and counts backwards.
3169     */
3170    struct LDKThirtyTwoBytes (*release_commitment_secret)(const void *this_arg, uint64_t idx);
3171    /**
3172     * Gets the holder's channel public keys and basepoints
3173     */
3174    struct LDKChannelPublicKeys pubkeys;
3175    /**
3176     * Fill in the pubkeys field as a reference to it will be given to Rust after this returns
3177     * Note that this takes a pointer to this object, not the this_ptr like other methods do
3178     * This function pointer may be NULL if pubkeys is filled in when this object is created and never needs updating.
3179     */
3180    void (*set_pubkeys)(const struct LDKBaseSign*NONNULL_PTR );
3181    /**
3182     * Gets an arbitrary identifier describing the set of keys which are provided back to you in
3183     * some SpendableOutputDescriptor types. This should be sufficient to identify this
3184     * Sign object uniquely and lookup or re-derive its keys.
3185     */
3186    struct LDKThirtyTwoBytes (*channel_keys_id)(const void *this_arg);
3187    /**
3188     * Create a signature for a counterparty's commitment transaction and associated HTLC transactions.
3189     *
3190     * Note that if signing fails or is rejected, the channel will be force-closed.
3191     */
3192    struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*sign_counterparty_commitment)(const void *this_arg, const struct LDKCommitmentTransaction *NONNULL_PTR commitment_tx);
3193    /**
3194     * Create a signatures for a holder's commitment transaction and its claiming HTLC transactions.
3195     * This will only ever be called with a non-revoked commitment_tx.  This will be called with the
3196     * latest commitment_tx when we initiate a force-close.
3197     * This will be called with the previous latest, just to get claiming HTLC signatures, if we are
3198     * reacting to a ChannelMonitor replica that decided to broadcast before it had been updated to
3199     * the latest.
3200     * This may be called multiple times for the same transaction.
3201     *
3202     * An external signer implementation should check that the commitment has not been revoked.
3203     *
3204     * May return Err if key derivation fails.  Callers, such as ChannelMonitor, will panic in such a case.
3205     */
3206    struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*sign_holder_commitment_and_htlcs)(const void *this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR commitment_tx);
3207    /**
3208     * Create a signature for the given input in a transaction spending an HTLC transaction output
3209     * or a commitment transaction `to_local` output when our counterparty broadcasts an old state.
3210     *
3211     * A justice transaction may claim multiple outputs at the same time if timelocks are
3212     * similar, but only a signature for the input at index `input` should be signed for here.
3213     * It may be called multiple times for same output(s) if a fee-bump is needed with regards
3214     * to an upcoming timelock expiration.
3215     *
3216     * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
3217     *
3218     * per_commitment_key is revocation secret which was provided by our counterparty when they
3219     * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does
3220     * not allow the spending of any funds by itself (you need our holder revocation_secret to do
3221     * so).
3222     */
3223    struct LDKCResult_SignatureNoneZ (*sign_justice_revoked_output)(const void *this_arg, struct LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (*per_commitment_key)[32]);
3224    /**
3225     * Create a signature for the given input in a transaction spending a commitment transaction
3226     * HTLC output when our counterparty broadcasts an old state.
3227     *
3228     * A justice transaction may claim multiple outputs at the same time if timelocks are
3229     * similar, but only a signature for the input at index `input` should be signed for here.
3230     * It may be called multiple times for same output(s) if a fee-bump is needed with regards
3231     * to an upcoming timelock expiration.
3232     *
3233     * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
3234     *
3235     * per_commitment_key is revocation secret which was provided by our counterparty when they
3236     * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does
3237     * not allow the spending of any funds by itself (you need our holder revocation_secret to do
3238     * so).
3239     *
3240     * htlc holds HTLC elements (hash, timelock), thus changing the format of the witness script
3241     * (which is committed to in the BIP 143 signatures).
3242     */
3243    struct LDKCResult_SignatureNoneZ (*sign_justice_revoked_htlc)(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);
3244    /**
3245     * Create a signature for a claiming transaction for a HTLC output on a counterparty's commitment
3246     * transaction, either offered or received.
3247     *
3248     * Such a transaction may claim multiples offered outputs at same time if we know the
3249     * preimage for each when we create it, but only the input at index `input` should be
3250     * signed for here. It may be called multiple times for same output(s) if a fee-bump is
3251     * needed with regards to an upcoming timelock expiration.
3252     *
3253     * Witness_script is either a offered or received script as defined in BOLT3 for HTLC
3254     * outputs.
3255     *
3256     * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
3257     *
3258     * Per_commitment_point is the dynamic point corresponding to the channel state
3259     * detected onchain. It has been generated by our counterparty and is used to derive
3260     * channel state keys, which are then included in the witness script and committed to in the
3261     * BIP 143 signature.
3262     */
3263    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);
3264    /**
3265     * Create a signature for a (proposed) closing transaction.
3266     *
3267     * Note that, due to rounding, there may be one \"missing\" satoshi, and either party may have
3268     * chosen to forgo their output as dust.
3269     */
3270    struct LDKCResult_SignatureNoneZ (*sign_closing_transaction)(const void *this_arg, struct LDKTransaction closing_tx);
3271    /**
3272     * Signs a channel announcement message with our funding key, proving it comes from one
3273     * of the channel participants.
3274     *
3275     * Note that if this fails or is rejected, the channel will not be publicly announced and
3276     * our counterparty may (though likely will not) close the channel on us for violating the
3277     * protocol.
3278     */
3279    struct LDKCResult_SignatureNoneZ (*sign_channel_announcement)(const void *this_arg, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR msg);
3280    /**
3281     * Set the counterparty static channel data, including basepoints,
3282     * counterparty_selected/holder_selected_contest_delay and funding outpoint.
3283     * This is done as soon as the funding outpoint is known.  Since these are static channel data,
3284     * they MUST NOT be allowed to change to different values once set.
3285     *
3286     * channel_parameters.is_populated() MUST be true.
3287     *
3288     * We bind holder_selected_contest_delay late here for API convenience.
3289     *
3290     * Will be called before any signatures are applied.
3291     */
3292    void (*ready_channel)(void *this_arg, const struct LDKChannelTransactionParameters *NONNULL_PTR channel_parameters);
3293    /**
3294     * Frees any resources associated with this object given its this_arg pointer.
3295     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
3296     */
3297    void (*free)(void *this_arg);
3298 } LDKBaseSign;
3299
3300 /**
3301  * A cloneable signer.
3302  *
3303  * Although we require signers to be cloneable, it may be useful for developers to be able to use
3304  * signers in an un-sized way, for example as `dyn BaseSign`. Therefore we separate the Clone trait,
3305  * which implies Sized, into this derived trait.
3306  */
3307 typedef struct LDKSign {
3308    /**
3309     * An opaque pointer which is passed to your function implementations as an argument.
3310     * This has no meaning in the LDK, and can be NULL or any other value.
3311     */
3312    void *this_arg;
3313    /**
3314     * Implementation of BaseSign for this object.
3315     */
3316    struct LDKBaseSign BaseSign;
3317    /**
3318     * Creates a copy of the BaseSign, for a copy of this Sign.
3319     * Because BaseSign doesn't natively support copying itself, you have to provide a full copy implementation here.
3320     */
3321    struct LDKBaseSign (*BaseSign_clone)(const struct LDKBaseSign *NONNULL_PTR orig_BaseSign);
3322    /**
3323     * Serialize the object into a byte array
3324     */
3325    struct LDKCVec_u8Z (*write)(const void *this_arg);
3326    /**
3327     * Creates a copy of the object pointed to by this_arg, for a copy of this Sign.
3328     * Note that the ultimate copy of the Sign will have all function pointers the same as the original.
3329     * May be NULL if no action needs to be taken, the this_arg pointer will be copied into the new Sign.
3330     */
3331    void *(*clone)(const void *this_arg);
3332    /**
3333     * Frees any resources associated with this object given its this_arg pointer.
3334     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
3335     */
3336    void (*free)(void *this_arg);
3337 } LDKSign;
3338
3339 /**
3340  * The contents of CResult_SignDecodeErrorZ
3341  */
3342 typedef union LDKCResult_SignDecodeErrorZPtr {
3343    /**
3344     * A pointer to the contents in the success state.
3345     * Reading from this pointer when `result_ok` is not set is undefined.
3346     */
3347    struct LDKSign *result;
3348    /**
3349     * A pointer to the contents in the error state.
3350     * Reading from this pointer when `result_ok` is set is undefined.
3351     */
3352    struct LDKDecodeError *err;
3353 } LDKCResult_SignDecodeErrorZPtr;
3354
3355 /**
3356  * A CResult_SignDecodeErrorZ represents the result of a fallible operation,
3357  * containing a crate::lightning::chain::keysinterface::Sign on success and a crate::lightning::ln::msgs::DecodeError on failure.
3358  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3359  */
3360 typedef struct LDKCResult_SignDecodeErrorZ {
3361    /**
3362     * The contents of this CResult_SignDecodeErrorZ, accessible via either
3363     * `err` or `result` depending on the state of `result_ok`.
3364     */
3365    union LDKCResult_SignDecodeErrorZPtr contents;
3366    /**
3367     * Whether this CResult_SignDecodeErrorZ represents a success state.
3368     */
3369    bool result_ok;
3370 } LDKCResult_SignDecodeErrorZ;
3371
3372 /**
3373  * Represents a secp256k1 signature serialized as two 32-byte numbers as well as a tag which
3374  * allows recovering the exact public key which created the signature given the message.
3375  */
3376 typedef struct LDKRecoverableSignature {
3377    /**
3378     * The bytes of the signature in "compact" form plus a "Recovery ID" which allows for
3379     * recovery.
3380     */
3381    uint8_t serialized_form[68];
3382 } LDKRecoverableSignature;
3383
3384 /**
3385  * The contents of CResult_RecoverableSignatureNoneZ
3386  */
3387 typedef union LDKCResult_RecoverableSignatureNoneZPtr {
3388    /**
3389     * A pointer to the contents in the success state.
3390     * Reading from this pointer when `result_ok` is not set is undefined.
3391     */
3392    struct LDKRecoverableSignature *result;
3393    /**
3394     * Note that this value is always NULL, as there are no contents in the Err variant
3395     */
3396    void *err;
3397 } LDKCResult_RecoverableSignatureNoneZPtr;
3398
3399 /**
3400  * A CResult_RecoverableSignatureNoneZ represents the result of a fallible operation,
3401  * containing a crate::c_types::RecoverableSignature on success and a () on failure.
3402  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3403  */
3404 typedef struct LDKCResult_RecoverableSignatureNoneZ {
3405    /**
3406     * The contents of this CResult_RecoverableSignatureNoneZ, accessible via either
3407     * `err` or `result` depending on the state of `result_ok`.
3408     */
3409    union LDKCResult_RecoverableSignatureNoneZPtr contents;
3410    /**
3411     * Whether this CResult_RecoverableSignatureNoneZ represents a success state.
3412     */
3413    bool result_ok;
3414 } LDKCResult_RecoverableSignatureNoneZ;
3415
3416 /**
3417  * A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size.
3418  * This corresponds to std::vector in C++
3419  */
3420 typedef struct LDKCVec_CVec_u8ZZ {
3421    /**
3422     * The elements in the array.
3423     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3424     */
3425    struct LDKCVec_u8Z *data;
3426    /**
3427     * The number of elements pointed to by `data`.
3428     */
3429    uintptr_t datalen;
3430 } LDKCVec_CVec_u8ZZ;
3431
3432 /**
3433  * The contents of CResult_CVec_CVec_u8ZZNoneZ
3434  */
3435 typedef union LDKCResult_CVec_CVec_u8ZZNoneZPtr {
3436    /**
3437     * A pointer to the contents in the success state.
3438     * Reading from this pointer when `result_ok` is not set is undefined.
3439     */
3440    struct LDKCVec_CVec_u8ZZ *result;
3441    /**
3442     * Note that this value is always NULL, as there are no contents in the Err variant
3443     */
3444    void *err;
3445 } LDKCResult_CVec_CVec_u8ZZNoneZPtr;
3446
3447 /**
3448  * A CResult_CVec_CVec_u8ZZNoneZ represents the result of a fallible operation,
3449  * containing a crate::c_types::derived::CVec_CVec_u8ZZ on success and a () on failure.
3450  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3451  */
3452 typedef struct LDKCResult_CVec_CVec_u8ZZNoneZ {
3453    /**
3454     * The contents of this CResult_CVec_CVec_u8ZZNoneZ, accessible via either
3455     * `err` or `result` depending on the state of `result_ok`.
3456     */
3457    union LDKCResult_CVec_CVec_u8ZZNoneZPtr contents;
3458    /**
3459     * Whether this CResult_CVec_CVec_u8ZZNoneZ represents a success state.
3460     */
3461    bool result_ok;
3462 } LDKCResult_CVec_CVec_u8ZZNoneZ;
3463
3464
3465
3466 /**
3467  * A simple implementation of Sign that just keeps the private keys in memory.
3468  *
3469  * This implementation performs no policy checks and is insufficient by itself as
3470  * a secure external signer.
3471  */
3472 typedef struct MUST_USE_STRUCT LDKInMemorySigner {
3473    /**
3474     * A pointer to the opaque Rust object.
3475     * Nearly everywhere, inner must be non-null, however in places where
3476     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3477     */
3478    LDKnativeInMemorySigner *inner;
3479    /**
3480     * Indicates that this is the only struct which contains the same pointer.
3481     * Rust functions which take ownership of an object provided via an argument require
3482     * this to be true and invalidate the object pointed to by inner.
3483     */
3484    bool is_owned;
3485 } LDKInMemorySigner;
3486
3487 /**
3488  * The contents of CResult_InMemorySignerDecodeErrorZ
3489  */
3490 typedef union LDKCResult_InMemorySignerDecodeErrorZPtr {
3491    /**
3492     * A pointer to the contents in the success state.
3493     * Reading from this pointer when `result_ok` is not set is undefined.
3494     */
3495    struct LDKInMemorySigner *result;
3496    /**
3497     * A pointer to the contents in the error state.
3498     * Reading from this pointer when `result_ok` is set is undefined.
3499     */
3500    struct LDKDecodeError *err;
3501 } LDKCResult_InMemorySignerDecodeErrorZPtr;
3502
3503 /**
3504  * A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation,
3505  * containing a crate::lightning::chain::keysinterface::InMemorySigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
3506  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3507  */
3508 typedef struct LDKCResult_InMemorySignerDecodeErrorZ {
3509    /**
3510     * The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either
3511     * `err` or `result` depending on the state of `result_ok`.
3512     */
3513    union LDKCResult_InMemorySignerDecodeErrorZPtr contents;
3514    /**
3515     * Whether this CResult_InMemorySignerDecodeErrorZ represents a success state.
3516     */
3517    bool result_ok;
3518 } LDKCResult_InMemorySignerDecodeErrorZ;
3519
3520 /**
3521  * A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size.
3522  * This corresponds to std::vector in C++
3523  */
3524 typedef struct LDKCVec_TxOutZ {
3525    /**
3526     * The elements in the array.
3527     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3528     */
3529    struct LDKTxOut *data;
3530    /**
3531     * The number of elements pointed to by `data`.
3532     */
3533    uintptr_t datalen;
3534 } LDKCVec_TxOutZ;
3535
3536 /**
3537  * The contents of CResult_TransactionNoneZ
3538  */
3539 typedef union LDKCResult_TransactionNoneZPtr {
3540    /**
3541     * A pointer to the contents in the success state.
3542     * Reading from this pointer when `result_ok` is not set is undefined.
3543     */
3544    struct LDKTransaction *result;
3545    /**
3546     * Note that this value is always NULL, as there are no contents in the Err variant
3547     */
3548    void *err;
3549 } LDKCResult_TransactionNoneZPtr;
3550
3551 /**
3552  * A CResult_TransactionNoneZ represents the result of a fallible operation,
3553  * containing a crate::c_types::Transaction on success and a () on failure.
3554  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3555  */
3556 typedef struct LDKCResult_TransactionNoneZ {
3557    /**
3558     * The contents of this CResult_TransactionNoneZ, accessible via either
3559     * `err` or `result` depending on the state of `result_ok`.
3560     */
3561    union LDKCResult_TransactionNoneZPtr contents;
3562    /**
3563     * Whether this CResult_TransactionNoneZ represents a success state.
3564     */
3565    bool result_ok;
3566 } LDKCResult_TransactionNoneZ;
3567
3568
3569
3570 /**
3571  * A ChannelMonitor handles chain events (blocks connected and disconnected) and generates
3572  * on-chain transactions to ensure no loss of funds occurs.
3573  *
3574  * You MUST ensure that no ChannelMonitors for a given channel anywhere contain out-of-date
3575  * information and are actively monitoring the chain.
3576  *
3577  * Pending Events or updated HTLCs which have not yet been read out by
3578  * get_and_clear_pending_monitor_events or get_and_clear_pending_events are serialized to disk and
3579  * reloaded at deserialize-time. Thus, you must ensure that, when handling events, all events
3580  * gotten are fully handled before re-serializing the new state.
3581  *
3582  * Note that the deserializer is only implemented for (BlockHash, ChannelMonitor), which
3583  * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along
3584  * the \"reorg path\" (ie disconnecting blocks until you find a common ancestor from both the
3585  * returned block hash and the the current chain and then reconnecting blocks to get to the
3586  * best chain) upon deserializing the object!
3587  */
3588 typedef struct MUST_USE_STRUCT LDKChannelMonitor {
3589    /**
3590     * A pointer to the opaque Rust object.
3591     * Nearly everywhere, inner must be non-null, however in places where
3592     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3593     */
3594    LDKnativeChannelMonitor *inner;
3595    /**
3596     * Indicates that this is the only struct which contains the same pointer.
3597     * Rust functions which take ownership of an object provided via an argument require
3598     * this to be true and invalidate the object pointed to by inner.
3599     */
3600    bool is_owned;
3601 } LDKChannelMonitor;
3602
3603 /**
3604  * A tuple of 2 elements. See the individual fields for the types contained.
3605  */
3606 typedef struct LDKC2Tuple_BlockHashChannelMonitorZ {
3607    /**
3608     * The element at position 0
3609     */
3610    struct LDKThirtyTwoBytes a;
3611    /**
3612     * The element at position 1
3613     */
3614    struct LDKChannelMonitor b;
3615 } LDKC2Tuple_BlockHashChannelMonitorZ;
3616
3617 /**
3618  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZs of arbitrary size.
3619  * This corresponds to std::vector in C++
3620  */
3621 typedef struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ {
3622    /**
3623     * The elements in the array.
3624     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3625     */
3626    struct LDKC2Tuple_BlockHashChannelMonitorZ *data;
3627    /**
3628     * The number of elements pointed to by `data`.
3629     */
3630    uintptr_t datalen;
3631 } LDKCVec_C2Tuple_BlockHashChannelMonitorZZ;
3632
3633 /**
3634  * The contents of CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ
3635  */
3636 typedef union LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
3637    /**
3638     * A pointer to the contents in the success state.
3639     * Reading from this pointer when `result_ok` is not set is undefined.
3640     */
3641    struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ *result;
3642    /**
3643     * A pointer to the contents in the error state.
3644     * Reading from this pointer when `result_ok` is set is undefined.
3645     */
3646    enum LDKIOError *err;
3647 } LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr;
3648
3649 /**
3650  * A CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents the result of a fallible operation,
3651  * containing a crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ on success and a crate::c_types::IOError on failure.
3652  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3653  */
3654 typedef struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
3655    /**
3656     * The contents of this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ, accessible via either
3657     * `err` or `result` depending on the state of `result_ok`.
3658     */
3659    union LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr contents;
3660    /**
3661     * Whether this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents a success state.
3662     */
3663    bool result_ok;
3664 } LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ;
3665
3666 /**
3667  * Indicates an error on the client's part (usually some variant of attempting to use too-low or
3668  * too-high values)
3669  */
3670 typedef enum LDKAPIError_Tag {
3671    /**
3672     * Indicates the API was wholly misused (see err for more). Cases where these can be returned
3673     * are documented, but generally indicates some precondition of a function was violated.
3674     */
3675    LDKAPIError_APIMisuseError,
3676    /**
3677     * Due to a high feerate, we were unable to complete the request.
3678     * For example, this may be returned if the feerate implies we cannot open a channel at the
3679     * requested value, but opening a larger channel would succeed.
3680     */
3681    LDKAPIError_FeeRateTooHigh,
3682    /**
3683     * A malformed Route was provided (eg overflowed value, node id mismatch, overly-looped route,
3684     * too-many-hops, etc).
3685     */
3686    LDKAPIError_RouteError,
3687    /**
3688     * We were unable to complete the request as the Channel required to do so is unable to
3689     * complete the request (or was not found). This can take many forms, including disconnected
3690     * peer, channel at capacity, channel shutting down, etc.
3691     */
3692    LDKAPIError_ChannelUnavailable,
3693    /**
3694     * An attempt to call watch/update_channel returned an Err (ie you did this!), causing the
3695     * attempted action to fail.
3696     */
3697    LDKAPIError_MonitorUpdateFailed,
3698    /**
3699     * Must be last for serialization purposes
3700     */
3701    LDKAPIError_Sentinel,
3702 } LDKAPIError_Tag;
3703
3704 typedef struct LDKAPIError_LDKAPIMisuseError_Body {
3705    /**
3706     * A human-readable error message
3707     */
3708    struct LDKStr err;
3709 } LDKAPIError_LDKAPIMisuseError_Body;
3710
3711 typedef struct LDKAPIError_LDKFeeRateTooHigh_Body {
3712    /**
3713     * A human-readable error message
3714     */
3715    struct LDKStr err;
3716    /**
3717     * The feerate which was too high.
3718     */
3719    uint32_t feerate;
3720 } LDKAPIError_LDKFeeRateTooHigh_Body;
3721
3722 typedef struct LDKAPIError_LDKRouteError_Body {
3723    /**
3724     * A human-readable error message
3725     */
3726    struct LDKStr err;
3727 } LDKAPIError_LDKRouteError_Body;
3728
3729 typedef struct LDKAPIError_LDKChannelUnavailable_Body {
3730    /**
3731     * A human-readable error message
3732     */
3733    struct LDKStr err;
3734 } LDKAPIError_LDKChannelUnavailable_Body;
3735
3736 typedef struct MUST_USE_STRUCT LDKAPIError {
3737    LDKAPIError_Tag tag;
3738    union {
3739       LDKAPIError_LDKAPIMisuseError_Body api_misuse_error;
3740       LDKAPIError_LDKFeeRateTooHigh_Body fee_rate_too_high;
3741       LDKAPIError_LDKRouteError_Body route_error;
3742       LDKAPIError_LDKChannelUnavailable_Body channel_unavailable;
3743    };
3744 } LDKAPIError;
3745
3746 /**
3747  * The contents of CResult_NoneAPIErrorZ
3748  */
3749 typedef union LDKCResult_NoneAPIErrorZPtr {
3750    /**
3751     * Note that this value is always NULL, as there are no contents in the OK variant
3752     */
3753    void *result;
3754    /**
3755     * A pointer to the contents in the error state.
3756     * Reading from this pointer when `result_ok` is set is undefined.
3757     */
3758    struct LDKAPIError *err;
3759 } LDKCResult_NoneAPIErrorZPtr;
3760
3761 /**
3762  * A CResult_NoneAPIErrorZ represents the result of a fallible operation,
3763  * containing a () on success and a crate::lightning::util::errors::APIError on failure.
3764  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3765  */
3766 typedef struct LDKCResult_NoneAPIErrorZ {
3767    /**
3768     * The contents of this CResult_NoneAPIErrorZ, accessible via either
3769     * `err` or `result` depending on the state of `result_ok`.
3770     */
3771    union LDKCResult_NoneAPIErrorZPtr contents;
3772    /**
3773     * Whether this CResult_NoneAPIErrorZ represents a success state.
3774     */
3775    bool result_ok;
3776 } LDKCResult_NoneAPIErrorZ;
3777
3778 /**
3779  * A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size.
3780  * This corresponds to std::vector in C++
3781  */
3782 typedef struct LDKCVec_CResult_NoneAPIErrorZZ {
3783    /**
3784     * The elements in the array.
3785     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3786     */
3787    struct LDKCResult_NoneAPIErrorZ *data;
3788    /**
3789     * The number of elements pointed to by `data`.
3790     */
3791    uintptr_t datalen;
3792 } LDKCVec_CResult_NoneAPIErrorZZ;
3793
3794 /**
3795  * A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size.
3796  * This corresponds to std::vector in C++
3797  */
3798 typedef struct LDKCVec_APIErrorZ {
3799    /**
3800     * The elements in the array.
3801     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3802     */
3803    struct LDKAPIError *data;
3804    /**
3805     * The number of elements pointed to by `data`.
3806     */
3807    uintptr_t datalen;
3808 } LDKCVec_APIErrorZ;
3809
3810 /**
3811  * If a payment fails to send, it can be in one of several states. This enum is returned as the
3812  * Err() type describing which state the payment is in, see the description of individual enum
3813  * states for more.
3814  */
3815 typedef enum LDKPaymentSendFailure_Tag {
3816    /**
3817     * A parameter which was passed to send_payment was invalid, preventing us from attempting to
3818     * send the payment at all. No channel state has been changed or messages sent to peers, and
3819     * once you've changed the parameter at error, you can freely retry the payment in full.
3820     */
3821    LDKPaymentSendFailure_ParameterError,
3822    /**
3823     * A parameter in a single path which was passed to send_payment was invalid, preventing us
3824     * from attempting to send the payment at all. No channel state has been changed or messages
3825     * sent to peers, and once you've changed the parameter at error, you can freely retry the
3826     * payment in full.
3827     *
3828     * The results here are ordered the same as the paths in the route object which was passed to
3829     * send_payment.
3830     */
3831    LDKPaymentSendFailure_PathParameterError,
3832    /**
3833     * All paths which were attempted failed to send, with no channel state change taking place.
3834     * You can freely retry the payment in full (though you probably want to do so over different
3835     * paths than the ones selected).
3836     */
3837    LDKPaymentSendFailure_AllFailedRetrySafe,
3838    /**
3839     * Some paths which were attempted failed to send, though possibly not all. At least some
3840     * paths have irrevocably committed to the HTLC and retrying the payment in full would result
3841     * in over-/re-payment.
3842     *
3843     * The results here are ordered the same as the paths in the route object which was passed to
3844     * send_payment, and any Errs which are not APIError::MonitorUpdateFailed can be safely
3845     * retried (though there is currently no API with which to do so).
3846     *
3847     * Any entries which contain Err(APIError::MonitorUpdateFailed) or Ok(()) MUST NOT be retried
3848     * as they will result in over-/re-payment. These HTLCs all either successfully sent (in the
3849     * case of Ok(())) or will send once channel_monitor_updated is called on the next-hop channel
3850     * with the latest update_id.
3851     */
3852    LDKPaymentSendFailure_PartialFailure,
3853    /**
3854     * Must be last for serialization purposes
3855     */
3856    LDKPaymentSendFailure_Sentinel,
3857 } LDKPaymentSendFailure_Tag;
3858
3859 typedef struct MUST_USE_STRUCT LDKPaymentSendFailure {
3860    LDKPaymentSendFailure_Tag tag;
3861    union {
3862       struct {
3863          struct LDKAPIError parameter_error;
3864       };
3865       struct {
3866          struct LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error;
3867       };
3868       struct {
3869          struct LDKCVec_APIErrorZ all_failed_retry_safe;
3870       };
3871       struct {
3872          struct LDKCVec_CResult_NoneAPIErrorZZ partial_failure;
3873       };
3874    };
3875 } LDKPaymentSendFailure;
3876
3877 /**
3878  * The contents of CResult_NonePaymentSendFailureZ
3879  */
3880 typedef union LDKCResult_NonePaymentSendFailureZPtr {
3881    /**
3882     * Note that this value is always NULL, as there are no contents in the OK variant
3883     */
3884    void *result;
3885    /**
3886     * A pointer to the contents in the error state.
3887     * Reading from this pointer when `result_ok` is set is undefined.
3888     */
3889    struct LDKPaymentSendFailure *err;
3890 } LDKCResult_NonePaymentSendFailureZPtr;
3891
3892 /**
3893  * A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
3894  * containing a () on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
3895  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3896  */
3897 typedef struct LDKCResult_NonePaymentSendFailureZ {
3898    /**
3899     * The contents of this CResult_NonePaymentSendFailureZ, accessible via either
3900     * `err` or `result` depending on the state of `result_ok`.
3901     */
3902    union LDKCResult_NonePaymentSendFailureZPtr contents;
3903    /**
3904     * Whether this CResult_NonePaymentSendFailureZ represents a success state.
3905     */
3906    bool result_ok;
3907 } LDKCResult_NonePaymentSendFailureZ;
3908
3909 /**
3910  * A 4-byte byte array.
3911  */
3912 typedef struct LDKFourBytes {
3913    /**
3914     * The four bytes
3915     */
3916    uint8_t data[4];
3917 } LDKFourBytes;
3918
3919 /**
3920  * A 16-byte byte array.
3921  */
3922 typedef struct LDKSixteenBytes {
3923    /**
3924     * The sixteen bytes
3925     */
3926    uint8_t data[16];
3927 } LDKSixteenBytes;
3928
3929 /**
3930  * A 10-byte byte array.
3931  */
3932 typedef struct LDKTenBytes {
3933    /**
3934     * The ten bytes
3935     */
3936    uint8_t data[10];
3937 } LDKTenBytes;
3938
3939 /**
3940  * An address which can be used to connect to a remote peer
3941  */
3942 typedef enum LDKNetAddress_Tag {
3943    /**
3944     * An IPv4 address/port on which the peer is listening.
3945     */
3946    LDKNetAddress_IPv4,
3947    /**
3948     * An IPv6 address/port on which the peer is listening.
3949     */
3950    LDKNetAddress_IPv6,
3951    /**
3952     * An old-style Tor onion address/port on which the peer is listening.
3953     */
3954    LDKNetAddress_OnionV2,
3955    /**
3956     * A new-style Tor onion address/port on which the peer is listening.
3957     * To create the human-readable \"hostname\", concatenate ed25519_pubkey, checksum, and version,
3958     * wrap as base32 and append \".onion\".
3959     */
3960    LDKNetAddress_OnionV3,
3961    /**
3962     * Must be last for serialization purposes
3963     */
3964    LDKNetAddress_Sentinel,
3965 } LDKNetAddress_Tag;
3966
3967 typedef struct LDKNetAddress_LDKIPv4_Body {
3968    /**
3969     * The 4-byte IPv4 address
3970     */
3971    struct LDKFourBytes addr;
3972    /**
3973     * The port on which the node is listening
3974     */
3975    uint16_t port;
3976 } LDKNetAddress_LDKIPv4_Body;
3977
3978 typedef struct LDKNetAddress_LDKIPv6_Body {
3979    /**
3980     * The 16-byte IPv6 address
3981     */
3982    struct LDKSixteenBytes addr;
3983    /**
3984     * The port on which the node is listening
3985     */
3986    uint16_t port;
3987 } LDKNetAddress_LDKIPv6_Body;
3988
3989 typedef struct LDKNetAddress_LDKOnionV2_Body {
3990    /**
3991     * The bytes (usually encoded in base32 with \".onion\" appended)
3992     */
3993    struct LDKTenBytes addr;
3994    /**
3995     * The port on which the node is listening
3996     */
3997    uint16_t port;
3998 } LDKNetAddress_LDKOnionV2_Body;
3999
4000 typedef struct LDKNetAddress_LDKOnionV3_Body {
4001    /**
4002     * The ed25519 long-term public key of the peer
4003     */
4004    struct LDKThirtyTwoBytes ed25519_pubkey;
4005    /**
4006     * The checksum of the pubkey and version, as included in the onion address
4007     */
4008    uint16_t checksum;
4009    /**
4010     * The version byte, as defined by the Tor Onion v3 spec.
4011     */
4012    uint8_t version;
4013    /**
4014     * The port on which the node is listening
4015     */
4016    uint16_t port;
4017 } LDKNetAddress_LDKOnionV3_Body;
4018
4019 typedef struct MUST_USE_STRUCT LDKNetAddress {
4020    LDKNetAddress_Tag tag;
4021    union {
4022       LDKNetAddress_LDKIPv4_Body i_pv4;
4023       LDKNetAddress_LDKIPv6_Body i_pv6;
4024       LDKNetAddress_LDKOnionV2_Body onion_v2;
4025       LDKNetAddress_LDKOnionV3_Body onion_v3;
4026    };
4027 } LDKNetAddress;
4028
4029 /**
4030  * A dynamically-allocated array of crate::lightning::ln::msgs::NetAddresss of arbitrary size.
4031  * This corresponds to std::vector in C++
4032  */
4033 typedef struct LDKCVec_NetAddressZ {
4034    /**
4035     * The elements in the array.
4036     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4037     */
4038    struct LDKNetAddress *data;
4039    /**
4040     * The number of elements pointed to by `data`.
4041     */
4042    uintptr_t datalen;
4043 } LDKCVec_NetAddressZ;
4044
4045 /**
4046  * A tuple of 2 elements. See the individual fields for the types contained.
4047  */
4048 typedef struct LDKC2Tuple_PaymentHashPaymentSecretZ {
4049    /**
4050     * The element at position 0
4051     */
4052    struct LDKThirtyTwoBytes a;
4053    /**
4054     * The element at position 1
4055     */
4056    struct LDKThirtyTwoBytes b;
4057 } LDKC2Tuple_PaymentHashPaymentSecretZ;
4058
4059 /**
4060  * The contents of CResult_PaymentSecretAPIErrorZ
4061  */
4062 typedef union LDKCResult_PaymentSecretAPIErrorZPtr {
4063    /**
4064     * A pointer to the contents in the success state.
4065     * Reading from this pointer when `result_ok` is not set is undefined.
4066     */
4067    struct LDKThirtyTwoBytes *result;
4068    /**
4069     * A pointer to the contents in the error state.
4070     * Reading from this pointer when `result_ok` is set is undefined.
4071     */
4072    struct LDKAPIError *err;
4073 } LDKCResult_PaymentSecretAPIErrorZPtr;
4074
4075 /**
4076  * A CResult_PaymentSecretAPIErrorZ represents the result of a fallible operation,
4077  * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
4078  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4079  */
4080 typedef struct LDKCResult_PaymentSecretAPIErrorZ {
4081    /**
4082     * The contents of this CResult_PaymentSecretAPIErrorZ, accessible via either
4083     * `err` or `result` depending on the state of `result_ok`.
4084     */
4085    union LDKCResult_PaymentSecretAPIErrorZPtr contents;
4086    /**
4087     * Whether this CResult_PaymentSecretAPIErrorZ represents a success state.
4088     */
4089    bool result_ok;
4090 } LDKCResult_PaymentSecretAPIErrorZ;
4091
4092 /**
4093  * A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
4094  * This corresponds to std::vector in C++
4095  */
4096 typedef struct LDKCVec_ChannelMonitorZ {
4097    /**
4098     * The elements in the array.
4099     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4100     */
4101    struct LDKChannelMonitor *data;
4102    /**
4103     * The number of elements pointed to by `data`.
4104     */
4105    uintptr_t datalen;
4106 } LDKCVec_ChannelMonitorZ;
4107
4108
4109
4110 /**
4111  * An update generated by the underlying Channel itself which contains some new information the
4112  * ChannelMonitor should be made aware of.
4113  */
4114 typedef struct MUST_USE_STRUCT LDKChannelMonitorUpdate {
4115    /**
4116     * A pointer to the opaque Rust object.
4117     * Nearly everywhere, inner must be non-null, however in places where
4118     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4119     */
4120    LDKnativeChannelMonitorUpdate *inner;
4121    /**
4122     * Indicates that this is the only struct which contains the same pointer.
4123     * Rust functions which take ownership of an object provided via an argument require
4124     * this to be true and invalidate the object pointed to by inner.
4125     */
4126    bool is_owned;
4127 } LDKChannelMonitorUpdate;
4128
4129 /**
4130  * The `Watch` trait defines behavior for watching on-chain activity pertaining to channels as
4131  * blocks are connected and disconnected.
4132  *
4133  * Each channel is associated with a [`ChannelMonitor`]. Implementations of this trait are
4134  * responsible for maintaining a set of monitors such that they can be updated accordingly as
4135  * channel state changes and HTLCs are resolved. See method documentation for specific
4136  * requirements.
4137  *
4138  * Implementations **must** ensure that updates are successfully applied and persisted upon method
4139  * completion. If an update fails with a [`PermanentFailure`], then it must immediately shut down
4140  * without taking any further action such as persisting the current state.
4141  *
4142  * If an implementation maintains multiple instances of a channel's monitor (e.g., by storing
4143  * backup copies), then it must ensure that updates are applied across all instances. Otherwise, it
4144  * could result in a revoked transaction being broadcast, allowing the counterparty to claim all
4145  * funds in the channel. See [`ChannelMonitorUpdateErr`] for more details about how to handle
4146  * multiple instances.
4147  *
4148  * [`ChannelMonitor`]: channelmonitor::ChannelMonitor
4149  * [`ChannelMonitorUpdateErr`]: channelmonitor::ChannelMonitorUpdateErr
4150  * [`PermanentFailure`]: channelmonitor::ChannelMonitorUpdateErr::PermanentFailure
4151  */
4152 typedef struct LDKWatch {
4153    /**
4154     * An opaque pointer which is passed to your function implementations as an argument.
4155     * This has no meaning in the LDK, and can be NULL or any other value.
4156     */
4157    void *this_arg;
4158    /**
4159     * Watches a channel identified by `funding_txo` using `monitor`.
4160     *
4161     * Implementations are responsible for watching the chain for the funding transaction along
4162     * with any spends of outputs returned by [`get_outputs_to_watch`]. In practice, this means
4163     * calling [`block_connected`] and [`block_disconnected`] on the monitor.
4164     *
4165     * [`get_outputs_to_watch`]: channelmonitor::ChannelMonitor::get_outputs_to_watch
4166     * [`block_connected`]: channelmonitor::ChannelMonitor::block_connected
4167     * [`block_disconnected`]: channelmonitor::ChannelMonitor::block_disconnected
4168     */
4169    struct LDKCResult_NoneChannelMonitorUpdateErrZ (*watch_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitor monitor);
4170    /**
4171     * Updates a channel identified by `funding_txo` by applying `update` to its monitor.
4172     *
4173     * Implementations must call [`update_monitor`] with the given update. See
4174     * [`ChannelMonitorUpdateErr`] for invariants around returning an error.
4175     *
4176     * [`update_monitor`]: channelmonitor::ChannelMonitor::update_monitor
4177     * [`ChannelMonitorUpdateErr`]: channelmonitor::ChannelMonitorUpdateErr
4178     */
4179    struct LDKCResult_NoneChannelMonitorUpdateErrZ (*update_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitorUpdate update);
4180    /**
4181     * Returns any monitor events since the last call. Subsequent calls must only return new
4182     * events.
4183     */
4184    struct LDKCVec_MonitorEventZ (*release_pending_monitor_events)(const void *this_arg);
4185    /**
4186     * Frees any resources associated with this object given its this_arg pointer.
4187     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
4188     */
4189    void (*free)(void *this_arg);
4190 } LDKWatch;
4191
4192 /**
4193  * An interface to send a transaction to the Bitcoin network.
4194  */
4195 typedef struct LDKBroadcasterInterface {
4196    /**
4197     * An opaque pointer which is passed to your function implementations as an argument.
4198     * This has no meaning in the LDK, and can be NULL or any other value.
4199     */
4200    void *this_arg;
4201    /**
4202     * Sends a transaction out to (hopefully) be mined.
4203     */
4204    void (*broadcast_transaction)(const void *this_arg, struct LDKTransaction tx);
4205    /**
4206     * Frees any resources associated with this object given its this_arg pointer.
4207     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
4208     */
4209    void (*free)(void *this_arg);
4210 } LDKBroadcasterInterface;
4211
4212 /**
4213  * A "slice" referencing some byte array. This is simply a length-tagged pointer which does not
4214  * own the memory pointed to by data.
4215  */
4216 typedef struct LDKu8slice {
4217    /**
4218     * A pointer to the byte buffer
4219     */
4220    const uint8_t *data;
4221    /**
4222     * The number of bytes pointed to by `data`.
4223     */
4224    uintptr_t datalen;
4225 } LDKu8slice;
4226
4227 /**
4228  * A trait to describe an object which can get user secrets and key material.
4229  */
4230 typedef struct LDKKeysInterface {
4231    /**
4232     * An opaque pointer which is passed to your function implementations as an argument.
4233     * This has no meaning in the LDK, and can be NULL or any other value.
4234     */
4235    void *this_arg;
4236    /**
4237     * Get node secret key (aka node_id or network_key).
4238     *
4239     * This method must return the same value each time it is called.
4240     */
4241    struct LDKSecretKey (*get_node_secret)(const void *this_arg);
4242    /**
4243     * Get a script pubkey which we send funds to when claiming on-chain contestable outputs.
4244     *
4245     * This method should return a different value each time it is called, to avoid linking
4246     * on-chain funds across channels as controlled to the same user.
4247     */
4248    struct LDKCVec_u8Z (*get_destination_script)(const void *this_arg);
4249    /**
4250     * Get a public key which we will send funds to (in the form of a P2WPKH output) when closing
4251     * a channel.
4252     *
4253     * This method should return a different value each time it is called, to avoid linking
4254     * on-chain funds across channels as controlled to the same user.
4255     */
4256    struct LDKPublicKey (*get_shutdown_pubkey)(const void *this_arg);
4257    /**
4258     * Get a new set of Sign for per-channel secrets. These MUST be unique even if you
4259     * restarted with some stale data!
4260     *
4261     * This method must return a different value each time it is called.
4262     */
4263    struct LDKSign (*get_channel_signer)(const void *this_arg, bool inbound, uint64_t channel_value_satoshis);
4264    /**
4265     * Gets a unique, cryptographically-secure, random 32 byte value. This is used for encrypting
4266     * onion packets and for temporary channel IDs. There is no requirement that these be
4267     * persisted anywhere, though they must be unique across restarts.
4268     *
4269     * This method must return a different value each time it is called.
4270     */
4271    struct LDKThirtyTwoBytes (*get_secure_random_bytes)(const void *this_arg);
4272    /**
4273     * Reads a `Signer` for this `KeysInterface` from the given input stream.
4274     * This is only called during deserialization of other objects which contain
4275     * `Sign`-implementing objects (ie `ChannelMonitor`s and `ChannelManager`s).
4276     * The bytes are exactly those which `<Self::Signer as Writeable>::write()` writes, and
4277     * contain no versioning scheme. You may wish to include your own version prefix and ensure
4278     * you've read all of the provided bytes to ensure no corruption occurred.
4279     */
4280    struct LDKCResult_SignDecodeErrorZ (*read_chan_signer)(const void *this_arg, struct LDKu8slice reader);
4281    /**
4282     * Sign an invoice's preimage (note that this is the preimage of the invoice, not the HTLC's
4283     * preimage). By parameterizing by the preimage instead of the hash, we allow implementors of
4284     * this trait to parse the invoice and make sure they're signing what they expect, rather than
4285     * blindly signing the hash.
4286     */
4287    struct LDKCResult_RecoverableSignatureNoneZ (*sign_invoice)(const void *this_arg, struct LDKCVec_u8Z invoice_preimage);
4288    /**
4289     * Frees any resources associated with this object given its this_arg pointer.
4290     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
4291     */
4292    void (*free)(void *this_arg);
4293 } LDKKeysInterface;
4294
4295 /**
4296  * A trait which should be implemented to provide feerate information on a number of time
4297  * horizons.
4298  *
4299  * Note that all of the functions implemented here *must* be reentrant-safe (obviously - they're
4300  * called from inside the library in response to chain events, P2P events, or timer events).
4301  */
4302 typedef struct LDKFeeEstimator {
4303    /**
4304     * An opaque pointer which is passed to your function implementations as an argument.
4305     * This has no meaning in the LDK, and can be NULL or any other value.
4306     */
4307    void *this_arg;
4308    /**
4309     * Gets estimated satoshis of fee required per 1000 Weight-Units.
4310     *
4311     * Must be no smaller than 253 (ie 1 satoshi-per-byte rounded up to ensure later round-downs
4312     * don't put us below 1 satoshi-per-byte).
4313     *
4314     * This translates to:
4315     *  * satoshis-per-byte * 250
4316     *  * ceil(satoshis-per-kbyte / 4)
4317     */
4318    uint32_t (*get_est_sat_per_1000_weight)(const void *this_arg, enum LDKConfirmationTarget confirmation_target);
4319    /**
4320     * Frees any resources associated with this object given its this_arg pointer.
4321     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
4322     */
4323    void (*free)(void *this_arg);
4324 } LDKFeeEstimator;
4325
4326 /**
4327  * A trait encapsulating the operations required of a logger
4328  */
4329 typedef struct LDKLogger {
4330    /**
4331     * An opaque pointer which is passed to your function implementations as an argument.
4332     * This has no meaning in the LDK, and can be NULL or any other value.
4333     */
4334    void *this_arg;
4335    /**
4336     * Logs the `Record`
4337     */
4338    void (*log)(const void *this_arg, const char *record);
4339    /**
4340     * Frees any resources associated with this object given its this_arg pointer.
4341     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
4342     */
4343    void (*free)(void *this_arg);
4344 } LDKLogger;
4345
4346
4347
4348 /**
4349  * Manager which keeps track of a number of channels and sends messages to the appropriate
4350  * channel, also tracking HTLC preimages and forwarding onion packets appropriately.
4351  *
4352  * Implements ChannelMessageHandler, handling the multi-channel parts and passing things through
4353  * to individual Channels.
4354  *
4355  * Implements Writeable to write out all channel state to disk. Implies peer_disconnected() for
4356  * all peers during write/read (though does not modify this instance, only the instance being
4357  * serialized). This will result in any channels which have not yet exchanged funding_created (ie
4358  * called funding_transaction_generated for outbound channels).
4359  *
4360  * Note that you can be a bit lazier about writing out ChannelManager than you can be with
4361  * ChannelMonitors. With ChannelMonitors you MUST write each monitor update out to disk before
4362  * returning from chain::Watch::watch_/update_channel, with ChannelManagers, writing updates
4363  * happens out-of-band (and will prevent any other ChannelManager operations from occurring during
4364  * the serialization process). If the deserialized version is out-of-date compared to the
4365  * ChannelMonitors passed by reference to read(), those channels will be force-closed based on the
4366  * ChannelMonitor state and no funds will be lost (mod on-chain transaction fees).
4367  *
4368  * Note that the deserializer is only implemented for (BlockHash, ChannelManager), which
4369  * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along
4370  * the \"reorg path\" (ie call block_disconnected() until you get to a common block and then call
4371  * block_connected() to step towards your best block) upon deserialization before using the
4372  * object!
4373  *
4374  * Note that ChannelManager is responsible for tracking liveness of its channels and generating
4375  * ChannelUpdate messages informing peers that the channel is temporarily disabled. To avoid
4376  * spam due to quick disconnection/reconnection, updates are not sent until the channel has been
4377  * offline for a full minute. In order to track this, you must call
4378  * timer_tick_occurred roughly once per minute, though it doesn't have to be perfect.
4379  *
4380  * Rather than using a plain ChannelManager, it is preferable to use either a SimpleArcChannelManager
4381  * a SimpleRefChannelManager, for conciseness. See their documentation for more details, but
4382  * essentially you should default to using a SimpleRefChannelManager, and use a
4383  * SimpleArcChannelManager when you require a ChannelManager with a static lifetime, such as when
4384  * you're using lightning-net-tokio.
4385  */
4386 typedef struct MUST_USE_STRUCT LDKChannelManager {
4387    /**
4388     * A pointer to the opaque Rust object.
4389     * Nearly everywhere, inner must be non-null, however in places where
4390     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4391     */
4392    LDKnativeChannelManager *inner;
4393    /**
4394     * Indicates that this is the only struct which contains the same pointer.
4395     * Rust functions which take ownership of an object provided via an argument require
4396     * this to be true and invalidate the object pointed to by inner.
4397     */
4398    bool is_owned;
4399 } LDKChannelManager;
4400
4401 /**
4402  * A tuple of 2 elements. See the individual fields for the types contained.
4403  */
4404 typedef struct LDKC2Tuple_BlockHashChannelManagerZ {
4405    /**
4406     * The element at position 0
4407     */
4408    struct LDKThirtyTwoBytes a;
4409    /**
4410     * The element at position 1
4411     */
4412    struct LDKChannelManager b;
4413 } LDKC2Tuple_BlockHashChannelManagerZ;
4414
4415 /**
4416  * The contents of CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ
4417  */
4418 typedef union LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
4419    /**
4420     * A pointer to the contents in the success state.
4421     * Reading from this pointer when `result_ok` is not set is undefined.
4422     */
4423    struct LDKC2Tuple_BlockHashChannelManagerZ *result;
4424    /**
4425     * A pointer to the contents in the error state.
4426     * Reading from this pointer when `result_ok` is set is undefined.
4427     */
4428    struct LDKDecodeError *err;
4429 } LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr;
4430
4431 /**
4432  * A CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents the result of a fallible operation,
4433  * containing a crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
4434  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4435  */
4436 typedef struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
4437    /**
4438     * The contents of this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ, accessible via either
4439     * `err` or `result` depending on the state of `result_ok`.
4440     */
4441    union LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr contents;
4442    /**
4443     * Whether this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents a success state.
4444     */
4445    bool result_ok;
4446 } LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ;
4447
4448
4449
4450 /**
4451  * Options which apply on a per-channel basis and may change at runtime or based on negotiation
4452  * with our counterparty.
4453  */
4454 typedef struct MUST_USE_STRUCT LDKChannelConfig {
4455    /**
4456     * A pointer to the opaque Rust object.
4457     * Nearly everywhere, inner must be non-null, however in places where
4458     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4459     */
4460    LDKnativeChannelConfig *inner;
4461    /**
4462     * Indicates that this is the only struct which contains the same pointer.
4463     * Rust functions which take ownership of an object provided via an argument require
4464     * this to be true and invalidate the object pointed to by inner.
4465     */
4466    bool is_owned;
4467 } LDKChannelConfig;
4468
4469 /**
4470  * The contents of CResult_ChannelConfigDecodeErrorZ
4471  */
4472 typedef union LDKCResult_ChannelConfigDecodeErrorZPtr {
4473    /**
4474     * A pointer to the contents in the success state.
4475     * Reading from this pointer when `result_ok` is not set is undefined.
4476     */
4477    struct LDKChannelConfig *result;
4478    /**
4479     * A pointer to the contents in the error state.
4480     * Reading from this pointer when `result_ok` is set is undefined.
4481     */
4482    struct LDKDecodeError *err;
4483 } LDKCResult_ChannelConfigDecodeErrorZPtr;
4484
4485 /**
4486  * A CResult_ChannelConfigDecodeErrorZ represents the result of a fallible operation,
4487  * containing a crate::lightning::util::config::ChannelConfig on success and a crate::lightning::ln::msgs::DecodeError on failure.
4488  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4489  */
4490 typedef struct LDKCResult_ChannelConfigDecodeErrorZ {
4491    /**
4492     * The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either
4493     * `err` or `result` depending on the state of `result_ok`.
4494     */
4495    union LDKCResult_ChannelConfigDecodeErrorZPtr contents;
4496    /**
4497     * Whether this CResult_ChannelConfigDecodeErrorZ represents a success state.
4498     */
4499    bool result_ok;
4500 } LDKCResult_ChannelConfigDecodeErrorZ;
4501
4502 /**
4503  * The contents of CResult_OutPointDecodeErrorZ
4504  */
4505 typedef union LDKCResult_OutPointDecodeErrorZPtr {
4506    /**
4507     * A pointer to the contents in the success state.
4508     * Reading from this pointer when `result_ok` is not set is undefined.
4509     */
4510    struct LDKOutPoint *result;
4511    /**
4512     * A pointer to the contents in the error state.
4513     * Reading from this pointer when `result_ok` is set is undefined.
4514     */
4515    struct LDKDecodeError *err;
4516 } LDKCResult_OutPointDecodeErrorZPtr;
4517
4518 /**
4519  * A CResult_OutPointDecodeErrorZ represents the result of a fallible operation,
4520  * containing a crate::lightning::chain::transaction::OutPoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
4521  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4522  */
4523 typedef struct LDKCResult_OutPointDecodeErrorZ {
4524    /**
4525     * The contents of this CResult_OutPointDecodeErrorZ, accessible via either
4526     * `err` or `result` depending on the state of `result_ok`.
4527     */
4528    union LDKCResult_OutPointDecodeErrorZPtr contents;
4529    /**
4530     * Whether this CResult_OutPointDecodeErrorZ represents a success state.
4531     */
4532    bool result_ok;
4533 } LDKCResult_OutPointDecodeErrorZ;
4534
4535 /**
4536  * The contents of CResult_SiPrefixNoneZ
4537  */
4538 typedef union LDKCResult_SiPrefixNoneZPtr {
4539    /**
4540     * A pointer to the contents in the success state.
4541     * Reading from this pointer when `result_ok` is not set is undefined.
4542     */
4543    enum LDKSiPrefix *result;
4544    /**
4545     * Note that this value is always NULL, as there are no contents in the Err variant
4546     */
4547    void *err;
4548 } LDKCResult_SiPrefixNoneZPtr;
4549
4550 /**
4551  * A CResult_SiPrefixNoneZ represents the result of a fallible operation,
4552  * containing a crate::lightning_invoice::SiPrefix on success and a () on failure.
4553  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4554  */
4555 typedef struct LDKCResult_SiPrefixNoneZ {
4556    /**
4557     * The contents of this CResult_SiPrefixNoneZ, accessible via either
4558     * `err` or `result` depending on the state of `result_ok`.
4559     */
4560    union LDKCResult_SiPrefixNoneZPtr contents;
4561    /**
4562     * Whether this CResult_SiPrefixNoneZ represents a success state.
4563     */
4564    bool result_ok;
4565 } LDKCResult_SiPrefixNoneZ;
4566
4567
4568
4569 /**
4570  * Represents a syntactically and semantically correct lightning BOLT11 invoice.
4571  *
4572  * There are three ways to construct an `Invoice`:
4573  *  1. using `InvoiceBuilder`
4574  *  2. using `Invoice::from_signed(SignedRawInvoice)`
4575  *  3. using `str::parse::<Invoice>(&str)`
4576  */
4577 typedef struct MUST_USE_STRUCT LDKInvoice {
4578    /**
4579     * A pointer to the opaque Rust object.
4580     * Nearly everywhere, inner must be non-null, however in places where
4581     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4582     */
4583    LDKnativeInvoice *inner;
4584    /**
4585     * Indicates that this is the only struct which contains the same pointer.
4586     * Rust functions which take ownership of an object provided via an argument require
4587     * this to be true and invalidate the object pointed to by inner.
4588     */
4589    bool is_owned;
4590 } LDKInvoice;
4591
4592 /**
4593  * The contents of CResult_InvoiceNoneZ
4594  */
4595 typedef union LDKCResult_InvoiceNoneZPtr {
4596    /**
4597     * A pointer to the contents in the success state.
4598     * Reading from this pointer when `result_ok` is not set is undefined.
4599     */
4600    struct LDKInvoice *result;
4601    /**
4602     * Note that this value is always NULL, as there are no contents in the Err variant
4603     */
4604    void *err;
4605 } LDKCResult_InvoiceNoneZPtr;
4606
4607 /**
4608  * A CResult_InvoiceNoneZ represents the result of a fallible operation,
4609  * containing a crate::lightning_invoice::Invoice on success and a () on failure.
4610  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4611  */
4612 typedef struct LDKCResult_InvoiceNoneZ {
4613    /**
4614     * The contents of this CResult_InvoiceNoneZ, accessible via either
4615     * `err` or `result` depending on the state of `result_ok`.
4616     */
4617    union LDKCResult_InvoiceNoneZPtr contents;
4618    /**
4619     * Whether this CResult_InvoiceNoneZ represents a success state.
4620     */
4621    bool result_ok;
4622 } LDKCResult_InvoiceNoneZ;
4623
4624
4625
4626 /**
4627  * Represents a signed `RawInvoice` with cached hash. The signature is not checked and may be
4628  * invalid.
4629  *
4630  * # Invariants
4631  * The hash has to be either from the deserialized invoice or from the serialized `raw_invoice`.
4632  */
4633 typedef struct MUST_USE_STRUCT LDKSignedRawInvoice {
4634    /**
4635     * A pointer to the opaque Rust object.
4636     * Nearly everywhere, inner must be non-null, however in places where
4637     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4638     */
4639    LDKnativeSignedRawInvoice *inner;
4640    /**
4641     * Indicates that this is the only struct which contains the same pointer.
4642     * Rust functions which take ownership of an object provided via an argument require
4643     * this to be true and invalidate the object pointed to by inner.
4644     */
4645    bool is_owned;
4646 } LDKSignedRawInvoice;
4647
4648 /**
4649  * The contents of CResult_SignedRawInvoiceNoneZ
4650  */
4651 typedef union LDKCResult_SignedRawInvoiceNoneZPtr {
4652    /**
4653     * A pointer to the contents in the success state.
4654     * Reading from this pointer when `result_ok` is not set is undefined.
4655     */
4656    struct LDKSignedRawInvoice *result;
4657    /**
4658     * Note that this value is always NULL, as there are no contents in the Err variant
4659     */
4660    void *err;
4661 } LDKCResult_SignedRawInvoiceNoneZPtr;
4662
4663 /**
4664  * A CResult_SignedRawInvoiceNoneZ represents the result of a fallible operation,
4665  * containing a crate::lightning_invoice::SignedRawInvoice on success and a () on failure.
4666  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4667  */
4668 typedef struct LDKCResult_SignedRawInvoiceNoneZ {
4669    /**
4670     * The contents of this CResult_SignedRawInvoiceNoneZ, accessible via either
4671     * `err` or `result` depending on the state of `result_ok`.
4672     */
4673    union LDKCResult_SignedRawInvoiceNoneZPtr contents;
4674    /**
4675     * Whether this CResult_SignedRawInvoiceNoneZ represents a success state.
4676     */
4677    bool result_ok;
4678 } LDKCResult_SignedRawInvoiceNoneZ;
4679
4680
4681
4682 /**
4683  * Represents an syntactically correct Invoice for a payment on the lightning network,
4684  * but without the signature information.
4685  * De- and encoding should not lead to information loss but may lead to different hashes.
4686  *
4687  * For methods without docs see the corresponding methods in `Invoice`.
4688  */
4689 typedef struct MUST_USE_STRUCT LDKRawInvoice {
4690    /**
4691     * A pointer to the opaque Rust object.
4692     * Nearly everywhere, inner must be non-null, however in places where
4693     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4694     */
4695    LDKnativeRawInvoice *inner;
4696    /**
4697     * Indicates that this is the only struct which contains the same pointer.
4698     * Rust functions which take ownership of an object provided via an argument require
4699     * this to be true and invalidate the object pointed to by inner.
4700     */
4701    bool is_owned;
4702 } LDKRawInvoice;
4703
4704
4705
4706 /**
4707  * Recoverable signature
4708  */
4709 typedef struct MUST_USE_STRUCT LDKInvoiceSignature {
4710    /**
4711     * A pointer to the opaque Rust object.
4712     * Nearly everywhere, inner must be non-null, however in places where
4713     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4714     */
4715    LDKnativeInvoiceSignature *inner;
4716    /**
4717     * Indicates that this is the only struct which contains the same pointer.
4718     * Rust functions which take ownership of an object provided via an argument require
4719     * this to be true and invalidate the object pointed to by inner.
4720     */
4721    bool is_owned;
4722 } LDKInvoiceSignature;
4723
4724 /**
4725  * A tuple of 3 elements. See the individual fields for the types contained.
4726  */
4727 typedef struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ {
4728    /**
4729     * The element at position 0
4730     */
4731    struct LDKRawInvoice a;
4732    /**
4733     * The element at position 1
4734     */
4735    struct LDKThirtyTwoBytes b;
4736    /**
4737     * The element at position 2
4738     */
4739    struct LDKInvoiceSignature c;
4740 } LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ;
4741
4742
4743
4744 /**
4745  * Payee public key
4746  */
4747 typedef struct MUST_USE_STRUCT LDKPayeePubKey {
4748    /**
4749     * A pointer to the opaque Rust object.
4750     * Nearly everywhere, inner must be non-null, however in places where
4751     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4752     */
4753    LDKnativePayeePubKey *inner;
4754    /**
4755     * Indicates that this is the only struct which contains the same pointer.
4756     * Rust functions which take ownership of an object provided via an argument require
4757     * this to be true and invalidate the object pointed to by inner.
4758     */
4759    bool is_owned;
4760 } LDKPayeePubKey;
4761
4762 /**
4763  * The contents of CResult_PayeePubKeyErrorZ
4764  */
4765 typedef union LDKCResult_PayeePubKeyErrorZPtr {
4766    /**
4767     * A pointer to the contents in the success state.
4768     * Reading from this pointer when `result_ok` is not set is undefined.
4769     */
4770    struct LDKPayeePubKey *result;
4771    /**
4772     * A pointer to the contents in the error state.
4773     * Reading from this pointer when `result_ok` is set is undefined.
4774     */
4775    enum LDKSecp256k1Error *err;
4776 } LDKCResult_PayeePubKeyErrorZPtr;
4777
4778 /**
4779  * A CResult_PayeePubKeyErrorZ represents the result of a fallible operation,
4780  * containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure.
4781  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4782  */
4783 typedef struct LDKCResult_PayeePubKeyErrorZ {
4784    /**
4785     * The contents of this CResult_PayeePubKeyErrorZ, accessible via either
4786     * `err` or `result` depending on the state of `result_ok`.
4787     */
4788    union LDKCResult_PayeePubKeyErrorZPtr contents;
4789    /**
4790     * Whether this CResult_PayeePubKeyErrorZ represents a success state.
4791     */
4792    bool result_ok;
4793 } LDKCResult_PayeePubKeyErrorZ;
4794
4795
4796
4797 /**
4798  * Private routing information
4799  *
4800  * # Invariants
4801  * The encoded route has to be <1024 5bit characters long (<=639 bytes or <=12 hops)
4802  *
4803  */
4804 typedef struct MUST_USE_STRUCT LDKRouteHint {
4805    /**
4806     * A pointer to the opaque Rust object.
4807     * Nearly everywhere, inner must be non-null, however in places where
4808     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4809     */
4810    LDKnativeRouteHint *inner;
4811    /**
4812     * Indicates that this is the only struct which contains the same pointer.
4813     * Rust functions which take ownership of an object provided via an argument require
4814     * this to be true and invalidate the object pointed to by inner.
4815     */
4816    bool is_owned;
4817 } LDKRouteHint;
4818
4819 /**
4820  * A dynamically-allocated array of crate::lightning_invoice::RouteHints of arbitrary size.
4821  * This corresponds to std::vector in C++
4822  */
4823 typedef struct LDKCVec_RouteHintZ {
4824    /**
4825     * The elements in the array.
4826     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4827     */
4828    struct LDKRouteHint *data;
4829    /**
4830     * The number of elements pointed to by `data`.
4831     */
4832    uintptr_t datalen;
4833 } LDKCVec_RouteHintZ;
4834
4835
4836
4837 /**
4838  * A timestamp that refers to a date after 1 January 1970 which means its representation as UNIX
4839  * timestamp is positive.
4840  *
4841  * # Invariants
4842  * The UNIX timestamp representing the stored time has to be positive and small enough so that
4843  * a `EpiryTime` can be added to it without an overflow.
4844  */
4845 typedef struct MUST_USE_STRUCT LDKPositiveTimestamp {
4846    /**
4847     * A pointer to the opaque Rust object.
4848     * Nearly everywhere, inner must be non-null, however in places where
4849     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4850     */
4851    LDKnativePositiveTimestamp *inner;
4852    /**
4853     * Indicates that this is the only struct which contains the same pointer.
4854     * Rust functions which take ownership of an object provided via an argument require
4855     * this to be true and invalidate the object pointed to by inner.
4856     */
4857    bool is_owned;
4858 } LDKPositiveTimestamp;
4859
4860 /**
4861  * The contents of CResult_PositiveTimestampCreationErrorZ
4862  */
4863 typedef union LDKCResult_PositiveTimestampCreationErrorZPtr {
4864    /**
4865     * A pointer to the contents in the success state.
4866     * Reading from this pointer when `result_ok` is not set is undefined.
4867     */
4868    struct LDKPositiveTimestamp *result;
4869    /**
4870     * A pointer to the contents in the error state.
4871     * Reading from this pointer when `result_ok` is set is undefined.
4872     */
4873    enum LDKCreationError *err;
4874 } LDKCResult_PositiveTimestampCreationErrorZPtr;
4875
4876 /**
4877  * A CResult_PositiveTimestampCreationErrorZ represents the result of a fallible operation,
4878  * containing a crate::lightning_invoice::PositiveTimestamp on success and a crate::lightning_invoice::CreationError on failure.
4879  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4880  */
4881 typedef struct LDKCResult_PositiveTimestampCreationErrorZ {
4882    /**
4883     * The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either
4884     * `err` or `result` depending on the state of `result_ok`.
4885     */
4886    union LDKCResult_PositiveTimestampCreationErrorZPtr contents;
4887    /**
4888     * Whether this CResult_PositiveTimestampCreationErrorZ represents a success state.
4889     */
4890    bool result_ok;
4891 } LDKCResult_PositiveTimestampCreationErrorZ;
4892
4893 /**
4894  * The contents of CResult_NoneSemanticErrorZ
4895  */
4896 typedef union LDKCResult_NoneSemanticErrorZPtr {
4897    /**
4898     * Note that this value is always NULL, as there are no contents in the OK variant
4899     */
4900    void *result;
4901    /**
4902     * A pointer to the contents in the error state.
4903     * Reading from this pointer when `result_ok` is set is undefined.
4904     */
4905    enum LDKSemanticError *err;
4906 } LDKCResult_NoneSemanticErrorZPtr;
4907
4908 /**
4909  * A CResult_NoneSemanticErrorZ represents the result of a fallible operation,
4910  * containing a () on success and a crate::lightning_invoice::SemanticError on failure.
4911  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4912  */
4913 typedef struct LDKCResult_NoneSemanticErrorZ {
4914    /**
4915     * The contents of this CResult_NoneSemanticErrorZ, accessible via either
4916     * `err` or `result` depending on the state of `result_ok`.
4917     */
4918    union LDKCResult_NoneSemanticErrorZPtr contents;
4919    /**
4920     * Whether this CResult_NoneSemanticErrorZ represents a success state.
4921     */
4922    bool result_ok;
4923 } LDKCResult_NoneSemanticErrorZ;
4924
4925 /**
4926  * The contents of CResult_InvoiceSemanticErrorZ
4927  */
4928 typedef union LDKCResult_InvoiceSemanticErrorZPtr {
4929    /**
4930     * A pointer to the contents in the success state.
4931     * Reading from this pointer when `result_ok` is not set is undefined.
4932     */
4933    struct LDKInvoice *result;
4934    /**
4935     * A pointer to the contents in the error state.
4936     * Reading from this pointer when `result_ok` is set is undefined.
4937     */
4938    enum LDKSemanticError *err;
4939 } LDKCResult_InvoiceSemanticErrorZPtr;
4940
4941 /**
4942  * A CResult_InvoiceSemanticErrorZ represents the result of a fallible operation,
4943  * containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SemanticError on failure.
4944  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4945  */
4946 typedef struct LDKCResult_InvoiceSemanticErrorZ {
4947    /**
4948     * The contents of this CResult_InvoiceSemanticErrorZ, accessible via either
4949     * `err` or `result` depending on the state of `result_ok`.
4950     */
4951    union LDKCResult_InvoiceSemanticErrorZPtr contents;
4952    /**
4953     * Whether this CResult_InvoiceSemanticErrorZ represents a success state.
4954     */
4955    bool result_ok;
4956 } LDKCResult_InvoiceSemanticErrorZ;
4957
4958
4959
4960 /**
4961  * Description string
4962  *
4963  * # Invariants
4964  * The description can be at most 639 __bytes__ long
4965  */
4966 typedef struct MUST_USE_STRUCT LDKDescription {
4967    /**
4968     * A pointer to the opaque Rust object.
4969     * Nearly everywhere, inner must be non-null, however in places where
4970     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4971     */
4972    LDKnativeDescription *inner;
4973    /**
4974     * Indicates that this is the only struct which contains the same pointer.
4975     * Rust functions which take ownership of an object provided via an argument require
4976     * this to be true and invalidate the object pointed to by inner.
4977     */
4978    bool is_owned;
4979 } LDKDescription;
4980
4981 /**
4982  * The contents of CResult_DescriptionCreationErrorZ
4983  */
4984 typedef union LDKCResult_DescriptionCreationErrorZPtr {
4985    /**
4986     * A pointer to the contents in the success state.
4987     * Reading from this pointer when `result_ok` is not set is undefined.
4988     */
4989    struct LDKDescription *result;
4990    /**
4991     * A pointer to the contents in the error state.
4992     * Reading from this pointer when `result_ok` is set is undefined.
4993     */
4994    enum LDKCreationError *err;
4995 } LDKCResult_DescriptionCreationErrorZPtr;
4996
4997 /**
4998  * A CResult_DescriptionCreationErrorZ represents the result of a fallible operation,
4999  * containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure.
5000  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5001  */
5002 typedef struct LDKCResult_DescriptionCreationErrorZ {
5003    /**
5004     * The contents of this CResult_DescriptionCreationErrorZ, accessible via either
5005     * `err` or `result` depending on the state of `result_ok`.
5006     */
5007    union LDKCResult_DescriptionCreationErrorZPtr contents;
5008    /**
5009     * Whether this CResult_DescriptionCreationErrorZ represents a success state.
5010     */
5011    bool result_ok;
5012 } LDKCResult_DescriptionCreationErrorZ;
5013
5014
5015
5016 /**
5017  * Positive duration that defines when (relatively to the timestamp) in the future the invoice
5018  * expires
5019  *
5020  * # Invariants
5021  * The number of seconds this expiry time represents has to be in the range
5022  * `0...(SYSTEM_TIME_MAX_UNIX_TIMESTAMP - MAX_EXPIRY_TIME)` to avoid overflows when adding it to a
5023  * timestamp
5024  */
5025 typedef struct MUST_USE_STRUCT LDKExpiryTime {
5026    /**
5027     * A pointer to the opaque Rust object.
5028     * Nearly everywhere, inner must be non-null, however in places where
5029     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5030     */
5031    LDKnativeExpiryTime *inner;
5032    /**
5033     * Indicates that this is the only struct which contains the same pointer.
5034     * Rust functions which take ownership of an object provided via an argument require
5035     * this to be true and invalidate the object pointed to by inner.
5036     */
5037    bool is_owned;
5038 } LDKExpiryTime;
5039
5040 /**
5041  * The contents of CResult_ExpiryTimeCreationErrorZ
5042  */
5043 typedef union LDKCResult_ExpiryTimeCreationErrorZPtr {
5044    /**
5045     * A pointer to the contents in the success state.
5046     * Reading from this pointer when `result_ok` is not set is undefined.
5047     */
5048    struct LDKExpiryTime *result;
5049    /**
5050     * A pointer to the contents in the error state.
5051     * Reading from this pointer when `result_ok` is set is undefined.
5052     */
5053    enum LDKCreationError *err;
5054 } LDKCResult_ExpiryTimeCreationErrorZPtr;
5055
5056 /**
5057  * A CResult_ExpiryTimeCreationErrorZ represents the result of a fallible operation,
5058  * containing a crate::lightning_invoice::ExpiryTime on success and a crate::lightning_invoice::CreationError on failure.
5059  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5060  */
5061 typedef struct LDKCResult_ExpiryTimeCreationErrorZ {
5062    /**
5063     * The contents of this CResult_ExpiryTimeCreationErrorZ, accessible via either
5064     * `err` or `result` depending on the state of `result_ok`.
5065     */
5066    union LDKCResult_ExpiryTimeCreationErrorZPtr contents;
5067    /**
5068     * Whether this CResult_ExpiryTimeCreationErrorZ represents a success state.
5069     */
5070    bool result_ok;
5071 } LDKCResult_ExpiryTimeCreationErrorZ;
5072
5073 /**
5074  * The contents of CResult_RouteHintCreationErrorZ
5075  */
5076 typedef union LDKCResult_RouteHintCreationErrorZPtr {
5077    /**
5078     * A pointer to the contents in the success state.
5079     * Reading from this pointer when `result_ok` is not set is undefined.
5080     */
5081    struct LDKRouteHint *result;
5082    /**
5083     * A pointer to the contents in the error state.
5084     * Reading from this pointer when `result_ok` is set is undefined.
5085     */
5086    enum LDKCreationError *err;
5087 } LDKCResult_RouteHintCreationErrorZPtr;
5088
5089 /**
5090  * A CResult_RouteHintCreationErrorZ represents the result of a fallible operation,
5091  * containing a crate::lightning_invoice::RouteHint on success and a crate::lightning_invoice::CreationError on failure.
5092  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5093  */
5094 typedef struct LDKCResult_RouteHintCreationErrorZ {
5095    /**
5096     * The contents of this CResult_RouteHintCreationErrorZ, accessible via either
5097     * `err` or `result` depending on the state of `result_ok`.
5098     */
5099    union LDKCResult_RouteHintCreationErrorZPtr contents;
5100    /**
5101     * Whether this CResult_RouteHintCreationErrorZ represents a success state.
5102     */
5103    bool result_ok;
5104 } LDKCResult_RouteHintCreationErrorZ;
5105
5106 /**
5107  * The contents of CResult_StringErrorZ
5108  */
5109 typedef union LDKCResult_StringErrorZPtr {
5110    /**
5111     * A pointer to the contents in the success state.
5112     * Reading from this pointer when `result_ok` is not set is undefined.
5113     */
5114    struct LDKStr *result;
5115    /**
5116     * A pointer to the contents in the error state.
5117     * Reading from this pointer when `result_ok` is set is undefined.
5118     */
5119    enum LDKSecp256k1Error *err;
5120 } LDKCResult_StringErrorZPtr;
5121
5122 /**
5123  * A CResult_StringErrorZ represents the result of a fallible operation,
5124  * containing a crate::c_types::Str on success and a crate::c_types::Secp256k1Error on failure.
5125  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5126  */
5127 typedef struct LDKCResult_StringErrorZ {
5128    /**
5129     * The contents of this CResult_StringErrorZ, accessible via either
5130     * `err` or `result` depending on the state of `result_ok`.
5131     */
5132    union LDKCResult_StringErrorZPtr contents;
5133    /**
5134     * Whether this CResult_StringErrorZ represents a success state.
5135     */
5136    bool result_ok;
5137 } LDKCResult_StringErrorZ;
5138
5139 /**
5140  * The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
5141  */
5142 typedef union LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr {
5143    /**
5144     * A pointer to the contents in the success state.
5145     * Reading from this pointer when `result_ok` is not set is undefined.
5146     */
5147    struct LDKChannelMonitorUpdate *result;
5148    /**
5149     * A pointer to the contents in the error state.
5150     * Reading from this pointer when `result_ok` is set is undefined.
5151     */
5152    struct LDKDecodeError *err;
5153 } LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr;
5154
5155 /**
5156  * A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
5157  * containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
5158  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5159  */
5160 typedef struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ {
5161    /**
5162     * The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
5163     * `err` or `result` depending on the state of `result_ok`.
5164     */
5165    union LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr contents;
5166    /**
5167     * Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
5168     */
5169    bool result_ok;
5170 } LDKCResult_ChannelMonitorUpdateDecodeErrorZ;
5171
5172 /**
5173  * The contents of CResult_HTLCUpdateDecodeErrorZ
5174  */
5175 typedef union LDKCResult_HTLCUpdateDecodeErrorZPtr {
5176    /**
5177     * A pointer to the contents in the success state.
5178     * Reading from this pointer when `result_ok` is not set is undefined.
5179     */
5180    struct LDKHTLCUpdate *result;
5181    /**
5182     * A pointer to the contents in the error state.
5183     * Reading from this pointer when `result_ok` is set is undefined.
5184     */
5185    struct LDKDecodeError *err;
5186 } LDKCResult_HTLCUpdateDecodeErrorZPtr;
5187
5188 /**
5189  * A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
5190  * containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
5191  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5192  */
5193 typedef struct LDKCResult_HTLCUpdateDecodeErrorZ {
5194    /**
5195     * The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
5196     * `err` or `result` depending on the state of `result_ok`.
5197     */
5198    union LDKCResult_HTLCUpdateDecodeErrorZPtr contents;
5199    /**
5200     * Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
5201     */
5202    bool result_ok;
5203 } LDKCResult_HTLCUpdateDecodeErrorZ;
5204
5205
5206
5207 /**
5208  * General Err type for ChannelMonitor actions. Generally, this implies that the data provided is
5209  * inconsistent with the ChannelMonitor being called. eg for ChannelMonitor::update_monitor this
5210  * means you tried to update a monitor for a different channel or the ChannelMonitorUpdate was
5211  * corrupted.
5212  * Contains a developer-readable error message.
5213  */
5214 typedef struct MUST_USE_STRUCT LDKMonitorUpdateError {
5215    /**
5216     * A pointer to the opaque Rust object.
5217     * Nearly everywhere, inner must be non-null, however in places where
5218     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5219     */
5220    LDKnativeMonitorUpdateError *inner;
5221    /**
5222     * Indicates that this is the only struct which contains the same pointer.
5223     * Rust functions which take ownership of an object provided via an argument require
5224     * this to be true and invalidate the object pointed to by inner.
5225     */
5226    bool is_owned;
5227 } LDKMonitorUpdateError;
5228
5229 /**
5230  * The contents of CResult_NoneMonitorUpdateErrorZ
5231  */
5232 typedef union LDKCResult_NoneMonitorUpdateErrorZPtr {
5233    /**
5234     * Note that this value is always NULL, as there are no contents in the OK variant
5235     */
5236    void *result;
5237    /**
5238     * A pointer to the contents in the error state.
5239     * Reading from this pointer when `result_ok` is set is undefined.
5240     */
5241    struct LDKMonitorUpdateError *err;
5242 } LDKCResult_NoneMonitorUpdateErrorZPtr;
5243
5244 /**
5245  * A CResult_NoneMonitorUpdateErrorZ represents the result of a fallible operation,
5246  * containing a () on success and a crate::lightning::chain::channelmonitor::MonitorUpdateError on failure.
5247  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5248  */
5249 typedef struct LDKCResult_NoneMonitorUpdateErrorZ {
5250    /**
5251     * The contents of this CResult_NoneMonitorUpdateErrorZ, accessible via either
5252     * `err` or `result` depending on the state of `result_ok`.
5253     */
5254    union LDKCResult_NoneMonitorUpdateErrorZPtr contents;
5255    /**
5256     * Whether this CResult_NoneMonitorUpdateErrorZ represents a success state.
5257     */
5258    bool result_ok;
5259 } LDKCResult_NoneMonitorUpdateErrorZ;
5260
5261 /**
5262  * A tuple of 2 elements. See the individual fields for the types contained.
5263  */
5264 typedef struct LDKC2Tuple_OutPointScriptZ {
5265    /**
5266     * The element at position 0
5267     */
5268    struct LDKOutPoint a;
5269    /**
5270     * The element at position 1
5271     */
5272    struct LDKCVec_u8Z b;
5273 } LDKC2Tuple_OutPointScriptZ;
5274
5275 /**
5276  * A tuple of 2 elements. See the individual fields for the types contained.
5277  */
5278 typedef struct LDKC2Tuple_u32ScriptZ {
5279    /**
5280     * The element at position 0
5281     */
5282    uint32_t a;
5283    /**
5284     * The element at position 1
5285     */
5286    struct LDKCVec_u8Z b;
5287 } LDKC2Tuple_u32ScriptZ;
5288
5289 /**
5290  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size.
5291  * This corresponds to std::vector in C++
5292  */
5293 typedef struct LDKCVec_C2Tuple_u32ScriptZZ {
5294    /**
5295     * The elements in the array.
5296     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5297     */
5298    struct LDKC2Tuple_u32ScriptZ *data;
5299    /**
5300     * The number of elements pointed to by `data`.
5301     */
5302    uintptr_t datalen;
5303 } LDKCVec_C2Tuple_u32ScriptZZ;
5304
5305 /**
5306  * A tuple of 2 elements. See the individual fields for the types contained.
5307  */
5308 typedef struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
5309    /**
5310     * The element at position 0
5311     */
5312    struct LDKThirtyTwoBytes a;
5313    /**
5314     * The element at position 1
5315     */
5316    struct LDKCVec_C2Tuple_u32ScriptZZ b;
5317 } LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ;
5318
5319 /**
5320  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size.
5321  * This corresponds to std::vector in C++
5322  */
5323 typedef struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
5324    /**
5325     * The elements in the array.
5326     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5327     */
5328    struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *data;
5329    /**
5330     * The number of elements pointed to by `data`.
5331     */
5332    uintptr_t datalen;
5333 } LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ;
5334
5335 /**
5336  * An Event which you should probably take some action in response to.
5337  *
5338  * Note that while Writeable and Readable are implemented for Event, you probably shouldn't use
5339  * them directly as they don't round-trip exactly (for example FundingGenerationReady is never
5340  * written as it makes no sense to respond to it after reconnecting to peers).
5341  */
5342 typedef enum LDKEvent_Tag {
5343    /**
5344     * Used to indicate that the client should generate a funding transaction with the given
5345     * parameters and then call ChannelManager::funding_transaction_generated.
5346     * Generated in ChannelManager message handling.
5347     * Note that *all inputs* in the funding transaction must spend SegWit outputs or your
5348     * counterparty can steal your funds!
5349     */
5350    LDKEvent_FundingGenerationReady,
5351    /**
5352     * Indicates we've received money! Just gotta dig out that payment preimage and feed it to
5353     * ChannelManager::claim_funds to get it....
5354     * Note that if the preimage is not known or the amount paid is incorrect, you should call
5355     * ChannelManager::fail_htlc_backwards to free up resources for this HTLC and avoid
5356     * network congestion.
5357     * The amount paid should be considered 'incorrect' when it is less than or more than twice
5358     * the amount expected.
5359     * If you fail to call either ChannelManager::claim_funds or
5360     * ChannelManager::fail_htlc_backwards within the HTLC's timeout, the HTLC will be
5361     * automatically failed.
5362     */
5363    LDKEvent_PaymentReceived,
5364    /**
5365     * Indicates an outbound payment we made succeeded (ie it made it all the way to its target
5366     * and we got back the payment preimage for it).
5367     */
5368    LDKEvent_PaymentSent,
5369    /**
5370     * Indicates an outbound payment we made failed. Probably some intermediary node dropped
5371     * something. You may wish to retry with a different route.
5372     */
5373    LDKEvent_PaymentFailed,
5374    /**
5375     * Used to indicate that ChannelManager::process_pending_htlc_forwards should be called at a
5376     * time in the future.
5377     */
5378    LDKEvent_PendingHTLCsForwardable,
5379    /**
5380     * Used to indicate that an output was generated on-chain which you should know how to spend.
5381     * Such an output will *not* ever be spent by rust-lightning, and are not at risk of your
5382     * counterparty spending them due to some kind of timeout. Thus, you need to store them
5383     * somewhere and spend them when you create on-chain transactions.
5384     */
5385    LDKEvent_SpendableOutputs,
5386    /**
5387     * Must be last for serialization purposes
5388     */
5389    LDKEvent_Sentinel,
5390 } LDKEvent_Tag;
5391
5392 typedef struct LDKEvent_LDKFundingGenerationReady_Body {
5393    /**
5394     * The random channel_id we picked which you'll need to pass into
5395     * ChannelManager::funding_transaction_generated.
5396     */
5397    struct LDKThirtyTwoBytes temporary_channel_id;
5398    /**
5399     * The value, in satoshis, that the output should have.
5400     */
5401    uint64_t channel_value_satoshis;
5402    /**
5403     * The script which should be used in the transaction output.
5404     */
5405    struct LDKCVec_u8Z output_script;
5406    /**
5407     * The value passed in to ChannelManager::create_channel
5408     */
5409    uint64_t user_channel_id;
5410 } LDKEvent_LDKFundingGenerationReady_Body;
5411
5412 typedef struct LDKEvent_LDKPaymentReceived_Body {
5413    /**
5414     * The hash for which the preimage should be handed to the ChannelManager.
5415     */
5416    struct LDKThirtyTwoBytes payment_hash;
5417    /**
5418     * The preimage to the payment_hash, if the payment hash (and secret) were fetched via
5419     * [`ChannelManager::create_inbound_payment`]. If provided, this can be handed directly to
5420     * [`ChannelManager::claim_funds`].
5421     *
5422     * [`ChannelManager::create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment
5423     * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
5424     */
5425    struct LDKThirtyTwoBytes payment_preimage;
5426    /**
5427     * The \"payment secret\". This authenticates the sender to the recipient, preventing a
5428     * number of deanonymization attacks during the routing process.
5429     * It is provided here for your reference, however its accuracy is enforced directly by
5430     * [`ChannelManager`] using the values you previously provided to
5431     * [`ChannelManager::create_inbound_payment`] or
5432     * [`ChannelManager::create_inbound_payment_for_hash`].
5433     *
5434     * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
5435     * [`ChannelManager::create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment
5436     * [`ChannelManager::create_inbound_payment_for_hash`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash
5437     */
5438    struct LDKThirtyTwoBytes payment_secret;
5439    /**
5440     * The value, in thousandths of a satoshi, that this payment is for. Note that you must
5441     * compare this to the expected value before accepting the payment (as otherwise you are
5442     * providing proof-of-payment for less than the value you expected!).
5443     */
5444    uint64_t amt;
5445    /**
5446     * This is the `user_payment_id` which was provided to
5447     * [`ChannelManager::create_inbound_payment_for_hash`] or
5448     * [`ChannelManager::create_inbound_payment`]. It has no meaning inside of LDK and is
5449     * simply copied here. It may be used to correlate PaymentReceived events with invoice
5450     * metadata stored elsewhere.
5451     *
5452     * [`ChannelManager::create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment
5453     * [`ChannelManager::create_inbound_payment_for_hash`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash
5454     */
5455    uint64_t user_payment_id;
5456 } LDKEvent_LDKPaymentReceived_Body;
5457
5458 typedef struct LDKEvent_LDKPaymentSent_Body {
5459    /**
5460     * The preimage to the hash given to ChannelManager::send_payment.
5461     * Note that this serves as a payment receipt, if you wish to have such a thing, you must
5462     * store it somehow!
5463     */
5464    struct LDKThirtyTwoBytes payment_preimage;
5465 } LDKEvent_LDKPaymentSent_Body;
5466
5467 typedef struct LDKEvent_LDKPaymentFailed_Body {
5468    /**
5469     * The hash which was given to ChannelManager::send_payment.
5470     */
5471    struct LDKThirtyTwoBytes payment_hash;
5472    /**
5473     * Indicates the payment was rejected for some reason by the recipient. This implies that
5474     * the payment has failed, not just the route in question. If this is not set, you may
5475     * retry the payment via a different route.
5476     */
5477    bool rejected_by_dest;
5478 } LDKEvent_LDKPaymentFailed_Body;
5479
5480 typedef struct LDKEvent_LDKPendingHTLCsForwardable_Body {
5481    /**
5482     * The minimum amount of time that should be waited prior to calling
5483     * process_pending_htlc_forwards. To increase the effort required to correlate payments,
5484     * you should wait a random amount of time in roughly the range (now + time_forwardable,
5485     * now + 5*time_forwardable).
5486     */
5487    uint64_t time_forwardable;
5488 } LDKEvent_LDKPendingHTLCsForwardable_Body;
5489
5490 typedef struct LDKEvent_LDKSpendableOutputs_Body {
5491    /**
5492     * The outputs which you should store as spendable by you.
5493     */
5494    struct LDKCVec_SpendableOutputDescriptorZ outputs;
5495 } LDKEvent_LDKSpendableOutputs_Body;
5496
5497 typedef struct MUST_USE_STRUCT LDKEvent {
5498    LDKEvent_Tag tag;
5499    union {
5500       LDKEvent_LDKFundingGenerationReady_Body funding_generation_ready;
5501       LDKEvent_LDKPaymentReceived_Body payment_received;
5502       LDKEvent_LDKPaymentSent_Body payment_sent;
5503       LDKEvent_LDKPaymentFailed_Body payment_failed;
5504       LDKEvent_LDKPendingHTLCsForwardable_Body pending_htl_cs_forwardable;
5505       LDKEvent_LDKSpendableOutputs_Body spendable_outputs;
5506    };
5507 } LDKEvent;
5508
5509 /**
5510  * A dynamically-allocated array of crate::lightning::util::events::Events of arbitrary size.
5511  * This corresponds to std::vector in C++
5512  */
5513 typedef struct LDKCVec_EventZ {
5514    /**
5515     * The elements in the array.
5516     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5517     */
5518    struct LDKEvent *data;
5519    /**
5520     * The number of elements pointed to by `data`.
5521     */
5522    uintptr_t datalen;
5523 } LDKCVec_EventZ;
5524
5525 /**
5526  * A dynamically-allocated array of crate::c_types::Transactions of arbitrary size.
5527  * This corresponds to std::vector in C++
5528  */
5529 typedef struct LDKCVec_TransactionZ {
5530    /**
5531     * The elements in the array.
5532     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5533     */
5534    struct LDKTransaction *data;
5535    /**
5536     * The number of elements pointed to by `data`.
5537     */
5538    uintptr_t datalen;
5539 } LDKCVec_TransactionZ;
5540
5541 /**
5542  * A tuple of 2 elements. See the individual fields for the types contained.
5543  */
5544 typedef struct LDKC2Tuple_u32TxOutZ {
5545    /**
5546     * The element at position 0
5547     */
5548    uint32_t a;
5549    /**
5550     * The element at position 1
5551     */
5552    struct LDKTxOut b;
5553 } LDKC2Tuple_u32TxOutZ;
5554
5555 /**
5556  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size.
5557  * This corresponds to std::vector in C++
5558  */
5559 typedef struct LDKCVec_C2Tuple_u32TxOutZZ {
5560    /**
5561     * The elements in the array.
5562     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5563     */
5564    struct LDKC2Tuple_u32TxOutZ *data;
5565    /**
5566     * The number of elements pointed to by `data`.
5567     */
5568    uintptr_t datalen;
5569 } LDKCVec_C2Tuple_u32TxOutZZ;
5570
5571 /**
5572  * A tuple of 2 elements. See the individual fields for the types contained.
5573  */
5574 typedef struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
5575    /**
5576     * The element at position 0
5577     */
5578    struct LDKThirtyTwoBytes a;
5579    /**
5580     * The element at position 1
5581     */
5582    struct LDKCVec_C2Tuple_u32TxOutZZ b;
5583 } LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ;
5584
5585 /**
5586  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZs of arbitrary size.
5587  * This corresponds to std::vector in C++
5588  */
5589 typedef struct LDKCVec_TransactionOutputsZ {
5590    /**
5591     * The elements in the array.
5592     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5593     */
5594    struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *data;
5595    /**
5596     * The number of elements pointed to by `data`.
5597     */
5598    uintptr_t datalen;
5599 } LDKCVec_TransactionOutputsZ;
5600
5601 /**
5602  * The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ
5603  */
5604 typedef union LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
5605    /**
5606     * A pointer to the contents in the success state.
5607     * Reading from this pointer when `result_ok` is not set is undefined.
5608     */
5609    struct LDKC2Tuple_BlockHashChannelMonitorZ *result;
5610    /**
5611     * A pointer to the contents in the error state.
5612     * Reading from this pointer when `result_ok` is set is undefined.
5613     */
5614    struct LDKDecodeError *err;
5615 } LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr;
5616
5617 /**
5618  * A CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents the result of a fallible operation,
5619  * containing a crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
5620  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5621  */
5622 typedef struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
5623    /**
5624     * The contents of this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either
5625     * `err` or `result` depending on the state of `result_ok`.
5626     */
5627    union LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr contents;
5628    /**
5629     * Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state.
5630     */
5631    bool result_ok;
5632 } LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ;
5633
5634 /**
5635  * The contents of CResult_boolLightningErrorZ
5636  */
5637 typedef union LDKCResult_boolLightningErrorZPtr {
5638    /**
5639     * A pointer to the contents in the success state.
5640     * Reading from this pointer when `result_ok` is not set is undefined.
5641     */
5642    bool *result;
5643    /**
5644     * A pointer to the contents in the error state.
5645     * Reading from this pointer when `result_ok` is set is undefined.
5646     */
5647    struct LDKLightningError *err;
5648 } LDKCResult_boolLightningErrorZPtr;
5649
5650 /**
5651  * A CResult_boolLightningErrorZ represents the result of a fallible operation,
5652  * containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure.
5653  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5654  */
5655 typedef struct LDKCResult_boolLightningErrorZ {
5656    /**
5657     * The contents of this CResult_boolLightningErrorZ, accessible via either
5658     * `err` or `result` depending on the state of `result_ok`.
5659     */
5660    union LDKCResult_boolLightningErrorZPtr contents;
5661    /**
5662     * Whether this CResult_boolLightningErrorZ represents a success state.
5663     */
5664    bool result_ok;
5665 } LDKCResult_boolLightningErrorZ;
5666
5667 /**
5668  * A tuple of 3 elements. See the individual fields for the types contained.
5669  */
5670 typedef struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
5671    /**
5672     * The element at position 0
5673     */
5674    struct LDKChannelAnnouncement a;
5675    /**
5676     * The element at position 1
5677     */
5678    struct LDKChannelUpdate b;
5679    /**
5680     * The element at position 2
5681     */
5682    struct LDKChannelUpdate c;
5683 } LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ;
5684
5685 /**
5686  * A dynamically-allocated array of crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZs of arbitrary size.
5687  * This corresponds to std::vector in C++
5688  */
5689 typedef struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
5690    /**
5691     * The elements in the array.
5692     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5693     */
5694    struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *data;
5695    /**
5696     * The number of elements pointed to by `data`.
5697     */
5698    uintptr_t datalen;
5699 } LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ;
5700
5701 /**
5702  * A dynamically-allocated array of crate::lightning::ln::msgs::NodeAnnouncements of arbitrary size.
5703  * This corresponds to std::vector in C++
5704  */
5705 typedef struct LDKCVec_NodeAnnouncementZ {
5706    /**
5707     * The elements in the array.
5708     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5709     */
5710    struct LDKNodeAnnouncement *data;
5711    /**
5712     * The number of elements pointed to by `data`.
5713     */
5714    uintptr_t datalen;
5715 } LDKCVec_NodeAnnouncementZ;
5716
5717 /**
5718  * The contents of CResult_NoneLightningErrorZ
5719  */
5720 typedef union LDKCResult_NoneLightningErrorZPtr {
5721    /**
5722     * Note that this value is always NULL, as there are no contents in the OK variant
5723     */
5724    void *result;
5725    /**
5726     * A pointer to the contents in the error state.
5727     * Reading from this pointer when `result_ok` is set is undefined.
5728     */
5729    struct LDKLightningError *err;
5730 } LDKCResult_NoneLightningErrorZPtr;
5731
5732 /**
5733  * A CResult_NoneLightningErrorZ represents the result of a fallible operation,
5734  * containing a () on success and a crate::lightning::ln::msgs::LightningError on failure.
5735  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5736  */
5737 typedef struct LDKCResult_NoneLightningErrorZ {
5738    /**
5739     * The contents of this CResult_NoneLightningErrorZ, accessible via either
5740     * `err` or `result` depending on the state of `result_ok`.
5741     */
5742    union LDKCResult_NoneLightningErrorZPtr contents;
5743    /**
5744     * Whether this CResult_NoneLightningErrorZ represents a success state.
5745     */
5746    bool result_ok;
5747 } LDKCResult_NoneLightningErrorZ;
5748
5749 /**
5750  * A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size.
5751  * This corresponds to std::vector in C++
5752  */
5753 typedef struct LDKCVec_PublicKeyZ {
5754    /**
5755     * The elements in the array.
5756     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5757     */
5758    struct LDKPublicKey *data;
5759    /**
5760     * The number of elements pointed to by `data`.
5761     */
5762    uintptr_t datalen;
5763 } LDKCVec_PublicKeyZ;
5764
5765
5766
5767 /**
5768  * Error for PeerManager errors. If you get one of these, you must disconnect the socket and
5769  * generate no further read_event/write_buffer_space_avail/socket_disconnected calls for the
5770  * descriptor.
5771  */
5772 typedef struct MUST_USE_STRUCT LDKPeerHandleError {
5773    /**
5774     * A pointer to the opaque Rust object.
5775     * Nearly everywhere, inner must be non-null, however in places where
5776     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5777     */
5778    LDKnativePeerHandleError *inner;
5779    /**
5780     * Indicates that this is the only struct which contains the same pointer.
5781     * Rust functions which take ownership of an object provided via an argument require
5782     * this to be true and invalidate the object pointed to by inner.
5783     */
5784    bool is_owned;
5785 } LDKPeerHandleError;
5786
5787 /**
5788  * The contents of CResult_CVec_u8ZPeerHandleErrorZ
5789  */
5790 typedef union LDKCResult_CVec_u8ZPeerHandleErrorZPtr {
5791    /**
5792     * A pointer to the contents in the success state.
5793     * Reading from this pointer when `result_ok` is not set is undefined.
5794     */
5795    struct LDKCVec_u8Z *result;
5796    /**
5797     * A pointer to the contents in the error state.
5798     * Reading from this pointer when `result_ok` is set is undefined.
5799     */
5800    struct LDKPeerHandleError *err;
5801 } LDKCResult_CVec_u8ZPeerHandleErrorZPtr;
5802
5803 /**
5804  * A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
5805  * containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
5806  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5807  */
5808 typedef struct LDKCResult_CVec_u8ZPeerHandleErrorZ {
5809    /**
5810     * The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
5811     * `err` or `result` depending on the state of `result_ok`.
5812     */
5813    union LDKCResult_CVec_u8ZPeerHandleErrorZPtr contents;
5814    /**
5815     * Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
5816     */
5817    bool result_ok;
5818 } LDKCResult_CVec_u8ZPeerHandleErrorZ;
5819
5820 /**
5821  * The contents of CResult_NonePeerHandleErrorZ
5822  */
5823 typedef union LDKCResult_NonePeerHandleErrorZPtr {
5824    /**
5825     * Note that this value is always NULL, as there are no contents in the OK variant
5826     */
5827    void *result;
5828    /**
5829     * A pointer to the contents in the error state.
5830     * Reading from this pointer when `result_ok` is set is undefined.
5831     */
5832    struct LDKPeerHandleError *err;
5833 } LDKCResult_NonePeerHandleErrorZPtr;
5834
5835 /**
5836  * A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
5837  * containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
5838  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5839  */
5840 typedef struct LDKCResult_NonePeerHandleErrorZ {
5841    /**
5842     * The contents of this CResult_NonePeerHandleErrorZ, accessible via either
5843     * `err` or `result` depending on the state of `result_ok`.
5844     */
5845    union LDKCResult_NonePeerHandleErrorZPtr contents;
5846    /**
5847     * Whether this CResult_NonePeerHandleErrorZ represents a success state.
5848     */
5849    bool result_ok;
5850 } LDKCResult_NonePeerHandleErrorZ;
5851
5852 /**
5853  * The contents of CResult_boolPeerHandleErrorZ
5854  */
5855 typedef union LDKCResult_boolPeerHandleErrorZPtr {
5856    /**
5857     * A pointer to the contents in the success state.
5858     * Reading from this pointer when `result_ok` is not set is undefined.
5859     */
5860    bool *result;
5861    /**
5862     * A pointer to the contents in the error state.
5863     * Reading from this pointer when `result_ok` is set is undefined.
5864     */
5865    struct LDKPeerHandleError *err;
5866 } LDKCResult_boolPeerHandleErrorZPtr;
5867
5868 /**
5869  * A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
5870  * containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
5871  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5872  */
5873 typedef struct LDKCResult_boolPeerHandleErrorZ {
5874    /**
5875     * The contents of this CResult_boolPeerHandleErrorZ, accessible via either
5876     * `err` or `result` depending on the state of `result_ok`.
5877     */
5878    union LDKCResult_boolPeerHandleErrorZPtr contents;
5879    /**
5880     * Whether this CResult_boolPeerHandleErrorZ represents a success state.
5881     */
5882    bool result_ok;
5883 } LDKCResult_boolPeerHandleErrorZ;
5884
5885
5886
5887 /**
5888  * Details about one direction of a channel. Received
5889  * within a channel update.
5890  */
5891 typedef struct MUST_USE_STRUCT LDKDirectionalChannelInfo {
5892    /**
5893     * A pointer to the opaque Rust object.
5894     * Nearly everywhere, inner must be non-null, however in places where
5895     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5896     */
5897    LDKnativeDirectionalChannelInfo *inner;
5898    /**
5899     * Indicates that this is the only struct which contains the same pointer.
5900     * Rust functions which take ownership of an object provided via an argument require
5901     * this to be true and invalidate the object pointed to by inner.
5902     */
5903    bool is_owned;
5904 } LDKDirectionalChannelInfo;
5905
5906 /**
5907  * The contents of CResult_DirectionalChannelInfoDecodeErrorZ
5908  */
5909 typedef union LDKCResult_DirectionalChannelInfoDecodeErrorZPtr {
5910    /**
5911     * A pointer to the contents in the success state.
5912     * Reading from this pointer when `result_ok` is not set is undefined.
5913     */
5914    struct LDKDirectionalChannelInfo *result;
5915    /**
5916     * A pointer to the contents in the error state.
5917     * Reading from this pointer when `result_ok` is set is undefined.
5918     */
5919    struct LDKDecodeError *err;
5920 } LDKCResult_DirectionalChannelInfoDecodeErrorZPtr;
5921
5922 /**
5923  * A CResult_DirectionalChannelInfoDecodeErrorZ represents the result of a fallible operation,
5924  * containing a crate::lightning::routing::network_graph::DirectionalChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
5925  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5926  */
5927 typedef struct LDKCResult_DirectionalChannelInfoDecodeErrorZ {
5928    /**
5929     * The contents of this CResult_DirectionalChannelInfoDecodeErrorZ, accessible via either
5930     * `err` or `result` depending on the state of `result_ok`.
5931     */
5932    union LDKCResult_DirectionalChannelInfoDecodeErrorZPtr contents;
5933    /**
5934     * Whether this CResult_DirectionalChannelInfoDecodeErrorZ represents a success state.
5935     */
5936    bool result_ok;
5937 } LDKCResult_DirectionalChannelInfoDecodeErrorZ;
5938
5939
5940
5941 /**
5942  * Details about a channel (both directions).
5943  * Received within a channel announcement.
5944  */
5945 typedef struct MUST_USE_STRUCT LDKChannelInfo {
5946    /**
5947     * A pointer to the opaque Rust object.
5948     * Nearly everywhere, inner must be non-null, however in places where
5949     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5950     */
5951    LDKnativeChannelInfo *inner;
5952    /**
5953     * Indicates that this is the only struct which contains the same pointer.
5954     * Rust functions which take ownership of an object provided via an argument require
5955     * this to be true and invalidate the object pointed to by inner.
5956     */
5957    bool is_owned;
5958 } LDKChannelInfo;
5959
5960 /**
5961  * The contents of CResult_ChannelInfoDecodeErrorZ
5962  */
5963 typedef union LDKCResult_ChannelInfoDecodeErrorZPtr {
5964    /**
5965     * A pointer to the contents in the success state.
5966     * Reading from this pointer when `result_ok` is not set is undefined.
5967     */
5968    struct LDKChannelInfo *result;
5969    /**
5970     * A pointer to the contents in the error state.
5971     * Reading from this pointer when `result_ok` is set is undefined.
5972     */
5973    struct LDKDecodeError *err;
5974 } LDKCResult_ChannelInfoDecodeErrorZPtr;
5975
5976 /**
5977  * A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation,
5978  * containing a crate::lightning::routing::network_graph::ChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
5979  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5980  */
5981 typedef struct LDKCResult_ChannelInfoDecodeErrorZ {
5982    /**
5983     * The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either
5984     * `err` or `result` depending on the state of `result_ok`.
5985     */
5986    union LDKCResult_ChannelInfoDecodeErrorZPtr contents;
5987    /**
5988     * Whether this CResult_ChannelInfoDecodeErrorZ represents a success state.
5989     */
5990    bool result_ok;
5991 } LDKCResult_ChannelInfoDecodeErrorZ;
5992
5993
5994
5995 /**
5996  * Fees for routing via a given channel or a node
5997  */
5998 typedef struct MUST_USE_STRUCT LDKRoutingFees {
5999    /**
6000     * A pointer to the opaque Rust object.
6001     * Nearly everywhere, inner must be non-null, however in places where
6002     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6003     */
6004    LDKnativeRoutingFees *inner;
6005    /**
6006     * Indicates that this is the only struct which contains the same pointer.
6007     * Rust functions which take ownership of an object provided via an argument require
6008     * this to be true and invalidate the object pointed to by inner.
6009     */
6010    bool is_owned;
6011 } LDKRoutingFees;
6012
6013 /**
6014  * The contents of CResult_RoutingFeesDecodeErrorZ
6015  */
6016 typedef union LDKCResult_RoutingFeesDecodeErrorZPtr {
6017    /**
6018     * A pointer to the contents in the success state.
6019     * Reading from this pointer when `result_ok` is not set is undefined.
6020     */
6021    struct LDKRoutingFees *result;
6022    /**
6023     * A pointer to the contents in the error state.
6024     * Reading from this pointer when `result_ok` is set is undefined.
6025     */
6026    struct LDKDecodeError *err;
6027 } LDKCResult_RoutingFeesDecodeErrorZPtr;
6028
6029 /**
6030  * A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation,
6031  * containing a crate::lightning::routing::network_graph::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure.
6032  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6033  */
6034 typedef struct LDKCResult_RoutingFeesDecodeErrorZ {
6035    /**
6036     * The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either
6037     * `err` or `result` depending on the state of `result_ok`.
6038     */
6039    union LDKCResult_RoutingFeesDecodeErrorZPtr contents;
6040    /**
6041     * Whether this CResult_RoutingFeesDecodeErrorZ represents a success state.
6042     */
6043    bool result_ok;
6044 } LDKCResult_RoutingFeesDecodeErrorZ;
6045
6046
6047
6048 /**
6049  * Information received in the latest node_announcement from this node.
6050  */
6051 typedef struct MUST_USE_STRUCT LDKNodeAnnouncementInfo {
6052    /**
6053     * A pointer to the opaque Rust object.
6054     * Nearly everywhere, inner must be non-null, however in places where
6055     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6056     */
6057    LDKnativeNodeAnnouncementInfo *inner;
6058    /**
6059     * Indicates that this is the only struct which contains the same pointer.
6060     * Rust functions which take ownership of an object provided via an argument require
6061     * this to be true and invalidate the object pointed to by inner.
6062     */
6063    bool is_owned;
6064 } LDKNodeAnnouncementInfo;
6065
6066 /**
6067  * The contents of CResult_NodeAnnouncementInfoDecodeErrorZ
6068  */
6069 typedef union LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr {
6070    /**
6071     * A pointer to the contents in the success state.
6072     * Reading from this pointer when `result_ok` is not set is undefined.
6073     */
6074    struct LDKNodeAnnouncementInfo *result;
6075    /**
6076     * A pointer to the contents in the error state.
6077     * Reading from this pointer when `result_ok` is set is undefined.
6078     */
6079    struct LDKDecodeError *err;
6080 } LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr;
6081
6082 /**
6083  * A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation,
6084  * containing a crate::lightning::routing::network_graph::NodeAnnouncementInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
6085  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6086  */
6087 typedef struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ {
6088    /**
6089     * The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either
6090     * `err` or `result` depending on the state of `result_ok`.
6091     */
6092    union LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr contents;
6093    /**
6094     * Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state.
6095     */
6096    bool result_ok;
6097 } LDKCResult_NodeAnnouncementInfoDecodeErrorZ;
6098
6099 /**
6100  * A dynamically-allocated array of u64s of arbitrary size.
6101  * This corresponds to std::vector in C++
6102  */
6103 typedef struct LDKCVec_u64Z {
6104    /**
6105     * The elements in the array.
6106     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6107     */
6108    uint64_t *data;
6109    /**
6110     * The number of elements pointed to by `data`.
6111     */
6112    uintptr_t datalen;
6113 } LDKCVec_u64Z;
6114
6115
6116
6117 /**
6118  * Details about a node in the network, known from the network announcement.
6119  */
6120 typedef struct MUST_USE_STRUCT LDKNodeInfo {
6121    /**
6122     * A pointer to the opaque Rust object.
6123     * Nearly everywhere, inner must be non-null, however in places where
6124     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6125     */
6126    LDKnativeNodeInfo *inner;
6127    /**
6128     * Indicates that this is the only struct which contains the same pointer.
6129     * Rust functions which take ownership of an object provided via an argument require
6130     * this to be true and invalidate the object pointed to by inner.
6131     */
6132    bool is_owned;
6133 } LDKNodeInfo;
6134
6135 /**
6136  * The contents of CResult_NodeInfoDecodeErrorZ
6137  */
6138 typedef union LDKCResult_NodeInfoDecodeErrorZPtr {
6139    /**
6140     * A pointer to the contents in the success state.
6141     * Reading from this pointer when `result_ok` is not set is undefined.
6142     */
6143    struct LDKNodeInfo *result;
6144    /**
6145     * A pointer to the contents in the error state.
6146     * Reading from this pointer when `result_ok` is set is undefined.
6147     */
6148    struct LDKDecodeError *err;
6149 } LDKCResult_NodeInfoDecodeErrorZPtr;
6150
6151 /**
6152  * A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation,
6153  * containing a crate::lightning::routing::network_graph::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
6154  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6155  */
6156 typedef struct LDKCResult_NodeInfoDecodeErrorZ {
6157    /**
6158     * The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either
6159     * `err` or `result` depending on the state of `result_ok`.
6160     */
6161    union LDKCResult_NodeInfoDecodeErrorZPtr contents;
6162    /**
6163     * Whether this CResult_NodeInfoDecodeErrorZ represents a success state.
6164     */
6165    bool result_ok;
6166 } LDKCResult_NodeInfoDecodeErrorZ;
6167
6168
6169
6170 /**
6171  * Represents the network as nodes and channels between them
6172  */
6173 typedef struct MUST_USE_STRUCT LDKNetworkGraph {
6174    /**
6175     * A pointer to the opaque Rust object.
6176     * Nearly everywhere, inner must be non-null, however in places where
6177     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6178     */
6179    LDKnativeNetworkGraph *inner;
6180    /**
6181     * Indicates that this is the only struct which contains the same pointer.
6182     * Rust functions which take ownership of an object provided via an argument require
6183     * this to be true and invalidate the object pointed to by inner.
6184     */
6185    bool is_owned;
6186 } LDKNetworkGraph;
6187
6188 /**
6189  * The contents of CResult_NetworkGraphDecodeErrorZ
6190  */
6191 typedef union LDKCResult_NetworkGraphDecodeErrorZPtr {
6192    /**
6193     * A pointer to the contents in the success state.
6194     * Reading from this pointer when `result_ok` is not set is undefined.
6195     */
6196    struct LDKNetworkGraph *result;
6197    /**
6198     * A pointer to the contents in the error state.
6199     * Reading from this pointer when `result_ok` is set is undefined.
6200     */
6201    struct LDKDecodeError *err;
6202 } LDKCResult_NetworkGraphDecodeErrorZPtr;
6203
6204 /**
6205  * A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation,
6206  * containing a crate::lightning::routing::network_graph::NetworkGraph on success and a crate::lightning::ln::msgs::DecodeError on failure.
6207  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6208  */
6209 typedef struct LDKCResult_NetworkGraphDecodeErrorZ {
6210    /**
6211     * The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either
6212     * `err` or `result` depending on the state of `result_ok`.
6213     */
6214    union LDKCResult_NetworkGraphDecodeErrorZPtr contents;
6215    /**
6216     * Whether this CResult_NetworkGraphDecodeErrorZ represents a success state.
6217     */
6218    bool result_ok;
6219 } LDKCResult_NetworkGraphDecodeErrorZ;
6220
6221 /**
6222  * The contents of CResult_NetAddressu8Z
6223  */
6224 typedef union LDKCResult_NetAddressu8ZPtr {
6225    /**
6226     * A pointer to the contents in the success state.
6227     * Reading from this pointer when `result_ok` is not set is undefined.
6228     */
6229    struct LDKNetAddress *result;
6230    /**
6231     * A pointer to the contents in the error state.
6232     * Reading from this pointer when `result_ok` is set is undefined.
6233     */
6234    uint8_t *err;
6235 } LDKCResult_NetAddressu8ZPtr;
6236
6237 /**
6238  * A CResult_NetAddressu8Z represents the result of a fallible operation,
6239  * containing a crate::lightning::ln::msgs::NetAddress on success and a u8 on failure.
6240  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6241  */
6242 typedef struct LDKCResult_NetAddressu8Z {
6243    /**
6244     * The contents of this CResult_NetAddressu8Z, accessible via either
6245     * `err` or `result` depending on the state of `result_ok`.
6246     */
6247    union LDKCResult_NetAddressu8ZPtr contents;
6248    /**
6249     * Whether this CResult_NetAddressu8Z represents a success state.
6250     */
6251    bool result_ok;
6252 } LDKCResult_NetAddressu8Z;
6253
6254 /**
6255  * The contents of CResult_CResult_NetAddressu8ZDecodeErrorZ
6256  */
6257 typedef union LDKCResult_CResult_NetAddressu8ZDecodeErrorZPtr {
6258    /**
6259     * A pointer to the contents in the success state.
6260     * Reading from this pointer when `result_ok` is not set is undefined.
6261     */
6262    struct LDKCResult_NetAddressu8Z *result;
6263    /**
6264     * A pointer to the contents in the error state.
6265     * Reading from this pointer when `result_ok` is set is undefined.
6266     */
6267    struct LDKDecodeError *err;
6268 } LDKCResult_CResult_NetAddressu8ZDecodeErrorZPtr;
6269
6270 /**
6271  * A CResult_CResult_NetAddressu8ZDecodeErrorZ represents the result of a fallible operation,
6272  * containing a crate::c_types::derived::CResult_NetAddressu8Z on success and a crate::lightning::ln::msgs::DecodeError on failure.
6273  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6274  */
6275 typedef struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ {
6276    /**
6277     * The contents of this CResult_CResult_NetAddressu8ZDecodeErrorZ, accessible via either
6278     * `err` or `result` depending on the state of `result_ok`.
6279     */
6280    union LDKCResult_CResult_NetAddressu8ZDecodeErrorZPtr contents;
6281    /**
6282     * Whether this CResult_CResult_NetAddressu8ZDecodeErrorZ represents a success state.
6283     */
6284    bool result_ok;
6285 } LDKCResult_CResult_NetAddressu8ZDecodeErrorZ;
6286
6287 /**
6288  * The contents of CResult_NetAddressDecodeErrorZ
6289  */
6290 typedef union LDKCResult_NetAddressDecodeErrorZPtr {
6291    /**
6292     * A pointer to the contents in the success state.
6293     * Reading from this pointer when `result_ok` is not set is undefined.
6294     */
6295    struct LDKNetAddress *result;
6296    /**
6297     * A pointer to the contents in the error state.
6298     * Reading from this pointer when `result_ok` is set is undefined.
6299     */
6300    struct LDKDecodeError *err;
6301 } LDKCResult_NetAddressDecodeErrorZPtr;
6302
6303 /**
6304  * A CResult_NetAddressDecodeErrorZ represents the result of a fallible operation,
6305  * containing a crate::lightning::ln::msgs::NetAddress on success and a crate::lightning::ln::msgs::DecodeError on failure.
6306  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6307  */
6308 typedef struct LDKCResult_NetAddressDecodeErrorZ {
6309    /**
6310     * The contents of this CResult_NetAddressDecodeErrorZ, accessible via either
6311     * `err` or `result` depending on the state of `result_ok`.
6312     */
6313    union LDKCResult_NetAddressDecodeErrorZPtr contents;
6314    /**
6315     * Whether this CResult_NetAddressDecodeErrorZ represents a success state.
6316     */
6317    bool result_ok;
6318 } LDKCResult_NetAddressDecodeErrorZ;
6319
6320
6321
6322 /**
6323  * An update_add_htlc message to be sent or received from a peer
6324  */
6325 typedef struct MUST_USE_STRUCT LDKUpdateAddHTLC {
6326    /**
6327     * A pointer to the opaque Rust object.
6328     * Nearly everywhere, inner must be non-null, however in places where
6329     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6330     */
6331    LDKnativeUpdateAddHTLC *inner;
6332    /**
6333     * Indicates that this is the only struct which contains the same pointer.
6334     * Rust functions which take ownership of an object provided via an argument require
6335     * this to be true and invalidate the object pointed to by inner.
6336     */
6337    bool is_owned;
6338 } LDKUpdateAddHTLC;
6339
6340 /**
6341  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size.
6342  * This corresponds to std::vector in C++
6343  */
6344 typedef struct LDKCVec_UpdateAddHTLCZ {
6345    /**
6346     * The elements in the array.
6347     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6348     */
6349    struct LDKUpdateAddHTLC *data;
6350    /**
6351     * The number of elements pointed to by `data`.
6352     */
6353    uintptr_t datalen;
6354 } LDKCVec_UpdateAddHTLCZ;
6355
6356
6357
6358 /**
6359  * An update_fulfill_htlc message to be sent or received from a peer
6360  */
6361 typedef struct MUST_USE_STRUCT LDKUpdateFulfillHTLC {
6362    /**
6363     * A pointer to the opaque Rust object.
6364     * Nearly everywhere, inner must be non-null, however in places where
6365     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6366     */
6367    LDKnativeUpdateFulfillHTLC *inner;
6368    /**
6369     * Indicates that this is the only struct which contains the same pointer.
6370     * Rust functions which take ownership of an object provided via an argument require
6371     * this to be true and invalidate the object pointed to by inner.
6372     */
6373    bool is_owned;
6374 } LDKUpdateFulfillHTLC;
6375
6376 /**
6377  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
6378  * This corresponds to std::vector in C++
6379  */
6380 typedef struct LDKCVec_UpdateFulfillHTLCZ {
6381    /**
6382     * The elements in the array.
6383     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6384     */
6385    struct LDKUpdateFulfillHTLC *data;
6386    /**
6387     * The number of elements pointed to by `data`.
6388     */
6389    uintptr_t datalen;
6390 } LDKCVec_UpdateFulfillHTLCZ;
6391
6392
6393
6394 /**
6395  * An update_fail_htlc message to be sent or received from a peer
6396  */
6397 typedef struct MUST_USE_STRUCT LDKUpdateFailHTLC {
6398    /**
6399     * A pointer to the opaque Rust object.
6400     * Nearly everywhere, inner must be non-null, however in places where
6401     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6402     */
6403    LDKnativeUpdateFailHTLC *inner;
6404    /**
6405     * Indicates that this is the only struct which contains the same pointer.
6406     * Rust functions which take ownership of an object provided via an argument require
6407     * this to be true and invalidate the object pointed to by inner.
6408     */
6409    bool is_owned;
6410 } LDKUpdateFailHTLC;
6411
6412 /**
6413  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size.
6414  * This corresponds to std::vector in C++
6415  */
6416 typedef struct LDKCVec_UpdateFailHTLCZ {
6417    /**
6418     * The elements in the array.
6419     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6420     */
6421    struct LDKUpdateFailHTLC *data;
6422    /**
6423     * The number of elements pointed to by `data`.
6424     */
6425    uintptr_t datalen;
6426 } LDKCVec_UpdateFailHTLCZ;
6427
6428
6429
6430 /**
6431  * An update_fail_malformed_htlc message to be sent or received from a peer
6432  */
6433 typedef struct MUST_USE_STRUCT LDKUpdateFailMalformedHTLC {
6434    /**
6435     * A pointer to the opaque Rust object.
6436     * Nearly everywhere, inner must be non-null, however in places where
6437     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6438     */
6439    LDKnativeUpdateFailMalformedHTLC *inner;
6440    /**
6441     * Indicates that this is the only struct which contains the same pointer.
6442     * Rust functions which take ownership of an object provided via an argument require
6443     * this to be true and invalidate the object pointed to by inner.
6444     */
6445    bool is_owned;
6446 } LDKUpdateFailMalformedHTLC;
6447
6448 /**
6449  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
6450  * This corresponds to std::vector in C++
6451  */
6452 typedef struct LDKCVec_UpdateFailMalformedHTLCZ {
6453    /**
6454     * The elements in the array.
6455     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6456     */
6457    struct LDKUpdateFailMalformedHTLC *data;
6458    /**
6459     * The number of elements pointed to by `data`.
6460     */
6461    uintptr_t datalen;
6462 } LDKCVec_UpdateFailMalformedHTLCZ;
6463
6464 /**
6465  * The contents of CResult_AcceptChannelDecodeErrorZ
6466  */
6467 typedef union LDKCResult_AcceptChannelDecodeErrorZPtr {
6468    /**
6469     * A pointer to the contents in the success state.
6470     * Reading from this pointer when `result_ok` is not set is undefined.
6471     */
6472    struct LDKAcceptChannel *result;
6473    /**
6474     * A pointer to the contents in the error state.
6475     * Reading from this pointer when `result_ok` is set is undefined.
6476     */
6477    struct LDKDecodeError *err;
6478 } LDKCResult_AcceptChannelDecodeErrorZPtr;
6479
6480 /**
6481  * A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
6482  * containing a crate::lightning::ln::msgs::AcceptChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
6483  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6484  */
6485 typedef struct LDKCResult_AcceptChannelDecodeErrorZ {
6486    /**
6487     * The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
6488     * `err` or `result` depending on the state of `result_ok`.
6489     */
6490    union LDKCResult_AcceptChannelDecodeErrorZPtr contents;
6491    /**
6492     * Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
6493     */
6494    bool result_ok;
6495 } LDKCResult_AcceptChannelDecodeErrorZ;
6496
6497 /**
6498  * The contents of CResult_AnnouncementSignaturesDecodeErrorZ
6499  */
6500 typedef union LDKCResult_AnnouncementSignaturesDecodeErrorZPtr {
6501    /**
6502     * A pointer to the contents in the success state.
6503     * Reading from this pointer when `result_ok` is not set is undefined.
6504     */
6505    struct LDKAnnouncementSignatures *result;
6506    /**
6507     * A pointer to the contents in the error state.
6508     * Reading from this pointer when `result_ok` is set is undefined.
6509     */
6510    struct LDKDecodeError *err;
6511 } LDKCResult_AnnouncementSignaturesDecodeErrorZPtr;
6512
6513 /**
6514  * A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
6515  * containing a crate::lightning::ln::msgs::AnnouncementSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
6516  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6517  */
6518 typedef struct LDKCResult_AnnouncementSignaturesDecodeErrorZ {
6519    /**
6520     * The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
6521     * `err` or `result` depending on the state of `result_ok`.
6522     */
6523    union LDKCResult_AnnouncementSignaturesDecodeErrorZPtr contents;
6524    /**
6525     * Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
6526     */
6527    bool result_ok;
6528 } LDKCResult_AnnouncementSignaturesDecodeErrorZ;
6529
6530 /**
6531  * The contents of CResult_ChannelReestablishDecodeErrorZ
6532  */
6533 typedef union LDKCResult_ChannelReestablishDecodeErrorZPtr {
6534    /**
6535     * A pointer to the contents in the success state.
6536     * Reading from this pointer when `result_ok` is not set is undefined.
6537     */
6538    struct LDKChannelReestablish *result;
6539    /**
6540     * A pointer to the contents in the error state.
6541     * Reading from this pointer when `result_ok` is set is undefined.
6542     */
6543    struct LDKDecodeError *err;
6544 } LDKCResult_ChannelReestablishDecodeErrorZPtr;
6545
6546 /**
6547  * A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
6548  * containing a crate::lightning::ln::msgs::ChannelReestablish on success and a crate::lightning::ln::msgs::DecodeError on failure.
6549  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6550  */
6551 typedef struct LDKCResult_ChannelReestablishDecodeErrorZ {
6552    /**
6553     * The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
6554     * `err` or `result` depending on the state of `result_ok`.
6555     */
6556    union LDKCResult_ChannelReestablishDecodeErrorZPtr contents;
6557    /**
6558     * Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
6559     */
6560    bool result_ok;
6561 } LDKCResult_ChannelReestablishDecodeErrorZ;
6562
6563 /**
6564  * The contents of CResult_ClosingSignedDecodeErrorZ
6565  */
6566 typedef union LDKCResult_ClosingSignedDecodeErrorZPtr {
6567    /**
6568     * A pointer to the contents in the success state.
6569     * Reading from this pointer when `result_ok` is not set is undefined.
6570     */
6571    struct LDKClosingSigned *result;
6572    /**
6573     * A pointer to the contents in the error state.
6574     * Reading from this pointer when `result_ok` is set is undefined.
6575     */
6576    struct LDKDecodeError *err;
6577 } LDKCResult_ClosingSignedDecodeErrorZPtr;
6578
6579 /**
6580  * A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
6581  * containing a crate::lightning::ln::msgs::ClosingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
6582  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6583  */
6584 typedef struct LDKCResult_ClosingSignedDecodeErrorZ {
6585    /**
6586     * The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
6587     * `err` or `result` depending on the state of `result_ok`.
6588     */
6589    union LDKCResult_ClosingSignedDecodeErrorZPtr contents;
6590    /**
6591     * Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
6592     */
6593    bool result_ok;
6594 } LDKCResult_ClosingSignedDecodeErrorZ;
6595
6596
6597
6598 /**
6599  * A commitment_signed message to be sent or received from a peer
6600  */
6601 typedef struct MUST_USE_STRUCT LDKCommitmentSigned {
6602    /**
6603     * A pointer to the opaque Rust object.
6604     * Nearly everywhere, inner must be non-null, however in places where
6605     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6606     */
6607    LDKnativeCommitmentSigned *inner;
6608    /**
6609     * Indicates that this is the only struct which contains the same pointer.
6610     * Rust functions which take ownership of an object provided via an argument require
6611     * this to be true and invalidate the object pointed to by inner.
6612     */
6613    bool is_owned;
6614 } LDKCommitmentSigned;
6615
6616 /**
6617  * The contents of CResult_CommitmentSignedDecodeErrorZ
6618  */
6619 typedef union LDKCResult_CommitmentSignedDecodeErrorZPtr {
6620    /**
6621     * A pointer to the contents in the success state.
6622     * Reading from this pointer when `result_ok` is not set is undefined.
6623     */
6624    struct LDKCommitmentSigned *result;
6625    /**
6626     * A pointer to the contents in the error state.
6627     * Reading from this pointer when `result_ok` is set is undefined.
6628     */
6629    struct LDKDecodeError *err;
6630 } LDKCResult_CommitmentSignedDecodeErrorZPtr;
6631
6632 /**
6633  * A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
6634  * containing a crate::lightning::ln::msgs::CommitmentSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
6635  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6636  */
6637 typedef struct LDKCResult_CommitmentSignedDecodeErrorZ {
6638    /**
6639     * The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
6640     * `err` or `result` depending on the state of `result_ok`.
6641     */
6642    union LDKCResult_CommitmentSignedDecodeErrorZPtr contents;
6643    /**
6644     * Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
6645     */
6646    bool result_ok;
6647 } LDKCResult_CommitmentSignedDecodeErrorZ;
6648
6649 /**
6650  * The contents of CResult_FundingCreatedDecodeErrorZ
6651  */
6652 typedef union LDKCResult_FundingCreatedDecodeErrorZPtr {
6653    /**
6654     * A pointer to the contents in the success state.
6655     * Reading from this pointer when `result_ok` is not set is undefined.
6656     */
6657    struct LDKFundingCreated *result;
6658    /**
6659     * A pointer to the contents in the error state.
6660     * Reading from this pointer when `result_ok` is set is undefined.
6661     */
6662    struct LDKDecodeError *err;
6663 } LDKCResult_FundingCreatedDecodeErrorZPtr;
6664
6665 /**
6666  * A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
6667  * containing a crate::lightning::ln::msgs::FundingCreated on success and a crate::lightning::ln::msgs::DecodeError on failure.
6668  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6669  */
6670 typedef struct LDKCResult_FundingCreatedDecodeErrorZ {
6671    /**
6672     * The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
6673     * `err` or `result` depending on the state of `result_ok`.
6674     */
6675    union LDKCResult_FundingCreatedDecodeErrorZPtr contents;
6676    /**
6677     * Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
6678     */
6679    bool result_ok;
6680 } LDKCResult_FundingCreatedDecodeErrorZ;
6681
6682 /**
6683  * The contents of CResult_FundingSignedDecodeErrorZ
6684  */
6685 typedef union LDKCResult_FundingSignedDecodeErrorZPtr {
6686    /**
6687     * A pointer to the contents in the success state.
6688     * Reading from this pointer when `result_ok` is not set is undefined.
6689     */
6690    struct LDKFundingSigned *result;
6691    /**
6692     * A pointer to the contents in the error state.
6693     * Reading from this pointer when `result_ok` is set is undefined.
6694     */
6695    struct LDKDecodeError *err;
6696 } LDKCResult_FundingSignedDecodeErrorZPtr;
6697
6698 /**
6699  * A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation,
6700  * containing a crate::lightning::ln::msgs::FundingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
6701  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6702  */
6703 typedef struct LDKCResult_FundingSignedDecodeErrorZ {
6704    /**
6705     * The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
6706     * `err` or `result` depending on the state of `result_ok`.
6707     */
6708    union LDKCResult_FundingSignedDecodeErrorZPtr contents;
6709    /**
6710     * Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
6711     */
6712    bool result_ok;
6713 } LDKCResult_FundingSignedDecodeErrorZ;
6714
6715 /**
6716  * The contents of CResult_FundingLockedDecodeErrorZ
6717  */
6718 typedef union LDKCResult_FundingLockedDecodeErrorZPtr {
6719    /**
6720     * A pointer to the contents in the success state.
6721     * Reading from this pointer when `result_ok` is not set is undefined.
6722     */
6723    struct LDKFundingLocked *result;
6724    /**
6725     * A pointer to the contents in the error state.
6726     * Reading from this pointer when `result_ok` is set is undefined.
6727     */
6728    struct LDKDecodeError *err;
6729 } LDKCResult_FundingLockedDecodeErrorZPtr;
6730
6731 /**
6732  * A CResult_FundingLockedDecodeErrorZ represents the result of a fallible operation,
6733  * containing a crate::lightning::ln::msgs::FundingLocked on success and a crate::lightning::ln::msgs::DecodeError on failure.
6734  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6735  */
6736 typedef struct LDKCResult_FundingLockedDecodeErrorZ {
6737    /**
6738     * The contents of this CResult_FundingLockedDecodeErrorZ, accessible via either
6739     * `err` or `result` depending on the state of `result_ok`.
6740     */
6741    union LDKCResult_FundingLockedDecodeErrorZPtr contents;
6742    /**
6743     * Whether this CResult_FundingLockedDecodeErrorZ represents a success state.
6744     */
6745    bool result_ok;
6746 } LDKCResult_FundingLockedDecodeErrorZ;
6747
6748
6749
6750 /**
6751  * An init message to be sent or received from a peer
6752  */
6753 typedef struct MUST_USE_STRUCT LDKInit {
6754    /**
6755     * A pointer to the opaque Rust object.
6756     * Nearly everywhere, inner must be non-null, however in places where
6757     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6758     */
6759    LDKnativeInit *inner;
6760    /**
6761     * Indicates that this is the only struct which contains the same pointer.
6762     * Rust functions which take ownership of an object provided via an argument require
6763     * this to be true and invalidate the object pointed to by inner.
6764     */
6765    bool is_owned;
6766 } LDKInit;
6767
6768 /**
6769  * The contents of CResult_InitDecodeErrorZ
6770  */
6771 typedef union LDKCResult_InitDecodeErrorZPtr {
6772    /**
6773     * A pointer to the contents in the success state.
6774     * Reading from this pointer when `result_ok` is not set is undefined.
6775     */
6776    struct LDKInit *result;
6777    /**
6778     * A pointer to the contents in the error state.
6779     * Reading from this pointer when `result_ok` is set is undefined.
6780     */
6781    struct LDKDecodeError *err;
6782 } LDKCResult_InitDecodeErrorZPtr;
6783
6784 /**
6785  * A CResult_InitDecodeErrorZ represents the result of a fallible operation,
6786  * containing a crate::lightning::ln::msgs::Init on success and a crate::lightning::ln::msgs::DecodeError on failure.
6787  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6788  */
6789 typedef struct LDKCResult_InitDecodeErrorZ {
6790    /**
6791     * The contents of this CResult_InitDecodeErrorZ, accessible via either
6792     * `err` or `result` depending on the state of `result_ok`.
6793     */
6794    union LDKCResult_InitDecodeErrorZPtr contents;
6795    /**
6796     * Whether this CResult_InitDecodeErrorZ represents a success state.
6797     */
6798    bool result_ok;
6799 } LDKCResult_InitDecodeErrorZ;
6800
6801 /**
6802  * The contents of CResult_OpenChannelDecodeErrorZ
6803  */
6804 typedef union LDKCResult_OpenChannelDecodeErrorZPtr {
6805    /**
6806     * A pointer to the contents in the success state.
6807     * Reading from this pointer when `result_ok` is not set is undefined.
6808     */
6809    struct LDKOpenChannel *result;
6810    /**
6811     * A pointer to the contents in the error state.
6812     * Reading from this pointer when `result_ok` is set is undefined.
6813     */
6814    struct LDKDecodeError *err;
6815 } LDKCResult_OpenChannelDecodeErrorZPtr;
6816
6817 /**
6818  * A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation,
6819  * containing a crate::lightning::ln::msgs::OpenChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
6820  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6821  */
6822 typedef struct LDKCResult_OpenChannelDecodeErrorZ {
6823    /**
6824     * The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
6825     * `err` or `result` depending on the state of `result_ok`.
6826     */
6827    union LDKCResult_OpenChannelDecodeErrorZPtr contents;
6828    /**
6829     * Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
6830     */
6831    bool result_ok;
6832 } LDKCResult_OpenChannelDecodeErrorZ;
6833
6834 /**
6835  * The contents of CResult_RevokeAndACKDecodeErrorZ
6836  */
6837 typedef union LDKCResult_RevokeAndACKDecodeErrorZPtr {
6838    /**
6839     * A pointer to the contents in the success state.
6840     * Reading from this pointer when `result_ok` is not set is undefined.
6841     */
6842    struct LDKRevokeAndACK *result;
6843    /**
6844     * A pointer to the contents in the error state.
6845     * Reading from this pointer when `result_ok` is set is undefined.
6846     */
6847    struct LDKDecodeError *err;
6848 } LDKCResult_RevokeAndACKDecodeErrorZPtr;
6849
6850 /**
6851  * A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
6852  * containing a crate::lightning::ln::msgs::RevokeAndACK on success and a crate::lightning::ln::msgs::DecodeError on failure.
6853  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6854  */
6855 typedef struct LDKCResult_RevokeAndACKDecodeErrorZ {
6856    /**
6857     * The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
6858     * `err` or `result` depending on the state of `result_ok`.
6859     */
6860    union LDKCResult_RevokeAndACKDecodeErrorZPtr contents;
6861    /**
6862     * Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
6863     */
6864    bool result_ok;
6865 } LDKCResult_RevokeAndACKDecodeErrorZ;
6866
6867 /**
6868  * The contents of CResult_ShutdownDecodeErrorZ
6869  */
6870 typedef union LDKCResult_ShutdownDecodeErrorZPtr {
6871    /**
6872     * A pointer to the contents in the success state.
6873     * Reading from this pointer when `result_ok` is not set is undefined.
6874     */
6875    struct LDKShutdown *result;
6876    /**
6877     * A pointer to the contents in the error state.
6878     * Reading from this pointer when `result_ok` is set is undefined.
6879     */
6880    struct LDKDecodeError *err;
6881 } LDKCResult_ShutdownDecodeErrorZPtr;
6882
6883 /**
6884  * A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation,
6885  * containing a crate::lightning::ln::msgs::Shutdown on success and a crate::lightning::ln::msgs::DecodeError on failure.
6886  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6887  */
6888 typedef struct LDKCResult_ShutdownDecodeErrorZ {
6889    /**
6890     * The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
6891     * `err` or `result` depending on the state of `result_ok`.
6892     */
6893    union LDKCResult_ShutdownDecodeErrorZPtr contents;
6894    /**
6895     * Whether this CResult_ShutdownDecodeErrorZ represents a success state.
6896     */
6897    bool result_ok;
6898 } LDKCResult_ShutdownDecodeErrorZ;
6899
6900 /**
6901  * The contents of CResult_UpdateFailHTLCDecodeErrorZ
6902  */
6903 typedef union LDKCResult_UpdateFailHTLCDecodeErrorZPtr {
6904    /**
6905     * A pointer to the contents in the success state.
6906     * Reading from this pointer when `result_ok` is not set is undefined.
6907     */
6908    struct LDKUpdateFailHTLC *result;
6909    /**
6910     * A pointer to the contents in the error state.
6911     * Reading from this pointer when `result_ok` is set is undefined.
6912     */
6913    struct LDKDecodeError *err;
6914 } LDKCResult_UpdateFailHTLCDecodeErrorZPtr;
6915
6916 /**
6917  * A CResult_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
6918  * containing a crate::lightning::ln::msgs::UpdateFailHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
6919  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6920  */
6921 typedef struct LDKCResult_UpdateFailHTLCDecodeErrorZ {
6922    /**
6923     * The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
6924     * `err` or `result` depending on the state of `result_ok`.
6925     */
6926    union LDKCResult_UpdateFailHTLCDecodeErrorZPtr contents;
6927    /**
6928     * Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
6929     */
6930    bool result_ok;
6931 } LDKCResult_UpdateFailHTLCDecodeErrorZ;
6932
6933 /**
6934  * The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
6935  */
6936 typedef union LDKCResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
6937    /**
6938     * A pointer to the contents in the success state.
6939     * Reading from this pointer when `result_ok` is not set is undefined.
6940     */
6941    struct LDKUpdateFailMalformedHTLC *result;
6942    /**
6943     * A pointer to the contents in the error state.
6944     * Reading from this pointer when `result_ok` is set is undefined.
6945     */
6946    struct LDKDecodeError *err;
6947 } LDKCResult_UpdateFailMalformedHTLCDecodeErrorZPtr;
6948
6949 /**
6950  * A CResult_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
6951  * containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
6952  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6953  */
6954 typedef struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ {
6955    /**
6956     * The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
6957     * `err` or `result` depending on the state of `result_ok`.
6958     */
6959    union LDKCResult_UpdateFailMalformedHTLCDecodeErrorZPtr contents;
6960    /**
6961     * Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
6962     */
6963    bool result_ok;
6964 } LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ;
6965
6966
6967
6968 /**
6969  * An update_fee message to be sent or received from a peer
6970  */
6971 typedef struct MUST_USE_STRUCT LDKUpdateFee {
6972    /**
6973     * A pointer to the opaque Rust object.
6974     * Nearly everywhere, inner must be non-null, however in places where
6975     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6976     */
6977    LDKnativeUpdateFee *inner;
6978    /**
6979     * Indicates that this is the only struct which contains the same pointer.
6980     * Rust functions which take ownership of an object provided via an argument require
6981     * this to be true and invalidate the object pointed to by inner.
6982     */
6983    bool is_owned;
6984 } LDKUpdateFee;
6985
6986 /**
6987  * The contents of CResult_UpdateFeeDecodeErrorZ
6988  */
6989 typedef union LDKCResult_UpdateFeeDecodeErrorZPtr {
6990    /**
6991     * A pointer to the contents in the success state.
6992     * Reading from this pointer when `result_ok` is not set is undefined.
6993     */
6994    struct LDKUpdateFee *result;
6995    /**
6996     * A pointer to the contents in the error state.
6997     * Reading from this pointer when `result_ok` is set is undefined.
6998     */
6999    struct LDKDecodeError *err;
7000 } LDKCResult_UpdateFeeDecodeErrorZPtr;
7001
7002 /**
7003  * A CResult_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
7004  * containing a crate::lightning::ln::msgs::UpdateFee on success and a crate::lightning::ln::msgs::DecodeError on failure.
7005  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7006  */
7007 typedef struct LDKCResult_UpdateFeeDecodeErrorZ {
7008    /**
7009     * The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
7010     * `err` or `result` depending on the state of `result_ok`.
7011     */
7012    union LDKCResult_UpdateFeeDecodeErrorZPtr contents;
7013    /**
7014     * Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
7015     */
7016    bool result_ok;
7017 } LDKCResult_UpdateFeeDecodeErrorZ;
7018
7019 /**
7020  * The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
7021  */
7022 typedef union LDKCResult_UpdateFulfillHTLCDecodeErrorZPtr {
7023    /**
7024     * A pointer to the contents in the success state.
7025     * Reading from this pointer when `result_ok` is not set is undefined.
7026     */
7027    struct LDKUpdateFulfillHTLC *result;
7028    /**
7029     * A pointer to the contents in the error state.
7030     * Reading from this pointer when `result_ok` is set is undefined.
7031     */
7032    struct LDKDecodeError *err;
7033 } LDKCResult_UpdateFulfillHTLCDecodeErrorZPtr;
7034
7035 /**
7036  * A CResult_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
7037  * containing a crate::lightning::ln::msgs::UpdateFulfillHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
7038  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7039  */
7040 typedef struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ {
7041    /**
7042     * The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
7043     * `err` or `result` depending on the state of `result_ok`.
7044     */
7045    union LDKCResult_UpdateFulfillHTLCDecodeErrorZPtr contents;
7046    /**
7047     * Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
7048     */
7049    bool result_ok;
7050 } LDKCResult_UpdateFulfillHTLCDecodeErrorZ;
7051
7052 /**
7053  * The contents of CResult_UpdateAddHTLCDecodeErrorZ
7054  */
7055 typedef union LDKCResult_UpdateAddHTLCDecodeErrorZPtr {
7056    /**
7057     * A pointer to the contents in the success state.
7058     * Reading from this pointer when `result_ok` is not set is undefined.
7059     */
7060    struct LDKUpdateAddHTLC *result;
7061    /**
7062     * A pointer to the contents in the error state.
7063     * Reading from this pointer when `result_ok` is set is undefined.
7064     */
7065    struct LDKDecodeError *err;
7066 } LDKCResult_UpdateAddHTLCDecodeErrorZPtr;
7067
7068 /**
7069  * A CResult_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
7070  * containing a crate::lightning::ln::msgs::UpdateAddHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
7071  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7072  */
7073 typedef struct LDKCResult_UpdateAddHTLCDecodeErrorZ {
7074    /**
7075     * The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
7076     * `err` or `result` depending on the state of `result_ok`.
7077     */
7078    union LDKCResult_UpdateAddHTLCDecodeErrorZPtr contents;
7079    /**
7080     * Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
7081     */
7082    bool result_ok;
7083 } LDKCResult_UpdateAddHTLCDecodeErrorZ;
7084
7085
7086
7087 /**
7088  * A ping message to be sent or received from a peer
7089  */
7090 typedef struct MUST_USE_STRUCT LDKPing {
7091    /**
7092     * A pointer to the opaque Rust object.
7093     * Nearly everywhere, inner must be non-null, however in places where
7094     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7095     */
7096    LDKnativePing *inner;
7097    /**
7098     * Indicates that this is the only struct which contains the same pointer.
7099     * Rust functions which take ownership of an object provided via an argument require
7100     * this to be true and invalidate the object pointed to by inner.
7101     */
7102    bool is_owned;
7103 } LDKPing;
7104
7105 /**
7106  * The contents of CResult_PingDecodeErrorZ
7107  */
7108 typedef union LDKCResult_PingDecodeErrorZPtr {
7109    /**
7110     * A pointer to the contents in the success state.
7111     * Reading from this pointer when `result_ok` is not set is undefined.
7112     */
7113    struct LDKPing *result;
7114    /**
7115     * A pointer to the contents in the error state.
7116     * Reading from this pointer when `result_ok` is set is undefined.
7117     */
7118    struct LDKDecodeError *err;
7119 } LDKCResult_PingDecodeErrorZPtr;
7120
7121 /**
7122  * A CResult_PingDecodeErrorZ represents the result of a fallible operation,
7123  * containing a crate::lightning::ln::msgs::Ping on success and a crate::lightning::ln::msgs::DecodeError on failure.
7124  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7125  */
7126 typedef struct LDKCResult_PingDecodeErrorZ {
7127    /**
7128     * The contents of this CResult_PingDecodeErrorZ, accessible via either
7129     * `err` or `result` depending on the state of `result_ok`.
7130     */
7131    union LDKCResult_PingDecodeErrorZPtr contents;
7132    /**
7133     * Whether this CResult_PingDecodeErrorZ represents a success state.
7134     */
7135    bool result_ok;
7136 } LDKCResult_PingDecodeErrorZ;
7137
7138
7139
7140 /**
7141  * A pong message to be sent or received from a peer
7142  */
7143 typedef struct MUST_USE_STRUCT LDKPong {
7144    /**
7145     * A pointer to the opaque Rust object.
7146     * Nearly everywhere, inner must be non-null, however in places where
7147     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7148     */
7149    LDKnativePong *inner;
7150    /**
7151     * Indicates that this is the only struct which contains the same pointer.
7152     * Rust functions which take ownership of an object provided via an argument require
7153     * this to be true and invalidate the object pointed to by inner.
7154     */
7155    bool is_owned;
7156 } LDKPong;
7157
7158 /**
7159  * The contents of CResult_PongDecodeErrorZ
7160  */
7161 typedef union LDKCResult_PongDecodeErrorZPtr {
7162    /**
7163     * A pointer to the contents in the success state.
7164     * Reading from this pointer when `result_ok` is not set is undefined.
7165     */
7166    struct LDKPong *result;
7167    /**
7168     * A pointer to the contents in the error state.
7169     * Reading from this pointer when `result_ok` is set is undefined.
7170     */
7171    struct LDKDecodeError *err;
7172 } LDKCResult_PongDecodeErrorZPtr;
7173
7174 /**
7175  * A CResult_PongDecodeErrorZ represents the result of a fallible operation,
7176  * containing a crate::lightning::ln::msgs::Pong on success and a crate::lightning::ln::msgs::DecodeError on failure.
7177  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7178  */
7179 typedef struct LDKCResult_PongDecodeErrorZ {
7180    /**
7181     * The contents of this CResult_PongDecodeErrorZ, accessible via either
7182     * `err` or `result` depending on the state of `result_ok`.
7183     */
7184    union LDKCResult_PongDecodeErrorZPtr contents;
7185    /**
7186     * Whether this CResult_PongDecodeErrorZ represents a success state.
7187     */
7188    bool result_ok;
7189 } LDKCResult_PongDecodeErrorZ;
7190
7191 /**
7192  * The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
7193  */
7194 typedef union LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
7195    /**
7196     * A pointer to the contents in the success state.
7197     * Reading from this pointer when `result_ok` is not set is undefined.
7198     */
7199    struct LDKUnsignedChannelAnnouncement *result;
7200    /**
7201     * A pointer to the contents in the error state.
7202     * Reading from this pointer when `result_ok` is set is undefined.
7203     */
7204    struct LDKDecodeError *err;
7205 } LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr;
7206
7207 /**
7208  * A CResult_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
7209  * containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
7210  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7211  */
7212 typedef struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ {
7213    /**
7214     * The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
7215     * `err` or `result` depending on the state of `result_ok`.
7216     */
7217    union LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr contents;
7218    /**
7219     * Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
7220     */
7221    bool result_ok;
7222 } LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ;
7223
7224 /**
7225  * The contents of CResult_ChannelAnnouncementDecodeErrorZ
7226  */
7227 typedef union LDKCResult_ChannelAnnouncementDecodeErrorZPtr {
7228    /**
7229     * A pointer to the contents in the success state.
7230     * Reading from this pointer when `result_ok` is not set is undefined.
7231     */
7232    struct LDKChannelAnnouncement *result;
7233    /**
7234     * A pointer to the contents in the error state.
7235     * Reading from this pointer when `result_ok` is set is undefined.
7236     */
7237    struct LDKDecodeError *err;
7238 } LDKCResult_ChannelAnnouncementDecodeErrorZPtr;
7239
7240 /**
7241  * A CResult_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
7242  * containing a crate::lightning::ln::msgs::ChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
7243  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7244  */
7245 typedef struct LDKCResult_ChannelAnnouncementDecodeErrorZ {
7246    /**
7247     * The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
7248     * `err` or `result` depending on the state of `result_ok`.
7249     */
7250    union LDKCResult_ChannelAnnouncementDecodeErrorZPtr contents;
7251    /**
7252     * Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
7253     */
7254    bool result_ok;
7255 } LDKCResult_ChannelAnnouncementDecodeErrorZ;
7256
7257
7258
7259 /**
7260  * The unsigned part of a channel_update
7261  */
7262 typedef struct MUST_USE_STRUCT LDKUnsignedChannelUpdate {
7263    /**
7264     * A pointer to the opaque Rust object.
7265     * Nearly everywhere, inner must be non-null, however in places where
7266     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7267     */
7268    LDKnativeUnsignedChannelUpdate *inner;
7269    /**
7270     * Indicates that this is the only struct which contains the same pointer.
7271     * Rust functions which take ownership of an object provided via an argument require
7272     * this to be true and invalidate the object pointed to by inner.
7273     */
7274    bool is_owned;
7275 } LDKUnsignedChannelUpdate;
7276
7277 /**
7278  * The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
7279  */
7280 typedef union LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr {
7281    /**
7282     * A pointer to the contents in the success state.
7283     * Reading from this pointer when `result_ok` is not set is undefined.
7284     */
7285    struct LDKUnsignedChannelUpdate *result;
7286    /**
7287     * A pointer to the contents in the error state.
7288     * Reading from this pointer when `result_ok` is set is undefined.
7289     */
7290    struct LDKDecodeError *err;
7291 } LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr;
7292
7293 /**
7294  * A CResult_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
7295  * containing a crate::lightning::ln::msgs::UnsignedChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
7296  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7297  */
7298 typedef struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ {
7299    /**
7300     * The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
7301     * `err` or `result` depending on the state of `result_ok`.
7302     */
7303    union LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr contents;
7304    /**
7305     * Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
7306     */
7307    bool result_ok;
7308 } LDKCResult_UnsignedChannelUpdateDecodeErrorZ;
7309
7310 /**
7311  * The contents of CResult_ChannelUpdateDecodeErrorZ
7312  */
7313 typedef union LDKCResult_ChannelUpdateDecodeErrorZPtr {
7314    /**
7315     * A pointer to the contents in the success state.
7316     * Reading from this pointer when `result_ok` is not set is undefined.
7317     */
7318    struct LDKChannelUpdate *result;
7319    /**
7320     * A pointer to the contents in the error state.
7321     * Reading from this pointer when `result_ok` is set is undefined.
7322     */
7323    struct LDKDecodeError *err;
7324 } LDKCResult_ChannelUpdateDecodeErrorZPtr;
7325
7326 /**
7327  * A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
7328  * containing a crate::lightning::ln::msgs::ChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
7329  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7330  */
7331 typedef struct LDKCResult_ChannelUpdateDecodeErrorZ {
7332    /**
7333     * The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
7334     * `err` or `result` depending on the state of `result_ok`.
7335     */
7336    union LDKCResult_ChannelUpdateDecodeErrorZPtr contents;
7337    /**
7338     * Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
7339     */
7340    bool result_ok;
7341 } LDKCResult_ChannelUpdateDecodeErrorZ;
7342
7343 /**
7344  * The contents of CResult_ErrorMessageDecodeErrorZ
7345  */
7346 typedef union LDKCResult_ErrorMessageDecodeErrorZPtr {
7347    /**
7348     * A pointer to the contents in the success state.
7349     * Reading from this pointer when `result_ok` is not set is undefined.
7350     */
7351    struct LDKErrorMessage *result;
7352    /**
7353     * A pointer to the contents in the error state.
7354     * Reading from this pointer when `result_ok` is set is undefined.
7355     */
7356    struct LDKDecodeError *err;
7357 } LDKCResult_ErrorMessageDecodeErrorZPtr;
7358
7359 /**
7360  * A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
7361  * containing a crate::lightning::ln::msgs::ErrorMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
7362  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7363  */
7364 typedef struct LDKCResult_ErrorMessageDecodeErrorZ {
7365    /**
7366     * The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
7367     * `err` or `result` depending on the state of `result_ok`.
7368     */
7369    union LDKCResult_ErrorMessageDecodeErrorZPtr contents;
7370    /**
7371     * Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
7372     */
7373    bool result_ok;
7374 } LDKCResult_ErrorMessageDecodeErrorZ;
7375
7376
7377
7378 /**
7379  * The unsigned part of a node_announcement
7380  */
7381 typedef struct MUST_USE_STRUCT LDKUnsignedNodeAnnouncement {
7382    /**
7383     * A pointer to the opaque Rust object.
7384     * Nearly everywhere, inner must be non-null, however in places where
7385     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7386     */
7387    LDKnativeUnsignedNodeAnnouncement *inner;
7388    /**
7389     * Indicates that this is the only struct which contains the same pointer.
7390     * Rust functions which take ownership of an object provided via an argument require
7391     * this to be true and invalidate the object pointed to by inner.
7392     */
7393    bool is_owned;
7394 } LDKUnsignedNodeAnnouncement;
7395
7396 /**
7397  * The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
7398  */
7399 typedef union LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
7400    /**
7401     * A pointer to the contents in the success state.
7402     * Reading from this pointer when `result_ok` is not set is undefined.
7403     */
7404    struct LDKUnsignedNodeAnnouncement *result;
7405    /**
7406     * A pointer to the contents in the error state.
7407     * Reading from this pointer when `result_ok` is set is undefined.
7408     */
7409    struct LDKDecodeError *err;
7410 } LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr;
7411
7412 /**
7413  * A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
7414  * containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
7415  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7416  */
7417 typedef struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ {
7418    /**
7419     * The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
7420     * `err` or `result` depending on the state of `result_ok`.
7421     */
7422    union LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr contents;
7423    /**
7424     * Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
7425     */
7426    bool result_ok;
7427 } LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ;
7428
7429 /**
7430  * The contents of CResult_NodeAnnouncementDecodeErrorZ
7431  */
7432 typedef union LDKCResult_NodeAnnouncementDecodeErrorZPtr {
7433    /**
7434     * A pointer to the contents in the success state.
7435     * Reading from this pointer when `result_ok` is not set is undefined.
7436     */
7437    struct LDKNodeAnnouncement *result;
7438    /**
7439     * A pointer to the contents in the error state.
7440     * Reading from this pointer when `result_ok` is set is undefined.
7441     */
7442    struct LDKDecodeError *err;
7443 } LDKCResult_NodeAnnouncementDecodeErrorZPtr;
7444
7445 /**
7446  * A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
7447  * containing a crate::lightning::ln::msgs::NodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
7448  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7449  */
7450 typedef struct LDKCResult_NodeAnnouncementDecodeErrorZ {
7451    /**
7452     * The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
7453     * `err` or `result` depending on the state of `result_ok`.
7454     */
7455    union LDKCResult_NodeAnnouncementDecodeErrorZPtr contents;
7456    /**
7457     * Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
7458     */
7459    bool result_ok;
7460 } LDKCResult_NodeAnnouncementDecodeErrorZ;
7461
7462 /**
7463  * The contents of CResult_QueryShortChannelIdsDecodeErrorZ
7464  */
7465 typedef union LDKCResult_QueryShortChannelIdsDecodeErrorZPtr {
7466    /**
7467     * A pointer to the contents in the success state.
7468     * Reading from this pointer when `result_ok` is not set is undefined.
7469     */
7470    struct LDKQueryShortChannelIds *result;
7471    /**
7472     * A pointer to the contents in the error state.
7473     * Reading from this pointer when `result_ok` is set is undefined.
7474     */
7475    struct LDKDecodeError *err;
7476 } LDKCResult_QueryShortChannelIdsDecodeErrorZPtr;
7477
7478 /**
7479  * A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
7480  * containing a crate::lightning::ln::msgs::QueryShortChannelIds on success and a crate::lightning::ln::msgs::DecodeError on failure.
7481  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7482  */
7483 typedef struct LDKCResult_QueryShortChannelIdsDecodeErrorZ {
7484    /**
7485     * The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
7486     * `err` or `result` depending on the state of `result_ok`.
7487     */
7488    union LDKCResult_QueryShortChannelIdsDecodeErrorZPtr contents;
7489    /**
7490     * Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
7491     */
7492    bool result_ok;
7493 } LDKCResult_QueryShortChannelIdsDecodeErrorZ;
7494
7495
7496
7497 /**
7498  * A reply_short_channel_ids_end message is sent as a reply to a
7499  * query_short_channel_ids message. The query recipient makes a best
7500  * effort to respond based on their local network view which may not be
7501  * a perfect view of the network.
7502  */
7503 typedef struct MUST_USE_STRUCT LDKReplyShortChannelIdsEnd {
7504    /**
7505     * A pointer to the opaque Rust object.
7506     * Nearly everywhere, inner must be non-null, however in places where
7507     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7508     */
7509    LDKnativeReplyShortChannelIdsEnd *inner;
7510    /**
7511     * Indicates that this is the only struct which contains the same pointer.
7512     * Rust functions which take ownership of an object provided via an argument require
7513     * this to be true and invalidate the object pointed to by inner.
7514     */
7515    bool is_owned;
7516 } LDKReplyShortChannelIdsEnd;
7517
7518 /**
7519  * The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
7520  */
7521 typedef union LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
7522    /**
7523     * A pointer to the contents in the success state.
7524     * Reading from this pointer when `result_ok` is not set is undefined.
7525     */
7526    struct LDKReplyShortChannelIdsEnd *result;
7527    /**
7528     * A pointer to the contents in the error state.
7529     * Reading from this pointer when `result_ok` is set is undefined.
7530     */
7531    struct LDKDecodeError *err;
7532 } LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr;
7533
7534 /**
7535  * A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
7536  * containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::lightning::ln::msgs::DecodeError on failure.
7537  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7538  */
7539 typedef struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ {
7540    /**
7541     * The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
7542     * `err` or `result` depending on the state of `result_ok`.
7543     */
7544    union LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr contents;
7545    /**
7546     * Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
7547     */
7548    bool result_ok;
7549 } LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ;
7550
7551 /**
7552  * The contents of CResult_QueryChannelRangeDecodeErrorZ
7553  */
7554 typedef union LDKCResult_QueryChannelRangeDecodeErrorZPtr {
7555    /**
7556     * A pointer to the contents in the success state.
7557     * Reading from this pointer when `result_ok` is not set is undefined.
7558     */
7559    struct LDKQueryChannelRange *result;
7560    /**
7561     * A pointer to the contents in the error state.
7562     * Reading from this pointer when `result_ok` is set is undefined.
7563     */
7564    struct LDKDecodeError *err;
7565 } LDKCResult_QueryChannelRangeDecodeErrorZPtr;
7566
7567 /**
7568  * A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
7569  * containing a crate::lightning::ln::msgs::QueryChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
7570  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7571  */
7572 typedef struct LDKCResult_QueryChannelRangeDecodeErrorZ {
7573    /**
7574     * The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
7575     * `err` or `result` depending on the state of `result_ok`.
7576     */
7577    union LDKCResult_QueryChannelRangeDecodeErrorZPtr contents;
7578    /**
7579     * Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
7580     */
7581    bool result_ok;
7582 } LDKCResult_QueryChannelRangeDecodeErrorZ;
7583
7584 /**
7585  * The contents of CResult_ReplyChannelRangeDecodeErrorZ
7586  */
7587 typedef union LDKCResult_ReplyChannelRangeDecodeErrorZPtr {
7588    /**
7589     * A pointer to the contents in the success state.
7590     * Reading from this pointer when `result_ok` is not set is undefined.
7591     */
7592    struct LDKReplyChannelRange *result;
7593    /**
7594     * A pointer to the contents in the error state.
7595     * Reading from this pointer when `result_ok` is set is undefined.
7596     */
7597    struct LDKDecodeError *err;
7598 } LDKCResult_ReplyChannelRangeDecodeErrorZPtr;
7599
7600 /**
7601  * A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
7602  * containing a crate::lightning::ln::msgs::ReplyChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
7603  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7604  */
7605 typedef struct LDKCResult_ReplyChannelRangeDecodeErrorZ {
7606    /**
7607     * The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
7608     * `err` or `result` depending on the state of `result_ok`.
7609     */
7610    union LDKCResult_ReplyChannelRangeDecodeErrorZPtr contents;
7611    /**
7612     * Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
7613     */
7614    bool result_ok;
7615 } LDKCResult_ReplyChannelRangeDecodeErrorZ;
7616
7617
7618
7619 /**
7620  * A gossip_timestamp_filter message is used by a node to request
7621  * gossip relay for messages in the requested time range when the
7622  * gossip_queries feature has been negotiated.
7623  */
7624 typedef struct MUST_USE_STRUCT LDKGossipTimestampFilter {
7625    /**
7626     * A pointer to the opaque Rust object.
7627     * Nearly everywhere, inner must be non-null, however in places where
7628     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7629     */
7630    LDKnativeGossipTimestampFilter *inner;
7631    /**
7632     * Indicates that this is the only struct which contains the same pointer.
7633     * Rust functions which take ownership of an object provided via an argument require
7634     * this to be true and invalidate the object pointed to by inner.
7635     */
7636    bool is_owned;
7637 } LDKGossipTimestampFilter;
7638
7639 /**
7640  * The contents of CResult_GossipTimestampFilterDecodeErrorZ
7641  */
7642 typedef union LDKCResult_GossipTimestampFilterDecodeErrorZPtr {
7643    /**
7644     * A pointer to the contents in the success state.
7645     * Reading from this pointer when `result_ok` is not set is undefined.
7646     */
7647    struct LDKGossipTimestampFilter *result;
7648    /**
7649     * A pointer to the contents in the error state.
7650     * Reading from this pointer when `result_ok` is set is undefined.
7651     */
7652    struct LDKDecodeError *err;
7653 } LDKCResult_GossipTimestampFilterDecodeErrorZPtr;
7654
7655 /**
7656  * A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
7657  * containing a crate::lightning::ln::msgs::GossipTimestampFilter on success and a crate::lightning::ln::msgs::DecodeError on failure.
7658  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7659  */
7660 typedef struct LDKCResult_GossipTimestampFilterDecodeErrorZ {
7661    /**
7662     * The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
7663     * `err` or `result` depending on the state of `result_ok`.
7664     */
7665    union LDKCResult_GossipTimestampFilterDecodeErrorZPtr contents;
7666    /**
7667     * Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
7668     */
7669    bool result_ok;
7670 } LDKCResult_GossipTimestampFilterDecodeErrorZ;
7671
7672 /**
7673  * When signing using a fallible method either an user-supplied `SignError` or a `CreationError`
7674  * may occur.
7675  */
7676 typedef enum LDKSignOrCreationError_Tag {
7677    /**
7678     * An error occurred during signing
7679     */
7680    LDKSignOrCreationError_SignError,
7681    /**
7682     * An error occurred while building the transaction
7683     */
7684    LDKSignOrCreationError_CreationError,
7685    /**
7686     * Must be last for serialization purposes
7687     */
7688    LDKSignOrCreationError_Sentinel,
7689 } LDKSignOrCreationError_Tag;
7690
7691 typedef struct MUST_USE_STRUCT LDKSignOrCreationError {
7692    LDKSignOrCreationError_Tag tag;
7693    union {
7694       struct {
7695          enum LDKCreationError creation_error;
7696       };
7697    };
7698 } LDKSignOrCreationError;
7699
7700 /**
7701  * The contents of CResult_InvoiceSignOrCreationErrorZ
7702  */
7703 typedef union LDKCResult_InvoiceSignOrCreationErrorZPtr {
7704    /**
7705     * A pointer to the contents in the success state.
7706     * Reading from this pointer when `result_ok` is not set is undefined.
7707     */
7708    struct LDKInvoice *result;
7709    /**
7710     * A pointer to the contents in the error state.
7711     * Reading from this pointer when `result_ok` is set is undefined.
7712     */
7713    struct LDKSignOrCreationError *err;
7714 } LDKCResult_InvoiceSignOrCreationErrorZPtr;
7715
7716 /**
7717  * A CResult_InvoiceSignOrCreationErrorZ represents the result of a fallible operation,
7718  * containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SignOrCreationError on failure.
7719  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7720  */
7721 typedef struct LDKCResult_InvoiceSignOrCreationErrorZ {
7722    /**
7723     * The contents of this CResult_InvoiceSignOrCreationErrorZ, accessible via either
7724     * `err` or `result` depending on the state of `result_ok`.
7725     */
7726    union LDKCResult_InvoiceSignOrCreationErrorZPtr contents;
7727    /**
7728     * Whether this CResult_InvoiceSignOrCreationErrorZ represents a success state.
7729     */
7730    bool result_ok;
7731 } LDKCResult_InvoiceSignOrCreationErrorZ;
7732
7733 /**
7734  * A trait indicating an object may generate message send events
7735  */
7736 typedef struct LDKMessageSendEventsProvider {
7737    /**
7738     * An opaque pointer which is passed to your function implementations as an argument.
7739     * This has no meaning in the LDK, and can be NULL or any other value.
7740     */
7741    void *this_arg;
7742    /**
7743     * Gets the list of pending events which were generated by previous actions, clearing the list
7744     * in the process.
7745     */
7746    struct LDKCVec_MessageSendEventZ (*get_and_clear_pending_msg_events)(const void *this_arg);
7747    /**
7748     * Frees any resources associated with this object given its this_arg pointer.
7749     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7750     */
7751    void (*free)(void *this_arg);
7752 } LDKMessageSendEventsProvider;
7753
7754 /**
7755  * A trait implemented for objects handling events from [`EventsProvider`].
7756  */
7757 typedef struct LDKEventHandler {
7758    /**
7759     * An opaque pointer which is passed to your function implementations as an argument.
7760     * This has no meaning in the LDK, and can be NULL or any other value.
7761     */
7762    void *this_arg;
7763    /**
7764     * Handles the given [`Event`].
7765     *
7766     * See [`EventsProvider`] for details that must be considered when implementing this method.
7767     */
7768    void (*handle_event)(const void *this_arg, struct LDKEvent event);
7769    /**
7770     * Frees any resources associated with this object given its this_arg pointer.
7771     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7772     */
7773    void (*free)(void *this_arg);
7774 } LDKEventHandler;
7775
7776 /**
7777  * A trait indicating an object may generate events.
7778  *
7779  * Events are processed by passing an [`EventHandler`] to [`process_pending_events`].
7780  *
7781  * # Requirements
7782  *
7783  * See [`process_pending_events`] for requirements around event processing.
7784  *
7785  * When using this trait, [`process_pending_events`] will call [`handle_event`] for each pending
7786  * event since the last invocation. The handler must either act upon the event immediately
7787  * or preserve it for later handling.
7788  *
7789  * Note, handlers may call back into the provider and thus deadlocking must be avoided. Be sure to
7790  * consult the provider's documentation on the implication of processing events and how a handler
7791  * may safely use the provider (e.g., see [`ChannelManager::process_pending_events`] and
7792  * [`ChainMonitor::process_pending_events`]).
7793  *
7794  * (C-not implementable) As there is likely no reason for a user to implement this trait on their
7795  * own type(s).
7796  *
7797  * [`process_pending_events`]: Self::process_pending_events
7798  * [`handle_event`]: EventHandler::handle_event
7799  * [`ChannelManager::process_pending_events`]: crate::ln::channelmanager::ChannelManager#method.process_pending_events
7800  * [`ChainMonitor::process_pending_events`]: crate::chain::chainmonitor::ChainMonitor#method.process_pending_events
7801  */
7802 typedef struct LDKEventsProvider {
7803    /**
7804     * An opaque pointer which is passed to your function implementations as an argument.
7805     * This has no meaning in the LDK, and can be NULL or any other value.
7806     */
7807    void *this_arg;
7808    /**
7809     * Processes any events generated since the last call using the given event handler.
7810     *
7811     * Subsequent calls must only process new events. However, handlers must be capable of handling
7812     * duplicate events across process restarts. This may occur if the provider was recovered from
7813     * an old state (i.e., it hadn't been successfully persisted after processing pending events).
7814     */
7815    void (*process_pending_events)(const void *this_arg, struct LDKEventHandler handler);
7816    /**
7817     * Frees any resources associated with this object given its this_arg pointer.
7818     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7819     */
7820    void (*free)(void *this_arg);
7821 } LDKEventsProvider;
7822
7823
7824
7825 /**
7826  * Configuration we set when applicable.
7827  *
7828  * Default::default() provides sane defaults.
7829  */
7830 typedef struct MUST_USE_STRUCT LDKChannelHandshakeConfig {
7831    /**
7832     * A pointer to the opaque Rust object.
7833     * Nearly everywhere, inner must be non-null, however in places where
7834     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7835     */
7836    LDKnativeChannelHandshakeConfig *inner;
7837    /**
7838     * Indicates that this is the only struct which contains the same pointer.
7839     * Rust functions which take ownership of an object provided via an argument require
7840     * this to be true and invalidate the object pointed to by inner.
7841     */
7842    bool is_owned;
7843 } LDKChannelHandshakeConfig;
7844
7845
7846
7847 /**
7848  * Optional channel limits which are applied during channel creation.
7849  *
7850  * These limits are only applied to our counterparty's limits, not our own.
7851  *
7852  * Use 0/<type>::max_value() as appropriate to skip checking.
7853  *
7854  * Provides sane defaults for most configurations.
7855  *
7856  * Most additional limits are disabled except those with which specify a default in individual
7857  * field documentation. Note that this may result in barely-usable channels, but since they
7858  * are applied mostly only to incoming channels that's not much of a problem.
7859  */
7860 typedef struct MUST_USE_STRUCT LDKChannelHandshakeLimits {
7861    /**
7862     * A pointer to the opaque Rust object.
7863     * Nearly everywhere, inner must be non-null, however in places where
7864     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7865     */
7866    LDKnativeChannelHandshakeLimits *inner;
7867    /**
7868     * Indicates that this is the only struct which contains the same pointer.
7869     * Rust functions which take ownership of an object provided via an argument require
7870     * this to be true and invalidate the object pointed to by inner.
7871     */
7872    bool is_owned;
7873 } LDKChannelHandshakeLimits;
7874
7875
7876
7877 /**
7878  * Top-level config which holds ChannelHandshakeLimits and ChannelConfig.
7879  *
7880  * Default::default() provides sane defaults for most configurations
7881  * (but currently with 0 relay fees!)
7882  */
7883 typedef struct MUST_USE_STRUCT LDKUserConfig {
7884    /**
7885     * A pointer to the opaque Rust object.
7886     * Nearly everywhere, inner must be non-null, however in places where
7887     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7888     */
7889    LDKnativeUserConfig *inner;
7890    /**
7891     * Indicates that this is the only struct which contains the same pointer.
7892     * Rust functions which take ownership of an object provided via an argument require
7893     * this to be true and invalidate the object pointed to by inner.
7894     */
7895    bool is_owned;
7896 } LDKUserConfig;
7897
7898 /**
7899  * The `Access` trait defines behavior for accessing chain data and state, such as blocks and
7900  * UTXOs.
7901  */
7902 typedef struct LDKAccess {
7903    /**
7904     * An opaque pointer which is passed to your function implementations as an argument.
7905     * This has no meaning in the LDK, and can be NULL or any other value.
7906     */
7907    void *this_arg;
7908    /**
7909     * Returns the transaction output of a funding transaction encoded by [`short_channel_id`].
7910     * Returns an error if `genesis_hash` is for a different chain or if such a transaction output
7911     * is unknown.
7912     *
7913     * [`short_channel_id`]: https://github.com/lightningnetwork/lightning-rfc/blob/master/07-routing-gossip.md#definition-of-short_channel_id
7914     */
7915    struct LDKCResult_TxOutAccessErrorZ (*get_utxo)(const void *this_arg, const uint8_t (*genesis_hash)[32], uint64_t short_channel_id);
7916    /**
7917     * Frees any resources associated with this object given its this_arg pointer.
7918     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7919     */
7920    void (*free)(void *this_arg);
7921 } LDKAccess;
7922
7923 /**
7924  * The `Listen` trait is used to notify when blocks have been connected or disconnected from the
7925  * chain.
7926  *
7927  * Useful when needing to replay chain data upon startup or as new chain events occur. Clients
7928  * sourcing chain data using a block-oriented API should prefer this interface over [`Confirm`].
7929  * Such clients fetch the entire header chain whereas clients using [`Confirm`] only fetch headers
7930  * when needed.
7931  */
7932 typedef struct LDKListen {
7933    /**
7934     * An opaque pointer which is passed to your function implementations as an argument.
7935     * This has no meaning in the LDK, and can be NULL or any other value.
7936     */
7937    void *this_arg;
7938    /**
7939     * Notifies the listener that a block was added at the given height.
7940     */
7941    void (*block_connected)(const void *this_arg, struct LDKu8slice block, uint32_t height);
7942    /**
7943     * Notifies the listener that a block was removed at the given height.
7944     */
7945    void (*block_disconnected)(const void *this_arg, const uint8_t (*header)[80], uint32_t height);
7946    /**
7947     * Frees any resources associated with this object given its this_arg pointer.
7948     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7949     */
7950    void (*free)(void *this_arg);
7951 } LDKListen;
7952
7953 /**
7954  * The `Confirm` trait is used to notify when transactions have been confirmed on chain or
7955  * unconfirmed during a chain reorganization.
7956  *
7957  * Clients sourcing chain data using a transaction-oriented API should prefer this interface over
7958  * [`Listen`]. For instance, an Electrum client may implement [`Filter`] by subscribing to activity
7959  * related to registered transactions and outputs. Upon notification, it would pass along the
7960  * matching transactions using this interface.
7961  *
7962  * # Use
7963  *
7964  * The intended use is as follows:
7965  * - Call [`transactions_confirmed`] to process any on-chain activity of interest.
7966  * - Call [`transaction_unconfirmed`] to process any transaction returned by [`get_relevant_txids`]
7967  *   that has been reorganized out of the chain.
7968  * - Call [`best_block_updated`] whenever a new chain tip becomes available.
7969  *
7970  * # Order
7971  *
7972  * Clients must call these methods in chain order. Specifically:
7973  * - Transactions confirmed in a block must be given before transactions confirmed in a later
7974  *   block.
7975  * - Dependent transactions within the same block must be given in topological order, possibly in
7976  *   separate calls.
7977  * - Unconfirmed transactions must be given after the original confirmations and before any
7978  *   reconfirmation.
7979  *
7980  * See individual method documentation for further details.
7981  *
7982  * [`transactions_confirmed`]: Self::transactions_confirmed
7983  * [`transaction_unconfirmed`]: Self::transaction_unconfirmed
7984  * [`best_block_updated`]: Self::best_block_updated
7985  * [`get_relevant_txids`]: Self::get_relevant_txids
7986  */
7987 typedef struct LDKConfirm {
7988    /**
7989     * An opaque pointer which is passed to your function implementations as an argument.
7990     * This has no meaning in the LDK, and can be NULL or any other value.
7991     */
7992    void *this_arg;
7993    /**
7994     * Processes transactions confirmed in a block with a given header and height.
7995     *
7996     * Should be called for any transactions registered by [`Filter::register_tx`] or any
7997     * transactions spending an output registered by [`Filter::register_output`]. Such transactions
7998     * appearing in the same block do not need to be included in the same call; instead, multiple
7999     * calls with additional transactions may be made so long as they are made in [chain order].
8000     *
8001     * May be called before or after [`best_block_updated`] for the corresponding block. However,
8002     * in the event of a chain reorganization, it must not be called with a `header` that is no
8003     * longer in the chain as of the last call to [`best_block_updated`].
8004     *
8005     * [chain order]: Confirm#Order
8006     * [`best_block_updated`]: Self::best_block_updated
8007     */
8008    void (*transactions_confirmed)(const void *this_arg, const uint8_t (*header)[80], struct LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height);
8009    /**
8010     * Processes a transaction that is no longer confirmed as result of a chain reorganization.
8011     *
8012     * Should be called for any transaction returned by [`get_relevant_txids`] if it has been
8013     * reorganized out of the best chain. Once called, the given transaction should not be returned
8014     * by [`get_relevant_txids`] unless it has been reconfirmed via [`transactions_confirmed`].
8015     *
8016     * [`get_relevant_txids`]: Self::get_relevant_txids
8017     * [`transactions_confirmed`]: Self::transactions_confirmed
8018     */
8019    void (*transaction_unconfirmed)(const void *this_arg, const uint8_t (*txid)[32]);
8020    /**
8021     * Processes an update to the best header connected at the given height.
8022     *
8023     * Should be called when a new header is available but may be skipped for intermediary blocks
8024     * if they become available at the same time.
8025     */
8026    void (*best_block_updated)(const void *this_arg, const uint8_t (*header)[80], uint32_t height);
8027    /**
8028     * Returns transactions that should be monitored for reorganization out of the chain.
8029     *
8030     * Should include any transactions passed to [`transactions_confirmed`] that have insufficient
8031     * confirmations to be safe from a chain reorganization. Should not include any transactions
8032     * passed to [`transaction_unconfirmed`] unless later reconfirmed.
8033     *
8034     * May be called to determine the subset of transactions that must still be monitored for
8035     * reorganization. Will be idempotent between calls but may change as a result of calls to the
8036     * other interface methods. Thus, this is useful to determine which transactions may need to be
8037     * given to [`transaction_unconfirmed`].
8038     *
8039     * [`transactions_confirmed`]: Self::transactions_confirmed
8040     * [`transaction_unconfirmed`]: Self::transaction_unconfirmed
8041     */
8042    struct LDKCVec_TxidZ (*get_relevant_txids)(const void *this_arg);
8043    /**
8044     * Frees any resources associated with this object given its this_arg pointer.
8045     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
8046     */
8047    void (*free)(void *this_arg);
8048 } LDKConfirm;
8049
8050
8051
8052 /**
8053  * A transaction output watched by a [`ChannelMonitor`] for spends on-chain.
8054  *
8055  * Used to convey to a [`Filter`] such an output with a given spending condition. Any transaction
8056  * spending the output must be given to [`ChannelMonitor::block_connected`] either directly or via
8057  * the return value of [`Filter::register_output`].
8058  *
8059  * If `block_hash` is `Some`, this indicates the output was created in the corresponding block and
8060  * may have been spent there. See [`Filter::register_output`] for details.
8061  *
8062  * [`ChannelMonitor`]: channelmonitor::ChannelMonitor
8063  * [`ChannelMonitor::block_connected`]: channelmonitor::ChannelMonitor::block_connected
8064  */
8065 typedef struct MUST_USE_STRUCT LDKWatchedOutput {
8066    /**
8067     * A pointer to the opaque Rust object.
8068     * Nearly everywhere, inner must be non-null, however in places where
8069     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8070     */
8071    LDKnativeWatchedOutput *inner;
8072    /**
8073     * Indicates that this is the only struct which contains the same pointer.
8074     * Rust functions which take ownership of an object provided via an argument require
8075     * this to be true and invalidate the object pointed to by inner.
8076     */
8077    bool is_owned;
8078 } LDKWatchedOutput;
8079
8080 /**
8081  * The `Filter` trait defines behavior for indicating chain activity of interest pertaining to
8082  * channels.
8083  *
8084  * This is useful in order to have a [`Watch`] implementation convey to a chain source which
8085  * transactions to be notified of. Notification may take the form of pre-filtering blocks or, in
8086  * the case of [BIP 157]/[BIP 158], only fetching a block if the compact filter matches. If
8087  * receiving full blocks from a chain source, any further filtering is unnecessary.
8088  *
8089  * After an output has been registered, subsequent block retrievals from the chain source must not
8090  * exclude any transactions matching the new criteria nor any in-block descendants of such
8091  * transactions.
8092  *
8093  * Note that use as part of a [`Watch`] implementation involves reentrancy. Therefore, the `Filter`
8094  * should not block on I/O. Implementations should instead queue the newly monitored data to be
8095  * processed later. Then, in order to block until the data has been processed, any [`Watch`]
8096  * invocation that has called the `Filter` must return [`TemporaryFailure`].
8097  *
8098  * [`TemporaryFailure`]: channelmonitor::ChannelMonitorUpdateErr::TemporaryFailure
8099  * [BIP 157]: https://github.com/bitcoin/bips/blob/master/bip-0157.mediawiki
8100  * [BIP 158]: https://github.com/bitcoin/bips/blob/master/bip-0158.mediawiki
8101  */
8102 typedef struct LDKFilter {
8103    /**
8104     * An opaque pointer which is passed to your function implementations as an argument.
8105     * This has no meaning in the LDK, and can be NULL or any other value.
8106     */
8107    void *this_arg;
8108    /**
8109     * Registers interest in a transaction with `txid` and having an output with `script_pubkey` as
8110     * a spending condition.
8111     */
8112    void (*register_tx)(const void *this_arg, const uint8_t (*txid)[32], struct LDKu8slice script_pubkey);
8113    /**
8114     * Registers interest in spends of a transaction output.
8115     *
8116     * Optionally, when `output.block_hash` is set, should return any transaction spending the
8117     * output that is found in the corresponding block along with its index.
8118     *
8119     * This return value is useful for Electrum clients in order to supply in-block descendant
8120     * transactions which otherwise were not included. This is not necessary for other clients if
8121     * such descendant transactions were already included (e.g., when a BIP 157 client provides the
8122     * full block).
8123     */
8124    struct LDKCOption_C2Tuple_usizeTransactionZZ (*register_output)(const void *this_arg, struct LDKWatchedOutput output);
8125    /**
8126     * Frees any resources associated with this object given its this_arg pointer.
8127     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
8128     */
8129    void (*free)(void *this_arg);
8130 } LDKFilter;
8131
8132 /**
8133  * `Persist` defines behavior for persisting channel monitors: this could mean
8134  * writing once to disk, and/or uploading to one or more backup services.
8135  *
8136  * Note that for every new monitor, you **must** persist the new `ChannelMonitor`
8137  * to disk/backups. And, on every update, you **must** persist either the
8138  * `ChannelMonitorUpdate` or the updated monitor itself. Otherwise, there is risk
8139  * of situations such as revoking a transaction, then crashing before this
8140  * revocation can be persisted, then unintentionally broadcasting a revoked
8141  * transaction and losing money. This is a risk because previous channel states
8142  * are toxic, so it's important that whatever channel state is persisted is
8143  * kept up-to-date.
8144  */
8145 typedef struct LDKPersist {
8146    /**
8147     * An opaque pointer which is passed to your function implementations as an argument.
8148     * This has no meaning in the LDK, and can be NULL or any other value.
8149     */
8150    void *this_arg;
8151    /**
8152     * Persist a new channel's data. The data can be stored any way you want, but
8153     * the identifier provided by Rust-Lightning is the channel's outpoint (and
8154     * it is up to you to maintain a correct mapping between the outpoint and the
8155     * stored channel data). Note that you **must** persist every new monitor to
8156     * disk. See the `Persist` trait documentation for more details.
8157     *
8158     * See [`ChannelMonitor::write`] for writing out a `ChannelMonitor`,
8159     * and [`ChannelMonitorUpdateErr`] for requirements when returning errors.
8160     */
8161    struct LDKCResult_NoneChannelMonitorUpdateErrZ (*persist_new_channel)(const void *this_arg, struct LDKOutPoint id, const struct LDKChannelMonitor *NONNULL_PTR data);
8162    /**
8163     * Update one channel's data. The provided `ChannelMonitor` has already
8164     * applied the given update.
8165     *
8166     * Note that on every update, you **must** persist either the
8167     * `ChannelMonitorUpdate` or the updated monitor itself to disk/backups. See
8168     * the `Persist` trait documentation for more details.
8169     *
8170     * If an implementer chooses to persist the updates only, they need to make
8171     * sure that all the updates are applied to the `ChannelMonitors` *before*
8172     * the set of channel monitors is given to the `ChannelManager`
8173     * deserialization routine. See [`ChannelMonitor::update_monitor`] for
8174     * applying a monitor update to a monitor. If full `ChannelMonitors` are
8175     * persisted, then there is no need to persist individual updates.
8176     *
8177     * Note that there could be a performance tradeoff between persisting complete
8178     * channel monitors on every update vs. persisting only updates and applying
8179     * them in batches. The size of each monitor grows `O(number of state updates)`
8180     * whereas updates are small and `O(1)`.
8181     *
8182     * See [`ChannelMonitor::write`] for writing out a `ChannelMonitor`,
8183     * [`ChannelMonitorUpdate::write`] for writing out an update, and
8184     * [`ChannelMonitorUpdateErr`] for requirements when returning errors.
8185     */
8186    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);
8187    /**
8188     * Frees any resources associated with this object given its this_arg pointer.
8189     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
8190     */
8191    void (*free)(void *this_arg);
8192 } LDKPersist;
8193
8194
8195
8196 /**
8197  * An implementation of [`chain::Watch`] for monitoring channels.
8198  *
8199  * Connected and disconnected blocks must be provided to `ChainMonitor` as documented by
8200  * [`chain::Watch`]. May be used in conjunction with [`ChannelManager`] to monitor channels locally
8201  * or used independently to monitor channels remotely. See the [module-level documentation] for
8202  * details.
8203  *
8204  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
8205  * [module-level documentation]: crate::chain::chainmonitor
8206  */
8207 typedef struct MUST_USE_STRUCT LDKChainMonitor {
8208    /**
8209     * A pointer to the opaque Rust object.
8210     * Nearly everywhere, inner must be non-null, however in places where
8211     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8212     */
8213    LDKnativeChainMonitor *inner;
8214    /**
8215     * Indicates that this is the only struct which contains the same pointer.
8216     * Rust functions which take ownership of an object provided via an argument require
8217     * this to be true and invalidate the object pointed to by inner.
8218     */
8219    bool is_owned;
8220 } LDKChainMonitor;
8221
8222
8223
8224 /**
8225  * Simple KeysInterface implementor that takes a 32-byte seed for use as a BIP 32 extended key
8226  * and derives keys from that.
8227  *
8228  * Your node_id is seed/0'
8229  * ChannelMonitor closes may use seed/1'
8230  * Cooperative closes may use seed/2'
8231  * The two close keys may be needed to claim on-chain funds!
8232  */
8233 typedef struct MUST_USE_STRUCT LDKKeysManager {
8234    /**
8235     * A pointer to the opaque Rust object.
8236     * Nearly everywhere, inner must be non-null, however in places where
8237     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8238     */
8239    LDKnativeKeysManager *inner;
8240    /**
8241     * Indicates that this is the only struct which contains the same pointer.
8242     * Rust functions which take ownership of an object provided via an argument require
8243     * this to be true and invalidate the object pointed to by inner.
8244     */
8245    bool is_owned;
8246 } LDKKeysManager;
8247
8248
8249
8250 /**
8251  * Chain-related parameters used to construct a new `ChannelManager`.
8252  *
8253  * Typically, the block-specific parameters are derived from the best block hash for the network,
8254  * as a newly constructed `ChannelManager` will not have created any channels yet. These parameters
8255  * are not needed when deserializing a previously constructed `ChannelManager`.
8256  */
8257 typedef struct MUST_USE_STRUCT LDKChainParameters {
8258    /**
8259     * A pointer to the opaque Rust object.
8260     * Nearly everywhere, inner must be non-null, however in places where
8261     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8262     */
8263    LDKnativeChainParameters *inner;
8264    /**
8265     * Indicates that this is the only struct which contains the same pointer.
8266     * Rust functions which take ownership of an object provided via an argument require
8267     * this to be true and invalidate the object pointed to by inner.
8268     */
8269    bool is_owned;
8270 } LDKChainParameters;
8271
8272
8273
8274 /**
8275  * The best known block as identified by its hash and height.
8276  */
8277 typedef struct MUST_USE_STRUCT LDKBestBlock {
8278    /**
8279     * A pointer to the opaque Rust object.
8280     * Nearly everywhere, inner must be non-null, however in places where
8281     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8282     */
8283    LDKnativeBestBlock *inner;
8284    /**
8285     * Indicates that this is the only struct which contains the same pointer.
8286     * Rust functions which take ownership of an object provided via an argument require
8287     * this to be true and invalidate the object pointed to by inner.
8288     */
8289    bool is_owned;
8290 } LDKBestBlock;
8291
8292 /**
8293  * A 3-byte byte array.
8294  */
8295 typedef struct LDKThreeBytes {
8296    /**
8297     * The three bytes
8298     */
8299    uint8_t data[3];
8300 } LDKThreeBytes;
8301
8302 /**
8303  * A trait to describe an object which can receive channel messages.
8304  *
8305  * Messages MAY be called in parallel when they originate from different their_node_ids, however
8306  * they MUST NOT be called in parallel when the two calls have the same their_node_id.
8307  */
8308 typedef struct LDKChannelMessageHandler {
8309    /**
8310     * An opaque pointer which is passed to your function implementations as an argument.
8311     * This has no meaning in the LDK, and can be NULL or any other value.
8312     */
8313    void *this_arg;
8314    /**
8315     * Handle an incoming open_channel message from the given peer.
8316     */
8317    void (*handle_open_channel)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKInitFeatures their_features, const struct LDKOpenChannel *NONNULL_PTR msg);
8318    /**
8319     * Handle an incoming accept_channel message from the given peer.
8320     */
8321    void (*handle_accept_channel)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKInitFeatures their_features, const struct LDKAcceptChannel *NONNULL_PTR msg);
8322    /**
8323     * Handle an incoming funding_created message from the given peer.
8324     */
8325    void (*handle_funding_created)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingCreated *NONNULL_PTR msg);
8326    /**
8327     * Handle an incoming funding_signed message from the given peer.
8328     */
8329    void (*handle_funding_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingSigned *NONNULL_PTR msg);
8330    /**
8331     * Handle an incoming funding_locked message from the given peer.
8332     */
8333    void (*handle_funding_locked)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingLocked *NONNULL_PTR msg);
8334    /**
8335     * Handle an incoming shutdown message from the given peer.
8336     */
8337    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);
8338    /**
8339     * Handle an incoming closing_signed message from the given peer.
8340     */
8341    void (*handle_closing_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKClosingSigned *NONNULL_PTR msg);
8342    /**
8343     * Handle an incoming update_add_htlc message from the given peer.
8344     */
8345    void (*handle_update_add_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateAddHTLC *NONNULL_PTR msg);
8346    /**
8347     * Handle an incoming update_fulfill_htlc message from the given peer.
8348     */
8349    void (*handle_update_fulfill_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFulfillHTLC *NONNULL_PTR msg);
8350    /**
8351     * Handle an incoming update_fail_htlc message from the given peer.
8352     */
8353    void (*handle_update_fail_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFailHTLC *NONNULL_PTR msg);
8354    /**
8355     * Handle an incoming update_fail_malformed_htlc message from the given peer.
8356     */
8357    void (*handle_update_fail_malformed_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR msg);
8358    /**
8359     * Handle an incoming commitment_signed message from the given peer.
8360     */
8361    void (*handle_commitment_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKCommitmentSigned *NONNULL_PTR msg);
8362    /**
8363     * Handle an incoming revoke_and_ack message from the given peer.
8364     */
8365    void (*handle_revoke_and_ack)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKRevokeAndACK *NONNULL_PTR msg);
8366    /**
8367     * Handle an incoming update_fee message from the given peer.
8368     */
8369    void (*handle_update_fee)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFee *NONNULL_PTR msg);
8370    /**
8371     * Handle an incoming announcement_signatures message from the given peer.
8372     */
8373    void (*handle_announcement_signatures)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKAnnouncementSignatures *NONNULL_PTR msg);
8374    /**
8375     * Indicates a connection to the peer failed/an existing connection was lost. If no connection
8376     * is believed to be possible in the future (eg they're sending us messages we don't
8377     * understand or indicate they require unknown feature bits), no_connection_possible is set
8378     * and any outstanding channels should be failed.
8379     */
8380    void (*peer_disconnected)(const void *this_arg, struct LDKPublicKey their_node_id, bool no_connection_possible);
8381    /**
8382     * Handle a peer reconnecting, possibly generating channel_reestablish message(s).
8383     */
8384    void (*peer_connected)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR msg);
8385    /**
8386     * Handle an incoming channel_reestablish message from the given peer.
8387     */
8388    void (*handle_channel_reestablish)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelReestablish *NONNULL_PTR msg);
8389    /**
8390     * Handle an incoming channel update from the given peer.
8391     */
8392    void (*handle_channel_update)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelUpdate *NONNULL_PTR msg);
8393    /**
8394     * Handle an incoming error message from the given peer.
8395     */
8396    void (*handle_error)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKErrorMessage *NONNULL_PTR msg);
8397    /**
8398     * Implementation of MessageSendEventsProvider for this object.
8399     */
8400    struct LDKMessageSendEventsProvider MessageSendEventsProvider;
8401    /**
8402     * Frees any resources associated with this object given its this_arg pointer.
8403     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
8404     */
8405    void (*free)(void *this_arg);
8406 } LDKChannelMessageHandler;
8407
8408
8409
8410 /**
8411  * Arguments for the creation of a ChannelManager that are not deserialized.
8412  *
8413  * At a high-level, the process for deserializing a ChannelManager and resuming normal operation
8414  * is:
8415  * 1) Deserialize all stored ChannelMonitors.
8416  * 2) Deserialize the ChannelManager by filling in this struct and calling:
8417  *    <(BlockHash, ChannelManager)>::read(reader, args)
8418  *    This may result in closing some Channels if the ChannelMonitor is newer than the stored
8419  *    ChannelManager state to ensure no loss of funds. Thus, transactions may be broadcasted.
8420  * 3) If you are not fetching full blocks, register all relevant ChannelMonitor outpoints the same
8421  *    way you would handle a `chain::Filter` call using ChannelMonitor::get_outputs_to_watch() and
8422  *    ChannelMonitor::get_funding_txo().
8423  * 4) Reconnect blocks on your ChannelMonitors.
8424  * 5) Disconnect/connect blocks on the ChannelManager.
8425  * 6) Move the ChannelMonitors into your local chain::Watch.
8426  *
8427  * Note that the ordering of #4-6 is not of importance, however all three must occur before you
8428  * call any other methods on the newly-deserialized ChannelManager.
8429  *
8430  * Note that because some channels may be closed during deserialization, it is critical that you
8431  * always deserialize only the latest version of a ChannelManager and ChannelMonitors available to
8432  * you. If you deserialize an old ChannelManager (during which force-closure transactions may be
8433  * broadcast), and then later deserialize a newer version of the same ChannelManager (which will
8434  * not force-close the same channels but consider them live), you may end up revoking a state for
8435  * which you've already broadcasted the transaction.
8436  */
8437 typedef struct MUST_USE_STRUCT LDKChannelManagerReadArgs {
8438    /**
8439     * A pointer to the opaque Rust object.
8440     * Nearly everywhere, inner must be non-null, however in places where
8441     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8442     */
8443    LDKnativeChannelManagerReadArgs *inner;
8444    /**
8445     * Indicates that this is the only struct which contains the same pointer.
8446     * Rust functions which take ownership of an object provided via an argument require
8447     * this to be true and invalidate the object pointed to by inner.
8448     */
8449    bool is_owned;
8450 } LDKChannelManagerReadArgs;
8451
8452
8453
8454 /**
8455  * Proof that the sender knows the per-commitment secret of the previous commitment transaction.
8456  * This is used to convince the recipient that the channel is at a certain commitment
8457  * number even if they lost that data due to a local failure.  Of course, the peer may lie
8458  * and even later commitments may have been revoked.
8459  */
8460 typedef struct MUST_USE_STRUCT LDKDataLossProtect {
8461    /**
8462     * A pointer to the opaque Rust object.
8463     * Nearly everywhere, inner must be non-null, however in places where
8464     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8465     */
8466    LDKnativeDataLossProtect *inner;
8467    /**
8468     * Indicates that this is the only struct which contains the same pointer.
8469     * Rust functions which take ownership of an object provided via an argument require
8470     * this to be true and invalidate the object pointed to by inner.
8471     */
8472    bool is_owned;
8473 } LDKDataLossProtect;
8474
8475 /**
8476  * A trait to describe an object which can receive routing messages.
8477  *
8478  * # Implementor DoS Warnings
8479  *
8480  * For `gossip_queries` messages there are potential DoS vectors when handling
8481  * inbound queries. Implementors using an on-disk network graph should be aware of
8482  * repeated disk I/O for queries accessing different parts of the network graph.
8483  */
8484 typedef struct LDKRoutingMessageHandler {
8485    /**
8486     * An opaque pointer which is passed to your function implementations as an argument.
8487     * This has no meaning in the LDK, and can be NULL or any other value.
8488     */
8489    void *this_arg;
8490    /**
8491     * Handle an incoming node_announcement message, returning true if it should be forwarded on,
8492     * false or returning an Err otherwise.
8493     */
8494    struct LDKCResult_boolLightningErrorZ (*handle_node_announcement)(const void *this_arg, const struct LDKNodeAnnouncement *NONNULL_PTR msg);
8495    /**
8496     * Handle a channel_announcement message, returning true if it should be forwarded on, false
8497     * or returning an Err otherwise.
8498     */
8499    struct LDKCResult_boolLightningErrorZ (*handle_channel_announcement)(const void *this_arg, const struct LDKChannelAnnouncement *NONNULL_PTR msg);
8500    /**
8501     * Handle an incoming channel_update message, returning true if it should be forwarded on,
8502     * false or returning an Err otherwise.
8503     */
8504    struct LDKCResult_boolLightningErrorZ (*handle_channel_update)(const void *this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg);
8505    /**
8506     * Handle some updates to the route graph that we learned due to an outbound failed payment.
8507     */
8508    void (*handle_htlc_fail_channel_update)(const void *this_arg, const struct LDKHTLCFailChannelUpdate *NONNULL_PTR update);
8509    /**
8510     * Gets a subset of the channel announcements and updates required to dump our routing table
8511     * to a remote node, starting at the short_channel_id indicated by starting_point and
8512     * including the batch_amount entries immediately higher in numerical value than starting_point.
8513     */
8514    struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ (*get_next_channel_announcements)(const void *this_arg, uint64_t starting_point, uint8_t batch_amount);
8515    /**
8516     * Gets a subset of the node announcements required to dump our routing table to a remote node,
8517     * starting at the node *after* the provided publickey and including batch_amount entries
8518     * immediately higher (as defined by <PublicKey as Ord>::cmp) than starting_point.
8519     * If None is provided for starting_point, we start at the first node.
8520     */
8521    struct LDKCVec_NodeAnnouncementZ (*get_next_node_announcements)(const void *this_arg, struct LDKPublicKey starting_point, uint8_t batch_amount);
8522    /**
8523     * Called when a connection is established with a peer. This can be used to
8524     * perform routing table synchronization using a strategy defined by the
8525     * implementor.
8526     */
8527    void (*sync_routing_table)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR init);
8528    /**
8529     * Handles the reply of a query we initiated to learn about channels
8530     * for a given range of blocks. We can expect to receive one or more
8531     * replies to a single query.
8532     */
8533    struct LDKCResult_NoneLightningErrorZ (*handle_reply_channel_range)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKReplyChannelRange msg);
8534    /**
8535     * Handles the reply of a query we initiated asking for routing gossip
8536     * messages for a list of channels. We should receive this message when
8537     * a node has completed its best effort to send us the pertaining routing
8538     * gossip messages.
8539     */
8540    struct LDKCResult_NoneLightningErrorZ (*handle_reply_short_channel_ids_end)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKReplyShortChannelIdsEnd msg);
8541    /**
8542     * Handles when a peer asks us to send a list of short_channel_ids
8543     * for the requested range of blocks.
8544     */
8545    struct LDKCResult_NoneLightningErrorZ (*handle_query_channel_range)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKQueryChannelRange msg);
8546    /**
8547     * Handles when a peer asks us to send routing gossip messages for a
8548     * list of short_channel_ids.
8549     */
8550    struct LDKCResult_NoneLightningErrorZ (*handle_query_short_channel_ids)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKQueryShortChannelIds msg);
8551    /**
8552     * Implementation of MessageSendEventsProvider for this object.
8553     */
8554    struct LDKMessageSendEventsProvider MessageSendEventsProvider;
8555    /**
8556     * Frees any resources associated with this object given its this_arg pointer.
8557     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
8558     */
8559    void (*free)(void *this_arg);
8560 } LDKRoutingMessageHandler;
8561
8562
8563
8564 /**
8565  * A dummy struct which implements `RoutingMessageHandler` without storing any routing information
8566  * or doing any processing. You can provide one of these as the route_handler in a MessageHandler.
8567  */
8568 typedef struct MUST_USE_STRUCT LDKIgnoringMessageHandler {
8569    /**
8570     * A pointer to the opaque Rust object.
8571     * Nearly everywhere, inner must be non-null, however in places where
8572     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8573     */
8574    LDKnativeIgnoringMessageHandler *inner;
8575    /**
8576     * Indicates that this is the only struct which contains the same pointer.
8577     * Rust functions which take ownership of an object provided via an argument require
8578     * this to be true and invalidate the object pointed to by inner.
8579     */
8580    bool is_owned;
8581 } LDKIgnoringMessageHandler;
8582
8583
8584
8585 /**
8586  * A dummy struct which implements `ChannelMessageHandler` without having any channels.
8587  * You can provide one of these as the route_handler in a MessageHandler.
8588  */
8589 typedef struct MUST_USE_STRUCT LDKErroringMessageHandler {
8590    /**
8591     * A pointer to the opaque Rust object.
8592     * Nearly everywhere, inner must be non-null, however in places where
8593     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8594     */
8595    LDKnativeErroringMessageHandler *inner;
8596    /**
8597     * Indicates that this is the only struct which contains the same pointer.
8598     * Rust functions which take ownership of an object provided via an argument require
8599     * this to be true and invalidate the object pointed to by inner.
8600     */
8601    bool is_owned;
8602 } LDKErroringMessageHandler;
8603
8604
8605
8606 /**
8607  * Provides references to trait impls which handle different types of messages.
8608  */
8609 typedef struct MUST_USE_STRUCT LDKMessageHandler {
8610    /**
8611     * A pointer to the opaque Rust object.
8612     * Nearly everywhere, inner must be non-null, however in places where
8613     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8614     */
8615    LDKnativeMessageHandler *inner;
8616    /**
8617     * Indicates that this is the only struct which contains the same pointer.
8618     * Rust functions which take ownership of an object provided via an argument require
8619     * this to be true and invalidate the object pointed to by inner.
8620     */
8621    bool is_owned;
8622 } LDKMessageHandler;
8623
8624 /**
8625  * Provides an object which can be used to send data to and which uniquely identifies a connection
8626  * to a remote host. You will need to be able to generate multiple of these which meet Eq and
8627  * implement Hash to meet the PeerManager API.
8628  *
8629  * For efficiency, Clone should be relatively cheap for this type.
8630  *
8631  * You probably want to just extend an int and put a file descriptor in a struct and implement
8632  * send_data. Note that if you are using a higher-level net library that may call close() itself,
8633  * be careful to ensure you don't have races whereby you might register a new connection with an
8634  * fd which is the same as a previous one which has yet to be removed via
8635  * PeerManager::socket_disconnected().
8636  */
8637 typedef struct LDKSocketDescriptor {
8638    /**
8639     * An opaque pointer which is passed to your function implementations as an argument.
8640     * This has no meaning in the LDK, and can be NULL or any other value.
8641     */
8642    void *this_arg;
8643    /**
8644     * Attempts to send some data from the given slice to the peer.
8645     *
8646     * Returns the amount of data which was sent, possibly 0 if the socket has since disconnected.
8647     * Note that in the disconnected case, socket_disconnected must still fire and further write
8648     * attempts may occur until that time.
8649     *
8650     * If the returned size is smaller than data.len(), a write_available event must
8651     * trigger the next time more data can be written. Additionally, until the a send_data event
8652     * completes fully, no further read_events should trigger on the same peer!
8653     *
8654     * If a read_event on this descriptor had previously returned true (indicating that read
8655     * events should be paused to prevent DoS in the send buffer), resume_read may be set
8656     * indicating that read events on this descriptor should resume. A resume_read of false does
8657     * *not* imply that further read events should be paused.
8658     */
8659    uintptr_t (*send_data)(void *this_arg, struct LDKu8slice data, bool resume_read);
8660    /**
8661     * Disconnect the socket pointed to by this SocketDescriptor. Once this function returns, no
8662     * more calls to write_buffer_space_avail, read_event or socket_disconnected may be made with
8663     * this descriptor. No socket_disconnected call should be generated as a result of this call,
8664     * though races may occur whereby disconnect_socket is called after a call to
8665     * socket_disconnected but prior to socket_disconnected returning.
8666     */
8667    void (*disconnect_socket)(void *this_arg);
8668    /**
8669     * Checks if two objects are equal given this object's this_arg pointer and another object.
8670     */
8671    bool (*eq)(const void *this_arg, const struct LDKSocketDescriptor *NONNULL_PTR other_arg);
8672    /**
8673     * Calculate a succinct non-cryptographic hash for an object given its this_arg pointer.
8674     * This is used, for example, for inclusion of this object in a hash map.
8675     */
8676    uint64_t (*hash)(const void *this_arg);
8677    /**
8678     * Creates a copy of the object pointed to by this_arg, for a copy of this SocketDescriptor.
8679     * Note that the ultimate copy of the SocketDescriptor will have all function pointers the same as the original.
8680     * May be NULL if no action needs to be taken, the this_arg pointer will be copied into the new SocketDescriptor.
8681     */
8682    void *(*clone)(const void *this_arg);
8683    /**
8684     * Frees any resources associated with this object given its this_arg pointer.
8685     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
8686     */
8687    void (*free)(void *this_arg);
8688 } LDKSocketDescriptor;
8689
8690
8691
8692 /**
8693  * A PeerManager manages a set of peers, described by their SocketDescriptor and marshalls socket
8694  * events into messages which it passes on to its MessageHandlers.
8695  *
8696  * Rather than using a plain PeerManager, it is preferable to use either a SimpleArcPeerManager
8697  * a SimpleRefPeerManager, for conciseness. See their documentation for more details, but
8698  * essentially you should default to using a SimpleRefPeerManager, and use a
8699  * SimpleArcPeerManager when you require a PeerManager with a static lifetime, such as when
8700  * you're using lightning-net-tokio.
8701  */
8702 typedef struct MUST_USE_STRUCT LDKPeerManager {
8703    /**
8704     * A pointer to the opaque Rust object.
8705     * Nearly everywhere, inner must be non-null, however in places where
8706     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8707     */
8708    LDKnativePeerManager *inner;
8709    /**
8710     * Indicates that this is the only struct which contains the same pointer.
8711     * Rust functions which take ownership of an object provided via an argument require
8712     * this to be true and invalidate the object pointed to by inner.
8713     */
8714    bool is_owned;
8715 } LDKPeerManager;
8716
8717
8718
8719 /**
8720  * Static channel fields used to build transactions given per-commitment fields, organized by
8721  * broadcaster/countersignatory.
8722  *
8723  * This is derived from the holder/counterparty-organized ChannelTransactionParameters via the
8724  * as_holder_broadcastable and as_counterparty_broadcastable functions.
8725  */
8726 typedef struct MUST_USE_STRUCT LDKDirectedChannelTransactionParameters {
8727    /**
8728     * A pointer to the opaque Rust object.
8729     * Nearly everywhere, inner must be non-null, however in places where
8730     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8731     */
8732    LDKnativeDirectedChannelTransactionParameters *inner;
8733    /**
8734     * Indicates that this is the only struct which contains the same pointer.
8735     * Rust functions which take ownership of an object provided via an argument require
8736     * this to be true and invalidate the object pointed to by inner.
8737     */
8738    bool is_owned;
8739 } LDKDirectedChannelTransactionParameters;
8740
8741
8742
8743 /**
8744  * A simple newtype for RwLockReadGuard<'a, NetworkGraph>.
8745  * This exists only to make accessing a RwLock<NetworkGraph> possible from
8746  * the C bindings, as it can be done directly in Rust code.
8747  */
8748 typedef struct MUST_USE_STRUCT LDKLockedNetworkGraph {
8749    /**
8750     * A pointer to the opaque Rust object.
8751     * Nearly everywhere, inner must be non-null, however in places where
8752     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8753     */
8754    LDKnativeLockedNetworkGraph *inner;
8755    /**
8756     * Indicates that this is the only struct which contains the same pointer.
8757     * Rust functions which take ownership of an object provided via an argument require
8758     * this to be true and invalidate the object pointed to by inner.
8759     */
8760    bool is_owned;
8761 } LDKLockedNetworkGraph;
8762
8763
8764
8765 /**
8766  * Receives and validates network updates from peers,
8767  * stores authentic and relevant data as a network graph.
8768  * This network graph is then used for routing payments.
8769  * Provides interface to help with initial routing sync by
8770  * serving historical announcements.
8771  */
8772 typedef struct MUST_USE_STRUCT LDKNetGraphMsgHandler {
8773    /**
8774     * A pointer to the opaque Rust object.
8775     * Nearly everywhere, inner must be non-null, however in places where
8776     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8777     */
8778    LDKnativeNetGraphMsgHandler *inner;
8779    /**
8780     * Indicates that this is the only struct which contains the same pointer.
8781     * Rust functions which take ownership of an object provided via an argument require
8782     * this to be true and invalidate the object pointed to by inner.
8783     */
8784    bool is_owned;
8785 } LDKNetGraphMsgHandler;
8786
8787
8788
8789 /**
8790  * FilesystemPersister persists channel data on disk, where each channel's
8791  * data is stored in a file named after its funding outpoint.
8792  *
8793  * Warning: this module does the best it can with calls to persist data, but it
8794  * can only guarantee that the data is passed to the drive. It is up to the
8795  * drive manufacturers to do the actual persistence properly, which they often
8796  * don't (especially on consumer-grade hardware). Therefore, it is up to the
8797  * user to validate their entire storage stack, to ensure the writes are
8798  * persistent.
8799  * Corollary: especially when dealing with larger amounts of money, it is best
8800  * practice to have multiple channel data backups and not rely only on one
8801  * FilesystemPersister.
8802  */
8803 typedef struct MUST_USE_STRUCT LDKFilesystemPersister {
8804    /**
8805     * A pointer to the opaque Rust object.
8806     * Nearly everywhere, inner must be non-null, however in places where
8807     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8808     */
8809    LDKnativeFilesystemPersister *inner;
8810    /**
8811     * Indicates that this is the only struct which contains the same pointer.
8812     * Rust functions which take ownership of an object provided via an argument require
8813     * this to be true and invalidate the object pointed to by inner.
8814     */
8815    bool is_owned;
8816 } LDKFilesystemPersister;
8817
8818
8819
8820 /**
8821  * BackgroundProcessor takes care of tasks that (1) need to happen periodically to keep
8822  * Rust-Lightning running properly, and (2) either can or should be run in the background. Its
8823  * responsibilities are:
8824  * * Monitoring whether the ChannelManager needs to be re-persisted to disk, and if so,
8825  *   writing it to disk/backups by invoking the callback given to it at startup.
8826  *   ChannelManager persistence should be done in the background.
8827  * * Calling `ChannelManager::timer_tick_occurred()` and
8828  *   `PeerManager::timer_tick_occurred()` every minute (can be done in the
8829  *   background).
8830  *
8831  * Note that if ChannelManager persistence fails and the persisted manager becomes out-of-date,
8832  * then there is a risk of channels force-closing on startup when the manager realizes it's
8833  * outdated. However, as long as `ChannelMonitor` backups are sound, no funds besides those used
8834  * for unilateral chain closure fees are at risk.
8835  */
8836 typedef struct MUST_USE_STRUCT LDKBackgroundProcessor {
8837    /**
8838     * A pointer to the opaque Rust object.
8839     * Nearly everywhere, inner must be non-null, however in places where
8840     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8841     */
8842    LDKnativeBackgroundProcessor *inner;
8843    /**
8844     * Indicates that this is the only struct which contains the same pointer.
8845     * Rust functions which take ownership of an object provided via an argument require
8846     * this to be true and invalidate the object pointed to by inner.
8847     */
8848    bool is_owned;
8849 } LDKBackgroundProcessor;
8850
8851 /**
8852  * Trait which handles persisting a [`ChannelManager`] to disk.
8853  *
8854  * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
8855  */
8856 typedef struct LDKChannelManagerPersister {
8857    /**
8858     * An opaque pointer which is passed to your function implementations as an argument.
8859     * This has no meaning in the LDK, and can be NULL or any other value.
8860     */
8861    void *this_arg;
8862    /**
8863     * Persist the given [`ChannelManager`] to disk, returning an error if persistence failed
8864     * (which will cause the [`BackgroundProcessor`] which called this method to exit.
8865     *
8866     * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
8867     */
8868    struct LDKCResult_NoneErrorZ (*persist_manager)(const void *this_arg, const struct LDKChannelManager *NONNULL_PTR channel_manager);
8869    /**
8870     * Frees any resources associated with this object given its this_arg pointer.
8871     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
8872     */
8873    void (*free)(void *this_arg);
8874 } LDKChannelManagerPersister;
8875
8876
8877
8878 /**
8879  * Data of the `RawInvoice` that is encoded in the data part
8880  */
8881 typedef struct MUST_USE_STRUCT LDKRawDataPart {
8882    /**
8883     * A pointer to the opaque Rust object.
8884     * Nearly everywhere, inner must be non-null, however in places where
8885     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8886     */
8887    LDKnativeRawDataPart *inner;
8888    /**
8889     * Indicates that this is the only struct which contains the same pointer.
8890     * Rust functions which take ownership of an object provided via an argument require
8891     * this to be true and invalidate the object pointed to by inner.
8892     */
8893    bool is_owned;
8894 } LDKRawDataPart;
8895
8896
8897
8898 /**
8899  * SHA-256 hash
8900  */
8901 typedef struct MUST_USE_STRUCT LDKSha256 {
8902    /**
8903     * A pointer to the opaque Rust object.
8904     * Nearly everywhere, inner must be non-null, however in places where
8905     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8906     */
8907    LDKnativeSha256 *inner;
8908    /**
8909     * Indicates that this is the only struct which contains the same pointer.
8910     * Rust functions which take ownership of an object provided via an argument require
8911     * this to be true and invalidate the object pointed to by inner.
8912     */
8913    bool is_owned;
8914 } LDKSha256;
8915
8916
8917
8918 /**
8919  * `min_final_cltv_expiry` to use for the last HTLC in the route
8920  */
8921 typedef struct MUST_USE_STRUCT LDKMinFinalCltvExpiry {
8922    /**
8923     * A pointer to the opaque Rust object.
8924     * Nearly everywhere, inner must be non-null, however in places where
8925     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8926     */
8927    LDKnativeMinFinalCltvExpiry *inner;
8928    /**
8929     * Indicates that this is the only struct which contains the same pointer.
8930     * Rust functions which take ownership of an object provided via an argument require
8931     * this to be true and invalidate the object pointed to by inner.
8932     */
8933    bool is_owned;
8934 } LDKMinFinalCltvExpiry;
8935
8936 /**
8937  * Integer in the range `0..32`
8938  */
8939 typedef struct LDKu5 {
8940    uint8_t _0;
8941 } LDKu5;
8942
8943 /**
8944  * A 20-byte byte array.
8945  */
8946 typedef struct LDKTwentyBytes {
8947    /**
8948     * The twenty bytes
8949     */
8950    uint8_t data[20];
8951 } LDKTwentyBytes;
8952
8953 /**
8954  * Fallback address in case no LN payment is possible
8955  */
8956 typedef enum LDKFallback_Tag {
8957    LDKFallback_SegWitProgram,
8958    LDKFallback_PubKeyHash,
8959    LDKFallback_ScriptHash,
8960    /**
8961     * Must be last for serialization purposes
8962     */
8963    LDKFallback_Sentinel,
8964 } LDKFallback_Tag;
8965
8966 typedef struct LDKFallback_LDKSegWitProgram_Body {
8967    struct LDKu5 version;
8968    struct LDKCVec_u8Z program;
8969 } LDKFallback_LDKSegWitProgram_Body;
8970
8971 typedef struct MUST_USE_STRUCT LDKFallback {
8972    LDKFallback_Tag tag;
8973    union {
8974       LDKFallback_LDKSegWitProgram_Body seg_wit_program;
8975       struct {
8976          struct LDKTwentyBytes pub_key_hash;
8977       };
8978       struct {
8979          struct LDKTwentyBytes script_hash;
8980       };
8981    };
8982 } LDKFallback;
8983
8984 extern const uintptr_t MAX_BUF_SIZE;
8985
8986 extern const uint64_t MIN_RELAY_FEE_SAT_PER_1000_WEIGHT;
8987
8988 extern const uint64_t CLOSED_CHANNEL_UPDATE_ID;
8989
8990 extern const uint32_t ANTI_REORG_DELAY;
8991
8992 extern const uint16_t BREAKDOWN_TIMEOUT;
8993
8994 extern const uint16_t MIN_CLTV_EXPIRY_DELTA;
8995
8996 extern const uint32_t MIN_FINAL_CLTV_EXPIRY;
8997
8998 extern const uintptr_t REVOKEABLE_REDEEMSCRIPT_MAX_LENGTH;
8999
9000 extern const uint8_t TAG_PAYMENT_HASH;
9001
9002 extern const uint8_t TAG_DESCRIPTION;
9003
9004 extern const uint8_t TAG_PAYEE_PUB_KEY;
9005
9006 extern const uint8_t TAG_DESCRIPTION_HASH;
9007
9008 extern const uint8_t TAG_EXPIRY_TIME;
9009
9010 extern const uint8_t TAG_MIN_FINAL_CLTV_EXPIRY;
9011
9012 extern const uint8_t TAG_FALLBACK;
9013
9014 extern const uint8_t TAG_ROUTE;
9015
9016 extern const uint8_t TAG_PAYMENT_SECRET;
9017
9018 extern const uint8_t TAG_FEATURES;
9019
9020 struct LDKStr _ldk_get_compiled_version(void);
9021
9022 struct LDKStr _ldk_c_bindings_get_compiled_version(void);
9023
9024 /**
9025  * Frees the data buffer, if data_is_owned is set and datalen > 0.
9026  */
9027 void Transaction_free(struct LDKTransaction _res);
9028
9029 /**
9030  * Frees the data pointed to by script_pubkey.
9031  */
9032 void TxOut_free(struct LDKTxOut _res);
9033
9034 /**
9035  * Creates a new TxOut which has the same data as `orig` but with a new script buffer.
9036  */
9037 struct LDKTxOut TxOut_clone(const struct LDKTxOut *NONNULL_PTR orig);
9038
9039 /**
9040  * Frees the data buffer, if chars_is_owned is set and len > 0.
9041  */
9042 void Str_free(struct LDKStr _res);
9043
9044 /**
9045  * Creates a new CResult_SecretKeyErrorZ in the success state.
9046  */
9047 struct LDKCResult_SecretKeyErrorZ CResult_SecretKeyErrorZ_ok(struct LDKSecretKey o);
9048
9049 /**
9050  * Creates a new CResult_SecretKeyErrorZ in the error state.
9051  */
9052 struct LDKCResult_SecretKeyErrorZ CResult_SecretKeyErrorZ_err(enum LDKSecp256k1Error e);
9053
9054 /**
9055  * Frees any resources used by the CResult_SecretKeyErrorZ.
9056  */
9057 void CResult_SecretKeyErrorZ_free(struct LDKCResult_SecretKeyErrorZ _res);
9058
9059 /**
9060  * Creates a new CResult_PublicKeyErrorZ in the success state.
9061  */
9062 struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_ok(struct LDKPublicKey o);
9063
9064 /**
9065  * Creates a new CResult_PublicKeyErrorZ in the error state.
9066  */
9067 struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_err(enum LDKSecp256k1Error e);
9068
9069 /**
9070  * Frees any resources used by the CResult_PublicKeyErrorZ.
9071  */
9072 void CResult_PublicKeyErrorZ_free(struct LDKCResult_PublicKeyErrorZ _res);
9073
9074 /**
9075  * Creates a new CResult_PublicKeyErrorZ which has the same data as `orig`
9076  * but with all dynamically-allocated buffers duplicated in new buffers.
9077  */
9078 struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_clone(const struct LDKCResult_PublicKeyErrorZ *NONNULL_PTR orig);
9079
9080 /**
9081  * Creates a new CResult_TxCreationKeysDecodeErrorZ in the success state.
9082  */
9083 struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_ok(struct LDKTxCreationKeys o);
9084
9085 /**
9086  * Creates a new CResult_TxCreationKeysDecodeErrorZ in the error state.
9087  */
9088 struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_err(struct LDKDecodeError e);
9089
9090 /**
9091  * Frees any resources used by the CResult_TxCreationKeysDecodeErrorZ.
9092  */
9093 void CResult_TxCreationKeysDecodeErrorZ_free(struct LDKCResult_TxCreationKeysDecodeErrorZ _res);
9094
9095 /**
9096  * Creates a new CResult_TxCreationKeysDecodeErrorZ which has the same data as `orig`
9097  * but with all dynamically-allocated buffers duplicated in new buffers.
9098  */
9099 struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_clone(const struct LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR orig);
9100
9101 /**
9102  * Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the success state.
9103  */
9104 struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_ok(struct LDKChannelPublicKeys o);
9105
9106 /**
9107  * Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the error state.
9108  */
9109 struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_err(struct LDKDecodeError e);
9110
9111 /**
9112  * Frees any resources used by the CResult_ChannelPublicKeysDecodeErrorZ.
9113  */
9114 void CResult_ChannelPublicKeysDecodeErrorZ_free(struct LDKCResult_ChannelPublicKeysDecodeErrorZ _res);
9115
9116 /**
9117  * Creates a new CResult_ChannelPublicKeysDecodeErrorZ which has the same data as `orig`
9118  * but with all dynamically-allocated buffers duplicated in new buffers.
9119  */
9120 struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_clone(const struct LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR orig);
9121
9122 /**
9123  * Creates a new CResult_TxCreationKeysErrorZ in the success state.
9124  */
9125 struct LDKCResult_TxCreationKeysErrorZ CResult_TxCreationKeysErrorZ_ok(struct LDKTxCreationKeys o);
9126
9127 /**
9128  * Creates a new CResult_TxCreationKeysErrorZ in the error state.
9129  */
9130 struct LDKCResult_TxCreationKeysErrorZ CResult_TxCreationKeysErrorZ_err(enum LDKSecp256k1Error e);
9131
9132 /**
9133  * Frees any resources used by the CResult_TxCreationKeysErrorZ.
9134  */
9135 void CResult_TxCreationKeysErrorZ_free(struct LDKCResult_TxCreationKeysErrorZ _res);
9136
9137 /**
9138  * Creates a new CResult_TxCreationKeysErrorZ which has the same data as `orig`
9139  * but with all dynamically-allocated buffers duplicated in new buffers.
9140  */
9141 struct LDKCResult_TxCreationKeysErrorZ CResult_TxCreationKeysErrorZ_clone(const struct LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR orig);
9142
9143 /**
9144  * Constructs a new COption_u32Z containing a u32
9145  */
9146 struct LDKCOption_u32Z COption_u32Z_some(uint32_t o);
9147
9148 /**
9149  * Constructs a new COption_u32Z containing nothing
9150  */
9151 struct LDKCOption_u32Z COption_u32Z_none(void);
9152
9153 /**
9154  * Frees any resources associated with the u32, if we are in the Some state
9155  */
9156 void COption_u32Z_free(struct LDKCOption_u32Z _res);
9157
9158 /**
9159  * Creates a new COption_u32Z which has the same data as `orig`
9160  * but with all dynamically-allocated buffers duplicated in new buffers.
9161  */
9162 struct LDKCOption_u32Z COption_u32Z_clone(const struct LDKCOption_u32Z *NONNULL_PTR orig);
9163
9164 /**
9165  * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the success state.
9166  */
9167 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(struct LDKHTLCOutputInCommitment o);
9168
9169 /**
9170  * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the error state.
9171  */
9172 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_err(struct LDKDecodeError e);
9173
9174 /**
9175  * Frees any resources used by the CResult_HTLCOutputInCommitmentDecodeErrorZ.
9176  */
9177 void CResult_HTLCOutputInCommitmentDecodeErrorZ_free(struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res);
9178
9179 /**
9180  * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ which has the same data as `orig`
9181  * but with all dynamically-allocated buffers duplicated in new buffers.
9182  */
9183 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(const struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR orig);
9184
9185 /**
9186  * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the success state.
9187  */
9188 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(struct LDKCounterpartyChannelTransactionParameters o);
9189
9190 /**
9191  * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the error state.
9192  */
9193 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(struct LDKDecodeError e);
9194
9195 /**
9196  * Frees any resources used by the CResult_CounterpartyChannelTransactionParametersDecodeErrorZ.
9197  */
9198 void CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res);
9199
9200 /**
9201  * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
9202  * but with all dynamically-allocated buffers duplicated in new buffers.
9203  */
9204 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(const struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR orig);
9205
9206 /**
9207  * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the success state.
9208  */
9209 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_ok(struct LDKChannelTransactionParameters o);
9210
9211 /**
9212  * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the error state.
9213  */
9214 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_err(struct LDKDecodeError e);
9215
9216 /**
9217  * Frees any resources used by the CResult_ChannelTransactionParametersDecodeErrorZ.
9218  */
9219 void CResult_ChannelTransactionParametersDecodeErrorZ_free(struct LDKCResult_ChannelTransactionParametersDecodeErrorZ _res);
9220
9221 /**
9222  * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
9223  * but with all dynamically-allocated buffers duplicated in new buffers.
9224  */
9225 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_clone(const struct LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR orig);
9226
9227 /**
9228  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9229  */
9230 void CVec_SignatureZ_free(struct LDKCVec_SignatureZ _res);
9231
9232 /**
9233  * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the success state.
9234  */
9235 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_ok(struct LDKHolderCommitmentTransaction o);
9236
9237 /**
9238  * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the error state.
9239  */
9240 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
9241
9242 /**
9243  * Frees any resources used by the CResult_HolderCommitmentTransactionDecodeErrorZ.
9244  */
9245 void CResult_HolderCommitmentTransactionDecodeErrorZ_free(struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res);
9246
9247 /**
9248  * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ which has the same data as `orig`
9249  * but with all dynamically-allocated buffers duplicated in new buffers.
9250  */
9251 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
9252
9253 /**
9254  * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the success state.
9255  */
9256 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(struct LDKBuiltCommitmentTransaction o);
9257
9258 /**
9259  * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the error state.
9260  */
9261 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
9262
9263 /**
9264  * Frees any resources used by the CResult_BuiltCommitmentTransactionDecodeErrorZ.
9265  */
9266 void CResult_BuiltCommitmentTransactionDecodeErrorZ_free(struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res);
9267
9268 /**
9269  * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ which has the same data as `orig`
9270  * but with all dynamically-allocated buffers duplicated in new buffers.
9271  */
9272 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
9273
9274 /**
9275  * Creates a new CResult_CommitmentTransactionDecodeErrorZ in the success state.
9276  */
9277 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_ok(struct LDKCommitmentTransaction o);
9278
9279 /**
9280  * Creates a new CResult_CommitmentTransactionDecodeErrorZ in the error state.
9281  */
9282 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
9283
9284 /**
9285  * Frees any resources used by the CResult_CommitmentTransactionDecodeErrorZ.
9286  */
9287 void CResult_CommitmentTransactionDecodeErrorZ_free(struct LDKCResult_CommitmentTransactionDecodeErrorZ _res);
9288
9289 /**
9290  * Creates a new CResult_CommitmentTransactionDecodeErrorZ which has the same data as `orig`
9291  * but with all dynamically-allocated buffers duplicated in new buffers.
9292  */
9293 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
9294
9295 /**
9296  * Creates a new CResult_TrustedCommitmentTransactionNoneZ in the success state.
9297  */
9298 struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_ok(struct LDKTrustedCommitmentTransaction o);
9299
9300 /**
9301  * Creates a new CResult_TrustedCommitmentTransactionNoneZ in the error state.
9302  */
9303 struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_err(void);
9304
9305 /**
9306  * Frees any resources used by the CResult_TrustedCommitmentTransactionNoneZ.
9307  */
9308 void CResult_TrustedCommitmentTransactionNoneZ_free(struct LDKCResult_TrustedCommitmentTransactionNoneZ _res);
9309
9310 /**
9311  * Creates a new CResult_CVec_SignatureZNoneZ in the success state.
9312  */
9313 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_ok(struct LDKCVec_SignatureZ o);
9314
9315 /**
9316  * Creates a new CResult_CVec_SignatureZNoneZ in the error state.
9317  */
9318 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_err(void);
9319
9320 /**
9321  * Frees any resources used by the CResult_CVec_SignatureZNoneZ.
9322  */
9323 void CResult_CVec_SignatureZNoneZ_free(struct LDKCResult_CVec_SignatureZNoneZ _res);
9324
9325 /**
9326  * Creates a new CResult_CVec_SignatureZNoneZ which has the same data as `orig`
9327  * but with all dynamically-allocated buffers duplicated in new buffers.
9328  */
9329 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_clone(const struct LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR orig);
9330
9331 /**
9332  * Creates a new CResult_NoneErrorZ in the success state.
9333  */
9334 struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_ok(void);
9335
9336 /**
9337  * Creates a new CResult_NoneErrorZ in the error state.
9338  */
9339 struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_err(enum LDKIOError e);
9340
9341 /**
9342  * Frees any resources used by the CResult_NoneErrorZ.
9343  */
9344 void CResult_NoneErrorZ_free(struct LDKCResult_NoneErrorZ _res);
9345
9346 /**
9347  * Creates a new CResult_NoneErrorZ which has the same data as `orig`
9348  * but with all dynamically-allocated buffers duplicated in new buffers.
9349  */
9350 struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_clone(const struct LDKCResult_NoneErrorZ *NONNULL_PTR orig);
9351
9352 /**
9353  * Creates a new CResult_RouteHopDecodeErrorZ in the success state.
9354  */
9355 struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_ok(struct LDKRouteHop o);
9356
9357 /**
9358  * Creates a new CResult_RouteHopDecodeErrorZ in the error state.
9359  */
9360 struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_err(struct LDKDecodeError e);
9361
9362 /**
9363  * Frees any resources used by the CResult_RouteHopDecodeErrorZ.
9364  */
9365 void CResult_RouteHopDecodeErrorZ_free(struct LDKCResult_RouteHopDecodeErrorZ _res);
9366
9367 /**
9368  * Creates a new CResult_RouteHopDecodeErrorZ which has the same data as `orig`
9369  * but with all dynamically-allocated buffers duplicated in new buffers.
9370  */
9371 struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_clone(const struct LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR orig);
9372
9373 /**
9374  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9375  */
9376 void CVec_RouteHopZ_free(struct LDKCVec_RouteHopZ _res);
9377
9378 /**
9379  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9380  */
9381 void CVec_CVec_RouteHopZZ_free(struct LDKCVec_CVec_RouteHopZZ _res);
9382
9383 /**
9384  * Creates a new CResult_RouteDecodeErrorZ in the success state.
9385  */
9386 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_ok(struct LDKRoute o);
9387
9388 /**
9389  * Creates a new CResult_RouteDecodeErrorZ in the error state.
9390  */
9391 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_err(struct LDKDecodeError e);
9392
9393 /**
9394  * Frees any resources used by the CResult_RouteDecodeErrorZ.
9395  */
9396 void CResult_RouteDecodeErrorZ_free(struct LDKCResult_RouteDecodeErrorZ _res);
9397
9398 /**
9399  * Creates a new CResult_RouteDecodeErrorZ which has the same data as `orig`
9400  * but with all dynamically-allocated buffers duplicated in new buffers.
9401  */
9402 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_clone(const struct LDKCResult_RouteDecodeErrorZ *NONNULL_PTR orig);
9403
9404 /**
9405  * Constructs a new COption_u64Z containing a u64
9406  */
9407 struct LDKCOption_u64Z COption_u64Z_some(uint64_t o);
9408
9409 /**
9410  * Constructs a new COption_u64Z containing nothing
9411  */
9412 struct LDKCOption_u64Z COption_u64Z_none(void);
9413
9414 /**
9415  * Frees any resources associated with the u64, if we are in the Some state
9416  */
9417 void COption_u64Z_free(struct LDKCOption_u64Z _res);
9418
9419 /**
9420  * Creates a new COption_u64Z which has the same data as `orig`
9421  * but with all dynamically-allocated buffers duplicated in new buffers.
9422  */
9423 struct LDKCOption_u64Z COption_u64Z_clone(const struct LDKCOption_u64Z *NONNULL_PTR orig);
9424
9425 /**
9426  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9427  */
9428 void CVec_ChannelDetailsZ_free(struct LDKCVec_ChannelDetailsZ _res);
9429
9430 /**
9431  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9432  */
9433 void CVec_RouteHintHopZ_free(struct LDKCVec_RouteHintHopZ _res);
9434
9435 /**
9436  * Creates a new CResult_RouteLightningErrorZ in the success state.
9437  */
9438 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_ok(struct LDKRoute o);
9439
9440 /**
9441  * Creates a new CResult_RouteLightningErrorZ in the error state.
9442  */
9443 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_err(struct LDKLightningError e);
9444
9445 /**
9446  * Frees any resources used by the CResult_RouteLightningErrorZ.
9447  */
9448 void CResult_RouteLightningErrorZ_free(struct LDKCResult_RouteLightningErrorZ _res);
9449
9450 /**
9451  * Creates a new CResult_RouteLightningErrorZ which has the same data as `orig`
9452  * but with all dynamically-allocated buffers duplicated in new buffers.
9453  */
9454 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_clone(const struct LDKCResult_RouteLightningErrorZ *NONNULL_PTR orig);
9455
9456 /**
9457  * Creates a new CResult_TxOutAccessErrorZ in the success state.
9458  */
9459 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_ok(struct LDKTxOut o);
9460
9461 /**
9462  * Creates a new CResult_TxOutAccessErrorZ in the error state.
9463  */
9464 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_err(enum LDKAccessError e);
9465
9466 /**
9467  * Frees any resources used by the CResult_TxOutAccessErrorZ.
9468  */
9469 void CResult_TxOutAccessErrorZ_free(struct LDKCResult_TxOutAccessErrorZ _res);
9470
9471 /**
9472  * Creates a new CResult_TxOutAccessErrorZ which has the same data as `orig`
9473  * but with all dynamically-allocated buffers duplicated in new buffers.
9474  */
9475 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_clone(const struct LDKCResult_TxOutAccessErrorZ *NONNULL_PTR orig);
9476
9477 /**
9478  * Creates a new tuple which has the same data as `orig`
9479  * but with all dynamically-allocated buffers duplicated in new buffers.
9480  */
9481 struct LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_clone(const struct LDKC2Tuple_usizeTransactionZ *NONNULL_PTR orig);
9482
9483 /**
9484  * Creates a new C2Tuple_usizeTransactionZ from the contained elements.
9485  */
9486 struct LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_new(uintptr_t a, struct LDKTransaction b);
9487
9488 /**
9489  * Frees any resources used by the C2Tuple_usizeTransactionZ.
9490  */
9491 void C2Tuple_usizeTransactionZ_free(struct LDKC2Tuple_usizeTransactionZ _res);
9492
9493 /**
9494  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9495  */
9496 void CVec_C2Tuple_usizeTransactionZZ_free(struct LDKCVec_C2Tuple_usizeTransactionZZ _res);
9497
9498 /**
9499  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9500  */
9501 void CVec_TxidZ_free(struct LDKCVec_TxidZ _res);
9502
9503 /**
9504  * Creates a new CResult_NoneChannelMonitorUpdateErrZ in the success state.
9505  */
9506 struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_ok(void);
9507
9508 /**
9509  * Creates a new CResult_NoneChannelMonitorUpdateErrZ in the error state.
9510  */
9511 struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_err(enum LDKChannelMonitorUpdateErr e);
9512
9513 /**
9514  * Frees any resources used by the CResult_NoneChannelMonitorUpdateErrZ.
9515  */
9516 void CResult_NoneChannelMonitorUpdateErrZ_free(struct LDKCResult_NoneChannelMonitorUpdateErrZ _res);
9517
9518 /**
9519  * Creates a new CResult_NoneChannelMonitorUpdateErrZ which has the same data as `orig`
9520  * but with all dynamically-allocated buffers duplicated in new buffers.
9521  */
9522 struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_clone(const struct LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR orig);
9523
9524 /**
9525  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9526  */
9527 void CVec_MonitorEventZ_free(struct LDKCVec_MonitorEventZ _res);
9528
9529 /**
9530  * Constructs a new COption_C2Tuple_usizeTransactionZZ containing a crate::c_types::derived::C2Tuple_usizeTransactionZ
9531  */
9532 struct LDKCOption_C2Tuple_usizeTransactionZZ COption_C2Tuple_usizeTransactionZZ_some(struct LDKC2Tuple_usizeTransactionZ o);
9533
9534 /**
9535  * Constructs a new COption_C2Tuple_usizeTransactionZZ containing nothing
9536  */
9537 struct LDKCOption_C2Tuple_usizeTransactionZZ COption_C2Tuple_usizeTransactionZZ_none(void);
9538
9539 /**
9540  * Frees any resources associated with the crate::c_types::derived::C2Tuple_usizeTransactionZ, if we are in the Some state
9541  */
9542 void COption_C2Tuple_usizeTransactionZZ_free(struct LDKCOption_C2Tuple_usizeTransactionZZ _res);
9543
9544 /**
9545  * Creates a new COption_C2Tuple_usizeTransactionZZ which has the same data as `orig`
9546  * but with all dynamically-allocated buffers duplicated in new buffers.
9547  */
9548 struct LDKCOption_C2Tuple_usizeTransactionZZ COption_C2Tuple_usizeTransactionZZ_clone(const struct LDKCOption_C2Tuple_usizeTransactionZZ *NONNULL_PTR orig);
9549
9550 /**
9551  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9552  */
9553 void CVec_SpendableOutputDescriptorZ_free(struct LDKCVec_SpendableOutputDescriptorZ _res);
9554
9555 /**
9556  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9557  */
9558 void CVec_MessageSendEventZ_free(struct LDKCVec_MessageSendEventZ _res);
9559
9560 /**
9561  * Creates a new CResult_InitFeaturesDecodeErrorZ in the success state.
9562  */
9563 struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_ok(struct LDKInitFeatures o);
9564
9565 /**
9566  * Creates a new CResult_InitFeaturesDecodeErrorZ in the error state.
9567  */
9568 struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
9569
9570 /**
9571  * Frees any resources used by the CResult_InitFeaturesDecodeErrorZ.
9572  */
9573 void CResult_InitFeaturesDecodeErrorZ_free(struct LDKCResult_InitFeaturesDecodeErrorZ _res);
9574
9575 /**
9576  * Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state.
9577  */
9578 struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_ok(struct LDKNodeFeatures o);
9579
9580 /**
9581  * Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state.
9582  */
9583 struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
9584
9585 /**
9586  * Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ.
9587  */
9588 void CResult_NodeFeaturesDecodeErrorZ_free(struct LDKCResult_NodeFeaturesDecodeErrorZ _res);
9589
9590 /**
9591  * Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state.
9592  */
9593 struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_ok(struct LDKChannelFeatures o);
9594
9595 /**
9596  * Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state.
9597  */
9598 struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
9599
9600 /**
9601  * Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ.
9602  */
9603 void CResult_ChannelFeaturesDecodeErrorZ_free(struct LDKCResult_ChannelFeaturesDecodeErrorZ _res);
9604
9605 /**
9606  * Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the success state.
9607  */
9608 struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_ok(struct LDKInvoiceFeatures o);
9609
9610 /**
9611  * Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the error state.
9612  */
9613 struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
9614
9615 /**
9616  * Frees any resources used by the CResult_InvoiceFeaturesDecodeErrorZ.
9617  */
9618 void CResult_InvoiceFeaturesDecodeErrorZ_free(struct LDKCResult_InvoiceFeaturesDecodeErrorZ _res);
9619
9620 /**
9621  * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the success state.
9622  */
9623 struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(struct LDKDelayedPaymentOutputDescriptor o);
9624
9625 /**
9626  * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the error state.
9627  */
9628 struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e);
9629
9630 /**
9631  * Frees any resources used by the CResult_DelayedPaymentOutputDescriptorDecodeErrorZ.
9632  */
9633 void CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res);
9634
9635 /**
9636  * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
9637  * but with all dynamically-allocated buffers duplicated in new buffers.
9638  */
9639 struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR orig);
9640
9641 /**
9642  * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the success state.
9643  */
9644 struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(struct LDKStaticPaymentOutputDescriptor o);
9645
9646 /**
9647  * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the error state.
9648  */
9649 struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e);
9650
9651 /**
9652  * Frees any resources used by the CResult_StaticPaymentOutputDescriptorDecodeErrorZ.
9653  */
9654 void CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res);
9655
9656 /**
9657  * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
9658  * but with all dynamically-allocated buffers duplicated in new buffers.
9659  */
9660 struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR orig);
9661
9662 /**
9663  * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state.
9664  */
9665 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_ok(struct LDKSpendableOutputDescriptor o);
9666
9667 /**
9668  * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state.
9669  */
9670 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e);
9671
9672 /**
9673  * Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ.
9674  */
9675 void CResult_SpendableOutputDescriptorDecodeErrorZ_free(struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res);
9676
9677 /**
9678  * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig`
9679  * but with all dynamically-allocated buffers duplicated in new buffers.
9680  */
9681 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR orig);
9682
9683 /**
9684  * Creates a new tuple which has the same data as `orig`
9685  * but with all dynamically-allocated buffers duplicated in new buffers.
9686  */
9687 struct LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_clone(const struct LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR orig);
9688
9689 /**
9690  * Creates a new C2Tuple_SignatureCVec_SignatureZZ from the contained elements.
9691  */
9692 struct LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_new(struct LDKSignature a, struct LDKCVec_SignatureZ b);
9693
9694 /**
9695  * Frees any resources used by the C2Tuple_SignatureCVec_SignatureZZ.
9696  */
9697 void C2Tuple_SignatureCVec_SignatureZZ_free(struct LDKC2Tuple_SignatureCVec_SignatureZZ _res);
9698
9699 /**
9700  * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the success state.
9701  */
9702 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(struct LDKC2Tuple_SignatureCVec_SignatureZZ o);
9703
9704 /**
9705  * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the error state.
9706  */
9707 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err(void);
9708
9709 /**
9710  * Frees any resources used by the CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ.
9711  */
9712 void CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res);
9713
9714 /**
9715  * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ which has the same data as `orig`
9716  * but with all dynamically-allocated buffers duplicated in new buffers.
9717  */
9718 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(const struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR orig);
9719
9720 /**
9721  * Creates a new CResult_SignatureNoneZ in the success state.
9722  */
9723 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_ok(struct LDKSignature o);
9724
9725 /**
9726  * Creates a new CResult_SignatureNoneZ in the error state.
9727  */
9728 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_err(void);
9729
9730 /**
9731  * Frees any resources used by the CResult_SignatureNoneZ.
9732  */
9733 void CResult_SignatureNoneZ_free(struct LDKCResult_SignatureNoneZ _res);
9734
9735 /**
9736  * Creates a new CResult_SignatureNoneZ which has the same data as `orig`
9737  * but with all dynamically-allocated buffers duplicated in new buffers.
9738  */
9739 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_clone(const struct LDKCResult_SignatureNoneZ *NONNULL_PTR orig);
9740
9741 /**
9742  * Creates a new CResult_SignDecodeErrorZ in the success state.
9743  */
9744 struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_ok(struct LDKSign o);
9745
9746 /**
9747  * Creates a new CResult_SignDecodeErrorZ in the error state.
9748  */
9749 struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_err(struct LDKDecodeError e);
9750
9751 /**
9752  * Frees any resources used by the CResult_SignDecodeErrorZ.
9753  */
9754 void CResult_SignDecodeErrorZ_free(struct LDKCResult_SignDecodeErrorZ _res);
9755
9756 /**
9757  * Creates a new CResult_SignDecodeErrorZ which has the same data as `orig`
9758  * but with all dynamically-allocated buffers duplicated in new buffers.
9759  */
9760 struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_clone(const struct LDKCResult_SignDecodeErrorZ *NONNULL_PTR orig);
9761
9762 /**
9763  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9764  */
9765 void CVec_u8Z_free(struct LDKCVec_u8Z _res);
9766
9767 /**
9768  * Creates a new CResult_RecoverableSignatureNoneZ in the success state.
9769  */
9770 struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_ok(struct LDKRecoverableSignature o);
9771
9772 /**
9773  * Creates a new CResult_RecoverableSignatureNoneZ in the error state.
9774  */
9775 struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_err(void);
9776
9777 /**
9778  * Frees any resources used by the CResult_RecoverableSignatureNoneZ.
9779  */
9780 void CResult_RecoverableSignatureNoneZ_free(struct LDKCResult_RecoverableSignatureNoneZ _res);
9781
9782 /**
9783  * Creates a new CResult_RecoverableSignatureNoneZ which has the same data as `orig`
9784  * but with all dynamically-allocated buffers duplicated in new buffers.
9785  */
9786 struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_clone(const struct LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR orig);
9787
9788 /**
9789  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9790  */
9791 void CVec_CVec_u8ZZ_free(struct LDKCVec_CVec_u8ZZ _res);
9792
9793 /**
9794  * Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state.
9795  */
9796 struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_ok(struct LDKCVec_CVec_u8ZZ o);
9797
9798 /**
9799  * Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state.
9800  */
9801 struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_err(void);
9802
9803 /**
9804  * Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ.
9805  */
9806 void CResult_CVec_CVec_u8ZZNoneZ_free(struct LDKCResult_CVec_CVec_u8ZZNoneZ _res);
9807
9808 /**
9809  * Creates a new CResult_CVec_CVec_u8ZZNoneZ which has the same data as `orig`
9810  * but with all dynamically-allocated buffers duplicated in new buffers.
9811  */
9812 struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_clone(const struct LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR orig);
9813
9814 /**
9815  * Creates a new CResult_InMemorySignerDecodeErrorZ in the success state.
9816  */
9817 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_ok(struct LDKInMemorySigner o);
9818
9819 /**
9820  * Creates a new CResult_InMemorySignerDecodeErrorZ in the error state.
9821  */
9822 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_err(struct LDKDecodeError e);
9823
9824 /**
9825  * Frees any resources used by the CResult_InMemorySignerDecodeErrorZ.
9826  */
9827 void CResult_InMemorySignerDecodeErrorZ_free(struct LDKCResult_InMemorySignerDecodeErrorZ _res);
9828
9829 /**
9830  * Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig`
9831  * but with all dynamically-allocated buffers duplicated in new buffers.
9832  */
9833 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_clone(const struct LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR orig);
9834
9835 /**
9836  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9837  */
9838 void CVec_TxOutZ_free(struct LDKCVec_TxOutZ _res);
9839
9840 /**
9841  * Creates a new CResult_TransactionNoneZ in the success state.
9842  */
9843 struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_ok(struct LDKTransaction o);
9844
9845 /**
9846  * Creates a new CResult_TransactionNoneZ in the error state.
9847  */
9848 struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_err(void);
9849
9850 /**
9851  * Frees any resources used by the CResult_TransactionNoneZ.
9852  */
9853 void CResult_TransactionNoneZ_free(struct LDKCResult_TransactionNoneZ _res);
9854
9855 /**
9856  * Creates a new CResult_TransactionNoneZ which has the same data as `orig`
9857  * but with all dynamically-allocated buffers duplicated in new buffers.
9858  */
9859 struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_clone(const struct LDKCResult_TransactionNoneZ *NONNULL_PTR orig);
9860
9861 /**
9862  * Creates a new C2Tuple_BlockHashChannelMonitorZ from the contained elements.
9863  */
9864 struct LDKC2Tuple_BlockHashChannelMonitorZ C2Tuple_BlockHashChannelMonitorZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelMonitor b);
9865
9866 /**
9867  * Frees any resources used by the C2Tuple_BlockHashChannelMonitorZ.
9868  */
9869 void C2Tuple_BlockHashChannelMonitorZ_free(struct LDKC2Tuple_BlockHashChannelMonitorZ _res);
9870
9871 /**
9872  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9873  */
9874 void CVec_C2Tuple_BlockHashChannelMonitorZZ_free(struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ _res);
9875
9876 /**
9877  * Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the success state.
9878  */
9879 struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ o);
9880
9881 /**
9882  * Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the error state.
9883  */
9884 struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(enum LDKIOError e);
9885
9886 /**
9887  * Frees any resources used by the CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.
9888  */
9889 void CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ _res);
9890
9891 /**
9892  * Creates a new CResult_NoneAPIErrorZ in the success state.
9893  */
9894 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_ok(void);
9895
9896 /**
9897  * Creates a new CResult_NoneAPIErrorZ in the error state.
9898  */
9899 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_err(struct LDKAPIError e);
9900
9901 /**
9902  * Frees any resources used by the CResult_NoneAPIErrorZ.
9903  */
9904 void CResult_NoneAPIErrorZ_free(struct LDKCResult_NoneAPIErrorZ _res);
9905
9906 /**
9907  * Creates a new CResult_NoneAPIErrorZ which has the same data as `orig`
9908  * but with all dynamically-allocated buffers duplicated in new buffers.
9909  */
9910 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_clone(const struct LDKCResult_NoneAPIErrorZ *NONNULL_PTR orig);
9911
9912 /**
9913  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9914  */
9915 void CVec_CResult_NoneAPIErrorZZ_free(struct LDKCVec_CResult_NoneAPIErrorZZ _res);
9916
9917 /**
9918  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9919  */
9920 void CVec_APIErrorZ_free(struct LDKCVec_APIErrorZ _res);
9921
9922 /**
9923  * Creates a new CResult_NonePaymentSendFailureZ in the success state.
9924  */
9925 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_ok(void);
9926
9927 /**
9928  * Creates a new CResult_NonePaymentSendFailureZ in the error state.
9929  */
9930 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_err(struct LDKPaymentSendFailure e);
9931
9932 /**
9933  * Frees any resources used by the CResult_NonePaymentSendFailureZ.
9934  */
9935 void CResult_NonePaymentSendFailureZ_free(struct LDKCResult_NonePaymentSendFailureZ _res);
9936
9937 /**
9938  * Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
9939  * but with all dynamically-allocated buffers duplicated in new buffers.
9940  */
9941 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_clone(const struct LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR orig);
9942
9943 /**
9944  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9945  */
9946 void CVec_NetAddressZ_free(struct LDKCVec_NetAddressZ _res);
9947
9948 /**
9949  * Creates a new tuple which has the same data as `orig`
9950  * but with all dynamically-allocated buffers duplicated in new buffers.
9951  */
9952 struct LDKC2Tuple_PaymentHashPaymentSecretZ C2Tuple_PaymentHashPaymentSecretZ_clone(const struct LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR orig);
9953
9954 /**
9955  * Creates a new C2Tuple_PaymentHashPaymentSecretZ from the contained elements.
9956  */
9957 struct LDKC2Tuple_PaymentHashPaymentSecretZ C2Tuple_PaymentHashPaymentSecretZ_new(struct LDKThirtyTwoBytes a, struct LDKThirtyTwoBytes b);
9958
9959 /**
9960  * Frees any resources used by the C2Tuple_PaymentHashPaymentSecretZ.
9961  */
9962 void C2Tuple_PaymentHashPaymentSecretZ_free(struct LDKC2Tuple_PaymentHashPaymentSecretZ _res);
9963
9964 /**
9965  * Creates a new CResult_PaymentSecretAPIErrorZ in the success state.
9966  */
9967 struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_ok(struct LDKThirtyTwoBytes o);
9968
9969 /**
9970  * Creates a new CResult_PaymentSecretAPIErrorZ in the error state.
9971  */
9972 struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_err(struct LDKAPIError e);
9973
9974 /**
9975  * Frees any resources used by the CResult_PaymentSecretAPIErrorZ.
9976  */
9977 void CResult_PaymentSecretAPIErrorZ_free(struct LDKCResult_PaymentSecretAPIErrorZ _res);
9978
9979 /**
9980  * Creates a new CResult_PaymentSecretAPIErrorZ which has the same data as `orig`
9981  * but with all dynamically-allocated buffers duplicated in new buffers.
9982  */
9983 struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_clone(const struct LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR orig);
9984
9985 /**
9986  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9987  */
9988 void CVec_ChannelMonitorZ_free(struct LDKCVec_ChannelMonitorZ _res);
9989
9990 /**
9991  * Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements.
9992  */
9993 struct LDKC2Tuple_BlockHashChannelManagerZ C2Tuple_BlockHashChannelManagerZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelManager b);
9994
9995 /**
9996  * Frees any resources used by the C2Tuple_BlockHashChannelManagerZ.
9997  */
9998 void C2Tuple_BlockHashChannelManagerZ_free(struct LDKC2Tuple_BlockHashChannelManagerZ _res);
9999
10000 /**
10001  * Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state.
10002  */
10003 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelManagerZ o);
10004
10005 /**
10006  * Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state.
10007  */
10008 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(struct LDKDecodeError e);
10009
10010 /**
10011  * Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.
10012  */
10013 void CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res);
10014
10015 /**
10016  * Creates a new CResult_ChannelConfigDecodeErrorZ in the success state.
10017  */
10018 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_ok(struct LDKChannelConfig o);
10019
10020 /**
10021  * Creates a new CResult_ChannelConfigDecodeErrorZ in the error state.
10022  */
10023 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_err(struct LDKDecodeError e);
10024
10025 /**
10026  * Frees any resources used by the CResult_ChannelConfigDecodeErrorZ.
10027  */
10028 void CResult_ChannelConfigDecodeErrorZ_free(struct LDKCResult_ChannelConfigDecodeErrorZ _res);
10029
10030 /**
10031  * Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig`
10032  * but with all dynamically-allocated buffers duplicated in new buffers.
10033  */
10034 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_clone(const struct LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR orig);
10035
10036 /**
10037  * Creates a new CResult_OutPointDecodeErrorZ in the success state.
10038  */
10039 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_ok(struct LDKOutPoint o);
10040
10041 /**
10042  * Creates a new CResult_OutPointDecodeErrorZ in the error state.
10043  */
10044 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_err(struct LDKDecodeError e);
10045
10046 /**
10047  * Frees any resources used by the CResult_OutPointDecodeErrorZ.
10048  */
10049 void CResult_OutPointDecodeErrorZ_free(struct LDKCResult_OutPointDecodeErrorZ _res);
10050
10051 /**
10052  * Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig`
10053  * but with all dynamically-allocated buffers duplicated in new buffers.
10054  */
10055 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_clone(const struct LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR orig);
10056
10057 /**
10058  * Creates a new CResult_SiPrefixNoneZ in the success state.
10059  */
10060 struct LDKCResult_SiPrefixNoneZ CResult_SiPrefixNoneZ_ok(enum LDKSiPrefix o);
10061
10062 /**
10063  * Creates a new CResult_SiPrefixNoneZ in the error state.
10064  */
10065 struct LDKCResult_SiPrefixNoneZ CResult_SiPrefixNoneZ_err(void);
10066
10067 /**
10068  * Frees any resources used by the CResult_SiPrefixNoneZ.
10069  */
10070 void CResult_SiPrefixNoneZ_free(struct LDKCResult_SiPrefixNoneZ _res);
10071
10072 /**
10073  * Creates a new CResult_SiPrefixNoneZ which has the same data as `orig`
10074  * but with all dynamically-allocated buffers duplicated in new buffers.
10075  */
10076 struct LDKCResult_SiPrefixNoneZ CResult_SiPrefixNoneZ_clone(const struct LDKCResult_SiPrefixNoneZ *NONNULL_PTR orig);
10077
10078 /**
10079  * Creates a new CResult_InvoiceNoneZ in the success state.
10080  */
10081 struct LDKCResult_InvoiceNoneZ CResult_InvoiceNoneZ_ok(struct LDKInvoice o);
10082
10083 /**
10084  * Creates a new CResult_InvoiceNoneZ in the error state.
10085  */
10086 struct LDKCResult_InvoiceNoneZ CResult_InvoiceNoneZ_err(void);
10087
10088 /**
10089  * Frees any resources used by the CResult_InvoiceNoneZ.
10090  */
10091 void CResult_InvoiceNoneZ_free(struct LDKCResult_InvoiceNoneZ _res);
10092
10093 /**
10094  * Creates a new CResult_InvoiceNoneZ which has the same data as `orig`
10095  * but with all dynamically-allocated buffers duplicated in new buffers.
10096  */
10097 struct LDKCResult_InvoiceNoneZ CResult_InvoiceNoneZ_clone(const struct LDKCResult_InvoiceNoneZ *NONNULL_PTR orig);
10098
10099 /**
10100  * Creates a new CResult_SignedRawInvoiceNoneZ in the success state.
10101  */
10102 struct LDKCResult_SignedRawInvoiceNoneZ CResult_SignedRawInvoiceNoneZ_ok(struct LDKSignedRawInvoice o);
10103
10104 /**
10105  * Creates a new CResult_SignedRawInvoiceNoneZ in the error state.
10106  */
10107 struct LDKCResult_SignedRawInvoiceNoneZ CResult_SignedRawInvoiceNoneZ_err(void);
10108
10109 /**
10110  * Frees any resources used by the CResult_SignedRawInvoiceNoneZ.
10111  */
10112 void CResult_SignedRawInvoiceNoneZ_free(struct LDKCResult_SignedRawInvoiceNoneZ _res);
10113
10114 /**
10115  * Creates a new CResult_SignedRawInvoiceNoneZ which has the same data as `orig`
10116  * but with all dynamically-allocated buffers duplicated in new buffers.
10117  */
10118 struct LDKCResult_SignedRawInvoiceNoneZ CResult_SignedRawInvoiceNoneZ_clone(const struct LDKCResult_SignedRawInvoiceNoneZ *NONNULL_PTR orig);
10119
10120 /**
10121  * Creates a new tuple which has the same data as `orig`
10122  * but with all dynamically-allocated buffers duplicated in new buffers.
10123  */
10124 struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(const struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR orig);
10125
10126 /**
10127  * Creates a new C3Tuple_RawInvoice_u832InvoiceSignatureZ from the contained elements.
10128  */
10129 struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(struct LDKRawInvoice a, struct LDKThirtyTwoBytes b, struct LDKInvoiceSignature c);
10130
10131 /**
10132  * Frees any resources used by the C3Tuple_RawInvoice_u832InvoiceSignatureZ.
10133  */
10134 void C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ _res);
10135
10136 /**
10137  * Creates a new CResult_PayeePubKeyErrorZ in the success state.
10138  */
10139 struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_ok(struct LDKPayeePubKey o);
10140
10141 /**
10142  * Creates a new CResult_PayeePubKeyErrorZ in the error state.
10143  */
10144 struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_err(enum LDKSecp256k1Error e);
10145
10146 /**
10147  * Frees any resources used by the CResult_PayeePubKeyErrorZ.
10148  */
10149 void CResult_PayeePubKeyErrorZ_free(struct LDKCResult_PayeePubKeyErrorZ _res);
10150
10151 /**
10152  * Creates a new CResult_PayeePubKeyErrorZ which has the same data as `orig`
10153  * but with all dynamically-allocated buffers duplicated in new buffers.
10154  */
10155 struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_clone(const struct LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR orig);
10156
10157 /**
10158  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10159  */
10160 void CVec_RouteHintZ_free(struct LDKCVec_RouteHintZ _res);
10161
10162 /**
10163  * Creates a new CResult_PositiveTimestampCreationErrorZ in the success state.
10164  */
10165 struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_ok(struct LDKPositiveTimestamp o);
10166
10167 /**
10168  * Creates a new CResult_PositiveTimestampCreationErrorZ in the error state.
10169  */
10170 struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_err(enum LDKCreationError e);
10171
10172 /**
10173  * Frees any resources used by the CResult_PositiveTimestampCreationErrorZ.
10174  */
10175 void CResult_PositiveTimestampCreationErrorZ_free(struct LDKCResult_PositiveTimestampCreationErrorZ _res);
10176
10177 /**
10178  * Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig`
10179  * but with all dynamically-allocated buffers duplicated in new buffers.
10180  */
10181 struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_clone(const struct LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR orig);
10182
10183 /**
10184  * Creates a new CResult_NoneSemanticErrorZ in the success state.
10185  */
10186 struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_ok(void);
10187
10188 /**
10189  * Creates a new CResult_NoneSemanticErrorZ in the error state.
10190  */
10191 struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_err(enum LDKSemanticError e);
10192
10193 /**
10194  * Frees any resources used by the CResult_NoneSemanticErrorZ.
10195  */
10196 void CResult_NoneSemanticErrorZ_free(struct LDKCResult_NoneSemanticErrorZ _res);
10197
10198 /**
10199  * Creates a new CResult_NoneSemanticErrorZ which has the same data as `orig`
10200  * but with all dynamically-allocated buffers duplicated in new buffers.
10201  */
10202 struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_clone(const struct LDKCResult_NoneSemanticErrorZ *NONNULL_PTR orig);
10203
10204 /**
10205  * Creates a new CResult_InvoiceSemanticErrorZ in the success state.
10206  */
10207 struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_ok(struct LDKInvoice o);
10208
10209 /**
10210  * Creates a new CResult_InvoiceSemanticErrorZ in the error state.
10211  */
10212 struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_err(enum LDKSemanticError e);
10213
10214 /**
10215  * Frees any resources used by the CResult_InvoiceSemanticErrorZ.
10216  */
10217 void CResult_InvoiceSemanticErrorZ_free(struct LDKCResult_InvoiceSemanticErrorZ _res);
10218
10219 /**
10220  * Creates a new CResult_InvoiceSemanticErrorZ which has the same data as `orig`
10221  * but with all dynamically-allocated buffers duplicated in new buffers.
10222  */
10223 struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_clone(const struct LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR orig);
10224
10225 /**
10226  * Creates a new CResult_DescriptionCreationErrorZ in the success state.
10227  */
10228 struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_ok(struct LDKDescription o);
10229
10230 /**
10231  * Creates a new CResult_DescriptionCreationErrorZ in the error state.
10232  */
10233 struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_err(enum LDKCreationError e);
10234
10235 /**
10236  * Frees any resources used by the CResult_DescriptionCreationErrorZ.
10237  */
10238 void CResult_DescriptionCreationErrorZ_free(struct LDKCResult_DescriptionCreationErrorZ _res);
10239
10240 /**
10241  * Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig`
10242  * but with all dynamically-allocated buffers duplicated in new buffers.
10243  */
10244 struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_clone(const struct LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR orig);
10245
10246 /**
10247  * Creates a new CResult_ExpiryTimeCreationErrorZ in the success state.
10248  */
10249 struct LDKCResult_ExpiryTimeCreationErrorZ CResult_ExpiryTimeCreationErrorZ_ok(struct LDKExpiryTime o);
10250
10251 /**
10252  * Creates a new CResult_ExpiryTimeCreationErrorZ in the error state.
10253  */
10254 struct LDKCResult_ExpiryTimeCreationErrorZ CResult_ExpiryTimeCreationErrorZ_err(enum LDKCreationError e);
10255
10256 /**
10257  * Frees any resources used by the CResult_ExpiryTimeCreationErrorZ.
10258  */
10259 void CResult_ExpiryTimeCreationErrorZ_free(struct LDKCResult_ExpiryTimeCreationErrorZ _res);
10260
10261 /**
10262  * Creates a new CResult_ExpiryTimeCreationErrorZ which has the same data as `orig`
10263  * but with all dynamically-allocated buffers duplicated in new buffers.
10264  */
10265 struct LDKCResult_ExpiryTimeCreationErrorZ CResult_ExpiryTimeCreationErrorZ_clone(const struct LDKCResult_ExpiryTimeCreationErrorZ *NONNULL_PTR orig);
10266
10267 /**
10268  * Creates a new CResult_RouteHintCreationErrorZ in the success state.
10269  */
10270 struct LDKCResult_RouteHintCreationErrorZ CResult_RouteHintCreationErrorZ_ok(struct LDKRouteHint o);
10271
10272 /**
10273  * Creates a new CResult_RouteHintCreationErrorZ in the error state.
10274  */
10275 struct LDKCResult_RouteHintCreationErrorZ CResult_RouteHintCreationErrorZ_err(enum LDKCreationError e);
10276
10277 /**
10278  * Frees any resources used by the CResult_RouteHintCreationErrorZ.
10279  */
10280 void CResult_RouteHintCreationErrorZ_free(struct LDKCResult_RouteHintCreationErrorZ _res);
10281
10282 /**
10283  * Creates a new CResult_RouteHintCreationErrorZ which has the same data as `orig`
10284  * but with all dynamically-allocated buffers duplicated in new buffers.
10285  */
10286 struct LDKCResult_RouteHintCreationErrorZ CResult_RouteHintCreationErrorZ_clone(const struct LDKCResult_RouteHintCreationErrorZ *NONNULL_PTR orig);
10287
10288 /**
10289  * Creates a new CResult_StringErrorZ in the success state.
10290  */
10291 struct LDKCResult_StringErrorZ CResult_StringErrorZ_ok(struct LDKStr o);
10292
10293 /**
10294  * Creates a new CResult_StringErrorZ in the error state.
10295  */
10296 struct LDKCResult_StringErrorZ CResult_StringErrorZ_err(enum LDKSecp256k1Error e);
10297
10298 /**
10299  * Frees any resources used by the CResult_StringErrorZ.
10300  */
10301 void CResult_StringErrorZ_free(struct LDKCResult_StringErrorZ _res);
10302
10303 /**
10304  * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
10305  */
10306 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_ok(struct LDKChannelMonitorUpdate o);
10307
10308 /**
10309  * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
10310  */
10311 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_err(struct LDKDecodeError e);
10312
10313 /**
10314  * Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
10315  */
10316 void CResult_ChannelMonitorUpdateDecodeErrorZ_free(struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res);
10317
10318 /**
10319  * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
10320  * but with all dynamically-allocated buffers duplicated in new buffers.
10321  */
10322 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_clone(const struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR orig);
10323
10324 /**
10325  * Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
10326  */
10327 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_ok(struct LDKHTLCUpdate o);
10328
10329 /**
10330  * Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
10331  */
10332 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_err(struct LDKDecodeError e);
10333
10334 /**
10335  * Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
10336  */
10337 void CResult_HTLCUpdateDecodeErrorZ_free(struct LDKCResult_HTLCUpdateDecodeErrorZ _res);
10338
10339 /**
10340  * Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
10341  * but with all dynamically-allocated buffers duplicated in new buffers.
10342  */
10343 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_clone(const struct LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR orig);
10344
10345 /**
10346  * Creates a new CResult_NoneMonitorUpdateErrorZ in the success state.
10347  */
10348 struct LDKCResult_NoneMonitorUpdateErrorZ CResult_NoneMonitorUpdateErrorZ_ok(void);
10349
10350 /**
10351  * Creates a new CResult_NoneMonitorUpdateErrorZ in the error state.
10352  */
10353 struct LDKCResult_NoneMonitorUpdateErrorZ CResult_NoneMonitorUpdateErrorZ_err(struct LDKMonitorUpdateError e);
10354
10355 /**
10356  * Frees any resources used by the CResult_NoneMonitorUpdateErrorZ.
10357  */
10358 void CResult_NoneMonitorUpdateErrorZ_free(struct LDKCResult_NoneMonitorUpdateErrorZ _res);
10359
10360 /**
10361  * Creates a new CResult_NoneMonitorUpdateErrorZ which has the same data as `orig`
10362  * but with all dynamically-allocated buffers duplicated in new buffers.
10363  */
10364 struct LDKCResult_NoneMonitorUpdateErrorZ CResult_NoneMonitorUpdateErrorZ_clone(const struct LDKCResult_NoneMonitorUpdateErrorZ *NONNULL_PTR orig);
10365
10366 /**
10367  * Creates a new tuple which has the same data as `orig`
10368  * but with all dynamically-allocated buffers duplicated in new buffers.
10369  */
10370 struct LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_clone(const struct LDKC2Tuple_OutPointScriptZ *NONNULL_PTR orig);
10371
10372 /**
10373  * Creates a new C2Tuple_OutPointScriptZ from the contained elements.
10374  */
10375 struct LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_new(struct LDKOutPoint a, struct LDKCVec_u8Z b);
10376
10377 /**
10378  * Frees any resources used by the C2Tuple_OutPointScriptZ.
10379  */
10380 void C2Tuple_OutPointScriptZ_free(struct LDKC2Tuple_OutPointScriptZ _res);
10381
10382 /**
10383  * Creates a new tuple which has the same data as `orig`
10384  * but with all dynamically-allocated buffers duplicated in new buffers.
10385  */
10386 struct LDKC2Tuple_u32ScriptZ C2Tuple_u32ScriptZ_clone(const struct LDKC2Tuple_u32ScriptZ *NONNULL_PTR orig);
10387
10388 /**
10389  * Creates a new C2Tuple_u32ScriptZ from the contained elements.
10390  */
10391 struct LDKC2Tuple_u32ScriptZ C2Tuple_u32ScriptZ_new(uint32_t a, struct LDKCVec_u8Z b);
10392
10393 /**
10394  * Frees any resources used by the C2Tuple_u32ScriptZ.
10395  */
10396 void C2Tuple_u32ScriptZ_free(struct LDKC2Tuple_u32ScriptZ _res);
10397
10398 /**
10399  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10400  */
10401 void CVec_C2Tuple_u32ScriptZZ_free(struct LDKCVec_C2Tuple_u32ScriptZZ _res);
10402
10403 /**
10404  * Creates a new tuple which has the same data as `orig`
10405  * but with all dynamically-allocated buffers duplicated in new buffers.
10406  */
10407 struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(const struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR orig);
10408
10409 /**
10410  * Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements.
10411  */
10412 struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32ScriptZZ b);
10413
10414 /**
10415  * Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ.
10416  */
10417 void C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res);
10418
10419 /**
10420  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10421  */
10422 void CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res);
10423
10424 /**
10425  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10426  */
10427 void CVec_EventZ_free(struct LDKCVec_EventZ _res);
10428
10429 /**
10430  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10431  */
10432 void CVec_TransactionZ_free(struct LDKCVec_TransactionZ _res);
10433
10434 /**
10435  * Creates a new tuple which has the same data as `orig`
10436  * but with all dynamically-allocated buffers duplicated in new buffers.
10437  */
10438 struct LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_clone(const struct LDKC2Tuple_u32TxOutZ *NONNULL_PTR orig);
10439
10440 /**
10441  * Creates a new C2Tuple_u32TxOutZ from the contained elements.
10442  */
10443 struct LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_new(uint32_t a, struct LDKTxOut b);
10444
10445 /**
10446  * Frees any resources used by the C2Tuple_u32TxOutZ.
10447  */
10448 void C2Tuple_u32TxOutZ_free(struct LDKC2Tuple_u32TxOutZ _res);
10449
10450 /**
10451  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10452  */
10453 void CVec_C2Tuple_u32TxOutZZ_free(struct LDKCVec_C2Tuple_u32TxOutZZ _res);
10454
10455 /**
10456  * Creates a new tuple which has the same data as `orig`
10457  * but with all dynamically-allocated buffers duplicated in new buffers.
10458  */
10459 struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(const struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR orig);
10460
10461 /**
10462  * Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements.
10463  */
10464 struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32TxOutZZ b);
10465
10466 /**
10467  * Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ.
10468  */
10469 void C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res);
10470
10471 /**
10472  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10473  */
10474 void CVec_TransactionOutputsZ_free(struct LDKCVec_TransactionOutputsZ _res);
10475
10476 /**
10477  * Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state.
10478  */
10479 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelMonitorZ o);
10480
10481 /**
10482  * Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state.
10483  */
10484 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(struct LDKDecodeError e);
10485
10486 /**
10487  * Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.
10488  */
10489 void CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res);
10490
10491 /**
10492  * Creates a new CResult_boolLightningErrorZ in the success state.
10493  */
10494 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_ok(bool o);
10495
10496 /**
10497  * Creates a new CResult_boolLightningErrorZ in the error state.
10498  */
10499 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_err(struct LDKLightningError e);
10500
10501 /**
10502  * Frees any resources used by the CResult_boolLightningErrorZ.
10503  */
10504 void CResult_boolLightningErrorZ_free(struct LDKCResult_boolLightningErrorZ _res);
10505
10506 /**
10507  * Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
10508  * but with all dynamically-allocated buffers duplicated in new buffers.
10509  */
10510 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_clone(const struct LDKCResult_boolLightningErrorZ *NONNULL_PTR orig);
10511
10512 /**
10513  * Creates a new tuple which has the same data as `orig`
10514  * but with all dynamically-allocated buffers duplicated in new buffers.
10515  */
10516 struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(const struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR orig);
10517
10518 /**
10519  * Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
10520  */
10521 struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(struct LDKChannelAnnouncement a, struct LDKChannelUpdate b, struct LDKChannelUpdate c);
10522
10523 /**
10524  * Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
10525  */
10526 void C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res);
10527
10528 /**
10529  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10530  */
10531 void CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res);
10532
10533 /**
10534  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10535  */
10536 void CVec_NodeAnnouncementZ_free(struct LDKCVec_NodeAnnouncementZ _res);
10537
10538 /**
10539  * Creates a new CResult_NoneLightningErrorZ in the success state.
10540  */
10541 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_ok(void);
10542
10543 /**
10544  * Creates a new CResult_NoneLightningErrorZ in the error state.
10545  */
10546 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_err(struct LDKLightningError e);
10547
10548 /**
10549  * Frees any resources used by the CResult_NoneLightningErrorZ.
10550  */
10551 void CResult_NoneLightningErrorZ_free(struct LDKCResult_NoneLightningErrorZ _res);
10552
10553 /**
10554  * Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
10555  * but with all dynamically-allocated buffers duplicated in new buffers.
10556  */
10557 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_clone(const struct LDKCResult_NoneLightningErrorZ *NONNULL_PTR orig);
10558
10559 /**
10560  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10561  */
10562 void CVec_PublicKeyZ_free(struct LDKCVec_PublicKeyZ _res);
10563
10564 /**
10565  * Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
10566  */
10567 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_ok(struct LDKCVec_u8Z o);
10568
10569 /**
10570  * Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
10571  */
10572 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_err(struct LDKPeerHandleError e);
10573
10574 /**
10575  * Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
10576  */
10577 void CResult_CVec_u8ZPeerHandleErrorZ_free(struct LDKCResult_CVec_u8ZPeerHandleErrorZ _res);
10578
10579 /**
10580  * Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
10581  * but with all dynamically-allocated buffers duplicated in new buffers.
10582  */
10583 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_clone(const struct LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR orig);
10584
10585 /**
10586  * Creates a new CResult_NonePeerHandleErrorZ in the success state.
10587  */
10588 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_ok(void);
10589
10590 /**
10591  * Creates a new CResult_NonePeerHandleErrorZ in the error state.
10592  */
10593 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_err(struct LDKPeerHandleError e);
10594
10595 /**
10596  * Frees any resources used by the CResult_NonePeerHandleErrorZ.
10597  */
10598 void CResult_NonePeerHandleErrorZ_free(struct LDKCResult_NonePeerHandleErrorZ _res);
10599
10600 /**
10601  * Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
10602  * but with all dynamically-allocated buffers duplicated in new buffers.
10603  */
10604 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_clone(const struct LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR orig);
10605
10606 /**
10607  * Creates a new CResult_boolPeerHandleErrorZ in the success state.
10608  */
10609 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_ok(bool o);
10610
10611 /**
10612  * Creates a new CResult_boolPeerHandleErrorZ in the error state.
10613  */
10614 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_err(struct LDKPeerHandleError e);
10615
10616 /**
10617  * Frees any resources used by the CResult_boolPeerHandleErrorZ.
10618  */
10619 void CResult_boolPeerHandleErrorZ_free(struct LDKCResult_boolPeerHandleErrorZ _res);
10620
10621 /**
10622  * Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
10623  * but with all dynamically-allocated buffers duplicated in new buffers.
10624  */
10625 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_clone(const struct LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR orig);
10626
10627 /**
10628  * Creates a new CResult_DirectionalChannelInfoDecodeErrorZ in the success state.
10629  */
10630 struct LDKCResult_DirectionalChannelInfoDecodeErrorZ CResult_DirectionalChannelInfoDecodeErrorZ_ok(struct LDKDirectionalChannelInfo o);
10631
10632 /**
10633  * Creates a new CResult_DirectionalChannelInfoDecodeErrorZ in the error state.
10634  */
10635 struct LDKCResult_DirectionalChannelInfoDecodeErrorZ CResult_DirectionalChannelInfoDecodeErrorZ_err(struct LDKDecodeError e);
10636
10637 /**
10638  * Frees any resources used by the CResult_DirectionalChannelInfoDecodeErrorZ.
10639  */
10640 void CResult_DirectionalChannelInfoDecodeErrorZ_free(struct LDKCResult_DirectionalChannelInfoDecodeErrorZ _res);
10641
10642 /**
10643  * Creates a new CResult_DirectionalChannelInfoDecodeErrorZ which has the same data as `orig`
10644  * but with all dynamically-allocated buffers duplicated in new buffers.
10645  */
10646 struct LDKCResult_DirectionalChannelInfoDecodeErrorZ CResult_DirectionalChannelInfoDecodeErrorZ_clone(const struct LDKCResult_DirectionalChannelInfoDecodeErrorZ *NONNULL_PTR orig);
10647
10648 /**
10649  * Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
10650  */
10651 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_ok(struct LDKChannelInfo o);
10652
10653 /**
10654  * Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
10655  */
10656 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_err(struct LDKDecodeError e);
10657
10658 /**
10659  * Frees any resources used by the CResult_ChannelInfoDecodeErrorZ.
10660  */
10661 void CResult_ChannelInfoDecodeErrorZ_free(struct LDKCResult_ChannelInfoDecodeErrorZ _res);
10662
10663 /**
10664  * Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig`
10665  * but with all dynamically-allocated buffers duplicated in new buffers.
10666  */
10667 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_clone(const struct LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR orig);
10668
10669 /**
10670  * Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
10671  */
10672 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_ok(struct LDKRoutingFees o);
10673
10674 /**
10675  * Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
10676  */
10677 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_err(struct LDKDecodeError e);
10678
10679 /**
10680  * Frees any resources used by the CResult_RoutingFeesDecodeErrorZ.
10681  */
10682 void CResult_RoutingFeesDecodeErrorZ_free(struct LDKCResult_RoutingFeesDecodeErrorZ _res);
10683
10684 /**
10685  * Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig`
10686  * but with all dynamically-allocated buffers duplicated in new buffers.
10687  */
10688 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_clone(const struct LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR orig);
10689
10690 /**
10691  * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
10692  */
10693 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_ok(struct LDKNodeAnnouncementInfo o);
10694
10695 /**
10696  * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
10697  */
10698 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_err(struct LDKDecodeError e);
10699
10700 /**
10701  * Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
10702  */
10703 void CResult_NodeAnnouncementInfoDecodeErrorZ_free(struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res);
10704
10705 /**
10706  * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
10707  * but with all dynamically-allocated buffers duplicated in new buffers.
10708  */
10709 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_clone(const struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR orig);
10710
10711 /**
10712  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10713  */
10714 void CVec_u64Z_free(struct LDKCVec_u64Z _res);
10715
10716 /**
10717  * Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
10718  */
10719 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_ok(struct LDKNodeInfo o);
10720
10721 /**
10722  * Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
10723  */
10724 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_err(struct LDKDecodeError e);
10725
10726 /**
10727  * Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
10728  */
10729 void CResult_NodeInfoDecodeErrorZ_free(struct LDKCResult_NodeInfoDecodeErrorZ _res);
10730
10731 /**
10732  * Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
10733  * but with all dynamically-allocated buffers duplicated in new buffers.
10734  */
10735 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_clone(const struct LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR orig);
10736
10737 /**
10738  * Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
10739  */
10740 struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_ok(struct LDKNetworkGraph o);
10741
10742 /**
10743  * Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
10744  */
10745 struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_err(struct LDKDecodeError e);
10746
10747 /**
10748  * Frees any resources used by the CResult_NetworkGraphDecodeErrorZ.
10749  */
10750 void CResult_NetworkGraphDecodeErrorZ_free(struct LDKCResult_NetworkGraphDecodeErrorZ _res);
10751
10752 /**
10753  * Creates a new CResult_NetworkGraphDecodeErrorZ which has the same data as `orig`
10754  * but with all dynamically-allocated buffers duplicated in new buffers.
10755  */
10756 struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_clone(const struct LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR orig);
10757
10758 /**
10759  * Creates a new CResult_NetAddressu8Z in the success state.
10760  */
10761 struct LDKCResult_NetAddressu8Z CResult_NetAddressu8Z_ok(struct LDKNetAddress o);
10762
10763 /**
10764  * Creates a new CResult_NetAddressu8Z in the error state.
10765  */
10766 struct LDKCResult_NetAddressu8Z CResult_NetAddressu8Z_err(uint8_t e);
10767
10768 /**
10769  * Frees any resources used by the CResult_NetAddressu8Z.
10770  */
10771 void CResult_NetAddressu8Z_free(struct LDKCResult_NetAddressu8Z _res);
10772
10773 /**
10774  * Creates a new CResult_NetAddressu8Z which has the same data as `orig`
10775  * but with all dynamically-allocated buffers duplicated in new buffers.
10776  */
10777 struct LDKCResult_NetAddressu8Z CResult_NetAddressu8Z_clone(const struct LDKCResult_NetAddressu8Z *NONNULL_PTR orig);
10778
10779 /**
10780  * Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ in the success state.
10781  */
10782 struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(struct LDKCResult_NetAddressu8Z o);
10783
10784 /**
10785  * Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ in the error state.
10786  */
10787 struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ CResult_CResult_NetAddressu8ZDecodeErrorZ_err(struct LDKDecodeError e);
10788
10789 /**
10790  * Frees any resources used by the CResult_CResult_NetAddressu8ZDecodeErrorZ.
10791  */
10792 void CResult_CResult_NetAddressu8ZDecodeErrorZ_free(struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ _res);
10793
10794 /**
10795  * Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ which has the same data as `orig`
10796  * but with all dynamically-allocated buffers duplicated in new buffers.
10797  */
10798 struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ CResult_CResult_NetAddressu8ZDecodeErrorZ_clone(const struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *NONNULL_PTR orig);
10799
10800 /**
10801  * Creates a new CResult_NetAddressDecodeErrorZ in the success state.
10802  */
10803 struct LDKCResult_NetAddressDecodeErrorZ CResult_NetAddressDecodeErrorZ_ok(struct LDKNetAddress o);
10804
10805 /**
10806  * Creates a new CResult_NetAddressDecodeErrorZ in the error state.
10807  */
10808 struct LDKCResult_NetAddressDecodeErrorZ CResult_NetAddressDecodeErrorZ_err(struct LDKDecodeError e);
10809
10810 /**
10811  * Frees any resources used by the CResult_NetAddressDecodeErrorZ.
10812  */
10813 void CResult_NetAddressDecodeErrorZ_free(struct LDKCResult_NetAddressDecodeErrorZ _res);
10814
10815 /**
10816  * Creates a new CResult_NetAddressDecodeErrorZ which has the same data as `orig`
10817  * but with all dynamically-allocated buffers duplicated in new buffers.
10818  */
10819 struct LDKCResult_NetAddressDecodeErrorZ CResult_NetAddressDecodeErrorZ_clone(const struct LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR orig);
10820
10821 /**
10822  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10823  */
10824 void CVec_UpdateAddHTLCZ_free(struct LDKCVec_UpdateAddHTLCZ _res);
10825
10826 /**
10827  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10828  */
10829 void CVec_UpdateFulfillHTLCZ_free(struct LDKCVec_UpdateFulfillHTLCZ _res);
10830
10831 /**
10832  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10833  */
10834 void CVec_UpdateFailHTLCZ_free(struct LDKCVec_UpdateFailHTLCZ _res);
10835
10836 /**
10837  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10838  */
10839 void CVec_UpdateFailMalformedHTLCZ_free(struct LDKCVec_UpdateFailMalformedHTLCZ _res);
10840
10841 /**
10842  * Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
10843  */
10844 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_ok(struct LDKAcceptChannel o);
10845
10846 /**
10847  * Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
10848  */
10849 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_err(struct LDKDecodeError e);
10850
10851 /**
10852  * Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
10853  */
10854 void CResult_AcceptChannelDecodeErrorZ_free(struct LDKCResult_AcceptChannelDecodeErrorZ _res);
10855
10856 /**
10857  * Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
10858  * but with all dynamically-allocated buffers duplicated in new buffers.
10859  */
10860 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_clone(const struct LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR orig);
10861
10862 /**
10863  * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
10864  */
10865 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_ok(struct LDKAnnouncementSignatures o);
10866
10867 /**
10868  * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
10869  */
10870 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_err(struct LDKDecodeError e);
10871
10872 /**
10873  * Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
10874  */
10875 void CResult_AnnouncementSignaturesDecodeErrorZ_free(struct LDKCResult_AnnouncementSignaturesDecodeErrorZ _res);
10876
10877 /**
10878  * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
10879  * but with all dynamically-allocated buffers duplicated in new buffers.
10880  */
10881 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_clone(const struct LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR orig);
10882
10883 /**
10884  * Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
10885  */
10886 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_ok(struct LDKChannelReestablish o);
10887
10888 /**
10889  * Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
10890  */
10891 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_err(struct LDKDecodeError e);
10892
10893 /**
10894  * Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
10895  */
10896 void CResult_ChannelReestablishDecodeErrorZ_free(struct LDKCResult_ChannelReestablishDecodeErrorZ _res);
10897
10898 /**
10899  * Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig`
10900  * but with all dynamically-allocated buffers duplicated in new buffers.
10901  */
10902 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_clone(const struct LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR orig);
10903
10904 /**
10905  * Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
10906  */
10907 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_ok(struct LDKClosingSigned o);
10908
10909 /**
10910  * Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
10911  */
10912 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_err(struct LDKDecodeError e);
10913
10914 /**
10915  * Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
10916  */
10917 void CResult_ClosingSignedDecodeErrorZ_free(struct LDKCResult_ClosingSignedDecodeErrorZ _res);
10918
10919 /**
10920  * Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig`
10921  * but with all dynamically-allocated buffers duplicated in new buffers.
10922  */
10923 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_clone(const struct LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR orig);
10924
10925 /**
10926  * Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
10927  */
10928 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_ok(struct LDKCommitmentSigned o);
10929
10930 /**
10931  * Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
10932  */
10933 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_err(struct LDKDecodeError e);
10934
10935 /**
10936  * Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
10937  */
10938 void CResult_CommitmentSignedDecodeErrorZ_free(struct LDKCResult_CommitmentSignedDecodeErrorZ _res);
10939
10940 /**
10941  * Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig`
10942  * but with all dynamically-allocated buffers duplicated in new buffers.
10943  */
10944 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_clone(const struct LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR orig);
10945
10946 /**
10947  * Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
10948  */
10949 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_ok(struct LDKFundingCreated o);
10950
10951 /**
10952  * Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
10953  */
10954 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_err(struct LDKDecodeError e);
10955
10956 /**
10957  * Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
10958  */
10959 void CResult_FundingCreatedDecodeErrorZ_free(struct LDKCResult_FundingCreatedDecodeErrorZ _res);
10960
10961 /**
10962  * Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig`
10963  * but with all dynamically-allocated buffers duplicated in new buffers.
10964  */
10965 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_clone(const struct LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR orig);
10966
10967 /**
10968  * Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
10969  */
10970 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_ok(struct LDKFundingSigned o);
10971
10972 /**
10973  * Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
10974  */
10975 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_err(struct LDKDecodeError e);
10976
10977 /**
10978  * Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
10979  */
10980 void CResult_FundingSignedDecodeErrorZ_free(struct LDKCResult_FundingSignedDecodeErrorZ _res);
10981
10982 /**
10983  * Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
10984  * but with all dynamically-allocated buffers duplicated in new buffers.
10985  */
10986 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_clone(const struct LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR orig);
10987
10988 /**
10989  * Creates a new CResult_FundingLockedDecodeErrorZ in the success state.
10990  */
10991 struct LDKCResult_FundingLockedDecodeErrorZ CResult_FundingLockedDecodeErrorZ_ok(struct LDKFundingLocked o);
10992
10993 /**
10994  * Creates a new CResult_FundingLockedDecodeErrorZ in the error state.
10995  */
10996 struct LDKCResult_FundingLockedDecodeErrorZ CResult_FundingLockedDecodeErrorZ_err(struct LDKDecodeError e);
10997
10998 /**
10999  * Frees any resources used by the CResult_FundingLockedDecodeErrorZ.
11000  */
11001 void CResult_FundingLockedDecodeErrorZ_free(struct LDKCResult_FundingLockedDecodeErrorZ _res);
11002
11003 /**
11004  * Creates a new CResult_FundingLockedDecodeErrorZ which has the same data as `orig`
11005  * but with all dynamically-allocated buffers duplicated in new buffers.
11006  */
11007 struct LDKCResult_FundingLockedDecodeErrorZ CResult_FundingLockedDecodeErrorZ_clone(const struct LDKCResult_FundingLockedDecodeErrorZ *NONNULL_PTR orig);
11008
11009 /**
11010  * Creates a new CResult_InitDecodeErrorZ in the success state.
11011  */
11012 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_ok(struct LDKInit o);
11013
11014 /**
11015  * Creates a new CResult_InitDecodeErrorZ in the error state.
11016  */
11017 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_err(struct LDKDecodeError e);
11018
11019 /**
11020  * Frees any resources used by the CResult_InitDecodeErrorZ.
11021  */
11022 void CResult_InitDecodeErrorZ_free(struct LDKCResult_InitDecodeErrorZ _res);
11023
11024 /**
11025  * Creates a new CResult_InitDecodeErrorZ which has the same data as `orig`
11026  * but with all dynamically-allocated buffers duplicated in new buffers.
11027  */
11028 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_clone(const struct LDKCResult_InitDecodeErrorZ *NONNULL_PTR orig);
11029
11030 /**
11031  * Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
11032  */
11033 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_ok(struct LDKOpenChannel o);
11034
11035 /**
11036  * Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
11037  */
11038 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_err(struct LDKDecodeError e);
11039
11040 /**
11041  * Frees any resources used by the CResult_OpenChannelDecodeErrorZ.
11042  */
11043 void CResult_OpenChannelDecodeErrorZ_free(struct LDKCResult_OpenChannelDecodeErrorZ _res);
11044
11045 /**
11046  * Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig`
11047  * but with all dynamically-allocated buffers duplicated in new buffers.
11048  */
11049 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_clone(const struct LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR orig);
11050
11051 /**
11052  * Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
11053  */
11054 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_ok(struct LDKRevokeAndACK o);
11055
11056 /**
11057  * Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
11058  */
11059 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_err(struct LDKDecodeError e);
11060
11061 /**
11062  * Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ.
11063  */
11064 void CResult_RevokeAndACKDecodeErrorZ_free(struct LDKCResult_RevokeAndACKDecodeErrorZ _res);
11065
11066 /**
11067  * Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig`
11068  * but with all dynamically-allocated buffers duplicated in new buffers.
11069  */
11070 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_clone(const struct LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR orig);
11071
11072 /**
11073  * Creates a new CResult_ShutdownDecodeErrorZ in the success state.
11074  */
11075 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_ok(struct LDKShutdown o);
11076
11077 /**
11078  * Creates a new CResult_ShutdownDecodeErrorZ in the error state.
11079  */
11080 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_err(struct LDKDecodeError e);
11081
11082 /**
11083  * Frees any resources used by the CResult_ShutdownDecodeErrorZ.
11084  */
11085 void CResult_ShutdownDecodeErrorZ_free(struct LDKCResult_ShutdownDecodeErrorZ _res);
11086
11087 /**
11088  * Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig`
11089  * but with all dynamically-allocated buffers duplicated in new buffers.
11090  */
11091 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_clone(const struct LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR orig);
11092
11093 /**
11094  * Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
11095  */
11096 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_ok(struct LDKUpdateFailHTLC o);
11097
11098 /**
11099  * Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
11100  */
11101 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_err(struct LDKDecodeError e);
11102
11103 /**
11104  * Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ.
11105  */
11106 void CResult_UpdateFailHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFailHTLCDecodeErrorZ _res);
11107
11108 /**
11109  * Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
11110  * but with all dynamically-allocated buffers duplicated in new buffers.
11111  */
11112 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR orig);
11113
11114 /**
11115  * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
11116  */
11117 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(struct LDKUpdateFailMalformedHTLC o);
11118
11119 /**
11120  * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
11121  */
11122 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(struct LDKDecodeError e);
11123
11124 /**
11125  * Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ.
11126  */
11127 void CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res);
11128
11129 /**
11130  * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
11131  * but with all dynamically-allocated buffers duplicated in new buffers.
11132  */
11133 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR orig);
11134
11135 /**
11136  * Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
11137  */
11138 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_ok(struct LDKUpdateFee o);
11139
11140 /**
11141  * Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
11142  */
11143 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_err(struct LDKDecodeError e);
11144
11145 /**
11146  * Frees any resources used by the CResult_UpdateFeeDecodeErrorZ.
11147  */
11148 void CResult_UpdateFeeDecodeErrorZ_free(struct LDKCResult_UpdateFeeDecodeErrorZ _res);
11149
11150 /**
11151  * Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig`
11152  * but with all dynamically-allocated buffers duplicated in new buffers.
11153  */
11154 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_clone(const struct LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR orig);
11155
11156 /**
11157  * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
11158  */
11159 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_ok(struct LDKUpdateFulfillHTLC o);
11160
11161 /**
11162  * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
11163  */
11164 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_err(struct LDKDecodeError e);
11165
11166 /**
11167  * Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ.
11168  */
11169 void CResult_UpdateFulfillHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res);
11170
11171 /**
11172  * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
11173  * but with all dynamically-allocated buffers duplicated in new buffers.
11174  */
11175 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR orig);
11176
11177 /**
11178  * Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
11179  */
11180 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_ok(struct LDKUpdateAddHTLC o);
11181
11182 /**
11183  * Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
11184  */
11185 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_err(struct LDKDecodeError e);
11186
11187 /**
11188  * Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ.
11189  */
11190 void CResult_UpdateAddHTLCDecodeErrorZ_free(struct LDKCResult_UpdateAddHTLCDecodeErrorZ _res);
11191
11192 /**
11193  * Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
11194  * but with all dynamically-allocated buffers duplicated in new buffers.
11195  */
11196 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR orig);
11197
11198 /**
11199  * Creates a new CResult_PingDecodeErrorZ in the success state.
11200  */
11201 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_ok(struct LDKPing o);
11202
11203 /**
11204  * Creates a new CResult_PingDecodeErrorZ in the error state.
11205  */
11206 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_err(struct LDKDecodeError e);
11207
11208 /**
11209  * Frees any resources used by the CResult_PingDecodeErrorZ.
11210  */
11211 void CResult_PingDecodeErrorZ_free(struct LDKCResult_PingDecodeErrorZ _res);
11212
11213 /**
11214  * Creates a new CResult_PingDecodeErrorZ which has the same data as `orig`
11215  * but with all dynamically-allocated buffers duplicated in new buffers.
11216  */
11217 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_clone(const struct LDKCResult_PingDecodeErrorZ *NONNULL_PTR orig);
11218
11219 /**
11220  * Creates a new CResult_PongDecodeErrorZ in the success state.
11221  */
11222 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_ok(struct LDKPong o);
11223
11224 /**
11225  * Creates a new CResult_PongDecodeErrorZ in the error state.
11226  */
11227 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_err(struct LDKDecodeError e);
11228
11229 /**
11230  * Frees any resources used by the CResult_PongDecodeErrorZ.
11231  */
11232 void CResult_PongDecodeErrorZ_free(struct LDKCResult_PongDecodeErrorZ _res);
11233
11234 /**
11235  * Creates a new CResult_PongDecodeErrorZ which has the same data as `orig`
11236  * but with all dynamically-allocated buffers duplicated in new buffers.
11237  */
11238 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_clone(const struct LDKCResult_PongDecodeErrorZ *NONNULL_PTR orig);
11239
11240 /**
11241  * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
11242  */
11243 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(struct LDKUnsignedChannelAnnouncement o);
11244
11245 /**
11246  * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
11247  */
11248 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
11249
11250 /**
11251  * Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
11252  */
11253 void CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res);
11254
11255 /**
11256  * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
11257  * but with all dynamically-allocated buffers duplicated in new buffers.
11258  */
11259 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(const struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR orig);
11260
11261 /**
11262  * Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
11263  */
11264 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_ok(struct LDKChannelAnnouncement o);
11265
11266 /**
11267  * Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
11268  */
11269 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
11270
11271 /**
11272  * Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
11273  */
11274 void CResult_ChannelAnnouncementDecodeErrorZ_free(struct LDKCResult_ChannelAnnouncementDecodeErrorZ _res);
11275
11276 /**
11277  * Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
11278  * but with all dynamically-allocated buffers duplicated in new buffers.
11279  */
11280 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_clone(const struct LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR orig);
11281
11282 /**
11283  * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
11284  */
11285 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_ok(struct LDKUnsignedChannelUpdate o);
11286
11287 /**
11288  * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
11289  */
11290 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_err(struct LDKDecodeError e);
11291
11292 /**
11293  * Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
11294  */
11295 void CResult_UnsignedChannelUpdateDecodeErrorZ_free(struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res);
11296
11297 /**
11298  * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
11299  * but with all dynamically-allocated buffers duplicated in new buffers.
11300  */
11301 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_clone(const struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR orig);
11302
11303 /**
11304  * Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
11305  */
11306 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_ok(struct LDKChannelUpdate o);
11307
11308 /**
11309  * Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
11310  */
11311 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_err(struct LDKDecodeError e);
11312
11313 /**
11314  * Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
11315  */
11316 void CResult_ChannelUpdateDecodeErrorZ_free(struct LDKCResult_ChannelUpdateDecodeErrorZ _res);
11317
11318 /**
11319  * Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
11320  * but with all dynamically-allocated buffers duplicated in new buffers.
11321  */
11322 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_clone(const struct LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR orig);
11323
11324 /**
11325  * Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
11326  */
11327 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_ok(struct LDKErrorMessage o);
11328
11329 /**
11330  * Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
11331  */
11332 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_err(struct LDKDecodeError e);
11333
11334 /**
11335  * Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
11336  */
11337 void CResult_ErrorMessageDecodeErrorZ_free(struct LDKCResult_ErrorMessageDecodeErrorZ _res);
11338
11339 /**
11340  * Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
11341  * but with all dynamically-allocated buffers duplicated in new buffers.
11342  */
11343 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_clone(const struct LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR orig);
11344
11345 /**
11346  * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
11347  */
11348 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(struct LDKUnsignedNodeAnnouncement o);
11349
11350 /**
11351  * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
11352  */
11353 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
11354
11355 /**
11356  * Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
11357  */
11358 void CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res);
11359
11360 /**
11361  * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
11362  * but with all dynamically-allocated buffers duplicated in new buffers.
11363  */
11364 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(const struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR orig);
11365
11366 /**
11367  * Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
11368  */
11369 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_ok(struct LDKNodeAnnouncement o);
11370
11371 /**
11372  * Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
11373  */
11374 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
11375
11376 /**
11377  * Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
11378  */
11379 void CResult_NodeAnnouncementDecodeErrorZ_free(struct LDKCResult_NodeAnnouncementDecodeErrorZ _res);
11380
11381 /**
11382  * Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
11383  * but with all dynamically-allocated buffers duplicated in new buffers.
11384  */
11385 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_clone(const struct LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR orig);
11386
11387 /**
11388  * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
11389  */
11390 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_ok(struct LDKQueryShortChannelIds o);
11391
11392 /**
11393  * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
11394  */
11395 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_err(struct LDKDecodeError e);
11396
11397 /**
11398  * Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
11399  */
11400 void CResult_QueryShortChannelIdsDecodeErrorZ_free(struct LDKCResult_QueryShortChannelIdsDecodeErrorZ _res);
11401
11402 /**
11403  * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
11404  * but with all dynamically-allocated buffers duplicated in new buffers.
11405  */
11406 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_clone(const struct LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR orig);
11407
11408 /**
11409  * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
11410  */
11411 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(struct LDKReplyShortChannelIdsEnd o);
11412
11413 /**
11414  * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
11415  */
11416 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(struct LDKDecodeError e);
11417
11418 /**
11419  * Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
11420  */
11421 void CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res);
11422
11423 /**
11424  * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
11425  * but with all dynamically-allocated buffers duplicated in new buffers.
11426  */
11427 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(const struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR orig);
11428
11429 /**
11430  * Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
11431  */
11432 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_ok(struct LDKQueryChannelRange o);
11433
11434 /**
11435  * Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
11436  */
11437 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_err(struct LDKDecodeError e);
11438
11439 /**
11440  * Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
11441  */
11442 void CResult_QueryChannelRangeDecodeErrorZ_free(struct LDKCResult_QueryChannelRangeDecodeErrorZ _res);
11443
11444 /**
11445  * Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
11446  * but with all dynamically-allocated buffers duplicated in new buffers.
11447  */
11448 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_clone(const struct LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR orig);
11449
11450 /**
11451  * Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
11452  */
11453 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_ok(struct LDKReplyChannelRange o);
11454
11455 /**
11456  * Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
11457  */
11458 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_err(struct LDKDecodeError e);
11459
11460 /**
11461  * Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
11462  */
11463 void CResult_ReplyChannelRangeDecodeErrorZ_free(struct LDKCResult_ReplyChannelRangeDecodeErrorZ _res);
11464
11465 /**
11466  * Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
11467  * but with all dynamically-allocated buffers duplicated in new buffers.
11468  */
11469 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_clone(const struct LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR orig);
11470
11471 /**
11472  * Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
11473  */
11474 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_ok(struct LDKGossipTimestampFilter o);
11475
11476 /**
11477  * Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
11478  */
11479 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_err(struct LDKDecodeError e);
11480
11481 /**
11482  * Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
11483  */
11484 void CResult_GossipTimestampFilterDecodeErrorZ_free(struct LDKCResult_GossipTimestampFilterDecodeErrorZ _res);
11485
11486 /**
11487  * Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
11488  * but with all dynamically-allocated buffers duplicated in new buffers.
11489  */
11490 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_clone(const struct LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR orig);
11491
11492 /**
11493  * Creates a new CResult_InvoiceSignOrCreationErrorZ in the success state.
11494  */
11495 struct LDKCResult_InvoiceSignOrCreationErrorZ CResult_InvoiceSignOrCreationErrorZ_ok(struct LDKInvoice o);
11496
11497 /**
11498  * Creates a new CResult_InvoiceSignOrCreationErrorZ in the error state.
11499  */
11500 struct LDKCResult_InvoiceSignOrCreationErrorZ CResult_InvoiceSignOrCreationErrorZ_err(struct LDKSignOrCreationError e);
11501
11502 /**
11503  * Frees any resources used by the CResult_InvoiceSignOrCreationErrorZ.
11504  */
11505 void CResult_InvoiceSignOrCreationErrorZ_free(struct LDKCResult_InvoiceSignOrCreationErrorZ _res);
11506
11507 /**
11508  * Creates a new CResult_InvoiceSignOrCreationErrorZ which has the same data as `orig`
11509  * but with all dynamically-allocated buffers duplicated in new buffers.
11510  */
11511 struct LDKCResult_InvoiceSignOrCreationErrorZ CResult_InvoiceSignOrCreationErrorZ_clone(const struct LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR orig);
11512
11513 /**
11514  * Frees any resources used by the Event
11515  */
11516 void Event_free(struct LDKEvent this_ptr);
11517
11518 /**
11519  * Creates a copy of the Event
11520  */
11521 struct LDKEvent Event_clone(const struct LDKEvent *NONNULL_PTR orig);
11522
11523 /**
11524  * Serialize the Event object into a byte array which can be read by Event_read
11525  */
11526 struct LDKCVec_u8Z Event_write(const struct LDKEvent *NONNULL_PTR obj);
11527
11528 /**
11529  * Frees any resources used by the MessageSendEvent
11530  */
11531 void MessageSendEvent_free(struct LDKMessageSendEvent this_ptr);
11532
11533 /**
11534  * Creates a copy of the MessageSendEvent
11535  */
11536 struct LDKMessageSendEvent MessageSendEvent_clone(const struct LDKMessageSendEvent *NONNULL_PTR orig);
11537
11538 /**
11539  * Calls the free function if one is set
11540  */
11541 void MessageSendEventsProvider_free(struct LDKMessageSendEventsProvider this_ptr);
11542
11543 /**
11544  * Calls the free function if one is set
11545  */
11546 void EventsProvider_free(struct LDKEventsProvider this_ptr);
11547
11548 /**
11549  * Calls the free function if one is set
11550  */
11551 void EventHandler_free(struct LDKEventHandler this_ptr);
11552
11553 /**
11554  * Frees any resources used by the APIError
11555  */
11556 void APIError_free(struct LDKAPIError this_ptr);
11557
11558 /**
11559  * Creates a copy of the APIError
11560  */
11561 struct LDKAPIError APIError_clone(const struct LDKAPIError *NONNULL_PTR orig);
11562
11563 /**
11564  * Creates a digital signature of a message given a SecretKey, like the node's secret.
11565  * A receiver knowing the PublicKey (e.g. the node's id) and the message can be sure that the signature was generated by the caller.
11566  * Signatures are EC recoverable, meaning that given the message and the signature the PublicKey of the signer can be extracted.
11567  */
11568 struct LDKCResult_StringErrorZ sign(struct LDKu8slice msg, struct LDKSecretKey sk);
11569
11570 /**
11571  * Recovers the PublicKey of the signer of the message given the message and the signature.
11572  */
11573 struct LDKCResult_PublicKeyErrorZ recover_pk(struct LDKu8slice msg, struct LDKStr sig);
11574
11575 /**
11576  * Verifies a message was signed by a PrivateKey that derives to a given PublicKey, given a message, a signature,
11577  * and the PublicKey.
11578  */
11579 bool verify(struct LDKu8slice msg, struct LDKStr sig, struct LDKPublicKey pk);
11580
11581 /**
11582  * Creates a copy of the Level
11583  */
11584 enum LDKLevel Level_clone(const enum LDKLevel *NONNULL_PTR orig);
11585
11586 /**
11587  * Checks if two Levels contain equal inner contents.
11588  * This ignores pointers and is_owned flags and looks at the values in fields.
11589  */
11590 bool Level_eq(const enum LDKLevel *NONNULL_PTR a, const enum LDKLevel *NONNULL_PTR b);
11591
11592 /**
11593  * Checks if two Levels contain equal inner contents.
11594  */
11595 uint64_t Level_hash(const enum LDKLevel *NONNULL_PTR o);
11596
11597 /**
11598  * Returns the most verbose logging level.
11599  */
11600 MUST_USE_RES enum LDKLevel Level_max(void);
11601
11602 /**
11603  * Calls the free function if one is set
11604  */
11605 void Logger_free(struct LDKLogger this_ptr);
11606
11607 /**
11608  * Frees any resources used by the ChannelHandshakeConfig, if is_owned is set and inner is non-NULL.
11609  */
11610 void ChannelHandshakeConfig_free(struct LDKChannelHandshakeConfig this_obj);
11611
11612 /**
11613  * Confirmations we will wait for before considering the channel locked in.
11614  * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
11615  * equivalent limit applied to outbound channels).
11616  *
11617  * Default value: 6.
11618  */
11619 uint32_t ChannelHandshakeConfig_get_minimum_depth(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
11620
11621 /**
11622  * Confirmations we will wait for before considering the channel locked in.
11623  * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
11624  * equivalent limit applied to outbound channels).
11625  *
11626  * Default value: 6.
11627  */
11628 void ChannelHandshakeConfig_set_minimum_depth(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint32_t val);
11629
11630 /**
11631  * Set to the number of blocks we require our counterparty to wait to claim their money (ie
11632  * the number of blocks we have to punish our counterparty if they broadcast a revoked
11633  * transaction).
11634  *
11635  * This is one of the main parameters of our security model. We (or one of our watchtowers) MUST
11636  * be online to check for revoked transactions on-chain at least once every our_to_self_delay
11637  * blocks (minus some margin to allow us enough time to broadcast and confirm a transaction,
11638  * possibly with time in between to RBF the spending transaction).
11639  *
11640  * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in
11641  * case of an honest unilateral channel close, which implicitly decrease the economic value of
11642  * our channel.
11643  *
11644  * Default value: [`BREAKDOWN_TIMEOUT`], we enforce it as a minimum at channel opening so you
11645  * can tweak config to ask for more security, not less.
11646  */
11647 uint16_t ChannelHandshakeConfig_get_our_to_self_delay(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
11648
11649 /**
11650  * Set to the number of blocks we require our counterparty to wait to claim their money (ie
11651  * the number of blocks we have to punish our counterparty if they broadcast a revoked
11652  * transaction).
11653  *
11654  * This is one of the main parameters of our security model. We (or one of our watchtowers) MUST
11655  * be online to check for revoked transactions on-chain at least once every our_to_self_delay
11656  * blocks (minus some margin to allow us enough time to broadcast and confirm a transaction,
11657  * possibly with time in between to RBF the spending transaction).
11658  *
11659  * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in
11660  * case of an honest unilateral channel close, which implicitly decrease the economic value of
11661  * our channel.
11662  *
11663  * Default value: [`BREAKDOWN_TIMEOUT`], we enforce it as a minimum at channel opening so you
11664  * can tweak config to ask for more security, not less.
11665  */
11666 void ChannelHandshakeConfig_set_our_to_self_delay(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint16_t val);
11667
11668 /**
11669  * Set to the smallest value HTLC we will accept to process.
11670  *
11671  * This value is sent to our counterparty on channel-open and we close the channel any time
11672  * our counterparty misbehaves by sending us an HTLC with a value smaller than this.
11673  *
11674  * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required
11675  * by the protocol.
11676  */
11677 uint64_t ChannelHandshakeConfig_get_our_htlc_minimum_msat(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
11678
11679 /**
11680  * Set to the smallest value HTLC we will accept to process.
11681  *
11682  * This value is sent to our counterparty on channel-open and we close the channel any time
11683  * our counterparty misbehaves by sending us an HTLC with a value smaller than this.
11684  *
11685  * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required
11686  * by the protocol.
11687  */
11688 void ChannelHandshakeConfig_set_our_htlc_minimum_msat(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint64_t val);
11689
11690 /**
11691  * Constructs a new ChannelHandshakeConfig given each field
11692  */
11693 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);
11694
11695 /**
11696  * Creates a copy of the ChannelHandshakeConfig
11697  */
11698 struct LDKChannelHandshakeConfig ChannelHandshakeConfig_clone(const struct LDKChannelHandshakeConfig *NONNULL_PTR orig);
11699
11700 /**
11701  * Creates a "default" ChannelHandshakeConfig. See struct and individual field documentaiton for details on which values are used.
11702  */
11703 MUST_USE_RES struct LDKChannelHandshakeConfig ChannelHandshakeConfig_default(void);
11704
11705 /**
11706  * Frees any resources used by the ChannelHandshakeLimits, if is_owned is set and inner is non-NULL.
11707  */
11708 void ChannelHandshakeLimits_free(struct LDKChannelHandshakeLimits this_obj);
11709
11710 /**
11711  * Minimum allowed satoshis when a channel is funded, this is supplied by the sender and so
11712  * only applies to inbound channels.
11713  *
11714  * Default value: 0.
11715  */
11716 uint64_t ChannelHandshakeLimits_get_min_funding_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
11717
11718 /**
11719  * Minimum allowed satoshis when a channel is funded, this is supplied by the sender and so
11720  * only applies to inbound channels.
11721  *
11722  * Default value: 0.
11723  */
11724 void ChannelHandshakeLimits_set_min_funding_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
11725
11726 /**
11727  * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows
11728  * you to limit the maximum minimum-size they can require.
11729  *
11730  * Default value: u64::max_value.
11731  */
11732 uint64_t ChannelHandshakeLimits_get_max_htlc_minimum_msat(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
11733
11734 /**
11735  * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows
11736  * you to limit the maximum minimum-size they can require.
11737  *
11738  * Default value: u64::max_value.
11739  */
11740 void ChannelHandshakeLimits_set_max_htlc_minimum_msat(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
11741
11742 /**
11743  * The remote node sets a limit on the maximum value of pending HTLCs to them at any given
11744  * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value.
11745  *
11746  * Default value: 0.
11747  */
11748 uint64_t ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
11749
11750 /**
11751  * The remote node sets a limit on the maximum value of pending HTLCs to them at any given
11752  * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value.
11753  *
11754  * Default value: 0.
11755  */
11756 void ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
11757
11758 /**
11759  * The remote node will require we keep a certain amount in direct payment to ourselves at all
11760  * time, ensuring that we are able to be punished if we broadcast an old state. This allows to
11761  * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs).
11762  *
11763  * Default value: u64::max_value.
11764  */
11765 uint64_t ChannelHandshakeLimits_get_max_channel_reserve_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
11766
11767 /**
11768  * The remote node will require we keep a certain amount in direct payment to ourselves at all
11769  * time, ensuring that we are able to be punished if we broadcast an old state. This allows to
11770  * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs).
11771  *
11772  * Default value: u64::max_value.
11773  */
11774 void ChannelHandshakeLimits_set_max_channel_reserve_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
11775
11776 /**
11777  * The remote node sets a limit on the maximum number of pending HTLCs to them at any given
11778  * time. This allows you to set a minimum such value.
11779  *
11780  * Default value: 0.
11781  */
11782 uint16_t ChannelHandshakeLimits_get_min_max_accepted_htlcs(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
11783
11784 /**
11785  * The remote node sets a limit on the maximum number of pending HTLCs to them at any given
11786  * time. This allows you to set a minimum such value.
11787  *
11788  * Default value: 0.
11789  */
11790 void ChannelHandshakeLimits_set_min_max_accepted_htlcs(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint16_t val);
11791
11792 /**
11793  * Before a channel is usable the funding transaction will need to be confirmed by at least a
11794  * certain number of blocks, specified by the node which is not the funder (as the funder can
11795  * assume they aren't going to double-spend themselves).
11796  * This config allows you to set a limit on the maximum amount of time to wait.
11797  *
11798  * Default value: 144, or roughly one day and only applies to outbound channels.
11799  */
11800 uint32_t ChannelHandshakeLimits_get_max_minimum_depth(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
11801
11802 /**
11803  * Before a channel is usable the funding transaction will need to be confirmed by at least a
11804  * certain number of blocks, specified by the node which is not the funder (as the funder can
11805  * assume they aren't going to double-spend themselves).
11806  * This config allows you to set a limit on the maximum amount of time to wait.
11807  *
11808  * Default value: 144, or roughly one day and only applies to outbound channels.
11809  */
11810 void ChannelHandshakeLimits_set_max_minimum_depth(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint32_t val);
11811
11812 /**
11813  * Set to force the incoming channel to match our announced channel preference in
11814  * ChannelConfig.
11815  *
11816  * Default value: true, to make the default that no announced channels are possible (which is
11817  * appropriate for any nodes which are not online very reliably).
11818  */
11819 bool ChannelHandshakeLimits_get_force_announced_channel_preference(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
11820
11821 /**
11822  * Set to force the incoming channel to match our announced channel preference in
11823  * ChannelConfig.
11824  *
11825  * Default value: true, to make the default that no announced channels are possible (which is
11826  * appropriate for any nodes which are not online very reliably).
11827  */
11828 void ChannelHandshakeLimits_set_force_announced_channel_preference(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, bool val);
11829
11830 /**
11831  * Set to the amount of time we're willing to wait to claim money back to us.
11832  *
11833  * Not checking this value would be a security issue, as our peer would be able to set it to
11834  * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time.
11835  *
11836  * Default value: 2016, which we also enforce as a maximum value so you can tweak config to
11837  * reduce the loss of having useless locked funds (if your peer accepts)
11838  */
11839 uint16_t ChannelHandshakeLimits_get_their_to_self_delay(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
11840
11841 /**
11842  * Set to the amount of time we're willing to wait to claim money back to us.
11843  *
11844  * Not checking this value would be a security issue, as our peer would be able to set it to
11845  * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time.
11846  *
11847  * Default value: 2016, which we also enforce as a maximum value so you can tweak config to
11848  * reduce the loss of having useless locked funds (if your peer accepts)
11849  */
11850 void ChannelHandshakeLimits_set_their_to_self_delay(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint16_t val);
11851
11852 /**
11853  * Constructs a new ChannelHandshakeLimits given each field
11854  */
11855 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, uint32_t max_minimum_depth_arg, bool force_announced_channel_preference_arg, uint16_t their_to_self_delay_arg);
11856
11857 /**
11858  * Creates a copy of the ChannelHandshakeLimits
11859  */
11860 struct LDKChannelHandshakeLimits ChannelHandshakeLimits_clone(const struct LDKChannelHandshakeLimits *NONNULL_PTR orig);
11861
11862 /**
11863  * Creates a "default" ChannelHandshakeLimits. See struct and individual field documentaiton for details on which values are used.
11864  */
11865 MUST_USE_RES struct LDKChannelHandshakeLimits ChannelHandshakeLimits_default(void);
11866
11867 /**
11868  * Frees any resources used by the ChannelConfig, if is_owned is set and inner is non-NULL.
11869  */
11870 void ChannelConfig_free(struct LDKChannelConfig this_obj);
11871
11872 /**
11873  * Amount (in millionths of a satoshi) the channel will charge per transferred satoshi.
11874  * This may be allowed to change at runtime in a later update, however doing so must result in
11875  * update messages sent to notify all nodes of our updated relay fee.
11876  *
11877  * Default value: 0.
11878  */
11879 uint32_t ChannelConfig_get_fee_proportional_millionths(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
11880
11881 /**
11882  * Amount (in millionths of a satoshi) the channel will charge per transferred satoshi.
11883  * This may be allowed to change at runtime in a later update, however doing so must result in
11884  * update messages sent to notify all nodes of our updated relay fee.
11885  *
11886  * Default value: 0.
11887  */
11888 void ChannelConfig_set_fee_proportional_millionths(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint32_t val);
11889
11890 /**
11891  * The difference in the CLTV value between incoming HTLCs and an outbound HTLC forwarded over
11892  * the channel this config applies to.
11893  *
11894  * This is analogous to [`ChannelHandshakeConfig::our_to_self_delay`] but applies to in-flight
11895  * HTLC balance when a channel appears on-chain whereas
11896  * [`ChannelHandshakeConfig::our_to_self_delay`] applies to the remaining
11897  * (non-HTLC-encumbered) balance.
11898  *
11899  * Thus, for HTLC-encumbered balances to be enforced on-chain when a channel is force-closed,
11900  * we (or one of our watchtowers) MUST be online to check for broadcast of the current
11901  * commitment transaction at least once per this many blocks (minus some margin to allow us
11902  * enough time to broadcast and confirm a transaction, possibly with time in between to RBF
11903  * the spending transaction).
11904  *
11905  * Default value: 72 (12 hours at an average of 6 blocks/hour).
11906  * Minimum value: [`MIN_CLTV_EXPIRY_DELTA`], any values less than this will be treated as
11907  *                [`MIN_CLTV_EXPIRY_DELTA`] instead.
11908  *
11909  * [`MIN_CLTV_EXPIRY_DELTA`]: crate::ln::channelmanager::MIN_CLTV_EXPIRY_DELTA
11910  */
11911 uint16_t ChannelConfig_get_cltv_expiry_delta(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
11912
11913 /**
11914  * The difference in the CLTV value between incoming HTLCs and an outbound HTLC forwarded over
11915  * the channel this config applies to.
11916  *
11917  * This is analogous to [`ChannelHandshakeConfig::our_to_self_delay`] but applies to in-flight
11918  * HTLC balance when a channel appears on-chain whereas
11919  * [`ChannelHandshakeConfig::our_to_self_delay`] applies to the remaining
11920  * (non-HTLC-encumbered) balance.
11921  *
11922  * Thus, for HTLC-encumbered balances to be enforced on-chain when a channel is force-closed,
11923  * we (or one of our watchtowers) MUST be online to check for broadcast of the current
11924  * commitment transaction at least once per this many blocks (minus some margin to allow us
11925  * enough time to broadcast and confirm a transaction, possibly with time in between to RBF
11926  * the spending transaction).
11927  *
11928  * Default value: 72 (12 hours at an average of 6 blocks/hour).
11929  * Minimum value: [`MIN_CLTV_EXPIRY_DELTA`], any values less than this will be treated as
11930  *                [`MIN_CLTV_EXPIRY_DELTA`] instead.
11931  *
11932  * [`MIN_CLTV_EXPIRY_DELTA`]: crate::ln::channelmanager::MIN_CLTV_EXPIRY_DELTA
11933  */
11934 void ChannelConfig_set_cltv_expiry_delta(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint16_t val);
11935
11936 /**
11937  * Set to announce the channel publicly and notify all nodes that they can route via this
11938  * channel.
11939  *
11940  * This should only be set to true for nodes which expect to be online reliably.
11941  *
11942  * As the node which funds a channel picks this value this will only apply for new outbound
11943  * channels unless ChannelHandshakeLimits::force_announced_channel_preferences is set.
11944  *
11945  * This cannot be changed after the initial channel handshake.
11946  *
11947  * Default value: false.
11948  */
11949 bool ChannelConfig_get_announced_channel(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
11950
11951 /**
11952  * Set to announce the channel publicly and notify all nodes that they can route via this
11953  * channel.
11954  *
11955  * This should only be set to true for nodes which expect to be online reliably.
11956  *
11957  * As the node which funds a channel picks this value this will only apply for new outbound
11958  * channels unless ChannelHandshakeLimits::force_announced_channel_preferences is set.
11959  *
11960  * This cannot be changed after the initial channel handshake.
11961  *
11962  * Default value: false.
11963  */
11964 void ChannelConfig_set_announced_channel(struct LDKChannelConfig *NONNULL_PTR this_ptr, bool val);
11965
11966 /**
11967  * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty
11968  * supports it, they will then enforce the mutual-close output to us matches what we provided
11969  * at intialization, preventing us from closing to an alternate pubkey.
11970  *
11971  * This is set to true by default to provide a slight increase in security, though ultimately
11972  * any attacker who is able to take control of a channel can just as easily send the funds via
11973  * lightning payments, so we never require that our counterparties support this option.
11974  *
11975  * This cannot be changed after a channel has been initialized.
11976  *
11977  * Default value: true.
11978  */
11979 bool ChannelConfig_get_commit_upfront_shutdown_pubkey(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
11980
11981 /**
11982  * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty
11983  * supports it, they will then enforce the mutual-close output to us matches what we provided
11984  * at intialization, preventing us from closing to an alternate pubkey.
11985  *
11986  * This is set to true by default to provide a slight increase in security, though ultimately
11987  * any attacker who is able to take control of a channel can just as easily send the funds via
11988  * lightning payments, so we never require that our counterparties support this option.
11989  *
11990  * This cannot be changed after a channel has been initialized.
11991  *
11992  * Default value: true.
11993  */
11994 void ChannelConfig_set_commit_upfront_shutdown_pubkey(struct LDKChannelConfig *NONNULL_PTR this_ptr, bool val);
11995
11996 /**
11997  * Constructs a new ChannelConfig given each field
11998  */
11999 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);
12000
12001 /**
12002  * Creates a copy of the ChannelConfig
12003  */
12004 struct LDKChannelConfig ChannelConfig_clone(const struct LDKChannelConfig *NONNULL_PTR orig);
12005
12006 /**
12007  * Creates a "default" ChannelConfig. See struct and individual field documentaiton for details on which values are used.
12008  */
12009 MUST_USE_RES struct LDKChannelConfig ChannelConfig_default(void);
12010
12011 /**
12012  * Serialize the ChannelConfig object into a byte array which can be read by ChannelConfig_read
12013  */
12014 struct LDKCVec_u8Z ChannelConfig_write(const struct LDKChannelConfig *NONNULL_PTR obj);
12015
12016 /**
12017  * Read a ChannelConfig from a byte array, created by ChannelConfig_write
12018  */
12019 struct LDKCResult_ChannelConfigDecodeErrorZ ChannelConfig_read(struct LDKu8slice ser);
12020
12021 /**
12022  * Frees any resources used by the UserConfig, if is_owned is set and inner is non-NULL.
12023  */
12024 void UserConfig_free(struct LDKUserConfig this_obj);
12025
12026 /**
12027  * Channel config that we propose to our counterparty.
12028  */
12029 struct LDKChannelHandshakeConfig UserConfig_get_own_channel_config(const struct LDKUserConfig *NONNULL_PTR this_ptr);
12030
12031 /**
12032  * Channel config that we propose to our counterparty.
12033  */
12034 void UserConfig_set_own_channel_config(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeConfig val);
12035
12036 /**
12037  * Limits applied to our counterparty's proposed channel config settings.
12038  */
12039 struct LDKChannelHandshakeLimits UserConfig_get_peer_channel_config_limits(const struct LDKUserConfig *NONNULL_PTR this_ptr);
12040
12041 /**
12042  * Limits applied to our counterparty's proposed channel config settings.
12043  */
12044 void UserConfig_set_peer_channel_config_limits(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeLimits val);
12045
12046 /**
12047  * Channel config which affects behavior during channel lifetime.
12048  */
12049 struct LDKChannelConfig UserConfig_get_channel_options(const struct LDKUserConfig *NONNULL_PTR this_ptr);
12050
12051 /**
12052  * Channel config which affects behavior during channel lifetime.
12053  */
12054 void UserConfig_set_channel_options(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelConfig val);
12055
12056 /**
12057  * Constructs a new UserConfig given each field
12058  */
12059 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);
12060
12061 /**
12062  * Creates a copy of the UserConfig
12063  */
12064 struct LDKUserConfig UserConfig_clone(const struct LDKUserConfig *NONNULL_PTR orig);
12065
12066 /**
12067  * Creates a "default" UserConfig. See struct and individual field documentaiton for details on which values are used.
12068  */
12069 MUST_USE_RES struct LDKUserConfig UserConfig_default(void);
12070
12071 /**
12072  * Creates a copy of the AccessError
12073  */
12074 enum LDKAccessError AccessError_clone(const enum LDKAccessError *NONNULL_PTR orig);
12075
12076 /**
12077  * Calls the free function if one is set
12078  */
12079 void Access_free(struct LDKAccess this_ptr);
12080
12081 /**
12082  * Calls the free function if one is set
12083  */
12084 void Listen_free(struct LDKListen this_ptr);
12085
12086 /**
12087  * Calls the free function if one is set
12088  */
12089 void Confirm_free(struct LDKConfirm this_ptr);
12090
12091 /**
12092  * Calls the free function if one is set
12093  */
12094 void Watch_free(struct LDKWatch this_ptr);
12095
12096 /**
12097  * Calls the free function if one is set
12098  */
12099 void Filter_free(struct LDKFilter this_ptr);
12100
12101 /**
12102  * Frees any resources used by the WatchedOutput, if is_owned is set and inner is non-NULL.
12103  */
12104 void WatchedOutput_free(struct LDKWatchedOutput this_obj);
12105
12106 /**
12107  * First block where the transaction output may have been spent.
12108  */
12109 struct LDKThirtyTwoBytes WatchedOutput_get_block_hash(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
12110
12111 /**
12112  * First block where the transaction output may have been spent.
12113  */
12114 void WatchedOutput_set_block_hash(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12115
12116 /**
12117  * Outpoint identifying the transaction output.
12118  */
12119 struct LDKOutPoint WatchedOutput_get_outpoint(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
12120
12121 /**
12122  * Outpoint identifying the transaction output.
12123  */
12124 void WatchedOutput_set_outpoint(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKOutPoint val);
12125
12126 /**
12127  * Spending condition of the transaction output.
12128  */
12129 struct LDKu8slice WatchedOutput_get_script_pubkey(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
12130
12131 /**
12132  * Spending condition of the transaction output.
12133  */
12134 void WatchedOutput_set_script_pubkey(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
12135
12136 /**
12137  * Constructs a new WatchedOutput given each field
12138  */
12139 MUST_USE_RES struct LDKWatchedOutput WatchedOutput_new(struct LDKThirtyTwoBytes block_hash_arg, struct LDKOutPoint outpoint_arg, struct LDKCVec_u8Z script_pubkey_arg);
12140
12141 /**
12142  * Calls the free function if one is set
12143  */
12144 void BroadcasterInterface_free(struct LDKBroadcasterInterface this_ptr);
12145
12146 /**
12147  * Creates a copy of the ConfirmationTarget
12148  */
12149 enum LDKConfirmationTarget ConfirmationTarget_clone(const enum LDKConfirmationTarget *NONNULL_PTR orig);
12150
12151 /**
12152  * Calls the free function if one is set
12153  */
12154 void FeeEstimator_free(struct LDKFeeEstimator this_ptr);
12155
12156 /**
12157  * Frees any resources used by the ChainMonitor, if is_owned is set and inner is non-NULL.
12158  */
12159 void ChainMonitor_free(struct LDKChainMonitor this_obj);
12160
12161 /**
12162  * Creates a new `ChainMonitor` used to watch on-chain activity pertaining to channels.
12163  *
12164  * When an optional chain source implementing [`chain::Filter`] is provided, the chain monitor
12165  * will call back to it indicating transactions and outputs of interest. This allows clients to
12166  * pre-filter blocks or only fetch blocks matching a compact filter. Otherwise, clients may
12167  * always need to fetch full blocks absent another means for determining which blocks contain
12168  * transactions relevant to the watched channels.
12169  */
12170 MUST_USE_RES struct LDKChainMonitor ChainMonitor_new(struct LDKFilter *chain_source, struct LDKBroadcasterInterface broadcaster, struct LDKLogger logger, struct LDKFeeEstimator feeest, struct LDKPersist persister);
12171
12172 /**
12173  * Constructs a new Listen which calls the relevant methods on this_arg.
12174  * This copies the `inner` pointer in this_arg and thus the returned Listen must be freed before this_arg is
12175  */
12176 struct LDKListen ChainMonitor_as_Listen(const struct LDKChainMonitor *NONNULL_PTR this_arg);
12177
12178 /**
12179  * Constructs a new Confirm which calls the relevant methods on this_arg.
12180  * This copies the `inner` pointer in this_arg and thus the returned Confirm must be freed before this_arg is
12181  */
12182 struct LDKConfirm ChainMonitor_as_Confirm(const struct LDKChainMonitor *NONNULL_PTR this_arg);
12183
12184 /**
12185  * Constructs a new Watch which calls the relevant methods on this_arg.
12186  * This copies the `inner` pointer in this_arg and thus the returned Watch must be freed before this_arg is
12187  */
12188 struct LDKWatch ChainMonitor_as_Watch(const struct LDKChainMonitor *NONNULL_PTR this_arg);
12189
12190 /**
12191  * Constructs a new EventsProvider which calls the relevant methods on this_arg.
12192  * This copies the `inner` pointer in this_arg and thus the returned EventsProvider must be freed before this_arg is
12193  */
12194 struct LDKEventsProvider ChainMonitor_as_EventsProvider(const struct LDKChainMonitor *NONNULL_PTR this_arg);
12195
12196 /**
12197  * Frees any resources used by the ChannelMonitorUpdate, if is_owned is set and inner is non-NULL.
12198  */
12199 void ChannelMonitorUpdate_free(struct LDKChannelMonitorUpdate this_obj);
12200
12201 /**
12202  * The sequence number of this update. Updates *must* be replayed in-order according to this
12203  * sequence number (and updates may panic if they are not). The update_id values are strictly
12204  * increasing and increase by one for each new update, with one exception specified below.
12205  *
12206  * This sequence number is also used to track up to which points updates which returned
12207  * ChannelMonitorUpdateErr::TemporaryFailure have been applied to all copies of a given
12208  * ChannelMonitor when ChannelManager::channel_monitor_updated is called.
12209  *
12210  * The only instance where update_id values are not strictly increasing is the case where we
12211  * allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See
12212  * its docs for more details.
12213  */
12214 uint64_t ChannelMonitorUpdate_get_update_id(const struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr);
12215
12216 /**
12217  * The sequence number of this update. Updates *must* be replayed in-order according to this
12218  * sequence number (and updates may panic if they are not). The update_id values are strictly
12219  * increasing and increase by one for each new update, with one exception specified below.
12220  *
12221  * This sequence number is also used to track up to which points updates which returned
12222  * ChannelMonitorUpdateErr::TemporaryFailure have been applied to all copies of a given
12223  * ChannelMonitor when ChannelManager::channel_monitor_updated is called.
12224  *
12225  * The only instance where update_id values are not strictly increasing is the case where we
12226  * allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See
12227  * its docs for more details.
12228  */
12229 void ChannelMonitorUpdate_set_update_id(struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr, uint64_t val);
12230
12231 /**
12232  * Creates a copy of the ChannelMonitorUpdate
12233  */
12234 struct LDKChannelMonitorUpdate ChannelMonitorUpdate_clone(const struct LDKChannelMonitorUpdate *NONNULL_PTR orig);
12235
12236 /**
12237  * Serialize the ChannelMonitorUpdate object into a byte array which can be read by ChannelMonitorUpdate_read
12238  */
12239 struct LDKCVec_u8Z ChannelMonitorUpdate_write(const struct LDKChannelMonitorUpdate *NONNULL_PTR obj);
12240
12241 /**
12242  * Read a ChannelMonitorUpdate from a byte array, created by ChannelMonitorUpdate_write
12243  */
12244 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ ChannelMonitorUpdate_read(struct LDKu8slice ser);
12245
12246 /**
12247  * Creates a copy of the ChannelMonitorUpdateErr
12248  */
12249 enum LDKChannelMonitorUpdateErr ChannelMonitorUpdateErr_clone(const enum LDKChannelMonitorUpdateErr *NONNULL_PTR orig);
12250
12251 /**
12252  * Frees any resources used by the MonitorUpdateError, if is_owned is set and inner is non-NULL.
12253  */
12254 void MonitorUpdateError_free(struct LDKMonitorUpdateError this_obj);
12255
12256 /**
12257  * Creates a copy of the MonitorUpdateError
12258  */
12259 struct LDKMonitorUpdateError MonitorUpdateError_clone(const struct LDKMonitorUpdateError *NONNULL_PTR orig);
12260
12261 /**
12262  * Frees any resources used by the MonitorEvent
12263  */
12264 void MonitorEvent_free(struct LDKMonitorEvent this_ptr);
12265
12266 /**
12267  * Creates a copy of the MonitorEvent
12268  */
12269 struct LDKMonitorEvent MonitorEvent_clone(const struct LDKMonitorEvent *NONNULL_PTR orig);
12270
12271 /**
12272  * Frees any resources used by the HTLCUpdate, if is_owned is set and inner is non-NULL.
12273  */
12274 void HTLCUpdate_free(struct LDKHTLCUpdate this_obj);
12275
12276 /**
12277  * Creates a copy of the HTLCUpdate
12278  */
12279 struct LDKHTLCUpdate HTLCUpdate_clone(const struct LDKHTLCUpdate *NONNULL_PTR orig);
12280
12281 /**
12282  * Serialize the HTLCUpdate object into a byte array which can be read by HTLCUpdate_read
12283  */
12284 struct LDKCVec_u8Z HTLCUpdate_write(const struct LDKHTLCUpdate *NONNULL_PTR obj);
12285
12286 /**
12287  * Read a HTLCUpdate from a byte array, created by HTLCUpdate_write
12288  */
12289 struct LDKCResult_HTLCUpdateDecodeErrorZ HTLCUpdate_read(struct LDKu8slice ser);
12290
12291 /**
12292  * Frees any resources used by the ChannelMonitor, if is_owned is set and inner is non-NULL.
12293  */
12294 void ChannelMonitor_free(struct LDKChannelMonitor this_obj);
12295
12296 /**
12297  * Serialize the ChannelMonitor object into a byte array which can be read by ChannelMonitor_read
12298  */
12299 struct LDKCVec_u8Z ChannelMonitor_write(const struct LDKChannelMonitor *NONNULL_PTR obj);
12300
12301 /**
12302  * Updates a ChannelMonitor on the basis of some new information provided by the Channel
12303  * itself.
12304  *
12305  * panics if the given update is not the next update by update_id.
12306  */
12307 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);
12308
12309 /**
12310  * Gets the update_id from the latest ChannelMonitorUpdate which was applied to this
12311  * ChannelMonitor.
12312  */
12313 MUST_USE_RES uint64_t ChannelMonitor_get_latest_update_id(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
12314
12315 /**
12316  * Gets the funding transaction outpoint of the channel this ChannelMonitor is monitoring for.
12317  */
12318 MUST_USE_RES struct LDKC2Tuple_OutPointScriptZ ChannelMonitor_get_funding_txo(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
12319
12320 /**
12321  * Gets a list of txids, with their output scripts (in the order they appear in the
12322  * transaction), which we must learn about spends of via block_connected().
12323  */
12324 MUST_USE_RES struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ChannelMonitor_get_outputs_to_watch(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
12325
12326 /**
12327  * Loads the funding txo and outputs to watch into the given `chain::Filter` by repeatedly
12328  * calling `chain::Filter::register_output` and `chain::Filter::register_tx` until all outputs
12329  * have been registered.
12330  */
12331 void ChannelMonitor_load_outputs_to_watch(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKFilter *NONNULL_PTR filter);
12332
12333 /**
12334  * Get the list of HTLCs who's status has been updated on chain. This should be called by
12335  * ChannelManager via [`chain::Watch::release_pending_monitor_events`].
12336  */
12337 MUST_USE_RES struct LDKCVec_MonitorEventZ ChannelMonitor_get_and_clear_pending_monitor_events(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
12338
12339 /**
12340  * Gets the list of pending events which were generated by previous actions, clearing the list
12341  * in the process.
12342  *
12343  * This is called by ChainMonitor::get_and_clear_pending_events() and is equivalent to
12344  * EventsProvider::get_and_clear_pending_events() except that it requires &mut self as we do
12345  * no internal locking in ChannelMonitors.
12346  */
12347 MUST_USE_RES struct LDKCVec_EventZ ChannelMonitor_get_and_clear_pending_events(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
12348
12349 /**
12350  * Used by ChannelManager deserialization to broadcast the latest holder state if its copy of
12351  * the Channel was out-of-date. You may use it to get a broadcastable holder toxic tx in case of
12352  * fallen-behind, i.e when receiving a channel_reestablish with a proof that our counterparty side knows
12353  * a higher revocation secret than the holder commitment number we are aware of. Broadcasting these
12354  * transactions are UNSAFE, as they allow counterparty side to punish you. Nevertheless you may want to
12355  * broadcast them if counterparty don't close channel with his higher commitment transaction after a
12356  * substantial amount of time (a month or even a year) to get back funds. Best may be to contact
12357  * out-of-band the other node operator to coordinate with him if option is available to you.
12358  * In any-case, choice is up to the user.
12359  */
12360 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);
12361
12362 /**
12363  * Processes transactions in a newly connected block, which may result in any of the following:
12364  * - update the monitor's state against resolved HTLCs
12365  * - punish the counterparty in the case of seeing a revoked commitment transaction
12366  * - force close the channel and claim/timeout incoming/outgoing HTLCs if near expiration
12367  * - detect settled outputs for later spending
12368  * - schedule and bump any in-flight claims
12369  *
12370  * Returns any new outputs to watch from `txdata`; after called, these are also included in
12371  * [`get_outputs_to_watch`].
12372  *
12373  * [`get_outputs_to_watch`]: #method.get_outputs_to_watch
12374  */
12375 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);
12376
12377 /**
12378  * Determines if the disconnected block contained any transactions of interest and updates
12379  * appropriately.
12380  */
12381 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);
12382
12383 /**
12384  * Processes transactions confirmed in a block with the given header and height, returning new
12385  * outputs to watch. See [`block_connected`] for details.
12386  *
12387  * Used instead of [`block_connected`] by clients that are notified of transactions rather than
12388  * blocks. See [`chain::Confirm`] for calling expectations.
12389  *
12390  * [`block_connected`]: Self::block_connected
12391  */
12392 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);
12393
12394 /**
12395  * Processes a transaction that was reorganized out of the chain.
12396  *
12397  * Used instead of [`block_disconnected`] by clients that are notified of transactions rather
12398  * than blocks. See [`chain::Confirm`] for calling expectations.
12399  *
12400  * [`block_disconnected`]: Self::block_disconnected
12401  */
12402 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);
12403
12404 /**
12405  * Updates the monitor with the current best chain tip, returning new outputs to watch. See
12406  * [`block_connected`] for details.
12407  *
12408  * Used instead of [`block_connected`] by clients that are notified of transactions rather than
12409  * blocks. See [`chain::Confirm`] for calling expectations.
12410  *
12411  * [`block_connected`]: Self::block_connected
12412  */
12413 MUST_USE_RES struct LDKCVec_TransactionOutputsZ ChannelMonitor_best_block_updated(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);
12414
12415 /**
12416  * Returns the set of txids that should be monitored for re-organization out of the chain.
12417  */
12418 MUST_USE_RES struct LDKCVec_TxidZ ChannelMonitor_get_relevant_txids(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
12419
12420 /**
12421  * Calls the free function if one is set
12422  */
12423 void Persist_free(struct LDKPersist this_ptr);
12424
12425 /**
12426  * Read a C2Tuple_BlockHashChannelMonitorZ from a byte array, created by C2Tuple_BlockHashChannelMonitorZ_write
12427  */
12428 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ C2Tuple_BlockHashChannelMonitorZ_read(struct LDKu8slice ser, const struct LDKKeysInterface *NONNULL_PTR arg);
12429
12430 /**
12431  * Frees any resources used by the OutPoint, if is_owned is set and inner is non-NULL.
12432  */
12433 void OutPoint_free(struct LDKOutPoint this_obj);
12434
12435 /**
12436  * The referenced transaction's txid.
12437  */
12438 const uint8_t (*OutPoint_get_txid(const struct LDKOutPoint *NONNULL_PTR this_ptr))[32];
12439
12440 /**
12441  * The referenced transaction's txid.
12442  */
12443 void OutPoint_set_txid(struct LDKOutPoint *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12444
12445 /**
12446  * The index of the referenced output in its transaction's vout.
12447  */
12448 uint16_t OutPoint_get_index(const struct LDKOutPoint *NONNULL_PTR this_ptr);
12449
12450 /**
12451  * The index of the referenced output in its transaction's vout.
12452  */
12453 void OutPoint_set_index(struct LDKOutPoint *NONNULL_PTR this_ptr, uint16_t val);
12454
12455 /**
12456  * Constructs a new OutPoint given each field
12457  */
12458 MUST_USE_RES struct LDKOutPoint OutPoint_new(struct LDKThirtyTwoBytes txid_arg, uint16_t index_arg);
12459
12460 /**
12461  * Creates a copy of the OutPoint
12462  */
12463 struct LDKOutPoint OutPoint_clone(const struct LDKOutPoint *NONNULL_PTR orig);
12464
12465 /**
12466  * Checks if two OutPoints contain equal inner contents.
12467  * This ignores pointers and is_owned flags and looks at the values in fields.
12468  * Two objects with NULL inner values will be considered "equal" here.
12469  */
12470 bool OutPoint_eq(const struct LDKOutPoint *NONNULL_PTR a, const struct LDKOutPoint *NONNULL_PTR b);
12471
12472 /**
12473  * Checks if two OutPoints contain equal inner contents.
12474  */
12475 uint64_t OutPoint_hash(const struct LDKOutPoint *NONNULL_PTR o);
12476
12477 /**
12478  * Convert an `OutPoint` to a lightning channel id.
12479  */
12480 MUST_USE_RES struct LDKThirtyTwoBytes OutPoint_to_channel_id(const struct LDKOutPoint *NONNULL_PTR this_arg);
12481
12482 /**
12483  * Serialize the OutPoint object into a byte array which can be read by OutPoint_read
12484  */
12485 struct LDKCVec_u8Z OutPoint_write(const struct LDKOutPoint *NONNULL_PTR obj);
12486
12487 /**
12488  * Read a OutPoint from a byte array, created by OutPoint_write
12489  */
12490 struct LDKCResult_OutPointDecodeErrorZ OutPoint_read(struct LDKu8slice ser);
12491
12492 /**
12493  * Frees any resources used by the DelayedPaymentOutputDescriptor, if is_owned is set and inner is non-NULL.
12494  */
12495 void DelayedPaymentOutputDescriptor_free(struct LDKDelayedPaymentOutputDescriptor this_obj);
12496
12497 /**
12498  * The outpoint which is spendable
12499  */
12500 struct LDKOutPoint DelayedPaymentOutputDescriptor_get_outpoint(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
12501
12502 /**
12503  * The outpoint which is spendable
12504  */
12505 void DelayedPaymentOutputDescriptor_set_outpoint(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKOutPoint val);
12506
12507 /**
12508  * Per commitment point to derive delayed_payment_key by key holder
12509  */
12510 struct LDKPublicKey DelayedPaymentOutputDescriptor_get_per_commitment_point(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
12511
12512 /**
12513  * Per commitment point to derive delayed_payment_key by key holder
12514  */
12515 void DelayedPaymentOutputDescriptor_set_per_commitment_point(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val);
12516
12517 /**
12518  * The nSequence value which must be set in the spending input to satisfy the OP_CSV in
12519  * the witness_script.
12520  */
12521 uint16_t DelayedPaymentOutputDescriptor_get_to_self_delay(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
12522
12523 /**
12524  * The nSequence value which must be set in the spending input to satisfy the OP_CSV in
12525  * the witness_script.
12526  */
12527 void DelayedPaymentOutputDescriptor_set_to_self_delay(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint16_t val);
12528
12529 /**
12530  * The output which is referenced by the given outpoint
12531  */
12532 void DelayedPaymentOutputDescriptor_set_output(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKTxOut val);
12533
12534 /**
12535  * The revocation point specific to the commitment transaction which was broadcast. Used to
12536  * derive the witnessScript for this output.
12537  */
12538 struct LDKPublicKey DelayedPaymentOutputDescriptor_get_revocation_pubkey(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
12539
12540 /**
12541  * The revocation point specific to the commitment transaction which was broadcast. Used to
12542  * derive the witnessScript for this output.
12543  */
12544 void DelayedPaymentOutputDescriptor_set_revocation_pubkey(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val);
12545
12546 /**
12547  * Arbitrary identification information returned by a call to
12548  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
12549  * the channel to spend the output.
12550  */
12551 const uint8_t (*DelayedPaymentOutputDescriptor_get_channel_keys_id(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr))[32];
12552
12553 /**
12554  * Arbitrary identification information returned by a call to
12555  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
12556  * the channel to spend the output.
12557  */
12558 void DelayedPaymentOutputDescriptor_set_channel_keys_id(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12559
12560 /**
12561  * The value of the channel which this output originated from, possibly indirectly.
12562  */
12563 uint64_t DelayedPaymentOutputDescriptor_get_channel_value_satoshis(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
12564
12565 /**
12566  * The value of the channel which this output originated from, possibly indirectly.
12567  */
12568 void DelayedPaymentOutputDescriptor_set_channel_value_satoshis(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint64_t val);
12569
12570 /**
12571  * Constructs a new DelayedPaymentOutputDescriptor given each field
12572  */
12573 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);
12574
12575 /**
12576  * Creates a copy of the DelayedPaymentOutputDescriptor
12577  */
12578 struct LDKDelayedPaymentOutputDescriptor DelayedPaymentOutputDescriptor_clone(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR orig);
12579
12580 /**
12581  * Serialize the DelayedPaymentOutputDescriptor object into a byte array which can be read by DelayedPaymentOutputDescriptor_read
12582  */
12583 struct LDKCVec_u8Z DelayedPaymentOutputDescriptor_write(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR obj);
12584
12585 /**
12586  * Read a DelayedPaymentOutputDescriptor from a byte array, created by DelayedPaymentOutputDescriptor_write
12587  */
12588 struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ DelayedPaymentOutputDescriptor_read(struct LDKu8slice ser);
12589
12590 /**
12591  * Frees any resources used by the StaticPaymentOutputDescriptor, if is_owned is set and inner is non-NULL.
12592  */
12593 void StaticPaymentOutputDescriptor_free(struct LDKStaticPaymentOutputDescriptor this_obj);
12594
12595 /**
12596  * The outpoint which is spendable
12597  */
12598 struct LDKOutPoint StaticPaymentOutputDescriptor_get_outpoint(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr);
12599
12600 /**
12601  * The outpoint which is spendable
12602  */
12603 void StaticPaymentOutputDescriptor_set_outpoint(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKOutPoint val);
12604
12605 /**
12606  * The output which is referenced by the given outpoint
12607  */
12608 void StaticPaymentOutputDescriptor_set_output(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKTxOut val);
12609
12610 /**
12611  * Arbitrary identification information returned by a call to
12612  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
12613  * the channel to spend the output.
12614  */
12615 const uint8_t (*StaticPaymentOutputDescriptor_get_channel_keys_id(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr))[32];
12616
12617 /**
12618  * Arbitrary identification information returned by a call to
12619  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
12620  * the channel to spend the output.
12621  */
12622 void StaticPaymentOutputDescriptor_set_channel_keys_id(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12623
12624 /**
12625  * The value of the channel which this transactions spends.
12626  */
12627 uint64_t StaticPaymentOutputDescriptor_get_channel_value_satoshis(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr);
12628
12629 /**
12630  * The value of the channel which this transactions spends.
12631  */
12632 void StaticPaymentOutputDescriptor_set_channel_value_satoshis(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint64_t val);
12633
12634 /**
12635  * Constructs a new StaticPaymentOutputDescriptor given each field
12636  */
12637 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);
12638
12639 /**
12640  * Creates a copy of the StaticPaymentOutputDescriptor
12641  */
12642 struct LDKStaticPaymentOutputDescriptor StaticPaymentOutputDescriptor_clone(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR orig);
12643
12644 /**
12645  * Serialize the StaticPaymentOutputDescriptor object into a byte array which can be read by StaticPaymentOutputDescriptor_read
12646  */
12647 struct LDKCVec_u8Z StaticPaymentOutputDescriptor_write(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR obj);
12648
12649 /**
12650  * Read a StaticPaymentOutputDescriptor from a byte array, created by StaticPaymentOutputDescriptor_write
12651  */
12652 struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ StaticPaymentOutputDescriptor_read(struct LDKu8slice ser);
12653
12654 /**
12655  * Frees any resources used by the SpendableOutputDescriptor
12656  */
12657 void SpendableOutputDescriptor_free(struct LDKSpendableOutputDescriptor this_ptr);
12658
12659 /**
12660  * Creates a copy of the SpendableOutputDescriptor
12661  */
12662 struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_clone(const struct LDKSpendableOutputDescriptor *NONNULL_PTR orig);
12663
12664 /**
12665  * Serialize the SpendableOutputDescriptor object into a byte array which can be read by SpendableOutputDescriptor_read
12666  */
12667 struct LDKCVec_u8Z SpendableOutputDescriptor_write(const struct LDKSpendableOutputDescriptor *NONNULL_PTR obj);
12668
12669 /**
12670  * Read a SpendableOutputDescriptor from a byte array, created by SpendableOutputDescriptor_write
12671  */
12672 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ SpendableOutputDescriptor_read(struct LDKu8slice ser);
12673
12674 /**
12675  * Calls the free function if one is set
12676  */
12677 void BaseSign_free(struct LDKBaseSign this_ptr);
12678
12679 /**
12680  * Creates a copy of a Sign
12681  */
12682 struct LDKSign Sign_clone(const struct LDKSign *NONNULL_PTR orig);
12683
12684 /**
12685  * Calls the free function if one is set
12686  */
12687 void Sign_free(struct LDKSign this_ptr);
12688
12689 /**
12690  * Calls the free function if one is set
12691  */
12692 void KeysInterface_free(struct LDKKeysInterface this_ptr);
12693
12694 /**
12695  * Frees any resources used by the InMemorySigner, if is_owned is set and inner is non-NULL.
12696  */
12697 void InMemorySigner_free(struct LDKInMemorySigner this_obj);
12698
12699 /**
12700  * Private key of anchor tx
12701  */
12702 const uint8_t (*InMemorySigner_get_funding_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
12703
12704 /**
12705  * Private key of anchor tx
12706  */
12707 void InMemorySigner_set_funding_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
12708
12709 /**
12710  * Holder secret key for blinded revocation pubkey
12711  */
12712 const uint8_t (*InMemorySigner_get_revocation_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
12713
12714 /**
12715  * Holder secret key for blinded revocation pubkey
12716  */
12717 void InMemorySigner_set_revocation_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
12718
12719 /**
12720  * Holder secret key used for our balance in counterparty-broadcasted commitment transactions
12721  */
12722 const uint8_t (*InMemorySigner_get_payment_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
12723
12724 /**
12725  * Holder secret key used for our balance in counterparty-broadcasted commitment transactions
12726  */
12727 void InMemorySigner_set_payment_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
12728
12729 /**
12730  * Holder secret key used in HTLC tx
12731  */
12732 const uint8_t (*InMemorySigner_get_delayed_payment_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
12733
12734 /**
12735  * Holder secret key used in HTLC tx
12736  */
12737 void InMemorySigner_set_delayed_payment_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
12738
12739 /**
12740  * Holder htlc secret key used in commitment tx htlc outputs
12741  */
12742 const uint8_t (*InMemorySigner_get_htlc_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
12743
12744 /**
12745  * Holder htlc secret key used in commitment tx htlc outputs
12746  */
12747 void InMemorySigner_set_htlc_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
12748
12749 /**
12750  * Commitment seed
12751  */
12752 const uint8_t (*InMemorySigner_get_commitment_seed(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
12753
12754 /**
12755  * Commitment seed
12756  */
12757 void InMemorySigner_set_commitment_seed(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12758
12759 /**
12760  * Creates a copy of the InMemorySigner
12761  */
12762 struct LDKInMemorySigner InMemorySigner_clone(const struct LDKInMemorySigner *NONNULL_PTR orig);
12763
12764 /**
12765  * Create a new InMemorySigner
12766  */
12767 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);
12768
12769 /**
12770  * Counterparty pubkeys.
12771  * Will panic if ready_channel wasn't called.
12772  */
12773 MUST_USE_RES struct LDKChannelPublicKeys InMemorySigner_counterparty_pubkeys(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
12774
12775 /**
12776  * The contest_delay value specified by our counterparty and applied on holder-broadcastable
12777  * transactions, ie the amount of time that we have to wait to recover our funds if we
12778  * broadcast a transaction.
12779  * Will panic if ready_channel wasn't called.
12780  */
12781 MUST_USE_RES uint16_t InMemorySigner_counterparty_selected_contest_delay(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
12782
12783 /**
12784  * The contest_delay value specified by us and applied on transactions broadcastable
12785  * by our counterparty, ie the amount of time that they have to wait to recover their funds
12786  * if they broadcast a transaction.
12787  * Will panic if ready_channel wasn't called.
12788  */
12789 MUST_USE_RES uint16_t InMemorySigner_holder_selected_contest_delay(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
12790
12791 /**
12792  * Whether the holder is the initiator
12793  * Will panic if ready_channel wasn't called.
12794  */
12795 MUST_USE_RES bool InMemorySigner_is_outbound(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
12796
12797 /**
12798  * Funding outpoint
12799  * Will panic if ready_channel wasn't called.
12800  */
12801 MUST_USE_RES struct LDKOutPoint InMemorySigner_funding_outpoint(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
12802
12803 /**
12804  * Obtain a ChannelTransactionParameters for this channel, to be used when verifying or
12805  * building transactions.
12806  *
12807  * Will panic if ready_channel wasn't called.
12808  */
12809 MUST_USE_RES struct LDKChannelTransactionParameters InMemorySigner_get_channel_parameters(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
12810
12811 /**
12812  * Sign the single input of spend_tx at index `input_idx` which spends the output
12813  * described by descriptor, returning the witness stack for the input.
12814  *
12815  * Returns an Err if the input at input_idx does not exist, has a non-empty script_sig,
12816  * or is not spending the outpoint described by `descriptor.outpoint`.
12817  */
12818 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);
12819
12820 /**
12821  * Sign the single input of spend_tx at index `input_idx` which spends the output
12822  * described by descriptor, returning the witness stack for the input.
12823  *
12824  * Returns an Err if the input at input_idx does not exist, has a non-empty script_sig,
12825  * is not spending the outpoint described by `descriptor.outpoint`, or does not have a
12826  * sequence set to `descriptor.to_self_delay`.
12827  */
12828 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);
12829
12830 /**
12831  * Constructs a new BaseSign which calls the relevant methods on this_arg.
12832  * This copies the `inner` pointer in this_arg and thus the returned BaseSign must be freed before this_arg is
12833  */
12834 struct LDKBaseSign InMemorySigner_as_BaseSign(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
12835
12836 /**
12837  * Constructs a new Sign which calls the relevant methods on this_arg.
12838  * This copies the `inner` pointer in this_arg and thus the returned Sign must be freed before this_arg is
12839  */
12840 struct LDKSign InMemorySigner_as_Sign(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
12841
12842 /**
12843  * Serialize the InMemorySigner object into a byte array which can be read by InMemorySigner_read
12844  */
12845 struct LDKCVec_u8Z InMemorySigner_write(const struct LDKInMemorySigner *NONNULL_PTR obj);
12846
12847 /**
12848  * Read a InMemorySigner from a byte array, created by InMemorySigner_write
12849  */
12850 struct LDKCResult_InMemorySignerDecodeErrorZ InMemorySigner_read(struct LDKu8slice ser);
12851
12852 /**
12853  * Frees any resources used by the KeysManager, if is_owned is set and inner is non-NULL.
12854  */
12855 void KeysManager_free(struct LDKKeysManager this_obj);
12856
12857 /**
12858  * Constructs a KeysManager from a 32-byte seed. If the seed is in some way biased (eg your
12859  * CSRNG is busted) this may panic (but more importantly, you will possibly lose funds).
12860  * starting_time isn't strictly required to actually be a time, but it must absolutely,
12861  * without a doubt, be unique to this instance. ie if you start multiple times with the same
12862  * seed, starting_time must be unique to each run. Thus, the easiest way to achieve this is to
12863  * simply use the current time (with very high precision).
12864  *
12865  * The seed MUST be backed up safely prior to use so that the keys can be re-created, however,
12866  * obviously, starting_time should be unique every time you reload the library - it is only
12867  * used to generate new ephemeral key data (which will be stored by the individual channel if
12868  * necessary).
12869  *
12870  * Note that the seed is required to recover certain on-chain funds independent of
12871  * ChannelMonitor data, though a current copy of ChannelMonitor data is also required for any
12872  * channel, and some on-chain during-closing funds.
12873  *
12874  * Note that until the 0.1 release there is no guarantee of backward compatibility between
12875  * versions. Once the library is more fully supported, the docs will be updated to include a
12876  * detailed description of the guarantee.
12877  */
12878 MUST_USE_RES struct LDKKeysManager KeysManager_new(const uint8_t (*seed)[32], uint64_t starting_time_secs, uint32_t starting_time_nanos);
12879
12880 /**
12881  * Derive an old Sign containing per-channel secrets based on a key derivation parameters.
12882  *
12883  * Key derivation parameters are accessible through a per-channel secrets
12884  * Sign::channel_keys_id and is provided inside DynamicOuputP2WSH in case of
12885  * onchain output detection for which a corresponding delayed_payment_key must be derived.
12886  */
12887 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]);
12888
12889 /**
12890  * Creates a Transaction which spends the given descriptors to the given outputs, plus an
12891  * output to the given change destination (if sufficient change value remains). The
12892  * transaction will have a feerate, at least, of the given value.
12893  *
12894  * Returns `Err(())` if the output value is greater than the input value minus required fee or
12895  * if a descriptor was duplicated.
12896  *
12897  * We do not enforce that outputs meet the dust limit or that any output scripts are standard.
12898  *
12899  * May panic if the `SpendableOutputDescriptor`s were not generated by Channels which used
12900  * this KeysManager or one of the `InMemorySigner` created by this KeysManager.
12901  */
12902 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);
12903
12904 /**
12905  * Constructs a new KeysInterface which calls the relevant methods on this_arg.
12906  * This copies the `inner` pointer in this_arg and thus the returned KeysInterface must be freed before this_arg is
12907  */
12908 struct LDKKeysInterface KeysManager_as_KeysInterface(const struct LDKKeysManager *NONNULL_PTR this_arg);
12909
12910 /**
12911  * Frees any resources used by the ChannelManager, if is_owned is set and inner is non-NULL.
12912  */
12913 void ChannelManager_free(struct LDKChannelManager this_obj);
12914
12915 /**
12916  * Frees any resources used by the ChainParameters, if is_owned is set and inner is non-NULL.
12917  */
12918 void ChainParameters_free(struct LDKChainParameters this_obj);
12919
12920 /**
12921  * The network for determining the `chain_hash` in Lightning messages.
12922  */
12923 enum LDKNetwork ChainParameters_get_network(const struct LDKChainParameters *NONNULL_PTR this_ptr);
12924
12925 /**
12926  * The network for determining the `chain_hash` in Lightning messages.
12927  */
12928 void ChainParameters_set_network(struct LDKChainParameters *NONNULL_PTR this_ptr, enum LDKNetwork val);
12929
12930 /**
12931  * The hash and height of the latest block successfully connected.
12932  *
12933  * Used to track on-chain channel funding outputs and send payments with reliable timelocks.
12934  */
12935 struct LDKBestBlock ChainParameters_get_best_block(const struct LDKChainParameters *NONNULL_PTR this_ptr);
12936
12937 /**
12938  * The hash and height of the latest block successfully connected.
12939  *
12940  * Used to track on-chain channel funding outputs and send payments with reliable timelocks.
12941  */
12942 void ChainParameters_set_best_block(struct LDKChainParameters *NONNULL_PTR this_ptr, struct LDKBestBlock val);
12943
12944 /**
12945  * Constructs a new ChainParameters given each field
12946  */
12947 MUST_USE_RES struct LDKChainParameters ChainParameters_new(enum LDKNetwork network_arg, struct LDKBestBlock best_block_arg);
12948
12949 /**
12950  * Frees any resources used by the BestBlock, if is_owned is set and inner is non-NULL.
12951  */
12952 void BestBlock_free(struct LDKBestBlock this_obj);
12953
12954 /**
12955  * Creates a copy of the BestBlock
12956  */
12957 struct LDKBestBlock BestBlock_clone(const struct LDKBestBlock *NONNULL_PTR orig);
12958
12959 /**
12960  * Returns the best block from the genesis of the given network.
12961  */
12962 MUST_USE_RES struct LDKBestBlock BestBlock_from_genesis(enum LDKNetwork network);
12963
12964 /**
12965  * Returns the best block as identified by the given block hash and height.
12966  */
12967 MUST_USE_RES struct LDKBestBlock BestBlock_new(struct LDKThirtyTwoBytes block_hash, uint32_t height);
12968
12969 /**
12970  * Returns the best block hash.
12971  */
12972 MUST_USE_RES struct LDKThirtyTwoBytes BestBlock_block_hash(const struct LDKBestBlock *NONNULL_PTR this_arg);
12973
12974 /**
12975  * Returns the best block height.
12976  */
12977 MUST_USE_RES uint32_t BestBlock_height(const struct LDKBestBlock *NONNULL_PTR this_arg);
12978
12979 /**
12980  * Frees any resources used by the ChannelDetails, if is_owned is set and inner is non-NULL.
12981  */
12982 void ChannelDetails_free(struct LDKChannelDetails this_obj);
12983
12984 /**
12985  * The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
12986  * thereafter this is the txid of the funding transaction xor the funding transaction output).
12987  * Note that this means this value is *not* persistent - it can change once during the
12988  * lifetime of the channel.
12989  */
12990 const uint8_t (*ChannelDetails_get_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr))[32];
12991
12992 /**
12993  * The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
12994  * thereafter this is the txid of the funding transaction xor the funding transaction output).
12995  * Note that this means this value is *not* persistent - it can change once during the
12996  * lifetime of the channel.
12997  */
12998 void ChannelDetails_set_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12999
13000 /**
13001  * The Channel's funding transaction output, if we've negotiated the funding transaction with
13002  * our counterparty already.
13003  *
13004  * Note that, if this has been set, `channel_id` will be equivalent to
13005  * `funding_txo.unwrap().to_channel_id()`.
13006  */
13007 struct LDKOutPoint ChannelDetails_get_funding_txo(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
13008
13009 /**
13010  * The Channel's funding transaction output, if we've negotiated the funding transaction with
13011  * our counterparty already.
13012  *
13013  * Note that, if this has been set, `channel_id` will be equivalent to
13014  * `funding_txo.unwrap().to_channel_id()`.
13015  */
13016 void ChannelDetails_set_funding_txo(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKOutPoint val);
13017
13018 /**
13019  * The position of the funding transaction in the chain. None if the funding transaction has
13020  * not yet been confirmed and the channel fully opened.
13021  */
13022 struct LDKCOption_u64Z ChannelDetails_get_short_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
13023
13024 /**
13025  * The position of the funding transaction in the chain. None if the funding transaction has
13026  * not yet been confirmed and the channel fully opened.
13027  */
13028 void ChannelDetails_set_short_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
13029
13030 /**
13031  * The node_id of our counterparty
13032  */
13033 struct LDKPublicKey ChannelDetails_get_remote_network_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
13034
13035 /**
13036  * The node_id of our counterparty
13037  */
13038 void ChannelDetails_set_remote_network_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKPublicKey val);
13039
13040 /**
13041  * The Features the channel counterparty provided upon last connection.
13042  * Useful for routing as it is the most up-to-date copy of the counterparty's features and
13043  * many routing-relevant features are present in the init context.
13044  */
13045 struct LDKInitFeatures ChannelDetails_get_counterparty_features(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
13046
13047 /**
13048  * The Features the channel counterparty provided upon last connection.
13049  * Useful for routing as it is the most up-to-date copy of the counterparty's features and
13050  * many routing-relevant features are present in the init context.
13051  */
13052 void ChannelDetails_set_counterparty_features(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKInitFeatures val);
13053
13054 /**
13055  * The value, in satoshis, of this channel as appears in the funding output
13056  */
13057 uint64_t ChannelDetails_get_channel_value_satoshis(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
13058
13059 /**
13060  * The value, in satoshis, of this channel as appears in the funding output
13061  */
13062 void ChannelDetails_set_channel_value_satoshis(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
13063
13064 /**
13065  * The user_id passed in to create_channel, or 0 if the channel was inbound.
13066  */
13067 uint64_t ChannelDetails_get_user_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
13068
13069 /**
13070  * The user_id passed in to create_channel, or 0 if the channel was inbound.
13071  */
13072 void ChannelDetails_set_user_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
13073
13074 /**
13075  * The available outbound capacity for sending HTLCs to the remote peer. This does not include
13076  * any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
13077  * available for inclusion in new outbound HTLCs). This further does not include any pending
13078  * outgoing HTLCs which are awaiting some other resolution to be sent.
13079  */
13080 uint64_t ChannelDetails_get_outbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
13081
13082 /**
13083  * The available outbound capacity for sending HTLCs to the remote peer. This does not include
13084  * any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
13085  * available for inclusion in new outbound HTLCs). This further does not include any pending
13086  * outgoing HTLCs which are awaiting some other resolution to be sent.
13087  */
13088 void ChannelDetails_set_outbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
13089
13090 /**
13091  * The available inbound capacity for the remote peer to send HTLCs to us. This does not
13092  * include any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
13093  * available for inclusion in new inbound HTLCs).
13094  * Note that there are some corner cases not fully handled here, so the actual available
13095  * inbound capacity may be slightly higher than this.
13096  */
13097 uint64_t ChannelDetails_get_inbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
13098
13099 /**
13100  * The available inbound capacity for the remote peer to send HTLCs to us. This does not
13101  * include any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
13102  * available for inclusion in new inbound HTLCs).
13103  * Note that there are some corner cases not fully handled here, so the actual available
13104  * inbound capacity may be slightly higher than this.
13105  */
13106 void ChannelDetails_set_inbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
13107
13108 /**
13109  * True if the channel was initiated (and thus funded) by us.
13110  */
13111 bool ChannelDetails_get_is_outbound(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
13112
13113 /**
13114  * True if the channel was initiated (and thus funded) by us.
13115  */
13116 void ChannelDetails_set_is_outbound(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
13117
13118 /**
13119  * True if the channel is confirmed, funding_locked messages have been exchanged, and the
13120  * channel is not currently being shut down. `funding_locked` message exchange implies the
13121  * required confirmation count has been reached (and we were connected to the peer at some
13122  * point after the funding transaction received enough confirmations).
13123  */
13124 bool ChannelDetails_get_is_funding_locked(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
13125
13126 /**
13127  * True if the channel is confirmed, funding_locked messages have been exchanged, and the
13128  * channel is not currently being shut down. `funding_locked` message exchange implies the
13129  * required confirmation count has been reached (and we were connected to the peer at some
13130  * point after the funding transaction received enough confirmations).
13131  */
13132 void ChannelDetails_set_is_funding_locked(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
13133
13134 /**
13135  * True if the channel is (a) confirmed and funding_locked messages have been exchanged, (b)
13136  * the peer is connected, (c) no monitor update failure is pending resolution, and (d) the
13137  * channel is not currently negotiating a shutdown.
13138  *
13139  * This is a strict superset of `is_funding_locked`.
13140  */
13141 bool ChannelDetails_get_is_usable(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
13142
13143 /**
13144  * True if the channel is (a) confirmed and funding_locked messages have been exchanged, (b)
13145  * the peer is connected, (c) no monitor update failure is pending resolution, and (d) the
13146  * channel is not currently negotiating a shutdown.
13147  *
13148  * This is a strict superset of `is_funding_locked`.
13149  */
13150 void ChannelDetails_set_is_usable(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
13151
13152 /**
13153  * True if this channel is (or will be) publicly-announced.
13154  */
13155 bool ChannelDetails_get_is_public(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
13156
13157 /**
13158  * True if this channel is (or will be) publicly-announced.
13159  */
13160 void ChannelDetails_set_is_public(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
13161
13162 /**
13163  * Creates a copy of the ChannelDetails
13164  */
13165 struct LDKChannelDetails ChannelDetails_clone(const struct LDKChannelDetails *NONNULL_PTR orig);
13166
13167 /**
13168  * Frees any resources used by the PaymentSendFailure
13169  */
13170 void PaymentSendFailure_free(struct LDKPaymentSendFailure this_ptr);
13171
13172 /**
13173  * Creates a copy of the PaymentSendFailure
13174  */
13175 struct LDKPaymentSendFailure PaymentSendFailure_clone(const struct LDKPaymentSendFailure *NONNULL_PTR orig);
13176
13177 /**
13178  * Constructs a new ChannelManager to hold several channels and route between them.
13179  *
13180  * This is the main \"logic hub\" for all channel-related actions, and implements
13181  * ChannelMessageHandler.
13182  *
13183  * Non-proportional fees are fixed according to our risk using the provided fee estimator.
13184  *
13185  * panics if channel_value_satoshis is >= `MAX_FUNDING_SATOSHIS`!
13186  *
13187  * Users need to notify the new ChannelManager when a new block is connected or
13188  * disconnected using its `block_connected` and `block_disconnected` methods, starting
13189  * from after `params.latest_hash`.
13190  */
13191 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);
13192
13193 /**
13194  * Gets the current configuration applied to all new channels,  as
13195  */
13196 MUST_USE_RES struct LDKUserConfig ChannelManager_get_current_default_configuration(const struct LDKChannelManager *NONNULL_PTR this_arg);
13197
13198 /**
13199  * Creates a new outbound channel to the given remote node and with the given value.
13200  *
13201  * user_id will be provided back as user_channel_id in FundingGenerationReady events to allow
13202  * tracking of which events correspond with which create_channel call. Note that the
13203  * user_channel_id defaults to 0 for inbound channels, so you may wish to avoid using 0 for
13204  * user_id here. user_id has no meaning inside of LDK, it is simply copied to events and
13205  * otherwise ignored.
13206  *
13207  * If successful, will generate a SendOpenChannel message event, so you should probably poll
13208  * PeerManager::process_events afterwards.
13209  *
13210  * Raises APIError::APIMisuseError when channel_value_satoshis > 2**24 or push_msat is
13211  * greater than channel_value_satoshis * 1k or channel_value_satoshis is < 1000.
13212  */
13213 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);
13214
13215 /**
13216  * Gets the list of open channels, in random order. See ChannelDetail field documentation for
13217  * more information.
13218  */
13219 MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
13220
13221 /**
13222  * Gets the list of usable channels, in random order. Useful as an argument to
13223  * get_route to ensure non-announced channels are used.
13224  *
13225  * These are guaranteed to have their [`ChannelDetails::is_usable`] value set to true, see the
13226  * documentation for [`ChannelDetails::is_usable`] for more info on exactly what the criteria
13227  * are.
13228  */
13229 MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_usable_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
13230
13231 /**
13232  * Begins the process of closing a channel. After this call (plus some timeout), no new HTLCs
13233  * will be accepted on the given channel, and after additional timeout/the closing of all
13234  * pending HTLCs, the channel will be closed on chain.
13235  *
13236  * May generate a SendShutdown message event on success, which should be relayed.
13237  */
13238 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_close_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32]);
13239
13240 /**
13241  * Force closes a channel, immediately broadcasting the latest local commitment transaction to
13242  * the chain and rejecting new HTLCs on the given channel. Fails if channel_id is unknown to the manager.
13243  */
13244 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_force_close_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32]);
13245
13246 /**
13247  * Force close all channels, immediately broadcasting the latest local commitment transaction
13248  * for each to the chain and rejecting new HTLCs on each.
13249  */
13250 void ChannelManager_force_close_all_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
13251
13252 /**
13253  * Sends a payment along a given route.
13254  *
13255  * Value parameters are provided via the last hop in route, see documentation for RouteHop
13256  * fields for more info.
13257  *
13258  * Note that if the payment_hash already exists elsewhere (eg you're sending a duplicative
13259  * payment), we don't do anything to stop you! We always try to ensure that if the provided
13260  * next hop knows the preimage to payment_hash they can claim an additional amount as
13261  * specified in the last hop in the route! Thus, you should probably do your own
13262  * payment_preimage tracking (which you should already be doing as they represent \"proof of
13263  * payment\") and prevent double-sends yourself.
13264  *
13265  * May generate SendHTLCs message(s) event on success, which should be relayed.
13266  *
13267  * Each path may have a different return value, and PaymentSendValue may return a Vec with
13268  * each entry matching the corresponding-index entry in the route paths, see
13269  * PaymentSendFailure for more info.
13270  *
13271  * In general, a path may raise:
13272  *  * APIError::RouteError when an invalid route or forwarding parameter (cltv_delta, fee,
13273  *    node public key) is specified.
13274  *  * APIError::ChannelUnavailable if the next-hop channel is not available for updates
13275  *    (including due to previous monitor update failure or new permanent monitor update
13276  *    failure).
13277  *  * APIError::MonitorUpdateFailed if a new monitor update failure prevented sending the
13278  *    relevant updates.
13279  *
13280  * Note that depending on the type of the PaymentSendFailure the HTLC may have been
13281  * irrevocably committed to on our end. In such a case, do NOT retry the payment with a
13282  * different route unless you intend to pay twice!
13283  *
13284  * payment_secret is unrelated to payment_hash (or PaymentPreimage) and exists to authenticate
13285  * the sender to the recipient and prevent payment-probing (deanonymization) attacks. For
13286  * newer nodes, it will be provided to you in the invoice. If you do not have one, the Route
13287  * must not contain multiple paths as multi-path payments require a recipient-provided
13288  * payment_secret.
13289  * If a payment_secret *is* provided, we assume that the invoice had the payment_secret feature
13290  * bit set (either as required or as available). If multiple paths are present in the Route,
13291  * we assume the invoice had the basic_mpp feature set.
13292  */
13293 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);
13294
13295 /**
13296  * Call this upon creation of a funding transaction for the given channel.
13297  *
13298  * Returns an [`APIError::APIMisuseError`] if the funding_transaction spent non-SegWit outputs
13299  * or if no output was found which matches the parameters in [`Event::FundingGenerationReady`].
13300  *
13301  * Panics if a funding transaction has already been provided for this channel.
13302  *
13303  * May panic if the output found in the funding transaction is duplicative with some other
13304  * channel (note that this should be trivially prevented by using unique funding transaction
13305  * keys per-channel).
13306  *
13307  * Do NOT broadcast the funding transaction yourself. When we have safely received our
13308  * counterparty's signature the funding transaction will automatically be broadcast via the
13309  * [`BroadcasterInterface`] provided when this `ChannelManager` was constructed.
13310  *
13311  * Note that this includes RBF or similar transaction replacement strategies - lightning does
13312  * not currently support replacing a funding transaction on an existing channel. Instead,
13313  * create a new channel with a conflicting funding transaction.
13314  *
13315  * [`Event::FundingGenerationReady`]: crate::util::events::Event::FundingGenerationReady
13316  */
13317 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);
13318
13319 /**
13320  * Regenerates channel_announcements and generates a signed node_announcement from the given
13321  * arguments, providing them in corresponding events via
13322  * [`get_and_clear_pending_msg_events`], if at least one public channel has been confirmed
13323  * on-chain. This effectively re-broadcasts all channel announcements and sends our node
13324  * announcement to ensure that the lightning P2P network is aware of the channels we have and
13325  * our network addresses.
13326  *
13327  * `rgb` is a node \"color\" and `alias` is a printable human-readable string to describe this
13328  * node to humans. They carry no in-protocol meaning.
13329  *
13330  * `addresses` represent the set (possibly empty) of socket addresses on which this node
13331  * accepts incoming connections. These will be included in the node_announcement, publicly
13332  * tying these addresses together and to this node. If you wish to preserve user privacy,
13333  * addresses should likely contain only Tor Onion addresses.
13334  *
13335  * Panics if `addresses` is absurdly large (more than 500).
13336  *
13337  * [`get_and_clear_pending_msg_events`]: MessageSendEventsProvider::get_and_clear_pending_msg_events
13338  */
13339 void ChannelManager_broadcast_node_announcement(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThreeBytes rgb, struct LDKThirtyTwoBytes alias, struct LDKCVec_NetAddressZ addresses);
13340
13341 /**
13342  * Processes HTLCs which are pending waiting on random forward delay.
13343  *
13344  * Should only really ever be called in response to a PendingHTLCsForwardable event.
13345  * Will likely generate further events.
13346  */
13347 void ChannelManager_process_pending_htlc_forwards(const struct LDKChannelManager *NONNULL_PTR this_arg);
13348
13349 /**
13350  * If a peer is disconnected we mark any channels with that peer as 'disabled'.
13351  * After some time, if channels are still disabled we need to broadcast a ChannelUpdate
13352  * to inform the network about the uselessness of these channels.
13353  *
13354  * This method handles all the details, and must be called roughly once per minute.
13355  *
13356  * Note that in some rare cases this may generate a `chain::Watch::update_channel` call.
13357  */
13358 void ChannelManager_timer_tick_occurred(const struct LDKChannelManager *NONNULL_PTR this_arg);
13359
13360 /**
13361  * Indicates that the preimage for payment_hash is unknown or the received amount is incorrect
13362  * after a PaymentReceived event, failing the HTLC back to its origin and freeing resources
13363  * along the path (including in our own channel on which we received it).
13364  * Returns false if no payment was found to fail backwards, true if the process of failing the
13365  * HTLC backwards has been started.
13366  */
13367 MUST_USE_RES bool ChannelManager_fail_htlc_backwards(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*payment_hash)[32]);
13368
13369 /**
13370  * Provides a payment preimage in response to a PaymentReceived event, returning true and
13371  * generating message events for the net layer to claim the payment, if possible. Thus, you
13372  * should probably kick the net layer to go send messages if this returns true!
13373  *
13374  * Note that if you did not set an `amount_msat` when calling [`create_inbound_payment`] or
13375  * [`create_inbound_payment_for_hash`] you must check that the amount in the `PaymentReceived`
13376  * event matches your expectation. If you fail to do so and call this method, you may provide
13377  * the sender \"proof-of-payment\" when they did not fulfill the full expected payment.
13378  *
13379  * May panic if called except in response to a PaymentReceived event.
13380  *
13381  * [`create_inbound_payment`]: Self::create_inbound_payment
13382  * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash
13383  */
13384 MUST_USE_RES bool ChannelManager_claim_funds(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_preimage);
13385
13386 /**
13387  * Gets the node_id held by this ChannelManager
13388  */
13389 MUST_USE_RES struct LDKPublicKey ChannelManager_get_our_node_id(const struct LDKChannelManager *NONNULL_PTR this_arg);
13390
13391 /**
13392  * Restores a single, given channel to normal operation after a
13393  * ChannelMonitorUpdateErr::TemporaryFailure was returned from a channel monitor update
13394  * operation.
13395  *
13396  * All ChannelMonitor updates up to and including highest_applied_update_id must have been
13397  * fully committed in every copy of the given channels' ChannelMonitors.
13398  *
13399  * Note that there is no effect to calling with a highest_applied_update_id other than the
13400  * current latest ChannelMonitorUpdate and one call to this function after multiple
13401  * ChannelMonitorUpdateErr::TemporaryFailures is fine. The highest_applied_update_id field
13402  * exists largely only to prevent races between this and concurrent update_monitor calls.
13403  *
13404  * Thus, the anticipated use is, at a high level:
13405  *  1) You register a chain::Watch with this ChannelManager,
13406  *  2) it stores each update to disk, and begins updating any remote (eg watchtower) copies of
13407  *     said ChannelMonitors as it can, returning ChannelMonitorUpdateErr::TemporaryFailures
13408  *     any time it cannot do so instantly,
13409  *  3) update(s) are applied to each remote copy of a ChannelMonitor,
13410  *  4) once all remote copies are updated, you call this function with the update_id that
13411  *     completed, and once it is the latest the Channel will be re-enabled.
13412  */
13413 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);
13414
13415 /**
13416  * Gets a payment secret and payment hash for use in an invoice given to a third party wishing
13417  * to pay us.
13418  *
13419  * This differs from [`create_inbound_payment_for_hash`] only in that it generates the
13420  * [`PaymentHash`] and [`PaymentPreimage`] for you, returning the first and storing the second.
13421  *
13422  * The [`PaymentPreimage`] will ultimately be returned to you in the [`PaymentReceived`], which
13423  * will have the [`PaymentReceived::payment_preimage`] field filled in. That should then be
13424  * passed directly to [`claim_funds`].
13425  *
13426  * See [`create_inbound_payment_for_hash`] for detailed documentation on behavior and requirements.
13427  *
13428  * [`claim_funds`]: Self::claim_funds
13429  * [`PaymentReceived`]: events::Event::PaymentReceived
13430  * [`PaymentReceived::payment_preimage`]: events::Event::PaymentReceived::payment_preimage
13431  * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash
13432  */
13433 MUST_USE_RES struct LDKC2Tuple_PaymentHashPaymentSecretZ ChannelManager_create_inbound_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKCOption_u64Z min_value_msat, uint32_t invoice_expiry_delta_secs, uint64_t user_payment_id);
13434
13435 /**
13436  * Gets a [`PaymentSecret`] for a given [`PaymentHash`], for which the payment preimage is
13437  * stored external to LDK.
13438  *
13439  * A [`PaymentReceived`] event will only be generated if the [`PaymentSecret`] matches a
13440  * payment secret fetched via this method or [`create_inbound_payment`], and which is at least
13441  * the `min_value_msat` provided here, if one is provided.
13442  *
13443  * The [`PaymentHash`] (and corresponding [`PaymentPreimage`]) must be globally unique. This
13444  * method may return an Err if another payment with the same payment_hash is still pending.
13445  *
13446  * `user_payment_id` will be provided back in [`PaymentReceived::user_payment_id`] events to
13447  * allow tracking of which events correspond with which calls to this and
13448  * [`create_inbound_payment`]. `user_payment_id` has no meaning inside of LDK, it is simply
13449  * copied to events and otherwise ignored. It may be used to correlate PaymentReceived events
13450  * with invoice metadata stored elsewhere.
13451  *
13452  * `min_value_msat` should be set if the invoice being generated contains a value. Any payment
13453  * received for the returned [`PaymentHash`] will be required to be at least `min_value_msat`
13454  * before a [`PaymentReceived`] event will be generated, ensuring that we do not provide the
13455  * sender \"proof-of-payment\" unless they have paid the required amount.
13456  *
13457  * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
13458  * in excess of the current time. This should roughly match the expiry time set in the invoice.
13459  * After this many seconds, we will remove the inbound payment, resulting in any attempts to
13460  * pay the invoice failing. The BOLT spec suggests 3,600 secs as a default validity time for
13461  * invoices when no timeout is set.
13462  *
13463  * Note that we use block header time to time-out pending inbound payments (with some margin
13464  * to compensate for the inaccuracy of block header timestamps). Thus, in practice we will
13465  * accept a payment and generate a [`PaymentReceived`] event for some time after the expiry.
13466  * If you need exact expiry semantics, you should enforce them upon receipt of
13467  * [`PaymentReceived`].
13468  *
13469  * Pending inbound payments are stored in memory and in serialized versions of this
13470  * [`ChannelManager`]. If potentially unbounded numbers of inbound payments may exist and
13471  * space is limited, you may wish to rate-limit inbound payment creation.
13472  *
13473  * May panic if `invoice_expiry_delta_secs` is greater than one year.
13474  *
13475  * Note that invoices generated for inbound payments should have their `min_final_cltv_expiry`
13476  * set to at least [`MIN_FINAL_CLTV_EXPIRY`].
13477  *
13478  * [`create_inbound_payment`]: Self::create_inbound_payment
13479  * [`PaymentReceived`]: events::Event::PaymentReceived
13480  * [`PaymentReceived::user_payment_id`]: events::Event::PaymentReceived::user_payment_id
13481  */
13482 MUST_USE_RES struct LDKCResult_PaymentSecretAPIErrorZ ChannelManager_create_inbound_payment_for_hash(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_hash, struct LDKCOption_u64Z min_value_msat, uint32_t invoice_expiry_delta_secs, uint64_t user_payment_id);
13483
13484 /**
13485  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
13486  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
13487  */
13488 struct LDKMessageSendEventsProvider ChannelManager_as_MessageSendEventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg);
13489
13490 /**
13491  * Constructs a new EventsProvider which calls the relevant methods on this_arg.
13492  * This copies the `inner` pointer in this_arg and thus the returned EventsProvider must be freed before this_arg is
13493  */
13494 struct LDKEventsProvider ChannelManager_as_EventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg);
13495
13496 /**
13497  * Constructs a new Listen which calls the relevant methods on this_arg.
13498  * This copies the `inner` pointer in this_arg and thus the returned Listen must be freed before this_arg is
13499  */
13500 struct LDKListen ChannelManager_as_Listen(const struct LDKChannelManager *NONNULL_PTR this_arg);
13501
13502 /**
13503  * Constructs a new Confirm which calls the relevant methods on this_arg.
13504  * This copies the `inner` pointer in this_arg and thus the returned Confirm must be freed before this_arg is
13505  */
13506 struct LDKConfirm ChannelManager_as_Confirm(const struct LDKChannelManager *NONNULL_PTR this_arg);
13507
13508 /**
13509  * Blocks until ChannelManager needs to be persisted or a timeout is reached. It returns a bool
13510  * indicating whether persistence is necessary. Only one listener on
13511  * `await_persistable_update` or `await_persistable_update_timeout` is guaranteed to be woken
13512  * up.
13513  * Note that the feature `allow_wallclock_use` must be enabled to use this function.
13514  */
13515 MUST_USE_RES bool ChannelManager_await_persistable_update_timeout(const struct LDKChannelManager *NONNULL_PTR this_arg, uint64_t max_wait);
13516
13517 /**
13518  * Blocks until ChannelManager needs to be persisted. Only one listener on
13519  * `await_persistable_update` or `await_persistable_update_timeout` is guaranteed to be woken
13520  * up.
13521  */
13522 void ChannelManager_await_persistable_update(const struct LDKChannelManager *NONNULL_PTR this_arg);
13523
13524 /**
13525  * Constructs a new ChannelMessageHandler which calls the relevant methods on this_arg.
13526  * This copies the `inner` pointer in this_arg and thus the returned ChannelMessageHandler must be freed before this_arg is
13527  */
13528 struct LDKChannelMessageHandler ChannelManager_as_ChannelMessageHandler(const struct LDKChannelManager *NONNULL_PTR this_arg);
13529
13530 /**
13531  * Serialize the ChannelManager object into a byte array which can be read by ChannelManager_read
13532  */
13533 struct LDKCVec_u8Z ChannelManager_write(const struct LDKChannelManager *NONNULL_PTR obj);
13534
13535 /**
13536  * Frees any resources used by the ChannelManagerReadArgs, if is_owned is set and inner is non-NULL.
13537  */
13538 void ChannelManagerReadArgs_free(struct LDKChannelManagerReadArgs this_obj);
13539
13540 /**
13541  * The keys provider which will give us relevant keys. Some keys will be loaded during
13542  * deserialization and KeysInterface::read_chan_signer will be used to read per-Channel
13543  * signing data.
13544  */
13545 const struct LDKKeysInterface *ChannelManagerReadArgs_get_keys_manager(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
13546
13547 /**
13548  * The keys provider which will give us relevant keys. Some keys will be loaded during
13549  * deserialization and KeysInterface::read_chan_signer will be used to read per-Channel
13550  * signing data.
13551  */
13552 void ChannelManagerReadArgs_set_keys_manager(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKKeysInterface val);
13553
13554 /**
13555  * The fee_estimator for use in the ChannelManager in the future.
13556  *
13557  * No calls to the FeeEstimator will be made during deserialization.
13558  */
13559 const struct LDKFeeEstimator *ChannelManagerReadArgs_get_fee_estimator(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
13560
13561 /**
13562  * The fee_estimator for use in the ChannelManager in the future.
13563  *
13564  * No calls to the FeeEstimator will be made during deserialization.
13565  */
13566 void ChannelManagerReadArgs_set_fee_estimator(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKFeeEstimator val);
13567
13568 /**
13569  * The chain::Watch for use in the ChannelManager in the future.
13570  *
13571  * No calls to the chain::Watch will be made during deserialization. It is assumed that
13572  * you have deserialized ChannelMonitors separately and will add them to your
13573  * chain::Watch after deserializing this ChannelManager.
13574  */
13575 const struct LDKWatch *ChannelManagerReadArgs_get_chain_monitor(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
13576
13577 /**
13578  * The chain::Watch for use in the ChannelManager in the future.
13579  *
13580  * No calls to the chain::Watch will be made during deserialization. It is assumed that
13581  * you have deserialized ChannelMonitors separately and will add them to your
13582  * chain::Watch after deserializing this ChannelManager.
13583  */
13584 void ChannelManagerReadArgs_set_chain_monitor(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKWatch val);
13585
13586 /**
13587  * The BroadcasterInterface which will be used in the ChannelManager in the future and may be
13588  * used to broadcast the latest local commitment transactions of channels which must be
13589  * force-closed during deserialization.
13590  */
13591 const struct LDKBroadcasterInterface *ChannelManagerReadArgs_get_tx_broadcaster(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
13592
13593 /**
13594  * The BroadcasterInterface which will be used in the ChannelManager in the future and may be
13595  * used to broadcast the latest local commitment transactions of channels which must be
13596  * force-closed during deserialization.
13597  */
13598 void ChannelManagerReadArgs_set_tx_broadcaster(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKBroadcasterInterface val);
13599
13600 /**
13601  * The Logger for use in the ChannelManager and which may be used to log information during
13602  * deserialization.
13603  */
13604 const struct LDKLogger *ChannelManagerReadArgs_get_logger(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
13605
13606 /**
13607  * The Logger for use in the ChannelManager and which may be used to log information during
13608  * deserialization.
13609  */
13610 void ChannelManagerReadArgs_set_logger(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKLogger val);
13611
13612 /**
13613  * Default settings used for new channels. Any existing channels will continue to use the
13614  * runtime settings which were stored when the ChannelManager was serialized.
13615  */
13616 struct LDKUserConfig ChannelManagerReadArgs_get_default_config(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
13617
13618 /**
13619  * Default settings used for new channels. Any existing channels will continue to use the
13620  * runtime settings which were stored when the ChannelManager was serialized.
13621  */
13622 void ChannelManagerReadArgs_set_default_config(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKUserConfig val);
13623
13624 /**
13625  * Simple utility function to create a ChannelManagerReadArgs which creates the monitor
13626  * HashMap for you. This is primarily useful for C bindings where it is not practical to
13627  * populate a HashMap directly from C.
13628  */
13629 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);
13630
13631 /**
13632  * Read a C2Tuple_BlockHashChannelManagerZ from a byte array, created by C2Tuple_BlockHashChannelManagerZ_write
13633  */
13634 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ C2Tuple_BlockHashChannelManagerZ_read(struct LDKu8slice ser, struct LDKChannelManagerReadArgs arg);
13635
13636 /**
13637  * Frees any resources used by the DecodeError, if is_owned is set and inner is non-NULL.
13638  */
13639 void DecodeError_free(struct LDKDecodeError this_obj);
13640
13641 /**
13642  * Creates a copy of the DecodeError
13643  */
13644 struct LDKDecodeError DecodeError_clone(const struct LDKDecodeError *NONNULL_PTR orig);
13645
13646 /**
13647  * Frees any resources used by the Init, if is_owned is set and inner is non-NULL.
13648  */
13649 void Init_free(struct LDKInit this_obj);
13650
13651 /**
13652  * The relevant features which the sender supports
13653  */
13654 struct LDKInitFeatures Init_get_features(const struct LDKInit *NONNULL_PTR this_ptr);
13655
13656 /**
13657  * The relevant features which the sender supports
13658  */
13659 void Init_set_features(struct LDKInit *NONNULL_PTR this_ptr, struct LDKInitFeatures val);
13660
13661 /**
13662  * Constructs a new Init given each field
13663  */
13664 MUST_USE_RES struct LDKInit Init_new(struct LDKInitFeatures features_arg);
13665
13666 /**
13667  * Creates a copy of the Init
13668  */
13669 struct LDKInit Init_clone(const struct LDKInit *NONNULL_PTR orig);
13670
13671 /**
13672  * Frees any resources used by the ErrorMessage, if is_owned is set and inner is non-NULL.
13673  */
13674 void ErrorMessage_free(struct LDKErrorMessage this_obj);
13675
13676 /**
13677  * The channel ID involved in the error
13678  */
13679 const uint8_t (*ErrorMessage_get_channel_id(const struct LDKErrorMessage *NONNULL_PTR this_ptr))[32];
13680
13681 /**
13682  * The channel ID involved in the error
13683  */
13684 void ErrorMessage_set_channel_id(struct LDKErrorMessage *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13685
13686 /**
13687  * A possibly human-readable error description.
13688  * The string should be sanitized before it is used (e.g. emitted to logs
13689  * or printed to stdout).  Otherwise, a well crafted error message may trigger a security
13690  * vulnerability in the terminal emulator or the logging subsystem.
13691  */
13692 struct LDKStr ErrorMessage_get_data(const struct LDKErrorMessage *NONNULL_PTR this_ptr);
13693
13694 /**
13695  * A possibly human-readable error description.
13696  * The string should be sanitized before it is used (e.g. emitted to logs
13697  * or printed to stdout).  Otherwise, a well crafted error message may trigger a security
13698  * vulnerability in the terminal emulator or the logging subsystem.
13699  */
13700 void ErrorMessage_set_data(struct LDKErrorMessage *NONNULL_PTR this_ptr, struct LDKStr val);
13701
13702 /**
13703  * Constructs a new ErrorMessage given each field
13704  */
13705 MUST_USE_RES struct LDKErrorMessage ErrorMessage_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKStr data_arg);
13706
13707 /**
13708  * Creates a copy of the ErrorMessage
13709  */
13710 struct LDKErrorMessage ErrorMessage_clone(const struct LDKErrorMessage *NONNULL_PTR orig);
13711
13712 /**
13713  * Frees any resources used by the Ping, if is_owned is set and inner is non-NULL.
13714  */
13715 void Ping_free(struct LDKPing this_obj);
13716
13717 /**
13718  * The desired response length
13719  */
13720 uint16_t Ping_get_ponglen(const struct LDKPing *NONNULL_PTR this_ptr);
13721
13722 /**
13723  * The desired response length
13724  */
13725 void Ping_set_ponglen(struct LDKPing *NONNULL_PTR this_ptr, uint16_t val);
13726
13727 /**
13728  * The ping packet size.
13729  * This field is not sent on the wire. byteslen zeros are sent.
13730  */
13731 uint16_t Ping_get_byteslen(const struct LDKPing *NONNULL_PTR this_ptr);
13732
13733 /**
13734  * The ping packet size.
13735  * This field is not sent on the wire. byteslen zeros are sent.
13736  */
13737 void Ping_set_byteslen(struct LDKPing *NONNULL_PTR this_ptr, uint16_t val);
13738
13739 /**
13740  * Constructs a new Ping given each field
13741  */
13742 MUST_USE_RES struct LDKPing Ping_new(uint16_t ponglen_arg, uint16_t byteslen_arg);
13743
13744 /**
13745  * Creates a copy of the Ping
13746  */
13747 struct LDKPing Ping_clone(const struct LDKPing *NONNULL_PTR orig);
13748
13749 /**
13750  * Frees any resources used by the Pong, if is_owned is set and inner is non-NULL.
13751  */
13752 void Pong_free(struct LDKPong this_obj);
13753
13754 /**
13755  * The pong packet size.
13756  * This field is not sent on the wire. byteslen zeros are sent.
13757  */
13758 uint16_t Pong_get_byteslen(const struct LDKPong *NONNULL_PTR this_ptr);
13759
13760 /**
13761  * The pong packet size.
13762  * This field is not sent on the wire. byteslen zeros are sent.
13763  */
13764 void Pong_set_byteslen(struct LDKPong *NONNULL_PTR this_ptr, uint16_t val);
13765
13766 /**
13767  * Constructs a new Pong given each field
13768  */
13769 MUST_USE_RES struct LDKPong Pong_new(uint16_t byteslen_arg);
13770
13771 /**
13772  * Creates a copy of the Pong
13773  */
13774 struct LDKPong Pong_clone(const struct LDKPong *NONNULL_PTR orig);
13775
13776 /**
13777  * Frees any resources used by the OpenChannel, if is_owned is set and inner is non-NULL.
13778  */
13779 void OpenChannel_free(struct LDKOpenChannel this_obj);
13780
13781 /**
13782  * The genesis hash of the blockchain where the channel is to be opened
13783  */
13784 const uint8_t (*OpenChannel_get_chain_hash(const struct LDKOpenChannel *NONNULL_PTR this_ptr))[32];
13785
13786 /**
13787  * The genesis hash of the blockchain where the channel is to be opened
13788  */
13789 void OpenChannel_set_chain_hash(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13790
13791 /**
13792  * A temporary channel ID, until the funding outpoint is announced
13793  */
13794 const uint8_t (*OpenChannel_get_temporary_channel_id(const struct LDKOpenChannel *NONNULL_PTR this_ptr))[32];
13795
13796 /**
13797  * A temporary channel ID, until the funding outpoint is announced
13798  */
13799 void OpenChannel_set_temporary_channel_id(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13800
13801 /**
13802  * The channel value
13803  */
13804 uint64_t OpenChannel_get_funding_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13805
13806 /**
13807  * The channel value
13808  */
13809 void OpenChannel_set_funding_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
13810
13811 /**
13812  * The amount to push to the counterparty as part of the open, in milli-satoshi
13813  */
13814 uint64_t OpenChannel_get_push_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13815
13816 /**
13817  * The amount to push to the counterparty as part of the open, in milli-satoshi
13818  */
13819 void OpenChannel_set_push_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
13820
13821 /**
13822  * The threshold below which outputs on transactions broadcast by sender will be omitted
13823  */
13824 uint64_t OpenChannel_get_dust_limit_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13825
13826 /**
13827  * The threshold below which outputs on transactions broadcast by sender will be omitted
13828  */
13829 void OpenChannel_set_dust_limit_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
13830
13831 /**
13832  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
13833  */
13834 uint64_t OpenChannel_get_max_htlc_value_in_flight_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13835
13836 /**
13837  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
13838  */
13839 void OpenChannel_set_max_htlc_value_in_flight_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
13840
13841 /**
13842  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
13843  */
13844 uint64_t OpenChannel_get_channel_reserve_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13845
13846 /**
13847  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
13848  */
13849 void OpenChannel_set_channel_reserve_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
13850
13851 /**
13852  * The minimum HTLC size incoming to sender, in milli-satoshi
13853  */
13854 uint64_t OpenChannel_get_htlc_minimum_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13855
13856 /**
13857  * The minimum HTLC size incoming to sender, in milli-satoshi
13858  */
13859 void OpenChannel_set_htlc_minimum_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
13860
13861 /**
13862  * The feerate per 1000-weight of sender generated transactions, until updated by update_fee
13863  */
13864 uint32_t OpenChannel_get_feerate_per_kw(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13865
13866 /**
13867  * The feerate per 1000-weight of sender generated transactions, until updated by update_fee
13868  */
13869 void OpenChannel_set_feerate_per_kw(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint32_t val);
13870
13871 /**
13872  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
13873  */
13874 uint16_t OpenChannel_get_to_self_delay(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13875
13876 /**
13877  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
13878  */
13879 void OpenChannel_set_to_self_delay(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint16_t val);
13880
13881 /**
13882  * The maximum number of inbound HTLCs towards sender
13883  */
13884 uint16_t OpenChannel_get_max_accepted_htlcs(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13885
13886 /**
13887  * The maximum number of inbound HTLCs towards sender
13888  */
13889 void OpenChannel_set_max_accepted_htlcs(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint16_t val);
13890
13891 /**
13892  * The sender's key controlling the funding transaction
13893  */
13894 struct LDKPublicKey OpenChannel_get_funding_pubkey(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13895
13896 /**
13897  * The sender's key controlling the funding transaction
13898  */
13899 void OpenChannel_set_funding_pubkey(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
13900
13901 /**
13902  * Used to derive a revocation key for transactions broadcast by counterparty
13903  */
13904 struct LDKPublicKey OpenChannel_get_revocation_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13905
13906 /**
13907  * Used to derive a revocation key for transactions broadcast by counterparty
13908  */
13909 void OpenChannel_set_revocation_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
13910
13911 /**
13912  * A payment key to sender for transactions broadcast by counterparty
13913  */
13914 struct LDKPublicKey OpenChannel_get_payment_point(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13915
13916 /**
13917  * A payment key to sender for transactions broadcast by counterparty
13918  */
13919 void OpenChannel_set_payment_point(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
13920
13921 /**
13922  * Used to derive a payment key to sender for transactions broadcast by sender
13923  */
13924 struct LDKPublicKey OpenChannel_get_delayed_payment_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13925
13926 /**
13927  * Used to derive a payment key to sender for transactions broadcast by sender
13928  */
13929 void OpenChannel_set_delayed_payment_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
13930
13931 /**
13932  * Used to derive an HTLC payment key to sender
13933  */
13934 struct LDKPublicKey OpenChannel_get_htlc_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13935
13936 /**
13937  * Used to derive an HTLC payment key to sender
13938  */
13939 void OpenChannel_set_htlc_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
13940
13941 /**
13942  * The first to-be-broadcast-by-sender transaction's per commitment point
13943  */
13944 struct LDKPublicKey OpenChannel_get_first_per_commitment_point(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13945
13946 /**
13947  * The first to-be-broadcast-by-sender transaction's per commitment point
13948  */
13949 void OpenChannel_set_first_per_commitment_point(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
13950
13951 /**
13952  * Channel flags
13953  */
13954 uint8_t OpenChannel_get_channel_flags(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
13955
13956 /**
13957  * Channel flags
13958  */
13959 void OpenChannel_set_channel_flags(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint8_t val);
13960
13961 /**
13962  * Creates a copy of the OpenChannel
13963  */
13964 struct LDKOpenChannel OpenChannel_clone(const struct LDKOpenChannel *NONNULL_PTR orig);
13965
13966 /**
13967  * Frees any resources used by the AcceptChannel, if is_owned is set and inner is non-NULL.
13968  */
13969 void AcceptChannel_free(struct LDKAcceptChannel this_obj);
13970
13971 /**
13972  * A temporary channel ID, until the funding outpoint is announced
13973  */
13974 const uint8_t (*AcceptChannel_get_temporary_channel_id(const struct LDKAcceptChannel *NONNULL_PTR this_ptr))[32];
13975
13976 /**
13977  * A temporary channel ID, until the funding outpoint is announced
13978  */
13979 void AcceptChannel_set_temporary_channel_id(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13980
13981 /**
13982  * The threshold below which outputs on transactions broadcast by sender will be omitted
13983  */
13984 uint64_t AcceptChannel_get_dust_limit_satoshis(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
13985
13986 /**
13987  * The threshold below which outputs on transactions broadcast by sender will be omitted
13988  */
13989 void AcceptChannel_set_dust_limit_satoshis(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
13990
13991 /**
13992  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
13993  */
13994 uint64_t AcceptChannel_get_max_htlc_value_in_flight_msat(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
13995
13996 /**
13997  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
13998  */
13999 void AcceptChannel_set_max_htlc_value_in_flight_msat(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
14000
14001 /**
14002  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
14003  */
14004 uint64_t AcceptChannel_get_channel_reserve_satoshis(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
14005
14006 /**
14007  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
14008  */
14009 void AcceptChannel_set_channel_reserve_satoshis(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
14010
14011 /**
14012  * The minimum HTLC size incoming to sender, in milli-satoshi
14013  */
14014 uint64_t AcceptChannel_get_htlc_minimum_msat(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
14015
14016 /**
14017  * The minimum HTLC size incoming to sender, in milli-satoshi
14018  */
14019 void AcceptChannel_set_htlc_minimum_msat(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
14020
14021 /**
14022  * Minimum depth of the funding transaction before the channel is considered open
14023  */
14024 uint32_t AcceptChannel_get_minimum_depth(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
14025
14026 /**
14027  * Minimum depth of the funding transaction before the channel is considered open
14028  */
14029 void AcceptChannel_set_minimum_depth(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint32_t val);
14030
14031 /**
14032  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
14033  */
14034 uint16_t AcceptChannel_get_to_self_delay(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
14035
14036 /**
14037  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
14038  */
14039 void AcceptChannel_set_to_self_delay(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint16_t val);
14040
14041 /**
14042  * The maximum number of inbound HTLCs towards sender
14043  */
14044 uint16_t AcceptChannel_get_max_accepted_htlcs(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
14045
14046 /**
14047  * The maximum number of inbound HTLCs towards sender
14048  */
14049 void AcceptChannel_set_max_accepted_htlcs(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint16_t val);
14050
14051 /**
14052  * The sender's key controlling the funding transaction
14053  */
14054 struct LDKPublicKey AcceptChannel_get_funding_pubkey(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
14055
14056 /**
14057  * The sender's key controlling the funding transaction
14058  */
14059 void AcceptChannel_set_funding_pubkey(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14060
14061 /**
14062  * Used to derive a revocation key for transactions broadcast by counterparty
14063  */
14064 struct LDKPublicKey AcceptChannel_get_revocation_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
14065
14066 /**
14067  * Used to derive a revocation key for transactions broadcast by counterparty
14068  */
14069 void AcceptChannel_set_revocation_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14070
14071 /**
14072  * A payment key to sender for transactions broadcast by counterparty
14073  */
14074 struct LDKPublicKey AcceptChannel_get_payment_point(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
14075
14076 /**
14077  * A payment key to sender for transactions broadcast by counterparty
14078  */
14079 void AcceptChannel_set_payment_point(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14080
14081 /**
14082  * Used to derive a payment key to sender for transactions broadcast by sender
14083  */
14084 struct LDKPublicKey AcceptChannel_get_delayed_payment_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
14085
14086 /**
14087  * Used to derive a payment key to sender for transactions broadcast by sender
14088  */
14089 void AcceptChannel_set_delayed_payment_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14090
14091 /**
14092  * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
14093  */
14094 struct LDKPublicKey AcceptChannel_get_htlc_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
14095
14096 /**
14097  * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
14098  */
14099 void AcceptChannel_set_htlc_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14100
14101 /**
14102  * The first to-be-broadcast-by-sender transaction's per commitment point
14103  */
14104 struct LDKPublicKey AcceptChannel_get_first_per_commitment_point(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
14105
14106 /**
14107  * The first to-be-broadcast-by-sender transaction's per commitment point
14108  */
14109 void AcceptChannel_set_first_per_commitment_point(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14110
14111 /**
14112  * Creates a copy of the AcceptChannel
14113  */
14114 struct LDKAcceptChannel AcceptChannel_clone(const struct LDKAcceptChannel *NONNULL_PTR orig);
14115
14116 /**
14117  * Frees any resources used by the FundingCreated, if is_owned is set and inner is non-NULL.
14118  */
14119 void FundingCreated_free(struct LDKFundingCreated this_obj);
14120
14121 /**
14122  * A temporary channel ID, until the funding is established
14123  */
14124 const uint8_t (*FundingCreated_get_temporary_channel_id(const struct LDKFundingCreated *NONNULL_PTR this_ptr))[32];
14125
14126 /**
14127  * A temporary channel ID, until the funding is established
14128  */
14129 void FundingCreated_set_temporary_channel_id(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14130
14131 /**
14132  * The funding transaction ID
14133  */
14134 const uint8_t (*FundingCreated_get_funding_txid(const struct LDKFundingCreated *NONNULL_PTR this_ptr))[32];
14135
14136 /**
14137  * The funding transaction ID
14138  */
14139 void FundingCreated_set_funding_txid(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14140
14141 /**
14142  * The specific output index funding this channel
14143  */
14144 uint16_t FundingCreated_get_funding_output_index(const struct LDKFundingCreated *NONNULL_PTR this_ptr);
14145
14146 /**
14147  * The specific output index funding this channel
14148  */
14149 void FundingCreated_set_funding_output_index(struct LDKFundingCreated *NONNULL_PTR this_ptr, uint16_t val);
14150
14151 /**
14152  * The signature of the channel initiator (funder) on the funding transaction
14153  */
14154 struct LDKSignature FundingCreated_get_signature(const struct LDKFundingCreated *NONNULL_PTR this_ptr);
14155
14156 /**
14157  * The signature of the channel initiator (funder) on the funding transaction
14158  */
14159 void FundingCreated_set_signature(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKSignature val);
14160
14161 /**
14162  * Constructs a new FundingCreated given each field
14163  */
14164 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);
14165
14166 /**
14167  * Creates a copy of the FundingCreated
14168  */
14169 struct LDKFundingCreated FundingCreated_clone(const struct LDKFundingCreated *NONNULL_PTR orig);
14170
14171 /**
14172  * Frees any resources used by the FundingSigned, if is_owned is set and inner is non-NULL.
14173  */
14174 void FundingSigned_free(struct LDKFundingSigned this_obj);
14175
14176 /**
14177  * The channel ID
14178  */
14179 const uint8_t (*FundingSigned_get_channel_id(const struct LDKFundingSigned *NONNULL_PTR this_ptr))[32];
14180
14181 /**
14182  * The channel ID
14183  */
14184 void FundingSigned_set_channel_id(struct LDKFundingSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14185
14186 /**
14187  * The signature of the channel acceptor (fundee) on the funding transaction
14188  */
14189 struct LDKSignature FundingSigned_get_signature(const struct LDKFundingSigned *NONNULL_PTR this_ptr);
14190
14191 /**
14192  * The signature of the channel acceptor (fundee) on the funding transaction
14193  */
14194 void FundingSigned_set_signature(struct LDKFundingSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
14195
14196 /**
14197  * Constructs a new FundingSigned given each field
14198  */
14199 MUST_USE_RES struct LDKFundingSigned FundingSigned_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKSignature signature_arg);
14200
14201 /**
14202  * Creates a copy of the FundingSigned
14203  */
14204 struct LDKFundingSigned FundingSigned_clone(const struct LDKFundingSigned *NONNULL_PTR orig);
14205
14206 /**
14207  * Frees any resources used by the FundingLocked, if is_owned is set and inner is non-NULL.
14208  */
14209 void FundingLocked_free(struct LDKFundingLocked this_obj);
14210
14211 /**
14212  * The channel ID
14213  */
14214 const uint8_t (*FundingLocked_get_channel_id(const struct LDKFundingLocked *NONNULL_PTR this_ptr))[32];
14215
14216 /**
14217  * The channel ID
14218  */
14219 void FundingLocked_set_channel_id(struct LDKFundingLocked *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14220
14221 /**
14222  * The per-commitment point of the second commitment transaction
14223  */
14224 struct LDKPublicKey FundingLocked_get_next_per_commitment_point(const struct LDKFundingLocked *NONNULL_PTR this_ptr);
14225
14226 /**
14227  * The per-commitment point of the second commitment transaction
14228  */
14229 void FundingLocked_set_next_per_commitment_point(struct LDKFundingLocked *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14230
14231 /**
14232  * Constructs a new FundingLocked given each field
14233  */
14234 MUST_USE_RES struct LDKFundingLocked FundingLocked_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKPublicKey next_per_commitment_point_arg);
14235
14236 /**
14237  * Creates a copy of the FundingLocked
14238  */
14239 struct LDKFundingLocked FundingLocked_clone(const struct LDKFundingLocked *NONNULL_PTR orig);
14240
14241 /**
14242  * Frees any resources used by the Shutdown, if is_owned is set and inner is non-NULL.
14243  */
14244 void Shutdown_free(struct LDKShutdown this_obj);
14245
14246 /**
14247  * The channel ID
14248  */
14249 const uint8_t (*Shutdown_get_channel_id(const struct LDKShutdown *NONNULL_PTR this_ptr))[32];
14250
14251 /**
14252  * The channel ID
14253  */
14254 void Shutdown_set_channel_id(struct LDKShutdown *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14255
14256 /**
14257  * The destination of this peer's funds on closing.
14258  * Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh.
14259  */
14260 struct LDKu8slice Shutdown_get_scriptpubkey(const struct LDKShutdown *NONNULL_PTR this_ptr);
14261
14262 /**
14263  * The destination of this peer's funds on closing.
14264  * Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh.
14265  */
14266 void Shutdown_set_scriptpubkey(struct LDKShutdown *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
14267
14268 /**
14269  * Constructs a new Shutdown given each field
14270  */
14271 MUST_USE_RES struct LDKShutdown Shutdown_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKCVec_u8Z scriptpubkey_arg);
14272
14273 /**
14274  * Creates a copy of the Shutdown
14275  */
14276 struct LDKShutdown Shutdown_clone(const struct LDKShutdown *NONNULL_PTR orig);
14277
14278 /**
14279  * Frees any resources used by the ClosingSigned, if is_owned is set and inner is non-NULL.
14280  */
14281 void ClosingSigned_free(struct LDKClosingSigned this_obj);
14282
14283 /**
14284  * The channel ID
14285  */
14286 const uint8_t (*ClosingSigned_get_channel_id(const struct LDKClosingSigned *NONNULL_PTR this_ptr))[32];
14287
14288 /**
14289  * The channel ID
14290  */
14291 void ClosingSigned_set_channel_id(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14292
14293 /**
14294  * The proposed total fee for the closing transaction
14295  */
14296 uint64_t ClosingSigned_get_fee_satoshis(const struct LDKClosingSigned *NONNULL_PTR this_ptr);
14297
14298 /**
14299  * The proposed total fee for the closing transaction
14300  */
14301 void ClosingSigned_set_fee_satoshis(struct LDKClosingSigned *NONNULL_PTR this_ptr, uint64_t val);
14302
14303 /**
14304  * A signature on the closing transaction
14305  */
14306 struct LDKSignature ClosingSigned_get_signature(const struct LDKClosingSigned *NONNULL_PTR this_ptr);
14307
14308 /**
14309  * A signature on the closing transaction
14310  */
14311 void ClosingSigned_set_signature(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
14312
14313 /**
14314  * Constructs a new ClosingSigned given each field
14315  */
14316 MUST_USE_RES struct LDKClosingSigned ClosingSigned_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t fee_satoshis_arg, struct LDKSignature signature_arg);
14317
14318 /**
14319  * Creates a copy of the ClosingSigned
14320  */
14321 struct LDKClosingSigned ClosingSigned_clone(const struct LDKClosingSigned *NONNULL_PTR orig);
14322
14323 /**
14324  * Frees any resources used by the UpdateAddHTLC, if is_owned is set and inner is non-NULL.
14325  */
14326 void UpdateAddHTLC_free(struct LDKUpdateAddHTLC this_obj);
14327
14328 /**
14329  * The channel ID
14330  */
14331 const uint8_t (*UpdateAddHTLC_get_channel_id(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr))[32];
14332
14333 /**
14334  * The channel ID
14335  */
14336 void UpdateAddHTLC_set_channel_id(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14337
14338 /**
14339  * The HTLC ID
14340  */
14341 uint64_t UpdateAddHTLC_get_htlc_id(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
14342
14343 /**
14344  * The HTLC ID
14345  */
14346 void UpdateAddHTLC_set_htlc_id(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint64_t val);
14347
14348 /**
14349  * The HTLC value in milli-satoshi
14350  */
14351 uint64_t UpdateAddHTLC_get_amount_msat(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
14352
14353 /**
14354  * The HTLC value in milli-satoshi
14355  */
14356 void UpdateAddHTLC_set_amount_msat(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint64_t val);
14357
14358 /**
14359  * The payment hash, the pre-image of which controls HTLC redemption
14360  */
14361 const uint8_t (*UpdateAddHTLC_get_payment_hash(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr))[32];
14362
14363 /**
14364  * The payment hash, the pre-image of which controls HTLC redemption
14365  */
14366 void UpdateAddHTLC_set_payment_hash(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14367
14368 /**
14369  * The expiry height of the HTLC
14370  */
14371 uint32_t UpdateAddHTLC_get_cltv_expiry(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
14372
14373 /**
14374  * The expiry height of the HTLC
14375  */
14376 void UpdateAddHTLC_set_cltv_expiry(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint32_t val);
14377
14378 /**
14379  * Creates a copy of the UpdateAddHTLC
14380  */
14381 struct LDKUpdateAddHTLC UpdateAddHTLC_clone(const struct LDKUpdateAddHTLC *NONNULL_PTR orig);
14382
14383 /**
14384  * Frees any resources used by the UpdateFulfillHTLC, if is_owned is set and inner is non-NULL.
14385  */
14386 void UpdateFulfillHTLC_free(struct LDKUpdateFulfillHTLC this_obj);
14387
14388 /**
14389  * The channel ID
14390  */
14391 const uint8_t (*UpdateFulfillHTLC_get_channel_id(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr))[32];
14392
14393 /**
14394  * The channel ID
14395  */
14396 void UpdateFulfillHTLC_set_channel_id(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14397
14398 /**
14399  * The HTLC ID
14400  */
14401 uint64_t UpdateFulfillHTLC_get_htlc_id(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr);
14402
14403 /**
14404  * The HTLC ID
14405  */
14406 void UpdateFulfillHTLC_set_htlc_id(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, uint64_t val);
14407
14408 /**
14409  * The pre-image of the payment hash, allowing HTLC redemption
14410  */
14411 const uint8_t (*UpdateFulfillHTLC_get_payment_preimage(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr))[32];
14412
14413 /**
14414  * The pre-image of the payment hash, allowing HTLC redemption
14415  */
14416 void UpdateFulfillHTLC_set_payment_preimage(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14417
14418 /**
14419  * Constructs a new UpdateFulfillHTLC given each field
14420  */
14421 MUST_USE_RES struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t htlc_id_arg, struct LDKThirtyTwoBytes payment_preimage_arg);
14422
14423 /**
14424  * Creates a copy of the UpdateFulfillHTLC
14425  */
14426 struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_clone(const struct LDKUpdateFulfillHTLC *NONNULL_PTR orig);
14427
14428 /**
14429  * Frees any resources used by the UpdateFailHTLC, if is_owned is set and inner is non-NULL.
14430  */
14431 void UpdateFailHTLC_free(struct LDKUpdateFailHTLC this_obj);
14432
14433 /**
14434  * The channel ID
14435  */
14436 const uint8_t (*UpdateFailHTLC_get_channel_id(const struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr))[32];
14437
14438 /**
14439  * The channel ID
14440  */
14441 void UpdateFailHTLC_set_channel_id(struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14442
14443 /**
14444  * The HTLC ID
14445  */
14446 uint64_t UpdateFailHTLC_get_htlc_id(const struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr);
14447
14448 /**
14449  * The HTLC ID
14450  */
14451 void UpdateFailHTLC_set_htlc_id(struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr, uint64_t val);
14452
14453 /**
14454  * Creates a copy of the UpdateFailHTLC
14455  */
14456 struct LDKUpdateFailHTLC UpdateFailHTLC_clone(const struct LDKUpdateFailHTLC *NONNULL_PTR orig);
14457
14458 /**
14459  * Frees any resources used by the UpdateFailMalformedHTLC, if is_owned is set and inner is non-NULL.
14460  */
14461 void UpdateFailMalformedHTLC_free(struct LDKUpdateFailMalformedHTLC this_obj);
14462
14463 /**
14464  * The channel ID
14465  */
14466 const uint8_t (*UpdateFailMalformedHTLC_get_channel_id(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr))[32];
14467
14468 /**
14469  * The channel ID
14470  */
14471 void UpdateFailMalformedHTLC_set_channel_id(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14472
14473 /**
14474  * The HTLC ID
14475  */
14476 uint64_t UpdateFailMalformedHTLC_get_htlc_id(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr);
14477
14478 /**
14479  * The HTLC ID
14480  */
14481 void UpdateFailMalformedHTLC_set_htlc_id(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, uint64_t val);
14482
14483 /**
14484  * The failure code
14485  */
14486 uint16_t UpdateFailMalformedHTLC_get_failure_code(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr);
14487
14488 /**
14489  * The failure code
14490  */
14491 void UpdateFailMalformedHTLC_set_failure_code(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, uint16_t val);
14492
14493 /**
14494  * Creates a copy of the UpdateFailMalformedHTLC
14495  */
14496 struct LDKUpdateFailMalformedHTLC UpdateFailMalformedHTLC_clone(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR orig);
14497
14498 /**
14499  * Frees any resources used by the CommitmentSigned, if is_owned is set and inner is non-NULL.
14500  */
14501 void CommitmentSigned_free(struct LDKCommitmentSigned this_obj);
14502
14503 /**
14504  * The channel ID
14505  */
14506 const uint8_t (*CommitmentSigned_get_channel_id(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr))[32];
14507
14508 /**
14509  * The channel ID
14510  */
14511 void CommitmentSigned_set_channel_id(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14512
14513 /**
14514  * A signature on the commitment transaction
14515  */
14516 struct LDKSignature CommitmentSigned_get_signature(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr);
14517
14518 /**
14519  * A signature on the commitment transaction
14520  */
14521 void CommitmentSigned_set_signature(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
14522
14523 /**
14524  * Signatures on the HTLC transactions
14525  */
14526 void CommitmentSigned_set_htlc_signatures(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKCVec_SignatureZ val);
14527
14528 /**
14529  * Constructs a new CommitmentSigned given each field
14530  */
14531 MUST_USE_RES struct LDKCommitmentSigned CommitmentSigned_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKSignature signature_arg, struct LDKCVec_SignatureZ htlc_signatures_arg);
14532
14533 /**
14534  * Creates a copy of the CommitmentSigned
14535  */
14536 struct LDKCommitmentSigned CommitmentSigned_clone(const struct LDKCommitmentSigned *NONNULL_PTR orig);
14537
14538 /**
14539  * Frees any resources used by the RevokeAndACK, if is_owned is set and inner is non-NULL.
14540  */
14541 void RevokeAndACK_free(struct LDKRevokeAndACK this_obj);
14542
14543 /**
14544  * The channel ID
14545  */
14546 const uint8_t (*RevokeAndACK_get_channel_id(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr))[32];
14547
14548 /**
14549  * The channel ID
14550  */
14551 void RevokeAndACK_set_channel_id(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14552
14553 /**
14554  * The secret corresponding to the per-commitment point
14555  */
14556 const uint8_t (*RevokeAndACK_get_per_commitment_secret(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr))[32];
14557
14558 /**
14559  * The secret corresponding to the per-commitment point
14560  */
14561 void RevokeAndACK_set_per_commitment_secret(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14562
14563 /**
14564  * The next sender-broadcast commitment transaction's per-commitment point
14565  */
14566 struct LDKPublicKey RevokeAndACK_get_next_per_commitment_point(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr);
14567
14568 /**
14569  * The next sender-broadcast commitment transaction's per-commitment point
14570  */
14571 void RevokeAndACK_set_next_per_commitment_point(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14572
14573 /**
14574  * Constructs a new RevokeAndACK given each field
14575  */
14576 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);
14577
14578 /**
14579  * Creates a copy of the RevokeAndACK
14580  */
14581 struct LDKRevokeAndACK RevokeAndACK_clone(const struct LDKRevokeAndACK *NONNULL_PTR orig);
14582
14583 /**
14584  * Frees any resources used by the UpdateFee, if is_owned is set and inner is non-NULL.
14585  */
14586 void UpdateFee_free(struct LDKUpdateFee this_obj);
14587
14588 /**
14589  * The channel ID
14590  */
14591 const uint8_t (*UpdateFee_get_channel_id(const struct LDKUpdateFee *NONNULL_PTR this_ptr))[32];
14592
14593 /**
14594  * The channel ID
14595  */
14596 void UpdateFee_set_channel_id(struct LDKUpdateFee *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14597
14598 /**
14599  * Fee rate per 1000-weight of the transaction
14600  */
14601 uint32_t UpdateFee_get_feerate_per_kw(const struct LDKUpdateFee *NONNULL_PTR this_ptr);
14602
14603 /**
14604  * Fee rate per 1000-weight of the transaction
14605  */
14606 void UpdateFee_set_feerate_per_kw(struct LDKUpdateFee *NONNULL_PTR this_ptr, uint32_t val);
14607
14608 /**
14609  * Constructs a new UpdateFee given each field
14610  */
14611 MUST_USE_RES struct LDKUpdateFee UpdateFee_new(struct LDKThirtyTwoBytes channel_id_arg, uint32_t feerate_per_kw_arg);
14612
14613 /**
14614  * Creates a copy of the UpdateFee
14615  */
14616 struct LDKUpdateFee UpdateFee_clone(const struct LDKUpdateFee *NONNULL_PTR orig);
14617
14618 /**
14619  * Frees any resources used by the DataLossProtect, if is_owned is set and inner is non-NULL.
14620  */
14621 void DataLossProtect_free(struct LDKDataLossProtect this_obj);
14622
14623 /**
14624  * Proof that the sender knows the per-commitment secret of a specific commitment transaction
14625  * belonging to the recipient
14626  */
14627 const uint8_t (*DataLossProtect_get_your_last_per_commitment_secret(const struct LDKDataLossProtect *NONNULL_PTR this_ptr))[32];
14628
14629 /**
14630  * Proof that the sender knows the per-commitment secret of a specific commitment transaction
14631  * belonging to the recipient
14632  */
14633 void DataLossProtect_set_your_last_per_commitment_secret(struct LDKDataLossProtect *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14634
14635 /**
14636  * The sender's per-commitment point for their current commitment transaction
14637  */
14638 struct LDKPublicKey DataLossProtect_get_my_current_per_commitment_point(const struct LDKDataLossProtect *NONNULL_PTR this_ptr);
14639
14640 /**
14641  * The sender's per-commitment point for their current commitment transaction
14642  */
14643 void DataLossProtect_set_my_current_per_commitment_point(struct LDKDataLossProtect *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14644
14645 /**
14646  * Constructs a new DataLossProtect given each field
14647  */
14648 MUST_USE_RES struct LDKDataLossProtect DataLossProtect_new(struct LDKThirtyTwoBytes your_last_per_commitment_secret_arg, struct LDKPublicKey my_current_per_commitment_point_arg);
14649
14650 /**
14651  * Creates a copy of the DataLossProtect
14652  */
14653 struct LDKDataLossProtect DataLossProtect_clone(const struct LDKDataLossProtect *NONNULL_PTR orig);
14654
14655 /**
14656  * Frees any resources used by the ChannelReestablish, if is_owned is set and inner is non-NULL.
14657  */
14658 void ChannelReestablish_free(struct LDKChannelReestablish this_obj);
14659
14660 /**
14661  * The channel ID
14662  */
14663 const uint8_t (*ChannelReestablish_get_channel_id(const struct LDKChannelReestablish *NONNULL_PTR this_ptr))[32];
14664
14665 /**
14666  * The channel ID
14667  */
14668 void ChannelReestablish_set_channel_id(struct LDKChannelReestablish *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14669
14670 /**
14671  * The next commitment number for the sender
14672  */
14673 uint64_t ChannelReestablish_get_next_local_commitment_number(const struct LDKChannelReestablish *NONNULL_PTR this_ptr);
14674
14675 /**
14676  * The next commitment number for the sender
14677  */
14678 void ChannelReestablish_set_next_local_commitment_number(struct LDKChannelReestablish *NONNULL_PTR this_ptr, uint64_t val);
14679
14680 /**
14681  * The next commitment number for the recipient
14682  */
14683 uint64_t ChannelReestablish_get_next_remote_commitment_number(const struct LDKChannelReestablish *NONNULL_PTR this_ptr);
14684
14685 /**
14686  * The next commitment number for the recipient
14687  */
14688 void ChannelReestablish_set_next_remote_commitment_number(struct LDKChannelReestablish *NONNULL_PTR this_ptr, uint64_t val);
14689
14690 /**
14691  * Creates a copy of the ChannelReestablish
14692  */
14693 struct LDKChannelReestablish ChannelReestablish_clone(const struct LDKChannelReestablish *NONNULL_PTR orig);
14694
14695 /**
14696  * Frees any resources used by the AnnouncementSignatures, if is_owned is set and inner is non-NULL.
14697  */
14698 void AnnouncementSignatures_free(struct LDKAnnouncementSignatures this_obj);
14699
14700 /**
14701  * The channel ID
14702  */
14703 const uint8_t (*AnnouncementSignatures_get_channel_id(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr))[32];
14704
14705 /**
14706  * The channel ID
14707  */
14708 void AnnouncementSignatures_set_channel_id(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14709
14710 /**
14711  * The short channel ID
14712  */
14713 uint64_t AnnouncementSignatures_get_short_channel_id(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
14714
14715 /**
14716  * The short channel ID
14717  */
14718 void AnnouncementSignatures_set_short_channel_id(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, uint64_t val);
14719
14720 /**
14721  * A signature by the node key
14722  */
14723 struct LDKSignature AnnouncementSignatures_get_node_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
14724
14725 /**
14726  * A signature by the node key
14727  */
14728 void AnnouncementSignatures_set_node_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKSignature val);
14729
14730 /**
14731  * A signature by the funding key
14732  */
14733 struct LDKSignature AnnouncementSignatures_get_bitcoin_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
14734
14735 /**
14736  * A signature by the funding key
14737  */
14738 void AnnouncementSignatures_set_bitcoin_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKSignature val);
14739
14740 /**
14741  * Constructs a new AnnouncementSignatures given each field
14742  */
14743 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);
14744
14745 /**
14746  * Creates a copy of the AnnouncementSignatures
14747  */
14748 struct LDKAnnouncementSignatures AnnouncementSignatures_clone(const struct LDKAnnouncementSignatures *NONNULL_PTR orig);
14749
14750 /**
14751  * Frees any resources used by the NetAddress
14752  */
14753 void NetAddress_free(struct LDKNetAddress this_ptr);
14754
14755 /**
14756  * Creates a copy of the NetAddress
14757  */
14758 struct LDKNetAddress NetAddress_clone(const struct LDKNetAddress *NONNULL_PTR orig);
14759
14760 /**
14761  * Serialize the NetAddress object into a byte array which can be read by NetAddress_read
14762  */
14763 struct LDKCVec_u8Z NetAddress_write(const struct LDKNetAddress *NONNULL_PTR obj);
14764
14765 /**
14766  * Read a Result from a byte array, created by Result_write
14767  */
14768 struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ Result_read(struct LDKu8slice ser);
14769
14770 /**
14771  * Read a NetAddress from a byte array, created by NetAddress_write
14772  */
14773 struct LDKCResult_NetAddressDecodeErrorZ NetAddress_read(struct LDKu8slice ser);
14774
14775 /**
14776  * Frees any resources used by the UnsignedNodeAnnouncement, if is_owned is set and inner is non-NULL.
14777  */
14778 void UnsignedNodeAnnouncement_free(struct LDKUnsignedNodeAnnouncement this_obj);
14779
14780 /**
14781  * The advertised features
14782  */
14783 struct LDKNodeFeatures UnsignedNodeAnnouncement_get_features(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
14784
14785 /**
14786  * The advertised features
14787  */
14788 void UnsignedNodeAnnouncement_set_features(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
14789
14790 /**
14791  * A strictly monotonic announcement counter, with gaps allowed
14792  */
14793 uint32_t UnsignedNodeAnnouncement_get_timestamp(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
14794
14795 /**
14796  * A strictly monotonic announcement counter, with gaps allowed
14797  */
14798 void UnsignedNodeAnnouncement_set_timestamp(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, uint32_t val);
14799
14800 /**
14801  * The node_id this announcement originated from (don't rebroadcast the node_announcement back
14802  * to this node).
14803  */
14804 struct LDKPublicKey UnsignedNodeAnnouncement_get_node_id(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
14805
14806 /**
14807  * The node_id this announcement originated from (don't rebroadcast the node_announcement back
14808  * to this node).
14809  */
14810 void UnsignedNodeAnnouncement_set_node_id(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14811
14812 /**
14813  * An RGB color for UI purposes
14814  */
14815 const uint8_t (*UnsignedNodeAnnouncement_get_rgb(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr))[3];
14816
14817 /**
14818  * An RGB color for UI purposes
14819  */
14820 void UnsignedNodeAnnouncement_set_rgb(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKThreeBytes val);
14821
14822 /**
14823  * An alias, for UI purposes.  This should be sanitized before use.  There is no guarantee
14824  * of uniqueness.
14825  */
14826 const uint8_t (*UnsignedNodeAnnouncement_get_alias(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr))[32];
14827
14828 /**
14829  * An alias, for UI purposes.  This should be sanitized before use.  There is no guarantee
14830  * of uniqueness.
14831  */
14832 void UnsignedNodeAnnouncement_set_alias(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14833
14834 /**
14835  * List of addresses on which this node is reachable
14836  */
14837 void UnsignedNodeAnnouncement_set_addresses(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKCVec_NetAddressZ val);
14838
14839 /**
14840  * Creates a copy of the UnsignedNodeAnnouncement
14841  */
14842 struct LDKUnsignedNodeAnnouncement UnsignedNodeAnnouncement_clone(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR orig);
14843
14844 /**
14845  * Frees any resources used by the NodeAnnouncement, if is_owned is set and inner is non-NULL.
14846  */
14847 void NodeAnnouncement_free(struct LDKNodeAnnouncement this_obj);
14848
14849 /**
14850  * The signature by the node key
14851  */
14852 struct LDKSignature NodeAnnouncement_get_signature(const struct LDKNodeAnnouncement *NONNULL_PTR this_ptr);
14853
14854 /**
14855  * The signature by the node key
14856  */
14857 void NodeAnnouncement_set_signature(struct LDKNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
14858
14859 /**
14860  * The actual content of the announcement
14861  */
14862 struct LDKUnsignedNodeAnnouncement NodeAnnouncement_get_contents(const struct LDKNodeAnnouncement *NONNULL_PTR this_ptr);
14863
14864 /**
14865  * The actual content of the announcement
14866  */
14867 void NodeAnnouncement_set_contents(struct LDKNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKUnsignedNodeAnnouncement val);
14868
14869 /**
14870  * Constructs a new NodeAnnouncement given each field
14871  */
14872 MUST_USE_RES struct LDKNodeAnnouncement NodeAnnouncement_new(struct LDKSignature signature_arg, struct LDKUnsignedNodeAnnouncement contents_arg);
14873
14874 /**
14875  * Creates a copy of the NodeAnnouncement
14876  */
14877 struct LDKNodeAnnouncement NodeAnnouncement_clone(const struct LDKNodeAnnouncement *NONNULL_PTR orig);
14878
14879 /**
14880  * Frees any resources used by the UnsignedChannelAnnouncement, if is_owned is set and inner is non-NULL.
14881  */
14882 void UnsignedChannelAnnouncement_free(struct LDKUnsignedChannelAnnouncement this_obj);
14883
14884 /**
14885  * The advertised channel features
14886  */
14887 struct LDKChannelFeatures UnsignedChannelAnnouncement_get_features(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
14888
14889 /**
14890  * The advertised channel features
14891  */
14892 void UnsignedChannelAnnouncement_set_features(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
14893
14894 /**
14895  * The genesis hash of the blockchain where the channel is to be opened
14896  */
14897 const uint8_t (*UnsignedChannelAnnouncement_get_chain_hash(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr))[32];
14898
14899 /**
14900  * The genesis hash of the blockchain where the channel is to be opened
14901  */
14902 void UnsignedChannelAnnouncement_set_chain_hash(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14903
14904 /**
14905  * The short channel ID
14906  */
14907 uint64_t UnsignedChannelAnnouncement_get_short_channel_id(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
14908
14909 /**
14910  * The short channel ID
14911  */
14912 void UnsignedChannelAnnouncement_set_short_channel_id(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, uint64_t val);
14913
14914 /**
14915  * One of the two node_ids which are endpoints of this channel
14916  */
14917 struct LDKPublicKey UnsignedChannelAnnouncement_get_node_id_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
14918
14919 /**
14920  * One of the two node_ids which are endpoints of this channel
14921  */
14922 void UnsignedChannelAnnouncement_set_node_id_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14923
14924 /**
14925  * The other of the two node_ids which are endpoints of this channel
14926  */
14927 struct LDKPublicKey UnsignedChannelAnnouncement_get_node_id_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
14928
14929 /**
14930  * The other of the two node_ids which are endpoints of this channel
14931  */
14932 void UnsignedChannelAnnouncement_set_node_id_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14933
14934 /**
14935  * The funding key for the first node
14936  */
14937 struct LDKPublicKey UnsignedChannelAnnouncement_get_bitcoin_key_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
14938
14939 /**
14940  * The funding key for the first node
14941  */
14942 void UnsignedChannelAnnouncement_set_bitcoin_key_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14943
14944 /**
14945  * The funding key for the second node
14946  */
14947 struct LDKPublicKey UnsignedChannelAnnouncement_get_bitcoin_key_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
14948
14949 /**
14950  * The funding key for the second node
14951  */
14952 void UnsignedChannelAnnouncement_set_bitcoin_key_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14953
14954 /**
14955  * Creates a copy of the UnsignedChannelAnnouncement
14956  */
14957 struct LDKUnsignedChannelAnnouncement UnsignedChannelAnnouncement_clone(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR orig);
14958
14959 /**
14960  * Frees any resources used by the ChannelAnnouncement, if is_owned is set and inner is non-NULL.
14961  */
14962 void ChannelAnnouncement_free(struct LDKChannelAnnouncement this_obj);
14963
14964 /**
14965  * Authentication of the announcement by the first public node
14966  */
14967 struct LDKSignature ChannelAnnouncement_get_node_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
14968
14969 /**
14970  * Authentication of the announcement by the first public node
14971  */
14972 void ChannelAnnouncement_set_node_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
14973
14974 /**
14975  * Authentication of the announcement by the second public node
14976  */
14977 struct LDKSignature ChannelAnnouncement_get_node_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
14978
14979 /**
14980  * Authentication of the announcement by the second public node
14981  */
14982 void ChannelAnnouncement_set_node_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
14983
14984 /**
14985  * Proof of funding UTXO ownership by the first public node
14986  */
14987 struct LDKSignature ChannelAnnouncement_get_bitcoin_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
14988
14989 /**
14990  * Proof of funding UTXO ownership by the first public node
14991  */
14992 void ChannelAnnouncement_set_bitcoin_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
14993
14994 /**
14995  * Proof of funding UTXO ownership by the second public node
14996  */
14997 struct LDKSignature ChannelAnnouncement_get_bitcoin_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
14998
14999 /**
15000  * Proof of funding UTXO ownership by the second public node
15001  */
15002 void ChannelAnnouncement_set_bitcoin_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
15003
15004 /**
15005  * The actual announcement
15006  */
15007 struct LDKUnsignedChannelAnnouncement ChannelAnnouncement_get_contents(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
15008
15009 /**
15010  * The actual announcement
15011  */
15012 void ChannelAnnouncement_set_contents(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKUnsignedChannelAnnouncement val);
15013
15014 /**
15015  * Constructs a new ChannelAnnouncement given each field
15016  */
15017 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);
15018
15019 /**
15020  * Creates a copy of the ChannelAnnouncement
15021  */
15022 struct LDKChannelAnnouncement ChannelAnnouncement_clone(const struct LDKChannelAnnouncement *NONNULL_PTR orig);
15023
15024 /**
15025  * Frees any resources used by the UnsignedChannelUpdate, if is_owned is set and inner is non-NULL.
15026  */
15027 void UnsignedChannelUpdate_free(struct LDKUnsignedChannelUpdate this_obj);
15028
15029 /**
15030  * The genesis hash of the blockchain where the channel is to be opened
15031  */
15032 const uint8_t (*UnsignedChannelUpdate_get_chain_hash(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr))[32];
15033
15034 /**
15035  * The genesis hash of the blockchain where the channel is to be opened
15036  */
15037 void UnsignedChannelUpdate_set_chain_hash(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
15038
15039 /**
15040  * The short channel ID
15041  */
15042 uint64_t UnsignedChannelUpdate_get_short_channel_id(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
15043
15044 /**
15045  * The short channel ID
15046  */
15047 void UnsignedChannelUpdate_set_short_channel_id(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val);
15048
15049 /**
15050  * A strictly monotonic announcement counter, with gaps allowed, specific to this channel
15051  */
15052 uint32_t UnsignedChannelUpdate_get_timestamp(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
15053
15054 /**
15055  * A strictly monotonic announcement counter, with gaps allowed, specific to this channel
15056  */
15057 void UnsignedChannelUpdate_set_timestamp(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
15058
15059 /**
15060  * Channel flags
15061  */
15062 uint8_t UnsignedChannelUpdate_get_flags(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
15063
15064 /**
15065  * Channel flags
15066  */
15067 void UnsignedChannelUpdate_set_flags(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint8_t val);
15068
15069 /**
15070  * The number of blocks such that if:
15071  * `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta`
15072  * then we need to fail the HTLC backwards. When forwarding an HTLC, cltv_expiry_delta determines
15073  * the outgoing HTLC's minimum cltv_expiry value -- so, if an incoming HTLC comes in with a
15074  * cltv_expiry of 100000, and the node we're forwarding to has a cltv_expiry_delta value of 10,
15075  * then we'll check that the outgoing HTLC's cltv_expiry value is at least 100010 before
15076  * forwarding. Note that the HTLC sender is the one who originally sets this value when
15077  * constructing the route.
15078  */
15079 uint16_t UnsignedChannelUpdate_get_cltv_expiry_delta(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
15080
15081 /**
15082  * The number of blocks such that if:
15083  * `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta`
15084  * then we need to fail the HTLC backwards. When forwarding an HTLC, cltv_expiry_delta determines
15085  * the outgoing HTLC's minimum cltv_expiry value -- so, if an incoming HTLC comes in with a
15086  * cltv_expiry of 100000, and the node we're forwarding to has a cltv_expiry_delta value of 10,
15087  * then we'll check that the outgoing HTLC's cltv_expiry value is at least 100010 before
15088  * forwarding. Note that the HTLC sender is the one who originally sets this value when
15089  * constructing the route.
15090  */
15091 void UnsignedChannelUpdate_set_cltv_expiry_delta(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint16_t val);
15092
15093 /**
15094  * The minimum HTLC size incoming to sender, in milli-satoshi
15095  */
15096 uint64_t UnsignedChannelUpdate_get_htlc_minimum_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
15097
15098 /**
15099  * The minimum HTLC size incoming to sender, in milli-satoshi
15100  */
15101 void UnsignedChannelUpdate_set_htlc_minimum_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val);
15102
15103 /**
15104  * The base HTLC fee charged by sender, in milli-satoshi
15105  */
15106 uint32_t UnsignedChannelUpdate_get_fee_base_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
15107
15108 /**
15109  * The base HTLC fee charged by sender, in milli-satoshi
15110  */
15111 void UnsignedChannelUpdate_set_fee_base_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
15112
15113 /**
15114  * The amount to fee multiplier, in micro-satoshi
15115  */
15116 uint32_t UnsignedChannelUpdate_get_fee_proportional_millionths(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
15117
15118 /**
15119  * The amount to fee multiplier, in micro-satoshi
15120  */
15121 void UnsignedChannelUpdate_set_fee_proportional_millionths(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
15122
15123 /**
15124  * Creates a copy of the UnsignedChannelUpdate
15125  */
15126 struct LDKUnsignedChannelUpdate UnsignedChannelUpdate_clone(const struct LDKUnsignedChannelUpdate *NONNULL_PTR orig);
15127
15128 /**
15129  * Frees any resources used by the ChannelUpdate, if is_owned is set and inner is non-NULL.
15130  */
15131 void ChannelUpdate_free(struct LDKChannelUpdate this_obj);
15132
15133 /**
15134  * A signature of the channel update
15135  */
15136 struct LDKSignature ChannelUpdate_get_signature(const struct LDKChannelUpdate *NONNULL_PTR this_ptr);
15137
15138 /**
15139  * A signature of the channel update
15140  */
15141 void ChannelUpdate_set_signature(struct LDKChannelUpdate *NONNULL_PTR this_ptr, struct LDKSignature val);
15142
15143 /**
15144  * The actual channel update
15145  */
15146 struct LDKUnsignedChannelUpdate ChannelUpdate_get_contents(const struct LDKChannelUpdate *NONNULL_PTR this_ptr);
15147
15148 /**
15149  * The actual channel update
15150  */
15151 void ChannelUpdate_set_contents(struct LDKChannelUpdate *NONNULL_PTR this_ptr, struct LDKUnsignedChannelUpdate val);
15152
15153 /**
15154  * Constructs a new ChannelUpdate given each field
15155  */
15156 MUST_USE_RES struct LDKChannelUpdate ChannelUpdate_new(struct LDKSignature signature_arg, struct LDKUnsignedChannelUpdate contents_arg);
15157
15158 /**
15159  * Creates a copy of the ChannelUpdate
15160  */
15161 struct LDKChannelUpdate ChannelUpdate_clone(const struct LDKChannelUpdate *NONNULL_PTR orig);
15162
15163 /**
15164  * Frees any resources used by the QueryChannelRange, if is_owned is set and inner is non-NULL.
15165  */
15166 void QueryChannelRange_free(struct LDKQueryChannelRange this_obj);
15167
15168 /**
15169  * The genesis hash of the blockchain being queried
15170  */
15171 const uint8_t (*QueryChannelRange_get_chain_hash(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr))[32];
15172
15173 /**
15174  * The genesis hash of the blockchain being queried
15175  */
15176 void QueryChannelRange_set_chain_hash(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
15177
15178 /**
15179  * The height of the first block for the channel UTXOs being queried
15180  */
15181 uint32_t QueryChannelRange_get_first_blocknum(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr);
15182
15183 /**
15184  * The height of the first block for the channel UTXOs being queried
15185  */
15186 void QueryChannelRange_set_first_blocknum(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, uint32_t val);
15187
15188 /**
15189  * The number of blocks to include in the query results
15190  */
15191 uint32_t QueryChannelRange_get_number_of_blocks(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr);
15192
15193 /**
15194  * The number of blocks to include in the query results
15195  */
15196 void QueryChannelRange_set_number_of_blocks(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, uint32_t val);
15197
15198 /**
15199  * Constructs a new QueryChannelRange given each field
15200  */
15201 MUST_USE_RES struct LDKQueryChannelRange QueryChannelRange_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_blocknum_arg, uint32_t number_of_blocks_arg);
15202
15203 /**
15204  * Creates a copy of the QueryChannelRange
15205  */
15206 struct LDKQueryChannelRange QueryChannelRange_clone(const struct LDKQueryChannelRange *NONNULL_PTR orig);
15207
15208 /**
15209  * Frees any resources used by the ReplyChannelRange, if is_owned is set and inner is non-NULL.
15210  */
15211 void ReplyChannelRange_free(struct LDKReplyChannelRange this_obj);
15212
15213 /**
15214  * The genesis hash of the blockchain being queried
15215  */
15216 const uint8_t (*ReplyChannelRange_get_chain_hash(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr))[32];
15217
15218 /**
15219  * The genesis hash of the blockchain being queried
15220  */
15221 void ReplyChannelRange_set_chain_hash(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
15222
15223 /**
15224  * The height of the first block in the range of the reply
15225  */
15226 uint32_t ReplyChannelRange_get_first_blocknum(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
15227
15228 /**
15229  * The height of the first block in the range of the reply
15230  */
15231 void ReplyChannelRange_set_first_blocknum(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, uint32_t val);
15232
15233 /**
15234  * The number of blocks included in the range of the reply
15235  */
15236 uint32_t ReplyChannelRange_get_number_of_blocks(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
15237
15238 /**
15239  * The number of blocks included in the range of the reply
15240  */
15241 void ReplyChannelRange_set_number_of_blocks(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, uint32_t val);
15242
15243 /**
15244  * True when this is the final reply for a query
15245  */
15246 bool ReplyChannelRange_get_sync_complete(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
15247
15248 /**
15249  * True when this is the final reply for a query
15250  */
15251 void ReplyChannelRange_set_sync_complete(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, bool val);
15252
15253 /**
15254  * The short_channel_ids in the channel range
15255  */
15256 void ReplyChannelRange_set_short_channel_ids(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
15257
15258 /**
15259  * Constructs a new ReplyChannelRange given each field
15260  */
15261 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);
15262
15263 /**
15264  * Creates a copy of the ReplyChannelRange
15265  */
15266 struct LDKReplyChannelRange ReplyChannelRange_clone(const struct LDKReplyChannelRange *NONNULL_PTR orig);
15267
15268 /**
15269  * Frees any resources used by the QueryShortChannelIds, if is_owned is set and inner is non-NULL.
15270  */
15271 void QueryShortChannelIds_free(struct LDKQueryShortChannelIds this_obj);
15272
15273 /**
15274  * The genesis hash of the blockchain being queried
15275  */
15276 const uint8_t (*QueryShortChannelIds_get_chain_hash(const struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr))[32];
15277
15278 /**
15279  * The genesis hash of the blockchain being queried
15280  */
15281 void QueryShortChannelIds_set_chain_hash(struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
15282
15283 /**
15284  * The short_channel_ids that are being queried
15285  */
15286 void QueryShortChannelIds_set_short_channel_ids(struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
15287
15288 /**
15289  * Constructs a new QueryShortChannelIds given each field
15290  */
15291 MUST_USE_RES struct LDKQueryShortChannelIds QueryShortChannelIds_new(struct LDKThirtyTwoBytes chain_hash_arg, struct LDKCVec_u64Z short_channel_ids_arg);
15292
15293 /**
15294  * Creates a copy of the QueryShortChannelIds
15295  */
15296 struct LDKQueryShortChannelIds QueryShortChannelIds_clone(const struct LDKQueryShortChannelIds *NONNULL_PTR orig);
15297
15298 /**
15299  * Frees any resources used by the ReplyShortChannelIdsEnd, if is_owned is set and inner is non-NULL.
15300  */
15301 void ReplyShortChannelIdsEnd_free(struct LDKReplyShortChannelIdsEnd this_obj);
15302
15303 /**
15304  * The genesis hash of the blockchain that was queried
15305  */
15306 const uint8_t (*ReplyShortChannelIdsEnd_get_chain_hash(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr))[32];
15307
15308 /**
15309  * The genesis hash of the blockchain that was queried
15310  */
15311 void ReplyShortChannelIdsEnd_set_chain_hash(struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
15312
15313 /**
15314  * Indicates if the query recipient maintains up-to-date channel
15315  * information for the chain_hash
15316  */
15317 bool ReplyShortChannelIdsEnd_get_full_information(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr);
15318
15319 /**
15320  * Indicates if the query recipient maintains up-to-date channel
15321  * information for the chain_hash
15322  */
15323 void ReplyShortChannelIdsEnd_set_full_information(struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr, bool val);
15324
15325 /**
15326  * Constructs a new ReplyShortChannelIdsEnd given each field
15327  */
15328 MUST_USE_RES struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_new(struct LDKThirtyTwoBytes chain_hash_arg, bool full_information_arg);
15329
15330 /**
15331  * Creates a copy of the ReplyShortChannelIdsEnd
15332  */
15333 struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_clone(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR orig);
15334
15335 /**
15336  * Frees any resources used by the GossipTimestampFilter, if is_owned is set and inner is non-NULL.
15337  */
15338 void GossipTimestampFilter_free(struct LDKGossipTimestampFilter this_obj);
15339
15340 /**
15341  * The genesis hash of the blockchain for channel and node information
15342  */
15343 const uint8_t (*GossipTimestampFilter_get_chain_hash(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr))[32];
15344
15345 /**
15346  * The genesis hash of the blockchain for channel and node information
15347  */
15348 void GossipTimestampFilter_set_chain_hash(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
15349
15350 /**
15351  * The starting unix timestamp
15352  */
15353 uint32_t GossipTimestampFilter_get_first_timestamp(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr);
15354
15355 /**
15356  * The starting unix timestamp
15357  */
15358 void GossipTimestampFilter_set_first_timestamp(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, uint32_t val);
15359
15360 /**
15361  * The range of information in seconds
15362  */
15363 uint32_t GossipTimestampFilter_get_timestamp_range(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr);
15364
15365 /**
15366  * The range of information in seconds
15367  */
15368 void GossipTimestampFilter_set_timestamp_range(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, uint32_t val);
15369
15370 /**
15371  * Constructs a new GossipTimestampFilter given each field
15372  */
15373 MUST_USE_RES struct LDKGossipTimestampFilter GossipTimestampFilter_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_timestamp_arg, uint32_t timestamp_range_arg);
15374
15375 /**
15376  * Creates a copy of the GossipTimestampFilter
15377  */
15378 struct LDKGossipTimestampFilter GossipTimestampFilter_clone(const struct LDKGossipTimestampFilter *NONNULL_PTR orig);
15379
15380 /**
15381  * Frees any resources used by the ErrorAction
15382  */
15383 void ErrorAction_free(struct LDKErrorAction this_ptr);
15384
15385 /**
15386  * Creates a copy of the ErrorAction
15387  */
15388 struct LDKErrorAction ErrorAction_clone(const struct LDKErrorAction *NONNULL_PTR orig);
15389
15390 /**
15391  * Frees any resources used by the LightningError, if is_owned is set and inner is non-NULL.
15392  */
15393 void LightningError_free(struct LDKLightningError this_obj);
15394
15395 /**
15396  * A human-readable message describing the error
15397  */
15398 struct LDKStr LightningError_get_err(const struct LDKLightningError *NONNULL_PTR this_ptr);
15399
15400 /**
15401  * A human-readable message describing the error
15402  */
15403 void LightningError_set_err(struct LDKLightningError *NONNULL_PTR this_ptr, struct LDKStr val);
15404
15405 /**
15406  * The action which should be taken against the offending peer.
15407  */
15408 struct LDKErrorAction LightningError_get_action(const struct LDKLightningError *NONNULL_PTR this_ptr);
15409
15410 /**
15411  * The action which should be taken against the offending peer.
15412  */
15413 void LightningError_set_action(struct LDKLightningError *NONNULL_PTR this_ptr, struct LDKErrorAction val);
15414
15415 /**
15416  * Constructs a new LightningError given each field
15417  */
15418 MUST_USE_RES struct LDKLightningError LightningError_new(struct LDKStr err_arg, struct LDKErrorAction action_arg);
15419
15420 /**
15421  * Creates a copy of the LightningError
15422  */
15423 struct LDKLightningError LightningError_clone(const struct LDKLightningError *NONNULL_PTR orig);
15424
15425 /**
15426  * Frees any resources used by the CommitmentUpdate, if is_owned is set and inner is non-NULL.
15427  */
15428 void CommitmentUpdate_free(struct LDKCommitmentUpdate this_obj);
15429
15430 /**
15431  * update_add_htlc messages which should be sent
15432  */
15433 void CommitmentUpdate_set_update_add_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateAddHTLCZ val);
15434
15435 /**
15436  * update_fulfill_htlc messages which should be sent
15437  */
15438 void CommitmentUpdate_set_update_fulfill_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFulfillHTLCZ val);
15439
15440 /**
15441  * update_fail_htlc messages which should be sent
15442  */
15443 void CommitmentUpdate_set_update_fail_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFailHTLCZ val);
15444
15445 /**
15446  * update_fail_malformed_htlc messages which should be sent
15447  */
15448 void CommitmentUpdate_set_update_fail_malformed_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFailMalformedHTLCZ val);
15449
15450 /**
15451  * An update_fee message which should be sent
15452  */
15453 struct LDKUpdateFee CommitmentUpdate_get_update_fee(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
15454
15455 /**
15456  * An update_fee message which should be sent
15457  */
15458 void CommitmentUpdate_set_update_fee(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKUpdateFee val);
15459
15460 /**
15461  * Finally, the commitment_signed message which should be sent
15462  */
15463 struct LDKCommitmentSigned CommitmentUpdate_get_commitment_signed(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
15464
15465 /**
15466  * Finally, the commitment_signed message which should be sent
15467  */
15468 void CommitmentUpdate_set_commitment_signed(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCommitmentSigned val);
15469
15470 /**
15471  * Constructs a new CommitmentUpdate given each field
15472  */
15473 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);
15474
15475 /**
15476  * Creates a copy of the CommitmentUpdate
15477  */
15478 struct LDKCommitmentUpdate CommitmentUpdate_clone(const struct LDKCommitmentUpdate *NONNULL_PTR orig);
15479
15480 /**
15481  * Frees any resources used by the HTLCFailChannelUpdate
15482  */
15483 void HTLCFailChannelUpdate_free(struct LDKHTLCFailChannelUpdate this_ptr);
15484
15485 /**
15486  * Creates a copy of the HTLCFailChannelUpdate
15487  */
15488 struct LDKHTLCFailChannelUpdate HTLCFailChannelUpdate_clone(const struct LDKHTLCFailChannelUpdate *NONNULL_PTR orig);
15489
15490 /**
15491  * Calls the free function if one is set
15492  */
15493 void ChannelMessageHandler_free(struct LDKChannelMessageHandler this_ptr);
15494
15495 /**
15496  * Calls the free function if one is set
15497  */
15498 void RoutingMessageHandler_free(struct LDKRoutingMessageHandler this_ptr);
15499
15500 /**
15501  * Serialize the AcceptChannel object into a byte array which can be read by AcceptChannel_read
15502  */
15503 struct LDKCVec_u8Z AcceptChannel_write(const struct LDKAcceptChannel *NONNULL_PTR obj);
15504
15505 /**
15506  * Read a AcceptChannel from a byte array, created by AcceptChannel_write
15507  */
15508 struct LDKCResult_AcceptChannelDecodeErrorZ AcceptChannel_read(struct LDKu8slice ser);
15509
15510 /**
15511  * Serialize the AnnouncementSignatures object into a byte array which can be read by AnnouncementSignatures_read
15512  */
15513 struct LDKCVec_u8Z AnnouncementSignatures_write(const struct LDKAnnouncementSignatures *NONNULL_PTR obj);
15514
15515 /**
15516  * Read a AnnouncementSignatures from a byte array, created by AnnouncementSignatures_write
15517  */
15518 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ AnnouncementSignatures_read(struct LDKu8slice ser);
15519
15520 /**
15521  * Serialize the ChannelReestablish object into a byte array which can be read by ChannelReestablish_read
15522  */
15523 struct LDKCVec_u8Z ChannelReestablish_write(const struct LDKChannelReestablish *NONNULL_PTR obj);
15524
15525 /**
15526  * Read a ChannelReestablish from a byte array, created by ChannelReestablish_write
15527  */
15528 struct LDKCResult_ChannelReestablishDecodeErrorZ ChannelReestablish_read(struct LDKu8slice ser);
15529
15530 /**
15531  * Serialize the ClosingSigned object into a byte array which can be read by ClosingSigned_read
15532  */
15533 struct LDKCVec_u8Z ClosingSigned_write(const struct LDKClosingSigned *NONNULL_PTR obj);
15534
15535 /**
15536  * Read a ClosingSigned from a byte array, created by ClosingSigned_write
15537  */
15538 struct LDKCResult_ClosingSignedDecodeErrorZ ClosingSigned_read(struct LDKu8slice ser);
15539
15540 /**
15541  * Serialize the CommitmentSigned object into a byte array which can be read by CommitmentSigned_read
15542  */
15543 struct LDKCVec_u8Z CommitmentSigned_write(const struct LDKCommitmentSigned *NONNULL_PTR obj);
15544
15545 /**
15546  * Read a CommitmentSigned from a byte array, created by CommitmentSigned_write
15547  */
15548 struct LDKCResult_CommitmentSignedDecodeErrorZ CommitmentSigned_read(struct LDKu8slice ser);
15549
15550 /**
15551  * Serialize the FundingCreated object into a byte array which can be read by FundingCreated_read
15552  */
15553 struct LDKCVec_u8Z FundingCreated_write(const struct LDKFundingCreated *NONNULL_PTR obj);
15554
15555 /**
15556  * Read a FundingCreated from a byte array, created by FundingCreated_write
15557  */
15558 struct LDKCResult_FundingCreatedDecodeErrorZ FundingCreated_read(struct LDKu8slice ser);
15559
15560 /**
15561  * Serialize the FundingSigned object into a byte array which can be read by FundingSigned_read
15562  */
15563 struct LDKCVec_u8Z FundingSigned_write(const struct LDKFundingSigned *NONNULL_PTR obj);
15564
15565 /**
15566  * Read a FundingSigned from a byte array, created by FundingSigned_write
15567  */
15568 struct LDKCResult_FundingSignedDecodeErrorZ FundingSigned_read(struct LDKu8slice ser);
15569
15570 /**
15571  * Serialize the FundingLocked object into a byte array which can be read by FundingLocked_read
15572  */
15573 struct LDKCVec_u8Z FundingLocked_write(const struct LDKFundingLocked *NONNULL_PTR obj);
15574
15575 /**
15576  * Read a FundingLocked from a byte array, created by FundingLocked_write
15577  */
15578 struct LDKCResult_FundingLockedDecodeErrorZ FundingLocked_read(struct LDKu8slice ser);
15579
15580 /**
15581  * Serialize the Init object into a byte array which can be read by Init_read
15582  */
15583 struct LDKCVec_u8Z Init_write(const struct LDKInit *NONNULL_PTR obj);
15584
15585 /**
15586  * Read a Init from a byte array, created by Init_write
15587  */
15588 struct LDKCResult_InitDecodeErrorZ Init_read(struct LDKu8slice ser);
15589
15590 /**
15591  * Serialize the OpenChannel object into a byte array which can be read by OpenChannel_read
15592  */
15593 struct LDKCVec_u8Z OpenChannel_write(const struct LDKOpenChannel *NONNULL_PTR obj);
15594
15595 /**
15596  * Read a OpenChannel from a byte array, created by OpenChannel_write
15597  */
15598 struct LDKCResult_OpenChannelDecodeErrorZ OpenChannel_read(struct LDKu8slice ser);
15599
15600 /**
15601  * Serialize the RevokeAndACK object into a byte array which can be read by RevokeAndACK_read
15602  */
15603 struct LDKCVec_u8Z RevokeAndACK_write(const struct LDKRevokeAndACK *NONNULL_PTR obj);
15604
15605 /**
15606  * Read a RevokeAndACK from a byte array, created by RevokeAndACK_write
15607  */
15608 struct LDKCResult_RevokeAndACKDecodeErrorZ RevokeAndACK_read(struct LDKu8slice ser);
15609
15610 /**
15611  * Serialize the Shutdown object into a byte array which can be read by Shutdown_read
15612  */
15613 struct LDKCVec_u8Z Shutdown_write(const struct LDKShutdown *NONNULL_PTR obj);
15614
15615 /**
15616  * Read a Shutdown from a byte array, created by Shutdown_write
15617  */
15618 struct LDKCResult_ShutdownDecodeErrorZ Shutdown_read(struct LDKu8slice ser);
15619
15620 /**
15621  * Serialize the UpdateFailHTLC object into a byte array which can be read by UpdateFailHTLC_read
15622  */
15623 struct LDKCVec_u8Z UpdateFailHTLC_write(const struct LDKUpdateFailHTLC *NONNULL_PTR obj);
15624
15625 /**
15626  * Read a UpdateFailHTLC from a byte array, created by UpdateFailHTLC_write
15627  */
15628 struct LDKCResult_UpdateFailHTLCDecodeErrorZ UpdateFailHTLC_read(struct LDKu8slice ser);
15629
15630 /**
15631  * Serialize the UpdateFailMalformedHTLC object into a byte array which can be read by UpdateFailMalformedHTLC_read
15632  */
15633 struct LDKCVec_u8Z UpdateFailMalformedHTLC_write(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR obj);
15634
15635 /**
15636  * Read a UpdateFailMalformedHTLC from a byte array, created by UpdateFailMalformedHTLC_write
15637  */
15638 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ UpdateFailMalformedHTLC_read(struct LDKu8slice ser);
15639
15640 /**
15641  * Serialize the UpdateFee object into a byte array which can be read by UpdateFee_read
15642  */
15643 struct LDKCVec_u8Z UpdateFee_write(const struct LDKUpdateFee *NONNULL_PTR obj);
15644
15645 /**
15646  * Read a UpdateFee from a byte array, created by UpdateFee_write
15647  */
15648 struct LDKCResult_UpdateFeeDecodeErrorZ UpdateFee_read(struct LDKu8slice ser);
15649
15650 /**
15651  * Serialize the UpdateFulfillHTLC object into a byte array which can be read by UpdateFulfillHTLC_read
15652  */
15653 struct LDKCVec_u8Z UpdateFulfillHTLC_write(const struct LDKUpdateFulfillHTLC *NONNULL_PTR obj);
15654
15655 /**
15656  * Read a UpdateFulfillHTLC from a byte array, created by UpdateFulfillHTLC_write
15657  */
15658 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ UpdateFulfillHTLC_read(struct LDKu8slice ser);
15659
15660 /**
15661  * Serialize the UpdateAddHTLC object into a byte array which can be read by UpdateAddHTLC_read
15662  */
15663 struct LDKCVec_u8Z UpdateAddHTLC_write(const struct LDKUpdateAddHTLC *NONNULL_PTR obj);
15664
15665 /**
15666  * Read a UpdateAddHTLC from a byte array, created by UpdateAddHTLC_write
15667  */
15668 struct LDKCResult_UpdateAddHTLCDecodeErrorZ UpdateAddHTLC_read(struct LDKu8slice ser);
15669
15670 /**
15671  * Serialize the Ping object into a byte array which can be read by Ping_read
15672  */
15673 struct LDKCVec_u8Z Ping_write(const struct LDKPing *NONNULL_PTR obj);
15674
15675 /**
15676  * Read a Ping from a byte array, created by Ping_write
15677  */
15678 struct LDKCResult_PingDecodeErrorZ Ping_read(struct LDKu8slice ser);
15679
15680 /**
15681  * Serialize the Pong object into a byte array which can be read by Pong_read
15682  */
15683 struct LDKCVec_u8Z Pong_write(const struct LDKPong *NONNULL_PTR obj);
15684
15685 /**
15686  * Read a Pong from a byte array, created by Pong_write
15687  */
15688 struct LDKCResult_PongDecodeErrorZ Pong_read(struct LDKu8slice ser);
15689
15690 /**
15691  * Serialize the UnsignedChannelAnnouncement object into a byte array which can be read by UnsignedChannelAnnouncement_read
15692  */
15693 struct LDKCVec_u8Z UnsignedChannelAnnouncement_write(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR obj);
15694
15695 /**
15696  * Read a UnsignedChannelAnnouncement from a byte array, created by UnsignedChannelAnnouncement_write
15697  */
15698 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ UnsignedChannelAnnouncement_read(struct LDKu8slice ser);
15699
15700 /**
15701  * Serialize the ChannelAnnouncement object into a byte array which can be read by ChannelAnnouncement_read
15702  */
15703 struct LDKCVec_u8Z ChannelAnnouncement_write(const struct LDKChannelAnnouncement *NONNULL_PTR obj);
15704
15705 /**
15706  * Read a ChannelAnnouncement from a byte array, created by ChannelAnnouncement_write
15707  */
15708 struct LDKCResult_ChannelAnnouncementDecodeErrorZ ChannelAnnouncement_read(struct LDKu8slice ser);
15709
15710 /**
15711  * Serialize the UnsignedChannelUpdate object into a byte array which can be read by UnsignedChannelUpdate_read
15712  */
15713 struct LDKCVec_u8Z UnsignedChannelUpdate_write(const struct LDKUnsignedChannelUpdate *NONNULL_PTR obj);
15714
15715 /**
15716  * Read a UnsignedChannelUpdate from a byte array, created by UnsignedChannelUpdate_write
15717  */
15718 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ UnsignedChannelUpdate_read(struct LDKu8slice ser);
15719
15720 /**
15721  * Serialize the ChannelUpdate object into a byte array which can be read by ChannelUpdate_read
15722  */
15723 struct LDKCVec_u8Z ChannelUpdate_write(const struct LDKChannelUpdate *NONNULL_PTR obj);
15724
15725 /**
15726  * Read a ChannelUpdate from a byte array, created by ChannelUpdate_write
15727  */
15728 struct LDKCResult_ChannelUpdateDecodeErrorZ ChannelUpdate_read(struct LDKu8slice ser);
15729
15730 /**
15731  * Serialize the ErrorMessage object into a byte array which can be read by ErrorMessage_read
15732  */
15733 struct LDKCVec_u8Z ErrorMessage_write(const struct LDKErrorMessage *NONNULL_PTR obj);
15734
15735 /**
15736  * Read a ErrorMessage from a byte array, created by ErrorMessage_write
15737  */
15738 struct LDKCResult_ErrorMessageDecodeErrorZ ErrorMessage_read(struct LDKu8slice ser);
15739
15740 /**
15741  * Serialize the UnsignedNodeAnnouncement object into a byte array which can be read by UnsignedNodeAnnouncement_read
15742  */
15743 struct LDKCVec_u8Z UnsignedNodeAnnouncement_write(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR obj);
15744
15745 /**
15746  * Read a UnsignedNodeAnnouncement from a byte array, created by UnsignedNodeAnnouncement_write
15747  */
15748 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ UnsignedNodeAnnouncement_read(struct LDKu8slice ser);
15749
15750 /**
15751  * Serialize the NodeAnnouncement object into a byte array which can be read by NodeAnnouncement_read
15752  */
15753 struct LDKCVec_u8Z NodeAnnouncement_write(const struct LDKNodeAnnouncement *NONNULL_PTR obj);
15754
15755 /**
15756  * Read a NodeAnnouncement from a byte array, created by NodeAnnouncement_write
15757  */
15758 struct LDKCResult_NodeAnnouncementDecodeErrorZ NodeAnnouncement_read(struct LDKu8slice ser);
15759
15760 /**
15761  * Read a QueryShortChannelIds from a byte array, created by QueryShortChannelIds_write
15762  */
15763 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ QueryShortChannelIds_read(struct LDKu8slice ser);
15764
15765 /**
15766  * Serialize the QueryShortChannelIds object into a byte array which can be read by QueryShortChannelIds_read
15767  */
15768 struct LDKCVec_u8Z QueryShortChannelIds_write(const struct LDKQueryShortChannelIds *NONNULL_PTR obj);
15769
15770 /**
15771  * Read a ReplyShortChannelIdsEnd from a byte array, created by ReplyShortChannelIdsEnd_write
15772  */
15773 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ ReplyShortChannelIdsEnd_read(struct LDKu8slice ser);
15774
15775 /**
15776  * Serialize the ReplyShortChannelIdsEnd object into a byte array which can be read by ReplyShortChannelIdsEnd_read
15777  */
15778 struct LDKCVec_u8Z ReplyShortChannelIdsEnd_write(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR obj);
15779
15780 /**
15781  *\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
15782  */
15783 MUST_USE_RES uint32_t QueryChannelRange_end_blocknum(const struct LDKQueryChannelRange *NONNULL_PTR this_arg);
15784
15785 /**
15786  * Read a QueryChannelRange from a byte array, created by QueryChannelRange_write
15787  */
15788 struct LDKCResult_QueryChannelRangeDecodeErrorZ QueryChannelRange_read(struct LDKu8slice ser);
15789
15790 /**
15791  * Serialize the QueryChannelRange object into a byte array which can be read by QueryChannelRange_read
15792  */
15793 struct LDKCVec_u8Z QueryChannelRange_write(const struct LDKQueryChannelRange *NONNULL_PTR obj);
15794
15795 /**
15796  * Read a ReplyChannelRange from a byte array, created by ReplyChannelRange_write
15797  */
15798 struct LDKCResult_ReplyChannelRangeDecodeErrorZ ReplyChannelRange_read(struct LDKu8slice ser);
15799
15800 /**
15801  * Serialize the ReplyChannelRange object into a byte array which can be read by ReplyChannelRange_read
15802  */
15803 struct LDKCVec_u8Z ReplyChannelRange_write(const struct LDKReplyChannelRange *NONNULL_PTR obj);
15804
15805 /**
15806  * Read a GossipTimestampFilter from a byte array, created by GossipTimestampFilter_write
15807  */
15808 struct LDKCResult_GossipTimestampFilterDecodeErrorZ GossipTimestampFilter_read(struct LDKu8slice ser);
15809
15810 /**
15811  * Serialize the GossipTimestampFilter object into a byte array which can be read by GossipTimestampFilter_read
15812  */
15813 struct LDKCVec_u8Z GossipTimestampFilter_write(const struct LDKGossipTimestampFilter *NONNULL_PTR obj);
15814
15815 /**
15816  * Frees any resources used by the IgnoringMessageHandler, if is_owned is set and inner is non-NULL.
15817  */
15818 void IgnoringMessageHandler_free(struct LDKIgnoringMessageHandler this_obj);
15819
15820 /**
15821  * Constructs a new IgnoringMessageHandler given each field
15822  */
15823 MUST_USE_RES struct LDKIgnoringMessageHandler IgnoringMessageHandler_new(void);
15824
15825 /**
15826  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
15827  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
15828  */
15829 struct LDKMessageSendEventsProvider IgnoringMessageHandler_as_MessageSendEventsProvider(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
15830
15831 /**
15832  * Constructs a new RoutingMessageHandler which calls the relevant methods on this_arg.
15833  * This copies the `inner` pointer in this_arg and thus the returned RoutingMessageHandler must be freed before this_arg is
15834  */
15835 struct LDKRoutingMessageHandler IgnoringMessageHandler_as_RoutingMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
15836
15837 /**
15838  * Frees any resources used by the ErroringMessageHandler, if is_owned is set and inner is non-NULL.
15839  */
15840 void ErroringMessageHandler_free(struct LDKErroringMessageHandler this_obj);
15841
15842 /**
15843  * Constructs a new ErroringMessageHandler
15844  */
15845 MUST_USE_RES struct LDKErroringMessageHandler ErroringMessageHandler_new(void);
15846
15847 /**
15848  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
15849  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
15850  */
15851 struct LDKMessageSendEventsProvider ErroringMessageHandler_as_MessageSendEventsProvider(const struct LDKErroringMessageHandler *NONNULL_PTR this_arg);
15852
15853 /**
15854  * Constructs a new ChannelMessageHandler which calls the relevant methods on this_arg.
15855  * This copies the `inner` pointer in this_arg and thus the returned ChannelMessageHandler must be freed before this_arg is
15856  */
15857 struct LDKChannelMessageHandler ErroringMessageHandler_as_ChannelMessageHandler(const struct LDKErroringMessageHandler *NONNULL_PTR this_arg);
15858
15859 /**
15860  * Frees any resources used by the MessageHandler, if is_owned is set and inner is non-NULL.
15861  */
15862 void MessageHandler_free(struct LDKMessageHandler this_obj);
15863
15864 /**
15865  * A message handler which handles messages specific to channels. Usually this is just a
15866  * ChannelManager object or a ErroringMessageHandler.
15867  */
15868 const struct LDKChannelMessageHandler *MessageHandler_get_chan_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr);
15869
15870 /**
15871  * A message handler which handles messages specific to channels. Usually this is just a
15872  * ChannelManager object or a ErroringMessageHandler.
15873  */
15874 void MessageHandler_set_chan_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKChannelMessageHandler val);
15875
15876 /**
15877  * A message handler which handles messages updating our knowledge of the network channel
15878  * graph. Usually this is just a NetGraphMsgHandlerMonitor object or an IgnoringMessageHandler.
15879  */
15880 const struct LDKRoutingMessageHandler *MessageHandler_get_route_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr);
15881
15882 /**
15883  * A message handler which handles messages updating our knowledge of the network channel
15884  * graph. Usually this is just a NetGraphMsgHandlerMonitor object or an IgnoringMessageHandler.
15885  */
15886 void MessageHandler_set_route_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKRoutingMessageHandler val);
15887
15888 /**
15889  * Constructs a new MessageHandler given each field
15890  */
15891 MUST_USE_RES struct LDKMessageHandler MessageHandler_new(struct LDKChannelMessageHandler chan_handler_arg, struct LDKRoutingMessageHandler route_handler_arg);
15892
15893 /**
15894  * Creates a copy of a SocketDescriptor
15895  */
15896 struct LDKSocketDescriptor SocketDescriptor_clone(const struct LDKSocketDescriptor *NONNULL_PTR orig);
15897
15898 /**
15899  * Calls the free function if one is set
15900  */
15901 void SocketDescriptor_free(struct LDKSocketDescriptor this_ptr);
15902
15903 /**
15904  * Frees any resources used by the PeerHandleError, if is_owned is set and inner is non-NULL.
15905  */
15906 void PeerHandleError_free(struct LDKPeerHandleError this_obj);
15907
15908 /**
15909  * Used to indicate that we probably can't make any future connections to this peer, implying
15910  * we should go ahead and force-close any channels we have with it.
15911  */
15912 bool PeerHandleError_get_no_connection_possible(const struct LDKPeerHandleError *NONNULL_PTR this_ptr);
15913
15914 /**
15915  * Used to indicate that we probably can't make any future connections to this peer, implying
15916  * we should go ahead and force-close any channels we have with it.
15917  */
15918 void PeerHandleError_set_no_connection_possible(struct LDKPeerHandleError *NONNULL_PTR this_ptr, bool val);
15919
15920 /**
15921  * Constructs a new PeerHandleError given each field
15922  */
15923 MUST_USE_RES struct LDKPeerHandleError PeerHandleError_new(bool no_connection_possible_arg);
15924
15925 /**
15926  * Creates a copy of the PeerHandleError
15927  */
15928 struct LDKPeerHandleError PeerHandleError_clone(const struct LDKPeerHandleError *NONNULL_PTR orig);
15929
15930 /**
15931  * Frees any resources used by the PeerManager, if is_owned is set and inner is non-NULL.
15932  */
15933 void PeerManager_free(struct LDKPeerManager this_obj);
15934
15935 /**
15936  * Constructs a new PeerManager with the given message handlers and node_id secret key
15937  * ephemeral_random_data is used to derive per-connection ephemeral keys and must be
15938  * cryptographically secure random bytes.
15939  */
15940 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);
15941
15942 /**
15943  * Get the list of node ids for peers which have completed the initial handshake.
15944  *
15945  * For outbound connections, this will be the same as the their_node_id parameter passed in to
15946  * new_outbound_connection, however entries will only appear once the initial handshake has
15947  * completed and we are sure the remote peer has the private key for the given node_id.
15948  */
15949 MUST_USE_RES struct LDKCVec_PublicKeyZ PeerManager_get_peer_node_ids(const struct LDKPeerManager *NONNULL_PTR this_arg);
15950
15951 /**
15952  * Indicates a new outbound connection has been established to a node with the given node_id.
15953  * Note that if an Err is returned here you MUST NOT call socket_disconnected for the new
15954  * descriptor but must disconnect the connection immediately.
15955  *
15956  * Returns a small number of bytes to send to the remote node (currently always 50).
15957  *
15958  * Panics if descriptor is duplicative with some other descriptor which has not yet had a
15959  * socket_disconnected().
15960  */
15961 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);
15962
15963 /**
15964  * Indicates a new inbound connection has been established.
15965  *
15966  * May refuse the connection by returning an Err, but will never write bytes to the remote end
15967  * (outbound connector always speaks first). Note that if an Err is returned here you MUST NOT
15968  * call socket_disconnected for the new descriptor but must disconnect the connection
15969  * immediately.
15970  *
15971  * Panics if descriptor is duplicative with some other descriptor which has not yet had
15972  * socket_disconnected called.
15973  */
15974 MUST_USE_RES struct LDKCResult_NonePeerHandleErrorZ PeerManager_new_inbound_connection(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor descriptor);
15975
15976 /**
15977  * Indicates that there is room to write data to the given socket descriptor.
15978  *
15979  * May return an Err to indicate that the connection should be closed.
15980  *
15981  * Will most likely call send_data on the descriptor passed in (or the descriptor handed into
15982  * new_*\\_connection) before returning. Thus, be very careful with reentrancy issues! The
15983  * invariants around calling write_buffer_space_avail in case a write did not fully complete
15984  * must still hold - be ready to call write_buffer_space_avail again if a write call generated
15985  * here isn't sufficient! Panics if the descriptor was not previously registered in a
15986  * new_\\*_connection event.
15987  */
15988 MUST_USE_RES struct LDKCResult_NonePeerHandleErrorZ PeerManager_write_buffer_space_avail(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor *NONNULL_PTR descriptor);
15989
15990 /**
15991  * Indicates that data was read from the given socket descriptor.
15992  *
15993  * May return an Err to indicate that the connection should be closed.
15994  *
15995  * Will *not* call back into send_data on any descriptors to avoid reentrancy complexity.
15996  * Thus, however, you almost certainly want to call process_events() after any read_event to
15997  * generate send_data calls to handle responses.
15998  *
15999  * If Ok(true) is returned, further read_events should not be triggered until a send_data call
16000  * on this file descriptor has resume_read set (preventing DoS issues in the send buffer).
16001  *
16002  * Panics if the descriptor was not previously registered in a new_*_connection event.
16003  */
16004 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);
16005
16006 /**
16007  * Checks for any events generated by our handlers and processes them. Includes sending most
16008  * response messages as well as messages generated by calls to handler functions directly (eg
16009  * functions like ChannelManager::process_pending_htlc_forward or send_payment).
16010  */
16011 void PeerManager_process_events(const struct LDKPeerManager *NONNULL_PTR this_arg);
16012
16013 /**
16014  * Indicates that the given socket descriptor's connection is now closed.
16015  *
16016  * This must only be called if the socket has been disconnected by the peer or your own
16017  * decision to disconnect it and must NOT be called in any case where other parts of this
16018  * library (eg PeerHandleError, explicit disconnect_socket calls) instruct you to disconnect
16019  * the peer.
16020  *
16021  * Panics if the descriptor was not previously registered in a successful new_*_connection event.
16022  */
16023 void PeerManager_socket_disconnected(const struct LDKPeerManager *NONNULL_PTR this_arg, const struct LDKSocketDescriptor *NONNULL_PTR descriptor);
16024
16025 /**
16026  * Disconnect a peer given its node id.
16027  *
16028  * Set no_connection_possible to true to prevent any further connection with this peer,
16029  * force-closing any channels we have with it.
16030  *
16031  * If a peer is connected, this will call `disconnect_socket` on the descriptor for the peer,
16032  * so be careful about reentrancy issues.
16033  */
16034 void PeerManager_disconnect_by_node_id(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKPublicKey node_id, bool no_connection_possible);
16035
16036 /**
16037  * This function should be called roughly once every 30 seconds.
16038  * It will send pings to each peer and disconnect those which did not respond to the last round of pings.
16039  * Will most likely call send_data on all of the registered descriptors, thus, be very careful with reentrancy issues!
16040  */
16041 void PeerManager_timer_tick_occurred(const struct LDKPeerManager *NONNULL_PTR this_arg);
16042
16043 /**
16044  * Build the commitment secret from the seed and the commitment number
16045  */
16046 struct LDKThirtyTwoBytes build_commitment_secret(const uint8_t (*commitment_seed)[32], uint64_t idx);
16047
16048 /**
16049  * Derives a per-commitment-transaction private key (eg an htlc key or delayed_payment key)
16050  * from the base secret and the per_commitment_point.
16051  *
16052  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
16053  * generated (ie our own).
16054  */
16055 struct LDKCResult_SecretKeyErrorZ derive_private_key(struct LDKPublicKey per_commitment_point, const uint8_t (*base_secret)[32]);
16056
16057 /**
16058  * Derives a per-commitment-transaction public key (eg an htlc key or a delayed_payment key)
16059  * from the base point and the per_commitment_key. This is the public equivalent of
16060  * derive_private_key - using only public keys to derive a public key instead of private keys.
16061  *
16062  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
16063  * generated (ie our own).
16064  */
16065 struct LDKCResult_PublicKeyErrorZ derive_public_key(struct LDKPublicKey per_commitment_point, struct LDKPublicKey base_point);
16066
16067 /**
16068  * Derives a per-commitment-transaction revocation key from its constituent parts.
16069  *
16070  * Only the cheating participant owns a valid witness to propagate a revoked
16071  * commitment transaction, thus per_commitment_secret always come from cheater
16072  * and revocation_base_secret always come from punisher, which is the broadcaster
16073  * of the transaction spending with this key knowledge.
16074  *
16075  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
16076  * generated (ie our own).
16077  */
16078 struct LDKCResult_SecretKeyErrorZ derive_private_revocation_key(const uint8_t (*per_commitment_secret)[32], const uint8_t (*countersignatory_revocation_base_secret)[32]);
16079
16080 /**
16081  * Derives a per-commitment-transaction revocation public key from its constituent parts. This is
16082  * the public equivalend of derive_private_revocation_key - using only public keys to derive a
16083  * public key instead of private keys.
16084  *
16085  * Only the cheating participant owns a valid witness to propagate a revoked
16086  * commitment transaction, thus per_commitment_point always come from cheater
16087  * and revocation_base_point always come from punisher, which is the broadcaster
16088  * of the transaction spending with this key knowledge.
16089  *
16090  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
16091  * generated (ie our own).
16092  */
16093 struct LDKCResult_PublicKeyErrorZ derive_public_revocation_key(struct LDKPublicKey per_commitment_point, struct LDKPublicKey countersignatory_revocation_base_point);
16094
16095 /**
16096  * Frees any resources used by the TxCreationKeys, if is_owned is set and inner is non-NULL.
16097  */
16098 void TxCreationKeys_free(struct LDKTxCreationKeys this_obj);
16099
16100 /**
16101  * The broadcaster's per-commitment public key which was used to derive the other keys.
16102  */
16103 struct LDKPublicKey TxCreationKeys_get_per_commitment_point(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
16104
16105 /**
16106  * The broadcaster's per-commitment public key which was used to derive the other keys.
16107  */
16108 void TxCreationKeys_set_per_commitment_point(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
16109
16110 /**
16111  * The revocation key which is used to allow the broadcaster of the commitment
16112  * transaction to provide their counterparty the ability to punish them if they broadcast
16113  * an old state.
16114  */
16115 struct LDKPublicKey TxCreationKeys_get_revocation_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
16116
16117 /**
16118  * The revocation key which is used to allow the broadcaster of the commitment
16119  * transaction to provide their counterparty the ability to punish them if they broadcast
16120  * an old state.
16121  */
16122 void TxCreationKeys_set_revocation_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
16123
16124 /**
16125  * Broadcaster's HTLC Key
16126  */
16127 struct LDKPublicKey TxCreationKeys_get_broadcaster_htlc_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
16128
16129 /**
16130  * Broadcaster's HTLC Key
16131  */
16132 void TxCreationKeys_set_broadcaster_htlc_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
16133
16134 /**
16135  * Countersignatory's HTLC Key
16136  */
16137 struct LDKPublicKey TxCreationKeys_get_countersignatory_htlc_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
16138
16139 /**
16140  * Countersignatory's HTLC Key
16141  */
16142 void TxCreationKeys_set_countersignatory_htlc_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
16143
16144 /**
16145  * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay)
16146  */
16147 struct LDKPublicKey TxCreationKeys_get_broadcaster_delayed_payment_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
16148
16149 /**
16150  * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay)
16151  */
16152 void TxCreationKeys_set_broadcaster_delayed_payment_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
16153
16154 /**
16155  * Constructs a new TxCreationKeys given each field
16156  */
16157 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);
16158
16159 /**
16160  * Creates a copy of the TxCreationKeys
16161  */
16162 struct LDKTxCreationKeys TxCreationKeys_clone(const struct LDKTxCreationKeys *NONNULL_PTR orig);
16163
16164 /**
16165  * Serialize the TxCreationKeys object into a byte array which can be read by TxCreationKeys_read
16166  */
16167 struct LDKCVec_u8Z TxCreationKeys_write(const struct LDKTxCreationKeys *NONNULL_PTR obj);
16168
16169 /**
16170  * Read a TxCreationKeys from a byte array, created by TxCreationKeys_write
16171  */
16172 struct LDKCResult_TxCreationKeysDecodeErrorZ TxCreationKeys_read(struct LDKu8slice ser);
16173
16174 /**
16175  * Frees any resources used by the ChannelPublicKeys, if is_owned is set and inner is non-NULL.
16176  */
16177 void ChannelPublicKeys_free(struct LDKChannelPublicKeys this_obj);
16178
16179 /**
16180  * The public key which is used to sign all commitment transactions, as it appears in the
16181  * on-chain channel lock-in 2-of-2 multisig output.
16182  */
16183 struct LDKPublicKey ChannelPublicKeys_get_funding_pubkey(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
16184
16185 /**
16186  * The public key which is used to sign all commitment transactions, as it appears in the
16187  * on-chain channel lock-in 2-of-2 multisig output.
16188  */
16189 void ChannelPublicKeys_set_funding_pubkey(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
16190
16191 /**
16192  * The base point which is used (with derive_public_revocation_key) to derive per-commitment
16193  * revocation keys. This is combined with the per-commitment-secret generated by the
16194  * counterparty to create a secret which the counterparty can reveal to revoke previous
16195  * states.
16196  */
16197 struct LDKPublicKey ChannelPublicKeys_get_revocation_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
16198
16199 /**
16200  * The base point which is used (with derive_public_revocation_key) to derive per-commitment
16201  * revocation keys. This is combined with the per-commitment-secret generated by the
16202  * counterparty to create a secret which the counterparty can reveal to revoke previous
16203  * states.
16204  */
16205 void ChannelPublicKeys_set_revocation_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
16206
16207 /**
16208  * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
16209  * spendable primary channel balance on the broadcaster's commitment transaction. This key is
16210  * static across every commitment transaction.
16211  */
16212 struct LDKPublicKey ChannelPublicKeys_get_payment_point(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
16213
16214 /**
16215  * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
16216  * spendable primary channel balance on the broadcaster's commitment transaction. This key is
16217  * static across every commitment transaction.
16218  */
16219 void ChannelPublicKeys_set_payment_point(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
16220
16221 /**
16222  * The base point which is used (with derive_public_key) to derive a per-commitment payment
16223  * public key which receives non-HTLC-encumbered funds which are only available for spending
16224  * after some delay (or can be claimed via the revocation path).
16225  */
16226 struct LDKPublicKey ChannelPublicKeys_get_delayed_payment_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
16227
16228 /**
16229  * The base point which is used (with derive_public_key) to derive a per-commitment payment
16230  * public key which receives non-HTLC-encumbered funds which are only available for spending
16231  * after some delay (or can be claimed via the revocation path).
16232  */
16233 void ChannelPublicKeys_set_delayed_payment_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
16234
16235 /**
16236  * The base point which is used (with derive_public_key) to derive a per-commitment public key
16237  * which is used to encumber HTLC-in-flight outputs.
16238  */
16239 struct LDKPublicKey ChannelPublicKeys_get_htlc_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
16240
16241 /**
16242  * The base point which is used (with derive_public_key) to derive a per-commitment public key
16243  * which is used to encumber HTLC-in-flight outputs.
16244  */
16245 void ChannelPublicKeys_set_htlc_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
16246
16247 /**
16248  * Constructs a new ChannelPublicKeys given each field
16249  */
16250 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);
16251
16252 /**
16253  * Creates a copy of the ChannelPublicKeys
16254  */
16255 struct LDKChannelPublicKeys ChannelPublicKeys_clone(const struct LDKChannelPublicKeys *NONNULL_PTR orig);
16256
16257 /**
16258  * Serialize the ChannelPublicKeys object into a byte array which can be read by ChannelPublicKeys_read
16259  */
16260 struct LDKCVec_u8Z ChannelPublicKeys_write(const struct LDKChannelPublicKeys *NONNULL_PTR obj);
16261
16262 /**
16263  * Read a ChannelPublicKeys from a byte array, created by ChannelPublicKeys_write
16264  */
16265 struct LDKCResult_ChannelPublicKeysDecodeErrorZ ChannelPublicKeys_read(struct LDKu8slice ser);
16266
16267 /**
16268  * Create per-state keys from channel base points and the per-commitment point.
16269  * Key set is asymmetric and can't be used as part of counter-signatory set of transactions.
16270  */
16271 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);
16272
16273 /**
16274  * Generate per-state keys from channel static keys.
16275  * Key set is asymmetric and can't be used as part of counter-signatory set of transactions.
16276  */
16277 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);
16278
16279 /**
16280  * A script either spendable by the revocation
16281  * key or the broadcaster_delayed_payment_key and satisfying the relative-locktime OP_CSV constrain.
16282  * Encumbering a `to_holder` output on a commitment transaction or 2nd-stage HTLC transactions.
16283  */
16284 struct LDKCVec_u8Z get_revokeable_redeemscript(struct LDKPublicKey revocation_key, uint16_t contest_delay, struct LDKPublicKey broadcaster_delayed_payment_key);
16285
16286 /**
16287  * Frees any resources used by the HTLCOutputInCommitment, if is_owned is set and inner is non-NULL.
16288  */
16289 void HTLCOutputInCommitment_free(struct LDKHTLCOutputInCommitment this_obj);
16290
16291 /**
16292  * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction).
16293  * Note that this is not the same as whether it is ountbound *from us*. To determine that you
16294  * need to compare this value to whether the commitment transaction in question is that of
16295  * the counterparty or our own.
16296  */
16297 bool HTLCOutputInCommitment_get_offered(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
16298
16299 /**
16300  * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction).
16301  * Note that this is not the same as whether it is ountbound *from us*. To determine that you
16302  * need to compare this value to whether the commitment transaction in question is that of
16303  * the counterparty or our own.
16304  */
16305 void HTLCOutputInCommitment_set_offered(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, bool val);
16306
16307 /**
16308  * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is
16309  * this divided by 1000.
16310  */
16311 uint64_t HTLCOutputInCommitment_get_amount_msat(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
16312
16313 /**
16314  * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is
16315  * this divided by 1000.
16316  */
16317 void HTLCOutputInCommitment_set_amount_msat(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, uint64_t val);
16318
16319 /**
16320  * The CLTV lock-time at which this HTLC expires.
16321  */
16322 uint32_t HTLCOutputInCommitment_get_cltv_expiry(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
16323
16324 /**
16325  * The CLTV lock-time at which this HTLC expires.
16326  */
16327 void HTLCOutputInCommitment_set_cltv_expiry(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, uint32_t val);
16328
16329 /**
16330  * The hash of the preimage which unlocks this HTLC.
16331  */
16332 const uint8_t (*HTLCOutputInCommitment_get_payment_hash(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr))[32];
16333
16334 /**
16335  * The hash of the preimage which unlocks this HTLC.
16336  */
16337 void HTLCOutputInCommitment_set_payment_hash(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
16338
16339 /**
16340  * The position within the commitment transactions' outputs. This may be None if the value is
16341  * below the dust limit (in which case no output appears in the commitment transaction and the
16342  * value is spent to additional transaction fees).
16343  */
16344 struct LDKCOption_u32Z HTLCOutputInCommitment_get_transaction_output_index(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
16345
16346 /**
16347  * The position within the commitment transactions' outputs. This may be None if the value is
16348  * below the dust limit (in which case no output appears in the commitment transaction and the
16349  * value is spent to additional transaction fees).
16350  */
16351 void HTLCOutputInCommitment_set_transaction_output_index(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val);
16352
16353 /**
16354  * Constructs a new HTLCOutputInCommitment given each field
16355  */
16356 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);
16357
16358 /**
16359  * Creates a copy of the HTLCOutputInCommitment
16360  */
16361 struct LDKHTLCOutputInCommitment HTLCOutputInCommitment_clone(const struct LDKHTLCOutputInCommitment *NONNULL_PTR orig);
16362
16363 /**
16364  * Serialize the HTLCOutputInCommitment object into a byte array which can be read by HTLCOutputInCommitment_read
16365  */
16366 struct LDKCVec_u8Z HTLCOutputInCommitment_write(const struct LDKHTLCOutputInCommitment *NONNULL_PTR obj);
16367
16368 /**
16369  * Read a HTLCOutputInCommitment from a byte array, created by HTLCOutputInCommitment_write
16370  */
16371 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ HTLCOutputInCommitment_read(struct LDKu8slice ser);
16372
16373 /**
16374  * Gets the witness redeemscript for an HTLC output in a commitment transaction. Note that htlc
16375  * does not need to have its previous_output_index filled.
16376  */
16377 struct LDKCVec_u8Z get_htlc_redeemscript(const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc, const struct LDKTxCreationKeys *NONNULL_PTR keys);
16378
16379 /**
16380  * Gets the redeemscript for a funding output from the two funding public keys.
16381  * Note that the order of funding public keys does not matter.
16382  */
16383 struct LDKCVec_u8Z make_funding_redeemscript(struct LDKPublicKey broadcaster, struct LDKPublicKey countersignatory);
16384
16385 /**
16386  * panics if htlc.transaction_output_index.is_none()!
16387  */
16388 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);
16389
16390 /**
16391  * Frees any resources used by the ChannelTransactionParameters, if is_owned is set and inner is non-NULL.
16392  */
16393 void ChannelTransactionParameters_free(struct LDKChannelTransactionParameters this_obj);
16394
16395 /**
16396  * Holder public keys
16397  */
16398 struct LDKChannelPublicKeys ChannelTransactionParameters_get_holder_pubkeys(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
16399
16400 /**
16401  * Holder public keys
16402  */
16403 void ChannelTransactionParameters_set_holder_pubkeys(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelPublicKeys val);
16404
16405 /**
16406  * The contest delay selected by the holder, which applies to counterparty-broadcast transactions
16407  */
16408 uint16_t ChannelTransactionParameters_get_holder_selected_contest_delay(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
16409
16410 /**
16411  * The contest delay selected by the holder, which applies to counterparty-broadcast transactions
16412  */
16413 void ChannelTransactionParameters_set_holder_selected_contest_delay(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, uint16_t val);
16414
16415 /**
16416  * Whether the holder is the initiator of this channel.
16417  * This is an input to the commitment number obscure factor computation.
16418  */
16419 bool ChannelTransactionParameters_get_is_outbound_from_holder(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
16420
16421 /**
16422  * Whether the holder is the initiator of this channel.
16423  * This is an input to the commitment number obscure factor computation.
16424  */
16425 void ChannelTransactionParameters_set_is_outbound_from_holder(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, bool val);
16426
16427 /**
16428  * The late-bound counterparty channel transaction parameters.
16429  * These parameters are populated at the point in the protocol where the counterparty provides them.
16430  */
16431 struct LDKCounterpartyChannelTransactionParameters ChannelTransactionParameters_get_counterparty_parameters(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
16432
16433 /**
16434  * The late-bound counterparty channel transaction parameters.
16435  * These parameters are populated at the point in the protocol where the counterparty provides them.
16436  */
16437 void ChannelTransactionParameters_set_counterparty_parameters(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKCounterpartyChannelTransactionParameters val);
16438
16439 /**
16440  * The late-bound funding outpoint
16441  */
16442 struct LDKOutPoint ChannelTransactionParameters_get_funding_outpoint(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
16443
16444 /**
16445  * The late-bound funding outpoint
16446  */
16447 void ChannelTransactionParameters_set_funding_outpoint(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKOutPoint val);
16448
16449 /**
16450  * Constructs a new ChannelTransactionParameters given each field
16451  */
16452 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);
16453
16454 /**
16455  * Creates a copy of the ChannelTransactionParameters
16456  */
16457 struct LDKChannelTransactionParameters ChannelTransactionParameters_clone(const struct LDKChannelTransactionParameters *NONNULL_PTR orig);
16458
16459 /**
16460  * Frees any resources used by the CounterpartyChannelTransactionParameters, if is_owned is set and inner is non-NULL.
16461  */
16462 void CounterpartyChannelTransactionParameters_free(struct LDKCounterpartyChannelTransactionParameters this_obj);
16463
16464 /**
16465  * Counter-party public keys
16466  */
16467 struct LDKChannelPublicKeys CounterpartyChannelTransactionParameters_get_pubkeys(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr);
16468
16469 /**
16470  * Counter-party public keys
16471  */
16472 void CounterpartyChannelTransactionParameters_set_pubkeys(struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelPublicKeys val);
16473
16474 /**
16475  * The contest delay selected by the counterparty, which applies to holder-broadcast transactions
16476  */
16477 uint16_t CounterpartyChannelTransactionParameters_get_selected_contest_delay(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr);
16478
16479 /**
16480  * The contest delay selected by the counterparty, which applies to holder-broadcast transactions
16481  */
16482 void CounterpartyChannelTransactionParameters_set_selected_contest_delay(struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr, uint16_t val);
16483
16484 /**
16485  * Constructs a new CounterpartyChannelTransactionParameters given each field
16486  */
16487 MUST_USE_RES struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_new(struct LDKChannelPublicKeys pubkeys_arg, uint16_t selected_contest_delay_arg);
16488
16489 /**
16490  * Creates a copy of the CounterpartyChannelTransactionParameters
16491  */
16492 struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_clone(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR orig);
16493
16494 /**
16495  * Whether the late bound parameters are populated.
16496  */
16497 MUST_USE_RES bool ChannelTransactionParameters_is_populated(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
16498
16499 /**
16500  * Convert the holder/counterparty parameters to broadcaster/countersignatory-organized parameters,
16501  * given that the holder is the broadcaster.
16502  *
16503  * self.is_populated() must be true before calling this function.
16504  */
16505 MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionParameters_as_holder_broadcastable(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
16506
16507 /**
16508  * Convert the holder/counterparty parameters to broadcaster/countersignatory-organized parameters,
16509  * given that the counterparty is the broadcaster.
16510  *
16511  * self.is_populated() must be true before calling this function.
16512  */
16513 MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionParameters_as_counterparty_broadcastable(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
16514
16515 /**
16516  * Serialize the CounterpartyChannelTransactionParameters object into a byte array which can be read by CounterpartyChannelTransactionParameters_read
16517  */
16518 struct LDKCVec_u8Z CounterpartyChannelTransactionParameters_write(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR obj);
16519
16520 /**
16521  * Read a CounterpartyChannelTransactionParameters from a byte array, created by CounterpartyChannelTransactionParameters_write
16522  */
16523 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CounterpartyChannelTransactionParameters_read(struct LDKu8slice ser);
16524
16525 /**
16526  * Serialize the ChannelTransactionParameters object into a byte array which can be read by ChannelTransactionParameters_read
16527  */
16528 struct LDKCVec_u8Z ChannelTransactionParameters_write(const struct LDKChannelTransactionParameters *NONNULL_PTR obj);
16529
16530 /**
16531  * Read a ChannelTransactionParameters from a byte array, created by ChannelTransactionParameters_write
16532  */
16533 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ ChannelTransactionParameters_read(struct LDKu8slice ser);
16534
16535 /**
16536  * Frees any resources used by the DirectedChannelTransactionParameters, if is_owned is set and inner is non-NULL.
16537  */
16538 void DirectedChannelTransactionParameters_free(struct LDKDirectedChannelTransactionParameters this_obj);
16539
16540 /**
16541  * Get the channel pubkeys for the broadcaster
16542  */
16543 MUST_USE_RES struct LDKChannelPublicKeys DirectedChannelTransactionParameters_broadcaster_pubkeys(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
16544
16545 /**
16546  * Get the channel pubkeys for the countersignatory
16547  */
16548 MUST_USE_RES struct LDKChannelPublicKeys DirectedChannelTransactionParameters_countersignatory_pubkeys(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
16549
16550 /**
16551  * Get the contest delay applicable to the transactions.
16552  * Note that the contest delay was selected by the countersignatory.
16553  */
16554 MUST_USE_RES uint16_t DirectedChannelTransactionParameters_contest_delay(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
16555
16556 /**
16557  * Whether the channel is outbound from the broadcaster.
16558  *
16559  * The boolean representing the side that initiated the channel is
16560  * an input to the commitment number obscure factor computation.
16561  */
16562 MUST_USE_RES bool DirectedChannelTransactionParameters_is_outbound(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
16563
16564 /**
16565  * The funding outpoint
16566  */
16567 MUST_USE_RES struct LDKOutPoint DirectedChannelTransactionParameters_funding_outpoint(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
16568
16569 /**
16570  * Frees any resources used by the HolderCommitmentTransaction, if is_owned is set and inner is non-NULL.
16571  */
16572 void HolderCommitmentTransaction_free(struct LDKHolderCommitmentTransaction this_obj);
16573
16574 /**
16575  * Our counterparty's signature for the transaction
16576  */
16577 struct LDKSignature HolderCommitmentTransaction_get_counterparty_sig(const struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr);
16578
16579 /**
16580  * Our counterparty's signature for the transaction
16581  */
16582 void HolderCommitmentTransaction_set_counterparty_sig(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKSignature val);
16583
16584 /**
16585  * All non-dust counterparty HTLC signatures, in the order they appear in the transaction
16586  */
16587 void HolderCommitmentTransaction_set_counterparty_htlc_sigs(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKCVec_SignatureZ val);
16588
16589 /**
16590  * Creates a copy of the HolderCommitmentTransaction
16591  */
16592 struct LDKHolderCommitmentTransaction HolderCommitmentTransaction_clone(const struct LDKHolderCommitmentTransaction *NONNULL_PTR orig);
16593
16594 /**
16595  * Serialize the HolderCommitmentTransaction object into a byte array which can be read by HolderCommitmentTransaction_read
16596  */
16597 struct LDKCVec_u8Z HolderCommitmentTransaction_write(const struct LDKHolderCommitmentTransaction *NONNULL_PTR obj);
16598
16599 /**
16600  * Read a HolderCommitmentTransaction from a byte array, created by HolderCommitmentTransaction_write
16601  */
16602 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ HolderCommitmentTransaction_read(struct LDKu8slice ser);
16603
16604 /**
16605  * Create a new holder transaction with the given counterparty signatures.
16606  * The funding keys are used to figure out which signature should go first when building the transaction for broadcast.
16607  */
16608 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);
16609
16610 /**
16611  * Frees any resources used by the BuiltCommitmentTransaction, if is_owned is set and inner is non-NULL.
16612  */
16613 void BuiltCommitmentTransaction_free(struct LDKBuiltCommitmentTransaction this_obj);
16614
16615 /**
16616  * The commitment transaction
16617  */
16618 struct LDKTransaction BuiltCommitmentTransaction_get_transaction(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr);
16619
16620 /**
16621  * The commitment transaction
16622  */
16623 void BuiltCommitmentTransaction_set_transaction(struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKTransaction val);
16624
16625 /**
16626  * The txid for the commitment transaction.
16627  *
16628  * This is provided as a performance optimization, instead of calling transaction.txid()
16629  * multiple times.
16630  */
16631 const uint8_t (*BuiltCommitmentTransaction_get_txid(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr))[32];
16632
16633 /**
16634  * The txid for the commitment transaction.
16635  *
16636  * This is provided as a performance optimization, instead of calling transaction.txid()
16637  * multiple times.
16638  */
16639 void BuiltCommitmentTransaction_set_txid(struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
16640
16641 /**
16642  * Constructs a new BuiltCommitmentTransaction given each field
16643  */
16644 MUST_USE_RES struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_new(struct LDKTransaction transaction_arg, struct LDKThirtyTwoBytes txid_arg);
16645
16646 /**
16647  * Creates a copy of the BuiltCommitmentTransaction
16648  */
16649 struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_clone(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR orig);
16650
16651 /**
16652  * Serialize the BuiltCommitmentTransaction object into a byte array which can be read by BuiltCommitmentTransaction_read
16653  */
16654 struct LDKCVec_u8Z BuiltCommitmentTransaction_write(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR obj);
16655
16656 /**
16657  * Read a BuiltCommitmentTransaction from a byte array, created by BuiltCommitmentTransaction_write
16658  */
16659 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ BuiltCommitmentTransaction_read(struct LDKu8slice ser);
16660
16661 /**
16662  * Get the SIGHASH_ALL sighash value of the transaction.
16663  *
16664  * This can be used to verify a signature.
16665  */
16666 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);
16667
16668 /**
16669  * Sign a transaction, either because we are counter-signing the counterparty's transaction or
16670  * because we are about to broadcast a holder transaction.
16671  */
16672 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);
16673
16674 /**
16675  * Frees any resources used by the CommitmentTransaction, if is_owned is set and inner is non-NULL.
16676  */
16677 void CommitmentTransaction_free(struct LDKCommitmentTransaction this_obj);
16678
16679 /**
16680  * Creates a copy of the CommitmentTransaction
16681  */
16682 struct LDKCommitmentTransaction CommitmentTransaction_clone(const struct LDKCommitmentTransaction *NONNULL_PTR orig);
16683
16684 /**
16685  * Serialize the CommitmentTransaction object into a byte array which can be read by CommitmentTransaction_read
16686  */
16687 struct LDKCVec_u8Z CommitmentTransaction_write(const struct LDKCommitmentTransaction *NONNULL_PTR obj);
16688
16689 /**
16690  * Read a CommitmentTransaction from a byte array, created by CommitmentTransaction_write
16691  */
16692 struct LDKCResult_CommitmentTransactionDecodeErrorZ CommitmentTransaction_read(struct LDKu8slice ser);
16693
16694 /**
16695  * The backwards-counting commitment number
16696  */
16697 MUST_USE_RES uint64_t CommitmentTransaction_commitment_number(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
16698
16699 /**
16700  * The value to be sent to the broadcaster
16701  */
16702 MUST_USE_RES uint64_t CommitmentTransaction_to_broadcaster_value_sat(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
16703
16704 /**
16705  * The value to be sent to the counterparty
16706  */
16707 MUST_USE_RES uint64_t CommitmentTransaction_to_countersignatory_value_sat(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
16708
16709 /**
16710  * The feerate paid per 1000-weight-unit in this commitment transaction.
16711  */
16712 MUST_USE_RES uint32_t CommitmentTransaction_feerate_per_kw(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
16713
16714 /**
16715  * Trust our pre-built transaction and derived transaction creation public keys.
16716  *
16717  * Applies a wrapper which allows access to these fields.
16718  *
16719  * This should only be used if you fully trust the builder of this object.  It should not
16720  *\tbe used by an external signer - instead use the verify function.
16721  */
16722 MUST_USE_RES struct LDKTrustedCommitmentTransaction CommitmentTransaction_trust(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
16723
16724 /**
16725  * Verify our pre-built transaction and derived transaction creation public keys.
16726  *
16727  * Applies a wrapper which allows access to these fields.
16728  *
16729  * An external validating signer must call this method before signing
16730  * or using the built transaction.
16731  */
16732 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);
16733
16734 /**
16735  * Frees any resources used by the TrustedCommitmentTransaction, if is_owned is set and inner is non-NULL.
16736  */
16737 void TrustedCommitmentTransaction_free(struct LDKTrustedCommitmentTransaction this_obj);
16738
16739 /**
16740  * The transaction ID of the built Bitcoin transaction
16741  */
16742 MUST_USE_RES struct LDKThirtyTwoBytes TrustedCommitmentTransaction_txid(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
16743
16744 /**
16745  * The pre-built Bitcoin commitment transaction
16746  */
16747 MUST_USE_RES struct LDKBuiltCommitmentTransaction TrustedCommitmentTransaction_built_transaction(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
16748
16749 /**
16750  * The pre-calculated transaction creation public keys.
16751  */
16752 MUST_USE_RES struct LDKTxCreationKeys TrustedCommitmentTransaction_keys(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
16753
16754 /**
16755  * Get a signature for each HTLC which was included in the commitment transaction (ie for
16756  * which HTLCOutputInCommitment::transaction_output_index.is_some()).
16757  *
16758  * The returned Vec has one entry for each HTLC, and in the same order.
16759  */
16760 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);
16761
16762 /**
16763  * Get the transaction number obscure factor
16764  */
16765 uint64_t get_commitment_transaction_number_obscure_factor(struct LDKPublicKey broadcaster_payment_basepoint, struct LDKPublicKey countersignatory_payment_basepoint, bool outbound_from_broadcaster);
16766
16767 /**
16768  * Checks if two InitFeaturess contain equal inner contents.
16769  * This ignores pointers and is_owned flags and looks at the values in fields.
16770  * Two objects with NULL inner values will be considered "equal" here.
16771  */
16772 bool InitFeatures_eq(const struct LDKInitFeatures *NONNULL_PTR a, const struct LDKInitFeatures *NONNULL_PTR b);
16773
16774 /**
16775  * Checks if two NodeFeaturess contain equal inner contents.
16776  * This ignores pointers and is_owned flags and looks at the values in fields.
16777  * Two objects with NULL inner values will be considered "equal" here.
16778  */
16779 bool NodeFeatures_eq(const struct LDKNodeFeatures *NONNULL_PTR a, const struct LDKNodeFeatures *NONNULL_PTR b);
16780
16781 /**
16782  * Checks if two ChannelFeaturess contain equal inner contents.
16783  * This ignores pointers and is_owned flags and looks at the values in fields.
16784  * Two objects with NULL inner values will be considered "equal" here.
16785  */
16786 bool ChannelFeatures_eq(const struct LDKChannelFeatures *NONNULL_PTR a, const struct LDKChannelFeatures *NONNULL_PTR b);
16787
16788 /**
16789  * Checks if two InvoiceFeaturess contain equal inner contents.
16790  * This ignores pointers and is_owned flags and looks at the values in fields.
16791  * Two objects with NULL inner values will be considered "equal" here.
16792  */
16793 bool InvoiceFeatures_eq(const struct LDKInvoiceFeatures *NONNULL_PTR a, const struct LDKInvoiceFeatures *NONNULL_PTR b);
16794
16795 /**
16796  * Creates a copy of the InitFeatures
16797  */
16798 struct LDKInitFeatures InitFeatures_clone(const struct LDKInitFeatures *NONNULL_PTR orig);
16799
16800 /**
16801  * Creates a copy of the NodeFeatures
16802  */
16803 struct LDKNodeFeatures NodeFeatures_clone(const struct LDKNodeFeatures *NONNULL_PTR orig);
16804
16805 /**
16806  * Creates a copy of the ChannelFeatures
16807  */
16808 struct LDKChannelFeatures ChannelFeatures_clone(const struct LDKChannelFeatures *NONNULL_PTR orig);
16809
16810 /**
16811  * Creates a copy of the InvoiceFeatures
16812  */
16813 struct LDKInvoiceFeatures InvoiceFeatures_clone(const struct LDKInvoiceFeatures *NONNULL_PTR orig);
16814
16815 /**
16816  * Frees any resources used by the InitFeatures, if is_owned is set and inner is non-NULL.
16817  */
16818 void InitFeatures_free(struct LDKInitFeatures this_obj);
16819
16820 /**
16821  * Frees any resources used by the NodeFeatures, if is_owned is set and inner is non-NULL.
16822  */
16823 void NodeFeatures_free(struct LDKNodeFeatures this_obj);
16824
16825 /**
16826  * Frees any resources used by the ChannelFeatures, if is_owned is set and inner is non-NULL.
16827  */
16828 void ChannelFeatures_free(struct LDKChannelFeatures this_obj);
16829
16830 /**
16831  * Frees any resources used by the InvoiceFeatures, if is_owned is set and inner is non-NULL.
16832  */
16833 void InvoiceFeatures_free(struct LDKInvoiceFeatures this_obj);
16834
16835 /**
16836  * Create a blank Features with no features set
16837  */
16838 MUST_USE_RES struct LDKInitFeatures InitFeatures_empty(void);
16839
16840 /**
16841  * Creates a Features with the bits set which are known by the implementation
16842  */
16843 MUST_USE_RES struct LDKInitFeatures InitFeatures_known(void);
16844
16845 /**
16846  * Create a blank Features with no features set
16847  */
16848 MUST_USE_RES struct LDKNodeFeatures NodeFeatures_empty(void);
16849
16850 /**
16851  * Creates a Features with the bits set which are known by the implementation
16852  */
16853 MUST_USE_RES struct LDKNodeFeatures NodeFeatures_known(void);
16854
16855 /**
16856  * Create a blank Features with no features set
16857  */
16858 MUST_USE_RES struct LDKChannelFeatures ChannelFeatures_empty(void);
16859
16860 /**
16861  * Creates a Features with the bits set which are known by the implementation
16862  */
16863 MUST_USE_RES struct LDKChannelFeatures ChannelFeatures_known(void);
16864
16865 /**
16866  * Create a blank Features with no features set
16867  */
16868 MUST_USE_RES struct LDKInvoiceFeatures InvoiceFeatures_empty(void);
16869
16870 /**
16871  * Creates a Features with the bits set which are known by the implementation
16872  */
16873 MUST_USE_RES struct LDKInvoiceFeatures InvoiceFeatures_known(void);
16874
16875 /**
16876  * Returns whether the `payment_secret` feature is supported.
16877  */
16878 MUST_USE_RES bool InitFeatures_supports_payment_secret(const struct LDKInitFeatures *NONNULL_PTR this_arg);
16879
16880 /**
16881  * Returns whether the `payment_secret` feature is supported.
16882  */
16883 MUST_USE_RES bool NodeFeatures_supports_payment_secret(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
16884
16885 /**
16886  * Returns whether the `payment_secret` feature is supported.
16887  */
16888 MUST_USE_RES bool InvoiceFeatures_supports_payment_secret(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
16889
16890 /**
16891  * Serialize the InitFeatures object into a byte array which can be read by InitFeatures_read
16892  */
16893 struct LDKCVec_u8Z InitFeatures_write(const struct LDKInitFeatures *NONNULL_PTR obj);
16894
16895 /**
16896  * Serialize the NodeFeatures object into a byte array which can be read by NodeFeatures_read
16897  */
16898 struct LDKCVec_u8Z NodeFeatures_write(const struct LDKNodeFeatures *NONNULL_PTR obj);
16899
16900 /**
16901  * Serialize the ChannelFeatures object into a byte array which can be read by ChannelFeatures_read
16902  */
16903 struct LDKCVec_u8Z ChannelFeatures_write(const struct LDKChannelFeatures *NONNULL_PTR obj);
16904
16905 /**
16906  * Serialize the InvoiceFeatures object into a byte array which can be read by InvoiceFeatures_read
16907  */
16908 struct LDKCVec_u8Z InvoiceFeatures_write(const struct LDKInvoiceFeatures *NONNULL_PTR obj);
16909
16910 /**
16911  * Read a InitFeatures from a byte array, created by InitFeatures_write
16912  */
16913 struct LDKCResult_InitFeaturesDecodeErrorZ InitFeatures_read(struct LDKu8slice ser);
16914
16915 /**
16916  * Read a NodeFeatures from a byte array, created by NodeFeatures_write
16917  */
16918 struct LDKCResult_NodeFeaturesDecodeErrorZ NodeFeatures_read(struct LDKu8slice ser);
16919
16920 /**
16921  * Read a ChannelFeatures from a byte array, created by ChannelFeatures_write
16922  */
16923 struct LDKCResult_ChannelFeaturesDecodeErrorZ ChannelFeatures_read(struct LDKu8slice ser);
16924
16925 /**
16926  * Read a InvoiceFeatures from a byte array, created by InvoiceFeatures_write
16927  */
16928 struct LDKCResult_InvoiceFeaturesDecodeErrorZ InvoiceFeatures_read(struct LDKu8slice ser);
16929
16930 /**
16931  * Frees any resources used by the RouteHop, if is_owned is set and inner is non-NULL.
16932  */
16933 void RouteHop_free(struct LDKRouteHop this_obj);
16934
16935 /**
16936  * The node_id of the node at this hop.
16937  */
16938 struct LDKPublicKey RouteHop_get_pubkey(const struct LDKRouteHop *NONNULL_PTR this_ptr);
16939
16940 /**
16941  * The node_id of the node at this hop.
16942  */
16943 void RouteHop_set_pubkey(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKPublicKey val);
16944
16945 /**
16946  * The node_announcement features of the node at this hop. For the last hop, these may be
16947  * amended to match the features present in the invoice this node generated.
16948  */
16949 struct LDKNodeFeatures RouteHop_get_node_features(const struct LDKRouteHop *NONNULL_PTR this_ptr);
16950
16951 /**
16952  * The node_announcement features of the node at this hop. For the last hop, these may be
16953  * amended to match the features present in the invoice this node generated.
16954  */
16955 void RouteHop_set_node_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
16956
16957 /**
16958  * The channel that should be used from the previous hop to reach this node.
16959  */
16960 uint64_t RouteHop_get_short_channel_id(const struct LDKRouteHop *NONNULL_PTR this_ptr);
16961
16962 /**
16963  * The channel that should be used from the previous hop to reach this node.
16964  */
16965 void RouteHop_set_short_channel_id(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val);
16966
16967 /**
16968  * The channel_announcement features of the channel that should be used from the previous hop
16969  * to reach this node.
16970  */
16971 struct LDKChannelFeatures RouteHop_get_channel_features(const struct LDKRouteHop *NONNULL_PTR this_ptr);
16972
16973 /**
16974  * The channel_announcement features of the channel that should be used from the previous hop
16975  * to reach this node.
16976  */
16977 void RouteHop_set_channel_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
16978
16979 /**
16980  * The fee taken on this hop (for paying for the use of the *next* channel in the path).
16981  * For the last hop, this should be the full value of the payment (might be more than
16982  * requested if we had to match htlc_minimum_msat).
16983  */
16984 uint64_t RouteHop_get_fee_msat(const struct LDKRouteHop *NONNULL_PTR this_ptr);
16985
16986 /**
16987  * The fee taken on this hop (for paying for the use of the *next* channel in the path).
16988  * For the last hop, this should be the full value of the payment (might be more than
16989  * requested if we had to match htlc_minimum_msat).
16990  */
16991 void RouteHop_set_fee_msat(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val);
16992
16993 /**
16994  * The CLTV delta added for this hop. For the last hop, this should be the full CLTV value
16995  * expected at the destination, in excess of the current block height.
16996  */
16997 uint32_t RouteHop_get_cltv_expiry_delta(const struct LDKRouteHop *NONNULL_PTR this_ptr);
16998
16999 /**
17000  * The CLTV delta added for this hop. For the last hop, this should be the full CLTV value
17001  * expected at the destination, in excess of the current block height.
17002  */
17003 void RouteHop_set_cltv_expiry_delta(struct LDKRouteHop *NONNULL_PTR this_ptr, uint32_t val);
17004
17005 /**
17006  * Constructs a new RouteHop given each field
17007  */
17008 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);
17009
17010 /**
17011  * Creates a copy of the RouteHop
17012  */
17013 struct LDKRouteHop RouteHop_clone(const struct LDKRouteHop *NONNULL_PTR orig);
17014
17015 /**
17016  * Serialize the RouteHop object into a byte array which can be read by RouteHop_read
17017  */
17018 struct LDKCVec_u8Z RouteHop_write(const struct LDKRouteHop *NONNULL_PTR obj);
17019
17020 /**
17021  * Read a RouteHop from a byte array, created by RouteHop_write
17022  */
17023 struct LDKCResult_RouteHopDecodeErrorZ RouteHop_read(struct LDKu8slice ser);
17024
17025 /**
17026  * Frees any resources used by the Route, if is_owned is set and inner is non-NULL.
17027  */
17028 void Route_free(struct LDKRoute this_obj);
17029
17030 /**
17031  * The list of routes taken for a single (potentially-)multi-part payment. The pubkey of the
17032  * last RouteHop in each path must be the same.
17033  * Each entry represents a list of hops, NOT INCLUDING our own, where the last hop is the
17034  * destination. Thus, this must always be at least length one. While the maximum length of any
17035  * given path is variable, keeping the length of any path to less than 20 should currently
17036  * ensure it is viable.
17037  */
17038 void Route_set_paths(struct LDKRoute *NONNULL_PTR this_ptr, struct LDKCVec_CVec_RouteHopZZ val);
17039
17040 /**
17041  * Constructs a new Route given each field
17042  */
17043 MUST_USE_RES struct LDKRoute Route_new(struct LDKCVec_CVec_RouteHopZZ paths_arg);
17044
17045 /**
17046  * Creates a copy of the Route
17047  */
17048 struct LDKRoute Route_clone(const struct LDKRoute *NONNULL_PTR orig);
17049
17050 /**
17051  * Serialize the Route object into a byte array which can be read by Route_read
17052  */
17053 struct LDKCVec_u8Z Route_write(const struct LDKRoute *NONNULL_PTR obj);
17054
17055 /**
17056  * Read a Route from a byte array, created by Route_write
17057  */
17058 struct LDKCResult_RouteDecodeErrorZ Route_read(struct LDKu8slice ser);
17059
17060 /**
17061  * Frees any resources used by the RouteHintHop, if is_owned is set and inner is non-NULL.
17062  */
17063 void RouteHintHop_free(struct LDKRouteHintHop this_obj);
17064
17065 /**
17066  * The node_id of the non-target end of the route
17067  */
17068 struct LDKPublicKey RouteHintHop_get_src_node_id(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
17069
17070 /**
17071  * The node_id of the non-target end of the route
17072  */
17073 void RouteHintHop_set_src_node_id(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKPublicKey val);
17074
17075 /**
17076  * The short_channel_id of this channel
17077  */
17078 uint64_t RouteHintHop_get_short_channel_id(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
17079
17080 /**
17081  * The short_channel_id of this channel
17082  */
17083 void RouteHintHop_set_short_channel_id(struct LDKRouteHintHop *NONNULL_PTR this_ptr, uint64_t val);
17084
17085 /**
17086  * The fees which must be paid to use this channel
17087  */
17088 struct LDKRoutingFees RouteHintHop_get_fees(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
17089
17090 /**
17091  * The fees which must be paid to use this channel
17092  */
17093 void RouteHintHop_set_fees(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
17094
17095 /**
17096  * The difference in CLTV values between this node and the next node.
17097  */
17098 uint16_t RouteHintHop_get_cltv_expiry_delta(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
17099
17100 /**
17101  * The difference in CLTV values between this node and the next node.
17102  */
17103 void RouteHintHop_set_cltv_expiry_delta(struct LDKRouteHintHop *NONNULL_PTR this_ptr, uint16_t val);
17104
17105 /**
17106  * The minimum value, in msat, which must be relayed to the next hop.
17107  */
17108 struct LDKCOption_u64Z RouteHintHop_get_htlc_minimum_msat(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
17109
17110 /**
17111  * The minimum value, in msat, which must be relayed to the next hop.
17112  */
17113 void RouteHintHop_set_htlc_minimum_msat(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
17114
17115 /**
17116  * The maximum value in msat available for routing with a single HTLC.
17117  */
17118 struct LDKCOption_u64Z RouteHintHop_get_htlc_maximum_msat(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
17119
17120 /**
17121  * The maximum value in msat available for routing with a single HTLC.
17122  */
17123 void RouteHintHop_set_htlc_maximum_msat(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
17124
17125 /**
17126  * Constructs a new RouteHintHop given each field
17127  */
17128 MUST_USE_RES struct LDKRouteHintHop RouteHintHop_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);
17129
17130 /**
17131  * Checks if two RouteHintHops contain equal inner contents.
17132  * This ignores pointers and is_owned flags and looks at the values in fields.
17133  * Two objects with NULL inner values will be considered "equal" here.
17134  */
17135 bool RouteHintHop_eq(const struct LDKRouteHintHop *NONNULL_PTR a, const struct LDKRouteHintHop *NONNULL_PTR b);
17136
17137 /**
17138  * Creates a copy of the RouteHintHop
17139  */
17140 struct LDKRouteHintHop RouteHintHop_clone(const struct LDKRouteHintHop *NONNULL_PTR orig);
17141
17142 /**
17143  * Gets a route from us (payer) to the given target node (payee).
17144  *
17145  * If the payee provided features in their invoice, they should be provided via payee_features.
17146  * Without this, MPP will only be used if the payee's features are available in the network graph.
17147  *
17148  * Extra routing hops between known nodes and the target will be used if they are included in
17149  * last_hops.
17150  *
17151  * If some channels aren't announced, it may be useful to fill in a first_hops with the
17152  * results from a local ChannelManager::list_usable_channels() call. If it is filled in, our
17153  * view of our local channels (from net_graph_msg_handler) will be ignored, and only those
17154  * in first_hops will be used.
17155  *
17156  * Panics if first_hops contains channels without short_channel_ids
17157  * (ChannelManager::list_usable_channels will never include such channels).
17158  *
17159  * The fees on channels from us to next-hops are ignored (as they are assumed to all be
17160  * equal), however the enabled/disabled bit on such channels as well as the
17161  * htlc_minimum_msat/htlc_maximum_msat *are* checked as they may change based on the receiving node.
17162  */
17163 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_RouteHintHopZ last_hops, uint64_t final_value_msat, uint32_t final_cltv, struct LDKLogger logger);
17164
17165 /**
17166  * Frees any resources used by the NetworkGraph, if is_owned is set and inner is non-NULL.
17167  */
17168 void NetworkGraph_free(struct LDKNetworkGraph this_obj);
17169
17170 /**
17171  * Creates a copy of the NetworkGraph
17172  */
17173 struct LDKNetworkGraph NetworkGraph_clone(const struct LDKNetworkGraph *NONNULL_PTR orig);
17174
17175 /**
17176  * Frees any resources used by the LockedNetworkGraph, if is_owned is set and inner is non-NULL.
17177  */
17178 void LockedNetworkGraph_free(struct LDKLockedNetworkGraph this_obj);
17179
17180 /**
17181  * Frees any resources used by the NetGraphMsgHandler, if is_owned is set and inner is non-NULL.
17182  */
17183 void NetGraphMsgHandler_free(struct LDKNetGraphMsgHandler this_obj);
17184
17185 /**
17186  * Creates a new tracker of the actual state of the network of channels and nodes,
17187  * assuming a fresh network graph.
17188  * Chain monitor is used to make sure announced channels exist on-chain,
17189  * channel data is correct, and that the announcement is signed with
17190  * channel owners' keys.
17191  */
17192 MUST_USE_RES struct LDKNetGraphMsgHandler NetGraphMsgHandler_new(struct LDKThirtyTwoBytes genesis_hash, struct LDKAccess *chain_access, struct LDKLogger logger);
17193
17194 /**
17195  * Creates a new tracker of the actual state of the network of channels and nodes,
17196  * assuming an existing Network Graph.
17197  */
17198 MUST_USE_RES struct LDKNetGraphMsgHandler NetGraphMsgHandler_from_net_graph(struct LDKAccess *chain_access, struct LDKLogger logger, struct LDKNetworkGraph network_graph);
17199
17200 /**
17201  * Adds a provider used to check new announcements. Does not affect
17202  * existing announcements unless they are updated.
17203  * Add, update or remove the provider would replace the current one.
17204  */
17205 void NetGraphMsgHandler_add_chain_access(struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg, struct LDKAccess *chain_access);
17206
17207 /**
17208  * Take a read lock on the network_graph and return it in the C-bindings
17209  * newtype helper. This is likely only useful when called via the C
17210  * bindings as you can call `self.network_graph.read().unwrap()` in Rust
17211  * yourself.
17212  */
17213 MUST_USE_RES struct LDKLockedNetworkGraph NetGraphMsgHandler_read_locked_graph(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg);
17214
17215 /**
17216  * Get a reference to the NetworkGraph which this read-lock contains.
17217  */
17218 MUST_USE_RES struct LDKNetworkGraph LockedNetworkGraph_graph(const struct LDKLockedNetworkGraph *NONNULL_PTR this_arg);
17219
17220 /**
17221  * Constructs a new RoutingMessageHandler which calls the relevant methods on this_arg.
17222  * This copies the `inner` pointer in this_arg and thus the returned RoutingMessageHandler must be freed before this_arg is
17223  */
17224 struct LDKRoutingMessageHandler NetGraphMsgHandler_as_RoutingMessageHandler(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg);
17225
17226 /**
17227  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
17228  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
17229  */
17230 struct LDKMessageSendEventsProvider NetGraphMsgHandler_as_MessageSendEventsProvider(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg);
17231
17232 /**
17233  * Frees any resources used by the DirectionalChannelInfo, if is_owned is set and inner is non-NULL.
17234  */
17235 void DirectionalChannelInfo_free(struct LDKDirectionalChannelInfo this_obj);
17236
17237 /**
17238  * When the last update to the channel direction was issued.
17239  * Value is opaque, as set in the announcement.
17240  */
17241 uint32_t DirectionalChannelInfo_get_last_update(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
17242
17243 /**
17244  * When the last update to the channel direction was issued.
17245  * Value is opaque, as set in the announcement.
17246  */
17247 void DirectionalChannelInfo_set_last_update(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, uint32_t val);
17248
17249 /**
17250  * Whether the channel can be currently used for payments (in this one direction).
17251  */
17252 bool DirectionalChannelInfo_get_enabled(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
17253
17254 /**
17255  * Whether the channel can be currently used for payments (in this one direction).
17256  */
17257 void DirectionalChannelInfo_set_enabled(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, bool val);
17258
17259 /**
17260  * The difference in CLTV values that you must have when routing through this channel.
17261  */
17262 uint16_t DirectionalChannelInfo_get_cltv_expiry_delta(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
17263
17264 /**
17265  * The difference in CLTV values that you must have when routing through this channel.
17266  */
17267 void DirectionalChannelInfo_set_cltv_expiry_delta(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, uint16_t val);
17268
17269 /**
17270  * The minimum value, which must be relayed to the next hop via the channel
17271  */
17272 uint64_t DirectionalChannelInfo_get_htlc_minimum_msat(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
17273
17274 /**
17275  * The minimum value, which must be relayed to the next hop via the channel
17276  */
17277 void DirectionalChannelInfo_set_htlc_minimum_msat(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, uint64_t val);
17278
17279 /**
17280  * The maximum value which may be relayed to the next hop via the channel.
17281  */
17282 struct LDKCOption_u64Z DirectionalChannelInfo_get_htlc_maximum_msat(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
17283
17284 /**
17285  * The maximum value which may be relayed to the next hop via the channel.
17286  */
17287 void DirectionalChannelInfo_set_htlc_maximum_msat(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
17288
17289 /**
17290  * Fees charged when the channel is used for routing
17291  */
17292 struct LDKRoutingFees DirectionalChannelInfo_get_fees(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
17293
17294 /**
17295  * Fees charged when the channel is used for routing
17296  */
17297 void DirectionalChannelInfo_set_fees(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
17298
17299 /**
17300  * Most recent update for the channel received from the network
17301  * Mostly redundant with the data we store in fields explicitly.
17302  * Everything else is useful only for sending out for initial routing sync.
17303  * Not stored if contains excess data to prevent DoS.
17304  */
17305 struct LDKChannelUpdate DirectionalChannelInfo_get_last_update_message(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
17306
17307 /**
17308  * Most recent update for the channel received from the network
17309  * Mostly redundant with the data we store in fields explicitly.
17310  * Everything else is useful only for sending out for initial routing sync.
17311  * Not stored if contains excess data to prevent DoS.
17312  */
17313 void DirectionalChannelInfo_set_last_update_message(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelUpdate val);
17314
17315 /**
17316  * Constructs a new DirectionalChannelInfo given each field
17317  */
17318 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);
17319
17320 /**
17321  * Creates a copy of the DirectionalChannelInfo
17322  */
17323 struct LDKDirectionalChannelInfo DirectionalChannelInfo_clone(const struct LDKDirectionalChannelInfo *NONNULL_PTR orig);
17324
17325 /**
17326  * Serialize the DirectionalChannelInfo object into a byte array which can be read by DirectionalChannelInfo_read
17327  */
17328 struct LDKCVec_u8Z DirectionalChannelInfo_write(const struct LDKDirectionalChannelInfo *NONNULL_PTR obj);
17329
17330 /**
17331  * Read a DirectionalChannelInfo from a byte array, created by DirectionalChannelInfo_write
17332  */
17333 struct LDKCResult_DirectionalChannelInfoDecodeErrorZ DirectionalChannelInfo_read(struct LDKu8slice ser);
17334
17335 /**
17336  * Frees any resources used by the ChannelInfo, if is_owned is set and inner is non-NULL.
17337  */
17338 void ChannelInfo_free(struct LDKChannelInfo this_obj);
17339
17340 /**
17341  * Protocol features of a channel communicated during its announcement
17342  */
17343 struct LDKChannelFeatures ChannelInfo_get_features(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
17344
17345 /**
17346  * Protocol features of a channel communicated during its announcement
17347  */
17348 void ChannelInfo_set_features(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
17349
17350 /**
17351  * Source node of the first direction of a channel
17352  */
17353 struct LDKPublicKey ChannelInfo_get_node_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
17354
17355 /**
17356  * Source node of the first direction of a channel
17357  */
17358 void ChannelInfo_set_node_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKPublicKey val);
17359
17360 /**
17361  * Details about the first direction of a channel
17362  */
17363 struct LDKDirectionalChannelInfo ChannelInfo_get_one_to_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
17364
17365 /**
17366  * Details about the first direction of a channel
17367  */
17368 void ChannelInfo_set_one_to_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKDirectionalChannelInfo val);
17369
17370 /**
17371  * Source node of the second direction of a channel
17372  */
17373 struct LDKPublicKey ChannelInfo_get_node_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
17374
17375 /**
17376  * Source node of the second direction of a channel
17377  */
17378 void ChannelInfo_set_node_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKPublicKey val);
17379
17380 /**
17381  * Details about the second direction of a channel
17382  */
17383 struct LDKDirectionalChannelInfo ChannelInfo_get_two_to_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
17384
17385 /**
17386  * Details about the second direction of a channel
17387  */
17388 void ChannelInfo_set_two_to_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKDirectionalChannelInfo val);
17389
17390 /**
17391  * The channel capacity as seen on-chain, if chain lookup is available.
17392  */
17393 struct LDKCOption_u64Z ChannelInfo_get_capacity_sats(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
17394
17395 /**
17396  * The channel capacity as seen on-chain, if chain lookup is available.
17397  */
17398 void ChannelInfo_set_capacity_sats(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
17399
17400 /**
17401  * An initial announcement of the channel
17402  * Mostly redundant with the data we store in fields explicitly.
17403  * Everything else is useful only for sending out for initial routing sync.
17404  * Not stored if contains excess data to prevent DoS.
17405  */
17406 struct LDKChannelAnnouncement ChannelInfo_get_announcement_message(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
17407
17408 /**
17409  * An initial announcement of the channel
17410  * Mostly redundant with the data we store in fields explicitly.
17411  * Everything else is useful only for sending out for initial routing sync.
17412  * Not stored if contains excess data to prevent DoS.
17413  */
17414 void ChannelInfo_set_announcement_message(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelAnnouncement val);
17415
17416 /**
17417  * Constructs a new ChannelInfo given each field
17418  */
17419 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);
17420
17421 /**
17422  * Creates a copy of the ChannelInfo
17423  */
17424 struct LDKChannelInfo ChannelInfo_clone(const struct LDKChannelInfo *NONNULL_PTR orig);
17425
17426 /**
17427  * Serialize the ChannelInfo object into a byte array which can be read by ChannelInfo_read
17428  */
17429 struct LDKCVec_u8Z ChannelInfo_write(const struct LDKChannelInfo *NONNULL_PTR obj);
17430
17431 /**
17432  * Read a ChannelInfo from a byte array, created by ChannelInfo_write
17433  */
17434 struct LDKCResult_ChannelInfoDecodeErrorZ ChannelInfo_read(struct LDKu8slice ser);
17435
17436 /**
17437  * Frees any resources used by the RoutingFees, if is_owned is set and inner is non-NULL.
17438  */
17439 void RoutingFees_free(struct LDKRoutingFees this_obj);
17440
17441 /**
17442  * Flat routing fee in satoshis
17443  */
17444 uint32_t RoutingFees_get_base_msat(const struct LDKRoutingFees *NONNULL_PTR this_ptr);
17445
17446 /**
17447  * Flat routing fee in satoshis
17448  */
17449 void RoutingFees_set_base_msat(struct LDKRoutingFees *NONNULL_PTR this_ptr, uint32_t val);
17450
17451 /**
17452  * Liquidity-based routing fee in millionths of a routed amount.
17453  * In other words, 10000 is 1%.
17454  */
17455 uint32_t RoutingFees_get_proportional_millionths(const struct LDKRoutingFees *NONNULL_PTR this_ptr);
17456
17457 /**
17458  * Liquidity-based routing fee in millionths of a routed amount.
17459  * In other words, 10000 is 1%.
17460  */
17461 void RoutingFees_set_proportional_millionths(struct LDKRoutingFees *NONNULL_PTR this_ptr, uint32_t val);
17462
17463 /**
17464  * Constructs a new RoutingFees given each field
17465  */
17466 MUST_USE_RES struct LDKRoutingFees RoutingFees_new(uint32_t base_msat_arg, uint32_t proportional_millionths_arg);
17467
17468 /**
17469  * Checks if two RoutingFeess contain equal inner contents.
17470  * This ignores pointers and is_owned flags and looks at the values in fields.
17471  * Two objects with NULL inner values will be considered "equal" here.
17472  */
17473 bool RoutingFees_eq(const struct LDKRoutingFees *NONNULL_PTR a, const struct LDKRoutingFees *NONNULL_PTR b);
17474
17475 /**
17476  * Creates a copy of the RoutingFees
17477  */
17478 struct LDKRoutingFees RoutingFees_clone(const struct LDKRoutingFees *NONNULL_PTR orig);
17479
17480 /**
17481  * Serialize the RoutingFees object into a byte array which can be read by RoutingFees_read
17482  */
17483 struct LDKCVec_u8Z RoutingFees_write(const struct LDKRoutingFees *NONNULL_PTR obj);
17484
17485 /**
17486  * Read a RoutingFees from a byte array, created by RoutingFees_write
17487  */
17488 struct LDKCResult_RoutingFeesDecodeErrorZ RoutingFees_read(struct LDKu8slice ser);
17489
17490 /**
17491  * Frees any resources used by the NodeAnnouncementInfo, if is_owned is set and inner is non-NULL.
17492  */
17493 void NodeAnnouncementInfo_free(struct LDKNodeAnnouncementInfo this_obj);
17494
17495 /**
17496  * Protocol features the node announced support for
17497  */
17498 struct LDKNodeFeatures NodeAnnouncementInfo_get_features(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
17499
17500 /**
17501  * Protocol features the node announced support for
17502  */
17503 void NodeAnnouncementInfo_set_features(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
17504
17505 /**
17506  * When the last known update to the node state was issued.
17507  * Value is opaque, as set in the announcement.
17508  */
17509 uint32_t NodeAnnouncementInfo_get_last_update(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
17510
17511 /**
17512  * When the last known update to the node state was issued.
17513  * Value is opaque, as set in the announcement.
17514  */
17515 void NodeAnnouncementInfo_set_last_update(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, uint32_t val);
17516
17517 /**
17518  * Color assigned to the node
17519  */
17520 const uint8_t (*NodeAnnouncementInfo_get_rgb(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr))[3];
17521
17522 /**
17523  * Color assigned to the node
17524  */
17525 void NodeAnnouncementInfo_set_rgb(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKThreeBytes val);
17526
17527 /**
17528  * Moniker assigned to the node.
17529  * May be invalid or malicious (eg control chars),
17530  * should not be exposed to the user.
17531  */
17532 const uint8_t (*NodeAnnouncementInfo_get_alias(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr))[32];
17533
17534 /**
17535  * Moniker assigned to the node.
17536  * May be invalid or malicious (eg control chars),
17537  * should not be exposed to the user.
17538  */
17539 void NodeAnnouncementInfo_set_alias(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
17540
17541 /**
17542  * Internet-level addresses via which one can connect to the node
17543  */
17544 void NodeAnnouncementInfo_set_addresses(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKCVec_NetAddressZ val);
17545
17546 /**
17547  * An initial announcement of the node
17548  * Mostly redundant with the data we store in fields explicitly.
17549  * Everything else is useful only for sending out for initial routing sync.
17550  * Not stored if contains excess data to prevent DoS.
17551  */
17552 struct LDKNodeAnnouncement NodeAnnouncementInfo_get_announcement_message(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
17553
17554 /**
17555  * An initial announcement of the node
17556  * Mostly redundant with the data we store in fields explicitly.
17557  * Everything else is useful only for sending out for initial routing sync.
17558  * Not stored if contains excess data to prevent DoS.
17559  */
17560 void NodeAnnouncementInfo_set_announcement_message(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeAnnouncement val);
17561
17562 /**
17563  * Constructs a new NodeAnnouncementInfo given each field
17564  */
17565 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);
17566
17567 /**
17568  * Creates a copy of the NodeAnnouncementInfo
17569  */
17570 struct LDKNodeAnnouncementInfo NodeAnnouncementInfo_clone(const struct LDKNodeAnnouncementInfo *NONNULL_PTR orig);
17571
17572 /**
17573  * Serialize the NodeAnnouncementInfo object into a byte array which can be read by NodeAnnouncementInfo_read
17574  */
17575 struct LDKCVec_u8Z NodeAnnouncementInfo_write(const struct LDKNodeAnnouncementInfo *NONNULL_PTR obj);
17576
17577 /**
17578  * Read a NodeAnnouncementInfo from a byte array, created by NodeAnnouncementInfo_write
17579  */
17580 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ NodeAnnouncementInfo_read(struct LDKu8slice ser);
17581
17582 /**
17583  * Frees any resources used by the NodeInfo, if is_owned is set and inner is non-NULL.
17584  */
17585 void NodeInfo_free(struct LDKNodeInfo this_obj);
17586
17587 /**
17588  * All valid channels a node has announced
17589  */
17590 void NodeInfo_set_channels(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
17591
17592 /**
17593  * Lowest fees enabling routing via any of the enabled, known channels to a node.
17594  * The two fields (flat and proportional fee) are independent,
17595  * meaning they don't have to refer to the same channel.
17596  */
17597 struct LDKRoutingFees NodeInfo_get_lowest_inbound_channel_fees(const struct LDKNodeInfo *NONNULL_PTR this_ptr);
17598
17599 /**
17600  * Lowest fees enabling routing via any of the enabled, known channels to a node.
17601  * The two fields (flat and proportional fee) are independent,
17602  * meaning they don't have to refer to the same channel.
17603  */
17604 void NodeInfo_set_lowest_inbound_channel_fees(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
17605
17606 /**
17607  * More information about a node from node_announcement.
17608  * Optional because we store a Node entry after learning about it from
17609  * a channel announcement, but before receiving a node announcement.
17610  */
17611 struct LDKNodeAnnouncementInfo NodeInfo_get_announcement_info(const struct LDKNodeInfo *NONNULL_PTR this_ptr);
17612
17613 /**
17614  * More information about a node from node_announcement.
17615  * Optional because we store a Node entry after learning about it from
17616  * a channel announcement, but before receiving a node announcement.
17617  */
17618 void NodeInfo_set_announcement_info(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKNodeAnnouncementInfo val);
17619
17620 /**
17621  * Constructs a new NodeInfo given each field
17622  */
17623 MUST_USE_RES struct LDKNodeInfo NodeInfo_new(struct LDKCVec_u64Z channels_arg, struct LDKRoutingFees lowest_inbound_channel_fees_arg, struct LDKNodeAnnouncementInfo announcement_info_arg);
17624
17625 /**
17626  * Creates a copy of the NodeInfo
17627  */
17628 struct LDKNodeInfo NodeInfo_clone(const struct LDKNodeInfo *NONNULL_PTR orig);
17629
17630 /**
17631  * Serialize the NodeInfo object into a byte array which can be read by NodeInfo_read
17632  */
17633 struct LDKCVec_u8Z NodeInfo_write(const struct LDKNodeInfo *NONNULL_PTR obj);
17634
17635 /**
17636  * Read a NodeInfo from a byte array, created by NodeInfo_write
17637  */
17638 struct LDKCResult_NodeInfoDecodeErrorZ NodeInfo_read(struct LDKu8slice ser);
17639
17640 /**
17641  * Serialize the NetworkGraph object into a byte array which can be read by NetworkGraph_read
17642  */
17643 struct LDKCVec_u8Z NetworkGraph_write(const struct LDKNetworkGraph *NONNULL_PTR obj);
17644
17645 /**
17646  * Read a NetworkGraph from a byte array, created by NetworkGraph_write
17647  */
17648 struct LDKCResult_NetworkGraphDecodeErrorZ NetworkGraph_read(struct LDKu8slice ser);
17649
17650 /**
17651  * Creates a new, empty, network graph.
17652  */
17653 MUST_USE_RES struct LDKNetworkGraph NetworkGraph_new(struct LDKThirtyTwoBytes genesis_hash);
17654
17655 /**
17656  * For an already known node (from channel announcements), update its stored properties from a
17657  * given node announcement.
17658  *
17659  * You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's
17660  * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
17661  * routing messages from a source using a protocol other than the lightning P2P protocol.
17662  */
17663 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_node_from_announcement(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKNodeAnnouncement *NONNULL_PTR msg);
17664
17665 /**
17666  * For an already known node (from channel announcements), update its stored properties from a
17667  * given node announcement without verifying the associated signatures. Because we aren't
17668  * given the associated signatures here we cannot relay the node announcement to any of our
17669  * peers.
17670  */
17671 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_node_from_unsigned_announcement(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR msg);
17672
17673 /**
17674  * Store or update channel info from a channel announcement.
17675  *
17676  * You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's
17677  * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
17678  * routing messages from a source using a protocol other than the lightning P2P protocol.
17679  *
17680  * If a `chain::Access` object is provided via `chain_access`, it will be called to verify
17681  * the corresponding UTXO exists on chain and is correctly-formatted.
17682  */
17683 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);
17684
17685 /**
17686  * Store or update channel info from a channel announcement without verifying the associated
17687  * signatures. Because we aren't given the associated signatures here we cannot relay the
17688  * channel announcement to any of our peers.
17689  *
17690  * If a `chain::Access` object is provided via `chain_access`, it will be called to verify
17691  * the corresponding UTXO exists on chain and is correctly-formatted.
17692  */
17693 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);
17694
17695 /**
17696  * Close a channel if a corresponding HTLC fail was sent.
17697  * If permanent, removes a channel from the local storage.
17698  * May cause the removal of nodes too, if this was their last channel.
17699  * If not permanent, makes channels unavailable for routing.
17700  */
17701 void NetworkGraph_close_channel_from_update(struct LDKNetworkGraph *NONNULL_PTR this_arg, uint64_t short_channel_id, bool is_permanent);
17702
17703 /**
17704  * For an already known (from announcement) channel, update info about one of the directions
17705  * of the channel.
17706  *
17707  * You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's
17708  * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
17709  * routing messages from a source using a protocol other than the lightning P2P protocol.
17710  */
17711 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg);
17712
17713 /**
17714  * For an already known (from announcement) channel, update info about one of the directions
17715  * of the channel without verifying the associated signatures. Because we aren't given the
17716  * associated signatures here we cannot relay the channel update to any of our peers.
17717  */
17718 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_unsigned(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedChannelUpdate *NONNULL_PTR msg);
17719
17720 /**
17721  * Frees any resources used by the FilesystemPersister, if is_owned is set and inner is non-NULL.
17722  */
17723 void FilesystemPersister_free(struct LDKFilesystemPersister this_obj);
17724
17725 /**
17726  * Initialize a new FilesystemPersister and set the path to the individual channels'
17727  * files.
17728  */
17729 MUST_USE_RES struct LDKFilesystemPersister FilesystemPersister_new(struct LDKStr path_to_channel_data);
17730
17731 /**
17732  * Get the directory which was provided when this persister was initialized.
17733  */
17734 MUST_USE_RES struct LDKStr FilesystemPersister_get_data_dir(const struct LDKFilesystemPersister *NONNULL_PTR this_arg);
17735
17736 /**
17737  * Writes the provided `ChannelManager` to the path provided at `FilesystemPersister`
17738  * initialization, within a file called \"manager\".
17739  */
17740 MUST_USE_RES struct LDKCResult_NoneErrorZ FilesystemPersister_persist_manager(struct LDKStr data_dir, const struct LDKChannelManager *NONNULL_PTR manager);
17741
17742 /**
17743  * Read `ChannelMonitor`s from disk.
17744  */
17745 MUST_USE_RES struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ FilesystemPersister_read_channelmonitors(const struct LDKFilesystemPersister *NONNULL_PTR this_arg, struct LDKKeysInterface keys_manager);
17746
17747 /**
17748  * Constructs a new Persist which calls the relevant methods on this_arg.
17749  * This copies the `inner` pointer in this_arg and thus the returned Persist must be freed before this_arg is
17750  */
17751 struct LDKPersist FilesystemPersister_as_Persist(const struct LDKFilesystemPersister *NONNULL_PTR this_arg);
17752
17753 /**
17754  * Frees any resources used by the BackgroundProcessor, if is_owned is set and inner is non-NULL.
17755  */
17756 void BackgroundProcessor_free(struct LDKBackgroundProcessor this_obj);
17757
17758 /**
17759  * Calls the free function if one is set
17760  */
17761 void ChannelManagerPersister_free(struct LDKChannelManagerPersister this_ptr);
17762
17763 /**
17764  * Start a background thread that takes care of responsibilities enumerated in the top-level
17765  * documentation.
17766  *
17767  * If `persist_manager` returns an error, then this thread will return said error (and
17768  * `start()` will need to be called again to restart the `BackgroundProcessor`). Users should
17769  * wait on [`thread_handle`]'s `join()` method to be able to tell if and when an error is
17770  * returned, or implement `persist_manager` such that an error is never returned to the
17771  * `BackgroundProcessor`
17772  *
17773  * `persist_manager` is responsible for writing out the [`ChannelManager`] to disk, and/or
17774  * uploading to one or more backup services. See [`ChannelManager::write`] for writing out a
17775  * [`ChannelManager`]. See [`FilesystemPersister::persist_manager`] for Rust-Lightning's
17776  * provided implementation.
17777  *
17778  * [`thread_handle`]: BackgroundProcessor::thread_handle
17779  * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
17780  * [`ChannelManager::write`]: lightning::ln::channelmanager::ChannelManager#impl-Writeable
17781  * [`FilesystemPersister::persist_manager`]: lightning_persister::FilesystemPersister::persist_manager
17782  */
17783 MUST_USE_RES struct LDKBackgroundProcessor BackgroundProcessor_start(struct LDKChannelManagerPersister persister, struct LDKEventHandler event_handler, const struct LDKChainMonitor *NONNULL_PTR chain_monitor, const struct LDKChannelManager *NONNULL_PTR channel_manager, const struct LDKPeerManager *NONNULL_PTR peer_manager, struct LDKLogger logger);
17784
17785 /**
17786  * Stop `BackgroundProcessor`'s thread.
17787  */
17788 MUST_USE_RES struct LDKCResult_NoneErrorZ BackgroundProcessor_stop(struct LDKBackgroundProcessor this_arg);
17789
17790 /**
17791  * **Call this function on startup to ensure that all assumptions about the platform are valid.**
17792  *
17793  * Unfortunately we have to make assumptions about the upper bounds of the `SystemTime` type on
17794  * your platform which we can't fully verify at compile time and which isn't part of it's contract.
17795  * To our best knowledge our assumptions hold for all platforms officially supported by rust, but
17796  * since this check is fast we recommend to do it anyway.
17797  *
17798  * If this function fails this is considered a bug. Please open an issue describing your
17799  * platform and stating your current system time.
17800  *
17801  * # Panics
17802  * If the check fails this function panics. By calling this function on startup you ensure that
17803  * this wont happen at an arbitrary later point in time.
17804  */
17805 void check_platform(void);
17806
17807 /**
17808  * Frees any resources used by the Invoice, if is_owned is set and inner is non-NULL.
17809  */
17810 void Invoice_free(struct LDKInvoice this_obj);
17811
17812 /**
17813  * Checks if two Invoices contain equal inner contents.
17814  * This ignores pointers and is_owned flags and looks at the values in fields.
17815  * Two objects with NULL inner values will be considered "equal" here.
17816  */
17817 bool Invoice_eq(const struct LDKInvoice *NONNULL_PTR a, const struct LDKInvoice *NONNULL_PTR b);
17818
17819 /**
17820  * Creates a copy of the Invoice
17821  */
17822 struct LDKInvoice Invoice_clone(const struct LDKInvoice *NONNULL_PTR orig);
17823
17824 /**
17825  * Frees any resources used by the SignedRawInvoice, if is_owned is set and inner is non-NULL.
17826  */
17827 void SignedRawInvoice_free(struct LDKSignedRawInvoice this_obj);
17828
17829 /**
17830  * Checks if two SignedRawInvoices contain equal inner contents.
17831  * This ignores pointers and is_owned flags and looks at the values in fields.
17832  * Two objects with NULL inner values will be considered "equal" here.
17833  */
17834 bool SignedRawInvoice_eq(const struct LDKSignedRawInvoice *NONNULL_PTR a, const struct LDKSignedRawInvoice *NONNULL_PTR b);
17835
17836 /**
17837  * Creates a copy of the SignedRawInvoice
17838  */
17839 struct LDKSignedRawInvoice SignedRawInvoice_clone(const struct LDKSignedRawInvoice *NONNULL_PTR orig);
17840
17841 /**
17842  * Frees any resources used by the RawInvoice, if is_owned is set and inner is non-NULL.
17843  */
17844 void RawInvoice_free(struct LDKRawInvoice this_obj);
17845
17846 /**
17847  * data part
17848  */
17849 struct LDKRawDataPart RawInvoice_get_data(const struct LDKRawInvoice *NONNULL_PTR this_ptr);
17850
17851 /**
17852  * data part
17853  */
17854 void RawInvoice_set_data(struct LDKRawInvoice *NONNULL_PTR this_ptr, struct LDKRawDataPart val);
17855
17856 /**
17857  * Checks if two RawInvoices contain equal inner contents.
17858  * This ignores pointers and is_owned flags and looks at the values in fields.
17859  * Two objects with NULL inner values will be considered "equal" here.
17860  */
17861 bool RawInvoice_eq(const struct LDKRawInvoice *NONNULL_PTR a, const struct LDKRawInvoice *NONNULL_PTR b);
17862
17863 /**
17864  * Creates a copy of the RawInvoice
17865  */
17866 struct LDKRawInvoice RawInvoice_clone(const struct LDKRawInvoice *NONNULL_PTR orig);
17867
17868 /**
17869  * Frees any resources used by the RawDataPart, if is_owned is set and inner is non-NULL.
17870  */
17871 void RawDataPart_free(struct LDKRawDataPart this_obj);
17872
17873 /**
17874  * generation time of the invoice
17875  */
17876 struct LDKPositiveTimestamp RawDataPart_get_timestamp(const struct LDKRawDataPart *NONNULL_PTR this_ptr);
17877
17878 /**
17879  * generation time of the invoice
17880  */
17881 void RawDataPart_set_timestamp(struct LDKRawDataPart *NONNULL_PTR this_ptr, struct LDKPositiveTimestamp val);
17882
17883 /**
17884  * Checks if two RawDataParts contain equal inner contents.
17885  * This ignores pointers and is_owned flags and looks at the values in fields.
17886  * Two objects with NULL inner values will be considered "equal" here.
17887  */
17888 bool RawDataPart_eq(const struct LDKRawDataPart *NONNULL_PTR a, const struct LDKRawDataPart *NONNULL_PTR b);
17889
17890 /**
17891  * Creates a copy of the RawDataPart
17892  */
17893 struct LDKRawDataPart RawDataPart_clone(const struct LDKRawDataPart *NONNULL_PTR orig);
17894
17895 /**
17896  * Frees any resources used by the PositiveTimestamp, if is_owned is set and inner is non-NULL.
17897  */
17898 void PositiveTimestamp_free(struct LDKPositiveTimestamp this_obj);
17899
17900 /**
17901  * Checks if two PositiveTimestamps contain equal inner contents.
17902  * This ignores pointers and is_owned flags and looks at the values in fields.
17903  * Two objects with NULL inner values will be considered "equal" here.
17904  */
17905 bool PositiveTimestamp_eq(const struct LDKPositiveTimestamp *NONNULL_PTR a, const struct LDKPositiveTimestamp *NONNULL_PTR b);
17906
17907 /**
17908  * Creates a copy of the PositiveTimestamp
17909  */
17910 struct LDKPositiveTimestamp PositiveTimestamp_clone(const struct LDKPositiveTimestamp *NONNULL_PTR orig);
17911
17912 /**
17913  * Creates a copy of the SiPrefix
17914  */
17915 enum LDKSiPrefix SiPrefix_clone(const enum LDKSiPrefix *NONNULL_PTR orig);
17916
17917 /**
17918  * Checks if two SiPrefixs contain equal inner contents.
17919  * This ignores pointers and is_owned flags and looks at the values in fields.
17920  */
17921 bool SiPrefix_eq(const enum LDKSiPrefix *NONNULL_PTR a, const enum LDKSiPrefix *NONNULL_PTR b);
17922
17923 /**
17924  * Returns the multiplier to go from a BTC value to picoBTC implied by this SiPrefix.
17925  * This is effectively 10^12 * the prefix multiplier
17926  */
17927 MUST_USE_RES uint64_t SiPrefix_multiplier(const enum LDKSiPrefix *NONNULL_PTR this_arg);
17928
17929 /**
17930  * Creates a copy of the Currency
17931  */
17932 enum LDKCurrency Currency_clone(const enum LDKCurrency *NONNULL_PTR orig);
17933
17934 /**
17935  * Checks if two Currencys contain equal inner contents.
17936  * This ignores pointers and is_owned flags and looks at the values in fields.
17937  */
17938 bool Currency_eq(const enum LDKCurrency *NONNULL_PTR a, const enum LDKCurrency *NONNULL_PTR b);
17939
17940 /**
17941  * Frees any resources used by the Sha256, if is_owned is set and inner is non-NULL.
17942  */
17943 void Sha256_free(struct LDKSha256 this_obj);
17944
17945 /**
17946  * Checks if two Sha256s contain equal inner contents.
17947  * This ignores pointers and is_owned flags and looks at the values in fields.
17948  * Two objects with NULL inner values will be considered "equal" here.
17949  */
17950 bool Sha256_eq(const struct LDKSha256 *NONNULL_PTR a, const struct LDKSha256 *NONNULL_PTR b);
17951
17952 /**
17953  * Creates a copy of the Sha256
17954  */
17955 struct LDKSha256 Sha256_clone(const struct LDKSha256 *NONNULL_PTR orig);
17956
17957 /**
17958  * Frees any resources used by the Description, if is_owned is set and inner is non-NULL.
17959  */
17960 void Description_free(struct LDKDescription this_obj);
17961
17962 /**
17963  * Checks if two Descriptions contain equal inner contents.
17964  * This ignores pointers and is_owned flags and looks at the values in fields.
17965  * Two objects with NULL inner values will be considered "equal" here.
17966  */
17967 bool Description_eq(const struct LDKDescription *NONNULL_PTR a, const struct LDKDescription *NONNULL_PTR b);
17968
17969 /**
17970  * Creates a copy of the Description
17971  */
17972 struct LDKDescription Description_clone(const struct LDKDescription *NONNULL_PTR orig);
17973
17974 /**
17975  * Frees any resources used by the PayeePubKey, if is_owned is set and inner is non-NULL.
17976  */
17977 void PayeePubKey_free(struct LDKPayeePubKey this_obj);
17978
17979 /**
17980  * Checks if two PayeePubKeys contain equal inner contents.
17981  * This ignores pointers and is_owned flags and looks at the values in fields.
17982  * Two objects with NULL inner values will be considered "equal" here.
17983  */
17984 bool PayeePubKey_eq(const struct LDKPayeePubKey *NONNULL_PTR a, const struct LDKPayeePubKey *NONNULL_PTR b);
17985
17986 /**
17987  * Creates a copy of the PayeePubKey
17988  */
17989 struct LDKPayeePubKey PayeePubKey_clone(const struct LDKPayeePubKey *NONNULL_PTR orig);
17990
17991 /**
17992  * Frees any resources used by the ExpiryTime, if is_owned is set and inner is non-NULL.
17993  */
17994 void ExpiryTime_free(struct LDKExpiryTime this_obj);
17995
17996 /**
17997  * Checks if two ExpiryTimes contain equal inner contents.
17998  * This ignores pointers and is_owned flags and looks at the values in fields.
17999  * Two objects with NULL inner values will be considered "equal" here.
18000  */
18001 bool ExpiryTime_eq(const struct LDKExpiryTime *NONNULL_PTR a, const struct LDKExpiryTime *NONNULL_PTR b);
18002
18003 /**
18004  * Creates a copy of the ExpiryTime
18005  */
18006 struct LDKExpiryTime ExpiryTime_clone(const struct LDKExpiryTime *NONNULL_PTR orig);
18007
18008 /**
18009  * Frees any resources used by the MinFinalCltvExpiry, if is_owned is set and inner is non-NULL.
18010  */
18011 void MinFinalCltvExpiry_free(struct LDKMinFinalCltvExpiry this_obj);
18012
18013 /**
18014  * Checks if two MinFinalCltvExpirys contain equal inner contents.
18015  * This ignores pointers and is_owned flags and looks at the values in fields.
18016  * Two objects with NULL inner values will be considered "equal" here.
18017  */
18018 bool MinFinalCltvExpiry_eq(const struct LDKMinFinalCltvExpiry *NONNULL_PTR a, const struct LDKMinFinalCltvExpiry *NONNULL_PTR b);
18019
18020 /**
18021  * Creates a copy of the MinFinalCltvExpiry
18022  */
18023 struct LDKMinFinalCltvExpiry MinFinalCltvExpiry_clone(const struct LDKMinFinalCltvExpiry *NONNULL_PTR orig);
18024
18025 /**
18026  * Frees any resources used by the Fallback
18027  */
18028 void Fallback_free(struct LDKFallback this_ptr);
18029
18030 /**
18031  * Creates a copy of the Fallback
18032  */
18033 struct LDKFallback Fallback_clone(const struct LDKFallback *NONNULL_PTR orig);
18034
18035 /**
18036  * Checks if two Fallbacks contain equal inner contents.
18037  * This ignores pointers and is_owned flags and looks at the values in fields.
18038  */
18039 bool Fallback_eq(const struct LDKFallback *NONNULL_PTR a, const struct LDKFallback *NONNULL_PTR b);
18040
18041 /**
18042  * Frees any resources used by the InvoiceSignature, if is_owned is set and inner is non-NULL.
18043  */
18044 void InvoiceSignature_free(struct LDKInvoiceSignature this_obj);
18045
18046 /**
18047  * Checks if two InvoiceSignatures contain equal inner contents.
18048  * This ignores pointers and is_owned flags and looks at the values in fields.
18049  * Two objects with NULL inner values will be considered "equal" here.
18050  */
18051 bool InvoiceSignature_eq(const struct LDKInvoiceSignature *NONNULL_PTR a, const struct LDKInvoiceSignature *NONNULL_PTR b);
18052
18053 /**
18054  * Creates a copy of the InvoiceSignature
18055  */
18056 struct LDKInvoiceSignature InvoiceSignature_clone(const struct LDKInvoiceSignature *NONNULL_PTR orig);
18057
18058 /**
18059  * Frees any resources used by the RouteHint, if is_owned is set and inner is non-NULL.
18060  */
18061 void RouteHint_free(struct LDKRouteHint this_obj);
18062
18063 /**
18064  * Checks if two RouteHints contain equal inner contents.
18065  * This ignores pointers and is_owned flags and looks at the values in fields.
18066  * Two objects with NULL inner values will be considered "equal" here.
18067  */
18068 bool RouteHint_eq(const struct LDKRouteHint *NONNULL_PTR a, const struct LDKRouteHint *NONNULL_PTR b);
18069
18070 /**
18071  * Creates a copy of the RouteHint
18072  */
18073 struct LDKRouteHint RouteHint_clone(const struct LDKRouteHint *NONNULL_PTR orig);
18074
18075 /**
18076  * Disassembles the `SignedRawInvoice` into its three parts:
18077  *  1. raw invoice
18078  *  2. hash of the raw invoice
18079  *  3. signature
18080  */
18081 MUST_USE_RES struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ SignedRawInvoice_into_parts(struct LDKSignedRawInvoice this_arg);
18082
18083 /**
18084  * The `RawInvoice` which was signed.
18085  */
18086 MUST_USE_RES struct LDKRawInvoice SignedRawInvoice_raw_invoice(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
18087
18088 /**
18089  * The hash of the `RawInvoice` that was signed.
18090  */
18091 MUST_USE_RES const uint8_t (*SignedRawInvoice_hash(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg))[32];
18092
18093 /**
18094  * InvoiceSignature for the invoice.
18095  */
18096 MUST_USE_RES struct LDKInvoiceSignature SignedRawInvoice_signature(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
18097
18098 /**
18099  * Recovers the public key used for signing the invoice from the recoverable signature.
18100  */
18101 MUST_USE_RES struct LDKCResult_PayeePubKeyErrorZ SignedRawInvoice_recover_payee_pub_key(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
18102
18103 /**
18104  * Checks if the signature is valid for the included payee public key or if none exists if it's
18105  * valid for the recovered signature (which should always be true?).
18106  */
18107 MUST_USE_RES bool SignedRawInvoice_check_signature(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
18108
18109 /**
18110  * Calculate the hash of the encoded `RawInvoice`
18111  */
18112 MUST_USE_RES struct LDKThirtyTwoBytes RawInvoice_hash(const struct LDKRawInvoice *NONNULL_PTR this_arg);
18113
18114 MUST_USE_RES struct LDKSha256 RawInvoice_payment_hash(const struct LDKRawInvoice *NONNULL_PTR this_arg);
18115
18116 MUST_USE_RES struct LDKDescription RawInvoice_description(const struct LDKRawInvoice *NONNULL_PTR this_arg);
18117
18118 MUST_USE_RES struct LDKPayeePubKey RawInvoice_payee_pub_key(const struct LDKRawInvoice *NONNULL_PTR this_arg);
18119
18120 MUST_USE_RES struct LDKSha256 RawInvoice_description_hash(const struct LDKRawInvoice *NONNULL_PTR this_arg);
18121
18122 MUST_USE_RES struct LDKExpiryTime RawInvoice_expiry_time(const struct LDKRawInvoice *NONNULL_PTR this_arg);
18123
18124 MUST_USE_RES struct LDKMinFinalCltvExpiry RawInvoice_min_final_cltv_expiry(const struct LDKRawInvoice *NONNULL_PTR this_arg);
18125
18126 MUST_USE_RES struct LDKThirtyTwoBytes RawInvoice_payment_secret(const struct LDKRawInvoice *NONNULL_PTR this_arg);
18127
18128 MUST_USE_RES struct LDKInvoiceFeatures RawInvoice_features(const struct LDKRawInvoice *NONNULL_PTR this_arg);
18129
18130 MUST_USE_RES struct LDKCVec_RouteHintZ RawInvoice_routes(const struct LDKRawInvoice *NONNULL_PTR this_arg);
18131
18132 MUST_USE_RES struct LDKCOption_u64Z RawInvoice_amount_pico_btc(const struct LDKRawInvoice *NONNULL_PTR this_arg);
18133
18134 MUST_USE_RES enum LDKCurrency RawInvoice_currency(const struct LDKRawInvoice *NONNULL_PTR this_arg);
18135
18136 /**
18137  * Create a new `PositiveTimestamp` from a unix timestamp in the Range
18138  * `0...SYSTEM_TIME_MAX_UNIX_TIMESTAMP - MAX_EXPIRY_TIME`, otherwise return a
18139  * `CreationError::TimestampOutOfBounds`.
18140  */
18141 MUST_USE_RES struct LDKCResult_PositiveTimestampCreationErrorZ PositiveTimestamp_from_unix_timestamp(uint64_t unix_seconds);
18142
18143 /**
18144  * Create a new `PositiveTimestamp` from a `SystemTime` with a corresponding unix timestamp in
18145  * the Range `0...SYSTEM_TIME_MAX_UNIX_TIMESTAMP - MAX_EXPIRY_TIME`, otherwise return a
18146  * `CreationError::TimestampOutOfBounds`.
18147  */
18148 MUST_USE_RES struct LDKCResult_PositiveTimestampCreationErrorZ PositiveTimestamp_from_system_time(uint64_t time);
18149
18150 /**
18151  * Returns the UNIX timestamp representing the stored time
18152  */
18153 MUST_USE_RES uint64_t PositiveTimestamp_as_unix_timestamp(const struct LDKPositiveTimestamp *NONNULL_PTR this_arg);
18154
18155 /**
18156  * Returns a reference to the internal `SystemTime` time representation
18157  */
18158 MUST_USE_RES uint64_t PositiveTimestamp_as_time(const struct LDKPositiveTimestamp *NONNULL_PTR this_arg);
18159
18160 /**
18161  * Transform the `Invoice` into it's unchecked version
18162  */
18163 MUST_USE_RES struct LDKSignedRawInvoice Invoice_into_signed_raw(struct LDKInvoice this_arg);
18164
18165 /**
18166  * Check that the invoice is signed correctly and that key recovery works
18167  */
18168 MUST_USE_RES struct LDKCResult_NoneSemanticErrorZ Invoice_check_signature(const struct LDKInvoice *NONNULL_PTR this_arg);
18169
18170 /**
18171  * Constructs an `Invoice` from a `SignedInvoice` by checking all its invariants.
18172  * ```
18173  * use lightning_invoice::*;
18174  *
18175  * let invoice = \"lnbc1pvjluezpp5qqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqypqdp\\
18176  * \tl2pkx2ctnv5sxxmmwwd5kgetjypeh2ursdae8g6twvus8g6rfwvs8qun0dfjkxaq8rkx3yf5tcsyz3d7\\
18177  * \t3gafnh3cax9rn449d9p5uxz9ezhhypd0elx87sjle52x86fux2ypatgddc6k63n7erqz25le42c4u4ec\\
18178  * \tky03ylcqca784w\";
18179  *
18180  * let signed = invoice.parse::<SignedRawInvoice>().unwrap();
18181  *
18182  * assert!(Invoice::from_signed(signed).is_ok());
18183  * ```
18184  */
18185 MUST_USE_RES struct LDKCResult_InvoiceSemanticErrorZ Invoice_from_signed(struct LDKSignedRawInvoice signed_invoice);
18186
18187 /**
18188  * Returns the `Invoice`'s timestamp (should equal it's creation time)
18189  */
18190 MUST_USE_RES uint64_t Invoice_timestamp(const struct LDKInvoice *NONNULL_PTR this_arg);
18191
18192 /**
18193  * Returns the hash to which we will receive the preimage on completion of the payment
18194  */
18195 MUST_USE_RES const uint8_t (*Invoice_payment_hash(const struct LDKInvoice *NONNULL_PTR this_arg))[32];
18196
18197 /**
18198  * Get the payee's public key if one was included in the invoice
18199  */
18200 MUST_USE_RES struct LDKPublicKey Invoice_payee_pub_key(const struct LDKInvoice *NONNULL_PTR this_arg);
18201
18202 /**
18203  * Get the payment secret if one was included in the invoice
18204  */
18205 MUST_USE_RES struct LDKThirtyTwoBytes Invoice_payment_secret(const struct LDKInvoice *NONNULL_PTR this_arg);
18206
18207 /**
18208  * Get the invoice features if they were included in the invoice
18209  */
18210 MUST_USE_RES struct LDKInvoiceFeatures Invoice_features(const struct LDKInvoice *NONNULL_PTR this_arg);
18211
18212 /**
18213  * Recover the payee's public key (only to be used if none was included in the invoice)
18214  */
18215 MUST_USE_RES struct LDKPublicKey Invoice_recover_payee_pub_key(const struct LDKInvoice *NONNULL_PTR this_arg);
18216
18217 /**
18218  * Returns the invoice's expiry time, if present, otherwise [`DEFAULT_EXPIRY_TIME`].
18219  */
18220 MUST_USE_RES uint64_t Invoice_expiry_time(const struct LDKInvoice *NONNULL_PTR this_arg);
18221
18222 /**
18223  * Returns the invoice's `min_final_cltv_expiry` time, if present, otherwise
18224  * [`DEFAULT_MIN_FINAL_CLTV_EXPIRY`].
18225  */
18226 MUST_USE_RES uint64_t Invoice_min_final_cltv_expiry(const struct LDKInvoice *NONNULL_PTR this_arg);
18227
18228 /**
18229  * Returns a list of all routes included in the invoice
18230  */
18231 MUST_USE_RES struct LDKCVec_RouteHintZ Invoice_routes(const struct LDKInvoice *NONNULL_PTR this_arg);
18232
18233 /**
18234  * Returns the currency for which the invoice was issued
18235  */
18236 MUST_USE_RES enum LDKCurrency Invoice_currency(const struct LDKInvoice *NONNULL_PTR this_arg);
18237
18238 /**
18239  * Returns the amount if specified in the invoice as pico <currency>.
18240  */
18241 MUST_USE_RES struct LDKCOption_u64Z Invoice_amount_pico_btc(const struct LDKInvoice *NONNULL_PTR this_arg);
18242
18243 /**
18244  * Creates a new `Description` if `description` is at most 1023 __bytes__ long,
18245  * returns `CreationError::DescriptionTooLong` otherwise
18246  *
18247  * Please note that single characters may use more than one byte due to UTF8 encoding.
18248  */
18249 MUST_USE_RES struct LDKCResult_DescriptionCreationErrorZ Description_new(struct LDKStr description);
18250
18251 /**
18252  * Returns the underlying description `String`
18253  */
18254 MUST_USE_RES struct LDKStr Description_into_inner(struct LDKDescription this_arg);
18255
18256 /**
18257  * Construct an `ExpiryTime` from seconds. If there exists a `PositiveTimestamp` which would
18258  * overflow on adding the `EpiryTime` to it then this function will return a
18259  * `CreationError::ExpiryTimeOutOfBounds`.
18260  */
18261 MUST_USE_RES struct LDKCResult_ExpiryTimeCreationErrorZ ExpiryTime_from_seconds(uint64_t seconds);
18262
18263 /**
18264  * Construct an `ExpiryTime` from a `Duration`. If there exists a `PositiveTimestamp` which
18265  * would overflow on adding the `EpiryTime` to it then this function will return a
18266  * `CreationError::ExpiryTimeOutOfBounds`.
18267  */
18268 MUST_USE_RES struct LDKCResult_ExpiryTimeCreationErrorZ ExpiryTime_from_duration(uint64_t duration);
18269
18270 /**
18271  * Returns the expiry time in seconds
18272  */
18273 MUST_USE_RES uint64_t ExpiryTime_as_seconds(const struct LDKExpiryTime *NONNULL_PTR this_arg);
18274
18275 /**
18276  * Returns a reference to the underlying `Duration` (=expiry time)
18277  */
18278 MUST_USE_RES uint64_t ExpiryTime_as_duration(const struct LDKExpiryTime *NONNULL_PTR this_arg);
18279
18280 /**
18281  * Create a new (partial) route from a list of hops
18282  */
18283 MUST_USE_RES struct LDKCResult_RouteHintCreationErrorZ RouteHint_new(struct LDKCVec_RouteHintHopZ hops);
18284
18285 /**
18286  * Returrn the underlying vector of hops
18287  */
18288 MUST_USE_RES struct LDKCVec_RouteHintHopZ RouteHint_into_inner(struct LDKRouteHint this_arg);
18289
18290 /**
18291  * Creates a copy of the CreationError
18292  */
18293 enum LDKCreationError CreationError_clone(const enum LDKCreationError *NONNULL_PTR orig);
18294
18295 /**
18296  * Checks if two CreationErrors contain equal inner contents.
18297  * This ignores pointers and is_owned flags and looks at the values in fields.
18298  */
18299 bool CreationError_eq(const enum LDKCreationError *NONNULL_PTR a, const enum LDKCreationError *NONNULL_PTR b);
18300
18301 /**
18302  * Get the string representation of a CreationError object
18303  */
18304 struct LDKStr CreationError_to_str(const enum LDKCreationError *NONNULL_PTR o);
18305
18306 /**
18307  * Creates a copy of the SemanticError
18308  */
18309 enum LDKSemanticError SemanticError_clone(const enum LDKSemanticError *NONNULL_PTR orig);
18310
18311 /**
18312  * Checks if two SemanticErrors contain equal inner contents.
18313  * This ignores pointers and is_owned flags and looks at the values in fields.
18314  */
18315 bool SemanticError_eq(const enum LDKSemanticError *NONNULL_PTR a, const enum LDKSemanticError *NONNULL_PTR b);
18316
18317 /**
18318  * Get the string representation of a SemanticError object
18319  */
18320 struct LDKStr SemanticError_to_str(const enum LDKSemanticError *NONNULL_PTR o);
18321
18322 /**
18323  * Frees any resources used by the SignOrCreationError
18324  */
18325 void SignOrCreationError_free(struct LDKSignOrCreationError this_ptr);
18326
18327 /**
18328  * Creates a copy of the SignOrCreationError
18329  */
18330 struct LDKSignOrCreationError SignOrCreationError_clone(const struct LDKSignOrCreationError *NONNULL_PTR orig);
18331
18332 /**
18333  * Checks if two SignOrCreationErrors contain equal inner contents.
18334  * This ignores pointers and is_owned flags and looks at the values in fields.
18335  */
18336 bool SignOrCreationError_eq(const struct LDKSignOrCreationError *NONNULL_PTR a, const struct LDKSignOrCreationError *NONNULL_PTR b);
18337
18338 /**
18339  * Get the string representation of a SignOrCreationError object
18340  */
18341 struct LDKStr SignOrCreationError_to_str(const struct LDKSignOrCreationError *NONNULL_PTR o);
18342
18343 /**
18344  * Utility to construct an invoice. Generally, unless you want to do something like a custom
18345  * cltv_expiry, this is what you should be using to create an invoice. The reason being, this
18346  * method stores the invoice's payment secret and preimage in `ChannelManager`, so (a) the user
18347  * doesn't have to store preimage/payment secret information and (b) `ChannelManager` can verify
18348  * that the payment secret is valid when the invoice is paid.
18349  */
18350 struct LDKCResult_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager(const struct LDKChannelManager *NONNULL_PTR channelmanager, struct LDKKeysInterface keys_manager, enum LDKCurrency network, struct LDKCOption_u64Z amt_msat, struct LDKStr description);
18351
18352 /**
18353  * Read a SiPrefix object from a string
18354  */
18355 struct LDKCResult_SiPrefixNoneZ SiPrefix_from_str(struct LDKStr s);
18356
18357 /**
18358  * Read a Invoice object from a string
18359  */
18360 struct LDKCResult_InvoiceNoneZ Invoice_from_str(struct LDKStr s);
18361
18362 /**
18363  * Read a SignedRawInvoice object from a string
18364  */
18365 struct LDKCResult_SignedRawInvoiceNoneZ SignedRawInvoice_from_str(struct LDKStr s);
18366
18367 /**
18368  * Get the string representation of a Invoice object
18369  */
18370 struct LDKStr Invoice_to_str(const struct LDKInvoice *NONNULL_PTR o);
18371
18372 /**
18373  * Get the string representation of a SignedRawInvoice object
18374  */
18375 struct LDKStr SignedRawInvoice_to_str(const struct LDKSignedRawInvoice *NONNULL_PTR o);
18376
18377 /**
18378  * Get the string representation of a Currency object
18379  */
18380 struct LDKStr Currency_to_str(const enum LDKCurrency *NONNULL_PTR o);
18381
18382 /**
18383  * Get the string representation of a SiPrefix object
18384  */
18385 struct LDKStr SiPrefix_to_str(const enum LDKSiPrefix *NONNULL_PTR o);
18386
18387 #endif /* LDK_C_BINDINGS_H */
18388
18389 #include <ldk_ver.h>