Merge pull request #40 from TheBlueMatt/main
[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
168     */
169    LDKCurrency_Simnet,
170    /**
171     * Bitcoin signet
172     */
173    LDKCurrency_Signet,
174    /**
175     * Must be last for serialization purposes
176     */
177    LDKCurrency_Sentinel,
178 } LDKCurrency;
179
180 /**
181  * Represents an IO Error. Note that some information is lost in the conversion from Rust.
182  */
183 typedef enum LDKIOError {
184    LDKIOError_NotFound,
185    LDKIOError_PermissionDenied,
186    LDKIOError_ConnectionRefused,
187    LDKIOError_ConnectionReset,
188    LDKIOError_ConnectionAborted,
189    LDKIOError_NotConnected,
190    LDKIOError_AddrInUse,
191    LDKIOError_AddrNotAvailable,
192    LDKIOError_BrokenPipe,
193    LDKIOError_AlreadyExists,
194    LDKIOError_WouldBlock,
195    LDKIOError_InvalidInput,
196    LDKIOError_InvalidData,
197    LDKIOError_TimedOut,
198    LDKIOError_WriteZero,
199    LDKIOError_Interrupted,
200    LDKIOError_Other,
201    LDKIOError_UnexpectedEof,
202    /**
203     * Must be last for serialization purposes
204     */
205    LDKIOError_Sentinel,
206 } LDKIOError;
207
208 /**
209  * An enum representing the available verbosity levels of the logger.
210  */
211 typedef enum LDKLevel {
212    /**
213     * Designates very low priority, often extremely verbose, information
214     */
215    LDKLevel_Trace,
216    /**
217     * Designates lower priority information
218     */
219    LDKLevel_Debug,
220    /**
221     * Designates useful information
222     */
223    LDKLevel_Info,
224    /**
225     * Designates hazardous situations
226     */
227    LDKLevel_Warn,
228    /**
229     * Designates very serious errors
230     */
231    LDKLevel_Error,
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
1189 /**
1190  * A script pubkey for shutting down a channel as defined by [BOLT #2].
1191  *
1192  * [BOLT #2]: https://github.com/lightningnetwork/lightning-rfc/blob/master/02-peer-protocol.md
1193  */
1194 typedef struct MUST_USE_STRUCT LDKShutdownScript {
1195    /**
1196     * A pointer to the opaque Rust object.
1197     * Nearly everywhere, inner must be non-null, however in places where
1198     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1199     */
1200    LDKnativeShutdownScript *inner;
1201    /**
1202     * Indicates that this is the only struct which contains the same pointer.
1203     * Rust functions which take ownership of an object provided via an argument require
1204     * this to be true and invalidate the object pointed to by inner.
1205     */
1206    bool is_owned;
1207 } LDKShutdownScript;
1208
1209 /**
1210  * The contents of CResult_ShutdownScriptDecodeErrorZ
1211  */
1212 typedef union LDKCResult_ShutdownScriptDecodeErrorZPtr {
1213    /**
1214     * A pointer to the contents in the success state.
1215     * Reading from this pointer when `result_ok` is not set is undefined.
1216     */
1217    struct LDKShutdownScript *result;
1218    /**
1219     * A pointer to the contents in the error state.
1220     * Reading from this pointer when `result_ok` is set is undefined.
1221     */
1222    struct LDKDecodeError *err;
1223 } LDKCResult_ShutdownScriptDecodeErrorZPtr;
1224
1225 /**
1226  * A CResult_ShutdownScriptDecodeErrorZ represents the result of a fallible operation,
1227  * containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::msgs::DecodeError on failure.
1228  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1229  */
1230 typedef struct LDKCResult_ShutdownScriptDecodeErrorZ {
1231    /**
1232     * The contents of this CResult_ShutdownScriptDecodeErrorZ, accessible via either
1233     * `err` or `result` depending on the state of `result_ok`.
1234     */
1235    union LDKCResult_ShutdownScriptDecodeErrorZPtr contents;
1236    /**
1237     * Whether this CResult_ShutdownScriptDecodeErrorZ represents a success state.
1238     */
1239    bool result_ok;
1240 } LDKCResult_ShutdownScriptDecodeErrorZ;
1241
1242
1243
1244 /**
1245  * An error occurring when converting from [`Script`] to [`ShutdownScript`].
1246  */
1247 typedef struct MUST_USE_STRUCT LDKInvalidShutdownScript {
1248    /**
1249     * A pointer to the opaque Rust object.
1250     * Nearly everywhere, inner must be non-null, however in places where
1251     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1252     */
1253    LDKnativeInvalidShutdownScript *inner;
1254    /**
1255     * Indicates that this is the only struct which contains the same pointer.
1256     * Rust functions which take ownership of an object provided via an argument require
1257     * this to be true and invalidate the object pointed to by inner.
1258     */
1259    bool is_owned;
1260 } LDKInvalidShutdownScript;
1261
1262 /**
1263  * The contents of CResult_ShutdownScriptInvalidShutdownScriptZ
1264  */
1265 typedef union LDKCResult_ShutdownScriptInvalidShutdownScriptZPtr {
1266    /**
1267     * A pointer to the contents in the success state.
1268     * Reading from this pointer when `result_ok` is not set is undefined.
1269     */
1270    struct LDKShutdownScript *result;
1271    /**
1272     * A pointer to the contents in the error state.
1273     * Reading from this pointer when `result_ok` is set is undefined.
1274     */
1275    struct LDKInvalidShutdownScript *err;
1276 } LDKCResult_ShutdownScriptInvalidShutdownScriptZPtr;
1277
1278 /**
1279  * A CResult_ShutdownScriptInvalidShutdownScriptZ represents the result of a fallible operation,
1280  * containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::script::InvalidShutdownScript on failure.
1281  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1282  */
1283 typedef struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ {
1284    /**
1285     * The contents of this CResult_ShutdownScriptInvalidShutdownScriptZ, accessible via either
1286     * `err` or `result` depending on the state of `result_ok`.
1287     */
1288    union LDKCResult_ShutdownScriptInvalidShutdownScriptZPtr contents;
1289    /**
1290     * Whether this CResult_ShutdownScriptInvalidShutdownScriptZ represents a success state.
1291     */
1292    bool result_ok;
1293 } LDKCResult_ShutdownScriptInvalidShutdownScriptZ;
1294
1295 /**
1296  * The contents of CResult_NoneErrorZ
1297  */
1298 typedef union LDKCResult_NoneErrorZPtr {
1299    /**
1300     * Note that this value is always NULL, as there are no contents in the OK variant
1301     */
1302    void *result;
1303    /**
1304     * A pointer to the contents in the error state.
1305     * Reading from this pointer when `result_ok` is set is undefined.
1306     */
1307    enum LDKIOError *err;
1308 } LDKCResult_NoneErrorZPtr;
1309
1310 /**
1311  * A CResult_NoneErrorZ represents the result of a fallible operation,
1312  * containing a () on success and a crate::c_types::IOError on failure.
1313  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1314  */
1315 typedef struct LDKCResult_NoneErrorZ {
1316    /**
1317     * The contents of this CResult_NoneErrorZ, accessible via either
1318     * `err` or `result` depending on the state of `result_ok`.
1319     */
1320    union LDKCResult_NoneErrorZPtr contents;
1321    /**
1322     * Whether this CResult_NoneErrorZ represents a success state.
1323     */
1324    bool result_ok;
1325 } LDKCResult_NoneErrorZ;
1326
1327
1328
1329 /**
1330  * A hop in a route
1331  */
1332 typedef struct MUST_USE_STRUCT LDKRouteHop {
1333    /**
1334     * A pointer to the opaque Rust object.
1335     * Nearly everywhere, inner must be non-null, however in places where
1336     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1337     */
1338    LDKnativeRouteHop *inner;
1339    /**
1340     * Indicates that this is the only struct which contains the same pointer.
1341     * Rust functions which take ownership of an object provided via an argument require
1342     * this to be true and invalidate the object pointed to by inner.
1343     */
1344    bool is_owned;
1345 } LDKRouteHop;
1346
1347 /**
1348  * The contents of CResult_RouteHopDecodeErrorZ
1349  */
1350 typedef union LDKCResult_RouteHopDecodeErrorZPtr {
1351    /**
1352     * A pointer to the contents in the success state.
1353     * Reading from this pointer when `result_ok` is not set is undefined.
1354     */
1355    struct LDKRouteHop *result;
1356    /**
1357     * A pointer to the contents in the error state.
1358     * Reading from this pointer when `result_ok` is set is undefined.
1359     */
1360    struct LDKDecodeError *err;
1361 } LDKCResult_RouteHopDecodeErrorZPtr;
1362
1363 /**
1364  * A CResult_RouteHopDecodeErrorZ represents the result of a fallible operation,
1365  * containing a crate::lightning::routing::router::RouteHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
1366  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1367  */
1368 typedef struct LDKCResult_RouteHopDecodeErrorZ {
1369    /**
1370     * The contents of this CResult_RouteHopDecodeErrorZ, accessible via either
1371     * `err` or `result` depending on the state of `result_ok`.
1372     */
1373    union LDKCResult_RouteHopDecodeErrorZPtr contents;
1374    /**
1375     * Whether this CResult_RouteHopDecodeErrorZ represents a success state.
1376     */
1377    bool result_ok;
1378 } LDKCResult_RouteHopDecodeErrorZ;
1379
1380 /**
1381  * A dynamically-allocated array of crate::lightning::routing::router::RouteHops of arbitrary size.
1382  * This corresponds to std::vector in C++
1383  */
1384 typedef struct LDKCVec_RouteHopZ {
1385    /**
1386     * The elements in the array.
1387     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1388     */
1389    struct LDKRouteHop *data;
1390    /**
1391     * The number of elements pointed to by `data`.
1392     */
1393    uintptr_t datalen;
1394 } LDKCVec_RouteHopZ;
1395
1396 /**
1397  * A dynamically-allocated array of crate::c_types::derived::CVec_RouteHopZs of arbitrary size.
1398  * This corresponds to std::vector in C++
1399  */
1400 typedef struct LDKCVec_CVec_RouteHopZZ {
1401    /**
1402     * The elements in the array.
1403     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1404     */
1405    struct LDKCVec_RouteHopZ *data;
1406    /**
1407     * The number of elements pointed to by `data`.
1408     */
1409    uintptr_t datalen;
1410 } LDKCVec_CVec_RouteHopZZ;
1411
1412
1413
1414 /**
1415  * A route directs a payment from the sender (us) to the recipient. If the recipient supports MPP,
1416  * it can take multiple paths. Each path is composed of one or more hops through the network.
1417  */
1418 typedef struct MUST_USE_STRUCT LDKRoute {
1419    /**
1420     * A pointer to the opaque Rust object.
1421     * Nearly everywhere, inner must be non-null, however in places where
1422     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1423     */
1424    LDKnativeRoute *inner;
1425    /**
1426     * Indicates that this is the only struct which contains the same pointer.
1427     * Rust functions which take ownership of an object provided via an argument require
1428     * this to be true and invalidate the object pointed to by inner.
1429     */
1430    bool is_owned;
1431 } LDKRoute;
1432
1433 /**
1434  * The contents of CResult_RouteDecodeErrorZ
1435  */
1436 typedef union LDKCResult_RouteDecodeErrorZPtr {
1437    /**
1438     * A pointer to the contents in the success state.
1439     * Reading from this pointer when `result_ok` is not set is undefined.
1440     */
1441    struct LDKRoute *result;
1442    /**
1443     * A pointer to the contents in the error state.
1444     * Reading from this pointer when `result_ok` is set is undefined.
1445     */
1446    struct LDKDecodeError *err;
1447 } LDKCResult_RouteDecodeErrorZPtr;
1448
1449 /**
1450  * A CResult_RouteDecodeErrorZ represents the result of a fallible operation,
1451  * containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::DecodeError on failure.
1452  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1453  */
1454 typedef struct LDKCResult_RouteDecodeErrorZ {
1455    /**
1456     * The contents of this CResult_RouteDecodeErrorZ, accessible via either
1457     * `err` or `result` depending on the state of `result_ok`.
1458     */
1459    union LDKCResult_RouteDecodeErrorZPtr contents;
1460    /**
1461     * Whether this CResult_RouteDecodeErrorZ represents a success state.
1462     */
1463    bool result_ok;
1464 } LDKCResult_RouteDecodeErrorZ;
1465
1466 /**
1467  * An enum which can either contain a u64 or not
1468  */
1469 typedef enum LDKCOption_u64Z_Tag {
1470    /**
1471     * When we're in this state, this COption_u64Z contains a u64
1472     */
1473    LDKCOption_u64Z_Some,
1474    /**
1475     * When we're in this state, this COption_u64Z contains nothing
1476     */
1477    LDKCOption_u64Z_None,
1478    /**
1479     * Must be last for serialization purposes
1480     */
1481    LDKCOption_u64Z_Sentinel,
1482 } LDKCOption_u64Z_Tag;
1483
1484 typedef struct LDKCOption_u64Z {
1485    LDKCOption_u64Z_Tag tag;
1486    union {
1487       struct {
1488          uint64_t some;
1489       };
1490    };
1491 } LDKCOption_u64Z;
1492
1493
1494
1495 /**
1496  * Details of a channel, as returned by ChannelManager::list_channels and ChannelManager::list_usable_channels
1497  */
1498 typedef struct MUST_USE_STRUCT LDKChannelDetails {
1499    /**
1500     * A pointer to the opaque Rust object.
1501     * Nearly everywhere, inner must be non-null, however in places where
1502     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1503     */
1504    LDKnativeChannelDetails *inner;
1505    /**
1506     * Indicates that this is the only struct which contains the same pointer.
1507     * Rust functions which take ownership of an object provided via an argument require
1508     * this to be true and invalidate the object pointed to by inner.
1509     */
1510    bool is_owned;
1511 } LDKChannelDetails;
1512
1513 /**
1514  * A dynamically-allocated array of crate::lightning::ln::channelmanager::ChannelDetailss of arbitrary size.
1515  * This corresponds to std::vector in C++
1516  */
1517 typedef struct LDKCVec_ChannelDetailsZ {
1518    /**
1519     * The elements in the array.
1520     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1521     */
1522    struct LDKChannelDetails *data;
1523    /**
1524     * The number of elements pointed to by `data`.
1525     */
1526    uintptr_t datalen;
1527 } LDKCVec_ChannelDetailsZ;
1528
1529
1530
1531 /**
1532  * A list of hops along a payment path terminating with a channel to the recipient.
1533  */
1534 typedef struct MUST_USE_STRUCT LDKRouteHint {
1535    /**
1536     * A pointer to the opaque Rust object.
1537     * Nearly everywhere, inner must be non-null, however in places where
1538     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1539     */
1540    LDKnativeRouteHint *inner;
1541    /**
1542     * Indicates that this is the only struct which contains the same pointer.
1543     * Rust functions which take ownership of an object provided via an argument require
1544     * this to be true and invalidate the object pointed to by inner.
1545     */
1546    bool is_owned;
1547 } LDKRouteHint;
1548
1549 /**
1550  * A dynamically-allocated array of crate::lightning::routing::router::RouteHints of arbitrary size.
1551  * This corresponds to std::vector in C++
1552  */
1553 typedef struct LDKCVec_RouteHintZ {
1554    /**
1555     * The elements in the array.
1556     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1557     */
1558    struct LDKRouteHint *data;
1559    /**
1560     * The number of elements pointed to by `data`.
1561     */
1562    uintptr_t datalen;
1563 } LDKCVec_RouteHintZ;
1564
1565
1566
1567 /**
1568  * An Err type for failure to process messages.
1569  */
1570 typedef struct MUST_USE_STRUCT LDKLightningError {
1571    /**
1572     * A pointer to the opaque Rust object.
1573     * Nearly everywhere, inner must be non-null, however in places where
1574     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1575     */
1576    LDKnativeLightningError *inner;
1577    /**
1578     * Indicates that this is the only struct which contains the same pointer.
1579     * Rust functions which take ownership of an object provided via an argument require
1580     * this to be true and invalidate the object pointed to by inner.
1581     */
1582    bool is_owned;
1583 } LDKLightningError;
1584
1585 /**
1586  * The contents of CResult_RouteLightningErrorZ
1587  */
1588 typedef union LDKCResult_RouteLightningErrorZPtr {
1589    /**
1590     * A pointer to the contents in the success state.
1591     * Reading from this pointer when `result_ok` is not set is undefined.
1592     */
1593    struct LDKRoute *result;
1594    /**
1595     * A pointer to the contents in the error state.
1596     * Reading from this pointer when `result_ok` is set is undefined.
1597     */
1598    struct LDKLightningError *err;
1599 } LDKCResult_RouteLightningErrorZPtr;
1600
1601 /**
1602  * A CResult_RouteLightningErrorZ represents the result of a fallible operation,
1603  * containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::LightningError on failure.
1604  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1605  */
1606 typedef struct LDKCResult_RouteLightningErrorZ {
1607    /**
1608     * The contents of this CResult_RouteLightningErrorZ, accessible via either
1609     * `err` or `result` depending on the state of `result_ok`.
1610     */
1611    union LDKCResult_RouteLightningErrorZPtr contents;
1612    /**
1613     * Whether this CResult_RouteLightningErrorZ represents a success state.
1614     */
1615    bool result_ok;
1616 } LDKCResult_RouteLightningErrorZ;
1617
1618 /**
1619  * The contents of CResult_TxOutAccessErrorZ
1620  */
1621 typedef union LDKCResult_TxOutAccessErrorZPtr {
1622    /**
1623     * A pointer to the contents in the success state.
1624     * Reading from this pointer when `result_ok` is not set is undefined.
1625     */
1626    struct LDKTxOut *result;
1627    /**
1628     * A pointer to the contents in the error state.
1629     * Reading from this pointer when `result_ok` is set is undefined.
1630     */
1631    enum LDKAccessError *err;
1632 } LDKCResult_TxOutAccessErrorZPtr;
1633
1634 /**
1635  * A CResult_TxOutAccessErrorZ represents the result of a fallible operation,
1636  * containing a crate::c_types::TxOut on success and a crate::lightning::chain::AccessError on failure.
1637  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1638  */
1639 typedef struct LDKCResult_TxOutAccessErrorZ {
1640    /**
1641     * The contents of this CResult_TxOutAccessErrorZ, accessible via either
1642     * `err` or `result` depending on the state of `result_ok`.
1643     */
1644    union LDKCResult_TxOutAccessErrorZPtr contents;
1645    /**
1646     * Whether this CResult_TxOutAccessErrorZ represents a success state.
1647     */
1648    bool result_ok;
1649 } LDKCResult_TxOutAccessErrorZ;
1650
1651 /**
1652  * A tuple of 2 elements. See the individual fields for the types contained.
1653  */
1654 typedef struct LDKC2Tuple_usizeTransactionZ {
1655    /**
1656     * The element at position 0
1657     */
1658    uintptr_t a;
1659    /**
1660     * The element at position 1
1661     */
1662    struct LDKTransaction b;
1663 } LDKC2Tuple_usizeTransactionZ;
1664
1665 /**
1666  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_usizeTransactionZs of arbitrary size.
1667  * This corresponds to std::vector in C++
1668  */
1669 typedef struct LDKCVec_C2Tuple_usizeTransactionZZ {
1670    /**
1671     * The elements in the array.
1672     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1673     */
1674    struct LDKC2Tuple_usizeTransactionZ *data;
1675    /**
1676     * The number of elements pointed to by `data`.
1677     */
1678    uintptr_t datalen;
1679 } LDKCVec_C2Tuple_usizeTransactionZZ;
1680
1681 /**
1682  * Arbitrary 32 bytes, which could represent one of a few different things. You probably want to
1683  * look up the corresponding function in rust-lightning's docs.
1684  */
1685 typedef struct LDKThirtyTwoBytes {
1686    /**
1687     * The thirty-two bytes
1688     */
1689    uint8_t data[32];
1690 } LDKThirtyTwoBytes;
1691
1692 /**
1693  * A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
1694  * This corresponds to std::vector in C++
1695  */
1696 typedef struct LDKCVec_TxidZ {
1697    /**
1698     * The elements in the array.
1699     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1700     */
1701    struct LDKThirtyTwoBytes *data;
1702    /**
1703     * The number of elements pointed to by `data`.
1704     */
1705    uintptr_t datalen;
1706 } LDKCVec_TxidZ;
1707
1708 /**
1709  * The contents of CResult_NoneChannelMonitorUpdateErrZ
1710  */
1711 typedef union LDKCResult_NoneChannelMonitorUpdateErrZPtr {
1712    /**
1713     * Note that this value is always NULL, as there are no contents in the OK variant
1714     */
1715    void *result;
1716    /**
1717     * A pointer to the contents in the error state.
1718     * Reading from this pointer when `result_ok` is set is undefined.
1719     */
1720    enum LDKChannelMonitorUpdateErr *err;
1721 } LDKCResult_NoneChannelMonitorUpdateErrZPtr;
1722
1723 /**
1724  * A CResult_NoneChannelMonitorUpdateErrZ represents the result of a fallible operation,
1725  * containing a () on success and a crate::lightning::chain::channelmonitor::ChannelMonitorUpdateErr on failure.
1726  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1727  */
1728 typedef struct LDKCResult_NoneChannelMonitorUpdateErrZ {
1729    /**
1730     * The contents of this CResult_NoneChannelMonitorUpdateErrZ, accessible via either
1731     * `err` or `result` depending on the state of `result_ok`.
1732     */
1733    union LDKCResult_NoneChannelMonitorUpdateErrZPtr contents;
1734    /**
1735     * Whether this CResult_NoneChannelMonitorUpdateErrZ represents a success state.
1736     */
1737    bool result_ok;
1738 } LDKCResult_NoneChannelMonitorUpdateErrZ;
1739
1740
1741
1742 /**
1743  * Simple structure sent back by `chain::Watch` when an HTLC from a forward channel is detected on
1744  * chain. Used to update the corresponding HTLC in the backward channel. Failing to pass the
1745  * preimage claim backward will lead to loss of funds.
1746  */
1747 typedef struct MUST_USE_STRUCT LDKHTLCUpdate {
1748    /**
1749     * A pointer to the opaque Rust object.
1750     * Nearly everywhere, inner must be non-null, however in places where
1751     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1752     */
1753    LDKnativeHTLCUpdate *inner;
1754    /**
1755     * Indicates that this is the only struct which contains the same pointer.
1756     * Rust functions which take ownership of an object provided via an argument require
1757     * this to be true and invalidate the object pointed to by inner.
1758     */
1759    bool is_owned;
1760 } LDKHTLCUpdate;
1761
1762
1763
1764 /**
1765  * A reference to a transaction output.
1766  *
1767  * Differs from bitcoin::blockdata::transaction::OutPoint as the index is a u16 instead of u32
1768  * due to LN's restrictions on index values. Should reduce (possibly) unsafe conversions this way.
1769  */
1770 typedef struct MUST_USE_STRUCT LDKOutPoint {
1771    /**
1772     * A pointer to the opaque Rust object.
1773     * Nearly everywhere, inner must be non-null, however in places where
1774     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1775     */
1776    LDKnativeOutPoint *inner;
1777    /**
1778     * Indicates that this is the only struct which contains the same pointer.
1779     * Rust functions which take ownership of an object provided via an argument require
1780     * this to be true and invalidate the object pointed to by inner.
1781     */
1782    bool is_owned;
1783 } LDKOutPoint;
1784
1785 /**
1786  * An event to be processed by the ChannelManager.
1787  */
1788 typedef enum LDKMonitorEvent_Tag {
1789    /**
1790     * A monitor event containing an HTLCUpdate.
1791     */
1792    LDKMonitorEvent_HTLCEvent,
1793    /**
1794     * A monitor event that the Channel's commitment transaction was broadcasted.
1795     */
1796    LDKMonitorEvent_CommitmentTxBroadcasted,
1797    /**
1798     * Must be last for serialization purposes
1799     */
1800    LDKMonitorEvent_Sentinel,
1801 } LDKMonitorEvent_Tag;
1802
1803 typedef struct MUST_USE_STRUCT LDKMonitorEvent {
1804    LDKMonitorEvent_Tag tag;
1805    union {
1806       struct {
1807          struct LDKHTLCUpdate htlc_event;
1808       };
1809       struct {
1810          struct LDKOutPoint commitment_tx_broadcasted;
1811       };
1812    };
1813 } LDKMonitorEvent;
1814
1815 /**
1816  * A dynamically-allocated array of crate::lightning::chain::channelmonitor::MonitorEvents of arbitrary size.
1817  * This corresponds to std::vector in C++
1818  */
1819 typedef struct LDKCVec_MonitorEventZ {
1820    /**
1821     * The elements in the array.
1822     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1823     */
1824    struct LDKMonitorEvent *data;
1825    /**
1826     * The number of elements pointed to by `data`.
1827     */
1828    uintptr_t datalen;
1829 } LDKCVec_MonitorEventZ;
1830
1831 /**
1832  * An enum which can either contain a crate::c_types::derived::C2Tuple_usizeTransactionZ or not
1833  */
1834 typedef enum LDKCOption_C2Tuple_usizeTransactionZZ_Tag {
1835    /**
1836     * When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains a crate::c_types::derived::C2Tuple_usizeTransactionZ
1837     */
1838    LDKCOption_C2Tuple_usizeTransactionZZ_Some,
1839    /**
1840     * When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains nothing
1841     */
1842    LDKCOption_C2Tuple_usizeTransactionZZ_None,
1843    /**
1844     * Must be last for serialization purposes
1845     */
1846    LDKCOption_C2Tuple_usizeTransactionZZ_Sentinel,
1847 } LDKCOption_C2Tuple_usizeTransactionZZ_Tag;
1848
1849 typedef struct LDKCOption_C2Tuple_usizeTransactionZZ {
1850    LDKCOption_C2Tuple_usizeTransactionZZ_Tag tag;
1851    union {
1852       struct {
1853          struct LDKC2Tuple_usizeTransactionZ some;
1854       };
1855    };
1856 } LDKCOption_C2Tuple_usizeTransactionZZ;
1857
1858
1859
1860 /**
1861  * Information about a spendable output to a P2WSH script. See
1862  * SpendableOutputDescriptor::DelayedPaymentOutput for more details on how to spend this.
1863  */
1864 typedef struct MUST_USE_STRUCT LDKDelayedPaymentOutputDescriptor {
1865    /**
1866     * A pointer to the opaque Rust object.
1867     * Nearly everywhere, inner must be non-null, however in places where
1868     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1869     */
1870    LDKnativeDelayedPaymentOutputDescriptor *inner;
1871    /**
1872     * Indicates that this is the only struct which contains the same pointer.
1873     * Rust functions which take ownership of an object provided via an argument require
1874     * this to be true and invalidate the object pointed to by inner.
1875     */
1876    bool is_owned;
1877 } LDKDelayedPaymentOutputDescriptor;
1878
1879
1880
1881 /**
1882  * Information about a spendable output to our \"payment key\". See
1883  * SpendableOutputDescriptor::StaticPaymentOutput for more details on how to spend this.
1884  */
1885 typedef struct MUST_USE_STRUCT LDKStaticPaymentOutputDescriptor {
1886    /**
1887     * A pointer to the opaque Rust object.
1888     * Nearly everywhere, inner must be non-null, however in places where
1889     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1890     */
1891    LDKnativeStaticPaymentOutputDescriptor *inner;
1892    /**
1893     * Indicates that this is the only struct which contains the same pointer.
1894     * Rust functions which take ownership of an object provided via an argument require
1895     * this to be true and invalidate the object pointed to by inner.
1896     */
1897    bool is_owned;
1898 } LDKStaticPaymentOutputDescriptor;
1899
1900 /**
1901  * When on-chain outputs are created by rust-lightning (which our counterparty is not able to
1902  * claim at any point in the future) an event is generated which you must track and be able to
1903  * spend on-chain. The information needed to do this is provided in this enum, including the
1904  * outpoint describing which txid and output index is available, the full output which exists at
1905  * that txid/index, and any keys or other information required to sign.
1906  */
1907 typedef enum LDKSpendableOutputDescriptor_Tag {
1908    /**
1909     * An output to a script which was provided via KeysInterface directly, either from
1910     * `get_destination_script()` or `get_shutdown_scriptpubkey()`, thus you should already know
1911     * how to spend it. No secret keys are provided as rust-lightning was never given any key.
1912     * These may include outputs from a transaction punishing our counterparty or claiming an HTLC
1913     * on-chain using the payment preimage or after it has timed out.
1914     */
1915    LDKSpendableOutputDescriptor_StaticOutput,
1916    /**
1917     * An output to a P2WSH script which can be spent with a single signature after a CSV delay.
1918     *
1919     * The witness in the spending input should be:
1920     * <BIP 143 signature> <empty vector> (MINIMALIF standard rule) <provided witnessScript>
1921     *
1922     * Note that the nSequence field in the spending input must be set to to_self_delay
1923     * (which means the transaction is not broadcastable until at least to_self_delay
1924     * blocks after the outpoint confirms).
1925     *
1926     * These are generally the result of a \"revocable\" output to us, spendable only by us unless
1927     * it is an output from an old state which we broadcast (which should never happen).
1928     *
1929     * To derive the delayed_payment key which is used to sign for this input, you must pass the
1930     * holder delayed_payment_base_key (ie the private key which corresponds to the pubkey in
1931     * Sign::pubkeys().delayed_payment_basepoint) and the provided per_commitment_point to
1932     * chan_utils::derive_private_key. The public key can be generated without the secret key
1933     * using chan_utils::derive_public_key and only the delayed_payment_basepoint which appears in
1934     * Sign::pubkeys().
1935     *
1936     * To derive the revocation_pubkey provided here (which is used in the witness
1937     * script generation), you must pass the counterparty revocation_basepoint (which appears in the
1938     * call to Sign::ready_channel) and the provided per_commitment point
1939     * to chan_utils::derive_public_revocation_key.
1940     *
1941     * The witness script which is hashed and included in the output script_pubkey may be
1942     * regenerated by passing the revocation_pubkey (derived as above), our delayed_payment pubkey
1943     * (derived as above), and the to_self_delay contained here to
1944     * chan_utils::get_revokeable_redeemscript.
1945     */
1946    LDKSpendableOutputDescriptor_DelayedPaymentOutput,
1947    /**
1948     * An output to a P2WPKH, spendable exclusively by our payment key (ie the private key which
1949     * corresponds to the public key in Sign::pubkeys().payment_point).
1950     * The witness in the spending input, is, thus, simply:
1951     * <BIP 143 signature> <payment key>
1952     *
1953     * These are generally the result of our counterparty having broadcast the current state,
1954     * allowing us to claim the non-HTLC-encumbered outputs immediately.
1955     */
1956    LDKSpendableOutputDescriptor_StaticPaymentOutput,
1957    /**
1958     * Must be last for serialization purposes
1959     */
1960    LDKSpendableOutputDescriptor_Sentinel,
1961 } LDKSpendableOutputDescriptor_Tag;
1962
1963 typedef struct LDKSpendableOutputDescriptor_LDKStaticOutput_Body {
1964    /**
1965     * The outpoint which is spendable
1966     */
1967    struct LDKOutPoint outpoint;
1968    /**
1969     * The output which is referenced by the given outpoint.
1970     */
1971    struct LDKTxOut output;
1972 } LDKSpendableOutputDescriptor_LDKStaticOutput_Body;
1973
1974 typedef struct MUST_USE_STRUCT LDKSpendableOutputDescriptor {
1975    LDKSpendableOutputDescriptor_Tag tag;
1976    union {
1977       LDKSpendableOutputDescriptor_LDKStaticOutput_Body static_output;
1978       struct {
1979          struct LDKDelayedPaymentOutputDescriptor delayed_payment_output;
1980       };
1981       struct {
1982          struct LDKStaticPaymentOutputDescriptor static_payment_output;
1983       };
1984    };
1985 } LDKSpendableOutputDescriptor;
1986
1987 /**
1988  * A dynamically-allocated array of crate::lightning::chain::keysinterface::SpendableOutputDescriptors of arbitrary size.
1989  * This corresponds to std::vector in C++
1990  */
1991 typedef struct LDKCVec_SpendableOutputDescriptorZ {
1992    /**
1993     * The elements in the array.
1994     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1995     */
1996    struct LDKSpendableOutputDescriptor *data;
1997    /**
1998     * The number of elements pointed to by `data`.
1999     */
2000    uintptr_t datalen;
2001 } LDKCVec_SpendableOutputDescriptorZ;
2002
2003
2004
2005 /**
2006  * An accept_channel message to be sent or received from a peer
2007  */
2008 typedef struct MUST_USE_STRUCT LDKAcceptChannel {
2009    /**
2010     * A pointer to the opaque Rust object.
2011     * Nearly everywhere, inner must be non-null, however in places where
2012     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2013     */
2014    LDKnativeAcceptChannel *inner;
2015    /**
2016     * Indicates that this is the only struct which contains the same pointer.
2017     * Rust functions which take ownership of an object provided via an argument require
2018     * this to be true and invalidate the object pointed to by inner.
2019     */
2020    bool is_owned;
2021 } LDKAcceptChannel;
2022
2023
2024
2025 /**
2026  * An open_channel message to be sent or received from a peer
2027  */
2028 typedef struct MUST_USE_STRUCT LDKOpenChannel {
2029    /**
2030     * A pointer to the opaque Rust object.
2031     * Nearly everywhere, inner must be non-null, however in places where
2032     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2033     */
2034    LDKnativeOpenChannel *inner;
2035    /**
2036     * Indicates that this is the only struct which contains the same pointer.
2037     * Rust functions which take ownership of an object provided via an argument require
2038     * this to be true and invalidate the object pointed to by inner.
2039     */
2040    bool is_owned;
2041 } LDKOpenChannel;
2042
2043
2044
2045 /**
2046  * A funding_created message to be sent or received from a peer
2047  */
2048 typedef struct MUST_USE_STRUCT LDKFundingCreated {
2049    /**
2050     * A pointer to the opaque Rust object.
2051     * Nearly everywhere, inner must be non-null, however in places where
2052     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2053     */
2054    LDKnativeFundingCreated *inner;
2055    /**
2056     * Indicates that this is the only struct which contains the same pointer.
2057     * Rust functions which take ownership of an object provided via an argument require
2058     * this to be true and invalidate the object pointed to by inner.
2059     */
2060    bool is_owned;
2061 } LDKFundingCreated;
2062
2063
2064
2065 /**
2066  * A funding_signed message to be sent or received from a peer
2067  */
2068 typedef struct MUST_USE_STRUCT LDKFundingSigned {
2069    /**
2070     * A pointer to the opaque Rust object.
2071     * Nearly everywhere, inner must be non-null, however in places where
2072     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2073     */
2074    LDKnativeFundingSigned *inner;
2075    /**
2076     * Indicates that this is the only struct which contains the same pointer.
2077     * Rust functions which take ownership of an object provided via an argument require
2078     * this to be true and invalidate the object pointed to by inner.
2079     */
2080    bool is_owned;
2081 } LDKFundingSigned;
2082
2083
2084
2085 /**
2086  * A funding_locked message to be sent or received from a peer
2087  */
2088 typedef struct MUST_USE_STRUCT LDKFundingLocked {
2089    /**
2090     * A pointer to the opaque Rust object.
2091     * Nearly everywhere, inner must be non-null, however in places where
2092     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2093     */
2094    LDKnativeFundingLocked *inner;
2095    /**
2096     * Indicates that this is the only struct which contains the same pointer.
2097     * Rust functions which take ownership of an object provided via an argument require
2098     * this to be true and invalidate the object pointed to by inner.
2099     */
2100    bool is_owned;
2101 } LDKFundingLocked;
2102
2103
2104
2105 /**
2106  * An announcement_signatures message to be sent or received from a peer
2107  */
2108 typedef struct MUST_USE_STRUCT LDKAnnouncementSignatures {
2109    /**
2110     * A pointer to the opaque Rust object.
2111     * Nearly everywhere, inner must be non-null, however in places where
2112     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2113     */
2114    LDKnativeAnnouncementSignatures *inner;
2115    /**
2116     * Indicates that this is the only struct which contains the same pointer.
2117     * Rust functions which take ownership of an object provided via an argument require
2118     * this to be true and invalidate the object pointed to by inner.
2119     */
2120    bool is_owned;
2121 } LDKAnnouncementSignatures;
2122
2123
2124
2125 /**
2126  * Struct used to return values from revoke_and_ack messages, containing a bunch of commitment
2127  * transaction updates if they were pending.
2128  */
2129 typedef struct MUST_USE_STRUCT LDKCommitmentUpdate {
2130    /**
2131     * A pointer to the opaque Rust object.
2132     * Nearly everywhere, inner must be non-null, however in places where
2133     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2134     */
2135    LDKnativeCommitmentUpdate *inner;
2136    /**
2137     * Indicates that this is the only struct which contains the same pointer.
2138     * Rust functions which take ownership of an object provided via an argument require
2139     * this to be true and invalidate the object pointed to by inner.
2140     */
2141    bool is_owned;
2142 } LDKCommitmentUpdate;
2143
2144
2145
2146 /**
2147  * A revoke_and_ack message to be sent or received from a peer
2148  */
2149 typedef struct MUST_USE_STRUCT LDKRevokeAndACK {
2150    /**
2151     * A pointer to the opaque Rust object.
2152     * Nearly everywhere, inner must be non-null, however in places where
2153     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2154     */
2155    LDKnativeRevokeAndACK *inner;
2156    /**
2157     * Indicates that this is the only struct which contains the same pointer.
2158     * Rust functions which take ownership of an object provided via an argument require
2159     * this to be true and invalidate the object pointed to by inner.
2160     */
2161    bool is_owned;
2162 } LDKRevokeAndACK;
2163
2164
2165
2166 /**
2167  * A closing_signed message to be sent or received from a peer
2168  */
2169 typedef struct MUST_USE_STRUCT LDKClosingSigned {
2170    /**
2171     * A pointer to the opaque Rust object.
2172     * Nearly everywhere, inner must be non-null, however in places where
2173     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2174     */
2175    LDKnativeClosingSigned *inner;
2176    /**
2177     * Indicates that this is the only struct which contains the same pointer.
2178     * Rust functions which take ownership of an object provided via an argument require
2179     * this to be true and invalidate the object pointed to by inner.
2180     */
2181    bool is_owned;
2182 } LDKClosingSigned;
2183
2184
2185
2186 /**
2187  * A shutdown message to be sent or received from a peer
2188  */
2189 typedef struct MUST_USE_STRUCT LDKShutdown {
2190    /**
2191     * A pointer to the opaque Rust object.
2192     * Nearly everywhere, inner must be non-null, however in places where
2193     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2194     */
2195    LDKnativeShutdown *inner;
2196    /**
2197     * Indicates that this is the only struct which contains the same pointer.
2198     * Rust functions which take ownership of an object provided via an argument require
2199     * this to be true and invalidate the object pointed to by inner.
2200     */
2201    bool is_owned;
2202 } LDKShutdown;
2203
2204
2205
2206 /**
2207  * A channel_reestablish message to be sent or received from a peer
2208  */
2209 typedef struct MUST_USE_STRUCT LDKChannelReestablish {
2210    /**
2211     * A pointer to the opaque Rust object.
2212     * Nearly everywhere, inner must be non-null, however in places where
2213     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2214     */
2215    LDKnativeChannelReestablish *inner;
2216    /**
2217     * Indicates that this is the only struct which contains the same pointer.
2218     * Rust functions which take ownership of an object provided via an argument require
2219     * this to be true and invalidate the object pointed to by inner.
2220     */
2221    bool is_owned;
2222 } LDKChannelReestablish;
2223
2224
2225
2226 /**
2227  * A channel_announcement message to be sent or received from a peer
2228  */
2229 typedef struct MUST_USE_STRUCT LDKChannelAnnouncement {
2230    /**
2231     * A pointer to the opaque Rust object.
2232     * Nearly everywhere, inner must be non-null, however in places where
2233     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2234     */
2235    LDKnativeChannelAnnouncement *inner;
2236    /**
2237     * Indicates that this is the only struct which contains the same pointer.
2238     * Rust functions which take ownership of an object provided via an argument require
2239     * this to be true and invalidate the object pointed to by inner.
2240     */
2241    bool is_owned;
2242 } LDKChannelAnnouncement;
2243
2244
2245
2246 /**
2247  * A channel_update message to be sent or received from a peer
2248  */
2249 typedef struct MUST_USE_STRUCT LDKChannelUpdate {
2250    /**
2251     * A pointer to the opaque Rust object.
2252     * Nearly everywhere, inner must be non-null, however in places where
2253     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2254     */
2255    LDKnativeChannelUpdate *inner;
2256    /**
2257     * Indicates that this is the only struct which contains the same pointer.
2258     * Rust functions which take ownership of an object provided via an argument require
2259     * this to be true and invalidate the object pointed to by inner.
2260     */
2261    bool is_owned;
2262 } LDKChannelUpdate;
2263
2264
2265
2266 /**
2267  * A node_announcement message to be sent or received from a peer
2268  */
2269 typedef struct MUST_USE_STRUCT LDKNodeAnnouncement {
2270    /**
2271     * A pointer to the opaque Rust object.
2272     * Nearly everywhere, inner must be non-null, however in places where
2273     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2274     */
2275    LDKnativeNodeAnnouncement *inner;
2276    /**
2277     * Indicates that this is the only struct which contains the same pointer.
2278     * Rust functions which take ownership of an object provided via an argument require
2279     * this to be true and invalidate the object pointed to by inner.
2280     */
2281    bool is_owned;
2282 } LDKNodeAnnouncement;
2283
2284
2285
2286 /**
2287  * An error message to be sent or received from a peer
2288  */
2289 typedef struct MUST_USE_STRUCT LDKErrorMessage {
2290    /**
2291     * A pointer to the opaque Rust object.
2292     * Nearly everywhere, inner must be non-null, however in places where
2293     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2294     */
2295    LDKnativeErrorMessage *inner;
2296    /**
2297     * Indicates that this is the only struct which contains the same pointer.
2298     * Rust functions which take ownership of an object provided via an argument require
2299     * this to be true and invalidate the object pointed to by inner.
2300     */
2301    bool is_owned;
2302 } LDKErrorMessage;
2303
2304 /**
2305  * Used to put an error message in a LightningError
2306  */
2307 typedef enum LDKErrorAction_Tag {
2308    /**
2309     * The peer took some action which made us think they were useless. Disconnect them.
2310     */
2311    LDKErrorAction_DisconnectPeer,
2312    /**
2313     * The peer did something harmless that we weren't able to process, just log and ignore
2314     */
2315    LDKErrorAction_IgnoreError,
2316    /**
2317     * The peer did something harmless that we weren't able to meaningfully process.
2318     * If the error is logged, log it at the given level.
2319     */
2320    LDKErrorAction_IgnoreAndLog,
2321    /**
2322     * The peer did something incorrect. Tell them.
2323     */
2324    LDKErrorAction_SendErrorMessage,
2325    /**
2326     * Must be last for serialization purposes
2327     */
2328    LDKErrorAction_Sentinel,
2329 } LDKErrorAction_Tag;
2330
2331 typedef struct LDKErrorAction_LDKDisconnectPeer_Body {
2332    /**
2333     * An error message which we should make an effort to send before we disconnect.
2334     *
2335     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
2336     */
2337    struct LDKErrorMessage msg;
2338 } LDKErrorAction_LDKDisconnectPeer_Body;
2339
2340 typedef struct LDKErrorAction_LDKSendErrorMessage_Body {
2341    /**
2342     * The message to send.
2343     */
2344    struct LDKErrorMessage msg;
2345 } LDKErrorAction_LDKSendErrorMessage_Body;
2346
2347 typedef struct MUST_USE_STRUCT LDKErrorAction {
2348    LDKErrorAction_Tag tag;
2349    union {
2350       LDKErrorAction_LDKDisconnectPeer_Body disconnect_peer;
2351       struct {
2352          enum LDKLevel ignore_and_log;
2353       };
2354       LDKErrorAction_LDKSendErrorMessage_Body send_error_message;
2355    };
2356 } LDKErrorAction;
2357
2358 /**
2359  * The information we received from a peer along the route of a payment we originated. This is
2360  * returned by ChannelMessageHandler::handle_update_fail_htlc to be passed into
2361  * RoutingMessageHandler::handle_htlc_fail_channel_update to update our network map.
2362  */
2363 typedef enum LDKHTLCFailChannelUpdate_Tag {
2364    /**
2365     * We received an error which included a full ChannelUpdate message.
2366     */
2367    LDKHTLCFailChannelUpdate_ChannelUpdateMessage,
2368    /**
2369     * We received an error which indicated only that a channel has been closed
2370     */
2371    LDKHTLCFailChannelUpdate_ChannelClosed,
2372    /**
2373     * We received an error which indicated only that a node has failed
2374     */
2375    LDKHTLCFailChannelUpdate_NodeFailure,
2376    /**
2377     * Must be last for serialization purposes
2378     */
2379    LDKHTLCFailChannelUpdate_Sentinel,
2380 } LDKHTLCFailChannelUpdate_Tag;
2381
2382 typedef struct LDKHTLCFailChannelUpdate_LDKChannelUpdateMessage_Body {
2383    /**
2384     * The unwrapped message we received
2385     */
2386    struct LDKChannelUpdate msg;
2387 } LDKHTLCFailChannelUpdate_LDKChannelUpdateMessage_Body;
2388
2389 typedef struct LDKHTLCFailChannelUpdate_LDKChannelClosed_Body {
2390    /**
2391     * The short_channel_id which has now closed.
2392     */
2393    uint64_t short_channel_id;
2394    /**
2395     * when this true, this channel should be permanently removed from the
2396     * consideration. Otherwise, this channel can be restored as new channel_update is received
2397     */
2398    bool is_permanent;
2399 } LDKHTLCFailChannelUpdate_LDKChannelClosed_Body;
2400
2401 typedef struct LDKHTLCFailChannelUpdate_LDKNodeFailure_Body {
2402    /**
2403     * The node_id that has failed.
2404     */
2405    struct LDKPublicKey node_id;
2406    /**
2407     * when this true, node should be permanently removed from the
2408     * consideration. Otherwise, the channels connected to this node can be
2409     * restored as new channel_update is received
2410     */
2411    bool is_permanent;
2412 } LDKHTLCFailChannelUpdate_LDKNodeFailure_Body;
2413
2414 typedef struct MUST_USE_STRUCT LDKHTLCFailChannelUpdate {
2415    LDKHTLCFailChannelUpdate_Tag tag;
2416    union {
2417       LDKHTLCFailChannelUpdate_LDKChannelUpdateMessage_Body channel_update_message;
2418       LDKHTLCFailChannelUpdate_LDKChannelClosed_Body channel_closed;
2419       LDKHTLCFailChannelUpdate_LDKNodeFailure_Body node_failure;
2420    };
2421 } LDKHTLCFailChannelUpdate;
2422
2423
2424
2425 /**
2426  * A query_channel_range message is used to query a peer for channel
2427  * UTXOs in a range of blocks. The recipient of a query makes a best
2428  * effort to reply to the query using one or more reply_channel_range
2429  * messages.
2430  */
2431 typedef struct MUST_USE_STRUCT LDKQueryChannelRange {
2432    /**
2433     * A pointer to the opaque Rust object.
2434     * Nearly everywhere, inner must be non-null, however in places where
2435     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2436     */
2437    LDKnativeQueryChannelRange *inner;
2438    /**
2439     * Indicates that this is the only struct which contains the same pointer.
2440     * Rust functions which take ownership of an object provided via an argument require
2441     * this to be true and invalidate the object pointed to by inner.
2442     */
2443    bool is_owned;
2444 } LDKQueryChannelRange;
2445
2446
2447
2448 /**
2449  * A query_short_channel_ids message is used to query a peer for
2450  * routing gossip messages related to one or more short_channel_ids.
2451  * The query recipient will reply with the latest, if available,
2452  * channel_announcement, channel_update and node_announcement messages
2453  * it maintains for the requested short_channel_ids followed by a
2454  * reply_short_channel_ids_end message. The short_channel_ids sent in
2455  * this query are encoded. We only support encoding_type=0 uncompressed
2456  * serialization and do not support encoding_type=1 zlib serialization.
2457  */
2458 typedef struct MUST_USE_STRUCT LDKQueryShortChannelIds {
2459    /**
2460     * A pointer to the opaque Rust object.
2461     * Nearly everywhere, inner must be non-null, however in places where
2462     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2463     */
2464    LDKnativeQueryShortChannelIds *inner;
2465    /**
2466     * Indicates that this is the only struct which contains the same pointer.
2467     * Rust functions which take ownership of an object provided via an argument require
2468     * this to be true and invalidate the object pointed to by inner.
2469     */
2470    bool is_owned;
2471 } LDKQueryShortChannelIds;
2472
2473
2474
2475 /**
2476  * A reply_channel_range message is a reply to a query_channel_range
2477  * message. Multiple reply_channel_range messages can be sent in reply
2478  * to a single query_channel_range message. The query recipient makes a
2479  * best effort to respond based on their local network view which may
2480  * not be a perfect view of the network. The short_channel_ids in the
2481  * reply are encoded. We only support encoding_type=0 uncompressed
2482  * serialization and do not support encoding_type=1 zlib serialization.
2483  */
2484 typedef struct MUST_USE_STRUCT LDKReplyChannelRange {
2485    /**
2486     * A pointer to the opaque Rust object.
2487     * Nearly everywhere, inner must be non-null, however in places where
2488     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2489     */
2490    LDKnativeReplyChannelRange *inner;
2491    /**
2492     * Indicates that this is the only struct which contains the same pointer.
2493     * Rust functions which take ownership of an object provided via an argument require
2494     * this to be true and invalidate the object pointed to by inner.
2495     */
2496    bool is_owned;
2497 } LDKReplyChannelRange;
2498
2499 /**
2500  * An event generated by ChannelManager which indicates a message should be sent to a peer (or
2501  * broadcast to most peers).
2502  * These events are handled by PeerManager::process_events if you are using a PeerManager.
2503  */
2504 typedef enum LDKMessageSendEvent_Tag {
2505    /**
2506     * Used to indicate that we've accepted a channel open and should send the accept_channel
2507     * message provided to the given peer.
2508     */
2509    LDKMessageSendEvent_SendAcceptChannel,
2510    /**
2511     * Used to indicate that we've initiated a channel open and should send the open_channel
2512     * message provided to the given peer.
2513     */
2514    LDKMessageSendEvent_SendOpenChannel,
2515    /**
2516     * Used to indicate that a funding_created message should be sent to the peer with the given node_id.
2517     */
2518    LDKMessageSendEvent_SendFundingCreated,
2519    /**
2520     * Used to indicate that a funding_signed message should be sent to the peer with the given node_id.
2521     */
2522    LDKMessageSendEvent_SendFundingSigned,
2523    /**
2524     * Used to indicate that a funding_locked message should be sent to the peer with the given node_id.
2525     */
2526    LDKMessageSendEvent_SendFundingLocked,
2527    /**
2528     * Used to indicate that an announcement_signatures message should be sent to the peer with the given node_id.
2529     */
2530    LDKMessageSendEvent_SendAnnouncementSignatures,
2531    /**
2532     * Used to indicate that a series of HTLC update messages, as well as a commitment_signed
2533     * message should be sent to the peer with the given node_id.
2534     */
2535    LDKMessageSendEvent_UpdateHTLCs,
2536    /**
2537     * Used to indicate that a revoke_and_ack message should be sent to the peer with the given node_id.
2538     */
2539    LDKMessageSendEvent_SendRevokeAndACK,
2540    /**
2541     * Used to indicate that a closing_signed message should be sent to the peer with the given node_id.
2542     */
2543    LDKMessageSendEvent_SendClosingSigned,
2544    /**
2545     * Used to indicate that a shutdown message should be sent to the peer with the given node_id.
2546     */
2547    LDKMessageSendEvent_SendShutdown,
2548    /**
2549     * Used to indicate that a channel_reestablish message should be sent to the peer with the given node_id.
2550     */
2551    LDKMessageSendEvent_SendChannelReestablish,
2552    /**
2553     * Used to indicate that a channel_announcement and channel_update should be broadcast to all
2554     * peers (except the peer with node_id either msg.contents.node_id_1 or msg.contents.node_id_2).
2555     *
2556     * Note that after doing so, you very likely (unless you did so very recently) want to call
2557     * ChannelManager::broadcast_node_announcement to trigger a BroadcastNodeAnnouncement event.
2558     * This ensures that any nodes which see our channel_announcement also have a relevant
2559     * node_announcement, including relevant feature flags which may be important for routing
2560     * through or to us.
2561     */
2562    LDKMessageSendEvent_BroadcastChannelAnnouncement,
2563    /**
2564     * Used to indicate that a node_announcement should be broadcast to all peers.
2565     */
2566    LDKMessageSendEvent_BroadcastNodeAnnouncement,
2567    /**
2568     * Used to indicate that a channel_update should be broadcast to all peers.
2569     */
2570    LDKMessageSendEvent_BroadcastChannelUpdate,
2571    /**
2572     * Used to indicate that a channel_update should be sent to a single peer.
2573     * In contrast to [`Self::BroadcastChannelUpdate`], this is used when the channel is a
2574     * private channel and we shouldn't be informing all of our peers of channel parameters.
2575     */
2576    LDKMessageSendEvent_SendChannelUpdate,
2577    /**
2578     * Broadcast an error downstream to be handled
2579     */
2580    LDKMessageSendEvent_HandleError,
2581    /**
2582     * When a payment fails we may receive updates back from the hop where it failed. In such
2583     * cases this event is generated so that we can inform the network graph of this information.
2584     */
2585    LDKMessageSendEvent_PaymentFailureNetworkUpdate,
2586    /**
2587     * Query a peer for channels with funding transaction UTXOs in a block range.
2588     */
2589    LDKMessageSendEvent_SendChannelRangeQuery,
2590    /**
2591     * Request routing gossip messages from a peer for a list of channels identified by
2592     * their short_channel_ids.
2593     */
2594    LDKMessageSendEvent_SendShortIdsQuery,
2595    /**
2596     * Sends a reply to a channel range query. This may be one of several SendReplyChannelRange events
2597     * emitted during processing of the query.
2598     */
2599    LDKMessageSendEvent_SendReplyChannelRange,
2600    /**
2601     * Must be last for serialization purposes
2602     */
2603    LDKMessageSendEvent_Sentinel,
2604 } LDKMessageSendEvent_Tag;
2605
2606 typedef struct LDKMessageSendEvent_LDKSendAcceptChannel_Body {
2607    /**
2608     * The node_id of the node which should receive this message
2609     */
2610    struct LDKPublicKey node_id;
2611    /**
2612     * The message which should be sent.
2613     */
2614    struct LDKAcceptChannel msg;
2615 } LDKMessageSendEvent_LDKSendAcceptChannel_Body;
2616
2617 typedef struct LDKMessageSendEvent_LDKSendOpenChannel_Body {
2618    /**
2619     * The node_id of the node which should receive this message
2620     */
2621    struct LDKPublicKey node_id;
2622    /**
2623     * The message which should be sent.
2624     */
2625    struct LDKOpenChannel msg;
2626 } LDKMessageSendEvent_LDKSendOpenChannel_Body;
2627
2628 typedef struct LDKMessageSendEvent_LDKSendFundingCreated_Body {
2629    /**
2630     * The node_id of the node which should receive this message
2631     */
2632    struct LDKPublicKey node_id;
2633    /**
2634     * The message which should be sent.
2635     */
2636    struct LDKFundingCreated msg;
2637 } LDKMessageSendEvent_LDKSendFundingCreated_Body;
2638
2639 typedef struct LDKMessageSendEvent_LDKSendFundingSigned_Body {
2640    /**
2641     * The node_id of the node which should receive this message
2642     */
2643    struct LDKPublicKey node_id;
2644    /**
2645     * The message which should be sent.
2646     */
2647    struct LDKFundingSigned msg;
2648 } LDKMessageSendEvent_LDKSendFundingSigned_Body;
2649
2650 typedef struct LDKMessageSendEvent_LDKSendFundingLocked_Body {
2651    /**
2652     * The node_id of the node which should receive these message(s)
2653     */
2654    struct LDKPublicKey node_id;
2655    /**
2656     * The funding_locked message which should be sent.
2657     */
2658    struct LDKFundingLocked msg;
2659 } LDKMessageSendEvent_LDKSendFundingLocked_Body;
2660
2661 typedef struct LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body {
2662    /**
2663     * The node_id of the node which should receive these message(s)
2664     */
2665    struct LDKPublicKey node_id;
2666    /**
2667     * The announcement_signatures message which should be sent.
2668     */
2669    struct LDKAnnouncementSignatures msg;
2670 } LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body;
2671
2672 typedef struct LDKMessageSendEvent_LDKUpdateHTLCs_Body {
2673    /**
2674     * The node_id of the node which should receive these message(s)
2675     */
2676    struct LDKPublicKey node_id;
2677    /**
2678     * The update messages which should be sent. ALL messages in the struct should be sent!
2679     */
2680    struct LDKCommitmentUpdate updates;
2681 } LDKMessageSendEvent_LDKUpdateHTLCs_Body;
2682
2683 typedef struct LDKMessageSendEvent_LDKSendRevokeAndACK_Body {
2684    /**
2685     * The node_id of the node which should receive this message
2686     */
2687    struct LDKPublicKey node_id;
2688    /**
2689     * The message which should be sent.
2690     */
2691    struct LDKRevokeAndACK msg;
2692 } LDKMessageSendEvent_LDKSendRevokeAndACK_Body;
2693
2694 typedef struct LDKMessageSendEvent_LDKSendClosingSigned_Body {
2695    /**
2696     * The node_id of the node which should receive this message
2697     */
2698    struct LDKPublicKey node_id;
2699    /**
2700     * The message which should be sent.
2701     */
2702    struct LDKClosingSigned msg;
2703 } LDKMessageSendEvent_LDKSendClosingSigned_Body;
2704
2705 typedef struct LDKMessageSendEvent_LDKSendShutdown_Body {
2706    /**
2707     * The node_id of the node which should receive this message
2708     */
2709    struct LDKPublicKey node_id;
2710    /**
2711     * The message which should be sent.
2712     */
2713    struct LDKShutdown msg;
2714 } LDKMessageSendEvent_LDKSendShutdown_Body;
2715
2716 typedef struct LDKMessageSendEvent_LDKSendChannelReestablish_Body {
2717    /**
2718     * The node_id of the node which should receive this message
2719     */
2720    struct LDKPublicKey node_id;
2721    /**
2722     * The message which should be sent.
2723     */
2724    struct LDKChannelReestablish msg;
2725 } LDKMessageSendEvent_LDKSendChannelReestablish_Body;
2726
2727 typedef struct LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body {
2728    /**
2729     * The channel_announcement which should be sent.
2730     */
2731    struct LDKChannelAnnouncement msg;
2732    /**
2733     * The followup channel_update which should be sent.
2734     */
2735    struct LDKChannelUpdate update_msg;
2736 } LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body;
2737
2738 typedef struct LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body {
2739    /**
2740     * The node_announcement which should be sent.
2741     */
2742    struct LDKNodeAnnouncement msg;
2743 } LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body;
2744
2745 typedef struct LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body {
2746    /**
2747     * The channel_update which should be sent.
2748     */
2749    struct LDKChannelUpdate msg;
2750 } LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body;
2751
2752 typedef struct LDKMessageSendEvent_LDKSendChannelUpdate_Body {
2753    /**
2754     * The node_id of the node which should receive this message
2755     */
2756    struct LDKPublicKey node_id;
2757    /**
2758     * The channel_update which should be sent.
2759     */
2760    struct LDKChannelUpdate msg;
2761 } LDKMessageSendEvent_LDKSendChannelUpdate_Body;
2762
2763 typedef struct LDKMessageSendEvent_LDKHandleError_Body {
2764    /**
2765     * The node_id of the node which should receive this message
2766     */
2767    struct LDKPublicKey node_id;
2768    /**
2769     * The action which should be taken.
2770     */
2771    struct LDKErrorAction action;
2772 } LDKMessageSendEvent_LDKHandleError_Body;
2773
2774 typedef struct LDKMessageSendEvent_LDKPaymentFailureNetworkUpdate_Body {
2775    /**
2776     * The channel/node update which should be sent to NetGraphMsgHandler
2777     */
2778    struct LDKHTLCFailChannelUpdate update;
2779 } LDKMessageSendEvent_LDKPaymentFailureNetworkUpdate_Body;
2780
2781 typedef struct LDKMessageSendEvent_LDKSendChannelRangeQuery_Body {
2782    /**
2783     * The node_id of this message recipient
2784     */
2785    struct LDKPublicKey node_id;
2786    /**
2787     * The query_channel_range which should be sent.
2788     */
2789    struct LDKQueryChannelRange msg;
2790 } LDKMessageSendEvent_LDKSendChannelRangeQuery_Body;
2791
2792 typedef struct LDKMessageSendEvent_LDKSendShortIdsQuery_Body {
2793    /**
2794     * The node_id of this message recipient
2795     */
2796    struct LDKPublicKey node_id;
2797    /**
2798     * The query_short_channel_ids which should be sent.
2799     */
2800    struct LDKQueryShortChannelIds msg;
2801 } LDKMessageSendEvent_LDKSendShortIdsQuery_Body;
2802
2803 typedef struct LDKMessageSendEvent_LDKSendReplyChannelRange_Body {
2804    /**
2805     * The node_id of this message recipient
2806     */
2807    struct LDKPublicKey node_id;
2808    /**
2809     * The reply_channel_range which should be sent.
2810     */
2811    struct LDKReplyChannelRange msg;
2812 } LDKMessageSendEvent_LDKSendReplyChannelRange_Body;
2813
2814 typedef struct MUST_USE_STRUCT LDKMessageSendEvent {
2815    LDKMessageSendEvent_Tag tag;
2816    union {
2817       LDKMessageSendEvent_LDKSendAcceptChannel_Body send_accept_channel;
2818       LDKMessageSendEvent_LDKSendOpenChannel_Body send_open_channel;
2819       LDKMessageSendEvent_LDKSendFundingCreated_Body send_funding_created;
2820       LDKMessageSendEvent_LDKSendFundingSigned_Body send_funding_signed;
2821       LDKMessageSendEvent_LDKSendFundingLocked_Body send_funding_locked;
2822       LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body send_announcement_signatures;
2823       LDKMessageSendEvent_LDKUpdateHTLCs_Body update_htl_cs;
2824       LDKMessageSendEvent_LDKSendRevokeAndACK_Body send_revoke_and_ack;
2825       LDKMessageSendEvent_LDKSendClosingSigned_Body send_closing_signed;
2826       LDKMessageSendEvent_LDKSendShutdown_Body send_shutdown;
2827       LDKMessageSendEvent_LDKSendChannelReestablish_Body send_channel_reestablish;
2828       LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body broadcast_channel_announcement;
2829       LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body broadcast_node_announcement;
2830       LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body broadcast_channel_update;
2831       LDKMessageSendEvent_LDKSendChannelUpdate_Body send_channel_update;
2832       LDKMessageSendEvent_LDKHandleError_Body handle_error;
2833       LDKMessageSendEvent_LDKPaymentFailureNetworkUpdate_Body payment_failure_network_update;
2834       LDKMessageSendEvent_LDKSendChannelRangeQuery_Body send_channel_range_query;
2835       LDKMessageSendEvent_LDKSendShortIdsQuery_Body send_short_ids_query;
2836       LDKMessageSendEvent_LDKSendReplyChannelRange_Body send_reply_channel_range;
2837    };
2838 } LDKMessageSendEvent;
2839
2840 /**
2841  * A dynamically-allocated array of crate::lightning::util::events::MessageSendEvents of arbitrary size.
2842  * This corresponds to std::vector in C++
2843  */
2844 typedef struct LDKCVec_MessageSendEventZ {
2845    /**
2846     * The elements in the array.
2847     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2848     */
2849    struct LDKMessageSendEvent *data;
2850    /**
2851     * The number of elements pointed to by `data`.
2852     */
2853    uintptr_t datalen;
2854 } LDKCVec_MessageSendEventZ;
2855
2856
2857
2858 /**
2859  * Features used within an `init` message.
2860  */
2861 typedef struct MUST_USE_STRUCT LDKInitFeatures {
2862    /**
2863     * A pointer to the opaque Rust object.
2864     * Nearly everywhere, inner must be non-null, however in places where
2865     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2866     */
2867    LDKnativeInitFeatures *inner;
2868    /**
2869     * Indicates that this is the only struct which contains the same pointer.
2870     * Rust functions which take ownership of an object provided via an argument require
2871     * this to be true and invalidate the object pointed to by inner.
2872     */
2873    bool is_owned;
2874 } LDKInitFeatures;
2875
2876 /**
2877  * The contents of CResult_InitFeaturesDecodeErrorZ
2878  */
2879 typedef union LDKCResult_InitFeaturesDecodeErrorZPtr {
2880    /**
2881     * A pointer to the contents in the success state.
2882     * Reading from this pointer when `result_ok` is not set is undefined.
2883     */
2884    struct LDKInitFeatures *result;
2885    /**
2886     * A pointer to the contents in the error state.
2887     * Reading from this pointer when `result_ok` is set is undefined.
2888     */
2889    struct LDKDecodeError *err;
2890 } LDKCResult_InitFeaturesDecodeErrorZPtr;
2891
2892 /**
2893  * A CResult_InitFeaturesDecodeErrorZ represents the result of a fallible operation,
2894  * containing a crate::lightning::ln::features::InitFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
2895  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2896  */
2897 typedef struct LDKCResult_InitFeaturesDecodeErrorZ {
2898    /**
2899     * The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either
2900     * `err` or `result` depending on the state of `result_ok`.
2901     */
2902    union LDKCResult_InitFeaturesDecodeErrorZPtr contents;
2903    /**
2904     * Whether this CResult_InitFeaturesDecodeErrorZ represents a success state.
2905     */
2906    bool result_ok;
2907 } LDKCResult_InitFeaturesDecodeErrorZ;
2908
2909
2910
2911 /**
2912  * Features used within a `node_announcement` message.
2913  */
2914 typedef struct MUST_USE_STRUCT LDKNodeFeatures {
2915    /**
2916     * A pointer to the opaque Rust object.
2917     * Nearly everywhere, inner must be non-null, however in places where
2918     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2919     */
2920    LDKnativeNodeFeatures *inner;
2921    /**
2922     * Indicates that this is the only struct which contains the same pointer.
2923     * Rust functions which take ownership of an object provided via an argument require
2924     * this to be true and invalidate the object pointed to by inner.
2925     */
2926    bool is_owned;
2927 } LDKNodeFeatures;
2928
2929 /**
2930  * The contents of CResult_NodeFeaturesDecodeErrorZ
2931  */
2932 typedef union LDKCResult_NodeFeaturesDecodeErrorZPtr {
2933    /**
2934     * A pointer to the contents in the success state.
2935     * Reading from this pointer when `result_ok` is not set is undefined.
2936     */
2937    struct LDKNodeFeatures *result;
2938    /**
2939     * A pointer to the contents in the error state.
2940     * Reading from this pointer when `result_ok` is set is undefined.
2941     */
2942    struct LDKDecodeError *err;
2943 } LDKCResult_NodeFeaturesDecodeErrorZPtr;
2944
2945 /**
2946  * A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation,
2947  * containing a crate::lightning::ln::features::NodeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
2948  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2949  */
2950 typedef struct LDKCResult_NodeFeaturesDecodeErrorZ {
2951    /**
2952     * The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either
2953     * `err` or `result` depending on the state of `result_ok`.
2954     */
2955    union LDKCResult_NodeFeaturesDecodeErrorZPtr contents;
2956    /**
2957     * Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state.
2958     */
2959    bool result_ok;
2960 } LDKCResult_NodeFeaturesDecodeErrorZ;
2961
2962
2963
2964 /**
2965  * Features used within a `channel_announcement` message.
2966  */
2967 typedef struct MUST_USE_STRUCT LDKChannelFeatures {
2968    /**
2969     * A pointer to the opaque Rust object.
2970     * Nearly everywhere, inner must be non-null, however in places where
2971     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2972     */
2973    LDKnativeChannelFeatures *inner;
2974    /**
2975     * Indicates that this is the only struct which contains the same pointer.
2976     * Rust functions which take ownership of an object provided via an argument require
2977     * this to be true and invalidate the object pointed to by inner.
2978     */
2979    bool is_owned;
2980 } LDKChannelFeatures;
2981
2982 /**
2983  * The contents of CResult_ChannelFeaturesDecodeErrorZ
2984  */
2985 typedef union LDKCResult_ChannelFeaturesDecodeErrorZPtr {
2986    /**
2987     * A pointer to the contents in the success state.
2988     * Reading from this pointer when `result_ok` is not set is undefined.
2989     */
2990    struct LDKChannelFeatures *result;
2991    /**
2992     * A pointer to the contents in the error state.
2993     * Reading from this pointer when `result_ok` is set is undefined.
2994     */
2995    struct LDKDecodeError *err;
2996 } LDKCResult_ChannelFeaturesDecodeErrorZPtr;
2997
2998 /**
2999  * A CResult_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation,
3000  * containing a crate::lightning::ln::features::ChannelFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
3001  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3002  */
3003 typedef struct LDKCResult_ChannelFeaturesDecodeErrorZ {
3004    /**
3005     * The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either
3006     * `err` or `result` depending on the state of `result_ok`.
3007     */
3008    union LDKCResult_ChannelFeaturesDecodeErrorZPtr contents;
3009    /**
3010     * Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state.
3011     */
3012    bool result_ok;
3013 } LDKCResult_ChannelFeaturesDecodeErrorZ;
3014
3015
3016
3017 /**
3018  * Features used within an invoice.
3019  */
3020 typedef struct MUST_USE_STRUCT LDKInvoiceFeatures {
3021    /**
3022     * A pointer to the opaque Rust object.
3023     * Nearly everywhere, inner must be non-null, however in places where
3024     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3025     */
3026    LDKnativeInvoiceFeatures *inner;
3027    /**
3028     * Indicates that this is the only struct which contains the same pointer.
3029     * Rust functions which take ownership of an object provided via an argument require
3030     * this to be true and invalidate the object pointed to by inner.
3031     */
3032    bool is_owned;
3033 } LDKInvoiceFeatures;
3034
3035 /**
3036  * The contents of CResult_InvoiceFeaturesDecodeErrorZ
3037  */
3038 typedef union LDKCResult_InvoiceFeaturesDecodeErrorZPtr {
3039    /**
3040     * A pointer to the contents in the success state.
3041     * Reading from this pointer when `result_ok` is not set is undefined.
3042     */
3043    struct LDKInvoiceFeatures *result;
3044    /**
3045     * A pointer to the contents in the error state.
3046     * Reading from this pointer when `result_ok` is set is undefined.
3047     */
3048    struct LDKDecodeError *err;
3049 } LDKCResult_InvoiceFeaturesDecodeErrorZPtr;
3050
3051 /**
3052  * A CResult_InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
3053  * containing a crate::lightning::ln::features::InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
3054  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3055  */
3056 typedef struct LDKCResult_InvoiceFeaturesDecodeErrorZ {
3057    /**
3058     * The contents of this CResult_InvoiceFeaturesDecodeErrorZ, accessible via either
3059     * `err` or `result` depending on the state of `result_ok`.
3060     */
3061    union LDKCResult_InvoiceFeaturesDecodeErrorZPtr contents;
3062    /**
3063     * Whether this CResult_InvoiceFeaturesDecodeErrorZ represents a success state.
3064     */
3065    bool result_ok;
3066 } LDKCResult_InvoiceFeaturesDecodeErrorZ;
3067
3068 /**
3069  * The contents of CResult_DelayedPaymentOutputDescriptorDecodeErrorZ
3070  */
3071 typedef union LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
3072    /**
3073     * A pointer to the contents in the success state.
3074     * Reading from this pointer when `result_ok` is not set is undefined.
3075     */
3076    struct LDKDelayedPaymentOutputDescriptor *result;
3077    /**
3078     * A pointer to the contents in the error state.
3079     * Reading from this pointer when `result_ok` is set is undefined.
3080     */
3081    struct LDKDecodeError *err;
3082 } LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr;
3083
3084 /**
3085  * A CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
3086  * containing a crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
3087  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3088  */
3089 typedef struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
3090    /**
3091     * The contents of this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ, accessible via either
3092     * `err` or `result` depending on the state of `result_ok`.
3093     */
3094    union LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr contents;
3095    /**
3096     * Whether this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents a success state.
3097     */
3098    bool result_ok;
3099 } LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ;
3100
3101 /**
3102  * The contents of CResult_StaticPaymentOutputDescriptorDecodeErrorZ
3103  */
3104 typedef union LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
3105    /**
3106     * A pointer to the contents in the success state.
3107     * Reading from this pointer when `result_ok` is not set is undefined.
3108     */
3109    struct LDKStaticPaymentOutputDescriptor *result;
3110    /**
3111     * A pointer to the contents in the error state.
3112     * Reading from this pointer when `result_ok` is set is undefined.
3113     */
3114    struct LDKDecodeError *err;
3115 } LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZPtr;
3116
3117 /**
3118  * A CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
3119  * containing a crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
3120  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3121  */
3122 typedef struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ {
3123    /**
3124     * The contents of this CResult_StaticPaymentOutputDescriptorDecodeErrorZ, accessible via either
3125     * `err` or `result` depending on the state of `result_ok`.
3126     */
3127    union LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZPtr contents;
3128    /**
3129     * Whether this CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents a success state.
3130     */
3131    bool result_ok;
3132 } LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ;
3133
3134 /**
3135  * The contents of CResult_SpendableOutputDescriptorDecodeErrorZ
3136  */
3137 typedef union LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr {
3138    /**
3139     * A pointer to the contents in the success state.
3140     * Reading from this pointer when `result_ok` is not set is undefined.
3141     */
3142    struct LDKSpendableOutputDescriptor *result;
3143    /**
3144     * A pointer to the contents in the error state.
3145     * Reading from this pointer when `result_ok` is set is undefined.
3146     */
3147    struct LDKDecodeError *err;
3148 } LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr;
3149
3150 /**
3151  * A CResult_SpendableOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
3152  * containing a crate::lightning::chain::keysinterface::SpendableOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
3153  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3154  */
3155 typedef struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ {
3156    /**
3157     * The contents of this CResult_SpendableOutputDescriptorDecodeErrorZ, accessible via either
3158     * `err` or `result` depending on the state of `result_ok`.
3159     */
3160    union LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr contents;
3161    /**
3162     * Whether this CResult_SpendableOutputDescriptorDecodeErrorZ represents a success state.
3163     */
3164    bool result_ok;
3165 } LDKCResult_SpendableOutputDescriptorDecodeErrorZ;
3166
3167 /**
3168  * A tuple of 2 elements. See the individual fields for the types contained.
3169  */
3170 typedef struct LDKC2Tuple_SignatureCVec_SignatureZZ {
3171    /**
3172     * The element at position 0
3173     */
3174    struct LDKSignature a;
3175    /**
3176     * The element at position 1
3177     */
3178    struct LDKCVec_SignatureZ b;
3179 } LDKC2Tuple_SignatureCVec_SignatureZZ;
3180
3181 /**
3182  * The contents of CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ
3183  */
3184 typedef union LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
3185    /**
3186     * A pointer to the contents in the success state.
3187     * Reading from this pointer when `result_ok` is not set is undefined.
3188     */
3189    struct LDKC2Tuple_SignatureCVec_SignatureZZ *result;
3190    /**
3191     * Note that this value is always NULL, as there are no contents in the Err variant
3192     */
3193    void *err;
3194 } LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr;
3195
3196 /**
3197  * A CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents the result of a fallible operation,
3198  * containing a crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ on success and a () on failure.
3199  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3200  */
3201 typedef struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
3202    /**
3203     * The contents of this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ, accessible via either
3204     * `err` or `result` depending on the state of `result_ok`.
3205     */
3206    union LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr contents;
3207    /**
3208     * Whether this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents a success state.
3209     */
3210    bool result_ok;
3211 } LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ;
3212
3213 /**
3214  * The contents of CResult_SignatureNoneZ
3215  */
3216 typedef union LDKCResult_SignatureNoneZPtr {
3217    /**
3218     * A pointer to the contents in the success state.
3219     * Reading from this pointer when `result_ok` is not set is undefined.
3220     */
3221    struct LDKSignature *result;
3222    /**
3223     * Note that this value is always NULL, as there are no contents in the Err variant
3224     */
3225    void *err;
3226 } LDKCResult_SignatureNoneZPtr;
3227
3228 /**
3229  * A CResult_SignatureNoneZ represents the result of a fallible operation,
3230  * containing a crate::c_types::Signature on success and a () on failure.
3231  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3232  */
3233 typedef struct LDKCResult_SignatureNoneZ {
3234    /**
3235     * The contents of this CResult_SignatureNoneZ, accessible via either
3236     * `err` or `result` depending on the state of `result_ok`.
3237     */
3238    union LDKCResult_SignatureNoneZPtr contents;
3239    /**
3240     * Whether this CResult_SignatureNoneZ represents a success state.
3241     */
3242    bool result_ok;
3243 } LDKCResult_SignatureNoneZ;
3244
3245
3246
3247 /**
3248  * The unsigned part of a channel_announcement
3249  */
3250 typedef struct MUST_USE_STRUCT LDKUnsignedChannelAnnouncement {
3251    /**
3252     * A pointer to the opaque Rust object.
3253     * Nearly everywhere, inner must be non-null, however in places where
3254     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3255     */
3256    LDKnativeUnsignedChannelAnnouncement *inner;
3257    /**
3258     * Indicates that this is the only struct which contains the same pointer.
3259     * Rust functions which take ownership of an object provided via an argument require
3260     * this to be true and invalidate the object pointed to by inner.
3261     */
3262    bool is_owned;
3263 } LDKUnsignedChannelAnnouncement;
3264
3265 /**
3266  * A trait to sign lightning channel transactions as described in BOLT 3.
3267  *
3268  * Signing services could be implemented on a hardware wallet. In this case,
3269  * the current Sign would be a front-end on top of a communication
3270  * channel connected to your secure device and lightning key material wouldn't
3271  * reside on a hot server. Nevertheless, a this deployment would still need
3272  * to trust the ChannelManager to avoid loss of funds as this latest component
3273  * could ask to sign commitment transaction with HTLCs paying to attacker pubkeys.
3274  *
3275  * A more secure iteration would be to use hashlock (or payment points) to pair
3276  * invoice/incoming HTLCs with outgoing HTLCs to implement a no-trust-ChannelManager
3277  * at the price of more state and computation on the hardware wallet side. In the future,
3278  * we are looking forward to design such interface.
3279  *
3280  * In any case, ChannelMonitor or fallback watchtowers are always going to be trusted
3281  * to act, as liveness and breach reply correctness are always going to be hard requirements
3282  * of LN security model, orthogonal of key management issues.
3283  */
3284 typedef struct LDKBaseSign {
3285    /**
3286     * An opaque pointer which is passed to your function implementations as an argument.
3287     * This has no meaning in the LDK, and can be NULL or any other value.
3288     */
3289    void *this_arg;
3290    /**
3291     * Gets the per-commitment point for a specific commitment number
3292     *
3293     * Note that the commitment number starts at (1 << 48) - 1 and counts backwards.
3294     */
3295    struct LDKPublicKey (*get_per_commitment_point)(const void *this_arg, uint64_t idx);
3296    /**
3297     * Gets the commitment secret for a specific commitment number as part of the revocation process
3298     *
3299     * An external signer implementation should error here if the commitment was already signed
3300     * and should refuse to sign it in the future.
3301     *
3302     * May be called more than once for the same index.
3303     *
3304     * Note that the commitment number starts at (1 << 48) - 1 and counts backwards.
3305     */
3306    struct LDKThirtyTwoBytes (*release_commitment_secret)(const void *this_arg, uint64_t idx);
3307    /**
3308     * Gets the holder's channel public keys and basepoints
3309     */
3310    struct LDKChannelPublicKeys pubkeys;
3311    /**
3312     * Fill in the pubkeys field as a reference to it will be given to Rust after this returns
3313     * Note that this takes a pointer to this object, not the this_ptr like other methods do
3314     * This function pointer may be NULL if pubkeys is filled in when this object is created and never needs updating.
3315     */
3316    void (*set_pubkeys)(const struct LDKBaseSign*NONNULL_PTR );
3317    /**
3318     * Gets an arbitrary identifier describing the set of keys which are provided back to you in
3319     * some SpendableOutputDescriptor types. This should be sufficient to identify this
3320     * Sign object uniquely and lookup or re-derive its keys.
3321     */
3322    struct LDKThirtyTwoBytes (*channel_keys_id)(const void *this_arg);
3323    /**
3324     * Create a signature for a counterparty's commitment transaction and associated HTLC transactions.
3325     *
3326     * Note that if signing fails or is rejected, the channel will be force-closed.
3327     */
3328    struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*sign_counterparty_commitment)(const void *this_arg, const struct LDKCommitmentTransaction *NONNULL_PTR commitment_tx);
3329    /**
3330     * Create a signatures for a holder's commitment transaction and its claiming HTLC transactions.
3331     * This will only ever be called with a non-revoked commitment_tx.  This will be called with the
3332     * latest commitment_tx when we initiate a force-close.
3333     * This will be called with the previous latest, just to get claiming HTLC signatures, if we are
3334     * reacting to a ChannelMonitor replica that decided to broadcast before it had been updated to
3335     * the latest.
3336     * This may be called multiple times for the same transaction.
3337     *
3338     * An external signer implementation should check that the commitment has not been revoked.
3339     *
3340     * May return Err if key derivation fails.  Callers, such as ChannelMonitor, will panic in such a case.
3341     */
3342    struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*sign_holder_commitment_and_htlcs)(const void *this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR commitment_tx);
3343    /**
3344     * Create a signature for the given input in a transaction spending an HTLC transaction output
3345     * or a commitment transaction `to_local` output when our counterparty broadcasts an old state.
3346     *
3347     * A justice transaction may claim multiple outputs at the same time if timelocks are
3348     * similar, but only a signature for the input at index `input` should be signed for here.
3349     * It may be called multiple times for same output(s) if a fee-bump is needed with regards
3350     * to an upcoming timelock expiration.
3351     *
3352     * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
3353     *
3354     * per_commitment_key is revocation secret which was provided by our counterparty when they
3355     * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does
3356     * not allow the spending of any funds by itself (you need our holder revocation_secret to do
3357     * so).
3358     */
3359    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]);
3360    /**
3361     * Create a signature for the given input in a transaction spending a commitment transaction
3362     * HTLC output when our counterparty broadcasts an old state.
3363     *
3364     * A justice transaction may claim multiple outputs at the same time if timelocks are
3365     * similar, but only a signature for the input at index `input` should be signed for here.
3366     * It may be called multiple times for same output(s) if a fee-bump is needed with regards
3367     * to an upcoming timelock expiration.
3368     *
3369     * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
3370     *
3371     * per_commitment_key is revocation secret which was provided by our counterparty when they
3372     * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does
3373     * not allow the spending of any funds by itself (you need our holder revocation_secret to do
3374     * so).
3375     *
3376     * htlc holds HTLC elements (hash, timelock), thus changing the format of the witness script
3377     * (which is committed to in the BIP 143 signatures).
3378     */
3379    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);
3380    /**
3381     * Create a signature for a claiming transaction for a HTLC output on a counterparty's commitment
3382     * transaction, either offered or received.
3383     *
3384     * Such a transaction may claim multiples offered outputs at same time if we know the
3385     * preimage for each when we create it, but only the input at index `input` should be
3386     * signed for here. It may be called multiple times for same output(s) if a fee-bump is
3387     * needed with regards to an upcoming timelock expiration.
3388     *
3389     * Witness_script is either a offered or received script as defined in BOLT3 for HTLC
3390     * outputs.
3391     *
3392     * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
3393     *
3394     * Per_commitment_point is the dynamic point corresponding to the channel state
3395     * detected onchain. It has been generated by our counterparty and is used to derive
3396     * channel state keys, which are then included in the witness script and committed to in the
3397     * BIP 143 signature.
3398     */
3399    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);
3400    /**
3401     * Create a signature for a (proposed) closing transaction.
3402     *
3403     * Note that, due to rounding, there may be one \"missing\" satoshi, and either party may have
3404     * chosen to forgo their output as dust.
3405     */
3406    struct LDKCResult_SignatureNoneZ (*sign_closing_transaction)(const void *this_arg, struct LDKTransaction closing_tx);
3407    /**
3408     * Signs a channel announcement message with our funding key, proving it comes from one
3409     * of the channel participants.
3410     *
3411     * Note that if this fails or is rejected, the channel will not be publicly announced and
3412     * our counterparty may (though likely will not) close the channel on us for violating the
3413     * protocol.
3414     */
3415    struct LDKCResult_SignatureNoneZ (*sign_channel_announcement)(const void *this_arg, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR msg);
3416    /**
3417     * Set the counterparty static channel data, including basepoints,
3418     * counterparty_selected/holder_selected_contest_delay and funding outpoint.
3419     * This is done as soon as the funding outpoint is known.  Since these are static channel data,
3420     * they MUST NOT be allowed to change to different values once set.
3421     *
3422     * channel_parameters.is_populated() MUST be true.
3423     *
3424     * We bind holder_selected_contest_delay late here for API convenience.
3425     *
3426     * Will be called before any signatures are applied.
3427     */
3428    void (*ready_channel)(void *this_arg, const struct LDKChannelTransactionParameters *NONNULL_PTR channel_parameters);
3429    /**
3430     * Frees any resources associated with this object given its this_arg pointer.
3431     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
3432     */
3433    void (*free)(void *this_arg);
3434 } LDKBaseSign;
3435
3436 /**
3437  * A cloneable signer.
3438  *
3439  * Although we require signers to be cloneable, it may be useful for developers to be able to use
3440  * signers in an un-sized way, for example as `dyn BaseSign`. Therefore we separate the Clone trait,
3441  * which implies Sized, into this derived trait.
3442  */
3443 typedef struct LDKSign {
3444    /**
3445     * An opaque pointer which is passed to your function implementations as an argument.
3446     * This has no meaning in the LDK, and can be NULL or any other value.
3447     */
3448    void *this_arg;
3449    /**
3450     * Implementation of BaseSign for this object.
3451     */
3452    struct LDKBaseSign BaseSign;
3453    /**
3454     * Serialize the object into a byte array
3455     */
3456    struct LDKCVec_u8Z (*write)(const void *this_arg);
3457    /**
3458     * Called, if set, after this Sign has been cloned into a duplicate object.
3459     * The new Sign is provided, and should be mutated as needed to perform a
3460     * deep copy of the object pointed to by this_arg or avoid any double-freeing.
3461     */
3462    void (*cloned)(struct LDKSign *NONNULL_PTR new_Sign);
3463    /**
3464     * Frees any resources associated with this object given its this_arg pointer.
3465     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
3466     */
3467    void (*free)(void *this_arg);
3468 } LDKSign;
3469
3470 /**
3471  * The contents of CResult_SignDecodeErrorZ
3472  */
3473 typedef union LDKCResult_SignDecodeErrorZPtr {
3474    /**
3475     * A pointer to the contents in the success state.
3476     * Reading from this pointer when `result_ok` is not set is undefined.
3477     */
3478    struct LDKSign *result;
3479    /**
3480     * A pointer to the contents in the error state.
3481     * Reading from this pointer when `result_ok` is set is undefined.
3482     */
3483    struct LDKDecodeError *err;
3484 } LDKCResult_SignDecodeErrorZPtr;
3485
3486 /**
3487  * A CResult_SignDecodeErrorZ represents the result of a fallible operation,
3488  * containing a crate::lightning::chain::keysinterface::Sign on success and a crate::lightning::ln::msgs::DecodeError on failure.
3489  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3490  */
3491 typedef struct LDKCResult_SignDecodeErrorZ {
3492    /**
3493     * The contents of this CResult_SignDecodeErrorZ, accessible via either
3494     * `err` or `result` depending on the state of `result_ok`.
3495     */
3496    union LDKCResult_SignDecodeErrorZPtr contents;
3497    /**
3498     * Whether this CResult_SignDecodeErrorZ represents a success state.
3499     */
3500    bool result_ok;
3501 } LDKCResult_SignDecodeErrorZ;
3502
3503 /**
3504  * Represents a secp256k1 signature serialized as two 32-byte numbers as well as a tag which
3505  * allows recovering the exact public key which created the signature given the message.
3506  */
3507 typedef struct LDKRecoverableSignature {
3508    /**
3509     * The bytes of the signature in "compact" form plus a "Recovery ID" which allows for
3510     * recovery.
3511     */
3512    uint8_t serialized_form[68];
3513 } LDKRecoverableSignature;
3514
3515 /**
3516  * The contents of CResult_RecoverableSignatureNoneZ
3517  */
3518 typedef union LDKCResult_RecoverableSignatureNoneZPtr {
3519    /**
3520     * A pointer to the contents in the success state.
3521     * Reading from this pointer when `result_ok` is not set is undefined.
3522     */
3523    struct LDKRecoverableSignature *result;
3524    /**
3525     * Note that this value is always NULL, as there are no contents in the Err variant
3526     */
3527    void *err;
3528 } LDKCResult_RecoverableSignatureNoneZPtr;
3529
3530 /**
3531  * A CResult_RecoverableSignatureNoneZ represents the result of a fallible operation,
3532  * containing a crate::c_types::RecoverableSignature on success and a () on failure.
3533  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3534  */
3535 typedef struct LDKCResult_RecoverableSignatureNoneZ {
3536    /**
3537     * The contents of this CResult_RecoverableSignatureNoneZ, accessible via either
3538     * `err` or `result` depending on the state of `result_ok`.
3539     */
3540    union LDKCResult_RecoverableSignatureNoneZPtr contents;
3541    /**
3542     * Whether this CResult_RecoverableSignatureNoneZ represents a success state.
3543     */
3544    bool result_ok;
3545 } LDKCResult_RecoverableSignatureNoneZ;
3546
3547 /**
3548  * A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size.
3549  * This corresponds to std::vector in C++
3550  */
3551 typedef struct LDKCVec_CVec_u8ZZ {
3552    /**
3553     * The elements in the array.
3554     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3555     */
3556    struct LDKCVec_u8Z *data;
3557    /**
3558     * The number of elements pointed to by `data`.
3559     */
3560    uintptr_t datalen;
3561 } LDKCVec_CVec_u8ZZ;
3562
3563 /**
3564  * The contents of CResult_CVec_CVec_u8ZZNoneZ
3565  */
3566 typedef union LDKCResult_CVec_CVec_u8ZZNoneZPtr {
3567    /**
3568     * A pointer to the contents in the success state.
3569     * Reading from this pointer when `result_ok` is not set is undefined.
3570     */
3571    struct LDKCVec_CVec_u8ZZ *result;
3572    /**
3573     * Note that this value is always NULL, as there are no contents in the Err variant
3574     */
3575    void *err;
3576 } LDKCResult_CVec_CVec_u8ZZNoneZPtr;
3577
3578 /**
3579  * A CResult_CVec_CVec_u8ZZNoneZ represents the result of a fallible operation,
3580  * containing a crate::c_types::derived::CVec_CVec_u8ZZ on success and a () on failure.
3581  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3582  */
3583 typedef struct LDKCResult_CVec_CVec_u8ZZNoneZ {
3584    /**
3585     * The contents of this CResult_CVec_CVec_u8ZZNoneZ, accessible via either
3586     * `err` or `result` depending on the state of `result_ok`.
3587     */
3588    union LDKCResult_CVec_CVec_u8ZZNoneZPtr contents;
3589    /**
3590     * Whether this CResult_CVec_CVec_u8ZZNoneZ represents a success state.
3591     */
3592    bool result_ok;
3593 } LDKCResult_CVec_CVec_u8ZZNoneZ;
3594
3595
3596
3597 /**
3598  * A simple implementation of Sign that just keeps the private keys in memory.
3599  *
3600  * This implementation performs no policy checks and is insufficient by itself as
3601  * a secure external signer.
3602  */
3603 typedef struct MUST_USE_STRUCT LDKInMemorySigner {
3604    /**
3605     * A pointer to the opaque Rust object.
3606     * Nearly everywhere, inner must be non-null, however in places where
3607     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3608     */
3609    LDKnativeInMemorySigner *inner;
3610    /**
3611     * Indicates that this is the only struct which contains the same pointer.
3612     * Rust functions which take ownership of an object provided via an argument require
3613     * this to be true and invalidate the object pointed to by inner.
3614     */
3615    bool is_owned;
3616 } LDKInMemorySigner;
3617
3618 /**
3619  * The contents of CResult_InMemorySignerDecodeErrorZ
3620  */
3621 typedef union LDKCResult_InMemorySignerDecodeErrorZPtr {
3622    /**
3623     * A pointer to the contents in the success state.
3624     * Reading from this pointer when `result_ok` is not set is undefined.
3625     */
3626    struct LDKInMemorySigner *result;
3627    /**
3628     * A pointer to the contents in the error state.
3629     * Reading from this pointer when `result_ok` is set is undefined.
3630     */
3631    struct LDKDecodeError *err;
3632 } LDKCResult_InMemorySignerDecodeErrorZPtr;
3633
3634 /**
3635  * A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation,
3636  * containing a crate::lightning::chain::keysinterface::InMemorySigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
3637  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3638  */
3639 typedef struct LDKCResult_InMemorySignerDecodeErrorZ {
3640    /**
3641     * The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either
3642     * `err` or `result` depending on the state of `result_ok`.
3643     */
3644    union LDKCResult_InMemorySignerDecodeErrorZPtr contents;
3645    /**
3646     * Whether this CResult_InMemorySignerDecodeErrorZ represents a success state.
3647     */
3648    bool result_ok;
3649 } LDKCResult_InMemorySignerDecodeErrorZ;
3650
3651 /**
3652  * A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size.
3653  * This corresponds to std::vector in C++
3654  */
3655 typedef struct LDKCVec_TxOutZ {
3656    /**
3657     * The elements in the array.
3658     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3659     */
3660    struct LDKTxOut *data;
3661    /**
3662     * The number of elements pointed to by `data`.
3663     */
3664    uintptr_t datalen;
3665 } LDKCVec_TxOutZ;
3666
3667 /**
3668  * The contents of CResult_TransactionNoneZ
3669  */
3670 typedef union LDKCResult_TransactionNoneZPtr {
3671    /**
3672     * A pointer to the contents in the success state.
3673     * Reading from this pointer when `result_ok` is not set is undefined.
3674     */
3675    struct LDKTransaction *result;
3676    /**
3677     * Note that this value is always NULL, as there are no contents in the Err variant
3678     */
3679    void *err;
3680 } LDKCResult_TransactionNoneZPtr;
3681
3682 /**
3683  * A CResult_TransactionNoneZ represents the result of a fallible operation,
3684  * containing a crate::c_types::Transaction on success and a () on failure.
3685  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3686  */
3687 typedef struct LDKCResult_TransactionNoneZ {
3688    /**
3689     * The contents of this CResult_TransactionNoneZ, accessible via either
3690     * `err` or `result` depending on the state of `result_ok`.
3691     */
3692    union LDKCResult_TransactionNoneZPtr contents;
3693    /**
3694     * Whether this CResult_TransactionNoneZ represents a success state.
3695     */
3696    bool result_ok;
3697 } LDKCResult_TransactionNoneZ;
3698
3699
3700
3701 /**
3702  * A ChannelMonitor handles chain events (blocks connected and disconnected) and generates
3703  * on-chain transactions to ensure no loss of funds occurs.
3704  *
3705  * You MUST ensure that no ChannelMonitors for a given channel anywhere contain out-of-date
3706  * information and are actively monitoring the chain.
3707  *
3708  * Pending Events or updated HTLCs which have not yet been read out by
3709  * get_and_clear_pending_monitor_events or get_and_clear_pending_events are serialized to disk and
3710  * reloaded at deserialize-time. Thus, you must ensure that, when handling events, all events
3711  * gotten are fully handled before re-serializing the new state.
3712  *
3713  * Note that the deserializer is only implemented for (BlockHash, ChannelMonitor), which
3714  * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along
3715  * the \"reorg path\" (ie disconnecting blocks until you find a common ancestor from both the
3716  * returned block hash and the the current chain and then reconnecting blocks to get to the
3717  * best chain) upon deserializing the object!
3718  */
3719 typedef struct MUST_USE_STRUCT LDKChannelMonitor {
3720    /**
3721     * A pointer to the opaque Rust object.
3722     * Nearly everywhere, inner must be non-null, however in places where
3723     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3724     */
3725    LDKnativeChannelMonitor *inner;
3726    /**
3727     * Indicates that this is the only struct which contains the same pointer.
3728     * Rust functions which take ownership of an object provided via an argument require
3729     * this to be true and invalidate the object pointed to by inner.
3730     */
3731    bool is_owned;
3732 } LDKChannelMonitor;
3733
3734 /**
3735  * A tuple of 2 elements. See the individual fields for the types contained.
3736  */
3737 typedef struct LDKC2Tuple_BlockHashChannelMonitorZ {
3738    /**
3739     * The element at position 0
3740     */
3741    struct LDKThirtyTwoBytes a;
3742    /**
3743     * The element at position 1
3744     */
3745    struct LDKChannelMonitor b;
3746 } LDKC2Tuple_BlockHashChannelMonitorZ;
3747
3748 /**
3749  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZs of arbitrary size.
3750  * This corresponds to std::vector in C++
3751  */
3752 typedef struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ {
3753    /**
3754     * The elements in the array.
3755     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3756     */
3757    struct LDKC2Tuple_BlockHashChannelMonitorZ *data;
3758    /**
3759     * The number of elements pointed to by `data`.
3760     */
3761    uintptr_t datalen;
3762 } LDKCVec_C2Tuple_BlockHashChannelMonitorZZ;
3763
3764 /**
3765  * The contents of CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ
3766  */
3767 typedef union LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
3768    /**
3769     * A pointer to the contents in the success state.
3770     * Reading from this pointer when `result_ok` is not set is undefined.
3771     */
3772    struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ *result;
3773    /**
3774     * A pointer to the contents in the error state.
3775     * Reading from this pointer when `result_ok` is set is undefined.
3776     */
3777    enum LDKIOError *err;
3778 } LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr;
3779
3780 /**
3781  * A CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents the result of a fallible operation,
3782  * containing a crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ on success and a crate::c_types::IOError on failure.
3783  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3784  */
3785 typedef struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
3786    /**
3787     * The contents of this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ, accessible via either
3788     * `err` or `result` depending on the state of `result_ok`.
3789     */
3790    union LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr contents;
3791    /**
3792     * Whether this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents a success state.
3793     */
3794    bool result_ok;
3795 } LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ;
3796
3797 /**
3798  * An enum which can either contain a u16 or not
3799  */
3800 typedef enum LDKCOption_u16Z_Tag {
3801    /**
3802     * When we're in this state, this COption_u16Z contains a u16
3803     */
3804    LDKCOption_u16Z_Some,
3805    /**
3806     * When we're in this state, this COption_u16Z contains nothing
3807     */
3808    LDKCOption_u16Z_None,
3809    /**
3810     * Must be last for serialization purposes
3811     */
3812    LDKCOption_u16Z_Sentinel,
3813 } LDKCOption_u16Z_Tag;
3814
3815 typedef struct LDKCOption_u16Z {
3816    LDKCOption_u16Z_Tag tag;
3817    union {
3818       struct {
3819          uint16_t some;
3820       };
3821    };
3822 } LDKCOption_u16Z;
3823
3824 /**
3825  * Indicates an error on the client's part (usually some variant of attempting to use too-low or
3826  * too-high values)
3827  */
3828 typedef enum LDKAPIError_Tag {
3829    /**
3830     * Indicates the API was wholly misused (see err for more). Cases where these can be returned
3831     * are documented, but generally indicates some precondition of a function was violated.
3832     */
3833    LDKAPIError_APIMisuseError,
3834    /**
3835     * Due to a high feerate, we were unable to complete the request.
3836     * For example, this may be returned if the feerate implies we cannot open a channel at the
3837     * requested value, but opening a larger channel would succeed.
3838     */
3839    LDKAPIError_FeeRateTooHigh,
3840    /**
3841     * A malformed Route was provided (eg overflowed value, node id mismatch, overly-looped route,
3842     * too-many-hops, etc).
3843     */
3844    LDKAPIError_RouteError,
3845    /**
3846     * We were unable to complete the request as the Channel required to do so is unable to
3847     * complete the request (or was not found). This can take many forms, including disconnected
3848     * peer, channel at capacity, channel shutting down, etc.
3849     */
3850    LDKAPIError_ChannelUnavailable,
3851    /**
3852     * An attempt to call watch/update_channel returned an Err (ie you did this!), causing the
3853     * attempted action to fail.
3854     */
3855    LDKAPIError_MonitorUpdateFailed,
3856    /**
3857     * [`KeysInterface::get_shutdown_scriptpubkey`] returned a shutdown scriptpubkey incompatible
3858     * with the channel counterparty as negotiated in [`InitFeatures`].
3859     *
3860     * Using a SegWit v0 script should resolve this issue. If you cannot, you won't be able to open
3861     * a channel or cooperatively close one with this peer (and will have to force-close instead).
3862     *
3863     * [`KeysInterface::get_shutdown_scriptpubkey`]: crate::chain::keysinterface::KeysInterface::get_shutdown_scriptpubkey
3864     * [`InitFeatures`]: crate::ln::features::InitFeatures
3865     */
3866    LDKAPIError_IncompatibleShutdownScript,
3867    /**
3868     * Must be last for serialization purposes
3869     */
3870    LDKAPIError_Sentinel,
3871 } LDKAPIError_Tag;
3872
3873 typedef struct LDKAPIError_LDKAPIMisuseError_Body {
3874    /**
3875     * A human-readable error message
3876     */
3877    struct LDKStr err;
3878 } LDKAPIError_LDKAPIMisuseError_Body;
3879
3880 typedef struct LDKAPIError_LDKFeeRateTooHigh_Body {
3881    /**
3882     * A human-readable error message
3883     */
3884    struct LDKStr err;
3885    /**
3886     * The feerate which was too high.
3887     */
3888    uint32_t feerate;
3889 } LDKAPIError_LDKFeeRateTooHigh_Body;
3890
3891 typedef struct LDKAPIError_LDKRouteError_Body {
3892    /**
3893     * A human-readable error message
3894     */
3895    struct LDKStr err;
3896 } LDKAPIError_LDKRouteError_Body;
3897
3898 typedef struct LDKAPIError_LDKChannelUnavailable_Body {
3899    /**
3900     * A human-readable error message
3901     */
3902    struct LDKStr err;
3903 } LDKAPIError_LDKChannelUnavailable_Body;
3904
3905 typedef struct LDKAPIError_LDKIncompatibleShutdownScript_Body {
3906    /**
3907     * The incompatible shutdown script.
3908     */
3909    struct LDKShutdownScript script;
3910 } LDKAPIError_LDKIncompatibleShutdownScript_Body;
3911
3912 typedef struct MUST_USE_STRUCT LDKAPIError {
3913    LDKAPIError_Tag tag;
3914    union {
3915       LDKAPIError_LDKAPIMisuseError_Body api_misuse_error;
3916       LDKAPIError_LDKFeeRateTooHigh_Body fee_rate_too_high;
3917       LDKAPIError_LDKRouteError_Body route_error;
3918       LDKAPIError_LDKChannelUnavailable_Body channel_unavailable;
3919       LDKAPIError_LDKIncompatibleShutdownScript_Body incompatible_shutdown_script;
3920    };
3921 } LDKAPIError;
3922
3923 /**
3924  * The contents of CResult_NoneAPIErrorZ
3925  */
3926 typedef union LDKCResult_NoneAPIErrorZPtr {
3927    /**
3928     * Note that this value is always NULL, as there are no contents in the OK variant
3929     */
3930    void *result;
3931    /**
3932     * A pointer to the contents in the error state.
3933     * Reading from this pointer when `result_ok` is set is undefined.
3934     */
3935    struct LDKAPIError *err;
3936 } LDKCResult_NoneAPIErrorZPtr;
3937
3938 /**
3939  * A CResult_NoneAPIErrorZ represents the result of a fallible operation,
3940  * containing a () on success and a crate::lightning::util::errors::APIError on failure.
3941  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3942  */
3943 typedef struct LDKCResult_NoneAPIErrorZ {
3944    /**
3945     * The contents of this CResult_NoneAPIErrorZ, accessible via either
3946     * `err` or `result` depending on the state of `result_ok`.
3947     */
3948    union LDKCResult_NoneAPIErrorZPtr contents;
3949    /**
3950     * Whether this CResult_NoneAPIErrorZ represents a success state.
3951     */
3952    bool result_ok;
3953 } LDKCResult_NoneAPIErrorZ;
3954
3955 /**
3956  * A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size.
3957  * This corresponds to std::vector in C++
3958  */
3959 typedef struct LDKCVec_CResult_NoneAPIErrorZZ {
3960    /**
3961     * The elements in the array.
3962     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3963     */
3964    struct LDKCResult_NoneAPIErrorZ *data;
3965    /**
3966     * The number of elements pointed to by `data`.
3967     */
3968    uintptr_t datalen;
3969 } LDKCVec_CResult_NoneAPIErrorZZ;
3970
3971 /**
3972  * A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size.
3973  * This corresponds to std::vector in C++
3974  */
3975 typedef struct LDKCVec_APIErrorZ {
3976    /**
3977     * The elements in the array.
3978     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3979     */
3980    struct LDKAPIError *data;
3981    /**
3982     * The number of elements pointed to by `data`.
3983     */
3984    uintptr_t datalen;
3985 } LDKCVec_APIErrorZ;
3986
3987 /**
3988  * If a payment fails to send, it can be in one of several states. This enum is returned as the
3989  * Err() type describing which state the payment is in, see the description of individual enum
3990  * states for more.
3991  */
3992 typedef enum LDKPaymentSendFailure_Tag {
3993    /**
3994     * A parameter which was passed to send_payment was invalid, preventing us from attempting to
3995     * send the payment at all. No channel state has been changed or messages sent to peers, and
3996     * once you've changed the parameter at error, you can freely retry the payment in full.
3997     */
3998    LDKPaymentSendFailure_ParameterError,
3999    /**
4000     * A parameter in a single path which was passed to send_payment was invalid, preventing us
4001     * from attempting to send the payment at all. No channel state has been changed or messages
4002     * sent to peers, and once you've changed the parameter at error, you can freely retry the
4003     * payment in full.
4004     *
4005     * The results here are ordered the same as the paths in the route object which was passed to
4006     * send_payment.
4007     */
4008    LDKPaymentSendFailure_PathParameterError,
4009    /**
4010     * All paths which were attempted failed to send, with no channel state change taking place.
4011     * You can freely retry the payment in full (though you probably want to do so over different
4012     * paths than the ones selected).
4013     */
4014    LDKPaymentSendFailure_AllFailedRetrySafe,
4015    /**
4016     * Some paths which were attempted failed to send, though possibly not all. At least some
4017     * paths have irrevocably committed to the HTLC and retrying the payment in full would result
4018     * in over-/re-payment.
4019     *
4020     * The results here are ordered the same as the paths in the route object which was passed to
4021     * send_payment, and any Errs which are not APIError::MonitorUpdateFailed can be safely
4022     * retried (though there is currently no API with which to do so).
4023     *
4024     * Any entries which contain Err(APIError::MonitorUpdateFailed) or Ok(()) MUST NOT be retried
4025     * as they will result in over-/re-payment. These HTLCs all either successfully sent (in the
4026     * case of Ok(())) or will send once channel_monitor_updated is called on the next-hop channel
4027     * with the latest update_id.
4028     */
4029    LDKPaymentSendFailure_PartialFailure,
4030    /**
4031     * Must be last for serialization purposes
4032     */
4033    LDKPaymentSendFailure_Sentinel,
4034 } LDKPaymentSendFailure_Tag;
4035
4036 typedef struct MUST_USE_STRUCT LDKPaymentSendFailure {
4037    LDKPaymentSendFailure_Tag tag;
4038    union {
4039       struct {
4040          struct LDKAPIError parameter_error;
4041       };
4042       struct {
4043          struct LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error;
4044       };
4045       struct {
4046          struct LDKCVec_APIErrorZ all_failed_retry_safe;
4047       };
4048       struct {
4049          struct LDKCVec_CResult_NoneAPIErrorZZ partial_failure;
4050       };
4051    };
4052 } LDKPaymentSendFailure;
4053
4054 /**
4055  * The contents of CResult_NonePaymentSendFailureZ
4056  */
4057 typedef union LDKCResult_NonePaymentSendFailureZPtr {
4058    /**
4059     * Note that this value is always NULL, as there are no contents in the OK variant
4060     */
4061    void *result;
4062    /**
4063     * A pointer to the contents in the error state.
4064     * Reading from this pointer when `result_ok` is set is undefined.
4065     */
4066    struct LDKPaymentSendFailure *err;
4067 } LDKCResult_NonePaymentSendFailureZPtr;
4068
4069 /**
4070  * A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
4071  * containing a () on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
4072  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4073  */
4074 typedef struct LDKCResult_NonePaymentSendFailureZ {
4075    /**
4076     * The contents of this CResult_NonePaymentSendFailureZ, accessible via either
4077     * `err` or `result` depending on the state of `result_ok`.
4078     */
4079    union LDKCResult_NonePaymentSendFailureZPtr contents;
4080    /**
4081     * Whether this CResult_NonePaymentSendFailureZ represents a success state.
4082     */
4083    bool result_ok;
4084 } LDKCResult_NonePaymentSendFailureZ;
4085
4086 /**
4087  * The contents of CResult_PaymentHashPaymentSendFailureZ
4088  */
4089 typedef union LDKCResult_PaymentHashPaymentSendFailureZPtr {
4090    /**
4091     * A pointer to the contents in the success state.
4092     * Reading from this pointer when `result_ok` is not set is undefined.
4093     */
4094    struct LDKThirtyTwoBytes *result;
4095    /**
4096     * A pointer to the contents in the error state.
4097     * Reading from this pointer when `result_ok` is set is undefined.
4098     */
4099    struct LDKPaymentSendFailure *err;
4100 } LDKCResult_PaymentHashPaymentSendFailureZPtr;
4101
4102 /**
4103  * A CResult_PaymentHashPaymentSendFailureZ represents the result of a fallible operation,
4104  * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
4105  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4106  */
4107 typedef struct LDKCResult_PaymentHashPaymentSendFailureZ {
4108    /**
4109     * The contents of this CResult_PaymentHashPaymentSendFailureZ, accessible via either
4110     * `err` or `result` depending on the state of `result_ok`.
4111     */
4112    union LDKCResult_PaymentHashPaymentSendFailureZPtr contents;
4113    /**
4114     * Whether this CResult_PaymentHashPaymentSendFailureZ represents a success state.
4115     */
4116    bool result_ok;
4117 } LDKCResult_PaymentHashPaymentSendFailureZ;
4118
4119 /**
4120  * A 4-byte byte array.
4121  */
4122 typedef struct LDKFourBytes {
4123    /**
4124     * The four bytes
4125     */
4126    uint8_t data[4];
4127 } LDKFourBytes;
4128
4129 /**
4130  * A 16-byte byte array.
4131  */
4132 typedef struct LDKSixteenBytes {
4133    /**
4134     * The sixteen bytes
4135     */
4136    uint8_t data[16];
4137 } LDKSixteenBytes;
4138
4139 /**
4140  * A 10-byte byte array.
4141  */
4142 typedef struct LDKTenBytes {
4143    /**
4144     * The ten bytes
4145     */
4146    uint8_t data[10];
4147 } LDKTenBytes;
4148
4149 /**
4150  * An address which can be used to connect to a remote peer
4151  */
4152 typedef enum LDKNetAddress_Tag {
4153    /**
4154     * An IPv4 address/port on which the peer is listening.
4155     */
4156    LDKNetAddress_IPv4,
4157    /**
4158     * An IPv6 address/port on which the peer is listening.
4159     */
4160    LDKNetAddress_IPv6,
4161    /**
4162     * An old-style Tor onion address/port on which the peer is listening.
4163     */
4164    LDKNetAddress_OnionV2,
4165    /**
4166     * A new-style Tor onion address/port on which the peer is listening.
4167     * To create the human-readable \"hostname\", concatenate ed25519_pubkey, checksum, and version,
4168     * wrap as base32 and append \".onion\".
4169     */
4170    LDKNetAddress_OnionV3,
4171    /**
4172     * Must be last for serialization purposes
4173     */
4174    LDKNetAddress_Sentinel,
4175 } LDKNetAddress_Tag;
4176
4177 typedef struct LDKNetAddress_LDKIPv4_Body {
4178    /**
4179     * The 4-byte IPv4 address
4180     */
4181    struct LDKFourBytes addr;
4182    /**
4183     * The port on which the node is listening
4184     */
4185    uint16_t port;
4186 } LDKNetAddress_LDKIPv4_Body;
4187
4188 typedef struct LDKNetAddress_LDKIPv6_Body {
4189    /**
4190     * The 16-byte IPv6 address
4191     */
4192    struct LDKSixteenBytes addr;
4193    /**
4194     * The port on which the node is listening
4195     */
4196    uint16_t port;
4197 } LDKNetAddress_LDKIPv6_Body;
4198
4199 typedef struct LDKNetAddress_LDKOnionV2_Body {
4200    /**
4201     * The bytes (usually encoded in base32 with \".onion\" appended)
4202     */
4203    struct LDKTenBytes addr;
4204    /**
4205     * The port on which the node is listening
4206     */
4207    uint16_t port;
4208 } LDKNetAddress_LDKOnionV2_Body;
4209
4210 typedef struct LDKNetAddress_LDKOnionV3_Body {
4211    /**
4212     * The ed25519 long-term public key of the peer
4213     */
4214    struct LDKThirtyTwoBytes ed25519_pubkey;
4215    /**
4216     * The checksum of the pubkey and version, as included in the onion address
4217     */
4218    uint16_t checksum;
4219    /**
4220     * The version byte, as defined by the Tor Onion v3 spec.
4221     */
4222    uint8_t version;
4223    /**
4224     * The port on which the node is listening
4225     */
4226    uint16_t port;
4227 } LDKNetAddress_LDKOnionV3_Body;
4228
4229 typedef struct MUST_USE_STRUCT LDKNetAddress {
4230    LDKNetAddress_Tag tag;
4231    union {
4232       LDKNetAddress_LDKIPv4_Body i_pv4;
4233       LDKNetAddress_LDKIPv6_Body i_pv6;
4234       LDKNetAddress_LDKOnionV2_Body onion_v2;
4235       LDKNetAddress_LDKOnionV3_Body onion_v3;
4236    };
4237 } LDKNetAddress;
4238
4239 /**
4240  * A dynamically-allocated array of crate::lightning::ln::msgs::NetAddresss of arbitrary size.
4241  * This corresponds to std::vector in C++
4242  */
4243 typedef struct LDKCVec_NetAddressZ {
4244    /**
4245     * The elements in the array.
4246     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4247     */
4248    struct LDKNetAddress *data;
4249    /**
4250     * The number of elements pointed to by `data`.
4251     */
4252    uintptr_t datalen;
4253 } LDKCVec_NetAddressZ;
4254
4255 /**
4256  * A tuple of 2 elements. See the individual fields for the types contained.
4257  */
4258 typedef struct LDKC2Tuple_PaymentHashPaymentSecretZ {
4259    /**
4260     * The element at position 0
4261     */
4262    struct LDKThirtyTwoBytes a;
4263    /**
4264     * The element at position 1
4265     */
4266    struct LDKThirtyTwoBytes b;
4267 } LDKC2Tuple_PaymentHashPaymentSecretZ;
4268
4269 /**
4270  * The contents of CResult_PaymentSecretAPIErrorZ
4271  */
4272 typedef union LDKCResult_PaymentSecretAPIErrorZPtr {
4273    /**
4274     * A pointer to the contents in the success state.
4275     * Reading from this pointer when `result_ok` is not set is undefined.
4276     */
4277    struct LDKThirtyTwoBytes *result;
4278    /**
4279     * A pointer to the contents in the error state.
4280     * Reading from this pointer when `result_ok` is set is undefined.
4281     */
4282    struct LDKAPIError *err;
4283 } LDKCResult_PaymentSecretAPIErrorZPtr;
4284
4285 /**
4286  * A CResult_PaymentSecretAPIErrorZ represents the result of a fallible operation,
4287  * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
4288  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4289  */
4290 typedef struct LDKCResult_PaymentSecretAPIErrorZ {
4291    /**
4292     * The contents of this CResult_PaymentSecretAPIErrorZ, accessible via either
4293     * `err` or `result` depending on the state of `result_ok`.
4294     */
4295    union LDKCResult_PaymentSecretAPIErrorZPtr contents;
4296    /**
4297     * Whether this CResult_PaymentSecretAPIErrorZ represents a success state.
4298     */
4299    bool result_ok;
4300 } LDKCResult_PaymentSecretAPIErrorZ;
4301
4302 /**
4303  * A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
4304  * This corresponds to std::vector in C++
4305  */
4306 typedef struct LDKCVec_ChannelMonitorZ {
4307    /**
4308     * The elements in the array.
4309     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4310     */
4311    struct LDKChannelMonitor *data;
4312    /**
4313     * The number of elements pointed to by `data`.
4314     */
4315    uintptr_t datalen;
4316 } LDKCVec_ChannelMonitorZ;
4317
4318
4319
4320 /**
4321  * An update generated by the underlying Channel itself which contains some new information the
4322  * ChannelMonitor should be made aware of.
4323  */
4324 typedef struct MUST_USE_STRUCT LDKChannelMonitorUpdate {
4325    /**
4326     * A pointer to the opaque Rust object.
4327     * Nearly everywhere, inner must be non-null, however in places where
4328     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4329     */
4330    LDKnativeChannelMonitorUpdate *inner;
4331    /**
4332     * Indicates that this is the only struct which contains the same pointer.
4333     * Rust functions which take ownership of an object provided via an argument require
4334     * this to be true and invalidate the object pointed to by inner.
4335     */
4336    bool is_owned;
4337 } LDKChannelMonitorUpdate;
4338
4339 /**
4340  * The `Watch` trait defines behavior for watching on-chain activity pertaining to channels as
4341  * blocks are connected and disconnected.
4342  *
4343  * Each channel is associated with a [`ChannelMonitor`]. Implementations of this trait are
4344  * responsible for maintaining a set of monitors such that they can be updated accordingly as
4345  * channel state changes and HTLCs are resolved. See method documentation for specific
4346  * requirements.
4347  *
4348  * Implementations **must** ensure that updates are successfully applied and persisted upon method
4349  * completion. If an update fails with a [`PermanentFailure`], then it must immediately shut down
4350  * without taking any further action such as persisting the current state.
4351  *
4352  * If an implementation maintains multiple instances of a channel's monitor (e.g., by storing
4353  * backup copies), then it must ensure that updates are applied across all instances. Otherwise, it
4354  * could result in a revoked transaction being broadcast, allowing the counterparty to claim all
4355  * funds in the channel. See [`ChannelMonitorUpdateErr`] for more details about how to handle
4356  * multiple instances.
4357  *
4358  * [`ChannelMonitor`]: channelmonitor::ChannelMonitor
4359  * [`ChannelMonitorUpdateErr`]: channelmonitor::ChannelMonitorUpdateErr
4360  * [`PermanentFailure`]: channelmonitor::ChannelMonitorUpdateErr::PermanentFailure
4361  */
4362 typedef struct LDKWatch {
4363    /**
4364     * An opaque pointer which is passed to your function implementations as an argument.
4365     * This has no meaning in the LDK, and can be NULL or any other value.
4366     */
4367    void *this_arg;
4368    /**
4369     * Watches a channel identified by `funding_txo` using `monitor`.
4370     *
4371     * Implementations are responsible for watching the chain for the funding transaction along
4372     * with any spends of outputs returned by [`get_outputs_to_watch`]. In practice, this means
4373     * calling [`block_connected`] and [`block_disconnected`] on the monitor.
4374     *
4375     * [`get_outputs_to_watch`]: channelmonitor::ChannelMonitor::get_outputs_to_watch
4376     * [`block_connected`]: channelmonitor::ChannelMonitor::block_connected
4377     * [`block_disconnected`]: channelmonitor::ChannelMonitor::block_disconnected
4378     */
4379    struct LDKCResult_NoneChannelMonitorUpdateErrZ (*watch_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitor monitor);
4380    /**
4381     * Updates a channel identified by `funding_txo` by applying `update` to its monitor.
4382     *
4383     * Implementations must call [`update_monitor`] with the given update. See
4384     * [`ChannelMonitorUpdateErr`] for invariants around returning an error.
4385     *
4386     * [`update_monitor`]: channelmonitor::ChannelMonitor::update_monitor
4387     * [`ChannelMonitorUpdateErr`]: channelmonitor::ChannelMonitorUpdateErr
4388     */
4389    struct LDKCResult_NoneChannelMonitorUpdateErrZ (*update_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitorUpdate update);
4390    /**
4391     * Returns any monitor events since the last call. Subsequent calls must only return new
4392     * events.
4393     */
4394    struct LDKCVec_MonitorEventZ (*release_pending_monitor_events)(const void *this_arg);
4395    /**
4396     * Frees any resources associated with this object given its this_arg pointer.
4397     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
4398     */
4399    void (*free)(void *this_arg);
4400 } LDKWatch;
4401
4402 /**
4403  * An interface to send a transaction to the Bitcoin network.
4404  */
4405 typedef struct LDKBroadcasterInterface {
4406    /**
4407     * An opaque pointer which is passed to your function implementations as an argument.
4408     * This has no meaning in the LDK, and can be NULL or any other value.
4409     */
4410    void *this_arg;
4411    /**
4412     * Sends a transaction out to (hopefully) be mined.
4413     */
4414    void (*broadcast_transaction)(const void *this_arg, struct LDKTransaction tx);
4415    /**
4416     * Frees any resources associated with this object given its this_arg pointer.
4417     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
4418     */
4419    void (*free)(void *this_arg);
4420 } LDKBroadcasterInterface;
4421
4422 /**
4423  * A "slice" referencing some byte array. This is simply a length-tagged pointer which does not
4424  * own the memory pointed to by data.
4425  */
4426 typedef struct LDKu8slice {
4427    /**
4428     * A pointer to the byte buffer
4429     */
4430    const uint8_t *data;
4431    /**
4432     * The number of bytes pointed to by `data`.
4433     */
4434    uintptr_t datalen;
4435 } LDKu8slice;
4436
4437 /**
4438  * A trait to describe an object which can get user secrets and key material.
4439  */
4440 typedef struct LDKKeysInterface {
4441    /**
4442     * An opaque pointer which is passed to your function implementations as an argument.
4443     * This has no meaning in the LDK, and can be NULL or any other value.
4444     */
4445    void *this_arg;
4446    /**
4447     * Get node secret key (aka node_id or network_key).
4448     *
4449     * This method must return the same value each time it is called.
4450     */
4451    struct LDKSecretKey (*get_node_secret)(const void *this_arg);
4452    /**
4453     * Get a script pubkey which we send funds to when claiming on-chain contestable outputs.
4454     *
4455     * This method should return a different value each time it is called, to avoid linking
4456     * on-chain funds across channels as controlled to the same user.
4457     */
4458    struct LDKCVec_u8Z (*get_destination_script)(const void *this_arg);
4459    /**
4460     * Get a script pubkey which we will send funds to when closing a channel.
4461     *
4462     * This method should return a different value each time it is called, to avoid linking
4463     * on-chain funds across channels as controlled to the same user.
4464     */
4465    struct LDKShutdownScript (*get_shutdown_scriptpubkey)(const void *this_arg);
4466    /**
4467     * Get a new set of Sign for per-channel secrets. These MUST be unique even if you
4468     * restarted with some stale data!
4469     *
4470     * This method must return a different value each time it is called.
4471     */
4472    struct LDKSign (*get_channel_signer)(const void *this_arg, bool inbound, uint64_t channel_value_satoshis);
4473    /**
4474     * Gets a unique, cryptographically-secure, random 32 byte value. This is used for encrypting
4475     * onion packets and for temporary channel IDs. There is no requirement that these be
4476     * persisted anywhere, though they must be unique across restarts.
4477     *
4478     * This method must return a different value each time it is called.
4479     */
4480    struct LDKThirtyTwoBytes (*get_secure_random_bytes)(const void *this_arg);
4481    /**
4482     * Reads a `Signer` for this `KeysInterface` from the given input stream.
4483     * This is only called during deserialization of other objects which contain
4484     * `Sign`-implementing objects (ie `ChannelMonitor`s and `ChannelManager`s).
4485     * The bytes are exactly those which `<Self::Signer as Writeable>::write()` writes, and
4486     * contain no versioning scheme. You may wish to include your own version prefix and ensure
4487     * you've read all of the provided bytes to ensure no corruption occurred.
4488     */
4489    struct LDKCResult_SignDecodeErrorZ (*read_chan_signer)(const void *this_arg, struct LDKu8slice reader);
4490    /**
4491     * Sign an invoice's preimage (note that this is the preimage of the invoice, not the HTLC's
4492     * preimage). By parameterizing by the preimage instead of the hash, we allow implementors of
4493     * this trait to parse the invoice and make sure they're signing what they expect, rather than
4494     * blindly signing the hash.
4495     */
4496    struct LDKCResult_RecoverableSignatureNoneZ (*sign_invoice)(const void *this_arg, struct LDKCVec_u8Z invoice_preimage);
4497    /**
4498     * Frees any resources associated with this object given its this_arg pointer.
4499     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
4500     */
4501    void (*free)(void *this_arg);
4502 } LDKKeysInterface;
4503
4504 /**
4505  * A trait which should be implemented to provide feerate information on a number of time
4506  * horizons.
4507  *
4508  * Note that all of the functions implemented here *must* be reentrant-safe (obviously - they're
4509  * called from inside the library in response to chain events, P2P events, or timer events).
4510  */
4511 typedef struct LDKFeeEstimator {
4512    /**
4513     * An opaque pointer which is passed to your function implementations as an argument.
4514     * This has no meaning in the LDK, and can be NULL or any other value.
4515     */
4516    void *this_arg;
4517    /**
4518     * Gets estimated satoshis of fee required per 1000 Weight-Units.
4519     *
4520     * Must be no smaller than 253 (ie 1 satoshi-per-byte rounded up to ensure later round-downs
4521     * don't put us below 1 satoshi-per-byte).
4522     *
4523     * This translates to:
4524     *  * satoshis-per-byte * 250
4525     *  * ceil(satoshis-per-kbyte / 4)
4526     */
4527    uint32_t (*get_est_sat_per_1000_weight)(const void *this_arg, enum LDKConfirmationTarget confirmation_target);
4528    /**
4529     * Frees any resources associated with this object given its this_arg pointer.
4530     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
4531     */
4532    void (*free)(void *this_arg);
4533 } LDKFeeEstimator;
4534
4535 /**
4536  * A trait encapsulating the operations required of a logger
4537  */
4538 typedef struct LDKLogger {
4539    /**
4540     * An opaque pointer which is passed to your function implementations as an argument.
4541     * This has no meaning in the LDK, and can be NULL or any other value.
4542     */
4543    void *this_arg;
4544    /**
4545     * Logs the `Record`
4546     */
4547    void (*log)(const void *this_arg, const char *record);
4548    /**
4549     * Frees any resources associated with this object given its this_arg pointer.
4550     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
4551     */
4552    void (*free)(void *this_arg);
4553 } LDKLogger;
4554
4555
4556
4557 /**
4558  * Manager which keeps track of a number of channels and sends messages to the appropriate
4559  * channel, also tracking HTLC preimages and forwarding onion packets appropriately.
4560  *
4561  * Implements ChannelMessageHandler, handling the multi-channel parts and passing things through
4562  * to individual Channels.
4563  *
4564  * Implements Writeable to write out all channel state to disk. Implies peer_disconnected() for
4565  * all peers during write/read (though does not modify this instance, only the instance being
4566  * serialized). This will result in any channels which have not yet exchanged funding_created (ie
4567  * called funding_transaction_generated for outbound channels).
4568  *
4569  * Note that you can be a bit lazier about writing out ChannelManager than you can be with
4570  * ChannelMonitors. With ChannelMonitors you MUST write each monitor update out to disk before
4571  * returning from chain::Watch::watch_/update_channel, with ChannelManagers, writing updates
4572  * happens out-of-band (and will prevent any other ChannelManager operations from occurring during
4573  * the serialization process). If the deserialized version is out-of-date compared to the
4574  * ChannelMonitors passed by reference to read(), those channels will be force-closed based on the
4575  * ChannelMonitor state and no funds will be lost (mod on-chain transaction fees).
4576  *
4577  * Note that the deserializer is only implemented for (BlockHash, ChannelManager), which
4578  * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along
4579  * the \"reorg path\" (ie call block_disconnected() until you get to a common block and then call
4580  * block_connected() to step towards your best block) upon deserialization before using the
4581  * object!
4582  *
4583  * Note that ChannelManager is responsible for tracking liveness of its channels and generating
4584  * ChannelUpdate messages informing peers that the channel is temporarily disabled. To avoid
4585  * spam due to quick disconnection/reconnection, updates are not sent until the channel has been
4586  * offline for a full minute. In order to track this, you must call
4587  * timer_tick_occurred roughly once per minute, though it doesn't have to be perfect.
4588  *
4589  * Rather than using a plain ChannelManager, it is preferable to use either a SimpleArcChannelManager
4590  * a SimpleRefChannelManager, for conciseness. See their documentation for more details, but
4591  * essentially you should default to using a SimpleRefChannelManager, and use a
4592  * SimpleArcChannelManager when you require a ChannelManager with a static lifetime, such as when
4593  * you're using lightning-net-tokio.
4594  */
4595 typedef struct MUST_USE_STRUCT LDKChannelManager {
4596    /**
4597     * A pointer to the opaque Rust object.
4598     * Nearly everywhere, inner must be non-null, however in places where
4599     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4600     */
4601    LDKnativeChannelManager *inner;
4602    /**
4603     * Indicates that this is the only struct which contains the same pointer.
4604     * Rust functions which take ownership of an object provided via an argument require
4605     * this to be true and invalidate the object pointed to by inner.
4606     */
4607    bool is_owned;
4608 } LDKChannelManager;
4609
4610 /**
4611  * A tuple of 2 elements. See the individual fields for the types contained.
4612  */
4613 typedef struct LDKC2Tuple_BlockHashChannelManagerZ {
4614    /**
4615     * The element at position 0
4616     */
4617    struct LDKThirtyTwoBytes a;
4618    /**
4619     * The element at position 1
4620     */
4621    struct LDKChannelManager b;
4622 } LDKC2Tuple_BlockHashChannelManagerZ;
4623
4624 /**
4625  * The contents of CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ
4626  */
4627 typedef union LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
4628    /**
4629     * A pointer to the contents in the success state.
4630     * Reading from this pointer when `result_ok` is not set is undefined.
4631     */
4632    struct LDKC2Tuple_BlockHashChannelManagerZ *result;
4633    /**
4634     * A pointer to the contents in the error state.
4635     * Reading from this pointer when `result_ok` is set is undefined.
4636     */
4637    struct LDKDecodeError *err;
4638 } LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr;
4639
4640 /**
4641  * A CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents the result of a fallible operation,
4642  * containing a crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
4643  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4644  */
4645 typedef struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
4646    /**
4647     * The contents of this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ, accessible via either
4648     * `err` or `result` depending on the state of `result_ok`.
4649     */
4650    union LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr contents;
4651    /**
4652     * Whether this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents a success state.
4653     */
4654    bool result_ok;
4655 } LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ;
4656
4657
4658
4659 /**
4660  * Options which apply on a per-channel basis and may change at runtime or based on negotiation
4661  * with our counterparty.
4662  */
4663 typedef struct MUST_USE_STRUCT LDKChannelConfig {
4664    /**
4665     * A pointer to the opaque Rust object.
4666     * Nearly everywhere, inner must be non-null, however in places where
4667     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4668     */
4669    LDKnativeChannelConfig *inner;
4670    /**
4671     * Indicates that this is the only struct which contains the same pointer.
4672     * Rust functions which take ownership of an object provided via an argument require
4673     * this to be true and invalidate the object pointed to by inner.
4674     */
4675    bool is_owned;
4676 } LDKChannelConfig;
4677
4678 /**
4679  * The contents of CResult_ChannelConfigDecodeErrorZ
4680  */
4681 typedef union LDKCResult_ChannelConfigDecodeErrorZPtr {
4682    /**
4683     * A pointer to the contents in the success state.
4684     * Reading from this pointer when `result_ok` is not set is undefined.
4685     */
4686    struct LDKChannelConfig *result;
4687    /**
4688     * A pointer to the contents in the error state.
4689     * Reading from this pointer when `result_ok` is set is undefined.
4690     */
4691    struct LDKDecodeError *err;
4692 } LDKCResult_ChannelConfigDecodeErrorZPtr;
4693
4694 /**
4695  * A CResult_ChannelConfigDecodeErrorZ represents the result of a fallible operation,
4696  * containing a crate::lightning::util::config::ChannelConfig on success and a crate::lightning::ln::msgs::DecodeError on failure.
4697  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4698  */
4699 typedef struct LDKCResult_ChannelConfigDecodeErrorZ {
4700    /**
4701     * The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either
4702     * `err` or `result` depending on the state of `result_ok`.
4703     */
4704    union LDKCResult_ChannelConfigDecodeErrorZPtr contents;
4705    /**
4706     * Whether this CResult_ChannelConfigDecodeErrorZ represents a success state.
4707     */
4708    bool result_ok;
4709 } LDKCResult_ChannelConfigDecodeErrorZ;
4710
4711 /**
4712  * The contents of CResult_OutPointDecodeErrorZ
4713  */
4714 typedef union LDKCResult_OutPointDecodeErrorZPtr {
4715    /**
4716     * A pointer to the contents in the success state.
4717     * Reading from this pointer when `result_ok` is not set is undefined.
4718     */
4719    struct LDKOutPoint *result;
4720    /**
4721     * A pointer to the contents in the error state.
4722     * Reading from this pointer when `result_ok` is set is undefined.
4723     */
4724    struct LDKDecodeError *err;
4725 } LDKCResult_OutPointDecodeErrorZPtr;
4726
4727 /**
4728  * A CResult_OutPointDecodeErrorZ represents the result of a fallible operation,
4729  * containing a crate::lightning::chain::transaction::OutPoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
4730  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4731  */
4732 typedef struct LDKCResult_OutPointDecodeErrorZ {
4733    /**
4734     * The contents of this CResult_OutPointDecodeErrorZ, accessible via either
4735     * `err` or `result` depending on the state of `result_ok`.
4736     */
4737    union LDKCResult_OutPointDecodeErrorZPtr contents;
4738    /**
4739     * Whether this CResult_OutPointDecodeErrorZ represents a success state.
4740     */
4741    bool result_ok;
4742 } LDKCResult_OutPointDecodeErrorZ;
4743
4744 /**
4745  * The contents of CResult_SiPrefixNoneZ
4746  */
4747 typedef union LDKCResult_SiPrefixNoneZPtr {
4748    /**
4749     * A pointer to the contents in the success state.
4750     * Reading from this pointer when `result_ok` is not set is undefined.
4751     */
4752    enum LDKSiPrefix *result;
4753    /**
4754     * Note that this value is always NULL, as there are no contents in the Err variant
4755     */
4756    void *err;
4757 } LDKCResult_SiPrefixNoneZPtr;
4758
4759 /**
4760  * A CResult_SiPrefixNoneZ represents the result of a fallible operation,
4761  * containing a crate::lightning_invoice::SiPrefix on success and a () on failure.
4762  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4763  */
4764 typedef struct LDKCResult_SiPrefixNoneZ {
4765    /**
4766     * The contents of this CResult_SiPrefixNoneZ, accessible via either
4767     * `err` or `result` depending on the state of `result_ok`.
4768     */
4769    union LDKCResult_SiPrefixNoneZPtr contents;
4770    /**
4771     * Whether this CResult_SiPrefixNoneZ represents a success state.
4772     */
4773    bool result_ok;
4774 } LDKCResult_SiPrefixNoneZ;
4775
4776
4777
4778 /**
4779  * Represents a syntactically and semantically correct lightning BOLT11 invoice.
4780  *
4781  * There are three ways to construct an `Invoice`:
4782  *  1. using `InvoiceBuilder`
4783  *  2. using `Invoice::from_signed(SignedRawInvoice)`
4784  *  3. using `str::parse::<Invoice>(&str)`
4785  */
4786 typedef struct MUST_USE_STRUCT LDKInvoice {
4787    /**
4788     * A pointer to the opaque Rust object.
4789     * Nearly everywhere, inner must be non-null, however in places where
4790     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4791     */
4792    LDKnativeInvoice *inner;
4793    /**
4794     * Indicates that this is the only struct which contains the same pointer.
4795     * Rust functions which take ownership of an object provided via an argument require
4796     * this to be true and invalidate the object pointed to by inner.
4797     */
4798    bool is_owned;
4799 } LDKInvoice;
4800
4801 /**
4802  * The contents of CResult_InvoiceNoneZ
4803  */
4804 typedef union LDKCResult_InvoiceNoneZPtr {
4805    /**
4806     * A pointer to the contents in the success state.
4807     * Reading from this pointer when `result_ok` is not set is undefined.
4808     */
4809    struct LDKInvoice *result;
4810    /**
4811     * Note that this value is always NULL, as there are no contents in the Err variant
4812     */
4813    void *err;
4814 } LDKCResult_InvoiceNoneZPtr;
4815
4816 /**
4817  * A CResult_InvoiceNoneZ represents the result of a fallible operation,
4818  * containing a crate::lightning_invoice::Invoice on success and a () on failure.
4819  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4820  */
4821 typedef struct LDKCResult_InvoiceNoneZ {
4822    /**
4823     * The contents of this CResult_InvoiceNoneZ, accessible via either
4824     * `err` or `result` depending on the state of `result_ok`.
4825     */
4826    union LDKCResult_InvoiceNoneZPtr contents;
4827    /**
4828     * Whether this CResult_InvoiceNoneZ represents a success state.
4829     */
4830    bool result_ok;
4831 } LDKCResult_InvoiceNoneZ;
4832
4833
4834
4835 /**
4836  * Represents a signed `RawInvoice` with cached hash. The signature is not checked and may be
4837  * invalid.
4838  *
4839  * # Invariants
4840  * The hash has to be either from the deserialized invoice or from the serialized `raw_invoice`.
4841  */
4842 typedef struct MUST_USE_STRUCT LDKSignedRawInvoice {
4843    /**
4844     * A pointer to the opaque Rust object.
4845     * Nearly everywhere, inner must be non-null, however in places where
4846     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4847     */
4848    LDKnativeSignedRawInvoice *inner;
4849    /**
4850     * Indicates that this is the only struct which contains the same pointer.
4851     * Rust functions which take ownership of an object provided via an argument require
4852     * this to be true and invalidate the object pointed to by inner.
4853     */
4854    bool is_owned;
4855 } LDKSignedRawInvoice;
4856
4857 /**
4858  * The contents of CResult_SignedRawInvoiceNoneZ
4859  */
4860 typedef union LDKCResult_SignedRawInvoiceNoneZPtr {
4861    /**
4862     * A pointer to the contents in the success state.
4863     * Reading from this pointer when `result_ok` is not set is undefined.
4864     */
4865    struct LDKSignedRawInvoice *result;
4866    /**
4867     * Note that this value is always NULL, as there are no contents in the Err variant
4868     */
4869    void *err;
4870 } LDKCResult_SignedRawInvoiceNoneZPtr;
4871
4872 /**
4873  * A CResult_SignedRawInvoiceNoneZ represents the result of a fallible operation,
4874  * containing a crate::lightning_invoice::SignedRawInvoice on success and a () on failure.
4875  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4876  */
4877 typedef struct LDKCResult_SignedRawInvoiceNoneZ {
4878    /**
4879     * The contents of this CResult_SignedRawInvoiceNoneZ, accessible via either
4880     * `err` or `result` depending on the state of `result_ok`.
4881     */
4882    union LDKCResult_SignedRawInvoiceNoneZPtr contents;
4883    /**
4884     * Whether this CResult_SignedRawInvoiceNoneZ represents a success state.
4885     */
4886    bool result_ok;
4887 } LDKCResult_SignedRawInvoiceNoneZ;
4888
4889
4890
4891 /**
4892  * Represents an syntactically correct Invoice for a payment on the lightning network,
4893  * but without the signature information.
4894  * De- and encoding should not lead to information loss but may lead to different hashes.
4895  *
4896  * For methods without docs see the corresponding methods in `Invoice`.
4897  */
4898 typedef struct MUST_USE_STRUCT LDKRawInvoice {
4899    /**
4900     * A pointer to the opaque Rust object.
4901     * Nearly everywhere, inner must be non-null, however in places where
4902     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4903     */
4904    LDKnativeRawInvoice *inner;
4905    /**
4906     * Indicates that this is the only struct which contains the same pointer.
4907     * Rust functions which take ownership of an object provided via an argument require
4908     * this to be true and invalidate the object pointed to by inner.
4909     */
4910    bool is_owned;
4911 } LDKRawInvoice;
4912
4913
4914
4915 /**
4916  * Recoverable signature
4917  */
4918 typedef struct MUST_USE_STRUCT LDKInvoiceSignature {
4919    /**
4920     * A pointer to the opaque Rust object.
4921     * Nearly everywhere, inner must be non-null, however in places where
4922     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4923     */
4924    LDKnativeInvoiceSignature *inner;
4925    /**
4926     * Indicates that this is the only struct which contains the same pointer.
4927     * Rust functions which take ownership of an object provided via an argument require
4928     * this to be true and invalidate the object pointed to by inner.
4929     */
4930    bool is_owned;
4931 } LDKInvoiceSignature;
4932
4933 /**
4934  * A tuple of 3 elements. See the individual fields for the types contained.
4935  */
4936 typedef struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ {
4937    /**
4938     * The element at position 0
4939     */
4940    struct LDKRawInvoice a;
4941    /**
4942     * The element at position 1
4943     */
4944    struct LDKThirtyTwoBytes b;
4945    /**
4946     * The element at position 2
4947     */
4948    struct LDKInvoiceSignature c;
4949 } LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ;
4950
4951
4952
4953 /**
4954  * Payee public key
4955  */
4956 typedef struct MUST_USE_STRUCT LDKPayeePubKey {
4957    /**
4958     * A pointer to the opaque Rust object.
4959     * Nearly everywhere, inner must be non-null, however in places where
4960     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4961     */
4962    LDKnativePayeePubKey *inner;
4963    /**
4964     * Indicates that this is the only struct which contains the same pointer.
4965     * Rust functions which take ownership of an object provided via an argument require
4966     * this to be true and invalidate the object pointed to by inner.
4967     */
4968    bool is_owned;
4969 } LDKPayeePubKey;
4970
4971 /**
4972  * The contents of CResult_PayeePubKeyErrorZ
4973  */
4974 typedef union LDKCResult_PayeePubKeyErrorZPtr {
4975    /**
4976     * A pointer to the contents in the success state.
4977     * Reading from this pointer when `result_ok` is not set is undefined.
4978     */
4979    struct LDKPayeePubKey *result;
4980    /**
4981     * A pointer to the contents in the error state.
4982     * Reading from this pointer when `result_ok` is set is undefined.
4983     */
4984    enum LDKSecp256k1Error *err;
4985 } LDKCResult_PayeePubKeyErrorZPtr;
4986
4987 /**
4988  * A CResult_PayeePubKeyErrorZ represents the result of a fallible operation,
4989  * containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure.
4990  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4991  */
4992 typedef struct LDKCResult_PayeePubKeyErrorZ {
4993    /**
4994     * The contents of this CResult_PayeePubKeyErrorZ, accessible via either
4995     * `err` or `result` depending on the state of `result_ok`.
4996     */
4997    union LDKCResult_PayeePubKeyErrorZPtr contents;
4998    /**
4999     * Whether this CResult_PayeePubKeyErrorZ represents a success state.
5000     */
5001    bool result_ok;
5002 } LDKCResult_PayeePubKeyErrorZ;
5003
5004
5005
5006 /**
5007  * Private routing information
5008  *
5009  * # Invariants
5010  * The encoded route has to be <1024 5bit characters long (<=639 bytes or <=12 hops)
5011  *
5012  */
5013 typedef struct MUST_USE_STRUCT LDKPrivateRoute {
5014    /**
5015     * A pointer to the opaque Rust object.
5016     * Nearly everywhere, inner must be non-null, however in places where
5017     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5018     */
5019    LDKnativePrivateRoute *inner;
5020    /**
5021     * Indicates that this is the only struct which contains the same pointer.
5022     * Rust functions which take ownership of an object provided via an argument require
5023     * this to be true and invalidate the object pointed to by inner.
5024     */
5025    bool is_owned;
5026 } LDKPrivateRoute;
5027
5028 /**
5029  * A dynamically-allocated array of crate::lightning_invoice::PrivateRoutes of arbitrary size.
5030  * This corresponds to std::vector in C++
5031  */
5032 typedef struct LDKCVec_PrivateRouteZ {
5033    /**
5034     * The elements in the array.
5035     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5036     */
5037    struct LDKPrivateRoute *data;
5038    /**
5039     * The number of elements pointed to by `data`.
5040     */
5041    uintptr_t datalen;
5042 } LDKCVec_PrivateRouteZ;
5043
5044
5045
5046 /**
5047  * A timestamp that refers to a date after 1 January 1970 which means its representation as UNIX
5048  * timestamp is positive.
5049  *
5050  * # Invariants
5051  * The UNIX timestamp representing the stored time has to be positive and small enough so that
5052  * a `EpiryTime` can be added to it without an overflow.
5053  */
5054 typedef struct MUST_USE_STRUCT LDKPositiveTimestamp {
5055    /**
5056     * A pointer to the opaque Rust object.
5057     * Nearly everywhere, inner must be non-null, however in places where
5058     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5059     */
5060    LDKnativePositiveTimestamp *inner;
5061    /**
5062     * Indicates that this is the only struct which contains the same pointer.
5063     * Rust functions which take ownership of an object provided via an argument require
5064     * this to be true and invalidate the object pointed to by inner.
5065     */
5066    bool is_owned;
5067 } LDKPositiveTimestamp;
5068
5069 /**
5070  * The contents of CResult_PositiveTimestampCreationErrorZ
5071  */
5072 typedef union LDKCResult_PositiveTimestampCreationErrorZPtr {
5073    /**
5074     * A pointer to the contents in the success state.
5075     * Reading from this pointer when `result_ok` is not set is undefined.
5076     */
5077    struct LDKPositiveTimestamp *result;
5078    /**
5079     * A pointer to the contents in the error state.
5080     * Reading from this pointer when `result_ok` is set is undefined.
5081     */
5082    enum LDKCreationError *err;
5083 } LDKCResult_PositiveTimestampCreationErrorZPtr;
5084
5085 /**
5086  * A CResult_PositiveTimestampCreationErrorZ represents the result of a fallible operation,
5087  * containing a crate::lightning_invoice::PositiveTimestamp on success and a crate::lightning_invoice::CreationError on failure.
5088  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5089  */
5090 typedef struct LDKCResult_PositiveTimestampCreationErrorZ {
5091    /**
5092     * The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either
5093     * `err` or `result` depending on the state of `result_ok`.
5094     */
5095    union LDKCResult_PositiveTimestampCreationErrorZPtr contents;
5096    /**
5097     * Whether this CResult_PositiveTimestampCreationErrorZ represents a success state.
5098     */
5099    bool result_ok;
5100 } LDKCResult_PositiveTimestampCreationErrorZ;
5101
5102 /**
5103  * The contents of CResult_NoneSemanticErrorZ
5104  */
5105 typedef union LDKCResult_NoneSemanticErrorZPtr {
5106    /**
5107     * Note that this value is always NULL, as there are no contents in the OK variant
5108     */
5109    void *result;
5110    /**
5111     * A pointer to the contents in the error state.
5112     * Reading from this pointer when `result_ok` is set is undefined.
5113     */
5114    enum LDKSemanticError *err;
5115 } LDKCResult_NoneSemanticErrorZPtr;
5116
5117 /**
5118  * A CResult_NoneSemanticErrorZ represents the result of a fallible operation,
5119  * containing a () on success and a crate::lightning_invoice::SemanticError on failure.
5120  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5121  */
5122 typedef struct LDKCResult_NoneSemanticErrorZ {
5123    /**
5124     * The contents of this CResult_NoneSemanticErrorZ, accessible via either
5125     * `err` or `result` depending on the state of `result_ok`.
5126     */
5127    union LDKCResult_NoneSemanticErrorZPtr contents;
5128    /**
5129     * Whether this CResult_NoneSemanticErrorZ represents a success state.
5130     */
5131    bool result_ok;
5132 } LDKCResult_NoneSemanticErrorZ;
5133
5134 /**
5135  * The contents of CResult_InvoiceSemanticErrorZ
5136  */
5137 typedef union LDKCResult_InvoiceSemanticErrorZPtr {
5138    /**
5139     * A pointer to the contents in the success state.
5140     * Reading from this pointer when `result_ok` is not set is undefined.
5141     */
5142    struct LDKInvoice *result;
5143    /**
5144     * A pointer to the contents in the error state.
5145     * Reading from this pointer when `result_ok` is set is undefined.
5146     */
5147    enum LDKSemanticError *err;
5148 } LDKCResult_InvoiceSemanticErrorZPtr;
5149
5150 /**
5151  * A CResult_InvoiceSemanticErrorZ represents the result of a fallible operation,
5152  * containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SemanticError on failure.
5153  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5154  */
5155 typedef struct LDKCResult_InvoiceSemanticErrorZ {
5156    /**
5157     * The contents of this CResult_InvoiceSemanticErrorZ, accessible via either
5158     * `err` or `result` depending on the state of `result_ok`.
5159     */
5160    union LDKCResult_InvoiceSemanticErrorZPtr contents;
5161    /**
5162     * Whether this CResult_InvoiceSemanticErrorZ represents a success state.
5163     */
5164    bool result_ok;
5165 } LDKCResult_InvoiceSemanticErrorZ;
5166
5167
5168
5169 /**
5170  * Description string
5171  *
5172  * # Invariants
5173  * The description can be at most 639 __bytes__ long
5174  */
5175 typedef struct MUST_USE_STRUCT LDKDescription {
5176    /**
5177     * A pointer to the opaque Rust object.
5178     * Nearly everywhere, inner must be non-null, however in places where
5179     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5180     */
5181    LDKnativeDescription *inner;
5182    /**
5183     * Indicates that this is the only struct which contains the same pointer.
5184     * Rust functions which take ownership of an object provided via an argument require
5185     * this to be true and invalidate the object pointed to by inner.
5186     */
5187    bool is_owned;
5188 } LDKDescription;
5189
5190 /**
5191  * The contents of CResult_DescriptionCreationErrorZ
5192  */
5193 typedef union LDKCResult_DescriptionCreationErrorZPtr {
5194    /**
5195     * A pointer to the contents in the success state.
5196     * Reading from this pointer when `result_ok` is not set is undefined.
5197     */
5198    struct LDKDescription *result;
5199    /**
5200     * A pointer to the contents in the error state.
5201     * Reading from this pointer when `result_ok` is set is undefined.
5202     */
5203    enum LDKCreationError *err;
5204 } LDKCResult_DescriptionCreationErrorZPtr;
5205
5206 /**
5207  * A CResult_DescriptionCreationErrorZ represents the result of a fallible operation,
5208  * containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure.
5209  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5210  */
5211 typedef struct LDKCResult_DescriptionCreationErrorZ {
5212    /**
5213     * The contents of this CResult_DescriptionCreationErrorZ, accessible via either
5214     * `err` or `result` depending on the state of `result_ok`.
5215     */
5216    union LDKCResult_DescriptionCreationErrorZPtr contents;
5217    /**
5218     * Whether this CResult_DescriptionCreationErrorZ represents a success state.
5219     */
5220    bool result_ok;
5221 } LDKCResult_DescriptionCreationErrorZ;
5222
5223
5224
5225 /**
5226  * Positive duration that defines when (relatively to the timestamp) in the future the invoice
5227  * expires
5228  *
5229  * # Invariants
5230  * The number of seconds this expiry time represents has to be in the range
5231  * `0...(SYSTEM_TIME_MAX_UNIX_TIMESTAMP - MAX_EXPIRY_TIME)` to avoid overflows when adding it to a
5232  * timestamp
5233  */
5234 typedef struct MUST_USE_STRUCT LDKExpiryTime {
5235    /**
5236     * A pointer to the opaque Rust object.
5237     * Nearly everywhere, inner must be non-null, however in places where
5238     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5239     */
5240    LDKnativeExpiryTime *inner;
5241    /**
5242     * Indicates that this is the only struct which contains the same pointer.
5243     * Rust functions which take ownership of an object provided via an argument require
5244     * this to be true and invalidate the object pointed to by inner.
5245     */
5246    bool is_owned;
5247 } LDKExpiryTime;
5248
5249 /**
5250  * The contents of CResult_ExpiryTimeCreationErrorZ
5251  */
5252 typedef union LDKCResult_ExpiryTimeCreationErrorZPtr {
5253    /**
5254     * A pointer to the contents in the success state.
5255     * Reading from this pointer when `result_ok` is not set is undefined.
5256     */
5257    struct LDKExpiryTime *result;
5258    /**
5259     * A pointer to the contents in the error state.
5260     * Reading from this pointer when `result_ok` is set is undefined.
5261     */
5262    enum LDKCreationError *err;
5263 } LDKCResult_ExpiryTimeCreationErrorZPtr;
5264
5265 /**
5266  * A CResult_ExpiryTimeCreationErrorZ represents the result of a fallible operation,
5267  * containing a crate::lightning_invoice::ExpiryTime on success and a crate::lightning_invoice::CreationError on failure.
5268  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5269  */
5270 typedef struct LDKCResult_ExpiryTimeCreationErrorZ {
5271    /**
5272     * The contents of this CResult_ExpiryTimeCreationErrorZ, accessible via either
5273     * `err` or `result` depending on the state of `result_ok`.
5274     */
5275    union LDKCResult_ExpiryTimeCreationErrorZPtr contents;
5276    /**
5277     * Whether this CResult_ExpiryTimeCreationErrorZ represents a success state.
5278     */
5279    bool result_ok;
5280 } LDKCResult_ExpiryTimeCreationErrorZ;
5281
5282 /**
5283  * The contents of CResult_PrivateRouteCreationErrorZ
5284  */
5285 typedef union LDKCResult_PrivateRouteCreationErrorZPtr {
5286    /**
5287     * A pointer to the contents in the success state.
5288     * Reading from this pointer when `result_ok` is not set is undefined.
5289     */
5290    struct LDKPrivateRoute *result;
5291    /**
5292     * A pointer to the contents in the error state.
5293     * Reading from this pointer when `result_ok` is set is undefined.
5294     */
5295    enum LDKCreationError *err;
5296 } LDKCResult_PrivateRouteCreationErrorZPtr;
5297
5298 /**
5299  * A CResult_PrivateRouteCreationErrorZ represents the result of a fallible operation,
5300  * containing a crate::lightning_invoice::PrivateRoute on success and a crate::lightning_invoice::CreationError on failure.
5301  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5302  */
5303 typedef struct LDKCResult_PrivateRouteCreationErrorZ {
5304    /**
5305     * The contents of this CResult_PrivateRouteCreationErrorZ, accessible via either
5306     * `err` or `result` depending on the state of `result_ok`.
5307     */
5308    union LDKCResult_PrivateRouteCreationErrorZPtr contents;
5309    /**
5310     * Whether this CResult_PrivateRouteCreationErrorZ represents a success state.
5311     */
5312    bool result_ok;
5313 } LDKCResult_PrivateRouteCreationErrorZ;
5314
5315 /**
5316  * The contents of CResult_StringErrorZ
5317  */
5318 typedef union LDKCResult_StringErrorZPtr {
5319    /**
5320     * A pointer to the contents in the success state.
5321     * Reading from this pointer when `result_ok` is not set is undefined.
5322     */
5323    struct LDKStr *result;
5324    /**
5325     * A pointer to the contents in the error state.
5326     * Reading from this pointer when `result_ok` is set is undefined.
5327     */
5328    enum LDKSecp256k1Error *err;
5329 } LDKCResult_StringErrorZPtr;
5330
5331 /**
5332  * A CResult_StringErrorZ represents the result of a fallible operation,
5333  * containing a crate::c_types::Str on success and a crate::c_types::Secp256k1Error on failure.
5334  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5335  */
5336 typedef struct LDKCResult_StringErrorZ {
5337    /**
5338     * The contents of this CResult_StringErrorZ, accessible via either
5339     * `err` or `result` depending on the state of `result_ok`.
5340     */
5341    union LDKCResult_StringErrorZPtr contents;
5342    /**
5343     * Whether this CResult_StringErrorZ represents a success state.
5344     */
5345    bool result_ok;
5346 } LDKCResult_StringErrorZ;
5347
5348 /**
5349  * The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
5350  */
5351 typedef union LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr {
5352    /**
5353     * A pointer to the contents in the success state.
5354     * Reading from this pointer when `result_ok` is not set is undefined.
5355     */
5356    struct LDKChannelMonitorUpdate *result;
5357    /**
5358     * A pointer to the contents in the error state.
5359     * Reading from this pointer when `result_ok` is set is undefined.
5360     */
5361    struct LDKDecodeError *err;
5362 } LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr;
5363
5364 /**
5365  * A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
5366  * containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
5367  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5368  */
5369 typedef struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ {
5370    /**
5371     * The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
5372     * `err` or `result` depending on the state of `result_ok`.
5373     */
5374    union LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr contents;
5375    /**
5376     * Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
5377     */
5378    bool result_ok;
5379 } LDKCResult_ChannelMonitorUpdateDecodeErrorZ;
5380
5381 /**
5382  * The contents of CResult_HTLCUpdateDecodeErrorZ
5383  */
5384 typedef union LDKCResult_HTLCUpdateDecodeErrorZPtr {
5385    /**
5386     * A pointer to the contents in the success state.
5387     * Reading from this pointer when `result_ok` is not set is undefined.
5388     */
5389    struct LDKHTLCUpdate *result;
5390    /**
5391     * A pointer to the contents in the error state.
5392     * Reading from this pointer when `result_ok` is set is undefined.
5393     */
5394    struct LDKDecodeError *err;
5395 } LDKCResult_HTLCUpdateDecodeErrorZPtr;
5396
5397 /**
5398  * A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
5399  * containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
5400  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5401  */
5402 typedef struct LDKCResult_HTLCUpdateDecodeErrorZ {
5403    /**
5404     * The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
5405     * `err` or `result` depending on the state of `result_ok`.
5406     */
5407    union LDKCResult_HTLCUpdateDecodeErrorZPtr contents;
5408    /**
5409     * Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
5410     */
5411    bool result_ok;
5412 } LDKCResult_HTLCUpdateDecodeErrorZ;
5413
5414
5415
5416 /**
5417  * General Err type for ChannelMonitor actions. Generally, this implies that the data provided is
5418  * inconsistent with the ChannelMonitor being called. eg for ChannelMonitor::update_monitor this
5419  * means you tried to update a monitor for a different channel or the ChannelMonitorUpdate was
5420  * corrupted.
5421  * Contains a developer-readable error message.
5422  */
5423 typedef struct MUST_USE_STRUCT LDKMonitorUpdateError {
5424    /**
5425     * A pointer to the opaque Rust object.
5426     * Nearly everywhere, inner must be non-null, however in places where
5427     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5428     */
5429    LDKnativeMonitorUpdateError *inner;
5430    /**
5431     * Indicates that this is the only struct which contains the same pointer.
5432     * Rust functions which take ownership of an object provided via an argument require
5433     * this to be true and invalidate the object pointed to by inner.
5434     */
5435    bool is_owned;
5436 } LDKMonitorUpdateError;
5437
5438 /**
5439  * The contents of CResult_NoneMonitorUpdateErrorZ
5440  */
5441 typedef union LDKCResult_NoneMonitorUpdateErrorZPtr {
5442    /**
5443     * Note that this value is always NULL, as there are no contents in the OK variant
5444     */
5445    void *result;
5446    /**
5447     * A pointer to the contents in the error state.
5448     * Reading from this pointer when `result_ok` is set is undefined.
5449     */
5450    struct LDKMonitorUpdateError *err;
5451 } LDKCResult_NoneMonitorUpdateErrorZPtr;
5452
5453 /**
5454  * A CResult_NoneMonitorUpdateErrorZ represents the result of a fallible operation,
5455  * containing a () on success and a crate::lightning::chain::channelmonitor::MonitorUpdateError on failure.
5456  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5457  */
5458 typedef struct LDKCResult_NoneMonitorUpdateErrorZ {
5459    /**
5460     * The contents of this CResult_NoneMonitorUpdateErrorZ, accessible via either
5461     * `err` or `result` depending on the state of `result_ok`.
5462     */
5463    union LDKCResult_NoneMonitorUpdateErrorZPtr contents;
5464    /**
5465     * Whether this CResult_NoneMonitorUpdateErrorZ represents a success state.
5466     */
5467    bool result_ok;
5468 } LDKCResult_NoneMonitorUpdateErrorZ;
5469
5470 /**
5471  * A tuple of 2 elements. See the individual fields for the types contained.
5472  */
5473 typedef struct LDKC2Tuple_OutPointScriptZ {
5474    /**
5475     * The element at position 0
5476     */
5477    struct LDKOutPoint a;
5478    /**
5479     * The element at position 1
5480     */
5481    struct LDKCVec_u8Z b;
5482 } LDKC2Tuple_OutPointScriptZ;
5483
5484 /**
5485  * A tuple of 2 elements. See the individual fields for the types contained.
5486  */
5487 typedef struct LDKC2Tuple_u32ScriptZ {
5488    /**
5489     * The element at position 0
5490     */
5491    uint32_t a;
5492    /**
5493     * The element at position 1
5494     */
5495    struct LDKCVec_u8Z b;
5496 } LDKC2Tuple_u32ScriptZ;
5497
5498 /**
5499  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size.
5500  * This corresponds to std::vector in C++
5501  */
5502 typedef struct LDKCVec_C2Tuple_u32ScriptZZ {
5503    /**
5504     * The elements in the array.
5505     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5506     */
5507    struct LDKC2Tuple_u32ScriptZ *data;
5508    /**
5509     * The number of elements pointed to by `data`.
5510     */
5511    uintptr_t datalen;
5512 } LDKCVec_C2Tuple_u32ScriptZZ;
5513
5514 /**
5515  * A tuple of 2 elements. See the individual fields for the types contained.
5516  */
5517 typedef struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
5518    /**
5519     * The element at position 0
5520     */
5521    struct LDKThirtyTwoBytes a;
5522    /**
5523     * The element at position 1
5524     */
5525    struct LDKCVec_C2Tuple_u32ScriptZZ b;
5526 } LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ;
5527
5528 /**
5529  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size.
5530  * This corresponds to std::vector in C++
5531  */
5532 typedef struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
5533    /**
5534     * The elements in the array.
5535     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5536     */
5537    struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *data;
5538    /**
5539     * The number of elements pointed to by `data`.
5540     */
5541    uintptr_t datalen;
5542 } LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ;
5543
5544 /**
5545  * Some information provided on receipt of payment depends on whether the payment received is a
5546  * spontaneous payment or a \"conventional\" lightning payment that's paying an invoice.
5547  */
5548 typedef enum LDKPaymentPurpose_Tag {
5549    /**
5550     * Information for receiving a payment that we generated an invoice for.
5551     */
5552    LDKPaymentPurpose_InvoicePayment,
5553    /**
5554     * Because this is a spontaneous payment, the payer generated their own preimage rather than us
5555     * (the payee) providing a preimage.
5556     */
5557    LDKPaymentPurpose_SpontaneousPayment,
5558    /**
5559     * Must be last for serialization purposes
5560     */
5561    LDKPaymentPurpose_Sentinel,
5562 } LDKPaymentPurpose_Tag;
5563
5564 typedef struct LDKPaymentPurpose_LDKInvoicePayment_Body {
5565    /**
5566     * The preimage to the payment_hash, if the payment hash (and secret) were fetched via
5567     * [`ChannelManager::create_inbound_payment`]. If provided, this can be handed directly to
5568     * [`ChannelManager::claim_funds`].
5569     *
5570     * [`ChannelManager::create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment
5571     * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
5572     *
5573     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
5574     */
5575    struct LDKThirtyTwoBytes payment_preimage;
5576    /**
5577     * The \"payment secret\". This authenticates the sender to the recipient, preventing a
5578     * number of deanonymization attacks during the routing process.
5579     * It is provided here for your reference, however its accuracy is enforced directly by
5580     * [`ChannelManager`] using the values you previously provided to
5581     * [`ChannelManager::create_inbound_payment`] or
5582     * [`ChannelManager::create_inbound_payment_for_hash`].
5583     *
5584     * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
5585     * [`ChannelManager::create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment
5586     * [`ChannelManager::create_inbound_payment_for_hash`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash
5587     */
5588    struct LDKThirtyTwoBytes payment_secret;
5589    /**
5590     * This is the `user_payment_id` which was provided to
5591     * [`ChannelManager::create_inbound_payment_for_hash`] or
5592     * [`ChannelManager::create_inbound_payment`]. It has no meaning inside of LDK and is
5593     * simply copied here. It may be used to correlate PaymentReceived events with invoice
5594     * metadata stored elsewhere.
5595     *
5596     * [`ChannelManager::create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment
5597     * [`ChannelManager::create_inbound_payment_for_hash`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash
5598     */
5599    uint64_t user_payment_id;
5600 } LDKPaymentPurpose_LDKInvoicePayment_Body;
5601
5602 typedef struct MUST_USE_STRUCT LDKPaymentPurpose {
5603    LDKPaymentPurpose_Tag tag;
5604    union {
5605       LDKPaymentPurpose_LDKInvoicePayment_Body invoice_payment;
5606       struct {
5607          struct LDKThirtyTwoBytes spontaneous_payment;
5608       };
5609    };
5610 } LDKPaymentPurpose;
5611
5612 /**
5613  * An Event which you should probably take some action in response to.
5614  *
5615  * Note that while Writeable and Readable are implemented for Event, you probably shouldn't use
5616  * them directly as they don't round-trip exactly (for example FundingGenerationReady is never
5617  * written as it makes no sense to respond to it after reconnecting to peers).
5618  */
5619 typedef enum LDKEvent_Tag {
5620    /**
5621     * Used to indicate that the client should generate a funding transaction with the given
5622     * parameters and then call ChannelManager::funding_transaction_generated.
5623     * Generated in ChannelManager message handling.
5624     * Note that *all inputs* in the funding transaction must spend SegWit outputs or your
5625     * counterparty can steal your funds!
5626     */
5627    LDKEvent_FundingGenerationReady,
5628    /**
5629     * Indicates we've received money! Just gotta dig out that payment preimage and feed it to
5630     * ChannelManager::claim_funds to get it....
5631     * Note that if the preimage is not known or the amount paid is incorrect, you should call
5632     * ChannelManager::fail_htlc_backwards to free up resources for this HTLC and avoid
5633     * network congestion.
5634     * The amount paid should be considered 'incorrect' when it is less than or more than twice
5635     * the amount expected.
5636     * If you fail to call either ChannelManager::claim_funds or
5637     * ChannelManager::fail_htlc_backwards within the HTLC's timeout, the HTLC will be
5638     * automatically failed.
5639     */
5640    LDKEvent_PaymentReceived,
5641    /**
5642     * Indicates an outbound payment we made succeeded (ie it made it all the way to its target
5643     * and we got back the payment preimage for it).
5644     */
5645    LDKEvent_PaymentSent,
5646    /**
5647     * Indicates an outbound payment we made failed. Probably some intermediary node dropped
5648     * something. You may wish to retry with a different route.
5649     */
5650    LDKEvent_PaymentFailed,
5651    /**
5652     * Used to indicate that ChannelManager::process_pending_htlc_forwards should be called at a
5653     * time in the future.
5654     */
5655    LDKEvent_PendingHTLCsForwardable,
5656    /**
5657     * Used to indicate that an output which you should know how to spend was confirmed on chain
5658     * and is now spendable.
5659     * Such an output will *not* ever be spent by rust-lightning, and are not at risk of your
5660     * counterparty spending them due to some kind of timeout. Thus, you need to store them
5661     * somewhere and spend them when you create on-chain transactions.
5662     */
5663    LDKEvent_SpendableOutputs,
5664    /**
5665     * This event is generated when a payment has been successfully forwarded through us and a
5666     * forwarding fee earned.
5667     */
5668    LDKEvent_PaymentForwarded,
5669    /**
5670     * Must be last for serialization purposes
5671     */
5672    LDKEvent_Sentinel,
5673 } LDKEvent_Tag;
5674
5675 typedef struct LDKEvent_LDKFundingGenerationReady_Body {
5676    /**
5677     * The random channel_id we picked which you'll need to pass into
5678     * ChannelManager::funding_transaction_generated.
5679     */
5680    struct LDKThirtyTwoBytes temporary_channel_id;
5681    /**
5682     * The value, in satoshis, that the output should have.
5683     */
5684    uint64_t channel_value_satoshis;
5685    /**
5686     * The script which should be used in the transaction output.
5687     */
5688    struct LDKCVec_u8Z output_script;
5689    /**
5690     * The value passed in to ChannelManager::create_channel
5691     */
5692    uint64_t user_channel_id;
5693 } LDKEvent_LDKFundingGenerationReady_Body;
5694
5695 typedef struct LDKEvent_LDKPaymentReceived_Body {
5696    /**
5697     * The hash for which the preimage should be handed to the ChannelManager.
5698     */
5699    struct LDKThirtyTwoBytes payment_hash;
5700    /**
5701     * The value, in thousandths of a satoshi, that this payment is for. Note that you must
5702     * compare this to the expected value before accepting the payment (as otherwise you are
5703     * providing proof-of-payment for less than the value you expected!).
5704     */
5705    uint64_t amt;
5706    /**
5707     * Information for claiming this received payment, based on whether the purpose of the
5708     * payment is to pay an invoice or to send a spontaneous payment.
5709     */
5710    struct LDKPaymentPurpose purpose;
5711 } LDKEvent_LDKPaymentReceived_Body;
5712
5713 typedef struct LDKEvent_LDKPaymentSent_Body {
5714    /**
5715     * The preimage to the hash given to ChannelManager::send_payment.
5716     * Note that this serves as a payment receipt, if you wish to have such a thing, you must
5717     * store it somehow!
5718     */
5719    struct LDKThirtyTwoBytes payment_preimage;
5720 } LDKEvent_LDKPaymentSent_Body;
5721
5722 typedef struct LDKEvent_LDKPaymentFailed_Body {
5723    /**
5724     * The hash which was given to ChannelManager::send_payment.
5725     */
5726    struct LDKThirtyTwoBytes payment_hash;
5727    /**
5728     * Indicates the payment was rejected for some reason by the recipient. This implies that
5729     * the payment has failed, not just the route in question. If this is not set, you may
5730     * retry the payment via a different route.
5731     */
5732    bool rejected_by_dest;
5733 } LDKEvent_LDKPaymentFailed_Body;
5734
5735 typedef struct LDKEvent_LDKPendingHTLCsForwardable_Body {
5736    /**
5737     * The minimum amount of time that should be waited prior to calling
5738     * process_pending_htlc_forwards. To increase the effort required to correlate payments,
5739     * you should wait a random amount of time in roughly the range (now + time_forwardable,
5740     * now + 5*time_forwardable).
5741     */
5742    uint64_t time_forwardable;
5743 } LDKEvent_LDKPendingHTLCsForwardable_Body;
5744
5745 typedef struct LDKEvent_LDKSpendableOutputs_Body {
5746    /**
5747     * The outputs which you should store as spendable by you.
5748     */
5749    struct LDKCVec_SpendableOutputDescriptorZ outputs;
5750 } LDKEvent_LDKSpendableOutputs_Body;
5751
5752 typedef struct LDKEvent_LDKPaymentForwarded_Body {
5753    /**
5754     * The fee, in milli-satoshis, which was earned as a result of the payment.
5755     *
5756     * Note that if we force-closed the channel over which we forwarded an HTLC while the HTLC
5757     * was pending, the amount the next hop claimed will have been rounded down to the nearest
5758     * whole satoshi. Thus, the fee calculated here may be higher than expected as we still
5759     * claimed the full value in millisatoshis from the source. In this case,
5760     * `claim_from_onchain_tx` will be set.
5761     *
5762     * If the channel which sent us the payment has been force-closed, we will claim the funds
5763     * via an on-chain transaction. In that case we do not yet know the on-chain transaction
5764     * fees which we will spend and will instead set this to `None`. It is possible duplicate
5765     * `PaymentForwarded` events are generated for the same payment iff `fee_earned_msat` is
5766     * `None`.
5767     */
5768    struct LDKCOption_u64Z fee_earned_msat;
5769    /**
5770     * If this is `true`, the forwarded HTLC was claimed by our counterparty via an on-chain
5771     * transaction.
5772     */
5773    bool claim_from_onchain_tx;
5774 } LDKEvent_LDKPaymentForwarded_Body;
5775
5776 typedef struct MUST_USE_STRUCT LDKEvent {
5777    LDKEvent_Tag tag;
5778    union {
5779       LDKEvent_LDKFundingGenerationReady_Body funding_generation_ready;
5780       LDKEvent_LDKPaymentReceived_Body payment_received;
5781       LDKEvent_LDKPaymentSent_Body payment_sent;
5782       LDKEvent_LDKPaymentFailed_Body payment_failed;
5783       LDKEvent_LDKPendingHTLCsForwardable_Body pending_htl_cs_forwardable;
5784       LDKEvent_LDKSpendableOutputs_Body spendable_outputs;
5785       LDKEvent_LDKPaymentForwarded_Body payment_forwarded;
5786    };
5787 } LDKEvent;
5788
5789 /**
5790  * A dynamically-allocated array of crate::lightning::util::events::Events of arbitrary size.
5791  * This corresponds to std::vector in C++
5792  */
5793 typedef struct LDKCVec_EventZ {
5794    /**
5795     * The elements in the array.
5796     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5797     */
5798    struct LDKEvent *data;
5799    /**
5800     * The number of elements pointed to by `data`.
5801     */
5802    uintptr_t datalen;
5803 } LDKCVec_EventZ;
5804
5805 /**
5806  * A dynamically-allocated array of crate::c_types::Transactions of arbitrary size.
5807  * This corresponds to std::vector in C++
5808  */
5809 typedef struct LDKCVec_TransactionZ {
5810    /**
5811     * The elements in the array.
5812     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5813     */
5814    struct LDKTransaction *data;
5815    /**
5816     * The number of elements pointed to by `data`.
5817     */
5818    uintptr_t datalen;
5819 } LDKCVec_TransactionZ;
5820
5821 /**
5822  * A tuple of 2 elements. See the individual fields for the types contained.
5823  */
5824 typedef struct LDKC2Tuple_u32TxOutZ {
5825    /**
5826     * The element at position 0
5827     */
5828    uint32_t a;
5829    /**
5830     * The element at position 1
5831     */
5832    struct LDKTxOut b;
5833 } LDKC2Tuple_u32TxOutZ;
5834
5835 /**
5836  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size.
5837  * This corresponds to std::vector in C++
5838  */
5839 typedef struct LDKCVec_C2Tuple_u32TxOutZZ {
5840    /**
5841     * The elements in the array.
5842     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5843     */
5844    struct LDKC2Tuple_u32TxOutZ *data;
5845    /**
5846     * The number of elements pointed to by `data`.
5847     */
5848    uintptr_t datalen;
5849 } LDKCVec_C2Tuple_u32TxOutZZ;
5850
5851 /**
5852  * A tuple of 2 elements. See the individual fields for the types contained.
5853  */
5854 typedef struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
5855    /**
5856     * The element at position 0
5857     */
5858    struct LDKThirtyTwoBytes a;
5859    /**
5860     * The element at position 1
5861     */
5862    struct LDKCVec_C2Tuple_u32TxOutZZ b;
5863 } LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ;
5864
5865 /**
5866  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZs of arbitrary size.
5867  * This corresponds to std::vector in C++
5868  */
5869 typedef struct LDKCVec_TransactionOutputsZ {
5870    /**
5871     * The elements in the array.
5872     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5873     */
5874    struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *data;
5875    /**
5876     * The number of elements pointed to by `data`.
5877     */
5878    uintptr_t datalen;
5879 } LDKCVec_TransactionOutputsZ;
5880
5881 /**
5882  * The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ
5883  */
5884 typedef union LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
5885    /**
5886     * A pointer to the contents in the success state.
5887     * Reading from this pointer when `result_ok` is not set is undefined.
5888     */
5889    struct LDKC2Tuple_BlockHashChannelMonitorZ *result;
5890    /**
5891     * A pointer to the contents in the error state.
5892     * Reading from this pointer when `result_ok` is set is undefined.
5893     */
5894    struct LDKDecodeError *err;
5895 } LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr;
5896
5897 /**
5898  * A CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents the result of a fallible operation,
5899  * containing a crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
5900  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5901  */
5902 typedef struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
5903    /**
5904     * The contents of this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either
5905     * `err` or `result` depending on the state of `result_ok`.
5906     */
5907    union LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr contents;
5908    /**
5909     * Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state.
5910     */
5911    bool result_ok;
5912 } LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ;
5913
5914 /**
5915  * The contents of CResult_boolLightningErrorZ
5916  */
5917 typedef union LDKCResult_boolLightningErrorZPtr {
5918    /**
5919     * A pointer to the contents in the success state.
5920     * Reading from this pointer when `result_ok` is not set is undefined.
5921     */
5922    bool *result;
5923    /**
5924     * A pointer to the contents in the error state.
5925     * Reading from this pointer when `result_ok` is set is undefined.
5926     */
5927    struct LDKLightningError *err;
5928 } LDKCResult_boolLightningErrorZPtr;
5929
5930 /**
5931  * A CResult_boolLightningErrorZ represents the result of a fallible operation,
5932  * containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure.
5933  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5934  */
5935 typedef struct LDKCResult_boolLightningErrorZ {
5936    /**
5937     * The contents of this CResult_boolLightningErrorZ, accessible via either
5938     * `err` or `result` depending on the state of `result_ok`.
5939     */
5940    union LDKCResult_boolLightningErrorZPtr contents;
5941    /**
5942     * Whether this CResult_boolLightningErrorZ represents a success state.
5943     */
5944    bool result_ok;
5945 } LDKCResult_boolLightningErrorZ;
5946
5947 /**
5948  * A tuple of 3 elements. See the individual fields for the types contained.
5949  */
5950 typedef struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
5951    /**
5952     * The element at position 0
5953     */
5954    struct LDKChannelAnnouncement a;
5955    /**
5956     * The element at position 1
5957     */
5958    struct LDKChannelUpdate b;
5959    /**
5960     * The element at position 2
5961     */
5962    struct LDKChannelUpdate c;
5963 } LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ;
5964
5965 /**
5966  * A dynamically-allocated array of crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZs of arbitrary size.
5967  * This corresponds to std::vector in C++
5968  */
5969 typedef struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
5970    /**
5971     * The elements in the array.
5972     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5973     */
5974    struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *data;
5975    /**
5976     * The number of elements pointed to by `data`.
5977     */
5978    uintptr_t datalen;
5979 } LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ;
5980
5981 /**
5982  * A dynamically-allocated array of crate::lightning::ln::msgs::NodeAnnouncements of arbitrary size.
5983  * This corresponds to std::vector in C++
5984  */
5985 typedef struct LDKCVec_NodeAnnouncementZ {
5986    /**
5987     * The elements in the array.
5988     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5989     */
5990    struct LDKNodeAnnouncement *data;
5991    /**
5992     * The number of elements pointed to by `data`.
5993     */
5994    uintptr_t datalen;
5995 } LDKCVec_NodeAnnouncementZ;
5996
5997 /**
5998  * The contents of CResult_NoneLightningErrorZ
5999  */
6000 typedef union LDKCResult_NoneLightningErrorZPtr {
6001    /**
6002     * Note that this value is always NULL, as there are no contents in the OK variant
6003     */
6004    void *result;
6005    /**
6006     * A pointer to the contents in the error state.
6007     * Reading from this pointer when `result_ok` is set is undefined.
6008     */
6009    struct LDKLightningError *err;
6010 } LDKCResult_NoneLightningErrorZPtr;
6011
6012 /**
6013  * A CResult_NoneLightningErrorZ represents the result of a fallible operation,
6014  * containing a () on success and a crate::lightning::ln::msgs::LightningError on failure.
6015  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6016  */
6017 typedef struct LDKCResult_NoneLightningErrorZ {
6018    /**
6019     * The contents of this CResult_NoneLightningErrorZ, accessible via either
6020     * `err` or `result` depending on the state of `result_ok`.
6021     */
6022    union LDKCResult_NoneLightningErrorZPtr contents;
6023    /**
6024     * Whether this CResult_NoneLightningErrorZ represents a success state.
6025     */
6026    bool result_ok;
6027 } LDKCResult_NoneLightningErrorZ;
6028
6029 /**
6030  * A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size.
6031  * This corresponds to std::vector in C++
6032  */
6033 typedef struct LDKCVec_PublicKeyZ {
6034    /**
6035     * The elements in the array.
6036     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6037     */
6038    struct LDKPublicKey *data;
6039    /**
6040     * The number of elements pointed to by `data`.
6041     */
6042    uintptr_t datalen;
6043 } LDKCVec_PublicKeyZ;
6044
6045
6046
6047 /**
6048  * Error for PeerManager errors. If you get one of these, you must disconnect the socket and
6049  * generate no further read_event/write_buffer_space_avail/socket_disconnected calls for the
6050  * descriptor.
6051  */
6052 typedef struct MUST_USE_STRUCT LDKPeerHandleError {
6053    /**
6054     * A pointer to the opaque Rust object.
6055     * Nearly everywhere, inner must be non-null, however in places where
6056     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6057     */
6058    LDKnativePeerHandleError *inner;
6059    /**
6060     * Indicates that this is the only struct which contains the same pointer.
6061     * Rust functions which take ownership of an object provided via an argument require
6062     * this to be true and invalidate the object pointed to by inner.
6063     */
6064    bool is_owned;
6065 } LDKPeerHandleError;
6066
6067 /**
6068  * The contents of CResult_CVec_u8ZPeerHandleErrorZ
6069  */
6070 typedef union LDKCResult_CVec_u8ZPeerHandleErrorZPtr {
6071    /**
6072     * A pointer to the contents in the success state.
6073     * Reading from this pointer when `result_ok` is not set is undefined.
6074     */
6075    struct LDKCVec_u8Z *result;
6076    /**
6077     * A pointer to the contents in the error state.
6078     * Reading from this pointer when `result_ok` is set is undefined.
6079     */
6080    struct LDKPeerHandleError *err;
6081 } LDKCResult_CVec_u8ZPeerHandleErrorZPtr;
6082
6083 /**
6084  * A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
6085  * containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
6086  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6087  */
6088 typedef struct LDKCResult_CVec_u8ZPeerHandleErrorZ {
6089    /**
6090     * The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
6091     * `err` or `result` depending on the state of `result_ok`.
6092     */
6093    union LDKCResult_CVec_u8ZPeerHandleErrorZPtr contents;
6094    /**
6095     * Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
6096     */
6097    bool result_ok;
6098 } LDKCResult_CVec_u8ZPeerHandleErrorZ;
6099
6100 /**
6101  * The contents of CResult_NonePeerHandleErrorZ
6102  */
6103 typedef union LDKCResult_NonePeerHandleErrorZPtr {
6104    /**
6105     * Note that this value is always NULL, as there are no contents in the OK variant
6106     */
6107    void *result;
6108    /**
6109     * A pointer to the contents in the error state.
6110     * Reading from this pointer when `result_ok` is set is undefined.
6111     */
6112    struct LDKPeerHandleError *err;
6113 } LDKCResult_NonePeerHandleErrorZPtr;
6114
6115 /**
6116  * A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
6117  * containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
6118  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6119  */
6120 typedef struct LDKCResult_NonePeerHandleErrorZ {
6121    /**
6122     * The contents of this CResult_NonePeerHandleErrorZ, accessible via either
6123     * `err` or `result` depending on the state of `result_ok`.
6124     */
6125    union LDKCResult_NonePeerHandleErrorZPtr contents;
6126    /**
6127     * Whether this CResult_NonePeerHandleErrorZ represents a success state.
6128     */
6129    bool result_ok;
6130 } LDKCResult_NonePeerHandleErrorZ;
6131
6132 /**
6133  * The contents of CResult_boolPeerHandleErrorZ
6134  */
6135 typedef union LDKCResult_boolPeerHandleErrorZPtr {
6136    /**
6137     * A pointer to the contents in the success state.
6138     * Reading from this pointer when `result_ok` is not set is undefined.
6139     */
6140    bool *result;
6141    /**
6142     * A pointer to the contents in the error state.
6143     * Reading from this pointer when `result_ok` is set is undefined.
6144     */
6145    struct LDKPeerHandleError *err;
6146 } LDKCResult_boolPeerHandleErrorZPtr;
6147
6148 /**
6149  * A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
6150  * containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
6151  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6152  */
6153 typedef struct LDKCResult_boolPeerHandleErrorZ {
6154    /**
6155     * The contents of this CResult_boolPeerHandleErrorZ, accessible via either
6156     * `err` or `result` depending on the state of `result_ok`.
6157     */
6158    union LDKCResult_boolPeerHandleErrorZPtr contents;
6159    /**
6160     * Whether this CResult_boolPeerHandleErrorZ represents a success state.
6161     */
6162    bool result_ok;
6163 } LDKCResult_boolPeerHandleErrorZ;
6164
6165
6166
6167 /**
6168  * Details about one direction of a channel. Received
6169  * within a channel update.
6170  */
6171 typedef struct MUST_USE_STRUCT LDKDirectionalChannelInfo {
6172    /**
6173     * A pointer to the opaque Rust object.
6174     * Nearly everywhere, inner must be non-null, however in places where
6175     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6176     */
6177    LDKnativeDirectionalChannelInfo *inner;
6178    /**
6179     * Indicates that this is the only struct which contains the same pointer.
6180     * Rust functions which take ownership of an object provided via an argument require
6181     * this to be true and invalidate the object pointed to by inner.
6182     */
6183    bool is_owned;
6184 } LDKDirectionalChannelInfo;
6185
6186 /**
6187  * The contents of CResult_DirectionalChannelInfoDecodeErrorZ
6188  */
6189 typedef union LDKCResult_DirectionalChannelInfoDecodeErrorZPtr {
6190    /**
6191     * A pointer to the contents in the success state.
6192     * Reading from this pointer when `result_ok` is not set is undefined.
6193     */
6194    struct LDKDirectionalChannelInfo *result;
6195    /**
6196     * A pointer to the contents in the error state.
6197     * Reading from this pointer when `result_ok` is set is undefined.
6198     */
6199    struct LDKDecodeError *err;
6200 } LDKCResult_DirectionalChannelInfoDecodeErrorZPtr;
6201
6202 /**
6203  * A CResult_DirectionalChannelInfoDecodeErrorZ represents the result of a fallible operation,
6204  * containing a crate::lightning::routing::network_graph::DirectionalChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
6205  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6206  */
6207 typedef struct LDKCResult_DirectionalChannelInfoDecodeErrorZ {
6208    /**
6209     * The contents of this CResult_DirectionalChannelInfoDecodeErrorZ, accessible via either
6210     * `err` or `result` depending on the state of `result_ok`.
6211     */
6212    union LDKCResult_DirectionalChannelInfoDecodeErrorZPtr contents;
6213    /**
6214     * Whether this CResult_DirectionalChannelInfoDecodeErrorZ represents a success state.
6215     */
6216    bool result_ok;
6217 } LDKCResult_DirectionalChannelInfoDecodeErrorZ;
6218
6219
6220
6221 /**
6222  * Details about a channel (both directions).
6223  * Received within a channel announcement.
6224  */
6225 typedef struct MUST_USE_STRUCT LDKChannelInfo {
6226    /**
6227     * A pointer to the opaque Rust object.
6228     * Nearly everywhere, inner must be non-null, however in places where
6229     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6230     */
6231    LDKnativeChannelInfo *inner;
6232    /**
6233     * Indicates that this is the only struct which contains the same pointer.
6234     * Rust functions which take ownership of an object provided via an argument require
6235     * this to be true and invalidate the object pointed to by inner.
6236     */
6237    bool is_owned;
6238 } LDKChannelInfo;
6239
6240 /**
6241  * The contents of CResult_ChannelInfoDecodeErrorZ
6242  */
6243 typedef union LDKCResult_ChannelInfoDecodeErrorZPtr {
6244    /**
6245     * A pointer to the contents in the success state.
6246     * Reading from this pointer when `result_ok` is not set is undefined.
6247     */
6248    struct LDKChannelInfo *result;
6249    /**
6250     * A pointer to the contents in the error state.
6251     * Reading from this pointer when `result_ok` is set is undefined.
6252     */
6253    struct LDKDecodeError *err;
6254 } LDKCResult_ChannelInfoDecodeErrorZPtr;
6255
6256 /**
6257  * A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation,
6258  * containing a crate::lightning::routing::network_graph::ChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
6259  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6260  */
6261 typedef struct LDKCResult_ChannelInfoDecodeErrorZ {
6262    /**
6263     * The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either
6264     * `err` or `result` depending on the state of `result_ok`.
6265     */
6266    union LDKCResult_ChannelInfoDecodeErrorZPtr contents;
6267    /**
6268     * Whether this CResult_ChannelInfoDecodeErrorZ represents a success state.
6269     */
6270    bool result_ok;
6271 } LDKCResult_ChannelInfoDecodeErrorZ;
6272
6273
6274
6275 /**
6276  * Fees for routing via a given channel or a node
6277  */
6278 typedef struct MUST_USE_STRUCT LDKRoutingFees {
6279    /**
6280     * A pointer to the opaque Rust object.
6281     * Nearly everywhere, inner must be non-null, however in places where
6282     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6283     */
6284    LDKnativeRoutingFees *inner;
6285    /**
6286     * Indicates that this is the only struct which contains the same pointer.
6287     * Rust functions which take ownership of an object provided via an argument require
6288     * this to be true and invalidate the object pointed to by inner.
6289     */
6290    bool is_owned;
6291 } LDKRoutingFees;
6292
6293 /**
6294  * The contents of CResult_RoutingFeesDecodeErrorZ
6295  */
6296 typedef union LDKCResult_RoutingFeesDecodeErrorZPtr {
6297    /**
6298     * A pointer to the contents in the success state.
6299     * Reading from this pointer when `result_ok` is not set is undefined.
6300     */
6301    struct LDKRoutingFees *result;
6302    /**
6303     * A pointer to the contents in the error state.
6304     * Reading from this pointer when `result_ok` is set is undefined.
6305     */
6306    struct LDKDecodeError *err;
6307 } LDKCResult_RoutingFeesDecodeErrorZPtr;
6308
6309 /**
6310  * A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation,
6311  * containing a crate::lightning::routing::network_graph::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure.
6312  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6313  */
6314 typedef struct LDKCResult_RoutingFeesDecodeErrorZ {
6315    /**
6316     * The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either
6317     * `err` or `result` depending on the state of `result_ok`.
6318     */
6319    union LDKCResult_RoutingFeesDecodeErrorZPtr contents;
6320    /**
6321     * Whether this CResult_RoutingFeesDecodeErrorZ represents a success state.
6322     */
6323    bool result_ok;
6324 } LDKCResult_RoutingFeesDecodeErrorZ;
6325
6326
6327
6328 /**
6329  * Information received in the latest node_announcement from this node.
6330  */
6331 typedef struct MUST_USE_STRUCT LDKNodeAnnouncementInfo {
6332    /**
6333     * A pointer to the opaque Rust object.
6334     * Nearly everywhere, inner must be non-null, however in places where
6335     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6336     */
6337    LDKnativeNodeAnnouncementInfo *inner;
6338    /**
6339     * Indicates that this is the only struct which contains the same pointer.
6340     * Rust functions which take ownership of an object provided via an argument require
6341     * this to be true and invalidate the object pointed to by inner.
6342     */
6343    bool is_owned;
6344 } LDKNodeAnnouncementInfo;
6345
6346 /**
6347  * The contents of CResult_NodeAnnouncementInfoDecodeErrorZ
6348  */
6349 typedef union LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr {
6350    /**
6351     * A pointer to the contents in the success state.
6352     * Reading from this pointer when `result_ok` is not set is undefined.
6353     */
6354    struct LDKNodeAnnouncementInfo *result;
6355    /**
6356     * A pointer to the contents in the error state.
6357     * Reading from this pointer when `result_ok` is set is undefined.
6358     */
6359    struct LDKDecodeError *err;
6360 } LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr;
6361
6362 /**
6363  * A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation,
6364  * containing a crate::lightning::routing::network_graph::NodeAnnouncementInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
6365  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6366  */
6367 typedef struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ {
6368    /**
6369     * The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either
6370     * `err` or `result` depending on the state of `result_ok`.
6371     */
6372    union LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr contents;
6373    /**
6374     * Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state.
6375     */
6376    bool result_ok;
6377 } LDKCResult_NodeAnnouncementInfoDecodeErrorZ;
6378
6379 /**
6380  * A dynamically-allocated array of u64s of arbitrary size.
6381  * This corresponds to std::vector in C++
6382  */
6383 typedef struct LDKCVec_u64Z {
6384    /**
6385     * The elements in the array.
6386     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6387     */
6388    uint64_t *data;
6389    /**
6390     * The number of elements pointed to by `data`.
6391     */
6392    uintptr_t datalen;
6393 } LDKCVec_u64Z;
6394
6395
6396
6397 /**
6398  * Details about a node in the network, known from the network announcement.
6399  */
6400 typedef struct MUST_USE_STRUCT LDKNodeInfo {
6401    /**
6402     * A pointer to the opaque Rust object.
6403     * Nearly everywhere, inner must be non-null, however in places where
6404     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6405     */
6406    LDKnativeNodeInfo *inner;
6407    /**
6408     * Indicates that this is the only struct which contains the same pointer.
6409     * Rust functions which take ownership of an object provided via an argument require
6410     * this to be true and invalidate the object pointed to by inner.
6411     */
6412    bool is_owned;
6413 } LDKNodeInfo;
6414
6415 /**
6416  * The contents of CResult_NodeInfoDecodeErrorZ
6417  */
6418 typedef union LDKCResult_NodeInfoDecodeErrorZPtr {
6419    /**
6420     * A pointer to the contents in the success state.
6421     * Reading from this pointer when `result_ok` is not set is undefined.
6422     */
6423    struct LDKNodeInfo *result;
6424    /**
6425     * A pointer to the contents in the error state.
6426     * Reading from this pointer when `result_ok` is set is undefined.
6427     */
6428    struct LDKDecodeError *err;
6429 } LDKCResult_NodeInfoDecodeErrorZPtr;
6430
6431 /**
6432  * A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation,
6433  * containing a crate::lightning::routing::network_graph::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
6434  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6435  */
6436 typedef struct LDKCResult_NodeInfoDecodeErrorZ {
6437    /**
6438     * The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either
6439     * `err` or `result` depending on the state of `result_ok`.
6440     */
6441    union LDKCResult_NodeInfoDecodeErrorZPtr contents;
6442    /**
6443     * Whether this CResult_NodeInfoDecodeErrorZ represents a success state.
6444     */
6445    bool result_ok;
6446 } LDKCResult_NodeInfoDecodeErrorZ;
6447
6448
6449
6450 /**
6451  * Represents the network as nodes and channels between them
6452  */
6453 typedef struct MUST_USE_STRUCT LDKNetworkGraph {
6454    /**
6455     * A pointer to the opaque Rust object.
6456     * Nearly everywhere, inner must be non-null, however in places where
6457     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6458     */
6459    LDKnativeNetworkGraph *inner;
6460    /**
6461     * Indicates that this is the only struct which contains the same pointer.
6462     * Rust functions which take ownership of an object provided via an argument require
6463     * this to be true and invalidate the object pointed to by inner.
6464     */
6465    bool is_owned;
6466 } LDKNetworkGraph;
6467
6468 /**
6469  * The contents of CResult_NetworkGraphDecodeErrorZ
6470  */
6471 typedef union LDKCResult_NetworkGraphDecodeErrorZPtr {
6472    /**
6473     * A pointer to the contents in the success state.
6474     * Reading from this pointer when `result_ok` is not set is undefined.
6475     */
6476    struct LDKNetworkGraph *result;
6477    /**
6478     * A pointer to the contents in the error state.
6479     * Reading from this pointer when `result_ok` is set is undefined.
6480     */
6481    struct LDKDecodeError *err;
6482 } LDKCResult_NetworkGraphDecodeErrorZPtr;
6483
6484 /**
6485  * A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation,
6486  * containing a crate::lightning::routing::network_graph::NetworkGraph on success and a crate::lightning::ln::msgs::DecodeError on failure.
6487  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6488  */
6489 typedef struct LDKCResult_NetworkGraphDecodeErrorZ {
6490    /**
6491     * The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either
6492     * `err` or `result` depending on the state of `result_ok`.
6493     */
6494    union LDKCResult_NetworkGraphDecodeErrorZPtr contents;
6495    /**
6496     * Whether this CResult_NetworkGraphDecodeErrorZ represents a success state.
6497     */
6498    bool result_ok;
6499 } LDKCResult_NetworkGraphDecodeErrorZ;
6500
6501 /**
6502  * The contents of CResult_NetAddressu8Z
6503  */
6504 typedef union LDKCResult_NetAddressu8ZPtr {
6505    /**
6506     * A pointer to the contents in the success state.
6507     * Reading from this pointer when `result_ok` is not set is undefined.
6508     */
6509    struct LDKNetAddress *result;
6510    /**
6511     * A pointer to the contents in the error state.
6512     * Reading from this pointer when `result_ok` is set is undefined.
6513     */
6514    uint8_t *err;
6515 } LDKCResult_NetAddressu8ZPtr;
6516
6517 /**
6518  * A CResult_NetAddressu8Z represents the result of a fallible operation,
6519  * containing a crate::lightning::ln::msgs::NetAddress on success and a u8 on failure.
6520  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6521  */
6522 typedef struct LDKCResult_NetAddressu8Z {
6523    /**
6524     * The contents of this CResult_NetAddressu8Z, accessible via either
6525     * `err` or `result` depending on the state of `result_ok`.
6526     */
6527    union LDKCResult_NetAddressu8ZPtr contents;
6528    /**
6529     * Whether this CResult_NetAddressu8Z represents a success state.
6530     */
6531    bool result_ok;
6532 } LDKCResult_NetAddressu8Z;
6533
6534 /**
6535  * The contents of CResult_CResult_NetAddressu8ZDecodeErrorZ
6536  */
6537 typedef union LDKCResult_CResult_NetAddressu8ZDecodeErrorZPtr {
6538    /**
6539     * A pointer to the contents in the success state.
6540     * Reading from this pointer when `result_ok` is not set is undefined.
6541     */
6542    struct LDKCResult_NetAddressu8Z *result;
6543    /**
6544     * A pointer to the contents in the error state.
6545     * Reading from this pointer when `result_ok` is set is undefined.
6546     */
6547    struct LDKDecodeError *err;
6548 } LDKCResult_CResult_NetAddressu8ZDecodeErrorZPtr;
6549
6550 /**
6551  * A CResult_CResult_NetAddressu8ZDecodeErrorZ represents the result of a fallible operation,
6552  * containing a crate::c_types::derived::CResult_NetAddressu8Z on success and a crate::lightning::ln::msgs::DecodeError on failure.
6553  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6554  */
6555 typedef struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ {
6556    /**
6557     * The contents of this CResult_CResult_NetAddressu8ZDecodeErrorZ, accessible via either
6558     * `err` or `result` depending on the state of `result_ok`.
6559     */
6560    union LDKCResult_CResult_NetAddressu8ZDecodeErrorZPtr contents;
6561    /**
6562     * Whether this CResult_CResult_NetAddressu8ZDecodeErrorZ represents a success state.
6563     */
6564    bool result_ok;
6565 } LDKCResult_CResult_NetAddressu8ZDecodeErrorZ;
6566
6567 /**
6568  * The contents of CResult_NetAddressDecodeErrorZ
6569  */
6570 typedef union LDKCResult_NetAddressDecodeErrorZPtr {
6571    /**
6572     * A pointer to the contents in the success state.
6573     * Reading from this pointer when `result_ok` is not set is undefined.
6574     */
6575    struct LDKNetAddress *result;
6576    /**
6577     * A pointer to the contents in the error state.
6578     * Reading from this pointer when `result_ok` is set is undefined.
6579     */
6580    struct LDKDecodeError *err;
6581 } LDKCResult_NetAddressDecodeErrorZPtr;
6582
6583 /**
6584  * A CResult_NetAddressDecodeErrorZ represents the result of a fallible operation,
6585  * containing a crate::lightning::ln::msgs::NetAddress on success and a crate::lightning::ln::msgs::DecodeError on failure.
6586  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6587  */
6588 typedef struct LDKCResult_NetAddressDecodeErrorZ {
6589    /**
6590     * The contents of this CResult_NetAddressDecodeErrorZ, accessible via either
6591     * `err` or `result` depending on the state of `result_ok`.
6592     */
6593    union LDKCResult_NetAddressDecodeErrorZPtr contents;
6594    /**
6595     * Whether this CResult_NetAddressDecodeErrorZ represents a success state.
6596     */
6597    bool result_ok;
6598 } LDKCResult_NetAddressDecodeErrorZ;
6599
6600
6601
6602 /**
6603  * An update_add_htlc message to be sent or received from a peer
6604  */
6605 typedef struct MUST_USE_STRUCT LDKUpdateAddHTLC {
6606    /**
6607     * A pointer to the opaque Rust object.
6608     * Nearly everywhere, inner must be non-null, however in places where
6609     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6610     */
6611    LDKnativeUpdateAddHTLC *inner;
6612    /**
6613     * Indicates that this is the only struct which contains the same pointer.
6614     * Rust functions which take ownership of an object provided via an argument require
6615     * this to be true and invalidate the object pointed to by inner.
6616     */
6617    bool is_owned;
6618 } LDKUpdateAddHTLC;
6619
6620 /**
6621  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size.
6622  * This corresponds to std::vector in C++
6623  */
6624 typedef struct LDKCVec_UpdateAddHTLCZ {
6625    /**
6626     * The elements in the array.
6627     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6628     */
6629    struct LDKUpdateAddHTLC *data;
6630    /**
6631     * The number of elements pointed to by `data`.
6632     */
6633    uintptr_t datalen;
6634 } LDKCVec_UpdateAddHTLCZ;
6635
6636
6637
6638 /**
6639  * An update_fulfill_htlc message to be sent or received from a peer
6640  */
6641 typedef struct MUST_USE_STRUCT LDKUpdateFulfillHTLC {
6642    /**
6643     * A pointer to the opaque Rust object.
6644     * Nearly everywhere, inner must be non-null, however in places where
6645     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6646     */
6647    LDKnativeUpdateFulfillHTLC *inner;
6648    /**
6649     * Indicates that this is the only struct which contains the same pointer.
6650     * Rust functions which take ownership of an object provided via an argument require
6651     * this to be true and invalidate the object pointed to by inner.
6652     */
6653    bool is_owned;
6654 } LDKUpdateFulfillHTLC;
6655
6656 /**
6657  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
6658  * This corresponds to std::vector in C++
6659  */
6660 typedef struct LDKCVec_UpdateFulfillHTLCZ {
6661    /**
6662     * The elements in the array.
6663     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6664     */
6665    struct LDKUpdateFulfillHTLC *data;
6666    /**
6667     * The number of elements pointed to by `data`.
6668     */
6669    uintptr_t datalen;
6670 } LDKCVec_UpdateFulfillHTLCZ;
6671
6672
6673
6674 /**
6675  * An update_fail_htlc message to be sent or received from a peer
6676  */
6677 typedef struct MUST_USE_STRUCT LDKUpdateFailHTLC {
6678    /**
6679     * A pointer to the opaque Rust object.
6680     * Nearly everywhere, inner must be non-null, however in places where
6681     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6682     */
6683    LDKnativeUpdateFailHTLC *inner;
6684    /**
6685     * Indicates that this is the only struct which contains the same pointer.
6686     * Rust functions which take ownership of an object provided via an argument require
6687     * this to be true and invalidate the object pointed to by inner.
6688     */
6689    bool is_owned;
6690 } LDKUpdateFailHTLC;
6691
6692 /**
6693  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size.
6694  * This corresponds to std::vector in C++
6695  */
6696 typedef struct LDKCVec_UpdateFailHTLCZ {
6697    /**
6698     * The elements in the array.
6699     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6700     */
6701    struct LDKUpdateFailHTLC *data;
6702    /**
6703     * The number of elements pointed to by `data`.
6704     */
6705    uintptr_t datalen;
6706 } LDKCVec_UpdateFailHTLCZ;
6707
6708
6709
6710 /**
6711  * An update_fail_malformed_htlc message to be sent or received from a peer
6712  */
6713 typedef struct MUST_USE_STRUCT LDKUpdateFailMalformedHTLC {
6714    /**
6715     * A pointer to the opaque Rust object.
6716     * Nearly everywhere, inner must be non-null, however in places where
6717     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6718     */
6719    LDKnativeUpdateFailMalformedHTLC *inner;
6720    /**
6721     * Indicates that this is the only struct which contains the same pointer.
6722     * Rust functions which take ownership of an object provided via an argument require
6723     * this to be true and invalidate the object pointed to by inner.
6724     */
6725    bool is_owned;
6726 } LDKUpdateFailMalformedHTLC;
6727
6728 /**
6729  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
6730  * This corresponds to std::vector in C++
6731  */
6732 typedef struct LDKCVec_UpdateFailMalformedHTLCZ {
6733    /**
6734     * The elements in the array.
6735     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6736     */
6737    struct LDKUpdateFailMalformedHTLC *data;
6738    /**
6739     * The number of elements pointed to by `data`.
6740     */
6741    uintptr_t datalen;
6742 } LDKCVec_UpdateFailMalformedHTLCZ;
6743
6744 /**
6745  * The contents of CResult_AcceptChannelDecodeErrorZ
6746  */
6747 typedef union LDKCResult_AcceptChannelDecodeErrorZPtr {
6748    /**
6749     * A pointer to the contents in the success state.
6750     * Reading from this pointer when `result_ok` is not set is undefined.
6751     */
6752    struct LDKAcceptChannel *result;
6753    /**
6754     * A pointer to the contents in the error state.
6755     * Reading from this pointer when `result_ok` is set is undefined.
6756     */
6757    struct LDKDecodeError *err;
6758 } LDKCResult_AcceptChannelDecodeErrorZPtr;
6759
6760 /**
6761  * A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
6762  * containing a crate::lightning::ln::msgs::AcceptChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
6763  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6764  */
6765 typedef struct LDKCResult_AcceptChannelDecodeErrorZ {
6766    /**
6767     * The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
6768     * `err` or `result` depending on the state of `result_ok`.
6769     */
6770    union LDKCResult_AcceptChannelDecodeErrorZPtr contents;
6771    /**
6772     * Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
6773     */
6774    bool result_ok;
6775 } LDKCResult_AcceptChannelDecodeErrorZ;
6776
6777 /**
6778  * The contents of CResult_AnnouncementSignaturesDecodeErrorZ
6779  */
6780 typedef union LDKCResult_AnnouncementSignaturesDecodeErrorZPtr {
6781    /**
6782     * A pointer to the contents in the success state.
6783     * Reading from this pointer when `result_ok` is not set is undefined.
6784     */
6785    struct LDKAnnouncementSignatures *result;
6786    /**
6787     * A pointer to the contents in the error state.
6788     * Reading from this pointer when `result_ok` is set is undefined.
6789     */
6790    struct LDKDecodeError *err;
6791 } LDKCResult_AnnouncementSignaturesDecodeErrorZPtr;
6792
6793 /**
6794  * A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
6795  * containing a crate::lightning::ln::msgs::AnnouncementSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
6796  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6797  */
6798 typedef struct LDKCResult_AnnouncementSignaturesDecodeErrorZ {
6799    /**
6800     * The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
6801     * `err` or `result` depending on the state of `result_ok`.
6802     */
6803    union LDKCResult_AnnouncementSignaturesDecodeErrorZPtr contents;
6804    /**
6805     * Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
6806     */
6807    bool result_ok;
6808 } LDKCResult_AnnouncementSignaturesDecodeErrorZ;
6809
6810 /**
6811  * The contents of CResult_ChannelReestablishDecodeErrorZ
6812  */
6813 typedef union LDKCResult_ChannelReestablishDecodeErrorZPtr {
6814    /**
6815     * A pointer to the contents in the success state.
6816     * Reading from this pointer when `result_ok` is not set is undefined.
6817     */
6818    struct LDKChannelReestablish *result;
6819    /**
6820     * A pointer to the contents in the error state.
6821     * Reading from this pointer when `result_ok` is set is undefined.
6822     */
6823    struct LDKDecodeError *err;
6824 } LDKCResult_ChannelReestablishDecodeErrorZPtr;
6825
6826 /**
6827  * A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
6828  * containing a crate::lightning::ln::msgs::ChannelReestablish on success and a crate::lightning::ln::msgs::DecodeError on failure.
6829  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6830  */
6831 typedef struct LDKCResult_ChannelReestablishDecodeErrorZ {
6832    /**
6833     * The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
6834     * `err` or `result` depending on the state of `result_ok`.
6835     */
6836    union LDKCResult_ChannelReestablishDecodeErrorZPtr contents;
6837    /**
6838     * Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
6839     */
6840    bool result_ok;
6841 } LDKCResult_ChannelReestablishDecodeErrorZ;
6842
6843 /**
6844  * The contents of CResult_ClosingSignedDecodeErrorZ
6845  */
6846 typedef union LDKCResult_ClosingSignedDecodeErrorZPtr {
6847    /**
6848     * A pointer to the contents in the success state.
6849     * Reading from this pointer when `result_ok` is not set is undefined.
6850     */
6851    struct LDKClosingSigned *result;
6852    /**
6853     * A pointer to the contents in the error state.
6854     * Reading from this pointer when `result_ok` is set is undefined.
6855     */
6856    struct LDKDecodeError *err;
6857 } LDKCResult_ClosingSignedDecodeErrorZPtr;
6858
6859 /**
6860  * A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
6861  * containing a crate::lightning::ln::msgs::ClosingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
6862  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6863  */
6864 typedef struct LDKCResult_ClosingSignedDecodeErrorZ {
6865    /**
6866     * The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
6867     * `err` or `result` depending on the state of `result_ok`.
6868     */
6869    union LDKCResult_ClosingSignedDecodeErrorZPtr contents;
6870    /**
6871     * Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
6872     */
6873    bool result_ok;
6874 } LDKCResult_ClosingSignedDecodeErrorZ;
6875
6876
6877
6878 /**
6879  * The minimum and maximum fees which the sender is willing to place on the closing transaction.
6880  * This is provided in [`ClosingSigned`] by both sides to indicate the fee range they are willing
6881  * to use.
6882  */
6883 typedef struct MUST_USE_STRUCT LDKClosingSignedFeeRange {
6884    /**
6885     * A pointer to the opaque Rust object.
6886     * Nearly everywhere, inner must be non-null, however in places where
6887     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6888     */
6889    LDKnativeClosingSignedFeeRange *inner;
6890    /**
6891     * Indicates that this is the only struct which contains the same pointer.
6892     * Rust functions which take ownership of an object provided via an argument require
6893     * this to be true and invalidate the object pointed to by inner.
6894     */
6895    bool is_owned;
6896 } LDKClosingSignedFeeRange;
6897
6898 /**
6899  * The contents of CResult_ClosingSignedFeeRangeDecodeErrorZ
6900  */
6901 typedef union LDKCResult_ClosingSignedFeeRangeDecodeErrorZPtr {
6902    /**
6903     * A pointer to the contents in the success state.
6904     * Reading from this pointer when `result_ok` is not set is undefined.
6905     */
6906    struct LDKClosingSignedFeeRange *result;
6907    /**
6908     * A pointer to the contents in the error state.
6909     * Reading from this pointer when `result_ok` is set is undefined.
6910     */
6911    struct LDKDecodeError *err;
6912 } LDKCResult_ClosingSignedFeeRangeDecodeErrorZPtr;
6913
6914 /**
6915  * A CResult_ClosingSignedFeeRangeDecodeErrorZ represents the result of a fallible operation,
6916  * containing a crate::lightning::ln::msgs::ClosingSignedFeeRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
6917  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6918  */
6919 typedef struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ {
6920    /**
6921     * The contents of this CResult_ClosingSignedFeeRangeDecodeErrorZ, accessible via either
6922     * `err` or `result` depending on the state of `result_ok`.
6923     */
6924    union LDKCResult_ClosingSignedFeeRangeDecodeErrorZPtr contents;
6925    /**
6926     * Whether this CResult_ClosingSignedFeeRangeDecodeErrorZ represents a success state.
6927     */
6928    bool result_ok;
6929 } LDKCResult_ClosingSignedFeeRangeDecodeErrorZ;
6930
6931
6932
6933 /**
6934  * A commitment_signed message to be sent or received from a peer
6935  */
6936 typedef struct MUST_USE_STRUCT LDKCommitmentSigned {
6937    /**
6938     * A pointer to the opaque Rust object.
6939     * Nearly everywhere, inner must be non-null, however in places where
6940     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6941     */
6942    LDKnativeCommitmentSigned *inner;
6943    /**
6944     * Indicates that this is the only struct which contains the same pointer.
6945     * Rust functions which take ownership of an object provided via an argument require
6946     * this to be true and invalidate the object pointed to by inner.
6947     */
6948    bool is_owned;
6949 } LDKCommitmentSigned;
6950
6951 /**
6952  * The contents of CResult_CommitmentSignedDecodeErrorZ
6953  */
6954 typedef union LDKCResult_CommitmentSignedDecodeErrorZPtr {
6955    /**
6956     * A pointer to the contents in the success state.
6957     * Reading from this pointer when `result_ok` is not set is undefined.
6958     */
6959    struct LDKCommitmentSigned *result;
6960    /**
6961     * A pointer to the contents in the error state.
6962     * Reading from this pointer when `result_ok` is set is undefined.
6963     */
6964    struct LDKDecodeError *err;
6965 } LDKCResult_CommitmentSignedDecodeErrorZPtr;
6966
6967 /**
6968  * A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
6969  * containing a crate::lightning::ln::msgs::CommitmentSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
6970  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6971  */
6972 typedef struct LDKCResult_CommitmentSignedDecodeErrorZ {
6973    /**
6974     * The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
6975     * `err` or `result` depending on the state of `result_ok`.
6976     */
6977    union LDKCResult_CommitmentSignedDecodeErrorZPtr contents;
6978    /**
6979     * Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
6980     */
6981    bool result_ok;
6982 } LDKCResult_CommitmentSignedDecodeErrorZ;
6983
6984 /**
6985  * The contents of CResult_FundingCreatedDecodeErrorZ
6986  */
6987 typedef union LDKCResult_FundingCreatedDecodeErrorZPtr {
6988    /**
6989     * A pointer to the contents in the success state.
6990     * Reading from this pointer when `result_ok` is not set is undefined.
6991     */
6992    struct LDKFundingCreated *result;
6993    /**
6994     * A pointer to the contents in the error state.
6995     * Reading from this pointer when `result_ok` is set is undefined.
6996     */
6997    struct LDKDecodeError *err;
6998 } LDKCResult_FundingCreatedDecodeErrorZPtr;
6999
7000 /**
7001  * A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
7002  * containing a crate::lightning::ln::msgs::FundingCreated on success and a crate::lightning::ln::msgs::DecodeError on failure.
7003  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7004  */
7005 typedef struct LDKCResult_FundingCreatedDecodeErrorZ {
7006    /**
7007     * The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
7008     * `err` or `result` depending on the state of `result_ok`.
7009     */
7010    union LDKCResult_FundingCreatedDecodeErrorZPtr contents;
7011    /**
7012     * Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
7013     */
7014    bool result_ok;
7015 } LDKCResult_FundingCreatedDecodeErrorZ;
7016
7017 /**
7018  * The contents of CResult_FundingSignedDecodeErrorZ
7019  */
7020 typedef union LDKCResult_FundingSignedDecodeErrorZPtr {
7021    /**
7022     * A pointer to the contents in the success state.
7023     * Reading from this pointer when `result_ok` is not set is undefined.
7024     */
7025    struct LDKFundingSigned *result;
7026    /**
7027     * A pointer to the contents in the error state.
7028     * Reading from this pointer when `result_ok` is set is undefined.
7029     */
7030    struct LDKDecodeError *err;
7031 } LDKCResult_FundingSignedDecodeErrorZPtr;
7032
7033 /**
7034  * A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation,
7035  * containing a crate::lightning::ln::msgs::FundingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
7036  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7037  */
7038 typedef struct LDKCResult_FundingSignedDecodeErrorZ {
7039    /**
7040     * The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
7041     * `err` or `result` depending on the state of `result_ok`.
7042     */
7043    union LDKCResult_FundingSignedDecodeErrorZPtr contents;
7044    /**
7045     * Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
7046     */
7047    bool result_ok;
7048 } LDKCResult_FundingSignedDecodeErrorZ;
7049
7050 /**
7051  * The contents of CResult_FundingLockedDecodeErrorZ
7052  */
7053 typedef union LDKCResult_FundingLockedDecodeErrorZPtr {
7054    /**
7055     * A pointer to the contents in the success state.
7056     * Reading from this pointer when `result_ok` is not set is undefined.
7057     */
7058    struct LDKFundingLocked *result;
7059    /**
7060     * A pointer to the contents in the error state.
7061     * Reading from this pointer when `result_ok` is set is undefined.
7062     */
7063    struct LDKDecodeError *err;
7064 } LDKCResult_FundingLockedDecodeErrorZPtr;
7065
7066 /**
7067  * A CResult_FundingLockedDecodeErrorZ represents the result of a fallible operation,
7068  * containing a crate::lightning::ln::msgs::FundingLocked on success and a crate::lightning::ln::msgs::DecodeError on failure.
7069  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7070  */
7071 typedef struct LDKCResult_FundingLockedDecodeErrorZ {
7072    /**
7073     * The contents of this CResult_FundingLockedDecodeErrorZ, accessible via either
7074     * `err` or `result` depending on the state of `result_ok`.
7075     */
7076    union LDKCResult_FundingLockedDecodeErrorZPtr contents;
7077    /**
7078     * Whether this CResult_FundingLockedDecodeErrorZ represents a success state.
7079     */
7080    bool result_ok;
7081 } LDKCResult_FundingLockedDecodeErrorZ;
7082
7083
7084
7085 /**
7086  * An init message to be sent or received from a peer
7087  */
7088 typedef struct MUST_USE_STRUCT LDKInit {
7089    /**
7090     * A pointer to the opaque Rust object.
7091     * Nearly everywhere, inner must be non-null, however in places where
7092     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7093     */
7094    LDKnativeInit *inner;
7095    /**
7096     * Indicates that this is the only struct which contains the same pointer.
7097     * Rust functions which take ownership of an object provided via an argument require
7098     * this to be true and invalidate the object pointed to by inner.
7099     */
7100    bool is_owned;
7101 } LDKInit;
7102
7103 /**
7104  * The contents of CResult_InitDecodeErrorZ
7105  */
7106 typedef union LDKCResult_InitDecodeErrorZPtr {
7107    /**
7108     * A pointer to the contents in the success state.
7109     * Reading from this pointer when `result_ok` is not set is undefined.
7110     */
7111    struct LDKInit *result;
7112    /**
7113     * A pointer to the contents in the error state.
7114     * Reading from this pointer when `result_ok` is set is undefined.
7115     */
7116    struct LDKDecodeError *err;
7117 } LDKCResult_InitDecodeErrorZPtr;
7118
7119 /**
7120  * A CResult_InitDecodeErrorZ represents the result of a fallible operation,
7121  * containing a crate::lightning::ln::msgs::Init on success and a crate::lightning::ln::msgs::DecodeError on failure.
7122  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7123  */
7124 typedef struct LDKCResult_InitDecodeErrorZ {
7125    /**
7126     * The contents of this CResult_InitDecodeErrorZ, accessible via either
7127     * `err` or `result` depending on the state of `result_ok`.
7128     */
7129    union LDKCResult_InitDecodeErrorZPtr contents;
7130    /**
7131     * Whether this CResult_InitDecodeErrorZ represents a success state.
7132     */
7133    bool result_ok;
7134 } LDKCResult_InitDecodeErrorZ;
7135
7136 /**
7137  * The contents of CResult_OpenChannelDecodeErrorZ
7138  */
7139 typedef union LDKCResult_OpenChannelDecodeErrorZPtr {
7140    /**
7141     * A pointer to the contents in the success state.
7142     * Reading from this pointer when `result_ok` is not set is undefined.
7143     */
7144    struct LDKOpenChannel *result;
7145    /**
7146     * A pointer to the contents in the error state.
7147     * Reading from this pointer when `result_ok` is set is undefined.
7148     */
7149    struct LDKDecodeError *err;
7150 } LDKCResult_OpenChannelDecodeErrorZPtr;
7151
7152 /**
7153  * A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation,
7154  * containing a crate::lightning::ln::msgs::OpenChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
7155  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7156  */
7157 typedef struct LDKCResult_OpenChannelDecodeErrorZ {
7158    /**
7159     * The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
7160     * `err` or `result` depending on the state of `result_ok`.
7161     */
7162    union LDKCResult_OpenChannelDecodeErrorZPtr contents;
7163    /**
7164     * Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
7165     */
7166    bool result_ok;
7167 } LDKCResult_OpenChannelDecodeErrorZ;
7168
7169 /**
7170  * The contents of CResult_RevokeAndACKDecodeErrorZ
7171  */
7172 typedef union LDKCResult_RevokeAndACKDecodeErrorZPtr {
7173    /**
7174     * A pointer to the contents in the success state.
7175     * Reading from this pointer when `result_ok` is not set is undefined.
7176     */
7177    struct LDKRevokeAndACK *result;
7178    /**
7179     * A pointer to the contents in the error state.
7180     * Reading from this pointer when `result_ok` is set is undefined.
7181     */
7182    struct LDKDecodeError *err;
7183 } LDKCResult_RevokeAndACKDecodeErrorZPtr;
7184
7185 /**
7186  * A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
7187  * containing a crate::lightning::ln::msgs::RevokeAndACK on success and a crate::lightning::ln::msgs::DecodeError on failure.
7188  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7189  */
7190 typedef struct LDKCResult_RevokeAndACKDecodeErrorZ {
7191    /**
7192     * The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
7193     * `err` or `result` depending on the state of `result_ok`.
7194     */
7195    union LDKCResult_RevokeAndACKDecodeErrorZPtr contents;
7196    /**
7197     * Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
7198     */
7199    bool result_ok;
7200 } LDKCResult_RevokeAndACKDecodeErrorZ;
7201
7202 /**
7203  * The contents of CResult_ShutdownDecodeErrorZ
7204  */
7205 typedef union LDKCResult_ShutdownDecodeErrorZPtr {
7206    /**
7207     * A pointer to the contents in the success state.
7208     * Reading from this pointer when `result_ok` is not set is undefined.
7209     */
7210    struct LDKShutdown *result;
7211    /**
7212     * A pointer to the contents in the error state.
7213     * Reading from this pointer when `result_ok` is set is undefined.
7214     */
7215    struct LDKDecodeError *err;
7216 } LDKCResult_ShutdownDecodeErrorZPtr;
7217
7218 /**
7219  * A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation,
7220  * containing a crate::lightning::ln::msgs::Shutdown on success and a crate::lightning::ln::msgs::DecodeError on failure.
7221  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7222  */
7223 typedef struct LDKCResult_ShutdownDecodeErrorZ {
7224    /**
7225     * The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
7226     * `err` or `result` depending on the state of `result_ok`.
7227     */
7228    union LDKCResult_ShutdownDecodeErrorZPtr contents;
7229    /**
7230     * Whether this CResult_ShutdownDecodeErrorZ represents a success state.
7231     */
7232    bool result_ok;
7233 } LDKCResult_ShutdownDecodeErrorZ;
7234
7235 /**
7236  * The contents of CResult_UpdateFailHTLCDecodeErrorZ
7237  */
7238 typedef union LDKCResult_UpdateFailHTLCDecodeErrorZPtr {
7239    /**
7240     * A pointer to the contents in the success state.
7241     * Reading from this pointer when `result_ok` is not set is undefined.
7242     */
7243    struct LDKUpdateFailHTLC *result;
7244    /**
7245     * A pointer to the contents in the error state.
7246     * Reading from this pointer when `result_ok` is set is undefined.
7247     */
7248    struct LDKDecodeError *err;
7249 } LDKCResult_UpdateFailHTLCDecodeErrorZPtr;
7250
7251 /**
7252  * A CResult_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
7253  * containing a crate::lightning::ln::msgs::UpdateFailHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
7254  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7255  */
7256 typedef struct LDKCResult_UpdateFailHTLCDecodeErrorZ {
7257    /**
7258     * The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
7259     * `err` or `result` depending on the state of `result_ok`.
7260     */
7261    union LDKCResult_UpdateFailHTLCDecodeErrorZPtr contents;
7262    /**
7263     * Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
7264     */
7265    bool result_ok;
7266 } LDKCResult_UpdateFailHTLCDecodeErrorZ;
7267
7268 /**
7269  * The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
7270  */
7271 typedef union LDKCResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
7272    /**
7273     * A pointer to the contents in the success state.
7274     * Reading from this pointer when `result_ok` is not set is undefined.
7275     */
7276    struct LDKUpdateFailMalformedHTLC *result;
7277    /**
7278     * A pointer to the contents in the error state.
7279     * Reading from this pointer when `result_ok` is set is undefined.
7280     */
7281    struct LDKDecodeError *err;
7282 } LDKCResult_UpdateFailMalformedHTLCDecodeErrorZPtr;
7283
7284 /**
7285  * A CResult_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
7286  * containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
7287  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7288  */
7289 typedef struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ {
7290    /**
7291     * The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
7292     * `err` or `result` depending on the state of `result_ok`.
7293     */
7294    union LDKCResult_UpdateFailMalformedHTLCDecodeErrorZPtr contents;
7295    /**
7296     * Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
7297     */
7298    bool result_ok;
7299 } LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ;
7300
7301
7302
7303 /**
7304  * An update_fee message to be sent or received from a peer
7305  */
7306 typedef struct MUST_USE_STRUCT LDKUpdateFee {
7307    /**
7308     * A pointer to the opaque Rust object.
7309     * Nearly everywhere, inner must be non-null, however in places where
7310     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7311     */
7312    LDKnativeUpdateFee *inner;
7313    /**
7314     * Indicates that this is the only struct which contains the same pointer.
7315     * Rust functions which take ownership of an object provided via an argument require
7316     * this to be true and invalidate the object pointed to by inner.
7317     */
7318    bool is_owned;
7319 } LDKUpdateFee;
7320
7321 /**
7322  * The contents of CResult_UpdateFeeDecodeErrorZ
7323  */
7324 typedef union LDKCResult_UpdateFeeDecodeErrorZPtr {
7325    /**
7326     * A pointer to the contents in the success state.
7327     * Reading from this pointer when `result_ok` is not set is undefined.
7328     */
7329    struct LDKUpdateFee *result;
7330    /**
7331     * A pointer to the contents in the error state.
7332     * Reading from this pointer when `result_ok` is set is undefined.
7333     */
7334    struct LDKDecodeError *err;
7335 } LDKCResult_UpdateFeeDecodeErrorZPtr;
7336
7337 /**
7338  * A CResult_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
7339  * containing a crate::lightning::ln::msgs::UpdateFee on success and a crate::lightning::ln::msgs::DecodeError on failure.
7340  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7341  */
7342 typedef struct LDKCResult_UpdateFeeDecodeErrorZ {
7343    /**
7344     * The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
7345     * `err` or `result` depending on the state of `result_ok`.
7346     */
7347    union LDKCResult_UpdateFeeDecodeErrorZPtr contents;
7348    /**
7349     * Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
7350     */
7351    bool result_ok;
7352 } LDKCResult_UpdateFeeDecodeErrorZ;
7353
7354 /**
7355  * The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
7356  */
7357 typedef union LDKCResult_UpdateFulfillHTLCDecodeErrorZPtr {
7358    /**
7359     * A pointer to the contents in the success state.
7360     * Reading from this pointer when `result_ok` is not set is undefined.
7361     */
7362    struct LDKUpdateFulfillHTLC *result;
7363    /**
7364     * A pointer to the contents in the error state.
7365     * Reading from this pointer when `result_ok` is set is undefined.
7366     */
7367    struct LDKDecodeError *err;
7368 } LDKCResult_UpdateFulfillHTLCDecodeErrorZPtr;
7369
7370 /**
7371  * A CResult_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
7372  * containing a crate::lightning::ln::msgs::UpdateFulfillHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
7373  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7374  */
7375 typedef struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ {
7376    /**
7377     * The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
7378     * `err` or `result` depending on the state of `result_ok`.
7379     */
7380    union LDKCResult_UpdateFulfillHTLCDecodeErrorZPtr contents;
7381    /**
7382     * Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
7383     */
7384    bool result_ok;
7385 } LDKCResult_UpdateFulfillHTLCDecodeErrorZ;
7386
7387 /**
7388  * The contents of CResult_UpdateAddHTLCDecodeErrorZ
7389  */
7390 typedef union LDKCResult_UpdateAddHTLCDecodeErrorZPtr {
7391    /**
7392     * A pointer to the contents in the success state.
7393     * Reading from this pointer when `result_ok` is not set is undefined.
7394     */
7395    struct LDKUpdateAddHTLC *result;
7396    /**
7397     * A pointer to the contents in the error state.
7398     * Reading from this pointer when `result_ok` is set is undefined.
7399     */
7400    struct LDKDecodeError *err;
7401 } LDKCResult_UpdateAddHTLCDecodeErrorZPtr;
7402
7403 /**
7404  * A CResult_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
7405  * containing a crate::lightning::ln::msgs::UpdateAddHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
7406  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7407  */
7408 typedef struct LDKCResult_UpdateAddHTLCDecodeErrorZ {
7409    /**
7410     * The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
7411     * `err` or `result` depending on the state of `result_ok`.
7412     */
7413    union LDKCResult_UpdateAddHTLCDecodeErrorZPtr contents;
7414    /**
7415     * Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
7416     */
7417    bool result_ok;
7418 } LDKCResult_UpdateAddHTLCDecodeErrorZ;
7419
7420
7421
7422 /**
7423  * A ping message to be sent or received from a peer
7424  */
7425 typedef struct MUST_USE_STRUCT LDKPing {
7426    /**
7427     * A pointer to the opaque Rust object.
7428     * Nearly everywhere, inner must be non-null, however in places where
7429     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7430     */
7431    LDKnativePing *inner;
7432    /**
7433     * Indicates that this is the only struct which contains the same pointer.
7434     * Rust functions which take ownership of an object provided via an argument require
7435     * this to be true and invalidate the object pointed to by inner.
7436     */
7437    bool is_owned;
7438 } LDKPing;
7439
7440 /**
7441  * The contents of CResult_PingDecodeErrorZ
7442  */
7443 typedef union LDKCResult_PingDecodeErrorZPtr {
7444    /**
7445     * A pointer to the contents in the success state.
7446     * Reading from this pointer when `result_ok` is not set is undefined.
7447     */
7448    struct LDKPing *result;
7449    /**
7450     * A pointer to the contents in the error state.
7451     * Reading from this pointer when `result_ok` is set is undefined.
7452     */
7453    struct LDKDecodeError *err;
7454 } LDKCResult_PingDecodeErrorZPtr;
7455
7456 /**
7457  * A CResult_PingDecodeErrorZ represents the result of a fallible operation,
7458  * containing a crate::lightning::ln::msgs::Ping on success and a crate::lightning::ln::msgs::DecodeError on failure.
7459  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7460  */
7461 typedef struct LDKCResult_PingDecodeErrorZ {
7462    /**
7463     * The contents of this CResult_PingDecodeErrorZ, accessible via either
7464     * `err` or `result` depending on the state of `result_ok`.
7465     */
7466    union LDKCResult_PingDecodeErrorZPtr contents;
7467    /**
7468     * Whether this CResult_PingDecodeErrorZ represents a success state.
7469     */
7470    bool result_ok;
7471 } LDKCResult_PingDecodeErrorZ;
7472
7473
7474
7475 /**
7476  * A pong message to be sent or received from a peer
7477  */
7478 typedef struct MUST_USE_STRUCT LDKPong {
7479    /**
7480     * A pointer to the opaque Rust object.
7481     * Nearly everywhere, inner must be non-null, however in places where
7482     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7483     */
7484    LDKnativePong *inner;
7485    /**
7486     * Indicates that this is the only struct which contains the same pointer.
7487     * Rust functions which take ownership of an object provided via an argument require
7488     * this to be true and invalidate the object pointed to by inner.
7489     */
7490    bool is_owned;
7491 } LDKPong;
7492
7493 /**
7494  * The contents of CResult_PongDecodeErrorZ
7495  */
7496 typedef union LDKCResult_PongDecodeErrorZPtr {
7497    /**
7498     * A pointer to the contents in the success state.
7499     * Reading from this pointer when `result_ok` is not set is undefined.
7500     */
7501    struct LDKPong *result;
7502    /**
7503     * A pointer to the contents in the error state.
7504     * Reading from this pointer when `result_ok` is set is undefined.
7505     */
7506    struct LDKDecodeError *err;
7507 } LDKCResult_PongDecodeErrorZPtr;
7508
7509 /**
7510  * A CResult_PongDecodeErrorZ represents the result of a fallible operation,
7511  * containing a crate::lightning::ln::msgs::Pong on success and a crate::lightning::ln::msgs::DecodeError on failure.
7512  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7513  */
7514 typedef struct LDKCResult_PongDecodeErrorZ {
7515    /**
7516     * The contents of this CResult_PongDecodeErrorZ, accessible via either
7517     * `err` or `result` depending on the state of `result_ok`.
7518     */
7519    union LDKCResult_PongDecodeErrorZPtr contents;
7520    /**
7521     * Whether this CResult_PongDecodeErrorZ represents a success state.
7522     */
7523    bool result_ok;
7524 } LDKCResult_PongDecodeErrorZ;
7525
7526 /**
7527  * The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
7528  */
7529 typedef union LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
7530    /**
7531     * A pointer to the contents in the success state.
7532     * Reading from this pointer when `result_ok` is not set is undefined.
7533     */
7534    struct LDKUnsignedChannelAnnouncement *result;
7535    /**
7536     * A pointer to the contents in the error state.
7537     * Reading from this pointer when `result_ok` is set is undefined.
7538     */
7539    struct LDKDecodeError *err;
7540 } LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr;
7541
7542 /**
7543  * A CResult_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
7544  * containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
7545  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7546  */
7547 typedef struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ {
7548    /**
7549     * The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
7550     * `err` or `result` depending on the state of `result_ok`.
7551     */
7552    union LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr contents;
7553    /**
7554     * Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
7555     */
7556    bool result_ok;
7557 } LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ;
7558
7559 /**
7560  * The contents of CResult_ChannelAnnouncementDecodeErrorZ
7561  */
7562 typedef union LDKCResult_ChannelAnnouncementDecodeErrorZPtr {
7563    /**
7564     * A pointer to the contents in the success state.
7565     * Reading from this pointer when `result_ok` is not set is undefined.
7566     */
7567    struct LDKChannelAnnouncement *result;
7568    /**
7569     * A pointer to the contents in the error state.
7570     * Reading from this pointer when `result_ok` is set is undefined.
7571     */
7572    struct LDKDecodeError *err;
7573 } LDKCResult_ChannelAnnouncementDecodeErrorZPtr;
7574
7575 /**
7576  * A CResult_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
7577  * containing a crate::lightning::ln::msgs::ChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
7578  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7579  */
7580 typedef struct LDKCResult_ChannelAnnouncementDecodeErrorZ {
7581    /**
7582     * The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
7583     * `err` or `result` depending on the state of `result_ok`.
7584     */
7585    union LDKCResult_ChannelAnnouncementDecodeErrorZPtr contents;
7586    /**
7587     * Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
7588     */
7589    bool result_ok;
7590 } LDKCResult_ChannelAnnouncementDecodeErrorZ;
7591
7592
7593
7594 /**
7595  * The unsigned part of a channel_update
7596  */
7597 typedef struct MUST_USE_STRUCT LDKUnsignedChannelUpdate {
7598    /**
7599     * A pointer to the opaque Rust object.
7600     * Nearly everywhere, inner must be non-null, however in places where
7601     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7602     */
7603    LDKnativeUnsignedChannelUpdate *inner;
7604    /**
7605     * Indicates that this is the only struct which contains the same pointer.
7606     * Rust functions which take ownership of an object provided via an argument require
7607     * this to be true and invalidate the object pointed to by inner.
7608     */
7609    bool is_owned;
7610 } LDKUnsignedChannelUpdate;
7611
7612 /**
7613  * The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
7614  */
7615 typedef union LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr {
7616    /**
7617     * A pointer to the contents in the success state.
7618     * Reading from this pointer when `result_ok` is not set is undefined.
7619     */
7620    struct LDKUnsignedChannelUpdate *result;
7621    /**
7622     * A pointer to the contents in the error state.
7623     * Reading from this pointer when `result_ok` is set is undefined.
7624     */
7625    struct LDKDecodeError *err;
7626 } LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr;
7627
7628 /**
7629  * A CResult_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
7630  * containing a crate::lightning::ln::msgs::UnsignedChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
7631  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7632  */
7633 typedef struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ {
7634    /**
7635     * The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
7636     * `err` or `result` depending on the state of `result_ok`.
7637     */
7638    union LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr contents;
7639    /**
7640     * Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
7641     */
7642    bool result_ok;
7643 } LDKCResult_UnsignedChannelUpdateDecodeErrorZ;
7644
7645 /**
7646  * The contents of CResult_ChannelUpdateDecodeErrorZ
7647  */
7648 typedef union LDKCResult_ChannelUpdateDecodeErrorZPtr {
7649    /**
7650     * A pointer to the contents in the success state.
7651     * Reading from this pointer when `result_ok` is not set is undefined.
7652     */
7653    struct LDKChannelUpdate *result;
7654    /**
7655     * A pointer to the contents in the error state.
7656     * Reading from this pointer when `result_ok` is set is undefined.
7657     */
7658    struct LDKDecodeError *err;
7659 } LDKCResult_ChannelUpdateDecodeErrorZPtr;
7660
7661 /**
7662  * A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
7663  * containing a crate::lightning::ln::msgs::ChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
7664  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7665  */
7666 typedef struct LDKCResult_ChannelUpdateDecodeErrorZ {
7667    /**
7668     * The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
7669     * `err` or `result` depending on the state of `result_ok`.
7670     */
7671    union LDKCResult_ChannelUpdateDecodeErrorZPtr contents;
7672    /**
7673     * Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
7674     */
7675    bool result_ok;
7676 } LDKCResult_ChannelUpdateDecodeErrorZ;
7677
7678 /**
7679  * The contents of CResult_ErrorMessageDecodeErrorZ
7680  */
7681 typedef union LDKCResult_ErrorMessageDecodeErrorZPtr {
7682    /**
7683     * A pointer to the contents in the success state.
7684     * Reading from this pointer when `result_ok` is not set is undefined.
7685     */
7686    struct LDKErrorMessage *result;
7687    /**
7688     * A pointer to the contents in the error state.
7689     * Reading from this pointer when `result_ok` is set is undefined.
7690     */
7691    struct LDKDecodeError *err;
7692 } LDKCResult_ErrorMessageDecodeErrorZPtr;
7693
7694 /**
7695  * A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
7696  * containing a crate::lightning::ln::msgs::ErrorMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
7697  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7698  */
7699 typedef struct LDKCResult_ErrorMessageDecodeErrorZ {
7700    /**
7701     * The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
7702     * `err` or `result` depending on the state of `result_ok`.
7703     */
7704    union LDKCResult_ErrorMessageDecodeErrorZPtr contents;
7705    /**
7706     * Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
7707     */
7708    bool result_ok;
7709 } LDKCResult_ErrorMessageDecodeErrorZ;
7710
7711
7712
7713 /**
7714  * The unsigned part of a node_announcement
7715  */
7716 typedef struct MUST_USE_STRUCT LDKUnsignedNodeAnnouncement {
7717    /**
7718     * A pointer to the opaque Rust object.
7719     * Nearly everywhere, inner must be non-null, however in places where
7720     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7721     */
7722    LDKnativeUnsignedNodeAnnouncement *inner;
7723    /**
7724     * Indicates that this is the only struct which contains the same pointer.
7725     * Rust functions which take ownership of an object provided via an argument require
7726     * this to be true and invalidate the object pointed to by inner.
7727     */
7728    bool is_owned;
7729 } LDKUnsignedNodeAnnouncement;
7730
7731 /**
7732  * The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
7733  */
7734 typedef union LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
7735    /**
7736     * A pointer to the contents in the success state.
7737     * Reading from this pointer when `result_ok` is not set is undefined.
7738     */
7739    struct LDKUnsignedNodeAnnouncement *result;
7740    /**
7741     * A pointer to the contents in the error state.
7742     * Reading from this pointer when `result_ok` is set is undefined.
7743     */
7744    struct LDKDecodeError *err;
7745 } LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr;
7746
7747 /**
7748  * A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
7749  * containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
7750  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7751  */
7752 typedef struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ {
7753    /**
7754     * The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
7755     * `err` or `result` depending on the state of `result_ok`.
7756     */
7757    union LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr contents;
7758    /**
7759     * Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
7760     */
7761    bool result_ok;
7762 } LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ;
7763
7764 /**
7765  * The contents of CResult_NodeAnnouncementDecodeErrorZ
7766  */
7767 typedef union LDKCResult_NodeAnnouncementDecodeErrorZPtr {
7768    /**
7769     * A pointer to the contents in the success state.
7770     * Reading from this pointer when `result_ok` is not set is undefined.
7771     */
7772    struct LDKNodeAnnouncement *result;
7773    /**
7774     * A pointer to the contents in the error state.
7775     * Reading from this pointer when `result_ok` is set is undefined.
7776     */
7777    struct LDKDecodeError *err;
7778 } LDKCResult_NodeAnnouncementDecodeErrorZPtr;
7779
7780 /**
7781  * A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
7782  * containing a crate::lightning::ln::msgs::NodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
7783  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7784  */
7785 typedef struct LDKCResult_NodeAnnouncementDecodeErrorZ {
7786    /**
7787     * The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
7788     * `err` or `result` depending on the state of `result_ok`.
7789     */
7790    union LDKCResult_NodeAnnouncementDecodeErrorZPtr contents;
7791    /**
7792     * Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
7793     */
7794    bool result_ok;
7795 } LDKCResult_NodeAnnouncementDecodeErrorZ;
7796
7797 /**
7798  * The contents of CResult_QueryShortChannelIdsDecodeErrorZ
7799  */
7800 typedef union LDKCResult_QueryShortChannelIdsDecodeErrorZPtr {
7801    /**
7802     * A pointer to the contents in the success state.
7803     * Reading from this pointer when `result_ok` is not set is undefined.
7804     */
7805    struct LDKQueryShortChannelIds *result;
7806    /**
7807     * A pointer to the contents in the error state.
7808     * Reading from this pointer when `result_ok` is set is undefined.
7809     */
7810    struct LDKDecodeError *err;
7811 } LDKCResult_QueryShortChannelIdsDecodeErrorZPtr;
7812
7813 /**
7814  * A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
7815  * containing a crate::lightning::ln::msgs::QueryShortChannelIds on success and a crate::lightning::ln::msgs::DecodeError on failure.
7816  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7817  */
7818 typedef struct LDKCResult_QueryShortChannelIdsDecodeErrorZ {
7819    /**
7820     * The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
7821     * `err` or `result` depending on the state of `result_ok`.
7822     */
7823    union LDKCResult_QueryShortChannelIdsDecodeErrorZPtr contents;
7824    /**
7825     * Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
7826     */
7827    bool result_ok;
7828 } LDKCResult_QueryShortChannelIdsDecodeErrorZ;
7829
7830
7831
7832 /**
7833  * A reply_short_channel_ids_end message is sent as a reply to a
7834  * query_short_channel_ids message. The query recipient makes a best
7835  * effort to respond based on their local network view which may not be
7836  * a perfect view of the network.
7837  */
7838 typedef struct MUST_USE_STRUCT LDKReplyShortChannelIdsEnd {
7839    /**
7840     * A pointer to the opaque Rust object.
7841     * Nearly everywhere, inner must be non-null, however in places where
7842     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7843     */
7844    LDKnativeReplyShortChannelIdsEnd *inner;
7845    /**
7846     * Indicates that this is the only struct which contains the same pointer.
7847     * Rust functions which take ownership of an object provided via an argument require
7848     * this to be true and invalidate the object pointed to by inner.
7849     */
7850    bool is_owned;
7851 } LDKReplyShortChannelIdsEnd;
7852
7853 /**
7854  * The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
7855  */
7856 typedef union LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
7857    /**
7858     * A pointer to the contents in the success state.
7859     * Reading from this pointer when `result_ok` is not set is undefined.
7860     */
7861    struct LDKReplyShortChannelIdsEnd *result;
7862    /**
7863     * A pointer to the contents in the error state.
7864     * Reading from this pointer when `result_ok` is set is undefined.
7865     */
7866    struct LDKDecodeError *err;
7867 } LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr;
7868
7869 /**
7870  * A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
7871  * containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::lightning::ln::msgs::DecodeError on failure.
7872  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7873  */
7874 typedef struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ {
7875    /**
7876     * The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
7877     * `err` or `result` depending on the state of `result_ok`.
7878     */
7879    union LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr contents;
7880    /**
7881     * Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
7882     */
7883    bool result_ok;
7884 } LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ;
7885
7886 /**
7887  * The contents of CResult_QueryChannelRangeDecodeErrorZ
7888  */
7889 typedef union LDKCResult_QueryChannelRangeDecodeErrorZPtr {
7890    /**
7891     * A pointer to the contents in the success state.
7892     * Reading from this pointer when `result_ok` is not set is undefined.
7893     */
7894    struct LDKQueryChannelRange *result;
7895    /**
7896     * A pointer to the contents in the error state.
7897     * Reading from this pointer when `result_ok` is set is undefined.
7898     */
7899    struct LDKDecodeError *err;
7900 } LDKCResult_QueryChannelRangeDecodeErrorZPtr;
7901
7902 /**
7903  * A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
7904  * containing a crate::lightning::ln::msgs::QueryChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
7905  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7906  */
7907 typedef struct LDKCResult_QueryChannelRangeDecodeErrorZ {
7908    /**
7909     * The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
7910     * `err` or `result` depending on the state of `result_ok`.
7911     */
7912    union LDKCResult_QueryChannelRangeDecodeErrorZPtr contents;
7913    /**
7914     * Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
7915     */
7916    bool result_ok;
7917 } LDKCResult_QueryChannelRangeDecodeErrorZ;
7918
7919 /**
7920  * The contents of CResult_ReplyChannelRangeDecodeErrorZ
7921  */
7922 typedef union LDKCResult_ReplyChannelRangeDecodeErrorZPtr {
7923    /**
7924     * A pointer to the contents in the success state.
7925     * Reading from this pointer when `result_ok` is not set is undefined.
7926     */
7927    struct LDKReplyChannelRange *result;
7928    /**
7929     * A pointer to the contents in the error state.
7930     * Reading from this pointer when `result_ok` is set is undefined.
7931     */
7932    struct LDKDecodeError *err;
7933 } LDKCResult_ReplyChannelRangeDecodeErrorZPtr;
7934
7935 /**
7936  * A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
7937  * containing a crate::lightning::ln::msgs::ReplyChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
7938  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7939  */
7940 typedef struct LDKCResult_ReplyChannelRangeDecodeErrorZ {
7941    /**
7942     * The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
7943     * `err` or `result` depending on the state of `result_ok`.
7944     */
7945    union LDKCResult_ReplyChannelRangeDecodeErrorZPtr contents;
7946    /**
7947     * Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
7948     */
7949    bool result_ok;
7950 } LDKCResult_ReplyChannelRangeDecodeErrorZ;
7951
7952
7953
7954 /**
7955  * A gossip_timestamp_filter message is used by a node to request
7956  * gossip relay for messages in the requested time range when the
7957  * gossip_queries feature has been negotiated.
7958  */
7959 typedef struct MUST_USE_STRUCT LDKGossipTimestampFilter {
7960    /**
7961     * A pointer to the opaque Rust object.
7962     * Nearly everywhere, inner must be non-null, however in places where
7963     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7964     */
7965    LDKnativeGossipTimestampFilter *inner;
7966    /**
7967     * Indicates that this is the only struct which contains the same pointer.
7968     * Rust functions which take ownership of an object provided via an argument require
7969     * this to be true and invalidate the object pointed to by inner.
7970     */
7971    bool is_owned;
7972 } LDKGossipTimestampFilter;
7973
7974 /**
7975  * The contents of CResult_GossipTimestampFilterDecodeErrorZ
7976  */
7977 typedef union LDKCResult_GossipTimestampFilterDecodeErrorZPtr {
7978    /**
7979     * A pointer to the contents in the success state.
7980     * Reading from this pointer when `result_ok` is not set is undefined.
7981     */
7982    struct LDKGossipTimestampFilter *result;
7983    /**
7984     * A pointer to the contents in the error state.
7985     * Reading from this pointer when `result_ok` is set is undefined.
7986     */
7987    struct LDKDecodeError *err;
7988 } LDKCResult_GossipTimestampFilterDecodeErrorZPtr;
7989
7990 /**
7991  * A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
7992  * containing a crate::lightning::ln::msgs::GossipTimestampFilter on success and a crate::lightning::ln::msgs::DecodeError on failure.
7993  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7994  */
7995 typedef struct LDKCResult_GossipTimestampFilterDecodeErrorZ {
7996    /**
7997     * The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
7998     * `err` or `result` depending on the state of `result_ok`.
7999     */
8000    union LDKCResult_GossipTimestampFilterDecodeErrorZPtr contents;
8001    /**
8002     * Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
8003     */
8004    bool result_ok;
8005 } LDKCResult_GossipTimestampFilterDecodeErrorZ;
8006
8007 /**
8008  * When signing using a fallible method either an user-supplied `SignError` or a `CreationError`
8009  * may occur.
8010  */
8011 typedef enum LDKSignOrCreationError_Tag {
8012    /**
8013     * An error occurred during signing
8014     */
8015    LDKSignOrCreationError_SignError,
8016    /**
8017     * An error occurred while building the transaction
8018     */
8019    LDKSignOrCreationError_CreationError,
8020    /**
8021     * Must be last for serialization purposes
8022     */
8023    LDKSignOrCreationError_Sentinel,
8024 } LDKSignOrCreationError_Tag;
8025
8026 typedef struct MUST_USE_STRUCT LDKSignOrCreationError {
8027    LDKSignOrCreationError_Tag tag;
8028    union {
8029       struct {
8030          enum LDKCreationError creation_error;
8031       };
8032    };
8033 } LDKSignOrCreationError;
8034
8035 /**
8036  * The contents of CResult_InvoiceSignOrCreationErrorZ
8037  */
8038 typedef union LDKCResult_InvoiceSignOrCreationErrorZPtr {
8039    /**
8040     * A pointer to the contents in the success state.
8041     * Reading from this pointer when `result_ok` is not set is undefined.
8042     */
8043    struct LDKInvoice *result;
8044    /**
8045     * A pointer to the contents in the error state.
8046     * Reading from this pointer when `result_ok` is set is undefined.
8047     */
8048    struct LDKSignOrCreationError *err;
8049 } LDKCResult_InvoiceSignOrCreationErrorZPtr;
8050
8051 /**
8052  * A CResult_InvoiceSignOrCreationErrorZ represents the result of a fallible operation,
8053  * containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SignOrCreationError on failure.
8054  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8055  */
8056 typedef struct LDKCResult_InvoiceSignOrCreationErrorZ {
8057    /**
8058     * The contents of this CResult_InvoiceSignOrCreationErrorZ, accessible via either
8059     * `err` or `result` depending on the state of `result_ok`.
8060     */
8061    union LDKCResult_InvoiceSignOrCreationErrorZPtr contents;
8062    /**
8063     * Whether this CResult_InvoiceSignOrCreationErrorZ represents a success state.
8064     */
8065    bool result_ok;
8066 } LDKCResult_InvoiceSignOrCreationErrorZ;
8067
8068 /**
8069  * A trait indicating an object may generate message send events
8070  */
8071 typedef struct LDKMessageSendEventsProvider {
8072    /**
8073     * An opaque pointer which is passed to your function implementations as an argument.
8074     * This has no meaning in the LDK, and can be NULL or any other value.
8075     */
8076    void *this_arg;
8077    /**
8078     * Gets the list of pending events which were generated by previous actions, clearing the list
8079     * in the process.
8080     */
8081    struct LDKCVec_MessageSendEventZ (*get_and_clear_pending_msg_events)(const void *this_arg);
8082    /**
8083     * Frees any resources associated with this object given its this_arg pointer.
8084     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
8085     */
8086    void (*free)(void *this_arg);
8087 } LDKMessageSendEventsProvider;
8088
8089 /**
8090  * A trait implemented for objects handling events from [`EventsProvider`].
8091  */
8092 typedef struct LDKEventHandler {
8093    /**
8094     * An opaque pointer which is passed to your function implementations as an argument.
8095     * This has no meaning in the LDK, and can be NULL or any other value.
8096     */
8097    void *this_arg;
8098    /**
8099     * Handles the given [`Event`].
8100     *
8101     * See [`EventsProvider`] for details that must be considered when implementing this method.
8102     */
8103    void (*handle_event)(const void *this_arg, struct LDKEvent event);
8104    /**
8105     * Frees any resources associated with this object given its this_arg pointer.
8106     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
8107     */
8108    void (*free)(void *this_arg);
8109 } LDKEventHandler;
8110
8111 /**
8112  * A trait indicating an object may generate events.
8113  *
8114  * Events are processed by passing an [`EventHandler`] to [`process_pending_events`].
8115  *
8116  * # Requirements
8117  *
8118  * See [`process_pending_events`] for requirements around event processing.
8119  *
8120  * When using this trait, [`process_pending_events`] will call [`handle_event`] for each pending
8121  * event since the last invocation. The handler must either act upon the event immediately
8122  * or preserve it for later handling.
8123  *
8124  * Note, handlers may call back into the provider and thus deadlocking must be avoided. Be sure to
8125  * consult the provider's documentation on the implication of processing events and how a handler
8126  * may safely use the provider (e.g., see [`ChannelManager::process_pending_events`] and
8127  * [`ChainMonitor::process_pending_events`]).
8128  *
8129  * (C-not implementable) As there is likely no reason for a user to implement this trait on their
8130  * own type(s).
8131  *
8132  * [`process_pending_events`]: Self::process_pending_events
8133  * [`handle_event`]: EventHandler::handle_event
8134  * [`ChannelManager::process_pending_events`]: crate::ln::channelmanager::ChannelManager#method.process_pending_events
8135  * [`ChainMonitor::process_pending_events`]: crate::chain::chainmonitor::ChainMonitor#method.process_pending_events
8136  */
8137 typedef struct LDKEventsProvider {
8138    /**
8139     * An opaque pointer which is passed to your function implementations as an argument.
8140     * This has no meaning in the LDK, and can be NULL or any other value.
8141     */
8142    void *this_arg;
8143    /**
8144     * Processes any events generated since the last call using the given event handler.
8145     *
8146     * Subsequent calls must only process new events. However, handlers must be capable of handling
8147     * duplicate events across process restarts. This may occur if the provider was recovered from
8148     * an old state (i.e., it hadn't been successfully persisted after processing pending events).
8149     */
8150    void (*process_pending_events)(const void *this_arg, struct LDKEventHandler handler);
8151    /**
8152     * Frees any resources associated with this object given its this_arg pointer.
8153     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
8154     */
8155    void (*free)(void *this_arg);
8156 } LDKEventsProvider;
8157
8158
8159
8160 /**
8161  * Configuration we set when applicable.
8162  *
8163  * Default::default() provides sane defaults.
8164  */
8165 typedef struct MUST_USE_STRUCT LDKChannelHandshakeConfig {
8166    /**
8167     * A pointer to the opaque Rust object.
8168     * Nearly everywhere, inner must be non-null, however in places where
8169     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8170     */
8171    LDKnativeChannelHandshakeConfig *inner;
8172    /**
8173     * Indicates that this is the only struct which contains the same pointer.
8174     * Rust functions which take ownership of an object provided via an argument require
8175     * this to be true and invalidate the object pointed to by inner.
8176     */
8177    bool is_owned;
8178 } LDKChannelHandshakeConfig;
8179
8180
8181
8182 /**
8183  * Optional channel limits which are applied during channel creation.
8184  *
8185  * These limits are only applied to our counterparty's limits, not our own.
8186  *
8187  * Use 0/<type>::max_value() as appropriate to skip checking.
8188  *
8189  * Provides sane defaults for most configurations.
8190  *
8191  * Most additional limits are disabled except those with which specify a default in individual
8192  * field documentation. Note that this may result in barely-usable channels, but since they
8193  * are applied mostly only to incoming channels that's not much of a problem.
8194  */
8195 typedef struct MUST_USE_STRUCT LDKChannelHandshakeLimits {
8196    /**
8197     * A pointer to the opaque Rust object.
8198     * Nearly everywhere, inner must be non-null, however in places where
8199     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8200     */
8201    LDKnativeChannelHandshakeLimits *inner;
8202    /**
8203     * Indicates that this is the only struct which contains the same pointer.
8204     * Rust functions which take ownership of an object provided via an argument require
8205     * this to be true and invalidate the object pointed to by inner.
8206     */
8207    bool is_owned;
8208 } LDKChannelHandshakeLimits;
8209
8210
8211
8212 /**
8213  * Top-level config which holds ChannelHandshakeLimits and ChannelConfig.
8214  *
8215  * Default::default() provides sane defaults for most configurations
8216  * (but currently with 0 relay fees!)
8217  */
8218 typedef struct MUST_USE_STRUCT LDKUserConfig {
8219    /**
8220     * A pointer to the opaque Rust object.
8221     * Nearly everywhere, inner must be non-null, however in places where
8222     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8223     */
8224    LDKnativeUserConfig *inner;
8225    /**
8226     * Indicates that this is the only struct which contains the same pointer.
8227     * Rust functions which take ownership of an object provided via an argument require
8228     * this to be true and invalidate the object pointed to by inner.
8229     */
8230    bool is_owned;
8231 } LDKUserConfig;
8232
8233
8234
8235 /**
8236  * The best known block as identified by its hash and height.
8237  */
8238 typedef struct MUST_USE_STRUCT LDKBestBlock {
8239    /**
8240     * A pointer to the opaque Rust object.
8241     * Nearly everywhere, inner must be non-null, however in places where
8242     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8243     */
8244    LDKnativeBestBlock *inner;
8245    /**
8246     * Indicates that this is the only struct which contains the same pointer.
8247     * Rust functions which take ownership of an object provided via an argument require
8248     * this to be true and invalidate the object pointed to by inner.
8249     */
8250    bool is_owned;
8251 } LDKBestBlock;
8252
8253 /**
8254  * The `Access` trait defines behavior for accessing chain data and state, such as blocks and
8255  * UTXOs.
8256  */
8257 typedef struct LDKAccess {
8258    /**
8259     * An opaque pointer which is passed to your function implementations as an argument.
8260     * This has no meaning in the LDK, and can be NULL or any other value.
8261     */
8262    void *this_arg;
8263    /**
8264     * Returns the transaction output of a funding transaction encoded by [`short_channel_id`].
8265     * Returns an error if `genesis_hash` is for a different chain or if such a transaction output
8266     * is unknown.
8267     *
8268     * [`short_channel_id`]: https://github.com/lightningnetwork/lightning-rfc/blob/master/07-routing-gossip.md#definition-of-short_channel_id
8269     */
8270    struct LDKCResult_TxOutAccessErrorZ (*get_utxo)(const void *this_arg, const uint8_t (*genesis_hash)[32], uint64_t short_channel_id);
8271    /**
8272     * Frees any resources associated with this object given its this_arg pointer.
8273     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
8274     */
8275    void (*free)(void *this_arg);
8276 } LDKAccess;
8277
8278 /**
8279  * The `Listen` trait is used to notify when blocks have been connected or disconnected from the
8280  * chain.
8281  *
8282  * Useful when needing to replay chain data upon startup or as new chain events occur. Clients
8283  * sourcing chain data using a block-oriented API should prefer this interface over [`Confirm`].
8284  * Such clients fetch the entire header chain whereas clients using [`Confirm`] only fetch headers
8285  * when needed.
8286  */
8287 typedef struct LDKListen {
8288    /**
8289     * An opaque pointer which is passed to your function implementations as an argument.
8290     * This has no meaning in the LDK, and can be NULL or any other value.
8291     */
8292    void *this_arg;
8293    /**
8294     * Notifies the listener that a block was added at the given height.
8295     */
8296    void (*block_connected)(const void *this_arg, struct LDKu8slice block, uint32_t height);
8297    /**
8298     * Notifies the listener that a block was removed at the given height.
8299     */
8300    void (*block_disconnected)(const void *this_arg, const uint8_t (*header)[80], uint32_t height);
8301    /**
8302     * Frees any resources associated with this object given its this_arg pointer.
8303     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
8304     */
8305    void (*free)(void *this_arg);
8306 } LDKListen;
8307
8308 /**
8309  * The `Confirm` trait is used to notify when transactions have been confirmed on chain or
8310  * unconfirmed during a chain reorganization.
8311  *
8312  * Clients sourcing chain data using a transaction-oriented API should prefer this interface over
8313  * [`Listen`]. For instance, an Electrum client may implement [`Filter`] by subscribing to activity
8314  * related to registered transactions and outputs. Upon notification, it would pass along the
8315  * matching transactions using this interface.
8316  *
8317  * # Use
8318  *
8319  * The intended use is as follows:
8320  * - Call [`transactions_confirmed`] to process any on-chain activity of interest.
8321  * - Call [`transaction_unconfirmed`] to process any transaction returned by [`get_relevant_txids`]
8322  *   that has been reorganized out of the chain.
8323  * - Call [`best_block_updated`] whenever a new chain tip becomes available.
8324  *
8325  * # Order
8326  *
8327  * Clients must call these methods in chain order. Specifically:
8328  * - Transactions confirmed in a block must be given before transactions confirmed in a later
8329  *   block.
8330  * - Dependent transactions within the same block must be given in topological order, possibly in
8331  *   separate calls.
8332  * - Unconfirmed transactions must be given after the original confirmations and before any
8333  *   reconfirmation.
8334  *
8335  * See individual method documentation for further details.
8336  *
8337  * [`transactions_confirmed`]: Self::transactions_confirmed
8338  * [`transaction_unconfirmed`]: Self::transaction_unconfirmed
8339  * [`best_block_updated`]: Self::best_block_updated
8340  * [`get_relevant_txids`]: Self::get_relevant_txids
8341  */
8342 typedef struct LDKConfirm {
8343    /**
8344     * An opaque pointer which is passed to your function implementations as an argument.
8345     * This has no meaning in the LDK, and can be NULL or any other value.
8346     */
8347    void *this_arg;
8348    /**
8349     * Processes transactions confirmed in a block with a given header and height.
8350     *
8351     * Should be called for any transactions registered by [`Filter::register_tx`] or any
8352     * transactions spending an output registered by [`Filter::register_output`]. Such transactions
8353     * appearing in the same block do not need to be included in the same call; instead, multiple
8354     * calls with additional transactions may be made so long as they are made in [chain order].
8355     *
8356     * May be called before or after [`best_block_updated`] for the corresponding block. However,
8357     * in the event of a chain reorganization, it must not be called with a `header` that is no
8358     * longer in the chain as of the last call to [`best_block_updated`].
8359     *
8360     * [chain order]: Confirm#Order
8361     * [`best_block_updated`]: Self::best_block_updated
8362     */
8363    void (*transactions_confirmed)(const void *this_arg, const uint8_t (*header)[80], struct LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height);
8364    /**
8365     * Processes a transaction that is no longer confirmed as result of a chain reorganization.
8366     *
8367     * Should be called for any transaction returned by [`get_relevant_txids`] if it has been
8368     * reorganized out of the best chain. Once called, the given transaction should not be returned
8369     * by [`get_relevant_txids`] unless it has been reconfirmed via [`transactions_confirmed`].
8370     *
8371     * [`get_relevant_txids`]: Self::get_relevant_txids
8372     * [`transactions_confirmed`]: Self::transactions_confirmed
8373     */
8374    void (*transaction_unconfirmed)(const void *this_arg, const uint8_t (*txid)[32]);
8375    /**
8376     * Processes an update to the best header connected at the given height.
8377     *
8378     * Should be called when a new header is available but may be skipped for intermediary blocks
8379     * if they become available at the same time.
8380     */
8381    void (*best_block_updated)(const void *this_arg, const uint8_t (*header)[80], uint32_t height);
8382    /**
8383     * Returns transactions that should be monitored for reorganization out of the chain.
8384     *
8385     * Should include any transactions passed to [`transactions_confirmed`] that have insufficient
8386     * confirmations to be safe from a chain reorganization. Should not include any transactions
8387     * passed to [`transaction_unconfirmed`] unless later reconfirmed.
8388     *
8389     * May be called to determine the subset of transactions that must still be monitored for
8390     * reorganization. Will be idempotent between calls but may change as a result of calls to the
8391     * other interface methods. Thus, this is useful to determine which transactions may need to be
8392     * given to [`transaction_unconfirmed`].
8393     *
8394     * [`transactions_confirmed`]: Self::transactions_confirmed
8395     * [`transaction_unconfirmed`]: Self::transaction_unconfirmed
8396     */
8397    struct LDKCVec_TxidZ (*get_relevant_txids)(const void *this_arg);
8398    /**
8399     * Frees any resources associated with this object given its this_arg pointer.
8400     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
8401     */
8402    void (*free)(void *this_arg);
8403 } LDKConfirm;
8404
8405
8406
8407 /**
8408  * A transaction output watched by a [`ChannelMonitor`] for spends on-chain.
8409  *
8410  * Used to convey to a [`Filter`] such an output with a given spending condition. Any transaction
8411  * spending the output must be given to [`ChannelMonitor::block_connected`] either directly or via
8412  * the return value of [`Filter::register_output`].
8413  *
8414  * If `block_hash` is `Some`, this indicates the output was created in the corresponding block and
8415  * may have been spent there. See [`Filter::register_output`] for details.
8416  *
8417  * [`ChannelMonitor`]: channelmonitor::ChannelMonitor
8418  * [`ChannelMonitor::block_connected`]: channelmonitor::ChannelMonitor::block_connected
8419  */
8420 typedef struct MUST_USE_STRUCT LDKWatchedOutput {
8421    /**
8422     * A pointer to the opaque Rust object.
8423     * Nearly everywhere, inner must be non-null, however in places where
8424     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8425     */
8426    LDKnativeWatchedOutput *inner;
8427    /**
8428     * Indicates that this is the only struct which contains the same pointer.
8429     * Rust functions which take ownership of an object provided via an argument require
8430     * this to be true and invalidate the object pointed to by inner.
8431     */
8432    bool is_owned;
8433 } LDKWatchedOutput;
8434
8435 /**
8436  * The `Filter` trait defines behavior for indicating chain activity of interest pertaining to
8437  * channels.
8438  *
8439  * This is useful in order to have a [`Watch`] implementation convey to a chain source which
8440  * transactions to be notified of. Notification may take the form of pre-filtering blocks or, in
8441  * the case of [BIP 157]/[BIP 158], only fetching a block if the compact filter matches. If
8442  * receiving full blocks from a chain source, any further filtering is unnecessary.
8443  *
8444  * After an output has been registered, subsequent block retrievals from the chain source must not
8445  * exclude any transactions matching the new criteria nor any in-block descendants of such
8446  * transactions.
8447  *
8448  * Note that use as part of a [`Watch`] implementation involves reentrancy. Therefore, the `Filter`
8449  * should not block on I/O. Implementations should instead queue the newly monitored data to be
8450  * processed later. Then, in order to block until the data has been processed, any [`Watch`]
8451  * invocation that has called the `Filter` must return [`TemporaryFailure`].
8452  *
8453  * [`TemporaryFailure`]: channelmonitor::ChannelMonitorUpdateErr::TemporaryFailure
8454  * [BIP 157]: https://github.com/bitcoin/bips/blob/master/bip-0157.mediawiki
8455  * [BIP 158]: https://github.com/bitcoin/bips/blob/master/bip-0158.mediawiki
8456  */
8457 typedef struct LDKFilter {
8458    /**
8459     * An opaque pointer which is passed to your function implementations as an argument.
8460     * This has no meaning in the LDK, and can be NULL or any other value.
8461     */
8462    void *this_arg;
8463    /**
8464     * Registers interest in a transaction with `txid` and having an output with `script_pubkey` as
8465     * a spending condition.
8466     */
8467    void (*register_tx)(const void *this_arg, const uint8_t (*txid)[32], struct LDKu8slice script_pubkey);
8468    /**
8469     * Registers interest in spends of a transaction output.
8470     *
8471     * Optionally, when `output.block_hash` is set, should return any transaction spending the
8472     * output that is found in the corresponding block along with its index.
8473     *
8474     * This return value is useful for Electrum clients in order to supply in-block descendant
8475     * transactions which otherwise were not included. This is not necessary for other clients if
8476     * such descendant transactions were already included (e.g., when a BIP 157 client provides the
8477     * full block).
8478     */
8479    struct LDKCOption_C2Tuple_usizeTransactionZZ (*register_output)(const void *this_arg, struct LDKWatchedOutput output);
8480    /**
8481     * Frees any resources associated with this object given its this_arg pointer.
8482     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
8483     */
8484    void (*free)(void *this_arg);
8485 } LDKFilter;
8486
8487 /**
8488  * `Persist` defines behavior for persisting channel monitors: this could mean
8489  * writing once to disk, and/or uploading to one or more backup services.
8490  *
8491  * Note that for every new monitor, you **must** persist the new `ChannelMonitor`
8492  * to disk/backups. And, on every update, you **must** persist either the
8493  * `ChannelMonitorUpdate` or the updated monitor itself. Otherwise, there is risk
8494  * of situations such as revoking a transaction, then crashing before this
8495  * revocation can be persisted, then unintentionally broadcasting a revoked
8496  * transaction and losing money. This is a risk because previous channel states
8497  * are toxic, so it's important that whatever channel state is persisted is
8498  * kept up-to-date.
8499  */
8500 typedef struct LDKPersist {
8501    /**
8502     * An opaque pointer which is passed to your function implementations as an argument.
8503     * This has no meaning in the LDK, and can be NULL or any other value.
8504     */
8505    void *this_arg;
8506    /**
8507     * Persist a new channel's data. The data can be stored any way you want, but
8508     * the identifier provided by Rust-Lightning is the channel's outpoint (and
8509     * it is up to you to maintain a correct mapping between the outpoint and the
8510     * stored channel data). Note that you **must** persist every new monitor to
8511     * disk. See the `Persist` trait documentation for more details.
8512     *
8513     * See [`ChannelMonitor::write`] for writing out a `ChannelMonitor`,
8514     * and [`ChannelMonitorUpdateErr`] for requirements when returning errors.
8515     */
8516    struct LDKCResult_NoneChannelMonitorUpdateErrZ (*persist_new_channel)(const void *this_arg, struct LDKOutPoint id, const struct LDKChannelMonitor *NONNULL_PTR data);
8517    /**
8518     * Update one channel's data. The provided `ChannelMonitor` has already
8519     * applied the given update.
8520     *
8521     * Note that on every update, you **must** persist either the
8522     * `ChannelMonitorUpdate` or the updated monitor itself to disk/backups. See
8523     * the `Persist` trait documentation for more details.
8524     *
8525     * If an implementer chooses to persist the updates only, they need to make
8526     * sure that all the updates are applied to the `ChannelMonitors` *before*
8527     * the set of channel monitors is given to the `ChannelManager`
8528     * deserialization routine. See [`ChannelMonitor::update_monitor`] for
8529     * applying a monitor update to a monitor. If full `ChannelMonitors` are
8530     * persisted, then there is no need to persist individual updates.
8531     *
8532     * Note that there could be a performance tradeoff between persisting complete
8533     * channel monitors on every update vs. persisting only updates and applying
8534     * them in batches. The size of each monitor grows `O(number of state updates)`
8535     * whereas updates are small and `O(1)`.
8536     *
8537     * See [`ChannelMonitor::write`] for writing out a `ChannelMonitor`,
8538     * [`ChannelMonitorUpdate::write`] for writing out an update, and
8539     * [`ChannelMonitorUpdateErr`] for requirements when returning errors.
8540     */
8541    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);
8542    /**
8543     * Frees any resources associated with this object given its this_arg pointer.
8544     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
8545     */
8546    void (*free)(void *this_arg);
8547 } LDKPersist;
8548
8549
8550
8551 /**
8552  * An implementation of [`chain::Watch`] for monitoring channels.
8553  *
8554  * Connected and disconnected blocks must be provided to `ChainMonitor` as documented by
8555  * [`chain::Watch`]. May be used in conjunction with [`ChannelManager`] to monitor channels locally
8556  * or used independently to monitor channels remotely. See the [module-level documentation] for
8557  * details.
8558  *
8559  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
8560  * [module-level documentation]: crate::chain::chainmonitor
8561  */
8562 typedef struct MUST_USE_STRUCT LDKChainMonitor {
8563    /**
8564     * A pointer to the opaque Rust object.
8565     * Nearly everywhere, inner must be non-null, however in places where
8566     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8567     */
8568    LDKnativeChainMonitor *inner;
8569    /**
8570     * Indicates that this is the only struct which contains the same pointer.
8571     * Rust functions which take ownership of an object provided via an argument require
8572     * this to be true and invalidate the object pointed to by inner.
8573     */
8574    bool is_owned;
8575 } LDKChainMonitor;
8576
8577
8578
8579 /**
8580  * Simple KeysInterface implementor that takes a 32-byte seed for use as a BIP 32 extended key
8581  * and derives keys from that.
8582  *
8583  * Your node_id is seed/0'
8584  * ChannelMonitor closes may use seed/1'
8585  * Cooperative closes may use seed/2'
8586  * The two close keys may be needed to claim on-chain funds!
8587  */
8588 typedef struct MUST_USE_STRUCT LDKKeysManager {
8589    /**
8590     * A pointer to the opaque Rust object.
8591     * Nearly everywhere, inner must be non-null, however in places where
8592     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8593     */
8594    LDKnativeKeysManager *inner;
8595    /**
8596     * Indicates that this is the only struct which contains the same pointer.
8597     * Rust functions which take ownership of an object provided via an argument require
8598     * this to be true and invalidate the object pointed to by inner.
8599     */
8600    bool is_owned;
8601 } LDKKeysManager;
8602
8603
8604
8605 /**
8606  * Chain-related parameters used to construct a new `ChannelManager`.
8607  *
8608  * Typically, the block-specific parameters are derived from the best block hash for the network,
8609  * as a newly constructed `ChannelManager` will not have created any channels yet. These parameters
8610  * are not needed when deserializing a previously constructed `ChannelManager`.
8611  */
8612 typedef struct MUST_USE_STRUCT LDKChainParameters {
8613    /**
8614     * A pointer to the opaque Rust object.
8615     * Nearly everywhere, inner must be non-null, however in places where
8616     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8617     */
8618    LDKnativeChainParameters *inner;
8619    /**
8620     * Indicates that this is the only struct which contains the same pointer.
8621     * Rust functions which take ownership of an object provided via an argument require
8622     * this to be true and invalidate the object pointed to by inner.
8623     */
8624    bool is_owned;
8625 } LDKChainParameters;
8626
8627
8628
8629 /**
8630  * Channel parameters which apply to our counterparty. These are split out from [`ChannelDetails`]
8631  * to better separate parameters.
8632  */
8633 typedef struct MUST_USE_STRUCT LDKChannelCounterparty {
8634    /**
8635     * A pointer to the opaque Rust object.
8636     * Nearly everywhere, inner must be non-null, however in places where
8637     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8638     */
8639    LDKnativeChannelCounterparty *inner;
8640    /**
8641     * Indicates that this is the only struct which contains the same pointer.
8642     * Rust functions which take ownership of an object provided via an argument require
8643     * this to be true and invalidate the object pointed to by inner.
8644     */
8645    bool is_owned;
8646 } LDKChannelCounterparty;
8647
8648 /**
8649  * A 3-byte byte array.
8650  */
8651 typedef struct LDKThreeBytes {
8652    /**
8653     * The three bytes
8654     */
8655    uint8_t data[3];
8656 } LDKThreeBytes;
8657
8658 /**
8659  * A trait to describe an object which can receive channel messages.
8660  *
8661  * Messages MAY be called in parallel when they originate from different their_node_ids, however
8662  * they MUST NOT be called in parallel when the two calls have the same their_node_id.
8663  */
8664 typedef struct LDKChannelMessageHandler {
8665    /**
8666     * An opaque pointer which is passed to your function implementations as an argument.
8667     * This has no meaning in the LDK, and can be NULL or any other value.
8668     */
8669    void *this_arg;
8670    /**
8671     * Handle an incoming open_channel message from the given peer.
8672     */
8673    void (*handle_open_channel)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKInitFeatures their_features, const struct LDKOpenChannel *NONNULL_PTR msg);
8674    /**
8675     * Handle an incoming accept_channel message from the given peer.
8676     */
8677    void (*handle_accept_channel)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKInitFeatures their_features, const struct LDKAcceptChannel *NONNULL_PTR msg);
8678    /**
8679     * Handle an incoming funding_created message from the given peer.
8680     */
8681    void (*handle_funding_created)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingCreated *NONNULL_PTR msg);
8682    /**
8683     * Handle an incoming funding_signed message from the given peer.
8684     */
8685    void (*handle_funding_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingSigned *NONNULL_PTR msg);
8686    /**
8687     * Handle an incoming funding_locked message from the given peer.
8688     */
8689    void (*handle_funding_locked)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingLocked *NONNULL_PTR msg);
8690    /**
8691     * Handle an incoming shutdown message from the given peer.
8692     */
8693    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);
8694    /**
8695     * Handle an incoming closing_signed message from the given peer.
8696     */
8697    void (*handle_closing_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKClosingSigned *NONNULL_PTR msg);
8698    /**
8699     * Handle an incoming update_add_htlc message from the given peer.
8700     */
8701    void (*handle_update_add_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateAddHTLC *NONNULL_PTR msg);
8702    /**
8703     * Handle an incoming update_fulfill_htlc message from the given peer.
8704     */
8705    void (*handle_update_fulfill_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFulfillHTLC *NONNULL_PTR msg);
8706    /**
8707     * Handle an incoming update_fail_htlc message from the given peer.
8708     */
8709    void (*handle_update_fail_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFailHTLC *NONNULL_PTR msg);
8710    /**
8711     * Handle an incoming update_fail_malformed_htlc message from the given peer.
8712     */
8713    void (*handle_update_fail_malformed_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR msg);
8714    /**
8715     * Handle an incoming commitment_signed message from the given peer.
8716     */
8717    void (*handle_commitment_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKCommitmentSigned *NONNULL_PTR msg);
8718    /**
8719     * Handle an incoming revoke_and_ack message from the given peer.
8720     */
8721    void (*handle_revoke_and_ack)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKRevokeAndACK *NONNULL_PTR msg);
8722    /**
8723     * Handle an incoming update_fee message from the given peer.
8724     */
8725    void (*handle_update_fee)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFee *NONNULL_PTR msg);
8726    /**
8727     * Handle an incoming announcement_signatures message from the given peer.
8728     */
8729    void (*handle_announcement_signatures)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKAnnouncementSignatures *NONNULL_PTR msg);
8730    /**
8731     * Indicates a connection to the peer failed/an existing connection was lost. If no connection
8732     * is believed to be possible in the future (eg they're sending us messages we don't
8733     * understand or indicate they require unknown feature bits), no_connection_possible is set
8734     * and any outstanding channels should be failed.
8735     */
8736    void (*peer_disconnected)(const void *this_arg, struct LDKPublicKey their_node_id, bool no_connection_possible);
8737    /**
8738     * Handle a peer reconnecting, possibly generating channel_reestablish message(s).
8739     */
8740    void (*peer_connected)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR msg);
8741    /**
8742     * Handle an incoming channel_reestablish message from the given peer.
8743     */
8744    void (*handle_channel_reestablish)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelReestablish *NONNULL_PTR msg);
8745    /**
8746     * Handle an incoming channel update from the given peer.
8747     */
8748    void (*handle_channel_update)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelUpdate *NONNULL_PTR msg);
8749    /**
8750     * Handle an incoming error message from the given peer.
8751     */
8752    void (*handle_error)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKErrorMessage *NONNULL_PTR msg);
8753    /**
8754     * Implementation of MessageSendEventsProvider for this object.
8755     */
8756    struct LDKMessageSendEventsProvider MessageSendEventsProvider;
8757    /**
8758     * Frees any resources associated with this object given its this_arg pointer.
8759     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
8760     */
8761    void (*free)(void *this_arg);
8762 } LDKChannelMessageHandler;
8763
8764
8765
8766 /**
8767  * Arguments for the creation of a ChannelManager that are not deserialized.
8768  *
8769  * At a high-level, the process for deserializing a ChannelManager and resuming normal operation
8770  * is:
8771  * 1) Deserialize all stored ChannelMonitors.
8772  * 2) Deserialize the ChannelManager by filling in this struct and calling:
8773  *    <(BlockHash, ChannelManager)>::read(reader, args)
8774  *    This may result in closing some Channels if the ChannelMonitor is newer than the stored
8775  *    ChannelManager state to ensure no loss of funds. Thus, transactions may be broadcasted.
8776  * 3) If you are not fetching full blocks, register all relevant ChannelMonitor outpoints the same
8777  *    way you would handle a `chain::Filter` call using ChannelMonitor::get_outputs_to_watch() and
8778  *    ChannelMonitor::get_funding_txo().
8779  * 4) Reconnect blocks on your ChannelMonitors.
8780  * 5) Disconnect/connect blocks on the ChannelManager.
8781  * 6) Move the ChannelMonitors into your local chain::Watch.
8782  *
8783  * Note that the ordering of #4-6 is not of importance, however all three must occur before you
8784  * call any other methods on the newly-deserialized ChannelManager.
8785  *
8786  * Note that because some channels may be closed during deserialization, it is critical that you
8787  * always deserialize only the latest version of a ChannelManager and ChannelMonitors available to
8788  * you. If you deserialize an old ChannelManager (during which force-closure transactions may be
8789  * broadcast), and then later deserialize a newer version of the same ChannelManager (which will
8790  * not force-close the same channels but consider them live), you may end up revoking a state for
8791  * which you've already broadcasted the transaction.
8792  */
8793 typedef struct MUST_USE_STRUCT LDKChannelManagerReadArgs {
8794    /**
8795     * A pointer to the opaque Rust object.
8796     * Nearly everywhere, inner must be non-null, however in places where
8797     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8798     */
8799    LDKnativeChannelManagerReadArgs *inner;
8800    /**
8801     * Indicates that this is the only struct which contains the same pointer.
8802     * Rust functions which take ownership of an object provided via an argument require
8803     * this to be true and invalidate the object pointed to by inner.
8804     */
8805    bool is_owned;
8806 } LDKChannelManagerReadArgs;
8807
8808
8809
8810 /**
8811  * Proof that the sender knows the per-commitment secret of the previous commitment transaction.
8812  * This is used to convince the recipient that the channel is at a certain commitment
8813  * number even if they lost that data due to a local failure.  Of course, the peer may lie
8814  * and even later commitments may have been revoked.
8815  */
8816 typedef struct MUST_USE_STRUCT LDKDataLossProtect {
8817    /**
8818     * A pointer to the opaque Rust object.
8819     * Nearly everywhere, inner must be non-null, however in places where
8820     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8821     */
8822    LDKnativeDataLossProtect *inner;
8823    /**
8824     * Indicates that this is the only struct which contains the same pointer.
8825     * Rust functions which take ownership of an object provided via an argument require
8826     * this to be true and invalidate the object pointed to by inner.
8827     */
8828    bool is_owned;
8829 } LDKDataLossProtect;
8830
8831 /**
8832  * A trait to describe an object which can receive routing messages.
8833  *
8834  * # Implementor DoS Warnings
8835  *
8836  * For `gossip_queries` messages there are potential DoS vectors when handling
8837  * inbound queries. Implementors using an on-disk network graph should be aware of
8838  * repeated disk I/O for queries accessing different parts of the network graph.
8839  */
8840 typedef struct LDKRoutingMessageHandler {
8841    /**
8842     * An opaque pointer which is passed to your function implementations as an argument.
8843     * This has no meaning in the LDK, and can be NULL or any other value.
8844     */
8845    void *this_arg;
8846    /**
8847     * Handle an incoming node_announcement message, returning true if it should be forwarded on,
8848     * false or returning an Err otherwise.
8849     */
8850    struct LDKCResult_boolLightningErrorZ (*handle_node_announcement)(const void *this_arg, const struct LDKNodeAnnouncement *NONNULL_PTR msg);
8851    /**
8852     * Handle a channel_announcement message, returning true if it should be forwarded on, false
8853     * or returning an Err otherwise.
8854     */
8855    struct LDKCResult_boolLightningErrorZ (*handle_channel_announcement)(const void *this_arg, const struct LDKChannelAnnouncement *NONNULL_PTR msg);
8856    /**
8857     * Handle an incoming channel_update message, returning true if it should be forwarded on,
8858     * false or returning an Err otherwise.
8859     */
8860    struct LDKCResult_boolLightningErrorZ (*handle_channel_update)(const void *this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg);
8861    /**
8862     * Handle some updates to the route graph that we learned due to an outbound failed payment.
8863     */
8864    void (*handle_htlc_fail_channel_update)(const void *this_arg, const struct LDKHTLCFailChannelUpdate *NONNULL_PTR update);
8865    /**
8866     * Gets a subset of the channel announcements and updates required to dump our routing table
8867     * to a remote node, starting at the short_channel_id indicated by starting_point and
8868     * including the batch_amount entries immediately higher in numerical value than starting_point.
8869     */
8870    struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ (*get_next_channel_announcements)(const void *this_arg, uint64_t starting_point, uint8_t batch_amount);
8871    /**
8872     * Gets a subset of the node announcements required to dump our routing table to a remote node,
8873     * starting at the node *after* the provided publickey and including batch_amount entries
8874     * immediately higher (as defined by <PublicKey as Ord>::cmp) than starting_point.
8875     * If None is provided for starting_point, we start at the first node.
8876     *
8877     * Note that starting_point (or a relevant inner pointer) may be NULL or all-0s to represent None
8878     */
8879    struct LDKCVec_NodeAnnouncementZ (*get_next_node_announcements)(const void *this_arg, struct LDKPublicKey starting_point, uint8_t batch_amount);
8880    /**
8881     * Called when a connection is established with a peer. This can be used to
8882     * perform routing table synchronization using a strategy defined by the
8883     * implementor.
8884     */
8885    void (*sync_routing_table)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR init);
8886    /**
8887     * Handles the reply of a query we initiated to learn about channels
8888     * for a given range of blocks. We can expect to receive one or more
8889     * replies to a single query.
8890     */
8891    struct LDKCResult_NoneLightningErrorZ (*handle_reply_channel_range)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKReplyChannelRange msg);
8892    /**
8893     * Handles the reply of a query we initiated asking for routing gossip
8894     * messages for a list of channels. We should receive this message when
8895     * a node has completed its best effort to send us the pertaining routing
8896     * gossip messages.
8897     */
8898    struct LDKCResult_NoneLightningErrorZ (*handle_reply_short_channel_ids_end)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKReplyShortChannelIdsEnd msg);
8899    /**
8900     * Handles when a peer asks us to send a list of short_channel_ids
8901     * for the requested range of blocks.
8902     */
8903    struct LDKCResult_NoneLightningErrorZ (*handle_query_channel_range)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKQueryChannelRange msg);
8904    /**
8905     * Handles when a peer asks us to send routing gossip messages for a
8906     * list of short_channel_ids.
8907     */
8908    struct LDKCResult_NoneLightningErrorZ (*handle_query_short_channel_ids)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKQueryShortChannelIds msg);
8909    /**
8910     * Implementation of MessageSendEventsProvider for this object.
8911     */
8912    struct LDKMessageSendEventsProvider MessageSendEventsProvider;
8913    /**
8914     * Frees any resources associated with this object given its this_arg pointer.
8915     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
8916     */
8917    void (*free)(void *this_arg);
8918 } LDKRoutingMessageHandler;
8919
8920
8921
8922 /**
8923  * A dummy struct which implements `RoutingMessageHandler` without storing any routing information
8924  * or doing any processing. You can provide one of these as the route_handler in a MessageHandler.
8925  */
8926 typedef struct MUST_USE_STRUCT LDKIgnoringMessageHandler {
8927    /**
8928     * A pointer to the opaque Rust object.
8929     * Nearly everywhere, inner must be non-null, however in places where
8930     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8931     */
8932    LDKnativeIgnoringMessageHandler *inner;
8933    /**
8934     * Indicates that this is the only struct which contains the same pointer.
8935     * Rust functions which take ownership of an object provided via an argument require
8936     * this to be true and invalidate the object pointed to by inner.
8937     */
8938    bool is_owned;
8939 } LDKIgnoringMessageHandler;
8940
8941
8942
8943 /**
8944  * A dummy struct which implements `ChannelMessageHandler` without having any channels.
8945  * You can provide one of these as the route_handler in a MessageHandler.
8946  */
8947 typedef struct MUST_USE_STRUCT LDKErroringMessageHandler {
8948    /**
8949     * A pointer to the opaque Rust object.
8950     * Nearly everywhere, inner must be non-null, however in places where
8951     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8952     */
8953    LDKnativeErroringMessageHandler *inner;
8954    /**
8955     * Indicates that this is the only struct which contains the same pointer.
8956     * Rust functions which take ownership of an object provided via an argument require
8957     * this to be true and invalidate the object pointed to by inner.
8958     */
8959    bool is_owned;
8960 } LDKErroringMessageHandler;
8961
8962
8963
8964 /**
8965  * Provides references to trait impls which handle different types of messages.
8966  */
8967 typedef struct MUST_USE_STRUCT LDKMessageHandler {
8968    /**
8969     * A pointer to the opaque Rust object.
8970     * Nearly everywhere, inner must be non-null, however in places where
8971     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8972     */
8973    LDKnativeMessageHandler *inner;
8974    /**
8975     * Indicates that this is the only struct which contains the same pointer.
8976     * Rust functions which take ownership of an object provided via an argument require
8977     * this to be true and invalidate the object pointed to by inner.
8978     */
8979    bool is_owned;
8980 } LDKMessageHandler;
8981
8982 /**
8983  * Provides an object which can be used to send data to and which uniquely identifies a connection
8984  * to a remote host. You will need to be able to generate multiple of these which meet Eq and
8985  * implement Hash to meet the PeerManager API.
8986  *
8987  * For efficiency, Clone should be relatively cheap for this type.
8988  *
8989  * Two descriptors may compare equal (by [`cmp::Eq`] and [`hash::Hash`]) as long as the original
8990  * has been disconnected, the [`PeerManager`] has been informed of the disconnection (either by it
8991  * having triggered the disconnection or a call to [`PeerManager::socket_disconnected`]), and no
8992  * further calls to the [`PeerManager`] related to the original socket occur. This allows you to
8993  * use a file descriptor for your SocketDescriptor directly, however for simplicity you may wish
8994  * to simply use another value which is guaranteed to be globally unique instead.
8995  */
8996 typedef struct LDKSocketDescriptor {
8997    /**
8998     * An opaque pointer which is passed to your function implementations as an argument.
8999     * This has no meaning in the LDK, and can be NULL or any other value.
9000     */
9001    void *this_arg;
9002    /**
9003     * Attempts to send some data from the given slice to the peer.
9004     *
9005     * Returns the amount of data which was sent, possibly 0 if the socket has since disconnected.
9006     * Note that in the disconnected case, [`PeerManager::socket_disconnected`] must still be
9007     * called and further write attempts may occur until that time.
9008     *
9009     * If the returned size is smaller than `data.len()`, a
9010     * [`PeerManager::write_buffer_space_avail`] call must be made the next time more data can be
9011     * written. Additionally, until a `send_data` event completes fully, no further
9012     * [`PeerManager::read_event`] calls should be made for the same peer! Because this is to
9013     * prevent denial-of-service issues, you should not read or buffer any data from the socket
9014     * until then.
9015     *
9016     * If a [`PeerManager::read_event`] call on this descriptor had previously returned true
9017     * (indicating that read events should be paused to prevent DoS in the send buffer),
9018     * `resume_read` may be set indicating that read events on this descriptor should resume. A
9019     * `resume_read` of false carries no meaning, and should not cause any action.
9020     */
9021    uintptr_t (*send_data)(void *this_arg, struct LDKu8slice data, bool resume_read);
9022    /**
9023     * Disconnect the socket pointed to by this SocketDescriptor.
9024     *
9025     * You do *not* need to call [`PeerManager::socket_disconnected`] with this socket after this
9026     * call (doing so is a noop).
9027     */
9028    void (*disconnect_socket)(void *this_arg);
9029    /**
9030     * Checks if two objects are equal given this object's this_arg pointer and another object.
9031     */
9032    bool (*eq)(const void *this_arg, const struct LDKSocketDescriptor *NONNULL_PTR other_arg);
9033    /**
9034     * Calculate a succinct non-cryptographic hash for an object given its this_arg pointer.
9035     * This is used, for example, for inclusion of this object in a hash map.
9036     */
9037    uint64_t (*hash)(const void *this_arg);
9038    /**
9039     * Called, if set, after this SocketDescriptor has been cloned into a duplicate object.
9040     * The new SocketDescriptor is provided, and should be mutated as needed to perform a
9041     * deep copy of the object pointed to by this_arg or avoid any double-freeing.
9042     */
9043    void (*cloned)(struct LDKSocketDescriptor *NONNULL_PTR new_SocketDescriptor);
9044    /**
9045     * Frees any resources associated with this object given its this_arg pointer.
9046     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
9047     */
9048    void (*free)(void *this_arg);
9049 } LDKSocketDescriptor;
9050
9051
9052
9053 /**
9054  * A PeerManager manages a set of peers, described by their [`SocketDescriptor`] and marshalls
9055  * socket events into messages which it passes on to its [`MessageHandler`].
9056  *
9057  * Locks are taken internally, so you must never assume that reentrancy from a
9058  * [`SocketDescriptor`] call back into [`PeerManager`] methods will not deadlock.
9059  *
9060  * Calls to [`read_event`] will decode relevant messages and pass them to the
9061  * [`ChannelMessageHandler`], likely doing message processing in-line. Thus, the primary form of
9062  * parallelism in Rust-Lightning is in calls to [`read_event`]. Note, however, that calls to any
9063  * [`PeerManager`] functions related to the same connection must occur only in serial, making new
9064  * calls only after previous ones have returned.
9065  *
9066  * Rather than using a plain PeerManager, it is preferable to use either a SimpleArcPeerManager
9067  * a SimpleRefPeerManager, for conciseness. See their documentation for more details, but
9068  * essentially you should default to using a SimpleRefPeerManager, and use a
9069  * SimpleArcPeerManager when you require a PeerManager with a static lifetime, such as when
9070  * you're using lightning-net-tokio.
9071  *
9072  * [`read_event`]: PeerManager::read_event
9073  */
9074 typedef struct MUST_USE_STRUCT LDKPeerManager {
9075    /**
9076     * A pointer to the opaque Rust object.
9077     * Nearly everywhere, inner must be non-null, however in places where
9078     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9079     */
9080    LDKnativePeerManager *inner;
9081    /**
9082     * Indicates that this is the only struct which contains the same pointer.
9083     * Rust functions which take ownership of an object provided via an argument require
9084     * this to be true and invalidate the object pointed to by inner.
9085     */
9086    bool is_owned;
9087 } LDKPeerManager;
9088
9089
9090
9091 /**
9092  * Static channel fields used to build transactions given per-commitment fields, organized by
9093  * broadcaster/countersignatory.
9094  *
9095  * This is derived from the holder/counterparty-organized ChannelTransactionParameters via the
9096  * as_holder_broadcastable and as_counterparty_broadcastable functions.
9097  */
9098 typedef struct MUST_USE_STRUCT LDKDirectedChannelTransactionParameters {
9099    /**
9100     * A pointer to the opaque Rust object.
9101     * Nearly everywhere, inner must be non-null, however in places where
9102     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9103     */
9104    LDKnativeDirectedChannelTransactionParameters *inner;
9105    /**
9106     * Indicates that this is the only struct which contains the same pointer.
9107     * Rust functions which take ownership of an object provided via an argument require
9108     * this to be true and invalidate the object pointed to by inner.
9109     */
9110    bool is_owned;
9111 } LDKDirectedChannelTransactionParameters;
9112
9113
9114
9115 /**
9116  * A channel descriptor for a hop along a payment path.
9117  */
9118 typedef struct MUST_USE_STRUCT LDKRouteHintHop {
9119    /**
9120     * A pointer to the opaque Rust object.
9121     * Nearly everywhere, inner must be non-null, however in places where
9122     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9123     */
9124    LDKnativeRouteHintHop *inner;
9125    /**
9126     * Indicates that this is the only struct which contains the same pointer.
9127     * Rust functions which take ownership of an object provided via an argument require
9128     * this to be true and invalidate the object pointed to by inner.
9129     */
9130    bool is_owned;
9131 } LDKRouteHintHop;
9132
9133
9134
9135 /**
9136  * A simple newtype for RwLockReadGuard<'a, NetworkGraph>.
9137  * This exists only to make accessing a RwLock<NetworkGraph> possible from
9138  * the C bindings, as it can be done directly in Rust code.
9139  */
9140 typedef struct MUST_USE_STRUCT LDKLockedNetworkGraph {
9141    /**
9142     * A pointer to the opaque Rust object.
9143     * Nearly everywhere, inner must be non-null, however in places where
9144     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9145     */
9146    LDKnativeLockedNetworkGraph *inner;
9147    /**
9148     * Indicates that this is the only struct which contains the same pointer.
9149     * Rust functions which take ownership of an object provided via an argument require
9150     * this to be true and invalidate the object pointed to by inner.
9151     */
9152    bool is_owned;
9153 } LDKLockedNetworkGraph;
9154
9155
9156
9157 /**
9158  * Receives and validates network updates from peers,
9159  * stores authentic and relevant data as a network graph.
9160  * This network graph is then used for routing payments.
9161  * Provides interface to help with initial routing sync by
9162  * serving historical announcements.
9163  */
9164 typedef struct MUST_USE_STRUCT LDKNetGraphMsgHandler {
9165    /**
9166     * A pointer to the opaque Rust object.
9167     * Nearly everywhere, inner must be non-null, however in places where
9168     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9169     */
9170    LDKnativeNetGraphMsgHandler *inner;
9171    /**
9172     * Indicates that this is the only struct which contains the same pointer.
9173     * Rust functions which take ownership of an object provided via an argument require
9174     * this to be true and invalidate the object pointed to by inner.
9175     */
9176    bool is_owned;
9177 } LDKNetGraphMsgHandler;
9178
9179
9180
9181 /**
9182  * FilesystemPersister persists channel data on disk, where each channel's
9183  * data is stored in a file named after its funding outpoint.
9184  *
9185  * Warning: this module does the best it can with calls to persist data, but it
9186  * can only guarantee that the data is passed to the drive. It is up to the
9187  * drive manufacturers to do the actual persistence properly, which they often
9188  * don't (especially on consumer-grade hardware). Therefore, it is up to the
9189  * user to validate their entire storage stack, to ensure the writes are
9190  * persistent.
9191  * Corollary: especially when dealing with larger amounts of money, it is best
9192  * practice to have multiple channel data backups and not rely only on one
9193  * FilesystemPersister.
9194  */
9195 typedef struct MUST_USE_STRUCT LDKFilesystemPersister {
9196    /**
9197     * A pointer to the opaque Rust object.
9198     * Nearly everywhere, inner must be non-null, however in places where
9199     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9200     */
9201    LDKnativeFilesystemPersister *inner;
9202    /**
9203     * Indicates that this is the only struct which contains the same pointer.
9204     * Rust functions which take ownership of an object provided via an argument require
9205     * this to be true and invalidate the object pointed to by inner.
9206     */
9207    bool is_owned;
9208 } LDKFilesystemPersister;
9209
9210
9211
9212 /**
9213  * BackgroundProcessor takes care of tasks that (1) need to happen periodically to keep
9214  * Rust-Lightning running properly, and (2) either can or should be run in the background. Its
9215  * responsibilities are:
9216  * * Monitoring whether the ChannelManager needs to be re-persisted to disk, and if so,
9217  *   writing it to disk/backups by invoking the callback given to it at startup.
9218  *   ChannelManager persistence should be done in the background.
9219  * * Calling `ChannelManager::timer_tick_occurred()` and
9220  *   `PeerManager::timer_tick_occurred()` every minute (can be done in the
9221  *   background).
9222  *
9223  * Note that if ChannelManager persistence fails and the persisted manager becomes out-of-date,
9224  * then there is a risk of channels force-closing on startup when the manager realizes it's
9225  * outdated. However, as long as `ChannelMonitor` backups are sound, no funds besides those used
9226  * for unilateral chain closure fees are at risk.
9227  *BackgroundProcessor will immediately stop on drop. It should be stored until shutdown.
9228  */
9229 typedef struct MUST_USE_STRUCT LDKBackgroundProcessor {
9230    /**
9231     * A pointer to the opaque Rust object.
9232     * Nearly everywhere, inner must be non-null, however in places where
9233     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9234     */
9235    LDKnativeBackgroundProcessor *inner;
9236    /**
9237     * Indicates that this is the only struct which contains the same pointer.
9238     * Rust functions which take ownership of an object provided via an argument require
9239     * this to be true and invalidate the object pointed to by inner.
9240     */
9241    bool is_owned;
9242 } LDKBackgroundProcessor;
9243
9244 /**
9245  * Trait which handles persisting a [`ChannelManager`] to disk.
9246  *
9247  * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
9248  */
9249 typedef struct LDKChannelManagerPersister {
9250    /**
9251     * An opaque pointer which is passed to your function implementations as an argument.
9252     * This has no meaning in the LDK, and can be NULL or any other value.
9253     */
9254    void *this_arg;
9255    /**
9256     * Persist the given [`ChannelManager`] to disk, returning an error if persistence failed
9257     * (which will cause the [`BackgroundProcessor`] which called this method to exit.
9258     *
9259     * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
9260     */
9261    struct LDKCResult_NoneErrorZ (*persist_manager)(const void *this_arg, const struct LDKChannelManager *NONNULL_PTR channel_manager);
9262    /**
9263     * Frees any resources associated with this object given its this_arg pointer.
9264     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
9265     */
9266    void (*free)(void *this_arg);
9267 } LDKChannelManagerPersister;
9268
9269
9270
9271 /**
9272  * Data of the `RawInvoice` that is encoded in the data part
9273  */
9274 typedef struct MUST_USE_STRUCT LDKRawDataPart {
9275    /**
9276     * A pointer to the opaque Rust object.
9277     * Nearly everywhere, inner must be non-null, however in places where
9278     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9279     */
9280    LDKnativeRawDataPart *inner;
9281    /**
9282     * Indicates that this is the only struct which contains the same pointer.
9283     * Rust functions which take ownership of an object provided via an argument require
9284     * this to be true and invalidate the object pointed to by inner.
9285     */
9286    bool is_owned;
9287 } LDKRawDataPart;
9288
9289
9290
9291 /**
9292  * SHA-256 hash
9293  */
9294 typedef struct MUST_USE_STRUCT LDKSha256 {
9295    /**
9296     * A pointer to the opaque Rust object.
9297     * Nearly everywhere, inner must be non-null, however in places where
9298     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9299     */
9300    LDKnativeSha256 *inner;
9301    /**
9302     * Indicates that this is the only struct which contains the same pointer.
9303     * Rust functions which take ownership of an object provided via an argument require
9304     * this to be true and invalidate the object pointed to by inner.
9305     */
9306    bool is_owned;
9307 } LDKSha256;
9308
9309
9310
9311 /**
9312  * `min_final_cltv_expiry` to use for the last HTLC in the route
9313  */
9314 typedef struct MUST_USE_STRUCT LDKMinFinalCltvExpiry {
9315    /**
9316     * A pointer to the opaque Rust object.
9317     * Nearly everywhere, inner must be non-null, however in places where
9318     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9319     */
9320    LDKnativeMinFinalCltvExpiry *inner;
9321    /**
9322     * Indicates that this is the only struct which contains the same pointer.
9323     * Rust functions which take ownership of an object provided via an argument require
9324     * this to be true and invalidate the object pointed to by inner.
9325     */
9326    bool is_owned;
9327 } LDKMinFinalCltvExpiry;
9328
9329 /**
9330  * Integer in the range `0..32`
9331  */
9332 typedef struct LDKu5 {
9333    uint8_t _0;
9334 } LDKu5;
9335
9336 /**
9337  * A 20-byte byte array.
9338  */
9339 typedef struct LDKTwentyBytes {
9340    /**
9341     * The twenty bytes
9342     */
9343    uint8_t data[20];
9344 } LDKTwentyBytes;
9345
9346 /**
9347  * Fallback address in case no LN payment is possible
9348  */
9349 typedef enum LDKFallback_Tag {
9350    LDKFallback_SegWitProgram,
9351    LDKFallback_PubKeyHash,
9352    LDKFallback_ScriptHash,
9353    /**
9354     * Must be last for serialization purposes
9355     */
9356    LDKFallback_Sentinel,
9357 } LDKFallback_Tag;
9358
9359 typedef struct LDKFallback_LDKSegWitProgram_Body {
9360    struct LDKu5 version;
9361    struct LDKCVec_u8Z program;
9362 } LDKFallback_LDKSegWitProgram_Body;
9363
9364 typedef struct MUST_USE_STRUCT LDKFallback {
9365    LDKFallback_Tag tag;
9366    union {
9367       LDKFallback_LDKSegWitProgram_Body seg_wit_program;
9368       struct {
9369          struct LDKTwentyBytes pub_key_hash;
9370       };
9371       struct {
9372          struct LDKTwentyBytes script_hash;
9373       };
9374    };
9375 } LDKFallback;
9376
9377 extern const uintptr_t MAX_BUF_SIZE;
9378
9379 extern const uint64_t MIN_RELAY_FEE_SAT_PER_1000_WEIGHT;
9380
9381 extern const uint64_t CLOSED_CHANNEL_UPDATE_ID;
9382
9383 extern const uint32_t ANTI_REORG_DELAY;
9384
9385 extern const uint16_t BREAKDOWN_TIMEOUT;
9386
9387 extern const uint16_t MIN_CLTV_EXPIRY_DELTA;
9388
9389 extern const uint32_t MIN_FINAL_CLTV_EXPIRY;
9390
9391 extern const uintptr_t REVOKEABLE_REDEEMSCRIPT_MAX_LENGTH;
9392
9393 extern const uint64_t DEFAULT_EXPIRY_TIME;
9394
9395 extern const uint64_t DEFAULT_MIN_FINAL_CLTV_EXPIRY;
9396
9397 extern const uint8_t TAG_PAYMENT_HASH;
9398
9399 extern const uint8_t TAG_DESCRIPTION;
9400
9401 extern const uint8_t TAG_PAYEE_PUB_KEY;
9402
9403 extern const uint8_t TAG_DESCRIPTION_HASH;
9404
9405 extern const uint8_t TAG_EXPIRY_TIME;
9406
9407 extern const uint8_t TAG_MIN_FINAL_CLTV_EXPIRY;
9408
9409 extern const uint8_t TAG_FALLBACK;
9410
9411 extern const uint8_t TAG_PRIVATE_ROUTE;
9412
9413 extern const uint8_t TAG_PAYMENT_SECRET;
9414
9415 extern const uint8_t TAG_FEATURES;
9416
9417 struct LDKStr _ldk_get_compiled_version(void);
9418
9419 struct LDKStr _ldk_c_bindings_get_compiled_version(void);
9420
9421 /**
9422  * Frees the data buffer, if data_is_owned is set and datalen > 0.
9423  */
9424 void Transaction_free(struct LDKTransaction _res);
9425
9426 /**
9427  * Convenience function for constructing a new TxOut
9428  */
9429 struct LDKTxOut TxOut_new(struct LDKCVec_u8Z script_pubkey, uint64_t value);
9430
9431 /**
9432  * Frees the data pointed to by script_pubkey.
9433  */
9434 void TxOut_free(struct LDKTxOut _res);
9435
9436 /**
9437  * Creates a new TxOut which has the same data as `orig` but with a new script buffer.
9438  */
9439 struct LDKTxOut TxOut_clone(const struct LDKTxOut *NONNULL_PTR orig);
9440
9441 /**
9442  * Frees the data buffer, if chars_is_owned is set and len > 0.
9443  */
9444 void Str_free(struct LDKStr _res);
9445
9446 /**
9447  * Creates a new CResult_SecretKeyErrorZ in the success state.
9448  */
9449 struct LDKCResult_SecretKeyErrorZ CResult_SecretKeyErrorZ_ok(struct LDKSecretKey o);
9450
9451 /**
9452  * Creates a new CResult_SecretKeyErrorZ in the error state.
9453  */
9454 struct LDKCResult_SecretKeyErrorZ CResult_SecretKeyErrorZ_err(enum LDKSecp256k1Error e);
9455
9456 /**
9457  * Frees any resources used by the CResult_SecretKeyErrorZ.
9458  */
9459 void CResult_SecretKeyErrorZ_free(struct LDKCResult_SecretKeyErrorZ _res);
9460
9461 /**
9462  * Creates a new CResult_PublicKeyErrorZ in the success state.
9463  */
9464 struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_ok(struct LDKPublicKey o);
9465
9466 /**
9467  * Creates a new CResult_PublicKeyErrorZ in the error state.
9468  */
9469 struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_err(enum LDKSecp256k1Error e);
9470
9471 /**
9472  * Frees any resources used by the CResult_PublicKeyErrorZ.
9473  */
9474 void CResult_PublicKeyErrorZ_free(struct LDKCResult_PublicKeyErrorZ _res);
9475
9476 /**
9477  * Creates a new CResult_PublicKeyErrorZ which has the same data as `orig`
9478  * but with all dynamically-allocated buffers duplicated in new buffers.
9479  */
9480 struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_clone(const struct LDKCResult_PublicKeyErrorZ *NONNULL_PTR orig);
9481
9482 /**
9483  * Creates a new CResult_TxCreationKeysDecodeErrorZ in the success state.
9484  */
9485 struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_ok(struct LDKTxCreationKeys o);
9486
9487 /**
9488  * Creates a new CResult_TxCreationKeysDecodeErrorZ in the error state.
9489  */
9490 struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_err(struct LDKDecodeError e);
9491
9492 /**
9493  * Frees any resources used by the CResult_TxCreationKeysDecodeErrorZ.
9494  */
9495 void CResult_TxCreationKeysDecodeErrorZ_free(struct LDKCResult_TxCreationKeysDecodeErrorZ _res);
9496
9497 /**
9498  * Creates a new CResult_TxCreationKeysDecodeErrorZ which has the same data as `orig`
9499  * but with all dynamically-allocated buffers duplicated in new buffers.
9500  */
9501 struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_clone(const struct LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR orig);
9502
9503 /**
9504  * Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the success state.
9505  */
9506 struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_ok(struct LDKChannelPublicKeys o);
9507
9508 /**
9509  * Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the error state.
9510  */
9511 struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_err(struct LDKDecodeError e);
9512
9513 /**
9514  * Frees any resources used by the CResult_ChannelPublicKeysDecodeErrorZ.
9515  */
9516 void CResult_ChannelPublicKeysDecodeErrorZ_free(struct LDKCResult_ChannelPublicKeysDecodeErrorZ _res);
9517
9518 /**
9519  * Creates a new CResult_ChannelPublicKeysDecodeErrorZ which has the same data as `orig`
9520  * but with all dynamically-allocated buffers duplicated in new buffers.
9521  */
9522 struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_clone(const struct LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR orig);
9523
9524 /**
9525  * Creates a new CResult_TxCreationKeysErrorZ in the success state.
9526  */
9527 struct LDKCResult_TxCreationKeysErrorZ CResult_TxCreationKeysErrorZ_ok(struct LDKTxCreationKeys o);
9528
9529 /**
9530  * Creates a new CResult_TxCreationKeysErrorZ in the error state.
9531  */
9532 struct LDKCResult_TxCreationKeysErrorZ CResult_TxCreationKeysErrorZ_err(enum LDKSecp256k1Error e);
9533
9534 /**
9535  * Frees any resources used by the CResult_TxCreationKeysErrorZ.
9536  */
9537 void CResult_TxCreationKeysErrorZ_free(struct LDKCResult_TxCreationKeysErrorZ _res);
9538
9539 /**
9540  * Creates a new CResult_TxCreationKeysErrorZ which has the same data as `orig`
9541  * but with all dynamically-allocated buffers duplicated in new buffers.
9542  */
9543 struct LDKCResult_TxCreationKeysErrorZ CResult_TxCreationKeysErrorZ_clone(const struct LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR orig);
9544
9545 /**
9546  * Constructs a new COption_u32Z containing a u32
9547  */
9548 struct LDKCOption_u32Z COption_u32Z_some(uint32_t o);
9549
9550 /**
9551  * Constructs a new COption_u32Z containing nothing
9552  */
9553 struct LDKCOption_u32Z COption_u32Z_none(void);
9554
9555 /**
9556  * Frees any resources associated with the u32, if we are in the Some state
9557  */
9558 void COption_u32Z_free(struct LDKCOption_u32Z _res);
9559
9560 /**
9561  * Creates a new COption_u32Z which has the same data as `orig`
9562  * but with all dynamically-allocated buffers duplicated in new buffers.
9563  */
9564 struct LDKCOption_u32Z COption_u32Z_clone(const struct LDKCOption_u32Z *NONNULL_PTR orig);
9565
9566 /**
9567  * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the success state.
9568  */
9569 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(struct LDKHTLCOutputInCommitment o);
9570
9571 /**
9572  * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the error state.
9573  */
9574 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_err(struct LDKDecodeError e);
9575
9576 /**
9577  * Frees any resources used by the CResult_HTLCOutputInCommitmentDecodeErrorZ.
9578  */
9579 void CResult_HTLCOutputInCommitmentDecodeErrorZ_free(struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res);
9580
9581 /**
9582  * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ which has the same data as `orig`
9583  * but with all dynamically-allocated buffers duplicated in new buffers.
9584  */
9585 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(const struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR orig);
9586
9587 /**
9588  * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the success state.
9589  */
9590 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(struct LDKCounterpartyChannelTransactionParameters o);
9591
9592 /**
9593  * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the error state.
9594  */
9595 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(struct LDKDecodeError e);
9596
9597 /**
9598  * Frees any resources used by the CResult_CounterpartyChannelTransactionParametersDecodeErrorZ.
9599  */
9600 void CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res);
9601
9602 /**
9603  * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
9604  * but with all dynamically-allocated buffers duplicated in new buffers.
9605  */
9606 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(const struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR orig);
9607
9608 /**
9609  * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the success state.
9610  */
9611 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_ok(struct LDKChannelTransactionParameters o);
9612
9613 /**
9614  * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the error state.
9615  */
9616 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_err(struct LDKDecodeError e);
9617
9618 /**
9619  * Frees any resources used by the CResult_ChannelTransactionParametersDecodeErrorZ.
9620  */
9621 void CResult_ChannelTransactionParametersDecodeErrorZ_free(struct LDKCResult_ChannelTransactionParametersDecodeErrorZ _res);
9622
9623 /**
9624  * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
9625  * but with all dynamically-allocated buffers duplicated in new buffers.
9626  */
9627 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_clone(const struct LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR orig);
9628
9629 /**
9630  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9631  */
9632 void CVec_SignatureZ_free(struct LDKCVec_SignatureZ _res);
9633
9634 /**
9635  * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the success state.
9636  */
9637 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_ok(struct LDKHolderCommitmentTransaction o);
9638
9639 /**
9640  * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the error state.
9641  */
9642 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
9643
9644 /**
9645  * Frees any resources used by the CResult_HolderCommitmentTransactionDecodeErrorZ.
9646  */
9647 void CResult_HolderCommitmentTransactionDecodeErrorZ_free(struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res);
9648
9649 /**
9650  * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ which has the same data as `orig`
9651  * but with all dynamically-allocated buffers duplicated in new buffers.
9652  */
9653 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
9654
9655 /**
9656  * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the success state.
9657  */
9658 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(struct LDKBuiltCommitmentTransaction o);
9659
9660 /**
9661  * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the error state.
9662  */
9663 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
9664
9665 /**
9666  * Frees any resources used by the CResult_BuiltCommitmentTransactionDecodeErrorZ.
9667  */
9668 void CResult_BuiltCommitmentTransactionDecodeErrorZ_free(struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res);
9669
9670 /**
9671  * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ which has the same data as `orig`
9672  * but with all dynamically-allocated buffers duplicated in new buffers.
9673  */
9674 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
9675
9676 /**
9677  * Creates a new CResult_CommitmentTransactionDecodeErrorZ in the success state.
9678  */
9679 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_ok(struct LDKCommitmentTransaction o);
9680
9681 /**
9682  * Creates a new CResult_CommitmentTransactionDecodeErrorZ in the error state.
9683  */
9684 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
9685
9686 /**
9687  * Frees any resources used by the CResult_CommitmentTransactionDecodeErrorZ.
9688  */
9689 void CResult_CommitmentTransactionDecodeErrorZ_free(struct LDKCResult_CommitmentTransactionDecodeErrorZ _res);
9690
9691 /**
9692  * Creates a new CResult_CommitmentTransactionDecodeErrorZ which has the same data as `orig`
9693  * but with all dynamically-allocated buffers duplicated in new buffers.
9694  */
9695 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
9696
9697 /**
9698  * Creates a new CResult_TrustedCommitmentTransactionNoneZ in the success state.
9699  */
9700 struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_ok(struct LDKTrustedCommitmentTransaction o);
9701
9702 /**
9703  * Creates a new CResult_TrustedCommitmentTransactionNoneZ in the error state.
9704  */
9705 struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_err(void);
9706
9707 /**
9708  * Frees any resources used by the CResult_TrustedCommitmentTransactionNoneZ.
9709  */
9710 void CResult_TrustedCommitmentTransactionNoneZ_free(struct LDKCResult_TrustedCommitmentTransactionNoneZ _res);
9711
9712 /**
9713  * Creates a new CResult_CVec_SignatureZNoneZ in the success state.
9714  */
9715 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_ok(struct LDKCVec_SignatureZ o);
9716
9717 /**
9718  * Creates a new CResult_CVec_SignatureZNoneZ in the error state.
9719  */
9720 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_err(void);
9721
9722 /**
9723  * Frees any resources used by the CResult_CVec_SignatureZNoneZ.
9724  */
9725 void CResult_CVec_SignatureZNoneZ_free(struct LDKCResult_CVec_SignatureZNoneZ _res);
9726
9727 /**
9728  * Creates a new CResult_CVec_SignatureZNoneZ which has the same data as `orig`
9729  * but with all dynamically-allocated buffers duplicated in new buffers.
9730  */
9731 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_clone(const struct LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR orig);
9732
9733 /**
9734  * Creates a new CResult_ShutdownScriptDecodeErrorZ in the success state.
9735  */
9736 struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_ok(struct LDKShutdownScript o);
9737
9738 /**
9739  * Creates a new CResult_ShutdownScriptDecodeErrorZ in the error state.
9740  */
9741 struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_err(struct LDKDecodeError e);
9742
9743 /**
9744  * Frees any resources used by the CResult_ShutdownScriptDecodeErrorZ.
9745  */
9746 void CResult_ShutdownScriptDecodeErrorZ_free(struct LDKCResult_ShutdownScriptDecodeErrorZ _res);
9747
9748 /**
9749  * Creates a new CResult_ShutdownScriptDecodeErrorZ which has the same data as `orig`
9750  * but with all dynamically-allocated buffers duplicated in new buffers.
9751  */
9752 struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_clone(const struct LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR orig);
9753
9754 /**
9755  * Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the success state.
9756  */
9757 struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ CResult_ShutdownScriptInvalidShutdownScriptZ_ok(struct LDKShutdownScript o);
9758
9759 /**
9760  * Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the error state.
9761  */
9762 struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ CResult_ShutdownScriptInvalidShutdownScriptZ_err(struct LDKInvalidShutdownScript e);
9763
9764 /**
9765  * Frees any resources used by the CResult_ShutdownScriptInvalidShutdownScriptZ.
9766  */
9767 void CResult_ShutdownScriptInvalidShutdownScriptZ_free(struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res);
9768
9769 /**
9770  * Creates a new CResult_NoneErrorZ in the success state.
9771  */
9772 struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_ok(void);
9773
9774 /**
9775  * Creates a new CResult_NoneErrorZ in the error state.
9776  */
9777 struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_err(enum LDKIOError e);
9778
9779 /**
9780  * Frees any resources used by the CResult_NoneErrorZ.
9781  */
9782 void CResult_NoneErrorZ_free(struct LDKCResult_NoneErrorZ _res);
9783
9784 /**
9785  * Creates a new CResult_NoneErrorZ which has the same data as `orig`
9786  * but with all dynamically-allocated buffers duplicated in new buffers.
9787  */
9788 struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_clone(const struct LDKCResult_NoneErrorZ *NONNULL_PTR orig);
9789
9790 /**
9791  * Creates a new CResult_RouteHopDecodeErrorZ in the success state.
9792  */
9793 struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_ok(struct LDKRouteHop o);
9794
9795 /**
9796  * Creates a new CResult_RouteHopDecodeErrorZ in the error state.
9797  */
9798 struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_err(struct LDKDecodeError e);
9799
9800 /**
9801  * Frees any resources used by the CResult_RouteHopDecodeErrorZ.
9802  */
9803 void CResult_RouteHopDecodeErrorZ_free(struct LDKCResult_RouteHopDecodeErrorZ _res);
9804
9805 /**
9806  * Creates a new CResult_RouteHopDecodeErrorZ which has the same data as `orig`
9807  * but with all dynamically-allocated buffers duplicated in new buffers.
9808  */
9809 struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_clone(const struct LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR orig);
9810
9811 /**
9812  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9813  */
9814 void CVec_RouteHopZ_free(struct LDKCVec_RouteHopZ _res);
9815
9816 /**
9817  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9818  */
9819 void CVec_CVec_RouteHopZZ_free(struct LDKCVec_CVec_RouteHopZZ _res);
9820
9821 /**
9822  * Creates a new CResult_RouteDecodeErrorZ in the success state.
9823  */
9824 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_ok(struct LDKRoute o);
9825
9826 /**
9827  * Creates a new CResult_RouteDecodeErrorZ in the error state.
9828  */
9829 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_err(struct LDKDecodeError e);
9830
9831 /**
9832  * Frees any resources used by the CResult_RouteDecodeErrorZ.
9833  */
9834 void CResult_RouteDecodeErrorZ_free(struct LDKCResult_RouteDecodeErrorZ _res);
9835
9836 /**
9837  * Creates a new CResult_RouteDecodeErrorZ which has the same data as `orig`
9838  * but with all dynamically-allocated buffers duplicated in new buffers.
9839  */
9840 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_clone(const struct LDKCResult_RouteDecodeErrorZ *NONNULL_PTR orig);
9841
9842 /**
9843  * Constructs a new COption_u64Z containing a u64
9844  */
9845 struct LDKCOption_u64Z COption_u64Z_some(uint64_t o);
9846
9847 /**
9848  * Constructs a new COption_u64Z containing nothing
9849  */
9850 struct LDKCOption_u64Z COption_u64Z_none(void);
9851
9852 /**
9853  * Frees any resources associated with the u64, if we are in the Some state
9854  */
9855 void COption_u64Z_free(struct LDKCOption_u64Z _res);
9856
9857 /**
9858  * Creates a new COption_u64Z which has the same data as `orig`
9859  * but with all dynamically-allocated buffers duplicated in new buffers.
9860  */
9861 struct LDKCOption_u64Z COption_u64Z_clone(const struct LDKCOption_u64Z *NONNULL_PTR orig);
9862
9863 /**
9864  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9865  */
9866 void CVec_ChannelDetailsZ_free(struct LDKCVec_ChannelDetailsZ _res);
9867
9868 /**
9869  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9870  */
9871 void CVec_RouteHintZ_free(struct LDKCVec_RouteHintZ _res);
9872
9873 /**
9874  * Creates a new CResult_RouteLightningErrorZ in the success state.
9875  */
9876 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_ok(struct LDKRoute o);
9877
9878 /**
9879  * Creates a new CResult_RouteLightningErrorZ in the error state.
9880  */
9881 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_err(struct LDKLightningError e);
9882
9883 /**
9884  * Frees any resources used by the CResult_RouteLightningErrorZ.
9885  */
9886 void CResult_RouteLightningErrorZ_free(struct LDKCResult_RouteLightningErrorZ _res);
9887
9888 /**
9889  * Creates a new CResult_RouteLightningErrorZ which has the same data as `orig`
9890  * but with all dynamically-allocated buffers duplicated in new buffers.
9891  */
9892 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_clone(const struct LDKCResult_RouteLightningErrorZ *NONNULL_PTR orig);
9893
9894 /**
9895  * Creates a new CResult_TxOutAccessErrorZ in the success state.
9896  */
9897 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_ok(struct LDKTxOut o);
9898
9899 /**
9900  * Creates a new CResult_TxOutAccessErrorZ in the error state.
9901  */
9902 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_err(enum LDKAccessError e);
9903
9904 /**
9905  * Frees any resources used by the CResult_TxOutAccessErrorZ.
9906  */
9907 void CResult_TxOutAccessErrorZ_free(struct LDKCResult_TxOutAccessErrorZ _res);
9908
9909 /**
9910  * Creates a new CResult_TxOutAccessErrorZ which has the same data as `orig`
9911  * but with all dynamically-allocated buffers duplicated in new buffers.
9912  */
9913 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_clone(const struct LDKCResult_TxOutAccessErrorZ *NONNULL_PTR orig);
9914
9915 /**
9916  * Creates a new tuple which has the same data as `orig`
9917  * but with all dynamically-allocated buffers duplicated in new buffers.
9918  */
9919 struct LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_clone(const struct LDKC2Tuple_usizeTransactionZ *NONNULL_PTR orig);
9920
9921 /**
9922  * Creates a new C2Tuple_usizeTransactionZ from the contained elements.
9923  */
9924 struct LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_new(uintptr_t a, struct LDKTransaction b);
9925
9926 /**
9927  * Frees any resources used by the C2Tuple_usizeTransactionZ.
9928  */
9929 void C2Tuple_usizeTransactionZ_free(struct LDKC2Tuple_usizeTransactionZ _res);
9930
9931 /**
9932  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9933  */
9934 void CVec_C2Tuple_usizeTransactionZZ_free(struct LDKCVec_C2Tuple_usizeTransactionZZ _res);
9935
9936 /**
9937  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9938  */
9939 void CVec_TxidZ_free(struct LDKCVec_TxidZ _res);
9940
9941 /**
9942  * Creates a new CResult_NoneChannelMonitorUpdateErrZ in the success state.
9943  */
9944 struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_ok(void);
9945
9946 /**
9947  * Creates a new CResult_NoneChannelMonitorUpdateErrZ in the error state.
9948  */
9949 struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_err(enum LDKChannelMonitorUpdateErr e);
9950
9951 /**
9952  * Frees any resources used by the CResult_NoneChannelMonitorUpdateErrZ.
9953  */
9954 void CResult_NoneChannelMonitorUpdateErrZ_free(struct LDKCResult_NoneChannelMonitorUpdateErrZ _res);
9955
9956 /**
9957  * Creates a new CResult_NoneChannelMonitorUpdateErrZ which has the same data as `orig`
9958  * but with all dynamically-allocated buffers duplicated in new buffers.
9959  */
9960 struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_clone(const struct LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR orig);
9961
9962 /**
9963  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9964  */
9965 void CVec_MonitorEventZ_free(struct LDKCVec_MonitorEventZ _res);
9966
9967 /**
9968  * Constructs a new COption_C2Tuple_usizeTransactionZZ containing a crate::c_types::derived::C2Tuple_usizeTransactionZ
9969  */
9970 struct LDKCOption_C2Tuple_usizeTransactionZZ COption_C2Tuple_usizeTransactionZZ_some(struct LDKC2Tuple_usizeTransactionZ o);
9971
9972 /**
9973  * Constructs a new COption_C2Tuple_usizeTransactionZZ containing nothing
9974  */
9975 struct LDKCOption_C2Tuple_usizeTransactionZZ COption_C2Tuple_usizeTransactionZZ_none(void);
9976
9977 /**
9978  * Frees any resources associated with the crate::c_types::derived::C2Tuple_usizeTransactionZ, if we are in the Some state
9979  */
9980 void COption_C2Tuple_usizeTransactionZZ_free(struct LDKCOption_C2Tuple_usizeTransactionZZ _res);
9981
9982 /**
9983  * Creates a new COption_C2Tuple_usizeTransactionZZ which has the same data as `orig`
9984  * but with all dynamically-allocated buffers duplicated in new buffers.
9985  */
9986 struct LDKCOption_C2Tuple_usizeTransactionZZ COption_C2Tuple_usizeTransactionZZ_clone(const struct LDKCOption_C2Tuple_usizeTransactionZZ *NONNULL_PTR orig);
9987
9988 /**
9989  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9990  */
9991 void CVec_SpendableOutputDescriptorZ_free(struct LDKCVec_SpendableOutputDescriptorZ _res);
9992
9993 /**
9994  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9995  */
9996 void CVec_MessageSendEventZ_free(struct LDKCVec_MessageSendEventZ _res);
9997
9998 /**
9999  * Creates a new CResult_InitFeaturesDecodeErrorZ in the success state.
10000  */
10001 struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_ok(struct LDKInitFeatures o);
10002
10003 /**
10004  * Creates a new CResult_InitFeaturesDecodeErrorZ in the error state.
10005  */
10006 struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
10007
10008 /**
10009  * Frees any resources used by the CResult_InitFeaturesDecodeErrorZ.
10010  */
10011 void CResult_InitFeaturesDecodeErrorZ_free(struct LDKCResult_InitFeaturesDecodeErrorZ _res);
10012
10013 /**
10014  * Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state.
10015  */
10016 struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_ok(struct LDKNodeFeatures o);
10017
10018 /**
10019  * Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state.
10020  */
10021 struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
10022
10023 /**
10024  * Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ.
10025  */
10026 void CResult_NodeFeaturesDecodeErrorZ_free(struct LDKCResult_NodeFeaturesDecodeErrorZ _res);
10027
10028 /**
10029  * Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state.
10030  */
10031 struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_ok(struct LDKChannelFeatures o);
10032
10033 /**
10034  * Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state.
10035  */
10036 struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
10037
10038 /**
10039  * Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ.
10040  */
10041 void CResult_ChannelFeaturesDecodeErrorZ_free(struct LDKCResult_ChannelFeaturesDecodeErrorZ _res);
10042
10043 /**
10044  * Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the success state.
10045  */
10046 struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_ok(struct LDKInvoiceFeatures o);
10047
10048 /**
10049  * Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the error state.
10050  */
10051 struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
10052
10053 /**
10054  * Frees any resources used by the CResult_InvoiceFeaturesDecodeErrorZ.
10055  */
10056 void CResult_InvoiceFeaturesDecodeErrorZ_free(struct LDKCResult_InvoiceFeaturesDecodeErrorZ _res);
10057
10058 /**
10059  * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the success state.
10060  */
10061 struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(struct LDKDelayedPaymentOutputDescriptor o);
10062
10063 /**
10064  * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the error state.
10065  */
10066 struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e);
10067
10068 /**
10069  * Frees any resources used by the CResult_DelayedPaymentOutputDescriptorDecodeErrorZ.
10070  */
10071 void CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res);
10072
10073 /**
10074  * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
10075  * but with all dynamically-allocated buffers duplicated in new buffers.
10076  */
10077 struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR orig);
10078
10079 /**
10080  * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the success state.
10081  */
10082 struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(struct LDKStaticPaymentOutputDescriptor o);
10083
10084 /**
10085  * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the error state.
10086  */
10087 struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e);
10088
10089 /**
10090  * Frees any resources used by the CResult_StaticPaymentOutputDescriptorDecodeErrorZ.
10091  */
10092 void CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res);
10093
10094 /**
10095  * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
10096  * but with all dynamically-allocated buffers duplicated in new buffers.
10097  */
10098 struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR orig);
10099
10100 /**
10101  * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state.
10102  */
10103 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_ok(struct LDKSpendableOutputDescriptor o);
10104
10105 /**
10106  * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state.
10107  */
10108 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e);
10109
10110 /**
10111  * Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ.
10112  */
10113 void CResult_SpendableOutputDescriptorDecodeErrorZ_free(struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res);
10114
10115 /**
10116  * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig`
10117  * but with all dynamically-allocated buffers duplicated in new buffers.
10118  */
10119 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR orig);
10120
10121 /**
10122  * Creates a new tuple which has the same data as `orig`
10123  * but with all dynamically-allocated buffers duplicated in new buffers.
10124  */
10125 struct LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_clone(const struct LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR orig);
10126
10127 /**
10128  * Creates a new C2Tuple_SignatureCVec_SignatureZZ from the contained elements.
10129  */
10130 struct LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_new(struct LDKSignature a, struct LDKCVec_SignatureZ b);
10131
10132 /**
10133  * Frees any resources used by the C2Tuple_SignatureCVec_SignatureZZ.
10134  */
10135 void C2Tuple_SignatureCVec_SignatureZZ_free(struct LDKC2Tuple_SignatureCVec_SignatureZZ _res);
10136
10137 /**
10138  * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the success state.
10139  */
10140 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(struct LDKC2Tuple_SignatureCVec_SignatureZZ o);
10141
10142 /**
10143  * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the error state.
10144  */
10145 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err(void);
10146
10147 /**
10148  * Frees any resources used by the CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ.
10149  */
10150 void CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res);
10151
10152 /**
10153  * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ which has the same data as `orig`
10154  * but with all dynamically-allocated buffers duplicated in new buffers.
10155  */
10156 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(const struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR orig);
10157
10158 /**
10159  * Creates a new CResult_SignatureNoneZ in the success state.
10160  */
10161 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_ok(struct LDKSignature o);
10162
10163 /**
10164  * Creates a new CResult_SignatureNoneZ in the error state.
10165  */
10166 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_err(void);
10167
10168 /**
10169  * Frees any resources used by the CResult_SignatureNoneZ.
10170  */
10171 void CResult_SignatureNoneZ_free(struct LDKCResult_SignatureNoneZ _res);
10172
10173 /**
10174  * Creates a new CResult_SignatureNoneZ which has the same data as `orig`
10175  * but with all dynamically-allocated buffers duplicated in new buffers.
10176  */
10177 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_clone(const struct LDKCResult_SignatureNoneZ *NONNULL_PTR orig);
10178
10179 /**
10180  * Creates a new CResult_SignDecodeErrorZ in the success state.
10181  */
10182 struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_ok(struct LDKSign o);
10183
10184 /**
10185  * Creates a new CResult_SignDecodeErrorZ in the error state.
10186  */
10187 struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_err(struct LDKDecodeError e);
10188
10189 /**
10190  * Frees any resources used by the CResult_SignDecodeErrorZ.
10191  */
10192 void CResult_SignDecodeErrorZ_free(struct LDKCResult_SignDecodeErrorZ _res);
10193
10194 /**
10195  * Creates a new CResult_SignDecodeErrorZ which has the same data as `orig`
10196  * but with all dynamically-allocated buffers duplicated in new buffers.
10197  */
10198 struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_clone(const struct LDKCResult_SignDecodeErrorZ *NONNULL_PTR orig);
10199
10200 /**
10201  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10202  */
10203 void CVec_u8Z_free(struct LDKCVec_u8Z _res);
10204
10205 /**
10206  * Creates a new CResult_RecoverableSignatureNoneZ in the success state.
10207  */
10208 struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_ok(struct LDKRecoverableSignature o);
10209
10210 /**
10211  * Creates a new CResult_RecoverableSignatureNoneZ in the error state.
10212  */
10213 struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_err(void);
10214
10215 /**
10216  * Frees any resources used by the CResult_RecoverableSignatureNoneZ.
10217  */
10218 void CResult_RecoverableSignatureNoneZ_free(struct LDKCResult_RecoverableSignatureNoneZ _res);
10219
10220 /**
10221  * Creates a new CResult_RecoverableSignatureNoneZ which has the same data as `orig`
10222  * but with all dynamically-allocated buffers duplicated in new buffers.
10223  */
10224 struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_clone(const struct LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR orig);
10225
10226 /**
10227  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10228  */
10229 void CVec_CVec_u8ZZ_free(struct LDKCVec_CVec_u8ZZ _res);
10230
10231 /**
10232  * Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state.
10233  */
10234 struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_ok(struct LDKCVec_CVec_u8ZZ o);
10235
10236 /**
10237  * Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state.
10238  */
10239 struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_err(void);
10240
10241 /**
10242  * Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ.
10243  */
10244 void CResult_CVec_CVec_u8ZZNoneZ_free(struct LDKCResult_CVec_CVec_u8ZZNoneZ _res);
10245
10246 /**
10247  * Creates a new CResult_CVec_CVec_u8ZZNoneZ which has the same data as `orig`
10248  * but with all dynamically-allocated buffers duplicated in new buffers.
10249  */
10250 struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_clone(const struct LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR orig);
10251
10252 /**
10253  * Creates a new CResult_InMemorySignerDecodeErrorZ in the success state.
10254  */
10255 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_ok(struct LDKInMemorySigner o);
10256
10257 /**
10258  * Creates a new CResult_InMemorySignerDecodeErrorZ in the error state.
10259  */
10260 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_err(struct LDKDecodeError e);
10261
10262 /**
10263  * Frees any resources used by the CResult_InMemorySignerDecodeErrorZ.
10264  */
10265 void CResult_InMemorySignerDecodeErrorZ_free(struct LDKCResult_InMemorySignerDecodeErrorZ _res);
10266
10267 /**
10268  * Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig`
10269  * but with all dynamically-allocated buffers duplicated in new buffers.
10270  */
10271 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_clone(const struct LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR orig);
10272
10273 /**
10274  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10275  */
10276 void CVec_TxOutZ_free(struct LDKCVec_TxOutZ _res);
10277
10278 /**
10279  * Creates a new CResult_TransactionNoneZ in the success state.
10280  */
10281 struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_ok(struct LDKTransaction o);
10282
10283 /**
10284  * Creates a new CResult_TransactionNoneZ in the error state.
10285  */
10286 struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_err(void);
10287
10288 /**
10289  * Frees any resources used by the CResult_TransactionNoneZ.
10290  */
10291 void CResult_TransactionNoneZ_free(struct LDKCResult_TransactionNoneZ _res);
10292
10293 /**
10294  * Creates a new CResult_TransactionNoneZ which has the same data as `orig`
10295  * but with all dynamically-allocated buffers duplicated in new buffers.
10296  */
10297 struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_clone(const struct LDKCResult_TransactionNoneZ *NONNULL_PTR orig);
10298
10299 /**
10300  * Creates a new C2Tuple_BlockHashChannelMonitorZ from the contained elements.
10301  */
10302 struct LDKC2Tuple_BlockHashChannelMonitorZ C2Tuple_BlockHashChannelMonitorZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelMonitor b);
10303
10304 /**
10305  * Frees any resources used by the C2Tuple_BlockHashChannelMonitorZ.
10306  */
10307 void C2Tuple_BlockHashChannelMonitorZ_free(struct LDKC2Tuple_BlockHashChannelMonitorZ _res);
10308
10309 /**
10310  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10311  */
10312 void CVec_C2Tuple_BlockHashChannelMonitorZZ_free(struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ _res);
10313
10314 /**
10315  * Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the success state.
10316  */
10317 struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ o);
10318
10319 /**
10320  * Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the error state.
10321  */
10322 struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(enum LDKIOError e);
10323
10324 /**
10325  * Frees any resources used by the CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.
10326  */
10327 void CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ _res);
10328
10329 /**
10330  * Constructs a new COption_u16Z containing a u16
10331  */
10332 struct LDKCOption_u16Z COption_u16Z_some(uint16_t o);
10333
10334 /**
10335  * Constructs a new COption_u16Z containing nothing
10336  */
10337 struct LDKCOption_u16Z COption_u16Z_none(void);
10338
10339 /**
10340  * Frees any resources associated with the u16, if we are in the Some state
10341  */
10342 void COption_u16Z_free(struct LDKCOption_u16Z _res);
10343
10344 /**
10345  * Creates a new COption_u16Z which has the same data as `orig`
10346  * but with all dynamically-allocated buffers duplicated in new buffers.
10347  */
10348 struct LDKCOption_u16Z COption_u16Z_clone(const struct LDKCOption_u16Z *NONNULL_PTR orig);
10349
10350 /**
10351  * Creates a new CResult_NoneAPIErrorZ in the success state.
10352  */
10353 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_ok(void);
10354
10355 /**
10356  * Creates a new CResult_NoneAPIErrorZ in the error state.
10357  */
10358 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_err(struct LDKAPIError e);
10359
10360 /**
10361  * Frees any resources used by the CResult_NoneAPIErrorZ.
10362  */
10363 void CResult_NoneAPIErrorZ_free(struct LDKCResult_NoneAPIErrorZ _res);
10364
10365 /**
10366  * Creates a new CResult_NoneAPIErrorZ which has the same data as `orig`
10367  * but with all dynamically-allocated buffers duplicated in new buffers.
10368  */
10369 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_clone(const struct LDKCResult_NoneAPIErrorZ *NONNULL_PTR orig);
10370
10371 /**
10372  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10373  */
10374 void CVec_CResult_NoneAPIErrorZZ_free(struct LDKCVec_CResult_NoneAPIErrorZZ _res);
10375
10376 /**
10377  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10378  */
10379 void CVec_APIErrorZ_free(struct LDKCVec_APIErrorZ _res);
10380
10381 /**
10382  * Creates a new CResult_NonePaymentSendFailureZ in the success state.
10383  */
10384 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_ok(void);
10385
10386 /**
10387  * Creates a new CResult_NonePaymentSendFailureZ in the error state.
10388  */
10389 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_err(struct LDKPaymentSendFailure e);
10390
10391 /**
10392  * Frees any resources used by the CResult_NonePaymentSendFailureZ.
10393  */
10394 void CResult_NonePaymentSendFailureZ_free(struct LDKCResult_NonePaymentSendFailureZ _res);
10395
10396 /**
10397  * Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
10398  * but with all dynamically-allocated buffers duplicated in new buffers.
10399  */
10400 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_clone(const struct LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR orig);
10401
10402 /**
10403  * Creates a new CResult_PaymentHashPaymentSendFailureZ in the success state.
10404  */
10405 struct LDKCResult_PaymentHashPaymentSendFailureZ CResult_PaymentHashPaymentSendFailureZ_ok(struct LDKThirtyTwoBytes o);
10406
10407 /**
10408  * Creates a new CResult_PaymentHashPaymentSendFailureZ in the error state.
10409  */
10410 struct LDKCResult_PaymentHashPaymentSendFailureZ CResult_PaymentHashPaymentSendFailureZ_err(struct LDKPaymentSendFailure e);
10411
10412 /**
10413  * Frees any resources used by the CResult_PaymentHashPaymentSendFailureZ.
10414  */
10415 void CResult_PaymentHashPaymentSendFailureZ_free(struct LDKCResult_PaymentHashPaymentSendFailureZ _res);
10416
10417 /**
10418  * Creates a new CResult_PaymentHashPaymentSendFailureZ which has the same data as `orig`
10419  * but with all dynamically-allocated buffers duplicated in new buffers.
10420  */
10421 struct LDKCResult_PaymentHashPaymentSendFailureZ CResult_PaymentHashPaymentSendFailureZ_clone(const struct LDKCResult_PaymentHashPaymentSendFailureZ *NONNULL_PTR orig);
10422
10423 /**
10424  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10425  */
10426 void CVec_NetAddressZ_free(struct LDKCVec_NetAddressZ _res);
10427
10428 /**
10429  * Creates a new tuple which has the same data as `orig`
10430  * but with all dynamically-allocated buffers duplicated in new buffers.
10431  */
10432 struct LDKC2Tuple_PaymentHashPaymentSecretZ C2Tuple_PaymentHashPaymentSecretZ_clone(const struct LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR orig);
10433
10434 /**
10435  * Creates a new C2Tuple_PaymentHashPaymentSecretZ from the contained elements.
10436  */
10437 struct LDKC2Tuple_PaymentHashPaymentSecretZ C2Tuple_PaymentHashPaymentSecretZ_new(struct LDKThirtyTwoBytes a, struct LDKThirtyTwoBytes b);
10438
10439 /**
10440  * Frees any resources used by the C2Tuple_PaymentHashPaymentSecretZ.
10441  */
10442 void C2Tuple_PaymentHashPaymentSecretZ_free(struct LDKC2Tuple_PaymentHashPaymentSecretZ _res);
10443
10444 /**
10445  * Creates a new CResult_PaymentSecretAPIErrorZ in the success state.
10446  */
10447 struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_ok(struct LDKThirtyTwoBytes o);
10448
10449 /**
10450  * Creates a new CResult_PaymentSecretAPIErrorZ in the error state.
10451  */
10452 struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_err(struct LDKAPIError e);
10453
10454 /**
10455  * Frees any resources used by the CResult_PaymentSecretAPIErrorZ.
10456  */
10457 void CResult_PaymentSecretAPIErrorZ_free(struct LDKCResult_PaymentSecretAPIErrorZ _res);
10458
10459 /**
10460  * Creates a new CResult_PaymentSecretAPIErrorZ which has the same data as `orig`
10461  * but with all dynamically-allocated buffers duplicated in new buffers.
10462  */
10463 struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_clone(const struct LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR orig);
10464
10465 /**
10466  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10467  */
10468 void CVec_ChannelMonitorZ_free(struct LDKCVec_ChannelMonitorZ _res);
10469
10470 /**
10471  * Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements.
10472  */
10473 struct LDKC2Tuple_BlockHashChannelManagerZ C2Tuple_BlockHashChannelManagerZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelManager b);
10474
10475 /**
10476  * Frees any resources used by the C2Tuple_BlockHashChannelManagerZ.
10477  */
10478 void C2Tuple_BlockHashChannelManagerZ_free(struct LDKC2Tuple_BlockHashChannelManagerZ _res);
10479
10480 /**
10481  * Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state.
10482  */
10483 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelManagerZ o);
10484
10485 /**
10486  * Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state.
10487  */
10488 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(struct LDKDecodeError e);
10489
10490 /**
10491  * Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.
10492  */
10493 void CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res);
10494
10495 /**
10496  * Creates a new CResult_ChannelConfigDecodeErrorZ in the success state.
10497  */
10498 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_ok(struct LDKChannelConfig o);
10499
10500 /**
10501  * Creates a new CResult_ChannelConfigDecodeErrorZ in the error state.
10502  */
10503 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_err(struct LDKDecodeError e);
10504
10505 /**
10506  * Frees any resources used by the CResult_ChannelConfigDecodeErrorZ.
10507  */
10508 void CResult_ChannelConfigDecodeErrorZ_free(struct LDKCResult_ChannelConfigDecodeErrorZ _res);
10509
10510 /**
10511  * Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig`
10512  * but with all dynamically-allocated buffers duplicated in new buffers.
10513  */
10514 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_clone(const struct LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR orig);
10515
10516 /**
10517  * Creates a new CResult_OutPointDecodeErrorZ in the success state.
10518  */
10519 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_ok(struct LDKOutPoint o);
10520
10521 /**
10522  * Creates a new CResult_OutPointDecodeErrorZ in the error state.
10523  */
10524 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_err(struct LDKDecodeError e);
10525
10526 /**
10527  * Frees any resources used by the CResult_OutPointDecodeErrorZ.
10528  */
10529 void CResult_OutPointDecodeErrorZ_free(struct LDKCResult_OutPointDecodeErrorZ _res);
10530
10531 /**
10532  * Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig`
10533  * but with all dynamically-allocated buffers duplicated in new buffers.
10534  */
10535 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_clone(const struct LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR orig);
10536
10537 /**
10538  * Creates a new CResult_SiPrefixNoneZ in the success state.
10539  */
10540 struct LDKCResult_SiPrefixNoneZ CResult_SiPrefixNoneZ_ok(enum LDKSiPrefix o);
10541
10542 /**
10543  * Creates a new CResult_SiPrefixNoneZ in the error state.
10544  */
10545 struct LDKCResult_SiPrefixNoneZ CResult_SiPrefixNoneZ_err(void);
10546
10547 /**
10548  * Frees any resources used by the CResult_SiPrefixNoneZ.
10549  */
10550 void CResult_SiPrefixNoneZ_free(struct LDKCResult_SiPrefixNoneZ _res);
10551
10552 /**
10553  * Creates a new CResult_SiPrefixNoneZ which has the same data as `orig`
10554  * but with all dynamically-allocated buffers duplicated in new buffers.
10555  */
10556 struct LDKCResult_SiPrefixNoneZ CResult_SiPrefixNoneZ_clone(const struct LDKCResult_SiPrefixNoneZ *NONNULL_PTR orig);
10557
10558 /**
10559  * Creates a new CResult_InvoiceNoneZ in the success state.
10560  */
10561 struct LDKCResult_InvoiceNoneZ CResult_InvoiceNoneZ_ok(struct LDKInvoice o);
10562
10563 /**
10564  * Creates a new CResult_InvoiceNoneZ in the error state.
10565  */
10566 struct LDKCResult_InvoiceNoneZ CResult_InvoiceNoneZ_err(void);
10567
10568 /**
10569  * Frees any resources used by the CResult_InvoiceNoneZ.
10570  */
10571 void CResult_InvoiceNoneZ_free(struct LDKCResult_InvoiceNoneZ _res);
10572
10573 /**
10574  * Creates a new CResult_InvoiceNoneZ which has the same data as `orig`
10575  * but with all dynamically-allocated buffers duplicated in new buffers.
10576  */
10577 struct LDKCResult_InvoiceNoneZ CResult_InvoiceNoneZ_clone(const struct LDKCResult_InvoiceNoneZ *NONNULL_PTR orig);
10578
10579 /**
10580  * Creates a new CResult_SignedRawInvoiceNoneZ in the success state.
10581  */
10582 struct LDKCResult_SignedRawInvoiceNoneZ CResult_SignedRawInvoiceNoneZ_ok(struct LDKSignedRawInvoice o);
10583
10584 /**
10585  * Creates a new CResult_SignedRawInvoiceNoneZ in the error state.
10586  */
10587 struct LDKCResult_SignedRawInvoiceNoneZ CResult_SignedRawInvoiceNoneZ_err(void);
10588
10589 /**
10590  * Frees any resources used by the CResult_SignedRawInvoiceNoneZ.
10591  */
10592 void CResult_SignedRawInvoiceNoneZ_free(struct LDKCResult_SignedRawInvoiceNoneZ _res);
10593
10594 /**
10595  * Creates a new CResult_SignedRawInvoiceNoneZ which has the same data as `orig`
10596  * but with all dynamically-allocated buffers duplicated in new buffers.
10597  */
10598 struct LDKCResult_SignedRawInvoiceNoneZ CResult_SignedRawInvoiceNoneZ_clone(const struct LDKCResult_SignedRawInvoiceNoneZ *NONNULL_PTR orig);
10599
10600 /**
10601  * Creates a new tuple which has the same data as `orig`
10602  * but with all dynamically-allocated buffers duplicated in new buffers.
10603  */
10604 struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(const struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR orig);
10605
10606 /**
10607  * Creates a new C3Tuple_RawInvoice_u832InvoiceSignatureZ from the contained elements.
10608  */
10609 struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(struct LDKRawInvoice a, struct LDKThirtyTwoBytes b, struct LDKInvoiceSignature c);
10610
10611 /**
10612  * Frees any resources used by the C3Tuple_RawInvoice_u832InvoiceSignatureZ.
10613  */
10614 void C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ _res);
10615
10616 /**
10617  * Creates a new CResult_PayeePubKeyErrorZ in the success state.
10618  */
10619 struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_ok(struct LDKPayeePubKey o);
10620
10621 /**
10622  * Creates a new CResult_PayeePubKeyErrorZ in the error state.
10623  */
10624 struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_err(enum LDKSecp256k1Error e);
10625
10626 /**
10627  * Frees any resources used by the CResult_PayeePubKeyErrorZ.
10628  */
10629 void CResult_PayeePubKeyErrorZ_free(struct LDKCResult_PayeePubKeyErrorZ _res);
10630
10631 /**
10632  * Creates a new CResult_PayeePubKeyErrorZ which has the same data as `orig`
10633  * but with all dynamically-allocated buffers duplicated in new buffers.
10634  */
10635 struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_clone(const struct LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR orig);
10636
10637 /**
10638  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10639  */
10640 void CVec_PrivateRouteZ_free(struct LDKCVec_PrivateRouteZ _res);
10641
10642 /**
10643  * Creates a new CResult_PositiveTimestampCreationErrorZ in the success state.
10644  */
10645 struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_ok(struct LDKPositiveTimestamp o);
10646
10647 /**
10648  * Creates a new CResult_PositiveTimestampCreationErrorZ in the error state.
10649  */
10650 struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_err(enum LDKCreationError e);
10651
10652 /**
10653  * Frees any resources used by the CResult_PositiveTimestampCreationErrorZ.
10654  */
10655 void CResult_PositiveTimestampCreationErrorZ_free(struct LDKCResult_PositiveTimestampCreationErrorZ _res);
10656
10657 /**
10658  * Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig`
10659  * but with all dynamically-allocated buffers duplicated in new buffers.
10660  */
10661 struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_clone(const struct LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR orig);
10662
10663 /**
10664  * Creates a new CResult_NoneSemanticErrorZ in the success state.
10665  */
10666 struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_ok(void);
10667
10668 /**
10669  * Creates a new CResult_NoneSemanticErrorZ in the error state.
10670  */
10671 struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_err(enum LDKSemanticError e);
10672
10673 /**
10674  * Frees any resources used by the CResult_NoneSemanticErrorZ.
10675  */
10676 void CResult_NoneSemanticErrorZ_free(struct LDKCResult_NoneSemanticErrorZ _res);
10677
10678 /**
10679  * Creates a new CResult_NoneSemanticErrorZ which has the same data as `orig`
10680  * but with all dynamically-allocated buffers duplicated in new buffers.
10681  */
10682 struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_clone(const struct LDKCResult_NoneSemanticErrorZ *NONNULL_PTR orig);
10683
10684 /**
10685  * Creates a new CResult_InvoiceSemanticErrorZ in the success state.
10686  */
10687 struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_ok(struct LDKInvoice o);
10688
10689 /**
10690  * Creates a new CResult_InvoiceSemanticErrorZ in the error state.
10691  */
10692 struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_err(enum LDKSemanticError e);
10693
10694 /**
10695  * Frees any resources used by the CResult_InvoiceSemanticErrorZ.
10696  */
10697 void CResult_InvoiceSemanticErrorZ_free(struct LDKCResult_InvoiceSemanticErrorZ _res);
10698
10699 /**
10700  * Creates a new CResult_InvoiceSemanticErrorZ which has the same data as `orig`
10701  * but with all dynamically-allocated buffers duplicated in new buffers.
10702  */
10703 struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_clone(const struct LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR orig);
10704
10705 /**
10706  * Creates a new CResult_DescriptionCreationErrorZ in the success state.
10707  */
10708 struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_ok(struct LDKDescription o);
10709
10710 /**
10711  * Creates a new CResult_DescriptionCreationErrorZ in the error state.
10712  */
10713 struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_err(enum LDKCreationError e);
10714
10715 /**
10716  * Frees any resources used by the CResult_DescriptionCreationErrorZ.
10717  */
10718 void CResult_DescriptionCreationErrorZ_free(struct LDKCResult_DescriptionCreationErrorZ _res);
10719
10720 /**
10721  * Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig`
10722  * but with all dynamically-allocated buffers duplicated in new buffers.
10723  */
10724 struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_clone(const struct LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR orig);
10725
10726 /**
10727  * Creates a new CResult_ExpiryTimeCreationErrorZ in the success state.
10728  */
10729 struct LDKCResult_ExpiryTimeCreationErrorZ CResult_ExpiryTimeCreationErrorZ_ok(struct LDKExpiryTime o);
10730
10731 /**
10732  * Creates a new CResult_ExpiryTimeCreationErrorZ in the error state.
10733  */
10734 struct LDKCResult_ExpiryTimeCreationErrorZ CResult_ExpiryTimeCreationErrorZ_err(enum LDKCreationError e);
10735
10736 /**
10737  * Frees any resources used by the CResult_ExpiryTimeCreationErrorZ.
10738  */
10739 void CResult_ExpiryTimeCreationErrorZ_free(struct LDKCResult_ExpiryTimeCreationErrorZ _res);
10740
10741 /**
10742  * Creates a new CResult_ExpiryTimeCreationErrorZ which has the same data as `orig`
10743  * but with all dynamically-allocated buffers duplicated in new buffers.
10744  */
10745 struct LDKCResult_ExpiryTimeCreationErrorZ CResult_ExpiryTimeCreationErrorZ_clone(const struct LDKCResult_ExpiryTimeCreationErrorZ *NONNULL_PTR orig);
10746
10747 /**
10748  * Creates a new CResult_PrivateRouteCreationErrorZ in the success state.
10749  */
10750 struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_ok(struct LDKPrivateRoute o);
10751
10752 /**
10753  * Creates a new CResult_PrivateRouteCreationErrorZ in the error state.
10754  */
10755 struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_err(enum LDKCreationError e);
10756
10757 /**
10758  * Frees any resources used by the CResult_PrivateRouteCreationErrorZ.
10759  */
10760 void CResult_PrivateRouteCreationErrorZ_free(struct LDKCResult_PrivateRouteCreationErrorZ _res);
10761
10762 /**
10763  * Creates a new CResult_PrivateRouteCreationErrorZ which has the same data as `orig`
10764  * but with all dynamically-allocated buffers duplicated in new buffers.
10765  */
10766 struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_clone(const struct LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR orig);
10767
10768 /**
10769  * Creates a new CResult_StringErrorZ in the success state.
10770  */
10771 struct LDKCResult_StringErrorZ CResult_StringErrorZ_ok(struct LDKStr o);
10772
10773 /**
10774  * Creates a new CResult_StringErrorZ in the error state.
10775  */
10776 struct LDKCResult_StringErrorZ CResult_StringErrorZ_err(enum LDKSecp256k1Error e);
10777
10778 /**
10779  * Frees any resources used by the CResult_StringErrorZ.
10780  */
10781 void CResult_StringErrorZ_free(struct LDKCResult_StringErrorZ _res);
10782
10783 /**
10784  * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
10785  */
10786 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_ok(struct LDKChannelMonitorUpdate o);
10787
10788 /**
10789  * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
10790  */
10791 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_err(struct LDKDecodeError e);
10792
10793 /**
10794  * Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
10795  */
10796 void CResult_ChannelMonitorUpdateDecodeErrorZ_free(struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res);
10797
10798 /**
10799  * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
10800  * but with all dynamically-allocated buffers duplicated in new buffers.
10801  */
10802 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_clone(const struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR orig);
10803
10804 /**
10805  * Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
10806  */
10807 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_ok(struct LDKHTLCUpdate o);
10808
10809 /**
10810  * Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
10811  */
10812 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_err(struct LDKDecodeError e);
10813
10814 /**
10815  * Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
10816  */
10817 void CResult_HTLCUpdateDecodeErrorZ_free(struct LDKCResult_HTLCUpdateDecodeErrorZ _res);
10818
10819 /**
10820  * Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
10821  * but with all dynamically-allocated buffers duplicated in new buffers.
10822  */
10823 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_clone(const struct LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR orig);
10824
10825 /**
10826  * Creates a new CResult_NoneMonitorUpdateErrorZ in the success state.
10827  */
10828 struct LDKCResult_NoneMonitorUpdateErrorZ CResult_NoneMonitorUpdateErrorZ_ok(void);
10829
10830 /**
10831  * Creates a new CResult_NoneMonitorUpdateErrorZ in the error state.
10832  */
10833 struct LDKCResult_NoneMonitorUpdateErrorZ CResult_NoneMonitorUpdateErrorZ_err(struct LDKMonitorUpdateError e);
10834
10835 /**
10836  * Frees any resources used by the CResult_NoneMonitorUpdateErrorZ.
10837  */
10838 void CResult_NoneMonitorUpdateErrorZ_free(struct LDKCResult_NoneMonitorUpdateErrorZ _res);
10839
10840 /**
10841  * Creates a new CResult_NoneMonitorUpdateErrorZ which has the same data as `orig`
10842  * but with all dynamically-allocated buffers duplicated in new buffers.
10843  */
10844 struct LDKCResult_NoneMonitorUpdateErrorZ CResult_NoneMonitorUpdateErrorZ_clone(const struct LDKCResult_NoneMonitorUpdateErrorZ *NONNULL_PTR orig);
10845
10846 /**
10847  * Creates a new tuple which has the same data as `orig`
10848  * but with all dynamically-allocated buffers duplicated in new buffers.
10849  */
10850 struct LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_clone(const struct LDKC2Tuple_OutPointScriptZ *NONNULL_PTR orig);
10851
10852 /**
10853  * Creates a new C2Tuple_OutPointScriptZ from the contained elements.
10854  */
10855 struct LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_new(struct LDKOutPoint a, struct LDKCVec_u8Z b);
10856
10857 /**
10858  * Frees any resources used by the C2Tuple_OutPointScriptZ.
10859  */
10860 void C2Tuple_OutPointScriptZ_free(struct LDKC2Tuple_OutPointScriptZ _res);
10861
10862 /**
10863  * Creates a new tuple which has the same data as `orig`
10864  * but with all dynamically-allocated buffers duplicated in new buffers.
10865  */
10866 struct LDKC2Tuple_u32ScriptZ C2Tuple_u32ScriptZ_clone(const struct LDKC2Tuple_u32ScriptZ *NONNULL_PTR orig);
10867
10868 /**
10869  * Creates a new C2Tuple_u32ScriptZ from the contained elements.
10870  */
10871 struct LDKC2Tuple_u32ScriptZ C2Tuple_u32ScriptZ_new(uint32_t a, struct LDKCVec_u8Z b);
10872
10873 /**
10874  * Frees any resources used by the C2Tuple_u32ScriptZ.
10875  */
10876 void C2Tuple_u32ScriptZ_free(struct LDKC2Tuple_u32ScriptZ _res);
10877
10878 /**
10879  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10880  */
10881 void CVec_C2Tuple_u32ScriptZZ_free(struct LDKCVec_C2Tuple_u32ScriptZZ _res);
10882
10883 /**
10884  * Creates a new tuple which has the same data as `orig`
10885  * but with all dynamically-allocated buffers duplicated in new buffers.
10886  */
10887 struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(const struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR orig);
10888
10889 /**
10890  * Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements.
10891  */
10892 struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32ScriptZZ b);
10893
10894 /**
10895  * Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ.
10896  */
10897 void C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res);
10898
10899 /**
10900  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10901  */
10902 void CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res);
10903
10904 /**
10905  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10906  */
10907 void CVec_EventZ_free(struct LDKCVec_EventZ _res);
10908
10909 /**
10910  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10911  */
10912 void CVec_TransactionZ_free(struct LDKCVec_TransactionZ _res);
10913
10914 /**
10915  * Creates a new tuple which has the same data as `orig`
10916  * but with all dynamically-allocated buffers duplicated in new buffers.
10917  */
10918 struct LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_clone(const struct LDKC2Tuple_u32TxOutZ *NONNULL_PTR orig);
10919
10920 /**
10921  * Creates a new C2Tuple_u32TxOutZ from the contained elements.
10922  */
10923 struct LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_new(uint32_t a, struct LDKTxOut b);
10924
10925 /**
10926  * Frees any resources used by the C2Tuple_u32TxOutZ.
10927  */
10928 void C2Tuple_u32TxOutZ_free(struct LDKC2Tuple_u32TxOutZ _res);
10929
10930 /**
10931  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10932  */
10933 void CVec_C2Tuple_u32TxOutZZ_free(struct LDKCVec_C2Tuple_u32TxOutZZ _res);
10934
10935 /**
10936  * Creates a new tuple which has the same data as `orig`
10937  * but with all dynamically-allocated buffers duplicated in new buffers.
10938  */
10939 struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(const struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR orig);
10940
10941 /**
10942  * Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements.
10943  */
10944 struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32TxOutZZ b);
10945
10946 /**
10947  * Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ.
10948  */
10949 void C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res);
10950
10951 /**
10952  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10953  */
10954 void CVec_TransactionOutputsZ_free(struct LDKCVec_TransactionOutputsZ _res);
10955
10956 /**
10957  * Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state.
10958  */
10959 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelMonitorZ o);
10960
10961 /**
10962  * Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state.
10963  */
10964 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(struct LDKDecodeError e);
10965
10966 /**
10967  * Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.
10968  */
10969 void CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res);
10970
10971 /**
10972  * Creates a new CResult_boolLightningErrorZ in the success state.
10973  */
10974 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_ok(bool o);
10975
10976 /**
10977  * Creates a new CResult_boolLightningErrorZ in the error state.
10978  */
10979 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_err(struct LDKLightningError e);
10980
10981 /**
10982  * Frees any resources used by the CResult_boolLightningErrorZ.
10983  */
10984 void CResult_boolLightningErrorZ_free(struct LDKCResult_boolLightningErrorZ _res);
10985
10986 /**
10987  * Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
10988  * but with all dynamically-allocated buffers duplicated in new buffers.
10989  */
10990 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_clone(const struct LDKCResult_boolLightningErrorZ *NONNULL_PTR orig);
10991
10992 /**
10993  * Creates a new tuple which has the same data as `orig`
10994  * but with all dynamically-allocated buffers duplicated in new buffers.
10995  */
10996 struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(const struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR orig);
10997
10998 /**
10999  * Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
11000  */
11001 struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(struct LDKChannelAnnouncement a, struct LDKChannelUpdate b, struct LDKChannelUpdate c);
11002
11003 /**
11004  * Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
11005  */
11006 void C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res);
11007
11008 /**
11009  * Frees the buffer pointed to by `data` if `datalen` is non-0.
11010  */
11011 void CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res);
11012
11013 /**
11014  * Frees the buffer pointed to by `data` if `datalen` is non-0.
11015  */
11016 void CVec_NodeAnnouncementZ_free(struct LDKCVec_NodeAnnouncementZ _res);
11017
11018 /**
11019  * Creates a new CResult_NoneLightningErrorZ in the success state.
11020  */
11021 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_ok(void);
11022
11023 /**
11024  * Creates a new CResult_NoneLightningErrorZ in the error state.
11025  */
11026 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_err(struct LDKLightningError e);
11027
11028 /**
11029  * Frees any resources used by the CResult_NoneLightningErrorZ.
11030  */
11031 void CResult_NoneLightningErrorZ_free(struct LDKCResult_NoneLightningErrorZ _res);
11032
11033 /**
11034  * Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
11035  * but with all dynamically-allocated buffers duplicated in new buffers.
11036  */
11037 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_clone(const struct LDKCResult_NoneLightningErrorZ *NONNULL_PTR orig);
11038
11039 /**
11040  * Frees the buffer pointed to by `data` if `datalen` is non-0.
11041  */
11042 void CVec_PublicKeyZ_free(struct LDKCVec_PublicKeyZ _res);
11043
11044 /**
11045  * Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
11046  */
11047 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_ok(struct LDKCVec_u8Z o);
11048
11049 /**
11050  * Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
11051  */
11052 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_err(struct LDKPeerHandleError e);
11053
11054 /**
11055  * Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
11056  */
11057 void CResult_CVec_u8ZPeerHandleErrorZ_free(struct LDKCResult_CVec_u8ZPeerHandleErrorZ _res);
11058
11059 /**
11060  * Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
11061  * but with all dynamically-allocated buffers duplicated in new buffers.
11062  */
11063 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_clone(const struct LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR orig);
11064
11065 /**
11066  * Creates a new CResult_NonePeerHandleErrorZ in the success state.
11067  */
11068 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_ok(void);
11069
11070 /**
11071  * Creates a new CResult_NonePeerHandleErrorZ in the error state.
11072  */
11073 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_err(struct LDKPeerHandleError e);
11074
11075 /**
11076  * Frees any resources used by the CResult_NonePeerHandleErrorZ.
11077  */
11078 void CResult_NonePeerHandleErrorZ_free(struct LDKCResult_NonePeerHandleErrorZ _res);
11079
11080 /**
11081  * Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
11082  * but with all dynamically-allocated buffers duplicated in new buffers.
11083  */
11084 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_clone(const struct LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR orig);
11085
11086 /**
11087  * Creates a new CResult_boolPeerHandleErrorZ in the success state.
11088  */
11089 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_ok(bool o);
11090
11091 /**
11092  * Creates a new CResult_boolPeerHandleErrorZ in the error state.
11093  */
11094 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_err(struct LDKPeerHandleError e);
11095
11096 /**
11097  * Frees any resources used by the CResult_boolPeerHandleErrorZ.
11098  */
11099 void CResult_boolPeerHandleErrorZ_free(struct LDKCResult_boolPeerHandleErrorZ _res);
11100
11101 /**
11102  * Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
11103  * but with all dynamically-allocated buffers duplicated in new buffers.
11104  */
11105 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_clone(const struct LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR orig);
11106
11107 /**
11108  * Creates a new CResult_DirectionalChannelInfoDecodeErrorZ in the success state.
11109  */
11110 struct LDKCResult_DirectionalChannelInfoDecodeErrorZ CResult_DirectionalChannelInfoDecodeErrorZ_ok(struct LDKDirectionalChannelInfo o);
11111
11112 /**
11113  * Creates a new CResult_DirectionalChannelInfoDecodeErrorZ in the error state.
11114  */
11115 struct LDKCResult_DirectionalChannelInfoDecodeErrorZ CResult_DirectionalChannelInfoDecodeErrorZ_err(struct LDKDecodeError e);
11116
11117 /**
11118  * Frees any resources used by the CResult_DirectionalChannelInfoDecodeErrorZ.
11119  */
11120 void CResult_DirectionalChannelInfoDecodeErrorZ_free(struct LDKCResult_DirectionalChannelInfoDecodeErrorZ _res);
11121
11122 /**
11123  * Creates a new CResult_DirectionalChannelInfoDecodeErrorZ which has the same data as `orig`
11124  * but with all dynamically-allocated buffers duplicated in new buffers.
11125  */
11126 struct LDKCResult_DirectionalChannelInfoDecodeErrorZ CResult_DirectionalChannelInfoDecodeErrorZ_clone(const struct LDKCResult_DirectionalChannelInfoDecodeErrorZ *NONNULL_PTR orig);
11127
11128 /**
11129  * Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
11130  */
11131 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_ok(struct LDKChannelInfo o);
11132
11133 /**
11134  * Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
11135  */
11136 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_err(struct LDKDecodeError e);
11137
11138 /**
11139  * Frees any resources used by the CResult_ChannelInfoDecodeErrorZ.
11140  */
11141 void CResult_ChannelInfoDecodeErrorZ_free(struct LDKCResult_ChannelInfoDecodeErrorZ _res);
11142
11143 /**
11144  * Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig`
11145  * but with all dynamically-allocated buffers duplicated in new buffers.
11146  */
11147 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_clone(const struct LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR orig);
11148
11149 /**
11150  * Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
11151  */
11152 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_ok(struct LDKRoutingFees o);
11153
11154 /**
11155  * Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
11156  */
11157 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_err(struct LDKDecodeError e);
11158
11159 /**
11160  * Frees any resources used by the CResult_RoutingFeesDecodeErrorZ.
11161  */
11162 void CResult_RoutingFeesDecodeErrorZ_free(struct LDKCResult_RoutingFeesDecodeErrorZ _res);
11163
11164 /**
11165  * Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig`
11166  * but with all dynamically-allocated buffers duplicated in new buffers.
11167  */
11168 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_clone(const struct LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR orig);
11169
11170 /**
11171  * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
11172  */
11173 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_ok(struct LDKNodeAnnouncementInfo o);
11174
11175 /**
11176  * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
11177  */
11178 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_err(struct LDKDecodeError e);
11179
11180 /**
11181  * Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
11182  */
11183 void CResult_NodeAnnouncementInfoDecodeErrorZ_free(struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res);
11184
11185 /**
11186  * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
11187  * but with all dynamically-allocated buffers duplicated in new buffers.
11188  */
11189 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_clone(const struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR orig);
11190
11191 /**
11192  * Frees the buffer pointed to by `data` if `datalen` is non-0.
11193  */
11194 void CVec_u64Z_free(struct LDKCVec_u64Z _res);
11195
11196 /**
11197  * Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
11198  */
11199 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_ok(struct LDKNodeInfo o);
11200
11201 /**
11202  * Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
11203  */
11204 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_err(struct LDKDecodeError e);
11205
11206 /**
11207  * Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
11208  */
11209 void CResult_NodeInfoDecodeErrorZ_free(struct LDKCResult_NodeInfoDecodeErrorZ _res);
11210
11211 /**
11212  * Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
11213  * but with all dynamically-allocated buffers duplicated in new buffers.
11214  */
11215 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_clone(const struct LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR orig);
11216
11217 /**
11218  * Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
11219  */
11220 struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_ok(struct LDKNetworkGraph o);
11221
11222 /**
11223  * Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
11224  */
11225 struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_err(struct LDKDecodeError e);
11226
11227 /**
11228  * Frees any resources used by the CResult_NetworkGraphDecodeErrorZ.
11229  */
11230 void CResult_NetworkGraphDecodeErrorZ_free(struct LDKCResult_NetworkGraphDecodeErrorZ _res);
11231
11232 /**
11233  * Creates a new CResult_NetworkGraphDecodeErrorZ which has the same data as `orig`
11234  * but with all dynamically-allocated buffers duplicated in new buffers.
11235  */
11236 struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_clone(const struct LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR orig);
11237
11238 /**
11239  * Creates a new CResult_NetAddressu8Z in the success state.
11240  */
11241 struct LDKCResult_NetAddressu8Z CResult_NetAddressu8Z_ok(struct LDKNetAddress o);
11242
11243 /**
11244  * Creates a new CResult_NetAddressu8Z in the error state.
11245  */
11246 struct LDKCResult_NetAddressu8Z CResult_NetAddressu8Z_err(uint8_t e);
11247
11248 /**
11249  * Frees any resources used by the CResult_NetAddressu8Z.
11250  */
11251 void CResult_NetAddressu8Z_free(struct LDKCResult_NetAddressu8Z _res);
11252
11253 /**
11254  * Creates a new CResult_NetAddressu8Z which has the same data as `orig`
11255  * but with all dynamically-allocated buffers duplicated in new buffers.
11256  */
11257 struct LDKCResult_NetAddressu8Z CResult_NetAddressu8Z_clone(const struct LDKCResult_NetAddressu8Z *NONNULL_PTR orig);
11258
11259 /**
11260  * Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ in the success state.
11261  */
11262 struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(struct LDKCResult_NetAddressu8Z o);
11263
11264 /**
11265  * Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ in the error state.
11266  */
11267 struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ CResult_CResult_NetAddressu8ZDecodeErrorZ_err(struct LDKDecodeError e);
11268
11269 /**
11270  * Frees any resources used by the CResult_CResult_NetAddressu8ZDecodeErrorZ.
11271  */
11272 void CResult_CResult_NetAddressu8ZDecodeErrorZ_free(struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ _res);
11273
11274 /**
11275  * Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ which has the same data as `orig`
11276  * but with all dynamically-allocated buffers duplicated in new buffers.
11277  */
11278 struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ CResult_CResult_NetAddressu8ZDecodeErrorZ_clone(const struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *NONNULL_PTR orig);
11279
11280 /**
11281  * Creates a new CResult_NetAddressDecodeErrorZ in the success state.
11282  */
11283 struct LDKCResult_NetAddressDecodeErrorZ CResult_NetAddressDecodeErrorZ_ok(struct LDKNetAddress o);
11284
11285 /**
11286  * Creates a new CResult_NetAddressDecodeErrorZ in the error state.
11287  */
11288 struct LDKCResult_NetAddressDecodeErrorZ CResult_NetAddressDecodeErrorZ_err(struct LDKDecodeError e);
11289
11290 /**
11291  * Frees any resources used by the CResult_NetAddressDecodeErrorZ.
11292  */
11293 void CResult_NetAddressDecodeErrorZ_free(struct LDKCResult_NetAddressDecodeErrorZ _res);
11294
11295 /**
11296  * Creates a new CResult_NetAddressDecodeErrorZ which has the same data as `orig`
11297  * but with all dynamically-allocated buffers duplicated in new buffers.
11298  */
11299 struct LDKCResult_NetAddressDecodeErrorZ CResult_NetAddressDecodeErrorZ_clone(const struct LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR orig);
11300
11301 /**
11302  * Frees the buffer pointed to by `data` if `datalen` is non-0.
11303  */
11304 void CVec_UpdateAddHTLCZ_free(struct LDKCVec_UpdateAddHTLCZ _res);
11305
11306 /**
11307  * Frees the buffer pointed to by `data` if `datalen` is non-0.
11308  */
11309 void CVec_UpdateFulfillHTLCZ_free(struct LDKCVec_UpdateFulfillHTLCZ _res);
11310
11311 /**
11312  * Frees the buffer pointed to by `data` if `datalen` is non-0.
11313  */
11314 void CVec_UpdateFailHTLCZ_free(struct LDKCVec_UpdateFailHTLCZ _res);
11315
11316 /**
11317  * Frees the buffer pointed to by `data` if `datalen` is non-0.
11318  */
11319 void CVec_UpdateFailMalformedHTLCZ_free(struct LDKCVec_UpdateFailMalformedHTLCZ _res);
11320
11321 /**
11322  * Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
11323  */
11324 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_ok(struct LDKAcceptChannel o);
11325
11326 /**
11327  * Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
11328  */
11329 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_err(struct LDKDecodeError e);
11330
11331 /**
11332  * Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
11333  */
11334 void CResult_AcceptChannelDecodeErrorZ_free(struct LDKCResult_AcceptChannelDecodeErrorZ _res);
11335
11336 /**
11337  * Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
11338  * but with all dynamically-allocated buffers duplicated in new buffers.
11339  */
11340 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_clone(const struct LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR orig);
11341
11342 /**
11343  * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
11344  */
11345 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_ok(struct LDKAnnouncementSignatures o);
11346
11347 /**
11348  * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
11349  */
11350 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_err(struct LDKDecodeError e);
11351
11352 /**
11353  * Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
11354  */
11355 void CResult_AnnouncementSignaturesDecodeErrorZ_free(struct LDKCResult_AnnouncementSignaturesDecodeErrorZ _res);
11356
11357 /**
11358  * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
11359  * but with all dynamically-allocated buffers duplicated in new buffers.
11360  */
11361 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_clone(const struct LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR orig);
11362
11363 /**
11364  * Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
11365  */
11366 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_ok(struct LDKChannelReestablish o);
11367
11368 /**
11369  * Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
11370  */
11371 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_err(struct LDKDecodeError e);
11372
11373 /**
11374  * Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
11375  */
11376 void CResult_ChannelReestablishDecodeErrorZ_free(struct LDKCResult_ChannelReestablishDecodeErrorZ _res);
11377
11378 /**
11379  * Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig`
11380  * but with all dynamically-allocated buffers duplicated in new buffers.
11381  */
11382 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_clone(const struct LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR orig);
11383
11384 /**
11385  * Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
11386  */
11387 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_ok(struct LDKClosingSigned o);
11388
11389 /**
11390  * Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
11391  */
11392 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_err(struct LDKDecodeError e);
11393
11394 /**
11395  * Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
11396  */
11397 void CResult_ClosingSignedDecodeErrorZ_free(struct LDKCResult_ClosingSignedDecodeErrorZ _res);
11398
11399 /**
11400  * Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig`
11401  * but with all dynamically-allocated buffers duplicated in new buffers.
11402  */
11403 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_clone(const struct LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR orig);
11404
11405 /**
11406  * Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the success state.
11407  */
11408 struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(struct LDKClosingSignedFeeRange o);
11409
11410 /**
11411  * Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the error state.
11412  */
11413 struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ CResult_ClosingSignedFeeRangeDecodeErrorZ_err(struct LDKDecodeError e);
11414
11415 /**
11416  * Frees any resources used by the CResult_ClosingSignedFeeRangeDecodeErrorZ.
11417  */
11418 void CResult_ClosingSignedFeeRangeDecodeErrorZ_free(struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res);
11419
11420 /**
11421  * Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ which has the same data as `orig`
11422  * but with all dynamically-allocated buffers duplicated in new buffers.
11423  */
11424 struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(const struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR orig);
11425
11426 /**
11427  * Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
11428  */
11429 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_ok(struct LDKCommitmentSigned o);
11430
11431 /**
11432  * Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
11433  */
11434 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_err(struct LDKDecodeError e);
11435
11436 /**
11437  * Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
11438  */
11439 void CResult_CommitmentSignedDecodeErrorZ_free(struct LDKCResult_CommitmentSignedDecodeErrorZ _res);
11440
11441 /**
11442  * Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig`
11443  * but with all dynamically-allocated buffers duplicated in new buffers.
11444  */
11445 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_clone(const struct LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR orig);
11446
11447 /**
11448  * Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
11449  */
11450 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_ok(struct LDKFundingCreated o);
11451
11452 /**
11453  * Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
11454  */
11455 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_err(struct LDKDecodeError e);
11456
11457 /**
11458  * Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
11459  */
11460 void CResult_FundingCreatedDecodeErrorZ_free(struct LDKCResult_FundingCreatedDecodeErrorZ _res);
11461
11462 /**
11463  * Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig`
11464  * but with all dynamically-allocated buffers duplicated in new buffers.
11465  */
11466 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_clone(const struct LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR orig);
11467
11468 /**
11469  * Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
11470  */
11471 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_ok(struct LDKFundingSigned o);
11472
11473 /**
11474  * Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
11475  */
11476 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_err(struct LDKDecodeError e);
11477
11478 /**
11479  * Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
11480  */
11481 void CResult_FundingSignedDecodeErrorZ_free(struct LDKCResult_FundingSignedDecodeErrorZ _res);
11482
11483 /**
11484  * Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
11485  * but with all dynamically-allocated buffers duplicated in new buffers.
11486  */
11487 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_clone(const struct LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR orig);
11488
11489 /**
11490  * Creates a new CResult_FundingLockedDecodeErrorZ in the success state.
11491  */
11492 struct LDKCResult_FundingLockedDecodeErrorZ CResult_FundingLockedDecodeErrorZ_ok(struct LDKFundingLocked o);
11493
11494 /**
11495  * Creates a new CResult_FundingLockedDecodeErrorZ in the error state.
11496  */
11497 struct LDKCResult_FundingLockedDecodeErrorZ CResult_FundingLockedDecodeErrorZ_err(struct LDKDecodeError e);
11498
11499 /**
11500  * Frees any resources used by the CResult_FundingLockedDecodeErrorZ.
11501  */
11502 void CResult_FundingLockedDecodeErrorZ_free(struct LDKCResult_FundingLockedDecodeErrorZ _res);
11503
11504 /**
11505  * Creates a new CResult_FundingLockedDecodeErrorZ which has the same data as `orig`
11506  * but with all dynamically-allocated buffers duplicated in new buffers.
11507  */
11508 struct LDKCResult_FundingLockedDecodeErrorZ CResult_FundingLockedDecodeErrorZ_clone(const struct LDKCResult_FundingLockedDecodeErrorZ *NONNULL_PTR orig);
11509
11510 /**
11511  * Creates a new CResult_InitDecodeErrorZ in the success state.
11512  */
11513 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_ok(struct LDKInit o);
11514
11515 /**
11516  * Creates a new CResult_InitDecodeErrorZ in the error state.
11517  */
11518 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_err(struct LDKDecodeError e);
11519
11520 /**
11521  * Frees any resources used by the CResult_InitDecodeErrorZ.
11522  */
11523 void CResult_InitDecodeErrorZ_free(struct LDKCResult_InitDecodeErrorZ _res);
11524
11525 /**
11526  * Creates a new CResult_InitDecodeErrorZ which has the same data as `orig`
11527  * but with all dynamically-allocated buffers duplicated in new buffers.
11528  */
11529 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_clone(const struct LDKCResult_InitDecodeErrorZ *NONNULL_PTR orig);
11530
11531 /**
11532  * Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
11533  */
11534 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_ok(struct LDKOpenChannel o);
11535
11536 /**
11537  * Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
11538  */
11539 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_err(struct LDKDecodeError e);
11540
11541 /**
11542  * Frees any resources used by the CResult_OpenChannelDecodeErrorZ.
11543  */
11544 void CResult_OpenChannelDecodeErrorZ_free(struct LDKCResult_OpenChannelDecodeErrorZ _res);
11545
11546 /**
11547  * Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig`
11548  * but with all dynamically-allocated buffers duplicated in new buffers.
11549  */
11550 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_clone(const struct LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR orig);
11551
11552 /**
11553  * Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
11554  */
11555 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_ok(struct LDKRevokeAndACK o);
11556
11557 /**
11558  * Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
11559  */
11560 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_err(struct LDKDecodeError e);
11561
11562 /**
11563  * Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ.
11564  */
11565 void CResult_RevokeAndACKDecodeErrorZ_free(struct LDKCResult_RevokeAndACKDecodeErrorZ _res);
11566
11567 /**
11568  * Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig`
11569  * but with all dynamically-allocated buffers duplicated in new buffers.
11570  */
11571 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_clone(const struct LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR orig);
11572
11573 /**
11574  * Creates a new CResult_ShutdownDecodeErrorZ in the success state.
11575  */
11576 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_ok(struct LDKShutdown o);
11577
11578 /**
11579  * Creates a new CResult_ShutdownDecodeErrorZ in the error state.
11580  */
11581 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_err(struct LDKDecodeError e);
11582
11583 /**
11584  * Frees any resources used by the CResult_ShutdownDecodeErrorZ.
11585  */
11586 void CResult_ShutdownDecodeErrorZ_free(struct LDKCResult_ShutdownDecodeErrorZ _res);
11587
11588 /**
11589  * Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig`
11590  * but with all dynamically-allocated buffers duplicated in new buffers.
11591  */
11592 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_clone(const struct LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR orig);
11593
11594 /**
11595  * Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
11596  */
11597 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_ok(struct LDKUpdateFailHTLC o);
11598
11599 /**
11600  * Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
11601  */
11602 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_err(struct LDKDecodeError e);
11603
11604 /**
11605  * Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ.
11606  */
11607 void CResult_UpdateFailHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFailHTLCDecodeErrorZ _res);
11608
11609 /**
11610  * Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
11611  * but with all dynamically-allocated buffers duplicated in new buffers.
11612  */
11613 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR orig);
11614
11615 /**
11616  * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
11617  */
11618 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(struct LDKUpdateFailMalformedHTLC o);
11619
11620 /**
11621  * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
11622  */
11623 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(struct LDKDecodeError e);
11624
11625 /**
11626  * Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ.
11627  */
11628 void CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res);
11629
11630 /**
11631  * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
11632  * but with all dynamically-allocated buffers duplicated in new buffers.
11633  */
11634 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR orig);
11635
11636 /**
11637  * Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
11638  */
11639 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_ok(struct LDKUpdateFee o);
11640
11641 /**
11642  * Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
11643  */
11644 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_err(struct LDKDecodeError e);
11645
11646 /**
11647  * Frees any resources used by the CResult_UpdateFeeDecodeErrorZ.
11648  */
11649 void CResult_UpdateFeeDecodeErrorZ_free(struct LDKCResult_UpdateFeeDecodeErrorZ _res);
11650
11651 /**
11652  * Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig`
11653  * but with all dynamically-allocated buffers duplicated in new buffers.
11654  */
11655 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_clone(const struct LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR orig);
11656
11657 /**
11658  * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
11659  */
11660 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_ok(struct LDKUpdateFulfillHTLC o);
11661
11662 /**
11663  * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
11664  */
11665 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_err(struct LDKDecodeError e);
11666
11667 /**
11668  * Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ.
11669  */
11670 void CResult_UpdateFulfillHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res);
11671
11672 /**
11673  * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
11674  * but with all dynamically-allocated buffers duplicated in new buffers.
11675  */
11676 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR orig);
11677
11678 /**
11679  * Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
11680  */
11681 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_ok(struct LDKUpdateAddHTLC o);
11682
11683 /**
11684  * Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
11685  */
11686 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_err(struct LDKDecodeError e);
11687
11688 /**
11689  * Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ.
11690  */
11691 void CResult_UpdateAddHTLCDecodeErrorZ_free(struct LDKCResult_UpdateAddHTLCDecodeErrorZ _res);
11692
11693 /**
11694  * Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
11695  * but with all dynamically-allocated buffers duplicated in new buffers.
11696  */
11697 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR orig);
11698
11699 /**
11700  * Creates a new CResult_PingDecodeErrorZ in the success state.
11701  */
11702 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_ok(struct LDKPing o);
11703
11704 /**
11705  * Creates a new CResult_PingDecodeErrorZ in the error state.
11706  */
11707 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_err(struct LDKDecodeError e);
11708
11709 /**
11710  * Frees any resources used by the CResult_PingDecodeErrorZ.
11711  */
11712 void CResult_PingDecodeErrorZ_free(struct LDKCResult_PingDecodeErrorZ _res);
11713
11714 /**
11715  * Creates a new CResult_PingDecodeErrorZ which has the same data as `orig`
11716  * but with all dynamically-allocated buffers duplicated in new buffers.
11717  */
11718 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_clone(const struct LDKCResult_PingDecodeErrorZ *NONNULL_PTR orig);
11719
11720 /**
11721  * Creates a new CResult_PongDecodeErrorZ in the success state.
11722  */
11723 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_ok(struct LDKPong o);
11724
11725 /**
11726  * Creates a new CResult_PongDecodeErrorZ in the error state.
11727  */
11728 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_err(struct LDKDecodeError e);
11729
11730 /**
11731  * Frees any resources used by the CResult_PongDecodeErrorZ.
11732  */
11733 void CResult_PongDecodeErrorZ_free(struct LDKCResult_PongDecodeErrorZ _res);
11734
11735 /**
11736  * Creates a new CResult_PongDecodeErrorZ which has the same data as `orig`
11737  * but with all dynamically-allocated buffers duplicated in new buffers.
11738  */
11739 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_clone(const struct LDKCResult_PongDecodeErrorZ *NONNULL_PTR orig);
11740
11741 /**
11742  * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
11743  */
11744 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(struct LDKUnsignedChannelAnnouncement o);
11745
11746 /**
11747  * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
11748  */
11749 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
11750
11751 /**
11752  * Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
11753  */
11754 void CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res);
11755
11756 /**
11757  * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
11758  * but with all dynamically-allocated buffers duplicated in new buffers.
11759  */
11760 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(const struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR orig);
11761
11762 /**
11763  * Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
11764  */
11765 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_ok(struct LDKChannelAnnouncement o);
11766
11767 /**
11768  * Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
11769  */
11770 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
11771
11772 /**
11773  * Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
11774  */
11775 void CResult_ChannelAnnouncementDecodeErrorZ_free(struct LDKCResult_ChannelAnnouncementDecodeErrorZ _res);
11776
11777 /**
11778  * Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
11779  * but with all dynamically-allocated buffers duplicated in new buffers.
11780  */
11781 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_clone(const struct LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR orig);
11782
11783 /**
11784  * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
11785  */
11786 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_ok(struct LDKUnsignedChannelUpdate o);
11787
11788 /**
11789  * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
11790  */
11791 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_err(struct LDKDecodeError e);
11792
11793 /**
11794  * Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
11795  */
11796 void CResult_UnsignedChannelUpdateDecodeErrorZ_free(struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res);
11797
11798 /**
11799  * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
11800  * but with all dynamically-allocated buffers duplicated in new buffers.
11801  */
11802 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_clone(const struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR orig);
11803
11804 /**
11805  * Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
11806  */
11807 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_ok(struct LDKChannelUpdate o);
11808
11809 /**
11810  * Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
11811  */
11812 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_err(struct LDKDecodeError e);
11813
11814 /**
11815  * Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
11816  */
11817 void CResult_ChannelUpdateDecodeErrorZ_free(struct LDKCResult_ChannelUpdateDecodeErrorZ _res);
11818
11819 /**
11820  * Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
11821  * but with all dynamically-allocated buffers duplicated in new buffers.
11822  */
11823 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_clone(const struct LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR orig);
11824
11825 /**
11826  * Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
11827  */
11828 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_ok(struct LDKErrorMessage o);
11829
11830 /**
11831  * Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
11832  */
11833 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_err(struct LDKDecodeError e);
11834
11835 /**
11836  * Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
11837  */
11838 void CResult_ErrorMessageDecodeErrorZ_free(struct LDKCResult_ErrorMessageDecodeErrorZ _res);
11839
11840 /**
11841  * Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
11842  * but with all dynamically-allocated buffers duplicated in new buffers.
11843  */
11844 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_clone(const struct LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR orig);
11845
11846 /**
11847  * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
11848  */
11849 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(struct LDKUnsignedNodeAnnouncement o);
11850
11851 /**
11852  * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
11853  */
11854 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
11855
11856 /**
11857  * Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
11858  */
11859 void CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res);
11860
11861 /**
11862  * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
11863  * but with all dynamically-allocated buffers duplicated in new buffers.
11864  */
11865 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(const struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR orig);
11866
11867 /**
11868  * Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
11869  */
11870 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_ok(struct LDKNodeAnnouncement o);
11871
11872 /**
11873  * Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
11874  */
11875 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
11876
11877 /**
11878  * Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
11879  */
11880 void CResult_NodeAnnouncementDecodeErrorZ_free(struct LDKCResult_NodeAnnouncementDecodeErrorZ _res);
11881
11882 /**
11883  * Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
11884  * but with all dynamically-allocated buffers duplicated in new buffers.
11885  */
11886 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_clone(const struct LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR orig);
11887
11888 /**
11889  * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
11890  */
11891 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_ok(struct LDKQueryShortChannelIds o);
11892
11893 /**
11894  * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
11895  */
11896 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_err(struct LDKDecodeError e);
11897
11898 /**
11899  * Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
11900  */
11901 void CResult_QueryShortChannelIdsDecodeErrorZ_free(struct LDKCResult_QueryShortChannelIdsDecodeErrorZ _res);
11902
11903 /**
11904  * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
11905  * but with all dynamically-allocated buffers duplicated in new buffers.
11906  */
11907 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_clone(const struct LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR orig);
11908
11909 /**
11910  * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
11911  */
11912 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(struct LDKReplyShortChannelIdsEnd o);
11913
11914 /**
11915  * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
11916  */
11917 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(struct LDKDecodeError e);
11918
11919 /**
11920  * Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
11921  */
11922 void CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res);
11923
11924 /**
11925  * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
11926  * but with all dynamically-allocated buffers duplicated in new buffers.
11927  */
11928 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(const struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR orig);
11929
11930 /**
11931  * Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
11932  */
11933 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_ok(struct LDKQueryChannelRange o);
11934
11935 /**
11936  * Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
11937  */
11938 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_err(struct LDKDecodeError e);
11939
11940 /**
11941  * Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
11942  */
11943 void CResult_QueryChannelRangeDecodeErrorZ_free(struct LDKCResult_QueryChannelRangeDecodeErrorZ _res);
11944
11945 /**
11946  * Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
11947  * but with all dynamically-allocated buffers duplicated in new buffers.
11948  */
11949 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_clone(const struct LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR orig);
11950
11951 /**
11952  * Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
11953  */
11954 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_ok(struct LDKReplyChannelRange o);
11955
11956 /**
11957  * Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
11958  */
11959 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_err(struct LDKDecodeError e);
11960
11961 /**
11962  * Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
11963  */
11964 void CResult_ReplyChannelRangeDecodeErrorZ_free(struct LDKCResult_ReplyChannelRangeDecodeErrorZ _res);
11965
11966 /**
11967  * Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
11968  * but with all dynamically-allocated buffers duplicated in new buffers.
11969  */
11970 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_clone(const struct LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR orig);
11971
11972 /**
11973  * Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
11974  */
11975 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_ok(struct LDKGossipTimestampFilter o);
11976
11977 /**
11978  * Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
11979  */
11980 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_err(struct LDKDecodeError e);
11981
11982 /**
11983  * Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
11984  */
11985 void CResult_GossipTimestampFilterDecodeErrorZ_free(struct LDKCResult_GossipTimestampFilterDecodeErrorZ _res);
11986
11987 /**
11988  * Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
11989  * but with all dynamically-allocated buffers duplicated in new buffers.
11990  */
11991 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_clone(const struct LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR orig);
11992
11993 /**
11994  * Creates a new CResult_InvoiceSignOrCreationErrorZ in the success state.
11995  */
11996 struct LDKCResult_InvoiceSignOrCreationErrorZ CResult_InvoiceSignOrCreationErrorZ_ok(struct LDKInvoice o);
11997
11998 /**
11999  * Creates a new CResult_InvoiceSignOrCreationErrorZ in the error state.
12000  */
12001 struct LDKCResult_InvoiceSignOrCreationErrorZ CResult_InvoiceSignOrCreationErrorZ_err(struct LDKSignOrCreationError e);
12002
12003 /**
12004  * Frees any resources used by the CResult_InvoiceSignOrCreationErrorZ.
12005  */
12006 void CResult_InvoiceSignOrCreationErrorZ_free(struct LDKCResult_InvoiceSignOrCreationErrorZ _res);
12007
12008 /**
12009  * Creates a new CResult_InvoiceSignOrCreationErrorZ which has the same data as `orig`
12010  * but with all dynamically-allocated buffers duplicated in new buffers.
12011  */
12012 struct LDKCResult_InvoiceSignOrCreationErrorZ CResult_InvoiceSignOrCreationErrorZ_clone(const struct LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR orig);
12013
12014 /**
12015  * Frees any resources used by the PaymentPurpose
12016  */
12017 void PaymentPurpose_free(struct LDKPaymentPurpose this_ptr);
12018
12019 /**
12020  * Creates a copy of the PaymentPurpose
12021  */
12022 struct LDKPaymentPurpose PaymentPurpose_clone(const struct LDKPaymentPurpose *NONNULL_PTR orig);
12023
12024 /**
12025  * Utility method to constructs a new InvoicePayment-variant PaymentPurpose
12026  */
12027 struct LDKPaymentPurpose PaymentPurpose_invoice_payment(struct LDKThirtyTwoBytes payment_preimage, struct LDKThirtyTwoBytes payment_secret, uint64_t user_payment_id);
12028
12029 /**
12030  * Utility method to constructs a new SpontaneousPayment-variant PaymentPurpose
12031  */
12032 struct LDKPaymentPurpose PaymentPurpose_spontaneous_payment(struct LDKThirtyTwoBytes a);
12033
12034 /**
12035  * Frees any resources used by the Event
12036  */
12037 void Event_free(struct LDKEvent this_ptr);
12038
12039 /**
12040  * Creates a copy of the Event
12041  */
12042 struct LDKEvent Event_clone(const struct LDKEvent *NONNULL_PTR orig);
12043
12044 /**
12045  * Utility method to constructs a new FundingGenerationReady-variant Event
12046  */
12047 struct LDKEvent Event_funding_generation_ready(struct LDKThirtyTwoBytes temporary_channel_id, uint64_t channel_value_satoshis, struct LDKCVec_u8Z output_script, uint64_t user_channel_id);
12048
12049 /**
12050  * Utility method to constructs a new PaymentReceived-variant Event
12051  */
12052 struct LDKEvent Event_payment_received(struct LDKThirtyTwoBytes payment_hash, uint64_t amt, struct LDKPaymentPurpose purpose);
12053
12054 /**
12055  * Utility method to constructs a new PaymentSent-variant Event
12056  */
12057 struct LDKEvent Event_payment_sent(struct LDKThirtyTwoBytes payment_preimage);
12058
12059 /**
12060  * Utility method to constructs a new PaymentFailed-variant Event
12061  */
12062 struct LDKEvent Event_payment_failed(struct LDKThirtyTwoBytes payment_hash, bool rejected_by_dest);
12063
12064 /**
12065  * Utility method to constructs a new PendingHTLCsForwardable-variant Event
12066  */
12067 struct LDKEvent Event_pending_htlcs_forwardable(uint64_t time_forwardable);
12068
12069 /**
12070  * Utility method to constructs a new SpendableOutputs-variant Event
12071  */
12072 struct LDKEvent Event_spendable_outputs(struct LDKCVec_SpendableOutputDescriptorZ outputs);
12073
12074 /**
12075  * Utility method to constructs a new PaymentForwarded-variant Event
12076  */
12077 struct LDKEvent Event_payment_forwarded(struct LDKCOption_u64Z fee_earned_msat, bool claim_from_onchain_tx);
12078
12079 /**
12080  * Serialize the Event object into a byte array which can be read by Event_read
12081  */
12082 struct LDKCVec_u8Z Event_write(const struct LDKEvent *NONNULL_PTR obj);
12083
12084 /**
12085  * Frees any resources used by the MessageSendEvent
12086  */
12087 void MessageSendEvent_free(struct LDKMessageSendEvent this_ptr);
12088
12089 /**
12090  * Creates a copy of the MessageSendEvent
12091  */
12092 struct LDKMessageSendEvent MessageSendEvent_clone(const struct LDKMessageSendEvent *NONNULL_PTR orig);
12093
12094 /**
12095  * Utility method to constructs a new SendAcceptChannel-variant MessageSendEvent
12096  */
12097 struct LDKMessageSendEvent MessageSendEvent_send_accept_channel(struct LDKPublicKey node_id, struct LDKAcceptChannel msg);
12098
12099 /**
12100  * Utility method to constructs a new SendOpenChannel-variant MessageSendEvent
12101  */
12102 struct LDKMessageSendEvent MessageSendEvent_send_open_channel(struct LDKPublicKey node_id, struct LDKOpenChannel msg);
12103
12104 /**
12105  * Utility method to constructs a new SendFundingCreated-variant MessageSendEvent
12106  */
12107 struct LDKMessageSendEvent MessageSendEvent_send_funding_created(struct LDKPublicKey node_id, struct LDKFundingCreated msg);
12108
12109 /**
12110  * Utility method to constructs a new SendFundingSigned-variant MessageSendEvent
12111  */
12112 struct LDKMessageSendEvent MessageSendEvent_send_funding_signed(struct LDKPublicKey node_id, struct LDKFundingSigned msg);
12113
12114 /**
12115  * Utility method to constructs a new SendFundingLocked-variant MessageSendEvent
12116  */
12117 struct LDKMessageSendEvent MessageSendEvent_send_funding_locked(struct LDKPublicKey node_id, struct LDKFundingLocked msg);
12118
12119 /**
12120  * Utility method to constructs a new SendAnnouncementSignatures-variant MessageSendEvent
12121  */
12122 struct LDKMessageSendEvent MessageSendEvent_send_announcement_signatures(struct LDKPublicKey node_id, struct LDKAnnouncementSignatures msg);
12123
12124 /**
12125  * Utility method to constructs a new UpdateHTLCs-variant MessageSendEvent
12126  */
12127 struct LDKMessageSendEvent MessageSendEvent_update_htlcs(struct LDKPublicKey node_id, struct LDKCommitmentUpdate updates);
12128
12129 /**
12130  * Utility method to constructs a new SendRevokeAndACK-variant MessageSendEvent
12131  */
12132 struct LDKMessageSendEvent MessageSendEvent_send_revoke_and_ack(struct LDKPublicKey node_id, struct LDKRevokeAndACK msg);
12133
12134 /**
12135  * Utility method to constructs a new SendClosingSigned-variant MessageSendEvent
12136  */
12137 struct LDKMessageSendEvent MessageSendEvent_send_closing_signed(struct LDKPublicKey node_id, struct LDKClosingSigned msg);
12138
12139 /**
12140  * Utility method to constructs a new SendShutdown-variant MessageSendEvent
12141  */
12142 struct LDKMessageSendEvent MessageSendEvent_send_shutdown(struct LDKPublicKey node_id, struct LDKShutdown msg);
12143
12144 /**
12145  * Utility method to constructs a new SendChannelReestablish-variant MessageSendEvent
12146  */
12147 struct LDKMessageSendEvent MessageSendEvent_send_channel_reestablish(struct LDKPublicKey node_id, struct LDKChannelReestablish msg);
12148
12149 /**
12150  * Utility method to constructs a new BroadcastChannelAnnouncement-variant MessageSendEvent
12151  */
12152 struct LDKMessageSendEvent MessageSendEvent_broadcast_channel_announcement(struct LDKChannelAnnouncement msg, struct LDKChannelUpdate update_msg);
12153
12154 /**
12155  * Utility method to constructs a new BroadcastNodeAnnouncement-variant MessageSendEvent
12156  */
12157 struct LDKMessageSendEvent MessageSendEvent_broadcast_node_announcement(struct LDKNodeAnnouncement msg);
12158
12159 /**
12160  * Utility method to constructs a new BroadcastChannelUpdate-variant MessageSendEvent
12161  */
12162 struct LDKMessageSendEvent MessageSendEvent_broadcast_channel_update(struct LDKChannelUpdate msg);
12163
12164 /**
12165  * Utility method to constructs a new SendChannelUpdate-variant MessageSendEvent
12166  */
12167 struct LDKMessageSendEvent MessageSendEvent_send_channel_update(struct LDKPublicKey node_id, struct LDKChannelUpdate msg);
12168
12169 /**
12170  * Utility method to constructs a new HandleError-variant MessageSendEvent
12171  */
12172 struct LDKMessageSendEvent MessageSendEvent_handle_error(struct LDKPublicKey node_id, struct LDKErrorAction action);
12173
12174 /**
12175  * Utility method to constructs a new PaymentFailureNetworkUpdate-variant MessageSendEvent
12176  */
12177 struct LDKMessageSendEvent MessageSendEvent_payment_failure_network_update(struct LDKHTLCFailChannelUpdate update);
12178
12179 /**
12180  * Utility method to constructs a new SendChannelRangeQuery-variant MessageSendEvent
12181  */
12182 struct LDKMessageSendEvent MessageSendEvent_send_channel_range_query(struct LDKPublicKey node_id, struct LDKQueryChannelRange msg);
12183
12184 /**
12185  * Utility method to constructs a new SendShortIdsQuery-variant MessageSendEvent
12186  */
12187 struct LDKMessageSendEvent MessageSendEvent_send_short_ids_query(struct LDKPublicKey node_id, struct LDKQueryShortChannelIds msg);
12188
12189 /**
12190  * Utility method to constructs a new SendReplyChannelRange-variant MessageSendEvent
12191  */
12192 struct LDKMessageSendEvent MessageSendEvent_send_reply_channel_range(struct LDKPublicKey node_id, struct LDKReplyChannelRange msg);
12193
12194 /**
12195  * Calls the free function if one is set
12196  */
12197 void MessageSendEventsProvider_free(struct LDKMessageSendEventsProvider this_ptr);
12198
12199 /**
12200  * Calls the free function if one is set
12201  */
12202 void EventsProvider_free(struct LDKEventsProvider this_ptr);
12203
12204 /**
12205  * Calls the free function if one is set
12206  */
12207 void EventHandler_free(struct LDKEventHandler this_ptr);
12208
12209 /**
12210  * Frees any resources used by the APIError
12211  */
12212 void APIError_free(struct LDKAPIError this_ptr);
12213
12214 /**
12215  * Creates a copy of the APIError
12216  */
12217 struct LDKAPIError APIError_clone(const struct LDKAPIError *NONNULL_PTR orig);
12218
12219 /**
12220  * Utility method to constructs a new APIMisuseError-variant APIError
12221  */
12222 struct LDKAPIError APIError_apimisuse_error(struct LDKStr err);
12223
12224 /**
12225  * Utility method to constructs a new FeeRateTooHigh-variant APIError
12226  */
12227 struct LDKAPIError APIError_fee_rate_too_high(struct LDKStr err, uint32_t feerate);
12228
12229 /**
12230  * Utility method to constructs a new RouteError-variant APIError
12231  */
12232 struct LDKAPIError APIError_route_error(struct LDKStr err);
12233
12234 /**
12235  * Utility method to constructs a new ChannelUnavailable-variant APIError
12236  */
12237 struct LDKAPIError APIError_channel_unavailable(struct LDKStr err);
12238
12239 /**
12240  * Utility method to constructs a new MonitorUpdateFailed-variant APIError
12241  */
12242 struct LDKAPIError APIError_monitor_update_failed(void);
12243
12244 /**
12245  * Utility method to constructs a new IncompatibleShutdownScript-variant APIError
12246  */
12247 struct LDKAPIError APIError_incompatible_shutdown_script(struct LDKShutdownScript script);
12248
12249 /**
12250  * Creates a digital signature of a message given a SecretKey, like the node's secret.
12251  * 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.
12252  * Signatures are EC recoverable, meaning that given the message and the signature the PublicKey of the signer can be extracted.
12253  */
12254 struct LDKCResult_StringErrorZ sign(struct LDKu8slice msg, const uint8_t (*sk)[32]);
12255
12256 /**
12257  * Recovers the PublicKey of the signer of the message given the message and the signature.
12258  */
12259 struct LDKCResult_PublicKeyErrorZ recover_pk(struct LDKu8slice msg, struct LDKStr sig);
12260
12261 /**
12262  * Verifies a message was signed by a PrivateKey that derives to a given PublicKey, given a message, a signature,
12263  * and the PublicKey.
12264  */
12265 bool verify(struct LDKu8slice msg, struct LDKStr sig, struct LDKPublicKey pk);
12266
12267 /**
12268  * Creates a copy of the Level
12269  */
12270 enum LDKLevel Level_clone(const enum LDKLevel *NONNULL_PTR orig);
12271
12272 /**
12273  * Utility method to constructs a new Trace-variant Level
12274  */
12275 enum LDKLevel Level_trace(void);
12276
12277 /**
12278  * Utility method to constructs a new Debug-variant Level
12279  */
12280 enum LDKLevel Level_debug(void);
12281
12282 /**
12283  * Utility method to constructs a new Info-variant Level
12284  */
12285 enum LDKLevel Level_info(void);
12286
12287 /**
12288  * Utility method to constructs a new Warn-variant Level
12289  */
12290 enum LDKLevel Level_warn(void);
12291
12292 /**
12293  * Utility method to constructs a new Error-variant Level
12294  */
12295 enum LDKLevel Level_error(void);
12296
12297 /**
12298  * Checks if two Levels contain equal inner contents.
12299  * This ignores pointers and is_owned flags and looks at the values in fields.
12300  */
12301 bool Level_eq(const enum LDKLevel *NONNULL_PTR a, const enum LDKLevel *NONNULL_PTR b);
12302
12303 /**
12304  * Checks if two Levels contain equal inner contents.
12305  */
12306 uint64_t Level_hash(const enum LDKLevel *NONNULL_PTR o);
12307
12308 /**
12309  * Returns the most verbose logging level.
12310  */
12311 MUST_USE_RES enum LDKLevel Level_max(void);
12312
12313 /**
12314  * Calls the free function if one is set
12315  */
12316 void Logger_free(struct LDKLogger this_ptr);
12317
12318 /**
12319  * Frees any resources used by the ChannelHandshakeConfig, if is_owned is set and inner is non-NULL.
12320  */
12321 void ChannelHandshakeConfig_free(struct LDKChannelHandshakeConfig this_obj);
12322
12323 /**
12324  * Confirmations we will wait for before considering the channel locked in.
12325  * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
12326  * equivalent limit applied to outbound channels).
12327  *
12328  * Default value: 6.
12329  */
12330 uint32_t ChannelHandshakeConfig_get_minimum_depth(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
12331
12332 /**
12333  * Confirmations we will wait for before considering the channel locked in.
12334  * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
12335  * equivalent limit applied to outbound channels).
12336  *
12337  * Default value: 6.
12338  */
12339 void ChannelHandshakeConfig_set_minimum_depth(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint32_t val);
12340
12341 /**
12342  * Set to the number of blocks we require our counterparty to wait to claim their money (ie
12343  * the number of blocks we have to punish our counterparty if they broadcast a revoked
12344  * transaction).
12345  *
12346  * This is one of the main parameters of our security model. We (or one of our watchtowers) MUST
12347  * be online to check for revoked transactions on-chain at least once every our_to_self_delay
12348  * blocks (minus some margin to allow us enough time to broadcast and confirm a transaction,
12349  * possibly with time in between to RBF the spending transaction).
12350  *
12351  * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in
12352  * case of an honest unilateral channel close, which implicitly decrease the economic value of
12353  * our channel.
12354  *
12355  * Default value: [`BREAKDOWN_TIMEOUT`], we enforce it as a minimum at channel opening so you
12356  * can tweak config to ask for more security, not less.
12357  */
12358 uint16_t ChannelHandshakeConfig_get_our_to_self_delay(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
12359
12360 /**
12361  * Set to the number of blocks we require our counterparty to wait to claim their money (ie
12362  * the number of blocks we have to punish our counterparty if they broadcast a revoked
12363  * transaction).
12364  *
12365  * This is one of the main parameters of our security model. We (or one of our watchtowers) MUST
12366  * be online to check for revoked transactions on-chain at least once every our_to_self_delay
12367  * blocks (minus some margin to allow us enough time to broadcast and confirm a transaction,
12368  * possibly with time in between to RBF the spending transaction).
12369  *
12370  * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in
12371  * case of an honest unilateral channel close, which implicitly decrease the economic value of
12372  * our channel.
12373  *
12374  * Default value: [`BREAKDOWN_TIMEOUT`], we enforce it as a minimum at channel opening so you
12375  * can tweak config to ask for more security, not less.
12376  */
12377 void ChannelHandshakeConfig_set_our_to_self_delay(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint16_t val);
12378
12379 /**
12380  * Set to the smallest value HTLC we will accept to process.
12381  *
12382  * This value is sent to our counterparty on channel-open and we close the channel any time
12383  * our counterparty misbehaves by sending us an HTLC with a value smaller than this.
12384  *
12385  * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required
12386  * by the protocol.
12387  */
12388 uint64_t ChannelHandshakeConfig_get_our_htlc_minimum_msat(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
12389
12390 /**
12391  * Set to the smallest value HTLC we will accept to process.
12392  *
12393  * This value is sent to our counterparty on channel-open and we close the channel any time
12394  * our counterparty misbehaves by sending us an HTLC with a value smaller than this.
12395  *
12396  * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required
12397  * by the protocol.
12398  */
12399 void ChannelHandshakeConfig_set_our_htlc_minimum_msat(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint64_t val);
12400
12401 /**
12402  * Constructs a new ChannelHandshakeConfig given each field
12403  */
12404 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);
12405
12406 /**
12407  * Creates a copy of the ChannelHandshakeConfig
12408  */
12409 struct LDKChannelHandshakeConfig ChannelHandshakeConfig_clone(const struct LDKChannelHandshakeConfig *NONNULL_PTR orig);
12410
12411 /**
12412  * Creates a "default" ChannelHandshakeConfig. See struct and individual field documentaiton for details on which values are used.
12413  */
12414 MUST_USE_RES struct LDKChannelHandshakeConfig ChannelHandshakeConfig_default(void);
12415
12416 /**
12417  * Frees any resources used by the ChannelHandshakeLimits, if is_owned is set and inner is non-NULL.
12418  */
12419 void ChannelHandshakeLimits_free(struct LDKChannelHandshakeLimits this_obj);
12420
12421 /**
12422  * Minimum allowed satoshis when a channel is funded, this is supplied by the sender and so
12423  * only applies to inbound channels.
12424  *
12425  * Default value: 0.
12426  */
12427 uint64_t ChannelHandshakeLimits_get_min_funding_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
12428
12429 /**
12430  * Minimum allowed satoshis when a channel is funded, this is supplied by the sender and so
12431  * only applies to inbound channels.
12432  *
12433  * Default value: 0.
12434  */
12435 void ChannelHandshakeLimits_set_min_funding_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
12436
12437 /**
12438  * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows
12439  * you to limit the maximum minimum-size they can require.
12440  *
12441  * Default value: u64::max_value.
12442  */
12443 uint64_t ChannelHandshakeLimits_get_max_htlc_minimum_msat(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
12444
12445 /**
12446  * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows
12447  * you to limit the maximum minimum-size they can require.
12448  *
12449  * Default value: u64::max_value.
12450  */
12451 void ChannelHandshakeLimits_set_max_htlc_minimum_msat(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
12452
12453 /**
12454  * The remote node sets a limit on the maximum value of pending HTLCs to them at any given
12455  * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value.
12456  *
12457  * Default value: 0.
12458  */
12459 uint64_t ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
12460
12461 /**
12462  * The remote node sets a limit on the maximum value of pending HTLCs to them at any given
12463  * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value.
12464  *
12465  * Default value: 0.
12466  */
12467 void ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
12468
12469 /**
12470  * The remote node will require we keep a certain amount in direct payment to ourselves at all
12471  * time, ensuring that we are able to be punished if we broadcast an old state. This allows to
12472  * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs).
12473  *
12474  * Default value: u64::max_value.
12475  */
12476 uint64_t ChannelHandshakeLimits_get_max_channel_reserve_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
12477
12478 /**
12479  * The remote node will require we keep a certain amount in direct payment to ourselves at all
12480  * time, ensuring that we are able to be punished if we broadcast an old state. This allows to
12481  * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs).
12482  *
12483  * Default value: u64::max_value.
12484  */
12485 void ChannelHandshakeLimits_set_max_channel_reserve_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
12486
12487 /**
12488  * The remote node sets a limit on the maximum number of pending HTLCs to them at any given
12489  * time. This allows you to set a minimum such value.
12490  *
12491  * Default value: 0.
12492  */
12493 uint16_t ChannelHandshakeLimits_get_min_max_accepted_htlcs(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
12494
12495 /**
12496  * The remote node sets a limit on the maximum number of pending HTLCs to them at any given
12497  * time. This allows you to set a minimum such value.
12498  *
12499  * Default value: 0.
12500  */
12501 void ChannelHandshakeLimits_set_min_max_accepted_htlcs(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint16_t val);
12502
12503 /**
12504  * Before a channel is usable the funding transaction will need to be confirmed by at least a
12505  * certain number of blocks, specified by the node which is not the funder (as the funder can
12506  * assume they aren't going to double-spend themselves).
12507  * This config allows you to set a limit on the maximum amount of time to wait.
12508  *
12509  * Default value: 144, or roughly one day and only applies to outbound channels.
12510  */
12511 uint32_t ChannelHandshakeLimits_get_max_minimum_depth(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
12512
12513 /**
12514  * Before a channel is usable the funding transaction will need to be confirmed by at least a
12515  * certain number of blocks, specified by the node which is not the funder (as the funder can
12516  * assume they aren't going to double-spend themselves).
12517  * This config allows you to set a limit on the maximum amount of time to wait.
12518  *
12519  * Default value: 144, or roughly one day and only applies to outbound channels.
12520  */
12521 void ChannelHandshakeLimits_set_max_minimum_depth(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint32_t val);
12522
12523 /**
12524  * Set to force an incoming channel to match our announced channel preference in
12525  * [`ChannelConfig::announced_channel`].
12526  *
12527  * For a node which is not online reliably, this should be set to true and
12528  * [`ChannelConfig::announced_channel`] set to false, ensuring that no announced (aka public)
12529  * channels will ever be opened.
12530  *
12531  * Default value: true.
12532  */
12533 bool ChannelHandshakeLimits_get_force_announced_channel_preference(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
12534
12535 /**
12536  * Set to force an incoming channel to match our announced channel preference in
12537  * [`ChannelConfig::announced_channel`].
12538  *
12539  * For a node which is not online reliably, this should be set to true and
12540  * [`ChannelConfig::announced_channel`] set to false, ensuring that no announced (aka public)
12541  * channels will ever be opened.
12542  *
12543  * Default value: true.
12544  */
12545 void ChannelHandshakeLimits_set_force_announced_channel_preference(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, bool val);
12546
12547 /**
12548  * Set to the amount of time we're willing to wait to claim money back to us.
12549  *
12550  * Not checking this value would be a security issue, as our peer would be able to set it to
12551  * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time.
12552  *
12553  * Default value: 2016, which we also enforce as a maximum value so you can tweak config to
12554  * reduce the loss of having useless locked funds (if your peer accepts)
12555  */
12556 uint16_t ChannelHandshakeLimits_get_their_to_self_delay(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
12557
12558 /**
12559  * Set to the amount of time we're willing to wait to claim money back to us.
12560  *
12561  * Not checking this value would be a security issue, as our peer would be able to set it to
12562  * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time.
12563  *
12564  * Default value: 2016, which we also enforce as a maximum value so you can tweak config to
12565  * reduce the loss of having useless locked funds (if your peer accepts)
12566  */
12567 void ChannelHandshakeLimits_set_their_to_self_delay(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint16_t val);
12568
12569 /**
12570  * Constructs a new ChannelHandshakeLimits given each field
12571  */
12572 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);
12573
12574 /**
12575  * Creates a copy of the ChannelHandshakeLimits
12576  */
12577 struct LDKChannelHandshakeLimits ChannelHandshakeLimits_clone(const struct LDKChannelHandshakeLimits *NONNULL_PTR orig);
12578
12579 /**
12580  * Creates a "default" ChannelHandshakeLimits. See struct and individual field documentaiton for details on which values are used.
12581  */
12582 MUST_USE_RES struct LDKChannelHandshakeLimits ChannelHandshakeLimits_default(void);
12583
12584 /**
12585  * Frees any resources used by the ChannelConfig, if is_owned is set and inner is non-NULL.
12586  */
12587 void ChannelConfig_free(struct LDKChannelConfig this_obj);
12588
12589 /**
12590  * Amount (in millionths of a satoshi) charged per satoshi for payments forwarded outbound
12591  * over the channel.
12592  * This may be allowed to change at runtime in a later update, however doing so must result in
12593  * update messages sent to notify all nodes of our updated relay fee.
12594  *
12595  * Default value: 0.
12596  */
12597 uint32_t ChannelConfig_get_forwarding_fee_proportional_millionths(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
12598
12599 /**
12600  * Amount (in millionths of a satoshi) charged per satoshi for payments forwarded outbound
12601  * over the channel.
12602  * This may be allowed to change at runtime in a later update, however doing so must result in
12603  * update messages sent to notify all nodes of our updated relay fee.
12604  *
12605  * Default value: 0.
12606  */
12607 void ChannelConfig_set_forwarding_fee_proportional_millionths(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint32_t val);
12608
12609 /**
12610  * Amount (in milli-satoshi) charged for payments forwarded outbound over the channel, in
12611  * excess of [`forwarding_fee_proportional_millionths`].
12612  * This may be allowed to change at runtime in a later update, however doing so must result in
12613  * update messages sent to notify all nodes of our updated relay fee.
12614  *
12615  * The default value of a single satoshi roughly matches the market rate on many routing nodes
12616  * as of July 2021. Adjusting it upwards or downwards may change whether nodes route through
12617  * this node.
12618  *
12619  * Default value: 1000.
12620  *
12621  * [`forwarding_fee_proportional_millionths`]: ChannelConfig::forwarding_fee_proportional_millionths
12622  */
12623 uint32_t ChannelConfig_get_forwarding_fee_base_msat(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
12624
12625 /**
12626  * Amount (in milli-satoshi) charged for payments forwarded outbound over the channel, in
12627  * excess of [`forwarding_fee_proportional_millionths`].
12628  * This may be allowed to change at runtime in a later update, however doing so must result in
12629  * update messages sent to notify all nodes of our updated relay fee.
12630  *
12631  * The default value of a single satoshi roughly matches the market rate on many routing nodes
12632  * as of July 2021. Adjusting it upwards or downwards may change whether nodes route through
12633  * this node.
12634  *
12635  * Default value: 1000.
12636  *
12637  * [`forwarding_fee_proportional_millionths`]: ChannelConfig::forwarding_fee_proportional_millionths
12638  */
12639 void ChannelConfig_set_forwarding_fee_base_msat(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint32_t val);
12640
12641 /**
12642  * The difference in the CLTV value between incoming HTLCs and an outbound HTLC forwarded over
12643  * the channel this config applies to.
12644  *
12645  * This is analogous to [`ChannelHandshakeConfig::our_to_self_delay`] but applies to in-flight
12646  * HTLC balance when a channel appears on-chain whereas
12647  * [`ChannelHandshakeConfig::our_to_self_delay`] applies to the remaining
12648  * (non-HTLC-encumbered) balance.
12649  *
12650  * Thus, for HTLC-encumbered balances to be enforced on-chain when a channel is force-closed,
12651  * we (or one of our watchtowers) MUST be online to check for broadcast of the current
12652  * commitment transaction at least once per this many blocks (minus some margin to allow us
12653  * enough time to broadcast and confirm a transaction, possibly with time in between to RBF
12654  * the spending transaction).
12655  *
12656  * Default value: 72 (12 hours at an average of 6 blocks/hour).
12657  * Minimum value: [`MIN_CLTV_EXPIRY_DELTA`], any values less than this will be treated as
12658  *                [`MIN_CLTV_EXPIRY_DELTA`] instead.
12659  *
12660  * [`MIN_CLTV_EXPIRY_DELTA`]: crate::ln::channelmanager::MIN_CLTV_EXPIRY_DELTA
12661  */
12662 uint16_t ChannelConfig_get_cltv_expiry_delta(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
12663
12664 /**
12665  * The difference in the CLTV value between incoming HTLCs and an outbound HTLC forwarded over
12666  * the channel this config applies to.
12667  *
12668  * This is analogous to [`ChannelHandshakeConfig::our_to_self_delay`] but applies to in-flight
12669  * HTLC balance when a channel appears on-chain whereas
12670  * [`ChannelHandshakeConfig::our_to_self_delay`] applies to the remaining
12671  * (non-HTLC-encumbered) balance.
12672  *
12673  * Thus, for HTLC-encumbered balances to be enforced on-chain when a channel is force-closed,
12674  * we (or one of our watchtowers) MUST be online to check for broadcast of the current
12675  * commitment transaction at least once per this many blocks (minus some margin to allow us
12676  * enough time to broadcast and confirm a transaction, possibly with time in between to RBF
12677  * the spending transaction).
12678  *
12679  * Default value: 72 (12 hours at an average of 6 blocks/hour).
12680  * Minimum value: [`MIN_CLTV_EXPIRY_DELTA`], any values less than this will be treated as
12681  *                [`MIN_CLTV_EXPIRY_DELTA`] instead.
12682  *
12683  * [`MIN_CLTV_EXPIRY_DELTA`]: crate::ln::channelmanager::MIN_CLTV_EXPIRY_DELTA
12684  */
12685 void ChannelConfig_set_cltv_expiry_delta(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint16_t val);
12686
12687 /**
12688  * Set to announce the channel publicly and notify all nodes that they can route via this
12689  * channel.
12690  *
12691  * This should only be set to true for nodes which expect to be online reliably.
12692  *
12693  * As the node which funds a channel picks this value this will only apply for new outbound
12694  * channels unless [`ChannelHandshakeLimits::force_announced_channel_preference`] is set.
12695  *
12696  * This cannot be changed after the initial channel handshake.
12697  *
12698  * Default value: false.
12699  */
12700 bool ChannelConfig_get_announced_channel(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
12701
12702 /**
12703  * Set to announce the channel publicly and notify all nodes that they can route via this
12704  * channel.
12705  *
12706  * This should only be set to true for nodes which expect to be online reliably.
12707  *
12708  * As the node which funds a channel picks this value this will only apply for new outbound
12709  * channels unless [`ChannelHandshakeLimits::force_announced_channel_preference`] is set.
12710  *
12711  * This cannot be changed after the initial channel handshake.
12712  *
12713  * Default value: false.
12714  */
12715 void ChannelConfig_set_announced_channel(struct LDKChannelConfig *NONNULL_PTR this_ptr, bool val);
12716
12717 /**
12718  * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty
12719  * supports it, they will then enforce the mutual-close output to us matches what we provided
12720  * at intialization, preventing us from closing to an alternate pubkey.
12721  *
12722  * This is set to true by default to provide a slight increase in security, though ultimately
12723  * any attacker who is able to take control of a channel can just as easily send the funds via
12724  * lightning payments, so we never require that our counterparties support this option.
12725  *
12726  * This cannot be changed after a channel has been initialized.
12727  *
12728  * Default value: true.
12729  */
12730 bool ChannelConfig_get_commit_upfront_shutdown_pubkey(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
12731
12732 /**
12733  * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty
12734  * supports it, they will then enforce the mutual-close output to us matches what we provided
12735  * at intialization, preventing us from closing to an alternate pubkey.
12736  *
12737  * This is set to true by default to provide a slight increase in security, though ultimately
12738  * any attacker who is able to take control of a channel can just as easily send the funds via
12739  * lightning payments, so we never require that our counterparties support this option.
12740  *
12741  * This cannot be changed after a channel has been initialized.
12742  *
12743  * Default value: true.
12744  */
12745 void ChannelConfig_set_commit_upfront_shutdown_pubkey(struct LDKChannelConfig *NONNULL_PTR this_ptr, bool val);
12746
12747 /**
12748  * Limit our total exposure to in-flight HTLCs which are burned to fees as they are too
12749  * small to claim on-chain.
12750  *
12751  * When an HTLC present in one of our channels is below a \"dust\" threshold, the HTLC will
12752  * not be claimable on-chain, instead being turned into additional miner fees if either
12753  * party force-closes the channel. Because the threshold is per-HTLC, our total exposure
12754  * to such payments may be sustantial if there are many dust HTLCs present when the
12755  * channel is force-closed.
12756  *
12757  * This limit is applied for sent, forwarded, and received HTLCs and limits the total
12758  * exposure across all three types per-channel. Setting this too low may prevent the
12759  * sending or receipt of low-value HTLCs on high-traffic nodes, and this limit is very
12760  * important to prevent stealing of dust HTLCs by miners.
12761  *
12762  * Default value: 5_000_000 msat.
12763  */
12764 uint64_t ChannelConfig_get_max_dust_htlc_exposure_msat(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
12765
12766 /**
12767  * Limit our total exposure to in-flight HTLCs which are burned to fees as they are too
12768  * small to claim on-chain.
12769  *
12770  * When an HTLC present in one of our channels is below a \"dust\" threshold, the HTLC will
12771  * not be claimable on-chain, instead being turned into additional miner fees if either
12772  * party force-closes the channel. Because the threshold is per-HTLC, our total exposure
12773  * to such payments may be sustantial if there are many dust HTLCs present when the
12774  * channel is force-closed.
12775  *
12776  * This limit is applied for sent, forwarded, and received HTLCs and limits the total
12777  * exposure across all three types per-channel. Setting this too low may prevent the
12778  * sending or receipt of low-value HTLCs on high-traffic nodes, and this limit is very
12779  * important to prevent stealing of dust HTLCs by miners.
12780  *
12781  * Default value: 5_000_000 msat.
12782  */
12783 void ChannelConfig_set_max_dust_htlc_exposure_msat(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint64_t val);
12784
12785 /**
12786  * The additional fee we're willing to pay to avoid waiting for the counterparty's
12787  * `to_self_delay` to reclaim funds.
12788  *
12789  * When we close a channel cooperatively with our counterparty, we negotiate a fee for the
12790  * closing transaction which both sides find acceptable, ultimately paid by the channel
12791  * funder/initiator.
12792  *
12793  * When we are the funder, because we have to pay the channel closing fee, we bound the
12794  * acceptable fee by our [`Background`] and [`Normal`] fees, with the upper bound increased by
12795  * this value. Because the on-chain fee we'd pay to force-close the channel is kept near our
12796  * [`Normal`] feerate during normal operation, this value represents the additional fee we're
12797  * willing to pay in order to avoid waiting for our counterparty's to_self_delay to reclaim our
12798  * funds.
12799  *
12800  * When we are not the funder, we require the closing transaction fee pay at least our
12801  * [`Background`] fee estimate, but allow our counterparty to pay as much fee as they like.
12802  * Thus, this value is ignored when we are not the funder.
12803  *
12804  * Default value: 1000 satoshis.
12805  *
12806  * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
12807  * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
12808  */
12809 uint64_t ChannelConfig_get_force_close_avoidance_max_fee_satoshis(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
12810
12811 /**
12812  * The additional fee we're willing to pay to avoid waiting for the counterparty's
12813  * `to_self_delay` to reclaim funds.
12814  *
12815  * When we close a channel cooperatively with our counterparty, we negotiate a fee for the
12816  * closing transaction which both sides find acceptable, ultimately paid by the channel
12817  * funder/initiator.
12818  *
12819  * When we are the funder, because we have to pay the channel closing fee, we bound the
12820  * acceptable fee by our [`Background`] and [`Normal`] fees, with the upper bound increased by
12821  * this value. Because the on-chain fee we'd pay to force-close the channel is kept near our
12822  * [`Normal`] feerate during normal operation, this value represents the additional fee we're
12823  * willing to pay in order to avoid waiting for our counterparty's to_self_delay to reclaim our
12824  * funds.
12825  *
12826  * When we are not the funder, we require the closing transaction fee pay at least our
12827  * [`Background`] fee estimate, but allow our counterparty to pay as much fee as they like.
12828  * Thus, this value is ignored when we are not the funder.
12829  *
12830  * Default value: 1000 satoshis.
12831  *
12832  * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
12833  * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
12834  */
12835 void ChannelConfig_set_force_close_avoidance_max_fee_satoshis(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint64_t val);
12836
12837 /**
12838  * Constructs a new ChannelConfig given each field
12839  */
12840 MUST_USE_RES struct LDKChannelConfig ChannelConfig_new(uint32_t forwarding_fee_proportional_millionths_arg, uint32_t forwarding_fee_base_msat_arg, uint16_t cltv_expiry_delta_arg, bool announced_channel_arg, bool commit_upfront_shutdown_pubkey_arg, uint64_t max_dust_htlc_exposure_msat_arg, uint64_t force_close_avoidance_max_fee_satoshis_arg);
12841
12842 /**
12843  * Creates a copy of the ChannelConfig
12844  */
12845 struct LDKChannelConfig ChannelConfig_clone(const struct LDKChannelConfig *NONNULL_PTR orig);
12846
12847 /**
12848  * Creates a "default" ChannelConfig. See struct and individual field documentaiton for details on which values are used.
12849  */
12850 MUST_USE_RES struct LDKChannelConfig ChannelConfig_default(void);
12851
12852 /**
12853  * Serialize the ChannelConfig object into a byte array which can be read by ChannelConfig_read
12854  */
12855 struct LDKCVec_u8Z ChannelConfig_write(const struct LDKChannelConfig *NONNULL_PTR obj);
12856
12857 /**
12858  * Read a ChannelConfig from a byte array, created by ChannelConfig_write
12859  */
12860 struct LDKCResult_ChannelConfigDecodeErrorZ ChannelConfig_read(struct LDKu8slice ser);
12861
12862 /**
12863  * Frees any resources used by the UserConfig, if is_owned is set and inner is non-NULL.
12864  */
12865 void UserConfig_free(struct LDKUserConfig this_obj);
12866
12867 /**
12868  * Channel config that we propose to our counterparty.
12869  */
12870 struct LDKChannelHandshakeConfig UserConfig_get_own_channel_config(const struct LDKUserConfig *NONNULL_PTR this_ptr);
12871
12872 /**
12873  * Channel config that we propose to our counterparty.
12874  */
12875 void UserConfig_set_own_channel_config(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeConfig val);
12876
12877 /**
12878  * Limits applied to our counterparty's proposed channel config settings.
12879  */
12880 struct LDKChannelHandshakeLimits UserConfig_get_peer_channel_config_limits(const struct LDKUserConfig *NONNULL_PTR this_ptr);
12881
12882 /**
12883  * Limits applied to our counterparty's proposed channel config settings.
12884  */
12885 void UserConfig_set_peer_channel_config_limits(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeLimits val);
12886
12887 /**
12888  * Channel config which affects behavior during channel lifetime.
12889  */
12890 struct LDKChannelConfig UserConfig_get_channel_options(const struct LDKUserConfig *NONNULL_PTR this_ptr);
12891
12892 /**
12893  * Channel config which affects behavior during channel lifetime.
12894  */
12895 void UserConfig_set_channel_options(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelConfig val);
12896
12897 /**
12898  * If this is set to false, we will reject any HTLCs which were to be forwarded over private
12899  * channels. This prevents us from taking on HTLC-forwarding risk when we intend to run as a
12900  * node which is not online reliably.
12901  *
12902  * For nodes which are not online reliably, you should set all channels to *not* be announced
12903  * (using [`ChannelConfig::announced_channel`] and
12904  * [`ChannelHandshakeLimits::force_announced_channel_preference`]) and set this to false to
12905  * ensure you are not exposed to any forwarding risk.
12906  *
12907  * Note that because you cannot change a channel's announced state after creation, there is no
12908  * way to disable forwarding on public channels retroactively. Thus, in order to change a node
12909  * from a publicly-announced forwarding node to a private non-forwarding node you must close
12910  * all your channels and open new ones. For privacy, you should also change your node_id
12911  * (swapping all private and public key material for new ones) at that time.
12912  *
12913  * Default value: false.
12914  */
12915 bool UserConfig_get_accept_forwards_to_priv_channels(const struct LDKUserConfig *NONNULL_PTR this_ptr);
12916
12917 /**
12918  * If this is set to false, we will reject any HTLCs which were to be forwarded over private
12919  * channels. This prevents us from taking on HTLC-forwarding risk when we intend to run as a
12920  * node which is not online reliably.
12921  *
12922  * For nodes which are not online reliably, you should set all channels to *not* be announced
12923  * (using [`ChannelConfig::announced_channel`] and
12924  * [`ChannelHandshakeLimits::force_announced_channel_preference`]) and set this to false to
12925  * ensure you are not exposed to any forwarding risk.
12926  *
12927  * Note that because you cannot change a channel's announced state after creation, there is no
12928  * way to disable forwarding on public channels retroactively. Thus, in order to change a node
12929  * from a publicly-announced forwarding node to a private non-forwarding node you must close
12930  * all your channels and open new ones. For privacy, you should also change your node_id
12931  * (swapping all private and public key material for new ones) at that time.
12932  *
12933  * Default value: false.
12934  */
12935 void UserConfig_set_accept_forwards_to_priv_channels(struct LDKUserConfig *NONNULL_PTR this_ptr, bool val);
12936
12937 /**
12938  * Constructs a new UserConfig given each field
12939  */
12940 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, bool accept_forwards_to_priv_channels_arg);
12941
12942 /**
12943  * Creates a copy of the UserConfig
12944  */
12945 struct LDKUserConfig UserConfig_clone(const struct LDKUserConfig *NONNULL_PTR orig);
12946
12947 /**
12948  * Creates a "default" UserConfig. See struct and individual field documentaiton for details on which values are used.
12949  */
12950 MUST_USE_RES struct LDKUserConfig UserConfig_default(void);
12951
12952 /**
12953  * Frees any resources used by the BestBlock, if is_owned is set and inner is non-NULL.
12954  */
12955 void BestBlock_free(struct LDKBestBlock this_obj);
12956
12957 /**
12958  * Creates a copy of the BestBlock
12959  */
12960 struct LDKBestBlock BestBlock_clone(const struct LDKBestBlock *NONNULL_PTR orig);
12961
12962 /**
12963  * Constructs a `BestBlock` that represents the genesis block at height 0 of the given
12964  * network.
12965  */
12966 MUST_USE_RES struct LDKBestBlock BestBlock_from_genesis(enum LDKNetwork network);
12967
12968 /**
12969  * Returns a `BestBlock` as identified by the given block hash and height.
12970  */
12971 MUST_USE_RES struct LDKBestBlock BestBlock_new(struct LDKThirtyTwoBytes block_hash, uint32_t height);
12972
12973 /**
12974  * Returns the best block hash.
12975  */
12976 MUST_USE_RES struct LDKThirtyTwoBytes BestBlock_block_hash(const struct LDKBestBlock *NONNULL_PTR this_arg);
12977
12978 /**
12979  * Returns the best block height.
12980  */
12981 MUST_USE_RES uint32_t BestBlock_height(const struct LDKBestBlock *NONNULL_PTR this_arg);
12982
12983 /**
12984  * Creates a copy of the AccessError
12985  */
12986 enum LDKAccessError AccessError_clone(const enum LDKAccessError *NONNULL_PTR orig);
12987
12988 /**
12989  * Utility method to constructs a new UnknownChain-variant AccessError
12990  */
12991 enum LDKAccessError AccessError_unknown_chain(void);
12992
12993 /**
12994  * Utility method to constructs a new UnknownTx-variant AccessError
12995  */
12996 enum LDKAccessError AccessError_unknown_tx(void);
12997
12998 /**
12999  * Calls the free function if one is set
13000  */
13001 void Access_free(struct LDKAccess this_ptr);
13002
13003 /**
13004  * Calls the free function if one is set
13005  */
13006 void Listen_free(struct LDKListen this_ptr);
13007
13008 /**
13009  * Calls the free function if one is set
13010  */
13011 void Confirm_free(struct LDKConfirm this_ptr);
13012
13013 /**
13014  * Calls the free function if one is set
13015  */
13016 void Watch_free(struct LDKWatch this_ptr);
13017
13018 /**
13019  * Calls the free function if one is set
13020  */
13021 void Filter_free(struct LDKFilter this_ptr);
13022
13023 /**
13024  * Frees any resources used by the WatchedOutput, if is_owned is set and inner is non-NULL.
13025  */
13026 void WatchedOutput_free(struct LDKWatchedOutput this_obj);
13027
13028 /**
13029  * First block where the transaction output may have been spent.
13030  *
13031  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
13032  */
13033 struct LDKThirtyTwoBytes WatchedOutput_get_block_hash(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
13034
13035 /**
13036  * First block where the transaction output may have been spent.
13037  *
13038  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
13039  */
13040 void WatchedOutput_set_block_hash(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13041
13042 /**
13043  * Outpoint identifying the transaction output.
13044  */
13045 struct LDKOutPoint WatchedOutput_get_outpoint(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
13046
13047 /**
13048  * Outpoint identifying the transaction output.
13049  */
13050 void WatchedOutput_set_outpoint(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKOutPoint val);
13051
13052 /**
13053  * Spending condition of the transaction output.
13054  */
13055 struct LDKu8slice WatchedOutput_get_script_pubkey(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
13056
13057 /**
13058  * Spending condition of the transaction output.
13059  */
13060 void WatchedOutput_set_script_pubkey(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
13061
13062 /**
13063  * Constructs a new WatchedOutput given each field
13064  */
13065 MUST_USE_RES struct LDKWatchedOutput WatchedOutput_new(struct LDKThirtyTwoBytes block_hash_arg, struct LDKOutPoint outpoint_arg, struct LDKCVec_u8Z script_pubkey_arg);
13066
13067 /**
13068  * Creates a copy of the WatchedOutput
13069  */
13070 struct LDKWatchedOutput WatchedOutput_clone(const struct LDKWatchedOutput *NONNULL_PTR orig);
13071
13072 /**
13073  * Checks if two WatchedOutputs contain equal inner contents.
13074  */
13075 uint64_t WatchedOutput_hash(const struct LDKWatchedOutput *NONNULL_PTR o);
13076
13077 /**
13078  * Calls the free function if one is set
13079  */
13080 void BroadcasterInterface_free(struct LDKBroadcasterInterface this_ptr);
13081
13082 /**
13083  * Creates a copy of the ConfirmationTarget
13084  */
13085 enum LDKConfirmationTarget ConfirmationTarget_clone(const enum LDKConfirmationTarget *NONNULL_PTR orig);
13086
13087 /**
13088  * Utility method to constructs a new Background-variant ConfirmationTarget
13089  */
13090 enum LDKConfirmationTarget ConfirmationTarget_background(void);
13091
13092 /**
13093  * Utility method to constructs a new Normal-variant ConfirmationTarget
13094  */
13095 enum LDKConfirmationTarget ConfirmationTarget_normal(void);
13096
13097 /**
13098  * Utility method to constructs a new HighPriority-variant ConfirmationTarget
13099  */
13100 enum LDKConfirmationTarget ConfirmationTarget_high_priority(void);
13101
13102 /**
13103  * Checks if two ConfirmationTargets contain equal inner contents.
13104  * This ignores pointers and is_owned flags and looks at the values in fields.
13105  */
13106 bool ConfirmationTarget_eq(const enum LDKConfirmationTarget *NONNULL_PTR a, const enum LDKConfirmationTarget *NONNULL_PTR b);
13107
13108 /**
13109  * Calls the free function if one is set
13110  */
13111 void FeeEstimator_free(struct LDKFeeEstimator this_ptr);
13112
13113 /**
13114  * Frees any resources used by the ChainMonitor, if is_owned is set and inner is non-NULL.
13115  */
13116 void ChainMonitor_free(struct LDKChainMonitor this_obj);
13117
13118 /**
13119  * Creates a new `ChainMonitor` used to watch on-chain activity pertaining to channels.
13120  *
13121  * When an optional chain source implementing [`chain::Filter`] is provided, the chain monitor
13122  * will call back to it indicating transactions and outputs of interest. This allows clients to
13123  * pre-filter blocks or only fetch blocks matching a compact filter. Otherwise, clients may
13124  * always need to fetch full blocks absent another means for determining which blocks contain
13125  * transactions relevant to the watched channels.
13126  *
13127  * Note that chain_source (or a relevant inner pointer) may be NULL or all-0s to represent None
13128  */
13129 MUST_USE_RES struct LDKChainMonitor ChainMonitor_new(struct LDKFilter *chain_source, struct LDKBroadcasterInterface broadcaster, struct LDKLogger logger, struct LDKFeeEstimator feeest, struct LDKPersist persister);
13130
13131 /**
13132  * Constructs a new Listen which calls the relevant methods on this_arg.
13133  * This copies the `inner` pointer in this_arg and thus the returned Listen must be freed before this_arg is
13134  */
13135 struct LDKListen ChainMonitor_as_Listen(const struct LDKChainMonitor *NONNULL_PTR this_arg);
13136
13137 /**
13138  * Constructs a new Confirm which calls the relevant methods on this_arg.
13139  * This copies the `inner` pointer in this_arg and thus the returned Confirm must be freed before this_arg is
13140  */
13141 struct LDKConfirm ChainMonitor_as_Confirm(const struct LDKChainMonitor *NONNULL_PTR this_arg);
13142
13143 /**
13144  * Constructs a new Watch which calls the relevant methods on this_arg.
13145  * This copies the `inner` pointer in this_arg and thus the returned Watch must be freed before this_arg is
13146  */
13147 struct LDKWatch ChainMonitor_as_Watch(const struct LDKChainMonitor *NONNULL_PTR this_arg);
13148
13149 /**
13150  * Constructs a new EventsProvider which calls the relevant methods on this_arg.
13151  * This copies the `inner` pointer in this_arg and thus the returned EventsProvider must be freed before this_arg is
13152  */
13153 struct LDKEventsProvider ChainMonitor_as_EventsProvider(const struct LDKChainMonitor *NONNULL_PTR this_arg);
13154
13155 /**
13156  * Frees any resources used by the ChannelMonitorUpdate, if is_owned is set and inner is non-NULL.
13157  */
13158 void ChannelMonitorUpdate_free(struct LDKChannelMonitorUpdate this_obj);
13159
13160 /**
13161  * The sequence number of this update. Updates *must* be replayed in-order according to this
13162  * sequence number (and updates may panic if they are not). The update_id values are strictly
13163  * increasing and increase by one for each new update, with one exception specified below.
13164  *
13165  * This sequence number is also used to track up to which points updates which returned
13166  * ChannelMonitorUpdateErr::TemporaryFailure have been applied to all copies of a given
13167  * ChannelMonitor when ChannelManager::channel_monitor_updated is called.
13168  *
13169  * The only instance where update_id values are not strictly increasing is the case where we
13170  * allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See
13171  * its docs for more details.
13172  */
13173 uint64_t ChannelMonitorUpdate_get_update_id(const struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr);
13174
13175 /**
13176  * The sequence number of this update. Updates *must* be replayed in-order according to this
13177  * sequence number (and updates may panic if they are not). The update_id values are strictly
13178  * increasing and increase by one for each new update, with one exception specified below.
13179  *
13180  * This sequence number is also used to track up to which points updates which returned
13181  * ChannelMonitorUpdateErr::TemporaryFailure have been applied to all copies of a given
13182  * ChannelMonitor when ChannelManager::channel_monitor_updated is called.
13183  *
13184  * The only instance where update_id values are not strictly increasing is the case where we
13185  * allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See
13186  * its docs for more details.
13187  */
13188 void ChannelMonitorUpdate_set_update_id(struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr, uint64_t val);
13189
13190 /**
13191  * Creates a copy of the ChannelMonitorUpdate
13192  */
13193 struct LDKChannelMonitorUpdate ChannelMonitorUpdate_clone(const struct LDKChannelMonitorUpdate *NONNULL_PTR orig);
13194
13195 /**
13196  * Serialize the ChannelMonitorUpdate object into a byte array which can be read by ChannelMonitorUpdate_read
13197  */
13198 struct LDKCVec_u8Z ChannelMonitorUpdate_write(const struct LDKChannelMonitorUpdate *NONNULL_PTR obj);
13199
13200 /**
13201  * Read a ChannelMonitorUpdate from a byte array, created by ChannelMonitorUpdate_write
13202  */
13203 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ ChannelMonitorUpdate_read(struct LDKu8slice ser);
13204
13205 /**
13206  * Creates a copy of the ChannelMonitorUpdateErr
13207  */
13208 enum LDKChannelMonitorUpdateErr ChannelMonitorUpdateErr_clone(const enum LDKChannelMonitorUpdateErr *NONNULL_PTR orig);
13209
13210 /**
13211  * Utility method to constructs a new TemporaryFailure-variant ChannelMonitorUpdateErr
13212  */
13213 enum LDKChannelMonitorUpdateErr ChannelMonitorUpdateErr_temporary_failure(void);
13214
13215 /**
13216  * Utility method to constructs a new PermanentFailure-variant ChannelMonitorUpdateErr
13217  */
13218 enum LDKChannelMonitorUpdateErr ChannelMonitorUpdateErr_permanent_failure(void);
13219
13220 /**
13221  * Frees any resources used by the MonitorUpdateError, if is_owned is set and inner is non-NULL.
13222  */
13223 void MonitorUpdateError_free(struct LDKMonitorUpdateError this_obj);
13224
13225 /**
13226  * Creates a copy of the MonitorUpdateError
13227  */
13228 struct LDKMonitorUpdateError MonitorUpdateError_clone(const struct LDKMonitorUpdateError *NONNULL_PTR orig);
13229
13230 /**
13231  * Frees any resources used by the MonitorEvent
13232  */
13233 void MonitorEvent_free(struct LDKMonitorEvent this_ptr);
13234
13235 /**
13236  * Creates a copy of the MonitorEvent
13237  */
13238 struct LDKMonitorEvent MonitorEvent_clone(const struct LDKMonitorEvent *NONNULL_PTR orig);
13239
13240 /**
13241  * Utility method to constructs a new HTLCEvent-variant MonitorEvent
13242  */
13243 struct LDKMonitorEvent MonitorEvent_htlcevent(struct LDKHTLCUpdate a);
13244
13245 /**
13246  * Utility method to constructs a new CommitmentTxBroadcasted-variant MonitorEvent
13247  */
13248 struct LDKMonitorEvent MonitorEvent_commitment_tx_broadcasted(struct LDKOutPoint a);
13249
13250 /**
13251  * Frees any resources used by the HTLCUpdate, if is_owned is set and inner is non-NULL.
13252  */
13253 void HTLCUpdate_free(struct LDKHTLCUpdate this_obj);
13254
13255 /**
13256  * Creates a copy of the HTLCUpdate
13257  */
13258 struct LDKHTLCUpdate HTLCUpdate_clone(const struct LDKHTLCUpdate *NONNULL_PTR orig);
13259
13260 /**
13261  * Serialize the HTLCUpdate object into a byte array which can be read by HTLCUpdate_read
13262  */
13263 struct LDKCVec_u8Z HTLCUpdate_write(const struct LDKHTLCUpdate *NONNULL_PTR obj);
13264
13265 /**
13266  * Read a HTLCUpdate from a byte array, created by HTLCUpdate_write
13267  */
13268 struct LDKCResult_HTLCUpdateDecodeErrorZ HTLCUpdate_read(struct LDKu8slice ser);
13269
13270 /**
13271  * Frees any resources used by the ChannelMonitor, if is_owned is set and inner is non-NULL.
13272  */
13273 void ChannelMonitor_free(struct LDKChannelMonitor this_obj);
13274
13275 /**
13276  * Serialize the ChannelMonitor object into a byte array which can be read by ChannelMonitor_read
13277  */
13278 struct LDKCVec_u8Z ChannelMonitor_write(const struct LDKChannelMonitor *NONNULL_PTR obj);
13279
13280 /**
13281  * Updates a ChannelMonitor on the basis of some new information provided by the Channel
13282  * itself.
13283  *
13284  * panics if the given update is not the next update by update_id.
13285  */
13286 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);
13287
13288 /**
13289  * Gets the update_id from the latest ChannelMonitorUpdate which was applied to this
13290  * ChannelMonitor.
13291  */
13292 MUST_USE_RES uint64_t ChannelMonitor_get_latest_update_id(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
13293
13294 /**
13295  * Gets the funding transaction outpoint of the channel this ChannelMonitor is monitoring for.
13296  */
13297 MUST_USE_RES struct LDKC2Tuple_OutPointScriptZ ChannelMonitor_get_funding_txo(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
13298
13299 /**
13300  * Gets a list of txids, with their output scripts (in the order they appear in the
13301  * transaction), which we must learn about spends of via block_connected().
13302  */
13303 MUST_USE_RES struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ChannelMonitor_get_outputs_to_watch(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
13304
13305 /**
13306  * Loads the funding txo and outputs to watch into the given `chain::Filter` by repeatedly
13307  * calling `chain::Filter::register_output` and `chain::Filter::register_tx` until all outputs
13308  * have been registered.
13309  */
13310 void ChannelMonitor_load_outputs_to_watch(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKFilter *NONNULL_PTR filter);
13311
13312 /**
13313  * Get the list of HTLCs who's status has been updated on chain. This should be called by
13314  * ChannelManager via [`chain::Watch::release_pending_monitor_events`].
13315  */
13316 MUST_USE_RES struct LDKCVec_MonitorEventZ ChannelMonitor_get_and_clear_pending_monitor_events(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
13317
13318 /**
13319  * Gets the list of pending events which were generated by previous actions, clearing the list
13320  * in the process.
13321  *
13322  * This is called by ChainMonitor::get_and_clear_pending_events() and is equivalent to
13323  * EventsProvider::get_and_clear_pending_events() except that it requires &mut self as we do
13324  * no internal locking in ChannelMonitors.
13325  */
13326 MUST_USE_RES struct LDKCVec_EventZ ChannelMonitor_get_and_clear_pending_events(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
13327
13328 /**
13329  * Used by ChannelManager deserialization to broadcast the latest holder state if its copy of
13330  * the Channel was out-of-date. You may use it to get a broadcastable holder toxic tx in case of
13331  * fallen-behind, i.e when receiving a channel_reestablish with a proof that our counterparty side knows
13332  * a higher revocation secret than the holder commitment number we are aware of. Broadcasting these
13333  * transactions are UNSAFE, as they allow counterparty side to punish you. Nevertheless you may want to
13334  * broadcast them if counterparty don't close channel with his higher commitment transaction after a
13335  * substantial amount of time (a month or even a year) to get back funds. Best may be to contact
13336  * out-of-band the other node operator to coordinate with him if option is available to you.
13337  * In any-case, choice is up to the user.
13338  */
13339 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);
13340
13341 /**
13342  * Processes transactions in a newly connected block, which may result in any of the following:
13343  * - update the monitor's state against resolved HTLCs
13344  * - punish the counterparty in the case of seeing a revoked commitment transaction
13345  * - force close the channel and claim/timeout incoming/outgoing HTLCs if near expiration
13346  * - detect settled outputs for later spending
13347  * - schedule and bump any in-flight claims
13348  *
13349  * Returns any new outputs to watch from `txdata`; after called, these are also included in
13350  * [`get_outputs_to_watch`].
13351  *
13352  * [`get_outputs_to_watch`]: #method.get_outputs_to_watch
13353  */
13354 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);
13355
13356 /**
13357  * Determines if the disconnected block contained any transactions of interest and updates
13358  * appropriately.
13359  */
13360 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);
13361
13362 /**
13363  * Processes transactions confirmed in a block with the given header and height, returning new
13364  * outputs to watch. See [`block_connected`] for details.
13365  *
13366  * Used instead of [`block_connected`] by clients that are notified of transactions rather than
13367  * blocks. See [`chain::Confirm`] for calling expectations.
13368  *
13369  * [`block_connected`]: Self::block_connected
13370  */
13371 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);
13372
13373 /**
13374  * Processes a transaction that was reorganized out of the chain.
13375  *
13376  * Used instead of [`block_disconnected`] by clients that are notified of transactions rather
13377  * than blocks. See [`chain::Confirm`] for calling expectations.
13378  *
13379  * [`block_disconnected`]: Self::block_disconnected
13380  */
13381 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);
13382
13383 /**
13384  * Updates the monitor with the current best chain tip, returning new outputs to watch. See
13385  * [`block_connected`] for details.
13386  *
13387  * Used instead of [`block_connected`] by clients that are notified of transactions rather than
13388  * blocks. See [`chain::Confirm`] for calling expectations.
13389  *
13390  * [`block_connected`]: Self::block_connected
13391  */
13392 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);
13393
13394 /**
13395  * Returns the set of txids that should be monitored for re-organization out of the chain.
13396  */
13397 MUST_USE_RES struct LDKCVec_TxidZ ChannelMonitor_get_relevant_txids(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
13398
13399 /**
13400  * Gets the latest best block which was connected either via the [`chain::Listen`] or
13401  * [`chain::Confirm`] interfaces.
13402  */
13403 MUST_USE_RES struct LDKBestBlock ChannelMonitor_current_best_block(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
13404
13405 /**
13406  * Calls the free function if one is set
13407  */
13408 void Persist_free(struct LDKPersist this_ptr);
13409
13410 /**
13411  * Read a C2Tuple_BlockHashChannelMonitorZ from a byte array, created by C2Tuple_BlockHashChannelMonitorZ_write
13412  */
13413 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ C2Tuple_BlockHashChannelMonitorZ_read(struct LDKu8slice ser, const struct LDKKeysInterface *NONNULL_PTR arg);
13414
13415 /**
13416  * Frees any resources used by the OutPoint, if is_owned is set and inner is non-NULL.
13417  */
13418 void OutPoint_free(struct LDKOutPoint this_obj);
13419
13420 /**
13421  * The referenced transaction's txid.
13422  */
13423 const uint8_t (*OutPoint_get_txid(const struct LDKOutPoint *NONNULL_PTR this_ptr))[32];
13424
13425 /**
13426  * The referenced transaction's txid.
13427  */
13428 void OutPoint_set_txid(struct LDKOutPoint *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13429
13430 /**
13431  * The index of the referenced output in its transaction's vout.
13432  */
13433 uint16_t OutPoint_get_index(const struct LDKOutPoint *NONNULL_PTR this_ptr);
13434
13435 /**
13436  * The index of the referenced output in its transaction's vout.
13437  */
13438 void OutPoint_set_index(struct LDKOutPoint *NONNULL_PTR this_ptr, uint16_t val);
13439
13440 /**
13441  * Constructs a new OutPoint given each field
13442  */
13443 MUST_USE_RES struct LDKOutPoint OutPoint_new(struct LDKThirtyTwoBytes txid_arg, uint16_t index_arg);
13444
13445 /**
13446  * Creates a copy of the OutPoint
13447  */
13448 struct LDKOutPoint OutPoint_clone(const struct LDKOutPoint *NONNULL_PTR orig);
13449
13450 /**
13451  * Checks if two OutPoints contain equal inner contents.
13452  * This ignores pointers and is_owned flags and looks at the values in fields.
13453  * Two objects with NULL inner values will be considered "equal" here.
13454  */
13455 bool OutPoint_eq(const struct LDKOutPoint *NONNULL_PTR a, const struct LDKOutPoint *NONNULL_PTR b);
13456
13457 /**
13458  * Checks if two OutPoints contain equal inner contents.
13459  */
13460 uint64_t OutPoint_hash(const struct LDKOutPoint *NONNULL_PTR o);
13461
13462 /**
13463  * Convert an `OutPoint` to a lightning channel id.
13464  */
13465 MUST_USE_RES struct LDKThirtyTwoBytes OutPoint_to_channel_id(const struct LDKOutPoint *NONNULL_PTR this_arg);
13466
13467 /**
13468  * Serialize the OutPoint object into a byte array which can be read by OutPoint_read
13469  */
13470 struct LDKCVec_u8Z OutPoint_write(const struct LDKOutPoint *NONNULL_PTR obj);
13471
13472 /**
13473  * Read a OutPoint from a byte array, created by OutPoint_write
13474  */
13475 struct LDKCResult_OutPointDecodeErrorZ OutPoint_read(struct LDKu8slice ser);
13476
13477 /**
13478  * Frees any resources used by the DelayedPaymentOutputDescriptor, if is_owned is set and inner is non-NULL.
13479  */
13480 void DelayedPaymentOutputDescriptor_free(struct LDKDelayedPaymentOutputDescriptor this_obj);
13481
13482 /**
13483  * The outpoint which is spendable
13484  */
13485 struct LDKOutPoint DelayedPaymentOutputDescriptor_get_outpoint(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
13486
13487 /**
13488  * The outpoint which is spendable
13489  */
13490 void DelayedPaymentOutputDescriptor_set_outpoint(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKOutPoint val);
13491
13492 /**
13493  * Per commitment point to derive delayed_payment_key by key holder
13494  */
13495 struct LDKPublicKey DelayedPaymentOutputDescriptor_get_per_commitment_point(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
13496
13497 /**
13498  * Per commitment point to derive delayed_payment_key by key holder
13499  */
13500 void DelayedPaymentOutputDescriptor_set_per_commitment_point(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val);
13501
13502 /**
13503  * The nSequence value which must be set in the spending input to satisfy the OP_CSV in
13504  * the witness_script.
13505  */
13506 uint16_t DelayedPaymentOutputDescriptor_get_to_self_delay(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
13507
13508 /**
13509  * The nSequence value which must be set in the spending input to satisfy the OP_CSV in
13510  * the witness_script.
13511  */
13512 void DelayedPaymentOutputDescriptor_set_to_self_delay(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint16_t val);
13513
13514 /**
13515  * The output which is referenced by the given outpoint
13516  */
13517 void DelayedPaymentOutputDescriptor_set_output(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKTxOut val);
13518
13519 /**
13520  * The revocation point specific to the commitment transaction which was broadcast. Used to
13521  * derive the witnessScript for this output.
13522  */
13523 struct LDKPublicKey DelayedPaymentOutputDescriptor_get_revocation_pubkey(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
13524
13525 /**
13526  * The revocation point specific to the commitment transaction which was broadcast. Used to
13527  * derive the witnessScript for this output.
13528  */
13529 void DelayedPaymentOutputDescriptor_set_revocation_pubkey(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val);
13530
13531 /**
13532  * Arbitrary identification information returned by a call to
13533  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
13534  * the channel to spend the output.
13535  */
13536 const uint8_t (*DelayedPaymentOutputDescriptor_get_channel_keys_id(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr))[32];
13537
13538 /**
13539  * Arbitrary identification information returned by a call to
13540  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
13541  * the channel to spend the output.
13542  */
13543 void DelayedPaymentOutputDescriptor_set_channel_keys_id(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13544
13545 /**
13546  * The value of the channel which this output originated from, possibly indirectly.
13547  */
13548 uint64_t DelayedPaymentOutputDescriptor_get_channel_value_satoshis(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
13549
13550 /**
13551  * The value of the channel which this output originated from, possibly indirectly.
13552  */
13553 void DelayedPaymentOutputDescriptor_set_channel_value_satoshis(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint64_t val);
13554
13555 /**
13556  * Constructs a new DelayedPaymentOutputDescriptor given each field
13557  */
13558 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);
13559
13560 /**
13561  * Creates a copy of the DelayedPaymentOutputDescriptor
13562  */
13563 struct LDKDelayedPaymentOutputDescriptor DelayedPaymentOutputDescriptor_clone(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR orig);
13564
13565 /**
13566  * Serialize the DelayedPaymentOutputDescriptor object into a byte array which can be read by DelayedPaymentOutputDescriptor_read
13567  */
13568 struct LDKCVec_u8Z DelayedPaymentOutputDescriptor_write(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR obj);
13569
13570 /**
13571  * Read a DelayedPaymentOutputDescriptor from a byte array, created by DelayedPaymentOutputDescriptor_write
13572  */
13573 struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ DelayedPaymentOutputDescriptor_read(struct LDKu8slice ser);
13574
13575 /**
13576  * Frees any resources used by the StaticPaymentOutputDescriptor, if is_owned is set and inner is non-NULL.
13577  */
13578 void StaticPaymentOutputDescriptor_free(struct LDKStaticPaymentOutputDescriptor this_obj);
13579
13580 /**
13581  * The outpoint which is spendable
13582  */
13583 struct LDKOutPoint StaticPaymentOutputDescriptor_get_outpoint(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr);
13584
13585 /**
13586  * The outpoint which is spendable
13587  */
13588 void StaticPaymentOutputDescriptor_set_outpoint(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKOutPoint val);
13589
13590 /**
13591  * The output which is referenced by the given outpoint
13592  */
13593 void StaticPaymentOutputDescriptor_set_output(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKTxOut val);
13594
13595 /**
13596  * Arbitrary identification information returned by a call to
13597  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
13598  * the channel to spend the output.
13599  */
13600 const uint8_t (*StaticPaymentOutputDescriptor_get_channel_keys_id(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr))[32];
13601
13602 /**
13603  * Arbitrary identification information returned by a call to
13604  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
13605  * the channel to spend the output.
13606  */
13607 void StaticPaymentOutputDescriptor_set_channel_keys_id(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13608
13609 /**
13610  * The value of the channel which this transactions spends.
13611  */
13612 uint64_t StaticPaymentOutputDescriptor_get_channel_value_satoshis(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr);
13613
13614 /**
13615  * The value of the channel which this transactions spends.
13616  */
13617 void StaticPaymentOutputDescriptor_set_channel_value_satoshis(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint64_t val);
13618
13619 /**
13620  * Constructs a new StaticPaymentOutputDescriptor given each field
13621  */
13622 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);
13623
13624 /**
13625  * Creates a copy of the StaticPaymentOutputDescriptor
13626  */
13627 struct LDKStaticPaymentOutputDescriptor StaticPaymentOutputDescriptor_clone(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR orig);
13628
13629 /**
13630  * Serialize the StaticPaymentOutputDescriptor object into a byte array which can be read by StaticPaymentOutputDescriptor_read
13631  */
13632 struct LDKCVec_u8Z StaticPaymentOutputDescriptor_write(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR obj);
13633
13634 /**
13635  * Read a StaticPaymentOutputDescriptor from a byte array, created by StaticPaymentOutputDescriptor_write
13636  */
13637 struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ StaticPaymentOutputDescriptor_read(struct LDKu8slice ser);
13638
13639 /**
13640  * Frees any resources used by the SpendableOutputDescriptor
13641  */
13642 void SpendableOutputDescriptor_free(struct LDKSpendableOutputDescriptor this_ptr);
13643
13644 /**
13645  * Creates a copy of the SpendableOutputDescriptor
13646  */
13647 struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_clone(const struct LDKSpendableOutputDescriptor *NONNULL_PTR orig);
13648
13649 /**
13650  * Utility method to constructs a new StaticOutput-variant SpendableOutputDescriptor
13651  */
13652 struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_static_output(struct LDKOutPoint outpoint, struct LDKTxOut output);
13653
13654 /**
13655  * Utility method to constructs a new DelayedPaymentOutput-variant SpendableOutputDescriptor
13656  */
13657 struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_delayed_payment_output(struct LDKDelayedPaymentOutputDescriptor a);
13658
13659 /**
13660  * Utility method to constructs a new StaticPaymentOutput-variant SpendableOutputDescriptor
13661  */
13662 struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_static_payment_output(struct LDKStaticPaymentOutputDescriptor a);
13663
13664 /**
13665  * Serialize the SpendableOutputDescriptor object into a byte array which can be read by SpendableOutputDescriptor_read
13666  */
13667 struct LDKCVec_u8Z SpendableOutputDescriptor_write(const struct LDKSpendableOutputDescriptor *NONNULL_PTR obj);
13668
13669 /**
13670  * Read a SpendableOutputDescriptor from a byte array, created by SpendableOutputDescriptor_write
13671  */
13672 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ SpendableOutputDescriptor_read(struct LDKu8slice ser);
13673
13674 /**
13675  * Calls the free function if one is set
13676  */
13677 void BaseSign_free(struct LDKBaseSign this_ptr);
13678
13679 /**
13680  * Creates a copy of a Sign
13681  */
13682 struct LDKSign Sign_clone(const struct LDKSign *NONNULL_PTR orig);
13683
13684 /**
13685  * Calls the free function if one is set
13686  */
13687 void Sign_free(struct LDKSign this_ptr);
13688
13689 /**
13690  * Calls the free function if one is set
13691  */
13692 void KeysInterface_free(struct LDKKeysInterface this_ptr);
13693
13694 /**
13695  * Frees any resources used by the InMemorySigner, if is_owned is set and inner is non-NULL.
13696  */
13697 void InMemorySigner_free(struct LDKInMemorySigner this_obj);
13698
13699 /**
13700  * Private key of anchor tx
13701  */
13702 const uint8_t (*InMemorySigner_get_funding_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
13703
13704 /**
13705  * Private key of anchor tx
13706  */
13707 void InMemorySigner_set_funding_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
13708
13709 /**
13710  * Holder secret key for blinded revocation pubkey
13711  */
13712 const uint8_t (*InMemorySigner_get_revocation_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
13713
13714 /**
13715  * Holder secret key for blinded revocation pubkey
13716  */
13717 void InMemorySigner_set_revocation_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
13718
13719 /**
13720  * Holder secret key used for our balance in counterparty-broadcasted commitment transactions
13721  */
13722 const uint8_t (*InMemorySigner_get_payment_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
13723
13724 /**
13725  * Holder secret key used for our balance in counterparty-broadcasted commitment transactions
13726  */
13727 void InMemorySigner_set_payment_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
13728
13729 /**
13730  * Holder secret key used in HTLC tx
13731  */
13732 const uint8_t (*InMemorySigner_get_delayed_payment_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
13733
13734 /**
13735  * Holder secret key used in HTLC tx
13736  */
13737 void InMemorySigner_set_delayed_payment_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
13738
13739 /**
13740  * Holder htlc secret key used in commitment tx htlc outputs
13741  */
13742 const uint8_t (*InMemorySigner_get_htlc_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
13743
13744 /**
13745  * Holder htlc secret key used in commitment tx htlc outputs
13746  */
13747 void InMemorySigner_set_htlc_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
13748
13749 /**
13750  * Commitment seed
13751  */
13752 const uint8_t (*InMemorySigner_get_commitment_seed(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
13753
13754 /**
13755  * Commitment seed
13756  */
13757 void InMemorySigner_set_commitment_seed(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13758
13759 /**
13760  * Creates a copy of the InMemorySigner
13761  */
13762 struct LDKInMemorySigner InMemorySigner_clone(const struct LDKInMemorySigner *NONNULL_PTR orig);
13763
13764 /**
13765  * Create a new InMemorySigner
13766  */
13767 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);
13768
13769 /**
13770  * Counterparty pubkeys.
13771  * Will panic if ready_channel wasn't called.
13772  */
13773 MUST_USE_RES struct LDKChannelPublicKeys InMemorySigner_counterparty_pubkeys(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
13774
13775 /**
13776  * The contest_delay value specified by our counterparty and applied on holder-broadcastable
13777  * transactions, ie the amount of time that we have to wait to recover our funds if we
13778  * broadcast a transaction.
13779  * Will panic if ready_channel wasn't called.
13780  */
13781 MUST_USE_RES uint16_t InMemorySigner_counterparty_selected_contest_delay(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
13782
13783 /**
13784  * The contest_delay value specified by us and applied on transactions broadcastable
13785  * by our counterparty, ie the amount of time that they have to wait to recover their funds
13786  * if they broadcast a transaction.
13787  * Will panic if ready_channel wasn't called.
13788  */
13789 MUST_USE_RES uint16_t InMemorySigner_holder_selected_contest_delay(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
13790
13791 /**
13792  * Whether the holder is the initiator
13793  * Will panic if ready_channel wasn't called.
13794  */
13795 MUST_USE_RES bool InMemorySigner_is_outbound(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
13796
13797 /**
13798  * Funding outpoint
13799  * Will panic if ready_channel wasn't called.
13800  */
13801 MUST_USE_RES struct LDKOutPoint InMemorySigner_funding_outpoint(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
13802
13803 /**
13804  * Obtain a ChannelTransactionParameters for this channel, to be used when verifying or
13805  * building transactions.
13806  *
13807  * Will panic if ready_channel wasn't called.
13808  */
13809 MUST_USE_RES struct LDKChannelTransactionParameters InMemorySigner_get_channel_parameters(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
13810
13811 /**
13812  * Sign the single input of spend_tx at index `input_idx` which spends the output
13813  * described by descriptor, returning the witness stack for the input.
13814  *
13815  * Returns an Err if the input at input_idx does not exist, has a non-empty script_sig,
13816  * or is not spending the outpoint described by `descriptor.outpoint`.
13817  */
13818 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);
13819
13820 /**
13821  * Sign the single input of spend_tx at index `input_idx` which spends the output
13822  * described by descriptor, returning the witness stack for the input.
13823  *
13824  * Returns an Err if the input at input_idx does not exist, has a non-empty script_sig,
13825  * is not spending the outpoint described by `descriptor.outpoint`, or does not have a
13826  * sequence set to `descriptor.to_self_delay`.
13827  */
13828 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);
13829
13830 /**
13831  * Constructs a new BaseSign which calls the relevant methods on this_arg.
13832  * This copies the `inner` pointer in this_arg and thus the returned BaseSign must be freed before this_arg is
13833  */
13834 struct LDKBaseSign InMemorySigner_as_BaseSign(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
13835
13836 /**
13837  * Constructs a new Sign which calls the relevant methods on this_arg.
13838  * This copies the `inner` pointer in this_arg and thus the returned Sign must be freed before this_arg is
13839  */
13840 struct LDKSign InMemorySigner_as_Sign(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
13841
13842 /**
13843  * Serialize the InMemorySigner object into a byte array which can be read by InMemorySigner_read
13844  */
13845 struct LDKCVec_u8Z InMemorySigner_write(const struct LDKInMemorySigner *NONNULL_PTR obj);
13846
13847 /**
13848  * Read a InMemorySigner from a byte array, created by InMemorySigner_write
13849  */
13850 struct LDKCResult_InMemorySignerDecodeErrorZ InMemorySigner_read(struct LDKu8slice ser);
13851
13852 /**
13853  * Frees any resources used by the KeysManager, if is_owned is set and inner is non-NULL.
13854  */
13855 void KeysManager_free(struct LDKKeysManager this_obj);
13856
13857 /**
13858  * Constructs a KeysManager from a 32-byte seed. If the seed is in some way biased (eg your
13859  * CSRNG is busted) this may panic (but more importantly, you will possibly lose funds).
13860  * starting_time isn't strictly required to actually be a time, but it must absolutely,
13861  * without a doubt, be unique to this instance. ie if you start multiple times with the same
13862  * seed, starting_time must be unique to each run. Thus, the easiest way to achieve this is to
13863  * simply use the current time (with very high precision).
13864  *
13865  * The seed MUST be backed up safely prior to use so that the keys can be re-created, however,
13866  * obviously, starting_time should be unique every time you reload the library - it is only
13867  * used to generate new ephemeral key data (which will be stored by the individual channel if
13868  * necessary).
13869  *
13870  * Note that the seed is required to recover certain on-chain funds independent of
13871  * ChannelMonitor data, though a current copy of ChannelMonitor data is also required for any
13872  * channel, and some on-chain during-closing funds.
13873  *
13874  * Note that until the 0.1 release there is no guarantee of backward compatibility between
13875  * versions. Once the library is more fully supported, the docs will be updated to include a
13876  * detailed description of the guarantee.
13877  */
13878 MUST_USE_RES struct LDKKeysManager KeysManager_new(const uint8_t (*seed)[32], uint64_t starting_time_secs, uint32_t starting_time_nanos);
13879
13880 /**
13881  * Derive an old Sign containing per-channel secrets based on a key derivation parameters.
13882  *
13883  * Key derivation parameters are accessible through a per-channel secrets
13884  * Sign::channel_keys_id and is provided inside DynamicOuputP2WSH in case of
13885  * onchain output detection for which a corresponding delayed_payment_key must be derived.
13886  */
13887 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]);
13888
13889 /**
13890  * Creates a Transaction which spends the given descriptors to the given outputs, plus an
13891  * output to the given change destination (if sufficient change value remains). The
13892  * transaction will have a feerate, at least, of the given value.
13893  *
13894  * Returns `Err(())` if the output value is greater than the input value minus required fee or
13895  * if a descriptor was duplicated.
13896  *
13897  * We do not enforce that outputs meet the dust limit or that any output scripts are standard.
13898  *
13899  * May panic if the `SpendableOutputDescriptor`s were not generated by Channels which used
13900  * this KeysManager or one of the `InMemorySigner` created by this KeysManager.
13901  */
13902 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);
13903
13904 /**
13905  * Constructs a new KeysInterface which calls the relevant methods on this_arg.
13906  * This copies the `inner` pointer in this_arg and thus the returned KeysInterface must be freed before this_arg is
13907  */
13908 struct LDKKeysInterface KeysManager_as_KeysInterface(const struct LDKKeysManager *NONNULL_PTR this_arg);
13909
13910 /**
13911  * Frees any resources used by the ChannelManager, if is_owned is set and inner is non-NULL.
13912  */
13913 void ChannelManager_free(struct LDKChannelManager this_obj);
13914
13915 /**
13916  * Frees any resources used by the ChainParameters, if is_owned is set and inner is non-NULL.
13917  */
13918 void ChainParameters_free(struct LDKChainParameters this_obj);
13919
13920 /**
13921  * The network for determining the `chain_hash` in Lightning messages.
13922  */
13923 enum LDKNetwork ChainParameters_get_network(const struct LDKChainParameters *NONNULL_PTR this_ptr);
13924
13925 /**
13926  * The network for determining the `chain_hash` in Lightning messages.
13927  */
13928 void ChainParameters_set_network(struct LDKChainParameters *NONNULL_PTR this_ptr, enum LDKNetwork val);
13929
13930 /**
13931  * The hash and height of the latest block successfully connected.
13932  *
13933  * Used to track on-chain channel funding outputs and send payments with reliable timelocks.
13934  */
13935 struct LDKBestBlock ChainParameters_get_best_block(const struct LDKChainParameters *NONNULL_PTR this_ptr);
13936
13937 /**
13938  * The hash and height of the latest block successfully connected.
13939  *
13940  * Used to track on-chain channel funding outputs and send payments with reliable timelocks.
13941  */
13942 void ChainParameters_set_best_block(struct LDKChainParameters *NONNULL_PTR this_ptr, struct LDKBestBlock val);
13943
13944 /**
13945  * Constructs a new ChainParameters given each field
13946  */
13947 MUST_USE_RES struct LDKChainParameters ChainParameters_new(enum LDKNetwork network_arg, struct LDKBestBlock best_block_arg);
13948
13949 /**
13950  * Creates a copy of the ChainParameters
13951  */
13952 struct LDKChainParameters ChainParameters_clone(const struct LDKChainParameters *NONNULL_PTR orig);
13953
13954 /**
13955  * Frees any resources used by the ChannelCounterparty, if is_owned is set and inner is non-NULL.
13956  */
13957 void ChannelCounterparty_free(struct LDKChannelCounterparty this_obj);
13958
13959 /**
13960  * The node_id of our counterparty
13961  */
13962 struct LDKPublicKey ChannelCounterparty_get_node_id(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
13963
13964 /**
13965  * The node_id of our counterparty
13966  */
13967 void ChannelCounterparty_set_node_id(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKPublicKey val);
13968
13969 /**
13970  * The Features the channel counterparty provided upon last connection.
13971  * Useful for routing as it is the most up-to-date copy of the counterparty's features and
13972  * many routing-relevant features are present in the init context.
13973  */
13974 struct LDKInitFeatures ChannelCounterparty_get_features(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
13975
13976 /**
13977  * The Features the channel counterparty provided upon last connection.
13978  * Useful for routing as it is the most up-to-date copy of the counterparty's features and
13979  * many routing-relevant features are present in the init context.
13980  */
13981 void ChannelCounterparty_set_features(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKInitFeatures val);
13982
13983 /**
13984  * The value, in satoshis, that must always be held in the channel for our counterparty. This
13985  * value ensures that if our counterparty broadcasts a revoked state, we can punish them by
13986  * claiming at least this value on chain.
13987  *
13988  * This value is not included in [`inbound_capacity_msat`] as it can never be spent.
13989  *
13990  * [`inbound_capacity_msat`]: ChannelDetails::inbound_capacity_msat
13991  */
13992 uint64_t ChannelCounterparty_get_unspendable_punishment_reserve(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
13993
13994 /**
13995  * The value, in satoshis, that must always be held in the channel for our counterparty. This
13996  * value ensures that if our counterparty broadcasts a revoked state, we can punish them by
13997  * claiming at least this value on chain.
13998  *
13999  * This value is not included in [`inbound_capacity_msat`] as it can never be spent.
14000  *
14001  * [`inbound_capacity_msat`]: ChannelDetails::inbound_capacity_msat
14002  */
14003 void ChannelCounterparty_set_unspendable_punishment_reserve(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, uint64_t val);
14004
14005 /**
14006  * Creates a copy of the ChannelCounterparty
14007  */
14008 struct LDKChannelCounterparty ChannelCounterparty_clone(const struct LDKChannelCounterparty *NONNULL_PTR orig);
14009
14010 /**
14011  * Frees any resources used by the ChannelDetails, if is_owned is set and inner is non-NULL.
14012  */
14013 void ChannelDetails_free(struct LDKChannelDetails this_obj);
14014
14015 /**
14016  * The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
14017  * thereafter this is the txid of the funding transaction xor the funding transaction output).
14018  * Note that this means this value is *not* persistent - it can change once during the
14019  * lifetime of the channel.
14020  */
14021 const uint8_t (*ChannelDetails_get_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr))[32];
14022
14023 /**
14024  * The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
14025  * thereafter this is the txid of the funding transaction xor the funding transaction output).
14026  * Note that this means this value is *not* persistent - it can change once during the
14027  * lifetime of the channel.
14028  */
14029 void ChannelDetails_set_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14030
14031 /**
14032  * Parameters which apply to our counterparty. See individual fields for more information.
14033  */
14034 struct LDKChannelCounterparty ChannelDetails_get_counterparty(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
14035
14036 /**
14037  * Parameters which apply to our counterparty. See individual fields for more information.
14038  */
14039 void ChannelDetails_set_counterparty(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKChannelCounterparty val);
14040
14041 /**
14042  * The Channel's funding transaction output, if we've negotiated the funding transaction with
14043  * our counterparty already.
14044  *
14045  * Note that, if this has been set, `channel_id` will be equivalent to
14046  * `funding_txo.unwrap().to_channel_id()`.
14047  *
14048  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
14049  */
14050 struct LDKOutPoint ChannelDetails_get_funding_txo(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
14051
14052 /**
14053  * The Channel's funding transaction output, if we've negotiated the funding transaction with
14054  * our counterparty already.
14055  *
14056  * Note that, if this has been set, `channel_id` will be equivalent to
14057  * `funding_txo.unwrap().to_channel_id()`.
14058  *
14059  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
14060  */
14061 void ChannelDetails_set_funding_txo(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKOutPoint val);
14062
14063 /**
14064  * The position of the funding transaction in the chain. None if the funding transaction has
14065  * not yet been confirmed and the channel fully opened.
14066  */
14067 struct LDKCOption_u64Z ChannelDetails_get_short_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
14068
14069 /**
14070  * The position of the funding transaction in the chain. None if the funding transaction has
14071  * not yet been confirmed and the channel fully opened.
14072  */
14073 void ChannelDetails_set_short_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
14074
14075 /**
14076  * The value, in satoshis, of this channel as appears in the funding output
14077  */
14078 uint64_t ChannelDetails_get_channel_value_satoshis(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
14079
14080 /**
14081  * The value, in satoshis, of this channel as appears in the funding output
14082  */
14083 void ChannelDetails_set_channel_value_satoshis(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
14084
14085 /**
14086  * The value, in satoshis, that must always be held in the channel for us. This value ensures
14087  * that if we broadcast a revoked state, our counterparty can punish us by claiming at least
14088  * this value on chain.
14089  *
14090  * This value is not included in [`outbound_capacity_msat`] as it can never be spent.
14091  *
14092  * This value will be `None` for outbound channels until the counterparty accepts the channel.
14093  *
14094  * [`outbound_capacity_msat`]: ChannelDetails::outbound_capacity_msat
14095  */
14096 struct LDKCOption_u64Z ChannelDetails_get_unspendable_punishment_reserve(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
14097
14098 /**
14099  * The value, in satoshis, that must always be held in the channel for us. This value ensures
14100  * that if we broadcast a revoked state, our counterparty can punish us by claiming at least
14101  * this value on chain.
14102  *
14103  * This value is not included in [`outbound_capacity_msat`] as it can never be spent.
14104  *
14105  * This value will be `None` for outbound channels until the counterparty accepts the channel.
14106  *
14107  * [`outbound_capacity_msat`]: ChannelDetails::outbound_capacity_msat
14108  */
14109 void ChannelDetails_set_unspendable_punishment_reserve(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
14110
14111 /**
14112  * The user_id passed in to create_channel, or 0 if the channel was inbound.
14113  */
14114 uint64_t ChannelDetails_get_user_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
14115
14116 /**
14117  * The user_id passed in to create_channel, or 0 if the channel was inbound.
14118  */
14119 void ChannelDetails_set_user_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
14120
14121 /**
14122  * The available outbound capacity for sending HTLCs to the remote peer. This does not include
14123  * any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
14124  * available for inclusion in new outbound HTLCs). This further does not include any pending
14125  * outgoing HTLCs which are awaiting some other resolution to be sent.
14126  *
14127  * This value is not exact. Due to various in-flight changes, feerate changes, and our
14128  * conflict-avoidance policy, exactly this amount is not likely to be spendable. However, we
14129  * should be able to spend nearly this amount.
14130  */
14131 uint64_t ChannelDetails_get_outbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
14132
14133 /**
14134  * The available outbound capacity for sending HTLCs to the remote peer. This does not include
14135  * any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
14136  * available for inclusion in new outbound HTLCs). This further does not include any pending
14137  * outgoing HTLCs which are awaiting some other resolution to be sent.
14138  *
14139  * This value is not exact. Due to various in-flight changes, feerate changes, and our
14140  * conflict-avoidance policy, exactly this amount is not likely to be spendable. However, we
14141  * should be able to spend nearly this amount.
14142  */
14143 void ChannelDetails_set_outbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
14144
14145 /**
14146  * The available inbound capacity for the remote peer to send HTLCs to us. This does not
14147  * include any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
14148  * available for inclusion in new inbound HTLCs).
14149  * Note that there are some corner cases not fully handled here, so the actual available
14150  * inbound capacity may be slightly higher than this.
14151  *
14152  * This value is not exact. Due to various in-flight changes, feerate changes, and our
14153  * counterparty's conflict-avoidance policy, exactly this amount is not likely to be spendable.
14154  * However, our counterparty should be able to spend nearly this amount.
14155  */
14156 uint64_t ChannelDetails_get_inbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
14157
14158 /**
14159  * The available inbound capacity for the remote peer to send HTLCs to us. This does not
14160  * include any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
14161  * available for inclusion in new inbound HTLCs).
14162  * Note that there are some corner cases not fully handled here, so the actual available
14163  * inbound capacity may be slightly higher than this.
14164  *
14165  * This value is not exact. Due to various in-flight changes, feerate changes, and our
14166  * counterparty's conflict-avoidance policy, exactly this amount is not likely to be spendable.
14167  * However, our counterparty should be able to spend nearly this amount.
14168  */
14169 void ChannelDetails_set_inbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
14170
14171 /**
14172  * The number of required confirmations on the funding transaction before the funding will be
14173  * considered \"locked\". This number is selected by the channel fundee (i.e. us if
14174  * [`is_outbound`] is *not* set), and can be selected for inbound channels with
14175  * [`ChannelHandshakeConfig::minimum_depth`] or limited for outbound channels with
14176  * [`ChannelHandshakeLimits::max_minimum_depth`].
14177  *
14178  * This value will be `None` for outbound channels until the counterparty accepts the channel.
14179  *
14180  * [`is_outbound`]: ChannelDetails::is_outbound
14181  * [`ChannelHandshakeConfig::minimum_depth`]: crate::util::config::ChannelHandshakeConfig::minimum_depth
14182  * [`ChannelHandshakeLimits::max_minimum_depth`]: crate::util::config::ChannelHandshakeLimits::max_minimum_depth
14183  */
14184 struct LDKCOption_u32Z ChannelDetails_get_confirmations_required(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
14185
14186 /**
14187  * The number of required confirmations on the funding transaction before the funding will be
14188  * considered \"locked\". This number is selected by the channel fundee (i.e. us if
14189  * [`is_outbound`] is *not* set), and can be selected for inbound channels with
14190  * [`ChannelHandshakeConfig::minimum_depth`] or limited for outbound channels with
14191  * [`ChannelHandshakeLimits::max_minimum_depth`].
14192  *
14193  * This value will be `None` for outbound channels until the counterparty accepts the channel.
14194  *
14195  * [`is_outbound`]: ChannelDetails::is_outbound
14196  * [`ChannelHandshakeConfig::minimum_depth`]: crate::util::config::ChannelHandshakeConfig::minimum_depth
14197  * [`ChannelHandshakeLimits::max_minimum_depth`]: crate::util::config::ChannelHandshakeLimits::max_minimum_depth
14198  */
14199 void ChannelDetails_set_confirmations_required(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val);
14200
14201 /**
14202  * The number of blocks (after our commitment transaction confirms) that we will need to wait
14203  * until we can claim our funds after we force-close the channel. During this time our
14204  * counterparty is allowed to punish us if we broadcasted a stale state. If our counterparty
14205  * force-closes the channel and broadcasts a commitment transaction we do not have to wait any
14206  * time to claim our non-HTLC-encumbered funds.
14207  *
14208  * This value will be `None` for outbound channels until the counterparty accepts the channel.
14209  */
14210 struct LDKCOption_u16Z ChannelDetails_get_force_close_spend_delay(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
14211
14212 /**
14213  * The number of blocks (after our commitment transaction confirms) that we will need to wait
14214  * until we can claim our funds after we force-close the channel. During this time our
14215  * counterparty is allowed to punish us if we broadcasted a stale state. If our counterparty
14216  * force-closes the channel and broadcasts a commitment transaction we do not have to wait any
14217  * time to claim our non-HTLC-encumbered funds.
14218  *
14219  * This value will be `None` for outbound channels until the counterparty accepts the channel.
14220  */
14221 void ChannelDetails_set_force_close_spend_delay(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u16Z val);
14222
14223 /**
14224  * True if the channel was initiated (and thus funded) by us.
14225  */
14226 bool ChannelDetails_get_is_outbound(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
14227
14228 /**
14229  * True if the channel was initiated (and thus funded) by us.
14230  */
14231 void ChannelDetails_set_is_outbound(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
14232
14233 /**
14234  * True if the channel is confirmed, funding_locked messages have been exchanged, and the
14235  * channel is not currently being shut down. `funding_locked` message exchange implies the
14236  * required confirmation count has been reached (and we were connected to the peer at some
14237  * point after the funding transaction received enough confirmations). The required
14238  * confirmation count is provided in [`confirmations_required`].
14239  *
14240  * [`confirmations_required`]: ChannelDetails::confirmations_required
14241  */
14242 bool ChannelDetails_get_is_funding_locked(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
14243
14244 /**
14245  * True if the channel is confirmed, funding_locked messages have been exchanged, and the
14246  * channel is not currently being shut down. `funding_locked` message exchange implies the
14247  * required confirmation count has been reached (and we were connected to the peer at some
14248  * point after the funding transaction received enough confirmations). The required
14249  * confirmation count is provided in [`confirmations_required`].
14250  *
14251  * [`confirmations_required`]: ChannelDetails::confirmations_required
14252  */
14253 void ChannelDetails_set_is_funding_locked(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
14254
14255 /**
14256  * True if the channel is (a) confirmed and funding_locked messages have been exchanged, (b)
14257  * the peer is connected, and (c) the channel is not currently negotiating a shutdown.
14258  *
14259  * This is a strict superset of `is_funding_locked`.
14260  */
14261 bool ChannelDetails_get_is_usable(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
14262
14263 /**
14264  * True if the channel is (a) confirmed and funding_locked messages have been exchanged, (b)
14265  * the peer is connected, and (c) the channel is not currently negotiating a shutdown.
14266  *
14267  * This is a strict superset of `is_funding_locked`.
14268  */
14269 void ChannelDetails_set_is_usable(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
14270
14271 /**
14272  * True if this channel is (or will be) publicly-announced.
14273  */
14274 bool ChannelDetails_get_is_public(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
14275
14276 /**
14277  * True if this channel is (or will be) publicly-announced.
14278  */
14279 void ChannelDetails_set_is_public(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
14280
14281 /**
14282  * Constructs a new ChannelDetails given each field
14283  */
14284 MUST_USE_RES struct LDKChannelDetails ChannelDetails_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKChannelCounterparty counterparty_arg, struct LDKOutPoint funding_txo_arg, struct LDKCOption_u64Z short_channel_id_arg, uint64_t channel_value_satoshis_arg, struct LDKCOption_u64Z unspendable_punishment_reserve_arg, uint64_t user_id_arg, uint64_t outbound_capacity_msat_arg, uint64_t inbound_capacity_msat_arg, struct LDKCOption_u32Z confirmations_required_arg, struct LDKCOption_u16Z force_close_spend_delay_arg, bool is_outbound_arg, bool is_funding_locked_arg, bool is_usable_arg, bool is_public_arg);
14285
14286 /**
14287  * Creates a copy of the ChannelDetails
14288  */
14289 struct LDKChannelDetails ChannelDetails_clone(const struct LDKChannelDetails *NONNULL_PTR orig);
14290
14291 /**
14292  * Frees any resources used by the PaymentSendFailure
14293  */
14294 void PaymentSendFailure_free(struct LDKPaymentSendFailure this_ptr);
14295
14296 /**
14297  * Creates a copy of the PaymentSendFailure
14298  */
14299 struct LDKPaymentSendFailure PaymentSendFailure_clone(const struct LDKPaymentSendFailure *NONNULL_PTR orig);
14300
14301 /**
14302  * Utility method to constructs a new ParameterError-variant PaymentSendFailure
14303  */
14304 struct LDKPaymentSendFailure PaymentSendFailure_parameter_error(struct LDKAPIError a);
14305
14306 /**
14307  * Utility method to constructs a new PathParameterError-variant PaymentSendFailure
14308  */
14309 struct LDKPaymentSendFailure PaymentSendFailure_path_parameter_error(struct LDKCVec_CResult_NoneAPIErrorZZ a);
14310
14311 /**
14312  * Utility method to constructs a new AllFailedRetrySafe-variant PaymentSendFailure
14313  */
14314 struct LDKPaymentSendFailure PaymentSendFailure_all_failed_retry_safe(struct LDKCVec_APIErrorZ a);
14315
14316 /**
14317  * Utility method to constructs a new PartialFailure-variant PaymentSendFailure
14318  */
14319 struct LDKPaymentSendFailure PaymentSendFailure_partial_failure(struct LDKCVec_CResult_NoneAPIErrorZZ a);
14320
14321 /**
14322  * Constructs a new ChannelManager to hold several channels and route between them.
14323  *
14324  * This is the main \"logic hub\" for all channel-related actions, and implements
14325  * ChannelMessageHandler.
14326  *
14327  * Non-proportional fees are fixed according to our risk using the provided fee estimator.
14328  *
14329  * panics if channel_value_satoshis is >= `MAX_FUNDING_SATOSHIS`!
14330  *
14331  * Users need to notify the new ChannelManager when a new block is connected or
14332  * disconnected using its `block_connected` and `block_disconnected` methods, starting
14333  * from after `params.latest_hash`.
14334  */
14335 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);
14336
14337 /**
14338  * Gets the current configuration applied to all new channels,  as
14339  */
14340 MUST_USE_RES struct LDKUserConfig ChannelManager_get_current_default_configuration(const struct LDKChannelManager *NONNULL_PTR this_arg);
14341
14342 /**
14343  * Creates a new outbound channel to the given remote node and with the given value.
14344  *
14345  * user_id will be provided back as user_channel_id in FundingGenerationReady events to allow
14346  * tracking of which events correspond with which create_channel call. Note that the
14347  * user_channel_id defaults to 0 for inbound channels, so you may wish to avoid using 0 for
14348  * user_id here. user_id has no meaning inside of LDK, it is simply copied to events and
14349  * otherwise ignored.
14350  *
14351  * If successful, will generate a SendOpenChannel message event, so you should probably poll
14352  * PeerManager::process_events afterwards.
14353  *
14354  * Raises APIError::APIMisuseError when channel_value_satoshis > 2**24 or push_msat is
14355  * greater than channel_value_satoshis * 1k or channel_value_satoshis is < 1000.
14356  *
14357  * Note that we do not check if you are currently connected to the given peer. If no
14358  * connection is available, the outbound `open_channel` message may fail to send, resulting in
14359  * the channel eventually being silently forgotten.
14360  *
14361  * Note that override_config (or a relevant inner pointer) may be NULL or all-0s to represent None
14362  */
14363 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);
14364
14365 /**
14366  * Gets the list of open channels, in random order. See ChannelDetail field documentation for
14367  * more information.
14368  */
14369 MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
14370
14371 /**
14372  * Gets the list of usable channels, in random order. Useful as an argument to
14373  * get_route to ensure non-announced channels are used.
14374  *
14375  * These are guaranteed to have their [`ChannelDetails::is_usable`] value set to true, see the
14376  * documentation for [`ChannelDetails::is_usable`] for more info on exactly what the criteria
14377  * are.
14378  */
14379 MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_usable_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
14380
14381 /**
14382  * Begins the process of closing a channel. After this call (plus some timeout), no new HTLCs
14383  * will be accepted on the given channel, and after additional timeout/the closing of all
14384  * pending HTLCs, the channel will be closed on chain.
14385  *
14386  *  * If we are the channel initiator, we will pay between our [`Background`] and
14387  *    [`ChannelConfig::force_close_avoidance_max_fee_satoshis`] plus our [`Normal`] fee
14388  *    estimate.
14389  *  * If our counterparty is the channel initiator, we will require a channel closing
14390  *    transaction feerate of at least our [`Background`] feerate or the feerate which
14391  *    would appear on a force-closure transaction, whichever is lower. We will allow our
14392  *    counterparty to pay as much fee as they'd like, however.
14393  *
14394  * May generate a SendShutdown message event on success, which should be relayed.
14395  *
14396  * [`ChannelConfig::force_close_avoidance_max_fee_satoshis`]: crate::util::config::ChannelConfig::force_close_avoidance_max_fee_satoshis
14397  * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
14398  * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
14399  */
14400 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_close_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32]);
14401
14402 /**
14403  * Begins the process of closing a channel. After this call (plus some timeout), no new HTLCs
14404  * will be accepted on the given channel, and after additional timeout/the closing of all
14405  * pending HTLCs, the channel will be closed on chain.
14406  *
14407  * `target_feerate_sat_per_1000_weight` has different meanings depending on if we initiated
14408  * the channel being closed or not:
14409  *  * If we are the channel initiator, we will pay at least this feerate on the closing
14410  *    transaction. The upper-bound is set by
14411  *    [`ChannelConfig::force_close_avoidance_max_fee_satoshis`] plus our [`Normal`] fee
14412  *    estimate (or `target_feerate_sat_per_1000_weight`, if it is greater).
14413  *  * If our counterparty is the channel initiator, we will refuse to accept a channel closure
14414  *    transaction feerate below `target_feerate_sat_per_1000_weight` (or the feerate which
14415  *    will appear on a force-closure transaction, whichever is lower).
14416  *
14417  * May generate a SendShutdown message event on success, which should be relayed.
14418  *
14419  * [`ChannelConfig::force_close_avoidance_max_fee_satoshis`]: crate::util::config::ChannelConfig::force_close_avoidance_max_fee_satoshis
14420  * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
14421  * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
14422  */
14423 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_close_channel_with_target_feerate(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32], uint32_t target_feerate_sats_per_1000_weight);
14424
14425 /**
14426  * Force closes a channel, immediately broadcasting the latest local commitment transaction to
14427  * the chain and rejecting new HTLCs on the given channel. Fails if channel_id is unknown to the manager.
14428  */
14429 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_force_close_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32]);
14430
14431 /**
14432  * Force close all channels, immediately broadcasting the latest local commitment transaction
14433  * for each to the chain and rejecting new HTLCs on each.
14434  */
14435 void ChannelManager_force_close_all_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
14436
14437 /**
14438  * Sends a payment along a given route.
14439  *
14440  * Value parameters are provided via the last hop in route, see documentation for RouteHop
14441  * fields for more info.
14442  *
14443  * Note that if the payment_hash already exists elsewhere (eg you're sending a duplicative
14444  * payment), we don't do anything to stop you! We always try to ensure that if the provided
14445  * next hop knows the preimage to payment_hash they can claim an additional amount as
14446  * specified in the last hop in the route! Thus, you should probably do your own
14447  * payment_preimage tracking (which you should already be doing as they represent \"proof of
14448  * payment\") and prevent double-sends yourself.
14449  *
14450  * May generate SendHTLCs message(s) event on success, which should be relayed.
14451  *
14452  * Each path may have a different return value, and PaymentSendValue may return a Vec with
14453  * each entry matching the corresponding-index entry in the route paths, see
14454  * PaymentSendFailure for more info.
14455  *
14456  * In general, a path may raise:
14457  *  * APIError::RouteError when an invalid route or forwarding parameter (cltv_delta, fee,
14458  *    node public key) is specified.
14459  *  * APIError::ChannelUnavailable if the next-hop channel is not available for updates
14460  *    (including due to previous monitor update failure or new permanent monitor update
14461  *    failure).
14462  *  * APIError::MonitorUpdateFailed if a new monitor update failure prevented sending the
14463  *    relevant updates.
14464  *
14465  * Note that depending on the type of the PaymentSendFailure the HTLC may have been
14466  * irrevocably committed to on our end. In such a case, do NOT retry the payment with a
14467  * different route unless you intend to pay twice!
14468  *
14469  * payment_secret is unrelated to payment_hash (or PaymentPreimage) and exists to authenticate
14470  * the sender to the recipient and prevent payment-probing (deanonymization) attacks. For
14471  * newer nodes, it will be provided to you in the invoice. If you do not have one, the Route
14472  * must not contain multiple paths as multi-path payments require a recipient-provided
14473  * payment_secret.
14474  * If a payment_secret *is* provided, we assume that the invoice had the payment_secret feature
14475  * bit set (either as required or as available). If multiple paths are present in the Route,
14476  * we assume the invoice had the basic_mpp feature set.
14477  *
14478  * Note that payment_secret (or a relevant inner pointer) may be NULL or all-0s to represent None
14479  */
14480 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);
14481
14482 /**
14483  * Send a spontaneous payment, which is a payment that does not require the recipient to have
14484  * generated an invoice. Optionally, you may specify the preimage. If you do choose to specify
14485  * the preimage, it must be a cryptographically secure random value that no intermediate node
14486  * would be able to guess -- otherwise, an intermediate node may claim the payment and it will
14487  * never reach the recipient.
14488  *
14489  * See [`send_payment`] documentation for more details on the return value of this function.
14490  *
14491  * Similar to regular payments, you MUST NOT reuse a `payment_preimage` value. See
14492  * [`send_payment`] for more information about the risks of duplicate preimage usage.
14493  *
14494  * Note that `route` must have exactly one path.
14495  *
14496  * [`send_payment`]: Self::send_payment
14497  *
14498  * Note that payment_preimage (or a relevant inner pointer) may be NULL or all-0s to represent None
14499  */
14500 MUST_USE_RES struct LDKCResult_PaymentHashPaymentSendFailureZ ChannelManager_send_spontaneous_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_preimage);
14501
14502 /**
14503  * Call this upon creation of a funding transaction for the given channel.
14504  *
14505  * Returns an [`APIError::APIMisuseError`] if the funding_transaction spent non-SegWit outputs
14506  * or if no output was found which matches the parameters in [`Event::FundingGenerationReady`].
14507  *
14508  * Panics if a funding transaction has already been provided for this channel.
14509  *
14510  * May panic if the output found in the funding transaction is duplicative with some other
14511  * channel (note that this should be trivially prevented by using unique funding transaction
14512  * keys per-channel).
14513  *
14514  * Do NOT broadcast the funding transaction yourself. When we have safely received our
14515  * counterparty's signature the funding transaction will automatically be broadcast via the
14516  * [`BroadcasterInterface`] provided when this `ChannelManager` was constructed.
14517  *
14518  * Note that this includes RBF or similar transaction replacement strategies - lightning does
14519  * not currently support replacing a funding transaction on an existing channel. Instead,
14520  * create a new channel with a conflicting funding transaction.
14521  *
14522  * [`Event::FundingGenerationReady`]: crate::util::events::Event::FundingGenerationReady
14523  */
14524 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);
14525
14526 /**
14527  * Regenerates channel_announcements and generates a signed node_announcement from the given
14528  * arguments, providing them in corresponding events via
14529  * [`get_and_clear_pending_msg_events`], if at least one public channel has been confirmed
14530  * on-chain. This effectively re-broadcasts all channel announcements and sends our node
14531  * announcement to ensure that the lightning P2P network is aware of the channels we have and
14532  * our network addresses.
14533  *
14534  * `rgb` is a node \"color\" and `alias` is a printable human-readable string to describe this
14535  * node to humans. They carry no in-protocol meaning.
14536  *
14537  * `addresses` represent the set (possibly empty) of socket addresses on which this node
14538  * accepts incoming connections. These will be included in the node_announcement, publicly
14539  * tying these addresses together and to this node. If you wish to preserve user privacy,
14540  * addresses should likely contain only Tor Onion addresses.
14541  *
14542  * Panics if `addresses` is absurdly large (more than 500).
14543  *
14544  * [`get_and_clear_pending_msg_events`]: MessageSendEventsProvider::get_and_clear_pending_msg_events
14545  */
14546 void ChannelManager_broadcast_node_announcement(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThreeBytes rgb, struct LDKThirtyTwoBytes alias, struct LDKCVec_NetAddressZ addresses);
14547
14548 /**
14549  * Processes HTLCs which are pending waiting on random forward delay.
14550  *
14551  * Should only really ever be called in response to a PendingHTLCsForwardable event.
14552  * Will likely generate further events.
14553  */
14554 void ChannelManager_process_pending_htlc_forwards(const struct LDKChannelManager *NONNULL_PTR this_arg);
14555
14556 /**
14557  * Performs actions which should happen on startup and roughly once per minute thereafter.
14558  *
14559  * This currently includes:
14560  *  * Increasing or decreasing the on-chain feerate estimates for our outbound channels,
14561  *  * Broadcasting `ChannelUpdate` messages if we've been disconnected from our peer for more
14562  *    than a minute, informing the network that they should no longer attempt to route over
14563  *    the channel.
14564  *
14565  * Note that this may cause reentrancy through `chain::Watch::update_channel` calls or feerate
14566  * estimate fetches.
14567  */
14568 void ChannelManager_timer_tick_occurred(const struct LDKChannelManager *NONNULL_PTR this_arg);
14569
14570 /**
14571  * Indicates that the preimage for payment_hash is unknown or the received amount is incorrect
14572  * after a PaymentReceived event, failing the HTLC back to its origin and freeing resources
14573  * along the path (including in our own channel on which we received it).
14574  * Returns false if no payment was found to fail backwards, true if the process of failing the
14575  * HTLC backwards has been started.
14576  */
14577 MUST_USE_RES bool ChannelManager_fail_htlc_backwards(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*payment_hash)[32]);
14578
14579 /**
14580  * Provides a payment preimage in response to a PaymentReceived event, returning true and
14581  * generating message events for the net layer to claim the payment, if possible. Thus, you
14582  * should probably kick the net layer to go send messages if this returns true!
14583  *
14584  * Note that if you did not set an `amount_msat` when calling [`create_inbound_payment`] or
14585  * [`create_inbound_payment_for_hash`] you must check that the amount in the `PaymentReceived`
14586  * event matches your expectation. If you fail to do so and call this method, you may provide
14587  * the sender \"proof-of-payment\" when they did not fulfill the full expected payment.
14588  *
14589  * May panic if called except in response to a PaymentReceived event.
14590  *
14591  * [`create_inbound_payment`]: Self::create_inbound_payment
14592  * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash
14593  */
14594 MUST_USE_RES bool ChannelManager_claim_funds(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_preimage);
14595
14596 /**
14597  * Gets the node_id held by this ChannelManager
14598  */
14599 MUST_USE_RES struct LDKPublicKey ChannelManager_get_our_node_id(const struct LDKChannelManager *NONNULL_PTR this_arg);
14600
14601 /**
14602  * Restores a single, given channel to normal operation after a
14603  * ChannelMonitorUpdateErr::TemporaryFailure was returned from a channel monitor update
14604  * operation.
14605  *
14606  * All ChannelMonitor updates up to and including highest_applied_update_id must have been
14607  * fully committed in every copy of the given channels' ChannelMonitors.
14608  *
14609  * Note that there is no effect to calling with a highest_applied_update_id other than the
14610  * current latest ChannelMonitorUpdate and one call to this function after multiple
14611  * ChannelMonitorUpdateErr::TemporaryFailures is fine. The highest_applied_update_id field
14612  * exists largely only to prevent races between this and concurrent update_monitor calls.
14613  *
14614  * Thus, the anticipated use is, at a high level:
14615  *  1) You register a chain::Watch with this ChannelManager,
14616  *  2) it stores each update to disk, and begins updating any remote (eg watchtower) copies of
14617  *     said ChannelMonitors as it can, returning ChannelMonitorUpdateErr::TemporaryFailures
14618  *     any time it cannot do so instantly,
14619  *  3) update(s) are applied to each remote copy of a ChannelMonitor,
14620  *  4) once all remote copies are updated, you call this function with the update_id that
14621  *     completed, and once it is the latest the Channel will be re-enabled.
14622  */
14623 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);
14624
14625 /**
14626  * Gets a payment secret and payment hash for use in an invoice given to a third party wishing
14627  * to pay us.
14628  *
14629  * This differs from [`create_inbound_payment_for_hash`] only in that it generates the
14630  * [`PaymentHash`] and [`PaymentPreimage`] for you, returning the first and storing the second.
14631  *
14632  * The [`PaymentPreimage`] will ultimately be returned to you in the [`PaymentReceived`], which
14633  * will have the [`PaymentReceived::payment_preimage`] field filled in. That should then be
14634  * passed directly to [`claim_funds`].
14635  *
14636  * See [`create_inbound_payment_for_hash`] for detailed documentation on behavior and requirements.
14637  *
14638  * [`claim_funds`]: Self::claim_funds
14639  * [`PaymentReceived`]: events::Event::PaymentReceived
14640  * [`PaymentReceived::payment_preimage`]: events::Event::PaymentReceived::payment_preimage
14641  * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash
14642  */
14643 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);
14644
14645 /**
14646  * Gets a [`PaymentSecret`] for a given [`PaymentHash`], for which the payment preimage is
14647  * stored external to LDK.
14648  *
14649  * A [`PaymentReceived`] event will only be generated if the [`PaymentSecret`] matches a
14650  * payment secret fetched via this method or [`create_inbound_payment`], and which is at least
14651  * the `min_value_msat` provided here, if one is provided.
14652  *
14653  * The [`PaymentHash`] (and corresponding [`PaymentPreimage`]) must be globally unique. This
14654  * method may return an Err if another payment with the same payment_hash is still pending.
14655  *
14656  * `user_payment_id` will be provided back in [`PaymentPurpose::InvoicePayment::user_payment_id`] events to
14657  * allow tracking of which events correspond with which calls to this and
14658  * [`create_inbound_payment`]. `user_payment_id` has no meaning inside of LDK, it is simply
14659  * copied to events and otherwise ignored. It may be used to correlate PaymentReceived events
14660  * with invoice metadata stored elsewhere.
14661  *
14662  * `min_value_msat` should be set if the invoice being generated contains a value. Any payment
14663  * received for the returned [`PaymentHash`] will be required to be at least `min_value_msat`
14664  * before a [`PaymentReceived`] event will be generated, ensuring that we do not provide the
14665  * sender \"proof-of-payment\" unless they have paid the required amount.
14666  *
14667  * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
14668  * in excess of the current time. This should roughly match the expiry time set in the invoice.
14669  * After this many seconds, we will remove the inbound payment, resulting in any attempts to
14670  * pay the invoice failing. The BOLT spec suggests 3,600 secs as a default validity time for
14671  * invoices when no timeout is set.
14672  *
14673  * Note that we use block header time to time-out pending inbound payments (with some margin
14674  * to compensate for the inaccuracy of block header timestamps). Thus, in practice we will
14675  * accept a payment and generate a [`PaymentReceived`] event for some time after the expiry.
14676  * If you need exact expiry semantics, you should enforce them upon receipt of
14677  * [`PaymentReceived`].
14678  *
14679  * Pending inbound payments are stored in memory and in serialized versions of this
14680  * [`ChannelManager`]. If potentially unbounded numbers of inbound payments may exist and
14681  * space is limited, you may wish to rate-limit inbound payment creation.
14682  *
14683  * May panic if `invoice_expiry_delta_secs` is greater than one year.
14684  *
14685  * Note that invoices generated for inbound payments should have their `min_final_cltv_expiry`
14686  * set to at least [`MIN_FINAL_CLTV_EXPIRY`].
14687  *
14688  * [`create_inbound_payment`]: Self::create_inbound_payment
14689  * [`PaymentReceived`]: events::Event::PaymentReceived
14690  * [`PaymentPurpose::InvoicePayment::user_payment_id`]: events::PaymentPurpose::InvoicePayment::user_payment_id
14691  */
14692 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);
14693
14694 /**
14695  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
14696  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
14697  */
14698 struct LDKMessageSendEventsProvider ChannelManager_as_MessageSendEventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg);
14699
14700 /**
14701  * Constructs a new EventsProvider which calls the relevant methods on this_arg.
14702  * This copies the `inner` pointer in this_arg and thus the returned EventsProvider must be freed before this_arg is
14703  */
14704 struct LDKEventsProvider ChannelManager_as_EventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg);
14705
14706 /**
14707  * Constructs a new Listen which calls the relevant methods on this_arg.
14708  * This copies the `inner` pointer in this_arg and thus the returned Listen must be freed before this_arg is
14709  */
14710 struct LDKListen ChannelManager_as_Listen(const struct LDKChannelManager *NONNULL_PTR this_arg);
14711
14712 /**
14713  * Constructs a new Confirm which calls the relevant methods on this_arg.
14714  * This copies the `inner` pointer in this_arg and thus the returned Confirm must be freed before this_arg is
14715  */
14716 struct LDKConfirm ChannelManager_as_Confirm(const struct LDKChannelManager *NONNULL_PTR this_arg);
14717
14718 /**
14719  * Blocks until ChannelManager needs to be persisted or a timeout is reached. It returns a bool
14720  * indicating whether persistence is necessary. Only one listener on
14721  * `await_persistable_update` or `await_persistable_update_timeout` is guaranteed to be woken
14722  * up.
14723  * Note that the feature `allow_wallclock_use` must be enabled to use this function.
14724  */
14725 MUST_USE_RES bool ChannelManager_await_persistable_update_timeout(const struct LDKChannelManager *NONNULL_PTR this_arg, uint64_t max_wait);
14726
14727 /**
14728  * Blocks until ChannelManager needs to be persisted. Only one listener on
14729  * `await_persistable_update` or `await_persistable_update_timeout` is guaranteed to be woken
14730  * up.
14731  */
14732 void ChannelManager_await_persistable_update(const struct LDKChannelManager *NONNULL_PTR this_arg);
14733
14734 /**
14735  * Gets the latest best block which was connected either via the [`chain::Listen`] or
14736  * [`chain::Confirm`] interfaces.
14737  */
14738 MUST_USE_RES struct LDKBestBlock ChannelManager_current_best_block(const struct LDKChannelManager *NONNULL_PTR this_arg);
14739
14740 /**
14741  * Constructs a new ChannelMessageHandler which calls the relevant methods on this_arg.
14742  * This copies the `inner` pointer in this_arg and thus the returned ChannelMessageHandler must be freed before this_arg is
14743  */
14744 struct LDKChannelMessageHandler ChannelManager_as_ChannelMessageHandler(const struct LDKChannelManager *NONNULL_PTR this_arg);
14745
14746 /**
14747  * Serialize the ChannelManager object into a byte array which can be read by ChannelManager_read
14748  */
14749 struct LDKCVec_u8Z ChannelManager_write(const struct LDKChannelManager *NONNULL_PTR obj);
14750
14751 /**
14752  * Frees any resources used by the ChannelManagerReadArgs, if is_owned is set and inner is non-NULL.
14753  */
14754 void ChannelManagerReadArgs_free(struct LDKChannelManagerReadArgs this_obj);
14755
14756 /**
14757  * The keys provider which will give us relevant keys. Some keys will be loaded during
14758  * deserialization and KeysInterface::read_chan_signer will be used to read per-Channel
14759  * signing data.
14760  */
14761 const struct LDKKeysInterface *ChannelManagerReadArgs_get_keys_manager(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
14762
14763 /**
14764  * The keys provider which will give us relevant keys. Some keys will be loaded during
14765  * deserialization and KeysInterface::read_chan_signer will be used to read per-Channel
14766  * signing data.
14767  */
14768 void ChannelManagerReadArgs_set_keys_manager(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKKeysInterface val);
14769
14770 /**
14771  * The fee_estimator for use in the ChannelManager in the future.
14772  *
14773  * No calls to the FeeEstimator will be made during deserialization.
14774  */
14775 const struct LDKFeeEstimator *ChannelManagerReadArgs_get_fee_estimator(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
14776
14777 /**
14778  * The fee_estimator for use in the ChannelManager in the future.
14779  *
14780  * No calls to the FeeEstimator will be made during deserialization.
14781  */
14782 void ChannelManagerReadArgs_set_fee_estimator(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKFeeEstimator val);
14783
14784 /**
14785  * The chain::Watch for use in the ChannelManager in the future.
14786  *
14787  * No calls to the chain::Watch will be made during deserialization. It is assumed that
14788  * you have deserialized ChannelMonitors separately and will add them to your
14789  * chain::Watch after deserializing this ChannelManager.
14790  */
14791 const struct LDKWatch *ChannelManagerReadArgs_get_chain_monitor(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
14792
14793 /**
14794  * The chain::Watch for use in the ChannelManager in the future.
14795  *
14796  * No calls to the chain::Watch will be made during deserialization. It is assumed that
14797  * you have deserialized ChannelMonitors separately and will add them to your
14798  * chain::Watch after deserializing this ChannelManager.
14799  */
14800 void ChannelManagerReadArgs_set_chain_monitor(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKWatch val);
14801
14802 /**
14803  * The BroadcasterInterface which will be used in the ChannelManager in the future and may be
14804  * used to broadcast the latest local commitment transactions of channels which must be
14805  * force-closed during deserialization.
14806  */
14807 const struct LDKBroadcasterInterface *ChannelManagerReadArgs_get_tx_broadcaster(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
14808
14809 /**
14810  * The BroadcasterInterface which will be used in the ChannelManager in the future and may be
14811  * used to broadcast the latest local commitment transactions of channels which must be
14812  * force-closed during deserialization.
14813  */
14814 void ChannelManagerReadArgs_set_tx_broadcaster(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKBroadcasterInterface val);
14815
14816 /**
14817  * The Logger for use in the ChannelManager and which may be used to log information during
14818  * deserialization.
14819  */
14820 const struct LDKLogger *ChannelManagerReadArgs_get_logger(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
14821
14822 /**
14823  * The Logger for use in the ChannelManager and which may be used to log information during
14824  * deserialization.
14825  */
14826 void ChannelManagerReadArgs_set_logger(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKLogger val);
14827
14828 /**
14829  * Default settings used for new channels. Any existing channels will continue to use the
14830  * runtime settings which were stored when the ChannelManager was serialized.
14831  */
14832 struct LDKUserConfig ChannelManagerReadArgs_get_default_config(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
14833
14834 /**
14835  * Default settings used for new channels. Any existing channels will continue to use the
14836  * runtime settings which were stored when the ChannelManager was serialized.
14837  */
14838 void ChannelManagerReadArgs_set_default_config(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKUserConfig val);
14839
14840 /**
14841  * Simple utility function to create a ChannelManagerReadArgs which creates the monitor
14842  * HashMap for you. This is primarily useful for C bindings where it is not practical to
14843  * populate a HashMap directly from C.
14844  */
14845 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);
14846
14847 /**
14848  * Read a C2Tuple_BlockHashChannelManagerZ from a byte array, created by C2Tuple_BlockHashChannelManagerZ_write
14849  */
14850 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ C2Tuple_BlockHashChannelManagerZ_read(struct LDKu8slice ser, struct LDKChannelManagerReadArgs arg);
14851
14852 /**
14853  * Frees any resources used by the DecodeError, if is_owned is set and inner is non-NULL.
14854  */
14855 void DecodeError_free(struct LDKDecodeError this_obj);
14856
14857 /**
14858  * Creates a copy of the DecodeError
14859  */
14860 struct LDKDecodeError DecodeError_clone(const struct LDKDecodeError *NONNULL_PTR orig);
14861
14862 /**
14863  * Frees any resources used by the Init, if is_owned is set and inner is non-NULL.
14864  */
14865 void Init_free(struct LDKInit this_obj);
14866
14867 /**
14868  * The relevant features which the sender supports
14869  */
14870 struct LDKInitFeatures Init_get_features(const struct LDKInit *NONNULL_PTR this_ptr);
14871
14872 /**
14873  * The relevant features which the sender supports
14874  */
14875 void Init_set_features(struct LDKInit *NONNULL_PTR this_ptr, struct LDKInitFeatures val);
14876
14877 /**
14878  * Constructs a new Init given each field
14879  */
14880 MUST_USE_RES struct LDKInit Init_new(struct LDKInitFeatures features_arg);
14881
14882 /**
14883  * Creates a copy of the Init
14884  */
14885 struct LDKInit Init_clone(const struct LDKInit *NONNULL_PTR orig);
14886
14887 /**
14888  * Frees any resources used by the ErrorMessage, if is_owned is set and inner is non-NULL.
14889  */
14890 void ErrorMessage_free(struct LDKErrorMessage this_obj);
14891
14892 /**
14893  * The channel ID involved in the error
14894  */
14895 const uint8_t (*ErrorMessage_get_channel_id(const struct LDKErrorMessage *NONNULL_PTR this_ptr))[32];
14896
14897 /**
14898  * The channel ID involved in the error
14899  */
14900 void ErrorMessage_set_channel_id(struct LDKErrorMessage *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14901
14902 /**
14903  * A possibly human-readable error description.
14904  * The string should be sanitized before it is used (e.g. emitted to logs
14905  * or printed to stdout).  Otherwise, a well crafted error message may trigger a security
14906  * vulnerability in the terminal emulator or the logging subsystem.
14907  */
14908 struct LDKStr ErrorMessage_get_data(const struct LDKErrorMessage *NONNULL_PTR this_ptr);
14909
14910 /**
14911  * A possibly human-readable error description.
14912  * The string should be sanitized before it is used (e.g. emitted to logs
14913  * or printed to stdout).  Otherwise, a well crafted error message may trigger a security
14914  * vulnerability in the terminal emulator or the logging subsystem.
14915  */
14916 void ErrorMessage_set_data(struct LDKErrorMessage *NONNULL_PTR this_ptr, struct LDKStr val);
14917
14918 /**
14919  * Constructs a new ErrorMessage given each field
14920  */
14921 MUST_USE_RES struct LDKErrorMessage ErrorMessage_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKStr data_arg);
14922
14923 /**
14924  * Creates a copy of the ErrorMessage
14925  */
14926 struct LDKErrorMessage ErrorMessage_clone(const struct LDKErrorMessage *NONNULL_PTR orig);
14927
14928 /**
14929  * Frees any resources used by the Ping, if is_owned is set and inner is non-NULL.
14930  */
14931 void Ping_free(struct LDKPing this_obj);
14932
14933 /**
14934  * The desired response length
14935  */
14936 uint16_t Ping_get_ponglen(const struct LDKPing *NONNULL_PTR this_ptr);
14937
14938 /**
14939  * The desired response length
14940  */
14941 void Ping_set_ponglen(struct LDKPing *NONNULL_PTR this_ptr, uint16_t val);
14942
14943 /**
14944  * The ping packet size.
14945  * This field is not sent on the wire. byteslen zeros are sent.
14946  */
14947 uint16_t Ping_get_byteslen(const struct LDKPing *NONNULL_PTR this_ptr);
14948
14949 /**
14950  * The ping packet size.
14951  * This field is not sent on the wire. byteslen zeros are sent.
14952  */
14953 void Ping_set_byteslen(struct LDKPing *NONNULL_PTR this_ptr, uint16_t val);
14954
14955 /**
14956  * Constructs a new Ping given each field
14957  */
14958 MUST_USE_RES struct LDKPing Ping_new(uint16_t ponglen_arg, uint16_t byteslen_arg);
14959
14960 /**
14961  * Creates a copy of the Ping
14962  */
14963 struct LDKPing Ping_clone(const struct LDKPing *NONNULL_PTR orig);
14964
14965 /**
14966  * Frees any resources used by the Pong, if is_owned is set and inner is non-NULL.
14967  */
14968 void Pong_free(struct LDKPong this_obj);
14969
14970 /**
14971  * The pong packet size.
14972  * This field is not sent on the wire. byteslen zeros are sent.
14973  */
14974 uint16_t Pong_get_byteslen(const struct LDKPong *NONNULL_PTR this_ptr);
14975
14976 /**
14977  * The pong packet size.
14978  * This field is not sent on the wire. byteslen zeros are sent.
14979  */
14980 void Pong_set_byteslen(struct LDKPong *NONNULL_PTR this_ptr, uint16_t val);
14981
14982 /**
14983  * Constructs a new Pong given each field
14984  */
14985 MUST_USE_RES struct LDKPong Pong_new(uint16_t byteslen_arg);
14986
14987 /**
14988  * Creates a copy of the Pong
14989  */
14990 struct LDKPong Pong_clone(const struct LDKPong *NONNULL_PTR orig);
14991
14992 /**
14993  * Frees any resources used by the OpenChannel, if is_owned is set and inner is non-NULL.
14994  */
14995 void OpenChannel_free(struct LDKOpenChannel this_obj);
14996
14997 /**
14998  * The genesis hash of the blockchain where the channel is to be opened
14999  */
15000 const uint8_t (*OpenChannel_get_chain_hash(const struct LDKOpenChannel *NONNULL_PTR this_ptr))[32];
15001
15002 /**
15003  * The genesis hash of the blockchain where the channel is to be opened
15004  */
15005 void OpenChannel_set_chain_hash(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
15006
15007 /**
15008  * A temporary channel ID, until the funding outpoint is announced
15009  */
15010 const uint8_t (*OpenChannel_get_temporary_channel_id(const struct LDKOpenChannel *NONNULL_PTR this_ptr))[32];
15011
15012 /**
15013  * A temporary channel ID, until the funding outpoint is announced
15014  */
15015 void OpenChannel_set_temporary_channel_id(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
15016
15017 /**
15018  * The channel value
15019  */
15020 uint64_t OpenChannel_get_funding_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
15021
15022 /**
15023  * The channel value
15024  */
15025 void OpenChannel_set_funding_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
15026
15027 /**
15028  * The amount to push to the counterparty as part of the open, in milli-satoshi
15029  */
15030 uint64_t OpenChannel_get_push_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
15031
15032 /**
15033  * The amount to push to the counterparty as part of the open, in milli-satoshi
15034  */
15035 void OpenChannel_set_push_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
15036
15037 /**
15038  * The threshold below which outputs on transactions broadcast by sender will be omitted
15039  */
15040 uint64_t OpenChannel_get_dust_limit_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
15041
15042 /**
15043  * The threshold below which outputs on transactions broadcast by sender will be omitted
15044  */
15045 void OpenChannel_set_dust_limit_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
15046
15047 /**
15048  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
15049  */
15050 uint64_t OpenChannel_get_max_htlc_value_in_flight_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
15051
15052 /**
15053  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
15054  */
15055 void OpenChannel_set_max_htlc_value_in_flight_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
15056
15057 /**
15058  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
15059  */
15060 uint64_t OpenChannel_get_channel_reserve_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
15061
15062 /**
15063  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
15064  */
15065 void OpenChannel_set_channel_reserve_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
15066
15067 /**
15068  * The minimum HTLC size incoming to sender, in milli-satoshi
15069  */
15070 uint64_t OpenChannel_get_htlc_minimum_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
15071
15072 /**
15073  * The minimum HTLC size incoming to sender, in milli-satoshi
15074  */
15075 void OpenChannel_set_htlc_minimum_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
15076
15077 /**
15078  * The feerate per 1000-weight of sender generated transactions, until updated by update_fee
15079  */
15080 uint32_t OpenChannel_get_feerate_per_kw(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
15081
15082 /**
15083  * The feerate per 1000-weight of sender generated transactions, until updated by update_fee
15084  */
15085 void OpenChannel_set_feerate_per_kw(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint32_t val);
15086
15087 /**
15088  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
15089  */
15090 uint16_t OpenChannel_get_to_self_delay(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
15091
15092 /**
15093  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
15094  */
15095 void OpenChannel_set_to_self_delay(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint16_t val);
15096
15097 /**
15098  * The maximum number of inbound HTLCs towards sender
15099  */
15100 uint16_t OpenChannel_get_max_accepted_htlcs(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
15101
15102 /**
15103  * The maximum number of inbound HTLCs towards sender
15104  */
15105 void OpenChannel_set_max_accepted_htlcs(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint16_t val);
15106
15107 /**
15108  * The sender's key controlling the funding transaction
15109  */
15110 struct LDKPublicKey OpenChannel_get_funding_pubkey(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
15111
15112 /**
15113  * The sender's key controlling the funding transaction
15114  */
15115 void OpenChannel_set_funding_pubkey(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
15116
15117 /**
15118  * Used to derive a revocation key for transactions broadcast by counterparty
15119  */
15120 struct LDKPublicKey OpenChannel_get_revocation_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
15121
15122 /**
15123  * Used to derive a revocation key for transactions broadcast by counterparty
15124  */
15125 void OpenChannel_set_revocation_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
15126
15127 /**
15128  * A payment key to sender for transactions broadcast by counterparty
15129  */
15130 struct LDKPublicKey OpenChannel_get_payment_point(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
15131
15132 /**
15133  * A payment key to sender for transactions broadcast by counterparty
15134  */
15135 void OpenChannel_set_payment_point(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
15136
15137 /**
15138  * Used to derive a payment key to sender for transactions broadcast by sender
15139  */
15140 struct LDKPublicKey OpenChannel_get_delayed_payment_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
15141
15142 /**
15143  * Used to derive a payment key to sender for transactions broadcast by sender
15144  */
15145 void OpenChannel_set_delayed_payment_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
15146
15147 /**
15148  * Used to derive an HTLC payment key to sender
15149  */
15150 struct LDKPublicKey OpenChannel_get_htlc_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
15151
15152 /**
15153  * Used to derive an HTLC payment key to sender
15154  */
15155 void OpenChannel_set_htlc_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
15156
15157 /**
15158  * The first to-be-broadcast-by-sender transaction's per commitment point
15159  */
15160 struct LDKPublicKey OpenChannel_get_first_per_commitment_point(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
15161
15162 /**
15163  * The first to-be-broadcast-by-sender transaction's per commitment point
15164  */
15165 void OpenChannel_set_first_per_commitment_point(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
15166
15167 /**
15168  * Channel flags
15169  */
15170 uint8_t OpenChannel_get_channel_flags(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
15171
15172 /**
15173  * Channel flags
15174  */
15175 void OpenChannel_set_channel_flags(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint8_t val);
15176
15177 /**
15178  * Creates a copy of the OpenChannel
15179  */
15180 struct LDKOpenChannel OpenChannel_clone(const struct LDKOpenChannel *NONNULL_PTR orig);
15181
15182 /**
15183  * Frees any resources used by the AcceptChannel, if is_owned is set and inner is non-NULL.
15184  */
15185 void AcceptChannel_free(struct LDKAcceptChannel this_obj);
15186
15187 /**
15188  * A temporary channel ID, until the funding outpoint is announced
15189  */
15190 const uint8_t (*AcceptChannel_get_temporary_channel_id(const struct LDKAcceptChannel *NONNULL_PTR this_ptr))[32];
15191
15192 /**
15193  * A temporary channel ID, until the funding outpoint is announced
15194  */
15195 void AcceptChannel_set_temporary_channel_id(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
15196
15197 /**
15198  * The threshold below which outputs on transactions broadcast by sender will be omitted
15199  */
15200 uint64_t AcceptChannel_get_dust_limit_satoshis(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
15201
15202 /**
15203  * The threshold below which outputs on transactions broadcast by sender will be omitted
15204  */
15205 void AcceptChannel_set_dust_limit_satoshis(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
15206
15207 /**
15208  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
15209  */
15210 uint64_t AcceptChannel_get_max_htlc_value_in_flight_msat(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
15211
15212 /**
15213  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
15214  */
15215 void AcceptChannel_set_max_htlc_value_in_flight_msat(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
15216
15217 /**
15218  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
15219  */
15220 uint64_t AcceptChannel_get_channel_reserve_satoshis(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
15221
15222 /**
15223  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
15224  */
15225 void AcceptChannel_set_channel_reserve_satoshis(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
15226
15227 /**
15228  * The minimum HTLC size incoming to sender, in milli-satoshi
15229  */
15230 uint64_t AcceptChannel_get_htlc_minimum_msat(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
15231
15232 /**
15233  * The minimum HTLC size incoming to sender, in milli-satoshi
15234  */
15235 void AcceptChannel_set_htlc_minimum_msat(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
15236
15237 /**
15238  * Minimum depth of the funding transaction before the channel is considered open
15239  */
15240 uint32_t AcceptChannel_get_minimum_depth(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
15241
15242 /**
15243  * Minimum depth of the funding transaction before the channel is considered open
15244  */
15245 void AcceptChannel_set_minimum_depth(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint32_t val);
15246
15247 /**
15248  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
15249  */
15250 uint16_t AcceptChannel_get_to_self_delay(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
15251
15252 /**
15253  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
15254  */
15255 void AcceptChannel_set_to_self_delay(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint16_t val);
15256
15257 /**
15258  * The maximum number of inbound HTLCs towards sender
15259  */
15260 uint16_t AcceptChannel_get_max_accepted_htlcs(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
15261
15262 /**
15263  * The maximum number of inbound HTLCs towards sender
15264  */
15265 void AcceptChannel_set_max_accepted_htlcs(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint16_t val);
15266
15267 /**
15268  * The sender's key controlling the funding transaction
15269  */
15270 struct LDKPublicKey AcceptChannel_get_funding_pubkey(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
15271
15272 /**
15273  * The sender's key controlling the funding transaction
15274  */
15275 void AcceptChannel_set_funding_pubkey(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
15276
15277 /**
15278  * Used to derive a revocation key for transactions broadcast by counterparty
15279  */
15280 struct LDKPublicKey AcceptChannel_get_revocation_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
15281
15282 /**
15283  * Used to derive a revocation key for transactions broadcast by counterparty
15284  */
15285 void AcceptChannel_set_revocation_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
15286
15287 /**
15288  * A payment key to sender for transactions broadcast by counterparty
15289  */
15290 struct LDKPublicKey AcceptChannel_get_payment_point(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
15291
15292 /**
15293  * A payment key to sender for transactions broadcast by counterparty
15294  */
15295 void AcceptChannel_set_payment_point(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
15296
15297 /**
15298  * Used to derive a payment key to sender for transactions broadcast by sender
15299  */
15300 struct LDKPublicKey AcceptChannel_get_delayed_payment_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
15301
15302 /**
15303  * Used to derive a payment key to sender for transactions broadcast by sender
15304  */
15305 void AcceptChannel_set_delayed_payment_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
15306
15307 /**
15308  * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
15309  */
15310 struct LDKPublicKey AcceptChannel_get_htlc_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
15311
15312 /**
15313  * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
15314  */
15315 void AcceptChannel_set_htlc_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
15316
15317 /**
15318  * The first to-be-broadcast-by-sender transaction's per commitment point
15319  */
15320 struct LDKPublicKey AcceptChannel_get_first_per_commitment_point(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
15321
15322 /**
15323  * The first to-be-broadcast-by-sender transaction's per commitment point
15324  */
15325 void AcceptChannel_set_first_per_commitment_point(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
15326
15327 /**
15328  * Creates a copy of the AcceptChannel
15329  */
15330 struct LDKAcceptChannel AcceptChannel_clone(const struct LDKAcceptChannel *NONNULL_PTR orig);
15331
15332 /**
15333  * Frees any resources used by the FundingCreated, if is_owned is set and inner is non-NULL.
15334  */
15335 void FundingCreated_free(struct LDKFundingCreated this_obj);
15336
15337 /**
15338  * A temporary channel ID, until the funding is established
15339  */
15340 const uint8_t (*FundingCreated_get_temporary_channel_id(const struct LDKFundingCreated *NONNULL_PTR this_ptr))[32];
15341
15342 /**
15343  * A temporary channel ID, until the funding is established
15344  */
15345 void FundingCreated_set_temporary_channel_id(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
15346
15347 /**
15348  * The funding transaction ID
15349  */
15350 const uint8_t (*FundingCreated_get_funding_txid(const struct LDKFundingCreated *NONNULL_PTR this_ptr))[32];
15351
15352 /**
15353  * The funding transaction ID
15354  */
15355 void FundingCreated_set_funding_txid(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
15356
15357 /**
15358  * The specific output index funding this channel
15359  */
15360 uint16_t FundingCreated_get_funding_output_index(const struct LDKFundingCreated *NONNULL_PTR this_ptr);
15361
15362 /**
15363  * The specific output index funding this channel
15364  */
15365 void FundingCreated_set_funding_output_index(struct LDKFundingCreated *NONNULL_PTR this_ptr, uint16_t val);
15366
15367 /**
15368  * The signature of the channel initiator (funder) on the funding transaction
15369  */
15370 struct LDKSignature FundingCreated_get_signature(const struct LDKFundingCreated *NONNULL_PTR this_ptr);
15371
15372 /**
15373  * The signature of the channel initiator (funder) on the funding transaction
15374  */
15375 void FundingCreated_set_signature(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKSignature val);
15376
15377 /**
15378  * Constructs a new FundingCreated given each field
15379  */
15380 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);
15381
15382 /**
15383  * Creates a copy of the FundingCreated
15384  */
15385 struct LDKFundingCreated FundingCreated_clone(const struct LDKFundingCreated *NONNULL_PTR orig);
15386
15387 /**
15388  * Frees any resources used by the FundingSigned, if is_owned is set and inner is non-NULL.
15389  */
15390 void FundingSigned_free(struct LDKFundingSigned this_obj);
15391
15392 /**
15393  * The channel ID
15394  */
15395 const uint8_t (*FundingSigned_get_channel_id(const struct LDKFundingSigned *NONNULL_PTR this_ptr))[32];
15396
15397 /**
15398  * The channel ID
15399  */
15400 void FundingSigned_set_channel_id(struct LDKFundingSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
15401
15402 /**
15403  * The signature of the channel acceptor (fundee) on the funding transaction
15404  */
15405 struct LDKSignature FundingSigned_get_signature(const struct LDKFundingSigned *NONNULL_PTR this_ptr);
15406
15407 /**
15408  * The signature of the channel acceptor (fundee) on the funding transaction
15409  */
15410 void FundingSigned_set_signature(struct LDKFundingSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
15411
15412 /**
15413  * Constructs a new FundingSigned given each field
15414  */
15415 MUST_USE_RES struct LDKFundingSigned FundingSigned_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKSignature signature_arg);
15416
15417 /**
15418  * Creates a copy of the FundingSigned
15419  */
15420 struct LDKFundingSigned FundingSigned_clone(const struct LDKFundingSigned *NONNULL_PTR orig);
15421
15422 /**
15423  * Frees any resources used by the FundingLocked, if is_owned is set and inner is non-NULL.
15424  */
15425 void FundingLocked_free(struct LDKFundingLocked this_obj);
15426
15427 /**
15428  * The channel ID
15429  */
15430 const uint8_t (*FundingLocked_get_channel_id(const struct LDKFundingLocked *NONNULL_PTR this_ptr))[32];
15431
15432 /**
15433  * The channel ID
15434  */
15435 void FundingLocked_set_channel_id(struct LDKFundingLocked *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
15436
15437 /**
15438  * The per-commitment point of the second commitment transaction
15439  */
15440 struct LDKPublicKey FundingLocked_get_next_per_commitment_point(const struct LDKFundingLocked *NONNULL_PTR this_ptr);
15441
15442 /**
15443  * The per-commitment point of the second commitment transaction
15444  */
15445 void FundingLocked_set_next_per_commitment_point(struct LDKFundingLocked *NONNULL_PTR this_ptr, struct LDKPublicKey val);
15446
15447 /**
15448  * Constructs a new FundingLocked given each field
15449  */
15450 MUST_USE_RES struct LDKFundingLocked FundingLocked_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKPublicKey next_per_commitment_point_arg);
15451
15452 /**
15453  * Creates a copy of the FundingLocked
15454  */
15455 struct LDKFundingLocked FundingLocked_clone(const struct LDKFundingLocked *NONNULL_PTR orig);
15456
15457 /**
15458  * Frees any resources used by the Shutdown, if is_owned is set and inner is non-NULL.
15459  */
15460 void Shutdown_free(struct LDKShutdown this_obj);
15461
15462 /**
15463  * The channel ID
15464  */
15465 const uint8_t (*Shutdown_get_channel_id(const struct LDKShutdown *NONNULL_PTR this_ptr))[32];
15466
15467 /**
15468  * The channel ID
15469  */
15470 void Shutdown_set_channel_id(struct LDKShutdown *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
15471
15472 /**
15473  * The destination of this peer's funds on closing.
15474  * Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh.
15475  */
15476 struct LDKu8slice Shutdown_get_scriptpubkey(const struct LDKShutdown *NONNULL_PTR this_ptr);
15477
15478 /**
15479  * The destination of this peer's funds on closing.
15480  * Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh.
15481  */
15482 void Shutdown_set_scriptpubkey(struct LDKShutdown *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
15483
15484 /**
15485  * Constructs a new Shutdown given each field
15486  */
15487 MUST_USE_RES struct LDKShutdown Shutdown_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKCVec_u8Z scriptpubkey_arg);
15488
15489 /**
15490  * Creates a copy of the Shutdown
15491  */
15492 struct LDKShutdown Shutdown_clone(const struct LDKShutdown *NONNULL_PTR orig);
15493
15494 /**
15495  * Frees any resources used by the ClosingSignedFeeRange, if is_owned is set and inner is non-NULL.
15496  */
15497 void ClosingSignedFeeRange_free(struct LDKClosingSignedFeeRange this_obj);
15498
15499 /**
15500  * The minimum absolute fee, in satoshis, which the sender is willing to place on the closing
15501  * transaction.
15502  */
15503 uint64_t ClosingSignedFeeRange_get_min_fee_satoshis(const struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr);
15504
15505 /**
15506  * The minimum absolute fee, in satoshis, which the sender is willing to place on the closing
15507  * transaction.
15508  */
15509 void ClosingSignedFeeRange_set_min_fee_satoshis(struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr, uint64_t val);
15510
15511 /**
15512  * The maximum absolute fee, in satoshis, which the sender is willing to place on the closing
15513  * transaction.
15514  */
15515 uint64_t ClosingSignedFeeRange_get_max_fee_satoshis(const struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr);
15516
15517 /**
15518  * The maximum absolute fee, in satoshis, which the sender is willing to place on the closing
15519  * transaction.
15520  */
15521 void ClosingSignedFeeRange_set_max_fee_satoshis(struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr, uint64_t val);
15522
15523 /**
15524  * Constructs a new ClosingSignedFeeRange given each field
15525  */
15526 MUST_USE_RES struct LDKClosingSignedFeeRange ClosingSignedFeeRange_new(uint64_t min_fee_satoshis_arg, uint64_t max_fee_satoshis_arg);
15527
15528 /**
15529  * Creates a copy of the ClosingSignedFeeRange
15530  */
15531 struct LDKClosingSignedFeeRange ClosingSignedFeeRange_clone(const struct LDKClosingSignedFeeRange *NONNULL_PTR orig);
15532
15533 /**
15534  * Frees any resources used by the ClosingSigned, if is_owned is set and inner is non-NULL.
15535  */
15536 void ClosingSigned_free(struct LDKClosingSigned this_obj);
15537
15538 /**
15539  * The channel ID
15540  */
15541 const uint8_t (*ClosingSigned_get_channel_id(const struct LDKClosingSigned *NONNULL_PTR this_ptr))[32];
15542
15543 /**
15544  * The channel ID
15545  */
15546 void ClosingSigned_set_channel_id(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
15547
15548 /**
15549  * The proposed total fee for the closing transaction
15550  */
15551 uint64_t ClosingSigned_get_fee_satoshis(const struct LDKClosingSigned *NONNULL_PTR this_ptr);
15552
15553 /**
15554  * The proposed total fee for the closing transaction
15555  */
15556 void ClosingSigned_set_fee_satoshis(struct LDKClosingSigned *NONNULL_PTR this_ptr, uint64_t val);
15557
15558 /**
15559  * A signature on the closing transaction
15560  */
15561 struct LDKSignature ClosingSigned_get_signature(const struct LDKClosingSigned *NONNULL_PTR this_ptr);
15562
15563 /**
15564  * A signature on the closing transaction
15565  */
15566 void ClosingSigned_set_signature(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
15567
15568 /**
15569  * The minimum and maximum fees which the sender is willing to accept, provided only by new
15570  * nodes.
15571  *
15572  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
15573  */
15574 struct LDKClosingSignedFeeRange ClosingSigned_get_fee_range(const struct LDKClosingSigned *NONNULL_PTR this_ptr);
15575
15576 /**
15577  * The minimum and maximum fees which the sender is willing to accept, provided only by new
15578  * nodes.
15579  *
15580  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
15581  */
15582 void ClosingSigned_set_fee_range(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKClosingSignedFeeRange val);
15583
15584 /**
15585  * Constructs a new ClosingSigned given each field
15586  */
15587 MUST_USE_RES struct LDKClosingSigned ClosingSigned_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t fee_satoshis_arg, struct LDKSignature signature_arg, struct LDKClosingSignedFeeRange fee_range_arg);
15588
15589 /**
15590  * Creates a copy of the ClosingSigned
15591  */
15592 struct LDKClosingSigned ClosingSigned_clone(const struct LDKClosingSigned *NONNULL_PTR orig);
15593
15594 /**
15595  * Frees any resources used by the UpdateAddHTLC, if is_owned is set and inner is non-NULL.
15596  */
15597 void UpdateAddHTLC_free(struct LDKUpdateAddHTLC this_obj);
15598
15599 /**
15600  * The channel ID
15601  */
15602 const uint8_t (*UpdateAddHTLC_get_channel_id(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr))[32];
15603
15604 /**
15605  * The channel ID
15606  */
15607 void UpdateAddHTLC_set_channel_id(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
15608
15609 /**
15610  * The HTLC ID
15611  */
15612 uint64_t UpdateAddHTLC_get_htlc_id(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
15613
15614 /**
15615  * The HTLC ID
15616  */
15617 void UpdateAddHTLC_set_htlc_id(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint64_t val);
15618
15619 /**
15620  * The HTLC value in milli-satoshi
15621  */
15622 uint64_t UpdateAddHTLC_get_amount_msat(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
15623
15624 /**
15625  * The HTLC value in milli-satoshi
15626  */
15627 void UpdateAddHTLC_set_amount_msat(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint64_t val);
15628
15629 /**
15630  * The payment hash, the pre-image of which controls HTLC redemption
15631  */
15632 const uint8_t (*UpdateAddHTLC_get_payment_hash(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr))[32];
15633
15634 /**
15635  * The payment hash, the pre-image of which controls HTLC redemption
15636  */
15637 void UpdateAddHTLC_set_payment_hash(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
15638
15639 /**
15640  * The expiry height of the HTLC
15641  */
15642 uint32_t UpdateAddHTLC_get_cltv_expiry(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
15643
15644 /**
15645  * The expiry height of the HTLC
15646  */
15647 void UpdateAddHTLC_set_cltv_expiry(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint32_t val);
15648
15649 /**
15650  * Creates a copy of the UpdateAddHTLC
15651  */
15652 struct LDKUpdateAddHTLC UpdateAddHTLC_clone(const struct LDKUpdateAddHTLC *NONNULL_PTR orig);
15653
15654 /**
15655  * Frees any resources used by the UpdateFulfillHTLC, if is_owned is set and inner is non-NULL.
15656  */
15657 void UpdateFulfillHTLC_free(struct LDKUpdateFulfillHTLC this_obj);
15658
15659 /**
15660  * The channel ID
15661  */
15662 const uint8_t (*UpdateFulfillHTLC_get_channel_id(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr))[32];
15663
15664 /**
15665  * The channel ID
15666  */
15667 void UpdateFulfillHTLC_set_channel_id(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
15668
15669 /**
15670  * The HTLC ID
15671  */
15672 uint64_t UpdateFulfillHTLC_get_htlc_id(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr);
15673
15674 /**
15675  * The HTLC ID
15676  */
15677 void UpdateFulfillHTLC_set_htlc_id(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, uint64_t val);
15678
15679 /**
15680  * The pre-image of the payment hash, allowing HTLC redemption
15681  */
15682 const uint8_t (*UpdateFulfillHTLC_get_payment_preimage(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr))[32];
15683
15684 /**
15685  * The pre-image of the payment hash, allowing HTLC redemption
15686  */
15687 void UpdateFulfillHTLC_set_payment_preimage(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
15688
15689 /**
15690  * Constructs a new UpdateFulfillHTLC given each field
15691  */
15692 MUST_USE_RES struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t htlc_id_arg, struct LDKThirtyTwoBytes payment_preimage_arg);
15693
15694 /**
15695  * Creates a copy of the UpdateFulfillHTLC
15696  */
15697 struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_clone(const struct LDKUpdateFulfillHTLC *NONNULL_PTR orig);
15698
15699 /**
15700  * Frees any resources used by the UpdateFailHTLC, if is_owned is set and inner is non-NULL.
15701  */
15702 void UpdateFailHTLC_free(struct LDKUpdateFailHTLC this_obj);
15703
15704 /**
15705  * The channel ID
15706  */
15707 const uint8_t (*UpdateFailHTLC_get_channel_id(const struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr))[32];
15708
15709 /**
15710  * The channel ID
15711  */
15712 void UpdateFailHTLC_set_channel_id(struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
15713
15714 /**
15715  * The HTLC ID
15716  */
15717 uint64_t UpdateFailHTLC_get_htlc_id(const struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr);
15718
15719 /**
15720  * The HTLC ID
15721  */
15722 void UpdateFailHTLC_set_htlc_id(struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr, uint64_t val);
15723
15724 /**
15725  * Creates a copy of the UpdateFailHTLC
15726  */
15727 struct LDKUpdateFailHTLC UpdateFailHTLC_clone(const struct LDKUpdateFailHTLC *NONNULL_PTR orig);
15728
15729 /**
15730  * Frees any resources used by the UpdateFailMalformedHTLC, if is_owned is set and inner is non-NULL.
15731  */
15732 void UpdateFailMalformedHTLC_free(struct LDKUpdateFailMalformedHTLC this_obj);
15733
15734 /**
15735  * The channel ID
15736  */
15737 const uint8_t (*UpdateFailMalformedHTLC_get_channel_id(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr))[32];
15738
15739 /**
15740  * The channel ID
15741  */
15742 void UpdateFailMalformedHTLC_set_channel_id(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
15743
15744 /**
15745  * The HTLC ID
15746  */
15747 uint64_t UpdateFailMalformedHTLC_get_htlc_id(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr);
15748
15749 /**
15750  * The HTLC ID
15751  */
15752 void UpdateFailMalformedHTLC_set_htlc_id(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, uint64_t val);
15753
15754 /**
15755  * The failure code
15756  */
15757 uint16_t UpdateFailMalformedHTLC_get_failure_code(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr);
15758
15759 /**
15760  * The failure code
15761  */
15762 void UpdateFailMalformedHTLC_set_failure_code(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, uint16_t val);
15763
15764 /**
15765  * Creates a copy of the UpdateFailMalformedHTLC
15766  */
15767 struct LDKUpdateFailMalformedHTLC UpdateFailMalformedHTLC_clone(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR orig);
15768
15769 /**
15770  * Frees any resources used by the CommitmentSigned, if is_owned is set and inner is non-NULL.
15771  */
15772 void CommitmentSigned_free(struct LDKCommitmentSigned this_obj);
15773
15774 /**
15775  * The channel ID
15776  */
15777 const uint8_t (*CommitmentSigned_get_channel_id(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr))[32];
15778
15779 /**
15780  * The channel ID
15781  */
15782 void CommitmentSigned_set_channel_id(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
15783
15784 /**
15785  * A signature on the commitment transaction
15786  */
15787 struct LDKSignature CommitmentSigned_get_signature(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr);
15788
15789 /**
15790  * A signature on the commitment transaction
15791  */
15792 void CommitmentSigned_set_signature(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
15793
15794 /**
15795  * Signatures on the HTLC transactions
15796  */
15797 void CommitmentSigned_set_htlc_signatures(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKCVec_SignatureZ val);
15798
15799 /**
15800  * Constructs a new CommitmentSigned given each field
15801  */
15802 MUST_USE_RES struct LDKCommitmentSigned CommitmentSigned_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKSignature signature_arg, struct LDKCVec_SignatureZ htlc_signatures_arg);
15803
15804 /**
15805  * Creates a copy of the CommitmentSigned
15806  */
15807 struct LDKCommitmentSigned CommitmentSigned_clone(const struct LDKCommitmentSigned *NONNULL_PTR orig);
15808
15809 /**
15810  * Frees any resources used by the RevokeAndACK, if is_owned is set and inner is non-NULL.
15811  */
15812 void RevokeAndACK_free(struct LDKRevokeAndACK this_obj);
15813
15814 /**
15815  * The channel ID
15816  */
15817 const uint8_t (*RevokeAndACK_get_channel_id(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr))[32];
15818
15819 /**
15820  * The channel ID
15821  */
15822 void RevokeAndACK_set_channel_id(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
15823
15824 /**
15825  * The secret corresponding to the per-commitment point
15826  */
15827 const uint8_t (*RevokeAndACK_get_per_commitment_secret(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr))[32];
15828
15829 /**
15830  * The secret corresponding to the per-commitment point
15831  */
15832 void RevokeAndACK_set_per_commitment_secret(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
15833
15834 /**
15835  * The next sender-broadcast commitment transaction's per-commitment point
15836  */
15837 struct LDKPublicKey RevokeAndACK_get_next_per_commitment_point(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr);
15838
15839 /**
15840  * The next sender-broadcast commitment transaction's per-commitment point
15841  */
15842 void RevokeAndACK_set_next_per_commitment_point(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKPublicKey val);
15843
15844 /**
15845  * Constructs a new RevokeAndACK given each field
15846  */
15847 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);
15848
15849 /**
15850  * Creates a copy of the RevokeAndACK
15851  */
15852 struct LDKRevokeAndACK RevokeAndACK_clone(const struct LDKRevokeAndACK *NONNULL_PTR orig);
15853
15854 /**
15855  * Frees any resources used by the UpdateFee, if is_owned is set and inner is non-NULL.
15856  */
15857 void UpdateFee_free(struct LDKUpdateFee this_obj);
15858
15859 /**
15860  * The channel ID
15861  */
15862 const uint8_t (*UpdateFee_get_channel_id(const struct LDKUpdateFee *NONNULL_PTR this_ptr))[32];
15863
15864 /**
15865  * The channel ID
15866  */
15867 void UpdateFee_set_channel_id(struct LDKUpdateFee *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
15868
15869 /**
15870  * Fee rate per 1000-weight of the transaction
15871  */
15872 uint32_t UpdateFee_get_feerate_per_kw(const struct LDKUpdateFee *NONNULL_PTR this_ptr);
15873
15874 /**
15875  * Fee rate per 1000-weight of the transaction
15876  */
15877 void UpdateFee_set_feerate_per_kw(struct LDKUpdateFee *NONNULL_PTR this_ptr, uint32_t val);
15878
15879 /**
15880  * Constructs a new UpdateFee given each field
15881  */
15882 MUST_USE_RES struct LDKUpdateFee UpdateFee_new(struct LDKThirtyTwoBytes channel_id_arg, uint32_t feerate_per_kw_arg);
15883
15884 /**
15885  * Creates a copy of the UpdateFee
15886  */
15887 struct LDKUpdateFee UpdateFee_clone(const struct LDKUpdateFee *NONNULL_PTR orig);
15888
15889 /**
15890  * Frees any resources used by the DataLossProtect, if is_owned is set and inner is non-NULL.
15891  */
15892 void DataLossProtect_free(struct LDKDataLossProtect this_obj);
15893
15894 /**
15895  * Proof that the sender knows the per-commitment secret of a specific commitment transaction
15896  * belonging to the recipient
15897  */
15898 const uint8_t (*DataLossProtect_get_your_last_per_commitment_secret(const struct LDKDataLossProtect *NONNULL_PTR this_ptr))[32];
15899
15900 /**
15901  * Proof that the sender knows the per-commitment secret of a specific commitment transaction
15902  * belonging to the recipient
15903  */
15904 void DataLossProtect_set_your_last_per_commitment_secret(struct LDKDataLossProtect *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
15905
15906 /**
15907  * The sender's per-commitment point for their current commitment transaction
15908  */
15909 struct LDKPublicKey DataLossProtect_get_my_current_per_commitment_point(const struct LDKDataLossProtect *NONNULL_PTR this_ptr);
15910
15911 /**
15912  * The sender's per-commitment point for their current commitment transaction
15913  */
15914 void DataLossProtect_set_my_current_per_commitment_point(struct LDKDataLossProtect *NONNULL_PTR this_ptr, struct LDKPublicKey val);
15915
15916 /**
15917  * Constructs a new DataLossProtect given each field
15918  */
15919 MUST_USE_RES struct LDKDataLossProtect DataLossProtect_new(struct LDKThirtyTwoBytes your_last_per_commitment_secret_arg, struct LDKPublicKey my_current_per_commitment_point_arg);
15920
15921 /**
15922  * Creates a copy of the DataLossProtect
15923  */
15924 struct LDKDataLossProtect DataLossProtect_clone(const struct LDKDataLossProtect *NONNULL_PTR orig);
15925
15926 /**
15927  * Frees any resources used by the ChannelReestablish, if is_owned is set and inner is non-NULL.
15928  */
15929 void ChannelReestablish_free(struct LDKChannelReestablish this_obj);
15930
15931 /**
15932  * The channel ID
15933  */
15934 const uint8_t (*ChannelReestablish_get_channel_id(const struct LDKChannelReestablish *NONNULL_PTR this_ptr))[32];
15935
15936 /**
15937  * The channel ID
15938  */
15939 void ChannelReestablish_set_channel_id(struct LDKChannelReestablish *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
15940
15941 /**
15942  * The next commitment number for the sender
15943  */
15944 uint64_t ChannelReestablish_get_next_local_commitment_number(const struct LDKChannelReestablish *NONNULL_PTR this_ptr);
15945
15946 /**
15947  * The next commitment number for the sender
15948  */
15949 void ChannelReestablish_set_next_local_commitment_number(struct LDKChannelReestablish *NONNULL_PTR this_ptr, uint64_t val);
15950
15951 /**
15952  * The next commitment number for the recipient
15953  */
15954 uint64_t ChannelReestablish_get_next_remote_commitment_number(const struct LDKChannelReestablish *NONNULL_PTR this_ptr);
15955
15956 /**
15957  * The next commitment number for the recipient
15958  */
15959 void ChannelReestablish_set_next_remote_commitment_number(struct LDKChannelReestablish *NONNULL_PTR this_ptr, uint64_t val);
15960
15961 /**
15962  * Creates a copy of the ChannelReestablish
15963  */
15964 struct LDKChannelReestablish ChannelReestablish_clone(const struct LDKChannelReestablish *NONNULL_PTR orig);
15965
15966 /**
15967  * Frees any resources used by the AnnouncementSignatures, if is_owned is set and inner is non-NULL.
15968  */
15969 void AnnouncementSignatures_free(struct LDKAnnouncementSignatures this_obj);
15970
15971 /**
15972  * The channel ID
15973  */
15974 const uint8_t (*AnnouncementSignatures_get_channel_id(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr))[32];
15975
15976 /**
15977  * The channel ID
15978  */
15979 void AnnouncementSignatures_set_channel_id(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
15980
15981 /**
15982  * The short channel ID
15983  */
15984 uint64_t AnnouncementSignatures_get_short_channel_id(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
15985
15986 /**
15987  * The short channel ID
15988  */
15989 void AnnouncementSignatures_set_short_channel_id(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, uint64_t val);
15990
15991 /**
15992  * A signature by the node key
15993  */
15994 struct LDKSignature AnnouncementSignatures_get_node_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
15995
15996 /**
15997  * A signature by the node key
15998  */
15999 void AnnouncementSignatures_set_node_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKSignature val);
16000
16001 /**
16002  * A signature by the funding key
16003  */
16004 struct LDKSignature AnnouncementSignatures_get_bitcoin_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
16005
16006 /**
16007  * A signature by the funding key
16008  */
16009 void AnnouncementSignatures_set_bitcoin_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKSignature val);
16010
16011 /**
16012  * Constructs a new AnnouncementSignatures given each field
16013  */
16014 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);
16015
16016 /**
16017  * Creates a copy of the AnnouncementSignatures
16018  */
16019 struct LDKAnnouncementSignatures AnnouncementSignatures_clone(const struct LDKAnnouncementSignatures *NONNULL_PTR orig);
16020
16021 /**
16022  * Frees any resources used by the NetAddress
16023  */
16024 void NetAddress_free(struct LDKNetAddress this_ptr);
16025
16026 /**
16027  * Creates a copy of the NetAddress
16028  */
16029 struct LDKNetAddress NetAddress_clone(const struct LDKNetAddress *NONNULL_PTR orig);
16030
16031 /**
16032  * Utility method to constructs a new IPv4-variant NetAddress
16033  */
16034 struct LDKNetAddress NetAddress_ipv4(struct LDKFourBytes addr, uint16_t port);
16035
16036 /**
16037  * Utility method to constructs a new IPv6-variant NetAddress
16038  */
16039 struct LDKNetAddress NetAddress_ipv6(struct LDKSixteenBytes addr, uint16_t port);
16040
16041 /**
16042  * Utility method to constructs a new OnionV2-variant NetAddress
16043  */
16044 struct LDKNetAddress NetAddress_onion_v2(struct LDKTenBytes addr, uint16_t port);
16045
16046 /**
16047  * Utility method to constructs a new OnionV3-variant NetAddress
16048  */
16049 struct LDKNetAddress NetAddress_onion_v3(struct LDKThirtyTwoBytes ed25519_pubkey, uint16_t checksum, uint8_t version, uint16_t port);
16050
16051 /**
16052  * Serialize the NetAddress object into a byte array which can be read by NetAddress_read
16053  */
16054 struct LDKCVec_u8Z NetAddress_write(const struct LDKNetAddress *NONNULL_PTR obj);
16055
16056 /**
16057  * Read a Result from a byte array, created by Result_write
16058  */
16059 struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ Result_read(struct LDKu8slice ser);
16060
16061 /**
16062  * Read a NetAddress from a byte array, created by NetAddress_write
16063  */
16064 struct LDKCResult_NetAddressDecodeErrorZ NetAddress_read(struct LDKu8slice ser);
16065
16066 /**
16067  * Frees any resources used by the UnsignedNodeAnnouncement, if is_owned is set and inner is non-NULL.
16068  */
16069 void UnsignedNodeAnnouncement_free(struct LDKUnsignedNodeAnnouncement this_obj);
16070
16071 /**
16072  * The advertised features
16073  */
16074 struct LDKNodeFeatures UnsignedNodeAnnouncement_get_features(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
16075
16076 /**
16077  * The advertised features
16078  */
16079 void UnsignedNodeAnnouncement_set_features(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
16080
16081 /**
16082  * A strictly monotonic announcement counter, with gaps allowed
16083  */
16084 uint32_t UnsignedNodeAnnouncement_get_timestamp(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
16085
16086 /**
16087  * A strictly monotonic announcement counter, with gaps allowed
16088  */
16089 void UnsignedNodeAnnouncement_set_timestamp(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, uint32_t val);
16090
16091 /**
16092  * The node_id this announcement originated from (don't rebroadcast the node_announcement back
16093  * to this node).
16094  */
16095 struct LDKPublicKey UnsignedNodeAnnouncement_get_node_id(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
16096
16097 /**
16098  * The node_id this announcement originated from (don't rebroadcast the node_announcement back
16099  * to this node).
16100  */
16101 void UnsignedNodeAnnouncement_set_node_id(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
16102
16103 /**
16104  * An RGB color for UI purposes
16105  */
16106 const uint8_t (*UnsignedNodeAnnouncement_get_rgb(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr))[3];
16107
16108 /**
16109  * An RGB color for UI purposes
16110  */
16111 void UnsignedNodeAnnouncement_set_rgb(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKThreeBytes val);
16112
16113 /**
16114  * An alias, for UI purposes.  This should be sanitized before use.  There is no guarantee
16115  * of uniqueness.
16116  */
16117 const uint8_t (*UnsignedNodeAnnouncement_get_alias(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr))[32];
16118
16119 /**
16120  * An alias, for UI purposes.  This should be sanitized before use.  There is no guarantee
16121  * of uniqueness.
16122  */
16123 void UnsignedNodeAnnouncement_set_alias(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
16124
16125 /**
16126  * List of addresses on which this node is reachable
16127  */
16128 void UnsignedNodeAnnouncement_set_addresses(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKCVec_NetAddressZ val);
16129
16130 /**
16131  * Creates a copy of the UnsignedNodeAnnouncement
16132  */
16133 struct LDKUnsignedNodeAnnouncement UnsignedNodeAnnouncement_clone(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR orig);
16134
16135 /**
16136  * Frees any resources used by the NodeAnnouncement, if is_owned is set and inner is non-NULL.
16137  */
16138 void NodeAnnouncement_free(struct LDKNodeAnnouncement this_obj);
16139
16140 /**
16141  * The signature by the node key
16142  */
16143 struct LDKSignature NodeAnnouncement_get_signature(const struct LDKNodeAnnouncement *NONNULL_PTR this_ptr);
16144
16145 /**
16146  * The signature by the node key
16147  */
16148 void NodeAnnouncement_set_signature(struct LDKNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
16149
16150 /**
16151  * The actual content of the announcement
16152  */
16153 struct LDKUnsignedNodeAnnouncement NodeAnnouncement_get_contents(const struct LDKNodeAnnouncement *NONNULL_PTR this_ptr);
16154
16155 /**
16156  * The actual content of the announcement
16157  */
16158 void NodeAnnouncement_set_contents(struct LDKNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKUnsignedNodeAnnouncement val);
16159
16160 /**
16161  * Constructs a new NodeAnnouncement given each field
16162  */
16163 MUST_USE_RES struct LDKNodeAnnouncement NodeAnnouncement_new(struct LDKSignature signature_arg, struct LDKUnsignedNodeAnnouncement contents_arg);
16164
16165 /**
16166  * Creates a copy of the NodeAnnouncement
16167  */
16168 struct LDKNodeAnnouncement NodeAnnouncement_clone(const struct LDKNodeAnnouncement *NONNULL_PTR orig);
16169
16170 /**
16171  * Frees any resources used by the UnsignedChannelAnnouncement, if is_owned is set and inner is non-NULL.
16172  */
16173 void UnsignedChannelAnnouncement_free(struct LDKUnsignedChannelAnnouncement this_obj);
16174
16175 /**
16176  * The advertised channel features
16177  */
16178 struct LDKChannelFeatures UnsignedChannelAnnouncement_get_features(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
16179
16180 /**
16181  * The advertised channel features
16182  */
16183 void UnsignedChannelAnnouncement_set_features(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
16184
16185 /**
16186  * The genesis hash of the blockchain where the channel is to be opened
16187  */
16188 const uint8_t (*UnsignedChannelAnnouncement_get_chain_hash(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr))[32];
16189
16190 /**
16191  * The genesis hash of the blockchain where the channel is to be opened
16192  */
16193 void UnsignedChannelAnnouncement_set_chain_hash(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
16194
16195 /**
16196  * The short channel ID
16197  */
16198 uint64_t UnsignedChannelAnnouncement_get_short_channel_id(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
16199
16200 /**
16201  * The short channel ID
16202  */
16203 void UnsignedChannelAnnouncement_set_short_channel_id(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, uint64_t val);
16204
16205 /**
16206  * One of the two node_ids which are endpoints of this channel
16207  */
16208 struct LDKPublicKey UnsignedChannelAnnouncement_get_node_id_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
16209
16210 /**
16211  * One of the two node_ids which are endpoints of this channel
16212  */
16213 void UnsignedChannelAnnouncement_set_node_id_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
16214
16215 /**
16216  * The other of the two node_ids which are endpoints of this channel
16217  */
16218 struct LDKPublicKey UnsignedChannelAnnouncement_get_node_id_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
16219
16220 /**
16221  * The other of the two node_ids which are endpoints of this channel
16222  */
16223 void UnsignedChannelAnnouncement_set_node_id_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
16224
16225 /**
16226  * The funding key for the first node
16227  */
16228 struct LDKPublicKey UnsignedChannelAnnouncement_get_bitcoin_key_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
16229
16230 /**
16231  * The funding key for the first node
16232  */
16233 void UnsignedChannelAnnouncement_set_bitcoin_key_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
16234
16235 /**
16236  * The funding key for the second node
16237  */
16238 struct LDKPublicKey UnsignedChannelAnnouncement_get_bitcoin_key_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
16239
16240 /**
16241  * The funding key for the second node
16242  */
16243 void UnsignedChannelAnnouncement_set_bitcoin_key_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
16244
16245 /**
16246  * Creates a copy of the UnsignedChannelAnnouncement
16247  */
16248 struct LDKUnsignedChannelAnnouncement UnsignedChannelAnnouncement_clone(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR orig);
16249
16250 /**
16251  * Frees any resources used by the ChannelAnnouncement, if is_owned is set and inner is non-NULL.
16252  */
16253 void ChannelAnnouncement_free(struct LDKChannelAnnouncement this_obj);
16254
16255 /**
16256  * Authentication of the announcement by the first public node
16257  */
16258 struct LDKSignature ChannelAnnouncement_get_node_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
16259
16260 /**
16261  * Authentication of the announcement by the first public node
16262  */
16263 void ChannelAnnouncement_set_node_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
16264
16265 /**
16266  * Authentication of the announcement by the second public node
16267  */
16268 struct LDKSignature ChannelAnnouncement_get_node_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
16269
16270 /**
16271  * Authentication of the announcement by the second public node
16272  */
16273 void ChannelAnnouncement_set_node_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
16274
16275 /**
16276  * Proof of funding UTXO ownership by the first public node
16277  */
16278 struct LDKSignature ChannelAnnouncement_get_bitcoin_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
16279
16280 /**
16281  * Proof of funding UTXO ownership by the first public node
16282  */
16283 void ChannelAnnouncement_set_bitcoin_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
16284
16285 /**
16286  * Proof of funding UTXO ownership by the second public node
16287  */
16288 struct LDKSignature ChannelAnnouncement_get_bitcoin_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
16289
16290 /**
16291  * Proof of funding UTXO ownership by the second public node
16292  */
16293 void ChannelAnnouncement_set_bitcoin_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
16294
16295 /**
16296  * The actual announcement
16297  */
16298 struct LDKUnsignedChannelAnnouncement ChannelAnnouncement_get_contents(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
16299
16300 /**
16301  * The actual announcement
16302  */
16303 void ChannelAnnouncement_set_contents(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKUnsignedChannelAnnouncement val);
16304
16305 /**
16306  * Constructs a new ChannelAnnouncement given each field
16307  */
16308 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);
16309
16310 /**
16311  * Creates a copy of the ChannelAnnouncement
16312  */
16313 struct LDKChannelAnnouncement ChannelAnnouncement_clone(const struct LDKChannelAnnouncement *NONNULL_PTR orig);
16314
16315 /**
16316  * Frees any resources used by the UnsignedChannelUpdate, if is_owned is set and inner is non-NULL.
16317  */
16318 void UnsignedChannelUpdate_free(struct LDKUnsignedChannelUpdate this_obj);
16319
16320 /**
16321  * The genesis hash of the blockchain where the channel is to be opened
16322  */
16323 const uint8_t (*UnsignedChannelUpdate_get_chain_hash(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr))[32];
16324
16325 /**
16326  * The genesis hash of the blockchain where the channel is to be opened
16327  */
16328 void UnsignedChannelUpdate_set_chain_hash(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
16329
16330 /**
16331  * The short channel ID
16332  */
16333 uint64_t UnsignedChannelUpdate_get_short_channel_id(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
16334
16335 /**
16336  * The short channel ID
16337  */
16338 void UnsignedChannelUpdate_set_short_channel_id(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val);
16339
16340 /**
16341  * A strictly monotonic announcement counter, with gaps allowed, specific to this channel
16342  */
16343 uint32_t UnsignedChannelUpdate_get_timestamp(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
16344
16345 /**
16346  * A strictly monotonic announcement counter, with gaps allowed, specific to this channel
16347  */
16348 void UnsignedChannelUpdate_set_timestamp(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
16349
16350 /**
16351  * Channel flags
16352  */
16353 uint8_t UnsignedChannelUpdate_get_flags(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
16354
16355 /**
16356  * Channel flags
16357  */
16358 void UnsignedChannelUpdate_set_flags(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint8_t val);
16359
16360 /**
16361  * The number of blocks such that if:
16362  * `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta`
16363  * then we need to fail the HTLC backwards. When forwarding an HTLC, cltv_expiry_delta determines
16364  * the outgoing HTLC's minimum cltv_expiry value -- so, if an incoming HTLC comes in with a
16365  * cltv_expiry of 100000, and the node we're forwarding to has a cltv_expiry_delta value of 10,
16366  * then we'll check that the outgoing HTLC's cltv_expiry value is at least 100010 before
16367  * forwarding. Note that the HTLC sender is the one who originally sets this value when
16368  * constructing the route.
16369  */
16370 uint16_t UnsignedChannelUpdate_get_cltv_expiry_delta(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
16371
16372 /**
16373  * The number of blocks such that if:
16374  * `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta`
16375  * then we need to fail the HTLC backwards. When forwarding an HTLC, cltv_expiry_delta determines
16376  * the outgoing HTLC's minimum cltv_expiry value -- so, if an incoming HTLC comes in with a
16377  * cltv_expiry of 100000, and the node we're forwarding to has a cltv_expiry_delta value of 10,
16378  * then we'll check that the outgoing HTLC's cltv_expiry value is at least 100010 before
16379  * forwarding. Note that the HTLC sender is the one who originally sets this value when
16380  * constructing the route.
16381  */
16382 void UnsignedChannelUpdate_set_cltv_expiry_delta(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint16_t val);
16383
16384 /**
16385  * The minimum HTLC size incoming to sender, in milli-satoshi
16386  */
16387 uint64_t UnsignedChannelUpdate_get_htlc_minimum_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
16388
16389 /**
16390  * The minimum HTLC size incoming to sender, in milli-satoshi
16391  */
16392 void UnsignedChannelUpdate_set_htlc_minimum_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val);
16393
16394 /**
16395  * The base HTLC fee charged by sender, in milli-satoshi
16396  */
16397 uint32_t UnsignedChannelUpdate_get_fee_base_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
16398
16399 /**
16400  * The base HTLC fee charged by sender, in milli-satoshi
16401  */
16402 void UnsignedChannelUpdate_set_fee_base_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
16403
16404 /**
16405  * The amount to fee multiplier, in micro-satoshi
16406  */
16407 uint32_t UnsignedChannelUpdate_get_fee_proportional_millionths(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
16408
16409 /**
16410  * The amount to fee multiplier, in micro-satoshi
16411  */
16412 void UnsignedChannelUpdate_set_fee_proportional_millionths(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
16413
16414 /**
16415  * Creates a copy of the UnsignedChannelUpdate
16416  */
16417 struct LDKUnsignedChannelUpdate UnsignedChannelUpdate_clone(const struct LDKUnsignedChannelUpdate *NONNULL_PTR orig);
16418
16419 /**
16420  * Frees any resources used by the ChannelUpdate, if is_owned is set and inner is non-NULL.
16421  */
16422 void ChannelUpdate_free(struct LDKChannelUpdate this_obj);
16423
16424 /**
16425  * A signature of the channel update
16426  */
16427 struct LDKSignature ChannelUpdate_get_signature(const struct LDKChannelUpdate *NONNULL_PTR this_ptr);
16428
16429 /**
16430  * A signature of the channel update
16431  */
16432 void ChannelUpdate_set_signature(struct LDKChannelUpdate *NONNULL_PTR this_ptr, struct LDKSignature val);
16433
16434 /**
16435  * The actual channel update
16436  */
16437 struct LDKUnsignedChannelUpdate ChannelUpdate_get_contents(const struct LDKChannelUpdate *NONNULL_PTR this_ptr);
16438
16439 /**
16440  * The actual channel update
16441  */
16442 void ChannelUpdate_set_contents(struct LDKChannelUpdate *NONNULL_PTR this_ptr, struct LDKUnsignedChannelUpdate val);
16443
16444 /**
16445  * Constructs a new ChannelUpdate given each field
16446  */
16447 MUST_USE_RES struct LDKChannelUpdate ChannelUpdate_new(struct LDKSignature signature_arg, struct LDKUnsignedChannelUpdate contents_arg);
16448
16449 /**
16450  * Creates a copy of the ChannelUpdate
16451  */
16452 struct LDKChannelUpdate ChannelUpdate_clone(const struct LDKChannelUpdate *NONNULL_PTR orig);
16453
16454 /**
16455  * Frees any resources used by the QueryChannelRange, if is_owned is set and inner is non-NULL.
16456  */
16457 void QueryChannelRange_free(struct LDKQueryChannelRange this_obj);
16458
16459 /**
16460  * The genesis hash of the blockchain being queried
16461  */
16462 const uint8_t (*QueryChannelRange_get_chain_hash(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr))[32];
16463
16464 /**
16465  * The genesis hash of the blockchain being queried
16466  */
16467 void QueryChannelRange_set_chain_hash(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
16468
16469 /**
16470  * The height of the first block for the channel UTXOs being queried
16471  */
16472 uint32_t QueryChannelRange_get_first_blocknum(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr);
16473
16474 /**
16475  * The height of the first block for the channel UTXOs being queried
16476  */
16477 void QueryChannelRange_set_first_blocknum(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, uint32_t val);
16478
16479 /**
16480  * The number of blocks to include in the query results
16481  */
16482 uint32_t QueryChannelRange_get_number_of_blocks(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr);
16483
16484 /**
16485  * The number of blocks to include in the query results
16486  */
16487 void QueryChannelRange_set_number_of_blocks(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, uint32_t val);
16488
16489 /**
16490  * Constructs a new QueryChannelRange given each field
16491  */
16492 MUST_USE_RES struct LDKQueryChannelRange QueryChannelRange_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_blocknum_arg, uint32_t number_of_blocks_arg);
16493
16494 /**
16495  * Creates a copy of the QueryChannelRange
16496  */
16497 struct LDKQueryChannelRange QueryChannelRange_clone(const struct LDKQueryChannelRange *NONNULL_PTR orig);
16498
16499 /**
16500  * Frees any resources used by the ReplyChannelRange, if is_owned is set and inner is non-NULL.
16501  */
16502 void ReplyChannelRange_free(struct LDKReplyChannelRange this_obj);
16503
16504 /**
16505  * The genesis hash of the blockchain being queried
16506  */
16507 const uint8_t (*ReplyChannelRange_get_chain_hash(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr))[32];
16508
16509 /**
16510  * The genesis hash of the blockchain being queried
16511  */
16512 void ReplyChannelRange_set_chain_hash(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
16513
16514 /**
16515  * The height of the first block in the range of the reply
16516  */
16517 uint32_t ReplyChannelRange_get_first_blocknum(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
16518
16519 /**
16520  * The height of the first block in the range of the reply
16521  */
16522 void ReplyChannelRange_set_first_blocknum(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, uint32_t val);
16523
16524 /**
16525  * The number of blocks included in the range of the reply
16526  */
16527 uint32_t ReplyChannelRange_get_number_of_blocks(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
16528
16529 /**
16530  * The number of blocks included in the range of the reply
16531  */
16532 void ReplyChannelRange_set_number_of_blocks(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, uint32_t val);
16533
16534 /**
16535  * True when this is the final reply for a query
16536  */
16537 bool ReplyChannelRange_get_sync_complete(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
16538
16539 /**
16540  * True when this is the final reply for a query
16541  */
16542 void ReplyChannelRange_set_sync_complete(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, bool val);
16543
16544 /**
16545  * The short_channel_ids in the channel range
16546  */
16547 void ReplyChannelRange_set_short_channel_ids(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
16548
16549 /**
16550  * Constructs a new ReplyChannelRange given each field
16551  */
16552 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);
16553
16554 /**
16555  * Creates a copy of the ReplyChannelRange
16556  */
16557 struct LDKReplyChannelRange ReplyChannelRange_clone(const struct LDKReplyChannelRange *NONNULL_PTR orig);
16558
16559 /**
16560  * Frees any resources used by the QueryShortChannelIds, if is_owned is set and inner is non-NULL.
16561  */
16562 void QueryShortChannelIds_free(struct LDKQueryShortChannelIds this_obj);
16563
16564 /**
16565  * The genesis hash of the blockchain being queried
16566  */
16567 const uint8_t (*QueryShortChannelIds_get_chain_hash(const struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr))[32];
16568
16569 /**
16570  * The genesis hash of the blockchain being queried
16571  */
16572 void QueryShortChannelIds_set_chain_hash(struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
16573
16574 /**
16575  * The short_channel_ids that are being queried
16576  */
16577 void QueryShortChannelIds_set_short_channel_ids(struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
16578
16579 /**
16580  * Constructs a new QueryShortChannelIds given each field
16581  */
16582 MUST_USE_RES struct LDKQueryShortChannelIds QueryShortChannelIds_new(struct LDKThirtyTwoBytes chain_hash_arg, struct LDKCVec_u64Z short_channel_ids_arg);
16583
16584 /**
16585  * Creates a copy of the QueryShortChannelIds
16586  */
16587 struct LDKQueryShortChannelIds QueryShortChannelIds_clone(const struct LDKQueryShortChannelIds *NONNULL_PTR orig);
16588
16589 /**
16590  * Frees any resources used by the ReplyShortChannelIdsEnd, if is_owned is set and inner is non-NULL.
16591  */
16592 void ReplyShortChannelIdsEnd_free(struct LDKReplyShortChannelIdsEnd this_obj);
16593
16594 /**
16595  * The genesis hash of the blockchain that was queried
16596  */
16597 const uint8_t (*ReplyShortChannelIdsEnd_get_chain_hash(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr))[32];
16598
16599 /**
16600  * The genesis hash of the blockchain that was queried
16601  */
16602 void ReplyShortChannelIdsEnd_set_chain_hash(struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
16603
16604 /**
16605  * Indicates if the query recipient maintains up-to-date channel
16606  * information for the chain_hash
16607  */
16608 bool ReplyShortChannelIdsEnd_get_full_information(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr);
16609
16610 /**
16611  * Indicates if the query recipient maintains up-to-date channel
16612  * information for the chain_hash
16613  */
16614 void ReplyShortChannelIdsEnd_set_full_information(struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr, bool val);
16615
16616 /**
16617  * Constructs a new ReplyShortChannelIdsEnd given each field
16618  */
16619 MUST_USE_RES struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_new(struct LDKThirtyTwoBytes chain_hash_arg, bool full_information_arg);
16620
16621 /**
16622  * Creates a copy of the ReplyShortChannelIdsEnd
16623  */
16624 struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_clone(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR orig);
16625
16626 /**
16627  * Frees any resources used by the GossipTimestampFilter, if is_owned is set and inner is non-NULL.
16628  */
16629 void GossipTimestampFilter_free(struct LDKGossipTimestampFilter this_obj);
16630
16631 /**
16632  * The genesis hash of the blockchain for channel and node information
16633  */
16634 const uint8_t (*GossipTimestampFilter_get_chain_hash(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr))[32];
16635
16636 /**
16637  * The genesis hash of the blockchain for channel and node information
16638  */
16639 void GossipTimestampFilter_set_chain_hash(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
16640
16641 /**
16642  * The starting unix timestamp
16643  */
16644 uint32_t GossipTimestampFilter_get_first_timestamp(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr);
16645
16646 /**
16647  * The starting unix timestamp
16648  */
16649 void GossipTimestampFilter_set_first_timestamp(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, uint32_t val);
16650
16651 /**
16652  * The range of information in seconds
16653  */
16654 uint32_t GossipTimestampFilter_get_timestamp_range(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr);
16655
16656 /**
16657  * The range of information in seconds
16658  */
16659 void GossipTimestampFilter_set_timestamp_range(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, uint32_t val);
16660
16661 /**
16662  * Constructs a new GossipTimestampFilter given each field
16663  */
16664 MUST_USE_RES struct LDKGossipTimestampFilter GossipTimestampFilter_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_timestamp_arg, uint32_t timestamp_range_arg);
16665
16666 /**
16667  * Creates a copy of the GossipTimestampFilter
16668  */
16669 struct LDKGossipTimestampFilter GossipTimestampFilter_clone(const struct LDKGossipTimestampFilter *NONNULL_PTR orig);
16670
16671 /**
16672  * Frees any resources used by the ErrorAction
16673  */
16674 void ErrorAction_free(struct LDKErrorAction this_ptr);
16675
16676 /**
16677  * Creates a copy of the ErrorAction
16678  */
16679 struct LDKErrorAction ErrorAction_clone(const struct LDKErrorAction *NONNULL_PTR orig);
16680
16681 /**
16682  * Utility method to constructs a new DisconnectPeer-variant ErrorAction
16683  */
16684 struct LDKErrorAction ErrorAction_disconnect_peer(struct LDKErrorMessage msg);
16685
16686 /**
16687  * Utility method to constructs a new IgnoreError-variant ErrorAction
16688  */
16689 struct LDKErrorAction ErrorAction_ignore_error(void);
16690
16691 /**
16692  * Utility method to constructs a new IgnoreAndLog-variant ErrorAction
16693  */
16694 struct LDKErrorAction ErrorAction_ignore_and_log(enum LDKLevel a);
16695
16696 /**
16697  * Utility method to constructs a new SendErrorMessage-variant ErrorAction
16698  */
16699 struct LDKErrorAction ErrorAction_send_error_message(struct LDKErrorMessage msg);
16700
16701 /**
16702  * Frees any resources used by the LightningError, if is_owned is set and inner is non-NULL.
16703  */
16704 void LightningError_free(struct LDKLightningError this_obj);
16705
16706 /**
16707  * A human-readable message describing the error
16708  */
16709 struct LDKStr LightningError_get_err(const struct LDKLightningError *NONNULL_PTR this_ptr);
16710
16711 /**
16712  * A human-readable message describing the error
16713  */
16714 void LightningError_set_err(struct LDKLightningError *NONNULL_PTR this_ptr, struct LDKStr val);
16715
16716 /**
16717  * The action which should be taken against the offending peer.
16718  */
16719 struct LDKErrorAction LightningError_get_action(const struct LDKLightningError *NONNULL_PTR this_ptr);
16720
16721 /**
16722  * The action which should be taken against the offending peer.
16723  */
16724 void LightningError_set_action(struct LDKLightningError *NONNULL_PTR this_ptr, struct LDKErrorAction val);
16725
16726 /**
16727  * Constructs a new LightningError given each field
16728  */
16729 MUST_USE_RES struct LDKLightningError LightningError_new(struct LDKStr err_arg, struct LDKErrorAction action_arg);
16730
16731 /**
16732  * Creates a copy of the LightningError
16733  */
16734 struct LDKLightningError LightningError_clone(const struct LDKLightningError *NONNULL_PTR orig);
16735
16736 /**
16737  * Frees any resources used by the CommitmentUpdate, if is_owned is set and inner is non-NULL.
16738  */
16739 void CommitmentUpdate_free(struct LDKCommitmentUpdate this_obj);
16740
16741 /**
16742  * update_add_htlc messages which should be sent
16743  */
16744 void CommitmentUpdate_set_update_add_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateAddHTLCZ val);
16745
16746 /**
16747  * update_fulfill_htlc messages which should be sent
16748  */
16749 void CommitmentUpdate_set_update_fulfill_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFulfillHTLCZ val);
16750
16751 /**
16752  * update_fail_htlc messages which should be sent
16753  */
16754 void CommitmentUpdate_set_update_fail_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFailHTLCZ val);
16755
16756 /**
16757  * update_fail_malformed_htlc messages which should be sent
16758  */
16759 void CommitmentUpdate_set_update_fail_malformed_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFailMalformedHTLCZ val);
16760
16761 /**
16762  * An update_fee message which should be sent
16763  *
16764  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
16765  */
16766 struct LDKUpdateFee CommitmentUpdate_get_update_fee(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
16767
16768 /**
16769  * An update_fee message which should be sent
16770  *
16771  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
16772  */
16773 void CommitmentUpdate_set_update_fee(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKUpdateFee val);
16774
16775 /**
16776  * Finally, the commitment_signed message which should be sent
16777  */
16778 struct LDKCommitmentSigned CommitmentUpdate_get_commitment_signed(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
16779
16780 /**
16781  * Finally, the commitment_signed message which should be sent
16782  */
16783 void CommitmentUpdate_set_commitment_signed(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCommitmentSigned val);
16784
16785 /**
16786  * Constructs a new CommitmentUpdate given each field
16787  */
16788 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);
16789
16790 /**
16791  * Creates a copy of the CommitmentUpdate
16792  */
16793 struct LDKCommitmentUpdate CommitmentUpdate_clone(const struct LDKCommitmentUpdate *NONNULL_PTR orig);
16794
16795 /**
16796  * Frees any resources used by the HTLCFailChannelUpdate
16797  */
16798 void HTLCFailChannelUpdate_free(struct LDKHTLCFailChannelUpdate this_ptr);
16799
16800 /**
16801  * Creates a copy of the HTLCFailChannelUpdate
16802  */
16803 struct LDKHTLCFailChannelUpdate HTLCFailChannelUpdate_clone(const struct LDKHTLCFailChannelUpdate *NONNULL_PTR orig);
16804
16805 /**
16806  * Utility method to constructs a new ChannelUpdateMessage-variant HTLCFailChannelUpdate
16807  */
16808 struct LDKHTLCFailChannelUpdate HTLCFailChannelUpdate_channel_update_message(struct LDKChannelUpdate msg);
16809
16810 /**
16811  * Utility method to constructs a new ChannelClosed-variant HTLCFailChannelUpdate
16812  */
16813 struct LDKHTLCFailChannelUpdate HTLCFailChannelUpdate_channel_closed(uint64_t short_channel_id, bool is_permanent);
16814
16815 /**
16816  * Utility method to constructs a new NodeFailure-variant HTLCFailChannelUpdate
16817  */
16818 struct LDKHTLCFailChannelUpdate HTLCFailChannelUpdate_node_failure(struct LDKPublicKey node_id, bool is_permanent);
16819
16820 /**
16821  * Calls the free function if one is set
16822  */
16823 void ChannelMessageHandler_free(struct LDKChannelMessageHandler this_ptr);
16824
16825 /**
16826  * Calls the free function if one is set
16827  */
16828 void RoutingMessageHandler_free(struct LDKRoutingMessageHandler this_ptr);
16829
16830 /**
16831  * Serialize the AcceptChannel object into a byte array which can be read by AcceptChannel_read
16832  */
16833 struct LDKCVec_u8Z AcceptChannel_write(const struct LDKAcceptChannel *NONNULL_PTR obj);
16834
16835 /**
16836  * Read a AcceptChannel from a byte array, created by AcceptChannel_write
16837  */
16838 struct LDKCResult_AcceptChannelDecodeErrorZ AcceptChannel_read(struct LDKu8slice ser);
16839
16840 /**
16841  * Serialize the AnnouncementSignatures object into a byte array which can be read by AnnouncementSignatures_read
16842  */
16843 struct LDKCVec_u8Z AnnouncementSignatures_write(const struct LDKAnnouncementSignatures *NONNULL_PTR obj);
16844
16845 /**
16846  * Read a AnnouncementSignatures from a byte array, created by AnnouncementSignatures_write
16847  */
16848 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ AnnouncementSignatures_read(struct LDKu8slice ser);
16849
16850 /**
16851  * Serialize the ChannelReestablish object into a byte array which can be read by ChannelReestablish_read
16852  */
16853 struct LDKCVec_u8Z ChannelReestablish_write(const struct LDKChannelReestablish *NONNULL_PTR obj);
16854
16855 /**
16856  * Read a ChannelReestablish from a byte array, created by ChannelReestablish_write
16857  */
16858 struct LDKCResult_ChannelReestablishDecodeErrorZ ChannelReestablish_read(struct LDKu8slice ser);
16859
16860 /**
16861  * Serialize the ClosingSigned object into a byte array which can be read by ClosingSigned_read
16862  */
16863 struct LDKCVec_u8Z ClosingSigned_write(const struct LDKClosingSigned *NONNULL_PTR obj);
16864
16865 /**
16866  * Read a ClosingSigned from a byte array, created by ClosingSigned_write
16867  */
16868 struct LDKCResult_ClosingSignedDecodeErrorZ ClosingSigned_read(struct LDKu8slice ser);
16869
16870 /**
16871  * Serialize the ClosingSignedFeeRange object into a byte array which can be read by ClosingSignedFeeRange_read
16872  */
16873 struct LDKCVec_u8Z ClosingSignedFeeRange_write(const struct LDKClosingSignedFeeRange *NONNULL_PTR obj);
16874
16875 /**
16876  * Read a ClosingSignedFeeRange from a byte array, created by ClosingSignedFeeRange_write
16877  */
16878 struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ ClosingSignedFeeRange_read(struct LDKu8slice ser);
16879
16880 /**
16881  * Serialize the CommitmentSigned object into a byte array which can be read by CommitmentSigned_read
16882  */
16883 struct LDKCVec_u8Z CommitmentSigned_write(const struct LDKCommitmentSigned *NONNULL_PTR obj);
16884
16885 /**
16886  * Read a CommitmentSigned from a byte array, created by CommitmentSigned_write
16887  */
16888 struct LDKCResult_CommitmentSignedDecodeErrorZ CommitmentSigned_read(struct LDKu8slice ser);
16889
16890 /**
16891  * Serialize the FundingCreated object into a byte array which can be read by FundingCreated_read
16892  */
16893 struct LDKCVec_u8Z FundingCreated_write(const struct LDKFundingCreated *NONNULL_PTR obj);
16894
16895 /**
16896  * Read a FundingCreated from a byte array, created by FundingCreated_write
16897  */
16898 struct LDKCResult_FundingCreatedDecodeErrorZ FundingCreated_read(struct LDKu8slice ser);
16899
16900 /**
16901  * Serialize the FundingSigned object into a byte array which can be read by FundingSigned_read
16902  */
16903 struct LDKCVec_u8Z FundingSigned_write(const struct LDKFundingSigned *NONNULL_PTR obj);
16904
16905 /**
16906  * Read a FundingSigned from a byte array, created by FundingSigned_write
16907  */
16908 struct LDKCResult_FundingSignedDecodeErrorZ FundingSigned_read(struct LDKu8slice ser);
16909
16910 /**
16911  * Serialize the FundingLocked object into a byte array which can be read by FundingLocked_read
16912  */
16913 struct LDKCVec_u8Z FundingLocked_write(const struct LDKFundingLocked *NONNULL_PTR obj);
16914
16915 /**
16916  * Read a FundingLocked from a byte array, created by FundingLocked_write
16917  */
16918 struct LDKCResult_FundingLockedDecodeErrorZ FundingLocked_read(struct LDKu8slice ser);
16919
16920 /**
16921  * Serialize the Init object into a byte array which can be read by Init_read
16922  */
16923 struct LDKCVec_u8Z Init_write(const struct LDKInit *NONNULL_PTR obj);
16924
16925 /**
16926  * Read a Init from a byte array, created by Init_write
16927  */
16928 struct LDKCResult_InitDecodeErrorZ Init_read(struct LDKu8slice ser);
16929
16930 /**
16931  * Serialize the OpenChannel object into a byte array which can be read by OpenChannel_read
16932  */
16933 struct LDKCVec_u8Z OpenChannel_write(const struct LDKOpenChannel *NONNULL_PTR obj);
16934
16935 /**
16936  * Read a OpenChannel from a byte array, created by OpenChannel_write
16937  */
16938 struct LDKCResult_OpenChannelDecodeErrorZ OpenChannel_read(struct LDKu8slice ser);
16939
16940 /**
16941  * Serialize the RevokeAndACK object into a byte array which can be read by RevokeAndACK_read
16942  */
16943 struct LDKCVec_u8Z RevokeAndACK_write(const struct LDKRevokeAndACK *NONNULL_PTR obj);
16944
16945 /**
16946  * Read a RevokeAndACK from a byte array, created by RevokeAndACK_write
16947  */
16948 struct LDKCResult_RevokeAndACKDecodeErrorZ RevokeAndACK_read(struct LDKu8slice ser);
16949
16950 /**
16951  * Serialize the Shutdown object into a byte array which can be read by Shutdown_read
16952  */
16953 struct LDKCVec_u8Z Shutdown_write(const struct LDKShutdown *NONNULL_PTR obj);
16954
16955 /**
16956  * Read a Shutdown from a byte array, created by Shutdown_write
16957  */
16958 struct LDKCResult_ShutdownDecodeErrorZ Shutdown_read(struct LDKu8slice ser);
16959
16960 /**
16961  * Serialize the UpdateFailHTLC object into a byte array which can be read by UpdateFailHTLC_read
16962  */
16963 struct LDKCVec_u8Z UpdateFailHTLC_write(const struct LDKUpdateFailHTLC *NONNULL_PTR obj);
16964
16965 /**
16966  * Read a UpdateFailHTLC from a byte array, created by UpdateFailHTLC_write
16967  */
16968 struct LDKCResult_UpdateFailHTLCDecodeErrorZ UpdateFailHTLC_read(struct LDKu8slice ser);
16969
16970 /**
16971  * Serialize the UpdateFailMalformedHTLC object into a byte array which can be read by UpdateFailMalformedHTLC_read
16972  */
16973 struct LDKCVec_u8Z UpdateFailMalformedHTLC_write(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR obj);
16974
16975 /**
16976  * Read a UpdateFailMalformedHTLC from a byte array, created by UpdateFailMalformedHTLC_write
16977  */
16978 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ UpdateFailMalformedHTLC_read(struct LDKu8slice ser);
16979
16980 /**
16981  * Serialize the UpdateFee object into a byte array which can be read by UpdateFee_read
16982  */
16983 struct LDKCVec_u8Z UpdateFee_write(const struct LDKUpdateFee *NONNULL_PTR obj);
16984
16985 /**
16986  * Read a UpdateFee from a byte array, created by UpdateFee_write
16987  */
16988 struct LDKCResult_UpdateFeeDecodeErrorZ UpdateFee_read(struct LDKu8slice ser);
16989
16990 /**
16991  * Serialize the UpdateFulfillHTLC object into a byte array which can be read by UpdateFulfillHTLC_read
16992  */
16993 struct LDKCVec_u8Z UpdateFulfillHTLC_write(const struct LDKUpdateFulfillHTLC *NONNULL_PTR obj);
16994
16995 /**
16996  * Read a UpdateFulfillHTLC from a byte array, created by UpdateFulfillHTLC_write
16997  */
16998 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ UpdateFulfillHTLC_read(struct LDKu8slice ser);
16999
17000 /**
17001  * Serialize the UpdateAddHTLC object into a byte array which can be read by UpdateAddHTLC_read
17002  */
17003 struct LDKCVec_u8Z UpdateAddHTLC_write(const struct LDKUpdateAddHTLC *NONNULL_PTR obj);
17004
17005 /**
17006  * Read a UpdateAddHTLC from a byte array, created by UpdateAddHTLC_write
17007  */
17008 struct LDKCResult_UpdateAddHTLCDecodeErrorZ UpdateAddHTLC_read(struct LDKu8slice ser);
17009
17010 /**
17011  * Serialize the Ping object into a byte array which can be read by Ping_read
17012  */
17013 struct LDKCVec_u8Z Ping_write(const struct LDKPing *NONNULL_PTR obj);
17014
17015 /**
17016  * Read a Ping from a byte array, created by Ping_write
17017  */
17018 struct LDKCResult_PingDecodeErrorZ Ping_read(struct LDKu8slice ser);
17019
17020 /**
17021  * Serialize the Pong object into a byte array which can be read by Pong_read
17022  */
17023 struct LDKCVec_u8Z Pong_write(const struct LDKPong *NONNULL_PTR obj);
17024
17025 /**
17026  * Read a Pong from a byte array, created by Pong_write
17027  */
17028 struct LDKCResult_PongDecodeErrorZ Pong_read(struct LDKu8slice ser);
17029
17030 /**
17031  * Serialize the UnsignedChannelAnnouncement object into a byte array which can be read by UnsignedChannelAnnouncement_read
17032  */
17033 struct LDKCVec_u8Z UnsignedChannelAnnouncement_write(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR obj);
17034
17035 /**
17036  * Read a UnsignedChannelAnnouncement from a byte array, created by UnsignedChannelAnnouncement_write
17037  */
17038 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ UnsignedChannelAnnouncement_read(struct LDKu8slice ser);
17039
17040 /**
17041  * Serialize the ChannelAnnouncement object into a byte array which can be read by ChannelAnnouncement_read
17042  */
17043 struct LDKCVec_u8Z ChannelAnnouncement_write(const struct LDKChannelAnnouncement *NONNULL_PTR obj);
17044
17045 /**
17046  * Read a ChannelAnnouncement from a byte array, created by ChannelAnnouncement_write
17047  */
17048 struct LDKCResult_ChannelAnnouncementDecodeErrorZ ChannelAnnouncement_read(struct LDKu8slice ser);
17049
17050 /**
17051  * Serialize the UnsignedChannelUpdate object into a byte array which can be read by UnsignedChannelUpdate_read
17052  */
17053 struct LDKCVec_u8Z UnsignedChannelUpdate_write(const struct LDKUnsignedChannelUpdate *NONNULL_PTR obj);
17054
17055 /**
17056  * Read a UnsignedChannelUpdate from a byte array, created by UnsignedChannelUpdate_write
17057  */
17058 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ UnsignedChannelUpdate_read(struct LDKu8slice ser);
17059
17060 /**
17061  * Serialize the ChannelUpdate object into a byte array which can be read by ChannelUpdate_read
17062  */
17063 struct LDKCVec_u8Z ChannelUpdate_write(const struct LDKChannelUpdate *NONNULL_PTR obj);
17064
17065 /**
17066  * Read a ChannelUpdate from a byte array, created by ChannelUpdate_write
17067  */
17068 struct LDKCResult_ChannelUpdateDecodeErrorZ ChannelUpdate_read(struct LDKu8slice ser);
17069
17070 /**
17071  * Serialize the ErrorMessage object into a byte array which can be read by ErrorMessage_read
17072  */
17073 struct LDKCVec_u8Z ErrorMessage_write(const struct LDKErrorMessage *NONNULL_PTR obj);
17074
17075 /**
17076  * Read a ErrorMessage from a byte array, created by ErrorMessage_write
17077  */
17078 struct LDKCResult_ErrorMessageDecodeErrorZ ErrorMessage_read(struct LDKu8slice ser);
17079
17080 /**
17081  * Serialize the UnsignedNodeAnnouncement object into a byte array which can be read by UnsignedNodeAnnouncement_read
17082  */
17083 struct LDKCVec_u8Z UnsignedNodeAnnouncement_write(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR obj);
17084
17085 /**
17086  * Read a UnsignedNodeAnnouncement from a byte array, created by UnsignedNodeAnnouncement_write
17087  */
17088 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ UnsignedNodeAnnouncement_read(struct LDKu8slice ser);
17089
17090 /**
17091  * Serialize the NodeAnnouncement object into a byte array which can be read by NodeAnnouncement_read
17092  */
17093 struct LDKCVec_u8Z NodeAnnouncement_write(const struct LDKNodeAnnouncement *NONNULL_PTR obj);
17094
17095 /**
17096  * Read a NodeAnnouncement from a byte array, created by NodeAnnouncement_write
17097  */
17098 struct LDKCResult_NodeAnnouncementDecodeErrorZ NodeAnnouncement_read(struct LDKu8slice ser);
17099
17100 /**
17101  * Read a QueryShortChannelIds from a byte array, created by QueryShortChannelIds_write
17102  */
17103 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ QueryShortChannelIds_read(struct LDKu8slice ser);
17104
17105 /**
17106  * Serialize the QueryShortChannelIds object into a byte array which can be read by QueryShortChannelIds_read
17107  */
17108 struct LDKCVec_u8Z QueryShortChannelIds_write(const struct LDKQueryShortChannelIds *NONNULL_PTR obj);
17109
17110 /**
17111  * Read a ReplyShortChannelIdsEnd from a byte array, created by ReplyShortChannelIdsEnd_write
17112  */
17113 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ ReplyShortChannelIdsEnd_read(struct LDKu8slice ser);
17114
17115 /**
17116  * Serialize the ReplyShortChannelIdsEnd object into a byte array which can be read by ReplyShortChannelIdsEnd_read
17117  */
17118 struct LDKCVec_u8Z ReplyShortChannelIdsEnd_write(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR obj);
17119
17120 /**
17121  *\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
17122  */
17123 MUST_USE_RES uint32_t QueryChannelRange_end_blocknum(const struct LDKQueryChannelRange *NONNULL_PTR this_arg);
17124
17125 /**
17126  * Read a QueryChannelRange from a byte array, created by QueryChannelRange_write
17127  */
17128 struct LDKCResult_QueryChannelRangeDecodeErrorZ QueryChannelRange_read(struct LDKu8slice ser);
17129
17130 /**
17131  * Serialize the QueryChannelRange object into a byte array which can be read by QueryChannelRange_read
17132  */
17133 struct LDKCVec_u8Z QueryChannelRange_write(const struct LDKQueryChannelRange *NONNULL_PTR obj);
17134
17135 /**
17136  * Read a ReplyChannelRange from a byte array, created by ReplyChannelRange_write
17137  */
17138 struct LDKCResult_ReplyChannelRangeDecodeErrorZ ReplyChannelRange_read(struct LDKu8slice ser);
17139
17140 /**
17141  * Serialize the ReplyChannelRange object into a byte array which can be read by ReplyChannelRange_read
17142  */
17143 struct LDKCVec_u8Z ReplyChannelRange_write(const struct LDKReplyChannelRange *NONNULL_PTR obj);
17144
17145 /**
17146  * Read a GossipTimestampFilter from a byte array, created by GossipTimestampFilter_write
17147  */
17148 struct LDKCResult_GossipTimestampFilterDecodeErrorZ GossipTimestampFilter_read(struct LDKu8slice ser);
17149
17150 /**
17151  * Serialize the GossipTimestampFilter object into a byte array which can be read by GossipTimestampFilter_read
17152  */
17153 struct LDKCVec_u8Z GossipTimestampFilter_write(const struct LDKGossipTimestampFilter *NONNULL_PTR obj);
17154
17155 /**
17156  * Frees any resources used by the IgnoringMessageHandler, if is_owned is set and inner is non-NULL.
17157  */
17158 void IgnoringMessageHandler_free(struct LDKIgnoringMessageHandler this_obj);
17159
17160 /**
17161  * Constructs a new IgnoringMessageHandler given each field
17162  */
17163 MUST_USE_RES struct LDKIgnoringMessageHandler IgnoringMessageHandler_new(void);
17164
17165 /**
17166  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
17167  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
17168  */
17169 struct LDKMessageSendEventsProvider IgnoringMessageHandler_as_MessageSendEventsProvider(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
17170
17171 /**
17172  * Constructs a new RoutingMessageHandler which calls the relevant methods on this_arg.
17173  * This copies the `inner` pointer in this_arg and thus the returned RoutingMessageHandler must be freed before this_arg is
17174  */
17175 struct LDKRoutingMessageHandler IgnoringMessageHandler_as_RoutingMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
17176
17177 /**
17178  * Frees any resources used by the ErroringMessageHandler, if is_owned is set and inner is non-NULL.
17179  */
17180 void ErroringMessageHandler_free(struct LDKErroringMessageHandler this_obj);
17181
17182 /**
17183  * Constructs a new ErroringMessageHandler
17184  */
17185 MUST_USE_RES struct LDKErroringMessageHandler ErroringMessageHandler_new(void);
17186
17187 /**
17188  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
17189  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
17190  */
17191 struct LDKMessageSendEventsProvider ErroringMessageHandler_as_MessageSendEventsProvider(const struct LDKErroringMessageHandler *NONNULL_PTR this_arg);
17192
17193 /**
17194  * Constructs a new ChannelMessageHandler which calls the relevant methods on this_arg.
17195  * This copies the `inner` pointer in this_arg and thus the returned ChannelMessageHandler must be freed before this_arg is
17196  */
17197 struct LDKChannelMessageHandler ErroringMessageHandler_as_ChannelMessageHandler(const struct LDKErroringMessageHandler *NONNULL_PTR this_arg);
17198
17199 /**
17200  * Frees any resources used by the MessageHandler, if is_owned is set and inner is non-NULL.
17201  */
17202 void MessageHandler_free(struct LDKMessageHandler this_obj);
17203
17204 /**
17205  * A message handler which handles messages specific to channels. Usually this is just a
17206  * [`ChannelManager`] object or an [`ErroringMessageHandler`].
17207  *
17208  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
17209  */
17210 const struct LDKChannelMessageHandler *MessageHandler_get_chan_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr);
17211
17212 /**
17213  * A message handler which handles messages specific to channels. Usually this is just a
17214  * [`ChannelManager`] object or an [`ErroringMessageHandler`].
17215  *
17216  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
17217  */
17218 void MessageHandler_set_chan_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKChannelMessageHandler val);
17219
17220 /**
17221  * A message handler which handles messages updating our knowledge of the network channel
17222  * graph. Usually this is just a [`NetGraphMsgHandler`] object or an
17223  * [`IgnoringMessageHandler`].
17224  *
17225  * [`NetGraphMsgHandler`]: crate::routing::network_graph::NetGraphMsgHandler
17226  */
17227 const struct LDKRoutingMessageHandler *MessageHandler_get_route_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr);
17228
17229 /**
17230  * A message handler which handles messages updating our knowledge of the network channel
17231  * graph. Usually this is just a [`NetGraphMsgHandler`] object or an
17232  * [`IgnoringMessageHandler`].
17233  *
17234  * [`NetGraphMsgHandler`]: crate::routing::network_graph::NetGraphMsgHandler
17235  */
17236 void MessageHandler_set_route_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKRoutingMessageHandler val);
17237
17238 /**
17239  * Constructs a new MessageHandler given each field
17240  */
17241 MUST_USE_RES struct LDKMessageHandler MessageHandler_new(struct LDKChannelMessageHandler chan_handler_arg, struct LDKRoutingMessageHandler route_handler_arg);
17242
17243 /**
17244  * Creates a copy of a SocketDescriptor
17245  */
17246 struct LDKSocketDescriptor SocketDescriptor_clone(const struct LDKSocketDescriptor *NONNULL_PTR orig);
17247
17248 /**
17249  * Calls the free function if one is set
17250  */
17251 void SocketDescriptor_free(struct LDKSocketDescriptor this_ptr);
17252
17253 /**
17254  * Frees any resources used by the PeerHandleError, if is_owned is set and inner is non-NULL.
17255  */
17256 void PeerHandleError_free(struct LDKPeerHandleError this_obj);
17257
17258 /**
17259  * Used to indicate that we probably can't make any future connections to this peer, implying
17260  * we should go ahead and force-close any channels we have with it.
17261  */
17262 bool PeerHandleError_get_no_connection_possible(const struct LDKPeerHandleError *NONNULL_PTR this_ptr);
17263
17264 /**
17265  * Used to indicate that we probably can't make any future connections to this peer, implying
17266  * we should go ahead and force-close any channels we have with it.
17267  */
17268 void PeerHandleError_set_no_connection_possible(struct LDKPeerHandleError *NONNULL_PTR this_ptr, bool val);
17269
17270 /**
17271  * Constructs a new PeerHandleError given each field
17272  */
17273 MUST_USE_RES struct LDKPeerHandleError PeerHandleError_new(bool no_connection_possible_arg);
17274
17275 /**
17276  * Creates a copy of the PeerHandleError
17277  */
17278 struct LDKPeerHandleError PeerHandleError_clone(const struct LDKPeerHandleError *NONNULL_PTR orig);
17279
17280 /**
17281  * Frees any resources used by the PeerManager, if is_owned is set and inner is non-NULL.
17282  */
17283 void PeerManager_free(struct LDKPeerManager this_obj);
17284
17285 /**
17286  * Constructs a new PeerManager with the given message handlers and node_id secret key
17287  * ephemeral_random_data is used to derive per-connection ephemeral keys and must be
17288  * cryptographically secure random bytes.
17289  */
17290 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);
17291
17292 /**
17293  * Get the list of node ids for peers which have completed the initial handshake.
17294  *
17295  * For outbound connections, this will be the same as the their_node_id parameter passed in to
17296  * new_outbound_connection, however entries will only appear once the initial handshake has
17297  * completed and we are sure the remote peer has the private key for the given node_id.
17298  */
17299 MUST_USE_RES struct LDKCVec_PublicKeyZ PeerManager_get_peer_node_ids(const struct LDKPeerManager *NONNULL_PTR this_arg);
17300
17301 /**
17302  * Indicates a new outbound connection has been established to a node with the given node_id.
17303  * Note that if an Err is returned here you MUST NOT call socket_disconnected for the new
17304  * descriptor but must disconnect the connection immediately.
17305  *
17306  * Returns a small number of bytes to send to the remote node (currently always 50).
17307  *
17308  * Panics if descriptor is duplicative with some other descriptor which has not yet been
17309  * [`socket_disconnected()`].
17310  *
17311  * [`socket_disconnected()`]: PeerManager::socket_disconnected
17312  */
17313 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);
17314
17315 /**
17316  * Indicates a new inbound connection has been established.
17317  *
17318  * May refuse the connection by returning an Err, but will never write bytes to the remote end
17319  * (outbound connector always speaks first). Note that if an Err is returned here you MUST NOT
17320  * call socket_disconnected for the new descriptor but must disconnect the connection
17321  * immediately.
17322  *
17323  * Panics if descriptor is duplicative with some other descriptor which has not yet been
17324  * [`socket_disconnected()`].
17325  *
17326  * [`socket_disconnected()`]: PeerManager::socket_disconnected
17327  */
17328 MUST_USE_RES struct LDKCResult_NonePeerHandleErrorZ PeerManager_new_inbound_connection(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor descriptor);
17329
17330 /**
17331  * Indicates that there is room to write data to the given socket descriptor.
17332  *
17333  * May return an Err to indicate that the connection should be closed.
17334  *
17335  * May call [`send_data`] on the descriptor passed in (or an equal descriptor) before
17336  * returning. Thus, be very careful with reentrancy issues! The invariants around calling
17337  * [`write_buffer_space_avail`] in case a write did not fully complete must still hold - be
17338  * ready to call `[write_buffer_space_avail`] again if a write call generated here isn't
17339  * sufficient!
17340  *
17341  * [`send_data`]: SocketDescriptor::send_data
17342  * [`write_buffer_space_avail`]: PeerManager::write_buffer_space_avail
17343  */
17344 MUST_USE_RES struct LDKCResult_NonePeerHandleErrorZ PeerManager_write_buffer_space_avail(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor *NONNULL_PTR descriptor);
17345
17346 /**
17347  * Indicates that data was read from the given socket descriptor.
17348  *
17349  * May return an Err to indicate that the connection should be closed.
17350  *
17351  * Will *not* call back into [`send_data`] on any descriptors to avoid reentrancy complexity.
17352  * Thus, however, you should call [`process_events`] after any `read_event` to generate
17353  * [`send_data`] calls to handle responses.
17354  *
17355  * If `Ok(true)` is returned, further read_events should not be triggered until a
17356  * [`send_data`] call on this descriptor has `resume_read` set (preventing DoS issues in the
17357  * send buffer).
17358  *
17359  * [`send_data`]: SocketDescriptor::send_data
17360  * [`process_events`]: PeerManager::process_events
17361  */
17362 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);
17363
17364 /**
17365  * Checks for any events generated by our handlers and processes them. Includes sending most
17366  * response messages as well as messages generated by calls to handler functions directly (eg
17367  * functions like [`ChannelManager::process_pending_htlc_forwards`] or [`send_payment`]).
17368  *
17369  * May call [`send_data`] on [`SocketDescriptor`]s. Thus, be very careful with reentrancy
17370  * issues!
17371  *
17372  * [`send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
17373  * [`ChannelManager::process_pending_htlc_forwards`]: crate::ln::channelmanager::ChannelManager::process_pending_htlc_forwards
17374  * [`send_data`]: SocketDescriptor::send_data
17375  */
17376 void PeerManager_process_events(const struct LDKPeerManager *NONNULL_PTR this_arg);
17377
17378 /**
17379  * Indicates that the given socket descriptor's connection is now closed.
17380  */
17381 void PeerManager_socket_disconnected(const struct LDKPeerManager *NONNULL_PTR this_arg, const struct LDKSocketDescriptor *NONNULL_PTR descriptor);
17382
17383 /**
17384  * Disconnect a peer given its node id.
17385  *
17386  * Set `no_connection_possible` to true to prevent any further connection with this peer,
17387  * force-closing any channels we have with it.
17388  *
17389  * If a peer is connected, this will call [`disconnect_socket`] on the descriptor for the
17390  * peer. Thus, be very careful about reentrancy issues.
17391  *
17392  * [`disconnect_socket`]: SocketDescriptor::disconnect_socket
17393  */
17394 void PeerManager_disconnect_by_node_id(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKPublicKey node_id, bool no_connection_possible);
17395
17396 /**
17397  * Send pings to each peer and disconnect those which did not respond to the last round of
17398  * pings.
17399  *
17400  * This may be called on any timescale you want, however, roughly once every five to ten
17401  * seconds is preferred. The call rate determines both how often we send a ping to our peers
17402  * and how much time they have to respond before we disconnect them.
17403  *
17404  * May call [`send_data`] on all [`SocketDescriptor`]s. Thus, be very careful with reentrancy
17405  * issues!
17406  *
17407  * [`send_data`]: SocketDescriptor::send_data
17408  */
17409 void PeerManager_timer_tick_occurred(const struct LDKPeerManager *NONNULL_PTR this_arg);
17410
17411 /**
17412  * Build the commitment secret from the seed and the commitment number
17413  */
17414 struct LDKThirtyTwoBytes build_commitment_secret(const uint8_t (*commitment_seed)[32], uint64_t idx);
17415
17416 /**
17417  * Derives a per-commitment-transaction private key (eg an htlc key or delayed_payment key)
17418  * from the base secret and the per_commitment_point.
17419  *
17420  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
17421  * generated (ie our own).
17422  */
17423 struct LDKCResult_SecretKeyErrorZ derive_private_key(struct LDKPublicKey per_commitment_point, const uint8_t (*base_secret)[32]);
17424
17425 /**
17426  * Derives a per-commitment-transaction public key (eg an htlc key or a delayed_payment key)
17427  * from the base point and the per_commitment_key. This is the public equivalent of
17428  * derive_private_key - using only public keys to derive a public key instead of private keys.
17429  *
17430  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
17431  * generated (ie our own).
17432  */
17433 struct LDKCResult_PublicKeyErrorZ derive_public_key(struct LDKPublicKey per_commitment_point, struct LDKPublicKey base_point);
17434
17435 /**
17436  * Derives a per-commitment-transaction revocation key from its constituent parts.
17437  *
17438  * Only the cheating participant owns a valid witness to propagate a revoked
17439  * commitment transaction, thus per_commitment_secret always come from cheater
17440  * and revocation_base_secret always come from punisher, which is the broadcaster
17441  * of the transaction spending with this key knowledge.
17442  *
17443  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
17444  * generated (ie our own).
17445  */
17446 struct LDKCResult_SecretKeyErrorZ derive_private_revocation_key(const uint8_t (*per_commitment_secret)[32], const uint8_t (*countersignatory_revocation_base_secret)[32]);
17447
17448 /**
17449  * Derives a per-commitment-transaction revocation public key from its constituent parts. This is
17450  * the public equivalend of derive_private_revocation_key - using only public keys to derive a
17451  * public key instead of private keys.
17452  *
17453  * Only the cheating participant owns a valid witness to propagate a revoked
17454  * commitment transaction, thus per_commitment_point always come from cheater
17455  * and revocation_base_point always come from punisher, which is the broadcaster
17456  * of the transaction spending with this key knowledge.
17457  *
17458  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
17459  * generated (ie our own).
17460  */
17461 struct LDKCResult_PublicKeyErrorZ derive_public_revocation_key(struct LDKPublicKey per_commitment_point, struct LDKPublicKey countersignatory_revocation_base_point);
17462
17463 /**
17464  * Frees any resources used by the TxCreationKeys, if is_owned is set and inner is non-NULL.
17465  */
17466 void TxCreationKeys_free(struct LDKTxCreationKeys this_obj);
17467
17468 /**
17469  * The broadcaster's per-commitment public key which was used to derive the other keys.
17470  */
17471 struct LDKPublicKey TxCreationKeys_get_per_commitment_point(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
17472
17473 /**
17474  * The broadcaster's per-commitment public key which was used to derive the other keys.
17475  */
17476 void TxCreationKeys_set_per_commitment_point(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
17477
17478 /**
17479  * The revocation key which is used to allow the broadcaster of the commitment
17480  * transaction to provide their counterparty the ability to punish them if they broadcast
17481  * an old state.
17482  */
17483 struct LDKPublicKey TxCreationKeys_get_revocation_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
17484
17485 /**
17486  * The revocation key which is used to allow the broadcaster of the commitment
17487  * transaction to provide their counterparty the ability to punish them if they broadcast
17488  * an old state.
17489  */
17490 void TxCreationKeys_set_revocation_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
17491
17492 /**
17493  * Broadcaster's HTLC Key
17494  */
17495 struct LDKPublicKey TxCreationKeys_get_broadcaster_htlc_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
17496
17497 /**
17498  * Broadcaster's HTLC Key
17499  */
17500 void TxCreationKeys_set_broadcaster_htlc_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
17501
17502 /**
17503  * Countersignatory's HTLC Key
17504  */
17505 struct LDKPublicKey TxCreationKeys_get_countersignatory_htlc_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
17506
17507 /**
17508  * Countersignatory's HTLC Key
17509  */
17510 void TxCreationKeys_set_countersignatory_htlc_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
17511
17512 /**
17513  * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay)
17514  */
17515 struct LDKPublicKey TxCreationKeys_get_broadcaster_delayed_payment_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
17516
17517 /**
17518  * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay)
17519  */
17520 void TxCreationKeys_set_broadcaster_delayed_payment_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
17521
17522 /**
17523  * Constructs a new TxCreationKeys given each field
17524  */
17525 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);
17526
17527 /**
17528  * Creates a copy of the TxCreationKeys
17529  */
17530 struct LDKTxCreationKeys TxCreationKeys_clone(const struct LDKTxCreationKeys *NONNULL_PTR orig);
17531
17532 /**
17533  * Serialize the TxCreationKeys object into a byte array which can be read by TxCreationKeys_read
17534  */
17535 struct LDKCVec_u8Z TxCreationKeys_write(const struct LDKTxCreationKeys *NONNULL_PTR obj);
17536
17537 /**
17538  * Read a TxCreationKeys from a byte array, created by TxCreationKeys_write
17539  */
17540 struct LDKCResult_TxCreationKeysDecodeErrorZ TxCreationKeys_read(struct LDKu8slice ser);
17541
17542 /**
17543  * Frees any resources used by the ChannelPublicKeys, if is_owned is set and inner is non-NULL.
17544  */
17545 void ChannelPublicKeys_free(struct LDKChannelPublicKeys this_obj);
17546
17547 /**
17548  * The public key which is used to sign all commitment transactions, as it appears in the
17549  * on-chain channel lock-in 2-of-2 multisig output.
17550  */
17551 struct LDKPublicKey ChannelPublicKeys_get_funding_pubkey(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
17552
17553 /**
17554  * The public key which is used to sign all commitment transactions, as it appears in the
17555  * on-chain channel lock-in 2-of-2 multisig output.
17556  */
17557 void ChannelPublicKeys_set_funding_pubkey(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
17558
17559 /**
17560  * The base point which is used (with derive_public_revocation_key) to derive per-commitment
17561  * revocation keys. This is combined with the per-commitment-secret generated by the
17562  * counterparty to create a secret which the counterparty can reveal to revoke previous
17563  * states.
17564  */
17565 struct LDKPublicKey ChannelPublicKeys_get_revocation_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
17566
17567 /**
17568  * The base point which is used (with derive_public_revocation_key) to derive per-commitment
17569  * revocation keys. This is combined with the per-commitment-secret generated by the
17570  * counterparty to create a secret which the counterparty can reveal to revoke previous
17571  * states.
17572  */
17573 void ChannelPublicKeys_set_revocation_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
17574
17575 /**
17576  * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
17577  * spendable primary channel balance on the broadcaster's commitment transaction. This key is
17578  * static across every commitment transaction.
17579  */
17580 struct LDKPublicKey ChannelPublicKeys_get_payment_point(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
17581
17582 /**
17583  * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
17584  * spendable primary channel balance on the broadcaster's commitment transaction. This key is
17585  * static across every commitment transaction.
17586  */
17587 void ChannelPublicKeys_set_payment_point(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
17588
17589 /**
17590  * The base point which is used (with derive_public_key) to derive a per-commitment payment
17591  * public key which receives non-HTLC-encumbered funds which are only available for spending
17592  * after some delay (or can be claimed via the revocation path).
17593  */
17594 struct LDKPublicKey ChannelPublicKeys_get_delayed_payment_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
17595
17596 /**
17597  * The base point which is used (with derive_public_key) to derive a per-commitment payment
17598  * public key which receives non-HTLC-encumbered funds which are only available for spending
17599  * after some delay (or can be claimed via the revocation path).
17600  */
17601 void ChannelPublicKeys_set_delayed_payment_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
17602
17603 /**
17604  * The base point which is used (with derive_public_key) to derive a per-commitment public key
17605  * which is used to encumber HTLC-in-flight outputs.
17606  */
17607 struct LDKPublicKey ChannelPublicKeys_get_htlc_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
17608
17609 /**
17610  * The base point which is used (with derive_public_key) to derive a per-commitment public key
17611  * which is used to encumber HTLC-in-flight outputs.
17612  */
17613 void ChannelPublicKeys_set_htlc_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
17614
17615 /**
17616  * Constructs a new ChannelPublicKeys given each field
17617  */
17618 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);
17619
17620 /**
17621  * Creates a copy of the ChannelPublicKeys
17622  */
17623 struct LDKChannelPublicKeys ChannelPublicKeys_clone(const struct LDKChannelPublicKeys *NONNULL_PTR orig);
17624
17625 /**
17626  * Serialize the ChannelPublicKeys object into a byte array which can be read by ChannelPublicKeys_read
17627  */
17628 struct LDKCVec_u8Z ChannelPublicKeys_write(const struct LDKChannelPublicKeys *NONNULL_PTR obj);
17629
17630 /**
17631  * Read a ChannelPublicKeys from a byte array, created by ChannelPublicKeys_write
17632  */
17633 struct LDKCResult_ChannelPublicKeysDecodeErrorZ ChannelPublicKeys_read(struct LDKu8slice ser);
17634
17635 /**
17636  * Create per-state keys from channel base points and the per-commitment point.
17637  * Key set is asymmetric and can't be used as part of counter-signatory set of transactions.
17638  */
17639 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);
17640
17641 /**
17642  * Generate per-state keys from channel static keys.
17643  * Key set is asymmetric and can't be used as part of counter-signatory set of transactions.
17644  */
17645 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);
17646
17647 /**
17648  * A script either spendable by the revocation
17649  * key or the broadcaster_delayed_payment_key and satisfying the relative-locktime OP_CSV constrain.
17650  * Encumbering a `to_holder` output on a commitment transaction or 2nd-stage HTLC transactions.
17651  */
17652 struct LDKCVec_u8Z get_revokeable_redeemscript(struct LDKPublicKey revocation_key, uint16_t contest_delay, struct LDKPublicKey broadcaster_delayed_payment_key);
17653
17654 /**
17655  * Frees any resources used by the HTLCOutputInCommitment, if is_owned is set and inner is non-NULL.
17656  */
17657 void HTLCOutputInCommitment_free(struct LDKHTLCOutputInCommitment this_obj);
17658
17659 /**
17660  * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction).
17661  * Note that this is not the same as whether it is ountbound *from us*. To determine that you
17662  * need to compare this value to whether the commitment transaction in question is that of
17663  * the counterparty or our own.
17664  */
17665 bool HTLCOutputInCommitment_get_offered(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
17666
17667 /**
17668  * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction).
17669  * Note that this is not the same as whether it is ountbound *from us*. To determine that you
17670  * need to compare this value to whether the commitment transaction in question is that of
17671  * the counterparty or our own.
17672  */
17673 void HTLCOutputInCommitment_set_offered(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, bool val);
17674
17675 /**
17676  * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is
17677  * this divided by 1000.
17678  */
17679 uint64_t HTLCOutputInCommitment_get_amount_msat(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
17680
17681 /**
17682  * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is
17683  * this divided by 1000.
17684  */
17685 void HTLCOutputInCommitment_set_amount_msat(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, uint64_t val);
17686
17687 /**
17688  * The CLTV lock-time at which this HTLC expires.
17689  */
17690 uint32_t HTLCOutputInCommitment_get_cltv_expiry(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
17691
17692 /**
17693  * The CLTV lock-time at which this HTLC expires.
17694  */
17695 void HTLCOutputInCommitment_set_cltv_expiry(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, uint32_t val);
17696
17697 /**
17698  * The hash of the preimage which unlocks this HTLC.
17699  */
17700 const uint8_t (*HTLCOutputInCommitment_get_payment_hash(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr))[32];
17701
17702 /**
17703  * The hash of the preimage which unlocks this HTLC.
17704  */
17705 void HTLCOutputInCommitment_set_payment_hash(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
17706
17707 /**
17708  * The position within the commitment transactions' outputs. This may be None if the value is
17709  * below the dust limit (in which case no output appears in the commitment transaction and the
17710  * value is spent to additional transaction fees).
17711  */
17712 struct LDKCOption_u32Z HTLCOutputInCommitment_get_transaction_output_index(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
17713
17714 /**
17715  * The position within the commitment transactions' outputs. This may be None if the value is
17716  * below the dust limit (in which case no output appears in the commitment transaction and the
17717  * value is spent to additional transaction fees).
17718  */
17719 void HTLCOutputInCommitment_set_transaction_output_index(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val);
17720
17721 /**
17722  * Constructs a new HTLCOutputInCommitment given each field
17723  */
17724 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);
17725
17726 /**
17727  * Creates a copy of the HTLCOutputInCommitment
17728  */
17729 struct LDKHTLCOutputInCommitment HTLCOutputInCommitment_clone(const struct LDKHTLCOutputInCommitment *NONNULL_PTR orig);
17730
17731 /**
17732  * Serialize the HTLCOutputInCommitment object into a byte array which can be read by HTLCOutputInCommitment_read
17733  */
17734 struct LDKCVec_u8Z HTLCOutputInCommitment_write(const struct LDKHTLCOutputInCommitment *NONNULL_PTR obj);
17735
17736 /**
17737  * Read a HTLCOutputInCommitment from a byte array, created by HTLCOutputInCommitment_write
17738  */
17739 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ HTLCOutputInCommitment_read(struct LDKu8slice ser);
17740
17741 /**
17742  * Gets the witness redeemscript for an HTLC output in a commitment transaction. Note that htlc
17743  * does not need to have its previous_output_index filled.
17744  */
17745 struct LDKCVec_u8Z get_htlc_redeemscript(const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc, const struct LDKTxCreationKeys *NONNULL_PTR keys);
17746
17747 /**
17748  * Gets the redeemscript for a funding output from the two funding public keys.
17749  * Note that the order of funding public keys does not matter.
17750  */
17751 struct LDKCVec_u8Z make_funding_redeemscript(struct LDKPublicKey broadcaster, struct LDKPublicKey countersignatory);
17752
17753 /**
17754  * Builds an unsigned HTLC-Success or HTLC-Timeout transaction from the given channel and HTLC
17755  * parameters. This is used by [`TrustedCommitmentTransaction::get_htlc_sigs`] to fetch the
17756  * transaction which needs signing, and can be used to construct an HTLC transaction which is
17757  * broadcastable given a counterparty HTLC signature.
17758  *
17759  * Panics if htlc.transaction_output_index.is_none() (as such HTLCs do not appear in the
17760  * commitment transaction).
17761  */
17762 struct LDKTransaction build_htlc_transaction(const uint8_t (*commitment_txid)[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);
17763
17764 /**
17765  * Frees any resources used by the ChannelTransactionParameters, if is_owned is set and inner is non-NULL.
17766  */
17767 void ChannelTransactionParameters_free(struct LDKChannelTransactionParameters this_obj);
17768
17769 /**
17770  * Holder public keys
17771  */
17772 struct LDKChannelPublicKeys ChannelTransactionParameters_get_holder_pubkeys(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
17773
17774 /**
17775  * Holder public keys
17776  */
17777 void ChannelTransactionParameters_set_holder_pubkeys(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelPublicKeys val);
17778
17779 /**
17780  * The contest delay selected by the holder, which applies to counterparty-broadcast transactions
17781  */
17782 uint16_t ChannelTransactionParameters_get_holder_selected_contest_delay(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
17783
17784 /**
17785  * The contest delay selected by the holder, which applies to counterparty-broadcast transactions
17786  */
17787 void ChannelTransactionParameters_set_holder_selected_contest_delay(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, uint16_t val);
17788
17789 /**
17790  * Whether the holder is the initiator of this channel.
17791  * This is an input to the commitment number obscure factor computation.
17792  */
17793 bool ChannelTransactionParameters_get_is_outbound_from_holder(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
17794
17795 /**
17796  * Whether the holder is the initiator of this channel.
17797  * This is an input to the commitment number obscure factor computation.
17798  */
17799 void ChannelTransactionParameters_set_is_outbound_from_holder(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, bool val);
17800
17801 /**
17802  * The late-bound counterparty channel transaction parameters.
17803  * These parameters are populated at the point in the protocol where the counterparty provides them.
17804  *
17805  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
17806  */
17807 struct LDKCounterpartyChannelTransactionParameters ChannelTransactionParameters_get_counterparty_parameters(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
17808
17809 /**
17810  * The late-bound counterparty channel transaction parameters.
17811  * These parameters are populated at the point in the protocol where the counterparty provides them.
17812  *
17813  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
17814  */
17815 void ChannelTransactionParameters_set_counterparty_parameters(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKCounterpartyChannelTransactionParameters val);
17816
17817 /**
17818  * The late-bound funding outpoint
17819  *
17820  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
17821  */
17822 struct LDKOutPoint ChannelTransactionParameters_get_funding_outpoint(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
17823
17824 /**
17825  * The late-bound funding outpoint
17826  *
17827  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
17828  */
17829 void ChannelTransactionParameters_set_funding_outpoint(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKOutPoint val);
17830
17831 /**
17832  * Constructs a new ChannelTransactionParameters given each field
17833  */
17834 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);
17835
17836 /**
17837  * Creates a copy of the ChannelTransactionParameters
17838  */
17839 struct LDKChannelTransactionParameters ChannelTransactionParameters_clone(const struct LDKChannelTransactionParameters *NONNULL_PTR orig);
17840
17841 /**
17842  * Frees any resources used by the CounterpartyChannelTransactionParameters, if is_owned is set and inner is non-NULL.
17843  */
17844 void CounterpartyChannelTransactionParameters_free(struct LDKCounterpartyChannelTransactionParameters this_obj);
17845
17846 /**
17847  * Counter-party public keys
17848  */
17849 struct LDKChannelPublicKeys CounterpartyChannelTransactionParameters_get_pubkeys(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr);
17850
17851 /**
17852  * Counter-party public keys
17853  */
17854 void CounterpartyChannelTransactionParameters_set_pubkeys(struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelPublicKeys val);
17855
17856 /**
17857  * The contest delay selected by the counterparty, which applies to holder-broadcast transactions
17858  */
17859 uint16_t CounterpartyChannelTransactionParameters_get_selected_contest_delay(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr);
17860
17861 /**
17862  * The contest delay selected by the counterparty, which applies to holder-broadcast transactions
17863  */
17864 void CounterpartyChannelTransactionParameters_set_selected_contest_delay(struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr, uint16_t val);
17865
17866 /**
17867  * Constructs a new CounterpartyChannelTransactionParameters given each field
17868  */
17869 MUST_USE_RES struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_new(struct LDKChannelPublicKeys pubkeys_arg, uint16_t selected_contest_delay_arg);
17870
17871 /**
17872  * Creates a copy of the CounterpartyChannelTransactionParameters
17873  */
17874 struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_clone(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR orig);
17875
17876 /**
17877  * Whether the late bound parameters are populated.
17878  */
17879 MUST_USE_RES bool ChannelTransactionParameters_is_populated(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
17880
17881 /**
17882  * Convert the holder/counterparty parameters to broadcaster/countersignatory-organized parameters,
17883  * given that the holder is the broadcaster.
17884  *
17885  * self.is_populated() must be true before calling this function.
17886  */
17887 MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionParameters_as_holder_broadcastable(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
17888
17889 /**
17890  * Convert the holder/counterparty parameters to broadcaster/countersignatory-organized parameters,
17891  * given that the counterparty is the broadcaster.
17892  *
17893  * self.is_populated() must be true before calling this function.
17894  */
17895 MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionParameters_as_counterparty_broadcastable(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
17896
17897 /**
17898  * Serialize the CounterpartyChannelTransactionParameters object into a byte array which can be read by CounterpartyChannelTransactionParameters_read
17899  */
17900 struct LDKCVec_u8Z CounterpartyChannelTransactionParameters_write(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR obj);
17901
17902 /**
17903  * Read a CounterpartyChannelTransactionParameters from a byte array, created by CounterpartyChannelTransactionParameters_write
17904  */
17905 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CounterpartyChannelTransactionParameters_read(struct LDKu8slice ser);
17906
17907 /**
17908  * Serialize the ChannelTransactionParameters object into a byte array which can be read by ChannelTransactionParameters_read
17909  */
17910 struct LDKCVec_u8Z ChannelTransactionParameters_write(const struct LDKChannelTransactionParameters *NONNULL_PTR obj);
17911
17912 /**
17913  * Read a ChannelTransactionParameters from a byte array, created by ChannelTransactionParameters_write
17914  */
17915 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ ChannelTransactionParameters_read(struct LDKu8slice ser);
17916
17917 /**
17918  * Frees any resources used by the DirectedChannelTransactionParameters, if is_owned is set and inner is non-NULL.
17919  */
17920 void DirectedChannelTransactionParameters_free(struct LDKDirectedChannelTransactionParameters this_obj);
17921
17922 /**
17923  * Get the channel pubkeys for the broadcaster
17924  */
17925 MUST_USE_RES struct LDKChannelPublicKeys DirectedChannelTransactionParameters_broadcaster_pubkeys(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
17926
17927 /**
17928  * Get the channel pubkeys for the countersignatory
17929  */
17930 MUST_USE_RES struct LDKChannelPublicKeys DirectedChannelTransactionParameters_countersignatory_pubkeys(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
17931
17932 /**
17933  * Get the contest delay applicable to the transactions.
17934  * Note that the contest delay was selected by the countersignatory.
17935  */
17936 MUST_USE_RES uint16_t DirectedChannelTransactionParameters_contest_delay(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
17937
17938 /**
17939  * Whether the channel is outbound from the broadcaster.
17940  *
17941  * The boolean representing the side that initiated the channel is
17942  * an input to the commitment number obscure factor computation.
17943  */
17944 MUST_USE_RES bool DirectedChannelTransactionParameters_is_outbound(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
17945
17946 /**
17947  * The funding outpoint
17948  */
17949 MUST_USE_RES struct LDKOutPoint DirectedChannelTransactionParameters_funding_outpoint(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
17950
17951 /**
17952  * Frees any resources used by the HolderCommitmentTransaction, if is_owned is set and inner is non-NULL.
17953  */
17954 void HolderCommitmentTransaction_free(struct LDKHolderCommitmentTransaction this_obj);
17955
17956 /**
17957  * Our counterparty's signature for the transaction
17958  */
17959 struct LDKSignature HolderCommitmentTransaction_get_counterparty_sig(const struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr);
17960
17961 /**
17962  * Our counterparty's signature for the transaction
17963  */
17964 void HolderCommitmentTransaction_set_counterparty_sig(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKSignature val);
17965
17966 /**
17967  * All non-dust counterparty HTLC signatures, in the order they appear in the transaction
17968  */
17969 void HolderCommitmentTransaction_set_counterparty_htlc_sigs(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKCVec_SignatureZ val);
17970
17971 /**
17972  * Creates a copy of the HolderCommitmentTransaction
17973  */
17974 struct LDKHolderCommitmentTransaction HolderCommitmentTransaction_clone(const struct LDKHolderCommitmentTransaction *NONNULL_PTR orig);
17975
17976 /**
17977  * Serialize the HolderCommitmentTransaction object into a byte array which can be read by HolderCommitmentTransaction_read
17978  */
17979 struct LDKCVec_u8Z HolderCommitmentTransaction_write(const struct LDKHolderCommitmentTransaction *NONNULL_PTR obj);
17980
17981 /**
17982  * Read a HolderCommitmentTransaction from a byte array, created by HolderCommitmentTransaction_write
17983  */
17984 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ HolderCommitmentTransaction_read(struct LDKu8slice ser);
17985
17986 /**
17987  * Create a new holder transaction with the given counterparty signatures.
17988  * The funding keys are used to figure out which signature should go first when building the transaction for broadcast.
17989  */
17990 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);
17991
17992 /**
17993  * Frees any resources used by the BuiltCommitmentTransaction, if is_owned is set and inner is non-NULL.
17994  */
17995 void BuiltCommitmentTransaction_free(struct LDKBuiltCommitmentTransaction this_obj);
17996
17997 /**
17998  * The commitment transaction
17999  */
18000 struct LDKTransaction BuiltCommitmentTransaction_get_transaction(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr);
18001
18002 /**
18003  * The commitment transaction
18004  */
18005 void BuiltCommitmentTransaction_set_transaction(struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKTransaction val);
18006
18007 /**
18008  * The txid for the commitment transaction.
18009  *
18010  * This is provided as a performance optimization, instead of calling transaction.txid()
18011  * multiple times.
18012  */
18013 const uint8_t (*BuiltCommitmentTransaction_get_txid(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr))[32];
18014
18015 /**
18016  * The txid for the commitment transaction.
18017  *
18018  * This is provided as a performance optimization, instead of calling transaction.txid()
18019  * multiple times.
18020  */
18021 void BuiltCommitmentTransaction_set_txid(struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
18022
18023 /**
18024  * Constructs a new BuiltCommitmentTransaction given each field
18025  */
18026 MUST_USE_RES struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_new(struct LDKTransaction transaction_arg, struct LDKThirtyTwoBytes txid_arg);
18027
18028 /**
18029  * Creates a copy of the BuiltCommitmentTransaction
18030  */
18031 struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_clone(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR orig);
18032
18033 /**
18034  * Serialize the BuiltCommitmentTransaction object into a byte array which can be read by BuiltCommitmentTransaction_read
18035  */
18036 struct LDKCVec_u8Z BuiltCommitmentTransaction_write(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR obj);
18037
18038 /**
18039  * Read a BuiltCommitmentTransaction from a byte array, created by BuiltCommitmentTransaction_write
18040  */
18041 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ BuiltCommitmentTransaction_read(struct LDKu8slice ser);
18042
18043 /**
18044  * Get the SIGHASH_ALL sighash value of the transaction.
18045  *
18046  * This can be used to verify a signature.
18047  */
18048 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);
18049
18050 /**
18051  * Sign a transaction, either because we are counter-signing the counterparty's transaction or
18052  * because we are about to broadcast a holder transaction.
18053  */
18054 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);
18055
18056 /**
18057  * Frees any resources used by the CommitmentTransaction, if is_owned is set and inner is non-NULL.
18058  */
18059 void CommitmentTransaction_free(struct LDKCommitmentTransaction this_obj);
18060
18061 /**
18062  * Creates a copy of the CommitmentTransaction
18063  */
18064 struct LDKCommitmentTransaction CommitmentTransaction_clone(const struct LDKCommitmentTransaction *NONNULL_PTR orig);
18065
18066 /**
18067  * Serialize the CommitmentTransaction object into a byte array which can be read by CommitmentTransaction_read
18068  */
18069 struct LDKCVec_u8Z CommitmentTransaction_write(const struct LDKCommitmentTransaction *NONNULL_PTR obj);
18070
18071 /**
18072  * Read a CommitmentTransaction from a byte array, created by CommitmentTransaction_write
18073  */
18074 struct LDKCResult_CommitmentTransactionDecodeErrorZ CommitmentTransaction_read(struct LDKu8slice ser);
18075
18076 /**
18077  * The backwards-counting commitment number
18078  */
18079 MUST_USE_RES uint64_t CommitmentTransaction_commitment_number(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
18080
18081 /**
18082  * The value to be sent to the broadcaster
18083  */
18084 MUST_USE_RES uint64_t CommitmentTransaction_to_broadcaster_value_sat(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
18085
18086 /**
18087  * The value to be sent to the counterparty
18088  */
18089 MUST_USE_RES uint64_t CommitmentTransaction_to_countersignatory_value_sat(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
18090
18091 /**
18092  * The feerate paid per 1000-weight-unit in this commitment transaction.
18093  */
18094 MUST_USE_RES uint32_t CommitmentTransaction_feerate_per_kw(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
18095
18096 /**
18097  * Trust our pre-built transaction and derived transaction creation public keys.
18098  *
18099  * Applies a wrapper which allows access to these fields.
18100  *
18101  * This should only be used if you fully trust the builder of this object.  It should not
18102  *\tbe used by an external signer - instead use the verify function.
18103  */
18104 MUST_USE_RES struct LDKTrustedCommitmentTransaction CommitmentTransaction_trust(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
18105
18106 /**
18107  * Verify our pre-built transaction and derived transaction creation public keys.
18108  *
18109  * Applies a wrapper which allows access to these fields.
18110  *
18111  * An external validating signer must call this method before signing
18112  * or using the built transaction.
18113  */
18114 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);
18115
18116 /**
18117  * Frees any resources used by the TrustedCommitmentTransaction, if is_owned is set and inner is non-NULL.
18118  */
18119 void TrustedCommitmentTransaction_free(struct LDKTrustedCommitmentTransaction this_obj);
18120
18121 /**
18122  * The transaction ID of the built Bitcoin transaction
18123  */
18124 MUST_USE_RES struct LDKThirtyTwoBytes TrustedCommitmentTransaction_txid(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
18125
18126 /**
18127  * The pre-built Bitcoin commitment transaction
18128  */
18129 MUST_USE_RES struct LDKBuiltCommitmentTransaction TrustedCommitmentTransaction_built_transaction(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
18130
18131 /**
18132  * The pre-calculated transaction creation public keys.
18133  */
18134 MUST_USE_RES struct LDKTxCreationKeys TrustedCommitmentTransaction_keys(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
18135
18136 /**
18137  * Get a signature for each HTLC which was included in the commitment transaction (ie for
18138  * which HTLCOutputInCommitment::transaction_output_index.is_some()).
18139  *
18140  * The returned Vec has one entry for each HTLC, and in the same order.
18141  */
18142 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);
18143
18144 /**
18145  * Commitment transaction numbers which appear in the transactions themselves are XOR'd with a
18146  * shared secret first. This prevents on-chain observers from discovering how many commitment
18147  * transactions occurred in a channel before it was closed.
18148  *
18149  * This function gets the shared secret from relevant channel public keys and can be used to
18150  * \"decrypt\" the commitment transaction number given a commitment transaction on-chain.
18151  */
18152 uint64_t get_commitment_transaction_number_obscure_factor(struct LDKPublicKey broadcaster_payment_basepoint, struct LDKPublicKey countersignatory_payment_basepoint, bool outbound_from_broadcaster);
18153
18154 /**
18155  * Checks if two InitFeaturess contain equal inner contents.
18156  * This ignores pointers and is_owned flags and looks at the values in fields.
18157  * Two objects with NULL inner values will be considered "equal" here.
18158  */
18159 bool InitFeatures_eq(const struct LDKInitFeatures *NONNULL_PTR a, const struct LDKInitFeatures *NONNULL_PTR b);
18160
18161 /**
18162  * Checks if two NodeFeaturess contain equal inner contents.
18163  * This ignores pointers and is_owned flags and looks at the values in fields.
18164  * Two objects with NULL inner values will be considered "equal" here.
18165  */
18166 bool NodeFeatures_eq(const struct LDKNodeFeatures *NONNULL_PTR a, const struct LDKNodeFeatures *NONNULL_PTR b);
18167
18168 /**
18169  * Checks if two ChannelFeaturess contain equal inner contents.
18170  * This ignores pointers and is_owned flags and looks at the values in fields.
18171  * Two objects with NULL inner values will be considered "equal" here.
18172  */
18173 bool ChannelFeatures_eq(const struct LDKChannelFeatures *NONNULL_PTR a, const struct LDKChannelFeatures *NONNULL_PTR b);
18174
18175 /**
18176  * Checks if two InvoiceFeaturess contain equal inner contents.
18177  * This ignores pointers and is_owned flags and looks at the values in fields.
18178  * Two objects with NULL inner values will be considered "equal" here.
18179  */
18180 bool InvoiceFeatures_eq(const struct LDKInvoiceFeatures *NONNULL_PTR a, const struct LDKInvoiceFeatures *NONNULL_PTR b);
18181
18182 /**
18183  * Creates a copy of the InitFeatures
18184  */
18185 struct LDKInitFeatures InitFeatures_clone(const struct LDKInitFeatures *NONNULL_PTR orig);
18186
18187 /**
18188  * Creates a copy of the NodeFeatures
18189  */
18190 struct LDKNodeFeatures NodeFeatures_clone(const struct LDKNodeFeatures *NONNULL_PTR orig);
18191
18192 /**
18193  * Creates a copy of the ChannelFeatures
18194  */
18195 struct LDKChannelFeatures ChannelFeatures_clone(const struct LDKChannelFeatures *NONNULL_PTR orig);
18196
18197 /**
18198  * Creates a copy of the InvoiceFeatures
18199  */
18200 struct LDKInvoiceFeatures InvoiceFeatures_clone(const struct LDKInvoiceFeatures *NONNULL_PTR orig);
18201
18202 /**
18203  * Frees any resources used by the InitFeatures, if is_owned is set and inner is non-NULL.
18204  */
18205 void InitFeatures_free(struct LDKInitFeatures this_obj);
18206
18207 /**
18208  * Frees any resources used by the NodeFeatures, if is_owned is set and inner is non-NULL.
18209  */
18210 void NodeFeatures_free(struct LDKNodeFeatures this_obj);
18211
18212 /**
18213  * Frees any resources used by the ChannelFeatures, if is_owned is set and inner is non-NULL.
18214  */
18215 void ChannelFeatures_free(struct LDKChannelFeatures this_obj);
18216
18217 /**
18218  * Frees any resources used by the InvoiceFeatures, if is_owned is set and inner is non-NULL.
18219  */
18220 void InvoiceFeatures_free(struct LDKInvoiceFeatures this_obj);
18221
18222 /**
18223  * Create a blank Features with no features set
18224  */
18225 MUST_USE_RES struct LDKInitFeatures InitFeatures_empty(void);
18226
18227 /**
18228  * Creates a Features with the bits set which are known by the implementation
18229  */
18230 MUST_USE_RES struct LDKInitFeatures InitFeatures_known(void);
18231
18232 /**
18233  * Create a blank Features with no features set
18234  */
18235 MUST_USE_RES struct LDKNodeFeatures NodeFeatures_empty(void);
18236
18237 /**
18238  * Creates a Features with the bits set which are known by the implementation
18239  */
18240 MUST_USE_RES struct LDKNodeFeatures NodeFeatures_known(void);
18241
18242 /**
18243  * Create a blank Features with no features set
18244  */
18245 MUST_USE_RES struct LDKChannelFeatures ChannelFeatures_empty(void);
18246
18247 /**
18248  * Creates a Features with the bits set which are known by the implementation
18249  */
18250 MUST_USE_RES struct LDKChannelFeatures ChannelFeatures_known(void);
18251
18252 /**
18253  * Create a blank Features with no features set
18254  */
18255 MUST_USE_RES struct LDKInvoiceFeatures InvoiceFeatures_empty(void);
18256
18257 /**
18258  * Creates a Features with the bits set which are known by the implementation
18259  */
18260 MUST_USE_RES struct LDKInvoiceFeatures InvoiceFeatures_known(void);
18261
18262 /**
18263  * Returns whether the `payment_secret` feature is supported.
18264  */
18265 MUST_USE_RES bool InitFeatures_supports_payment_secret(const struct LDKInitFeatures *NONNULL_PTR this_arg);
18266
18267 /**
18268  * Returns whether the `payment_secret` feature is supported.
18269  */
18270 MUST_USE_RES bool NodeFeatures_supports_payment_secret(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
18271
18272 /**
18273  * Returns whether the `payment_secret` feature is supported.
18274  */
18275 MUST_USE_RES bool InvoiceFeatures_supports_payment_secret(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
18276
18277 /**
18278  * Serialize the InitFeatures object into a byte array which can be read by InitFeatures_read
18279  */
18280 struct LDKCVec_u8Z InitFeatures_write(const struct LDKInitFeatures *NONNULL_PTR obj);
18281
18282 /**
18283  * Serialize the NodeFeatures object into a byte array which can be read by NodeFeatures_read
18284  */
18285 struct LDKCVec_u8Z NodeFeatures_write(const struct LDKNodeFeatures *NONNULL_PTR obj);
18286
18287 /**
18288  * Serialize the ChannelFeatures object into a byte array which can be read by ChannelFeatures_read
18289  */
18290 struct LDKCVec_u8Z ChannelFeatures_write(const struct LDKChannelFeatures *NONNULL_PTR obj);
18291
18292 /**
18293  * Serialize the InvoiceFeatures object into a byte array which can be read by InvoiceFeatures_read
18294  */
18295 struct LDKCVec_u8Z InvoiceFeatures_write(const struct LDKInvoiceFeatures *NONNULL_PTR obj);
18296
18297 /**
18298  * Read a InitFeatures from a byte array, created by InitFeatures_write
18299  */
18300 struct LDKCResult_InitFeaturesDecodeErrorZ InitFeatures_read(struct LDKu8slice ser);
18301
18302 /**
18303  * Read a NodeFeatures from a byte array, created by NodeFeatures_write
18304  */
18305 struct LDKCResult_NodeFeaturesDecodeErrorZ NodeFeatures_read(struct LDKu8slice ser);
18306
18307 /**
18308  * Read a ChannelFeatures from a byte array, created by ChannelFeatures_write
18309  */
18310 struct LDKCResult_ChannelFeaturesDecodeErrorZ ChannelFeatures_read(struct LDKu8slice ser);
18311
18312 /**
18313  * Read a InvoiceFeatures from a byte array, created by InvoiceFeatures_write
18314  */
18315 struct LDKCResult_InvoiceFeaturesDecodeErrorZ InvoiceFeatures_read(struct LDKu8slice ser);
18316
18317 /**
18318  * Frees any resources used by the ShutdownScript, if is_owned is set and inner is non-NULL.
18319  */
18320 void ShutdownScript_free(struct LDKShutdownScript this_obj);
18321
18322 /**
18323  * Creates a copy of the ShutdownScript
18324  */
18325 struct LDKShutdownScript ShutdownScript_clone(const struct LDKShutdownScript *NONNULL_PTR orig);
18326
18327 /**
18328  * Frees any resources used by the InvalidShutdownScript, if is_owned is set and inner is non-NULL.
18329  */
18330 void InvalidShutdownScript_free(struct LDKInvalidShutdownScript this_obj);
18331
18332 /**
18333  * The script that did not meet the requirements from [BOLT #2].
18334  *
18335  * [BOLT #2]: https://github.com/lightningnetwork/lightning-rfc/blob/master/02-peer-protocol.md
18336  */
18337 struct LDKu8slice InvalidShutdownScript_get_script(const struct LDKInvalidShutdownScript *NONNULL_PTR this_ptr);
18338
18339 /**
18340  * The script that did not meet the requirements from [BOLT #2].
18341  *
18342  * [BOLT #2]: https://github.com/lightningnetwork/lightning-rfc/blob/master/02-peer-protocol.md
18343  */
18344 void InvalidShutdownScript_set_script(struct LDKInvalidShutdownScript *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
18345
18346 /**
18347  * Constructs a new InvalidShutdownScript given each field
18348  */
18349 MUST_USE_RES struct LDKInvalidShutdownScript InvalidShutdownScript_new(struct LDKCVec_u8Z script_arg);
18350
18351 /**
18352  * Serialize the ShutdownScript object into a byte array which can be read by ShutdownScript_read
18353  */
18354 struct LDKCVec_u8Z ShutdownScript_write(const struct LDKShutdownScript *NONNULL_PTR obj);
18355
18356 /**
18357  * Read a ShutdownScript from a byte array, created by ShutdownScript_write
18358  */
18359 struct LDKCResult_ShutdownScriptDecodeErrorZ ShutdownScript_read(struct LDKu8slice ser);
18360
18361 /**
18362  * Generates a P2PKH script pubkey from the given [`PubkeyHash`].
18363  */
18364 MUST_USE_RES struct LDKShutdownScript ShutdownScript_new_p2pkh(const uint8_t (*pubkey_hash)[20]);
18365
18366 /**
18367  * Generates a P2SH script pubkey from the given [`ScriptHash`].
18368  */
18369 MUST_USE_RES struct LDKShutdownScript ShutdownScript_new_p2sh(const uint8_t (*script_hash)[20]);
18370
18371 /**
18372  * Generates a P2WPKH script pubkey from the given [`WPubkeyHash`].
18373  */
18374 MUST_USE_RES struct LDKShutdownScript ShutdownScript_new_p2wpkh(const uint8_t (*pubkey_hash)[20]);
18375
18376 /**
18377  * Generates a P2WSH script pubkey from the given [`WScriptHash`].
18378  */
18379 MUST_USE_RES struct LDKShutdownScript ShutdownScript_new_p2wsh(const uint8_t (*script_hash)[32]);
18380
18381 /**
18382  * Generates a witness script pubkey from the given segwit version and program.
18383  *
18384  * Note for version-zero witness scripts you must use [`ShutdownScript::new_p2wpkh`] or
18385  * [`ShutdownScript::new_p2wsh`] instead.
18386  *
18387  * # Errors
18388  *
18389  * This function may return an error if `program` is invalid for the segwit `version`.
18390  */
18391 MUST_USE_RES struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ ShutdownScript_new_witness_program(uint8_t version, struct LDKu8slice program);
18392
18393 /**
18394  * Converts the shutdown script into the underlying [`Script`].
18395  */
18396 MUST_USE_RES struct LDKCVec_u8Z ShutdownScript_into_inner(struct LDKShutdownScript this_arg);
18397
18398 /**
18399  * Returns the [`PublicKey`] used for a P2WPKH shutdown script if constructed directly from it.
18400  *
18401  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
18402  */
18403 MUST_USE_RES struct LDKPublicKey ShutdownScript_as_legacy_pubkey(const struct LDKShutdownScript *NONNULL_PTR this_arg);
18404
18405 /**
18406  * Returns whether the shutdown script is compatible with the features as defined by BOLT #2.
18407  *
18408  * Specifically, checks for compliance with feature `option_shutdown_anysegwit`.
18409  */
18410 MUST_USE_RES bool ShutdownScript_is_compatible(const struct LDKShutdownScript *NONNULL_PTR this_arg, const struct LDKInitFeatures *NONNULL_PTR features);
18411
18412 /**
18413  * Frees any resources used by the RouteHop, if is_owned is set and inner is non-NULL.
18414  */
18415 void RouteHop_free(struct LDKRouteHop this_obj);
18416
18417 /**
18418  * The node_id of the node at this hop.
18419  */
18420 struct LDKPublicKey RouteHop_get_pubkey(const struct LDKRouteHop *NONNULL_PTR this_ptr);
18421
18422 /**
18423  * The node_id of the node at this hop.
18424  */
18425 void RouteHop_set_pubkey(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKPublicKey val);
18426
18427 /**
18428  * The node_announcement features of the node at this hop. For the last hop, these may be
18429  * amended to match the features present in the invoice this node generated.
18430  */
18431 struct LDKNodeFeatures RouteHop_get_node_features(const struct LDKRouteHop *NONNULL_PTR this_ptr);
18432
18433 /**
18434  * The node_announcement features of the node at this hop. For the last hop, these may be
18435  * amended to match the features present in the invoice this node generated.
18436  */
18437 void RouteHop_set_node_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
18438
18439 /**
18440  * The channel that should be used from the previous hop to reach this node.
18441  */
18442 uint64_t RouteHop_get_short_channel_id(const struct LDKRouteHop *NONNULL_PTR this_ptr);
18443
18444 /**
18445  * The channel that should be used from the previous hop to reach this node.
18446  */
18447 void RouteHop_set_short_channel_id(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val);
18448
18449 /**
18450  * The channel_announcement features of the channel that should be used from the previous hop
18451  * to reach this node.
18452  */
18453 struct LDKChannelFeatures RouteHop_get_channel_features(const struct LDKRouteHop *NONNULL_PTR this_ptr);
18454
18455 /**
18456  * The channel_announcement features of the channel that should be used from the previous hop
18457  * to reach this node.
18458  */
18459 void RouteHop_set_channel_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
18460
18461 /**
18462  * The fee taken on this hop (for paying for the use of the *next* channel in the path).
18463  * For the last hop, this should be the full value of the payment (might be more than
18464  * requested if we had to match htlc_minimum_msat).
18465  */
18466 uint64_t RouteHop_get_fee_msat(const struct LDKRouteHop *NONNULL_PTR this_ptr);
18467
18468 /**
18469  * The fee taken on this hop (for paying for the use of the *next* channel in the path).
18470  * For the last hop, this should be the full value of the payment (might be more than
18471  * requested if we had to match htlc_minimum_msat).
18472  */
18473 void RouteHop_set_fee_msat(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val);
18474
18475 /**
18476  * The CLTV delta added for this hop. For the last hop, this should be the full CLTV value
18477  * expected at the destination, in excess of the current block height.
18478  */
18479 uint32_t RouteHop_get_cltv_expiry_delta(const struct LDKRouteHop *NONNULL_PTR this_ptr);
18480
18481 /**
18482  * The CLTV delta added for this hop. For the last hop, this should be the full CLTV value
18483  * expected at the destination, in excess of the current block height.
18484  */
18485 void RouteHop_set_cltv_expiry_delta(struct LDKRouteHop *NONNULL_PTR this_ptr, uint32_t val);
18486
18487 /**
18488  * Constructs a new RouteHop given each field
18489  */
18490 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);
18491
18492 /**
18493  * Creates a copy of the RouteHop
18494  */
18495 struct LDKRouteHop RouteHop_clone(const struct LDKRouteHop *NONNULL_PTR orig);
18496
18497 /**
18498  * Serialize the RouteHop object into a byte array which can be read by RouteHop_read
18499  */
18500 struct LDKCVec_u8Z RouteHop_write(const struct LDKRouteHop *NONNULL_PTR obj);
18501
18502 /**
18503  * Read a RouteHop from a byte array, created by RouteHop_write
18504  */
18505 struct LDKCResult_RouteHopDecodeErrorZ RouteHop_read(struct LDKu8slice ser);
18506
18507 /**
18508  * Frees any resources used by the Route, if is_owned is set and inner is non-NULL.
18509  */
18510 void Route_free(struct LDKRoute this_obj);
18511
18512 /**
18513  * The list of routes taken for a single (potentially-)multi-part payment. The pubkey of the
18514  * last RouteHop in each path must be the same.
18515  * Each entry represents a list of hops, NOT INCLUDING our own, where the last hop is the
18516  * destination. Thus, this must always be at least length one. While the maximum length of any
18517  * given path is variable, keeping the length of any path to less than 20 should currently
18518  * ensure it is viable.
18519  */
18520 void Route_set_paths(struct LDKRoute *NONNULL_PTR this_ptr, struct LDKCVec_CVec_RouteHopZZ val);
18521
18522 /**
18523  * Constructs a new Route given each field
18524  */
18525 MUST_USE_RES struct LDKRoute Route_new(struct LDKCVec_CVec_RouteHopZZ paths_arg);
18526
18527 /**
18528  * Creates a copy of the Route
18529  */
18530 struct LDKRoute Route_clone(const struct LDKRoute *NONNULL_PTR orig);
18531
18532 /**
18533  * Serialize the Route object into a byte array which can be read by Route_read
18534  */
18535 struct LDKCVec_u8Z Route_write(const struct LDKRoute *NONNULL_PTR obj);
18536
18537 /**
18538  * Read a Route from a byte array, created by Route_write
18539  */
18540 struct LDKCResult_RouteDecodeErrorZ Route_read(struct LDKu8slice ser);
18541
18542 /**
18543  * Frees any resources used by the RouteHint, if is_owned is set and inner is non-NULL.
18544  */
18545 void RouteHint_free(struct LDKRouteHint this_obj);
18546
18547 /**
18548  * Checks if two RouteHints contain equal inner contents.
18549  * This ignores pointers and is_owned flags and looks at the values in fields.
18550  * Two objects with NULL inner values will be considered "equal" here.
18551  */
18552 bool RouteHint_eq(const struct LDKRouteHint *NONNULL_PTR a, const struct LDKRouteHint *NONNULL_PTR b);
18553
18554 /**
18555  * Creates a copy of the RouteHint
18556  */
18557 struct LDKRouteHint RouteHint_clone(const struct LDKRouteHint *NONNULL_PTR orig);
18558
18559 /**
18560  * Frees any resources used by the RouteHintHop, if is_owned is set and inner is non-NULL.
18561  */
18562 void RouteHintHop_free(struct LDKRouteHintHop this_obj);
18563
18564 /**
18565  * The node_id of the non-target end of the route
18566  */
18567 struct LDKPublicKey RouteHintHop_get_src_node_id(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
18568
18569 /**
18570  * The node_id of the non-target end of the route
18571  */
18572 void RouteHintHop_set_src_node_id(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKPublicKey val);
18573
18574 /**
18575  * The short_channel_id of this channel
18576  */
18577 uint64_t RouteHintHop_get_short_channel_id(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
18578
18579 /**
18580  * The short_channel_id of this channel
18581  */
18582 void RouteHintHop_set_short_channel_id(struct LDKRouteHintHop *NONNULL_PTR this_ptr, uint64_t val);
18583
18584 /**
18585  * The fees which must be paid to use this channel
18586  */
18587 struct LDKRoutingFees RouteHintHop_get_fees(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
18588
18589 /**
18590  * The fees which must be paid to use this channel
18591  */
18592 void RouteHintHop_set_fees(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
18593
18594 /**
18595  * The difference in CLTV values between this node and the next node.
18596  */
18597 uint16_t RouteHintHop_get_cltv_expiry_delta(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
18598
18599 /**
18600  * The difference in CLTV values between this node and the next node.
18601  */
18602 void RouteHintHop_set_cltv_expiry_delta(struct LDKRouteHintHop *NONNULL_PTR this_ptr, uint16_t val);
18603
18604 /**
18605  * The minimum value, in msat, which must be relayed to the next hop.
18606  */
18607 struct LDKCOption_u64Z RouteHintHop_get_htlc_minimum_msat(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
18608
18609 /**
18610  * The minimum value, in msat, which must be relayed to the next hop.
18611  */
18612 void RouteHintHop_set_htlc_minimum_msat(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
18613
18614 /**
18615  * The maximum value in msat available for routing with a single HTLC.
18616  */
18617 struct LDKCOption_u64Z RouteHintHop_get_htlc_maximum_msat(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
18618
18619 /**
18620  * The maximum value in msat available for routing with a single HTLC.
18621  */
18622 void RouteHintHop_set_htlc_maximum_msat(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
18623
18624 /**
18625  * Constructs a new RouteHintHop given each field
18626  */
18627 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);
18628
18629 /**
18630  * Checks if two RouteHintHops contain equal inner contents.
18631  * This ignores pointers and is_owned flags and looks at the values in fields.
18632  * Two objects with NULL inner values will be considered "equal" here.
18633  */
18634 bool RouteHintHop_eq(const struct LDKRouteHintHop *NONNULL_PTR a, const struct LDKRouteHintHop *NONNULL_PTR b);
18635
18636 /**
18637  * Creates a copy of the RouteHintHop
18638  */
18639 struct LDKRouteHintHop RouteHintHop_clone(const struct LDKRouteHintHop *NONNULL_PTR orig);
18640
18641 /**
18642  * Gets a keysend route from us (payer) to the given target node (payee). This is needed because
18643  * keysend payments do not have an invoice from which to pull the payee's supported features, which
18644  * makes it tricky to otherwise supply the `payee_features` parameter of `get_route`.
18645  *
18646  * Note that first_hops (or a relevant inner pointer) may be NULL or all-0s to represent None
18647  */
18648 struct LDKCResult_RouteLightningErrorZ get_keysend_route(struct LDKPublicKey our_node_id, const struct LDKNetworkGraph *NONNULL_PTR network, struct LDKPublicKey payee, struct LDKCVec_ChannelDetailsZ *first_hops, struct LDKCVec_RouteHintZ last_hops, uint64_t final_value_msat, uint32_t final_cltv, struct LDKLogger logger);
18649
18650 /**
18651  * Gets a route from us (payer) to the given target node (payee).
18652  *
18653  * If the payee provided features in their invoice, they should be provided via payee_features.
18654  * Without this, MPP will only be used if the payee's features are available in the network graph.
18655  *
18656  * Private routing paths between a public node and the target may be included in `last_hops`.
18657  * Currently, only the last hop in each path is considered.
18658  *
18659  * If some channels aren't announced, it may be useful to fill in a first_hops with the
18660  * results from a local ChannelManager::list_usable_channels() call. If it is filled in, our
18661  * view of our local channels (from net_graph_msg_handler) will be ignored, and only those
18662  * in first_hops will be used.
18663  *
18664  * Panics if first_hops contains channels without short_channel_ids
18665  * (ChannelManager::list_usable_channels will never include such channels).
18666  *
18667  * The fees on channels from us to next-hops are ignored (as they are assumed to all be
18668  * equal), however the enabled/disabled bit on such channels as well as the
18669  * htlc_minimum_msat/htlc_maximum_msat *are* checked as they may change based on the receiving node.
18670  *
18671  * Note that payee_features (or a relevant inner pointer) may be NULL or all-0s to represent None
18672  * Note that first_hops (or a relevant inner pointer) may be NULL or all-0s to represent None
18673  */
18674 struct LDKCResult_RouteLightningErrorZ get_route(struct LDKPublicKey our_node_id, const struct LDKNetworkGraph *NONNULL_PTR network, struct LDKPublicKey payee, struct LDKInvoiceFeatures payee_features, struct LDKCVec_ChannelDetailsZ *first_hops, struct LDKCVec_RouteHintZ last_hops, uint64_t final_value_msat, uint32_t final_cltv, struct LDKLogger logger);
18675
18676 /**
18677  * Frees any resources used by the NetworkGraph, if is_owned is set and inner is non-NULL.
18678  */
18679 void NetworkGraph_free(struct LDKNetworkGraph this_obj);
18680
18681 /**
18682  * Creates a copy of the NetworkGraph
18683  */
18684 struct LDKNetworkGraph NetworkGraph_clone(const struct LDKNetworkGraph *NONNULL_PTR orig);
18685
18686 /**
18687  * Frees any resources used by the LockedNetworkGraph, if is_owned is set and inner is non-NULL.
18688  */
18689 void LockedNetworkGraph_free(struct LDKLockedNetworkGraph this_obj);
18690
18691 /**
18692  * Frees any resources used by the NetGraphMsgHandler, if is_owned is set and inner is non-NULL.
18693  */
18694 void NetGraphMsgHandler_free(struct LDKNetGraphMsgHandler this_obj);
18695
18696 /**
18697  * Creates a new tracker of the actual state of the network of channels and nodes,
18698  * assuming a fresh network graph.
18699  * Chain monitor is used to make sure announced channels exist on-chain,
18700  * channel data is correct, and that the announcement is signed with
18701  * channel owners' keys.
18702  *
18703  * Note that chain_access (or a relevant inner pointer) may be NULL or all-0s to represent None
18704  */
18705 MUST_USE_RES struct LDKNetGraphMsgHandler NetGraphMsgHandler_new(struct LDKThirtyTwoBytes genesis_hash, struct LDKAccess *chain_access, struct LDKLogger logger);
18706
18707 /**
18708  * Creates a new tracker of the actual state of the network of channels and nodes,
18709  * assuming an existing Network Graph.
18710  *
18711  * Note that chain_access (or a relevant inner pointer) may be NULL or all-0s to represent None
18712  */
18713 MUST_USE_RES struct LDKNetGraphMsgHandler NetGraphMsgHandler_from_net_graph(struct LDKAccess *chain_access, struct LDKLogger logger, struct LDKNetworkGraph network_graph);
18714
18715 /**
18716  * Adds a provider used to check new announcements. Does not affect
18717  * existing announcements unless they are updated.
18718  * Add, update or remove the provider would replace the current one.
18719  *
18720  * Note that chain_access (or a relevant inner pointer) may be NULL or all-0s to represent None
18721  */
18722 void NetGraphMsgHandler_add_chain_access(struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg, struct LDKAccess *chain_access);
18723
18724 /**
18725  * Take a read lock on the network_graph and return it in the C-bindings
18726  * newtype helper. This is likely only useful when called via the C
18727  * bindings as you can call `self.network_graph.read().unwrap()` in Rust
18728  * yourself.
18729  */
18730 MUST_USE_RES struct LDKLockedNetworkGraph NetGraphMsgHandler_read_locked_graph(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg);
18731
18732 /**
18733  * Get a reference to the NetworkGraph which this read-lock contains.
18734  */
18735 MUST_USE_RES struct LDKNetworkGraph LockedNetworkGraph_graph(const struct LDKLockedNetworkGraph *NONNULL_PTR this_arg);
18736
18737 /**
18738  * Constructs a new RoutingMessageHandler which calls the relevant methods on this_arg.
18739  * This copies the `inner` pointer in this_arg and thus the returned RoutingMessageHandler must be freed before this_arg is
18740  */
18741 struct LDKRoutingMessageHandler NetGraphMsgHandler_as_RoutingMessageHandler(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg);
18742
18743 /**
18744  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
18745  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
18746  */
18747 struct LDKMessageSendEventsProvider NetGraphMsgHandler_as_MessageSendEventsProvider(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg);
18748
18749 /**
18750  * Frees any resources used by the DirectionalChannelInfo, if is_owned is set and inner is non-NULL.
18751  */
18752 void DirectionalChannelInfo_free(struct LDKDirectionalChannelInfo this_obj);
18753
18754 /**
18755  * When the last update to the channel direction was issued.
18756  * Value is opaque, as set in the announcement.
18757  */
18758 uint32_t DirectionalChannelInfo_get_last_update(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
18759
18760 /**
18761  * When the last update to the channel direction was issued.
18762  * Value is opaque, as set in the announcement.
18763  */
18764 void DirectionalChannelInfo_set_last_update(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, uint32_t val);
18765
18766 /**
18767  * Whether the channel can be currently used for payments (in this one direction).
18768  */
18769 bool DirectionalChannelInfo_get_enabled(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
18770
18771 /**
18772  * Whether the channel can be currently used for payments (in this one direction).
18773  */
18774 void DirectionalChannelInfo_set_enabled(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, bool val);
18775
18776 /**
18777  * The difference in CLTV values that you must have when routing through this channel.
18778  */
18779 uint16_t DirectionalChannelInfo_get_cltv_expiry_delta(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
18780
18781 /**
18782  * The difference in CLTV values that you must have when routing through this channel.
18783  */
18784 void DirectionalChannelInfo_set_cltv_expiry_delta(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, uint16_t val);
18785
18786 /**
18787  * The minimum value, which must be relayed to the next hop via the channel
18788  */
18789 uint64_t DirectionalChannelInfo_get_htlc_minimum_msat(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
18790
18791 /**
18792  * The minimum value, which must be relayed to the next hop via the channel
18793  */
18794 void DirectionalChannelInfo_set_htlc_minimum_msat(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, uint64_t val);
18795
18796 /**
18797  * The maximum value which may be relayed to the next hop via the channel.
18798  */
18799 struct LDKCOption_u64Z DirectionalChannelInfo_get_htlc_maximum_msat(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
18800
18801 /**
18802  * The maximum value which may be relayed to the next hop via the channel.
18803  */
18804 void DirectionalChannelInfo_set_htlc_maximum_msat(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
18805
18806 /**
18807  * Fees charged when the channel is used for routing
18808  */
18809 struct LDKRoutingFees DirectionalChannelInfo_get_fees(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
18810
18811 /**
18812  * Fees charged when the channel is used for routing
18813  */
18814 void DirectionalChannelInfo_set_fees(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
18815
18816 /**
18817  * Most recent update for the channel received from the network
18818  * Mostly redundant with the data we store in fields explicitly.
18819  * Everything else is useful only for sending out for initial routing sync.
18820  * Not stored if contains excess data to prevent DoS.
18821  *
18822  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
18823  */
18824 struct LDKChannelUpdate DirectionalChannelInfo_get_last_update_message(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
18825
18826 /**
18827  * Most recent update for the channel received from the network
18828  * Mostly redundant with the data we store in fields explicitly.
18829  * Everything else is useful only for sending out for initial routing sync.
18830  * Not stored if contains excess data to prevent DoS.
18831  *
18832  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
18833  */
18834 void DirectionalChannelInfo_set_last_update_message(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelUpdate val);
18835
18836 /**
18837  * Constructs a new DirectionalChannelInfo given each field
18838  */
18839 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);
18840
18841 /**
18842  * Creates a copy of the DirectionalChannelInfo
18843  */
18844 struct LDKDirectionalChannelInfo DirectionalChannelInfo_clone(const struct LDKDirectionalChannelInfo *NONNULL_PTR orig);
18845
18846 /**
18847  * Serialize the DirectionalChannelInfo object into a byte array which can be read by DirectionalChannelInfo_read
18848  */
18849 struct LDKCVec_u8Z DirectionalChannelInfo_write(const struct LDKDirectionalChannelInfo *NONNULL_PTR obj);
18850
18851 /**
18852  * Read a DirectionalChannelInfo from a byte array, created by DirectionalChannelInfo_write
18853  */
18854 struct LDKCResult_DirectionalChannelInfoDecodeErrorZ DirectionalChannelInfo_read(struct LDKu8slice ser);
18855
18856 /**
18857  * Frees any resources used by the ChannelInfo, if is_owned is set and inner is non-NULL.
18858  */
18859 void ChannelInfo_free(struct LDKChannelInfo this_obj);
18860
18861 /**
18862  * Protocol features of a channel communicated during its announcement
18863  */
18864 struct LDKChannelFeatures ChannelInfo_get_features(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
18865
18866 /**
18867  * Protocol features of a channel communicated during its announcement
18868  */
18869 void ChannelInfo_set_features(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
18870
18871 /**
18872  * Source node of the first direction of a channel
18873  */
18874 struct LDKPublicKey ChannelInfo_get_node_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
18875
18876 /**
18877  * Source node of the first direction of a channel
18878  */
18879 void ChannelInfo_set_node_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKPublicKey val);
18880
18881 /**
18882  * Details about the first direction of a channel
18883  *
18884  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
18885  */
18886 struct LDKDirectionalChannelInfo ChannelInfo_get_one_to_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
18887
18888 /**
18889  * Details about the first direction of a channel
18890  *
18891  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
18892  */
18893 void ChannelInfo_set_one_to_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKDirectionalChannelInfo val);
18894
18895 /**
18896  * Source node of the second direction of a channel
18897  */
18898 struct LDKPublicKey ChannelInfo_get_node_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
18899
18900 /**
18901  * Source node of the second direction of a channel
18902  */
18903 void ChannelInfo_set_node_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKPublicKey val);
18904
18905 /**
18906  * Details about the second direction of a channel
18907  *
18908  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
18909  */
18910 struct LDKDirectionalChannelInfo ChannelInfo_get_two_to_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
18911
18912 /**
18913  * Details about the second direction of a channel
18914  *
18915  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
18916  */
18917 void ChannelInfo_set_two_to_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKDirectionalChannelInfo val);
18918
18919 /**
18920  * The channel capacity as seen on-chain, if chain lookup is available.
18921  */
18922 struct LDKCOption_u64Z ChannelInfo_get_capacity_sats(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
18923
18924 /**
18925  * The channel capacity as seen on-chain, if chain lookup is available.
18926  */
18927 void ChannelInfo_set_capacity_sats(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
18928
18929 /**
18930  * An initial announcement of the channel
18931  * Mostly redundant with the data we store in fields explicitly.
18932  * Everything else is useful only for sending out for initial routing sync.
18933  * Not stored if contains excess data to prevent DoS.
18934  *
18935  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
18936  */
18937 struct LDKChannelAnnouncement ChannelInfo_get_announcement_message(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
18938
18939 /**
18940  * An initial announcement of the channel
18941  * Mostly redundant with the data we store in fields explicitly.
18942  * Everything else is useful only for sending out for initial routing sync.
18943  * Not stored if contains excess data to prevent DoS.
18944  *
18945  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
18946  */
18947 void ChannelInfo_set_announcement_message(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelAnnouncement val);
18948
18949 /**
18950  * Constructs a new ChannelInfo given each field
18951  */
18952 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);
18953
18954 /**
18955  * Creates a copy of the ChannelInfo
18956  */
18957 struct LDKChannelInfo ChannelInfo_clone(const struct LDKChannelInfo *NONNULL_PTR orig);
18958
18959 /**
18960  * Serialize the ChannelInfo object into a byte array which can be read by ChannelInfo_read
18961  */
18962 struct LDKCVec_u8Z ChannelInfo_write(const struct LDKChannelInfo *NONNULL_PTR obj);
18963
18964 /**
18965  * Read a ChannelInfo from a byte array, created by ChannelInfo_write
18966  */
18967 struct LDKCResult_ChannelInfoDecodeErrorZ ChannelInfo_read(struct LDKu8slice ser);
18968
18969 /**
18970  * Frees any resources used by the RoutingFees, if is_owned is set and inner is non-NULL.
18971  */
18972 void RoutingFees_free(struct LDKRoutingFees this_obj);
18973
18974 /**
18975  * Flat routing fee in satoshis
18976  */
18977 uint32_t RoutingFees_get_base_msat(const struct LDKRoutingFees *NONNULL_PTR this_ptr);
18978
18979 /**
18980  * Flat routing fee in satoshis
18981  */
18982 void RoutingFees_set_base_msat(struct LDKRoutingFees *NONNULL_PTR this_ptr, uint32_t val);
18983
18984 /**
18985  * Liquidity-based routing fee in millionths of a routed amount.
18986  * In other words, 10000 is 1%.
18987  */
18988 uint32_t RoutingFees_get_proportional_millionths(const struct LDKRoutingFees *NONNULL_PTR this_ptr);
18989
18990 /**
18991  * Liquidity-based routing fee in millionths of a routed amount.
18992  * In other words, 10000 is 1%.
18993  */
18994 void RoutingFees_set_proportional_millionths(struct LDKRoutingFees *NONNULL_PTR this_ptr, uint32_t val);
18995
18996 /**
18997  * Constructs a new RoutingFees given each field
18998  */
18999 MUST_USE_RES struct LDKRoutingFees RoutingFees_new(uint32_t base_msat_arg, uint32_t proportional_millionths_arg);
19000
19001 /**
19002  * Checks if two RoutingFeess contain equal inner contents.
19003  * This ignores pointers and is_owned flags and looks at the values in fields.
19004  * Two objects with NULL inner values will be considered "equal" here.
19005  */
19006 bool RoutingFees_eq(const struct LDKRoutingFees *NONNULL_PTR a, const struct LDKRoutingFees *NONNULL_PTR b);
19007
19008 /**
19009  * Creates a copy of the RoutingFees
19010  */
19011 struct LDKRoutingFees RoutingFees_clone(const struct LDKRoutingFees *NONNULL_PTR orig);
19012
19013 /**
19014  * Serialize the RoutingFees object into a byte array which can be read by RoutingFees_read
19015  */
19016 struct LDKCVec_u8Z RoutingFees_write(const struct LDKRoutingFees *NONNULL_PTR obj);
19017
19018 /**
19019  * Read a RoutingFees from a byte array, created by RoutingFees_write
19020  */
19021 struct LDKCResult_RoutingFeesDecodeErrorZ RoutingFees_read(struct LDKu8slice ser);
19022
19023 /**
19024  * Frees any resources used by the NodeAnnouncementInfo, if is_owned is set and inner is non-NULL.
19025  */
19026 void NodeAnnouncementInfo_free(struct LDKNodeAnnouncementInfo this_obj);
19027
19028 /**
19029  * Protocol features the node announced support for
19030  */
19031 struct LDKNodeFeatures NodeAnnouncementInfo_get_features(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
19032
19033 /**
19034  * Protocol features the node announced support for
19035  */
19036 void NodeAnnouncementInfo_set_features(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
19037
19038 /**
19039  * When the last known update to the node state was issued.
19040  * Value is opaque, as set in the announcement.
19041  */
19042 uint32_t NodeAnnouncementInfo_get_last_update(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
19043
19044 /**
19045  * When the last known update to the node state was issued.
19046  * Value is opaque, as set in the announcement.
19047  */
19048 void NodeAnnouncementInfo_set_last_update(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, uint32_t val);
19049
19050 /**
19051  * Color assigned to the node
19052  */
19053 const uint8_t (*NodeAnnouncementInfo_get_rgb(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr))[3];
19054
19055 /**
19056  * Color assigned to the node
19057  */
19058 void NodeAnnouncementInfo_set_rgb(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKThreeBytes val);
19059
19060 /**
19061  * Moniker assigned to the node.
19062  * May be invalid or malicious (eg control chars),
19063  * should not be exposed to the user.
19064  */
19065 const uint8_t (*NodeAnnouncementInfo_get_alias(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr))[32];
19066
19067 /**
19068  * Moniker assigned to the node.
19069  * May be invalid or malicious (eg control chars),
19070  * should not be exposed to the user.
19071  */
19072 void NodeAnnouncementInfo_set_alias(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
19073
19074 /**
19075  * Internet-level addresses via which one can connect to the node
19076  */
19077 void NodeAnnouncementInfo_set_addresses(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKCVec_NetAddressZ val);
19078
19079 /**
19080  * An initial announcement of the node
19081  * Mostly redundant with the data we store in fields explicitly.
19082  * Everything else is useful only for sending out for initial routing sync.
19083  * Not stored if contains excess data to prevent DoS.
19084  *
19085  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
19086  */
19087 struct LDKNodeAnnouncement NodeAnnouncementInfo_get_announcement_message(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
19088
19089 /**
19090  * An initial announcement of the node
19091  * Mostly redundant with the data we store in fields explicitly.
19092  * Everything else is useful only for sending out for initial routing sync.
19093  * Not stored if contains excess data to prevent DoS.
19094  *
19095  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
19096  */
19097 void NodeAnnouncementInfo_set_announcement_message(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeAnnouncement val);
19098
19099 /**
19100  * Constructs a new NodeAnnouncementInfo given each field
19101  */
19102 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);
19103
19104 /**
19105  * Creates a copy of the NodeAnnouncementInfo
19106  */
19107 struct LDKNodeAnnouncementInfo NodeAnnouncementInfo_clone(const struct LDKNodeAnnouncementInfo *NONNULL_PTR orig);
19108
19109 /**
19110  * Serialize the NodeAnnouncementInfo object into a byte array which can be read by NodeAnnouncementInfo_read
19111  */
19112 struct LDKCVec_u8Z NodeAnnouncementInfo_write(const struct LDKNodeAnnouncementInfo *NONNULL_PTR obj);
19113
19114 /**
19115  * Read a NodeAnnouncementInfo from a byte array, created by NodeAnnouncementInfo_write
19116  */
19117 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ NodeAnnouncementInfo_read(struct LDKu8slice ser);
19118
19119 /**
19120  * Frees any resources used by the NodeInfo, if is_owned is set and inner is non-NULL.
19121  */
19122 void NodeInfo_free(struct LDKNodeInfo this_obj);
19123
19124 /**
19125  * All valid channels a node has announced
19126  */
19127 void NodeInfo_set_channels(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
19128
19129 /**
19130  * Lowest fees enabling routing via any of the enabled, known channels to a node.
19131  * The two fields (flat and proportional fee) are independent,
19132  * meaning they don't have to refer to the same channel.
19133  *
19134  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
19135  */
19136 struct LDKRoutingFees NodeInfo_get_lowest_inbound_channel_fees(const struct LDKNodeInfo *NONNULL_PTR this_ptr);
19137
19138 /**
19139  * Lowest fees enabling routing via any of the enabled, known channels to a node.
19140  * The two fields (flat and proportional fee) are independent,
19141  * meaning they don't have to refer to the same channel.
19142  *
19143  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
19144  */
19145 void NodeInfo_set_lowest_inbound_channel_fees(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
19146
19147 /**
19148  * More information about a node from node_announcement.
19149  * Optional because we store a Node entry after learning about it from
19150  * a channel announcement, but before receiving a node announcement.
19151  *
19152  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
19153  */
19154 struct LDKNodeAnnouncementInfo NodeInfo_get_announcement_info(const struct LDKNodeInfo *NONNULL_PTR this_ptr);
19155
19156 /**
19157  * More information about a node from node_announcement.
19158  * Optional because we store a Node entry after learning about it from
19159  * a channel announcement, but before receiving a node announcement.
19160  *
19161  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
19162  */
19163 void NodeInfo_set_announcement_info(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKNodeAnnouncementInfo val);
19164
19165 /**
19166  * Constructs a new NodeInfo given each field
19167  */
19168 MUST_USE_RES struct LDKNodeInfo NodeInfo_new(struct LDKCVec_u64Z channels_arg, struct LDKRoutingFees lowest_inbound_channel_fees_arg, struct LDKNodeAnnouncementInfo announcement_info_arg);
19169
19170 /**
19171  * Creates a copy of the NodeInfo
19172  */
19173 struct LDKNodeInfo NodeInfo_clone(const struct LDKNodeInfo *NONNULL_PTR orig);
19174
19175 /**
19176  * Serialize the NodeInfo object into a byte array which can be read by NodeInfo_read
19177  */
19178 struct LDKCVec_u8Z NodeInfo_write(const struct LDKNodeInfo *NONNULL_PTR obj);
19179
19180 /**
19181  * Read a NodeInfo from a byte array, created by NodeInfo_write
19182  */
19183 struct LDKCResult_NodeInfoDecodeErrorZ NodeInfo_read(struct LDKu8slice ser);
19184
19185 /**
19186  * Serialize the NetworkGraph object into a byte array which can be read by NetworkGraph_read
19187  */
19188 struct LDKCVec_u8Z NetworkGraph_write(const struct LDKNetworkGraph *NONNULL_PTR obj);
19189
19190 /**
19191  * Read a NetworkGraph from a byte array, created by NetworkGraph_write
19192  */
19193 struct LDKCResult_NetworkGraphDecodeErrorZ NetworkGraph_read(struct LDKu8slice ser);
19194
19195 /**
19196  * Creates a new, empty, network graph.
19197  */
19198 MUST_USE_RES struct LDKNetworkGraph NetworkGraph_new(struct LDKThirtyTwoBytes genesis_hash);
19199
19200 /**
19201  * For an already known node (from channel announcements), update its stored properties from a
19202  * given node announcement.
19203  *
19204  * You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's
19205  * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
19206  * routing messages from a source using a protocol other than the lightning P2P protocol.
19207  */
19208 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_node_from_announcement(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKNodeAnnouncement *NONNULL_PTR msg);
19209
19210 /**
19211  * For an already known node (from channel announcements), update its stored properties from a
19212  * given node announcement without verifying the associated signatures. Because we aren't
19213  * given the associated signatures here we cannot relay the node announcement to any of our
19214  * peers.
19215  */
19216 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_node_from_unsigned_announcement(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR msg);
19217
19218 /**
19219  * Store or update channel info from a channel announcement.
19220  *
19221  * You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's
19222  * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
19223  * routing messages from a source using a protocol other than the lightning P2P protocol.
19224  *
19225  * If a `chain::Access` object is provided via `chain_access`, it will be called to verify
19226  * the corresponding UTXO exists on chain and is correctly-formatted.
19227  *
19228  * Note that chain_access (or a relevant inner pointer) may be NULL or all-0s to represent None
19229  */
19230 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);
19231
19232 /**
19233  * Store or update channel info from a channel announcement without verifying the associated
19234  * signatures. Because we aren't given the associated signatures here we cannot relay the
19235  * channel announcement to any of our peers.
19236  *
19237  * If a `chain::Access` object is provided via `chain_access`, it will be called to verify
19238  * the corresponding UTXO exists on chain and is correctly-formatted.
19239  *
19240  * Note that chain_access (or a relevant inner pointer) may be NULL or all-0s to represent None
19241  */
19242 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);
19243
19244 /**
19245  * Close a channel if a corresponding HTLC fail was sent.
19246  * If permanent, removes a channel from the local storage.
19247  * May cause the removal of nodes too, if this was their last channel.
19248  * If not permanent, makes channels unavailable for routing.
19249  */
19250 void NetworkGraph_close_channel_from_update(struct LDKNetworkGraph *NONNULL_PTR this_arg, uint64_t short_channel_id, bool is_permanent);
19251
19252 /**
19253  * For an already known (from announcement) channel, update info about one of the directions
19254  * of the channel.
19255  *
19256  * You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's
19257  * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
19258  * routing messages from a source using a protocol other than the lightning P2P protocol.
19259  */
19260 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg);
19261
19262 /**
19263  * For an already known (from announcement) channel, update info about one of the directions
19264  * of the channel without verifying the associated signatures. Because we aren't given the
19265  * associated signatures here we cannot relay the channel update to any of our peers.
19266  */
19267 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_unsigned(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedChannelUpdate *NONNULL_PTR msg);
19268
19269 /**
19270  * Frees any resources used by the FilesystemPersister, if is_owned is set and inner is non-NULL.
19271  */
19272 void FilesystemPersister_free(struct LDKFilesystemPersister this_obj);
19273
19274 /**
19275  * Initialize a new FilesystemPersister and set the path to the individual channels'
19276  * files.
19277  */
19278 MUST_USE_RES struct LDKFilesystemPersister FilesystemPersister_new(struct LDKStr path_to_channel_data);
19279
19280 /**
19281  * Get the directory which was provided when this persister was initialized.
19282  */
19283 MUST_USE_RES struct LDKStr FilesystemPersister_get_data_dir(const struct LDKFilesystemPersister *NONNULL_PTR this_arg);
19284
19285 /**
19286  * Writes the provided `ChannelManager` to the path provided at `FilesystemPersister`
19287  * initialization, within a file called \"manager\".
19288  */
19289 MUST_USE_RES struct LDKCResult_NoneErrorZ FilesystemPersister_persist_manager(struct LDKStr data_dir, const struct LDKChannelManager *NONNULL_PTR manager);
19290
19291 /**
19292  * Read `ChannelMonitor`s from disk.
19293  */
19294 MUST_USE_RES struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ FilesystemPersister_read_channelmonitors(const struct LDKFilesystemPersister *NONNULL_PTR this_arg, struct LDKKeysInterface keys_manager);
19295
19296 /**
19297  * Constructs a new Persist which calls the relevant methods on this_arg.
19298  * This copies the `inner` pointer in this_arg and thus the returned Persist must be freed before this_arg is
19299  */
19300 struct LDKPersist FilesystemPersister_as_Persist(const struct LDKFilesystemPersister *NONNULL_PTR this_arg);
19301
19302 /**
19303  * Frees any resources used by the BackgroundProcessor, if is_owned is set and inner is non-NULL.
19304  */
19305 void BackgroundProcessor_free(struct LDKBackgroundProcessor this_obj);
19306
19307 /**
19308  * Calls the free function if one is set
19309  */
19310 void ChannelManagerPersister_free(struct LDKChannelManagerPersister this_ptr);
19311
19312 /**
19313  * Start a background thread that takes care of responsibilities enumerated in the [top-level
19314  * documentation].
19315  *
19316  * The thread runs indefinitely unless the object is dropped, [`stop`] is called, or
19317  * `persist_manager` returns an error. In case of an error, the error is retrieved by calling
19318  * either [`join`] or [`stop`].
19319  *
19320  * Typically, users should either implement [`ChannelManagerPersister`] to never return an
19321  * error or call [`join`] and handle any error that may arise. For the latter case, the
19322  * `BackgroundProcessor` must be restarted by calling `start` again after handling the error.
19323  *
19324  * `persist_manager` is responsible for writing out the [`ChannelManager`] to disk, and/or
19325  * uploading to one or more backup services. See [`ChannelManager::write`] for writing out a
19326  * [`ChannelManager`]. See [`FilesystemPersister::persist_manager`] for Rust-Lightning's
19327  * provided implementation.
19328  *
19329  * [top-level documentation]: Self
19330  * [`join`]: Self::join
19331  * [`stop`]: Self::stop
19332  * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
19333  * [`ChannelManager::write`]: lightning::ln::channelmanager::ChannelManager#impl-Writeable
19334  * [`FilesystemPersister::persist_manager`]: lightning_persister::FilesystemPersister::persist_manager
19335  */
19336 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);
19337
19338 /**
19339  * Join `BackgroundProcessor`'s thread, returning any error that occurred while persisting
19340  * [`ChannelManager`].
19341  *
19342  * # Panics
19343  *
19344  * This function panics if the background thread has panicked such as while persisting or
19345  * handling events.
19346  *
19347  * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
19348  */
19349 MUST_USE_RES struct LDKCResult_NoneErrorZ BackgroundProcessor_join(struct LDKBackgroundProcessor this_arg);
19350
19351 /**
19352  * Stop `BackgroundProcessor`'s thread, returning any error that occurred while persisting
19353  * [`ChannelManager`].
19354  *
19355  * # Panics
19356  *
19357  * This function panics if the background thread has panicked such as while persisting or
19358  * handling events.
19359  *
19360  * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
19361  */
19362 MUST_USE_RES struct LDKCResult_NoneErrorZ BackgroundProcessor_stop(struct LDKBackgroundProcessor this_arg);
19363
19364 /**
19365  * **Call this function on startup to ensure that all assumptions about the platform are valid.**
19366  *
19367  * Unfortunately we have to make assumptions about the upper bounds of the `SystemTime` type on
19368  * your platform which we can't fully verify at compile time and which isn't part of it's contract.
19369  * To our best knowledge our assumptions hold for all platforms officially supported by rust, but
19370  * since this check is fast we recommend to do it anyway.
19371  *
19372  * If this function fails this is considered a bug. Please open an issue describing your
19373  * platform and stating your current system time.
19374  *
19375  * # Panics
19376  * If the check fails this function panics. By calling this function on startup you ensure that
19377  * this wont happen at an arbitrary later point in time.
19378  */
19379 void check_platform(void);
19380
19381 /**
19382  * Frees any resources used by the Invoice, if is_owned is set and inner is non-NULL.
19383  */
19384 void Invoice_free(struct LDKInvoice this_obj);
19385
19386 /**
19387  * Checks if two Invoices contain equal inner contents.
19388  * This ignores pointers and is_owned flags and looks at the values in fields.
19389  * Two objects with NULL inner values will be considered "equal" here.
19390  */
19391 bool Invoice_eq(const struct LDKInvoice *NONNULL_PTR a, const struct LDKInvoice *NONNULL_PTR b);
19392
19393 /**
19394  * Creates a copy of the Invoice
19395  */
19396 struct LDKInvoice Invoice_clone(const struct LDKInvoice *NONNULL_PTR orig);
19397
19398 /**
19399  * Frees any resources used by the SignedRawInvoice, if is_owned is set and inner is non-NULL.
19400  */
19401 void SignedRawInvoice_free(struct LDKSignedRawInvoice this_obj);
19402
19403 /**
19404  * Checks if two SignedRawInvoices contain equal inner contents.
19405  * This ignores pointers and is_owned flags and looks at the values in fields.
19406  * Two objects with NULL inner values will be considered "equal" here.
19407  */
19408 bool SignedRawInvoice_eq(const struct LDKSignedRawInvoice *NONNULL_PTR a, const struct LDKSignedRawInvoice *NONNULL_PTR b);
19409
19410 /**
19411  * Creates a copy of the SignedRawInvoice
19412  */
19413 struct LDKSignedRawInvoice SignedRawInvoice_clone(const struct LDKSignedRawInvoice *NONNULL_PTR orig);
19414
19415 /**
19416  * Frees any resources used by the RawInvoice, if is_owned is set and inner is non-NULL.
19417  */
19418 void RawInvoice_free(struct LDKRawInvoice this_obj);
19419
19420 /**
19421  * data part
19422  */
19423 struct LDKRawDataPart RawInvoice_get_data(const struct LDKRawInvoice *NONNULL_PTR this_ptr);
19424
19425 /**
19426  * data part
19427  */
19428 void RawInvoice_set_data(struct LDKRawInvoice *NONNULL_PTR this_ptr, struct LDKRawDataPart val);
19429
19430 /**
19431  * Checks if two RawInvoices contain equal inner contents.
19432  * This ignores pointers and is_owned flags and looks at the values in fields.
19433  * Two objects with NULL inner values will be considered "equal" here.
19434  */
19435 bool RawInvoice_eq(const struct LDKRawInvoice *NONNULL_PTR a, const struct LDKRawInvoice *NONNULL_PTR b);
19436
19437 /**
19438  * Creates a copy of the RawInvoice
19439  */
19440 struct LDKRawInvoice RawInvoice_clone(const struct LDKRawInvoice *NONNULL_PTR orig);
19441
19442 /**
19443  * Frees any resources used by the RawDataPart, if is_owned is set and inner is non-NULL.
19444  */
19445 void RawDataPart_free(struct LDKRawDataPart this_obj);
19446
19447 /**
19448  * generation time of the invoice
19449  */
19450 struct LDKPositiveTimestamp RawDataPart_get_timestamp(const struct LDKRawDataPart *NONNULL_PTR this_ptr);
19451
19452 /**
19453  * generation time of the invoice
19454  */
19455 void RawDataPart_set_timestamp(struct LDKRawDataPart *NONNULL_PTR this_ptr, struct LDKPositiveTimestamp val);
19456
19457 /**
19458  * Checks if two RawDataParts contain equal inner contents.
19459  * This ignores pointers and is_owned flags and looks at the values in fields.
19460  * Two objects with NULL inner values will be considered "equal" here.
19461  */
19462 bool RawDataPart_eq(const struct LDKRawDataPart *NONNULL_PTR a, const struct LDKRawDataPart *NONNULL_PTR b);
19463
19464 /**
19465  * Creates a copy of the RawDataPart
19466  */
19467 struct LDKRawDataPart RawDataPart_clone(const struct LDKRawDataPart *NONNULL_PTR orig);
19468
19469 /**
19470  * Frees any resources used by the PositiveTimestamp, if is_owned is set and inner is non-NULL.
19471  */
19472 void PositiveTimestamp_free(struct LDKPositiveTimestamp this_obj);
19473
19474 /**
19475  * Checks if two PositiveTimestamps contain equal inner contents.
19476  * This ignores pointers and is_owned flags and looks at the values in fields.
19477  * Two objects with NULL inner values will be considered "equal" here.
19478  */
19479 bool PositiveTimestamp_eq(const struct LDKPositiveTimestamp *NONNULL_PTR a, const struct LDKPositiveTimestamp *NONNULL_PTR b);
19480
19481 /**
19482  * Creates a copy of the PositiveTimestamp
19483  */
19484 struct LDKPositiveTimestamp PositiveTimestamp_clone(const struct LDKPositiveTimestamp *NONNULL_PTR orig);
19485
19486 /**
19487  * Creates a copy of the SiPrefix
19488  */
19489 enum LDKSiPrefix SiPrefix_clone(const enum LDKSiPrefix *NONNULL_PTR orig);
19490
19491 /**
19492  * Utility method to constructs a new Milli-variant SiPrefix
19493  */
19494 enum LDKSiPrefix SiPrefix_milli(void);
19495
19496 /**
19497  * Utility method to constructs a new Micro-variant SiPrefix
19498  */
19499 enum LDKSiPrefix SiPrefix_micro(void);
19500
19501 /**
19502  * Utility method to constructs a new Nano-variant SiPrefix
19503  */
19504 enum LDKSiPrefix SiPrefix_nano(void);
19505
19506 /**
19507  * Utility method to constructs a new Pico-variant SiPrefix
19508  */
19509 enum LDKSiPrefix SiPrefix_pico(void);
19510
19511 /**
19512  * Checks if two SiPrefixs contain equal inner contents.
19513  * This ignores pointers and is_owned flags and looks at the values in fields.
19514  */
19515 bool SiPrefix_eq(const enum LDKSiPrefix *NONNULL_PTR a, const enum LDKSiPrefix *NONNULL_PTR b);
19516
19517 /**
19518  * Returns the multiplier to go from a BTC value to picoBTC implied by this SiPrefix.
19519  * This is effectively 10^12 * the prefix multiplier
19520  */
19521 MUST_USE_RES uint64_t SiPrefix_multiplier(const enum LDKSiPrefix *NONNULL_PTR this_arg);
19522
19523 /**
19524  * Creates a copy of the Currency
19525  */
19526 enum LDKCurrency Currency_clone(const enum LDKCurrency *NONNULL_PTR orig);
19527
19528 /**
19529  * Utility method to constructs a new Bitcoin-variant Currency
19530  */
19531 enum LDKCurrency Currency_bitcoin(void);
19532
19533 /**
19534  * Utility method to constructs a new BitcoinTestnet-variant Currency
19535  */
19536 enum LDKCurrency Currency_bitcoin_testnet(void);
19537
19538 /**
19539  * Utility method to constructs a new Regtest-variant Currency
19540  */
19541 enum LDKCurrency Currency_regtest(void);
19542
19543 /**
19544  * Utility method to constructs a new Simnet-variant Currency
19545  */
19546 enum LDKCurrency Currency_simnet(void);
19547
19548 /**
19549  * Utility method to constructs a new Signet-variant Currency
19550  */
19551 enum LDKCurrency Currency_signet(void);
19552
19553 /**
19554  * Checks if two Currencys contain equal inner contents.
19555  * This ignores pointers and is_owned flags and looks at the values in fields.
19556  */
19557 bool Currency_eq(const enum LDKCurrency *NONNULL_PTR a, const enum LDKCurrency *NONNULL_PTR b);
19558
19559 /**
19560  * Frees any resources used by the Sha256, if is_owned is set and inner is non-NULL.
19561  */
19562 void Sha256_free(struct LDKSha256 this_obj);
19563
19564 /**
19565  * Checks if two Sha256s contain equal inner contents.
19566  * This ignores pointers and is_owned flags and looks at the values in fields.
19567  * Two objects with NULL inner values will be considered "equal" here.
19568  */
19569 bool Sha256_eq(const struct LDKSha256 *NONNULL_PTR a, const struct LDKSha256 *NONNULL_PTR b);
19570
19571 /**
19572  * Creates a copy of the Sha256
19573  */
19574 struct LDKSha256 Sha256_clone(const struct LDKSha256 *NONNULL_PTR orig);
19575
19576 /**
19577  * Frees any resources used by the Description, if is_owned is set and inner is non-NULL.
19578  */
19579 void Description_free(struct LDKDescription this_obj);
19580
19581 /**
19582  * Checks if two Descriptions contain equal inner contents.
19583  * This ignores pointers and is_owned flags and looks at the values in fields.
19584  * Two objects with NULL inner values will be considered "equal" here.
19585  */
19586 bool Description_eq(const struct LDKDescription *NONNULL_PTR a, const struct LDKDescription *NONNULL_PTR b);
19587
19588 /**
19589  * Creates a copy of the Description
19590  */
19591 struct LDKDescription Description_clone(const struct LDKDescription *NONNULL_PTR orig);
19592
19593 /**
19594  * Frees any resources used by the PayeePubKey, if is_owned is set and inner is non-NULL.
19595  */
19596 void PayeePubKey_free(struct LDKPayeePubKey this_obj);
19597
19598 /**
19599  * Checks if two PayeePubKeys contain equal inner contents.
19600  * This ignores pointers and is_owned flags and looks at the values in fields.
19601  * Two objects with NULL inner values will be considered "equal" here.
19602  */
19603 bool PayeePubKey_eq(const struct LDKPayeePubKey *NONNULL_PTR a, const struct LDKPayeePubKey *NONNULL_PTR b);
19604
19605 /**
19606  * Creates a copy of the PayeePubKey
19607  */
19608 struct LDKPayeePubKey PayeePubKey_clone(const struct LDKPayeePubKey *NONNULL_PTR orig);
19609
19610 /**
19611  * Frees any resources used by the ExpiryTime, if is_owned is set and inner is non-NULL.
19612  */
19613 void ExpiryTime_free(struct LDKExpiryTime this_obj);
19614
19615 /**
19616  * Checks if two ExpiryTimes contain equal inner contents.
19617  * This ignores pointers and is_owned flags and looks at the values in fields.
19618  * Two objects with NULL inner values will be considered "equal" here.
19619  */
19620 bool ExpiryTime_eq(const struct LDKExpiryTime *NONNULL_PTR a, const struct LDKExpiryTime *NONNULL_PTR b);
19621
19622 /**
19623  * Creates a copy of the ExpiryTime
19624  */
19625 struct LDKExpiryTime ExpiryTime_clone(const struct LDKExpiryTime *NONNULL_PTR orig);
19626
19627 /**
19628  * Frees any resources used by the MinFinalCltvExpiry, if is_owned is set and inner is non-NULL.
19629  */
19630 void MinFinalCltvExpiry_free(struct LDKMinFinalCltvExpiry this_obj);
19631
19632 /**
19633  * Checks if two MinFinalCltvExpirys contain equal inner contents.
19634  * This ignores pointers and is_owned flags and looks at the values in fields.
19635  * Two objects with NULL inner values will be considered "equal" here.
19636  */
19637 bool MinFinalCltvExpiry_eq(const struct LDKMinFinalCltvExpiry *NONNULL_PTR a, const struct LDKMinFinalCltvExpiry *NONNULL_PTR b);
19638
19639 /**
19640  * Creates a copy of the MinFinalCltvExpiry
19641  */
19642 struct LDKMinFinalCltvExpiry MinFinalCltvExpiry_clone(const struct LDKMinFinalCltvExpiry *NONNULL_PTR orig);
19643
19644 /**
19645  * Frees any resources used by the Fallback
19646  */
19647 void Fallback_free(struct LDKFallback this_ptr);
19648
19649 /**
19650  * Creates a copy of the Fallback
19651  */
19652 struct LDKFallback Fallback_clone(const struct LDKFallback *NONNULL_PTR orig);
19653
19654 /**
19655  * Utility method to constructs a new SegWitProgram-variant Fallback
19656  */
19657 struct LDKFallback Fallback_seg_wit_program(struct LDKu5 version, struct LDKCVec_u8Z program);
19658
19659 /**
19660  * Utility method to constructs a new PubKeyHash-variant Fallback
19661  */
19662 struct LDKFallback Fallback_pub_key_hash(struct LDKTwentyBytes a);
19663
19664 /**
19665  * Utility method to constructs a new ScriptHash-variant Fallback
19666  */
19667 struct LDKFallback Fallback_script_hash(struct LDKTwentyBytes a);
19668
19669 /**
19670  * Checks if two Fallbacks contain equal inner contents.
19671  * This ignores pointers and is_owned flags and looks at the values in fields.
19672  */
19673 bool Fallback_eq(const struct LDKFallback *NONNULL_PTR a, const struct LDKFallback *NONNULL_PTR b);
19674
19675 /**
19676  * Frees any resources used by the InvoiceSignature, if is_owned is set and inner is non-NULL.
19677  */
19678 void InvoiceSignature_free(struct LDKInvoiceSignature this_obj);
19679
19680 /**
19681  * Checks if two InvoiceSignatures contain equal inner contents.
19682  * This ignores pointers and is_owned flags and looks at the values in fields.
19683  * Two objects with NULL inner values will be considered "equal" here.
19684  */
19685 bool InvoiceSignature_eq(const struct LDKInvoiceSignature *NONNULL_PTR a, const struct LDKInvoiceSignature *NONNULL_PTR b);
19686
19687 /**
19688  * Creates a copy of the InvoiceSignature
19689  */
19690 struct LDKInvoiceSignature InvoiceSignature_clone(const struct LDKInvoiceSignature *NONNULL_PTR orig);
19691
19692 /**
19693  * Frees any resources used by the PrivateRoute, if is_owned is set and inner is non-NULL.
19694  */
19695 void PrivateRoute_free(struct LDKPrivateRoute this_obj);
19696
19697 /**
19698  * Checks if two PrivateRoutes contain equal inner contents.
19699  * This ignores pointers and is_owned flags and looks at the values in fields.
19700  * Two objects with NULL inner values will be considered "equal" here.
19701  */
19702 bool PrivateRoute_eq(const struct LDKPrivateRoute *NONNULL_PTR a, const struct LDKPrivateRoute *NONNULL_PTR b);
19703
19704 /**
19705  * Creates a copy of the PrivateRoute
19706  */
19707 struct LDKPrivateRoute PrivateRoute_clone(const struct LDKPrivateRoute *NONNULL_PTR orig);
19708
19709 /**
19710  * Disassembles the `SignedRawInvoice` into its three parts:
19711  *  1. raw invoice
19712  *  2. hash of the raw invoice
19713  *  3. signature
19714  */
19715 MUST_USE_RES struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ SignedRawInvoice_into_parts(struct LDKSignedRawInvoice this_arg);
19716
19717 /**
19718  * The `RawInvoice` which was signed.
19719  */
19720 MUST_USE_RES struct LDKRawInvoice SignedRawInvoice_raw_invoice(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
19721
19722 /**
19723  * The hash of the `RawInvoice` that was signed.
19724  */
19725 MUST_USE_RES const uint8_t (*SignedRawInvoice_hash(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg))[32];
19726
19727 /**
19728  * InvoiceSignature for the invoice.
19729  */
19730 MUST_USE_RES struct LDKInvoiceSignature SignedRawInvoice_signature(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
19731
19732 /**
19733  * Recovers the public key used for signing the invoice from the recoverable signature.
19734  */
19735 MUST_USE_RES struct LDKCResult_PayeePubKeyErrorZ SignedRawInvoice_recover_payee_pub_key(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
19736
19737 /**
19738  * Checks if the signature is valid for the included payee public key or if none exists if it's
19739  * valid for the recovered signature (which should always be true?).
19740  */
19741 MUST_USE_RES bool SignedRawInvoice_check_signature(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
19742
19743 /**
19744  * Calculate the hash of the encoded `RawInvoice`
19745  */
19746 MUST_USE_RES struct LDKThirtyTwoBytes RawInvoice_hash(const struct LDKRawInvoice *NONNULL_PTR this_arg);
19747
19748 /**
19749  *
19750  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
19751  */
19752 MUST_USE_RES struct LDKSha256 RawInvoice_payment_hash(const struct LDKRawInvoice *NONNULL_PTR this_arg);
19753
19754 /**
19755  *
19756  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
19757  */
19758 MUST_USE_RES struct LDKDescription RawInvoice_description(const struct LDKRawInvoice *NONNULL_PTR this_arg);
19759
19760 /**
19761  *
19762  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
19763  */
19764 MUST_USE_RES struct LDKPayeePubKey RawInvoice_payee_pub_key(const struct LDKRawInvoice *NONNULL_PTR this_arg);
19765
19766 /**
19767  *
19768  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
19769  */
19770 MUST_USE_RES struct LDKSha256 RawInvoice_description_hash(const struct LDKRawInvoice *NONNULL_PTR this_arg);
19771
19772 /**
19773  *
19774  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
19775  */
19776 MUST_USE_RES struct LDKExpiryTime RawInvoice_expiry_time(const struct LDKRawInvoice *NONNULL_PTR this_arg);
19777
19778 /**
19779  *
19780  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
19781  */
19782 MUST_USE_RES struct LDKMinFinalCltvExpiry RawInvoice_min_final_cltv_expiry(const struct LDKRawInvoice *NONNULL_PTR this_arg);
19783
19784 /**
19785  *
19786  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
19787  */
19788 MUST_USE_RES struct LDKThirtyTwoBytes RawInvoice_payment_secret(const struct LDKRawInvoice *NONNULL_PTR this_arg);
19789
19790 /**
19791  *
19792  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
19793  */
19794 MUST_USE_RES struct LDKInvoiceFeatures RawInvoice_features(const struct LDKRawInvoice *NONNULL_PTR this_arg);
19795
19796 MUST_USE_RES struct LDKCVec_PrivateRouteZ RawInvoice_private_routes(const struct LDKRawInvoice *NONNULL_PTR this_arg);
19797
19798 MUST_USE_RES struct LDKCOption_u64Z RawInvoice_amount_pico_btc(const struct LDKRawInvoice *NONNULL_PTR this_arg);
19799
19800 MUST_USE_RES enum LDKCurrency RawInvoice_currency(const struct LDKRawInvoice *NONNULL_PTR this_arg);
19801
19802 /**
19803  * Create a new `PositiveTimestamp` from a unix timestamp in the Range
19804  * `0...SYSTEM_TIME_MAX_UNIX_TIMESTAMP - MAX_EXPIRY_TIME`, otherwise return a
19805  * `CreationError::TimestampOutOfBounds`.
19806  */
19807 MUST_USE_RES struct LDKCResult_PositiveTimestampCreationErrorZ PositiveTimestamp_from_unix_timestamp(uint64_t unix_seconds);
19808
19809 /**
19810  * Create a new `PositiveTimestamp` from a `SystemTime` with a corresponding unix timestamp in
19811  * the Range `0...SYSTEM_TIME_MAX_UNIX_TIMESTAMP - MAX_EXPIRY_TIME`, otherwise return a
19812  * `CreationError::TimestampOutOfBounds`.
19813  */
19814 MUST_USE_RES struct LDKCResult_PositiveTimestampCreationErrorZ PositiveTimestamp_from_system_time(uint64_t time);
19815
19816 /**
19817  * Returns the UNIX timestamp representing the stored time
19818  */
19819 MUST_USE_RES uint64_t PositiveTimestamp_as_unix_timestamp(const struct LDKPositiveTimestamp *NONNULL_PTR this_arg);
19820
19821 /**
19822  * Returns a reference to the internal `SystemTime` time representation
19823  */
19824 MUST_USE_RES uint64_t PositiveTimestamp_as_time(const struct LDKPositiveTimestamp *NONNULL_PTR this_arg);
19825
19826 /**
19827  * Transform the `Invoice` into it's unchecked version
19828  */
19829 MUST_USE_RES struct LDKSignedRawInvoice Invoice_into_signed_raw(struct LDKInvoice this_arg);
19830
19831 /**
19832  * Check that the invoice is signed correctly and that key recovery works
19833  */
19834 MUST_USE_RES struct LDKCResult_NoneSemanticErrorZ Invoice_check_signature(const struct LDKInvoice *NONNULL_PTR this_arg);
19835
19836 /**
19837  * Constructs an `Invoice` from a `SignedRawInvoice` by checking all its invariants.
19838  * ```
19839  * use lightning_invoice::*;
19840  *
19841  * let invoice = \"lnbc1pvjluezpp5qqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqypqdp\\
19842  * \tl2pkx2ctnv5sxxmmwwd5kgetjypeh2ursdae8g6twvus8g6rfwvs8qun0dfjkxaq8rkx3yf5tcsyz3d7\\
19843  * \t3gafnh3cax9rn449d9p5uxz9ezhhypd0elx87sjle52x86fux2ypatgddc6k63n7erqz25le42c4u4ec\\
19844  * \tky03ylcqca784w\";
19845  *
19846  * let signed = invoice.parse::<SignedRawInvoice>().unwrap();
19847  *
19848  * assert!(Invoice::from_signed(signed).is_ok());
19849  * ```
19850  */
19851 MUST_USE_RES struct LDKCResult_InvoiceSemanticErrorZ Invoice_from_signed(struct LDKSignedRawInvoice signed_invoice);
19852
19853 /**
19854  * Returns the `Invoice`'s timestamp (should equal it's creation time)
19855  */
19856 MUST_USE_RES uint64_t Invoice_timestamp(const struct LDKInvoice *NONNULL_PTR this_arg);
19857
19858 /**
19859  * Returns the hash to which we will receive the preimage on completion of the payment
19860  */
19861 MUST_USE_RES const uint8_t (*Invoice_payment_hash(const struct LDKInvoice *NONNULL_PTR this_arg))[32];
19862
19863 /**
19864  * Get the payee's public key if one was included in the invoice
19865  *
19866  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
19867  */
19868 MUST_USE_RES struct LDKPublicKey Invoice_payee_pub_key(const struct LDKInvoice *NONNULL_PTR this_arg);
19869
19870 /**
19871  * Get the payment secret if one was included in the invoice
19872  *
19873  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
19874  */
19875 MUST_USE_RES struct LDKThirtyTwoBytes Invoice_payment_secret(const struct LDKInvoice *NONNULL_PTR this_arg);
19876
19877 /**
19878  * Get the invoice features if they were included in the invoice
19879  *
19880  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
19881  */
19882 MUST_USE_RES struct LDKInvoiceFeatures Invoice_features(const struct LDKInvoice *NONNULL_PTR this_arg);
19883
19884 /**
19885  * Recover the payee's public key (only to be used if none was included in the invoice)
19886  */
19887 MUST_USE_RES struct LDKPublicKey Invoice_recover_payee_pub_key(const struct LDKInvoice *NONNULL_PTR this_arg);
19888
19889 /**
19890  * Returns the invoice's expiry time, if present, otherwise [`DEFAULT_EXPIRY_TIME`].
19891  */
19892 MUST_USE_RES uint64_t Invoice_expiry_time(const struct LDKInvoice *NONNULL_PTR this_arg);
19893
19894 /**
19895  * Returns the invoice's `min_final_cltv_expiry` time, if present, otherwise
19896  * [`DEFAULT_MIN_FINAL_CLTV_EXPIRY`].
19897  */
19898 MUST_USE_RES uint64_t Invoice_min_final_cltv_expiry(const struct LDKInvoice *NONNULL_PTR this_arg);
19899
19900 /**
19901  * Returns a list of all routes included in the invoice
19902  */
19903 MUST_USE_RES struct LDKCVec_PrivateRouteZ Invoice_private_routes(const struct LDKInvoice *NONNULL_PTR this_arg);
19904
19905 /**
19906  * Returns a list of all routes included in the invoice as the underlying hints
19907  */
19908 MUST_USE_RES struct LDKCVec_RouteHintZ Invoice_route_hints(const struct LDKInvoice *NONNULL_PTR this_arg);
19909
19910 /**
19911  * Returns the currency for which the invoice was issued
19912  */
19913 MUST_USE_RES enum LDKCurrency Invoice_currency(const struct LDKInvoice *NONNULL_PTR this_arg);
19914
19915 /**
19916  * Returns the amount if specified in the invoice as pico <currency>.
19917  */
19918 MUST_USE_RES struct LDKCOption_u64Z Invoice_amount_pico_btc(const struct LDKInvoice *NONNULL_PTR this_arg);
19919
19920 /**
19921  * Creates a new `Description` if `description` is at most 1023 __bytes__ long,
19922  * returns `CreationError::DescriptionTooLong` otherwise
19923  *
19924  * Please note that single characters may use more than one byte due to UTF8 encoding.
19925  */
19926 MUST_USE_RES struct LDKCResult_DescriptionCreationErrorZ Description_new(struct LDKStr description);
19927
19928 /**
19929  * Returns the underlying description `String`
19930  */
19931 MUST_USE_RES struct LDKStr Description_into_inner(struct LDKDescription this_arg);
19932
19933 /**
19934  * Construct an `ExpiryTime` from seconds. If there exists a `PositiveTimestamp` which would
19935  * overflow on adding the `EpiryTime` to it then this function will return a
19936  * `CreationError::ExpiryTimeOutOfBounds`.
19937  */
19938 MUST_USE_RES struct LDKCResult_ExpiryTimeCreationErrorZ ExpiryTime_from_seconds(uint64_t seconds);
19939
19940 /**
19941  * Construct an `ExpiryTime` from a `Duration`. If there exists a `PositiveTimestamp` which
19942  * would overflow on adding the `EpiryTime` to it then this function will return a
19943  * `CreationError::ExpiryTimeOutOfBounds`.
19944  */
19945 MUST_USE_RES struct LDKCResult_ExpiryTimeCreationErrorZ ExpiryTime_from_duration(uint64_t duration);
19946
19947 /**
19948  * Returns the expiry time in seconds
19949  */
19950 MUST_USE_RES uint64_t ExpiryTime_as_seconds(const struct LDKExpiryTime *NONNULL_PTR this_arg);
19951
19952 /**
19953  * Returns a reference to the underlying `Duration` (=expiry time)
19954  */
19955 MUST_USE_RES uint64_t ExpiryTime_as_duration(const struct LDKExpiryTime *NONNULL_PTR this_arg);
19956
19957 /**
19958  * Creates a new (partial) route from a list of hops
19959  */
19960 MUST_USE_RES struct LDKCResult_PrivateRouteCreationErrorZ PrivateRoute_new(struct LDKRouteHint hops);
19961
19962 /**
19963  * Returns the underlying list of hops
19964  */
19965 MUST_USE_RES struct LDKRouteHint PrivateRoute_into_inner(struct LDKPrivateRoute this_arg);
19966
19967 /**
19968  * Creates a copy of the CreationError
19969  */
19970 enum LDKCreationError CreationError_clone(const enum LDKCreationError *NONNULL_PTR orig);
19971
19972 /**
19973  * Utility method to constructs a new DescriptionTooLong-variant CreationError
19974  */
19975 enum LDKCreationError CreationError_description_too_long(void);
19976
19977 /**
19978  * Utility method to constructs a new RouteTooLong-variant CreationError
19979  */
19980 enum LDKCreationError CreationError_route_too_long(void);
19981
19982 /**
19983  * Utility method to constructs a new TimestampOutOfBounds-variant CreationError
19984  */
19985 enum LDKCreationError CreationError_timestamp_out_of_bounds(void);
19986
19987 /**
19988  * Utility method to constructs a new ExpiryTimeOutOfBounds-variant CreationError
19989  */
19990 enum LDKCreationError CreationError_expiry_time_out_of_bounds(void);
19991
19992 /**
19993  * Checks if two CreationErrors contain equal inner contents.
19994  * This ignores pointers and is_owned flags and looks at the values in fields.
19995  */
19996 bool CreationError_eq(const enum LDKCreationError *NONNULL_PTR a, const enum LDKCreationError *NONNULL_PTR b);
19997
19998 /**
19999  * Get the string representation of a CreationError object
20000  */
20001 struct LDKStr CreationError_to_str(const enum LDKCreationError *NONNULL_PTR o);
20002
20003 /**
20004  * Creates a copy of the SemanticError
20005  */
20006 enum LDKSemanticError SemanticError_clone(const enum LDKSemanticError *NONNULL_PTR orig);
20007
20008 /**
20009  * Utility method to constructs a new NoPaymentHash-variant SemanticError
20010  */
20011 enum LDKSemanticError SemanticError_no_payment_hash(void);
20012
20013 /**
20014  * Utility method to constructs a new MultiplePaymentHashes-variant SemanticError
20015  */
20016 enum LDKSemanticError SemanticError_multiple_payment_hashes(void);
20017
20018 /**
20019  * Utility method to constructs a new NoDescription-variant SemanticError
20020  */
20021 enum LDKSemanticError SemanticError_no_description(void);
20022
20023 /**
20024  * Utility method to constructs a new MultipleDescriptions-variant SemanticError
20025  */
20026 enum LDKSemanticError SemanticError_multiple_descriptions(void);
20027
20028 /**
20029  * Utility method to constructs a new MultiplePaymentSecrets-variant SemanticError
20030  */
20031 enum LDKSemanticError SemanticError_multiple_payment_secrets(void);
20032
20033 /**
20034  * Utility method to constructs a new InvalidFeatures-variant SemanticError
20035  */
20036 enum LDKSemanticError SemanticError_invalid_features(void);
20037
20038 /**
20039  * Utility method to constructs a new InvalidRecoveryId-variant SemanticError
20040  */
20041 enum LDKSemanticError SemanticError_invalid_recovery_id(void);
20042
20043 /**
20044  * Utility method to constructs a new InvalidSignature-variant SemanticError
20045  */
20046 enum LDKSemanticError SemanticError_invalid_signature(void);
20047
20048 /**
20049  * Checks if two SemanticErrors contain equal inner contents.
20050  * This ignores pointers and is_owned flags and looks at the values in fields.
20051  */
20052 bool SemanticError_eq(const enum LDKSemanticError *NONNULL_PTR a, const enum LDKSemanticError *NONNULL_PTR b);
20053
20054 /**
20055  * Get the string representation of a SemanticError object
20056  */
20057 struct LDKStr SemanticError_to_str(const enum LDKSemanticError *NONNULL_PTR o);
20058
20059 /**
20060  * Frees any resources used by the SignOrCreationError
20061  */
20062 void SignOrCreationError_free(struct LDKSignOrCreationError this_ptr);
20063
20064 /**
20065  * Creates a copy of the SignOrCreationError
20066  */
20067 struct LDKSignOrCreationError SignOrCreationError_clone(const struct LDKSignOrCreationError *NONNULL_PTR orig);
20068
20069 /**
20070  * Utility method to constructs a new SignError-variant SignOrCreationError
20071  */
20072 struct LDKSignOrCreationError SignOrCreationError_sign_error(void);
20073
20074 /**
20075  * Utility method to constructs a new CreationError-variant SignOrCreationError
20076  */
20077 struct LDKSignOrCreationError SignOrCreationError_creation_error(enum LDKCreationError a);
20078
20079 /**
20080  * Checks if two SignOrCreationErrors contain equal inner contents.
20081  * This ignores pointers and is_owned flags and looks at the values in fields.
20082  */
20083 bool SignOrCreationError_eq(const struct LDKSignOrCreationError *NONNULL_PTR a, const struct LDKSignOrCreationError *NONNULL_PTR b);
20084
20085 /**
20086  * Get the string representation of a SignOrCreationError object
20087  */
20088 struct LDKStr SignOrCreationError_to_str(const struct LDKSignOrCreationError *NONNULL_PTR o);
20089
20090 /**
20091  * Utility to construct an invoice. Generally, unless you want to do something like a custom
20092  * cltv_expiry, this is what you should be using to create an invoice. The reason being, this
20093  * method stores the invoice's payment secret and preimage in `ChannelManager`, so (a) the user
20094  * doesn't have to store preimage/payment secret information and (b) `ChannelManager` can verify
20095  * that the payment secret is valid when the invoice is paid.
20096  */
20097 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);
20098
20099 /**
20100  * Read a SiPrefix object from a string
20101  */
20102 struct LDKCResult_SiPrefixNoneZ SiPrefix_from_str(struct LDKStr s);
20103
20104 /**
20105  * Read a Invoice object from a string
20106  */
20107 struct LDKCResult_InvoiceNoneZ Invoice_from_str(struct LDKStr s);
20108
20109 /**
20110  * Read a SignedRawInvoice object from a string
20111  */
20112 struct LDKCResult_SignedRawInvoiceNoneZ SignedRawInvoice_from_str(struct LDKStr s);
20113
20114 /**
20115  * Get the string representation of a Invoice object
20116  */
20117 struct LDKStr Invoice_to_str(const struct LDKInvoice *NONNULL_PTR o);
20118
20119 /**
20120  * Get the string representation of a SignedRawInvoice object
20121  */
20122 struct LDKStr SignedRawInvoice_to_str(const struct LDKSignedRawInvoice *NONNULL_PTR o);
20123
20124 /**
20125  * Get the string representation of a Currency object
20126  */
20127 struct LDKStr Currency_to_str(const enum LDKCurrency *NONNULL_PTR o);
20128
20129 /**
20130  * Get the string representation of a SiPrefix object
20131  */
20132 struct LDKStr SiPrefix_to_str(const enum LDKSiPrefix *NONNULL_PTR o);
20133
20134 #endif /* LDK_C_BINDINGS_H */
20135
20136 #include "ldk_ver.h"