Update auto-generated bindings
[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  * The contents of CResult_NoneErrorZ
1189  */
1190 typedef union LDKCResult_NoneErrorZPtr {
1191    /**
1192     * Note that this value is always NULL, as there are no contents in the OK variant
1193     */
1194    void *result;
1195    /**
1196     * A pointer to the contents in the error state.
1197     * Reading from this pointer when `result_ok` is set is undefined.
1198     */
1199    enum LDKIOError *err;
1200 } LDKCResult_NoneErrorZPtr;
1201
1202 /**
1203  * A CResult_NoneErrorZ represents the result of a fallible operation,
1204  * containing a () on success and a crate::c_types::IOError on failure.
1205  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1206  */
1207 typedef struct LDKCResult_NoneErrorZ {
1208    /**
1209     * The contents of this CResult_NoneErrorZ, accessible via either
1210     * `err` or `result` depending on the state of `result_ok`.
1211     */
1212    union LDKCResult_NoneErrorZPtr contents;
1213    /**
1214     * Whether this CResult_NoneErrorZ represents a success state.
1215     */
1216    bool result_ok;
1217 } LDKCResult_NoneErrorZ;
1218
1219
1220
1221 /**
1222  * A hop in a route
1223  */
1224 typedef struct MUST_USE_STRUCT LDKRouteHop {
1225    /**
1226     * A pointer to the opaque Rust object.
1227     * Nearly everywhere, inner must be non-null, however in places where
1228     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1229     */
1230    LDKnativeRouteHop *inner;
1231    /**
1232     * Indicates that this is the only struct which contains the same pointer.
1233     * Rust functions which take ownership of an object provided via an argument require
1234     * this to be true and invalidate the object pointed to by inner.
1235     */
1236    bool is_owned;
1237 } LDKRouteHop;
1238
1239 /**
1240  * The contents of CResult_RouteHopDecodeErrorZ
1241  */
1242 typedef union LDKCResult_RouteHopDecodeErrorZPtr {
1243    /**
1244     * A pointer to the contents in the success state.
1245     * Reading from this pointer when `result_ok` is not set is undefined.
1246     */
1247    struct LDKRouteHop *result;
1248    /**
1249     * A pointer to the contents in the error state.
1250     * Reading from this pointer when `result_ok` is set is undefined.
1251     */
1252    struct LDKDecodeError *err;
1253 } LDKCResult_RouteHopDecodeErrorZPtr;
1254
1255 /**
1256  * A CResult_RouteHopDecodeErrorZ represents the result of a fallible operation,
1257  * containing a crate::lightning::routing::router::RouteHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
1258  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1259  */
1260 typedef struct LDKCResult_RouteHopDecodeErrorZ {
1261    /**
1262     * The contents of this CResult_RouteHopDecodeErrorZ, accessible via either
1263     * `err` or `result` depending on the state of `result_ok`.
1264     */
1265    union LDKCResult_RouteHopDecodeErrorZPtr contents;
1266    /**
1267     * Whether this CResult_RouteHopDecodeErrorZ represents a success state.
1268     */
1269    bool result_ok;
1270 } LDKCResult_RouteHopDecodeErrorZ;
1271
1272 /**
1273  * A dynamically-allocated array of crate::lightning::routing::router::RouteHops of arbitrary size.
1274  * This corresponds to std::vector in C++
1275  */
1276 typedef struct LDKCVec_RouteHopZ {
1277    /**
1278     * The elements in the array.
1279     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1280     */
1281    struct LDKRouteHop *data;
1282    /**
1283     * The number of elements pointed to by `data`.
1284     */
1285    uintptr_t datalen;
1286 } LDKCVec_RouteHopZ;
1287
1288 /**
1289  * A dynamically-allocated array of crate::c_types::derived::CVec_RouteHopZs of arbitrary size.
1290  * This corresponds to std::vector in C++
1291  */
1292 typedef struct LDKCVec_CVec_RouteHopZZ {
1293    /**
1294     * The elements in the array.
1295     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1296     */
1297    struct LDKCVec_RouteHopZ *data;
1298    /**
1299     * The number of elements pointed to by `data`.
1300     */
1301    uintptr_t datalen;
1302 } LDKCVec_CVec_RouteHopZZ;
1303
1304
1305
1306 /**
1307  * A route directs a payment from the sender (us) to the recipient. If the recipient supports MPP,
1308  * it can take multiple paths. Each path is composed of one or more hops through the network.
1309  */
1310 typedef struct MUST_USE_STRUCT LDKRoute {
1311    /**
1312     * A pointer to the opaque Rust object.
1313     * Nearly everywhere, inner must be non-null, however in places where
1314     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1315     */
1316    LDKnativeRoute *inner;
1317    /**
1318     * Indicates that this is the only struct which contains the same pointer.
1319     * Rust functions which take ownership of an object provided via an argument require
1320     * this to be true and invalidate the object pointed to by inner.
1321     */
1322    bool is_owned;
1323 } LDKRoute;
1324
1325 /**
1326  * The contents of CResult_RouteDecodeErrorZ
1327  */
1328 typedef union LDKCResult_RouteDecodeErrorZPtr {
1329    /**
1330     * A pointer to the contents in the success state.
1331     * Reading from this pointer when `result_ok` is not set is undefined.
1332     */
1333    struct LDKRoute *result;
1334    /**
1335     * A pointer to the contents in the error state.
1336     * Reading from this pointer when `result_ok` is set is undefined.
1337     */
1338    struct LDKDecodeError *err;
1339 } LDKCResult_RouteDecodeErrorZPtr;
1340
1341 /**
1342  * A CResult_RouteDecodeErrorZ represents the result of a fallible operation,
1343  * containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::DecodeError on failure.
1344  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1345  */
1346 typedef struct LDKCResult_RouteDecodeErrorZ {
1347    /**
1348     * The contents of this CResult_RouteDecodeErrorZ, accessible via either
1349     * `err` or `result` depending on the state of `result_ok`.
1350     */
1351    union LDKCResult_RouteDecodeErrorZPtr contents;
1352    /**
1353     * Whether this CResult_RouteDecodeErrorZ represents a success state.
1354     */
1355    bool result_ok;
1356 } LDKCResult_RouteDecodeErrorZ;
1357
1358 /**
1359  * An enum which can either contain a u64 or not
1360  */
1361 typedef enum LDKCOption_u64Z_Tag {
1362    /**
1363     * When we're in this state, this COption_u64Z contains a u64
1364     */
1365    LDKCOption_u64Z_Some,
1366    /**
1367     * When we're in this state, this COption_u64Z contains nothing
1368     */
1369    LDKCOption_u64Z_None,
1370    /**
1371     * Must be last for serialization purposes
1372     */
1373    LDKCOption_u64Z_Sentinel,
1374 } LDKCOption_u64Z_Tag;
1375
1376 typedef struct LDKCOption_u64Z {
1377    LDKCOption_u64Z_Tag tag;
1378    union {
1379       struct {
1380          uint64_t some;
1381       };
1382    };
1383 } LDKCOption_u64Z;
1384
1385
1386
1387 /**
1388  * Details of a channel, as returned by ChannelManager::list_channels and ChannelManager::list_usable_channels
1389  */
1390 typedef struct MUST_USE_STRUCT LDKChannelDetails {
1391    /**
1392     * A pointer to the opaque Rust object.
1393     * Nearly everywhere, inner must be non-null, however in places where
1394     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1395     */
1396    LDKnativeChannelDetails *inner;
1397    /**
1398     * Indicates that this is the only struct which contains the same pointer.
1399     * Rust functions which take ownership of an object provided via an argument require
1400     * this to be true and invalidate the object pointed to by inner.
1401     */
1402    bool is_owned;
1403 } LDKChannelDetails;
1404
1405 /**
1406  * A dynamically-allocated array of crate::lightning::ln::channelmanager::ChannelDetailss of arbitrary size.
1407  * This corresponds to std::vector in C++
1408  */
1409 typedef struct LDKCVec_ChannelDetailsZ {
1410    /**
1411     * The elements in the array.
1412     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1413     */
1414    struct LDKChannelDetails *data;
1415    /**
1416     * The number of elements pointed to by `data`.
1417     */
1418    uintptr_t datalen;
1419 } LDKCVec_ChannelDetailsZ;
1420
1421
1422
1423 /**
1424  * A list of hops along a payment path terminating with a channel to the recipient.
1425  */
1426 typedef struct MUST_USE_STRUCT LDKRouteHint {
1427    /**
1428     * A pointer to the opaque Rust object.
1429     * Nearly everywhere, inner must be non-null, however in places where
1430     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1431     */
1432    LDKnativeRouteHint *inner;
1433    /**
1434     * Indicates that this is the only struct which contains the same pointer.
1435     * Rust functions which take ownership of an object provided via an argument require
1436     * this to be true and invalidate the object pointed to by inner.
1437     */
1438    bool is_owned;
1439 } LDKRouteHint;
1440
1441 /**
1442  * A dynamically-allocated array of crate::lightning::routing::router::RouteHints of arbitrary size.
1443  * This corresponds to std::vector in C++
1444  */
1445 typedef struct LDKCVec_RouteHintZ {
1446    /**
1447     * The elements in the array.
1448     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1449     */
1450    struct LDKRouteHint *data;
1451    /**
1452     * The number of elements pointed to by `data`.
1453     */
1454    uintptr_t datalen;
1455 } LDKCVec_RouteHintZ;
1456
1457
1458
1459 /**
1460  * An Err type for failure to process messages.
1461  */
1462 typedef struct MUST_USE_STRUCT LDKLightningError {
1463    /**
1464     * A pointer to the opaque Rust object.
1465     * Nearly everywhere, inner must be non-null, however in places where
1466     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1467     */
1468    LDKnativeLightningError *inner;
1469    /**
1470     * Indicates that this is the only struct which contains the same pointer.
1471     * Rust functions which take ownership of an object provided via an argument require
1472     * this to be true and invalidate the object pointed to by inner.
1473     */
1474    bool is_owned;
1475 } LDKLightningError;
1476
1477 /**
1478  * The contents of CResult_RouteLightningErrorZ
1479  */
1480 typedef union LDKCResult_RouteLightningErrorZPtr {
1481    /**
1482     * A pointer to the contents in the success state.
1483     * Reading from this pointer when `result_ok` is not set is undefined.
1484     */
1485    struct LDKRoute *result;
1486    /**
1487     * A pointer to the contents in the error state.
1488     * Reading from this pointer when `result_ok` is set is undefined.
1489     */
1490    struct LDKLightningError *err;
1491 } LDKCResult_RouteLightningErrorZPtr;
1492
1493 /**
1494  * A CResult_RouteLightningErrorZ represents the result of a fallible operation,
1495  * containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::LightningError on failure.
1496  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1497  */
1498 typedef struct LDKCResult_RouteLightningErrorZ {
1499    /**
1500     * The contents of this CResult_RouteLightningErrorZ, accessible via either
1501     * `err` or `result` depending on the state of `result_ok`.
1502     */
1503    union LDKCResult_RouteLightningErrorZPtr contents;
1504    /**
1505     * Whether this CResult_RouteLightningErrorZ represents a success state.
1506     */
1507    bool result_ok;
1508 } LDKCResult_RouteLightningErrorZ;
1509
1510 /**
1511  * The contents of CResult_TxOutAccessErrorZ
1512  */
1513 typedef union LDKCResult_TxOutAccessErrorZPtr {
1514    /**
1515     * A pointer to the contents in the success state.
1516     * Reading from this pointer when `result_ok` is not set is undefined.
1517     */
1518    struct LDKTxOut *result;
1519    /**
1520     * A pointer to the contents in the error state.
1521     * Reading from this pointer when `result_ok` is set is undefined.
1522     */
1523    enum LDKAccessError *err;
1524 } LDKCResult_TxOutAccessErrorZPtr;
1525
1526 /**
1527  * A CResult_TxOutAccessErrorZ represents the result of a fallible operation,
1528  * containing a crate::c_types::TxOut on success and a crate::lightning::chain::AccessError on failure.
1529  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1530  */
1531 typedef struct LDKCResult_TxOutAccessErrorZ {
1532    /**
1533     * The contents of this CResult_TxOutAccessErrorZ, accessible via either
1534     * `err` or `result` depending on the state of `result_ok`.
1535     */
1536    union LDKCResult_TxOutAccessErrorZPtr contents;
1537    /**
1538     * Whether this CResult_TxOutAccessErrorZ represents a success state.
1539     */
1540    bool result_ok;
1541 } LDKCResult_TxOutAccessErrorZ;
1542
1543 /**
1544  * A tuple of 2 elements. See the individual fields for the types contained.
1545  */
1546 typedef struct LDKC2Tuple_usizeTransactionZ {
1547    /**
1548     * The element at position 0
1549     */
1550    uintptr_t a;
1551    /**
1552     * The element at position 1
1553     */
1554    struct LDKTransaction b;
1555 } LDKC2Tuple_usizeTransactionZ;
1556
1557 /**
1558  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_usizeTransactionZs of arbitrary size.
1559  * This corresponds to std::vector in C++
1560  */
1561 typedef struct LDKCVec_C2Tuple_usizeTransactionZZ {
1562    /**
1563     * The elements in the array.
1564     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1565     */
1566    struct LDKC2Tuple_usizeTransactionZ *data;
1567    /**
1568     * The number of elements pointed to by `data`.
1569     */
1570    uintptr_t datalen;
1571 } LDKCVec_C2Tuple_usizeTransactionZZ;
1572
1573 /**
1574  * Arbitrary 32 bytes, which could represent one of a few different things. You probably want to
1575  * look up the corresponding function in rust-lightning's docs.
1576  */
1577 typedef struct LDKThirtyTwoBytes {
1578    /**
1579     * The thirty-two bytes
1580     */
1581    uint8_t data[32];
1582 } LDKThirtyTwoBytes;
1583
1584 /**
1585  * A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
1586  * This corresponds to std::vector in C++
1587  */
1588 typedef struct LDKCVec_TxidZ {
1589    /**
1590     * The elements in the array.
1591     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1592     */
1593    struct LDKThirtyTwoBytes *data;
1594    /**
1595     * The number of elements pointed to by `data`.
1596     */
1597    uintptr_t datalen;
1598 } LDKCVec_TxidZ;
1599
1600 /**
1601  * The contents of CResult_NoneChannelMonitorUpdateErrZ
1602  */
1603 typedef union LDKCResult_NoneChannelMonitorUpdateErrZPtr {
1604    /**
1605     * Note that this value is always NULL, as there are no contents in the OK variant
1606     */
1607    void *result;
1608    /**
1609     * A pointer to the contents in the error state.
1610     * Reading from this pointer when `result_ok` is set is undefined.
1611     */
1612    enum LDKChannelMonitorUpdateErr *err;
1613 } LDKCResult_NoneChannelMonitorUpdateErrZPtr;
1614
1615 /**
1616  * A CResult_NoneChannelMonitorUpdateErrZ represents the result of a fallible operation,
1617  * containing a () on success and a crate::lightning::chain::channelmonitor::ChannelMonitorUpdateErr on failure.
1618  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1619  */
1620 typedef struct LDKCResult_NoneChannelMonitorUpdateErrZ {
1621    /**
1622     * The contents of this CResult_NoneChannelMonitorUpdateErrZ, accessible via either
1623     * `err` or `result` depending on the state of `result_ok`.
1624     */
1625    union LDKCResult_NoneChannelMonitorUpdateErrZPtr contents;
1626    /**
1627     * Whether this CResult_NoneChannelMonitorUpdateErrZ represents a success state.
1628     */
1629    bool result_ok;
1630 } LDKCResult_NoneChannelMonitorUpdateErrZ;
1631
1632
1633
1634 /**
1635  * Simple structure sent back by `chain::Watch` when an HTLC from a forward channel is detected on
1636  * chain. Used to update the corresponding HTLC in the backward channel. Failing to pass the
1637  * preimage claim backward will lead to loss of funds.
1638  */
1639 typedef struct MUST_USE_STRUCT LDKHTLCUpdate {
1640    /**
1641     * A pointer to the opaque Rust object.
1642     * Nearly everywhere, inner must be non-null, however in places where
1643     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1644     */
1645    LDKnativeHTLCUpdate *inner;
1646    /**
1647     * Indicates that this is the only struct which contains the same pointer.
1648     * Rust functions which take ownership of an object provided via an argument require
1649     * this to be true and invalidate the object pointed to by inner.
1650     */
1651    bool is_owned;
1652 } LDKHTLCUpdate;
1653
1654
1655
1656 /**
1657  * A reference to a transaction output.
1658  *
1659  * Differs from bitcoin::blockdata::transaction::OutPoint as the index is a u16 instead of u32
1660  * due to LN's restrictions on index values. Should reduce (possibly) unsafe conversions this way.
1661  */
1662 typedef struct MUST_USE_STRUCT LDKOutPoint {
1663    /**
1664     * A pointer to the opaque Rust object.
1665     * Nearly everywhere, inner must be non-null, however in places where
1666     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1667     */
1668    LDKnativeOutPoint *inner;
1669    /**
1670     * Indicates that this is the only struct which contains the same pointer.
1671     * Rust functions which take ownership of an object provided via an argument require
1672     * this to be true and invalidate the object pointed to by inner.
1673     */
1674    bool is_owned;
1675 } LDKOutPoint;
1676
1677 /**
1678  * An event to be processed by the ChannelManager.
1679  */
1680 typedef enum LDKMonitorEvent_Tag {
1681    /**
1682     * A monitor event containing an HTLCUpdate.
1683     */
1684    LDKMonitorEvent_HTLCEvent,
1685    /**
1686     * A monitor event that the Channel's commitment transaction was broadcasted.
1687     */
1688    LDKMonitorEvent_CommitmentTxBroadcasted,
1689    /**
1690     * Must be last for serialization purposes
1691     */
1692    LDKMonitorEvent_Sentinel,
1693 } LDKMonitorEvent_Tag;
1694
1695 typedef struct MUST_USE_STRUCT LDKMonitorEvent {
1696    LDKMonitorEvent_Tag tag;
1697    union {
1698       struct {
1699          struct LDKHTLCUpdate htlc_event;
1700       };
1701       struct {
1702          struct LDKOutPoint commitment_tx_broadcasted;
1703       };
1704    };
1705 } LDKMonitorEvent;
1706
1707 /**
1708  * A dynamically-allocated array of crate::lightning::chain::channelmonitor::MonitorEvents of arbitrary size.
1709  * This corresponds to std::vector in C++
1710  */
1711 typedef struct LDKCVec_MonitorEventZ {
1712    /**
1713     * The elements in the array.
1714     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1715     */
1716    struct LDKMonitorEvent *data;
1717    /**
1718     * The number of elements pointed to by `data`.
1719     */
1720    uintptr_t datalen;
1721 } LDKCVec_MonitorEventZ;
1722
1723 /**
1724  * An enum which can either contain a crate::c_types::derived::C2Tuple_usizeTransactionZ or not
1725  */
1726 typedef enum LDKCOption_C2Tuple_usizeTransactionZZ_Tag {
1727    /**
1728     * When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains a crate::c_types::derived::C2Tuple_usizeTransactionZ
1729     */
1730    LDKCOption_C2Tuple_usizeTransactionZZ_Some,
1731    /**
1732     * When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains nothing
1733     */
1734    LDKCOption_C2Tuple_usizeTransactionZZ_None,
1735    /**
1736     * Must be last for serialization purposes
1737     */
1738    LDKCOption_C2Tuple_usizeTransactionZZ_Sentinel,
1739 } LDKCOption_C2Tuple_usizeTransactionZZ_Tag;
1740
1741 typedef struct LDKCOption_C2Tuple_usizeTransactionZZ {
1742    LDKCOption_C2Tuple_usizeTransactionZZ_Tag tag;
1743    union {
1744       struct {
1745          struct LDKC2Tuple_usizeTransactionZ some;
1746       };
1747    };
1748 } LDKCOption_C2Tuple_usizeTransactionZZ;
1749
1750
1751
1752 /**
1753  * Information about a spendable output to a P2WSH script. See
1754  * SpendableOutputDescriptor::DelayedPaymentOutput for more details on how to spend this.
1755  */
1756 typedef struct MUST_USE_STRUCT LDKDelayedPaymentOutputDescriptor {
1757    /**
1758     * A pointer to the opaque Rust object.
1759     * Nearly everywhere, inner must be non-null, however in places where
1760     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1761     */
1762    LDKnativeDelayedPaymentOutputDescriptor *inner;
1763    /**
1764     * Indicates that this is the only struct which contains the same pointer.
1765     * Rust functions which take ownership of an object provided via an argument require
1766     * this to be true and invalidate the object pointed to by inner.
1767     */
1768    bool is_owned;
1769 } LDKDelayedPaymentOutputDescriptor;
1770
1771
1772
1773 /**
1774  * Information about a spendable output to our \"payment key\". See
1775  * SpendableOutputDescriptor::StaticPaymentOutput for more details on how to spend this.
1776  */
1777 typedef struct MUST_USE_STRUCT LDKStaticPaymentOutputDescriptor {
1778    /**
1779     * A pointer to the opaque Rust object.
1780     * Nearly everywhere, inner must be non-null, however in places where
1781     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1782     */
1783    LDKnativeStaticPaymentOutputDescriptor *inner;
1784    /**
1785     * Indicates that this is the only struct which contains the same pointer.
1786     * Rust functions which take ownership of an object provided via an argument require
1787     * this to be true and invalidate the object pointed to by inner.
1788     */
1789    bool is_owned;
1790 } LDKStaticPaymentOutputDescriptor;
1791
1792 /**
1793  * When on-chain outputs are created by rust-lightning (which our counterparty is not able to
1794  * claim at any point in the future) an event is generated which you must track and be able to
1795  * spend on-chain. The information needed to do this is provided in this enum, including the
1796  * outpoint describing which txid and output index is available, the full output which exists at
1797  * that txid/index, and any keys or other information required to sign.
1798  */
1799 typedef enum LDKSpendableOutputDescriptor_Tag {
1800    /**
1801     * An output to a script which was provided via KeysInterface directly, either from
1802     * `get_destination_script()` or `get_shutdown_pubkey()`, thus you should already know how to
1803     * spend it. No secret keys are provided as rust-lightning was never given any key.
1804     * These may include outputs from a transaction punishing our counterparty or claiming an HTLC
1805     * on-chain using the payment preimage or after it has timed out.
1806     */
1807    LDKSpendableOutputDescriptor_StaticOutput,
1808    /**
1809     * An output to a P2WSH script which can be spent with a single signature after a CSV delay.
1810     *
1811     * The witness in the spending input should be:
1812     * <BIP 143 signature> <empty vector> (MINIMALIF standard rule) <provided witnessScript>
1813     *
1814     * Note that the nSequence field in the spending input must be set to to_self_delay
1815     * (which means the transaction is not broadcastable until at least to_self_delay
1816     * blocks after the outpoint confirms).
1817     *
1818     * These are generally the result of a \"revocable\" output to us, spendable only by us unless
1819     * it is an output from an old state which we broadcast (which should never happen).
1820     *
1821     * To derive the delayed_payment key which is used to sign for this input, you must pass the
1822     * holder delayed_payment_base_key (ie the private key which corresponds to the pubkey in
1823     * Sign::pubkeys().delayed_payment_basepoint) and the provided per_commitment_point to
1824     * chan_utils::derive_private_key. The public key can be generated without the secret key
1825     * using chan_utils::derive_public_key and only the delayed_payment_basepoint which appears in
1826     * Sign::pubkeys().
1827     *
1828     * To derive the revocation_pubkey provided here (which is used in the witness
1829     * script generation), you must pass the counterparty revocation_basepoint (which appears in the
1830     * call to Sign::ready_channel) and the provided per_commitment point
1831     * to chan_utils::derive_public_revocation_key.
1832     *
1833     * The witness script which is hashed and included in the output script_pubkey may be
1834     * regenerated by passing the revocation_pubkey (derived as above), our delayed_payment pubkey
1835     * (derived as above), and the to_self_delay contained here to
1836     * chan_utils::get_revokeable_redeemscript.
1837     */
1838    LDKSpendableOutputDescriptor_DelayedPaymentOutput,
1839    /**
1840     * An output to a P2WPKH, spendable exclusively by our payment key (ie the private key which
1841     * corresponds to the public key in Sign::pubkeys().payment_point).
1842     * The witness in the spending input, is, thus, simply:
1843     * <BIP 143 signature> <payment key>
1844     *
1845     * These are generally the result of our counterparty having broadcast the current state,
1846     * allowing us to claim the non-HTLC-encumbered outputs immediately.
1847     */
1848    LDKSpendableOutputDescriptor_StaticPaymentOutput,
1849    /**
1850     * Must be last for serialization purposes
1851     */
1852    LDKSpendableOutputDescriptor_Sentinel,
1853 } LDKSpendableOutputDescriptor_Tag;
1854
1855 typedef struct LDKSpendableOutputDescriptor_LDKStaticOutput_Body {
1856    /**
1857     * The outpoint which is spendable
1858     */
1859    struct LDKOutPoint outpoint;
1860    /**
1861     * The output which is referenced by the given outpoint.
1862     */
1863    struct LDKTxOut output;
1864 } LDKSpendableOutputDescriptor_LDKStaticOutput_Body;
1865
1866 typedef struct MUST_USE_STRUCT LDKSpendableOutputDescriptor {
1867    LDKSpendableOutputDescriptor_Tag tag;
1868    union {
1869       LDKSpendableOutputDescriptor_LDKStaticOutput_Body static_output;
1870       struct {
1871          struct LDKDelayedPaymentOutputDescriptor delayed_payment_output;
1872       };
1873       struct {
1874          struct LDKStaticPaymentOutputDescriptor static_payment_output;
1875       };
1876    };
1877 } LDKSpendableOutputDescriptor;
1878
1879 /**
1880  * A dynamically-allocated array of crate::lightning::chain::keysinterface::SpendableOutputDescriptors of arbitrary size.
1881  * This corresponds to std::vector in C++
1882  */
1883 typedef struct LDKCVec_SpendableOutputDescriptorZ {
1884    /**
1885     * The elements in the array.
1886     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1887     */
1888    struct LDKSpendableOutputDescriptor *data;
1889    /**
1890     * The number of elements pointed to by `data`.
1891     */
1892    uintptr_t datalen;
1893 } LDKCVec_SpendableOutputDescriptorZ;
1894
1895
1896
1897 /**
1898  * An accept_channel message to be sent or received from a peer
1899  */
1900 typedef struct MUST_USE_STRUCT LDKAcceptChannel {
1901    /**
1902     * A pointer to the opaque Rust object.
1903     * Nearly everywhere, inner must be non-null, however in places where
1904     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1905     */
1906    LDKnativeAcceptChannel *inner;
1907    /**
1908     * Indicates that this is the only struct which contains the same pointer.
1909     * Rust functions which take ownership of an object provided via an argument require
1910     * this to be true and invalidate the object pointed to by inner.
1911     */
1912    bool is_owned;
1913 } LDKAcceptChannel;
1914
1915
1916
1917 /**
1918  * An open_channel message to be sent or received from a peer
1919  */
1920 typedef struct MUST_USE_STRUCT LDKOpenChannel {
1921    /**
1922     * A pointer to the opaque Rust object.
1923     * Nearly everywhere, inner must be non-null, however in places where
1924     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1925     */
1926    LDKnativeOpenChannel *inner;
1927    /**
1928     * Indicates that this is the only struct which contains the same pointer.
1929     * Rust functions which take ownership of an object provided via an argument require
1930     * this to be true and invalidate the object pointed to by inner.
1931     */
1932    bool is_owned;
1933 } LDKOpenChannel;
1934
1935
1936
1937 /**
1938  * A funding_created message to be sent or received from a peer
1939  */
1940 typedef struct MUST_USE_STRUCT LDKFundingCreated {
1941    /**
1942     * A pointer to the opaque Rust object.
1943     * Nearly everywhere, inner must be non-null, however in places where
1944     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1945     */
1946    LDKnativeFundingCreated *inner;
1947    /**
1948     * Indicates that this is the only struct which contains the same pointer.
1949     * Rust functions which take ownership of an object provided via an argument require
1950     * this to be true and invalidate the object pointed to by inner.
1951     */
1952    bool is_owned;
1953 } LDKFundingCreated;
1954
1955
1956
1957 /**
1958  * A funding_signed message to be sent or received from a peer
1959  */
1960 typedef struct MUST_USE_STRUCT LDKFundingSigned {
1961    /**
1962     * A pointer to the opaque Rust object.
1963     * Nearly everywhere, inner must be non-null, however in places where
1964     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1965     */
1966    LDKnativeFundingSigned *inner;
1967    /**
1968     * Indicates that this is the only struct which contains the same pointer.
1969     * Rust functions which take ownership of an object provided via an argument require
1970     * this to be true and invalidate the object pointed to by inner.
1971     */
1972    bool is_owned;
1973 } LDKFundingSigned;
1974
1975
1976
1977 /**
1978  * A funding_locked message to be sent or received from a peer
1979  */
1980 typedef struct MUST_USE_STRUCT LDKFundingLocked {
1981    /**
1982     * A pointer to the opaque Rust object.
1983     * Nearly everywhere, inner must be non-null, however in places where
1984     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1985     */
1986    LDKnativeFundingLocked *inner;
1987    /**
1988     * Indicates that this is the only struct which contains the same pointer.
1989     * Rust functions which take ownership of an object provided via an argument require
1990     * this to be true and invalidate the object pointed to by inner.
1991     */
1992    bool is_owned;
1993 } LDKFundingLocked;
1994
1995
1996
1997 /**
1998  * An announcement_signatures message to be sent or received from a peer
1999  */
2000 typedef struct MUST_USE_STRUCT LDKAnnouncementSignatures {
2001    /**
2002     * A pointer to the opaque Rust object.
2003     * Nearly everywhere, inner must be non-null, however in places where
2004     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2005     */
2006    LDKnativeAnnouncementSignatures *inner;
2007    /**
2008     * Indicates that this is the only struct which contains the same pointer.
2009     * Rust functions which take ownership of an object provided via an argument require
2010     * this to be true and invalidate the object pointed to by inner.
2011     */
2012    bool is_owned;
2013 } LDKAnnouncementSignatures;
2014
2015
2016
2017 /**
2018  * Struct used to return values from revoke_and_ack messages, containing a bunch of commitment
2019  * transaction updates if they were pending.
2020  */
2021 typedef struct MUST_USE_STRUCT LDKCommitmentUpdate {
2022    /**
2023     * A pointer to the opaque Rust object.
2024     * Nearly everywhere, inner must be non-null, however in places where
2025     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2026     */
2027    LDKnativeCommitmentUpdate *inner;
2028    /**
2029     * Indicates that this is the only struct which contains the same pointer.
2030     * Rust functions which take ownership of an object provided via an argument require
2031     * this to be true and invalidate the object pointed to by inner.
2032     */
2033    bool is_owned;
2034 } LDKCommitmentUpdate;
2035
2036
2037
2038 /**
2039  * A revoke_and_ack message to be sent or received from a peer
2040  */
2041 typedef struct MUST_USE_STRUCT LDKRevokeAndACK {
2042    /**
2043     * A pointer to the opaque Rust object.
2044     * Nearly everywhere, inner must be non-null, however in places where
2045     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2046     */
2047    LDKnativeRevokeAndACK *inner;
2048    /**
2049     * Indicates that this is the only struct which contains the same pointer.
2050     * Rust functions which take ownership of an object provided via an argument require
2051     * this to be true and invalidate the object pointed to by inner.
2052     */
2053    bool is_owned;
2054 } LDKRevokeAndACK;
2055
2056
2057
2058 /**
2059  * A closing_signed message to be sent or received from a peer
2060  */
2061 typedef struct MUST_USE_STRUCT LDKClosingSigned {
2062    /**
2063     * A pointer to the opaque Rust object.
2064     * Nearly everywhere, inner must be non-null, however in places where
2065     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2066     */
2067    LDKnativeClosingSigned *inner;
2068    /**
2069     * Indicates that this is the only struct which contains the same pointer.
2070     * Rust functions which take ownership of an object provided via an argument require
2071     * this to be true and invalidate the object pointed to by inner.
2072     */
2073    bool is_owned;
2074 } LDKClosingSigned;
2075
2076
2077
2078 /**
2079  * A shutdown message to be sent or received from a peer
2080  */
2081 typedef struct MUST_USE_STRUCT LDKShutdown {
2082    /**
2083     * A pointer to the opaque Rust object.
2084     * Nearly everywhere, inner must be non-null, however in places where
2085     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2086     */
2087    LDKnativeShutdown *inner;
2088    /**
2089     * Indicates that this is the only struct which contains the same pointer.
2090     * Rust functions which take ownership of an object provided via an argument require
2091     * this to be true and invalidate the object pointed to by inner.
2092     */
2093    bool is_owned;
2094 } LDKShutdown;
2095
2096
2097
2098 /**
2099  * A channel_reestablish message to be sent or received from a peer
2100  */
2101 typedef struct MUST_USE_STRUCT LDKChannelReestablish {
2102    /**
2103     * A pointer to the opaque Rust object.
2104     * Nearly everywhere, inner must be non-null, however in places where
2105     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2106     */
2107    LDKnativeChannelReestablish *inner;
2108    /**
2109     * Indicates that this is the only struct which contains the same pointer.
2110     * Rust functions which take ownership of an object provided via an argument require
2111     * this to be true and invalidate the object pointed to by inner.
2112     */
2113    bool is_owned;
2114 } LDKChannelReestablish;
2115
2116
2117
2118 /**
2119  * A channel_announcement message to be sent or received from a peer
2120  */
2121 typedef struct MUST_USE_STRUCT LDKChannelAnnouncement {
2122    /**
2123     * A pointer to the opaque Rust object.
2124     * Nearly everywhere, inner must be non-null, however in places where
2125     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2126     */
2127    LDKnativeChannelAnnouncement *inner;
2128    /**
2129     * Indicates that this is the only struct which contains the same pointer.
2130     * Rust functions which take ownership of an object provided via an argument require
2131     * this to be true and invalidate the object pointed to by inner.
2132     */
2133    bool is_owned;
2134 } LDKChannelAnnouncement;
2135
2136
2137
2138 /**
2139  * A channel_update message to be sent or received from a peer
2140  */
2141 typedef struct MUST_USE_STRUCT LDKChannelUpdate {
2142    /**
2143     * A pointer to the opaque Rust object.
2144     * Nearly everywhere, inner must be non-null, however in places where
2145     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2146     */
2147    LDKnativeChannelUpdate *inner;
2148    /**
2149     * Indicates that this is the only struct which contains the same pointer.
2150     * Rust functions which take ownership of an object provided via an argument require
2151     * this to be true and invalidate the object pointed to by inner.
2152     */
2153    bool is_owned;
2154 } LDKChannelUpdate;
2155
2156
2157
2158 /**
2159  * A node_announcement message to be sent or received from a peer
2160  */
2161 typedef struct MUST_USE_STRUCT LDKNodeAnnouncement {
2162    /**
2163     * A pointer to the opaque Rust object.
2164     * Nearly everywhere, inner must be non-null, however in places where
2165     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2166     */
2167    LDKnativeNodeAnnouncement *inner;
2168    /**
2169     * Indicates that this is the only struct which contains the same pointer.
2170     * Rust functions which take ownership of an object provided via an argument require
2171     * this to be true and invalidate the object pointed to by inner.
2172     */
2173    bool is_owned;
2174 } LDKNodeAnnouncement;
2175
2176
2177
2178 /**
2179  * An error message to be sent or received from a peer
2180  */
2181 typedef struct MUST_USE_STRUCT LDKErrorMessage {
2182    /**
2183     * A pointer to the opaque Rust object.
2184     * Nearly everywhere, inner must be non-null, however in places where
2185     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2186     */
2187    LDKnativeErrorMessage *inner;
2188    /**
2189     * Indicates that this is the only struct which contains the same pointer.
2190     * Rust functions which take ownership of an object provided via an argument require
2191     * this to be true and invalidate the object pointed to by inner.
2192     */
2193    bool is_owned;
2194 } LDKErrorMessage;
2195
2196 /**
2197  * Used to put an error message in a LightningError
2198  */
2199 typedef enum LDKErrorAction_Tag {
2200    /**
2201     * The peer took some action which made us think they were useless. Disconnect them.
2202     */
2203    LDKErrorAction_DisconnectPeer,
2204    /**
2205     * The peer did something harmless that we weren't able to process, just log and ignore
2206     */
2207    LDKErrorAction_IgnoreError,
2208    /**
2209     * The peer did something harmless that we weren't able to meaningfully process.
2210     * If the error is logged, log it at the given level.
2211     */
2212    LDKErrorAction_IgnoreAndLog,
2213    /**
2214     * The peer did something incorrect. Tell them.
2215     */
2216    LDKErrorAction_SendErrorMessage,
2217    /**
2218     * Must be last for serialization purposes
2219     */
2220    LDKErrorAction_Sentinel,
2221 } LDKErrorAction_Tag;
2222
2223 typedef struct LDKErrorAction_LDKDisconnectPeer_Body {
2224    /**
2225     * An error message which we should make an effort to send before we disconnect.
2226     */
2227    struct LDKErrorMessage msg;
2228 } LDKErrorAction_LDKDisconnectPeer_Body;
2229
2230 typedef struct LDKErrorAction_LDKSendErrorMessage_Body {
2231    /**
2232     * The message to send.
2233     */
2234    struct LDKErrorMessage msg;
2235 } LDKErrorAction_LDKSendErrorMessage_Body;
2236
2237 typedef struct MUST_USE_STRUCT LDKErrorAction {
2238    LDKErrorAction_Tag tag;
2239    union {
2240       LDKErrorAction_LDKDisconnectPeer_Body disconnect_peer;
2241       struct {
2242          enum LDKLevel ignore_and_log;
2243       };
2244       LDKErrorAction_LDKSendErrorMessage_Body send_error_message;
2245    };
2246 } LDKErrorAction;
2247
2248 /**
2249  * The information we received from a peer along the route of a payment we originated. This is
2250  * returned by ChannelMessageHandler::handle_update_fail_htlc to be passed into
2251  * RoutingMessageHandler::handle_htlc_fail_channel_update to update our network map.
2252  */
2253 typedef enum LDKHTLCFailChannelUpdate_Tag {
2254    /**
2255     * We received an error which included a full ChannelUpdate message.
2256     */
2257    LDKHTLCFailChannelUpdate_ChannelUpdateMessage,
2258    /**
2259     * We received an error which indicated only that a channel has been closed
2260     */
2261    LDKHTLCFailChannelUpdate_ChannelClosed,
2262    /**
2263     * We received an error which indicated only that a node has failed
2264     */
2265    LDKHTLCFailChannelUpdate_NodeFailure,
2266    /**
2267     * Must be last for serialization purposes
2268     */
2269    LDKHTLCFailChannelUpdate_Sentinel,
2270 } LDKHTLCFailChannelUpdate_Tag;
2271
2272 typedef struct LDKHTLCFailChannelUpdate_LDKChannelUpdateMessage_Body {
2273    /**
2274     * The unwrapped message we received
2275     */
2276    struct LDKChannelUpdate msg;
2277 } LDKHTLCFailChannelUpdate_LDKChannelUpdateMessage_Body;
2278
2279 typedef struct LDKHTLCFailChannelUpdate_LDKChannelClosed_Body {
2280    /**
2281     * The short_channel_id which has now closed.
2282     */
2283    uint64_t short_channel_id;
2284    /**
2285     * when this true, this channel should be permanently removed from the
2286     * consideration. Otherwise, this channel can be restored as new channel_update is received
2287     */
2288    bool is_permanent;
2289 } LDKHTLCFailChannelUpdate_LDKChannelClosed_Body;
2290
2291 typedef struct LDKHTLCFailChannelUpdate_LDKNodeFailure_Body {
2292    /**
2293     * The node_id that has failed.
2294     */
2295    struct LDKPublicKey node_id;
2296    /**
2297     * when this true, node should be permanently removed from the
2298     * consideration. Otherwise, the channels connected to this node can be
2299     * restored as new channel_update is received
2300     */
2301    bool is_permanent;
2302 } LDKHTLCFailChannelUpdate_LDKNodeFailure_Body;
2303
2304 typedef struct MUST_USE_STRUCT LDKHTLCFailChannelUpdate {
2305    LDKHTLCFailChannelUpdate_Tag tag;
2306    union {
2307       LDKHTLCFailChannelUpdate_LDKChannelUpdateMessage_Body channel_update_message;
2308       LDKHTLCFailChannelUpdate_LDKChannelClosed_Body channel_closed;
2309       LDKHTLCFailChannelUpdate_LDKNodeFailure_Body node_failure;
2310    };
2311 } LDKHTLCFailChannelUpdate;
2312
2313
2314
2315 /**
2316  * A query_channel_range message is used to query a peer for channel
2317  * UTXOs in a range of blocks. The recipient of a query makes a best
2318  * effort to reply to the query using one or more reply_channel_range
2319  * messages.
2320  */
2321 typedef struct MUST_USE_STRUCT LDKQueryChannelRange {
2322    /**
2323     * A pointer to the opaque Rust object.
2324     * Nearly everywhere, inner must be non-null, however in places where
2325     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2326     */
2327    LDKnativeQueryChannelRange *inner;
2328    /**
2329     * Indicates that this is the only struct which contains the same pointer.
2330     * Rust functions which take ownership of an object provided via an argument require
2331     * this to be true and invalidate the object pointed to by inner.
2332     */
2333    bool is_owned;
2334 } LDKQueryChannelRange;
2335
2336
2337
2338 /**
2339  * A query_short_channel_ids message is used to query a peer for
2340  * routing gossip messages related to one or more short_channel_ids.
2341  * The query recipient will reply with the latest, if available,
2342  * channel_announcement, channel_update and node_announcement messages
2343  * it maintains for the requested short_channel_ids followed by a
2344  * reply_short_channel_ids_end message. The short_channel_ids sent in
2345  * this query are encoded. We only support encoding_type=0 uncompressed
2346  * serialization and do not support encoding_type=1 zlib serialization.
2347  */
2348 typedef struct MUST_USE_STRUCT LDKQueryShortChannelIds {
2349    /**
2350     * A pointer to the opaque Rust object.
2351     * Nearly everywhere, inner must be non-null, however in places where
2352     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2353     */
2354    LDKnativeQueryShortChannelIds *inner;
2355    /**
2356     * Indicates that this is the only struct which contains the same pointer.
2357     * Rust functions which take ownership of an object provided via an argument require
2358     * this to be true and invalidate the object pointed to by inner.
2359     */
2360    bool is_owned;
2361 } LDKQueryShortChannelIds;
2362
2363
2364
2365 /**
2366  * A reply_channel_range message is a reply to a query_channel_range
2367  * message. Multiple reply_channel_range messages can be sent in reply
2368  * to a single query_channel_range message. The query recipient makes a
2369  * best effort to respond based on their local network view which may
2370  * not be a perfect view of the network. The short_channel_ids in the
2371  * reply are encoded. We only support encoding_type=0 uncompressed
2372  * serialization and do not support encoding_type=1 zlib serialization.
2373  */
2374 typedef struct MUST_USE_STRUCT LDKReplyChannelRange {
2375    /**
2376     * A pointer to the opaque Rust object.
2377     * Nearly everywhere, inner must be non-null, however in places where
2378     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2379     */
2380    LDKnativeReplyChannelRange *inner;
2381    /**
2382     * Indicates that this is the only struct which contains the same pointer.
2383     * Rust functions which take ownership of an object provided via an argument require
2384     * this to be true and invalidate the object pointed to by inner.
2385     */
2386    bool is_owned;
2387 } LDKReplyChannelRange;
2388
2389 /**
2390  * An event generated by ChannelManager which indicates a message should be sent to a peer (or
2391  * broadcast to most peers).
2392  * These events are handled by PeerManager::process_events if you are using a PeerManager.
2393  */
2394 typedef enum LDKMessageSendEvent_Tag {
2395    /**
2396     * Used to indicate that we've accepted a channel open and should send the accept_channel
2397     * message provided to the given peer.
2398     */
2399    LDKMessageSendEvent_SendAcceptChannel,
2400    /**
2401     * Used to indicate that we've initiated a channel open and should send the open_channel
2402     * message provided to the given peer.
2403     */
2404    LDKMessageSendEvent_SendOpenChannel,
2405    /**
2406     * Used to indicate that a funding_created message should be sent to the peer with the given node_id.
2407     */
2408    LDKMessageSendEvent_SendFundingCreated,
2409    /**
2410     * Used to indicate that a funding_signed message should be sent to the peer with the given node_id.
2411     */
2412    LDKMessageSendEvent_SendFundingSigned,
2413    /**
2414     * Used to indicate that a funding_locked message should be sent to the peer with the given node_id.
2415     */
2416    LDKMessageSendEvent_SendFundingLocked,
2417    /**
2418     * Used to indicate that an announcement_signatures message should be sent to the peer with the given node_id.
2419     */
2420    LDKMessageSendEvent_SendAnnouncementSignatures,
2421    /**
2422     * Used to indicate that a series of HTLC update messages, as well as a commitment_signed
2423     * message should be sent to the peer with the given node_id.
2424     */
2425    LDKMessageSendEvent_UpdateHTLCs,
2426    /**
2427     * Used to indicate that a revoke_and_ack message should be sent to the peer with the given node_id.
2428     */
2429    LDKMessageSendEvent_SendRevokeAndACK,
2430    /**
2431     * Used to indicate that a closing_signed message should be sent to the peer with the given node_id.
2432     */
2433    LDKMessageSendEvent_SendClosingSigned,
2434    /**
2435     * Used to indicate that a shutdown message should be sent to the peer with the given node_id.
2436     */
2437    LDKMessageSendEvent_SendShutdown,
2438    /**
2439     * Used to indicate that a channel_reestablish message should be sent to the peer with the given node_id.
2440     */
2441    LDKMessageSendEvent_SendChannelReestablish,
2442    /**
2443     * Used to indicate that a channel_announcement and channel_update should be broadcast to all
2444     * peers (except the peer with node_id either msg.contents.node_id_1 or msg.contents.node_id_2).
2445     *
2446     * Note that after doing so, you very likely (unless you did so very recently) want to call
2447     * ChannelManager::broadcast_node_announcement to trigger a BroadcastNodeAnnouncement event.
2448     * This ensures that any nodes which see our channel_announcement also have a relevant
2449     * node_announcement, including relevant feature flags which may be important for routing
2450     * through or to us.
2451     */
2452    LDKMessageSendEvent_BroadcastChannelAnnouncement,
2453    /**
2454     * Used to indicate that a node_announcement should be broadcast to all peers.
2455     */
2456    LDKMessageSendEvent_BroadcastNodeAnnouncement,
2457    /**
2458     * Used to indicate that a channel_update should be broadcast to all peers.
2459     */
2460    LDKMessageSendEvent_BroadcastChannelUpdate,
2461    /**
2462     * Used to indicate that a channel_update should be sent to a single peer.
2463     * In contrast to [`Self::BroadcastChannelUpdate`], this is used when the channel is a
2464     * private channel and we shouldn't be informing all of our peers of channel parameters.
2465     */
2466    LDKMessageSendEvent_SendChannelUpdate,
2467    /**
2468     * Broadcast an error downstream to be handled
2469     */
2470    LDKMessageSendEvent_HandleError,
2471    /**
2472     * When a payment fails we may receive updates back from the hop where it failed. In such
2473     * cases this event is generated so that we can inform the network graph of this information.
2474     */
2475    LDKMessageSendEvent_PaymentFailureNetworkUpdate,
2476    /**
2477     * Query a peer for channels with funding transaction UTXOs in a block range.
2478     */
2479    LDKMessageSendEvent_SendChannelRangeQuery,
2480    /**
2481     * Request routing gossip messages from a peer for a list of channels identified by
2482     * their short_channel_ids.
2483     */
2484    LDKMessageSendEvent_SendShortIdsQuery,
2485    /**
2486     * Sends a reply to a channel range query. This may be one of several SendReplyChannelRange events
2487     * emitted during processing of the query.
2488     */
2489    LDKMessageSendEvent_SendReplyChannelRange,
2490    /**
2491     * Must be last for serialization purposes
2492     */
2493    LDKMessageSendEvent_Sentinel,
2494 } LDKMessageSendEvent_Tag;
2495
2496 typedef struct LDKMessageSendEvent_LDKSendAcceptChannel_Body {
2497    /**
2498     * The node_id of the node which should receive this message
2499     */
2500    struct LDKPublicKey node_id;
2501    /**
2502     * The message which should be sent.
2503     */
2504    struct LDKAcceptChannel msg;
2505 } LDKMessageSendEvent_LDKSendAcceptChannel_Body;
2506
2507 typedef struct LDKMessageSendEvent_LDKSendOpenChannel_Body {
2508    /**
2509     * The node_id of the node which should receive this message
2510     */
2511    struct LDKPublicKey node_id;
2512    /**
2513     * The message which should be sent.
2514     */
2515    struct LDKOpenChannel msg;
2516 } LDKMessageSendEvent_LDKSendOpenChannel_Body;
2517
2518 typedef struct LDKMessageSendEvent_LDKSendFundingCreated_Body {
2519    /**
2520     * The node_id of the node which should receive this message
2521     */
2522    struct LDKPublicKey node_id;
2523    /**
2524     * The message which should be sent.
2525     */
2526    struct LDKFundingCreated msg;
2527 } LDKMessageSendEvent_LDKSendFundingCreated_Body;
2528
2529 typedef struct LDKMessageSendEvent_LDKSendFundingSigned_Body {
2530    /**
2531     * The node_id of the node which should receive this message
2532     */
2533    struct LDKPublicKey node_id;
2534    /**
2535     * The message which should be sent.
2536     */
2537    struct LDKFundingSigned msg;
2538 } LDKMessageSendEvent_LDKSendFundingSigned_Body;
2539
2540 typedef struct LDKMessageSendEvent_LDKSendFundingLocked_Body {
2541    /**
2542     * The node_id of the node which should receive these message(s)
2543     */
2544    struct LDKPublicKey node_id;
2545    /**
2546     * The funding_locked message which should be sent.
2547     */
2548    struct LDKFundingLocked msg;
2549 } LDKMessageSendEvent_LDKSendFundingLocked_Body;
2550
2551 typedef struct LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body {
2552    /**
2553     * The node_id of the node which should receive these message(s)
2554     */
2555    struct LDKPublicKey node_id;
2556    /**
2557     * The announcement_signatures message which should be sent.
2558     */
2559    struct LDKAnnouncementSignatures msg;
2560 } LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body;
2561
2562 typedef struct LDKMessageSendEvent_LDKUpdateHTLCs_Body {
2563    /**
2564     * The node_id of the node which should receive these message(s)
2565     */
2566    struct LDKPublicKey node_id;
2567    /**
2568     * The update messages which should be sent. ALL messages in the struct should be sent!
2569     */
2570    struct LDKCommitmentUpdate updates;
2571 } LDKMessageSendEvent_LDKUpdateHTLCs_Body;
2572
2573 typedef struct LDKMessageSendEvent_LDKSendRevokeAndACK_Body {
2574    /**
2575     * The node_id of the node which should receive this message
2576     */
2577    struct LDKPublicKey node_id;
2578    /**
2579     * The message which should be sent.
2580     */
2581    struct LDKRevokeAndACK msg;
2582 } LDKMessageSendEvent_LDKSendRevokeAndACK_Body;
2583
2584 typedef struct LDKMessageSendEvent_LDKSendClosingSigned_Body {
2585    /**
2586     * The node_id of the node which should receive this message
2587     */
2588    struct LDKPublicKey node_id;
2589    /**
2590     * The message which should be sent.
2591     */
2592    struct LDKClosingSigned msg;
2593 } LDKMessageSendEvent_LDKSendClosingSigned_Body;
2594
2595 typedef struct LDKMessageSendEvent_LDKSendShutdown_Body {
2596    /**
2597     * The node_id of the node which should receive this message
2598     */
2599    struct LDKPublicKey node_id;
2600    /**
2601     * The message which should be sent.
2602     */
2603    struct LDKShutdown msg;
2604 } LDKMessageSendEvent_LDKSendShutdown_Body;
2605
2606 typedef struct LDKMessageSendEvent_LDKSendChannelReestablish_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 LDKChannelReestablish msg;
2615 } LDKMessageSendEvent_LDKSendChannelReestablish_Body;
2616
2617 typedef struct LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body {
2618    /**
2619     * The channel_announcement which should be sent.
2620     */
2621    struct LDKChannelAnnouncement msg;
2622    /**
2623     * The followup channel_update which should be sent.
2624     */
2625    struct LDKChannelUpdate update_msg;
2626 } LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body;
2627
2628 typedef struct LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body {
2629    /**
2630     * The node_announcement which should be sent.
2631     */
2632    struct LDKNodeAnnouncement msg;
2633 } LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body;
2634
2635 typedef struct LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body {
2636    /**
2637     * The channel_update which should be sent.
2638     */
2639    struct LDKChannelUpdate msg;
2640 } LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body;
2641
2642 typedef struct LDKMessageSendEvent_LDKSendChannelUpdate_Body {
2643    /**
2644     * The node_id of the node which should receive this message
2645     */
2646    struct LDKPublicKey node_id;
2647    /**
2648     * The channel_update which should be sent.
2649     */
2650    struct LDKChannelUpdate msg;
2651 } LDKMessageSendEvent_LDKSendChannelUpdate_Body;
2652
2653 typedef struct LDKMessageSendEvent_LDKHandleError_Body {
2654    /**
2655     * The node_id of the node which should receive this message
2656     */
2657    struct LDKPublicKey node_id;
2658    /**
2659     * The action which should be taken.
2660     */
2661    struct LDKErrorAction action;
2662 } LDKMessageSendEvent_LDKHandleError_Body;
2663
2664 typedef struct LDKMessageSendEvent_LDKPaymentFailureNetworkUpdate_Body {
2665    /**
2666     * The channel/node update which should be sent to NetGraphMsgHandler
2667     */
2668    struct LDKHTLCFailChannelUpdate update;
2669 } LDKMessageSendEvent_LDKPaymentFailureNetworkUpdate_Body;
2670
2671 typedef struct LDKMessageSendEvent_LDKSendChannelRangeQuery_Body {
2672    /**
2673     * The node_id of this message recipient
2674     */
2675    struct LDKPublicKey node_id;
2676    /**
2677     * The query_channel_range which should be sent.
2678     */
2679    struct LDKQueryChannelRange msg;
2680 } LDKMessageSendEvent_LDKSendChannelRangeQuery_Body;
2681
2682 typedef struct LDKMessageSendEvent_LDKSendShortIdsQuery_Body {
2683    /**
2684     * The node_id of this message recipient
2685     */
2686    struct LDKPublicKey node_id;
2687    /**
2688     * The query_short_channel_ids which should be sent.
2689     */
2690    struct LDKQueryShortChannelIds msg;
2691 } LDKMessageSendEvent_LDKSendShortIdsQuery_Body;
2692
2693 typedef struct LDKMessageSendEvent_LDKSendReplyChannelRange_Body {
2694    /**
2695     * The node_id of this message recipient
2696     */
2697    struct LDKPublicKey node_id;
2698    /**
2699     * The reply_channel_range which should be sent.
2700     */
2701    struct LDKReplyChannelRange msg;
2702 } LDKMessageSendEvent_LDKSendReplyChannelRange_Body;
2703
2704 typedef struct MUST_USE_STRUCT LDKMessageSendEvent {
2705    LDKMessageSendEvent_Tag tag;
2706    union {
2707       LDKMessageSendEvent_LDKSendAcceptChannel_Body send_accept_channel;
2708       LDKMessageSendEvent_LDKSendOpenChannel_Body send_open_channel;
2709       LDKMessageSendEvent_LDKSendFundingCreated_Body send_funding_created;
2710       LDKMessageSendEvent_LDKSendFundingSigned_Body send_funding_signed;
2711       LDKMessageSendEvent_LDKSendFundingLocked_Body send_funding_locked;
2712       LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body send_announcement_signatures;
2713       LDKMessageSendEvent_LDKUpdateHTLCs_Body update_htl_cs;
2714       LDKMessageSendEvent_LDKSendRevokeAndACK_Body send_revoke_and_ack;
2715       LDKMessageSendEvent_LDKSendClosingSigned_Body send_closing_signed;
2716       LDKMessageSendEvent_LDKSendShutdown_Body send_shutdown;
2717       LDKMessageSendEvent_LDKSendChannelReestablish_Body send_channel_reestablish;
2718       LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body broadcast_channel_announcement;
2719       LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body broadcast_node_announcement;
2720       LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body broadcast_channel_update;
2721       LDKMessageSendEvent_LDKSendChannelUpdate_Body send_channel_update;
2722       LDKMessageSendEvent_LDKHandleError_Body handle_error;
2723       LDKMessageSendEvent_LDKPaymentFailureNetworkUpdate_Body payment_failure_network_update;
2724       LDKMessageSendEvent_LDKSendChannelRangeQuery_Body send_channel_range_query;
2725       LDKMessageSendEvent_LDKSendShortIdsQuery_Body send_short_ids_query;
2726       LDKMessageSendEvent_LDKSendReplyChannelRange_Body send_reply_channel_range;
2727    };
2728 } LDKMessageSendEvent;
2729
2730 /**
2731  * A dynamically-allocated array of crate::lightning::util::events::MessageSendEvents of arbitrary size.
2732  * This corresponds to std::vector in C++
2733  */
2734 typedef struct LDKCVec_MessageSendEventZ {
2735    /**
2736     * The elements in the array.
2737     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2738     */
2739    struct LDKMessageSendEvent *data;
2740    /**
2741     * The number of elements pointed to by `data`.
2742     */
2743    uintptr_t datalen;
2744 } LDKCVec_MessageSendEventZ;
2745
2746
2747
2748 /**
2749  * Features used within an `init` message.
2750  */
2751 typedef struct MUST_USE_STRUCT LDKInitFeatures {
2752    /**
2753     * A pointer to the opaque Rust object.
2754     * Nearly everywhere, inner must be non-null, however in places where
2755     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2756     */
2757    LDKnativeInitFeatures *inner;
2758    /**
2759     * Indicates that this is the only struct which contains the same pointer.
2760     * Rust functions which take ownership of an object provided via an argument require
2761     * this to be true and invalidate the object pointed to by inner.
2762     */
2763    bool is_owned;
2764 } LDKInitFeatures;
2765
2766 /**
2767  * The contents of CResult_InitFeaturesDecodeErrorZ
2768  */
2769 typedef union LDKCResult_InitFeaturesDecodeErrorZPtr {
2770    /**
2771     * A pointer to the contents in the success state.
2772     * Reading from this pointer when `result_ok` is not set is undefined.
2773     */
2774    struct LDKInitFeatures *result;
2775    /**
2776     * A pointer to the contents in the error state.
2777     * Reading from this pointer when `result_ok` is set is undefined.
2778     */
2779    struct LDKDecodeError *err;
2780 } LDKCResult_InitFeaturesDecodeErrorZPtr;
2781
2782 /**
2783  * A CResult_InitFeaturesDecodeErrorZ represents the result of a fallible operation,
2784  * containing a crate::lightning::ln::features::InitFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
2785  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2786  */
2787 typedef struct LDKCResult_InitFeaturesDecodeErrorZ {
2788    /**
2789     * The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either
2790     * `err` or `result` depending on the state of `result_ok`.
2791     */
2792    union LDKCResult_InitFeaturesDecodeErrorZPtr contents;
2793    /**
2794     * Whether this CResult_InitFeaturesDecodeErrorZ represents a success state.
2795     */
2796    bool result_ok;
2797 } LDKCResult_InitFeaturesDecodeErrorZ;
2798
2799
2800
2801 /**
2802  * Features used within a `node_announcement` message.
2803  */
2804 typedef struct MUST_USE_STRUCT LDKNodeFeatures {
2805    /**
2806     * A pointer to the opaque Rust object.
2807     * Nearly everywhere, inner must be non-null, however in places where
2808     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2809     */
2810    LDKnativeNodeFeatures *inner;
2811    /**
2812     * Indicates that this is the only struct which contains the same pointer.
2813     * Rust functions which take ownership of an object provided via an argument require
2814     * this to be true and invalidate the object pointed to by inner.
2815     */
2816    bool is_owned;
2817 } LDKNodeFeatures;
2818
2819 /**
2820  * The contents of CResult_NodeFeaturesDecodeErrorZ
2821  */
2822 typedef union LDKCResult_NodeFeaturesDecodeErrorZPtr {
2823    /**
2824     * A pointer to the contents in the success state.
2825     * Reading from this pointer when `result_ok` is not set is undefined.
2826     */
2827    struct LDKNodeFeatures *result;
2828    /**
2829     * A pointer to the contents in the error state.
2830     * Reading from this pointer when `result_ok` is set is undefined.
2831     */
2832    struct LDKDecodeError *err;
2833 } LDKCResult_NodeFeaturesDecodeErrorZPtr;
2834
2835 /**
2836  * A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation,
2837  * containing a crate::lightning::ln::features::NodeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
2838  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2839  */
2840 typedef struct LDKCResult_NodeFeaturesDecodeErrorZ {
2841    /**
2842     * The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either
2843     * `err` or `result` depending on the state of `result_ok`.
2844     */
2845    union LDKCResult_NodeFeaturesDecodeErrorZPtr contents;
2846    /**
2847     * Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state.
2848     */
2849    bool result_ok;
2850 } LDKCResult_NodeFeaturesDecodeErrorZ;
2851
2852
2853
2854 /**
2855  * Features used within a `channel_announcement` message.
2856  */
2857 typedef struct MUST_USE_STRUCT LDKChannelFeatures {
2858    /**
2859     * A pointer to the opaque Rust object.
2860     * Nearly everywhere, inner must be non-null, however in places where
2861     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2862     */
2863    LDKnativeChannelFeatures *inner;
2864    /**
2865     * Indicates that this is the only struct which contains the same pointer.
2866     * Rust functions which take ownership of an object provided via an argument require
2867     * this to be true and invalidate the object pointed to by inner.
2868     */
2869    bool is_owned;
2870 } LDKChannelFeatures;
2871
2872 /**
2873  * The contents of CResult_ChannelFeaturesDecodeErrorZ
2874  */
2875 typedef union LDKCResult_ChannelFeaturesDecodeErrorZPtr {
2876    /**
2877     * A pointer to the contents in the success state.
2878     * Reading from this pointer when `result_ok` is not set is undefined.
2879     */
2880    struct LDKChannelFeatures *result;
2881    /**
2882     * A pointer to the contents in the error state.
2883     * Reading from this pointer when `result_ok` is set is undefined.
2884     */
2885    struct LDKDecodeError *err;
2886 } LDKCResult_ChannelFeaturesDecodeErrorZPtr;
2887
2888 /**
2889  * A CResult_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation,
2890  * containing a crate::lightning::ln::features::ChannelFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
2891  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2892  */
2893 typedef struct LDKCResult_ChannelFeaturesDecodeErrorZ {
2894    /**
2895     * The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either
2896     * `err` or `result` depending on the state of `result_ok`.
2897     */
2898    union LDKCResult_ChannelFeaturesDecodeErrorZPtr contents;
2899    /**
2900     * Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state.
2901     */
2902    bool result_ok;
2903 } LDKCResult_ChannelFeaturesDecodeErrorZ;
2904
2905
2906
2907 /**
2908  * Features used within an invoice.
2909  */
2910 typedef struct MUST_USE_STRUCT LDKInvoiceFeatures {
2911    /**
2912     * A pointer to the opaque Rust object.
2913     * Nearly everywhere, inner must be non-null, however in places where
2914     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2915     */
2916    LDKnativeInvoiceFeatures *inner;
2917    /**
2918     * Indicates that this is the only struct which contains the same pointer.
2919     * Rust functions which take ownership of an object provided via an argument require
2920     * this to be true and invalidate the object pointed to by inner.
2921     */
2922    bool is_owned;
2923 } LDKInvoiceFeatures;
2924
2925 /**
2926  * The contents of CResult_InvoiceFeaturesDecodeErrorZ
2927  */
2928 typedef union LDKCResult_InvoiceFeaturesDecodeErrorZPtr {
2929    /**
2930     * A pointer to the contents in the success state.
2931     * Reading from this pointer when `result_ok` is not set is undefined.
2932     */
2933    struct LDKInvoiceFeatures *result;
2934    /**
2935     * A pointer to the contents in the error state.
2936     * Reading from this pointer when `result_ok` is set is undefined.
2937     */
2938    struct LDKDecodeError *err;
2939 } LDKCResult_InvoiceFeaturesDecodeErrorZPtr;
2940
2941 /**
2942  * A CResult_InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
2943  * containing a crate::lightning::ln::features::InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
2944  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2945  */
2946 typedef struct LDKCResult_InvoiceFeaturesDecodeErrorZ {
2947    /**
2948     * The contents of this CResult_InvoiceFeaturesDecodeErrorZ, accessible via either
2949     * `err` or `result` depending on the state of `result_ok`.
2950     */
2951    union LDKCResult_InvoiceFeaturesDecodeErrorZPtr contents;
2952    /**
2953     * Whether this CResult_InvoiceFeaturesDecodeErrorZ represents a success state.
2954     */
2955    bool result_ok;
2956 } LDKCResult_InvoiceFeaturesDecodeErrorZ;
2957
2958 /**
2959  * The contents of CResult_DelayedPaymentOutputDescriptorDecodeErrorZ
2960  */
2961 typedef union LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
2962    /**
2963     * A pointer to the contents in the success state.
2964     * Reading from this pointer when `result_ok` is not set is undefined.
2965     */
2966    struct LDKDelayedPaymentOutputDescriptor *result;
2967    /**
2968     * A pointer to the contents in the error state.
2969     * Reading from this pointer when `result_ok` is set is undefined.
2970     */
2971    struct LDKDecodeError *err;
2972 } LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr;
2973
2974 /**
2975  * A CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
2976  * containing a crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
2977  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2978  */
2979 typedef struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
2980    /**
2981     * The contents of this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ, accessible via either
2982     * `err` or `result` depending on the state of `result_ok`.
2983     */
2984    union LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr contents;
2985    /**
2986     * Whether this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents a success state.
2987     */
2988    bool result_ok;
2989 } LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ;
2990
2991 /**
2992  * The contents of CResult_StaticPaymentOutputDescriptorDecodeErrorZ
2993  */
2994 typedef union LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
2995    /**
2996     * A pointer to the contents in the success state.
2997     * Reading from this pointer when `result_ok` is not set is undefined.
2998     */
2999    struct LDKStaticPaymentOutputDescriptor *result;
3000    /**
3001     * A pointer to the contents in the error state.
3002     * Reading from this pointer when `result_ok` is set is undefined.
3003     */
3004    struct LDKDecodeError *err;
3005 } LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZPtr;
3006
3007 /**
3008  * A CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
3009  * containing a crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
3010  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3011  */
3012 typedef struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ {
3013    /**
3014     * The contents of this CResult_StaticPaymentOutputDescriptorDecodeErrorZ, accessible via either
3015     * `err` or `result` depending on the state of `result_ok`.
3016     */
3017    union LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZPtr contents;
3018    /**
3019     * Whether this CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents a success state.
3020     */
3021    bool result_ok;
3022 } LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ;
3023
3024 /**
3025  * The contents of CResult_SpendableOutputDescriptorDecodeErrorZ
3026  */
3027 typedef union LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr {
3028    /**
3029     * A pointer to the contents in the success state.
3030     * Reading from this pointer when `result_ok` is not set is undefined.
3031     */
3032    struct LDKSpendableOutputDescriptor *result;
3033    /**
3034     * A pointer to the contents in the error state.
3035     * Reading from this pointer when `result_ok` is set is undefined.
3036     */
3037    struct LDKDecodeError *err;
3038 } LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr;
3039
3040 /**
3041  * A CResult_SpendableOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
3042  * containing a crate::lightning::chain::keysinterface::SpendableOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
3043  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3044  */
3045 typedef struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ {
3046    /**
3047     * The contents of this CResult_SpendableOutputDescriptorDecodeErrorZ, accessible via either
3048     * `err` or `result` depending on the state of `result_ok`.
3049     */
3050    union LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr contents;
3051    /**
3052     * Whether this CResult_SpendableOutputDescriptorDecodeErrorZ represents a success state.
3053     */
3054    bool result_ok;
3055 } LDKCResult_SpendableOutputDescriptorDecodeErrorZ;
3056
3057 /**
3058  * A tuple of 2 elements. See the individual fields for the types contained.
3059  */
3060 typedef struct LDKC2Tuple_SignatureCVec_SignatureZZ {
3061    /**
3062     * The element at position 0
3063     */
3064    struct LDKSignature a;
3065    /**
3066     * The element at position 1
3067     */
3068    struct LDKCVec_SignatureZ b;
3069 } LDKC2Tuple_SignatureCVec_SignatureZZ;
3070
3071 /**
3072  * The contents of CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ
3073  */
3074 typedef union LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
3075    /**
3076     * A pointer to the contents in the success state.
3077     * Reading from this pointer when `result_ok` is not set is undefined.
3078     */
3079    struct LDKC2Tuple_SignatureCVec_SignatureZZ *result;
3080    /**
3081     * Note that this value is always NULL, as there are no contents in the Err variant
3082     */
3083    void *err;
3084 } LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr;
3085
3086 /**
3087  * A CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents the result of a fallible operation,
3088  * containing a crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ on success and a () on failure.
3089  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3090  */
3091 typedef struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
3092    /**
3093     * The contents of this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ, accessible via either
3094     * `err` or `result` depending on the state of `result_ok`.
3095     */
3096    union LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr contents;
3097    /**
3098     * Whether this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents a success state.
3099     */
3100    bool result_ok;
3101 } LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ;
3102
3103 /**
3104  * The contents of CResult_SignatureNoneZ
3105  */
3106 typedef union LDKCResult_SignatureNoneZPtr {
3107    /**
3108     * A pointer to the contents in the success state.
3109     * Reading from this pointer when `result_ok` is not set is undefined.
3110     */
3111    struct LDKSignature *result;
3112    /**
3113     * Note that this value is always NULL, as there are no contents in the Err variant
3114     */
3115    void *err;
3116 } LDKCResult_SignatureNoneZPtr;
3117
3118 /**
3119  * A CResult_SignatureNoneZ represents the result of a fallible operation,
3120  * containing a crate::c_types::Signature on success and a () on failure.
3121  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3122  */
3123 typedef struct LDKCResult_SignatureNoneZ {
3124    /**
3125     * The contents of this CResult_SignatureNoneZ, accessible via either
3126     * `err` or `result` depending on the state of `result_ok`.
3127     */
3128    union LDKCResult_SignatureNoneZPtr contents;
3129    /**
3130     * Whether this CResult_SignatureNoneZ represents a success state.
3131     */
3132    bool result_ok;
3133 } LDKCResult_SignatureNoneZ;
3134
3135
3136
3137 /**
3138  * The unsigned part of a channel_announcement
3139  */
3140 typedef struct MUST_USE_STRUCT LDKUnsignedChannelAnnouncement {
3141    /**
3142     * A pointer to the opaque Rust object.
3143     * Nearly everywhere, inner must be non-null, however in places where
3144     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3145     */
3146    LDKnativeUnsignedChannelAnnouncement *inner;
3147    /**
3148     * Indicates that this is the only struct which contains the same pointer.
3149     * Rust functions which take ownership of an object provided via an argument require
3150     * this to be true and invalidate the object pointed to by inner.
3151     */
3152    bool is_owned;
3153 } LDKUnsignedChannelAnnouncement;
3154
3155 /**
3156  * A trait to sign lightning channel transactions as described in BOLT 3.
3157  *
3158  * Signing services could be implemented on a hardware wallet. In this case,
3159  * the current Sign would be a front-end on top of a communication
3160  * channel connected to your secure device and lightning key material wouldn't
3161  * reside on a hot server. Nevertheless, a this deployment would still need
3162  * to trust the ChannelManager to avoid loss of funds as this latest component
3163  * could ask to sign commitment transaction with HTLCs paying to attacker pubkeys.
3164  *
3165  * A more secure iteration would be to use hashlock (or payment points) to pair
3166  * invoice/incoming HTLCs with outgoing HTLCs to implement a no-trust-ChannelManager
3167  * at the price of more state and computation on the hardware wallet side. In the future,
3168  * we are looking forward to design such interface.
3169  *
3170  * In any case, ChannelMonitor or fallback watchtowers are always going to be trusted
3171  * to act, as liveness and breach reply correctness are always going to be hard requirements
3172  * of LN security model, orthogonal of key management issues.
3173  */
3174 typedef struct LDKBaseSign {
3175    /**
3176     * An opaque pointer which is passed to your function implementations as an argument.
3177     * This has no meaning in the LDK, and can be NULL or any other value.
3178     */
3179    void *this_arg;
3180    /**
3181     * Gets the per-commitment point for a specific commitment number
3182     *
3183     * Note that the commitment number starts at (1 << 48) - 1 and counts backwards.
3184     */
3185    struct LDKPublicKey (*get_per_commitment_point)(const void *this_arg, uint64_t idx);
3186    /**
3187     * Gets the commitment secret for a specific commitment number as part of the revocation process
3188     *
3189     * An external signer implementation should error here if the commitment was already signed
3190     * and should refuse to sign it in the future.
3191     *
3192     * May be called more than once for the same index.
3193     *
3194     * Note that the commitment number starts at (1 << 48) - 1 and counts backwards.
3195     */
3196    struct LDKThirtyTwoBytes (*release_commitment_secret)(const void *this_arg, uint64_t idx);
3197    /**
3198     * Gets the holder's channel public keys and basepoints
3199     */
3200    struct LDKChannelPublicKeys pubkeys;
3201    /**
3202     * Fill in the pubkeys field as a reference to it will be given to Rust after this returns
3203     * Note that this takes a pointer to this object, not the this_ptr like other methods do
3204     * This function pointer may be NULL if pubkeys is filled in when this object is created and never needs updating.
3205     */
3206    void (*set_pubkeys)(const struct LDKBaseSign*NONNULL_PTR );
3207    /**
3208     * Gets an arbitrary identifier describing the set of keys which are provided back to you in
3209     * some SpendableOutputDescriptor types. This should be sufficient to identify this
3210     * Sign object uniquely and lookup or re-derive its keys.
3211     */
3212    struct LDKThirtyTwoBytes (*channel_keys_id)(const void *this_arg);
3213    /**
3214     * Create a signature for a counterparty's commitment transaction and associated HTLC transactions.
3215     *
3216     * Note that if signing fails or is rejected, the channel will be force-closed.
3217     */
3218    struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*sign_counterparty_commitment)(const void *this_arg, const struct LDKCommitmentTransaction *NONNULL_PTR commitment_tx);
3219    /**
3220     * Create a signatures for a holder's commitment transaction and its claiming HTLC transactions.
3221     * This will only ever be called with a non-revoked commitment_tx.  This will be called with the
3222     * latest commitment_tx when we initiate a force-close.
3223     * This will be called with the previous latest, just to get claiming HTLC signatures, if we are
3224     * reacting to a ChannelMonitor replica that decided to broadcast before it had been updated to
3225     * the latest.
3226     * This may be called multiple times for the same transaction.
3227     *
3228     * An external signer implementation should check that the commitment has not been revoked.
3229     *
3230     * May return Err if key derivation fails.  Callers, such as ChannelMonitor, will panic in such a case.
3231     */
3232    struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*sign_holder_commitment_and_htlcs)(const void *this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR commitment_tx);
3233    /**
3234     * Create a signature for the given input in a transaction spending an HTLC transaction output
3235     * or a commitment transaction `to_local` output when our counterparty broadcasts an old state.
3236     *
3237     * A justice transaction may claim multiple outputs at the same time if timelocks are
3238     * similar, but only a signature for the input at index `input` should be signed for here.
3239     * It may be called multiple times for same output(s) if a fee-bump is needed with regards
3240     * to an upcoming timelock expiration.
3241     *
3242     * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
3243     *
3244     * per_commitment_key is revocation secret which was provided by our counterparty when they
3245     * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does
3246     * not allow the spending of any funds by itself (you need our holder revocation_secret to do
3247     * so).
3248     */
3249    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]);
3250    /**
3251     * Create a signature for the given input in a transaction spending a commitment transaction
3252     * HTLC output when our counterparty broadcasts an old state.
3253     *
3254     * A justice transaction may claim multiple outputs at the same time if timelocks are
3255     * similar, but only a signature for the input at index `input` should be signed for here.
3256     * It may be called multiple times for same output(s) if a fee-bump is needed with regards
3257     * to an upcoming timelock expiration.
3258     *
3259     * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
3260     *
3261     * per_commitment_key is revocation secret which was provided by our counterparty when they
3262     * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does
3263     * not allow the spending of any funds by itself (you need our holder revocation_secret to do
3264     * so).
3265     *
3266     * htlc holds HTLC elements (hash, timelock), thus changing the format of the witness script
3267     * (which is committed to in the BIP 143 signatures).
3268     */
3269    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);
3270    /**
3271     * Create a signature for a claiming transaction for a HTLC output on a counterparty's commitment
3272     * transaction, either offered or received.
3273     *
3274     * Such a transaction may claim multiples offered outputs at same time if we know the
3275     * preimage for each when we create it, but only the input at index `input` should be
3276     * signed for here. It may be called multiple times for same output(s) if a fee-bump is
3277     * needed with regards to an upcoming timelock expiration.
3278     *
3279     * Witness_script is either a offered or received script as defined in BOLT3 for HTLC
3280     * outputs.
3281     *
3282     * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
3283     *
3284     * Per_commitment_point is the dynamic point corresponding to the channel state
3285     * detected onchain. It has been generated by our counterparty and is used to derive
3286     * channel state keys, which are then included in the witness script and committed to in the
3287     * BIP 143 signature.
3288     */
3289    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);
3290    /**
3291     * Create a signature for a (proposed) closing transaction.
3292     *
3293     * Note that, due to rounding, there may be one \"missing\" satoshi, and either party may have
3294     * chosen to forgo their output as dust.
3295     */
3296    struct LDKCResult_SignatureNoneZ (*sign_closing_transaction)(const void *this_arg, struct LDKTransaction closing_tx);
3297    /**
3298     * Signs a channel announcement message with our funding key, proving it comes from one
3299     * of the channel participants.
3300     *
3301     * Note that if this fails or is rejected, the channel will not be publicly announced and
3302     * our counterparty may (though likely will not) close the channel on us for violating the
3303     * protocol.
3304     */
3305    struct LDKCResult_SignatureNoneZ (*sign_channel_announcement)(const void *this_arg, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR msg);
3306    /**
3307     * Set the counterparty static channel data, including basepoints,
3308     * counterparty_selected/holder_selected_contest_delay and funding outpoint.
3309     * This is done as soon as the funding outpoint is known.  Since these are static channel data,
3310     * they MUST NOT be allowed to change to different values once set.
3311     *
3312     * channel_parameters.is_populated() MUST be true.
3313     *
3314     * We bind holder_selected_contest_delay late here for API convenience.
3315     *
3316     * Will be called before any signatures are applied.
3317     */
3318    void (*ready_channel)(void *this_arg, const struct LDKChannelTransactionParameters *NONNULL_PTR channel_parameters);
3319    /**
3320     * Frees any resources associated with this object given its this_arg pointer.
3321     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
3322     */
3323    void (*free)(void *this_arg);
3324 } LDKBaseSign;
3325
3326 /**
3327  * A cloneable signer.
3328  *
3329  * Although we require signers to be cloneable, it may be useful for developers to be able to use
3330  * signers in an un-sized way, for example as `dyn BaseSign`. Therefore we separate the Clone trait,
3331  * which implies Sized, into this derived trait.
3332  */
3333 typedef struct LDKSign {
3334    /**
3335     * An opaque pointer which is passed to your function implementations as an argument.
3336     * This has no meaning in the LDK, and can be NULL or any other value.
3337     */
3338    void *this_arg;
3339    /**
3340     * Implementation of BaseSign for this object.
3341     */
3342    struct LDKBaseSign BaseSign;
3343    /**
3344     * Serialize the object into a byte array
3345     */
3346    struct LDKCVec_u8Z (*write)(const void *this_arg);
3347    /**
3348     * Called, if set, after this Sign has been cloned into a duplicate object.
3349     * The new Sign is provided, and should be mutated as needed to perform a
3350     * deep copy of the object pointed to by this_arg or avoid any double-freeing.
3351     */
3352    void (*cloned)(struct LDKSign *NONNULL_PTR new_Sign);
3353    /**
3354     * Frees any resources associated with this object given its this_arg pointer.
3355     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
3356     */
3357    void (*free)(void *this_arg);
3358 } LDKSign;
3359
3360 /**
3361  * The contents of CResult_SignDecodeErrorZ
3362  */
3363 typedef union LDKCResult_SignDecodeErrorZPtr {
3364    /**
3365     * A pointer to the contents in the success state.
3366     * Reading from this pointer when `result_ok` is not set is undefined.
3367     */
3368    struct LDKSign *result;
3369    /**
3370     * A pointer to the contents in the error state.
3371     * Reading from this pointer when `result_ok` is set is undefined.
3372     */
3373    struct LDKDecodeError *err;
3374 } LDKCResult_SignDecodeErrorZPtr;
3375
3376 /**
3377  * A CResult_SignDecodeErrorZ represents the result of a fallible operation,
3378  * containing a crate::lightning::chain::keysinterface::Sign on success and a crate::lightning::ln::msgs::DecodeError on failure.
3379  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3380  */
3381 typedef struct LDKCResult_SignDecodeErrorZ {
3382    /**
3383     * The contents of this CResult_SignDecodeErrorZ, accessible via either
3384     * `err` or `result` depending on the state of `result_ok`.
3385     */
3386    union LDKCResult_SignDecodeErrorZPtr contents;
3387    /**
3388     * Whether this CResult_SignDecodeErrorZ represents a success state.
3389     */
3390    bool result_ok;
3391 } LDKCResult_SignDecodeErrorZ;
3392
3393 /**
3394  * Represents a secp256k1 signature serialized as two 32-byte numbers as well as a tag which
3395  * allows recovering the exact public key which created the signature given the message.
3396  */
3397 typedef struct LDKRecoverableSignature {
3398    /**
3399     * The bytes of the signature in "compact" form plus a "Recovery ID" which allows for
3400     * recovery.
3401     */
3402    uint8_t serialized_form[68];
3403 } LDKRecoverableSignature;
3404
3405 /**
3406  * The contents of CResult_RecoverableSignatureNoneZ
3407  */
3408 typedef union LDKCResult_RecoverableSignatureNoneZPtr {
3409    /**
3410     * A pointer to the contents in the success state.
3411     * Reading from this pointer when `result_ok` is not set is undefined.
3412     */
3413    struct LDKRecoverableSignature *result;
3414    /**
3415     * Note that this value is always NULL, as there are no contents in the Err variant
3416     */
3417    void *err;
3418 } LDKCResult_RecoverableSignatureNoneZPtr;
3419
3420 /**
3421  * A CResult_RecoverableSignatureNoneZ represents the result of a fallible operation,
3422  * containing a crate::c_types::RecoverableSignature on success and a () on failure.
3423  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3424  */
3425 typedef struct LDKCResult_RecoverableSignatureNoneZ {
3426    /**
3427     * The contents of this CResult_RecoverableSignatureNoneZ, accessible via either
3428     * `err` or `result` depending on the state of `result_ok`.
3429     */
3430    union LDKCResult_RecoverableSignatureNoneZPtr contents;
3431    /**
3432     * Whether this CResult_RecoverableSignatureNoneZ represents a success state.
3433     */
3434    bool result_ok;
3435 } LDKCResult_RecoverableSignatureNoneZ;
3436
3437 /**
3438  * A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size.
3439  * This corresponds to std::vector in C++
3440  */
3441 typedef struct LDKCVec_CVec_u8ZZ {
3442    /**
3443     * The elements in the array.
3444     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3445     */
3446    struct LDKCVec_u8Z *data;
3447    /**
3448     * The number of elements pointed to by `data`.
3449     */
3450    uintptr_t datalen;
3451 } LDKCVec_CVec_u8ZZ;
3452
3453 /**
3454  * The contents of CResult_CVec_CVec_u8ZZNoneZ
3455  */
3456 typedef union LDKCResult_CVec_CVec_u8ZZNoneZPtr {
3457    /**
3458     * A pointer to the contents in the success state.
3459     * Reading from this pointer when `result_ok` is not set is undefined.
3460     */
3461    struct LDKCVec_CVec_u8ZZ *result;
3462    /**
3463     * Note that this value is always NULL, as there are no contents in the Err variant
3464     */
3465    void *err;
3466 } LDKCResult_CVec_CVec_u8ZZNoneZPtr;
3467
3468 /**
3469  * A CResult_CVec_CVec_u8ZZNoneZ represents the result of a fallible operation,
3470  * containing a crate::c_types::derived::CVec_CVec_u8ZZ on success and a () on failure.
3471  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3472  */
3473 typedef struct LDKCResult_CVec_CVec_u8ZZNoneZ {
3474    /**
3475     * The contents of this CResult_CVec_CVec_u8ZZNoneZ, accessible via either
3476     * `err` or `result` depending on the state of `result_ok`.
3477     */
3478    union LDKCResult_CVec_CVec_u8ZZNoneZPtr contents;
3479    /**
3480     * Whether this CResult_CVec_CVec_u8ZZNoneZ represents a success state.
3481     */
3482    bool result_ok;
3483 } LDKCResult_CVec_CVec_u8ZZNoneZ;
3484
3485
3486
3487 /**
3488  * A simple implementation of Sign that just keeps the private keys in memory.
3489  *
3490  * This implementation performs no policy checks and is insufficient by itself as
3491  * a secure external signer.
3492  */
3493 typedef struct MUST_USE_STRUCT LDKInMemorySigner {
3494    /**
3495     * A pointer to the opaque Rust object.
3496     * Nearly everywhere, inner must be non-null, however in places where
3497     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3498     */
3499    LDKnativeInMemorySigner *inner;
3500    /**
3501     * Indicates that this is the only struct which contains the same pointer.
3502     * Rust functions which take ownership of an object provided via an argument require
3503     * this to be true and invalidate the object pointed to by inner.
3504     */
3505    bool is_owned;
3506 } LDKInMemorySigner;
3507
3508 /**
3509  * The contents of CResult_InMemorySignerDecodeErrorZ
3510  */
3511 typedef union LDKCResult_InMemorySignerDecodeErrorZPtr {
3512    /**
3513     * A pointer to the contents in the success state.
3514     * Reading from this pointer when `result_ok` is not set is undefined.
3515     */
3516    struct LDKInMemorySigner *result;
3517    /**
3518     * A pointer to the contents in the error state.
3519     * Reading from this pointer when `result_ok` is set is undefined.
3520     */
3521    struct LDKDecodeError *err;
3522 } LDKCResult_InMemorySignerDecodeErrorZPtr;
3523
3524 /**
3525  * A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation,
3526  * containing a crate::lightning::chain::keysinterface::InMemorySigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
3527  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3528  */
3529 typedef struct LDKCResult_InMemorySignerDecodeErrorZ {
3530    /**
3531     * The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either
3532     * `err` or `result` depending on the state of `result_ok`.
3533     */
3534    union LDKCResult_InMemorySignerDecodeErrorZPtr contents;
3535    /**
3536     * Whether this CResult_InMemorySignerDecodeErrorZ represents a success state.
3537     */
3538    bool result_ok;
3539 } LDKCResult_InMemorySignerDecodeErrorZ;
3540
3541 /**
3542  * A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size.
3543  * This corresponds to std::vector in C++
3544  */
3545 typedef struct LDKCVec_TxOutZ {
3546    /**
3547     * The elements in the array.
3548     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3549     */
3550    struct LDKTxOut *data;
3551    /**
3552     * The number of elements pointed to by `data`.
3553     */
3554    uintptr_t datalen;
3555 } LDKCVec_TxOutZ;
3556
3557 /**
3558  * The contents of CResult_TransactionNoneZ
3559  */
3560 typedef union LDKCResult_TransactionNoneZPtr {
3561    /**
3562     * A pointer to the contents in the success state.
3563     * Reading from this pointer when `result_ok` is not set is undefined.
3564     */
3565    struct LDKTransaction *result;
3566    /**
3567     * Note that this value is always NULL, as there are no contents in the Err variant
3568     */
3569    void *err;
3570 } LDKCResult_TransactionNoneZPtr;
3571
3572 /**
3573  * A CResult_TransactionNoneZ represents the result of a fallible operation,
3574  * containing a crate::c_types::Transaction on success and a () on failure.
3575  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3576  */
3577 typedef struct LDKCResult_TransactionNoneZ {
3578    /**
3579     * The contents of this CResult_TransactionNoneZ, accessible via either
3580     * `err` or `result` depending on the state of `result_ok`.
3581     */
3582    union LDKCResult_TransactionNoneZPtr contents;
3583    /**
3584     * Whether this CResult_TransactionNoneZ represents a success state.
3585     */
3586    bool result_ok;
3587 } LDKCResult_TransactionNoneZ;
3588
3589
3590
3591 /**
3592  * A ChannelMonitor handles chain events (blocks connected and disconnected) and generates
3593  * on-chain transactions to ensure no loss of funds occurs.
3594  *
3595  * You MUST ensure that no ChannelMonitors for a given channel anywhere contain out-of-date
3596  * information and are actively monitoring the chain.
3597  *
3598  * Pending Events or updated HTLCs which have not yet been read out by
3599  * get_and_clear_pending_monitor_events or get_and_clear_pending_events are serialized to disk and
3600  * reloaded at deserialize-time. Thus, you must ensure that, when handling events, all events
3601  * gotten are fully handled before re-serializing the new state.
3602  *
3603  * Note that the deserializer is only implemented for (BlockHash, ChannelMonitor), which
3604  * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along
3605  * the \"reorg path\" (ie disconnecting blocks until you find a common ancestor from both the
3606  * returned block hash and the the current chain and then reconnecting blocks to get to the
3607  * best chain) upon deserializing the object!
3608  */
3609 typedef struct MUST_USE_STRUCT LDKChannelMonitor {
3610    /**
3611     * A pointer to the opaque Rust object.
3612     * Nearly everywhere, inner must be non-null, however in places where
3613     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3614     */
3615    LDKnativeChannelMonitor *inner;
3616    /**
3617     * Indicates that this is the only struct which contains the same pointer.
3618     * Rust functions which take ownership of an object provided via an argument require
3619     * this to be true and invalidate the object pointed to by inner.
3620     */
3621    bool is_owned;
3622 } LDKChannelMonitor;
3623
3624 /**
3625  * A tuple of 2 elements. See the individual fields for the types contained.
3626  */
3627 typedef struct LDKC2Tuple_BlockHashChannelMonitorZ {
3628    /**
3629     * The element at position 0
3630     */
3631    struct LDKThirtyTwoBytes a;
3632    /**
3633     * The element at position 1
3634     */
3635    struct LDKChannelMonitor b;
3636 } LDKC2Tuple_BlockHashChannelMonitorZ;
3637
3638 /**
3639  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZs of arbitrary size.
3640  * This corresponds to std::vector in C++
3641  */
3642 typedef struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ {
3643    /**
3644     * The elements in the array.
3645     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3646     */
3647    struct LDKC2Tuple_BlockHashChannelMonitorZ *data;
3648    /**
3649     * The number of elements pointed to by `data`.
3650     */
3651    uintptr_t datalen;
3652 } LDKCVec_C2Tuple_BlockHashChannelMonitorZZ;
3653
3654 /**
3655  * The contents of CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ
3656  */
3657 typedef union LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
3658    /**
3659     * A pointer to the contents in the success state.
3660     * Reading from this pointer when `result_ok` is not set is undefined.
3661     */
3662    struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ *result;
3663    /**
3664     * A pointer to the contents in the error state.
3665     * Reading from this pointer when `result_ok` is set is undefined.
3666     */
3667    enum LDKIOError *err;
3668 } LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr;
3669
3670 /**
3671  * A CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents the result of a fallible operation,
3672  * containing a crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ on success and a crate::c_types::IOError on failure.
3673  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3674  */
3675 typedef struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
3676    /**
3677     * The contents of this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ, accessible via either
3678     * `err` or `result` depending on the state of `result_ok`.
3679     */
3680    union LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr contents;
3681    /**
3682     * Whether this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents a success state.
3683     */
3684    bool result_ok;
3685 } LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ;
3686
3687 /**
3688  * An enum which can either contain a u16 or not
3689  */
3690 typedef enum LDKCOption_u16Z_Tag {
3691    /**
3692     * When we're in this state, this COption_u16Z contains a u16
3693     */
3694    LDKCOption_u16Z_Some,
3695    /**
3696     * When we're in this state, this COption_u16Z contains nothing
3697     */
3698    LDKCOption_u16Z_None,
3699    /**
3700     * Must be last for serialization purposes
3701     */
3702    LDKCOption_u16Z_Sentinel,
3703 } LDKCOption_u16Z_Tag;
3704
3705 typedef struct LDKCOption_u16Z {
3706    LDKCOption_u16Z_Tag tag;
3707    union {
3708       struct {
3709          uint16_t some;
3710       };
3711    };
3712 } LDKCOption_u16Z;
3713
3714 /**
3715  * Indicates an error on the client's part (usually some variant of attempting to use too-low or
3716  * too-high values)
3717  */
3718 typedef enum LDKAPIError_Tag {
3719    /**
3720     * Indicates the API was wholly misused (see err for more). Cases where these can be returned
3721     * are documented, but generally indicates some precondition of a function was violated.
3722     */
3723    LDKAPIError_APIMisuseError,
3724    /**
3725     * Due to a high feerate, we were unable to complete the request.
3726     * For example, this may be returned if the feerate implies we cannot open a channel at the
3727     * requested value, but opening a larger channel would succeed.
3728     */
3729    LDKAPIError_FeeRateTooHigh,
3730    /**
3731     * A malformed Route was provided (eg overflowed value, node id mismatch, overly-looped route,
3732     * too-many-hops, etc).
3733     */
3734    LDKAPIError_RouteError,
3735    /**
3736     * We were unable to complete the request as the Channel required to do so is unable to
3737     * complete the request (or was not found). This can take many forms, including disconnected
3738     * peer, channel at capacity, channel shutting down, etc.
3739     */
3740    LDKAPIError_ChannelUnavailable,
3741    /**
3742     * An attempt to call watch/update_channel returned an Err (ie you did this!), causing the
3743     * attempted action to fail.
3744     */
3745    LDKAPIError_MonitorUpdateFailed,
3746    /**
3747     * Must be last for serialization purposes
3748     */
3749    LDKAPIError_Sentinel,
3750 } LDKAPIError_Tag;
3751
3752 typedef struct LDKAPIError_LDKAPIMisuseError_Body {
3753    /**
3754     * A human-readable error message
3755     */
3756    struct LDKStr err;
3757 } LDKAPIError_LDKAPIMisuseError_Body;
3758
3759 typedef struct LDKAPIError_LDKFeeRateTooHigh_Body {
3760    /**
3761     * A human-readable error message
3762     */
3763    struct LDKStr err;
3764    /**
3765     * The feerate which was too high.
3766     */
3767    uint32_t feerate;
3768 } LDKAPIError_LDKFeeRateTooHigh_Body;
3769
3770 typedef struct LDKAPIError_LDKRouteError_Body {
3771    /**
3772     * A human-readable error message
3773     */
3774    struct LDKStr err;
3775 } LDKAPIError_LDKRouteError_Body;
3776
3777 typedef struct LDKAPIError_LDKChannelUnavailable_Body {
3778    /**
3779     * A human-readable error message
3780     */
3781    struct LDKStr err;
3782 } LDKAPIError_LDKChannelUnavailable_Body;
3783
3784 typedef struct MUST_USE_STRUCT LDKAPIError {
3785    LDKAPIError_Tag tag;
3786    union {
3787       LDKAPIError_LDKAPIMisuseError_Body api_misuse_error;
3788       LDKAPIError_LDKFeeRateTooHigh_Body fee_rate_too_high;
3789       LDKAPIError_LDKRouteError_Body route_error;
3790       LDKAPIError_LDKChannelUnavailable_Body channel_unavailable;
3791    };
3792 } LDKAPIError;
3793
3794 /**
3795  * The contents of CResult_NoneAPIErrorZ
3796  */
3797 typedef union LDKCResult_NoneAPIErrorZPtr {
3798    /**
3799     * Note that this value is always NULL, as there are no contents in the OK variant
3800     */
3801    void *result;
3802    /**
3803     * A pointer to the contents in the error state.
3804     * Reading from this pointer when `result_ok` is set is undefined.
3805     */
3806    struct LDKAPIError *err;
3807 } LDKCResult_NoneAPIErrorZPtr;
3808
3809 /**
3810  * A CResult_NoneAPIErrorZ represents the result of a fallible operation,
3811  * containing a () on success and a crate::lightning::util::errors::APIError on failure.
3812  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3813  */
3814 typedef struct LDKCResult_NoneAPIErrorZ {
3815    /**
3816     * The contents of this CResult_NoneAPIErrorZ, accessible via either
3817     * `err` or `result` depending on the state of `result_ok`.
3818     */
3819    union LDKCResult_NoneAPIErrorZPtr contents;
3820    /**
3821     * Whether this CResult_NoneAPIErrorZ represents a success state.
3822     */
3823    bool result_ok;
3824 } LDKCResult_NoneAPIErrorZ;
3825
3826 /**
3827  * A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size.
3828  * This corresponds to std::vector in C++
3829  */
3830 typedef struct LDKCVec_CResult_NoneAPIErrorZZ {
3831    /**
3832     * The elements in the array.
3833     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3834     */
3835    struct LDKCResult_NoneAPIErrorZ *data;
3836    /**
3837     * The number of elements pointed to by `data`.
3838     */
3839    uintptr_t datalen;
3840 } LDKCVec_CResult_NoneAPIErrorZZ;
3841
3842 /**
3843  * A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size.
3844  * This corresponds to std::vector in C++
3845  */
3846 typedef struct LDKCVec_APIErrorZ {
3847    /**
3848     * The elements in the array.
3849     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
3850     */
3851    struct LDKAPIError *data;
3852    /**
3853     * The number of elements pointed to by `data`.
3854     */
3855    uintptr_t datalen;
3856 } LDKCVec_APIErrorZ;
3857
3858 /**
3859  * If a payment fails to send, it can be in one of several states. This enum is returned as the
3860  * Err() type describing which state the payment is in, see the description of individual enum
3861  * states for more.
3862  */
3863 typedef enum LDKPaymentSendFailure_Tag {
3864    /**
3865     * A parameter which was passed to send_payment was invalid, preventing us from attempting to
3866     * send the payment at all. No channel state has been changed or messages sent to peers, and
3867     * once you've changed the parameter at error, you can freely retry the payment in full.
3868     */
3869    LDKPaymentSendFailure_ParameterError,
3870    /**
3871     * A parameter in a single path which was passed to send_payment was invalid, preventing us
3872     * from attempting to send the payment at all. No channel state has been changed or messages
3873     * sent to peers, and once you've changed the parameter at error, you can freely retry the
3874     * payment in full.
3875     *
3876     * The results here are ordered the same as the paths in the route object which was passed to
3877     * send_payment.
3878     */
3879    LDKPaymentSendFailure_PathParameterError,
3880    /**
3881     * All paths which were attempted failed to send, with no channel state change taking place.
3882     * You can freely retry the payment in full (though you probably want to do so over different
3883     * paths than the ones selected).
3884     */
3885    LDKPaymentSendFailure_AllFailedRetrySafe,
3886    /**
3887     * Some paths which were attempted failed to send, though possibly not all. At least some
3888     * paths have irrevocably committed to the HTLC and retrying the payment in full would result
3889     * in over-/re-payment.
3890     *
3891     * The results here are ordered the same as the paths in the route object which was passed to
3892     * send_payment, and any Errs which are not APIError::MonitorUpdateFailed can be safely
3893     * retried (though there is currently no API with which to do so).
3894     *
3895     * Any entries which contain Err(APIError::MonitorUpdateFailed) or Ok(()) MUST NOT be retried
3896     * as they will result in over-/re-payment. These HTLCs all either successfully sent (in the
3897     * case of Ok(())) or will send once channel_monitor_updated is called on the next-hop channel
3898     * with the latest update_id.
3899     */
3900    LDKPaymentSendFailure_PartialFailure,
3901    /**
3902     * Must be last for serialization purposes
3903     */
3904    LDKPaymentSendFailure_Sentinel,
3905 } LDKPaymentSendFailure_Tag;
3906
3907 typedef struct MUST_USE_STRUCT LDKPaymentSendFailure {
3908    LDKPaymentSendFailure_Tag tag;
3909    union {
3910       struct {
3911          struct LDKAPIError parameter_error;
3912       };
3913       struct {
3914          struct LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error;
3915       };
3916       struct {
3917          struct LDKCVec_APIErrorZ all_failed_retry_safe;
3918       };
3919       struct {
3920          struct LDKCVec_CResult_NoneAPIErrorZZ partial_failure;
3921       };
3922    };
3923 } LDKPaymentSendFailure;
3924
3925 /**
3926  * The contents of CResult_NonePaymentSendFailureZ
3927  */
3928 typedef union LDKCResult_NonePaymentSendFailureZPtr {
3929    /**
3930     * Note that this value is always NULL, as there are no contents in the OK variant
3931     */
3932    void *result;
3933    /**
3934     * A pointer to the contents in the error state.
3935     * Reading from this pointer when `result_ok` is set is undefined.
3936     */
3937    struct LDKPaymentSendFailure *err;
3938 } LDKCResult_NonePaymentSendFailureZPtr;
3939
3940 /**
3941  * A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
3942  * containing a () on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
3943  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3944  */
3945 typedef struct LDKCResult_NonePaymentSendFailureZ {
3946    /**
3947     * The contents of this CResult_NonePaymentSendFailureZ, accessible via either
3948     * `err` or `result` depending on the state of `result_ok`.
3949     */
3950    union LDKCResult_NonePaymentSendFailureZPtr contents;
3951    /**
3952     * Whether this CResult_NonePaymentSendFailureZ represents a success state.
3953     */
3954    bool result_ok;
3955 } LDKCResult_NonePaymentSendFailureZ;
3956
3957 /**
3958  * The contents of CResult_PaymentHashPaymentSendFailureZ
3959  */
3960 typedef union LDKCResult_PaymentHashPaymentSendFailureZPtr {
3961    /**
3962     * A pointer to the contents in the success state.
3963     * Reading from this pointer when `result_ok` is not set is undefined.
3964     */
3965    struct LDKThirtyTwoBytes *result;
3966    /**
3967     * A pointer to the contents in the error state.
3968     * Reading from this pointer when `result_ok` is set is undefined.
3969     */
3970    struct LDKPaymentSendFailure *err;
3971 } LDKCResult_PaymentHashPaymentSendFailureZPtr;
3972
3973 /**
3974  * A CResult_PaymentHashPaymentSendFailureZ represents the result of a fallible operation,
3975  * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
3976  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3977  */
3978 typedef struct LDKCResult_PaymentHashPaymentSendFailureZ {
3979    /**
3980     * The contents of this CResult_PaymentHashPaymentSendFailureZ, accessible via either
3981     * `err` or `result` depending on the state of `result_ok`.
3982     */
3983    union LDKCResult_PaymentHashPaymentSendFailureZPtr contents;
3984    /**
3985     * Whether this CResult_PaymentHashPaymentSendFailureZ represents a success state.
3986     */
3987    bool result_ok;
3988 } LDKCResult_PaymentHashPaymentSendFailureZ;
3989
3990 /**
3991  * A 4-byte byte array.
3992  */
3993 typedef struct LDKFourBytes {
3994    /**
3995     * The four bytes
3996     */
3997    uint8_t data[4];
3998 } LDKFourBytes;
3999
4000 /**
4001  * A 16-byte byte array.
4002  */
4003 typedef struct LDKSixteenBytes {
4004    /**
4005     * The sixteen bytes
4006     */
4007    uint8_t data[16];
4008 } LDKSixteenBytes;
4009
4010 /**
4011  * A 10-byte byte array.
4012  */
4013 typedef struct LDKTenBytes {
4014    /**
4015     * The ten bytes
4016     */
4017    uint8_t data[10];
4018 } LDKTenBytes;
4019
4020 /**
4021  * An address which can be used to connect to a remote peer
4022  */
4023 typedef enum LDKNetAddress_Tag {
4024    /**
4025     * An IPv4 address/port on which the peer is listening.
4026     */
4027    LDKNetAddress_IPv4,
4028    /**
4029     * An IPv6 address/port on which the peer is listening.
4030     */
4031    LDKNetAddress_IPv6,
4032    /**
4033     * An old-style Tor onion address/port on which the peer is listening.
4034     */
4035    LDKNetAddress_OnionV2,
4036    /**
4037     * A new-style Tor onion address/port on which the peer is listening.
4038     * To create the human-readable \"hostname\", concatenate ed25519_pubkey, checksum, and version,
4039     * wrap as base32 and append \".onion\".
4040     */
4041    LDKNetAddress_OnionV3,
4042    /**
4043     * Must be last for serialization purposes
4044     */
4045    LDKNetAddress_Sentinel,
4046 } LDKNetAddress_Tag;
4047
4048 typedef struct LDKNetAddress_LDKIPv4_Body {
4049    /**
4050     * The 4-byte IPv4 address
4051     */
4052    struct LDKFourBytes addr;
4053    /**
4054     * The port on which the node is listening
4055     */
4056    uint16_t port;
4057 } LDKNetAddress_LDKIPv4_Body;
4058
4059 typedef struct LDKNetAddress_LDKIPv6_Body {
4060    /**
4061     * The 16-byte IPv6 address
4062     */
4063    struct LDKSixteenBytes addr;
4064    /**
4065     * The port on which the node is listening
4066     */
4067    uint16_t port;
4068 } LDKNetAddress_LDKIPv6_Body;
4069
4070 typedef struct LDKNetAddress_LDKOnionV2_Body {
4071    /**
4072     * The bytes (usually encoded in base32 with \".onion\" appended)
4073     */
4074    struct LDKTenBytes addr;
4075    /**
4076     * The port on which the node is listening
4077     */
4078    uint16_t port;
4079 } LDKNetAddress_LDKOnionV2_Body;
4080
4081 typedef struct LDKNetAddress_LDKOnionV3_Body {
4082    /**
4083     * The ed25519 long-term public key of the peer
4084     */
4085    struct LDKThirtyTwoBytes ed25519_pubkey;
4086    /**
4087     * The checksum of the pubkey and version, as included in the onion address
4088     */
4089    uint16_t checksum;
4090    /**
4091     * The version byte, as defined by the Tor Onion v3 spec.
4092     */
4093    uint8_t version;
4094    /**
4095     * The port on which the node is listening
4096     */
4097    uint16_t port;
4098 } LDKNetAddress_LDKOnionV3_Body;
4099
4100 typedef struct MUST_USE_STRUCT LDKNetAddress {
4101    LDKNetAddress_Tag tag;
4102    union {
4103       LDKNetAddress_LDKIPv4_Body i_pv4;
4104       LDKNetAddress_LDKIPv6_Body i_pv6;
4105       LDKNetAddress_LDKOnionV2_Body onion_v2;
4106       LDKNetAddress_LDKOnionV3_Body onion_v3;
4107    };
4108 } LDKNetAddress;
4109
4110 /**
4111  * A dynamically-allocated array of crate::lightning::ln::msgs::NetAddresss of arbitrary size.
4112  * This corresponds to std::vector in C++
4113  */
4114 typedef struct LDKCVec_NetAddressZ {
4115    /**
4116     * The elements in the array.
4117     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4118     */
4119    struct LDKNetAddress *data;
4120    /**
4121     * The number of elements pointed to by `data`.
4122     */
4123    uintptr_t datalen;
4124 } LDKCVec_NetAddressZ;
4125
4126 /**
4127  * A tuple of 2 elements. See the individual fields for the types contained.
4128  */
4129 typedef struct LDKC2Tuple_PaymentHashPaymentSecretZ {
4130    /**
4131     * The element at position 0
4132     */
4133    struct LDKThirtyTwoBytes a;
4134    /**
4135     * The element at position 1
4136     */
4137    struct LDKThirtyTwoBytes b;
4138 } LDKC2Tuple_PaymentHashPaymentSecretZ;
4139
4140 /**
4141  * The contents of CResult_PaymentSecretAPIErrorZ
4142  */
4143 typedef union LDKCResult_PaymentSecretAPIErrorZPtr {
4144    /**
4145     * A pointer to the contents in the success state.
4146     * Reading from this pointer when `result_ok` is not set is undefined.
4147     */
4148    struct LDKThirtyTwoBytes *result;
4149    /**
4150     * A pointer to the contents in the error state.
4151     * Reading from this pointer when `result_ok` is set is undefined.
4152     */
4153    struct LDKAPIError *err;
4154 } LDKCResult_PaymentSecretAPIErrorZPtr;
4155
4156 /**
4157  * A CResult_PaymentSecretAPIErrorZ represents the result of a fallible operation,
4158  * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
4159  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4160  */
4161 typedef struct LDKCResult_PaymentSecretAPIErrorZ {
4162    /**
4163     * The contents of this CResult_PaymentSecretAPIErrorZ, accessible via either
4164     * `err` or `result` depending on the state of `result_ok`.
4165     */
4166    union LDKCResult_PaymentSecretAPIErrorZPtr contents;
4167    /**
4168     * Whether this CResult_PaymentSecretAPIErrorZ represents a success state.
4169     */
4170    bool result_ok;
4171 } LDKCResult_PaymentSecretAPIErrorZ;
4172
4173 /**
4174  * A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
4175  * This corresponds to std::vector in C++
4176  */
4177 typedef struct LDKCVec_ChannelMonitorZ {
4178    /**
4179     * The elements in the array.
4180     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4181     */
4182    struct LDKChannelMonitor *data;
4183    /**
4184     * The number of elements pointed to by `data`.
4185     */
4186    uintptr_t datalen;
4187 } LDKCVec_ChannelMonitorZ;
4188
4189
4190
4191 /**
4192  * An update generated by the underlying Channel itself which contains some new information the
4193  * ChannelMonitor should be made aware of.
4194  */
4195 typedef struct MUST_USE_STRUCT LDKChannelMonitorUpdate {
4196    /**
4197     * A pointer to the opaque Rust object.
4198     * Nearly everywhere, inner must be non-null, however in places where
4199     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4200     */
4201    LDKnativeChannelMonitorUpdate *inner;
4202    /**
4203     * Indicates that this is the only struct which contains the same pointer.
4204     * Rust functions which take ownership of an object provided via an argument require
4205     * this to be true and invalidate the object pointed to by inner.
4206     */
4207    bool is_owned;
4208 } LDKChannelMonitorUpdate;
4209
4210 /**
4211  * The `Watch` trait defines behavior for watching on-chain activity pertaining to channels as
4212  * blocks are connected and disconnected.
4213  *
4214  * Each channel is associated with a [`ChannelMonitor`]. Implementations of this trait are
4215  * responsible for maintaining a set of monitors such that they can be updated accordingly as
4216  * channel state changes and HTLCs are resolved. See method documentation for specific
4217  * requirements.
4218  *
4219  * Implementations **must** ensure that updates are successfully applied and persisted upon method
4220  * completion. If an update fails with a [`PermanentFailure`], then it must immediately shut down
4221  * without taking any further action such as persisting the current state.
4222  *
4223  * If an implementation maintains multiple instances of a channel's monitor (e.g., by storing
4224  * backup copies), then it must ensure that updates are applied across all instances. Otherwise, it
4225  * could result in a revoked transaction being broadcast, allowing the counterparty to claim all
4226  * funds in the channel. See [`ChannelMonitorUpdateErr`] for more details about how to handle
4227  * multiple instances.
4228  *
4229  * [`ChannelMonitor`]: channelmonitor::ChannelMonitor
4230  * [`ChannelMonitorUpdateErr`]: channelmonitor::ChannelMonitorUpdateErr
4231  * [`PermanentFailure`]: channelmonitor::ChannelMonitorUpdateErr::PermanentFailure
4232  */
4233 typedef struct LDKWatch {
4234    /**
4235     * An opaque pointer which is passed to your function implementations as an argument.
4236     * This has no meaning in the LDK, and can be NULL or any other value.
4237     */
4238    void *this_arg;
4239    /**
4240     * Watches a channel identified by `funding_txo` using `monitor`.
4241     *
4242     * Implementations are responsible for watching the chain for the funding transaction along
4243     * with any spends of outputs returned by [`get_outputs_to_watch`]. In practice, this means
4244     * calling [`block_connected`] and [`block_disconnected`] on the monitor.
4245     *
4246     * [`get_outputs_to_watch`]: channelmonitor::ChannelMonitor::get_outputs_to_watch
4247     * [`block_connected`]: channelmonitor::ChannelMonitor::block_connected
4248     * [`block_disconnected`]: channelmonitor::ChannelMonitor::block_disconnected
4249     */
4250    struct LDKCResult_NoneChannelMonitorUpdateErrZ (*watch_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitor monitor);
4251    /**
4252     * Updates a channel identified by `funding_txo` by applying `update` to its monitor.
4253     *
4254     * Implementations must call [`update_monitor`] with the given update. See
4255     * [`ChannelMonitorUpdateErr`] for invariants around returning an error.
4256     *
4257     * [`update_monitor`]: channelmonitor::ChannelMonitor::update_monitor
4258     * [`ChannelMonitorUpdateErr`]: channelmonitor::ChannelMonitorUpdateErr
4259     */
4260    struct LDKCResult_NoneChannelMonitorUpdateErrZ (*update_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitorUpdate update);
4261    /**
4262     * Returns any monitor events since the last call. Subsequent calls must only return new
4263     * events.
4264     */
4265    struct LDKCVec_MonitorEventZ (*release_pending_monitor_events)(const void *this_arg);
4266    /**
4267     * Frees any resources associated with this object given its this_arg pointer.
4268     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
4269     */
4270    void (*free)(void *this_arg);
4271 } LDKWatch;
4272
4273 /**
4274  * An interface to send a transaction to the Bitcoin network.
4275  */
4276 typedef struct LDKBroadcasterInterface {
4277    /**
4278     * An opaque pointer which is passed to your function implementations as an argument.
4279     * This has no meaning in the LDK, and can be NULL or any other value.
4280     */
4281    void *this_arg;
4282    /**
4283     * Sends a transaction out to (hopefully) be mined.
4284     */
4285    void (*broadcast_transaction)(const void *this_arg, struct LDKTransaction tx);
4286    /**
4287     * Frees any resources associated with this object given its this_arg pointer.
4288     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
4289     */
4290    void (*free)(void *this_arg);
4291 } LDKBroadcasterInterface;
4292
4293 /**
4294  * A "slice" referencing some byte array. This is simply a length-tagged pointer which does not
4295  * own the memory pointed to by data.
4296  */
4297 typedef struct LDKu8slice {
4298    /**
4299     * A pointer to the byte buffer
4300     */
4301    const uint8_t *data;
4302    /**
4303     * The number of bytes pointed to by `data`.
4304     */
4305    uintptr_t datalen;
4306 } LDKu8slice;
4307
4308 /**
4309  * A trait to describe an object which can get user secrets and key material.
4310  */
4311 typedef struct LDKKeysInterface {
4312    /**
4313     * An opaque pointer which is passed to your function implementations as an argument.
4314     * This has no meaning in the LDK, and can be NULL or any other value.
4315     */
4316    void *this_arg;
4317    /**
4318     * Get node secret key (aka node_id or network_key).
4319     *
4320     * This method must return the same value each time it is called.
4321     */
4322    struct LDKSecretKey (*get_node_secret)(const void *this_arg);
4323    /**
4324     * Get a script pubkey which we send funds to when claiming on-chain contestable outputs.
4325     *
4326     * This method should return a different value each time it is called, to avoid linking
4327     * on-chain funds across channels as controlled to the same user.
4328     */
4329    struct LDKCVec_u8Z (*get_destination_script)(const void *this_arg);
4330    /**
4331     * Get a public key which we will send funds to (in the form of a P2WPKH output) when closing
4332     * a channel.
4333     *
4334     * This method should return a different value each time it is called, to avoid linking
4335     * on-chain funds across channels as controlled to the same user.
4336     */
4337    struct LDKPublicKey (*get_shutdown_pubkey)(const void *this_arg);
4338    /**
4339     * Get a new set of Sign for per-channel secrets. These MUST be unique even if you
4340     * restarted with some stale data!
4341     *
4342     * This method must return a different value each time it is called.
4343     */
4344    struct LDKSign (*get_channel_signer)(const void *this_arg, bool inbound, uint64_t channel_value_satoshis);
4345    /**
4346     * Gets a unique, cryptographically-secure, random 32 byte value. This is used for encrypting
4347     * onion packets and for temporary channel IDs. There is no requirement that these be
4348     * persisted anywhere, though they must be unique across restarts.
4349     *
4350     * This method must return a different value each time it is called.
4351     */
4352    struct LDKThirtyTwoBytes (*get_secure_random_bytes)(const void *this_arg);
4353    /**
4354     * Reads a `Signer` for this `KeysInterface` from the given input stream.
4355     * This is only called during deserialization of other objects which contain
4356     * `Sign`-implementing objects (ie `ChannelMonitor`s and `ChannelManager`s).
4357     * The bytes are exactly those which `<Self::Signer as Writeable>::write()` writes, and
4358     * contain no versioning scheme. You may wish to include your own version prefix and ensure
4359     * you've read all of the provided bytes to ensure no corruption occurred.
4360     */
4361    struct LDKCResult_SignDecodeErrorZ (*read_chan_signer)(const void *this_arg, struct LDKu8slice reader);
4362    /**
4363     * Sign an invoice's preimage (note that this is the preimage of the invoice, not the HTLC's
4364     * preimage). By parameterizing by the preimage instead of the hash, we allow implementors of
4365     * this trait to parse the invoice and make sure they're signing what they expect, rather than
4366     * blindly signing the hash.
4367     */
4368    struct LDKCResult_RecoverableSignatureNoneZ (*sign_invoice)(const void *this_arg, struct LDKCVec_u8Z invoice_preimage);
4369    /**
4370     * Frees any resources associated with this object given its this_arg pointer.
4371     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
4372     */
4373    void (*free)(void *this_arg);
4374 } LDKKeysInterface;
4375
4376 /**
4377  * A trait which should be implemented to provide feerate information on a number of time
4378  * horizons.
4379  *
4380  * Note that all of the functions implemented here *must* be reentrant-safe (obviously - they're
4381  * called from inside the library in response to chain events, P2P events, or timer events).
4382  */
4383 typedef struct LDKFeeEstimator {
4384    /**
4385     * An opaque pointer which is passed to your function implementations as an argument.
4386     * This has no meaning in the LDK, and can be NULL or any other value.
4387     */
4388    void *this_arg;
4389    /**
4390     * Gets estimated satoshis of fee required per 1000 Weight-Units.
4391     *
4392     * Must be no smaller than 253 (ie 1 satoshi-per-byte rounded up to ensure later round-downs
4393     * don't put us below 1 satoshi-per-byte).
4394     *
4395     * This translates to:
4396     *  * satoshis-per-byte * 250
4397     *  * ceil(satoshis-per-kbyte / 4)
4398     */
4399    uint32_t (*get_est_sat_per_1000_weight)(const void *this_arg, enum LDKConfirmationTarget confirmation_target);
4400    /**
4401     * Frees any resources associated with this object given its this_arg pointer.
4402     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
4403     */
4404    void (*free)(void *this_arg);
4405 } LDKFeeEstimator;
4406
4407 /**
4408  * A trait encapsulating the operations required of a logger
4409  */
4410 typedef struct LDKLogger {
4411    /**
4412     * An opaque pointer which is passed to your function implementations as an argument.
4413     * This has no meaning in the LDK, and can be NULL or any other value.
4414     */
4415    void *this_arg;
4416    /**
4417     * Logs the `Record`
4418     */
4419    void (*log)(const void *this_arg, const char *record);
4420    /**
4421     * Frees any resources associated with this object given its this_arg pointer.
4422     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
4423     */
4424    void (*free)(void *this_arg);
4425 } LDKLogger;
4426
4427
4428
4429 /**
4430  * Manager which keeps track of a number of channels and sends messages to the appropriate
4431  * channel, also tracking HTLC preimages and forwarding onion packets appropriately.
4432  *
4433  * Implements ChannelMessageHandler, handling the multi-channel parts and passing things through
4434  * to individual Channels.
4435  *
4436  * Implements Writeable to write out all channel state to disk. Implies peer_disconnected() for
4437  * all peers during write/read (though does not modify this instance, only the instance being
4438  * serialized). This will result in any channels which have not yet exchanged funding_created (ie
4439  * called funding_transaction_generated for outbound channels).
4440  *
4441  * Note that you can be a bit lazier about writing out ChannelManager than you can be with
4442  * ChannelMonitors. With ChannelMonitors you MUST write each monitor update out to disk before
4443  * returning from chain::Watch::watch_/update_channel, with ChannelManagers, writing updates
4444  * happens out-of-band (and will prevent any other ChannelManager operations from occurring during
4445  * the serialization process). If the deserialized version is out-of-date compared to the
4446  * ChannelMonitors passed by reference to read(), those channels will be force-closed based on the
4447  * ChannelMonitor state and no funds will be lost (mod on-chain transaction fees).
4448  *
4449  * Note that the deserializer is only implemented for (BlockHash, ChannelManager), which
4450  * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along
4451  * the \"reorg path\" (ie call block_disconnected() until you get to a common block and then call
4452  * block_connected() to step towards your best block) upon deserialization before using the
4453  * object!
4454  *
4455  * Note that ChannelManager is responsible for tracking liveness of its channels and generating
4456  * ChannelUpdate messages informing peers that the channel is temporarily disabled. To avoid
4457  * spam due to quick disconnection/reconnection, updates are not sent until the channel has been
4458  * offline for a full minute. In order to track this, you must call
4459  * timer_tick_occurred roughly once per minute, though it doesn't have to be perfect.
4460  *
4461  * Rather than using a plain ChannelManager, it is preferable to use either a SimpleArcChannelManager
4462  * a SimpleRefChannelManager, for conciseness. See their documentation for more details, but
4463  * essentially you should default to using a SimpleRefChannelManager, and use a
4464  * SimpleArcChannelManager when you require a ChannelManager with a static lifetime, such as when
4465  * you're using lightning-net-tokio.
4466  */
4467 typedef struct MUST_USE_STRUCT LDKChannelManager {
4468    /**
4469     * A pointer to the opaque Rust object.
4470     * Nearly everywhere, inner must be non-null, however in places where
4471     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4472     */
4473    LDKnativeChannelManager *inner;
4474    /**
4475     * Indicates that this is the only struct which contains the same pointer.
4476     * Rust functions which take ownership of an object provided via an argument require
4477     * this to be true and invalidate the object pointed to by inner.
4478     */
4479    bool is_owned;
4480 } LDKChannelManager;
4481
4482 /**
4483  * A tuple of 2 elements. See the individual fields for the types contained.
4484  */
4485 typedef struct LDKC2Tuple_BlockHashChannelManagerZ {
4486    /**
4487     * The element at position 0
4488     */
4489    struct LDKThirtyTwoBytes a;
4490    /**
4491     * The element at position 1
4492     */
4493    struct LDKChannelManager b;
4494 } LDKC2Tuple_BlockHashChannelManagerZ;
4495
4496 /**
4497  * The contents of CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ
4498  */
4499 typedef union LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
4500    /**
4501     * A pointer to the contents in the success state.
4502     * Reading from this pointer when `result_ok` is not set is undefined.
4503     */
4504    struct LDKC2Tuple_BlockHashChannelManagerZ *result;
4505    /**
4506     * A pointer to the contents in the error state.
4507     * Reading from this pointer when `result_ok` is set is undefined.
4508     */
4509    struct LDKDecodeError *err;
4510 } LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr;
4511
4512 /**
4513  * A CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents the result of a fallible operation,
4514  * containing a crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
4515  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4516  */
4517 typedef struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
4518    /**
4519     * The contents of this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ, accessible via either
4520     * `err` or `result` depending on the state of `result_ok`.
4521     */
4522    union LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr contents;
4523    /**
4524     * Whether this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents a success state.
4525     */
4526    bool result_ok;
4527 } LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ;
4528
4529
4530
4531 /**
4532  * Options which apply on a per-channel basis and may change at runtime or based on negotiation
4533  * with our counterparty.
4534  */
4535 typedef struct MUST_USE_STRUCT LDKChannelConfig {
4536    /**
4537     * A pointer to the opaque Rust object.
4538     * Nearly everywhere, inner must be non-null, however in places where
4539     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4540     */
4541    LDKnativeChannelConfig *inner;
4542    /**
4543     * Indicates that this is the only struct which contains the same pointer.
4544     * Rust functions which take ownership of an object provided via an argument require
4545     * this to be true and invalidate the object pointed to by inner.
4546     */
4547    bool is_owned;
4548 } LDKChannelConfig;
4549
4550 /**
4551  * The contents of CResult_ChannelConfigDecodeErrorZ
4552  */
4553 typedef union LDKCResult_ChannelConfigDecodeErrorZPtr {
4554    /**
4555     * A pointer to the contents in the success state.
4556     * Reading from this pointer when `result_ok` is not set is undefined.
4557     */
4558    struct LDKChannelConfig *result;
4559    /**
4560     * A pointer to the contents in the error state.
4561     * Reading from this pointer when `result_ok` is set is undefined.
4562     */
4563    struct LDKDecodeError *err;
4564 } LDKCResult_ChannelConfigDecodeErrorZPtr;
4565
4566 /**
4567  * A CResult_ChannelConfigDecodeErrorZ represents the result of a fallible operation,
4568  * containing a crate::lightning::util::config::ChannelConfig on success and a crate::lightning::ln::msgs::DecodeError on failure.
4569  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4570  */
4571 typedef struct LDKCResult_ChannelConfigDecodeErrorZ {
4572    /**
4573     * The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either
4574     * `err` or `result` depending on the state of `result_ok`.
4575     */
4576    union LDKCResult_ChannelConfigDecodeErrorZPtr contents;
4577    /**
4578     * Whether this CResult_ChannelConfigDecodeErrorZ represents a success state.
4579     */
4580    bool result_ok;
4581 } LDKCResult_ChannelConfigDecodeErrorZ;
4582
4583 /**
4584  * The contents of CResult_OutPointDecodeErrorZ
4585  */
4586 typedef union LDKCResult_OutPointDecodeErrorZPtr {
4587    /**
4588     * A pointer to the contents in the success state.
4589     * Reading from this pointer when `result_ok` is not set is undefined.
4590     */
4591    struct LDKOutPoint *result;
4592    /**
4593     * A pointer to the contents in the error state.
4594     * Reading from this pointer when `result_ok` is set is undefined.
4595     */
4596    struct LDKDecodeError *err;
4597 } LDKCResult_OutPointDecodeErrorZPtr;
4598
4599 /**
4600  * A CResult_OutPointDecodeErrorZ represents the result of a fallible operation,
4601  * containing a crate::lightning::chain::transaction::OutPoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
4602  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4603  */
4604 typedef struct LDKCResult_OutPointDecodeErrorZ {
4605    /**
4606     * The contents of this CResult_OutPointDecodeErrorZ, accessible via either
4607     * `err` or `result` depending on the state of `result_ok`.
4608     */
4609    union LDKCResult_OutPointDecodeErrorZPtr contents;
4610    /**
4611     * Whether this CResult_OutPointDecodeErrorZ represents a success state.
4612     */
4613    bool result_ok;
4614 } LDKCResult_OutPointDecodeErrorZ;
4615
4616 /**
4617  * The contents of CResult_SiPrefixNoneZ
4618  */
4619 typedef union LDKCResult_SiPrefixNoneZPtr {
4620    /**
4621     * A pointer to the contents in the success state.
4622     * Reading from this pointer when `result_ok` is not set is undefined.
4623     */
4624    enum LDKSiPrefix *result;
4625    /**
4626     * Note that this value is always NULL, as there are no contents in the Err variant
4627     */
4628    void *err;
4629 } LDKCResult_SiPrefixNoneZPtr;
4630
4631 /**
4632  * A CResult_SiPrefixNoneZ represents the result of a fallible operation,
4633  * containing a crate::lightning_invoice::SiPrefix on success and a () on failure.
4634  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4635  */
4636 typedef struct LDKCResult_SiPrefixNoneZ {
4637    /**
4638     * The contents of this CResult_SiPrefixNoneZ, accessible via either
4639     * `err` or `result` depending on the state of `result_ok`.
4640     */
4641    union LDKCResult_SiPrefixNoneZPtr contents;
4642    /**
4643     * Whether this CResult_SiPrefixNoneZ represents a success state.
4644     */
4645    bool result_ok;
4646 } LDKCResult_SiPrefixNoneZ;
4647
4648
4649
4650 /**
4651  * Represents a syntactically and semantically correct lightning BOLT11 invoice.
4652  *
4653  * There are three ways to construct an `Invoice`:
4654  *  1. using `InvoiceBuilder`
4655  *  2. using `Invoice::from_signed(SignedRawInvoice)`
4656  *  3. using `str::parse::<Invoice>(&str)`
4657  */
4658 typedef struct MUST_USE_STRUCT LDKInvoice {
4659    /**
4660     * A pointer to the opaque Rust object.
4661     * Nearly everywhere, inner must be non-null, however in places where
4662     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4663     */
4664    LDKnativeInvoice *inner;
4665    /**
4666     * Indicates that this is the only struct which contains the same pointer.
4667     * Rust functions which take ownership of an object provided via an argument require
4668     * this to be true and invalidate the object pointed to by inner.
4669     */
4670    bool is_owned;
4671 } LDKInvoice;
4672
4673 /**
4674  * The contents of CResult_InvoiceNoneZ
4675  */
4676 typedef union LDKCResult_InvoiceNoneZPtr {
4677    /**
4678     * A pointer to the contents in the success state.
4679     * Reading from this pointer when `result_ok` is not set is undefined.
4680     */
4681    struct LDKInvoice *result;
4682    /**
4683     * Note that this value is always NULL, as there are no contents in the Err variant
4684     */
4685    void *err;
4686 } LDKCResult_InvoiceNoneZPtr;
4687
4688 /**
4689  * A CResult_InvoiceNoneZ represents the result of a fallible operation,
4690  * containing a crate::lightning_invoice::Invoice on success and a () on failure.
4691  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4692  */
4693 typedef struct LDKCResult_InvoiceNoneZ {
4694    /**
4695     * The contents of this CResult_InvoiceNoneZ, accessible via either
4696     * `err` or `result` depending on the state of `result_ok`.
4697     */
4698    union LDKCResult_InvoiceNoneZPtr contents;
4699    /**
4700     * Whether this CResult_InvoiceNoneZ represents a success state.
4701     */
4702    bool result_ok;
4703 } LDKCResult_InvoiceNoneZ;
4704
4705
4706
4707 /**
4708  * Represents a signed `RawInvoice` with cached hash. The signature is not checked and may be
4709  * invalid.
4710  *
4711  * # Invariants
4712  * The hash has to be either from the deserialized invoice or from the serialized `raw_invoice`.
4713  */
4714 typedef struct MUST_USE_STRUCT LDKSignedRawInvoice {
4715    /**
4716     * A pointer to the opaque Rust object.
4717     * Nearly everywhere, inner must be non-null, however in places where
4718     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4719     */
4720    LDKnativeSignedRawInvoice *inner;
4721    /**
4722     * Indicates that this is the only struct which contains the same pointer.
4723     * Rust functions which take ownership of an object provided via an argument require
4724     * this to be true and invalidate the object pointed to by inner.
4725     */
4726    bool is_owned;
4727 } LDKSignedRawInvoice;
4728
4729 /**
4730  * The contents of CResult_SignedRawInvoiceNoneZ
4731  */
4732 typedef union LDKCResult_SignedRawInvoiceNoneZPtr {
4733    /**
4734     * A pointer to the contents in the success state.
4735     * Reading from this pointer when `result_ok` is not set is undefined.
4736     */
4737    struct LDKSignedRawInvoice *result;
4738    /**
4739     * Note that this value is always NULL, as there are no contents in the Err variant
4740     */
4741    void *err;
4742 } LDKCResult_SignedRawInvoiceNoneZPtr;
4743
4744 /**
4745  * A CResult_SignedRawInvoiceNoneZ represents the result of a fallible operation,
4746  * containing a crate::lightning_invoice::SignedRawInvoice on success and a () on failure.
4747  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4748  */
4749 typedef struct LDKCResult_SignedRawInvoiceNoneZ {
4750    /**
4751     * The contents of this CResult_SignedRawInvoiceNoneZ, accessible via either
4752     * `err` or `result` depending on the state of `result_ok`.
4753     */
4754    union LDKCResult_SignedRawInvoiceNoneZPtr contents;
4755    /**
4756     * Whether this CResult_SignedRawInvoiceNoneZ represents a success state.
4757     */
4758    bool result_ok;
4759 } LDKCResult_SignedRawInvoiceNoneZ;
4760
4761
4762
4763 /**
4764  * Represents an syntactically correct Invoice for a payment on the lightning network,
4765  * but without the signature information.
4766  * De- and encoding should not lead to information loss but may lead to different hashes.
4767  *
4768  * For methods without docs see the corresponding methods in `Invoice`.
4769  */
4770 typedef struct MUST_USE_STRUCT LDKRawInvoice {
4771    /**
4772     * A pointer to the opaque Rust object.
4773     * Nearly everywhere, inner must be non-null, however in places where
4774     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4775     */
4776    LDKnativeRawInvoice *inner;
4777    /**
4778     * Indicates that this is the only struct which contains the same pointer.
4779     * Rust functions which take ownership of an object provided via an argument require
4780     * this to be true and invalidate the object pointed to by inner.
4781     */
4782    bool is_owned;
4783 } LDKRawInvoice;
4784
4785
4786
4787 /**
4788  * Recoverable signature
4789  */
4790 typedef struct MUST_USE_STRUCT LDKInvoiceSignature {
4791    /**
4792     * A pointer to the opaque Rust object.
4793     * Nearly everywhere, inner must be non-null, however in places where
4794     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4795     */
4796    LDKnativeInvoiceSignature *inner;
4797    /**
4798     * Indicates that this is the only struct which contains the same pointer.
4799     * Rust functions which take ownership of an object provided via an argument require
4800     * this to be true and invalidate the object pointed to by inner.
4801     */
4802    bool is_owned;
4803 } LDKInvoiceSignature;
4804
4805 /**
4806  * A tuple of 3 elements. See the individual fields for the types contained.
4807  */
4808 typedef struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ {
4809    /**
4810     * The element at position 0
4811     */
4812    struct LDKRawInvoice a;
4813    /**
4814     * The element at position 1
4815     */
4816    struct LDKThirtyTwoBytes b;
4817    /**
4818     * The element at position 2
4819     */
4820    struct LDKInvoiceSignature c;
4821 } LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ;
4822
4823
4824
4825 /**
4826  * Payee public key
4827  */
4828 typedef struct MUST_USE_STRUCT LDKPayeePubKey {
4829    /**
4830     * A pointer to the opaque Rust object.
4831     * Nearly everywhere, inner must be non-null, however in places where
4832     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4833     */
4834    LDKnativePayeePubKey *inner;
4835    /**
4836     * Indicates that this is the only struct which contains the same pointer.
4837     * Rust functions which take ownership of an object provided via an argument require
4838     * this to be true and invalidate the object pointed to by inner.
4839     */
4840    bool is_owned;
4841 } LDKPayeePubKey;
4842
4843 /**
4844  * The contents of CResult_PayeePubKeyErrorZ
4845  */
4846 typedef union LDKCResult_PayeePubKeyErrorZPtr {
4847    /**
4848     * A pointer to the contents in the success state.
4849     * Reading from this pointer when `result_ok` is not set is undefined.
4850     */
4851    struct LDKPayeePubKey *result;
4852    /**
4853     * A pointer to the contents in the error state.
4854     * Reading from this pointer when `result_ok` is set is undefined.
4855     */
4856    enum LDKSecp256k1Error *err;
4857 } LDKCResult_PayeePubKeyErrorZPtr;
4858
4859 /**
4860  * A CResult_PayeePubKeyErrorZ represents the result of a fallible operation,
4861  * containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure.
4862  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4863  */
4864 typedef struct LDKCResult_PayeePubKeyErrorZ {
4865    /**
4866     * The contents of this CResult_PayeePubKeyErrorZ, accessible via either
4867     * `err` or `result` depending on the state of `result_ok`.
4868     */
4869    union LDKCResult_PayeePubKeyErrorZPtr contents;
4870    /**
4871     * Whether this CResult_PayeePubKeyErrorZ represents a success state.
4872     */
4873    bool result_ok;
4874 } LDKCResult_PayeePubKeyErrorZ;
4875
4876
4877
4878 /**
4879  * Private routing information
4880  *
4881  * # Invariants
4882  * The encoded route has to be <1024 5bit characters long (<=639 bytes or <=12 hops)
4883  *
4884  */
4885 typedef struct MUST_USE_STRUCT LDKPrivateRoute {
4886    /**
4887     * A pointer to the opaque Rust object.
4888     * Nearly everywhere, inner must be non-null, however in places where
4889     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4890     */
4891    LDKnativePrivateRoute *inner;
4892    /**
4893     * Indicates that this is the only struct which contains the same pointer.
4894     * Rust functions which take ownership of an object provided via an argument require
4895     * this to be true and invalidate the object pointed to by inner.
4896     */
4897    bool is_owned;
4898 } LDKPrivateRoute;
4899
4900 /**
4901  * A dynamically-allocated array of crate::lightning_invoice::PrivateRoutes of arbitrary size.
4902  * This corresponds to std::vector in C++
4903  */
4904 typedef struct LDKCVec_PrivateRouteZ {
4905    /**
4906     * The elements in the array.
4907     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4908     */
4909    struct LDKPrivateRoute *data;
4910    /**
4911     * The number of elements pointed to by `data`.
4912     */
4913    uintptr_t datalen;
4914 } LDKCVec_PrivateRouteZ;
4915
4916
4917
4918 /**
4919  * A timestamp that refers to a date after 1 January 1970 which means its representation as UNIX
4920  * timestamp is positive.
4921  *
4922  * # Invariants
4923  * The UNIX timestamp representing the stored time has to be positive and small enough so that
4924  * a `EpiryTime` can be added to it without an overflow.
4925  */
4926 typedef struct MUST_USE_STRUCT LDKPositiveTimestamp {
4927    /**
4928     * A pointer to the opaque Rust object.
4929     * Nearly everywhere, inner must be non-null, however in places where
4930     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4931     */
4932    LDKnativePositiveTimestamp *inner;
4933    /**
4934     * Indicates that this is the only struct which contains the same pointer.
4935     * Rust functions which take ownership of an object provided via an argument require
4936     * this to be true and invalidate the object pointed to by inner.
4937     */
4938    bool is_owned;
4939 } LDKPositiveTimestamp;
4940
4941 /**
4942  * The contents of CResult_PositiveTimestampCreationErrorZ
4943  */
4944 typedef union LDKCResult_PositiveTimestampCreationErrorZPtr {
4945    /**
4946     * A pointer to the contents in the success state.
4947     * Reading from this pointer when `result_ok` is not set is undefined.
4948     */
4949    struct LDKPositiveTimestamp *result;
4950    /**
4951     * A pointer to the contents in the error state.
4952     * Reading from this pointer when `result_ok` is set is undefined.
4953     */
4954    enum LDKCreationError *err;
4955 } LDKCResult_PositiveTimestampCreationErrorZPtr;
4956
4957 /**
4958  * A CResult_PositiveTimestampCreationErrorZ represents the result of a fallible operation,
4959  * containing a crate::lightning_invoice::PositiveTimestamp on success and a crate::lightning_invoice::CreationError on failure.
4960  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4961  */
4962 typedef struct LDKCResult_PositiveTimestampCreationErrorZ {
4963    /**
4964     * The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either
4965     * `err` or `result` depending on the state of `result_ok`.
4966     */
4967    union LDKCResult_PositiveTimestampCreationErrorZPtr contents;
4968    /**
4969     * Whether this CResult_PositiveTimestampCreationErrorZ represents a success state.
4970     */
4971    bool result_ok;
4972 } LDKCResult_PositiveTimestampCreationErrorZ;
4973
4974 /**
4975  * The contents of CResult_NoneSemanticErrorZ
4976  */
4977 typedef union LDKCResult_NoneSemanticErrorZPtr {
4978    /**
4979     * Note that this value is always NULL, as there are no contents in the OK variant
4980     */
4981    void *result;
4982    /**
4983     * A pointer to the contents in the error state.
4984     * Reading from this pointer when `result_ok` is set is undefined.
4985     */
4986    enum LDKSemanticError *err;
4987 } LDKCResult_NoneSemanticErrorZPtr;
4988
4989 /**
4990  * A CResult_NoneSemanticErrorZ represents the result of a fallible operation,
4991  * containing a () on success and a crate::lightning_invoice::SemanticError on failure.
4992  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4993  */
4994 typedef struct LDKCResult_NoneSemanticErrorZ {
4995    /**
4996     * The contents of this CResult_NoneSemanticErrorZ, accessible via either
4997     * `err` or `result` depending on the state of `result_ok`.
4998     */
4999    union LDKCResult_NoneSemanticErrorZPtr contents;
5000    /**
5001     * Whether this CResult_NoneSemanticErrorZ represents a success state.
5002     */
5003    bool result_ok;
5004 } LDKCResult_NoneSemanticErrorZ;
5005
5006 /**
5007  * The contents of CResult_InvoiceSemanticErrorZ
5008  */
5009 typedef union LDKCResult_InvoiceSemanticErrorZPtr {
5010    /**
5011     * A pointer to the contents in the success state.
5012     * Reading from this pointer when `result_ok` is not set is undefined.
5013     */
5014    struct LDKInvoice *result;
5015    /**
5016     * A pointer to the contents in the error state.
5017     * Reading from this pointer when `result_ok` is set is undefined.
5018     */
5019    enum LDKSemanticError *err;
5020 } LDKCResult_InvoiceSemanticErrorZPtr;
5021
5022 /**
5023  * A CResult_InvoiceSemanticErrorZ represents the result of a fallible operation,
5024  * containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SemanticError on failure.
5025  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5026  */
5027 typedef struct LDKCResult_InvoiceSemanticErrorZ {
5028    /**
5029     * The contents of this CResult_InvoiceSemanticErrorZ, accessible via either
5030     * `err` or `result` depending on the state of `result_ok`.
5031     */
5032    union LDKCResult_InvoiceSemanticErrorZPtr contents;
5033    /**
5034     * Whether this CResult_InvoiceSemanticErrorZ represents a success state.
5035     */
5036    bool result_ok;
5037 } LDKCResult_InvoiceSemanticErrorZ;
5038
5039
5040
5041 /**
5042  * Description string
5043  *
5044  * # Invariants
5045  * The description can be at most 639 __bytes__ long
5046  */
5047 typedef struct MUST_USE_STRUCT LDKDescription {
5048    /**
5049     * A pointer to the opaque Rust object.
5050     * Nearly everywhere, inner must be non-null, however in places where
5051     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5052     */
5053    LDKnativeDescription *inner;
5054    /**
5055     * Indicates that this is the only struct which contains the same pointer.
5056     * Rust functions which take ownership of an object provided via an argument require
5057     * this to be true and invalidate the object pointed to by inner.
5058     */
5059    bool is_owned;
5060 } LDKDescription;
5061
5062 /**
5063  * The contents of CResult_DescriptionCreationErrorZ
5064  */
5065 typedef union LDKCResult_DescriptionCreationErrorZPtr {
5066    /**
5067     * A pointer to the contents in the success state.
5068     * Reading from this pointer when `result_ok` is not set is undefined.
5069     */
5070    struct LDKDescription *result;
5071    /**
5072     * A pointer to the contents in the error state.
5073     * Reading from this pointer when `result_ok` is set is undefined.
5074     */
5075    enum LDKCreationError *err;
5076 } LDKCResult_DescriptionCreationErrorZPtr;
5077
5078 /**
5079  * A CResult_DescriptionCreationErrorZ represents the result of a fallible operation,
5080  * containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure.
5081  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5082  */
5083 typedef struct LDKCResult_DescriptionCreationErrorZ {
5084    /**
5085     * The contents of this CResult_DescriptionCreationErrorZ, accessible via either
5086     * `err` or `result` depending on the state of `result_ok`.
5087     */
5088    union LDKCResult_DescriptionCreationErrorZPtr contents;
5089    /**
5090     * Whether this CResult_DescriptionCreationErrorZ represents a success state.
5091     */
5092    bool result_ok;
5093 } LDKCResult_DescriptionCreationErrorZ;
5094
5095
5096
5097 /**
5098  * Positive duration that defines when (relatively to the timestamp) in the future the invoice
5099  * expires
5100  *
5101  * # Invariants
5102  * The number of seconds this expiry time represents has to be in the range
5103  * `0...(SYSTEM_TIME_MAX_UNIX_TIMESTAMP - MAX_EXPIRY_TIME)` to avoid overflows when adding it to a
5104  * timestamp
5105  */
5106 typedef struct MUST_USE_STRUCT LDKExpiryTime {
5107    /**
5108     * A pointer to the opaque Rust object.
5109     * Nearly everywhere, inner must be non-null, however in places where
5110     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5111     */
5112    LDKnativeExpiryTime *inner;
5113    /**
5114     * Indicates that this is the only struct which contains the same pointer.
5115     * Rust functions which take ownership of an object provided via an argument require
5116     * this to be true and invalidate the object pointed to by inner.
5117     */
5118    bool is_owned;
5119 } LDKExpiryTime;
5120
5121 /**
5122  * The contents of CResult_ExpiryTimeCreationErrorZ
5123  */
5124 typedef union LDKCResult_ExpiryTimeCreationErrorZPtr {
5125    /**
5126     * A pointer to the contents in the success state.
5127     * Reading from this pointer when `result_ok` is not set is undefined.
5128     */
5129    struct LDKExpiryTime *result;
5130    /**
5131     * A pointer to the contents in the error state.
5132     * Reading from this pointer when `result_ok` is set is undefined.
5133     */
5134    enum LDKCreationError *err;
5135 } LDKCResult_ExpiryTimeCreationErrorZPtr;
5136
5137 /**
5138  * A CResult_ExpiryTimeCreationErrorZ represents the result of a fallible operation,
5139  * containing a crate::lightning_invoice::ExpiryTime on success and a crate::lightning_invoice::CreationError on failure.
5140  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5141  */
5142 typedef struct LDKCResult_ExpiryTimeCreationErrorZ {
5143    /**
5144     * The contents of this CResult_ExpiryTimeCreationErrorZ, accessible via either
5145     * `err` or `result` depending on the state of `result_ok`.
5146     */
5147    union LDKCResult_ExpiryTimeCreationErrorZPtr contents;
5148    /**
5149     * Whether this CResult_ExpiryTimeCreationErrorZ represents a success state.
5150     */
5151    bool result_ok;
5152 } LDKCResult_ExpiryTimeCreationErrorZ;
5153
5154 /**
5155  * The contents of CResult_PrivateRouteCreationErrorZ
5156  */
5157 typedef union LDKCResult_PrivateRouteCreationErrorZPtr {
5158    /**
5159     * A pointer to the contents in the success state.
5160     * Reading from this pointer when `result_ok` is not set is undefined.
5161     */
5162    struct LDKPrivateRoute *result;
5163    /**
5164     * A pointer to the contents in the error state.
5165     * Reading from this pointer when `result_ok` is set is undefined.
5166     */
5167    enum LDKCreationError *err;
5168 } LDKCResult_PrivateRouteCreationErrorZPtr;
5169
5170 /**
5171  * A CResult_PrivateRouteCreationErrorZ represents the result of a fallible operation,
5172  * containing a crate::lightning_invoice::PrivateRoute on success and a crate::lightning_invoice::CreationError on failure.
5173  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5174  */
5175 typedef struct LDKCResult_PrivateRouteCreationErrorZ {
5176    /**
5177     * The contents of this CResult_PrivateRouteCreationErrorZ, accessible via either
5178     * `err` or `result` depending on the state of `result_ok`.
5179     */
5180    union LDKCResult_PrivateRouteCreationErrorZPtr contents;
5181    /**
5182     * Whether this CResult_PrivateRouteCreationErrorZ represents a success state.
5183     */
5184    bool result_ok;
5185 } LDKCResult_PrivateRouteCreationErrorZ;
5186
5187 /**
5188  * The contents of CResult_StringErrorZ
5189  */
5190 typedef union LDKCResult_StringErrorZPtr {
5191    /**
5192     * A pointer to the contents in the success state.
5193     * Reading from this pointer when `result_ok` is not set is undefined.
5194     */
5195    struct LDKStr *result;
5196    /**
5197     * A pointer to the contents in the error state.
5198     * Reading from this pointer when `result_ok` is set is undefined.
5199     */
5200    enum LDKSecp256k1Error *err;
5201 } LDKCResult_StringErrorZPtr;
5202
5203 /**
5204  * A CResult_StringErrorZ represents the result of a fallible operation,
5205  * containing a crate::c_types::Str on success and a crate::c_types::Secp256k1Error on failure.
5206  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5207  */
5208 typedef struct LDKCResult_StringErrorZ {
5209    /**
5210     * The contents of this CResult_StringErrorZ, accessible via either
5211     * `err` or `result` depending on the state of `result_ok`.
5212     */
5213    union LDKCResult_StringErrorZPtr contents;
5214    /**
5215     * Whether this CResult_StringErrorZ represents a success state.
5216     */
5217    bool result_ok;
5218 } LDKCResult_StringErrorZ;
5219
5220 /**
5221  * The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
5222  */
5223 typedef union LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr {
5224    /**
5225     * A pointer to the contents in the success state.
5226     * Reading from this pointer when `result_ok` is not set is undefined.
5227     */
5228    struct LDKChannelMonitorUpdate *result;
5229    /**
5230     * A pointer to the contents in the error state.
5231     * Reading from this pointer when `result_ok` is set is undefined.
5232     */
5233    struct LDKDecodeError *err;
5234 } LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr;
5235
5236 /**
5237  * A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
5238  * containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
5239  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5240  */
5241 typedef struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ {
5242    /**
5243     * The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
5244     * `err` or `result` depending on the state of `result_ok`.
5245     */
5246    union LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr contents;
5247    /**
5248     * Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
5249     */
5250    bool result_ok;
5251 } LDKCResult_ChannelMonitorUpdateDecodeErrorZ;
5252
5253 /**
5254  * The contents of CResult_HTLCUpdateDecodeErrorZ
5255  */
5256 typedef union LDKCResult_HTLCUpdateDecodeErrorZPtr {
5257    /**
5258     * A pointer to the contents in the success state.
5259     * Reading from this pointer when `result_ok` is not set is undefined.
5260     */
5261    struct LDKHTLCUpdate *result;
5262    /**
5263     * A pointer to the contents in the error state.
5264     * Reading from this pointer when `result_ok` is set is undefined.
5265     */
5266    struct LDKDecodeError *err;
5267 } LDKCResult_HTLCUpdateDecodeErrorZPtr;
5268
5269 /**
5270  * A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
5271  * containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
5272  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5273  */
5274 typedef struct LDKCResult_HTLCUpdateDecodeErrorZ {
5275    /**
5276     * The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
5277     * `err` or `result` depending on the state of `result_ok`.
5278     */
5279    union LDKCResult_HTLCUpdateDecodeErrorZPtr contents;
5280    /**
5281     * Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
5282     */
5283    bool result_ok;
5284 } LDKCResult_HTLCUpdateDecodeErrorZ;
5285
5286
5287
5288 /**
5289  * General Err type for ChannelMonitor actions. Generally, this implies that the data provided is
5290  * inconsistent with the ChannelMonitor being called. eg for ChannelMonitor::update_monitor this
5291  * means you tried to update a monitor for a different channel or the ChannelMonitorUpdate was
5292  * corrupted.
5293  * Contains a developer-readable error message.
5294  */
5295 typedef struct MUST_USE_STRUCT LDKMonitorUpdateError {
5296    /**
5297     * A pointer to the opaque Rust object.
5298     * Nearly everywhere, inner must be non-null, however in places where
5299     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5300     */
5301    LDKnativeMonitorUpdateError *inner;
5302    /**
5303     * Indicates that this is the only struct which contains the same pointer.
5304     * Rust functions which take ownership of an object provided via an argument require
5305     * this to be true and invalidate the object pointed to by inner.
5306     */
5307    bool is_owned;
5308 } LDKMonitorUpdateError;
5309
5310 /**
5311  * The contents of CResult_NoneMonitorUpdateErrorZ
5312  */
5313 typedef union LDKCResult_NoneMonitorUpdateErrorZPtr {
5314    /**
5315     * Note that this value is always NULL, as there are no contents in the OK variant
5316     */
5317    void *result;
5318    /**
5319     * A pointer to the contents in the error state.
5320     * Reading from this pointer when `result_ok` is set is undefined.
5321     */
5322    struct LDKMonitorUpdateError *err;
5323 } LDKCResult_NoneMonitorUpdateErrorZPtr;
5324
5325 /**
5326  * A CResult_NoneMonitorUpdateErrorZ represents the result of a fallible operation,
5327  * containing a () on success and a crate::lightning::chain::channelmonitor::MonitorUpdateError on failure.
5328  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5329  */
5330 typedef struct LDKCResult_NoneMonitorUpdateErrorZ {
5331    /**
5332     * The contents of this CResult_NoneMonitorUpdateErrorZ, accessible via either
5333     * `err` or `result` depending on the state of `result_ok`.
5334     */
5335    union LDKCResult_NoneMonitorUpdateErrorZPtr contents;
5336    /**
5337     * Whether this CResult_NoneMonitorUpdateErrorZ represents a success state.
5338     */
5339    bool result_ok;
5340 } LDKCResult_NoneMonitorUpdateErrorZ;
5341
5342 /**
5343  * A tuple of 2 elements. See the individual fields for the types contained.
5344  */
5345 typedef struct LDKC2Tuple_OutPointScriptZ {
5346    /**
5347     * The element at position 0
5348     */
5349    struct LDKOutPoint a;
5350    /**
5351     * The element at position 1
5352     */
5353    struct LDKCVec_u8Z b;
5354 } LDKC2Tuple_OutPointScriptZ;
5355
5356 /**
5357  * A tuple of 2 elements. See the individual fields for the types contained.
5358  */
5359 typedef struct LDKC2Tuple_u32ScriptZ {
5360    /**
5361     * The element at position 0
5362     */
5363    uint32_t a;
5364    /**
5365     * The element at position 1
5366     */
5367    struct LDKCVec_u8Z b;
5368 } LDKC2Tuple_u32ScriptZ;
5369
5370 /**
5371  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size.
5372  * This corresponds to std::vector in C++
5373  */
5374 typedef struct LDKCVec_C2Tuple_u32ScriptZZ {
5375    /**
5376     * The elements in the array.
5377     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5378     */
5379    struct LDKC2Tuple_u32ScriptZ *data;
5380    /**
5381     * The number of elements pointed to by `data`.
5382     */
5383    uintptr_t datalen;
5384 } LDKCVec_C2Tuple_u32ScriptZZ;
5385
5386 /**
5387  * A tuple of 2 elements. See the individual fields for the types contained.
5388  */
5389 typedef struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
5390    /**
5391     * The element at position 0
5392     */
5393    struct LDKThirtyTwoBytes a;
5394    /**
5395     * The element at position 1
5396     */
5397    struct LDKCVec_C2Tuple_u32ScriptZZ b;
5398 } LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ;
5399
5400 /**
5401  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size.
5402  * This corresponds to std::vector in C++
5403  */
5404 typedef struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
5405    /**
5406     * The elements in the array.
5407     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5408     */
5409    struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *data;
5410    /**
5411     * The number of elements pointed to by `data`.
5412     */
5413    uintptr_t datalen;
5414 } LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ;
5415
5416 /**
5417  * Some information provided on receipt of payment depends on whether the payment received is a
5418  * spontaneous payment or a \"conventional\" lightning payment that's paying an invoice.
5419  */
5420 typedef enum LDKPaymentPurpose_Tag {
5421    /**
5422     * Information for receiving a payment that we generated an invoice for.
5423     */
5424    LDKPaymentPurpose_InvoicePayment,
5425    /**
5426     * Because this is a spontaneous payment, the payer generated their own preimage rather than us
5427     * (the payee) providing a preimage.
5428     */
5429    LDKPaymentPurpose_SpontaneousPayment,
5430    /**
5431     * Must be last for serialization purposes
5432     */
5433    LDKPaymentPurpose_Sentinel,
5434 } LDKPaymentPurpose_Tag;
5435
5436 typedef struct LDKPaymentPurpose_LDKInvoicePayment_Body {
5437    /**
5438     * The preimage to the payment_hash, if the payment hash (and secret) were fetched via
5439     * [`ChannelManager::create_inbound_payment`]. If provided, this can be handed directly to
5440     * [`ChannelManager::claim_funds`].
5441     *
5442     * [`ChannelManager::create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment
5443     * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
5444     */
5445    struct LDKThirtyTwoBytes payment_preimage;
5446    /**
5447     * The \"payment secret\". This authenticates the sender to the recipient, preventing a
5448     * number of deanonymization attacks during the routing process.
5449     * It is provided here for your reference, however its accuracy is enforced directly by
5450     * [`ChannelManager`] using the values you previously provided to
5451     * [`ChannelManager::create_inbound_payment`] or
5452     * [`ChannelManager::create_inbound_payment_for_hash`].
5453     *
5454     * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
5455     * [`ChannelManager::create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment
5456     * [`ChannelManager::create_inbound_payment_for_hash`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash
5457     */
5458    struct LDKThirtyTwoBytes payment_secret;
5459    /**
5460     * This is the `user_payment_id` which was provided to
5461     * [`ChannelManager::create_inbound_payment_for_hash`] or
5462     * [`ChannelManager::create_inbound_payment`]. It has no meaning inside of LDK and is
5463     * simply copied here. It may be used to correlate PaymentReceived events with invoice
5464     * metadata stored elsewhere.
5465     *
5466     * [`ChannelManager::create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment
5467     * [`ChannelManager::create_inbound_payment_for_hash`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash
5468     */
5469    uint64_t user_payment_id;
5470 } LDKPaymentPurpose_LDKInvoicePayment_Body;
5471
5472 typedef struct MUST_USE_STRUCT LDKPaymentPurpose {
5473    LDKPaymentPurpose_Tag tag;
5474    union {
5475       LDKPaymentPurpose_LDKInvoicePayment_Body invoice_payment;
5476       struct {
5477          struct LDKThirtyTwoBytes spontaneous_payment;
5478       };
5479    };
5480 } LDKPaymentPurpose;
5481
5482 /**
5483  * An Event which you should probably take some action in response to.
5484  *
5485  * Note that while Writeable and Readable are implemented for Event, you probably shouldn't use
5486  * them directly as they don't round-trip exactly (for example FundingGenerationReady is never
5487  * written as it makes no sense to respond to it after reconnecting to peers).
5488  */
5489 typedef enum LDKEvent_Tag {
5490    /**
5491     * Used to indicate that the client should generate a funding transaction with the given
5492     * parameters and then call ChannelManager::funding_transaction_generated.
5493     * Generated in ChannelManager message handling.
5494     * Note that *all inputs* in the funding transaction must spend SegWit outputs or your
5495     * counterparty can steal your funds!
5496     */
5497    LDKEvent_FundingGenerationReady,
5498    /**
5499     * Indicates we've received money! Just gotta dig out that payment preimage and feed it to
5500     * ChannelManager::claim_funds to get it....
5501     * Note that if the preimage is not known or the amount paid is incorrect, you should call
5502     * ChannelManager::fail_htlc_backwards to free up resources for this HTLC and avoid
5503     * network congestion.
5504     * The amount paid should be considered 'incorrect' when it is less than or more than twice
5505     * the amount expected.
5506     * If you fail to call either ChannelManager::claim_funds or
5507     * ChannelManager::fail_htlc_backwards within the HTLC's timeout, the HTLC will be
5508     * automatically failed.
5509     */
5510    LDKEvent_PaymentReceived,
5511    /**
5512     * Indicates an outbound payment we made succeeded (ie it made it all the way to its target
5513     * and we got back the payment preimage for it).
5514     */
5515    LDKEvent_PaymentSent,
5516    /**
5517     * Indicates an outbound payment we made failed. Probably some intermediary node dropped
5518     * something. You may wish to retry with a different route.
5519     */
5520    LDKEvent_PaymentFailed,
5521    /**
5522     * Used to indicate that ChannelManager::process_pending_htlc_forwards should be called at a
5523     * time in the future.
5524     */
5525    LDKEvent_PendingHTLCsForwardable,
5526    /**
5527     * Used to indicate that an output which you should know how to spend was confirmed on chain
5528     * and is now spendable.
5529     * Such an output will *not* ever be spent by rust-lightning, and are not at risk of your
5530     * counterparty spending them due to some kind of timeout. Thus, you need to store them
5531     * somewhere and spend them when you create on-chain transactions.
5532     */
5533    LDKEvent_SpendableOutputs,
5534    /**
5535     * Must be last for serialization purposes
5536     */
5537    LDKEvent_Sentinel,
5538 } LDKEvent_Tag;
5539
5540 typedef struct LDKEvent_LDKFundingGenerationReady_Body {
5541    /**
5542     * The random channel_id we picked which you'll need to pass into
5543     * ChannelManager::funding_transaction_generated.
5544     */
5545    struct LDKThirtyTwoBytes temporary_channel_id;
5546    /**
5547     * The value, in satoshis, that the output should have.
5548     */
5549    uint64_t channel_value_satoshis;
5550    /**
5551     * The script which should be used in the transaction output.
5552     */
5553    struct LDKCVec_u8Z output_script;
5554    /**
5555     * The value passed in to ChannelManager::create_channel
5556     */
5557    uint64_t user_channel_id;
5558 } LDKEvent_LDKFundingGenerationReady_Body;
5559
5560 typedef struct LDKEvent_LDKPaymentReceived_Body {
5561    /**
5562     * The hash for which the preimage should be handed to the ChannelManager.
5563     */
5564    struct LDKThirtyTwoBytes payment_hash;
5565    /**
5566     * The value, in thousandths of a satoshi, that this payment is for. Note that you must
5567     * compare this to the expected value before accepting the payment (as otherwise you are
5568     * providing proof-of-payment for less than the value you expected!).
5569     */
5570    uint64_t amt;
5571    /**
5572     * Information for claiming this received payment, based on whether the purpose of the
5573     * payment is to pay an invoice or to send a spontaneous payment.
5574     */
5575    struct LDKPaymentPurpose purpose;
5576 } LDKEvent_LDKPaymentReceived_Body;
5577
5578 typedef struct LDKEvent_LDKPaymentSent_Body {
5579    /**
5580     * The preimage to the hash given to ChannelManager::send_payment.
5581     * Note that this serves as a payment receipt, if you wish to have such a thing, you must
5582     * store it somehow!
5583     */
5584    struct LDKThirtyTwoBytes payment_preimage;
5585 } LDKEvent_LDKPaymentSent_Body;
5586
5587 typedef struct LDKEvent_LDKPaymentFailed_Body {
5588    /**
5589     * The hash which was given to ChannelManager::send_payment.
5590     */
5591    struct LDKThirtyTwoBytes payment_hash;
5592    /**
5593     * Indicates the payment was rejected for some reason by the recipient. This implies that
5594     * the payment has failed, not just the route in question. If this is not set, you may
5595     * retry the payment via a different route.
5596     */
5597    bool rejected_by_dest;
5598 } LDKEvent_LDKPaymentFailed_Body;
5599
5600 typedef struct LDKEvent_LDKPendingHTLCsForwardable_Body {
5601    /**
5602     * The minimum amount of time that should be waited prior to calling
5603     * process_pending_htlc_forwards. To increase the effort required to correlate payments,
5604     * you should wait a random amount of time in roughly the range (now + time_forwardable,
5605     * now + 5*time_forwardable).
5606     */
5607    uint64_t time_forwardable;
5608 } LDKEvent_LDKPendingHTLCsForwardable_Body;
5609
5610 typedef struct LDKEvent_LDKSpendableOutputs_Body {
5611    /**
5612     * The outputs which you should store as spendable by you.
5613     */
5614    struct LDKCVec_SpendableOutputDescriptorZ outputs;
5615 } LDKEvent_LDKSpendableOutputs_Body;
5616
5617 typedef struct MUST_USE_STRUCT LDKEvent {
5618    LDKEvent_Tag tag;
5619    union {
5620       LDKEvent_LDKFundingGenerationReady_Body funding_generation_ready;
5621       LDKEvent_LDKPaymentReceived_Body payment_received;
5622       LDKEvent_LDKPaymentSent_Body payment_sent;
5623       LDKEvent_LDKPaymentFailed_Body payment_failed;
5624       LDKEvent_LDKPendingHTLCsForwardable_Body pending_htl_cs_forwardable;
5625       LDKEvent_LDKSpendableOutputs_Body spendable_outputs;
5626    };
5627 } LDKEvent;
5628
5629 /**
5630  * A dynamically-allocated array of crate::lightning::util::events::Events of arbitrary size.
5631  * This corresponds to std::vector in C++
5632  */
5633 typedef struct LDKCVec_EventZ {
5634    /**
5635     * The elements in the array.
5636     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5637     */
5638    struct LDKEvent *data;
5639    /**
5640     * The number of elements pointed to by `data`.
5641     */
5642    uintptr_t datalen;
5643 } LDKCVec_EventZ;
5644
5645 /**
5646  * A dynamically-allocated array of crate::c_types::Transactions of arbitrary size.
5647  * This corresponds to std::vector in C++
5648  */
5649 typedef struct LDKCVec_TransactionZ {
5650    /**
5651     * The elements in the array.
5652     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5653     */
5654    struct LDKTransaction *data;
5655    /**
5656     * The number of elements pointed to by `data`.
5657     */
5658    uintptr_t datalen;
5659 } LDKCVec_TransactionZ;
5660
5661 /**
5662  * A tuple of 2 elements. See the individual fields for the types contained.
5663  */
5664 typedef struct LDKC2Tuple_u32TxOutZ {
5665    /**
5666     * The element at position 0
5667     */
5668    uint32_t a;
5669    /**
5670     * The element at position 1
5671     */
5672    struct LDKTxOut b;
5673 } LDKC2Tuple_u32TxOutZ;
5674
5675 /**
5676  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size.
5677  * This corresponds to std::vector in C++
5678  */
5679 typedef struct LDKCVec_C2Tuple_u32TxOutZZ {
5680    /**
5681     * The elements in the array.
5682     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5683     */
5684    struct LDKC2Tuple_u32TxOutZ *data;
5685    /**
5686     * The number of elements pointed to by `data`.
5687     */
5688    uintptr_t datalen;
5689 } LDKCVec_C2Tuple_u32TxOutZZ;
5690
5691 /**
5692  * A tuple of 2 elements. See the individual fields for the types contained.
5693  */
5694 typedef struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
5695    /**
5696     * The element at position 0
5697     */
5698    struct LDKThirtyTwoBytes a;
5699    /**
5700     * The element at position 1
5701     */
5702    struct LDKCVec_C2Tuple_u32TxOutZZ b;
5703 } LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ;
5704
5705 /**
5706  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZs of arbitrary size.
5707  * This corresponds to std::vector in C++
5708  */
5709 typedef struct LDKCVec_TransactionOutputsZ {
5710    /**
5711     * The elements in the array.
5712     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5713     */
5714    struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *data;
5715    /**
5716     * The number of elements pointed to by `data`.
5717     */
5718    uintptr_t datalen;
5719 } LDKCVec_TransactionOutputsZ;
5720
5721 /**
5722  * The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ
5723  */
5724 typedef union LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
5725    /**
5726     * A pointer to the contents in the success state.
5727     * Reading from this pointer when `result_ok` is not set is undefined.
5728     */
5729    struct LDKC2Tuple_BlockHashChannelMonitorZ *result;
5730    /**
5731     * A pointer to the contents in the error state.
5732     * Reading from this pointer when `result_ok` is set is undefined.
5733     */
5734    struct LDKDecodeError *err;
5735 } LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr;
5736
5737 /**
5738  * A CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents the result of a fallible operation,
5739  * containing a crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
5740  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5741  */
5742 typedef struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
5743    /**
5744     * The contents of this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either
5745     * `err` or `result` depending on the state of `result_ok`.
5746     */
5747    union LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr contents;
5748    /**
5749     * Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state.
5750     */
5751    bool result_ok;
5752 } LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ;
5753
5754 /**
5755  * The contents of CResult_boolLightningErrorZ
5756  */
5757 typedef union LDKCResult_boolLightningErrorZPtr {
5758    /**
5759     * A pointer to the contents in the success state.
5760     * Reading from this pointer when `result_ok` is not set is undefined.
5761     */
5762    bool *result;
5763    /**
5764     * A pointer to the contents in the error state.
5765     * Reading from this pointer when `result_ok` is set is undefined.
5766     */
5767    struct LDKLightningError *err;
5768 } LDKCResult_boolLightningErrorZPtr;
5769
5770 /**
5771  * A CResult_boolLightningErrorZ represents the result of a fallible operation,
5772  * containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure.
5773  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5774  */
5775 typedef struct LDKCResult_boolLightningErrorZ {
5776    /**
5777     * The contents of this CResult_boolLightningErrorZ, accessible via either
5778     * `err` or `result` depending on the state of `result_ok`.
5779     */
5780    union LDKCResult_boolLightningErrorZPtr contents;
5781    /**
5782     * Whether this CResult_boolLightningErrorZ represents a success state.
5783     */
5784    bool result_ok;
5785 } LDKCResult_boolLightningErrorZ;
5786
5787 /**
5788  * A tuple of 3 elements. See the individual fields for the types contained.
5789  */
5790 typedef struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
5791    /**
5792     * The element at position 0
5793     */
5794    struct LDKChannelAnnouncement a;
5795    /**
5796     * The element at position 1
5797     */
5798    struct LDKChannelUpdate b;
5799    /**
5800     * The element at position 2
5801     */
5802    struct LDKChannelUpdate c;
5803 } LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ;
5804
5805 /**
5806  * A dynamically-allocated array of crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZs of arbitrary size.
5807  * This corresponds to std::vector in C++
5808  */
5809 typedef struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
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 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *data;
5815    /**
5816     * The number of elements pointed to by `data`.
5817     */
5818    uintptr_t datalen;
5819 } LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ;
5820
5821 /**
5822  * A dynamically-allocated array of crate::lightning::ln::msgs::NodeAnnouncements of arbitrary size.
5823  * This corresponds to std::vector in C++
5824  */
5825 typedef struct LDKCVec_NodeAnnouncementZ {
5826    /**
5827     * The elements in the array.
5828     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5829     */
5830    struct LDKNodeAnnouncement *data;
5831    /**
5832     * The number of elements pointed to by `data`.
5833     */
5834    uintptr_t datalen;
5835 } LDKCVec_NodeAnnouncementZ;
5836
5837 /**
5838  * The contents of CResult_NoneLightningErrorZ
5839  */
5840 typedef union LDKCResult_NoneLightningErrorZPtr {
5841    /**
5842     * Note that this value is always NULL, as there are no contents in the OK variant
5843     */
5844    void *result;
5845    /**
5846     * A pointer to the contents in the error state.
5847     * Reading from this pointer when `result_ok` is set is undefined.
5848     */
5849    struct LDKLightningError *err;
5850 } LDKCResult_NoneLightningErrorZPtr;
5851
5852 /**
5853  * A CResult_NoneLightningErrorZ represents the result of a fallible operation,
5854  * containing a () on success and a crate::lightning::ln::msgs::LightningError on failure.
5855  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5856  */
5857 typedef struct LDKCResult_NoneLightningErrorZ {
5858    /**
5859     * The contents of this CResult_NoneLightningErrorZ, accessible via either
5860     * `err` or `result` depending on the state of `result_ok`.
5861     */
5862    union LDKCResult_NoneLightningErrorZPtr contents;
5863    /**
5864     * Whether this CResult_NoneLightningErrorZ represents a success state.
5865     */
5866    bool result_ok;
5867 } LDKCResult_NoneLightningErrorZ;
5868
5869 /**
5870  * A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size.
5871  * This corresponds to std::vector in C++
5872  */
5873 typedef struct LDKCVec_PublicKeyZ {
5874    /**
5875     * The elements in the array.
5876     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5877     */
5878    struct LDKPublicKey *data;
5879    /**
5880     * The number of elements pointed to by `data`.
5881     */
5882    uintptr_t datalen;
5883 } LDKCVec_PublicKeyZ;
5884
5885
5886
5887 /**
5888  * Error for PeerManager errors. If you get one of these, you must disconnect the socket and
5889  * generate no further read_event/write_buffer_space_avail/socket_disconnected calls for the
5890  * descriptor.
5891  */
5892 typedef struct MUST_USE_STRUCT LDKPeerHandleError {
5893    /**
5894     * A pointer to the opaque Rust object.
5895     * Nearly everywhere, inner must be non-null, however in places where
5896     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5897     */
5898    LDKnativePeerHandleError *inner;
5899    /**
5900     * Indicates that this is the only struct which contains the same pointer.
5901     * Rust functions which take ownership of an object provided via an argument require
5902     * this to be true and invalidate the object pointed to by inner.
5903     */
5904    bool is_owned;
5905 } LDKPeerHandleError;
5906
5907 /**
5908  * The contents of CResult_CVec_u8ZPeerHandleErrorZ
5909  */
5910 typedef union LDKCResult_CVec_u8ZPeerHandleErrorZPtr {
5911    /**
5912     * A pointer to the contents in the success state.
5913     * Reading from this pointer when `result_ok` is not set is undefined.
5914     */
5915    struct LDKCVec_u8Z *result;
5916    /**
5917     * A pointer to the contents in the error state.
5918     * Reading from this pointer when `result_ok` is set is undefined.
5919     */
5920    struct LDKPeerHandleError *err;
5921 } LDKCResult_CVec_u8ZPeerHandleErrorZPtr;
5922
5923 /**
5924  * A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
5925  * containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
5926  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5927  */
5928 typedef struct LDKCResult_CVec_u8ZPeerHandleErrorZ {
5929    /**
5930     * The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
5931     * `err` or `result` depending on the state of `result_ok`.
5932     */
5933    union LDKCResult_CVec_u8ZPeerHandleErrorZPtr contents;
5934    /**
5935     * Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
5936     */
5937    bool result_ok;
5938 } LDKCResult_CVec_u8ZPeerHandleErrorZ;
5939
5940 /**
5941  * The contents of CResult_NonePeerHandleErrorZ
5942  */
5943 typedef union LDKCResult_NonePeerHandleErrorZPtr {
5944    /**
5945     * Note that this value is always NULL, as there are no contents in the OK variant
5946     */
5947    void *result;
5948    /**
5949     * A pointer to the contents in the error state.
5950     * Reading from this pointer when `result_ok` is set is undefined.
5951     */
5952    struct LDKPeerHandleError *err;
5953 } LDKCResult_NonePeerHandleErrorZPtr;
5954
5955 /**
5956  * A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
5957  * containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
5958  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5959  */
5960 typedef struct LDKCResult_NonePeerHandleErrorZ {
5961    /**
5962     * The contents of this CResult_NonePeerHandleErrorZ, accessible via either
5963     * `err` or `result` depending on the state of `result_ok`.
5964     */
5965    union LDKCResult_NonePeerHandleErrorZPtr contents;
5966    /**
5967     * Whether this CResult_NonePeerHandleErrorZ represents a success state.
5968     */
5969    bool result_ok;
5970 } LDKCResult_NonePeerHandleErrorZ;
5971
5972 /**
5973  * The contents of CResult_boolPeerHandleErrorZ
5974  */
5975 typedef union LDKCResult_boolPeerHandleErrorZPtr {
5976    /**
5977     * A pointer to the contents in the success state.
5978     * Reading from this pointer when `result_ok` is not set is undefined.
5979     */
5980    bool *result;
5981    /**
5982     * A pointer to the contents in the error state.
5983     * Reading from this pointer when `result_ok` is set is undefined.
5984     */
5985    struct LDKPeerHandleError *err;
5986 } LDKCResult_boolPeerHandleErrorZPtr;
5987
5988 /**
5989  * A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
5990  * containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
5991  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5992  */
5993 typedef struct LDKCResult_boolPeerHandleErrorZ {
5994    /**
5995     * The contents of this CResult_boolPeerHandleErrorZ, accessible via either
5996     * `err` or `result` depending on the state of `result_ok`.
5997     */
5998    union LDKCResult_boolPeerHandleErrorZPtr contents;
5999    /**
6000     * Whether this CResult_boolPeerHandleErrorZ represents a success state.
6001     */
6002    bool result_ok;
6003 } LDKCResult_boolPeerHandleErrorZ;
6004
6005
6006
6007 /**
6008  * Details about one direction of a channel. Received
6009  * within a channel update.
6010  */
6011 typedef struct MUST_USE_STRUCT LDKDirectionalChannelInfo {
6012    /**
6013     * A pointer to the opaque Rust object.
6014     * Nearly everywhere, inner must be non-null, however in places where
6015     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6016     */
6017    LDKnativeDirectionalChannelInfo *inner;
6018    /**
6019     * Indicates that this is the only struct which contains the same pointer.
6020     * Rust functions which take ownership of an object provided via an argument require
6021     * this to be true and invalidate the object pointed to by inner.
6022     */
6023    bool is_owned;
6024 } LDKDirectionalChannelInfo;
6025
6026 /**
6027  * The contents of CResult_DirectionalChannelInfoDecodeErrorZ
6028  */
6029 typedef union LDKCResult_DirectionalChannelInfoDecodeErrorZPtr {
6030    /**
6031     * A pointer to the contents in the success state.
6032     * Reading from this pointer when `result_ok` is not set is undefined.
6033     */
6034    struct LDKDirectionalChannelInfo *result;
6035    /**
6036     * A pointer to the contents in the error state.
6037     * Reading from this pointer when `result_ok` is set is undefined.
6038     */
6039    struct LDKDecodeError *err;
6040 } LDKCResult_DirectionalChannelInfoDecodeErrorZPtr;
6041
6042 /**
6043  * A CResult_DirectionalChannelInfoDecodeErrorZ represents the result of a fallible operation,
6044  * containing a crate::lightning::routing::network_graph::DirectionalChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
6045  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6046  */
6047 typedef struct LDKCResult_DirectionalChannelInfoDecodeErrorZ {
6048    /**
6049     * The contents of this CResult_DirectionalChannelInfoDecodeErrorZ, accessible via either
6050     * `err` or `result` depending on the state of `result_ok`.
6051     */
6052    union LDKCResult_DirectionalChannelInfoDecodeErrorZPtr contents;
6053    /**
6054     * Whether this CResult_DirectionalChannelInfoDecodeErrorZ represents a success state.
6055     */
6056    bool result_ok;
6057 } LDKCResult_DirectionalChannelInfoDecodeErrorZ;
6058
6059
6060
6061 /**
6062  * Details about a channel (both directions).
6063  * Received within a channel announcement.
6064  */
6065 typedef struct MUST_USE_STRUCT LDKChannelInfo {
6066    /**
6067     * A pointer to the opaque Rust object.
6068     * Nearly everywhere, inner must be non-null, however in places where
6069     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6070     */
6071    LDKnativeChannelInfo *inner;
6072    /**
6073     * Indicates that this is the only struct which contains the same pointer.
6074     * Rust functions which take ownership of an object provided via an argument require
6075     * this to be true and invalidate the object pointed to by inner.
6076     */
6077    bool is_owned;
6078 } LDKChannelInfo;
6079
6080 /**
6081  * The contents of CResult_ChannelInfoDecodeErrorZ
6082  */
6083 typedef union LDKCResult_ChannelInfoDecodeErrorZPtr {
6084    /**
6085     * A pointer to the contents in the success state.
6086     * Reading from this pointer when `result_ok` is not set is undefined.
6087     */
6088    struct LDKChannelInfo *result;
6089    /**
6090     * A pointer to the contents in the error state.
6091     * Reading from this pointer when `result_ok` is set is undefined.
6092     */
6093    struct LDKDecodeError *err;
6094 } LDKCResult_ChannelInfoDecodeErrorZPtr;
6095
6096 /**
6097  * A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation,
6098  * containing a crate::lightning::routing::network_graph::ChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
6099  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6100  */
6101 typedef struct LDKCResult_ChannelInfoDecodeErrorZ {
6102    /**
6103     * The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either
6104     * `err` or `result` depending on the state of `result_ok`.
6105     */
6106    union LDKCResult_ChannelInfoDecodeErrorZPtr contents;
6107    /**
6108     * Whether this CResult_ChannelInfoDecodeErrorZ represents a success state.
6109     */
6110    bool result_ok;
6111 } LDKCResult_ChannelInfoDecodeErrorZ;
6112
6113
6114
6115 /**
6116  * Fees for routing via a given channel or a node
6117  */
6118 typedef struct MUST_USE_STRUCT LDKRoutingFees {
6119    /**
6120     * A pointer to the opaque Rust object.
6121     * Nearly everywhere, inner must be non-null, however in places where
6122     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6123     */
6124    LDKnativeRoutingFees *inner;
6125    /**
6126     * Indicates that this is the only struct which contains the same pointer.
6127     * Rust functions which take ownership of an object provided via an argument require
6128     * this to be true and invalidate the object pointed to by inner.
6129     */
6130    bool is_owned;
6131 } LDKRoutingFees;
6132
6133 /**
6134  * The contents of CResult_RoutingFeesDecodeErrorZ
6135  */
6136 typedef union LDKCResult_RoutingFeesDecodeErrorZPtr {
6137    /**
6138     * A pointer to the contents in the success state.
6139     * Reading from this pointer when `result_ok` is not set is undefined.
6140     */
6141    struct LDKRoutingFees *result;
6142    /**
6143     * A pointer to the contents in the error state.
6144     * Reading from this pointer when `result_ok` is set is undefined.
6145     */
6146    struct LDKDecodeError *err;
6147 } LDKCResult_RoutingFeesDecodeErrorZPtr;
6148
6149 /**
6150  * A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation,
6151  * containing a crate::lightning::routing::network_graph::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure.
6152  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6153  */
6154 typedef struct LDKCResult_RoutingFeesDecodeErrorZ {
6155    /**
6156     * The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either
6157     * `err` or `result` depending on the state of `result_ok`.
6158     */
6159    union LDKCResult_RoutingFeesDecodeErrorZPtr contents;
6160    /**
6161     * Whether this CResult_RoutingFeesDecodeErrorZ represents a success state.
6162     */
6163    bool result_ok;
6164 } LDKCResult_RoutingFeesDecodeErrorZ;
6165
6166
6167
6168 /**
6169  * Information received in the latest node_announcement from this node.
6170  */
6171 typedef struct MUST_USE_STRUCT LDKNodeAnnouncementInfo {
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    LDKnativeNodeAnnouncementInfo *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 } LDKNodeAnnouncementInfo;
6185
6186 /**
6187  * The contents of CResult_NodeAnnouncementInfoDecodeErrorZ
6188  */
6189 typedef union LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr {
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 LDKNodeAnnouncementInfo *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_NodeAnnouncementInfoDecodeErrorZPtr;
6201
6202 /**
6203  * A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation,
6204  * containing a crate::lightning::routing::network_graph::NodeAnnouncementInfo 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_NodeAnnouncementInfoDecodeErrorZ {
6208    /**
6209     * The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either
6210     * `err` or `result` depending on the state of `result_ok`.
6211     */
6212    union LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr contents;
6213    /**
6214     * Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state.
6215     */
6216    bool result_ok;
6217 } LDKCResult_NodeAnnouncementInfoDecodeErrorZ;
6218
6219 /**
6220  * A dynamically-allocated array of u64s of arbitrary size.
6221  * This corresponds to std::vector in C++
6222  */
6223 typedef struct LDKCVec_u64Z {
6224    /**
6225     * The elements in the array.
6226     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6227     */
6228    uint64_t *data;
6229    /**
6230     * The number of elements pointed to by `data`.
6231     */
6232    uintptr_t datalen;
6233 } LDKCVec_u64Z;
6234
6235
6236
6237 /**
6238  * Details about a node in the network, known from the network announcement.
6239  */
6240 typedef struct MUST_USE_STRUCT LDKNodeInfo {
6241    /**
6242     * A pointer to the opaque Rust object.
6243     * Nearly everywhere, inner must be non-null, however in places where
6244     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6245     */
6246    LDKnativeNodeInfo *inner;
6247    /**
6248     * Indicates that this is the only struct which contains the same pointer.
6249     * Rust functions which take ownership of an object provided via an argument require
6250     * this to be true and invalidate the object pointed to by inner.
6251     */
6252    bool is_owned;
6253 } LDKNodeInfo;
6254
6255 /**
6256  * The contents of CResult_NodeInfoDecodeErrorZ
6257  */
6258 typedef union LDKCResult_NodeInfoDecodeErrorZPtr {
6259    /**
6260     * A pointer to the contents in the success state.
6261     * Reading from this pointer when `result_ok` is not set is undefined.
6262     */
6263    struct LDKNodeInfo *result;
6264    /**
6265     * A pointer to the contents in the error state.
6266     * Reading from this pointer when `result_ok` is set is undefined.
6267     */
6268    struct LDKDecodeError *err;
6269 } LDKCResult_NodeInfoDecodeErrorZPtr;
6270
6271 /**
6272  * A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation,
6273  * containing a crate::lightning::routing::network_graph::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
6274  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6275  */
6276 typedef struct LDKCResult_NodeInfoDecodeErrorZ {
6277    /**
6278     * The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either
6279     * `err` or `result` depending on the state of `result_ok`.
6280     */
6281    union LDKCResult_NodeInfoDecodeErrorZPtr contents;
6282    /**
6283     * Whether this CResult_NodeInfoDecodeErrorZ represents a success state.
6284     */
6285    bool result_ok;
6286 } LDKCResult_NodeInfoDecodeErrorZ;
6287
6288
6289
6290 /**
6291  * Represents the network as nodes and channels between them
6292  */
6293 typedef struct MUST_USE_STRUCT LDKNetworkGraph {
6294    /**
6295     * A pointer to the opaque Rust object.
6296     * Nearly everywhere, inner must be non-null, however in places where
6297     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6298     */
6299    LDKnativeNetworkGraph *inner;
6300    /**
6301     * Indicates that this is the only struct which contains the same pointer.
6302     * Rust functions which take ownership of an object provided via an argument require
6303     * this to be true and invalidate the object pointed to by inner.
6304     */
6305    bool is_owned;
6306 } LDKNetworkGraph;
6307
6308 /**
6309  * The contents of CResult_NetworkGraphDecodeErrorZ
6310  */
6311 typedef union LDKCResult_NetworkGraphDecodeErrorZPtr {
6312    /**
6313     * A pointer to the contents in the success state.
6314     * Reading from this pointer when `result_ok` is not set is undefined.
6315     */
6316    struct LDKNetworkGraph *result;
6317    /**
6318     * A pointer to the contents in the error state.
6319     * Reading from this pointer when `result_ok` is set is undefined.
6320     */
6321    struct LDKDecodeError *err;
6322 } LDKCResult_NetworkGraphDecodeErrorZPtr;
6323
6324 /**
6325  * A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation,
6326  * containing a crate::lightning::routing::network_graph::NetworkGraph on success and a crate::lightning::ln::msgs::DecodeError on failure.
6327  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6328  */
6329 typedef struct LDKCResult_NetworkGraphDecodeErrorZ {
6330    /**
6331     * The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either
6332     * `err` or `result` depending on the state of `result_ok`.
6333     */
6334    union LDKCResult_NetworkGraphDecodeErrorZPtr contents;
6335    /**
6336     * Whether this CResult_NetworkGraphDecodeErrorZ represents a success state.
6337     */
6338    bool result_ok;
6339 } LDKCResult_NetworkGraphDecodeErrorZ;
6340
6341 /**
6342  * The contents of CResult_NetAddressu8Z
6343  */
6344 typedef union LDKCResult_NetAddressu8ZPtr {
6345    /**
6346     * A pointer to the contents in the success state.
6347     * Reading from this pointer when `result_ok` is not set is undefined.
6348     */
6349    struct LDKNetAddress *result;
6350    /**
6351     * A pointer to the contents in the error state.
6352     * Reading from this pointer when `result_ok` is set is undefined.
6353     */
6354    uint8_t *err;
6355 } LDKCResult_NetAddressu8ZPtr;
6356
6357 /**
6358  * A CResult_NetAddressu8Z represents the result of a fallible operation,
6359  * containing a crate::lightning::ln::msgs::NetAddress on success and a u8 on failure.
6360  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6361  */
6362 typedef struct LDKCResult_NetAddressu8Z {
6363    /**
6364     * The contents of this CResult_NetAddressu8Z, accessible via either
6365     * `err` or `result` depending on the state of `result_ok`.
6366     */
6367    union LDKCResult_NetAddressu8ZPtr contents;
6368    /**
6369     * Whether this CResult_NetAddressu8Z represents a success state.
6370     */
6371    bool result_ok;
6372 } LDKCResult_NetAddressu8Z;
6373
6374 /**
6375  * The contents of CResult_CResult_NetAddressu8ZDecodeErrorZ
6376  */
6377 typedef union LDKCResult_CResult_NetAddressu8ZDecodeErrorZPtr {
6378    /**
6379     * A pointer to the contents in the success state.
6380     * Reading from this pointer when `result_ok` is not set is undefined.
6381     */
6382    struct LDKCResult_NetAddressu8Z *result;
6383    /**
6384     * A pointer to the contents in the error state.
6385     * Reading from this pointer when `result_ok` is set is undefined.
6386     */
6387    struct LDKDecodeError *err;
6388 } LDKCResult_CResult_NetAddressu8ZDecodeErrorZPtr;
6389
6390 /**
6391  * A CResult_CResult_NetAddressu8ZDecodeErrorZ represents the result of a fallible operation,
6392  * containing a crate::c_types::derived::CResult_NetAddressu8Z on success and a crate::lightning::ln::msgs::DecodeError on failure.
6393  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6394  */
6395 typedef struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ {
6396    /**
6397     * The contents of this CResult_CResult_NetAddressu8ZDecodeErrorZ, accessible via either
6398     * `err` or `result` depending on the state of `result_ok`.
6399     */
6400    union LDKCResult_CResult_NetAddressu8ZDecodeErrorZPtr contents;
6401    /**
6402     * Whether this CResult_CResult_NetAddressu8ZDecodeErrorZ represents a success state.
6403     */
6404    bool result_ok;
6405 } LDKCResult_CResult_NetAddressu8ZDecodeErrorZ;
6406
6407 /**
6408  * The contents of CResult_NetAddressDecodeErrorZ
6409  */
6410 typedef union LDKCResult_NetAddressDecodeErrorZPtr {
6411    /**
6412     * A pointer to the contents in the success state.
6413     * Reading from this pointer when `result_ok` is not set is undefined.
6414     */
6415    struct LDKNetAddress *result;
6416    /**
6417     * A pointer to the contents in the error state.
6418     * Reading from this pointer when `result_ok` is set is undefined.
6419     */
6420    struct LDKDecodeError *err;
6421 } LDKCResult_NetAddressDecodeErrorZPtr;
6422
6423 /**
6424  * A CResult_NetAddressDecodeErrorZ represents the result of a fallible operation,
6425  * containing a crate::lightning::ln::msgs::NetAddress on success and a crate::lightning::ln::msgs::DecodeError on failure.
6426  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6427  */
6428 typedef struct LDKCResult_NetAddressDecodeErrorZ {
6429    /**
6430     * The contents of this CResult_NetAddressDecodeErrorZ, accessible via either
6431     * `err` or `result` depending on the state of `result_ok`.
6432     */
6433    union LDKCResult_NetAddressDecodeErrorZPtr contents;
6434    /**
6435     * Whether this CResult_NetAddressDecodeErrorZ represents a success state.
6436     */
6437    bool result_ok;
6438 } LDKCResult_NetAddressDecodeErrorZ;
6439
6440
6441
6442 /**
6443  * An update_add_htlc message to be sent or received from a peer
6444  */
6445 typedef struct MUST_USE_STRUCT LDKUpdateAddHTLC {
6446    /**
6447     * A pointer to the opaque Rust object.
6448     * Nearly everywhere, inner must be non-null, however in places where
6449     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6450     */
6451    LDKnativeUpdateAddHTLC *inner;
6452    /**
6453     * Indicates that this is the only struct which contains the same pointer.
6454     * Rust functions which take ownership of an object provided via an argument require
6455     * this to be true and invalidate the object pointed to by inner.
6456     */
6457    bool is_owned;
6458 } LDKUpdateAddHTLC;
6459
6460 /**
6461  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size.
6462  * This corresponds to std::vector in C++
6463  */
6464 typedef struct LDKCVec_UpdateAddHTLCZ {
6465    /**
6466     * The elements in the array.
6467     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6468     */
6469    struct LDKUpdateAddHTLC *data;
6470    /**
6471     * The number of elements pointed to by `data`.
6472     */
6473    uintptr_t datalen;
6474 } LDKCVec_UpdateAddHTLCZ;
6475
6476
6477
6478 /**
6479  * An update_fulfill_htlc message to be sent or received from a peer
6480  */
6481 typedef struct MUST_USE_STRUCT LDKUpdateFulfillHTLC {
6482    /**
6483     * A pointer to the opaque Rust object.
6484     * Nearly everywhere, inner must be non-null, however in places where
6485     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6486     */
6487    LDKnativeUpdateFulfillHTLC *inner;
6488    /**
6489     * Indicates that this is the only struct which contains the same pointer.
6490     * Rust functions which take ownership of an object provided via an argument require
6491     * this to be true and invalidate the object pointed to by inner.
6492     */
6493    bool is_owned;
6494 } LDKUpdateFulfillHTLC;
6495
6496 /**
6497  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
6498  * This corresponds to std::vector in C++
6499  */
6500 typedef struct LDKCVec_UpdateFulfillHTLCZ {
6501    /**
6502     * The elements in the array.
6503     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6504     */
6505    struct LDKUpdateFulfillHTLC *data;
6506    /**
6507     * The number of elements pointed to by `data`.
6508     */
6509    uintptr_t datalen;
6510 } LDKCVec_UpdateFulfillHTLCZ;
6511
6512
6513
6514 /**
6515  * An update_fail_htlc message to be sent or received from a peer
6516  */
6517 typedef struct MUST_USE_STRUCT LDKUpdateFailHTLC {
6518    /**
6519     * A pointer to the opaque Rust object.
6520     * Nearly everywhere, inner must be non-null, however in places where
6521     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6522     */
6523    LDKnativeUpdateFailHTLC *inner;
6524    /**
6525     * Indicates that this is the only struct which contains the same pointer.
6526     * Rust functions which take ownership of an object provided via an argument require
6527     * this to be true and invalidate the object pointed to by inner.
6528     */
6529    bool is_owned;
6530 } LDKUpdateFailHTLC;
6531
6532 /**
6533  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size.
6534  * This corresponds to std::vector in C++
6535  */
6536 typedef struct LDKCVec_UpdateFailHTLCZ {
6537    /**
6538     * The elements in the array.
6539     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6540     */
6541    struct LDKUpdateFailHTLC *data;
6542    /**
6543     * The number of elements pointed to by `data`.
6544     */
6545    uintptr_t datalen;
6546 } LDKCVec_UpdateFailHTLCZ;
6547
6548
6549
6550 /**
6551  * An update_fail_malformed_htlc message to be sent or received from a peer
6552  */
6553 typedef struct MUST_USE_STRUCT LDKUpdateFailMalformedHTLC {
6554    /**
6555     * A pointer to the opaque Rust object.
6556     * Nearly everywhere, inner must be non-null, however in places where
6557     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6558     */
6559    LDKnativeUpdateFailMalformedHTLC *inner;
6560    /**
6561     * Indicates that this is the only struct which contains the same pointer.
6562     * Rust functions which take ownership of an object provided via an argument require
6563     * this to be true and invalidate the object pointed to by inner.
6564     */
6565    bool is_owned;
6566 } LDKUpdateFailMalformedHTLC;
6567
6568 /**
6569  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
6570  * This corresponds to std::vector in C++
6571  */
6572 typedef struct LDKCVec_UpdateFailMalformedHTLCZ {
6573    /**
6574     * The elements in the array.
6575     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6576     */
6577    struct LDKUpdateFailMalformedHTLC *data;
6578    /**
6579     * The number of elements pointed to by `data`.
6580     */
6581    uintptr_t datalen;
6582 } LDKCVec_UpdateFailMalformedHTLCZ;
6583
6584 /**
6585  * The contents of CResult_AcceptChannelDecodeErrorZ
6586  */
6587 typedef union LDKCResult_AcceptChannelDecodeErrorZPtr {
6588    /**
6589     * A pointer to the contents in the success state.
6590     * Reading from this pointer when `result_ok` is not set is undefined.
6591     */
6592    struct LDKAcceptChannel *result;
6593    /**
6594     * A pointer to the contents in the error state.
6595     * Reading from this pointer when `result_ok` is set is undefined.
6596     */
6597    struct LDKDecodeError *err;
6598 } LDKCResult_AcceptChannelDecodeErrorZPtr;
6599
6600 /**
6601  * A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
6602  * containing a crate::lightning::ln::msgs::AcceptChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
6603  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6604  */
6605 typedef struct LDKCResult_AcceptChannelDecodeErrorZ {
6606    /**
6607     * The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
6608     * `err` or `result` depending on the state of `result_ok`.
6609     */
6610    union LDKCResult_AcceptChannelDecodeErrorZPtr contents;
6611    /**
6612     * Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
6613     */
6614    bool result_ok;
6615 } LDKCResult_AcceptChannelDecodeErrorZ;
6616
6617 /**
6618  * The contents of CResult_AnnouncementSignaturesDecodeErrorZ
6619  */
6620 typedef union LDKCResult_AnnouncementSignaturesDecodeErrorZPtr {
6621    /**
6622     * A pointer to the contents in the success state.
6623     * Reading from this pointer when `result_ok` is not set is undefined.
6624     */
6625    struct LDKAnnouncementSignatures *result;
6626    /**
6627     * A pointer to the contents in the error state.
6628     * Reading from this pointer when `result_ok` is set is undefined.
6629     */
6630    struct LDKDecodeError *err;
6631 } LDKCResult_AnnouncementSignaturesDecodeErrorZPtr;
6632
6633 /**
6634  * A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
6635  * containing a crate::lightning::ln::msgs::AnnouncementSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
6636  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6637  */
6638 typedef struct LDKCResult_AnnouncementSignaturesDecodeErrorZ {
6639    /**
6640     * The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
6641     * `err` or `result` depending on the state of `result_ok`.
6642     */
6643    union LDKCResult_AnnouncementSignaturesDecodeErrorZPtr contents;
6644    /**
6645     * Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
6646     */
6647    bool result_ok;
6648 } LDKCResult_AnnouncementSignaturesDecodeErrorZ;
6649
6650 /**
6651  * The contents of CResult_ChannelReestablishDecodeErrorZ
6652  */
6653 typedef union LDKCResult_ChannelReestablishDecodeErrorZPtr {
6654    /**
6655     * A pointer to the contents in the success state.
6656     * Reading from this pointer when `result_ok` is not set is undefined.
6657     */
6658    struct LDKChannelReestablish *result;
6659    /**
6660     * A pointer to the contents in the error state.
6661     * Reading from this pointer when `result_ok` is set is undefined.
6662     */
6663    struct LDKDecodeError *err;
6664 } LDKCResult_ChannelReestablishDecodeErrorZPtr;
6665
6666 /**
6667  * A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
6668  * containing a crate::lightning::ln::msgs::ChannelReestablish on success and a crate::lightning::ln::msgs::DecodeError on failure.
6669  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6670  */
6671 typedef struct LDKCResult_ChannelReestablishDecodeErrorZ {
6672    /**
6673     * The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
6674     * `err` or `result` depending on the state of `result_ok`.
6675     */
6676    union LDKCResult_ChannelReestablishDecodeErrorZPtr contents;
6677    /**
6678     * Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
6679     */
6680    bool result_ok;
6681 } LDKCResult_ChannelReestablishDecodeErrorZ;
6682
6683 /**
6684  * The contents of CResult_ClosingSignedDecodeErrorZ
6685  */
6686 typedef union LDKCResult_ClosingSignedDecodeErrorZPtr {
6687    /**
6688     * A pointer to the contents in the success state.
6689     * Reading from this pointer when `result_ok` is not set is undefined.
6690     */
6691    struct LDKClosingSigned *result;
6692    /**
6693     * A pointer to the contents in the error state.
6694     * Reading from this pointer when `result_ok` is set is undefined.
6695     */
6696    struct LDKDecodeError *err;
6697 } LDKCResult_ClosingSignedDecodeErrorZPtr;
6698
6699 /**
6700  * A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
6701  * containing a crate::lightning::ln::msgs::ClosingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
6702  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6703  */
6704 typedef struct LDKCResult_ClosingSignedDecodeErrorZ {
6705    /**
6706     * The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
6707     * `err` or `result` depending on the state of `result_ok`.
6708     */
6709    union LDKCResult_ClosingSignedDecodeErrorZPtr contents;
6710    /**
6711     * Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
6712     */
6713    bool result_ok;
6714 } LDKCResult_ClosingSignedDecodeErrorZ;
6715
6716
6717
6718 /**
6719  * A commitment_signed message to be sent or received from a peer
6720  */
6721 typedef struct MUST_USE_STRUCT LDKCommitmentSigned {
6722    /**
6723     * A pointer to the opaque Rust object.
6724     * Nearly everywhere, inner must be non-null, however in places where
6725     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6726     */
6727    LDKnativeCommitmentSigned *inner;
6728    /**
6729     * Indicates that this is the only struct which contains the same pointer.
6730     * Rust functions which take ownership of an object provided via an argument require
6731     * this to be true and invalidate the object pointed to by inner.
6732     */
6733    bool is_owned;
6734 } LDKCommitmentSigned;
6735
6736 /**
6737  * The contents of CResult_CommitmentSignedDecodeErrorZ
6738  */
6739 typedef union LDKCResult_CommitmentSignedDecodeErrorZPtr {
6740    /**
6741     * A pointer to the contents in the success state.
6742     * Reading from this pointer when `result_ok` is not set is undefined.
6743     */
6744    struct LDKCommitmentSigned *result;
6745    /**
6746     * A pointer to the contents in the error state.
6747     * Reading from this pointer when `result_ok` is set is undefined.
6748     */
6749    struct LDKDecodeError *err;
6750 } LDKCResult_CommitmentSignedDecodeErrorZPtr;
6751
6752 /**
6753  * A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
6754  * containing a crate::lightning::ln::msgs::CommitmentSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
6755  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6756  */
6757 typedef struct LDKCResult_CommitmentSignedDecodeErrorZ {
6758    /**
6759     * The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
6760     * `err` or `result` depending on the state of `result_ok`.
6761     */
6762    union LDKCResult_CommitmentSignedDecodeErrorZPtr contents;
6763    /**
6764     * Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
6765     */
6766    bool result_ok;
6767 } LDKCResult_CommitmentSignedDecodeErrorZ;
6768
6769 /**
6770  * The contents of CResult_FundingCreatedDecodeErrorZ
6771  */
6772 typedef union LDKCResult_FundingCreatedDecodeErrorZPtr {
6773    /**
6774     * A pointer to the contents in the success state.
6775     * Reading from this pointer when `result_ok` is not set is undefined.
6776     */
6777    struct LDKFundingCreated *result;
6778    /**
6779     * A pointer to the contents in the error state.
6780     * Reading from this pointer when `result_ok` is set is undefined.
6781     */
6782    struct LDKDecodeError *err;
6783 } LDKCResult_FundingCreatedDecodeErrorZPtr;
6784
6785 /**
6786  * A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
6787  * containing a crate::lightning::ln::msgs::FundingCreated on success and a crate::lightning::ln::msgs::DecodeError on failure.
6788  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6789  */
6790 typedef struct LDKCResult_FundingCreatedDecodeErrorZ {
6791    /**
6792     * The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
6793     * `err` or `result` depending on the state of `result_ok`.
6794     */
6795    union LDKCResult_FundingCreatedDecodeErrorZPtr contents;
6796    /**
6797     * Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
6798     */
6799    bool result_ok;
6800 } LDKCResult_FundingCreatedDecodeErrorZ;
6801
6802 /**
6803  * The contents of CResult_FundingSignedDecodeErrorZ
6804  */
6805 typedef union LDKCResult_FundingSignedDecodeErrorZPtr {
6806    /**
6807     * A pointer to the contents in the success state.
6808     * Reading from this pointer when `result_ok` is not set is undefined.
6809     */
6810    struct LDKFundingSigned *result;
6811    /**
6812     * A pointer to the contents in the error state.
6813     * Reading from this pointer when `result_ok` is set is undefined.
6814     */
6815    struct LDKDecodeError *err;
6816 } LDKCResult_FundingSignedDecodeErrorZPtr;
6817
6818 /**
6819  * A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation,
6820  * containing a crate::lightning::ln::msgs::FundingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
6821  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6822  */
6823 typedef struct LDKCResult_FundingSignedDecodeErrorZ {
6824    /**
6825     * The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
6826     * `err` or `result` depending on the state of `result_ok`.
6827     */
6828    union LDKCResult_FundingSignedDecodeErrorZPtr contents;
6829    /**
6830     * Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
6831     */
6832    bool result_ok;
6833 } LDKCResult_FundingSignedDecodeErrorZ;
6834
6835 /**
6836  * The contents of CResult_FundingLockedDecodeErrorZ
6837  */
6838 typedef union LDKCResult_FundingLockedDecodeErrorZPtr {
6839    /**
6840     * A pointer to the contents in the success state.
6841     * Reading from this pointer when `result_ok` is not set is undefined.
6842     */
6843    struct LDKFundingLocked *result;
6844    /**
6845     * A pointer to the contents in the error state.
6846     * Reading from this pointer when `result_ok` is set is undefined.
6847     */
6848    struct LDKDecodeError *err;
6849 } LDKCResult_FundingLockedDecodeErrorZPtr;
6850
6851 /**
6852  * A CResult_FundingLockedDecodeErrorZ represents the result of a fallible operation,
6853  * containing a crate::lightning::ln::msgs::FundingLocked on success and a crate::lightning::ln::msgs::DecodeError on failure.
6854  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6855  */
6856 typedef struct LDKCResult_FundingLockedDecodeErrorZ {
6857    /**
6858     * The contents of this CResult_FundingLockedDecodeErrorZ, accessible via either
6859     * `err` or `result` depending on the state of `result_ok`.
6860     */
6861    union LDKCResult_FundingLockedDecodeErrorZPtr contents;
6862    /**
6863     * Whether this CResult_FundingLockedDecodeErrorZ represents a success state.
6864     */
6865    bool result_ok;
6866 } LDKCResult_FundingLockedDecodeErrorZ;
6867
6868
6869
6870 /**
6871  * An init message to be sent or received from a peer
6872  */
6873 typedef struct MUST_USE_STRUCT LDKInit {
6874    /**
6875     * A pointer to the opaque Rust object.
6876     * Nearly everywhere, inner must be non-null, however in places where
6877     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6878     */
6879    LDKnativeInit *inner;
6880    /**
6881     * Indicates that this is the only struct which contains the same pointer.
6882     * Rust functions which take ownership of an object provided via an argument require
6883     * this to be true and invalidate the object pointed to by inner.
6884     */
6885    bool is_owned;
6886 } LDKInit;
6887
6888 /**
6889  * The contents of CResult_InitDecodeErrorZ
6890  */
6891 typedef union LDKCResult_InitDecodeErrorZPtr {
6892    /**
6893     * A pointer to the contents in the success state.
6894     * Reading from this pointer when `result_ok` is not set is undefined.
6895     */
6896    struct LDKInit *result;
6897    /**
6898     * A pointer to the contents in the error state.
6899     * Reading from this pointer when `result_ok` is set is undefined.
6900     */
6901    struct LDKDecodeError *err;
6902 } LDKCResult_InitDecodeErrorZPtr;
6903
6904 /**
6905  * A CResult_InitDecodeErrorZ represents the result of a fallible operation,
6906  * containing a crate::lightning::ln::msgs::Init on success and a crate::lightning::ln::msgs::DecodeError on failure.
6907  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6908  */
6909 typedef struct LDKCResult_InitDecodeErrorZ {
6910    /**
6911     * The contents of this CResult_InitDecodeErrorZ, accessible via either
6912     * `err` or `result` depending on the state of `result_ok`.
6913     */
6914    union LDKCResult_InitDecodeErrorZPtr contents;
6915    /**
6916     * Whether this CResult_InitDecodeErrorZ represents a success state.
6917     */
6918    bool result_ok;
6919 } LDKCResult_InitDecodeErrorZ;
6920
6921 /**
6922  * The contents of CResult_OpenChannelDecodeErrorZ
6923  */
6924 typedef union LDKCResult_OpenChannelDecodeErrorZPtr {
6925    /**
6926     * A pointer to the contents in the success state.
6927     * Reading from this pointer when `result_ok` is not set is undefined.
6928     */
6929    struct LDKOpenChannel *result;
6930    /**
6931     * A pointer to the contents in the error state.
6932     * Reading from this pointer when `result_ok` is set is undefined.
6933     */
6934    struct LDKDecodeError *err;
6935 } LDKCResult_OpenChannelDecodeErrorZPtr;
6936
6937 /**
6938  * A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation,
6939  * containing a crate::lightning::ln::msgs::OpenChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
6940  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6941  */
6942 typedef struct LDKCResult_OpenChannelDecodeErrorZ {
6943    /**
6944     * The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
6945     * `err` or `result` depending on the state of `result_ok`.
6946     */
6947    union LDKCResult_OpenChannelDecodeErrorZPtr contents;
6948    /**
6949     * Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
6950     */
6951    bool result_ok;
6952 } LDKCResult_OpenChannelDecodeErrorZ;
6953
6954 /**
6955  * The contents of CResult_RevokeAndACKDecodeErrorZ
6956  */
6957 typedef union LDKCResult_RevokeAndACKDecodeErrorZPtr {
6958    /**
6959     * A pointer to the contents in the success state.
6960     * Reading from this pointer when `result_ok` is not set is undefined.
6961     */
6962    struct LDKRevokeAndACK *result;
6963    /**
6964     * A pointer to the contents in the error state.
6965     * Reading from this pointer when `result_ok` is set is undefined.
6966     */
6967    struct LDKDecodeError *err;
6968 } LDKCResult_RevokeAndACKDecodeErrorZPtr;
6969
6970 /**
6971  * A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
6972  * containing a crate::lightning::ln::msgs::RevokeAndACK on success and a crate::lightning::ln::msgs::DecodeError on failure.
6973  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6974  */
6975 typedef struct LDKCResult_RevokeAndACKDecodeErrorZ {
6976    /**
6977     * The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
6978     * `err` or `result` depending on the state of `result_ok`.
6979     */
6980    union LDKCResult_RevokeAndACKDecodeErrorZPtr contents;
6981    /**
6982     * Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
6983     */
6984    bool result_ok;
6985 } LDKCResult_RevokeAndACKDecodeErrorZ;
6986
6987 /**
6988  * The contents of CResult_ShutdownDecodeErrorZ
6989  */
6990 typedef union LDKCResult_ShutdownDecodeErrorZPtr {
6991    /**
6992     * A pointer to the contents in the success state.
6993     * Reading from this pointer when `result_ok` is not set is undefined.
6994     */
6995    struct LDKShutdown *result;
6996    /**
6997     * A pointer to the contents in the error state.
6998     * Reading from this pointer when `result_ok` is set is undefined.
6999     */
7000    struct LDKDecodeError *err;
7001 } LDKCResult_ShutdownDecodeErrorZPtr;
7002
7003 /**
7004  * A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation,
7005  * containing a crate::lightning::ln::msgs::Shutdown on success and a crate::lightning::ln::msgs::DecodeError on failure.
7006  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7007  */
7008 typedef struct LDKCResult_ShutdownDecodeErrorZ {
7009    /**
7010     * The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
7011     * `err` or `result` depending on the state of `result_ok`.
7012     */
7013    union LDKCResult_ShutdownDecodeErrorZPtr contents;
7014    /**
7015     * Whether this CResult_ShutdownDecodeErrorZ represents a success state.
7016     */
7017    bool result_ok;
7018 } LDKCResult_ShutdownDecodeErrorZ;
7019
7020 /**
7021  * The contents of CResult_UpdateFailHTLCDecodeErrorZ
7022  */
7023 typedef union LDKCResult_UpdateFailHTLCDecodeErrorZPtr {
7024    /**
7025     * A pointer to the contents in the success state.
7026     * Reading from this pointer when `result_ok` is not set is undefined.
7027     */
7028    struct LDKUpdateFailHTLC *result;
7029    /**
7030     * A pointer to the contents in the error state.
7031     * Reading from this pointer when `result_ok` is set is undefined.
7032     */
7033    struct LDKDecodeError *err;
7034 } LDKCResult_UpdateFailHTLCDecodeErrorZPtr;
7035
7036 /**
7037  * A CResult_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
7038  * containing a crate::lightning::ln::msgs::UpdateFailHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
7039  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7040  */
7041 typedef struct LDKCResult_UpdateFailHTLCDecodeErrorZ {
7042    /**
7043     * The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
7044     * `err` or `result` depending on the state of `result_ok`.
7045     */
7046    union LDKCResult_UpdateFailHTLCDecodeErrorZPtr contents;
7047    /**
7048     * Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
7049     */
7050    bool result_ok;
7051 } LDKCResult_UpdateFailHTLCDecodeErrorZ;
7052
7053 /**
7054  * The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
7055  */
7056 typedef union LDKCResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
7057    /**
7058     * A pointer to the contents in the success state.
7059     * Reading from this pointer when `result_ok` is not set is undefined.
7060     */
7061    struct LDKUpdateFailMalformedHTLC *result;
7062    /**
7063     * A pointer to the contents in the error state.
7064     * Reading from this pointer when `result_ok` is set is undefined.
7065     */
7066    struct LDKDecodeError *err;
7067 } LDKCResult_UpdateFailMalformedHTLCDecodeErrorZPtr;
7068
7069 /**
7070  * A CResult_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
7071  * containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
7072  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7073  */
7074 typedef struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ {
7075    /**
7076     * The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
7077     * `err` or `result` depending on the state of `result_ok`.
7078     */
7079    union LDKCResult_UpdateFailMalformedHTLCDecodeErrorZPtr contents;
7080    /**
7081     * Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
7082     */
7083    bool result_ok;
7084 } LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ;
7085
7086
7087
7088 /**
7089  * An update_fee message to be sent or received from a peer
7090  */
7091 typedef struct MUST_USE_STRUCT LDKUpdateFee {
7092    /**
7093     * A pointer to the opaque Rust object.
7094     * Nearly everywhere, inner must be non-null, however in places where
7095     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7096     */
7097    LDKnativeUpdateFee *inner;
7098    /**
7099     * Indicates that this is the only struct which contains the same pointer.
7100     * Rust functions which take ownership of an object provided via an argument require
7101     * this to be true and invalidate the object pointed to by inner.
7102     */
7103    bool is_owned;
7104 } LDKUpdateFee;
7105
7106 /**
7107  * The contents of CResult_UpdateFeeDecodeErrorZ
7108  */
7109 typedef union LDKCResult_UpdateFeeDecodeErrorZPtr {
7110    /**
7111     * A pointer to the contents in the success state.
7112     * Reading from this pointer when `result_ok` is not set is undefined.
7113     */
7114    struct LDKUpdateFee *result;
7115    /**
7116     * A pointer to the contents in the error state.
7117     * Reading from this pointer when `result_ok` is set is undefined.
7118     */
7119    struct LDKDecodeError *err;
7120 } LDKCResult_UpdateFeeDecodeErrorZPtr;
7121
7122 /**
7123  * A CResult_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
7124  * containing a crate::lightning::ln::msgs::UpdateFee on success and a crate::lightning::ln::msgs::DecodeError on failure.
7125  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7126  */
7127 typedef struct LDKCResult_UpdateFeeDecodeErrorZ {
7128    /**
7129     * The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
7130     * `err` or `result` depending on the state of `result_ok`.
7131     */
7132    union LDKCResult_UpdateFeeDecodeErrorZPtr contents;
7133    /**
7134     * Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
7135     */
7136    bool result_ok;
7137 } LDKCResult_UpdateFeeDecodeErrorZ;
7138
7139 /**
7140  * The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
7141  */
7142 typedef union LDKCResult_UpdateFulfillHTLCDecodeErrorZPtr {
7143    /**
7144     * A pointer to the contents in the success state.
7145     * Reading from this pointer when `result_ok` is not set is undefined.
7146     */
7147    struct LDKUpdateFulfillHTLC *result;
7148    /**
7149     * A pointer to the contents in the error state.
7150     * Reading from this pointer when `result_ok` is set is undefined.
7151     */
7152    struct LDKDecodeError *err;
7153 } LDKCResult_UpdateFulfillHTLCDecodeErrorZPtr;
7154
7155 /**
7156  * A CResult_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
7157  * containing a crate::lightning::ln::msgs::UpdateFulfillHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
7158  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7159  */
7160 typedef struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ {
7161    /**
7162     * The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
7163     * `err` or `result` depending on the state of `result_ok`.
7164     */
7165    union LDKCResult_UpdateFulfillHTLCDecodeErrorZPtr contents;
7166    /**
7167     * Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
7168     */
7169    bool result_ok;
7170 } LDKCResult_UpdateFulfillHTLCDecodeErrorZ;
7171
7172 /**
7173  * The contents of CResult_UpdateAddHTLCDecodeErrorZ
7174  */
7175 typedef union LDKCResult_UpdateAddHTLCDecodeErrorZPtr {
7176    /**
7177     * A pointer to the contents in the success state.
7178     * Reading from this pointer when `result_ok` is not set is undefined.
7179     */
7180    struct LDKUpdateAddHTLC *result;
7181    /**
7182     * A pointer to the contents in the error state.
7183     * Reading from this pointer when `result_ok` is set is undefined.
7184     */
7185    struct LDKDecodeError *err;
7186 } LDKCResult_UpdateAddHTLCDecodeErrorZPtr;
7187
7188 /**
7189  * A CResult_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
7190  * containing a crate::lightning::ln::msgs::UpdateAddHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
7191  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7192  */
7193 typedef struct LDKCResult_UpdateAddHTLCDecodeErrorZ {
7194    /**
7195     * The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
7196     * `err` or `result` depending on the state of `result_ok`.
7197     */
7198    union LDKCResult_UpdateAddHTLCDecodeErrorZPtr contents;
7199    /**
7200     * Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
7201     */
7202    bool result_ok;
7203 } LDKCResult_UpdateAddHTLCDecodeErrorZ;
7204
7205
7206
7207 /**
7208  * A ping message to be sent or received from a peer
7209  */
7210 typedef struct MUST_USE_STRUCT LDKPing {
7211    /**
7212     * A pointer to the opaque Rust object.
7213     * Nearly everywhere, inner must be non-null, however in places where
7214     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7215     */
7216    LDKnativePing *inner;
7217    /**
7218     * Indicates that this is the only struct which contains the same pointer.
7219     * Rust functions which take ownership of an object provided via an argument require
7220     * this to be true and invalidate the object pointed to by inner.
7221     */
7222    bool is_owned;
7223 } LDKPing;
7224
7225 /**
7226  * The contents of CResult_PingDecodeErrorZ
7227  */
7228 typedef union LDKCResult_PingDecodeErrorZPtr {
7229    /**
7230     * A pointer to the contents in the success state.
7231     * Reading from this pointer when `result_ok` is not set is undefined.
7232     */
7233    struct LDKPing *result;
7234    /**
7235     * A pointer to the contents in the error state.
7236     * Reading from this pointer when `result_ok` is set is undefined.
7237     */
7238    struct LDKDecodeError *err;
7239 } LDKCResult_PingDecodeErrorZPtr;
7240
7241 /**
7242  * A CResult_PingDecodeErrorZ represents the result of a fallible operation,
7243  * containing a crate::lightning::ln::msgs::Ping on success and a crate::lightning::ln::msgs::DecodeError on failure.
7244  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7245  */
7246 typedef struct LDKCResult_PingDecodeErrorZ {
7247    /**
7248     * The contents of this CResult_PingDecodeErrorZ, accessible via either
7249     * `err` or `result` depending on the state of `result_ok`.
7250     */
7251    union LDKCResult_PingDecodeErrorZPtr contents;
7252    /**
7253     * Whether this CResult_PingDecodeErrorZ represents a success state.
7254     */
7255    bool result_ok;
7256 } LDKCResult_PingDecodeErrorZ;
7257
7258
7259
7260 /**
7261  * A pong message to be sent or received from a peer
7262  */
7263 typedef struct MUST_USE_STRUCT LDKPong {
7264    /**
7265     * A pointer to the opaque Rust object.
7266     * Nearly everywhere, inner must be non-null, however in places where
7267     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7268     */
7269    LDKnativePong *inner;
7270    /**
7271     * Indicates that this is the only struct which contains the same pointer.
7272     * Rust functions which take ownership of an object provided via an argument require
7273     * this to be true and invalidate the object pointed to by inner.
7274     */
7275    bool is_owned;
7276 } LDKPong;
7277
7278 /**
7279  * The contents of CResult_PongDecodeErrorZ
7280  */
7281 typedef union LDKCResult_PongDecodeErrorZPtr {
7282    /**
7283     * A pointer to the contents in the success state.
7284     * Reading from this pointer when `result_ok` is not set is undefined.
7285     */
7286    struct LDKPong *result;
7287    /**
7288     * A pointer to the contents in the error state.
7289     * Reading from this pointer when `result_ok` is set is undefined.
7290     */
7291    struct LDKDecodeError *err;
7292 } LDKCResult_PongDecodeErrorZPtr;
7293
7294 /**
7295  * A CResult_PongDecodeErrorZ represents the result of a fallible operation,
7296  * containing a crate::lightning::ln::msgs::Pong on success and a crate::lightning::ln::msgs::DecodeError on failure.
7297  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7298  */
7299 typedef struct LDKCResult_PongDecodeErrorZ {
7300    /**
7301     * The contents of this CResult_PongDecodeErrorZ, accessible via either
7302     * `err` or `result` depending on the state of `result_ok`.
7303     */
7304    union LDKCResult_PongDecodeErrorZPtr contents;
7305    /**
7306     * Whether this CResult_PongDecodeErrorZ represents a success state.
7307     */
7308    bool result_ok;
7309 } LDKCResult_PongDecodeErrorZ;
7310
7311 /**
7312  * The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
7313  */
7314 typedef union LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
7315    /**
7316     * A pointer to the contents in the success state.
7317     * Reading from this pointer when `result_ok` is not set is undefined.
7318     */
7319    struct LDKUnsignedChannelAnnouncement *result;
7320    /**
7321     * A pointer to the contents in the error state.
7322     * Reading from this pointer when `result_ok` is set is undefined.
7323     */
7324    struct LDKDecodeError *err;
7325 } LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr;
7326
7327 /**
7328  * A CResult_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
7329  * containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
7330  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7331  */
7332 typedef struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ {
7333    /**
7334     * The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
7335     * `err` or `result` depending on the state of `result_ok`.
7336     */
7337    union LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr contents;
7338    /**
7339     * Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
7340     */
7341    bool result_ok;
7342 } LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ;
7343
7344 /**
7345  * The contents of CResult_ChannelAnnouncementDecodeErrorZ
7346  */
7347 typedef union LDKCResult_ChannelAnnouncementDecodeErrorZPtr {
7348    /**
7349     * A pointer to the contents in the success state.
7350     * Reading from this pointer when `result_ok` is not set is undefined.
7351     */
7352    struct LDKChannelAnnouncement *result;
7353    /**
7354     * A pointer to the contents in the error state.
7355     * Reading from this pointer when `result_ok` is set is undefined.
7356     */
7357    struct LDKDecodeError *err;
7358 } LDKCResult_ChannelAnnouncementDecodeErrorZPtr;
7359
7360 /**
7361  * A CResult_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
7362  * containing a crate::lightning::ln::msgs::ChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
7363  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7364  */
7365 typedef struct LDKCResult_ChannelAnnouncementDecodeErrorZ {
7366    /**
7367     * The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
7368     * `err` or `result` depending on the state of `result_ok`.
7369     */
7370    union LDKCResult_ChannelAnnouncementDecodeErrorZPtr contents;
7371    /**
7372     * Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
7373     */
7374    bool result_ok;
7375 } LDKCResult_ChannelAnnouncementDecodeErrorZ;
7376
7377
7378
7379 /**
7380  * The unsigned part of a channel_update
7381  */
7382 typedef struct MUST_USE_STRUCT LDKUnsignedChannelUpdate {
7383    /**
7384     * A pointer to the opaque Rust object.
7385     * Nearly everywhere, inner must be non-null, however in places where
7386     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7387     */
7388    LDKnativeUnsignedChannelUpdate *inner;
7389    /**
7390     * Indicates that this is the only struct which contains the same pointer.
7391     * Rust functions which take ownership of an object provided via an argument require
7392     * this to be true and invalidate the object pointed to by inner.
7393     */
7394    bool is_owned;
7395 } LDKUnsignedChannelUpdate;
7396
7397 /**
7398  * The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
7399  */
7400 typedef union LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr {
7401    /**
7402     * A pointer to the contents in the success state.
7403     * Reading from this pointer when `result_ok` is not set is undefined.
7404     */
7405    struct LDKUnsignedChannelUpdate *result;
7406    /**
7407     * A pointer to the contents in the error state.
7408     * Reading from this pointer when `result_ok` is set is undefined.
7409     */
7410    struct LDKDecodeError *err;
7411 } LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr;
7412
7413 /**
7414  * A CResult_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
7415  * containing a crate::lightning::ln::msgs::UnsignedChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
7416  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7417  */
7418 typedef struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ {
7419    /**
7420     * The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
7421     * `err` or `result` depending on the state of `result_ok`.
7422     */
7423    union LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr contents;
7424    /**
7425     * Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
7426     */
7427    bool result_ok;
7428 } LDKCResult_UnsignedChannelUpdateDecodeErrorZ;
7429
7430 /**
7431  * The contents of CResult_ChannelUpdateDecodeErrorZ
7432  */
7433 typedef union LDKCResult_ChannelUpdateDecodeErrorZPtr {
7434    /**
7435     * A pointer to the contents in the success state.
7436     * Reading from this pointer when `result_ok` is not set is undefined.
7437     */
7438    struct LDKChannelUpdate *result;
7439    /**
7440     * A pointer to the contents in the error state.
7441     * Reading from this pointer when `result_ok` is set is undefined.
7442     */
7443    struct LDKDecodeError *err;
7444 } LDKCResult_ChannelUpdateDecodeErrorZPtr;
7445
7446 /**
7447  * A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
7448  * containing a crate::lightning::ln::msgs::ChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
7449  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7450  */
7451 typedef struct LDKCResult_ChannelUpdateDecodeErrorZ {
7452    /**
7453     * The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
7454     * `err` or `result` depending on the state of `result_ok`.
7455     */
7456    union LDKCResult_ChannelUpdateDecodeErrorZPtr contents;
7457    /**
7458     * Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
7459     */
7460    bool result_ok;
7461 } LDKCResult_ChannelUpdateDecodeErrorZ;
7462
7463 /**
7464  * The contents of CResult_ErrorMessageDecodeErrorZ
7465  */
7466 typedef union LDKCResult_ErrorMessageDecodeErrorZPtr {
7467    /**
7468     * A pointer to the contents in the success state.
7469     * Reading from this pointer when `result_ok` is not set is undefined.
7470     */
7471    struct LDKErrorMessage *result;
7472    /**
7473     * A pointer to the contents in the error state.
7474     * Reading from this pointer when `result_ok` is set is undefined.
7475     */
7476    struct LDKDecodeError *err;
7477 } LDKCResult_ErrorMessageDecodeErrorZPtr;
7478
7479 /**
7480  * A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
7481  * containing a crate::lightning::ln::msgs::ErrorMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
7482  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7483  */
7484 typedef struct LDKCResult_ErrorMessageDecodeErrorZ {
7485    /**
7486     * The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
7487     * `err` or `result` depending on the state of `result_ok`.
7488     */
7489    union LDKCResult_ErrorMessageDecodeErrorZPtr contents;
7490    /**
7491     * Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
7492     */
7493    bool result_ok;
7494 } LDKCResult_ErrorMessageDecodeErrorZ;
7495
7496
7497
7498 /**
7499  * The unsigned part of a node_announcement
7500  */
7501 typedef struct MUST_USE_STRUCT LDKUnsignedNodeAnnouncement {
7502    /**
7503     * A pointer to the opaque Rust object.
7504     * Nearly everywhere, inner must be non-null, however in places where
7505     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7506     */
7507    LDKnativeUnsignedNodeAnnouncement *inner;
7508    /**
7509     * Indicates that this is the only struct which contains the same pointer.
7510     * Rust functions which take ownership of an object provided via an argument require
7511     * this to be true and invalidate the object pointed to by inner.
7512     */
7513    bool is_owned;
7514 } LDKUnsignedNodeAnnouncement;
7515
7516 /**
7517  * The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
7518  */
7519 typedef union LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
7520    /**
7521     * A pointer to the contents in the success state.
7522     * Reading from this pointer when `result_ok` is not set is undefined.
7523     */
7524    struct LDKUnsignedNodeAnnouncement *result;
7525    /**
7526     * A pointer to the contents in the error state.
7527     * Reading from this pointer when `result_ok` is set is undefined.
7528     */
7529    struct LDKDecodeError *err;
7530 } LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr;
7531
7532 /**
7533  * A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
7534  * containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
7535  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7536  */
7537 typedef struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ {
7538    /**
7539     * The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
7540     * `err` or `result` depending on the state of `result_ok`.
7541     */
7542    union LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr contents;
7543    /**
7544     * Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
7545     */
7546    bool result_ok;
7547 } LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ;
7548
7549 /**
7550  * The contents of CResult_NodeAnnouncementDecodeErrorZ
7551  */
7552 typedef union LDKCResult_NodeAnnouncementDecodeErrorZPtr {
7553    /**
7554     * A pointer to the contents in the success state.
7555     * Reading from this pointer when `result_ok` is not set is undefined.
7556     */
7557    struct LDKNodeAnnouncement *result;
7558    /**
7559     * A pointer to the contents in the error state.
7560     * Reading from this pointer when `result_ok` is set is undefined.
7561     */
7562    struct LDKDecodeError *err;
7563 } LDKCResult_NodeAnnouncementDecodeErrorZPtr;
7564
7565 /**
7566  * A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
7567  * containing a crate::lightning::ln::msgs::NodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
7568  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7569  */
7570 typedef struct LDKCResult_NodeAnnouncementDecodeErrorZ {
7571    /**
7572     * The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
7573     * `err` or `result` depending on the state of `result_ok`.
7574     */
7575    union LDKCResult_NodeAnnouncementDecodeErrorZPtr contents;
7576    /**
7577     * Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
7578     */
7579    bool result_ok;
7580 } LDKCResult_NodeAnnouncementDecodeErrorZ;
7581
7582 /**
7583  * The contents of CResult_QueryShortChannelIdsDecodeErrorZ
7584  */
7585 typedef union LDKCResult_QueryShortChannelIdsDecodeErrorZPtr {
7586    /**
7587     * A pointer to the contents in the success state.
7588     * Reading from this pointer when `result_ok` is not set is undefined.
7589     */
7590    struct LDKQueryShortChannelIds *result;
7591    /**
7592     * A pointer to the contents in the error state.
7593     * Reading from this pointer when `result_ok` is set is undefined.
7594     */
7595    struct LDKDecodeError *err;
7596 } LDKCResult_QueryShortChannelIdsDecodeErrorZPtr;
7597
7598 /**
7599  * A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
7600  * containing a crate::lightning::ln::msgs::QueryShortChannelIds on success and a crate::lightning::ln::msgs::DecodeError on failure.
7601  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7602  */
7603 typedef struct LDKCResult_QueryShortChannelIdsDecodeErrorZ {
7604    /**
7605     * The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
7606     * `err` or `result` depending on the state of `result_ok`.
7607     */
7608    union LDKCResult_QueryShortChannelIdsDecodeErrorZPtr contents;
7609    /**
7610     * Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
7611     */
7612    bool result_ok;
7613 } LDKCResult_QueryShortChannelIdsDecodeErrorZ;
7614
7615
7616
7617 /**
7618  * A reply_short_channel_ids_end message is sent as a reply to a
7619  * query_short_channel_ids message. The query recipient makes a best
7620  * effort to respond based on their local network view which may not be
7621  * a perfect view of the network.
7622  */
7623 typedef struct MUST_USE_STRUCT LDKReplyShortChannelIdsEnd {
7624    /**
7625     * A pointer to the opaque Rust object.
7626     * Nearly everywhere, inner must be non-null, however in places where
7627     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7628     */
7629    LDKnativeReplyShortChannelIdsEnd *inner;
7630    /**
7631     * Indicates that this is the only struct which contains the same pointer.
7632     * Rust functions which take ownership of an object provided via an argument require
7633     * this to be true and invalidate the object pointed to by inner.
7634     */
7635    bool is_owned;
7636 } LDKReplyShortChannelIdsEnd;
7637
7638 /**
7639  * The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
7640  */
7641 typedef union LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
7642    /**
7643     * A pointer to the contents in the success state.
7644     * Reading from this pointer when `result_ok` is not set is undefined.
7645     */
7646    struct LDKReplyShortChannelIdsEnd *result;
7647    /**
7648     * A pointer to the contents in the error state.
7649     * Reading from this pointer when `result_ok` is set is undefined.
7650     */
7651    struct LDKDecodeError *err;
7652 } LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr;
7653
7654 /**
7655  * A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
7656  * containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::lightning::ln::msgs::DecodeError on failure.
7657  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7658  */
7659 typedef struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ {
7660    /**
7661     * The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
7662     * `err` or `result` depending on the state of `result_ok`.
7663     */
7664    union LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr contents;
7665    /**
7666     * Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
7667     */
7668    bool result_ok;
7669 } LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ;
7670
7671 /**
7672  * The contents of CResult_QueryChannelRangeDecodeErrorZ
7673  */
7674 typedef union LDKCResult_QueryChannelRangeDecodeErrorZPtr {
7675    /**
7676     * A pointer to the contents in the success state.
7677     * Reading from this pointer when `result_ok` is not set is undefined.
7678     */
7679    struct LDKQueryChannelRange *result;
7680    /**
7681     * A pointer to the contents in the error state.
7682     * Reading from this pointer when `result_ok` is set is undefined.
7683     */
7684    struct LDKDecodeError *err;
7685 } LDKCResult_QueryChannelRangeDecodeErrorZPtr;
7686
7687 /**
7688  * A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
7689  * containing a crate::lightning::ln::msgs::QueryChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
7690  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7691  */
7692 typedef struct LDKCResult_QueryChannelRangeDecodeErrorZ {
7693    /**
7694     * The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
7695     * `err` or `result` depending on the state of `result_ok`.
7696     */
7697    union LDKCResult_QueryChannelRangeDecodeErrorZPtr contents;
7698    /**
7699     * Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
7700     */
7701    bool result_ok;
7702 } LDKCResult_QueryChannelRangeDecodeErrorZ;
7703
7704 /**
7705  * The contents of CResult_ReplyChannelRangeDecodeErrorZ
7706  */
7707 typedef union LDKCResult_ReplyChannelRangeDecodeErrorZPtr {
7708    /**
7709     * A pointer to the contents in the success state.
7710     * Reading from this pointer when `result_ok` is not set is undefined.
7711     */
7712    struct LDKReplyChannelRange *result;
7713    /**
7714     * A pointer to the contents in the error state.
7715     * Reading from this pointer when `result_ok` is set is undefined.
7716     */
7717    struct LDKDecodeError *err;
7718 } LDKCResult_ReplyChannelRangeDecodeErrorZPtr;
7719
7720 /**
7721  * A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
7722  * containing a crate::lightning::ln::msgs::ReplyChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
7723  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7724  */
7725 typedef struct LDKCResult_ReplyChannelRangeDecodeErrorZ {
7726    /**
7727     * The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
7728     * `err` or `result` depending on the state of `result_ok`.
7729     */
7730    union LDKCResult_ReplyChannelRangeDecodeErrorZPtr contents;
7731    /**
7732     * Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
7733     */
7734    bool result_ok;
7735 } LDKCResult_ReplyChannelRangeDecodeErrorZ;
7736
7737
7738
7739 /**
7740  * A gossip_timestamp_filter message is used by a node to request
7741  * gossip relay for messages in the requested time range when the
7742  * gossip_queries feature has been negotiated.
7743  */
7744 typedef struct MUST_USE_STRUCT LDKGossipTimestampFilter {
7745    /**
7746     * A pointer to the opaque Rust object.
7747     * Nearly everywhere, inner must be non-null, however in places where
7748     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7749     */
7750    LDKnativeGossipTimestampFilter *inner;
7751    /**
7752     * Indicates that this is the only struct which contains the same pointer.
7753     * Rust functions which take ownership of an object provided via an argument require
7754     * this to be true and invalidate the object pointed to by inner.
7755     */
7756    bool is_owned;
7757 } LDKGossipTimestampFilter;
7758
7759 /**
7760  * The contents of CResult_GossipTimestampFilterDecodeErrorZ
7761  */
7762 typedef union LDKCResult_GossipTimestampFilterDecodeErrorZPtr {
7763    /**
7764     * A pointer to the contents in the success state.
7765     * Reading from this pointer when `result_ok` is not set is undefined.
7766     */
7767    struct LDKGossipTimestampFilter *result;
7768    /**
7769     * A pointer to the contents in the error state.
7770     * Reading from this pointer when `result_ok` is set is undefined.
7771     */
7772    struct LDKDecodeError *err;
7773 } LDKCResult_GossipTimestampFilterDecodeErrorZPtr;
7774
7775 /**
7776  * A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
7777  * containing a crate::lightning::ln::msgs::GossipTimestampFilter on success and a crate::lightning::ln::msgs::DecodeError on failure.
7778  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7779  */
7780 typedef struct LDKCResult_GossipTimestampFilterDecodeErrorZ {
7781    /**
7782     * The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
7783     * `err` or `result` depending on the state of `result_ok`.
7784     */
7785    union LDKCResult_GossipTimestampFilterDecodeErrorZPtr contents;
7786    /**
7787     * Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
7788     */
7789    bool result_ok;
7790 } LDKCResult_GossipTimestampFilterDecodeErrorZ;
7791
7792 /**
7793  * When signing using a fallible method either an user-supplied `SignError` or a `CreationError`
7794  * may occur.
7795  */
7796 typedef enum LDKSignOrCreationError_Tag {
7797    /**
7798     * An error occurred during signing
7799     */
7800    LDKSignOrCreationError_SignError,
7801    /**
7802     * An error occurred while building the transaction
7803     */
7804    LDKSignOrCreationError_CreationError,
7805    /**
7806     * Must be last for serialization purposes
7807     */
7808    LDKSignOrCreationError_Sentinel,
7809 } LDKSignOrCreationError_Tag;
7810
7811 typedef struct MUST_USE_STRUCT LDKSignOrCreationError {
7812    LDKSignOrCreationError_Tag tag;
7813    union {
7814       struct {
7815          enum LDKCreationError creation_error;
7816       };
7817    };
7818 } LDKSignOrCreationError;
7819
7820 /**
7821  * The contents of CResult_InvoiceSignOrCreationErrorZ
7822  */
7823 typedef union LDKCResult_InvoiceSignOrCreationErrorZPtr {
7824    /**
7825     * A pointer to the contents in the success state.
7826     * Reading from this pointer when `result_ok` is not set is undefined.
7827     */
7828    struct LDKInvoice *result;
7829    /**
7830     * A pointer to the contents in the error state.
7831     * Reading from this pointer when `result_ok` is set is undefined.
7832     */
7833    struct LDKSignOrCreationError *err;
7834 } LDKCResult_InvoiceSignOrCreationErrorZPtr;
7835
7836 /**
7837  * A CResult_InvoiceSignOrCreationErrorZ represents the result of a fallible operation,
7838  * containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SignOrCreationError on failure.
7839  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7840  */
7841 typedef struct LDKCResult_InvoiceSignOrCreationErrorZ {
7842    /**
7843     * The contents of this CResult_InvoiceSignOrCreationErrorZ, accessible via either
7844     * `err` or `result` depending on the state of `result_ok`.
7845     */
7846    union LDKCResult_InvoiceSignOrCreationErrorZPtr contents;
7847    /**
7848     * Whether this CResult_InvoiceSignOrCreationErrorZ represents a success state.
7849     */
7850    bool result_ok;
7851 } LDKCResult_InvoiceSignOrCreationErrorZ;
7852
7853 /**
7854  * A trait indicating an object may generate message send events
7855  */
7856 typedef struct LDKMessageSendEventsProvider {
7857    /**
7858     * An opaque pointer which is passed to your function implementations as an argument.
7859     * This has no meaning in the LDK, and can be NULL or any other value.
7860     */
7861    void *this_arg;
7862    /**
7863     * Gets the list of pending events which were generated by previous actions, clearing the list
7864     * in the process.
7865     */
7866    struct LDKCVec_MessageSendEventZ (*get_and_clear_pending_msg_events)(const void *this_arg);
7867    /**
7868     * Frees any resources associated with this object given its this_arg pointer.
7869     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7870     */
7871    void (*free)(void *this_arg);
7872 } LDKMessageSendEventsProvider;
7873
7874 /**
7875  * A trait implemented for objects handling events from [`EventsProvider`].
7876  */
7877 typedef struct LDKEventHandler {
7878    /**
7879     * An opaque pointer which is passed to your function implementations as an argument.
7880     * This has no meaning in the LDK, and can be NULL or any other value.
7881     */
7882    void *this_arg;
7883    /**
7884     * Handles the given [`Event`].
7885     *
7886     * See [`EventsProvider`] for details that must be considered when implementing this method.
7887     */
7888    void (*handle_event)(const void *this_arg, struct LDKEvent event);
7889    /**
7890     * Frees any resources associated with this object given its this_arg pointer.
7891     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7892     */
7893    void (*free)(void *this_arg);
7894 } LDKEventHandler;
7895
7896 /**
7897  * A trait indicating an object may generate events.
7898  *
7899  * Events are processed by passing an [`EventHandler`] to [`process_pending_events`].
7900  *
7901  * # Requirements
7902  *
7903  * See [`process_pending_events`] for requirements around event processing.
7904  *
7905  * When using this trait, [`process_pending_events`] will call [`handle_event`] for each pending
7906  * event since the last invocation. The handler must either act upon the event immediately
7907  * or preserve it for later handling.
7908  *
7909  * Note, handlers may call back into the provider and thus deadlocking must be avoided. Be sure to
7910  * consult the provider's documentation on the implication of processing events and how a handler
7911  * may safely use the provider (e.g., see [`ChannelManager::process_pending_events`] and
7912  * [`ChainMonitor::process_pending_events`]).
7913  *
7914  * (C-not implementable) As there is likely no reason for a user to implement this trait on their
7915  * own type(s).
7916  *
7917  * [`process_pending_events`]: Self::process_pending_events
7918  * [`handle_event`]: EventHandler::handle_event
7919  * [`ChannelManager::process_pending_events`]: crate::ln::channelmanager::ChannelManager#method.process_pending_events
7920  * [`ChainMonitor::process_pending_events`]: crate::chain::chainmonitor::ChainMonitor#method.process_pending_events
7921  */
7922 typedef struct LDKEventsProvider {
7923    /**
7924     * An opaque pointer which is passed to your function implementations as an argument.
7925     * This has no meaning in the LDK, and can be NULL or any other value.
7926     */
7927    void *this_arg;
7928    /**
7929     * Processes any events generated since the last call using the given event handler.
7930     *
7931     * Subsequent calls must only process new events. However, handlers must be capable of handling
7932     * duplicate events across process restarts. This may occur if the provider was recovered from
7933     * an old state (i.e., it hadn't been successfully persisted after processing pending events).
7934     */
7935    void (*process_pending_events)(const void *this_arg, struct LDKEventHandler handler);
7936    /**
7937     * Frees any resources associated with this object given its this_arg pointer.
7938     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7939     */
7940    void (*free)(void *this_arg);
7941 } LDKEventsProvider;
7942
7943
7944
7945 /**
7946  * Configuration we set when applicable.
7947  *
7948  * Default::default() provides sane defaults.
7949  */
7950 typedef struct MUST_USE_STRUCT LDKChannelHandshakeConfig {
7951    /**
7952     * A pointer to the opaque Rust object.
7953     * Nearly everywhere, inner must be non-null, however in places where
7954     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7955     */
7956    LDKnativeChannelHandshakeConfig *inner;
7957    /**
7958     * Indicates that this is the only struct which contains the same pointer.
7959     * Rust functions which take ownership of an object provided via an argument require
7960     * this to be true and invalidate the object pointed to by inner.
7961     */
7962    bool is_owned;
7963 } LDKChannelHandshakeConfig;
7964
7965
7966
7967 /**
7968  * Optional channel limits which are applied during channel creation.
7969  *
7970  * These limits are only applied to our counterparty's limits, not our own.
7971  *
7972  * Use 0/<type>::max_value() as appropriate to skip checking.
7973  *
7974  * Provides sane defaults for most configurations.
7975  *
7976  * Most additional limits are disabled except those with which specify a default in individual
7977  * field documentation. Note that this may result in barely-usable channels, but since they
7978  * are applied mostly only to incoming channels that's not much of a problem.
7979  */
7980 typedef struct MUST_USE_STRUCT LDKChannelHandshakeLimits {
7981    /**
7982     * A pointer to the opaque Rust object.
7983     * Nearly everywhere, inner must be non-null, however in places where
7984     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7985     */
7986    LDKnativeChannelHandshakeLimits *inner;
7987    /**
7988     * Indicates that this is the only struct which contains the same pointer.
7989     * Rust functions which take ownership of an object provided via an argument require
7990     * this to be true and invalidate the object pointed to by inner.
7991     */
7992    bool is_owned;
7993 } LDKChannelHandshakeLimits;
7994
7995
7996
7997 /**
7998  * Top-level config which holds ChannelHandshakeLimits and ChannelConfig.
7999  *
8000  * Default::default() provides sane defaults for most configurations
8001  * (but currently with 0 relay fees!)
8002  */
8003 typedef struct MUST_USE_STRUCT LDKUserConfig {
8004    /**
8005     * A pointer to the opaque Rust object.
8006     * Nearly everywhere, inner must be non-null, however in places where
8007     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8008     */
8009    LDKnativeUserConfig *inner;
8010    /**
8011     * Indicates that this is the only struct which contains the same pointer.
8012     * Rust functions which take ownership of an object provided via an argument require
8013     * this to be true and invalidate the object pointed to by inner.
8014     */
8015    bool is_owned;
8016 } LDKUserConfig;
8017
8018
8019
8020 /**
8021  * The best known block as identified by its hash and height.
8022  */
8023 typedef struct MUST_USE_STRUCT LDKBestBlock {
8024    /**
8025     * A pointer to the opaque Rust object.
8026     * Nearly everywhere, inner must be non-null, however in places where
8027     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8028     */
8029    LDKnativeBestBlock *inner;
8030    /**
8031     * Indicates that this is the only struct which contains the same pointer.
8032     * Rust functions which take ownership of an object provided via an argument require
8033     * this to be true and invalidate the object pointed to by inner.
8034     */
8035    bool is_owned;
8036 } LDKBestBlock;
8037
8038 /**
8039  * The `Access` trait defines behavior for accessing chain data and state, such as blocks and
8040  * UTXOs.
8041  */
8042 typedef struct LDKAccess {
8043    /**
8044     * An opaque pointer which is passed to your function implementations as an argument.
8045     * This has no meaning in the LDK, and can be NULL or any other value.
8046     */
8047    void *this_arg;
8048    /**
8049     * Returns the transaction output of a funding transaction encoded by [`short_channel_id`].
8050     * Returns an error if `genesis_hash` is for a different chain or if such a transaction output
8051     * is unknown.
8052     *
8053     * [`short_channel_id`]: https://github.com/lightningnetwork/lightning-rfc/blob/master/07-routing-gossip.md#definition-of-short_channel_id
8054     */
8055    struct LDKCResult_TxOutAccessErrorZ (*get_utxo)(const void *this_arg, const uint8_t (*genesis_hash)[32], uint64_t short_channel_id);
8056    /**
8057     * Frees any resources associated with this object given its this_arg pointer.
8058     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
8059     */
8060    void (*free)(void *this_arg);
8061 } LDKAccess;
8062
8063 /**
8064  * The `Listen` trait is used to notify when blocks have been connected or disconnected from the
8065  * chain.
8066  *
8067  * Useful when needing to replay chain data upon startup or as new chain events occur. Clients
8068  * sourcing chain data using a block-oriented API should prefer this interface over [`Confirm`].
8069  * Such clients fetch the entire header chain whereas clients using [`Confirm`] only fetch headers
8070  * when needed.
8071  */
8072 typedef struct LDKListen {
8073    /**
8074     * An opaque pointer which is passed to your function implementations as an argument.
8075     * This has no meaning in the LDK, and can be NULL or any other value.
8076     */
8077    void *this_arg;
8078    /**
8079     * Notifies the listener that a block was added at the given height.
8080     */
8081    void (*block_connected)(const void *this_arg, struct LDKu8slice block, uint32_t height);
8082    /**
8083     * Notifies the listener that a block was removed at the given height.
8084     */
8085    void (*block_disconnected)(const void *this_arg, const uint8_t (*header)[80], uint32_t height);
8086    /**
8087     * Frees any resources associated with this object given its this_arg pointer.
8088     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
8089     */
8090    void (*free)(void *this_arg);
8091 } LDKListen;
8092
8093 /**
8094  * The `Confirm` trait is used to notify when transactions have been confirmed on chain or
8095  * unconfirmed during a chain reorganization.
8096  *
8097  * Clients sourcing chain data using a transaction-oriented API should prefer this interface over
8098  * [`Listen`]. For instance, an Electrum client may implement [`Filter`] by subscribing to activity
8099  * related to registered transactions and outputs. Upon notification, it would pass along the
8100  * matching transactions using this interface.
8101  *
8102  * # Use
8103  *
8104  * The intended use is as follows:
8105  * - Call [`transactions_confirmed`] to process any on-chain activity of interest.
8106  * - Call [`transaction_unconfirmed`] to process any transaction returned by [`get_relevant_txids`]
8107  *   that has been reorganized out of the chain.
8108  * - Call [`best_block_updated`] whenever a new chain tip becomes available.
8109  *
8110  * # Order
8111  *
8112  * Clients must call these methods in chain order. Specifically:
8113  * - Transactions confirmed in a block must be given before transactions confirmed in a later
8114  *   block.
8115  * - Dependent transactions within the same block must be given in topological order, possibly in
8116  *   separate calls.
8117  * - Unconfirmed transactions must be given after the original confirmations and before any
8118  *   reconfirmation.
8119  *
8120  * See individual method documentation for further details.
8121  *
8122  * [`transactions_confirmed`]: Self::transactions_confirmed
8123  * [`transaction_unconfirmed`]: Self::transaction_unconfirmed
8124  * [`best_block_updated`]: Self::best_block_updated
8125  * [`get_relevant_txids`]: Self::get_relevant_txids
8126  */
8127 typedef struct LDKConfirm {
8128    /**
8129     * An opaque pointer which is passed to your function implementations as an argument.
8130     * This has no meaning in the LDK, and can be NULL or any other value.
8131     */
8132    void *this_arg;
8133    /**
8134     * Processes transactions confirmed in a block with a given header and height.
8135     *
8136     * Should be called for any transactions registered by [`Filter::register_tx`] or any
8137     * transactions spending an output registered by [`Filter::register_output`]. Such transactions
8138     * appearing in the same block do not need to be included in the same call; instead, multiple
8139     * calls with additional transactions may be made so long as they are made in [chain order].
8140     *
8141     * May be called before or after [`best_block_updated`] for the corresponding block. However,
8142     * in the event of a chain reorganization, it must not be called with a `header` that is no
8143     * longer in the chain as of the last call to [`best_block_updated`].
8144     *
8145     * [chain order]: Confirm#Order
8146     * [`best_block_updated`]: Self::best_block_updated
8147     */
8148    void (*transactions_confirmed)(const void *this_arg, const uint8_t (*header)[80], struct LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height);
8149    /**
8150     * Processes a transaction that is no longer confirmed as result of a chain reorganization.
8151     *
8152     * Should be called for any transaction returned by [`get_relevant_txids`] if it has been
8153     * reorganized out of the best chain. Once called, the given transaction should not be returned
8154     * by [`get_relevant_txids`] unless it has been reconfirmed via [`transactions_confirmed`].
8155     *
8156     * [`get_relevant_txids`]: Self::get_relevant_txids
8157     * [`transactions_confirmed`]: Self::transactions_confirmed
8158     */
8159    void (*transaction_unconfirmed)(const void *this_arg, const uint8_t (*txid)[32]);
8160    /**
8161     * Processes an update to the best header connected at the given height.
8162     *
8163     * Should be called when a new header is available but may be skipped for intermediary blocks
8164     * if they become available at the same time.
8165     */
8166    void (*best_block_updated)(const void *this_arg, const uint8_t (*header)[80], uint32_t height);
8167    /**
8168     * Returns transactions that should be monitored for reorganization out of the chain.
8169     *
8170     * Should include any transactions passed to [`transactions_confirmed`] that have insufficient
8171     * confirmations to be safe from a chain reorganization. Should not include any transactions
8172     * passed to [`transaction_unconfirmed`] unless later reconfirmed.
8173     *
8174     * May be called to determine the subset of transactions that must still be monitored for
8175     * reorganization. Will be idempotent between calls but may change as a result of calls to the
8176     * other interface methods. Thus, this is useful to determine which transactions may need to be
8177     * given to [`transaction_unconfirmed`].
8178     *
8179     * [`transactions_confirmed`]: Self::transactions_confirmed
8180     * [`transaction_unconfirmed`]: Self::transaction_unconfirmed
8181     */
8182    struct LDKCVec_TxidZ (*get_relevant_txids)(const void *this_arg);
8183    /**
8184     * Frees any resources associated with this object given its this_arg pointer.
8185     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
8186     */
8187    void (*free)(void *this_arg);
8188 } LDKConfirm;
8189
8190
8191
8192 /**
8193  * A transaction output watched by a [`ChannelMonitor`] for spends on-chain.
8194  *
8195  * Used to convey to a [`Filter`] such an output with a given spending condition. Any transaction
8196  * spending the output must be given to [`ChannelMonitor::block_connected`] either directly or via
8197  * the return value of [`Filter::register_output`].
8198  *
8199  * If `block_hash` is `Some`, this indicates the output was created in the corresponding block and
8200  * may have been spent there. See [`Filter::register_output`] for details.
8201  *
8202  * [`ChannelMonitor`]: channelmonitor::ChannelMonitor
8203  * [`ChannelMonitor::block_connected`]: channelmonitor::ChannelMonitor::block_connected
8204  */
8205 typedef struct MUST_USE_STRUCT LDKWatchedOutput {
8206    /**
8207     * A pointer to the opaque Rust object.
8208     * Nearly everywhere, inner must be non-null, however in places where
8209     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8210     */
8211    LDKnativeWatchedOutput *inner;
8212    /**
8213     * Indicates that this is the only struct which contains the same pointer.
8214     * Rust functions which take ownership of an object provided via an argument require
8215     * this to be true and invalidate the object pointed to by inner.
8216     */
8217    bool is_owned;
8218 } LDKWatchedOutput;
8219
8220 /**
8221  * The `Filter` trait defines behavior for indicating chain activity of interest pertaining to
8222  * channels.
8223  *
8224  * This is useful in order to have a [`Watch`] implementation convey to a chain source which
8225  * transactions to be notified of. Notification may take the form of pre-filtering blocks or, in
8226  * the case of [BIP 157]/[BIP 158], only fetching a block if the compact filter matches. If
8227  * receiving full blocks from a chain source, any further filtering is unnecessary.
8228  *
8229  * After an output has been registered, subsequent block retrievals from the chain source must not
8230  * exclude any transactions matching the new criteria nor any in-block descendants of such
8231  * transactions.
8232  *
8233  * Note that use as part of a [`Watch`] implementation involves reentrancy. Therefore, the `Filter`
8234  * should not block on I/O. Implementations should instead queue the newly monitored data to be
8235  * processed later. Then, in order to block until the data has been processed, any [`Watch`]
8236  * invocation that has called the `Filter` must return [`TemporaryFailure`].
8237  *
8238  * [`TemporaryFailure`]: channelmonitor::ChannelMonitorUpdateErr::TemporaryFailure
8239  * [BIP 157]: https://github.com/bitcoin/bips/blob/master/bip-0157.mediawiki
8240  * [BIP 158]: https://github.com/bitcoin/bips/blob/master/bip-0158.mediawiki
8241  */
8242 typedef struct LDKFilter {
8243    /**
8244     * An opaque pointer which is passed to your function implementations as an argument.
8245     * This has no meaning in the LDK, and can be NULL or any other value.
8246     */
8247    void *this_arg;
8248    /**
8249     * Registers interest in a transaction with `txid` and having an output with `script_pubkey` as
8250     * a spending condition.
8251     */
8252    void (*register_tx)(const void *this_arg, const uint8_t (*txid)[32], struct LDKu8slice script_pubkey);
8253    /**
8254     * Registers interest in spends of a transaction output.
8255     *
8256     * Optionally, when `output.block_hash` is set, should return any transaction spending the
8257     * output that is found in the corresponding block along with its index.
8258     *
8259     * This return value is useful for Electrum clients in order to supply in-block descendant
8260     * transactions which otherwise were not included. This is not necessary for other clients if
8261     * such descendant transactions were already included (e.g., when a BIP 157 client provides the
8262     * full block).
8263     */
8264    struct LDKCOption_C2Tuple_usizeTransactionZZ (*register_output)(const void *this_arg, struct LDKWatchedOutput output);
8265    /**
8266     * Frees any resources associated with this object given its this_arg pointer.
8267     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
8268     */
8269    void (*free)(void *this_arg);
8270 } LDKFilter;
8271
8272 /**
8273  * `Persist` defines behavior for persisting channel monitors: this could mean
8274  * writing once to disk, and/or uploading to one or more backup services.
8275  *
8276  * Note that for every new monitor, you **must** persist the new `ChannelMonitor`
8277  * to disk/backups. And, on every update, you **must** persist either the
8278  * `ChannelMonitorUpdate` or the updated monitor itself. Otherwise, there is risk
8279  * of situations such as revoking a transaction, then crashing before this
8280  * revocation can be persisted, then unintentionally broadcasting a revoked
8281  * transaction and losing money. This is a risk because previous channel states
8282  * are toxic, so it's important that whatever channel state is persisted is
8283  * kept up-to-date.
8284  */
8285 typedef struct LDKPersist {
8286    /**
8287     * An opaque pointer which is passed to your function implementations as an argument.
8288     * This has no meaning in the LDK, and can be NULL or any other value.
8289     */
8290    void *this_arg;
8291    /**
8292     * Persist a new channel's data. The data can be stored any way you want, but
8293     * the identifier provided by Rust-Lightning is the channel's outpoint (and
8294     * it is up to you to maintain a correct mapping between the outpoint and the
8295     * stored channel data). Note that you **must** persist every new monitor to
8296     * disk. See the `Persist` trait documentation for more details.
8297     *
8298     * See [`ChannelMonitor::write`] for writing out a `ChannelMonitor`,
8299     * and [`ChannelMonitorUpdateErr`] for requirements when returning errors.
8300     */
8301    struct LDKCResult_NoneChannelMonitorUpdateErrZ (*persist_new_channel)(const void *this_arg, struct LDKOutPoint id, const struct LDKChannelMonitor *NONNULL_PTR data);
8302    /**
8303     * Update one channel's data. The provided `ChannelMonitor` has already
8304     * applied the given update.
8305     *
8306     * Note that on every update, you **must** persist either the
8307     * `ChannelMonitorUpdate` or the updated monitor itself to disk/backups. See
8308     * the `Persist` trait documentation for more details.
8309     *
8310     * If an implementer chooses to persist the updates only, they need to make
8311     * sure that all the updates are applied to the `ChannelMonitors` *before*
8312     * the set of channel monitors is given to the `ChannelManager`
8313     * deserialization routine. See [`ChannelMonitor::update_monitor`] for
8314     * applying a monitor update to a monitor. If full `ChannelMonitors` are
8315     * persisted, then there is no need to persist individual updates.
8316     *
8317     * Note that there could be a performance tradeoff between persisting complete
8318     * channel monitors on every update vs. persisting only updates and applying
8319     * them in batches. The size of each monitor grows `O(number of state updates)`
8320     * whereas updates are small and `O(1)`.
8321     *
8322     * See [`ChannelMonitor::write`] for writing out a `ChannelMonitor`,
8323     * [`ChannelMonitorUpdate::write`] for writing out an update, and
8324     * [`ChannelMonitorUpdateErr`] for requirements when returning errors.
8325     */
8326    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);
8327    /**
8328     * Frees any resources associated with this object given its this_arg pointer.
8329     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
8330     */
8331    void (*free)(void *this_arg);
8332 } LDKPersist;
8333
8334
8335
8336 /**
8337  * An implementation of [`chain::Watch`] for monitoring channels.
8338  *
8339  * Connected and disconnected blocks must be provided to `ChainMonitor` as documented by
8340  * [`chain::Watch`]. May be used in conjunction with [`ChannelManager`] to monitor channels locally
8341  * or used independently to monitor channels remotely. See the [module-level documentation] for
8342  * details.
8343  *
8344  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
8345  * [module-level documentation]: crate::chain::chainmonitor
8346  */
8347 typedef struct MUST_USE_STRUCT LDKChainMonitor {
8348    /**
8349     * A pointer to the opaque Rust object.
8350     * Nearly everywhere, inner must be non-null, however in places where
8351     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8352     */
8353    LDKnativeChainMonitor *inner;
8354    /**
8355     * Indicates that this is the only struct which contains the same pointer.
8356     * Rust functions which take ownership of an object provided via an argument require
8357     * this to be true and invalidate the object pointed to by inner.
8358     */
8359    bool is_owned;
8360 } LDKChainMonitor;
8361
8362
8363
8364 /**
8365  * Simple KeysInterface implementor that takes a 32-byte seed for use as a BIP 32 extended key
8366  * and derives keys from that.
8367  *
8368  * Your node_id is seed/0'
8369  * ChannelMonitor closes may use seed/1'
8370  * Cooperative closes may use seed/2'
8371  * The two close keys may be needed to claim on-chain funds!
8372  */
8373 typedef struct MUST_USE_STRUCT LDKKeysManager {
8374    /**
8375     * A pointer to the opaque Rust object.
8376     * Nearly everywhere, inner must be non-null, however in places where
8377     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8378     */
8379    LDKnativeKeysManager *inner;
8380    /**
8381     * Indicates that this is the only struct which contains the same pointer.
8382     * Rust functions which take ownership of an object provided via an argument require
8383     * this to be true and invalidate the object pointed to by inner.
8384     */
8385    bool is_owned;
8386 } LDKKeysManager;
8387
8388
8389
8390 /**
8391  * Chain-related parameters used to construct a new `ChannelManager`.
8392  *
8393  * Typically, the block-specific parameters are derived from the best block hash for the network,
8394  * as a newly constructed `ChannelManager` will not have created any channels yet. These parameters
8395  * are not needed when deserializing a previously constructed `ChannelManager`.
8396  */
8397 typedef struct MUST_USE_STRUCT LDKChainParameters {
8398    /**
8399     * A pointer to the opaque Rust object.
8400     * Nearly everywhere, inner must be non-null, however in places where
8401     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8402     */
8403    LDKnativeChainParameters *inner;
8404    /**
8405     * Indicates that this is the only struct which contains the same pointer.
8406     * Rust functions which take ownership of an object provided via an argument require
8407     * this to be true and invalidate the object pointed to by inner.
8408     */
8409    bool is_owned;
8410 } LDKChainParameters;
8411
8412
8413
8414 /**
8415  * Channel parameters which apply to our counterparty. These are split out from [`ChannelDetails`]
8416  * to better separate parameters.
8417  */
8418 typedef struct MUST_USE_STRUCT LDKChannelCounterparty {
8419    /**
8420     * A pointer to the opaque Rust object.
8421     * Nearly everywhere, inner must be non-null, however in places where
8422     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8423     */
8424    LDKnativeChannelCounterparty *inner;
8425    /**
8426     * Indicates that this is the only struct which contains the same pointer.
8427     * Rust functions which take ownership of an object provided via an argument require
8428     * this to be true and invalidate the object pointed to by inner.
8429     */
8430    bool is_owned;
8431 } LDKChannelCounterparty;
8432
8433 /**
8434  * A 3-byte byte array.
8435  */
8436 typedef struct LDKThreeBytes {
8437    /**
8438     * The three bytes
8439     */
8440    uint8_t data[3];
8441 } LDKThreeBytes;
8442
8443 /**
8444  * A trait to describe an object which can receive channel messages.
8445  *
8446  * Messages MAY be called in parallel when they originate from different their_node_ids, however
8447  * they MUST NOT be called in parallel when the two calls have the same their_node_id.
8448  */
8449 typedef struct LDKChannelMessageHandler {
8450    /**
8451     * An opaque pointer which is passed to your function implementations as an argument.
8452     * This has no meaning in the LDK, and can be NULL or any other value.
8453     */
8454    void *this_arg;
8455    /**
8456     * Handle an incoming open_channel message from the given peer.
8457     */
8458    void (*handle_open_channel)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKInitFeatures their_features, const struct LDKOpenChannel *NONNULL_PTR msg);
8459    /**
8460     * Handle an incoming accept_channel message from the given peer.
8461     */
8462    void (*handle_accept_channel)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKInitFeatures their_features, const struct LDKAcceptChannel *NONNULL_PTR msg);
8463    /**
8464     * Handle an incoming funding_created message from the given peer.
8465     */
8466    void (*handle_funding_created)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingCreated *NONNULL_PTR msg);
8467    /**
8468     * Handle an incoming funding_signed message from the given peer.
8469     */
8470    void (*handle_funding_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingSigned *NONNULL_PTR msg);
8471    /**
8472     * Handle an incoming funding_locked message from the given peer.
8473     */
8474    void (*handle_funding_locked)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingLocked *NONNULL_PTR msg);
8475    /**
8476     * Handle an incoming shutdown message from the given peer.
8477     */
8478    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);
8479    /**
8480     * Handle an incoming closing_signed message from the given peer.
8481     */
8482    void (*handle_closing_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKClosingSigned *NONNULL_PTR msg);
8483    /**
8484     * Handle an incoming update_add_htlc message from the given peer.
8485     */
8486    void (*handle_update_add_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateAddHTLC *NONNULL_PTR msg);
8487    /**
8488     * Handle an incoming update_fulfill_htlc message from the given peer.
8489     */
8490    void (*handle_update_fulfill_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFulfillHTLC *NONNULL_PTR msg);
8491    /**
8492     * Handle an incoming update_fail_htlc message from the given peer.
8493     */
8494    void (*handle_update_fail_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFailHTLC *NONNULL_PTR msg);
8495    /**
8496     * Handle an incoming update_fail_malformed_htlc message from the given peer.
8497     */
8498    void (*handle_update_fail_malformed_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR msg);
8499    /**
8500     * Handle an incoming commitment_signed message from the given peer.
8501     */
8502    void (*handle_commitment_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKCommitmentSigned *NONNULL_PTR msg);
8503    /**
8504     * Handle an incoming revoke_and_ack message from the given peer.
8505     */
8506    void (*handle_revoke_and_ack)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKRevokeAndACK *NONNULL_PTR msg);
8507    /**
8508     * Handle an incoming update_fee message from the given peer.
8509     */
8510    void (*handle_update_fee)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFee *NONNULL_PTR msg);
8511    /**
8512     * Handle an incoming announcement_signatures message from the given peer.
8513     */
8514    void (*handle_announcement_signatures)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKAnnouncementSignatures *NONNULL_PTR msg);
8515    /**
8516     * Indicates a connection to the peer failed/an existing connection was lost. If no connection
8517     * is believed to be possible in the future (eg they're sending us messages we don't
8518     * understand or indicate they require unknown feature bits), no_connection_possible is set
8519     * and any outstanding channels should be failed.
8520     */
8521    void (*peer_disconnected)(const void *this_arg, struct LDKPublicKey their_node_id, bool no_connection_possible);
8522    /**
8523     * Handle a peer reconnecting, possibly generating channel_reestablish message(s).
8524     */
8525    void (*peer_connected)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR msg);
8526    /**
8527     * Handle an incoming channel_reestablish message from the given peer.
8528     */
8529    void (*handle_channel_reestablish)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelReestablish *NONNULL_PTR msg);
8530    /**
8531     * Handle an incoming channel update from the given peer.
8532     */
8533    void (*handle_channel_update)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelUpdate *NONNULL_PTR msg);
8534    /**
8535     * Handle an incoming error message from the given peer.
8536     */
8537    void (*handle_error)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKErrorMessage *NONNULL_PTR msg);
8538    /**
8539     * Implementation of MessageSendEventsProvider for this object.
8540     */
8541    struct LDKMessageSendEventsProvider MessageSendEventsProvider;
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 } LDKChannelMessageHandler;
8548
8549
8550
8551 /**
8552  * Arguments for the creation of a ChannelManager that are not deserialized.
8553  *
8554  * At a high-level, the process for deserializing a ChannelManager and resuming normal operation
8555  * is:
8556  * 1) Deserialize all stored ChannelMonitors.
8557  * 2) Deserialize the ChannelManager by filling in this struct and calling:
8558  *    <(BlockHash, ChannelManager)>::read(reader, args)
8559  *    This may result in closing some Channels if the ChannelMonitor is newer than the stored
8560  *    ChannelManager state to ensure no loss of funds. Thus, transactions may be broadcasted.
8561  * 3) If you are not fetching full blocks, register all relevant ChannelMonitor outpoints the same
8562  *    way you would handle a `chain::Filter` call using ChannelMonitor::get_outputs_to_watch() and
8563  *    ChannelMonitor::get_funding_txo().
8564  * 4) Reconnect blocks on your ChannelMonitors.
8565  * 5) Disconnect/connect blocks on the ChannelManager.
8566  * 6) Move the ChannelMonitors into your local chain::Watch.
8567  *
8568  * Note that the ordering of #4-6 is not of importance, however all three must occur before you
8569  * call any other methods on the newly-deserialized ChannelManager.
8570  *
8571  * Note that because some channels may be closed during deserialization, it is critical that you
8572  * always deserialize only the latest version of a ChannelManager and ChannelMonitors available to
8573  * you. If you deserialize an old ChannelManager (during which force-closure transactions may be
8574  * broadcast), and then later deserialize a newer version of the same ChannelManager (which will
8575  * not force-close the same channels but consider them live), you may end up revoking a state for
8576  * which you've already broadcasted the transaction.
8577  */
8578 typedef struct MUST_USE_STRUCT LDKChannelManagerReadArgs {
8579    /**
8580     * A pointer to the opaque Rust object.
8581     * Nearly everywhere, inner must be non-null, however in places where
8582     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8583     */
8584    LDKnativeChannelManagerReadArgs *inner;
8585    /**
8586     * Indicates that this is the only struct which contains the same pointer.
8587     * Rust functions which take ownership of an object provided via an argument require
8588     * this to be true and invalidate the object pointed to by inner.
8589     */
8590    bool is_owned;
8591 } LDKChannelManagerReadArgs;
8592
8593
8594
8595 /**
8596  * Proof that the sender knows the per-commitment secret of the previous commitment transaction.
8597  * This is used to convince the recipient that the channel is at a certain commitment
8598  * number even if they lost that data due to a local failure.  Of course, the peer may lie
8599  * and even later commitments may have been revoked.
8600  */
8601 typedef struct MUST_USE_STRUCT LDKDataLossProtect {
8602    /**
8603     * A pointer to the opaque Rust object.
8604     * Nearly everywhere, inner must be non-null, however in places where
8605     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8606     */
8607    LDKnativeDataLossProtect *inner;
8608    /**
8609     * Indicates that this is the only struct which contains the same pointer.
8610     * Rust functions which take ownership of an object provided via an argument require
8611     * this to be true and invalidate the object pointed to by inner.
8612     */
8613    bool is_owned;
8614 } LDKDataLossProtect;
8615
8616 /**
8617  * A trait to describe an object which can receive routing messages.
8618  *
8619  * # Implementor DoS Warnings
8620  *
8621  * For `gossip_queries` messages there are potential DoS vectors when handling
8622  * inbound queries. Implementors using an on-disk network graph should be aware of
8623  * repeated disk I/O for queries accessing different parts of the network graph.
8624  */
8625 typedef struct LDKRoutingMessageHandler {
8626    /**
8627     * An opaque pointer which is passed to your function implementations as an argument.
8628     * This has no meaning in the LDK, and can be NULL or any other value.
8629     */
8630    void *this_arg;
8631    /**
8632     * Handle an incoming node_announcement message, returning true if it should be forwarded on,
8633     * false or returning an Err otherwise.
8634     */
8635    struct LDKCResult_boolLightningErrorZ (*handle_node_announcement)(const void *this_arg, const struct LDKNodeAnnouncement *NONNULL_PTR msg);
8636    /**
8637     * Handle a channel_announcement message, returning true if it should be forwarded on, false
8638     * or returning an Err otherwise.
8639     */
8640    struct LDKCResult_boolLightningErrorZ (*handle_channel_announcement)(const void *this_arg, const struct LDKChannelAnnouncement *NONNULL_PTR msg);
8641    /**
8642     * Handle an incoming channel_update message, returning true if it should be forwarded on,
8643     * false or returning an Err otherwise.
8644     */
8645    struct LDKCResult_boolLightningErrorZ (*handle_channel_update)(const void *this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg);
8646    /**
8647     * Handle some updates to the route graph that we learned due to an outbound failed payment.
8648     */
8649    void (*handle_htlc_fail_channel_update)(const void *this_arg, const struct LDKHTLCFailChannelUpdate *NONNULL_PTR update);
8650    /**
8651     * Gets a subset of the channel announcements and updates required to dump our routing table
8652     * to a remote node, starting at the short_channel_id indicated by starting_point and
8653     * including the batch_amount entries immediately higher in numerical value than starting_point.
8654     */
8655    struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ (*get_next_channel_announcements)(const void *this_arg, uint64_t starting_point, uint8_t batch_amount);
8656    /**
8657     * Gets a subset of the node announcements required to dump our routing table to a remote node,
8658     * starting at the node *after* the provided publickey and including batch_amount entries
8659     * immediately higher (as defined by <PublicKey as Ord>::cmp) than starting_point.
8660     * If None is provided for starting_point, we start at the first node.
8661     */
8662    struct LDKCVec_NodeAnnouncementZ (*get_next_node_announcements)(const void *this_arg, struct LDKPublicKey starting_point, uint8_t batch_amount);
8663    /**
8664     * Called when a connection is established with a peer. This can be used to
8665     * perform routing table synchronization using a strategy defined by the
8666     * implementor.
8667     */
8668    void (*sync_routing_table)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR init);
8669    /**
8670     * Handles the reply of a query we initiated to learn about channels
8671     * for a given range of blocks. We can expect to receive one or more
8672     * replies to a single query.
8673     */
8674    struct LDKCResult_NoneLightningErrorZ (*handle_reply_channel_range)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKReplyChannelRange msg);
8675    /**
8676     * Handles the reply of a query we initiated asking for routing gossip
8677     * messages for a list of channels. We should receive this message when
8678     * a node has completed its best effort to send us the pertaining routing
8679     * gossip messages.
8680     */
8681    struct LDKCResult_NoneLightningErrorZ (*handle_reply_short_channel_ids_end)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKReplyShortChannelIdsEnd msg);
8682    /**
8683     * Handles when a peer asks us to send a list of short_channel_ids
8684     * for the requested range of blocks.
8685     */
8686    struct LDKCResult_NoneLightningErrorZ (*handle_query_channel_range)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKQueryChannelRange msg);
8687    /**
8688     * Handles when a peer asks us to send routing gossip messages for a
8689     * list of short_channel_ids.
8690     */
8691    struct LDKCResult_NoneLightningErrorZ (*handle_query_short_channel_ids)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKQueryShortChannelIds msg);
8692    /**
8693     * Implementation of MessageSendEventsProvider for this object.
8694     */
8695    struct LDKMessageSendEventsProvider MessageSendEventsProvider;
8696    /**
8697     * Frees any resources associated with this object given its this_arg pointer.
8698     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
8699     */
8700    void (*free)(void *this_arg);
8701 } LDKRoutingMessageHandler;
8702
8703
8704
8705 /**
8706  * A dummy struct which implements `RoutingMessageHandler` without storing any routing information
8707  * or doing any processing. You can provide one of these as the route_handler in a MessageHandler.
8708  */
8709 typedef struct MUST_USE_STRUCT LDKIgnoringMessageHandler {
8710    /**
8711     * A pointer to the opaque Rust object.
8712     * Nearly everywhere, inner must be non-null, however in places where
8713     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8714     */
8715    LDKnativeIgnoringMessageHandler *inner;
8716    /**
8717     * Indicates that this is the only struct which contains the same pointer.
8718     * Rust functions which take ownership of an object provided via an argument require
8719     * this to be true and invalidate the object pointed to by inner.
8720     */
8721    bool is_owned;
8722 } LDKIgnoringMessageHandler;
8723
8724
8725
8726 /**
8727  * A dummy struct which implements `ChannelMessageHandler` without having any channels.
8728  * You can provide one of these as the route_handler in a MessageHandler.
8729  */
8730 typedef struct MUST_USE_STRUCT LDKErroringMessageHandler {
8731    /**
8732     * A pointer to the opaque Rust object.
8733     * Nearly everywhere, inner must be non-null, however in places where
8734     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8735     */
8736    LDKnativeErroringMessageHandler *inner;
8737    /**
8738     * Indicates that this is the only struct which contains the same pointer.
8739     * Rust functions which take ownership of an object provided via an argument require
8740     * this to be true and invalidate the object pointed to by inner.
8741     */
8742    bool is_owned;
8743 } LDKErroringMessageHandler;
8744
8745
8746
8747 /**
8748  * Provides references to trait impls which handle different types of messages.
8749  */
8750 typedef struct MUST_USE_STRUCT LDKMessageHandler {
8751    /**
8752     * A pointer to the opaque Rust object.
8753     * Nearly everywhere, inner must be non-null, however in places where
8754     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8755     */
8756    LDKnativeMessageHandler *inner;
8757    /**
8758     * Indicates that this is the only struct which contains the same pointer.
8759     * Rust functions which take ownership of an object provided via an argument require
8760     * this to be true and invalidate the object pointed to by inner.
8761     */
8762    bool is_owned;
8763 } LDKMessageHandler;
8764
8765 /**
8766  * Provides an object which can be used to send data to and which uniquely identifies a connection
8767  * to a remote host. You will need to be able to generate multiple of these which meet Eq and
8768  * implement Hash to meet the PeerManager API.
8769  *
8770  * For efficiency, Clone should be relatively cheap for this type.
8771  *
8772  * Two descriptors may compare equal (by [`cmp::Eq`] and [`hash::Hash`]) as long as the original
8773  * has been disconnected, the [`PeerManager`] has been informed of the disconnection (either by it
8774  * having triggered the disconnection or a call to [`PeerManager::socket_disconnected`]), and no
8775  * further calls to the [`PeerManager`] related to the original socket occur. This allows you to
8776  * use a file descriptor for your SocketDescriptor directly, however for simplicity you may wish
8777  * to simply use another value which is guaranteed to be globally unique instead.
8778  */
8779 typedef struct LDKSocketDescriptor {
8780    /**
8781     * An opaque pointer which is passed to your function implementations as an argument.
8782     * This has no meaning in the LDK, and can be NULL or any other value.
8783     */
8784    void *this_arg;
8785    /**
8786     * Attempts to send some data from the given slice to the peer.
8787     *
8788     * Returns the amount of data which was sent, possibly 0 if the socket has since disconnected.
8789     * Note that in the disconnected case, [`PeerManager::socket_disconnected`] must still be
8790     * called and further write attempts may occur until that time.
8791     *
8792     * If the returned size is smaller than `data.len()`, a
8793     * [`PeerManager::write_buffer_space_avail`] call must be made the next time more data can be
8794     * written. Additionally, until a `send_data` event completes fully, no further
8795     * [`PeerManager::read_event`] calls should be made for the same peer! Because this is to
8796     * prevent denial-of-service issues, you should not read or buffer any data from the socket
8797     * until then.
8798     *
8799     * If a [`PeerManager::read_event`] call on this descriptor had previously returned true
8800     * (indicating that read events should be paused to prevent DoS in the send buffer),
8801     * `resume_read` may be set indicating that read events on this descriptor should resume. A
8802     * `resume_read` of false carries no meaning, and should not cause any action.
8803     */
8804    uintptr_t (*send_data)(void *this_arg, struct LDKu8slice data, bool resume_read);
8805    /**
8806     * Disconnect the socket pointed to by this SocketDescriptor.
8807     *
8808     * You do *not* need to call [`PeerManager::socket_disconnected`] with this socket after this
8809     * call (doing so is a noop).
8810     */
8811    void (*disconnect_socket)(void *this_arg);
8812    /**
8813     * Checks if two objects are equal given this object's this_arg pointer and another object.
8814     */
8815    bool (*eq)(const void *this_arg, const struct LDKSocketDescriptor *NONNULL_PTR other_arg);
8816    /**
8817     * Calculate a succinct non-cryptographic hash for an object given its this_arg pointer.
8818     * This is used, for example, for inclusion of this object in a hash map.
8819     */
8820    uint64_t (*hash)(const void *this_arg);
8821    /**
8822     * Called, if set, after this SocketDescriptor has been cloned into a duplicate object.
8823     * The new SocketDescriptor is provided, and should be mutated as needed to perform a
8824     * deep copy of the object pointed to by this_arg or avoid any double-freeing.
8825     */
8826    void (*cloned)(struct LDKSocketDescriptor *NONNULL_PTR new_SocketDescriptor);
8827    /**
8828     * Frees any resources associated with this object given its this_arg pointer.
8829     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
8830     */
8831    void (*free)(void *this_arg);
8832 } LDKSocketDescriptor;
8833
8834
8835
8836 /**
8837  * A PeerManager manages a set of peers, described by their [`SocketDescriptor`] and marshalls
8838  * socket events into messages which it passes on to its [`MessageHandler`].
8839  *
8840  * Locks are taken internally, so you must never assume that reentrancy from a
8841  * [`SocketDescriptor`] call back into [`PeerManager`] methods will not deadlock.
8842  *
8843  * Calls to [`read_event`] will decode relevant messages and pass them to the
8844  * [`ChannelMessageHandler`], likely doing message processing in-line. Thus, the primary form of
8845  * parallelism in Rust-Lightning is in calls to [`read_event`]. Note, however, that calls to any
8846  * [`PeerManager`] functions related to the same connection must occur only in serial, making new
8847  * calls only after previous ones have returned.
8848  *
8849  * Rather than using a plain PeerManager, it is preferable to use either a SimpleArcPeerManager
8850  * a SimpleRefPeerManager, for conciseness. See their documentation for more details, but
8851  * essentially you should default to using a SimpleRefPeerManager, and use a
8852  * SimpleArcPeerManager when you require a PeerManager with a static lifetime, such as when
8853  * you're using lightning-net-tokio.
8854  *
8855  * [`read_event`]: PeerManager::read_event
8856  */
8857 typedef struct MUST_USE_STRUCT LDKPeerManager {
8858    /**
8859     * A pointer to the opaque Rust object.
8860     * Nearly everywhere, inner must be non-null, however in places where
8861     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8862     */
8863    LDKnativePeerManager *inner;
8864    /**
8865     * Indicates that this is the only struct which contains the same pointer.
8866     * Rust functions which take ownership of an object provided via an argument require
8867     * this to be true and invalidate the object pointed to by inner.
8868     */
8869    bool is_owned;
8870 } LDKPeerManager;
8871
8872
8873
8874 /**
8875  * Static channel fields used to build transactions given per-commitment fields, organized by
8876  * broadcaster/countersignatory.
8877  *
8878  * This is derived from the holder/counterparty-organized ChannelTransactionParameters via the
8879  * as_holder_broadcastable and as_counterparty_broadcastable functions.
8880  */
8881 typedef struct MUST_USE_STRUCT LDKDirectedChannelTransactionParameters {
8882    /**
8883     * A pointer to the opaque Rust object.
8884     * Nearly everywhere, inner must be non-null, however in places where
8885     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8886     */
8887    LDKnativeDirectedChannelTransactionParameters *inner;
8888    /**
8889     * Indicates that this is the only struct which contains the same pointer.
8890     * Rust functions which take ownership of an object provided via an argument require
8891     * this to be true and invalidate the object pointed to by inner.
8892     */
8893    bool is_owned;
8894 } LDKDirectedChannelTransactionParameters;
8895
8896
8897
8898 /**
8899  * A channel descriptor for a hop along a payment path.
8900  */
8901 typedef struct MUST_USE_STRUCT LDKRouteHintHop {
8902    /**
8903     * A pointer to the opaque Rust object.
8904     * Nearly everywhere, inner must be non-null, however in places where
8905     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8906     */
8907    LDKnativeRouteHintHop *inner;
8908    /**
8909     * Indicates that this is the only struct which contains the same pointer.
8910     * Rust functions which take ownership of an object provided via an argument require
8911     * this to be true and invalidate the object pointed to by inner.
8912     */
8913    bool is_owned;
8914 } LDKRouteHintHop;
8915
8916
8917
8918 /**
8919  * A simple newtype for RwLockReadGuard<'a, NetworkGraph>.
8920  * This exists only to make accessing a RwLock<NetworkGraph> possible from
8921  * the C bindings, as it can be done directly in Rust code.
8922  */
8923 typedef struct MUST_USE_STRUCT LDKLockedNetworkGraph {
8924    /**
8925     * A pointer to the opaque Rust object.
8926     * Nearly everywhere, inner must be non-null, however in places where
8927     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8928     */
8929    LDKnativeLockedNetworkGraph *inner;
8930    /**
8931     * Indicates that this is the only struct which contains the same pointer.
8932     * Rust functions which take ownership of an object provided via an argument require
8933     * this to be true and invalidate the object pointed to by inner.
8934     */
8935    bool is_owned;
8936 } LDKLockedNetworkGraph;
8937
8938
8939
8940 /**
8941  * Receives and validates network updates from peers,
8942  * stores authentic and relevant data as a network graph.
8943  * This network graph is then used for routing payments.
8944  * Provides interface to help with initial routing sync by
8945  * serving historical announcements.
8946  */
8947 typedef struct MUST_USE_STRUCT LDKNetGraphMsgHandler {
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    LDKnativeNetGraphMsgHandler *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 } LDKNetGraphMsgHandler;
8961
8962
8963
8964 /**
8965  * FilesystemPersister persists channel data on disk, where each channel's
8966  * data is stored in a file named after its funding outpoint.
8967  *
8968  * Warning: this module does the best it can with calls to persist data, but it
8969  * can only guarantee that the data is passed to the drive. It is up to the
8970  * drive manufacturers to do the actual persistence properly, which they often
8971  * don't (especially on consumer-grade hardware). Therefore, it is up to the
8972  * user to validate their entire storage stack, to ensure the writes are
8973  * persistent.
8974  * Corollary: especially when dealing with larger amounts of money, it is best
8975  * practice to have multiple channel data backups and not rely only on one
8976  * FilesystemPersister.
8977  */
8978 typedef struct MUST_USE_STRUCT LDKFilesystemPersister {
8979    /**
8980     * A pointer to the opaque Rust object.
8981     * Nearly everywhere, inner must be non-null, however in places where
8982     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8983     */
8984    LDKnativeFilesystemPersister *inner;
8985    /**
8986     * Indicates that this is the only struct which contains the same pointer.
8987     * Rust functions which take ownership of an object provided via an argument require
8988     * this to be true and invalidate the object pointed to by inner.
8989     */
8990    bool is_owned;
8991 } LDKFilesystemPersister;
8992
8993
8994
8995 /**
8996  * BackgroundProcessor takes care of tasks that (1) need to happen periodically to keep
8997  * Rust-Lightning running properly, and (2) either can or should be run in the background. Its
8998  * responsibilities are:
8999  * * Monitoring whether the ChannelManager needs to be re-persisted to disk, and if so,
9000  *   writing it to disk/backups by invoking the callback given to it at startup.
9001  *   ChannelManager persistence should be done in the background.
9002  * * Calling `ChannelManager::timer_tick_occurred()` and
9003  *   `PeerManager::timer_tick_occurred()` every minute (can be done in the
9004  *   background).
9005  *
9006  * Note that if ChannelManager persistence fails and the persisted manager becomes out-of-date,
9007  * then there is a risk of channels force-closing on startup when the manager realizes it's
9008  * outdated. However, as long as `ChannelMonitor` backups are sound, no funds besides those used
9009  * for unilateral chain closure fees are at risk.
9010  */
9011 typedef struct MUST_USE_STRUCT LDKBackgroundProcessor {
9012    /**
9013     * A pointer to the opaque Rust object.
9014     * Nearly everywhere, inner must be non-null, however in places where
9015     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9016     */
9017    LDKnativeBackgroundProcessor *inner;
9018    /**
9019     * Indicates that this is the only struct which contains the same pointer.
9020     * Rust functions which take ownership of an object provided via an argument require
9021     * this to be true and invalidate the object pointed to by inner.
9022     */
9023    bool is_owned;
9024 } LDKBackgroundProcessor;
9025
9026 /**
9027  * Trait which handles persisting a [`ChannelManager`] to disk.
9028  *
9029  * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
9030  */
9031 typedef struct LDKChannelManagerPersister {
9032    /**
9033     * An opaque pointer which is passed to your function implementations as an argument.
9034     * This has no meaning in the LDK, and can be NULL or any other value.
9035     */
9036    void *this_arg;
9037    /**
9038     * Persist the given [`ChannelManager`] to disk, returning an error if persistence failed
9039     * (which will cause the [`BackgroundProcessor`] which called this method to exit.
9040     *
9041     * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
9042     */
9043    struct LDKCResult_NoneErrorZ (*persist_manager)(const void *this_arg, const struct LDKChannelManager *NONNULL_PTR channel_manager);
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 } LDKChannelManagerPersister;
9050
9051
9052
9053 /**
9054  * Data of the `RawInvoice` that is encoded in the data part
9055  */
9056 typedef struct MUST_USE_STRUCT LDKRawDataPart {
9057    /**
9058     * A pointer to the opaque Rust object.
9059     * Nearly everywhere, inner must be non-null, however in places where
9060     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9061     */
9062    LDKnativeRawDataPart *inner;
9063    /**
9064     * Indicates that this is the only struct which contains the same pointer.
9065     * Rust functions which take ownership of an object provided via an argument require
9066     * this to be true and invalidate the object pointed to by inner.
9067     */
9068    bool is_owned;
9069 } LDKRawDataPart;
9070
9071
9072
9073 /**
9074  * SHA-256 hash
9075  */
9076 typedef struct MUST_USE_STRUCT LDKSha256 {
9077    /**
9078     * A pointer to the opaque Rust object.
9079     * Nearly everywhere, inner must be non-null, however in places where
9080     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9081     */
9082    LDKnativeSha256 *inner;
9083    /**
9084     * Indicates that this is the only struct which contains the same pointer.
9085     * Rust functions which take ownership of an object provided via an argument require
9086     * this to be true and invalidate the object pointed to by inner.
9087     */
9088    bool is_owned;
9089 } LDKSha256;
9090
9091
9092
9093 /**
9094  * `min_final_cltv_expiry` to use for the last HTLC in the route
9095  */
9096 typedef struct MUST_USE_STRUCT LDKMinFinalCltvExpiry {
9097    /**
9098     * A pointer to the opaque Rust object.
9099     * Nearly everywhere, inner must be non-null, however in places where
9100     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9101     */
9102    LDKnativeMinFinalCltvExpiry *inner;
9103    /**
9104     * Indicates that this is the only struct which contains the same pointer.
9105     * Rust functions which take ownership of an object provided via an argument require
9106     * this to be true and invalidate the object pointed to by inner.
9107     */
9108    bool is_owned;
9109 } LDKMinFinalCltvExpiry;
9110
9111 /**
9112  * Integer in the range `0..32`
9113  */
9114 typedef struct LDKu5 {
9115    uint8_t _0;
9116 } LDKu5;
9117
9118 /**
9119  * A 20-byte byte array.
9120  */
9121 typedef struct LDKTwentyBytes {
9122    /**
9123     * The twenty bytes
9124     */
9125    uint8_t data[20];
9126 } LDKTwentyBytes;
9127
9128 /**
9129  * Fallback address in case no LN payment is possible
9130  */
9131 typedef enum LDKFallback_Tag {
9132    LDKFallback_SegWitProgram,
9133    LDKFallback_PubKeyHash,
9134    LDKFallback_ScriptHash,
9135    /**
9136     * Must be last for serialization purposes
9137     */
9138    LDKFallback_Sentinel,
9139 } LDKFallback_Tag;
9140
9141 typedef struct LDKFallback_LDKSegWitProgram_Body {
9142    struct LDKu5 version;
9143    struct LDKCVec_u8Z program;
9144 } LDKFallback_LDKSegWitProgram_Body;
9145
9146 typedef struct MUST_USE_STRUCT LDKFallback {
9147    LDKFallback_Tag tag;
9148    union {
9149       LDKFallback_LDKSegWitProgram_Body seg_wit_program;
9150       struct {
9151          struct LDKTwentyBytes pub_key_hash;
9152       };
9153       struct {
9154          struct LDKTwentyBytes script_hash;
9155       };
9156    };
9157 } LDKFallback;
9158
9159 extern const uintptr_t MAX_BUF_SIZE;
9160
9161 extern const uint64_t MIN_RELAY_FEE_SAT_PER_1000_WEIGHT;
9162
9163 extern const uint64_t CLOSED_CHANNEL_UPDATE_ID;
9164
9165 extern const uint32_t ANTI_REORG_DELAY;
9166
9167 extern const uint16_t BREAKDOWN_TIMEOUT;
9168
9169 extern const uint16_t MIN_CLTV_EXPIRY_DELTA;
9170
9171 extern const uint32_t MIN_FINAL_CLTV_EXPIRY;
9172
9173 extern const uintptr_t REVOKEABLE_REDEEMSCRIPT_MAX_LENGTH;
9174
9175 extern const uint64_t DEFAULT_EXPIRY_TIME;
9176
9177 extern const uint64_t DEFAULT_MIN_FINAL_CLTV_EXPIRY;
9178
9179 extern const uint8_t TAG_PAYMENT_HASH;
9180
9181 extern const uint8_t TAG_DESCRIPTION;
9182
9183 extern const uint8_t TAG_PAYEE_PUB_KEY;
9184
9185 extern const uint8_t TAG_DESCRIPTION_HASH;
9186
9187 extern const uint8_t TAG_EXPIRY_TIME;
9188
9189 extern const uint8_t TAG_MIN_FINAL_CLTV_EXPIRY;
9190
9191 extern const uint8_t TAG_FALLBACK;
9192
9193 extern const uint8_t TAG_PRIVATE_ROUTE;
9194
9195 extern const uint8_t TAG_PAYMENT_SECRET;
9196
9197 extern const uint8_t TAG_FEATURES;
9198
9199 struct LDKStr _ldk_get_compiled_version(void);
9200
9201 struct LDKStr _ldk_c_bindings_get_compiled_version(void);
9202
9203 /**
9204  * Frees the data buffer, if data_is_owned is set and datalen > 0.
9205  */
9206 void Transaction_free(struct LDKTransaction _res);
9207
9208 /**
9209  * Frees the data pointed to by script_pubkey.
9210  */
9211 void TxOut_free(struct LDKTxOut _res);
9212
9213 /**
9214  * Creates a new TxOut which has the same data as `orig` but with a new script buffer.
9215  */
9216 struct LDKTxOut TxOut_clone(const struct LDKTxOut *NONNULL_PTR orig);
9217
9218 /**
9219  * Frees the data buffer, if chars_is_owned is set and len > 0.
9220  */
9221 void Str_free(struct LDKStr _res);
9222
9223 /**
9224  * Creates a new CResult_SecretKeyErrorZ in the success state.
9225  */
9226 struct LDKCResult_SecretKeyErrorZ CResult_SecretKeyErrorZ_ok(struct LDKSecretKey o);
9227
9228 /**
9229  * Creates a new CResult_SecretKeyErrorZ in the error state.
9230  */
9231 struct LDKCResult_SecretKeyErrorZ CResult_SecretKeyErrorZ_err(enum LDKSecp256k1Error e);
9232
9233 /**
9234  * Frees any resources used by the CResult_SecretKeyErrorZ.
9235  */
9236 void CResult_SecretKeyErrorZ_free(struct LDKCResult_SecretKeyErrorZ _res);
9237
9238 /**
9239  * Creates a new CResult_PublicKeyErrorZ in the success state.
9240  */
9241 struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_ok(struct LDKPublicKey o);
9242
9243 /**
9244  * Creates a new CResult_PublicKeyErrorZ in the error state.
9245  */
9246 struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_err(enum LDKSecp256k1Error e);
9247
9248 /**
9249  * Frees any resources used by the CResult_PublicKeyErrorZ.
9250  */
9251 void CResult_PublicKeyErrorZ_free(struct LDKCResult_PublicKeyErrorZ _res);
9252
9253 /**
9254  * Creates a new CResult_PublicKeyErrorZ which has the same data as `orig`
9255  * but with all dynamically-allocated buffers duplicated in new buffers.
9256  */
9257 struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_clone(const struct LDKCResult_PublicKeyErrorZ *NONNULL_PTR orig);
9258
9259 /**
9260  * Creates a new CResult_TxCreationKeysDecodeErrorZ in the success state.
9261  */
9262 struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_ok(struct LDKTxCreationKeys o);
9263
9264 /**
9265  * Creates a new CResult_TxCreationKeysDecodeErrorZ in the error state.
9266  */
9267 struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_err(struct LDKDecodeError e);
9268
9269 /**
9270  * Frees any resources used by the CResult_TxCreationKeysDecodeErrorZ.
9271  */
9272 void CResult_TxCreationKeysDecodeErrorZ_free(struct LDKCResult_TxCreationKeysDecodeErrorZ _res);
9273
9274 /**
9275  * Creates a new CResult_TxCreationKeysDecodeErrorZ which has the same data as `orig`
9276  * but with all dynamically-allocated buffers duplicated in new buffers.
9277  */
9278 struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_clone(const struct LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR orig);
9279
9280 /**
9281  * Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the success state.
9282  */
9283 struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_ok(struct LDKChannelPublicKeys o);
9284
9285 /**
9286  * Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the error state.
9287  */
9288 struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_err(struct LDKDecodeError e);
9289
9290 /**
9291  * Frees any resources used by the CResult_ChannelPublicKeysDecodeErrorZ.
9292  */
9293 void CResult_ChannelPublicKeysDecodeErrorZ_free(struct LDKCResult_ChannelPublicKeysDecodeErrorZ _res);
9294
9295 /**
9296  * Creates a new CResult_ChannelPublicKeysDecodeErrorZ which has the same data as `orig`
9297  * but with all dynamically-allocated buffers duplicated in new buffers.
9298  */
9299 struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_clone(const struct LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR orig);
9300
9301 /**
9302  * Creates a new CResult_TxCreationKeysErrorZ in the success state.
9303  */
9304 struct LDKCResult_TxCreationKeysErrorZ CResult_TxCreationKeysErrorZ_ok(struct LDKTxCreationKeys o);
9305
9306 /**
9307  * Creates a new CResult_TxCreationKeysErrorZ in the error state.
9308  */
9309 struct LDKCResult_TxCreationKeysErrorZ CResult_TxCreationKeysErrorZ_err(enum LDKSecp256k1Error e);
9310
9311 /**
9312  * Frees any resources used by the CResult_TxCreationKeysErrorZ.
9313  */
9314 void CResult_TxCreationKeysErrorZ_free(struct LDKCResult_TxCreationKeysErrorZ _res);
9315
9316 /**
9317  * Creates a new CResult_TxCreationKeysErrorZ which has the same data as `orig`
9318  * but with all dynamically-allocated buffers duplicated in new buffers.
9319  */
9320 struct LDKCResult_TxCreationKeysErrorZ CResult_TxCreationKeysErrorZ_clone(const struct LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR orig);
9321
9322 /**
9323  * Constructs a new COption_u32Z containing a u32
9324  */
9325 struct LDKCOption_u32Z COption_u32Z_some(uint32_t o);
9326
9327 /**
9328  * Constructs a new COption_u32Z containing nothing
9329  */
9330 struct LDKCOption_u32Z COption_u32Z_none(void);
9331
9332 /**
9333  * Frees any resources associated with the u32, if we are in the Some state
9334  */
9335 void COption_u32Z_free(struct LDKCOption_u32Z _res);
9336
9337 /**
9338  * Creates a new COption_u32Z which has the same data as `orig`
9339  * but with all dynamically-allocated buffers duplicated in new buffers.
9340  */
9341 struct LDKCOption_u32Z COption_u32Z_clone(const struct LDKCOption_u32Z *NONNULL_PTR orig);
9342
9343 /**
9344  * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the success state.
9345  */
9346 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(struct LDKHTLCOutputInCommitment o);
9347
9348 /**
9349  * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the error state.
9350  */
9351 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_err(struct LDKDecodeError e);
9352
9353 /**
9354  * Frees any resources used by the CResult_HTLCOutputInCommitmentDecodeErrorZ.
9355  */
9356 void CResult_HTLCOutputInCommitmentDecodeErrorZ_free(struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res);
9357
9358 /**
9359  * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ which has the same data as `orig`
9360  * but with all dynamically-allocated buffers duplicated in new buffers.
9361  */
9362 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(const struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR orig);
9363
9364 /**
9365  * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the success state.
9366  */
9367 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(struct LDKCounterpartyChannelTransactionParameters o);
9368
9369 /**
9370  * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the error state.
9371  */
9372 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(struct LDKDecodeError e);
9373
9374 /**
9375  * Frees any resources used by the CResult_CounterpartyChannelTransactionParametersDecodeErrorZ.
9376  */
9377 void CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res);
9378
9379 /**
9380  * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
9381  * but with all dynamically-allocated buffers duplicated in new buffers.
9382  */
9383 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(const struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR orig);
9384
9385 /**
9386  * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the success state.
9387  */
9388 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_ok(struct LDKChannelTransactionParameters o);
9389
9390 /**
9391  * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the error state.
9392  */
9393 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_err(struct LDKDecodeError e);
9394
9395 /**
9396  * Frees any resources used by the CResult_ChannelTransactionParametersDecodeErrorZ.
9397  */
9398 void CResult_ChannelTransactionParametersDecodeErrorZ_free(struct LDKCResult_ChannelTransactionParametersDecodeErrorZ _res);
9399
9400 /**
9401  * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
9402  * but with all dynamically-allocated buffers duplicated in new buffers.
9403  */
9404 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_clone(const struct LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR orig);
9405
9406 /**
9407  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9408  */
9409 void CVec_SignatureZ_free(struct LDKCVec_SignatureZ _res);
9410
9411 /**
9412  * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the success state.
9413  */
9414 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_ok(struct LDKHolderCommitmentTransaction o);
9415
9416 /**
9417  * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the error state.
9418  */
9419 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
9420
9421 /**
9422  * Frees any resources used by the CResult_HolderCommitmentTransactionDecodeErrorZ.
9423  */
9424 void CResult_HolderCommitmentTransactionDecodeErrorZ_free(struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res);
9425
9426 /**
9427  * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ which has the same data as `orig`
9428  * but with all dynamically-allocated buffers duplicated in new buffers.
9429  */
9430 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
9431
9432 /**
9433  * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the success state.
9434  */
9435 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(struct LDKBuiltCommitmentTransaction o);
9436
9437 /**
9438  * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the error state.
9439  */
9440 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
9441
9442 /**
9443  * Frees any resources used by the CResult_BuiltCommitmentTransactionDecodeErrorZ.
9444  */
9445 void CResult_BuiltCommitmentTransactionDecodeErrorZ_free(struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res);
9446
9447 /**
9448  * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ which has the same data as `orig`
9449  * but with all dynamically-allocated buffers duplicated in new buffers.
9450  */
9451 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
9452
9453 /**
9454  * Creates a new CResult_CommitmentTransactionDecodeErrorZ in the success state.
9455  */
9456 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_ok(struct LDKCommitmentTransaction o);
9457
9458 /**
9459  * Creates a new CResult_CommitmentTransactionDecodeErrorZ in the error state.
9460  */
9461 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
9462
9463 /**
9464  * Frees any resources used by the CResult_CommitmentTransactionDecodeErrorZ.
9465  */
9466 void CResult_CommitmentTransactionDecodeErrorZ_free(struct LDKCResult_CommitmentTransactionDecodeErrorZ _res);
9467
9468 /**
9469  * Creates a new CResult_CommitmentTransactionDecodeErrorZ which has the same data as `orig`
9470  * but with all dynamically-allocated buffers duplicated in new buffers.
9471  */
9472 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
9473
9474 /**
9475  * Creates a new CResult_TrustedCommitmentTransactionNoneZ in the success state.
9476  */
9477 struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_ok(struct LDKTrustedCommitmentTransaction o);
9478
9479 /**
9480  * Creates a new CResult_TrustedCommitmentTransactionNoneZ in the error state.
9481  */
9482 struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_err(void);
9483
9484 /**
9485  * Frees any resources used by the CResult_TrustedCommitmentTransactionNoneZ.
9486  */
9487 void CResult_TrustedCommitmentTransactionNoneZ_free(struct LDKCResult_TrustedCommitmentTransactionNoneZ _res);
9488
9489 /**
9490  * Creates a new CResult_CVec_SignatureZNoneZ in the success state.
9491  */
9492 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_ok(struct LDKCVec_SignatureZ o);
9493
9494 /**
9495  * Creates a new CResult_CVec_SignatureZNoneZ in the error state.
9496  */
9497 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_err(void);
9498
9499 /**
9500  * Frees any resources used by the CResult_CVec_SignatureZNoneZ.
9501  */
9502 void CResult_CVec_SignatureZNoneZ_free(struct LDKCResult_CVec_SignatureZNoneZ _res);
9503
9504 /**
9505  * Creates a new CResult_CVec_SignatureZNoneZ which has the same data as `orig`
9506  * but with all dynamically-allocated buffers duplicated in new buffers.
9507  */
9508 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_clone(const struct LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR orig);
9509
9510 /**
9511  * Creates a new CResult_NoneErrorZ in the success state.
9512  */
9513 struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_ok(void);
9514
9515 /**
9516  * Creates a new CResult_NoneErrorZ in the error state.
9517  */
9518 struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_err(enum LDKIOError e);
9519
9520 /**
9521  * Frees any resources used by the CResult_NoneErrorZ.
9522  */
9523 void CResult_NoneErrorZ_free(struct LDKCResult_NoneErrorZ _res);
9524
9525 /**
9526  * Creates a new CResult_NoneErrorZ which has the same data as `orig`
9527  * but with all dynamically-allocated buffers duplicated in new buffers.
9528  */
9529 struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_clone(const struct LDKCResult_NoneErrorZ *NONNULL_PTR orig);
9530
9531 /**
9532  * Creates a new CResult_RouteHopDecodeErrorZ in the success state.
9533  */
9534 struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_ok(struct LDKRouteHop o);
9535
9536 /**
9537  * Creates a new CResult_RouteHopDecodeErrorZ in the error state.
9538  */
9539 struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_err(struct LDKDecodeError e);
9540
9541 /**
9542  * Frees any resources used by the CResult_RouteHopDecodeErrorZ.
9543  */
9544 void CResult_RouteHopDecodeErrorZ_free(struct LDKCResult_RouteHopDecodeErrorZ _res);
9545
9546 /**
9547  * Creates a new CResult_RouteHopDecodeErrorZ which has the same data as `orig`
9548  * but with all dynamically-allocated buffers duplicated in new buffers.
9549  */
9550 struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_clone(const struct LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR orig);
9551
9552 /**
9553  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9554  */
9555 void CVec_RouteHopZ_free(struct LDKCVec_RouteHopZ _res);
9556
9557 /**
9558  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9559  */
9560 void CVec_CVec_RouteHopZZ_free(struct LDKCVec_CVec_RouteHopZZ _res);
9561
9562 /**
9563  * Creates a new CResult_RouteDecodeErrorZ in the success state.
9564  */
9565 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_ok(struct LDKRoute o);
9566
9567 /**
9568  * Creates a new CResult_RouteDecodeErrorZ in the error state.
9569  */
9570 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_err(struct LDKDecodeError e);
9571
9572 /**
9573  * Frees any resources used by the CResult_RouteDecodeErrorZ.
9574  */
9575 void CResult_RouteDecodeErrorZ_free(struct LDKCResult_RouteDecodeErrorZ _res);
9576
9577 /**
9578  * Creates a new CResult_RouteDecodeErrorZ which has the same data as `orig`
9579  * but with all dynamically-allocated buffers duplicated in new buffers.
9580  */
9581 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_clone(const struct LDKCResult_RouteDecodeErrorZ *NONNULL_PTR orig);
9582
9583 /**
9584  * Constructs a new COption_u64Z containing a u64
9585  */
9586 struct LDKCOption_u64Z COption_u64Z_some(uint64_t o);
9587
9588 /**
9589  * Constructs a new COption_u64Z containing nothing
9590  */
9591 struct LDKCOption_u64Z COption_u64Z_none(void);
9592
9593 /**
9594  * Frees any resources associated with the u64, if we are in the Some state
9595  */
9596 void COption_u64Z_free(struct LDKCOption_u64Z _res);
9597
9598 /**
9599  * Creates a new COption_u64Z which has the same data as `orig`
9600  * but with all dynamically-allocated buffers duplicated in new buffers.
9601  */
9602 struct LDKCOption_u64Z COption_u64Z_clone(const struct LDKCOption_u64Z *NONNULL_PTR orig);
9603
9604 /**
9605  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9606  */
9607 void CVec_ChannelDetailsZ_free(struct LDKCVec_ChannelDetailsZ _res);
9608
9609 /**
9610  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9611  */
9612 void CVec_RouteHintZ_free(struct LDKCVec_RouteHintZ _res);
9613
9614 /**
9615  * Creates a new CResult_RouteLightningErrorZ in the success state.
9616  */
9617 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_ok(struct LDKRoute o);
9618
9619 /**
9620  * Creates a new CResult_RouteLightningErrorZ in the error state.
9621  */
9622 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_err(struct LDKLightningError e);
9623
9624 /**
9625  * Frees any resources used by the CResult_RouteLightningErrorZ.
9626  */
9627 void CResult_RouteLightningErrorZ_free(struct LDKCResult_RouteLightningErrorZ _res);
9628
9629 /**
9630  * Creates a new CResult_RouteLightningErrorZ which has the same data as `orig`
9631  * but with all dynamically-allocated buffers duplicated in new buffers.
9632  */
9633 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_clone(const struct LDKCResult_RouteLightningErrorZ *NONNULL_PTR orig);
9634
9635 /**
9636  * Creates a new CResult_TxOutAccessErrorZ in the success state.
9637  */
9638 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_ok(struct LDKTxOut o);
9639
9640 /**
9641  * Creates a new CResult_TxOutAccessErrorZ in the error state.
9642  */
9643 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_err(enum LDKAccessError e);
9644
9645 /**
9646  * Frees any resources used by the CResult_TxOutAccessErrorZ.
9647  */
9648 void CResult_TxOutAccessErrorZ_free(struct LDKCResult_TxOutAccessErrorZ _res);
9649
9650 /**
9651  * Creates a new CResult_TxOutAccessErrorZ which has the same data as `orig`
9652  * but with all dynamically-allocated buffers duplicated in new buffers.
9653  */
9654 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_clone(const struct LDKCResult_TxOutAccessErrorZ *NONNULL_PTR orig);
9655
9656 /**
9657  * Creates a new tuple which has the same data as `orig`
9658  * but with all dynamically-allocated buffers duplicated in new buffers.
9659  */
9660 struct LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_clone(const struct LDKC2Tuple_usizeTransactionZ *NONNULL_PTR orig);
9661
9662 /**
9663  * Creates a new C2Tuple_usizeTransactionZ from the contained elements.
9664  */
9665 struct LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_new(uintptr_t a, struct LDKTransaction b);
9666
9667 /**
9668  * Frees any resources used by the C2Tuple_usizeTransactionZ.
9669  */
9670 void C2Tuple_usizeTransactionZ_free(struct LDKC2Tuple_usizeTransactionZ _res);
9671
9672 /**
9673  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9674  */
9675 void CVec_C2Tuple_usizeTransactionZZ_free(struct LDKCVec_C2Tuple_usizeTransactionZZ _res);
9676
9677 /**
9678  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9679  */
9680 void CVec_TxidZ_free(struct LDKCVec_TxidZ _res);
9681
9682 /**
9683  * Creates a new CResult_NoneChannelMonitorUpdateErrZ in the success state.
9684  */
9685 struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_ok(void);
9686
9687 /**
9688  * Creates a new CResult_NoneChannelMonitorUpdateErrZ in the error state.
9689  */
9690 struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_err(enum LDKChannelMonitorUpdateErr e);
9691
9692 /**
9693  * Frees any resources used by the CResult_NoneChannelMonitorUpdateErrZ.
9694  */
9695 void CResult_NoneChannelMonitorUpdateErrZ_free(struct LDKCResult_NoneChannelMonitorUpdateErrZ _res);
9696
9697 /**
9698  * Creates a new CResult_NoneChannelMonitorUpdateErrZ which has the same data as `orig`
9699  * but with all dynamically-allocated buffers duplicated in new buffers.
9700  */
9701 struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_clone(const struct LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR orig);
9702
9703 /**
9704  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9705  */
9706 void CVec_MonitorEventZ_free(struct LDKCVec_MonitorEventZ _res);
9707
9708 /**
9709  * Constructs a new COption_C2Tuple_usizeTransactionZZ containing a crate::c_types::derived::C2Tuple_usizeTransactionZ
9710  */
9711 struct LDKCOption_C2Tuple_usizeTransactionZZ COption_C2Tuple_usizeTransactionZZ_some(struct LDKC2Tuple_usizeTransactionZ o);
9712
9713 /**
9714  * Constructs a new COption_C2Tuple_usizeTransactionZZ containing nothing
9715  */
9716 struct LDKCOption_C2Tuple_usizeTransactionZZ COption_C2Tuple_usizeTransactionZZ_none(void);
9717
9718 /**
9719  * Frees any resources associated with the crate::c_types::derived::C2Tuple_usizeTransactionZ, if we are in the Some state
9720  */
9721 void COption_C2Tuple_usizeTransactionZZ_free(struct LDKCOption_C2Tuple_usizeTransactionZZ _res);
9722
9723 /**
9724  * Creates a new COption_C2Tuple_usizeTransactionZZ which has the same data as `orig`
9725  * but with all dynamically-allocated buffers duplicated in new buffers.
9726  */
9727 struct LDKCOption_C2Tuple_usizeTransactionZZ COption_C2Tuple_usizeTransactionZZ_clone(const struct LDKCOption_C2Tuple_usizeTransactionZZ *NONNULL_PTR orig);
9728
9729 /**
9730  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9731  */
9732 void CVec_SpendableOutputDescriptorZ_free(struct LDKCVec_SpendableOutputDescriptorZ _res);
9733
9734 /**
9735  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9736  */
9737 void CVec_MessageSendEventZ_free(struct LDKCVec_MessageSendEventZ _res);
9738
9739 /**
9740  * Creates a new CResult_InitFeaturesDecodeErrorZ in the success state.
9741  */
9742 struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_ok(struct LDKInitFeatures o);
9743
9744 /**
9745  * Creates a new CResult_InitFeaturesDecodeErrorZ in the error state.
9746  */
9747 struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
9748
9749 /**
9750  * Frees any resources used by the CResult_InitFeaturesDecodeErrorZ.
9751  */
9752 void CResult_InitFeaturesDecodeErrorZ_free(struct LDKCResult_InitFeaturesDecodeErrorZ _res);
9753
9754 /**
9755  * Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state.
9756  */
9757 struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_ok(struct LDKNodeFeatures o);
9758
9759 /**
9760  * Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state.
9761  */
9762 struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
9763
9764 /**
9765  * Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ.
9766  */
9767 void CResult_NodeFeaturesDecodeErrorZ_free(struct LDKCResult_NodeFeaturesDecodeErrorZ _res);
9768
9769 /**
9770  * Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state.
9771  */
9772 struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_ok(struct LDKChannelFeatures o);
9773
9774 /**
9775  * Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state.
9776  */
9777 struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
9778
9779 /**
9780  * Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ.
9781  */
9782 void CResult_ChannelFeaturesDecodeErrorZ_free(struct LDKCResult_ChannelFeaturesDecodeErrorZ _res);
9783
9784 /**
9785  * Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the success state.
9786  */
9787 struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_ok(struct LDKInvoiceFeatures o);
9788
9789 /**
9790  * Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the error state.
9791  */
9792 struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
9793
9794 /**
9795  * Frees any resources used by the CResult_InvoiceFeaturesDecodeErrorZ.
9796  */
9797 void CResult_InvoiceFeaturesDecodeErrorZ_free(struct LDKCResult_InvoiceFeaturesDecodeErrorZ _res);
9798
9799 /**
9800  * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the success state.
9801  */
9802 struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(struct LDKDelayedPaymentOutputDescriptor o);
9803
9804 /**
9805  * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the error state.
9806  */
9807 struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e);
9808
9809 /**
9810  * Frees any resources used by the CResult_DelayedPaymentOutputDescriptorDecodeErrorZ.
9811  */
9812 void CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res);
9813
9814 /**
9815  * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
9816  * but with all dynamically-allocated buffers duplicated in new buffers.
9817  */
9818 struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR orig);
9819
9820 /**
9821  * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the success state.
9822  */
9823 struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(struct LDKStaticPaymentOutputDescriptor o);
9824
9825 /**
9826  * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the error state.
9827  */
9828 struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e);
9829
9830 /**
9831  * Frees any resources used by the CResult_StaticPaymentOutputDescriptorDecodeErrorZ.
9832  */
9833 void CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res);
9834
9835 /**
9836  * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
9837  * but with all dynamically-allocated buffers duplicated in new buffers.
9838  */
9839 struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR orig);
9840
9841 /**
9842  * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state.
9843  */
9844 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_ok(struct LDKSpendableOutputDescriptor o);
9845
9846 /**
9847  * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state.
9848  */
9849 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e);
9850
9851 /**
9852  * Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ.
9853  */
9854 void CResult_SpendableOutputDescriptorDecodeErrorZ_free(struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res);
9855
9856 /**
9857  * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig`
9858  * but with all dynamically-allocated buffers duplicated in new buffers.
9859  */
9860 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR orig);
9861
9862 /**
9863  * Creates a new tuple which has the same data as `orig`
9864  * but with all dynamically-allocated buffers duplicated in new buffers.
9865  */
9866 struct LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_clone(const struct LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR orig);
9867
9868 /**
9869  * Creates a new C2Tuple_SignatureCVec_SignatureZZ from the contained elements.
9870  */
9871 struct LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_new(struct LDKSignature a, struct LDKCVec_SignatureZ b);
9872
9873 /**
9874  * Frees any resources used by the C2Tuple_SignatureCVec_SignatureZZ.
9875  */
9876 void C2Tuple_SignatureCVec_SignatureZZ_free(struct LDKC2Tuple_SignatureCVec_SignatureZZ _res);
9877
9878 /**
9879  * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the success state.
9880  */
9881 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(struct LDKC2Tuple_SignatureCVec_SignatureZZ o);
9882
9883 /**
9884  * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the error state.
9885  */
9886 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err(void);
9887
9888 /**
9889  * Frees any resources used by the CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ.
9890  */
9891 void CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res);
9892
9893 /**
9894  * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ which has the same data as `orig`
9895  * but with all dynamically-allocated buffers duplicated in new buffers.
9896  */
9897 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(const struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR orig);
9898
9899 /**
9900  * Creates a new CResult_SignatureNoneZ in the success state.
9901  */
9902 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_ok(struct LDKSignature o);
9903
9904 /**
9905  * Creates a new CResult_SignatureNoneZ in the error state.
9906  */
9907 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_err(void);
9908
9909 /**
9910  * Frees any resources used by the CResult_SignatureNoneZ.
9911  */
9912 void CResult_SignatureNoneZ_free(struct LDKCResult_SignatureNoneZ _res);
9913
9914 /**
9915  * Creates a new CResult_SignatureNoneZ which has the same data as `orig`
9916  * but with all dynamically-allocated buffers duplicated in new buffers.
9917  */
9918 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_clone(const struct LDKCResult_SignatureNoneZ *NONNULL_PTR orig);
9919
9920 /**
9921  * Creates a new CResult_SignDecodeErrorZ in the success state.
9922  */
9923 struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_ok(struct LDKSign o);
9924
9925 /**
9926  * Creates a new CResult_SignDecodeErrorZ in the error state.
9927  */
9928 struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_err(struct LDKDecodeError e);
9929
9930 /**
9931  * Frees any resources used by the CResult_SignDecodeErrorZ.
9932  */
9933 void CResult_SignDecodeErrorZ_free(struct LDKCResult_SignDecodeErrorZ _res);
9934
9935 /**
9936  * Creates a new CResult_SignDecodeErrorZ which has the same data as `orig`
9937  * but with all dynamically-allocated buffers duplicated in new buffers.
9938  */
9939 struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_clone(const struct LDKCResult_SignDecodeErrorZ *NONNULL_PTR orig);
9940
9941 /**
9942  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9943  */
9944 void CVec_u8Z_free(struct LDKCVec_u8Z _res);
9945
9946 /**
9947  * Creates a new CResult_RecoverableSignatureNoneZ in the success state.
9948  */
9949 struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_ok(struct LDKRecoverableSignature o);
9950
9951 /**
9952  * Creates a new CResult_RecoverableSignatureNoneZ in the error state.
9953  */
9954 struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_err(void);
9955
9956 /**
9957  * Frees any resources used by the CResult_RecoverableSignatureNoneZ.
9958  */
9959 void CResult_RecoverableSignatureNoneZ_free(struct LDKCResult_RecoverableSignatureNoneZ _res);
9960
9961 /**
9962  * Creates a new CResult_RecoverableSignatureNoneZ which has the same data as `orig`
9963  * but with all dynamically-allocated buffers duplicated in new buffers.
9964  */
9965 struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_clone(const struct LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR orig);
9966
9967 /**
9968  * Frees the buffer pointed to by `data` if `datalen` is non-0.
9969  */
9970 void CVec_CVec_u8ZZ_free(struct LDKCVec_CVec_u8ZZ _res);
9971
9972 /**
9973  * Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state.
9974  */
9975 struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_ok(struct LDKCVec_CVec_u8ZZ o);
9976
9977 /**
9978  * Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state.
9979  */
9980 struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_err(void);
9981
9982 /**
9983  * Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ.
9984  */
9985 void CResult_CVec_CVec_u8ZZNoneZ_free(struct LDKCResult_CVec_CVec_u8ZZNoneZ _res);
9986
9987 /**
9988  * Creates a new CResult_CVec_CVec_u8ZZNoneZ which has the same data as `orig`
9989  * but with all dynamically-allocated buffers duplicated in new buffers.
9990  */
9991 struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_clone(const struct LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR orig);
9992
9993 /**
9994  * Creates a new CResult_InMemorySignerDecodeErrorZ in the success state.
9995  */
9996 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_ok(struct LDKInMemorySigner o);
9997
9998 /**
9999  * Creates a new CResult_InMemorySignerDecodeErrorZ in the error state.
10000  */
10001 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_err(struct LDKDecodeError e);
10002
10003 /**
10004  * Frees any resources used by the CResult_InMemorySignerDecodeErrorZ.
10005  */
10006 void CResult_InMemorySignerDecodeErrorZ_free(struct LDKCResult_InMemorySignerDecodeErrorZ _res);
10007
10008 /**
10009  * Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig`
10010  * but with all dynamically-allocated buffers duplicated in new buffers.
10011  */
10012 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_clone(const struct LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR orig);
10013
10014 /**
10015  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10016  */
10017 void CVec_TxOutZ_free(struct LDKCVec_TxOutZ _res);
10018
10019 /**
10020  * Creates a new CResult_TransactionNoneZ in the success state.
10021  */
10022 struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_ok(struct LDKTransaction o);
10023
10024 /**
10025  * Creates a new CResult_TransactionNoneZ in the error state.
10026  */
10027 struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_err(void);
10028
10029 /**
10030  * Frees any resources used by the CResult_TransactionNoneZ.
10031  */
10032 void CResult_TransactionNoneZ_free(struct LDKCResult_TransactionNoneZ _res);
10033
10034 /**
10035  * Creates a new CResult_TransactionNoneZ which has the same data as `orig`
10036  * but with all dynamically-allocated buffers duplicated in new buffers.
10037  */
10038 struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_clone(const struct LDKCResult_TransactionNoneZ *NONNULL_PTR orig);
10039
10040 /**
10041  * Creates a new C2Tuple_BlockHashChannelMonitorZ from the contained elements.
10042  */
10043 struct LDKC2Tuple_BlockHashChannelMonitorZ C2Tuple_BlockHashChannelMonitorZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelMonitor b);
10044
10045 /**
10046  * Frees any resources used by the C2Tuple_BlockHashChannelMonitorZ.
10047  */
10048 void C2Tuple_BlockHashChannelMonitorZ_free(struct LDKC2Tuple_BlockHashChannelMonitorZ _res);
10049
10050 /**
10051  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10052  */
10053 void CVec_C2Tuple_BlockHashChannelMonitorZZ_free(struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ _res);
10054
10055 /**
10056  * Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the success state.
10057  */
10058 struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ o);
10059
10060 /**
10061  * Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the error state.
10062  */
10063 struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(enum LDKIOError e);
10064
10065 /**
10066  * Frees any resources used by the CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.
10067  */
10068 void CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ _res);
10069
10070 /**
10071  * Constructs a new COption_u16Z containing a u16
10072  */
10073 struct LDKCOption_u16Z COption_u16Z_some(uint16_t o);
10074
10075 /**
10076  * Constructs a new COption_u16Z containing nothing
10077  */
10078 struct LDKCOption_u16Z COption_u16Z_none(void);
10079
10080 /**
10081  * Frees any resources associated with the u16, if we are in the Some state
10082  */
10083 void COption_u16Z_free(struct LDKCOption_u16Z _res);
10084
10085 /**
10086  * Creates a new COption_u16Z which has the same data as `orig`
10087  * but with all dynamically-allocated buffers duplicated in new buffers.
10088  */
10089 struct LDKCOption_u16Z COption_u16Z_clone(const struct LDKCOption_u16Z *NONNULL_PTR orig);
10090
10091 /**
10092  * Creates a new CResult_NoneAPIErrorZ in the success state.
10093  */
10094 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_ok(void);
10095
10096 /**
10097  * Creates a new CResult_NoneAPIErrorZ in the error state.
10098  */
10099 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_err(struct LDKAPIError e);
10100
10101 /**
10102  * Frees any resources used by the CResult_NoneAPIErrorZ.
10103  */
10104 void CResult_NoneAPIErrorZ_free(struct LDKCResult_NoneAPIErrorZ _res);
10105
10106 /**
10107  * Creates a new CResult_NoneAPIErrorZ which has the same data as `orig`
10108  * but with all dynamically-allocated buffers duplicated in new buffers.
10109  */
10110 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_clone(const struct LDKCResult_NoneAPIErrorZ *NONNULL_PTR orig);
10111
10112 /**
10113  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10114  */
10115 void CVec_CResult_NoneAPIErrorZZ_free(struct LDKCVec_CResult_NoneAPIErrorZZ _res);
10116
10117 /**
10118  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10119  */
10120 void CVec_APIErrorZ_free(struct LDKCVec_APIErrorZ _res);
10121
10122 /**
10123  * Creates a new CResult_NonePaymentSendFailureZ in the success state.
10124  */
10125 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_ok(void);
10126
10127 /**
10128  * Creates a new CResult_NonePaymentSendFailureZ in the error state.
10129  */
10130 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_err(struct LDKPaymentSendFailure e);
10131
10132 /**
10133  * Frees any resources used by the CResult_NonePaymentSendFailureZ.
10134  */
10135 void CResult_NonePaymentSendFailureZ_free(struct LDKCResult_NonePaymentSendFailureZ _res);
10136
10137 /**
10138  * Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
10139  * but with all dynamically-allocated buffers duplicated in new buffers.
10140  */
10141 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_clone(const struct LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR orig);
10142
10143 /**
10144  * Creates a new CResult_PaymentHashPaymentSendFailureZ in the success state.
10145  */
10146 struct LDKCResult_PaymentHashPaymentSendFailureZ CResult_PaymentHashPaymentSendFailureZ_ok(struct LDKThirtyTwoBytes o);
10147
10148 /**
10149  * Creates a new CResult_PaymentHashPaymentSendFailureZ in the error state.
10150  */
10151 struct LDKCResult_PaymentHashPaymentSendFailureZ CResult_PaymentHashPaymentSendFailureZ_err(struct LDKPaymentSendFailure e);
10152
10153 /**
10154  * Frees any resources used by the CResult_PaymentHashPaymentSendFailureZ.
10155  */
10156 void CResult_PaymentHashPaymentSendFailureZ_free(struct LDKCResult_PaymentHashPaymentSendFailureZ _res);
10157
10158 /**
10159  * Creates a new CResult_PaymentHashPaymentSendFailureZ which has the same data as `orig`
10160  * but with all dynamically-allocated buffers duplicated in new buffers.
10161  */
10162 struct LDKCResult_PaymentHashPaymentSendFailureZ CResult_PaymentHashPaymentSendFailureZ_clone(const struct LDKCResult_PaymentHashPaymentSendFailureZ *NONNULL_PTR orig);
10163
10164 /**
10165  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10166  */
10167 void CVec_NetAddressZ_free(struct LDKCVec_NetAddressZ _res);
10168
10169 /**
10170  * Creates a new tuple which has the same data as `orig`
10171  * but with all dynamically-allocated buffers duplicated in new buffers.
10172  */
10173 struct LDKC2Tuple_PaymentHashPaymentSecretZ C2Tuple_PaymentHashPaymentSecretZ_clone(const struct LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR orig);
10174
10175 /**
10176  * Creates a new C2Tuple_PaymentHashPaymentSecretZ from the contained elements.
10177  */
10178 struct LDKC2Tuple_PaymentHashPaymentSecretZ C2Tuple_PaymentHashPaymentSecretZ_new(struct LDKThirtyTwoBytes a, struct LDKThirtyTwoBytes b);
10179
10180 /**
10181  * Frees any resources used by the C2Tuple_PaymentHashPaymentSecretZ.
10182  */
10183 void C2Tuple_PaymentHashPaymentSecretZ_free(struct LDKC2Tuple_PaymentHashPaymentSecretZ _res);
10184
10185 /**
10186  * Creates a new CResult_PaymentSecretAPIErrorZ in the success state.
10187  */
10188 struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_ok(struct LDKThirtyTwoBytes o);
10189
10190 /**
10191  * Creates a new CResult_PaymentSecretAPIErrorZ in the error state.
10192  */
10193 struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_err(struct LDKAPIError e);
10194
10195 /**
10196  * Frees any resources used by the CResult_PaymentSecretAPIErrorZ.
10197  */
10198 void CResult_PaymentSecretAPIErrorZ_free(struct LDKCResult_PaymentSecretAPIErrorZ _res);
10199
10200 /**
10201  * Creates a new CResult_PaymentSecretAPIErrorZ which has the same data as `orig`
10202  * but with all dynamically-allocated buffers duplicated in new buffers.
10203  */
10204 struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_clone(const struct LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR orig);
10205
10206 /**
10207  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10208  */
10209 void CVec_ChannelMonitorZ_free(struct LDKCVec_ChannelMonitorZ _res);
10210
10211 /**
10212  * Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements.
10213  */
10214 struct LDKC2Tuple_BlockHashChannelManagerZ C2Tuple_BlockHashChannelManagerZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelManager b);
10215
10216 /**
10217  * Frees any resources used by the C2Tuple_BlockHashChannelManagerZ.
10218  */
10219 void C2Tuple_BlockHashChannelManagerZ_free(struct LDKC2Tuple_BlockHashChannelManagerZ _res);
10220
10221 /**
10222  * Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state.
10223  */
10224 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelManagerZ o);
10225
10226 /**
10227  * Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state.
10228  */
10229 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(struct LDKDecodeError e);
10230
10231 /**
10232  * Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.
10233  */
10234 void CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res);
10235
10236 /**
10237  * Creates a new CResult_ChannelConfigDecodeErrorZ in the success state.
10238  */
10239 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_ok(struct LDKChannelConfig o);
10240
10241 /**
10242  * Creates a new CResult_ChannelConfigDecodeErrorZ in the error state.
10243  */
10244 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_err(struct LDKDecodeError e);
10245
10246 /**
10247  * Frees any resources used by the CResult_ChannelConfigDecodeErrorZ.
10248  */
10249 void CResult_ChannelConfigDecodeErrorZ_free(struct LDKCResult_ChannelConfigDecodeErrorZ _res);
10250
10251 /**
10252  * Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig`
10253  * but with all dynamically-allocated buffers duplicated in new buffers.
10254  */
10255 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_clone(const struct LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR orig);
10256
10257 /**
10258  * Creates a new CResult_OutPointDecodeErrorZ in the success state.
10259  */
10260 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_ok(struct LDKOutPoint o);
10261
10262 /**
10263  * Creates a new CResult_OutPointDecodeErrorZ in the error state.
10264  */
10265 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_err(struct LDKDecodeError e);
10266
10267 /**
10268  * Frees any resources used by the CResult_OutPointDecodeErrorZ.
10269  */
10270 void CResult_OutPointDecodeErrorZ_free(struct LDKCResult_OutPointDecodeErrorZ _res);
10271
10272 /**
10273  * Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig`
10274  * but with all dynamically-allocated buffers duplicated in new buffers.
10275  */
10276 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_clone(const struct LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR orig);
10277
10278 /**
10279  * Creates a new CResult_SiPrefixNoneZ in the success state.
10280  */
10281 struct LDKCResult_SiPrefixNoneZ CResult_SiPrefixNoneZ_ok(enum LDKSiPrefix o);
10282
10283 /**
10284  * Creates a new CResult_SiPrefixNoneZ in the error state.
10285  */
10286 struct LDKCResult_SiPrefixNoneZ CResult_SiPrefixNoneZ_err(void);
10287
10288 /**
10289  * Frees any resources used by the CResult_SiPrefixNoneZ.
10290  */
10291 void CResult_SiPrefixNoneZ_free(struct LDKCResult_SiPrefixNoneZ _res);
10292
10293 /**
10294  * Creates a new CResult_SiPrefixNoneZ which has the same data as `orig`
10295  * but with all dynamically-allocated buffers duplicated in new buffers.
10296  */
10297 struct LDKCResult_SiPrefixNoneZ CResult_SiPrefixNoneZ_clone(const struct LDKCResult_SiPrefixNoneZ *NONNULL_PTR orig);
10298
10299 /**
10300  * Creates a new CResult_InvoiceNoneZ in the success state.
10301  */
10302 struct LDKCResult_InvoiceNoneZ CResult_InvoiceNoneZ_ok(struct LDKInvoice o);
10303
10304 /**
10305  * Creates a new CResult_InvoiceNoneZ in the error state.
10306  */
10307 struct LDKCResult_InvoiceNoneZ CResult_InvoiceNoneZ_err(void);
10308
10309 /**
10310  * Frees any resources used by the CResult_InvoiceNoneZ.
10311  */
10312 void CResult_InvoiceNoneZ_free(struct LDKCResult_InvoiceNoneZ _res);
10313
10314 /**
10315  * Creates a new CResult_InvoiceNoneZ which has the same data as `orig`
10316  * but with all dynamically-allocated buffers duplicated in new buffers.
10317  */
10318 struct LDKCResult_InvoiceNoneZ CResult_InvoiceNoneZ_clone(const struct LDKCResult_InvoiceNoneZ *NONNULL_PTR orig);
10319
10320 /**
10321  * Creates a new CResult_SignedRawInvoiceNoneZ in the success state.
10322  */
10323 struct LDKCResult_SignedRawInvoiceNoneZ CResult_SignedRawInvoiceNoneZ_ok(struct LDKSignedRawInvoice o);
10324
10325 /**
10326  * Creates a new CResult_SignedRawInvoiceNoneZ in the error state.
10327  */
10328 struct LDKCResult_SignedRawInvoiceNoneZ CResult_SignedRawInvoiceNoneZ_err(void);
10329
10330 /**
10331  * Frees any resources used by the CResult_SignedRawInvoiceNoneZ.
10332  */
10333 void CResult_SignedRawInvoiceNoneZ_free(struct LDKCResult_SignedRawInvoiceNoneZ _res);
10334
10335 /**
10336  * Creates a new CResult_SignedRawInvoiceNoneZ which has the same data as `orig`
10337  * but with all dynamically-allocated buffers duplicated in new buffers.
10338  */
10339 struct LDKCResult_SignedRawInvoiceNoneZ CResult_SignedRawInvoiceNoneZ_clone(const struct LDKCResult_SignedRawInvoiceNoneZ *NONNULL_PTR orig);
10340
10341 /**
10342  * Creates a new tuple which has the same data as `orig`
10343  * but with all dynamically-allocated buffers duplicated in new buffers.
10344  */
10345 struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(const struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR orig);
10346
10347 /**
10348  * Creates a new C3Tuple_RawInvoice_u832InvoiceSignatureZ from the contained elements.
10349  */
10350 struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(struct LDKRawInvoice a, struct LDKThirtyTwoBytes b, struct LDKInvoiceSignature c);
10351
10352 /**
10353  * Frees any resources used by the C3Tuple_RawInvoice_u832InvoiceSignatureZ.
10354  */
10355 void C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ _res);
10356
10357 /**
10358  * Creates a new CResult_PayeePubKeyErrorZ in the success state.
10359  */
10360 struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_ok(struct LDKPayeePubKey o);
10361
10362 /**
10363  * Creates a new CResult_PayeePubKeyErrorZ in the error state.
10364  */
10365 struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_err(enum LDKSecp256k1Error e);
10366
10367 /**
10368  * Frees any resources used by the CResult_PayeePubKeyErrorZ.
10369  */
10370 void CResult_PayeePubKeyErrorZ_free(struct LDKCResult_PayeePubKeyErrorZ _res);
10371
10372 /**
10373  * Creates a new CResult_PayeePubKeyErrorZ which has the same data as `orig`
10374  * but with all dynamically-allocated buffers duplicated in new buffers.
10375  */
10376 struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_clone(const struct LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR orig);
10377
10378 /**
10379  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10380  */
10381 void CVec_PrivateRouteZ_free(struct LDKCVec_PrivateRouteZ _res);
10382
10383 /**
10384  * Creates a new CResult_PositiveTimestampCreationErrorZ in the success state.
10385  */
10386 struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_ok(struct LDKPositiveTimestamp o);
10387
10388 /**
10389  * Creates a new CResult_PositiveTimestampCreationErrorZ in the error state.
10390  */
10391 struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_err(enum LDKCreationError e);
10392
10393 /**
10394  * Frees any resources used by the CResult_PositiveTimestampCreationErrorZ.
10395  */
10396 void CResult_PositiveTimestampCreationErrorZ_free(struct LDKCResult_PositiveTimestampCreationErrorZ _res);
10397
10398 /**
10399  * Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig`
10400  * but with all dynamically-allocated buffers duplicated in new buffers.
10401  */
10402 struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_clone(const struct LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR orig);
10403
10404 /**
10405  * Creates a new CResult_NoneSemanticErrorZ in the success state.
10406  */
10407 struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_ok(void);
10408
10409 /**
10410  * Creates a new CResult_NoneSemanticErrorZ in the error state.
10411  */
10412 struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_err(enum LDKSemanticError e);
10413
10414 /**
10415  * Frees any resources used by the CResult_NoneSemanticErrorZ.
10416  */
10417 void CResult_NoneSemanticErrorZ_free(struct LDKCResult_NoneSemanticErrorZ _res);
10418
10419 /**
10420  * Creates a new CResult_NoneSemanticErrorZ which has the same data as `orig`
10421  * but with all dynamically-allocated buffers duplicated in new buffers.
10422  */
10423 struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_clone(const struct LDKCResult_NoneSemanticErrorZ *NONNULL_PTR orig);
10424
10425 /**
10426  * Creates a new CResult_InvoiceSemanticErrorZ in the success state.
10427  */
10428 struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_ok(struct LDKInvoice o);
10429
10430 /**
10431  * Creates a new CResult_InvoiceSemanticErrorZ in the error state.
10432  */
10433 struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_err(enum LDKSemanticError e);
10434
10435 /**
10436  * Frees any resources used by the CResult_InvoiceSemanticErrorZ.
10437  */
10438 void CResult_InvoiceSemanticErrorZ_free(struct LDKCResult_InvoiceSemanticErrorZ _res);
10439
10440 /**
10441  * Creates a new CResult_InvoiceSemanticErrorZ which has the same data as `orig`
10442  * but with all dynamically-allocated buffers duplicated in new buffers.
10443  */
10444 struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_clone(const struct LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR orig);
10445
10446 /**
10447  * Creates a new CResult_DescriptionCreationErrorZ in the success state.
10448  */
10449 struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_ok(struct LDKDescription o);
10450
10451 /**
10452  * Creates a new CResult_DescriptionCreationErrorZ in the error state.
10453  */
10454 struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_err(enum LDKCreationError e);
10455
10456 /**
10457  * Frees any resources used by the CResult_DescriptionCreationErrorZ.
10458  */
10459 void CResult_DescriptionCreationErrorZ_free(struct LDKCResult_DescriptionCreationErrorZ _res);
10460
10461 /**
10462  * Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig`
10463  * but with all dynamically-allocated buffers duplicated in new buffers.
10464  */
10465 struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_clone(const struct LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR orig);
10466
10467 /**
10468  * Creates a new CResult_ExpiryTimeCreationErrorZ in the success state.
10469  */
10470 struct LDKCResult_ExpiryTimeCreationErrorZ CResult_ExpiryTimeCreationErrorZ_ok(struct LDKExpiryTime o);
10471
10472 /**
10473  * Creates a new CResult_ExpiryTimeCreationErrorZ in the error state.
10474  */
10475 struct LDKCResult_ExpiryTimeCreationErrorZ CResult_ExpiryTimeCreationErrorZ_err(enum LDKCreationError e);
10476
10477 /**
10478  * Frees any resources used by the CResult_ExpiryTimeCreationErrorZ.
10479  */
10480 void CResult_ExpiryTimeCreationErrorZ_free(struct LDKCResult_ExpiryTimeCreationErrorZ _res);
10481
10482 /**
10483  * Creates a new CResult_ExpiryTimeCreationErrorZ which has the same data as `orig`
10484  * but with all dynamically-allocated buffers duplicated in new buffers.
10485  */
10486 struct LDKCResult_ExpiryTimeCreationErrorZ CResult_ExpiryTimeCreationErrorZ_clone(const struct LDKCResult_ExpiryTimeCreationErrorZ *NONNULL_PTR orig);
10487
10488 /**
10489  * Creates a new CResult_PrivateRouteCreationErrorZ in the success state.
10490  */
10491 struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_ok(struct LDKPrivateRoute o);
10492
10493 /**
10494  * Creates a new CResult_PrivateRouteCreationErrorZ in the error state.
10495  */
10496 struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_err(enum LDKCreationError e);
10497
10498 /**
10499  * Frees any resources used by the CResult_PrivateRouteCreationErrorZ.
10500  */
10501 void CResult_PrivateRouteCreationErrorZ_free(struct LDKCResult_PrivateRouteCreationErrorZ _res);
10502
10503 /**
10504  * Creates a new CResult_PrivateRouteCreationErrorZ which has the same data as `orig`
10505  * but with all dynamically-allocated buffers duplicated in new buffers.
10506  */
10507 struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_clone(const struct LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR orig);
10508
10509 /**
10510  * Creates a new CResult_StringErrorZ in the success state.
10511  */
10512 struct LDKCResult_StringErrorZ CResult_StringErrorZ_ok(struct LDKStr o);
10513
10514 /**
10515  * Creates a new CResult_StringErrorZ in the error state.
10516  */
10517 struct LDKCResult_StringErrorZ CResult_StringErrorZ_err(enum LDKSecp256k1Error e);
10518
10519 /**
10520  * Frees any resources used by the CResult_StringErrorZ.
10521  */
10522 void CResult_StringErrorZ_free(struct LDKCResult_StringErrorZ _res);
10523
10524 /**
10525  * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
10526  */
10527 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_ok(struct LDKChannelMonitorUpdate o);
10528
10529 /**
10530  * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
10531  */
10532 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_err(struct LDKDecodeError e);
10533
10534 /**
10535  * Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
10536  */
10537 void CResult_ChannelMonitorUpdateDecodeErrorZ_free(struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res);
10538
10539 /**
10540  * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
10541  * but with all dynamically-allocated buffers duplicated in new buffers.
10542  */
10543 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_clone(const struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR orig);
10544
10545 /**
10546  * Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
10547  */
10548 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_ok(struct LDKHTLCUpdate o);
10549
10550 /**
10551  * Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
10552  */
10553 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_err(struct LDKDecodeError e);
10554
10555 /**
10556  * Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
10557  */
10558 void CResult_HTLCUpdateDecodeErrorZ_free(struct LDKCResult_HTLCUpdateDecodeErrorZ _res);
10559
10560 /**
10561  * Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
10562  * but with all dynamically-allocated buffers duplicated in new buffers.
10563  */
10564 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_clone(const struct LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR orig);
10565
10566 /**
10567  * Creates a new CResult_NoneMonitorUpdateErrorZ in the success state.
10568  */
10569 struct LDKCResult_NoneMonitorUpdateErrorZ CResult_NoneMonitorUpdateErrorZ_ok(void);
10570
10571 /**
10572  * Creates a new CResult_NoneMonitorUpdateErrorZ in the error state.
10573  */
10574 struct LDKCResult_NoneMonitorUpdateErrorZ CResult_NoneMonitorUpdateErrorZ_err(struct LDKMonitorUpdateError e);
10575
10576 /**
10577  * Frees any resources used by the CResult_NoneMonitorUpdateErrorZ.
10578  */
10579 void CResult_NoneMonitorUpdateErrorZ_free(struct LDKCResult_NoneMonitorUpdateErrorZ _res);
10580
10581 /**
10582  * Creates a new CResult_NoneMonitorUpdateErrorZ which has the same data as `orig`
10583  * but with all dynamically-allocated buffers duplicated in new buffers.
10584  */
10585 struct LDKCResult_NoneMonitorUpdateErrorZ CResult_NoneMonitorUpdateErrorZ_clone(const struct LDKCResult_NoneMonitorUpdateErrorZ *NONNULL_PTR orig);
10586
10587 /**
10588  * Creates a new tuple which has the same data as `orig`
10589  * but with all dynamically-allocated buffers duplicated in new buffers.
10590  */
10591 struct LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_clone(const struct LDKC2Tuple_OutPointScriptZ *NONNULL_PTR orig);
10592
10593 /**
10594  * Creates a new C2Tuple_OutPointScriptZ from the contained elements.
10595  */
10596 struct LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_new(struct LDKOutPoint a, struct LDKCVec_u8Z b);
10597
10598 /**
10599  * Frees any resources used by the C2Tuple_OutPointScriptZ.
10600  */
10601 void C2Tuple_OutPointScriptZ_free(struct LDKC2Tuple_OutPointScriptZ _res);
10602
10603 /**
10604  * Creates a new tuple which has the same data as `orig`
10605  * but with all dynamically-allocated buffers duplicated in new buffers.
10606  */
10607 struct LDKC2Tuple_u32ScriptZ C2Tuple_u32ScriptZ_clone(const struct LDKC2Tuple_u32ScriptZ *NONNULL_PTR orig);
10608
10609 /**
10610  * Creates a new C2Tuple_u32ScriptZ from the contained elements.
10611  */
10612 struct LDKC2Tuple_u32ScriptZ C2Tuple_u32ScriptZ_new(uint32_t a, struct LDKCVec_u8Z b);
10613
10614 /**
10615  * Frees any resources used by the C2Tuple_u32ScriptZ.
10616  */
10617 void C2Tuple_u32ScriptZ_free(struct LDKC2Tuple_u32ScriptZ _res);
10618
10619 /**
10620  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10621  */
10622 void CVec_C2Tuple_u32ScriptZZ_free(struct LDKCVec_C2Tuple_u32ScriptZZ _res);
10623
10624 /**
10625  * Creates a new tuple which has the same data as `orig`
10626  * but with all dynamically-allocated buffers duplicated in new buffers.
10627  */
10628 struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(const struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR orig);
10629
10630 /**
10631  * Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements.
10632  */
10633 struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32ScriptZZ b);
10634
10635 /**
10636  * Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ.
10637  */
10638 void C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res);
10639
10640 /**
10641  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10642  */
10643 void CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res);
10644
10645 /**
10646  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10647  */
10648 void CVec_EventZ_free(struct LDKCVec_EventZ _res);
10649
10650 /**
10651  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10652  */
10653 void CVec_TransactionZ_free(struct LDKCVec_TransactionZ _res);
10654
10655 /**
10656  * Creates a new tuple which has the same data as `orig`
10657  * but with all dynamically-allocated buffers duplicated in new buffers.
10658  */
10659 struct LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_clone(const struct LDKC2Tuple_u32TxOutZ *NONNULL_PTR orig);
10660
10661 /**
10662  * Creates a new C2Tuple_u32TxOutZ from the contained elements.
10663  */
10664 struct LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_new(uint32_t a, struct LDKTxOut b);
10665
10666 /**
10667  * Frees any resources used by the C2Tuple_u32TxOutZ.
10668  */
10669 void C2Tuple_u32TxOutZ_free(struct LDKC2Tuple_u32TxOutZ _res);
10670
10671 /**
10672  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10673  */
10674 void CVec_C2Tuple_u32TxOutZZ_free(struct LDKCVec_C2Tuple_u32TxOutZZ _res);
10675
10676 /**
10677  * Creates a new tuple which has the same data as `orig`
10678  * but with all dynamically-allocated buffers duplicated in new buffers.
10679  */
10680 struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(const struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR orig);
10681
10682 /**
10683  * Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements.
10684  */
10685 struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32TxOutZZ b);
10686
10687 /**
10688  * Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ.
10689  */
10690 void C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res);
10691
10692 /**
10693  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10694  */
10695 void CVec_TransactionOutputsZ_free(struct LDKCVec_TransactionOutputsZ _res);
10696
10697 /**
10698  * Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state.
10699  */
10700 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelMonitorZ o);
10701
10702 /**
10703  * Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state.
10704  */
10705 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(struct LDKDecodeError e);
10706
10707 /**
10708  * Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.
10709  */
10710 void CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res);
10711
10712 /**
10713  * Creates a new CResult_boolLightningErrorZ in the success state.
10714  */
10715 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_ok(bool o);
10716
10717 /**
10718  * Creates a new CResult_boolLightningErrorZ in the error state.
10719  */
10720 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_err(struct LDKLightningError e);
10721
10722 /**
10723  * Frees any resources used by the CResult_boolLightningErrorZ.
10724  */
10725 void CResult_boolLightningErrorZ_free(struct LDKCResult_boolLightningErrorZ _res);
10726
10727 /**
10728  * Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
10729  * but with all dynamically-allocated buffers duplicated in new buffers.
10730  */
10731 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_clone(const struct LDKCResult_boolLightningErrorZ *NONNULL_PTR orig);
10732
10733 /**
10734  * Creates a new tuple which has the same data as `orig`
10735  * but with all dynamically-allocated buffers duplicated in new buffers.
10736  */
10737 struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(const struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR orig);
10738
10739 /**
10740  * Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
10741  */
10742 struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(struct LDKChannelAnnouncement a, struct LDKChannelUpdate b, struct LDKChannelUpdate c);
10743
10744 /**
10745  * Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
10746  */
10747 void C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res);
10748
10749 /**
10750  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10751  */
10752 void CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res);
10753
10754 /**
10755  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10756  */
10757 void CVec_NodeAnnouncementZ_free(struct LDKCVec_NodeAnnouncementZ _res);
10758
10759 /**
10760  * Creates a new CResult_NoneLightningErrorZ in the success state.
10761  */
10762 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_ok(void);
10763
10764 /**
10765  * Creates a new CResult_NoneLightningErrorZ in the error state.
10766  */
10767 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_err(struct LDKLightningError e);
10768
10769 /**
10770  * Frees any resources used by the CResult_NoneLightningErrorZ.
10771  */
10772 void CResult_NoneLightningErrorZ_free(struct LDKCResult_NoneLightningErrorZ _res);
10773
10774 /**
10775  * Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
10776  * but with all dynamically-allocated buffers duplicated in new buffers.
10777  */
10778 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_clone(const struct LDKCResult_NoneLightningErrorZ *NONNULL_PTR orig);
10779
10780 /**
10781  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10782  */
10783 void CVec_PublicKeyZ_free(struct LDKCVec_PublicKeyZ _res);
10784
10785 /**
10786  * Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
10787  */
10788 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_ok(struct LDKCVec_u8Z o);
10789
10790 /**
10791  * Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
10792  */
10793 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_err(struct LDKPeerHandleError e);
10794
10795 /**
10796  * Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
10797  */
10798 void CResult_CVec_u8ZPeerHandleErrorZ_free(struct LDKCResult_CVec_u8ZPeerHandleErrorZ _res);
10799
10800 /**
10801  * Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
10802  * but with all dynamically-allocated buffers duplicated in new buffers.
10803  */
10804 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_clone(const struct LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR orig);
10805
10806 /**
10807  * Creates a new CResult_NonePeerHandleErrorZ in the success state.
10808  */
10809 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_ok(void);
10810
10811 /**
10812  * Creates a new CResult_NonePeerHandleErrorZ in the error state.
10813  */
10814 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_err(struct LDKPeerHandleError e);
10815
10816 /**
10817  * Frees any resources used by the CResult_NonePeerHandleErrorZ.
10818  */
10819 void CResult_NonePeerHandleErrorZ_free(struct LDKCResult_NonePeerHandleErrorZ _res);
10820
10821 /**
10822  * Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
10823  * but with all dynamically-allocated buffers duplicated in new buffers.
10824  */
10825 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_clone(const struct LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR orig);
10826
10827 /**
10828  * Creates a new CResult_boolPeerHandleErrorZ in the success state.
10829  */
10830 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_ok(bool o);
10831
10832 /**
10833  * Creates a new CResult_boolPeerHandleErrorZ in the error state.
10834  */
10835 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_err(struct LDKPeerHandleError e);
10836
10837 /**
10838  * Frees any resources used by the CResult_boolPeerHandleErrorZ.
10839  */
10840 void CResult_boolPeerHandleErrorZ_free(struct LDKCResult_boolPeerHandleErrorZ _res);
10841
10842 /**
10843  * Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
10844  * but with all dynamically-allocated buffers duplicated in new buffers.
10845  */
10846 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_clone(const struct LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR orig);
10847
10848 /**
10849  * Creates a new CResult_DirectionalChannelInfoDecodeErrorZ in the success state.
10850  */
10851 struct LDKCResult_DirectionalChannelInfoDecodeErrorZ CResult_DirectionalChannelInfoDecodeErrorZ_ok(struct LDKDirectionalChannelInfo o);
10852
10853 /**
10854  * Creates a new CResult_DirectionalChannelInfoDecodeErrorZ in the error state.
10855  */
10856 struct LDKCResult_DirectionalChannelInfoDecodeErrorZ CResult_DirectionalChannelInfoDecodeErrorZ_err(struct LDKDecodeError e);
10857
10858 /**
10859  * Frees any resources used by the CResult_DirectionalChannelInfoDecodeErrorZ.
10860  */
10861 void CResult_DirectionalChannelInfoDecodeErrorZ_free(struct LDKCResult_DirectionalChannelInfoDecodeErrorZ _res);
10862
10863 /**
10864  * Creates a new CResult_DirectionalChannelInfoDecodeErrorZ which has the same data as `orig`
10865  * but with all dynamically-allocated buffers duplicated in new buffers.
10866  */
10867 struct LDKCResult_DirectionalChannelInfoDecodeErrorZ CResult_DirectionalChannelInfoDecodeErrorZ_clone(const struct LDKCResult_DirectionalChannelInfoDecodeErrorZ *NONNULL_PTR orig);
10868
10869 /**
10870  * Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
10871  */
10872 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_ok(struct LDKChannelInfo o);
10873
10874 /**
10875  * Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
10876  */
10877 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_err(struct LDKDecodeError e);
10878
10879 /**
10880  * Frees any resources used by the CResult_ChannelInfoDecodeErrorZ.
10881  */
10882 void CResult_ChannelInfoDecodeErrorZ_free(struct LDKCResult_ChannelInfoDecodeErrorZ _res);
10883
10884 /**
10885  * Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig`
10886  * but with all dynamically-allocated buffers duplicated in new buffers.
10887  */
10888 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_clone(const struct LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR orig);
10889
10890 /**
10891  * Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
10892  */
10893 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_ok(struct LDKRoutingFees o);
10894
10895 /**
10896  * Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
10897  */
10898 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_err(struct LDKDecodeError e);
10899
10900 /**
10901  * Frees any resources used by the CResult_RoutingFeesDecodeErrorZ.
10902  */
10903 void CResult_RoutingFeesDecodeErrorZ_free(struct LDKCResult_RoutingFeesDecodeErrorZ _res);
10904
10905 /**
10906  * Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig`
10907  * but with all dynamically-allocated buffers duplicated in new buffers.
10908  */
10909 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_clone(const struct LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR orig);
10910
10911 /**
10912  * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
10913  */
10914 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_ok(struct LDKNodeAnnouncementInfo o);
10915
10916 /**
10917  * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
10918  */
10919 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_err(struct LDKDecodeError e);
10920
10921 /**
10922  * Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
10923  */
10924 void CResult_NodeAnnouncementInfoDecodeErrorZ_free(struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res);
10925
10926 /**
10927  * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
10928  * but with all dynamically-allocated buffers duplicated in new buffers.
10929  */
10930 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_clone(const struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR orig);
10931
10932 /**
10933  * Frees the buffer pointed to by `data` if `datalen` is non-0.
10934  */
10935 void CVec_u64Z_free(struct LDKCVec_u64Z _res);
10936
10937 /**
10938  * Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
10939  */
10940 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_ok(struct LDKNodeInfo o);
10941
10942 /**
10943  * Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
10944  */
10945 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_err(struct LDKDecodeError e);
10946
10947 /**
10948  * Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
10949  */
10950 void CResult_NodeInfoDecodeErrorZ_free(struct LDKCResult_NodeInfoDecodeErrorZ _res);
10951
10952 /**
10953  * Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
10954  * but with all dynamically-allocated buffers duplicated in new buffers.
10955  */
10956 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_clone(const struct LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR orig);
10957
10958 /**
10959  * Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
10960  */
10961 struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_ok(struct LDKNetworkGraph o);
10962
10963 /**
10964  * Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
10965  */
10966 struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_err(struct LDKDecodeError e);
10967
10968 /**
10969  * Frees any resources used by the CResult_NetworkGraphDecodeErrorZ.
10970  */
10971 void CResult_NetworkGraphDecodeErrorZ_free(struct LDKCResult_NetworkGraphDecodeErrorZ _res);
10972
10973 /**
10974  * Creates a new CResult_NetworkGraphDecodeErrorZ which has the same data as `orig`
10975  * but with all dynamically-allocated buffers duplicated in new buffers.
10976  */
10977 struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_clone(const struct LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR orig);
10978
10979 /**
10980  * Creates a new CResult_NetAddressu8Z in the success state.
10981  */
10982 struct LDKCResult_NetAddressu8Z CResult_NetAddressu8Z_ok(struct LDKNetAddress o);
10983
10984 /**
10985  * Creates a new CResult_NetAddressu8Z in the error state.
10986  */
10987 struct LDKCResult_NetAddressu8Z CResult_NetAddressu8Z_err(uint8_t e);
10988
10989 /**
10990  * Frees any resources used by the CResult_NetAddressu8Z.
10991  */
10992 void CResult_NetAddressu8Z_free(struct LDKCResult_NetAddressu8Z _res);
10993
10994 /**
10995  * Creates a new CResult_NetAddressu8Z which has the same data as `orig`
10996  * but with all dynamically-allocated buffers duplicated in new buffers.
10997  */
10998 struct LDKCResult_NetAddressu8Z CResult_NetAddressu8Z_clone(const struct LDKCResult_NetAddressu8Z *NONNULL_PTR orig);
10999
11000 /**
11001  * Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ in the success state.
11002  */
11003 struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(struct LDKCResult_NetAddressu8Z o);
11004
11005 /**
11006  * Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ in the error state.
11007  */
11008 struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ CResult_CResult_NetAddressu8ZDecodeErrorZ_err(struct LDKDecodeError e);
11009
11010 /**
11011  * Frees any resources used by the CResult_CResult_NetAddressu8ZDecodeErrorZ.
11012  */
11013 void CResult_CResult_NetAddressu8ZDecodeErrorZ_free(struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ _res);
11014
11015 /**
11016  * Creates a new CResult_CResult_NetAddressu8ZDecodeErrorZ which has the same data as `orig`
11017  * but with all dynamically-allocated buffers duplicated in new buffers.
11018  */
11019 struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ CResult_CResult_NetAddressu8ZDecodeErrorZ_clone(const struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *NONNULL_PTR orig);
11020
11021 /**
11022  * Creates a new CResult_NetAddressDecodeErrorZ in the success state.
11023  */
11024 struct LDKCResult_NetAddressDecodeErrorZ CResult_NetAddressDecodeErrorZ_ok(struct LDKNetAddress o);
11025
11026 /**
11027  * Creates a new CResult_NetAddressDecodeErrorZ in the error state.
11028  */
11029 struct LDKCResult_NetAddressDecodeErrorZ CResult_NetAddressDecodeErrorZ_err(struct LDKDecodeError e);
11030
11031 /**
11032  * Frees any resources used by the CResult_NetAddressDecodeErrorZ.
11033  */
11034 void CResult_NetAddressDecodeErrorZ_free(struct LDKCResult_NetAddressDecodeErrorZ _res);
11035
11036 /**
11037  * Creates a new CResult_NetAddressDecodeErrorZ which has the same data as `orig`
11038  * but with all dynamically-allocated buffers duplicated in new buffers.
11039  */
11040 struct LDKCResult_NetAddressDecodeErrorZ CResult_NetAddressDecodeErrorZ_clone(const struct LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR orig);
11041
11042 /**
11043  * Frees the buffer pointed to by `data` if `datalen` is non-0.
11044  */
11045 void CVec_UpdateAddHTLCZ_free(struct LDKCVec_UpdateAddHTLCZ _res);
11046
11047 /**
11048  * Frees the buffer pointed to by `data` if `datalen` is non-0.
11049  */
11050 void CVec_UpdateFulfillHTLCZ_free(struct LDKCVec_UpdateFulfillHTLCZ _res);
11051
11052 /**
11053  * Frees the buffer pointed to by `data` if `datalen` is non-0.
11054  */
11055 void CVec_UpdateFailHTLCZ_free(struct LDKCVec_UpdateFailHTLCZ _res);
11056
11057 /**
11058  * Frees the buffer pointed to by `data` if `datalen` is non-0.
11059  */
11060 void CVec_UpdateFailMalformedHTLCZ_free(struct LDKCVec_UpdateFailMalformedHTLCZ _res);
11061
11062 /**
11063  * Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
11064  */
11065 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_ok(struct LDKAcceptChannel o);
11066
11067 /**
11068  * Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
11069  */
11070 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_err(struct LDKDecodeError e);
11071
11072 /**
11073  * Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
11074  */
11075 void CResult_AcceptChannelDecodeErrorZ_free(struct LDKCResult_AcceptChannelDecodeErrorZ _res);
11076
11077 /**
11078  * Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
11079  * but with all dynamically-allocated buffers duplicated in new buffers.
11080  */
11081 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_clone(const struct LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR orig);
11082
11083 /**
11084  * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
11085  */
11086 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_ok(struct LDKAnnouncementSignatures o);
11087
11088 /**
11089  * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
11090  */
11091 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_err(struct LDKDecodeError e);
11092
11093 /**
11094  * Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
11095  */
11096 void CResult_AnnouncementSignaturesDecodeErrorZ_free(struct LDKCResult_AnnouncementSignaturesDecodeErrorZ _res);
11097
11098 /**
11099  * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
11100  * but with all dynamically-allocated buffers duplicated in new buffers.
11101  */
11102 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_clone(const struct LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR orig);
11103
11104 /**
11105  * Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
11106  */
11107 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_ok(struct LDKChannelReestablish o);
11108
11109 /**
11110  * Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
11111  */
11112 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_err(struct LDKDecodeError e);
11113
11114 /**
11115  * Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
11116  */
11117 void CResult_ChannelReestablishDecodeErrorZ_free(struct LDKCResult_ChannelReestablishDecodeErrorZ _res);
11118
11119 /**
11120  * Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig`
11121  * but with all dynamically-allocated buffers duplicated in new buffers.
11122  */
11123 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_clone(const struct LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR orig);
11124
11125 /**
11126  * Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
11127  */
11128 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_ok(struct LDKClosingSigned o);
11129
11130 /**
11131  * Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
11132  */
11133 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_err(struct LDKDecodeError e);
11134
11135 /**
11136  * Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
11137  */
11138 void CResult_ClosingSignedDecodeErrorZ_free(struct LDKCResult_ClosingSignedDecodeErrorZ _res);
11139
11140 /**
11141  * Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig`
11142  * but with all dynamically-allocated buffers duplicated in new buffers.
11143  */
11144 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_clone(const struct LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR orig);
11145
11146 /**
11147  * Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
11148  */
11149 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_ok(struct LDKCommitmentSigned o);
11150
11151 /**
11152  * Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
11153  */
11154 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_err(struct LDKDecodeError e);
11155
11156 /**
11157  * Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
11158  */
11159 void CResult_CommitmentSignedDecodeErrorZ_free(struct LDKCResult_CommitmentSignedDecodeErrorZ _res);
11160
11161 /**
11162  * Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig`
11163  * but with all dynamically-allocated buffers duplicated in new buffers.
11164  */
11165 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_clone(const struct LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR orig);
11166
11167 /**
11168  * Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
11169  */
11170 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_ok(struct LDKFundingCreated o);
11171
11172 /**
11173  * Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
11174  */
11175 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_err(struct LDKDecodeError e);
11176
11177 /**
11178  * Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
11179  */
11180 void CResult_FundingCreatedDecodeErrorZ_free(struct LDKCResult_FundingCreatedDecodeErrorZ _res);
11181
11182 /**
11183  * Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig`
11184  * but with all dynamically-allocated buffers duplicated in new buffers.
11185  */
11186 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_clone(const struct LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR orig);
11187
11188 /**
11189  * Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
11190  */
11191 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_ok(struct LDKFundingSigned o);
11192
11193 /**
11194  * Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
11195  */
11196 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_err(struct LDKDecodeError e);
11197
11198 /**
11199  * Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
11200  */
11201 void CResult_FundingSignedDecodeErrorZ_free(struct LDKCResult_FundingSignedDecodeErrorZ _res);
11202
11203 /**
11204  * Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
11205  * but with all dynamically-allocated buffers duplicated in new buffers.
11206  */
11207 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_clone(const struct LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR orig);
11208
11209 /**
11210  * Creates a new CResult_FundingLockedDecodeErrorZ in the success state.
11211  */
11212 struct LDKCResult_FundingLockedDecodeErrorZ CResult_FundingLockedDecodeErrorZ_ok(struct LDKFundingLocked o);
11213
11214 /**
11215  * Creates a new CResult_FundingLockedDecodeErrorZ in the error state.
11216  */
11217 struct LDKCResult_FundingLockedDecodeErrorZ CResult_FundingLockedDecodeErrorZ_err(struct LDKDecodeError e);
11218
11219 /**
11220  * Frees any resources used by the CResult_FundingLockedDecodeErrorZ.
11221  */
11222 void CResult_FundingLockedDecodeErrorZ_free(struct LDKCResult_FundingLockedDecodeErrorZ _res);
11223
11224 /**
11225  * Creates a new CResult_FundingLockedDecodeErrorZ which has the same data as `orig`
11226  * but with all dynamically-allocated buffers duplicated in new buffers.
11227  */
11228 struct LDKCResult_FundingLockedDecodeErrorZ CResult_FundingLockedDecodeErrorZ_clone(const struct LDKCResult_FundingLockedDecodeErrorZ *NONNULL_PTR orig);
11229
11230 /**
11231  * Creates a new CResult_InitDecodeErrorZ in the success state.
11232  */
11233 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_ok(struct LDKInit o);
11234
11235 /**
11236  * Creates a new CResult_InitDecodeErrorZ in the error state.
11237  */
11238 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_err(struct LDKDecodeError e);
11239
11240 /**
11241  * Frees any resources used by the CResult_InitDecodeErrorZ.
11242  */
11243 void CResult_InitDecodeErrorZ_free(struct LDKCResult_InitDecodeErrorZ _res);
11244
11245 /**
11246  * Creates a new CResult_InitDecodeErrorZ which has the same data as `orig`
11247  * but with all dynamically-allocated buffers duplicated in new buffers.
11248  */
11249 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_clone(const struct LDKCResult_InitDecodeErrorZ *NONNULL_PTR orig);
11250
11251 /**
11252  * Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
11253  */
11254 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_ok(struct LDKOpenChannel o);
11255
11256 /**
11257  * Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
11258  */
11259 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_err(struct LDKDecodeError e);
11260
11261 /**
11262  * Frees any resources used by the CResult_OpenChannelDecodeErrorZ.
11263  */
11264 void CResult_OpenChannelDecodeErrorZ_free(struct LDKCResult_OpenChannelDecodeErrorZ _res);
11265
11266 /**
11267  * Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig`
11268  * but with all dynamically-allocated buffers duplicated in new buffers.
11269  */
11270 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_clone(const struct LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR orig);
11271
11272 /**
11273  * Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
11274  */
11275 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_ok(struct LDKRevokeAndACK o);
11276
11277 /**
11278  * Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
11279  */
11280 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_err(struct LDKDecodeError e);
11281
11282 /**
11283  * Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ.
11284  */
11285 void CResult_RevokeAndACKDecodeErrorZ_free(struct LDKCResult_RevokeAndACKDecodeErrorZ _res);
11286
11287 /**
11288  * Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig`
11289  * but with all dynamically-allocated buffers duplicated in new buffers.
11290  */
11291 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_clone(const struct LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR orig);
11292
11293 /**
11294  * Creates a new CResult_ShutdownDecodeErrorZ in the success state.
11295  */
11296 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_ok(struct LDKShutdown o);
11297
11298 /**
11299  * Creates a new CResult_ShutdownDecodeErrorZ in the error state.
11300  */
11301 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_err(struct LDKDecodeError e);
11302
11303 /**
11304  * Frees any resources used by the CResult_ShutdownDecodeErrorZ.
11305  */
11306 void CResult_ShutdownDecodeErrorZ_free(struct LDKCResult_ShutdownDecodeErrorZ _res);
11307
11308 /**
11309  * Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig`
11310  * but with all dynamically-allocated buffers duplicated in new buffers.
11311  */
11312 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_clone(const struct LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR orig);
11313
11314 /**
11315  * Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
11316  */
11317 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_ok(struct LDKUpdateFailHTLC o);
11318
11319 /**
11320  * Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
11321  */
11322 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_err(struct LDKDecodeError e);
11323
11324 /**
11325  * Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ.
11326  */
11327 void CResult_UpdateFailHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFailHTLCDecodeErrorZ _res);
11328
11329 /**
11330  * Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
11331  * but with all dynamically-allocated buffers duplicated in new buffers.
11332  */
11333 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR orig);
11334
11335 /**
11336  * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
11337  */
11338 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(struct LDKUpdateFailMalformedHTLC o);
11339
11340 /**
11341  * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
11342  */
11343 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(struct LDKDecodeError e);
11344
11345 /**
11346  * Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ.
11347  */
11348 void CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res);
11349
11350 /**
11351  * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
11352  * but with all dynamically-allocated buffers duplicated in new buffers.
11353  */
11354 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR orig);
11355
11356 /**
11357  * Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
11358  */
11359 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_ok(struct LDKUpdateFee o);
11360
11361 /**
11362  * Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
11363  */
11364 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_err(struct LDKDecodeError e);
11365
11366 /**
11367  * Frees any resources used by the CResult_UpdateFeeDecodeErrorZ.
11368  */
11369 void CResult_UpdateFeeDecodeErrorZ_free(struct LDKCResult_UpdateFeeDecodeErrorZ _res);
11370
11371 /**
11372  * Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig`
11373  * but with all dynamically-allocated buffers duplicated in new buffers.
11374  */
11375 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_clone(const struct LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR orig);
11376
11377 /**
11378  * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
11379  */
11380 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_ok(struct LDKUpdateFulfillHTLC o);
11381
11382 /**
11383  * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
11384  */
11385 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_err(struct LDKDecodeError e);
11386
11387 /**
11388  * Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ.
11389  */
11390 void CResult_UpdateFulfillHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res);
11391
11392 /**
11393  * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
11394  * but with all dynamically-allocated buffers duplicated in new buffers.
11395  */
11396 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR orig);
11397
11398 /**
11399  * Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
11400  */
11401 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_ok(struct LDKUpdateAddHTLC o);
11402
11403 /**
11404  * Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
11405  */
11406 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_err(struct LDKDecodeError e);
11407
11408 /**
11409  * Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ.
11410  */
11411 void CResult_UpdateAddHTLCDecodeErrorZ_free(struct LDKCResult_UpdateAddHTLCDecodeErrorZ _res);
11412
11413 /**
11414  * Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
11415  * but with all dynamically-allocated buffers duplicated in new buffers.
11416  */
11417 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR orig);
11418
11419 /**
11420  * Creates a new CResult_PingDecodeErrorZ in the success state.
11421  */
11422 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_ok(struct LDKPing o);
11423
11424 /**
11425  * Creates a new CResult_PingDecodeErrorZ in the error state.
11426  */
11427 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_err(struct LDKDecodeError e);
11428
11429 /**
11430  * Frees any resources used by the CResult_PingDecodeErrorZ.
11431  */
11432 void CResult_PingDecodeErrorZ_free(struct LDKCResult_PingDecodeErrorZ _res);
11433
11434 /**
11435  * Creates a new CResult_PingDecodeErrorZ which has the same data as `orig`
11436  * but with all dynamically-allocated buffers duplicated in new buffers.
11437  */
11438 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_clone(const struct LDKCResult_PingDecodeErrorZ *NONNULL_PTR orig);
11439
11440 /**
11441  * Creates a new CResult_PongDecodeErrorZ in the success state.
11442  */
11443 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_ok(struct LDKPong o);
11444
11445 /**
11446  * Creates a new CResult_PongDecodeErrorZ in the error state.
11447  */
11448 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_err(struct LDKDecodeError e);
11449
11450 /**
11451  * Frees any resources used by the CResult_PongDecodeErrorZ.
11452  */
11453 void CResult_PongDecodeErrorZ_free(struct LDKCResult_PongDecodeErrorZ _res);
11454
11455 /**
11456  * Creates a new CResult_PongDecodeErrorZ which has the same data as `orig`
11457  * but with all dynamically-allocated buffers duplicated in new buffers.
11458  */
11459 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_clone(const struct LDKCResult_PongDecodeErrorZ *NONNULL_PTR orig);
11460
11461 /**
11462  * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
11463  */
11464 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(struct LDKUnsignedChannelAnnouncement o);
11465
11466 /**
11467  * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
11468  */
11469 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
11470
11471 /**
11472  * Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
11473  */
11474 void CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res);
11475
11476 /**
11477  * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
11478  * but with all dynamically-allocated buffers duplicated in new buffers.
11479  */
11480 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(const struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR orig);
11481
11482 /**
11483  * Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
11484  */
11485 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_ok(struct LDKChannelAnnouncement o);
11486
11487 /**
11488  * Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
11489  */
11490 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
11491
11492 /**
11493  * Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
11494  */
11495 void CResult_ChannelAnnouncementDecodeErrorZ_free(struct LDKCResult_ChannelAnnouncementDecodeErrorZ _res);
11496
11497 /**
11498  * Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
11499  * but with all dynamically-allocated buffers duplicated in new buffers.
11500  */
11501 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_clone(const struct LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR orig);
11502
11503 /**
11504  * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
11505  */
11506 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_ok(struct LDKUnsignedChannelUpdate o);
11507
11508 /**
11509  * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
11510  */
11511 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_err(struct LDKDecodeError e);
11512
11513 /**
11514  * Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
11515  */
11516 void CResult_UnsignedChannelUpdateDecodeErrorZ_free(struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res);
11517
11518 /**
11519  * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
11520  * but with all dynamically-allocated buffers duplicated in new buffers.
11521  */
11522 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_clone(const struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR orig);
11523
11524 /**
11525  * Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
11526  */
11527 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_ok(struct LDKChannelUpdate o);
11528
11529 /**
11530  * Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
11531  */
11532 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_err(struct LDKDecodeError e);
11533
11534 /**
11535  * Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
11536  */
11537 void CResult_ChannelUpdateDecodeErrorZ_free(struct LDKCResult_ChannelUpdateDecodeErrorZ _res);
11538
11539 /**
11540  * Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
11541  * but with all dynamically-allocated buffers duplicated in new buffers.
11542  */
11543 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_clone(const struct LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR orig);
11544
11545 /**
11546  * Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
11547  */
11548 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_ok(struct LDKErrorMessage o);
11549
11550 /**
11551  * Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
11552  */
11553 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_err(struct LDKDecodeError e);
11554
11555 /**
11556  * Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
11557  */
11558 void CResult_ErrorMessageDecodeErrorZ_free(struct LDKCResult_ErrorMessageDecodeErrorZ _res);
11559
11560 /**
11561  * Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
11562  * but with all dynamically-allocated buffers duplicated in new buffers.
11563  */
11564 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_clone(const struct LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR orig);
11565
11566 /**
11567  * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
11568  */
11569 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(struct LDKUnsignedNodeAnnouncement o);
11570
11571 /**
11572  * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
11573  */
11574 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
11575
11576 /**
11577  * Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
11578  */
11579 void CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res);
11580
11581 /**
11582  * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
11583  * but with all dynamically-allocated buffers duplicated in new buffers.
11584  */
11585 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(const struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR orig);
11586
11587 /**
11588  * Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
11589  */
11590 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_ok(struct LDKNodeAnnouncement o);
11591
11592 /**
11593  * Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
11594  */
11595 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
11596
11597 /**
11598  * Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
11599  */
11600 void CResult_NodeAnnouncementDecodeErrorZ_free(struct LDKCResult_NodeAnnouncementDecodeErrorZ _res);
11601
11602 /**
11603  * Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
11604  * but with all dynamically-allocated buffers duplicated in new buffers.
11605  */
11606 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_clone(const struct LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR orig);
11607
11608 /**
11609  * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
11610  */
11611 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_ok(struct LDKQueryShortChannelIds o);
11612
11613 /**
11614  * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
11615  */
11616 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_err(struct LDKDecodeError e);
11617
11618 /**
11619  * Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
11620  */
11621 void CResult_QueryShortChannelIdsDecodeErrorZ_free(struct LDKCResult_QueryShortChannelIdsDecodeErrorZ _res);
11622
11623 /**
11624  * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
11625  * but with all dynamically-allocated buffers duplicated in new buffers.
11626  */
11627 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_clone(const struct LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR orig);
11628
11629 /**
11630  * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
11631  */
11632 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(struct LDKReplyShortChannelIdsEnd o);
11633
11634 /**
11635  * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
11636  */
11637 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(struct LDKDecodeError e);
11638
11639 /**
11640  * Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
11641  */
11642 void CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res);
11643
11644 /**
11645  * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
11646  * but with all dynamically-allocated buffers duplicated in new buffers.
11647  */
11648 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(const struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR orig);
11649
11650 /**
11651  * Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
11652  */
11653 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_ok(struct LDKQueryChannelRange o);
11654
11655 /**
11656  * Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
11657  */
11658 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_err(struct LDKDecodeError e);
11659
11660 /**
11661  * Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
11662  */
11663 void CResult_QueryChannelRangeDecodeErrorZ_free(struct LDKCResult_QueryChannelRangeDecodeErrorZ _res);
11664
11665 /**
11666  * Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
11667  * but with all dynamically-allocated buffers duplicated in new buffers.
11668  */
11669 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_clone(const struct LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR orig);
11670
11671 /**
11672  * Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
11673  */
11674 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_ok(struct LDKReplyChannelRange o);
11675
11676 /**
11677  * Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
11678  */
11679 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_err(struct LDKDecodeError e);
11680
11681 /**
11682  * Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
11683  */
11684 void CResult_ReplyChannelRangeDecodeErrorZ_free(struct LDKCResult_ReplyChannelRangeDecodeErrorZ _res);
11685
11686 /**
11687  * Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
11688  * but with all dynamically-allocated buffers duplicated in new buffers.
11689  */
11690 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_clone(const struct LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR orig);
11691
11692 /**
11693  * Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
11694  */
11695 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_ok(struct LDKGossipTimestampFilter o);
11696
11697 /**
11698  * Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
11699  */
11700 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_err(struct LDKDecodeError e);
11701
11702 /**
11703  * Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
11704  */
11705 void CResult_GossipTimestampFilterDecodeErrorZ_free(struct LDKCResult_GossipTimestampFilterDecodeErrorZ _res);
11706
11707 /**
11708  * Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
11709  * but with all dynamically-allocated buffers duplicated in new buffers.
11710  */
11711 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_clone(const struct LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR orig);
11712
11713 /**
11714  * Creates a new CResult_InvoiceSignOrCreationErrorZ in the success state.
11715  */
11716 struct LDKCResult_InvoiceSignOrCreationErrorZ CResult_InvoiceSignOrCreationErrorZ_ok(struct LDKInvoice o);
11717
11718 /**
11719  * Creates a new CResult_InvoiceSignOrCreationErrorZ in the error state.
11720  */
11721 struct LDKCResult_InvoiceSignOrCreationErrorZ CResult_InvoiceSignOrCreationErrorZ_err(struct LDKSignOrCreationError e);
11722
11723 /**
11724  * Frees any resources used by the CResult_InvoiceSignOrCreationErrorZ.
11725  */
11726 void CResult_InvoiceSignOrCreationErrorZ_free(struct LDKCResult_InvoiceSignOrCreationErrorZ _res);
11727
11728 /**
11729  * Creates a new CResult_InvoiceSignOrCreationErrorZ which has the same data as `orig`
11730  * but with all dynamically-allocated buffers duplicated in new buffers.
11731  */
11732 struct LDKCResult_InvoiceSignOrCreationErrorZ CResult_InvoiceSignOrCreationErrorZ_clone(const struct LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR orig);
11733
11734 /**
11735  * Frees any resources used by the PaymentPurpose
11736  */
11737 void PaymentPurpose_free(struct LDKPaymentPurpose this_ptr);
11738
11739 /**
11740  * Creates a copy of the PaymentPurpose
11741  */
11742 struct LDKPaymentPurpose PaymentPurpose_clone(const struct LDKPaymentPurpose *NONNULL_PTR orig);
11743
11744 /**
11745  * Frees any resources used by the Event
11746  */
11747 void Event_free(struct LDKEvent this_ptr);
11748
11749 /**
11750  * Creates a copy of the Event
11751  */
11752 struct LDKEvent Event_clone(const struct LDKEvent *NONNULL_PTR orig);
11753
11754 /**
11755  * Serialize the Event object into a byte array which can be read by Event_read
11756  */
11757 struct LDKCVec_u8Z Event_write(const struct LDKEvent *NONNULL_PTR obj);
11758
11759 /**
11760  * Frees any resources used by the MessageSendEvent
11761  */
11762 void MessageSendEvent_free(struct LDKMessageSendEvent this_ptr);
11763
11764 /**
11765  * Creates a copy of the MessageSendEvent
11766  */
11767 struct LDKMessageSendEvent MessageSendEvent_clone(const struct LDKMessageSendEvent *NONNULL_PTR orig);
11768
11769 /**
11770  * Calls the free function if one is set
11771  */
11772 void MessageSendEventsProvider_free(struct LDKMessageSendEventsProvider this_ptr);
11773
11774 /**
11775  * Calls the free function if one is set
11776  */
11777 void EventsProvider_free(struct LDKEventsProvider this_ptr);
11778
11779 /**
11780  * Calls the free function if one is set
11781  */
11782 void EventHandler_free(struct LDKEventHandler this_ptr);
11783
11784 /**
11785  * Frees any resources used by the APIError
11786  */
11787 void APIError_free(struct LDKAPIError this_ptr);
11788
11789 /**
11790  * Creates a copy of the APIError
11791  */
11792 struct LDKAPIError APIError_clone(const struct LDKAPIError *NONNULL_PTR orig);
11793
11794 /**
11795  * Creates a digital signature of a message given a SecretKey, like the node's secret.
11796  * 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.
11797  * Signatures are EC recoverable, meaning that given the message and the signature the PublicKey of the signer can be extracted.
11798  */
11799 struct LDKCResult_StringErrorZ sign(struct LDKu8slice msg, const uint8_t (*sk)[32]);
11800
11801 /**
11802  * Recovers the PublicKey of the signer of the message given the message and the signature.
11803  */
11804 struct LDKCResult_PublicKeyErrorZ recover_pk(struct LDKu8slice msg, struct LDKStr sig);
11805
11806 /**
11807  * Verifies a message was signed by a PrivateKey that derives to a given PublicKey, given a message, a signature,
11808  * and the PublicKey.
11809  */
11810 bool verify(struct LDKu8slice msg, struct LDKStr sig, struct LDKPublicKey pk);
11811
11812 /**
11813  * Creates a copy of the Level
11814  */
11815 enum LDKLevel Level_clone(const enum LDKLevel *NONNULL_PTR orig);
11816
11817 /**
11818  * Checks if two Levels contain equal inner contents.
11819  * This ignores pointers and is_owned flags and looks at the values in fields.
11820  */
11821 bool Level_eq(const enum LDKLevel *NONNULL_PTR a, const enum LDKLevel *NONNULL_PTR b);
11822
11823 /**
11824  * Checks if two Levels contain equal inner contents.
11825  */
11826 uint64_t Level_hash(const enum LDKLevel *NONNULL_PTR o);
11827
11828 /**
11829  * Returns the most verbose logging level.
11830  */
11831 MUST_USE_RES enum LDKLevel Level_max(void);
11832
11833 /**
11834  * Calls the free function if one is set
11835  */
11836 void Logger_free(struct LDKLogger this_ptr);
11837
11838 /**
11839  * Frees any resources used by the ChannelHandshakeConfig, if is_owned is set and inner is non-NULL.
11840  */
11841 void ChannelHandshakeConfig_free(struct LDKChannelHandshakeConfig this_obj);
11842
11843 /**
11844  * Confirmations we will wait for before considering the channel locked in.
11845  * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
11846  * equivalent limit applied to outbound channels).
11847  *
11848  * Default value: 6.
11849  */
11850 uint32_t ChannelHandshakeConfig_get_minimum_depth(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
11851
11852 /**
11853  * Confirmations we will wait for before considering the channel locked in.
11854  * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
11855  * equivalent limit applied to outbound channels).
11856  *
11857  * Default value: 6.
11858  */
11859 void ChannelHandshakeConfig_set_minimum_depth(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint32_t val);
11860
11861 /**
11862  * Set to the number of blocks we require our counterparty to wait to claim their money (ie
11863  * the number of blocks we have to punish our counterparty if they broadcast a revoked
11864  * transaction).
11865  *
11866  * This is one of the main parameters of our security model. We (or one of our watchtowers) MUST
11867  * be online to check for revoked transactions on-chain at least once every our_to_self_delay
11868  * blocks (minus some margin to allow us enough time to broadcast and confirm a transaction,
11869  * possibly with time in between to RBF the spending transaction).
11870  *
11871  * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in
11872  * case of an honest unilateral channel close, which implicitly decrease the economic value of
11873  * our channel.
11874  *
11875  * Default value: [`BREAKDOWN_TIMEOUT`], we enforce it as a minimum at channel opening so you
11876  * can tweak config to ask for more security, not less.
11877  */
11878 uint16_t ChannelHandshakeConfig_get_our_to_self_delay(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
11879
11880 /**
11881  * Set to the number of blocks we require our counterparty to wait to claim their money (ie
11882  * the number of blocks we have to punish our counterparty if they broadcast a revoked
11883  * transaction).
11884  *
11885  * This is one of the main parameters of our security model. We (or one of our watchtowers) MUST
11886  * be online to check for revoked transactions on-chain at least once every our_to_self_delay
11887  * blocks (minus some margin to allow us enough time to broadcast and confirm a transaction,
11888  * possibly with time in between to RBF the spending transaction).
11889  *
11890  * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in
11891  * case of an honest unilateral channel close, which implicitly decrease the economic value of
11892  * our channel.
11893  *
11894  * Default value: [`BREAKDOWN_TIMEOUT`], we enforce it as a minimum at channel opening so you
11895  * can tweak config to ask for more security, not less.
11896  */
11897 void ChannelHandshakeConfig_set_our_to_self_delay(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint16_t val);
11898
11899 /**
11900  * Set to the smallest value HTLC we will accept to process.
11901  *
11902  * This value is sent to our counterparty on channel-open and we close the channel any time
11903  * our counterparty misbehaves by sending us an HTLC with a value smaller than this.
11904  *
11905  * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required
11906  * by the protocol.
11907  */
11908 uint64_t ChannelHandshakeConfig_get_our_htlc_minimum_msat(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
11909
11910 /**
11911  * Set to the smallest value HTLC we will accept to process.
11912  *
11913  * This value is sent to our counterparty on channel-open and we close the channel any time
11914  * our counterparty misbehaves by sending us an HTLC with a value smaller than this.
11915  *
11916  * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required
11917  * by the protocol.
11918  */
11919 void ChannelHandshakeConfig_set_our_htlc_minimum_msat(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint64_t val);
11920
11921 /**
11922  * Constructs a new ChannelHandshakeConfig given each field
11923  */
11924 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);
11925
11926 /**
11927  * Creates a copy of the ChannelHandshakeConfig
11928  */
11929 struct LDKChannelHandshakeConfig ChannelHandshakeConfig_clone(const struct LDKChannelHandshakeConfig *NONNULL_PTR orig);
11930
11931 /**
11932  * Creates a "default" ChannelHandshakeConfig. See struct and individual field documentaiton for details on which values are used.
11933  */
11934 MUST_USE_RES struct LDKChannelHandshakeConfig ChannelHandshakeConfig_default(void);
11935
11936 /**
11937  * Frees any resources used by the ChannelHandshakeLimits, if is_owned is set and inner is non-NULL.
11938  */
11939 void ChannelHandshakeLimits_free(struct LDKChannelHandshakeLimits this_obj);
11940
11941 /**
11942  * Minimum allowed satoshis when a channel is funded, this is supplied by the sender and so
11943  * only applies to inbound channels.
11944  *
11945  * Default value: 0.
11946  */
11947 uint64_t ChannelHandshakeLimits_get_min_funding_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
11948
11949 /**
11950  * Minimum allowed satoshis when a channel is funded, this is supplied by the sender and so
11951  * only applies to inbound channels.
11952  *
11953  * Default value: 0.
11954  */
11955 void ChannelHandshakeLimits_set_min_funding_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
11956
11957 /**
11958  * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows
11959  * you to limit the maximum minimum-size they can require.
11960  *
11961  * Default value: u64::max_value.
11962  */
11963 uint64_t ChannelHandshakeLimits_get_max_htlc_minimum_msat(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
11964
11965 /**
11966  * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows
11967  * you to limit the maximum minimum-size they can require.
11968  *
11969  * Default value: u64::max_value.
11970  */
11971 void ChannelHandshakeLimits_set_max_htlc_minimum_msat(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
11972
11973 /**
11974  * The remote node sets a limit on the maximum value of pending HTLCs to them at any given
11975  * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value.
11976  *
11977  * Default value: 0.
11978  */
11979 uint64_t ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
11980
11981 /**
11982  * The remote node sets a limit on the maximum value of pending HTLCs to them at any given
11983  * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value.
11984  *
11985  * Default value: 0.
11986  */
11987 void ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
11988
11989 /**
11990  * The remote node will require we keep a certain amount in direct payment to ourselves at all
11991  * time, ensuring that we are able to be punished if we broadcast an old state. This allows to
11992  * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs).
11993  *
11994  * Default value: u64::max_value.
11995  */
11996 uint64_t ChannelHandshakeLimits_get_max_channel_reserve_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
11997
11998 /**
11999  * The remote node will require we keep a certain amount in direct payment to ourselves at all
12000  * time, ensuring that we are able to be punished if we broadcast an old state. This allows to
12001  * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs).
12002  *
12003  * Default value: u64::max_value.
12004  */
12005 void ChannelHandshakeLimits_set_max_channel_reserve_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
12006
12007 /**
12008  * The remote node sets a limit on the maximum number of pending HTLCs to them at any given
12009  * time. This allows you to set a minimum such value.
12010  *
12011  * Default value: 0.
12012  */
12013 uint16_t ChannelHandshakeLimits_get_min_max_accepted_htlcs(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
12014
12015 /**
12016  * The remote node sets a limit on the maximum number of pending HTLCs to them at any given
12017  * time. This allows you to set a minimum such value.
12018  *
12019  * Default value: 0.
12020  */
12021 void ChannelHandshakeLimits_set_min_max_accepted_htlcs(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint16_t val);
12022
12023 /**
12024  * Before a channel is usable the funding transaction will need to be confirmed by at least a
12025  * certain number of blocks, specified by the node which is not the funder (as the funder can
12026  * assume they aren't going to double-spend themselves).
12027  * This config allows you to set a limit on the maximum amount of time to wait.
12028  *
12029  * Default value: 144, or roughly one day and only applies to outbound channels.
12030  */
12031 uint32_t ChannelHandshakeLimits_get_max_minimum_depth(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
12032
12033 /**
12034  * Before a channel is usable the funding transaction will need to be confirmed by at least a
12035  * certain number of blocks, specified by the node which is not the funder (as the funder can
12036  * assume they aren't going to double-spend themselves).
12037  * This config allows you to set a limit on the maximum amount of time to wait.
12038  *
12039  * Default value: 144, or roughly one day and only applies to outbound channels.
12040  */
12041 void ChannelHandshakeLimits_set_max_minimum_depth(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint32_t val);
12042
12043 /**
12044  * Set to force an incoming channel to match our announced channel preference in
12045  * [`ChannelConfig::announced_channel`].
12046  *
12047  * For a node which is not online reliably, this should be set to true and
12048  * [`ChannelConfig::announced_channel`] set to false, ensuring that no announced (aka public)
12049  * channels will ever be opened.
12050  *
12051  * Default value: true.
12052  */
12053 bool ChannelHandshakeLimits_get_force_announced_channel_preference(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
12054
12055 /**
12056  * Set to force an incoming channel to match our announced channel preference in
12057  * [`ChannelConfig::announced_channel`].
12058  *
12059  * For a node which is not online reliably, this should be set to true and
12060  * [`ChannelConfig::announced_channel`] set to false, ensuring that no announced (aka public)
12061  * channels will ever be opened.
12062  *
12063  * Default value: true.
12064  */
12065 void ChannelHandshakeLimits_set_force_announced_channel_preference(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, bool val);
12066
12067 /**
12068  * Set to the amount of time we're willing to wait to claim money back to us.
12069  *
12070  * Not checking this value would be a security issue, as our peer would be able to set it to
12071  * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time.
12072  *
12073  * Default value: 2016, which we also enforce as a maximum value so you can tweak config to
12074  * reduce the loss of having useless locked funds (if your peer accepts)
12075  */
12076 uint16_t ChannelHandshakeLimits_get_their_to_self_delay(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
12077
12078 /**
12079  * Set to the amount of time we're willing to wait to claim money back to us.
12080  *
12081  * Not checking this value would be a security issue, as our peer would be able to set it to
12082  * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time.
12083  *
12084  * Default value: 2016, which we also enforce as a maximum value so you can tweak config to
12085  * reduce the loss of having useless locked funds (if your peer accepts)
12086  */
12087 void ChannelHandshakeLimits_set_their_to_self_delay(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint16_t val);
12088
12089 /**
12090  * Constructs a new ChannelHandshakeLimits given each field
12091  */
12092 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);
12093
12094 /**
12095  * Creates a copy of the ChannelHandshakeLimits
12096  */
12097 struct LDKChannelHandshakeLimits ChannelHandshakeLimits_clone(const struct LDKChannelHandshakeLimits *NONNULL_PTR orig);
12098
12099 /**
12100  * Creates a "default" ChannelHandshakeLimits. See struct and individual field documentaiton for details on which values are used.
12101  */
12102 MUST_USE_RES struct LDKChannelHandshakeLimits ChannelHandshakeLimits_default(void);
12103
12104 /**
12105  * Frees any resources used by the ChannelConfig, if is_owned is set and inner is non-NULL.
12106  */
12107 void ChannelConfig_free(struct LDKChannelConfig this_obj);
12108
12109 /**
12110  * Amount (in millionths of a satoshi) charged per satoshi for payments forwarded outbound
12111  * over the channel.
12112  * This may be allowed to change at runtime in a later update, however doing so must result in
12113  * update messages sent to notify all nodes of our updated relay fee.
12114  *
12115  * Default value: 0.
12116  */
12117 uint32_t ChannelConfig_get_forwarding_fee_proportional_millionths(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
12118
12119 /**
12120  * Amount (in millionths of a satoshi) charged per satoshi for payments forwarded outbound
12121  * over the channel.
12122  * This may be allowed to change at runtime in a later update, however doing so must result in
12123  * update messages sent to notify all nodes of our updated relay fee.
12124  *
12125  * Default value: 0.
12126  */
12127 void ChannelConfig_set_forwarding_fee_proportional_millionths(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint32_t val);
12128
12129 /**
12130  * Amount (in milli-satoshi) charged for payments forwarded outbound over the channel, in
12131  * excess of [`forwarding_fee_proportional_millionths`].
12132  * This may be allowed to change at runtime in a later update, however doing so must result in
12133  * update messages sent to notify all nodes of our updated relay fee.
12134  *
12135  * The default value of a single satoshi roughly matches the market rate on many routing nodes
12136  * as of July 2021. Adjusting it upwards or downwards may change whether nodes route through
12137  * this node.
12138  *
12139  * Default value: 1000.
12140  *
12141  * [`forwarding_fee_proportional_millionths`]: ChannelConfig::forwarding_fee_proportional_millionths
12142  */
12143 uint32_t ChannelConfig_get_forwarding_fee_base_msat(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
12144
12145 /**
12146  * Amount (in milli-satoshi) charged for payments forwarded outbound over the channel, in
12147  * excess of [`forwarding_fee_proportional_millionths`].
12148  * This may be allowed to change at runtime in a later update, however doing so must result in
12149  * update messages sent to notify all nodes of our updated relay fee.
12150  *
12151  * The default value of a single satoshi roughly matches the market rate on many routing nodes
12152  * as of July 2021. Adjusting it upwards or downwards may change whether nodes route through
12153  * this node.
12154  *
12155  * Default value: 1000.
12156  *
12157  * [`forwarding_fee_proportional_millionths`]: ChannelConfig::forwarding_fee_proportional_millionths
12158  */
12159 void ChannelConfig_set_forwarding_fee_base_msat(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint32_t val);
12160
12161 /**
12162  * The difference in the CLTV value between incoming HTLCs and an outbound HTLC forwarded over
12163  * the channel this config applies to.
12164  *
12165  * This is analogous to [`ChannelHandshakeConfig::our_to_self_delay`] but applies to in-flight
12166  * HTLC balance when a channel appears on-chain whereas
12167  * [`ChannelHandshakeConfig::our_to_self_delay`] applies to the remaining
12168  * (non-HTLC-encumbered) balance.
12169  *
12170  * Thus, for HTLC-encumbered balances to be enforced on-chain when a channel is force-closed,
12171  * we (or one of our watchtowers) MUST be online to check for broadcast of the current
12172  * commitment transaction at least once per this many blocks (minus some margin to allow us
12173  * enough time to broadcast and confirm a transaction, possibly with time in between to RBF
12174  * the spending transaction).
12175  *
12176  * Default value: 72 (12 hours at an average of 6 blocks/hour).
12177  * Minimum value: [`MIN_CLTV_EXPIRY_DELTA`], any values less than this will be treated as
12178  *                [`MIN_CLTV_EXPIRY_DELTA`] instead.
12179  *
12180  * [`MIN_CLTV_EXPIRY_DELTA`]: crate::ln::channelmanager::MIN_CLTV_EXPIRY_DELTA
12181  */
12182 uint16_t ChannelConfig_get_cltv_expiry_delta(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
12183
12184 /**
12185  * The difference in the CLTV value between incoming HTLCs and an outbound HTLC forwarded over
12186  * the channel this config applies to.
12187  *
12188  * This is analogous to [`ChannelHandshakeConfig::our_to_self_delay`] but applies to in-flight
12189  * HTLC balance when a channel appears on-chain whereas
12190  * [`ChannelHandshakeConfig::our_to_self_delay`] applies to the remaining
12191  * (non-HTLC-encumbered) balance.
12192  *
12193  * Thus, for HTLC-encumbered balances to be enforced on-chain when a channel is force-closed,
12194  * we (or one of our watchtowers) MUST be online to check for broadcast of the current
12195  * commitment transaction at least once per this many blocks (minus some margin to allow us
12196  * enough time to broadcast and confirm a transaction, possibly with time in between to RBF
12197  * the spending transaction).
12198  *
12199  * Default value: 72 (12 hours at an average of 6 blocks/hour).
12200  * Minimum value: [`MIN_CLTV_EXPIRY_DELTA`], any values less than this will be treated as
12201  *                [`MIN_CLTV_EXPIRY_DELTA`] instead.
12202  *
12203  * [`MIN_CLTV_EXPIRY_DELTA`]: crate::ln::channelmanager::MIN_CLTV_EXPIRY_DELTA
12204  */
12205 void ChannelConfig_set_cltv_expiry_delta(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint16_t val);
12206
12207 /**
12208  * Set to announce the channel publicly and notify all nodes that they can route via this
12209  * channel.
12210  *
12211  * This should only be set to true for nodes which expect to be online reliably.
12212  *
12213  * As the node which funds a channel picks this value this will only apply for new outbound
12214  * channels unless [`ChannelHandshakeLimits::force_announced_channel_preference`] is set.
12215  *
12216  * This cannot be changed after the initial channel handshake.
12217  *
12218  * Default value: false.
12219  */
12220 bool ChannelConfig_get_announced_channel(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
12221
12222 /**
12223  * Set to announce the channel publicly and notify all nodes that they can route via this
12224  * channel.
12225  *
12226  * This should only be set to true for nodes which expect to be online reliably.
12227  *
12228  * As the node which funds a channel picks this value this will only apply for new outbound
12229  * channels unless [`ChannelHandshakeLimits::force_announced_channel_preference`] is set.
12230  *
12231  * This cannot be changed after the initial channel handshake.
12232  *
12233  * Default value: false.
12234  */
12235 void ChannelConfig_set_announced_channel(struct LDKChannelConfig *NONNULL_PTR this_ptr, bool val);
12236
12237 /**
12238  * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty
12239  * supports it, they will then enforce the mutual-close output to us matches what we provided
12240  * at intialization, preventing us from closing to an alternate pubkey.
12241  *
12242  * This is set to true by default to provide a slight increase in security, though ultimately
12243  * any attacker who is able to take control of a channel can just as easily send the funds via
12244  * lightning payments, so we never require that our counterparties support this option.
12245  *
12246  * This cannot be changed after a channel has been initialized.
12247  *
12248  * Default value: true.
12249  */
12250 bool ChannelConfig_get_commit_upfront_shutdown_pubkey(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
12251
12252 /**
12253  * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty
12254  * supports it, they will then enforce the mutual-close output to us matches what we provided
12255  * at intialization, preventing us from closing to an alternate pubkey.
12256  *
12257  * This is set to true by default to provide a slight increase in security, though ultimately
12258  * any attacker who is able to take control of a channel can just as easily send the funds via
12259  * lightning payments, so we never require that our counterparties support this option.
12260  *
12261  * This cannot be changed after a channel has been initialized.
12262  *
12263  * Default value: true.
12264  */
12265 void ChannelConfig_set_commit_upfront_shutdown_pubkey(struct LDKChannelConfig *NONNULL_PTR this_ptr, bool val);
12266
12267 /**
12268  * Constructs a new ChannelConfig given each field
12269  */
12270 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);
12271
12272 /**
12273  * Creates a copy of the ChannelConfig
12274  */
12275 struct LDKChannelConfig ChannelConfig_clone(const struct LDKChannelConfig *NONNULL_PTR orig);
12276
12277 /**
12278  * Creates a "default" ChannelConfig. See struct and individual field documentaiton for details on which values are used.
12279  */
12280 MUST_USE_RES struct LDKChannelConfig ChannelConfig_default(void);
12281
12282 /**
12283  * Serialize the ChannelConfig object into a byte array which can be read by ChannelConfig_read
12284  */
12285 struct LDKCVec_u8Z ChannelConfig_write(const struct LDKChannelConfig *NONNULL_PTR obj);
12286
12287 /**
12288  * Read a ChannelConfig from a byte array, created by ChannelConfig_write
12289  */
12290 struct LDKCResult_ChannelConfigDecodeErrorZ ChannelConfig_read(struct LDKu8slice ser);
12291
12292 /**
12293  * Frees any resources used by the UserConfig, if is_owned is set and inner is non-NULL.
12294  */
12295 void UserConfig_free(struct LDKUserConfig this_obj);
12296
12297 /**
12298  * Channel config that we propose to our counterparty.
12299  */
12300 struct LDKChannelHandshakeConfig UserConfig_get_own_channel_config(const struct LDKUserConfig *NONNULL_PTR this_ptr);
12301
12302 /**
12303  * Channel config that we propose to our counterparty.
12304  */
12305 void UserConfig_set_own_channel_config(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeConfig val);
12306
12307 /**
12308  * Limits applied to our counterparty's proposed channel config settings.
12309  */
12310 struct LDKChannelHandshakeLimits UserConfig_get_peer_channel_config_limits(const struct LDKUserConfig *NONNULL_PTR this_ptr);
12311
12312 /**
12313  * Limits applied to our counterparty's proposed channel config settings.
12314  */
12315 void UserConfig_set_peer_channel_config_limits(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeLimits val);
12316
12317 /**
12318  * Channel config which affects behavior during channel lifetime.
12319  */
12320 struct LDKChannelConfig UserConfig_get_channel_options(const struct LDKUserConfig *NONNULL_PTR this_ptr);
12321
12322 /**
12323  * Channel config which affects behavior during channel lifetime.
12324  */
12325 void UserConfig_set_channel_options(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelConfig val);
12326
12327 /**
12328  * If this is set to false, we will reject any HTLCs which were to be forwarded over private
12329  * channels. This prevents us from taking on HTLC-forwarding risk when we intend to run as a
12330  * node which is not online reliably.
12331  *
12332  * For nodes which are not online reliably, you should set all channels to *not* be announced
12333  * (using [`ChannelConfig::announced_channel`] and
12334  * [`ChannelHandshakeLimits::force_announced_channel_preference`]) and set this to false to
12335  * ensure you are not exposed to any forwarding risk.
12336  *
12337  * Note that because you cannot change a channel's announced state after creation, there is no
12338  * way to disable forwarding on public channels retroactively. Thus, in order to change a node
12339  * from a publicly-announced forwarding node to a private non-forwarding node you must close
12340  * all your channels and open new ones. For privacy, you should also change your node_id
12341  * (swapping all private and public key material for new ones) at that time.
12342  *
12343  * Default value: false.
12344  */
12345 bool UserConfig_get_accept_forwards_to_priv_channels(const struct LDKUserConfig *NONNULL_PTR this_ptr);
12346
12347 /**
12348  * If this is set to false, we will reject any HTLCs which were to be forwarded over private
12349  * channels. This prevents us from taking on HTLC-forwarding risk when we intend to run as a
12350  * node which is not online reliably.
12351  *
12352  * For nodes which are not online reliably, you should set all channels to *not* be announced
12353  * (using [`ChannelConfig::announced_channel`] and
12354  * [`ChannelHandshakeLimits::force_announced_channel_preference`]) and set this to false to
12355  * ensure you are not exposed to any forwarding risk.
12356  *
12357  * Note that because you cannot change a channel's announced state after creation, there is no
12358  * way to disable forwarding on public channels retroactively. Thus, in order to change a node
12359  * from a publicly-announced forwarding node to a private non-forwarding node you must close
12360  * all your channels and open new ones. For privacy, you should also change your node_id
12361  * (swapping all private and public key material for new ones) at that time.
12362  *
12363  * Default value: false.
12364  */
12365 void UserConfig_set_accept_forwards_to_priv_channels(struct LDKUserConfig *NONNULL_PTR this_ptr, bool val);
12366
12367 /**
12368  * Constructs a new UserConfig given each field
12369  */
12370 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);
12371
12372 /**
12373  * Creates a copy of the UserConfig
12374  */
12375 struct LDKUserConfig UserConfig_clone(const struct LDKUserConfig *NONNULL_PTR orig);
12376
12377 /**
12378  * Creates a "default" UserConfig. See struct and individual field documentaiton for details on which values are used.
12379  */
12380 MUST_USE_RES struct LDKUserConfig UserConfig_default(void);
12381
12382 /**
12383  * Frees any resources used by the BestBlock, if is_owned is set and inner is non-NULL.
12384  */
12385 void BestBlock_free(struct LDKBestBlock this_obj);
12386
12387 /**
12388  * Creates a copy of the BestBlock
12389  */
12390 struct LDKBestBlock BestBlock_clone(const struct LDKBestBlock *NONNULL_PTR orig);
12391
12392 /**
12393  * Constructs a `BestBlock` that represents the genesis block at height 0 of the given
12394  * network.
12395  */
12396 MUST_USE_RES struct LDKBestBlock BestBlock_from_genesis(enum LDKNetwork network);
12397
12398 /**
12399  * Returns a `BestBlock` as identified by the given block hash and height.
12400  */
12401 MUST_USE_RES struct LDKBestBlock BestBlock_new(struct LDKThirtyTwoBytes block_hash, uint32_t height);
12402
12403 /**
12404  * Returns the best block hash.
12405  */
12406 MUST_USE_RES struct LDKThirtyTwoBytes BestBlock_block_hash(const struct LDKBestBlock *NONNULL_PTR this_arg);
12407
12408 /**
12409  * Returns the best block height.
12410  */
12411 MUST_USE_RES uint32_t BestBlock_height(const struct LDKBestBlock *NONNULL_PTR this_arg);
12412
12413 /**
12414  * Creates a copy of the AccessError
12415  */
12416 enum LDKAccessError AccessError_clone(const enum LDKAccessError *NONNULL_PTR orig);
12417
12418 /**
12419  * Calls the free function if one is set
12420  */
12421 void Access_free(struct LDKAccess this_ptr);
12422
12423 /**
12424  * Calls the free function if one is set
12425  */
12426 void Listen_free(struct LDKListen this_ptr);
12427
12428 /**
12429  * Calls the free function if one is set
12430  */
12431 void Confirm_free(struct LDKConfirm this_ptr);
12432
12433 /**
12434  * Calls the free function if one is set
12435  */
12436 void Watch_free(struct LDKWatch this_ptr);
12437
12438 /**
12439  * Calls the free function if one is set
12440  */
12441 void Filter_free(struct LDKFilter this_ptr);
12442
12443 /**
12444  * Frees any resources used by the WatchedOutput, if is_owned is set and inner is non-NULL.
12445  */
12446 void WatchedOutput_free(struct LDKWatchedOutput this_obj);
12447
12448 /**
12449  * First block where the transaction output may have been spent.
12450  */
12451 struct LDKThirtyTwoBytes WatchedOutput_get_block_hash(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
12452
12453 /**
12454  * First block where the transaction output may have been spent.
12455  */
12456 void WatchedOutput_set_block_hash(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12457
12458 /**
12459  * Outpoint identifying the transaction output.
12460  */
12461 struct LDKOutPoint WatchedOutput_get_outpoint(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
12462
12463 /**
12464  * Outpoint identifying the transaction output.
12465  */
12466 void WatchedOutput_set_outpoint(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKOutPoint val);
12467
12468 /**
12469  * Spending condition of the transaction output.
12470  */
12471 struct LDKu8slice WatchedOutput_get_script_pubkey(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
12472
12473 /**
12474  * Spending condition of the transaction output.
12475  */
12476 void WatchedOutput_set_script_pubkey(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
12477
12478 /**
12479  * Constructs a new WatchedOutput given each field
12480  */
12481 MUST_USE_RES struct LDKWatchedOutput WatchedOutput_new(struct LDKThirtyTwoBytes block_hash_arg, struct LDKOutPoint outpoint_arg, struct LDKCVec_u8Z script_pubkey_arg);
12482
12483 /**
12484  * Creates a copy of the WatchedOutput
12485  */
12486 struct LDKWatchedOutput WatchedOutput_clone(const struct LDKWatchedOutput *NONNULL_PTR orig);
12487
12488 /**
12489  * Checks if two WatchedOutputs contain equal inner contents.
12490  */
12491 uint64_t WatchedOutput_hash(const struct LDKWatchedOutput *NONNULL_PTR o);
12492
12493 /**
12494  * Calls the free function if one is set
12495  */
12496 void BroadcasterInterface_free(struct LDKBroadcasterInterface this_ptr);
12497
12498 /**
12499  * Creates a copy of the ConfirmationTarget
12500  */
12501 enum LDKConfirmationTarget ConfirmationTarget_clone(const enum LDKConfirmationTarget *NONNULL_PTR orig);
12502
12503 /**
12504  * Calls the free function if one is set
12505  */
12506 void FeeEstimator_free(struct LDKFeeEstimator this_ptr);
12507
12508 /**
12509  * Frees any resources used by the ChainMonitor, if is_owned is set and inner is non-NULL.
12510  */
12511 void ChainMonitor_free(struct LDKChainMonitor this_obj);
12512
12513 /**
12514  * Creates a new `ChainMonitor` used to watch on-chain activity pertaining to channels.
12515  *
12516  * When an optional chain source implementing [`chain::Filter`] is provided, the chain monitor
12517  * will call back to it indicating transactions and outputs of interest. This allows clients to
12518  * pre-filter blocks or only fetch blocks matching a compact filter. Otherwise, clients may
12519  * always need to fetch full blocks absent another means for determining which blocks contain
12520  * transactions relevant to the watched channels.
12521  */
12522 MUST_USE_RES struct LDKChainMonitor ChainMonitor_new(struct LDKFilter *chain_source, struct LDKBroadcasterInterface broadcaster, struct LDKLogger logger, struct LDKFeeEstimator feeest, struct LDKPersist persister);
12523
12524 /**
12525  * Constructs a new Listen which calls the relevant methods on this_arg.
12526  * This copies the `inner` pointer in this_arg and thus the returned Listen must be freed before this_arg is
12527  */
12528 struct LDKListen ChainMonitor_as_Listen(const struct LDKChainMonitor *NONNULL_PTR this_arg);
12529
12530 /**
12531  * Constructs a new Confirm which calls the relevant methods on this_arg.
12532  * This copies the `inner` pointer in this_arg and thus the returned Confirm must be freed before this_arg is
12533  */
12534 struct LDKConfirm ChainMonitor_as_Confirm(const struct LDKChainMonitor *NONNULL_PTR this_arg);
12535
12536 /**
12537  * Constructs a new Watch which calls the relevant methods on this_arg.
12538  * This copies the `inner` pointer in this_arg and thus the returned Watch must be freed before this_arg is
12539  */
12540 struct LDKWatch ChainMonitor_as_Watch(const struct LDKChainMonitor *NONNULL_PTR this_arg);
12541
12542 /**
12543  * Constructs a new EventsProvider which calls the relevant methods on this_arg.
12544  * This copies the `inner` pointer in this_arg and thus the returned EventsProvider must be freed before this_arg is
12545  */
12546 struct LDKEventsProvider ChainMonitor_as_EventsProvider(const struct LDKChainMonitor *NONNULL_PTR this_arg);
12547
12548 /**
12549  * Frees any resources used by the ChannelMonitorUpdate, if is_owned is set and inner is non-NULL.
12550  */
12551 void ChannelMonitorUpdate_free(struct LDKChannelMonitorUpdate this_obj);
12552
12553 /**
12554  * The sequence number of this update. Updates *must* be replayed in-order according to this
12555  * sequence number (and updates may panic if they are not). The update_id values are strictly
12556  * increasing and increase by one for each new update, with one exception specified below.
12557  *
12558  * This sequence number is also used to track up to which points updates which returned
12559  * ChannelMonitorUpdateErr::TemporaryFailure have been applied to all copies of a given
12560  * ChannelMonitor when ChannelManager::channel_monitor_updated is called.
12561  *
12562  * The only instance where update_id values are not strictly increasing is the case where we
12563  * allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See
12564  * its docs for more details.
12565  */
12566 uint64_t ChannelMonitorUpdate_get_update_id(const struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr);
12567
12568 /**
12569  * The sequence number of this update. Updates *must* be replayed in-order according to this
12570  * sequence number (and updates may panic if they are not). The update_id values are strictly
12571  * increasing and increase by one for each new update, with one exception specified below.
12572  *
12573  * This sequence number is also used to track up to which points updates which returned
12574  * ChannelMonitorUpdateErr::TemporaryFailure have been applied to all copies of a given
12575  * ChannelMonitor when ChannelManager::channel_monitor_updated is called.
12576  *
12577  * The only instance where update_id values are not strictly increasing is the case where we
12578  * allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See
12579  * its docs for more details.
12580  */
12581 void ChannelMonitorUpdate_set_update_id(struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr, uint64_t val);
12582
12583 /**
12584  * Creates a copy of the ChannelMonitorUpdate
12585  */
12586 struct LDKChannelMonitorUpdate ChannelMonitorUpdate_clone(const struct LDKChannelMonitorUpdate *NONNULL_PTR orig);
12587
12588 /**
12589  * Serialize the ChannelMonitorUpdate object into a byte array which can be read by ChannelMonitorUpdate_read
12590  */
12591 struct LDKCVec_u8Z ChannelMonitorUpdate_write(const struct LDKChannelMonitorUpdate *NONNULL_PTR obj);
12592
12593 /**
12594  * Read a ChannelMonitorUpdate from a byte array, created by ChannelMonitorUpdate_write
12595  */
12596 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ ChannelMonitorUpdate_read(struct LDKu8slice ser);
12597
12598 /**
12599  * Creates a copy of the ChannelMonitorUpdateErr
12600  */
12601 enum LDKChannelMonitorUpdateErr ChannelMonitorUpdateErr_clone(const enum LDKChannelMonitorUpdateErr *NONNULL_PTR orig);
12602
12603 /**
12604  * Frees any resources used by the MonitorUpdateError, if is_owned is set and inner is non-NULL.
12605  */
12606 void MonitorUpdateError_free(struct LDKMonitorUpdateError this_obj);
12607
12608 /**
12609  * Creates a copy of the MonitorUpdateError
12610  */
12611 struct LDKMonitorUpdateError MonitorUpdateError_clone(const struct LDKMonitorUpdateError *NONNULL_PTR orig);
12612
12613 /**
12614  * Frees any resources used by the MonitorEvent
12615  */
12616 void MonitorEvent_free(struct LDKMonitorEvent this_ptr);
12617
12618 /**
12619  * Creates a copy of the MonitorEvent
12620  */
12621 struct LDKMonitorEvent MonitorEvent_clone(const struct LDKMonitorEvent *NONNULL_PTR orig);
12622
12623 /**
12624  * Frees any resources used by the HTLCUpdate, if is_owned is set and inner is non-NULL.
12625  */
12626 void HTLCUpdate_free(struct LDKHTLCUpdate this_obj);
12627
12628 /**
12629  * Creates a copy of the HTLCUpdate
12630  */
12631 struct LDKHTLCUpdate HTLCUpdate_clone(const struct LDKHTLCUpdate *NONNULL_PTR orig);
12632
12633 /**
12634  * Serialize the HTLCUpdate object into a byte array which can be read by HTLCUpdate_read
12635  */
12636 struct LDKCVec_u8Z HTLCUpdate_write(const struct LDKHTLCUpdate *NONNULL_PTR obj);
12637
12638 /**
12639  * Read a HTLCUpdate from a byte array, created by HTLCUpdate_write
12640  */
12641 struct LDKCResult_HTLCUpdateDecodeErrorZ HTLCUpdate_read(struct LDKu8slice ser);
12642
12643 /**
12644  * Frees any resources used by the ChannelMonitor, if is_owned is set and inner is non-NULL.
12645  */
12646 void ChannelMonitor_free(struct LDKChannelMonitor this_obj);
12647
12648 /**
12649  * Serialize the ChannelMonitor object into a byte array which can be read by ChannelMonitor_read
12650  */
12651 struct LDKCVec_u8Z ChannelMonitor_write(const struct LDKChannelMonitor *NONNULL_PTR obj);
12652
12653 /**
12654  * Updates a ChannelMonitor on the basis of some new information provided by the Channel
12655  * itself.
12656  *
12657  * panics if the given update is not the next update by update_id.
12658  */
12659 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);
12660
12661 /**
12662  * Gets the update_id from the latest ChannelMonitorUpdate which was applied to this
12663  * ChannelMonitor.
12664  */
12665 MUST_USE_RES uint64_t ChannelMonitor_get_latest_update_id(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
12666
12667 /**
12668  * Gets the funding transaction outpoint of the channel this ChannelMonitor is monitoring for.
12669  */
12670 MUST_USE_RES struct LDKC2Tuple_OutPointScriptZ ChannelMonitor_get_funding_txo(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
12671
12672 /**
12673  * Gets a list of txids, with their output scripts (in the order they appear in the
12674  * transaction), which we must learn about spends of via block_connected().
12675  */
12676 MUST_USE_RES struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ChannelMonitor_get_outputs_to_watch(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
12677
12678 /**
12679  * Loads the funding txo and outputs to watch into the given `chain::Filter` by repeatedly
12680  * calling `chain::Filter::register_output` and `chain::Filter::register_tx` until all outputs
12681  * have been registered.
12682  */
12683 void ChannelMonitor_load_outputs_to_watch(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKFilter *NONNULL_PTR filter);
12684
12685 /**
12686  * Get the list of HTLCs who's status has been updated on chain. This should be called by
12687  * ChannelManager via [`chain::Watch::release_pending_monitor_events`].
12688  */
12689 MUST_USE_RES struct LDKCVec_MonitorEventZ ChannelMonitor_get_and_clear_pending_monitor_events(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
12690
12691 /**
12692  * Gets the list of pending events which were generated by previous actions, clearing the list
12693  * in the process.
12694  *
12695  * This is called by ChainMonitor::get_and_clear_pending_events() and is equivalent to
12696  * EventsProvider::get_and_clear_pending_events() except that it requires &mut self as we do
12697  * no internal locking in ChannelMonitors.
12698  */
12699 MUST_USE_RES struct LDKCVec_EventZ ChannelMonitor_get_and_clear_pending_events(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
12700
12701 /**
12702  * Used by ChannelManager deserialization to broadcast the latest holder state if its copy of
12703  * the Channel was out-of-date. You may use it to get a broadcastable holder toxic tx in case of
12704  * fallen-behind, i.e when receiving a channel_reestablish with a proof that our counterparty side knows
12705  * a higher revocation secret than the holder commitment number we are aware of. Broadcasting these
12706  * transactions are UNSAFE, as they allow counterparty side to punish you. Nevertheless you may want to
12707  * broadcast them if counterparty don't close channel with his higher commitment transaction after a
12708  * substantial amount of time (a month or even a year) to get back funds. Best may be to contact
12709  * out-of-band the other node operator to coordinate with him if option is available to you.
12710  * In any-case, choice is up to the user.
12711  */
12712 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);
12713
12714 /**
12715  * Processes transactions in a newly connected block, which may result in any of the following:
12716  * - update the monitor's state against resolved HTLCs
12717  * - punish the counterparty in the case of seeing a revoked commitment transaction
12718  * - force close the channel and claim/timeout incoming/outgoing HTLCs if near expiration
12719  * - detect settled outputs for later spending
12720  * - schedule and bump any in-flight claims
12721  *
12722  * Returns any new outputs to watch from `txdata`; after called, these are also included in
12723  * [`get_outputs_to_watch`].
12724  *
12725  * [`get_outputs_to_watch`]: #method.get_outputs_to_watch
12726  */
12727 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);
12728
12729 /**
12730  * Determines if the disconnected block contained any transactions of interest and updates
12731  * appropriately.
12732  */
12733 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);
12734
12735 /**
12736  * Processes transactions confirmed in a block with the given header and height, returning new
12737  * outputs to watch. See [`block_connected`] for details.
12738  *
12739  * Used instead of [`block_connected`] by clients that are notified of transactions rather than
12740  * blocks. See [`chain::Confirm`] for calling expectations.
12741  *
12742  * [`block_connected`]: Self::block_connected
12743  */
12744 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);
12745
12746 /**
12747  * Processes a transaction that was reorganized out of the chain.
12748  *
12749  * Used instead of [`block_disconnected`] by clients that are notified of transactions rather
12750  * than blocks. See [`chain::Confirm`] for calling expectations.
12751  *
12752  * [`block_disconnected`]: Self::block_disconnected
12753  */
12754 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);
12755
12756 /**
12757  * Updates the monitor with the current best chain tip, returning new outputs to watch. See
12758  * [`block_connected`] for details.
12759  *
12760  * Used instead of [`block_connected`] by clients that are notified of transactions rather than
12761  * blocks. See [`chain::Confirm`] for calling expectations.
12762  *
12763  * [`block_connected`]: Self::block_connected
12764  */
12765 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);
12766
12767 /**
12768  * Returns the set of txids that should be monitored for re-organization out of the chain.
12769  */
12770 MUST_USE_RES struct LDKCVec_TxidZ ChannelMonitor_get_relevant_txids(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
12771
12772 /**
12773  * Gets the latest best block which was connected either via the [`chain::Listen`] or
12774  * [`chain::Confirm`] interfaces.
12775  */
12776 MUST_USE_RES struct LDKBestBlock ChannelMonitor_current_best_block(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
12777
12778 /**
12779  * Calls the free function if one is set
12780  */
12781 void Persist_free(struct LDKPersist this_ptr);
12782
12783 /**
12784  * Read a C2Tuple_BlockHashChannelMonitorZ from a byte array, created by C2Tuple_BlockHashChannelMonitorZ_write
12785  */
12786 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ C2Tuple_BlockHashChannelMonitorZ_read(struct LDKu8slice ser, const struct LDKKeysInterface *NONNULL_PTR arg);
12787
12788 /**
12789  * Frees any resources used by the OutPoint, if is_owned is set and inner is non-NULL.
12790  */
12791 void OutPoint_free(struct LDKOutPoint this_obj);
12792
12793 /**
12794  * The referenced transaction's txid.
12795  */
12796 const uint8_t (*OutPoint_get_txid(const struct LDKOutPoint *NONNULL_PTR this_ptr))[32];
12797
12798 /**
12799  * The referenced transaction's txid.
12800  */
12801 void OutPoint_set_txid(struct LDKOutPoint *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12802
12803 /**
12804  * The index of the referenced output in its transaction's vout.
12805  */
12806 uint16_t OutPoint_get_index(const struct LDKOutPoint *NONNULL_PTR this_ptr);
12807
12808 /**
12809  * The index of the referenced output in its transaction's vout.
12810  */
12811 void OutPoint_set_index(struct LDKOutPoint *NONNULL_PTR this_ptr, uint16_t val);
12812
12813 /**
12814  * Constructs a new OutPoint given each field
12815  */
12816 MUST_USE_RES struct LDKOutPoint OutPoint_new(struct LDKThirtyTwoBytes txid_arg, uint16_t index_arg);
12817
12818 /**
12819  * Creates a copy of the OutPoint
12820  */
12821 struct LDKOutPoint OutPoint_clone(const struct LDKOutPoint *NONNULL_PTR orig);
12822
12823 /**
12824  * Checks if two OutPoints contain equal inner contents.
12825  * This ignores pointers and is_owned flags and looks at the values in fields.
12826  * Two objects with NULL inner values will be considered "equal" here.
12827  */
12828 bool OutPoint_eq(const struct LDKOutPoint *NONNULL_PTR a, const struct LDKOutPoint *NONNULL_PTR b);
12829
12830 /**
12831  * Checks if two OutPoints contain equal inner contents.
12832  */
12833 uint64_t OutPoint_hash(const struct LDKOutPoint *NONNULL_PTR o);
12834
12835 /**
12836  * Convert an `OutPoint` to a lightning channel id.
12837  */
12838 MUST_USE_RES struct LDKThirtyTwoBytes OutPoint_to_channel_id(const struct LDKOutPoint *NONNULL_PTR this_arg);
12839
12840 /**
12841  * Serialize the OutPoint object into a byte array which can be read by OutPoint_read
12842  */
12843 struct LDKCVec_u8Z OutPoint_write(const struct LDKOutPoint *NONNULL_PTR obj);
12844
12845 /**
12846  * Read a OutPoint from a byte array, created by OutPoint_write
12847  */
12848 struct LDKCResult_OutPointDecodeErrorZ OutPoint_read(struct LDKu8slice ser);
12849
12850 /**
12851  * Frees any resources used by the DelayedPaymentOutputDescriptor, if is_owned is set and inner is non-NULL.
12852  */
12853 void DelayedPaymentOutputDescriptor_free(struct LDKDelayedPaymentOutputDescriptor this_obj);
12854
12855 /**
12856  * The outpoint which is spendable
12857  */
12858 struct LDKOutPoint DelayedPaymentOutputDescriptor_get_outpoint(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
12859
12860 /**
12861  * The outpoint which is spendable
12862  */
12863 void DelayedPaymentOutputDescriptor_set_outpoint(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKOutPoint val);
12864
12865 /**
12866  * Per commitment point to derive delayed_payment_key by key holder
12867  */
12868 struct LDKPublicKey DelayedPaymentOutputDescriptor_get_per_commitment_point(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
12869
12870 /**
12871  * Per commitment point to derive delayed_payment_key by key holder
12872  */
12873 void DelayedPaymentOutputDescriptor_set_per_commitment_point(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val);
12874
12875 /**
12876  * The nSequence value which must be set in the spending input to satisfy the OP_CSV in
12877  * the witness_script.
12878  */
12879 uint16_t DelayedPaymentOutputDescriptor_get_to_self_delay(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
12880
12881 /**
12882  * The nSequence value which must be set in the spending input to satisfy the OP_CSV in
12883  * the witness_script.
12884  */
12885 void DelayedPaymentOutputDescriptor_set_to_self_delay(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint16_t val);
12886
12887 /**
12888  * The output which is referenced by the given outpoint
12889  */
12890 void DelayedPaymentOutputDescriptor_set_output(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKTxOut val);
12891
12892 /**
12893  * The revocation point specific to the commitment transaction which was broadcast. Used to
12894  * derive the witnessScript for this output.
12895  */
12896 struct LDKPublicKey DelayedPaymentOutputDescriptor_get_revocation_pubkey(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
12897
12898 /**
12899  * The revocation point specific to the commitment transaction which was broadcast. Used to
12900  * derive the witnessScript for this output.
12901  */
12902 void DelayedPaymentOutputDescriptor_set_revocation_pubkey(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val);
12903
12904 /**
12905  * Arbitrary identification information returned by a call to
12906  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
12907  * the channel to spend the output.
12908  */
12909 const uint8_t (*DelayedPaymentOutputDescriptor_get_channel_keys_id(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr))[32];
12910
12911 /**
12912  * Arbitrary identification information returned by a call to
12913  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
12914  * the channel to spend the output.
12915  */
12916 void DelayedPaymentOutputDescriptor_set_channel_keys_id(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12917
12918 /**
12919  * The value of the channel which this output originated from, possibly indirectly.
12920  */
12921 uint64_t DelayedPaymentOutputDescriptor_get_channel_value_satoshis(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
12922
12923 /**
12924  * The value of the channel which this output originated from, possibly indirectly.
12925  */
12926 void DelayedPaymentOutputDescriptor_set_channel_value_satoshis(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint64_t val);
12927
12928 /**
12929  * Constructs a new DelayedPaymentOutputDescriptor given each field
12930  */
12931 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);
12932
12933 /**
12934  * Creates a copy of the DelayedPaymentOutputDescriptor
12935  */
12936 struct LDKDelayedPaymentOutputDescriptor DelayedPaymentOutputDescriptor_clone(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR orig);
12937
12938 /**
12939  * Serialize the DelayedPaymentOutputDescriptor object into a byte array which can be read by DelayedPaymentOutputDescriptor_read
12940  */
12941 struct LDKCVec_u8Z DelayedPaymentOutputDescriptor_write(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR obj);
12942
12943 /**
12944  * Read a DelayedPaymentOutputDescriptor from a byte array, created by DelayedPaymentOutputDescriptor_write
12945  */
12946 struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ DelayedPaymentOutputDescriptor_read(struct LDKu8slice ser);
12947
12948 /**
12949  * Frees any resources used by the StaticPaymentOutputDescriptor, if is_owned is set and inner is non-NULL.
12950  */
12951 void StaticPaymentOutputDescriptor_free(struct LDKStaticPaymentOutputDescriptor this_obj);
12952
12953 /**
12954  * The outpoint which is spendable
12955  */
12956 struct LDKOutPoint StaticPaymentOutputDescriptor_get_outpoint(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr);
12957
12958 /**
12959  * The outpoint which is spendable
12960  */
12961 void StaticPaymentOutputDescriptor_set_outpoint(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKOutPoint val);
12962
12963 /**
12964  * The output which is referenced by the given outpoint
12965  */
12966 void StaticPaymentOutputDescriptor_set_output(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKTxOut val);
12967
12968 /**
12969  * Arbitrary identification information returned by a call to
12970  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
12971  * the channel to spend the output.
12972  */
12973 const uint8_t (*StaticPaymentOutputDescriptor_get_channel_keys_id(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr))[32];
12974
12975 /**
12976  * Arbitrary identification information returned by a call to
12977  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
12978  * the channel to spend the output.
12979  */
12980 void StaticPaymentOutputDescriptor_set_channel_keys_id(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
12981
12982 /**
12983  * The value of the channel which this transactions spends.
12984  */
12985 uint64_t StaticPaymentOutputDescriptor_get_channel_value_satoshis(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr);
12986
12987 /**
12988  * The value of the channel which this transactions spends.
12989  */
12990 void StaticPaymentOutputDescriptor_set_channel_value_satoshis(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint64_t val);
12991
12992 /**
12993  * Constructs a new StaticPaymentOutputDescriptor given each field
12994  */
12995 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);
12996
12997 /**
12998  * Creates a copy of the StaticPaymentOutputDescriptor
12999  */
13000 struct LDKStaticPaymentOutputDescriptor StaticPaymentOutputDescriptor_clone(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR orig);
13001
13002 /**
13003  * Serialize the StaticPaymentOutputDescriptor object into a byte array which can be read by StaticPaymentOutputDescriptor_read
13004  */
13005 struct LDKCVec_u8Z StaticPaymentOutputDescriptor_write(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR obj);
13006
13007 /**
13008  * Read a StaticPaymentOutputDescriptor from a byte array, created by StaticPaymentOutputDescriptor_write
13009  */
13010 struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ StaticPaymentOutputDescriptor_read(struct LDKu8slice ser);
13011
13012 /**
13013  * Frees any resources used by the SpendableOutputDescriptor
13014  */
13015 void SpendableOutputDescriptor_free(struct LDKSpendableOutputDescriptor this_ptr);
13016
13017 /**
13018  * Creates a copy of the SpendableOutputDescriptor
13019  */
13020 struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_clone(const struct LDKSpendableOutputDescriptor *NONNULL_PTR orig);
13021
13022 /**
13023  * Serialize the SpendableOutputDescriptor object into a byte array which can be read by SpendableOutputDescriptor_read
13024  */
13025 struct LDKCVec_u8Z SpendableOutputDescriptor_write(const struct LDKSpendableOutputDescriptor *NONNULL_PTR obj);
13026
13027 /**
13028  * Read a SpendableOutputDescriptor from a byte array, created by SpendableOutputDescriptor_write
13029  */
13030 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ SpendableOutputDescriptor_read(struct LDKu8slice ser);
13031
13032 /**
13033  * Calls the free function if one is set
13034  */
13035 void BaseSign_free(struct LDKBaseSign this_ptr);
13036
13037 /**
13038  * Creates a copy of a Sign
13039  */
13040 struct LDKSign Sign_clone(const struct LDKSign *NONNULL_PTR orig);
13041
13042 /**
13043  * Calls the free function if one is set
13044  */
13045 void Sign_free(struct LDKSign this_ptr);
13046
13047 /**
13048  * Calls the free function if one is set
13049  */
13050 void KeysInterface_free(struct LDKKeysInterface this_ptr);
13051
13052 /**
13053  * Frees any resources used by the InMemorySigner, if is_owned is set and inner is non-NULL.
13054  */
13055 void InMemorySigner_free(struct LDKInMemorySigner this_obj);
13056
13057 /**
13058  * Private key of anchor tx
13059  */
13060 const uint8_t (*InMemorySigner_get_funding_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
13061
13062 /**
13063  * Private key of anchor tx
13064  */
13065 void InMemorySigner_set_funding_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
13066
13067 /**
13068  * Holder secret key for blinded revocation pubkey
13069  */
13070 const uint8_t (*InMemorySigner_get_revocation_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
13071
13072 /**
13073  * Holder secret key for blinded revocation pubkey
13074  */
13075 void InMemorySigner_set_revocation_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
13076
13077 /**
13078  * Holder secret key used for our balance in counterparty-broadcasted commitment transactions
13079  */
13080 const uint8_t (*InMemorySigner_get_payment_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
13081
13082 /**
13083  * Holder secret key used for our balance in counterparty-broadcasted commitment transactions
13084  */
13085 void InMemorySigner_set_payment_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
13086
13087 /**
13088  * Holder secret key used in HTLC tx
13089  */
13090 const uint8_t (*InMemorySigner_get_delayed_payment_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
13091
13092 /**
13093  * Holder secret key used in HTLC tx
13094  */
13095 void InMemorySigner_set_delayed_payment_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
13096
13097 /**
13098  * Holder htlc secret key used in commitment tx htlc outputs
13099  */
13100 const uint8_t (*InMemorySigner_get_htlc_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
13101
13102 /**
13103  * Holder htlc secret key used in commitment tx htlc outputs
13104  */
13105 void InMemorySigner_set_htlc_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
13106
13107 /**
13108  * Commitment seed
13109  */
13110 const uint8_t (*InMemorySigner_get_commitment_seed(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
13111
13112 /**
13113  * Commitment seed
13114  */
13115 void InMemorySigner_set_commitment_seed(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13116
13117 /**
13118  * Creates a copy of the InMemorySigner
13119  */
13120 struct LDKInMemorySigner InMemorySigner_clone(const struct LDKInMemorySigner *NONNULL_PTR orig);
13121
13122 /**
13123  * Create a new InMemorySigner
13124  */
13125 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);
13126
13127 /**
13128  * Counterparty pubkeys.
13129  * Will panic if ready_channel wasn't called.
13130  */
13131 MUST_USE_RES struct LDKChannelPublicKeys InMemorySigner_counterparty_pubkeys(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
13132
13133 /**
13134  * The contest_delay value specified by our counterparty and applied on holder-broadcastable
13135  * transactions, ie the amount of time that we have to wait to recover our funds if we
13136  * broadcast a transaction.
13137  * Will panic if ready_channel wasn't called.
13138  */
13139 MUST_USE_RES uint16_t InMemorySigner_counterparty_selected_contest_delay(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
13140
13141 /**
13142  * The contest_delay value specified by us and applied on transactions broadcastable
13143  * by our counterparty, ie the amount of time that they have to wait to recover their funds
13144  * if they broadcast a transaction.
13145  * Will panic if ready_channel wasn't called.
13146  */
13147 MUST_USE_RES uint16_t InMemorySigner_holder_selected_contest_delay(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
13148
13149 /**
13150  * Whether the holder is the initiator
13151  * Will panic if ready_channel wasn't called.
13152  */
13153 MUST_USE_RES bool InMemorySigner_is_outbound(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
13154
13155 /**
13156  * Funding outpoint
13157  * Will panic if ready_channel wasn't called.
13158  */
13159 MUST_USE_RES struct LDKOutPoint InMemorySigner_funding_outpoint(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
13160
13161 /**
13162  * Obtain a ChannelTransactionParameters for this channel, to be used when verifying or
13163  * building transactions.
13164  *
13165  * Will panic if ready_channel wasn't called.
13166  */
13167 MUST_USE_RES struct LDKChannelTransactionParameters InMemorySigner_get_channel_parameters(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
13168
13169 /**
13170  * Sign the single input of spend_tx at index `input_idx` which spends the output
13171  * described by descriptor, returning the witness stack for the input.
13172  *
13173  * Returns an Err if the input at input_idx does not exist, has a non-empty script_sig,
13174  * or is not spending the outpoint described by `descriptor.outpoint`.
13175  */
13176 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);
13177
13178 /**
13179  * Sign the single input of spend_tx at index `input_idx` which spends the output
13180  * described by descriptor, returning the witness stack for the input.
13181  *
13182  * Returns an Err if the input at input_idx does not exist, has a non-empty script_sig,
13183  * is not spending the outpoint described by `descriptor.outpoint`, or does not have a
13184  * sequence set to `descriptor.to_self_delay`.
13185  */
13186 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);
13187
13188 /**
13189  * Constructs a new BaseSign which calls the relevant methods on this_arg.
13190  * This copies the `inner` pointer in this_arg and thus the returned BaseSign must be freed before this_arg is
13191  */
13192 struct LDKBaseSign InMemorySigner_as_BaseSign(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
13193
13194 /**
13195  * Constructs a new Sign which calls the relevant methods on this_arg.
13196  * This copies the `inner` pointer in this_arg and thus the returned Sign must be freed before this_arg is
13197  */
13198 struct LDKSign InMemorySigner_as_Sign(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
13199
13200 /**
13201  * Serialize the InMemorySigner object into a byte array which can be read by InMemorySigner_read
13202  */
13203 struct LDKCVec_u8Z InMemorySigner_write(const struct LDKInMemorySigner *NONNULL_PTR obj);
13204
13205 /**
13206  * Read a InMemorySigner from a byte array, created by InMemorySigner_write
13207  */
13208 struct LDKCResult_InMemorySignerDecodeErrorZ InMemorySigner_read(struct LDKu8slice ser);
13209
13210 /**
13211  * Frees any resources used by the KeysManager, if is_owned is set and inner is non-NULL.
13212  */
13213 void KeysManager_free(struct LDKKeysManager this_obj);
13214
13215 /**
13216  * Constructs a KeysManager from a 32-byte seed. If the seed is in some way biased (eg your
13217  * CSRNG is busted) this may panic (but more importantly, you will possibly lose funds).
13218  * starting_time isn't strictly required to actually be a time, but it must absolutely,
13219  * without a doubt, be unique to this instance. ie if you start multiple times with the same
13220  * seed, starting_time must be unique to each run. Thus, the easiest way to achieve this is to
13221  * simply use the current time (with very high precision).
13222  *
13223  * The seed MUST be backed up safely prior to use so that the keys can be re-created, however,
13224  * obviously, starting_time should be unique every time you reload the library - it is only
13225  * used to generate new ephemeral key data (which will be stored by the individual channel if
13226  * necessary).
13227  *
13228  * Note that the seed is required to recover certain on-chain funds independent of
13229  * ChannelMonitor data, though a current copy of ChannelMonitor data is also required for any
13230  * channel, and some on-chain during-closing funds.
13231  *
13232  * Note that until the 0.1 release there is no guarantee of backward compatibility between
13233  * versions. Once the library is more fully supported, the docs will be updated to include a
13234  * detailed description of the guarantee.
13235  */
13236 MUST_USE_RES struct LDKKeysManager KeysManager_new(const uint8_t (*seed)[32], uint64_t starting_time_secs, uint32_t starting_time_nanos);
13237
13238 /**
13239  * Derive an old Sign containing per-channel secrets based on a key derivation parameters.
13240  *
13241  * Key derivation parameters are accessible through a per-channel secrets
13242  * Sign::channel_keys_id and is provided inside DynamicOuputP2WSH in case of
13243  * onchain output detection for which a corresponding delayed_payment_key must be derived.
13244  */
13245 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]);
13246
13247 /**
13248  * Creates a Transaction which spends the given descriptors to the given outputs, plus an
13249  * output to the given change destination (if sufficient change value remains). The
13250  * transaction will have a feerate, at least, of the given value.
13251  *
13252  * Returns `Err(())` if the output value is greater than the input value minus required fee or
13253  * if a descriptor was duplicated.
13254  *
13255  * We do not enforce that outputs meet the dust limit or that any output scripts are standard.
13256  *
13257  * May panic if the `SpendableOutputDescriptor`s were not generated by Channels which used
13258  * this KeysManager or one of the `InMemorySigner` created by this KeysManager.
13259  */
13260 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);
13261
13262 /**
13263  * Constructs a new KeysInterface which calls the relevant methods on this_arg.
13264  * This copies the `inner` pointer in this_arg and thus the returned KeysInterface must be freed before this_arg is
13265  */
13266 struct LDKKeysInterface KeysManager_as_KeysInterface(const struct LDKKeysManager *NONNULL_PTR this_arg);
13267
13268 /**
13269  * Frees any resources used by the ChannelManager, if is_owned is set and inner is non-NULL.
13270  */
13271 void ChannelManager_free(struct LDKChannelManager this_obj);
13272
13273 /**
13274  * Frees any resources used by the ChainParameters, if is_owned is set and inner is non-NULL.
13275  */
13276 void ChainParameters_free(struct LDKChainParameters this_obj);
13277
13278 /**
13279  * The network for determining the `chain_hash` in Lightning messages.
13280  */
13281 enum LDKNetwork ChainParameters_get_network(const struct LDKChainParameters *NONNULL_PTR this_ptr);
13282
13283 /**
13284  * The network for determining the `chain_hash` in Lightning messages.
13285  */
13286 void ChainParameters_set_network(struct LDKChainParameters *NONNULL_PTR this_ptr, enum LDKNetwork val);
13287
13288 /**
13289  * The hash and height of the latest block successfully connected.
13290  *
13291  * Used to track on-chain channel funding outputs and send payments with reliable timelocks.
13292  */
13293 struct LDKBestBlock ChainParameters_get_best_block(const struct LDKChainParameters *NONNULL_PTR this_ptr);
13294
13295 /**
13296  * The hash and height of the latest block successfully connected.
13297  *
13298  * Used to track on-chain channel funding outputs and send payments with reliable timelocks.
13299  */
13300 void ChainParameters_set_best_block(struct LDKChainParameters *NONNULL_PTR this_ptr, struct LDKBestBlock val);
13301
13302 /**
13303  * Constructs a new ChainParameters given each field
13304  */
13305 MUST_USE_RES struct LDKChainParameters ChainParameters_new(enum LDKNetwork network_arg, struct LDKBestBlock best_block_arg);
13306
13307 /**
13308  * Creates a copy of the ChainParameters
13309  */
13310 struct LDKChainParameters ChainParameters_clone(const struct LDKChainParameters *NONNULL_PTR orig);
13311
13312 /**
13313  * Frees any resources used by the ChannelCounterparty, if is_owned is set and inner is non-NULL.
13314  */
13315 void ChannelCounterparty_free(struct LDKChannelCounterparty this_obj);
13316
13317 /**
13318  * The node_id of our counterparty
13319  */
13320 struct LDKPublicKey ChannelCounterparty_get_node_id(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
13321
13322 /**
13323  * The node_id of our counterparty
13324  */
13325 void ChannelCounterparty_set_node_id(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKPublicKey val);
13326
13327 /**
13328  * The Features the channel counterparty provided upon last connection.
13329  * Useful for routing as it is the most up-to-date copy of the counterparty's features and
13330  * many routing-relevant features are present in the init context.
13331  */
13332 struct LDKInitFeatures ChannelCounterparty_get_features(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
13333
13334 /**
13335  * The Features the channel counterparty provided upon last connection.
13336  * Useful for routing as it is the most up-to-date copy of the counterparty's features and
13337  * many routing-relevant features are present in the init context.
13338  */
13339 void ChannelCounterparty_set_features(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKInitFeatures val);
13340
13341 /**
13342  * The value, in satoshis, that must always be held in the channel for our counterparty. This
13343  * value ensures that if our counterparty broadcasts a revoked state, we can punish them by
13344  * claiming at least this value on chain.
13345  *
13346  * This value is not included in [`inbound_capacity_msat`] as it can never be spent.
13347  *
13348  * [`inbound_capacity_msat`]: ChannelDetails::inbound_capacity_msat
13349  */
13350 uint64_t ChannelCounterparty_get_unspendable_punishment_reserve(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
13351
13352 /**
13353  * The value, in satoshis, that must always be held in the channel for our counterparty. This
13354  * value ensures that if our counterparty broadcasts a revoked state, we can punish them by
13355  * claiming at least this value on chain.
13356  *
13357  * This value is not included in [`inbound_capacity_msat`] as it can never be spent.
13358  *
13359  * [`inbound_capacity_msat`]: ChannelDetails::inbound_capacity_msat
13360  */
13361 void ChannelCounterparty_set_unspendable_punishment_reserve(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, uint64_t val);
13362
13363 /**
13364  * Creates a copy of the ChannelCounterparty
13365  */
13366 struct LDKChannelCounterparty ChannelCounterparty_clone(const struct LDKChannelCounterparty *NONNULL_PTR orig);
13367
13368 /**
13369  * Frees any resources used by the ChannelDetails, if is_owned is set and inner is non-NULL.
13370  */
13371 void ChannelDetails_free(struct LDKChannelDetails this_obj);
13372
13373 /**
13374  * The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
13375  * thereafter this is the txid of the funding transaction xor the funding transaction output).
13376  * Note that this means this value is *not* persistent - it can change once during the
13377  * lifetime of the channel.
13378  */
13379 const uint8_t (*ChannelDetails_get_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr))[32];
13380
13381 /**
13382  * The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
13383  * thereafter this is the txid of the funding transaction xor the funding transaction output).
13384  * Note that this means this value is *not* persistent - it can change once during the
13385  * lifetime of the channel.
13386  */
13387 void ChannelDetails_set_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
13388
13389 /**
13390  * Parameters which apply to our counterparty. See individual fields for more information.
13391  */
13392 struct LDKChannelCounterparty ChannelDetails_get_counterparty(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
13393
13394 /**
13395  * Parameters which apply to our counterparty. See individual fields for more information.
13396  */
13397 void ChannelDetails_set_counterparty(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKChannelCounterparty val);
13398
13399 /**
13400  * The Channel's funding transaction output, if we've negotiated the funding transaction with
13401  * our counterparty already.
13402  *
13403  * Note that, if this has been set, `channel_id` will be equivalent to
13404  * `funding_txo.unwrap().to_channel_id()`.
13405  */
13406 struct LDKOutPoint ChannelDetails_get_funding_txo(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
13407
13408 /**
13409  * The Channel's funding transaction output, if we've negotiated the funding transaction with
13410  * our counterparty already.
13411  *
13412  * Note that, if this has been set, `channel_id` will be equivalent to
13413  * `funding_txo.unwrap().to_channel_id()`.
13414  */
13415 void ChannelDetails_set_funding_txo(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKOutPoint val);
13416
13417 /**
13418  * The position of the funding transaction in the chain. None if the funding transaction has
13419  * not yet been confirmed and the channel fully opened.
13420  */
13421 struct LDKCOption_u64Z ChannelDetails_get_short_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
13422
13423 /**
13424  * The position of the funding transaction in the chain. None if the funding transaction has
13425  * not yet been confirmed and the channel fully opened.
13426  */
13427 void ChannelDetails_set_short_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
13428
13429 /**
13430  * The value, in satoshis, of this channel as appears in the funding output
13431  */
13432 uint64_t ChannelDetails_get_channel_value_satoshis(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
13433
13434 /**
13435  * The value, in satoshis, of this channel as appears in the funding output
13436  */
13437 void ChannelDetails_set_channel_value_satoshis(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
13438
13439 /**
13440  * The value, in satoshis, that must always be held in the channel for us. This value ensures
13441  * that if we broadcast a revoked state, our counterparty can punish us by claiming at least
13442  * this value on chain.
13443  *
13444  * This value is not included in [`outbound_capacity_msat`] as it can never be spent.
13445  *
13446  * This value will be `None` for outbound channels until the counterparty accepts the channel.
13447  *
13448  * [`outbound_capacity_msat`]: ChannelDetails::outbound_capacity_msat
13449  */
13450 struct LDKCOption_u64Z ChannelDetails_get_unspendable_punishment_reserve(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
13451
13452 /**
13453  * The value, in satoshis, that must always be held in the channel for us. This value ensures
13454  * that if we broadcast a revoked state, our counterparty can punish us by claiming at least
13455  * this value on chain.
13456  *
13457  * This value is not included in [`outbound_capacity_msat`] as it can never be spent.
13458  *
13459  * This value will be `None` for outbound channels until the counterparty accepts the channel.
13460  *
13461  * [`outbound_capacity_msat`]: ChannelDetails::outbound_capacity_msat
13462  */
13463 void ChannelDetails_set_unspendable_punishment_reserve(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
13464
13465 /**
13466  * The user_id passed in to create_channel, or 0 if the channel was inbound.
13467  */
13468 uint64_t ChannelDetails_get_user_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
13469
13470 /**
13471  * The user_id passed in to create_channel, or 0 if the channel was inbound.
13472  */
13473 void ChannelDetails_set_user_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
13474
13475 /**
13476  * The available outbound capacity for sending HTLCs to the remote peer. This does not include
13477  * any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
13478  * available for inclusion in new outbound HTLCs). This further does not include any pending
13479  * outgoing HTLCs which are awaiting some other resolution to be sent.
13480  *
13481  * This value is not exact. Due to various in-flight changes, feerate changes, and our
13482  * conflict-avoidance policy, exactly this amount is not likely to be spendable. However, we
13483  * should be able to spend nearly this amount.
13484  */
13485 uint64_t ChannelDetails_get_outbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
13486
13487 /**
13488  * The available outbound capacity for sending HTLCs to the remote peer. This does not include
13489  * any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
13490  * available for inclusion in new outbound HTLCs). This further does not include any pending
13491  * outgoing HTLCs which are awaiting some other resolution to be sent.
13492  *
13493  * This value is not exact. Due to various in-flight changes, feerate changes, and our
13494  * conflict-avoidance policy, exactly this amount is not likely to be spendable. However, we
13495  * should be able to spend nearly this amount.
13496  */
13497 void ChannelDetails_set_outbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
13498
13499 /**
13500  * The available inbound capacity for the remote peer to send HTLCs to us. This does not
13501  * include any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
13502  * available for inclusion in new inbound HTLCs).
13503  * Note that there are some corner cases not fully handled here, so the actual available
13504  * inbound capacity may be slightly higher than this.
13505  *
13506  * This value is not exact. Due to various in-flight changes, feerate changes, and our
13507  * counterparty's conflict-avoidance policy, exactly this amount is not likely to be spendable.
13508  * However, our counterparty should be able to spend nearly this amount.
13509  */
13510 uint64_t ChannelDetails_get_inbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
13511
13512 /**
13513  * The available inbound capacity for the remote peer to send HTLCs to us. This does not
13514  * include any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
13515  * available for inclusion in new inbound HTLCs).
13516  * Note that there are some corner cases not fully handled here, so the actual available
13517  * inbound capacity may be slightly higher than this.
13518  *
13519  * This value is not exact. Due to various in-flight changes, feerate changes, and our
13520  * counterparty's conflict-avoidance policy, exactly this amount is not likely to be spendable.
13521  * However, our counterparty should be able to spend nearly this amount.
13522  */
13523 void ChannelDetails_set_inbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
13524
13525 /**
13526  * The number of required confirmations on the funding transaction before the funding will be
13527  * considered \"locked\". This number is selected by the channel fundee (i.e. us if
13528  * [`is_outbound`] is *not* set), and can be selected for inbound channels with
13529  * [`ChannelHandshakeConfig::minimum_depth`] or limited for outbound channels with
13530  * [`ChannelHandshakeLimits::max_minimum_depth`].
13531  *
13532  * This value will be `None` for outbound channels until the counterparty accepts the channel.
13533  *
13534  * [`is_outbound`]: ChannelDetails::is_outbound
13535  * [`ChannelHandshakeConfig::minimum_depth`]: crate::util::config::ChannelHandshakeConfig::minimum_depth
13536  * [`ChannelHandshakeLimits::max_minimum_depth`]: crate::util::config::ChannelHandshakeLimits::max_minimum_depth
13537  */
13538 struct LDKCOption_u32Z ChannelDetails_get_confirmations_required(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
13539
13540 /**
13541  * The number of required confirmations on the funding transaction before the funding will be
13542  * considered \"locked\". This number is selected by the channel fundee (i.e. us if
13543  * [`is_outbound`] is *not* set), and can be selected for inbound channels with
13544  * [`ChannelHandshakeConfig::minimum_depth`] or limited for outbound channels with
13545  * [`ChannelHandshakeLimits::max_minimum_depth`].
13546  *
13547  * This value will be `None` for outbound channels until the counterparty accepts the channel.
13548  *
13549  * [`is_outbound`]: ChannelDetails::is_outbound
13550  * [`ChannelHandshakeConfig::minimum_depth`]: crate::util::config::ChannelHandshakeConfig::minimum_depth
13551  * [`ChannelHandshakeLimits::max_minimum_depth`]: crate::util::config::ChannelHandshakeLimits::max_minimum_depth
13552  */
13553 void ChannelDetails_set_confirmations_required(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val);
13554
13555 /**
13556  * The number of blocks (after our commitment transaction confirms) that we will need to wait
13557  * until we can claim our funds after we force-close the channel. During this time our
13558  * counterparty is allowed to punish us if we broadcasted a stale state. If our counterparty
13559  * force-closes the channel and broadcasts a commitment transaction we do not have to wait any
13560  * time to claim our non-HTLC-encumbered funds.
13561  *
13562  * This value will be `None` for outbound channels until the counterparty accepts the channel.
13563  */
13564 struct LDKCOption_u16Z ChannelDetails_get_force_close_spend_delay(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
13565
13566 /**
13567  * The number of blocks (after our commitment transaction confirms) that we will need to wait
13568  * until we can claim our funds after we force-close the channel. During this time our
13569  * counterparty is allowed to punish us if we broadcasted a stale state. If our counterparty
13570  * force-closes the channel and broadcasts a commitment transaction we do not have to wait any
13571  * time to claim our non-HTLC-encumbered funds.
13572  *
13573  * This value will be `None` for outbound channels until the counterparty accepts the channel.
13574  */
13575 void ChannelDetails_set_force_close_spend_delay(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u16Z val);
13576
13577 /**
13578  * True if the channel was initiated (and thus funded) by us.
13579  */
13580 bool ChannelDetails_get_is_outbound(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
13581
13582 /**
13583  * True if the channel was initiated (and thus funded) by us.
13584  */
13585 void ChannelDetails_set_is_outbound(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
13586
13587 /**
13588  * True if the channel is confirmed, funding_locked messages have been exchanged, and the
13589  * channel is not currently being shut down. `funding_locked` message exchange implies the
13590  * required confirmation count has been reached (and we were connected to the peer at some
13591  * point after the funding transaction received enough confirmations). The required
13592  * confirmation count is provided in [`confirmations_required`].
13593  *
13594  * [`confirmations_required`]: ChannelDetails::confirmations_required
13595  */
13596 bool ChannelDetails_get_is_funding_locked(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
13597
13598 /**
13599  * True if the channel is confirmed, funding_locked messages have been exchanged, and the
13600  * channel is not currently being shut down. `funding_locked` message exchange implies the
13601  * required confirmation count has been reached (and we were connected to the peer at some
13602  * point after the funding transaction received enough confirmations). The required
13603  * confirmation count is provided in [`confirmations_required`].
13604  *
13605  * [`confirmations_required`]: ChannelDetails::confirmations_required
13606  */
13607 void ChannelDetails_set_is_funding_locked(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
13608
13609 /**
13610  * True if the channel is (a) confirmed and funding_locked messages have been exchanged, (b)
13611  * the peer is connected, and (c) the channel is not currently negotiating a shutdown.
13612  *
13613  * This is a strict superset of `is_funding_locked`.
13614  */
13615 bool ChannelDetails_get_is_usable(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
13616
13617 /**
13618  * True if the channel is (a) confirmed and funding_locked messages have been exchanged, (b)
13619  * the peer is connected, and (c) the channel is not currently negotiating a shutdown.
13620  *
13621  * This is a strict superset of `is_funding_locked`.
13622  */
13623 void ChannelDetails_set_is_usable(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
13624
13625 /**
13626  * True if this channel is (or will be) publicly-announced.
13627  */
13628 bool ChannelDetails_get_is_public(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
13629
13630 /**
13631  * True if this channel is (or will be) publicly-announced.
13632  */
13633 void ChannelDetails_set_is_public(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
13634
13635 /**
13636  * Constructs a new ChannelDetails given each field
13637  */
13638 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);
13639
13640 /**
13641  * Creates a copy of the ChannelDetails
13642  */
13643 struct LDKChannelDetails ChannelDetails_clone(const struct LDKChannelDetails *NONNULL_PTR orig);
13644
13645 /**
13646  * Frees any resources used by the PaymentSendFailure
13647  */
13648 void PaymentSendFailure_free(struct LDKPaymentSendFailure this_ptr);
13649
13650 /**
13651  * Creates a copy of the PaymentSendFailure
13652  */
13653 struct LDKPaymentSendFailure PaymentSendFailure_clone(const struct LDKPaymentSendFailure *NONNULL_PTR orig);
13654
13655 /**
13656  * Constructs a new ChannelManager to hold several channels and route between them.
13657  *
13658  * This is the main \"logic hub\" for all channel-related actions, and implements
13659  * ChannelMessageHandler.
13660  *
13661  * Non-proportional fees are fixed according to our risk using the provided fee estimator.
13662  *
13663  * panics if channel_value_satoshis is >= `MAX_FUNDING_SATOSHIS`!
13664  *
13665  * Users need to notify the new ChannelManager when a new block is connected or
13666  * disconnected using its `block_connected` and `block_disconnected` methods, starting
13667  * from after `params.latest_hash`.
13668  */
13669 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);
13670
13671 /**
13672  * Gets the current configuration applied to all new channels,  as
13673  */
13674 MUST_USE_RES struct LDKUserConfig ChannelManager_get_current_default_configuration(const struct LDKChannelManager *NONNULL_PTR this_arg);
13675
13676 /**
13677  * Creates a new outbound channel to the given remote node and with the given value.
13678  *
13679  * user_id will be provided back as user_channel_id in FundingGenerationReady events to allow
13680  * tracking of which events correspond with which create_channel call. Note that the
13681  * user_channel_id defaults to 0 for inbound channels, so you may wish to avoid using 0 for
13682  * user_id here. user_id has no meaning inside of LDK, it is simply copied to events and
13683  * otherwise ignored.
13684  *
13685  * If successful, will generate a SendOpenChannel message event, so you should probably poll
13686  * PeerManager::process_events afterwards.
13687  *
13688  * Raises APIError::APIMisuseError when channel_value_satoshis > 2**24 or push_msat is
13689  * greater than channel_value_satoshis * 1k or channel_value_satoshis is < 1000.
13690  *
13691  * Note that we do not check if you are currently connected to the given peer. If no
13692  * connection is available, the outbound `open_channel` message may fail to send, resulting in
13693  * the channel eventually being silently forgotten.
13694  */
13695 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);
13696
13697 /**
13698  * Gets the list of open channels, in random order. See ChannelDetail field documentation for
13699  * more information.
13700  */
13701 MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
13702
13703 /**
13704  * Gets the list of usable channels, in random order. Useful as an argument to
13705  * get_route to ensure non-announced channels are used.
13706  *
13707  * These are guaranteed to have their [`ChannelDetails::is_usable`] value set to true, see the
13708  * documentation for [`ChannelDetails::is_usable`] for more info on exactly what the criteria
13709  * are.
13710  */
13711 MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_usable_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
13712
13713 /**
13714  * Begins the process of closing a channel. After this call (plus some timeout), no new HTLCs
13715  * will be accepted on the given channel, and after additional timeout/the closing of all
13716  * pending HTLCs, the channel will be closed on chain.
13717  *
13718  * May generate a SendShutdown message event on success, which should be relayed.
13719  */
13720 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_close_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32]);
13721
13722 /**
13723  * Force closes a channel, immediately broadcasting the latest local commitment transaction to
13724  * the chain and rejecting new HTLCs on the given channel. Fails if channel_id is unknown to the manager.
13725  */
13726 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_force_close_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32]);
13727
13728 /**
13729  * Force close all channels, immediately broadcasting the latest local commitment transaction
13730  * for each to the chain and rejecting new HTLCs on each.
13731  */
13732 void ChannelManager_force_close_all_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
13733
13734 /**
13735  * Sends a payment along a given route.
13736  *
13737  * Value parameters are provided via the last hop in route, see documentation for RouteHop
13738  * fields for more info.
13739  *
13740  * Note that if the payment_hash already exists elsewhere (eg you're sending a duplicative
13741  * payment), we don't do anything to stop you! We always try to ensure that if the provided
13742  * next hop knows the preimage to payment_hash they can claim an additional amount as
13743  * specified in the last hop in the route! Thus, you should probably do your own
13744  * payment_preimage tracking (which you should already be doing as they represent \"proof of
13745  * payment\") and prevent double-sends yourself.
13746  *
13747  * May generate SendHTLCs message(s) event on success, which should be relayed.
13748  *
13749  * Each path may have a different return value, and PaymentSendValue may return a Vec with
13750  * each entry matching the corresponding-index entry in the route paths, see
13751  * PaymentSendFailure for more info.
13752  *
13753  * In general, a path may raise:
13754  *  * APIError::RouteError when an invalid route or forwarding parameter (cltv_delta, fee,
13755  *    node public key) is specified.
13756  *  * APIError::ChannelUnavailable if the next-hop channel is not available for updates
13757  *    (including due to previous monitor update failure or new permanent monitor update
13758  *    failure).
13759  *  * APIError::MonitorUpdateFailed if a new monitor update failure prevented sending the
13760  *    relevant updates.
13761  *
13762  * Note that depending on the type of the PaymentSendFailure the HTLC may have been
13763  * irrevocably committed to on our end. In such a case, do NOT retry the payment with a
13764  * different route unless you intend to pay twice!
13765  *
13766  * payment_secret is unrelated to payment_hash (or PaymentPreimage) and exists to authenticate
13767  * the sender to the recipient and prevent payment-probing (deanonymization) attacks. For
13768  * newer nodes, it will be provided to you in the invoice. If you do not have one, the Route
13769  * must not contain multiple paths as multi-path payments require a recipient-provided
13770  * payment_secret.
13771  * If a payment_secret *is* provided, we assume that the invoice had the payment_secret feature
13772  * bit set (either as required or as available). If multiple paths are present in the Route,
13773  * we assume the invoice had the basic_mpp feature set.
13774  */
13775 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);
13776
13777 /**
13778  * Send a spontaneous payment, which is a payment that does not require the recipient to have
13779  * generated an invoice. Optionally, you may specify the preimage. If you do choose to specify
13780  * the preimage, it must be a cryptographically secure random value that no intermediate node
13781  * would be able to guess -- otherwise, an intermediate node may claim the payment and it will
13782  * never reach the recipient.
13783  *
13784  * Similar to regular payments, you MUST NOT reuse a `payment_preimage` value. See
13785  * [`send_payment`] for more information about the risks of duplicate preimage usage.
13786  *
13787  * [`send_payment`]: Self::send_payment
13788  */
13789 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);
13790
13791 /**
13792  * Call this upon creation of a funding transaction for the given channel.
13793  *
13794  * Returns an [`APIError::APIMisuseError`] if the funding_transaction spent non-SegWit outputs
13795  * or if no output was found which matches the parameters in [`Event::FundingGenerationReady`].
13796  *
13797  * Panics if a funding transaction has already been provided for this channel.
13798  *
13799  * May panic if the output found in the funding transaction is duplicative with some other
13800  * channel (note that this should be trivially prevented by using unique funding transaction
13801  * keys per-channel).
13802  *
13803  * Do NOT broadcast the funding transaction yourself. When we have safely received our
13804  * counterparty's signature the funding transaction will automatically be broadcast via the
13805  * [`BroadcasterInterface`] provided when this `ChannelManager` was constructed.
13806  *
13807  * Note that this includes RBF or similar transaction replacement strategies - lightning does
13808  * not currently support replacing a funding transaction on an existing channel. Instead,
13809  * create a new channel with a conflicting funding transaction.
13810  *
13811  * [`Event::FundingGenerationReady`]: crate::util::events::Event::FundingGenerationReady
13812  */
13813 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);
13814
13815 /**
13816  * Regenerates channel_announcements and generates a signed node_announcement from the given
13817  * arguments, providing them in corresponding events via
13818  * [`get_and_clear_pending_msg_events`], if at least one public channel has been confirmed
13819  * on-chain. This effectively re-broadcasts all channel announcements and sends our node
13820  * announcement to ensure that the lightning P2P network is aware of the channels we have and
13821  * our network addresses.
13822  *
13823  * `rgb` is a node \"color\" and `alias` is a printable human-readable string to describe this
13824  * node to humans. They carry no in-protocol meaning.
13825  *
13826  * `addresses` represent the set (possibly empty) of socket addresses on which this node
13827  * accepts incoming connections. These will be included in the node_announcement, publicly
13828  * tying these addresses together and to this node. If you wish to preserve user privacy,
13829  * addresses should likely contain only Tor Onion addresses.
13830  *
13831  * Panics if `addresses` is absurdly large (more than 500).
13832  *
13833  * [`get_and_clear_pending_msg_events`]: MessageSendEventsProvider::get_and_clear_pending_msg_events
13834  */
13835 void ChannelManager_broadcast_node_announcement(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThreeBytes rgb, struct LDKThirtyTwoBytes alias, struct LDKCVec_NetAddressZ addresses);
13836
13837 /**
13838  * Processes HTLCs which are pending waiting on random forward delay.
13839  *
13840  * Should only really ever be called in response to a PendingHTLCsForwardable event.
13841  * Will likely generate further events.
13842  */
13843 void ChannelManager_process_pending_htlc_forwards(const struct LDKChannelManager *NONNULL_PTR this_arg);
13844
13845 /**
13846  * If a peer is disconnected we mark any channels with that peer as 'disabled'.
13847  * After some time, if channels are still disabled we need to broadcast a ChannelUpdate
13848  * to inform the network about the uselessness of these channels.
13849  *
13850  * This method handles all the details, and must be called roughly once per minute.
13851  *
13852  * Note that in some rare cases this may generate a `chain::Watch::update_channel` call.
13853  */
13854 void ChannelManager_timer_tick_occurred(const struct LDKChannelManager *NONNULL_PTR this_arg);
13855
13856 /**
13857  * Indicates that the preimage for payment_hash is unknown or the received amount is incorrect
13858  * after a PaymentReceived event, failing the HTLC back to its origin and freeing resources
13859  * along the path (including in our own channel on which we received it).
13860  * Returns false if no payment was found to fail backwards, true if the process of failing the
13861  * HTLC backwards has been started.
13862  */
13863 MUST_USE_RES bool ChannelManager_fail_htlc_backwards(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*payment_hash)[32]);
13864
13865 /**
13866  * Provides a payment preimage in response to a PaymentReceived event, returning true and
13867  * generating message events for the net layer to claim the payment, if possible. Thus, you
13868  * should probably kick the net layer to go send messages if this returns true!
13869  *
13870  * Note that if you did not set an `amount_msat` when calling [`create_inbound_payment`] or
13871  * [`create_inbound_payment_for_hash`] you must check that the amount in the `PaymentReceived`
13872  * event matches your expectation. If you fail to do so and call this method, you may provide
13873  * the sender \"proof-of-payment\" when they did not fulfill the full expected payment.
13874  *
13875  * May panic if called except in response to a PaymentReceived event.
13876  *
13877  * [`create_inbound_payment`]: Self::create_inbound_payment
13878  * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash
13879  */
13880 MUST_USE_RES bool ChannelManager_claim_funds(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_preimage);
13881
13882 /**
13883  * Gets the node_id held by this ChannelManager
13884  */
13885 MUST_USE_RES struct LDKPublicKey ChannelManager_get_our_node_id(const struct LDKChannelManager *NONNULL_PTR this_arg);
13886
13887 /**
13888  * Restores a single, given channel to normal operation after a
13889  * ChannelMonitorUpdateErr::TemporaryFailure was returned from a channel monitor update
13890  * operation.
13891  *
13892  * All ChannelMonitor updates up to and including highest_applied_update_id must have been
13893  * fully committed in every copy of the given channels' ChannelMonitors.
13894  *
13895  * Note that there is no effect to calling with a highest_applied_update_id other than the
13896  * current latest ChannelMonitorUpdate and one call to this function after multiple
13897  * ChannelMonitorUpdateErr::TemporaryFailures is fine. The highest_applied_update_id field
13898  * exists largely only to prevent races between this and concurrent update_monitor calls.
13899  *
13900  * Thus, the anticipated use is, at a high level:
13901  *  1) You register a chain::Watch with this ChannelManager,
13902  *  2) it stores each update to disk, and begins updating any remote (eg watchtower) copies of
13903  *     said ChannelMonitors as it can, returning ChannelMonitorUpdateErr::TemporaryFailures
13904  *     any time it cannot do so instantly,
13905  *  3) update(s) are applied to each remote copy of a ChannelMonitor,
13906  *  4) once all remote copies are updated, you call this function with the update_id that
13907  *     completed, and once it is the latest the Channel will be re-enabled.
13908  */
13909 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);
13910
13911 /**
13912  * Gets a payment secret and payment hash for use in an invoice given to a third party wishing
13913  * to pay us.
13914  *
13915  * This differs from [`create_inbound_payment_for_hash`] only in that it generates the
13916  * [`PaymentHash`] and [`PaymentPreimage`] for you, returning the first and storing the second.
13917  *
13918  * The [`PaymentPreimage`] will ultimately be returned to you in the [`PaymentReceived`], which
13919  * will have the [`PaymentReceived::payment_preimage`] field filled in. That should then be
13920  * passed directly to [`claim_funds`].
13921  *
13922  * See [`create_inbound_payment_for_hash`] for detailed documentation on behavior and requirements.
13923  *
13924  * [`claim_funds`]: Self::claim_funds
13925  * [`PaymentReceived`]: events::Event::PaymentReceived
13926  * [`PaymentReceived::payment_preimage`]: events::Event::PaymentReceived::payment_preimage
13927  * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash
13928  */
13929 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);
13930
13931 /**
13932  * Gets a [`PaymentSecret`] for a given [`PaymentHash`], for which the payment preimage is
13933  * stored external to LDK.
13934  *
13935  * A [`PaymentReceived`] event will only be generated if the [`PaymentSecret`] matches a
13936  * payment secret fetched via this method or [`create_inbound_payment`], and which is at least
13937  * the `min_value_msat` provided here, if one is provided.
13938  *
13939  * The [`PaymentHash`] (and corresponding [`PaymentPreimage`]) must be globally unique. This
13940  * method may return an Err if another payment with the same payment_hash is still pending.
13941  *
13942  * `user_payment_id` will be provided back in [`PaymentPurpose::InvoicePayment::user_payment_id`] events to
13943  * allow tracking of which events correspond with which calls to this and
13944  * [`create_inbound_payment`]. `user_payment_id` has no meaning inside of LDK, it is simply
13945  * copied to events and otherwise ignored. It may be used to correlate PaymentReceived events
13946  * with invoice metadata stored elsewhere.
13947  *
13948  * `min_value_msat` should be set if the invoice being generated contains a value. Any payment
13949  * received for the returned [`PaymentHash`] will be required to be at least `min_value_msat`
13950  * before a [`PaymentReceived`] event will be generated, ensuring that we do not provide the
13951  * sender \"proof-of-payment\" unless they have paid the required amount.
13952  *
13953  * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
13954  * in excess of the current time. This should roughly match the expiry time set in the invoice.
13955  * After this many seconds, we will remove the inbound payment, resulting in any attempts to
13956  * pay the invoice failing. The BOLT spec suggests 3,600 secs as a default validity time for
13957  * invoices when no timeout is set.
13958  *
13959  * Note that we use block header time to time-out pending inbound payments (with some margin
13960  * to compensate for the inaccuracy of block header timestamps). Thus, in practice we will
13961  * accept a payment and generate a [`PaymentReceived`] event for some time after the expiry.
13962  * If you need exact expiry semantics, you should enforce them upon receipt of
13963  * [`PaymentReceived`].
13964  *
13965  * Pending inbound payments are stored in memory and in serialized versions of this
13966  * [`ChannelManager`]. If potentially unbounded numbers of inbound payments may exist and
13967  * space is limited, you may wish to rate-limit inbound payment creation.
13968  *
13969  * May panic if `invoice_expiry_delta_secs` is greater than one year.
13970  *
13971  * Note that invoices generated for inbound payments should have their `min_final_cltv_expiry`
13972  * set to at least [`MIN_FINAL_CLTV_EXPIRY`].
13973  *
13974  * [`create_inbound_payment`]: Self::create_inbound_payment
13975  * [`PaymentReceived`]: events::Event::PaymentReceived
13976  * [`PaymentPurpose::InvoicePayment::user_payment_id`]: events::PaymentPurpose::InvoicePayment::user_payment_id
13977  */
13978 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);
13979
13980 /**
13981  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
13982  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
13983  */
13984 struct LDKMessageSendEventsProvider ChannelManager_as_MessageSendEventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg);
13985
13986 /**
13987  * Constructs a new EventsProvider which calls the relevant methods on this_arg.
13988  * This copies the `inner` pointer in this_arg and thus the returned EventsProvider must be freed before this_arg is
13989  */
13990 struct LDKEventsProvider ChannelManager_as_EventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg);
13991
13992 /**
13993  * Constructs a new Listen which calls the relevant methods on this_arg.
13994  * This copies the `inner` pointer in this_arg and thus the returned Listen must be freed before this_arg is
13995  */
13996 struct LDKListen ChannelManager_as_Listen(const struct LDKChannelManager *NONNULL_PTR this_arg);
13997
13998 /**
13999  * Constructs a new Confirm which calls the relevant methods on this_arg.
14000  * This copies the `inner` pointer in this_arg and thus the returned Confirm must be freed before this_arg is
14001  */
14002 struct LDKConfirm ChannelManager_as_Confirm(const struct LDKChannelManager *NONNULL_PTR this_arg);
14003
14004 /**
14005  * Blocks until ChannelManager needs to be persisted or a timeout is reached. It returns a bool
14006  * indicating whether persistence is necessary. Only one listener on
14007  * `await_persistable_update` or `await_persistable_update_timeout` is guaranteed to be woken
14008  * up.
14009  * Note that the feature `allow_wallclock_use` must be enabled to use this function.
14010  */
14011 MUST_USE_RES bool ChannelManager_await_persistable_update_timeout(const struct LDKChannelManager *NONNULL_PTR this_arg, uint64_t max_wait);
14012
14013 /**
14014  * Blocks until ChannelManager needs to be persisted. Only one listener on
14015  * `await_persistable_update` or `await_persistable_update_timeout` is guaranteed to be woken
14016  * up.
14017  */
14018 void ChannelManager_await_persistable_update(const struct LDKChannelManager *NONNULL_PTR this_arg);
14019
14020 /**
14021  * Gets the latest best block which was connected either via the [`chain::Listen`] or
14022  * [`chain::Confirm`] interfaces.
14023  */
14024 MUST_USE_RES struct LDKBestBlock ChannelManager_current_best_block(const struct LDKChannelManager *NONNULL_PTR this_arg);
14025
14026 /**
14027  * Constructs a new ChannelMessageHandler which calls the relevant methods on this_arg.
14028  * This copies the `inner` pointer in this_arg and thus the returned ChannelMessageHandler must be freed before this_arg is
14029  */
14030 struct LDKChannelMessageHandler ChannelManager_as_ChannelMessageHandler(const struct LDKChannelManager *NONNULL_PTR this_arg);
14031
14032 /**
14033  * Serialize the ChannelManager object into a byte array which can be read by ChannelManager_read
14034  */
14035 struct LDKCVec_u8Z ChannelManager_write(const struct LDKChannelManager *NONNULL_PTR obj);
14036
14037 /**
14038  * Frees any resources used by the ChannelManagerReadArgs, if is_owned is set and inner is non-NULL.
14039  */
14040 void ChannelManagerReadArgs_free(struct LDKChannelManagerReadArgs this_obj);
14041
14042 /**
14043  * The keys provider which will give us relevant keys. Some keys will be loaded during
14044  * deserialization and KeysInterface::read_chan_signer will be used to read per-Channel
14045  * signing data.
14046  */
14047 const struct LDKKeysInterface *ChannelManagerReadArgs_get_keys_manager(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
14048
14049 /**
14050  * The keys provider which will give us relevant keys. Some keys will be loaded during
14051  * deserialization and KeysInterface::read_chan_signer will be used to read per-Channel
14052  * signing data.
14053  */
14054 void ChannelManagerReadArgs_set_keys_manager(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKKeysInterface val);
14055
14056 /**
14057  * The fee_estimator for use in the ChannelManager in the future.
14058  *
14059  * No calls to the FeeEstimator will be made during deserialization.
14060  */
14061 const struct LDKFeeEstimator *ChannelManagerReadArgs_get_fee_estimator(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
14062
14063 /**
14064  * The fee_estimator for use in the ChannelManager in the future.
14065  *
14066  * No calls to the FeeEstimator will be made during deserialization.
14067  */
14068 void ChannelManagerReadArgs_set_fee_estimator(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKFeeEstimator val);
14069
14070 /**
14071  * The chain::Watch for use in the ChannelManager in the future.
14072  *
14073  * No calls to the chain::Watch will be made during deserialization. It is assumed that
14074  * you have deserialized ChannelMonitors separately and will add them to your
14075  * chain::Watch after deserializing this ChannelManager.
14076  */
14077 const struct LDKWatch *ChannelManagerReadArgs_get_chain_monitor(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
14078
14079 /**
14080  * The chain::Watch for use in the ChannelManager in the future.
14081  *
14082  * No calls to the chain::Watch will be made during deserialization. It is assumed that
14083  * you have deserialized ChannelMonitors separately and will add them to your
14084  * chain::Watch after deserializing this ChannelManager.
14085  */
14086 void ChannelManagerReadArgs_set_chain_monitor(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKWatch val);
14087
14088 /**
14089  * The BroadcasterInterface which will be used in the ChannelManager in the future and may be
14090  * used to broadcast the latest local commitment transactions of channels which must be
14091  * force-closed during deserialization.
14092  */
14093 const struct LDKBroadcasterInterface *ChannelManagerReadArgs_get_tx_broadcaster(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
14094
14095 /**
14096  * The BroadcasterInterface which will be used in the ChannelManager in the future and may be
14097  * used to broadcast the latest local commitment transactions of channels which must be
14098  * force-closed during deserialization.
14099  */
14100 void ChannelManagerReadArgs_set_tx_broadcaster(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKBroadcasterInterface val);
14101
14102 /**
14103  * The Logger for use in the ChannelManager and which may be used to log information during
14104  * deserialization.
14105  */
14106 const struct LDKLogger *ChannelManagerReadArgs_get_logger(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
14107
14108 /**
14109  * The Logger for use in the ChannelManager and which may be used to log information during
14110  * deserialization.
14111  */
14112 void ChannelManagerReadArgs_set_logger(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKLogger val);
14113
14114 /**
14115  * Default settings used for new channels. Any existing channels will continue to use the
14116  * runtime settings which were stored when the ChannelManager was serialized.
14117  */
14118 struct LDKUserConfig ChannelManagerReadArgs_get_default_config(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
14119
14120 /**
14121  * Default settings used for new channels. Any existing channels will continue to use the
14122  * runtime settings which were stored when the ChannelManager was serialized.
14123  */
14124 void ChannelManagerReadArgs_set_default_config(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKUserConfig val);
14125
14126 /**
14127  * Simple utility function to create a ChannelManagerReadArgs which creates the monitor
14128  * HashMap for you. This is primarily useful for C bindings where it is not practical to
14129  * populate a HashMap directly from C.
14130  */
14131 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);
14132
14133 /**
14134  * Read a C2Tuple_BlockHashChannelManagerZ from a byte array, created by C2Tuple_BlockHashChannelManagerZ_write
14135  */
14136 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ C2Tuple_BlockHashChannelManagerZ_read(struct LDKu8slice ser, struct LDKChannelManagerReadArgs arg);
14137
14138 /**
14139  * Frees any resources used by the DecodeError, if is_owned is set and inner is non-NULL.
14140  */
14141 void DecodeError_free(struct LDKDecodeError this_obj);
14142
14143 /**
14144  * Creates a copy of the DecodeError
14145  */
14146 struct LDKDecodeError DecodeError_clone(const struct LDKDecodeError *NONNULL_PTR orig);
14147
14148 /**
14149  * Frees any resources used by the Init, if is_owned is set and inner is non-NULL.
14150  */
14151 void Init_free(struct LDKInit this_obj);
14152
14153 /**
14154  * The relevant features which the sender supports
14155  */
14156 struct LDKInitFeatures Init_get_features(const struct LDKInit *NONNULL_PTR this_ptr);
14157
14158 /**
14159  * The relevant features which the sender supports
14160  */
14161 void Init_set_features(struct LDKInit *NONNULL_PTR this_ptr, struct LDKInitFeatures val);
14162
14163 /**
14164  * Constructs a new Init given each field
14165  */
14166 MUST_USE_RES struct LDKInit Init_new(struct LDKInitFeatures features_arg);
14167
14168 /**
14169  * Creates a copy of the Init
14170  */
14171 struct LDKInit Init_clone(const struct LDKInit *NONNULL_PTR orig);
14172
14173 /**
14174  * Frees any resources used by the ErrorMessage, if is_owned is set and inner is non-NULL.
14175  */
14176 void ErrorMessage_free(struct LDKErrorMessage this_obj);
14177
14178 /**
14179  * The channel ID involved in the error
14180  */
14181 const uint8_t (*ErrorMessage_get_channel_id(const struct LDKErrorMessage *NONNULL_PTR this_ptr))[32];
14182
14183 /**
14184  * The channel ID involved in the error
14185  */
14186 void ErrorMessage_set_channel_id(struct LDKErrorMessage *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14187
14188 /**
14189  * A possibly human-readable error description.
14190  * The string should be sanitized before it is used (e.g. emitted to logs
14191  * or printed to stdout).  Otherwise, a well crafted error message may trigger a security
14192  * vulnerability in the terminal emulator or the logging subsystem.
14193  */
14194 struct LDKStr ErrorMessage_get_data(const struct LDKErrorMessage *NONNULL_PTR this_ptr);
14195
14196 /**
14197  * A possibly human-readable error description.
14198  * The string should be sanitized before it is used (e.g. emitted to logs
14199  * or printed to stdout).  Otherwise, a well crafted error message may trigger a security
14200  * vulnerability in the terminal emulator or the logging subsystem.
14201  */
14202 void ErrorMessage_set_data(struct LDKErrorMessage *NONNULL_PTR this_ptr, struct LDKStr val);
14203
14204 /**
14205  * Constructs a new ErrorMessage given each field
14206  */
14207 MUST_USE_RES struct LDKErrorMessage ErrorMessage_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKStr data_arg);
14208
14209 /**
14210  * Creates a copy of the ErrorMessage
14211  */
14212 struct LDKErrorMessage ErrorMessage_clone(const struct LDKErrorMessage *NONNULL_PTR orig);
14213
14214 /**
14215  * Frees any resources used by the Ping, if is_owned is set and inner is non-NULL.
14216  */
14217 void Ping_free(struct LDKPing this_obj);
14218
14219 /**
14220  * The desired response length
14221  */
14222 uint16_t Ping_get_ponglen(const struct LDKPing *NONNULL_PTR this_ptr);
14223
14224 /**
14225  * The desired response length
14226  */
14227 void Ping_set_ponglen(struct LDKPing *NONNULL_PTR this_ptr, uint16_t val);
14228
14229 /**
14230  * The ping packet size.
14231  * This field is not sent on the wire. byteslen zeros are sent.
14232  */
14233 uint16_t Ping_get_byteslen(const struct LDKPing *NONNULL_PTR this_ptr);
14234
14235 /**
14236  * The ping packet size.
14237  * This field is not sent on the wire. byteslen zeros are sent.
14238  */
14239 void Ping_set_byteslen(struct LDKPing *NONNULL_PTR this_ptr, uint16_t val);
14240
14241 /**
14242  * Constructs a new Ping given each field
14243  */
14244 MUST_USE_RES struct LDKPing Ping_new(uint16_t ponglen_arg, uint16_t byteslen_arg);
14245
14246 /**
14247  * Creates a copy of the Ping
14248  */
14249 struct LDKPing Ping_clone(const struct LDKPing *NONNULL_PTR orig);
14250
14251 /**
14252  * Frees any resources used by the Pong, if is_owned is set and inner is non-NULL.
14253  */
14254 void Pong_free(struct LDKPong this_obj);
14255
14256 /**
14257  * The pong packet size.
14258  * This field is not sent on the wire. byteslen zeros are sent.
14259  */
14260 uint16_t Pong_get_byteslen(const struct LDKPong *NONNULL_PTR this_ptr);
14261
14262 /**
14263  * The pong packet size.
14264  * This field is not sent on the wire. byteslen zeros are sent.
14265  */
14266 void Pong_set_byteslen(struct LDKPong *NONNULL_PTR this_ptr, uint16_t val);
14267
14268 /**
14269  * Constructs a new Pong given each field
14270  */
14271 MUST_USE_RES struct LDKPong Pong_new(uint16_t byteslen_arg);
14272
14273 /**
14274  * Creates a copy of the Pong
14275  */
14276 struct LDKPong Pong_clone(const struct LDKPong *NONNULL_PTR orig);
14277
14278 /**
14279  * Frees any resources used by the OpenChannel, if is_owned is set and inner is non-NULL.
14280  */
14281 void OpenChannel_free(struct LDKOpenChannel this_obj);
14282
14283 /**
14284  * The genesis hash of the blockchain where the channel is to be opened
14285  */
14286 const uint8_t (*OpenChannel_get_chain_hash(const struct LDKOpenChannel *NONNULL_PTR this_ptr))[32];
14287
14288 /**
14289  * The genesis hash of the blockchain where the channel is to be opened
14290  */
14291 void OpenChannel_set_chain_hash(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14292
14293 /**
14294  * A temporary channel ID, until the funding outpoint is announced
14295  */
14296 const uint8_t (*OpenChannel_get_temporary_channel_id(const struct LDKOpenChannel *NONNULL_PTR this_ptr))[32];
14297
14298 /**
14299  * A temporary channel ID, until the funding outpoint is announced
14300  */
14301 void OpenChannel_set_temporary_channel_id(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14302
14303 /**
14304  * The channel value
14305  */
14306 uint64_t OpenChannel_get_funding_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
14307
14308 /**
14309  * The channel value
14310  */
14311 void OpenChannel_set_funding_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
14312
14313 /**
14314  * The amount to push to the counterparty as part of the open, in milli-satoshi
14315  */
14316 uint64_t OpenChannel_get_push_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
14317
14318 /**
14319  * The amount to push to the counterparty as part of the open, in milli-satoshi
14320  */
14321 void OpenChannel_set_push_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
14322
14323 /**
14324  * The threshold below which outputs on transactions broadcast by sender will be omitted
14325  */
14326 uint64_t OpenChannel_get_dust_limit_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
14327
14328 /**
14329  * The threshold below which outputs on transactions broadcast by sender will be omitted
14330  */
14331 void OpenChannel_set_dust_limit_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
14332
14333 /**
14334  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
14335  */
14336 uint64_t OpenChannel_get_max_htlc_value_in_flight_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
14337
14338 /**
14339  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
14340  */
14341 void OpenChannel_set_max_htlc_value_in_flight_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
14342
14343 /**
14344  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
14345  */
14346 uint64_t OpenChannel_get_channel_reserve_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
14347
14348 /**
14349  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
14350  */
14351 void OpenChannel_set_channel_reserve_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
14352
14353 /**
14354  * The minimum HTLC size incoming to sender, in milli-satoshi
14355  */
14356 uint64_t OpenChannel_get_htlc_minimum_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
14357
14358 /**
14359  * The minimum HTLC size incoming to sender, in milli-satoshi
14360  */
14361 void OpenChannel_set_htlc_minimum_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
14362
14363 /**
14364  * The feerate per 1000-weight of sender generated transactions, until updated by update_fee
14365  */
14366 uint32_t OpenChannel_get_feerate_per_kw(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
14367
14368 /**
14369  * The feerate per 1000-weight of sender generated transactions, until updated by update_fee
14370  */
14371 void OpenChannel_set_feerate_per_kw(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint32_t val);
14372
14373 /**
14374  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
14375  */
14376 uint16_t OpenChannel_get_to_self_delay(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
14377
14378 /**
14379  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
14380  */
14381 void OpenChannel_set_to_self_delay(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint16_t val);
14382
14383 /**
14384  * The maximum number of inbound HTLCs towards sender
14385  */
14386 uint16_t OpenChannel_get_max_accepted_htlcs(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
14387
14388 /**
14389  * The maximum number of inbound HTLCs towards sender
14390  */
14391 void OpenChannel_set_max_accepted_htlcs(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint16_t val);
14392
14393 /**
14394  * The sender's key controlling the funding transaction
14395  */
14396 struct LDKPublicKey OpenChannel_get_funding_pubkey(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
14397
14398 /**
14399  * The sender's key controlling the funding transaction
14400  */
14401 void OpenChannel_set_funding_pubkey(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14402
14403 /**
14404  * Used to derive a revocation key for transactions broadcast by counterparty
14405  */
14406 struct LDKPublicKey OpenChannel_get_revocation_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
14407
14408 /**
14409  * Used to derive a revocation key for transactions broadcast by counterparty
14410  */
14411 void OpenChannel_set_revocation_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14412
14413 /**
14414  * A payment key to sender for transactions broadcast by counterparty
14415  */
14416 struct LDKPublicKey OpenChannel_get_payment_point(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
14417
14418 /**
14419  * A payment key to sender for transactions broadcast by counterparty
14420  */
14421 void OpenChannel_set_payment_point(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14422
14423 /**
14424  * Used to derive a payment key to sender for transactions broadcast by sender
14425  */
14426 struct LDKPublicKey OpenChannel_get_delayed_payment_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
14427
14428 /**
14429  * Used to derive a payment key to sender for transactions broadcast by sender
14430  */
14431 void OpenChannel_set_delayed_payment_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14432
14433 /**
14434  * Used to derive an HTLC payment key to sender
14435  */
14436 struct LDKPublicKey OpenChannel_get_htlc_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
14437
14438 /**
14439  * Used to derive an HTLC payment key to sender
14440  */
14441 void OpenChannel_set_htlc_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14442
14443 /**
14444  * The first to-be-broadcast-by-sender transaction's per commitment point
14445  */
14446 struct LDKPublicKey OpenChannel_get_first_per_commitment_point(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
14447
14448 /**
14449  * The first to-be-broadcast-by-sender transaction's per commitment point
14450  */
14451 void OpenChannel_set_first_per_commitment_point(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14452
14453 /**
14454  * Channel flags
14455  */
14456 uint8_t OpenChannel_get_channel_flags(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
14457
14458 /**
14459  * Channel flags
14460  */
14461 void OpenChannel_set_channel_flags(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint8_t val);
14462
14463 /**
14464  * Creates a copy of the OpenChannel
14465  */
14466 struct LDKOpenChannel OpenChannel_clone(const struct LDKOpenChannel *NONNULL_PTR orig);
14467
14468 /**
14469  * Frees any resources used by the AcceptChannel, if is_owned is set and inner is non-NULL.
14470  */
14471 void AcceptChannel_free(struct LDKAcceptChannel this_obj);
14472
14473 /**
14474  * A temporary channel ID, until the funding outpoint is announced
14475  */
14476 const uint8_t (*AcceptChannel_get_temporary_channel_id(const struct LDKAcceptChannel *NONNULL_PTR this_ptr))[32];
14477
14478 /**
14479  * A temporary channel ID, until the funding outpoint is announced
14480  */
14481 void AcceptChannel_set_temporary_channel_id(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14482
14483 /**
14484  * The threshold below which outputs on transactions broadcast by sender will be omitted
14485  */
14486 uint64_t AcceptChannel_get_dust_limit_satoshis(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
14487
14488 /**
14489  * The threshold below which outputs on transactions broadcast by sender will be omitted
14490  */
14491 void AcceptChannel_set_dust_limit_satoshis(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
14492
14493 /**
14494  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
14495  */
14496 uint64_t AcceptChannel_get_max_htlc_value_in_flight_msat(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
14497
14498 /**
14499  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
14500  */
14501 void AcceptChannel_set_max_htlc_value_in_flight_msat(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
14502
14503 /**
14504  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
14505  */
14506 uint64_t AcceptChannel_get_channel_reserve_satoshis(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
14507
14508 /**
14509  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
14510  */
14511 void AcceptChannel_set_channel_reserve_satoshis(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
14512
14513 /**
14514  * The minimum HTLC size incoming to sender, in milli-satoshi
14515  */
14516 uint64_t AcceptChannel_get_htlc_minimum_msat(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
14517
14518 /**
14519  * The minimum HTLC size incoming to sender, in milli-satoshi
14520  */
14521 void AcceptChannel_set_htlc_minimum_msat(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
14522
14523 /**
14524  * Minimum depth of the funding transaction before the channel is considered open
14525  */
14526 uint32_t AcceptChannel_get_minimum_depth(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
14527
14528 /**
14529  * Minimum depth of the funding transaction before the channel is considered open
14530  */
14531 void AcceptChannel_set_minimum_depth(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint32_t val);
14532
14533 /**
14534  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
14535  */
14536 uint16_t AcceptChannel_get_to_self_delay(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
14537
14538 /**
14539  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
14540  */
14541 void AcceptChannel_set_to_self_delay(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint16_t val);
14542
14543 /**
14544  * The maximum number of inbound HTLCs towards sender
14545  */
14546 uint16_t AcceptChannel_get_max_accepted_htlcs(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
14547
14548 /**
14549  * The maximum number of inbound HTLCs towards sender
14550  */
14551 void AcceptChannel_set_max_accepted_htlcs(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint16_t val);
14552
14553 /**
14554  * The sender's key controlling the funding transaction
14555  */
14556 struct LDKPublicKey AcceptChannel_get_funding_pubkey(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
14557
14558 /**
14559  * The sender's key controlling the funding transaction
14560  */
14561 void AcceptChannel_set_funding_pubkey(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14562
14563 /**
14564  * Used to derive a revocation key for transactions broadcast by counterparty
14565  */
14566 struct LDKPublicKey AcceptChannel_get_revocation_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
14567
14568 /**
14569  * Used to derive a revocation key for transactions broadcast by counterparty
14570  */
14571 void AcceptChannel_set_revocation_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14572
14573 /**
14574  * A payment key to sender for transactions broadcast by counterparty
14575  */
14576 struct LDKPublicKey AcceptChannel_get_payment_point(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
14577
14578 /**
14579  * A payment key to sender for transactions broadcast by counterparty
14580  */
14581 void AcceptChannel_set_payment_point(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14582
14583 /**
14584  * Used to derive a payment key to sender for transactions broadcast by sender
14585  */
14586 struct LDKPublicKey AcceptChannel_get_delayed_payment_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
14587
14588 /**
14589  * Used to derive a payment key to sender for transactions broadcast by sender
14590  */
14591 void AcceptChannel_set_delayed_payment_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14592
14593 /**
14594  * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
14595  */
14596 struct LDKPublicKey AcceptChannel_get_htlc_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
14597
14598 /**
14599  * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
14600  */
14601 void AcceptChannel_set_htlc_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14602
14603 /**
14604  * The first to-be-broadcast-by-sender transaction's per commitment point
14605  */
14606 struct LDKPublicKey AcceptChannel_get_first_per_commitment_point(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
14607
14608 /**
14609  * The first to-be-broadcast-by-sender transaction's per commitment point
14610  */
14611 void AcceptChannel_set_first_per_commitment_point(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14612
14613 /**
14614  * Creates a copy of the AcceptChannel
14615  */
14616 struct LDKAcceptChannel AcceptChannel_clone(const struct LDKAcceptChannel *NONNULL_PTR orig);
14617
14618 /**
14619  * Frees any resources used by the FundingCreated, if is_owned is set and inner is non-NULL.
14620  */
14621 void FundingCreated_free(struct LDKFundingCreated this_obj);
14622
14623 /**
14624  * A temporary channel ID, until the funding is established
14625  */
14626 const uint8_t (*FundingCreated_get_temporary_channel_id(const struct LDKFundingCreated *NONNULL_PTR this_ptr))[32];
14627
14628 /**
14629  * A temporary channel ID, until the funding is established
14630  */
14631 void FundingCreated_set_temporary_channel_id(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14632
14633 /**
14634  * The funding transaction ID
14635  */
14636 const uint8_t (*FundingCreated_get_funding_txid(const struct LDKFundingCreated *NONNULL_PTR this_ptr))[32];
14637
14638 /**
14639  * The funding transaction ID
14640  */
14641 void FundingCreated_set_funding_txid(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14642
14643 /**
14644  * The specific output index funding this channel
14645  */
14646 uint16_t FundingCreated_get_funding_output_index(const struct LDKFundingCreated *NONNULL_PTR this_ptr);
14647
14648 /**
14649  * The specific output index funding this channel
14650  */
14651 void FundingCreated_set_funding_output_index(struct LDKFundingCreated *NONNULL_PTR this_ptr, uint16_t val);
14652
14653 /**
14654  * The signature of the channel initiator (funder) on the funding transaction
14655  */
14656 struct LDKSignature FundingCreated_get_signature(const struct LDKFundingCreated *NONNULL_PTR this_ptr);
14657
14658 /**
14659  * The signature of the channel initiator (funder) on the funding transaction
14660  */
14661 void FundingCreated_set_signature(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKSignature val);
14662
14663 /**
14664  * Constructs a new FundingCreated given each field
14665  */
14666 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);
14667
14668 /**
14669  * Creates a copy of the FundingCreated
14670  */
14671 struct LDKFundingCreated FundingCreated_clone(const struct LDKFundingCreated *NONNULL_PTR orig);
14672
14673 /**
14674  * Frees any resources used by the FundingSigned, if is_owned is set and inner is non-NULL.
14675  */
14676 void FundingSigned_free(struct LDKFundingSigned this_obj);
14677
14678 /**
14679  * The channel ID
14680  */
14681 const uint8_t (*FundingSigned_get_channel_id(const struct LDKFundingSigned *NONNULL_PTR this_ptr))[32];
14682
14683 /**
14684  * The channel ID
14685  */
14686 void FundingSigned_set_channel_id(struct LDKFundingSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14687
14688 /**
14689  * The signature of the channel acceptor (fundee) on the funding transaction
14690  */
14691 struct LDKSignature FundingSigned_get_signature(const struct LDKFundingSigned *NONNULL_PTR this_ptr);
14692
14693 /**
14694  * The signature of the channel acceptor (fundee) on the funding transaction
14695  */
14696 void FundingSigned_set_signature(struct LDKFundingSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
14697
14698 /**
14699  * Constructs a new FundingSigned given each field
14700  */
14701 MUST_USE_RES struct LDKFundingSigned FundingSigned_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKSignature signature_arg);
14702
14703 /**
14704  * Creates a copy of the FundingSigned
14705  */
14706 struct LDKFundingSigned FundingSigned_clone(const struct LDKFundingSigned *NONNULL_PTR orig);
14707
14708 /**
14709  * Frees any resources used by the FundingLocked, if is_owned is set and inner is non-NULL.
14710  */
14711 void FundingLocked_free(struct LDKFundingLocked this_obj);
14712
14713 /**
14714  * The channel ID
14715  */
14716 const uint8_t (*FundingLocked_get_channel_id(const struct LDKFundingLocked *NONNULL_PTR this_ptr))[32];
14717
14718 /**
14719  * The channel ID
14720  */
14721 void FundingLocked_set_channel_id(struct LDKFundingLocked *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14722
14723 /**
14724  * The per-commitment point of the second commitment transaction
14725  */
14726 struct LDKPublicKey FundingLocked_get_next_per_commitment_point(const struct LDKFundingLocked *NONNULL_PTR this_ptr);
14727
14728 /**
14729  * The per-commitment point of the second commitment transaction
14730  */
14731 void FundingLocked_set_next_per_commitment_point(struct LDKFundingLocked *NONNULL_PTR this_ptr, struct LDKPublicKey val);
14732
14733 /**
14734  * Constructs a new FundingLocked given each field
14735  */
14736 MUST_USE_RES struct LDKFundingLocked FundingLocked_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKPublicKey next_per_commitment_point_arg);
14737
14738 /**
14739  * Creates a copy of the FundingLocked
14740  */
14741 struct LDKFundingLocked FundingLocked_clone(const struct LDKFundingLocked *NONNULL_PTR orig);
14742
14743 /**
14744  * Frees any resources used by the Shutdown, if is_owned is set and inner is non-NULL.
14745  */
14746 void Shutdown_free(struct LDKShutdown this_obj);
14747
14748 /**
14749  * The channel ID
14750  */
14751 const uint8_t (*Shutdown_get_channel_id(const struct LDKShutdown *NONNULL_PTR this_ptr))[32];
14752
14753 /**
14754  * The channel ID
14755  */
14756 void Shutdown_set_channel_id(struct LDKShutdown *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14757
14758 /**
14759  * The destination of this peer's funds on closing.
14760  * Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh.
14761  */
14762 struct LDKu8slice Shutdown_get_scriptpubkey(const struct LDKShutdown *NONNULL_PTR this_ptr);
14763
14764 /**
14765  * The destination of this peer's funds on closing.
14766  * Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh.
14767  */
14768 void Shutdown_set_scriptpubkey(struct LDKShutdown *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
14769
14770 /**
14771  * Constructs a new Shutdown given each field
14772  */
14773 MUST_USE_RES struct LDKShutdown Shutdown_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKCVec_u8Z scriptpubkey_arg);
14774
14775 /**
14776  * Creates a copy of the Shutdown
14777  */
14778 struct LDKShutdown Shutdown_clone(const struct LDKShutdown *NONNULL_PTR orig);
14779
14780 /**
14781  * Frees any resources used by the ClosingSigned, if is_owned is set and inner is non-NULL.
14782  */
14783 void ClosingSigned_free(struct LDKClosingSigned this_obj);
14784
14785 /**
14786  * The channel ID
14787  */
14788 const uint8_t (*ClosingSigned_get_channel_id(const struct LDKClosingSigned *NONNULL_PTR this_ptr))[32];
14789
14790 /**
14791  * The channel ID
14792  */
14793 void ClosingSigned_set_channel_id(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14794
14795 /**
14796  * The proposed total fee for the closing transaction
14797  */
14798 uint64_t ClosingSigned_get_fee_satoshis(const struct LDKClosingSigned *NONNULL_PTR this_ptr);
14799
14800 /**
14801  * The proposed total fee for the closing transaction
14802  */
14803 void ClosingSigned_set_fee_satoshis(struct LDKClosingSigned *NONNULL_PTR this_ptr, uint64_t val);
14804
14805 /**
14806  * A signature on the closing transaction
14807  */
14808 struct LDKSignature ClosingSigned_get_signature(const struct LDKClosingSigned *NONNULL_PTR this_ptr);
14809
14810 /**
14811  * A signature on the closing transaction
14812  */
14813 void ClosingSigned_set_signature(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
14814
14815 /**
14816  * Constructs a new ClosingSigned given each field
14817  */
14818 MUST_USE_RES struct LDKClosingSigned ClosingSigned_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t fee_satoshis_arg, struct LDKSignature signature_arg);
14819
14820 /**
14821  * Creates a copy of the ClosingSigned
14822  */
14823 struct LDKClosingSigned ClosingSigned_clone(const struct LDKClosingSigned *NONNULL_PTR orig);
14824
14825 /**
14826  * Frees any resources used by the UpdateAddHTLC, if is_owned is set and inner is non-NULL.
14827  */
14828 void UpdateAddHTLC_free(struct LDKUpdateAddHTLC this_obj);
14829
14830 /**
14831  * The channel ID
14832  */
14833 const uint8_t (*UpdateAddHTLC_get_channel_id(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr))[32];
14834
14835 /**
14836  * The channel ID
14837  */
14838 void UpdateAddHTLC_set_channel_id(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14839
14840 /**
14841  * The HTLC ID
14842  */
14843 uint64_t UpdateAddHTLC_get_htlc_id(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
14844
14845 /**
14846  * The HTLC ID
14847  */
14848 void UpdateAddHTLC_set_htlc_id(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint64_t val);
14849
14850 /**
14851  * The HTLC value in milli-satoshi
14852  */
14853 uint64_t UpdateAddHTLC_get_amount_msat(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
14854
14855 /**
14856  * The HTLC value in milli-satoshi
14857  */
14858 void UpdateAddHTLC_set_amount_msat(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint64_t val);
14859
14860 /**
14861  * The payment hash, the pre-image of which controls HTLC redemption
14862  */
14863 const uint8_t (*UpdateAddHTLC_get_payment_hash(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr))[32];
14864
14865 /**
14866  * The payment hash, the pre-image of which controls HTLC redemption
14867  */
14868 void UpdateAddHTLC_set_payment_hash(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14869
14870 /**
14871  * The expiry height of the HTLC
14872  */
14873 uint32_t UpdateAddHTLC_get_cltv_expiry(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
14874
14875 /**
14876  * The expiry height of the HTLC
14877  */
14878 void UpdateAddHTLC_set_cltv_expiry(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint32_t val);
14879
14880 /**
14881  * Creates a copy of the UpdateAddHTLC
14882  */
14883 struct LDKUpdateAddHTLC UpdateAddHTLC_clone(const struct LDKUpdateAddHTLC *NONNULL_PTR orig);
14884
14885 /**
14886  * Frees any resources used by the UpdateFulfillHTLC, if is_owned is set and inner is non-NULL.
14887  */
14888 void UpdateFulfillHTLC_free(struct LDKUpdateFulfillHTLC this_obj);
14889
14890 /**
14891  * The channel ID
14892  */
14893 const uint8_t (*UpdateFulfillHTLC_get_channel_id(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr))[32];
14894
14895 /**
14896  * The channel ID
14897  */
14898 void UpdateFulfillHTLC_set_channel_id(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14899
14900 /**
14901  * The HTLC ID
14902  */
14903 uint64_t UpdateFulfillHTLC_get_htlc_id(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr);
14904
14905 /**
14906  * The HTLC ID
14907  */
14908 void UpdateFulfillHTLC_set_htlc_id(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, uint64_t val);
14909
14910 /**
14911  * The pre-image of the payment hash, allowing HTLC redemption
14912  */
14913 const uint8_t (*UpdateFulfillHTLC_get_payment_preimage(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr))[32];
14914
14915 /**
14916  * The pre-image of the payment hash, allowing HTLC redemption
14917  */
14918 void UpdateFulfillHTLC_set_payment_preimage(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14919
14920 /**
14921  * Constructs a new UpdateFulfillHTLC given each field
14922  */
14923 MUST_USE_RES struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t htlc_id_arg, struct LDKThirtyTwoBytes payment_preimage_arg);
14924
14925 /**
14926  * Creates a copy of the UpdateFulfillHTLC
14927  */
14928 struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_clone(const struct LDKUpdateFulfillHTLC *NONNULL_PTR orig);
14929
14930 /**
14931  * Frees any resources used by the UpdateFailHTLC, if is_owned is set and inner is non-NULL.
14932  */
14933 void UpdateFailHTLC_free(struct LDKUpdateFailHTLC this_obj);
14934
14935 /**
14936  * The channel ID
14937  */
14938 const uint8_t (*UpdateFailHTLC_get_channel_id(const struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr))[32];
14939
14940 /**
14941  * The channel ID
14942  */
14943 void UpdateFailHTLC_set_channel_id(struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14944
14945 /**
14946  * The HTLC ID
14947  */
14948 uint64_t UpdateFailHTLC_get_htlc_id(const struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr);
14949
14950 /**
14951  * The HTLC ID
14952  */
14953 void UpdateFailHTLC_set_htlc_id(struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr, uint64_t val);
14954
14955 /**
14956  * Creates a copy of the UpdateFailHTLC
14957  */
14958 struct LDKUpdateFailHTLC UpdateFailHTLC_clone(const struct LDKUpdateFailHTLC *NONNULL_PTR orig);
14959
14960 /**
14961  * Frees any resources used by the UpdateFailMalformedHTLC, if is_owned is set and inner is non-NULL.
14962  */
14963 void UpdateFailMalformedHTLC_free(struct LDKUpdateFailMalformedHTLC this_obj);
14964
14965 /**
14966  * The channel ID
14967  */
14968 const uint8_t (*UpdateFailMalformedHTLC_get_channel_id(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr))[32];
14969
14970 /**
14971  * The channel ID
14972  */
14973 void UpdateFailMalformedHTLC_set_channel_id(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
14974
14975 /**
14976  * The HTLC ID
14977  */
14978 uint64_t UpdateFailMalformedHTLC_get_htlc_id(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr);
14979
14980 /**
14981  * The HTLC ID
14982  */
14983 void UpdateFailMalformedHTLC_set_htlc_id(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, uint64_t val);
14984
14985 /**
14986  * The failure code
14987  */
14988 uint16_t UpdateFailMalformedHTLC_get_failure_code(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr);
14989
14990 /**
14991  * The failure code
14992  */
14993 void UpdateFailMalformedHTLC_set_failure_code(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, uint16_t val);
14994
14995 /**
14996  * Creates a copy of the UpdateFailMalformedHTLC
14997  */
14998 struct LDKUpdateFailMalformedHTLC UpdateFailMalformedHTLC_clone(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR orig);
14999
15000 /**
15001  * Frees any resources used by the CommitmentSigned, if is_owned is set and inner is non-NULL.
15002  */
15003 void CommitmentSigned_free(struct LDKCommitmentSigned this_obj);
15004
15005 /**
15006  * The channel ID
15007  */
15008 const uint8_t (*CommitmentSigned_get_channel_id(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr))[32];
15009
15010 /**
15011  * The channel ID
15012  */
15013 void CommitmentSigned_set_channel_id(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
15014
15015 /**
15016  * A signature on the commitment transaction
15017  */
15018 struct LDKSignature CommitmentSigned_get_signature(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr);
15019
15020 /**
15021  * A signature on the commitment transaction
15022  */
15023 void CommitmentSigned_set_signature(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
15024
15025 /**
15026  * Signatures on the HTLC transactions
15027  */
15028 void CommitmentSigned_set_htlc_signatures(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKCVec_SignatureZ val);
15029
15030 /**
15031  * Constructs a new CommitmentSigned given each field
15032  */
15033 MUST_USE_RES struct LDKCommitmentSigned CommitmentSigned_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKSignature signature_arg, struct LDKCVec_SignatureZ htlc_signatures_arg);
15034
15035 /**
15036  * Creates a copy of the CommitmentSigned
15037  */
15038 struct LDKCommitmentSigned CommitmentSigned_clone(const struct LDKCommitmentSigned *NONNULL_PTR orig);
15039
15040 /**
15041  * Frees any resources used by the RevokeAndACK, if is_owned is set and inner is non-NULL.
15042  */
15043 void RevokeAndACK_free(struct LDKRevokeAndACK this_obj);
15044
15045 /**
15046  * The channel ID
15047  */
15048 const uint8_t (*RevokeAndACK_get_channel_id(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr))[32];
15049
15050 /**
15051  * The channel ID
15052  */
15053 void RevokeAndACK_set_channel_id(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
15054
15055 /**
15056  * The secret corresponding to the per-commitment point
15057  */
15058 const uint8_t (*RevokeAndACK_get_per_commitment_secret(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr))[32];
15059
15060 /**
15061  * The secret corresponding to the per-commitment point
15062  */
15063 void RevokeAndACK_set_per_commitment_secret(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
15064
15065 /**
15066  * The next sender-broadcast commitment transaction's per-commitment point
15067  */
15068 struct LDKPublicKey RevokeAndACK_get_next_per_commitment_point(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr);
15069
15070 /**
15071  * The next sender-broadcast commitment transaction's per-commitment point
15072  */
15073 void RevokeAndACK_set_next_per_commitment_point(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKPublicKey val);
15074
15075 /**
15076  * Constructs a new RevokeAndACK given each field
15077  */
15078 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);
15079
15080 /**
15081  * Creates a copy of the RevokeAndACK
15082  */
15083 struct LDKRevokeAndACK RevokeAndACK_clone(const struct LDKRevokeAndACK *NONNULL_PTR orig);
15084
15085 /**
15086  * Frees any resources used by the UpdateFee, if is_owned is set and inner is non-NULL.
15087  */
15088 void UpdateFee_free(struct LDKUpdateFee this_obj);
15089
15090 /**
15091  * The channel ID
15092  */
15093 const uint8_t (*UpdateFee_get_channel_id(const struct LDKUpdateFee *NONNULL_PTR this_ptr))[32];
15094
15095 /**
15096  * The channel ID
15097  */
15098 void UpdateFee_set_channel_id(struct LDKUpdateFee *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
15099
15100 /**
15101  * Fee rate per 1000-weight of the transaction
15102  */
15103 uint32_t UpdateFee_get_feerate_per_kw(const struct LDKUpdateFee *NONNULL_PTR this_ptr);
15104
15105 /**
15106  * Fee rate per 1000-weight of the transaction
15107  */
15108 void UpdateFee_set_feerate_per_kw(struct LDKUpdateFee *NONNULL_PTR this_ptr, uint32_t val);
15109
15110 /**
15111  * Constructs a new UpdateFee given each field
15112  */
15113 MUST_USE_RES struct LDKUpdateFee UpdateFee_new(struct LDKThirtyTwoBytes channel_id_arg, uint32_t feerate_per_kw_arg);
15114
15115 /**
15116  * Creates a copy of the UpdateFee
15117  */
15118 struct LDKUpdateFee UpdateFee_clone(const struct LDKUpdateFee *NONNULL_PTR orig);
15119
15120 /**
15121  * Frees any resources used by the DataLossProtect, if is_owned is set and inner is non-NULL.
15122  */
15123 void DataLossProtect_free(struct LDKDataLossProtect this_obj);
15124
15125 /**
15126  * Proof that the sender knows the per-commitment secret of a specific commitment transaction
15127  * belonging to the recipient
15128  */
15129 const uint8_t (*DataLossProtect_get_your_last_per_commitment_secret(const struct LDKDataLossProtect *NONNULL_PTR this_ptr))[32];
15130
15131 /**
15132  * Proof that the sender knows the per-commitment secret of a specific commitment transaction
15133  * belonging to the recipient
15134  */
15135 void DataLossProtect_set_your_last_per_commitment_secret(struct LDKDataLossProtect *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
15136
15137 /**
15138  * The sender's per-commitment point for their current commitment transaction
15139  */
15140 struct LDKPublicKey DataLossProtect_get_my_current_per_commitment_point(const struct LDKDataLossProtect *NONNULL_PTR this_ptr);
15141
15142 /**
15143  * The sender's per-commitment point for their current commitment transaction
15144  */
15145 void DataLossProtect_set_my_current_per_commitment_point(struct LDKDataLossProtect *NONNULL_PTR this_ptr, struct LDKPublicKey val);
15146
15147 /**
15148  * Constructs a new DataLossProtect given each field
15149  */
15150 MUST_USE_RES struct LDKDataLossProtect DataLossProtect_new(struct LDKThirtyTwoBytes your_last_per_commitment_secret_arg, struct LDKPublicKey my_current_per_commitment_point_arg);
15151
15152 /**
15153  * Creates a copy of the DataLossProtect
15154  */
15155 struct LDKDataLossProtect DataLossProtect_clone(const struct LDKDataLossProtect *NONNULL_PTR orig);
15156
15157 /**
15158  * Frees any resources used by the ChannelReestablish, if is_owned is set and inner is non-NULL.
15159  */
15160 void ChannelReestablish_free(struct LDKChannelReestablish this_obj);
15161
15162 /**
15163  * The channel ID
15164  */
15165 const uint8_t (*ChannelReestablish_get_channel_id(const struct LDKChannelReestablish *NONNULL_PTR this_ptr))[32];
15166
15167 /**
15168  * The channel ID
15169  */
15170 void ChannelReestablish_set_channel_id(struct LDKChannelReestablish *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
15171
15172 /**
15173  * The next commitment number for the sender
15174  */
15175 uint64_t ChannelReestablish_get_next_local_commitment_number(const struct LDKChannelReestablish *NONNULL_PTR this_ptr);
15176
15177 /**
15178  * The next commitment number for the sender
15179  */
15180 void ChannelReestablish_set_next_local_commitment_number(struct LDKChannelReestablish *NONNULL_PTR this_ptr, uint64_t val);
15181
15182 /**
15183  * The next commitment number for the recipient
15184  */
15185 uint64_t ChannelReestablish_get_next_remote_commitment_number(const struct LDKChannelReestablish *NONNULL_PTR this_ptr);
15186
15187 /**
15188  * The next commitment number for the recipient
15189  */
15190 void ChannelReestablish_set_next_remote_commitment_number(struct LDKChannelReestablish *NONNULL_PTR this_ptr, uint64_t val);
15191
15192 /**
15193  * Creates a copy of the ChannelReestablish
15194  */
15195 struct LDKChannelReestablish ChannelReestablish_clone(const struct LDKChannelReestablish *NONNULL_PTR orig);
15196
15197 /**
15198  * Frees any resources used by the AnnouncementSignatures, if is_owned is set and inner is non-NULL.
15199  */
15200 void AnnouncementSignatures_free(struct LDKAnnouncementSignatures this_obj);
15201
15202 /**
15203  * The channel ID
15204  */
15205 const uint8_t (*AnnouncementSignatures_get_channel_id(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr))[32];
15206
15207 /**
15208  * The channel ID
15209  */
15210 void AnnouncementSignatures_set_channel_id(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
15211
15212 /**
15213  * The short channel ID
15214  */
15215 uint64_t AnnouncementSignatures_get_short_channel_id(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
15216
15217 /**
15218  * The short channel ID
15219  */
15220 void AnnouncementSignatures_set_short_channel_id(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, uint64_t val);
15221
15222 /**
15223  * A signature by the node key
15224  */
15225 struct LDKSignature AnnouncementSignatures_get_node_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
15226
15227 /**
15228  * A signature by the node key
15229  */
15230 void AnnouncementSignatures_set_node_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKSignature val);
15231
15232 /**
15233  * A signature by the funding key
15234  */
15235 struct LDKSignature AnnouncementSignatures_get_bitcoin_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
15236
15237 /**
15238  * A signature by the funding key
15239  */
15240 void AnnouncementSignatures_set_bitcoin_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKSignature val);
15241
15242 /**
15243  * Constructs a new AnnouncementSignatures given each field
15244  */
15245 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);
15246
15247 /**
15248  * Creates a copy of the AnnouncementSignatures
15249  */
15250 struct LDKAnnouncementSignatures AnnouncementSignatures_clone(const struct LDKAnnouncementSignatures *NONNULL_PTR orig);
15251
15252 /**
15253  * Frees any resources used by the NetAddress
15254  */
15255 void NetAddress_free(struct LDKNetAddress this_ptr);
15256
15257 /**
15258  * Creates a copy of the NetAddress
15259  */
15260 struct LDKNetAddress NetAddress_clone(const struct LDKNetAddress *NONNULL_PTR orig);
15261
15262 /**
15263  * Serialize the NetAddress object into a byte array which can be read by NetAddress_read
15264  */
15265 struct LDKCVec_u8Z NetAddress_write(const struct LDKNetAddress *NONNULL_PTR obj);
15266
15267 /**
15268  * Read a Result from a byte array, created by Result_write
15269  */
15270 struct LDKCResult_CResult_NetAddressu8ZDecodeErrorZ Result_read(struct LDKu8slice ser);
15271
15272 /**
15273  * Read a NetAddress from a byte array, created by NetAddress_write
15274  */
15275 struct LDKCResult_NetAddressDecodeErrorZ NetAddress_read(struct LDKu8slice ser);
15276
15277 /**
15278  * Frees any resources used by the UnsignedNodeAnnouncement, if is_owned is set and inner is non-NULL.
15279  */
15280 void UnsignedNodeAnnouncement_free(struct LDKUnsignedNodeAnnouncement this_obj);
15281
15282 /**
15283  * The advertised features
15284  */
15285 struct LDKNodeFeatures UnsignedNodeAnnouncement_get_features(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
15286
15287 /**
15288  * The advertised features
15289  */
15290 void UnsignedNodeAnnouncement_set_features(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
15291
15292 /**
15293  * A strictly monotonic announcement counter, with gaps allowed
15294  */
15295 uint32_t UnsignedNodeAnnouncement_get_timestamp(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
15296
15297 /**
15298  * A strictly monotonic announcement counter, with gaps allowed
15299  */
15300 void UnsignedNodeAnnouncement_set_timestamp(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, uint32_t val);
15301
15302 /**
15303  * The node_id this announcement originated from (don't rebroadcast the node_announcement back
15304  * to this node).
15305  */
15306 struct LDKPublicKey UnsignedNodeAnnouncement_get_node_id(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
15307
15308 /**
15309  * The node_id this announcement originated from (don't rebroadcast the node_announcement back
15310  * to this node).
15311  */
15312 void UnsignedNodeAnnouncement_set_node_id(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
15313
15314 /**
15315  * An RGB color for UI purposes
15316  */
15317 const uint8_t (*UnsignedNodeAnnouncement_get_rgb(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr))[3];
15318
15319 /**
15320  * An RGB color for UI purposes
15321  */
15322 void UnsignedNodeAnnouncement_set_rgb(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKThreeBytes val);
15323
15324 /**
15325  * An alias, for UI purposes.  This should be sanitized before use.  There is no guarantee
15326  * of uniqueness.
15327  */
15328 const uint8_t (*UnsignedNodeAnnouncement_get_alias(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr))[32];
15329
15330 /**
15331  * An alias, for UI purposes.  This should be sanitized before use.  There is no guarantee
15332  * of uniqueness.
15333  */
15334 void UnsignedNodeAnnouncement_set_alias(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
15335
15336 /**
15337  * List of addresses on which this node is reachable
15338  */
15339 void UnsignedNodeAnnouncement_set_addresses(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKCVec_NetAddressZ val);
15340
15341 /**
15342  * Creates a copy of the UnsignedNodeAnnouncement
15343  */
15344 struct LDKUnsignedNodeAnnouncement UnsignedNodeAnnouncement_clone(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR orig);
15345
15346 /**
15347  * Frees any resources used by the NodeAnnouncement, if is_owned is set and inner is non-NULL.
15348  */
15349 void NodeAnnouncement_free(struct LDKNodeAnnouncement this_obj);
15350
15351 /**
15352  * The signature by the node key
15353  */
15354 struct LDKSignature NodeAnnouncement_get_signature(const struct LDKNodeAnnouncement *NONNULL_PTR this_ptr);
15355
15356 /**
15357  * The signature by the node key
15358  */
15359 void NodeAnnouncement_set_signature(struct LDKNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
15360
15361 /**
15362  * The actual content of the announcement
15363  */
15364 struct LDKUnsignedNodeAnnouncement NodeAnnouncement_get_contents(const struct LDKNodeAnnouncement *NONNULL_PTR this_ptr);
15365
15366 /**
15367  * The actual content of the announcement
15368  */
15369 void NodeAnnouncement_set_contents(struct LDKNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKUnsignedNodeAnnouncement val);
15370
15371 /**
15372  * Constructs a new NodeAnnouncement given each field
15373  */
15374 MUST_USE_RES struct LDKNodeAnnouncement NodeAnnouncement_new(struct LDKSignature signature_arg, struct LDKUnsignedNodeAnnouncement contents_arg);
15375
15376 /**
15377  * Creates a copy of the NodeAnnouncement
15378  */
15379 struct LDKNodeAnnouncement NodeAnnouncement_clone(const struct LDKNodeAnnouncement *NONNULL_PTR orig);
15380
15381 /**
15382  * Frees any resources used by the UnsignedChannelAnnouncement, if is_owned is set and inner is non-NULL.
15383  */
15384 void UnsignedChannelAnnouncement_free(struct LDKUnsignedChannelAnnouncement this_obj);
15385
15386 /**
15387  * The advertised channel features
15388  */
15389 struct LDKChannelFeatures UnsignedChannelAnnouncement_get_features(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
15390
15391 /**
15392  * The advertised channel features
15393  */
15394 void UnsignedChannelAnnouncement_set_features(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
15395
15396 /**
15397  * The genesis hash of the blockchain where the channel is to be opened
15398  */
15399 const uint8_t (*UnsignedChannelAnnouncement_get_chain_hash(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr))[32];
15400
15401 /**
15402  * The genesis hash of the blockchain where the channel is to be opened
15403  */
15404 void UnsignedChannelAnnouncement_set_chain_hash(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
15405
15406 /**
15407  * The short channel ID
15408  */
15409 uint64_t UnsignedChannelAnnouncement_get_short_channel_id(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
15410
15411 /**
15412  * The short channel ID
15413  */
15414 void UnsignedChannelAnnouncement_set_short_channel_id(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, uint64_t val);
15415
15416 /**
15417  * One of the two node_ids which are endpoints of this channel
15418  */
15419 struct LDKPublicKey UnsignedChannelAnnouncement_get_node_id_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
15420
15421 /**
15422  * One of the two node_ids which are endpoints of this channel
15423  */
15424 void UnsignedChannelAnnouncement_set_node_id_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
15425
15426 /**
15427  * The other of the two node_ids which are endpoints of this channel
15428  */
15429 struct LDKPublicKey UnsignedChannelAnnouncement_get_node_id_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
15430
15431 /**
15432  * The other of the two node_ids which are endpoints of this channel
15433  */
15434 void UnsignedChannelAnnouncement_set_node_id_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
15435
15436 /**
15437  * The funding key for the first node
15438  */
15439 struct LDKPublicKey UnsignedChannelAnnouncement_get_bitcoin_key_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
15440
15441 /**
15442  * The funding key for the first node
15443  */
15444 void UnsignedChannelAnnouncement_set_bitcoin_key_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
15445
15446 /**
15447  * The funding key for the second node
15448  */
15449 struct LDKPublicKey UnsignedChannelAnnouncement_get_bitcoin_key_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
15450
15451 /**
15452  * The funding key for the second node
15453  */
15454 void UnsignedChannelAnnouncement_set_bitcoin_key_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
15455
15456 /**
15457  * Creates a copy of the UnsignedChannelAnnouncement
15458  */
15459 struct LDKUnsignedChannelAnnouncement UnsignedChannelAnnouncement_clone(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR orig);
15460
15461 /**
15462  * Frees any resources used by the ChannelAnnouncement, if is_owned is set and inner is non-NULL.
15463  */
15464 void ChannelAnnouncement_free(struct LDKChannelAnnouncement this_obj);
15465
15466 /**
15467  * Authentication of the announcement by the first public node
15468  */
15469 struct LDKSignature ChannelAnnouncement_get_node_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
15470
15471 /**
15472  * Authentication of the announcement by the first public node
15473  */
15474 void ChannelAnnouncement_set_node_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
15475
15476 /**
15477  * Authentication of the announcement by the second public node
15478  */
15479 struct LDKSignature ChannelAnnouncement_get_node_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
15480
15481 /**
15482  * Authentication of the announcement by the second public node
15483  */
15484 void ChannelAnnouncement_set_node_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
15485
15486 /**
15487  * Proof of funding UTXO ownership by the first public node
15488  */
15489 struct LDKSignature ChannelAnnouncement_get_bitcoin_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
15490
15491 /**
15492  * Proof of funding UTXO ownership by the first public node
15493  */
15494 void ChannelAnnouncement_set_bitcoin_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
15495
15496 /**
15497  * Proof of funding UTXO ownership by the second public node
15498  */
15499 struct LDKSignature ChannelAnnouncement_get_bitcoin_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
15500
15501 /**
15502  * Proof of funding UTXO ownership by the second public node
15503  */
15504 void ChannelAnnouncement_set_bitcoin_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
15505
15506 /**
15507  * The actual announcement
15508  */
15509 struct LDKUnsignedChannelAnnouncement ChannelAnnouncement_get_contents(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
15510
15511 /**
15512  * The actual announcement
15513  */
15514 void ChannelAnnouncement_set_contents(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKUnsignedChannelAnnouncement val);
15515
15516 /**
15517  * Constructs a new ChannelAnnouncement given each field
15518  */
15519 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);
15520
15521 /**
15522  * Creates a copy of the ChannelAnnouncement
15523  */
15524 struct LDKChannelAnnouncement ChannelAnnouncement_clone(const struct LDKChannelAnnouncement *NONNULL_PTR orig);
15525
15526 /**
15527  * Frees any resources used by the UnsignedChannelUpdate, if is_owned is set and inner is non-NULL.
15528  */
15529 void UnsignedChannelUpdate_free(struct LDKUnsignedChannelUpdate this_obj);
15530
15531 /**
15532  * The genesis hash of the blockchain where the channel is to be opened
15533  */
15534 const uint8_t (*UnsignedChannelUpdate_get_chain_hash(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr))[32];
15535
15536 /**
15537  * The genesis hash of the blockchain where the channel is to be opened
15538  */
15539 void UnsignedChannelUpdate_set_chain_hash(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
15540
15541 /**
15542  * The short channel ID
15543  */
15544 uint64_t UnsignedChannelUpdate_get_short_channel_id(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
15545
15546 /**
15547  * The short channel ID
15548  */
15549 void UnsignedChannelUpdate_set_short_channel_id(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val);
15550
15551 /**
15552  * A strictly monotonic announcement counter, with gaps allowed, specific to this channel
15553  */
15554 uint32_t UnsignedChannelUpdate_get_timestamp(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
15555
15556 /**
15557  * A strictly monotonic announcement counter, with gaps allowed, specific to this channel
15558  */
15559 void UnsignedChannelUpdate_set_timestamp(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
15560
15561 /**
15562  * Channel flags
15563  */
15564 uint8_t UnsignedChannelUpdate_get_flags(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
15565
15566 /**
15567  * Channel flags
15568  */
15569 void UnsignedChannelUpdate_set_flags(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint8_t val);
15570
15571 /**
15572  * The number of blocks such that if:
15573  * `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta`
15574  * then we need to fail the HTLC backwards. When forwarding an HTLC, cltv_expiry_delta determines
15575  * the outgoing HTLC's minimum cltv_expiry value -- so, if an incoming HTLC comes in with a
15576  * cltv_expiry of 100000, and the node we're forwarding to has a cltv_expiry_delta value of 10,
15577  * then we'll check that the outgoing HTLC's cltv_expiry value is at least 100010 before
15578  * forwarding. Note that the HTLC sender is the one who originally sets this value when
15579  * constructing the route.
15580  */
15581 uint16_t UnsignedChannelUpdate_get_cltv_expiry_delta(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
15582
15583 /**
15584  * The number of blocks such that if:
15585  * `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta`
15586  * then we need to fail the HTLC backwards. When forwarding an HTLC, cltv_expiry_delta determines
15587  * the outgoing HTLC's minimum cltv_expiry value -- so, if an incoming HTLC comes in with a
15588  * cltv_expiry of 100000, and the node we're forwarding to has a cltv_expiry_delta value of 10,
15589  * then we'll check that the outgoing HTLC's cltv_expiry value is at least 100010 before
15590  * forwarding. Note that the HTLC sender is the one who originally sets this value when
15591  * constructing the route.
15592  */
15593 void UnsignedChannelUpdate_set_cltv_expiry_delta(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint16_t val);
15594
15595 /**
15596  * The minimum HTLC size incoming to sender, in milli-satoshi
15597  */
15598 uint64_t UnsignedChannelUpdate_get_htlc_minimum_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
15599
15600 /**
15601  * The minimum HTLC size incoming to sender, in milli-satoshi
15602  */
15603 void UnsignedChannelUpdate_set_htlc_minimum_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val);
15604
15605 /**
15606  * The base HTLC fee charged by sender, in milli-satoshi
15607  */
15608 uint32_t UnsignedChannelUpdate_get_fee_base_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
15609
15610 /**
15611  * The base HTLC fee charged by sender, in milli-satoshi
15612  */
15613 void UnsignedChannelUpdate_set_fee_base_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
15614
15615 /**
15616  * The amount to fee multiplier, in micro-satoshi
15617  */
15618 uint32_t UnsignedChannelUpdate_get_fee_proportional_millionths(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
15619
15620 /**
15621  * The amount to fee multiplier, in micro-satoshi
15622  */
15623 void UnsignedChannelUpdate_set_fee_proportional_millionths(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
15624
15625 /**
15626  * Creates a copy of the UnsignedChannelUpdate
15627  */
15628 struct LDKUnsignedChannelUpdate UnsignedChannelUpdate_clone(const struct LDKUnsignedChannelUpdate *NONNULL_PTR orig);
15629
15630 /**
15631  * Frees any resources used by the ChannelUpdate, if is_owned is set and inner is non-NULL.
15632  */
15633 void ChannelUpdate_free(struct LDKChannelUpdate this_obj);
15634
15635 /**
15636  * A signature of the channel update
15637  */
15638 struct LDKSignature ChannelUpdate_get_signature(const struct LDKChannelUpdate *NONNULL_PTR this_ptr);
15639
15640 /**
15641  * A signature of the channel update
15642  */
15643 void ChannelUpdate_set_signature(struct LDKChannelUpdate *NONNULL_PTR this_ptr, struct LDKSignature val);
15644
15645 /**
15646  * The actual channel update
15647  */
15648 struct LDKUnsignedChannelUpdate ChannelUpdate_get_contents(const struct LDKChannelUpdate *NONNULL_PTR this_ptr);
15649
15650 /**
15651  * The actual channel update
15652  */
15653 void ChannelUpdate_set_contents(struct LDKChannelUpdate *NONNULL_PTR this_ptr, struct LDKUnsignedChannelUpdate val);
15654
15655 /**
15656  * Constructs a new ChannelUpdate given each field
15657  */
15658 MUST_USE_RES struct LDKChannelUpdate ChannelUpdate_new(struct LDKSignature signature_arg, struct LDKUnsignedChannelUpdate contents_arg);
15659
15660 /**
15661  * Creates a copy of the ChannelUpdate
15662  */
15663 struct LDKChannelUpdate ChannelUpdate_clone(const struct LDKChannelUpdate *NONNULL_PTR orig);
15664
15665 /**
15666  * Frees any resources used by the QueryChannelRange, if is_owned is set and inner is non-NULL.
15667  */
15668 void QueryChannelRange_free(struct LDKQueryChannelRange this_obj);
15669
15670 /**
15671  * The genesis hash of the blockchain being queried
15672  */
15673 const uint8_t (*QueryChannelRange_get_chain_hash(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr))[32];
15674
15675 /**
15676  * The genesis hash of the blockchain being queried
15677  */
15678 void QueryChannelRange_set_chain_hash(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
15679
15680 /**
15681  * The height of the first block for the channel UTXOs being queried
15682  */
15683 uint32_t QueryChannelRange_get_first_blocknum(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr);
15684
15685 /**
15686  * The height of the first block for the channel UTXOs being queried
15687  */
15688 void QueryChannelRange_set_first_blocknum(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, uint32_t val);
15689
15690 /**
15691  * The number of blocks to include in the query results
15692  */
15693 uint32_t QueryChannelRange_get_number_of_blocks(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr);
15694
15695 /**
15696  * The number of blocks to include in the query results
15697  */
15698 void QueryChannelRange_set_number_of_blocks(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, uint32_t val);
15699
15700 /**
15701  * Constructs a new QueryChannelRange given each field
15702  */
15703 MUST_USE_RES struct LDKQueryChannelRange QueryChannelRange_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_blocknum_arg, uint32_t number_of_blocks_arg);
15704
15705 /**
15706  * Creates a copy of the QueryChannelRange
15707  */
15708 struct LDKQueryChannelRange QueryChannelRange_clone(const struct LDKQueryChannelRange *NONNULL_PTR orig);
15709
15710 /**
15711  * Frees any resources used by the ReplyChannelRange, if is_owned is set and inner is non-NULL.
15712  */
15713 void ReplyChannelRange_free(struct LDKReplyChannelRange this_obj);
15714
15715 /**
15716  * The genesis hash of the blockchain being queried
15717  */
15718 const uint8_t (*ReplyChannelRange_get_chain_hash(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr))[32];
15719
15720 /**
15721  * The genesis hash of the blockchain being queried
15722  */
15723 void ReplyChannelRange_set_chain_hash(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
15724
15725 /**
15726  * The height of the first block in the range of the reply
15727  */
15728 uint32_t ReplyChannelRange_get_first_blocknum(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
15729
15730 /**
15731  * The height of the first block in the range of the reply
15732  */
15733 void ReplyChannelRange_set_first_blocknum(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, uint32_t val);
15734
15735 /**
15736  * The number of blocks included in the range of the reply
15737  */
15738 uint32_t ReplyChannelRange_get_number_of_blocks(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
15739
15740 /**
15741  * The number of blocks included in the range of the reply
15742  */
15743 void ReplyChannelRange_set_number_of_blocks(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, uint32_t val);
15744
15745 /**
15746  * True when this is the final reply for a query
15747  */
15748 bool ReplyChannelRange_get_sync_complete(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
15749
15750 /**
15751  * True when this is the final reply for a query
15752  */
15753 void ReplyChannelRange_set_sync_complete(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, bool val);
15754
15755 /**
15756  * The short_channel_ids in the channel range
15757  */
15758 void ReplyChannelRange_set_short_channel_ids(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
15759
15760 /**
15761  * Constructs a new ReplyChannelRange given each field
15762  */
15763 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);
15764
15765 /**
15766  * Creates a copy of the ReplyChannelRange
15767  */
15768 struct LDKReplyChannelRange ReplyChannelRange_clone(const struct LDKReplyChannelRange *NONNULL_PTR orig);
15769
15770 /**
15771  * Frees any resources used by the QueryShortChannelIds, if is_owned is set and inner is non-NULL.
15772  */
15773 void QueryShortChannelIds_free(struct LDKQueryShortChannelIds this_obj);
15774
15775 /**
15776  * The genesis hash of the blockchain being queried
15777  */
15778 const uint8_t (*QueryShortChannelIds_get_chain_hash(const struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr))[32];
15779
15780 /**
15781  * The genesis hash of the blockchain being queried
15782  */
15783 void QueryShortChannelIds_set_chain_hash(struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
15784
15785 /**
15786  * The short_channel_ids that are being queried
15787  */
15788 void QueryShortChannelIds_set_short_channel_ids(struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
15789
15790 /**
15791  * Constructs a new QueryShortChannelIds given each field
15792  */
15793 MUST_USE_RES struct LDKQueryShortChannelIds QueryShortChannelIds_new(struct LDKThirtyTwoBytes chain_hash_arg, struct LDKCVec_u64Z short_channel_ids_arg);
15794
15795 /**
15796  * Creates a copy of the QueryShortChannelIds
15797  */
15798 struct LDKQueryShortChannelIds QueryShortChannelIds_clone(const struct LDKQueryShortChannelIds *NONNULL_PTR orig);
15799
15800 /**
15801  * Frees any resources used by the ReplyShortChannelIdsEnd, if is_owned is set and inner is non-NULL.
15802  */
15803 void ReplyShortChannelIdsEnd_free(struct LDKReplyShortChannelIdsEnd this_obj);
15804
15805 /**
15806  * The genesis hash of the blockchain that was queried
15807  */
15808 const uint8_t (*ReplyShortChannelIdsEnd_get_chain_hash(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr))[32];
15809
15810 /**
15811  * The genesis hash of the blockchain that was queried
15812  */
15813 void ReplyShortChannelIdsEnd_set_chain_hash(struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
15814
15815 /**
15816  * Indicates if the query recipient maintains up-to-date channel
15817  * information for the chain_hash
15818  */
15819 bool ReplyShortChannelIdsEnd_get_full_information(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr);
15820
15821 /**
15822  * Indicates if the query recipient maintains up-to-date channel
15823  * information for the chain_hash
15824  */
15825 void ReplyShortChannelIdsEnd_set_full_information(struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr, bool val);
15826
15827 /**
15828  * Constructs a new ReplyShortChannelIdsEnd given each field
15829  */
15830 MUST_USE_RES struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_new(struct LDKThirtyTwoBytes chain_hash_arg, bool full_information_arg);
15831
15832 /**
15833  * Creates a copy of the ReplyShortChannelIdsEnd
15834  */
15835 struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_clone(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR orig);
15836
15837 /**
15838  * Frees any resources used by the GossipTimestampFilter, if is_owned is set and inner is non-NULL.
15839  */
15840 void GossipTimestampFilter_free(struct LDKGossipTimestampFilter this_obj);
15841
15842 /**
15843  * The genesis hash of the blockchain for channel and node information
15844  */
15845 const uint8_t (*GossipTimestampFilter_get_chain_hash(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr))[32];
15846
15847 /**
15848  * The genesis hash of the blockchain for channel and node information
15849  */
15850 void GossipTimestampFilter_set_chain_hash(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
15851
15852 /**
15853  * The starting unix timestamp
15854  */
15855 uint32_t GossipTimestampFilter_get_first_timestamp(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr);
15856
15857 /**
15858  * The starting unix timestamp
15859  */
15860 void GossipTimestampFilter_set_first_timestamp(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, uint32_t val);
15861
15862 /**
15863  * The range of information in seconds
15864  */
15865 uint32_t GossipTimestampFilter_get_timestamp_range(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr);
15866
15867 /**
15868  * The range of information in seconds
15869  */
15870 void GossipTimestampFilter_set_timestamp_range(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, uint32_t val);
15871
15872 /**
15873  * Constructs a new GossipTimestampFilter given each field
15874  */
15875 MUST_USE_RES struct LDKGossipTimestampFilter GossipTimestampFilter_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_timestamp_arg, uint32_t timestamp_range_arg);
15876
15877 /**
15878  * Creates a copy of the GossipTimestampFilter
15879  */
15880 struct LDKGossipTimestampFilter GossipTimestampFilter_clone(const struct LDKGossipTimestampFilter *NONNULL_PTR orig);
15881
15882 /**
15883  * Frees any resources used by the ErrorAction
15884  */
15885 void ErrorAction_free(struct LDKErrorAction this_ptr);
15886
15887 /**
15888  * Creates a copy of the ErrorAction
15889  */
15890 struct LDKErrorAction ErrorAction_clone(const struct LDKErrorAction *NONNULL_PTR orig);
15891
15892 /**
15893  * Frees any resources used by the LightningError, if is_owned is set and inner is non-NULL.
15894  */
15895 void LightningError_free(struct LDKLightningError this_obj);
15896
15897 /**
15898  * A human-readable message describing the error
15899  */
15900 struct LDKStr LightningError_get_err(const struct LDKLightningError *NONNULL_PTR this_ptr);
15901
15902 /**
15903  * A human-readable message describing the error
15904  */
15905 void LightningError_set_err(struct LDKLightningError *NONNULL_PTR this_ptr, struct LDKStr val);
15906
15907 /**
15908  * The action which should be taken against the offending peer.
15909  */
15910 struct LDKErrorAction LightningError_get_action(const struct LDKLightningError *NONNULL_PTR this_ptr);
15911
15912 /**
15913  * The action which should be taken against the offending peer.
15914  */
15915 void LightningError_set_action(struct LDKLightningError *NONNULL_PTR this_ptr, struct LDKErrorAction val);
15916
15917 /**
15918  * Constructs a new LightningError given each field
15919  */
15920 MUST_USE_RES struct LDKLightningError LightningError_new(struct LDKStr err_arg, struct LDKErrorAction action_arg);
15921
15922 /**
15923  * Creates a copy of the LightningError
15924  */
15925 struct LDKLightningError LightningError_clone(const struct LDKLightningError *NONNULL_PTR orig);
15926
15927 /**
15928  * Frees any resources used by the CommitmentUpdate, if is_owned is set and inner is non-NULL.
15929  */
15930 void CommitmentUpdate_free(struct LDKCommitmentUpdate this_obj);
15931
15932 /**
15933  * update_add_htlc messages which should be sent
15934  */
15935 void CommitmentUpdate_set_update_add_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateAddHTLCZ val);
15936
15937 /**
15938  * update_fulfill_htlc messages which should be sent
15939  */
15940 void CommitmentUpdate_set_update_fulfill_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFulfillHTLCZ val);
15941
15942 /**
15943  * update_fail_htlc messages which should be sent
15944  */
15945 void CommitmentUpdate_set_update_fail_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFailHTLCZ val);
15946
15947 /**
15948  * update_fail_malformed_htlc messages which should be sent
15949  */
15950 void CommitmentUpdate_set_update_fail_malformed_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFailMalformedHTLCZ val);
15951
15952 /**
15953  * An update_fee message which should be sent
15954  */
15955 struct LDKUpdateFee CommitmentUpdate_get_update_fee(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
15956
15957 /**
15958  * An update_fee message which should be sent
15959  */
15960 void CommitmentUpdate_set_update_fee(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKUpdateFee val);
15961
15962 /**
15963  * Finally, the commitment_signed message which should be sent
15964  */
15965 struct LDKCommitmentSigned CommitmentUpdate_get_commitment_signed(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
15966
15967 /**
15968  * Finally, the commitment_signed message which should be sent
15969  */
15970 void CommitmentUpdate_set_commitment_signed(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCommitmentSigned val);
15971
15972 /**
15973  * Constructs a new CommitmentUpdate given each field
15974  */
15975 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);
15976
15977 /**
15978  * Creates a copy of the CommitmentUpdate
15979  */
15980 struct LDKCommitmentUpdate CommitmentUpdate_clone(const struct LDKCommitmentUpdate *NONNULL_PTR orig);
15981
15982 /**
15983  * Frees any resources used by the HTLCFailChannelUpdate
15984  */
15985 void HTLCFailChannelUpdate_free(struct LDKHTLCFailChannelUpdate this_ptr);
15986
15987 /**
15988  * Creates a copy of the HTLCFailChannelUpdate
15989  */
15990 struct LDKHTLCFailChannelUpdate HTLCFailChannelUpdate_clone(const struct LDKHTLCFailChannelUpdate *NONNULL_PTR orig);
15991
15992 /**
15993  * Calls the free function if one is set
15994  */
15995 void ChannelMessageHandler_free(struct LDKChannelMessageHandler this_ptr);
15996
15997 /**
15998  * Calls the free function if one is set
15999  */
16000 void RoutingMessageHandler_free(struct LDKRoutingMessageHandler this_ptr);
16001
16002 /**
16003  * Serialize the AcceptChannel object into a byte array which can be read by AcceptChannel_read
16004  */
16005 struct LDKCVec_u8Z AcceptChannel_write(const struct LDKAcceptChannel *NONNULL_PTR obj);
16006
16007 /**
16008  * Read a AcceptChannel from a byte array, created by AcceptChannel_write
16009  */
16010 struct LDKCResult_AcceptChannelDecodeErrorZ AcceptChannel_read(struct LDKu8slice ser);
16011
16012 /**
16013  * Serialize the AnnouncementSignatures object into a byte array which can be read by AnnouncementSignatures_read
16014  */
16015 struct LDKCVec_u8Z AnnouncementSignatures_write(const struct LDKAnnouncementSignatures *NONNULL_PTR obj);
16016
16017 /**
16018  * Read a AnnouncementSignatures from a byte array, created by AnnouncementSignatures_write
16019  */
16020 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ AnnouncementSignatures_read(struct LDKu8slice ser);
16021
16022 /**
16023  * Serialize the ChannelReestablish object into a byte array which can be read by ChannelReestablish_read
16024  */
16025 struct LDKCVec_u8Z ChannelReestablish_write(const struct LDKChannelReestablish *NONNULL_PTR obj);
16026
16027 /**
16028  * Read a ChannelReestablish from a byte array, created by ChannelReestablish_write
16029  */
16030 struct LDKCResult_ChannelReestablishDecodeErrorZ ChannelReestablish_read(struct LDKu8slice ser);
16031
16032 /**
16033  * Serialize the ClosingSigned object into a byte array which can be read by ClosingSigned_read
16034  */
16035 struct LDKCVec_u8Z ClosingSigned_write(const struct LDKClosingSigned *NONNULL_PTR obj);
16036
16037 /**
16038  * Read a ClosingSigned from a byte array, created by ClosingSigned_write
16039  */
16040 struct LDKCResult_ClosingSignedDecodeErrorZ ClosingSigned_read(struct LDKu8slice ser);
16041
16042 /**
16043  * Serialize the CommitmentSigned object into a byte array which can be read by CommitmentSigned_read
16044  */
16045 struct LDKCVec_u8Z CommitmentSigned_write(const struct LDKCommitmentSigned *NONNULL_PTR obj);
16046
16047 /**
16048  * Read a CommitmentSigned from a byte array, created by CommitmentSigned_write
16049  */
16050 struct LDKCResult_CommitmentSignedDecodeErrorZ CommitmentSigned_read(struct LDKu8slice ser);
16051
16052 /**
16053  * Serialize the FundingCreated object into a byte array which can be read by FundingCreated_read
16054  */
16055 struct LDKCVec_u8Z FundingCreated_write(const struct LDKFundingCreated *NONNULL_PTR obj);
16056
16057 /**
16058  * Read a FundingCreated from a byte array, created by FundingCreated_write
16059  */
16060 struct LDKCResult_FundingCreatedDecodeErrorZ FundingCreated_read(struct LDKu8slice ser);
16061
16062 /**
16063  * Serialize the FundingSigned object into a byte array which can be read by FundingSigned_read
16064  */
16065 struct LDKCVec_u8Z FundingSigned_write(const struct LDKFundingSigned *NONNULL_PTR obj);
16066
16067 /**
16068  * Read a FundingSigned from a byte array, created by FundingSigned_write
16069  */
16070 struct LDKCResult_FundingSignedDecodeErrorZ FundingSigned_read(struct LDKu8slice ser);
16071
16072 /**
16073  * Serialize the FundingLocked object into a byte array which can be read by FundingLocked_read
16074  */
16075 struct LDKCVec_u8Z FundingLocked_write(const struct LDKFundingLocked *NONNULL_PTR obj);
16076
16077 /**
16078  * Read a FundingLocked from a byte array, created by FundingLocked_write
16079  */
16080 struct LDKCResult_FundingLockedDecodeErrorZ FundingLocked_read(struct LDKu8slice ser);
16081
16082 /**
16083  * Serialize the Init object into a byte array which can be read by Init_read
16084  */
16085 struct LDKCVec_u8Z Init_write(const struct LDKInit *NONNULL_PTR obj);
16086
16087 /**
16088  * Read a Init from a byte array, created by Init_write
16089  */
16090 struct LDKCResult_InitDecodeErrorZ Init_read(struct LDKu8slice ser);
16091
16092 /**
16093  * Serialize the OpenChannel object into a byte array which can be read by OpenChannel_read
16094  */
16095 struct LDKCVec_u8Z OpenChannel_write(const struct LDKOpenChannel *NONNULL_PTR obj);
16096
16097 /**
16098  * Read a OpenChannel from a byte array, created by OpenChannel_write
16099  */
16100 struct LDKCResult_OpenChannelDecodeErrorZ OpenChannel_read(struct LDKu8slice ser);
16101
16102 /**
16103  * Serialize the RevokeAndACK object into a byte array which can be read by RevokeAndACK_read
16104  */
16105 struct LDKCVec_u8Z RevokeAndACK_write(const struct LDKRevokeAndACK *NONNULL_PTR obj);
16106
16107 /**
16108  * Read a RevokeAndACK from a byte array, created by RevokeAndACK_write
16109  */
16110 struct LDKCResult_RevokeAndACKDecodeErrorZ RevokeAndACK_read(struct LDKu8slice ser);
16111
16112 /**
16113  * Serialize the Shutdown object into a byte array which can be read by Shutdown_read
16114  */
16115 struct LDKCVec_u8Z Shutdown_write(const struct LDKShutdown *NONNULL_PTR obj);
16116
16117 /**
16118  * Read a Shutdown from a byte array, created by Shutdown_write
16119  */
16120 struct LDKCResult_ShutdownDecodeErrorZ Shutdown_read(struct LDKu8slice ser);
16121
16122 /**
16123  * Serialize the UpdateFailHTLC object into a byte array which can be read by UpdateFailHTLC_read
16124  */
16125 struct LDKCVec_u8Z UpdateFailHTLC_write(const struct LDKUpdateFailHTLC *NONNULL_PTR obj);
16126
16127 /**
16128  * Read a UpdateFailHTLC from a byte array, created by UpdateFailHTLC_write
16129  */
16130 struct LDKCResult_UpdateFailHTLCDecodeErrorZ UpdateFailHTLC_read(struct LDKu8slice ser);
16131
16132 /**
16133  * Serialize the UpdateFailMalformedHTLC object into a byte array which can be read by UpdateFailMalformedHTLC_read
16134  */
16135 struct LDKCVec_u8Z UpdateFailMalformedHTLC_write(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR obj);
16136
16137 /**
16138  * Read a UpdateFailMalformedHTLC from a byte array, created by UpdateFailMalformedHTLC_write
16139  */
16140 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ UpdateFailMalformedHTLC_read(struct LDKu8slice ser);
16141
16142 /**
16143  * Serialize the UpdateFee object into a byte array which can be read by UpdateFee_read
16144  */
16145 struct LDKCVec_u8Z UpdateFee_write(const struct LDKUpdateFee *NONNULL_PTR obj);
16146
16147 /**
16148  * Read a UpdateFee from a byte array, created by UpdateFee_write
16149  */
16150 struct LDKCResult_UpdateFeeDecodeErrorZ UpdateFee_read(struct LDKu8slice ser);
16151
16152 /**
16153  * Serialize the UpdateFulfillHTLC object into a byte array which can be read by UpdateFulfillHTLC_read
16154  */
16155 struct LDKCVec_u8Z UpdateFulfillHTLC_write(const struct LDKUpdateFulfillHTLC *NONNULL_PTR obj);
16156
16157 /**
16158  * Read a UpdateFulfillHTLC from a byte array, created by UpdateFulfillHTLC_write
16159  */
16160 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ UpdateFulfillHTLC_read(struct LDKu8slice ser);
16161
16162 /**
16163  * Serialize the UpdateAddHTLC object into a byte array which can be read by UpdateAddHTLC_read
16164  */
16165 struct LDKCVec_u8Z UpdateAddHTLC_write(const struct LDKUpdateAddHTLC *NONNULL_PTR obj);
16166
16167 /**
16168  * Read a UpdateAddHTLC from a byte array, created by UpdateAddHTLC_write
16169  */
16170 struct LDKCResult_UpdateAddHTLCDecodeErrorZ UpdateAddHTLC_read(struct LDKu8slice ser);
16171
16172 /**
16173  * Serialize the Ping object into a byte array which can be read by Ping_read
16174  */
16175 struct LDKCVec_u8Z Ping_write(const struct LDKPing *NONNULL_PTR obj);
16176
16177 /**
16178  * Read a Ping from a byte array, created by Ping_write
16179  */
16180 struct LDKCResult_PingDecodeErrorZ Ping_read(struct LDKu8slice ser);
16181
16182 /**
16183  * Serialize the Pong object into a byte array which can be read by Pong_read
16184  */
16185 struct LDKCVec_u8Z Pong_write(const struct LDKPong *NONNULL_PTR obj);
16186
16187 /**
16188  * Read a Pong from a byte array, created by Pong_write
16189  */
16190 struct LDKCResult_PongDecodeErrorZ Pong_read(struct LDKu8slice ser);
16191
16192 /**
16193  * Serialize the UnsignedChannelAnnouncement object into a byte array which can be read by UnsignedChannelAnnouncement_read
16194  */
16195 struct LDKCVec_u8Z UnsignedChannelAnnouncement_write(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR obj);
16196
16197 /**
16198  * Read a UnsignedChannelAnnouncement from a byte array, created by UnsignedChannelAnnouncement_write
16199  */
16200 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ UnsignedChannelAnnouncement_read(struct LDKu8slice ser);
16201
16202 /**
16203  * Serialize the ChannelAnnouncement object into a byte array which can be read by ChannelAnnouncement_read
16204  */
16205 struct LDKCVec_u8Z ChannelAnnouncement_write(const struct LDKChannelAnnouncement *NONNULL_PTR obj);
16206
16207 /**
16208  * Read a ChannelAnnouncement from a byte array, created by ChannelAnnouncement_write
16209  */
16210 struct LDKCResult_ChannelAnnouncementDecodeErrorZ ChannelAnnouncement_read(struct LDKu8slice ser);
16211
16212 /**
16213  * Serialize the UnsignedChannelUpdate object into a byte array which can be read by UnsignedChannelUpdate_read
16214  */
16215 struct LDKCVec_u8Z UnsignedChannelUpdate_write(const struct LDKUnsignedChannelUpdate *NONNULL_PTR obj);
16216
16217 /**
16218  * Read a UnsignedChannelUpdate from a byte array, created by UnsignedChannelUpdate_write
16219  */
16220 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ UnsignedChannelUpdate_read(struct LDKu8slice ser);
16221
16222 /**
16223  * Serialize the ChannelUpdate object into a byte array which can be read by ChannelUpdate_read
16224  */
16225 struct LDKCVec_u8Z ChannelUpdate_write(const struct LDKChannelUpdate *NONNULL_PTR obj);
16226
16227 /**
16228  * Read a ChannelUpdate from a byte array, created by ChannelUpdate_write
16229  */
16230 struct LDKCResult_ChannelUpdateDecodeErrorZ ChannelUpdate_read(struct LDKu8slice ser);
16231
16232 /**
16233  * Serialize the ErrorMessage object into a byte array which can be read by ErrorMessage_read
16234  */
16235 struct LDKCVec_u8Z ErrorMessage_write(const struct LDKErrorMessage *NONNULL_PTR obj);
16236
16237 /**
16238  * Read a ErrorMessage from a byte array, created by ErrorMessage_write
16239  */
16240 struct LDKCResult_ErrorMessageDecodeErrorZ ErrorMessage_read(struct LDKu8slice ser);
16241
16242 /**
16243  * Serialize the UnsignedNodeAnnouncement object into a byte array which can be read by UnsignedNodeAnnouncement_read
16244  */
16245 struct LDKCVec_u8Z UnsignedNodeAnnouncement_write(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR obj);
16246
16247 /**
16248  * Read a UnsignedNodeAnnouncement from a byte array, created by UnsignedNodeAnnouncement_write
16249  */
16250 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ UnsignedNodeAnnouncement_read(struct LDKu8slice ser);
16251
16252 /**
16253  * Serialize the NodeAnnouncement object into a byte array which can be read by NodeAnnouncement_read
16254  */
16255 struct LDKCVec_u8Z NodeAnnouncement_write(const struct LDKNodeAnnouncement *NONNULL_PTR obj);
16256
16257 /**
16258  * Read a NodeAnnouncement from a byte array, created by NodeAnnouncement_write
16259  */
16260 struct LDKCResult_NodeAnnouncementDecodeErrorZ NodeAnnouncement_read(struct LDKu8slice ser);
16261
16262 /**
16263  * Read a QueryShortChannelIds from a byte array, created by QueryShortChannelIds_write
16264  */
16265 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ QueryShortChannelIds_read(struct LDKu8slice ser);
16266
16267 /**
16268  * Serialize the QueryShortChannelIds object into a byte array which can be read by QueryShortChannelIds_read
16269  */
16270 struct LDKCVec_u8Z QueryShortChannelIds_write(const struct LDKQueryShortChannelIds *NONNULL_PTR obj);
16271
16272 /**
16273  * Read a ReplyShortChannelIdsEnd from a byte array, created by ReplyShortChannelIdsEnd_write
16274  */
16275 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ ReplyShortChannelIdsEnd_read(struct LDKu8slice ser);
16276
16277 /**
16278  * Serialize the ReplyShortChannelIdsEnd object into a byte array which can be read by ReplyShortChannelIdsEnd_read
16279  */
16280 struct LDKCVec_u8Z ReplyShortChannelIdsEnd_write(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR obj);
16281
16282 /**
16283  *\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
16284  */
16285 MUST_USE_RES uint32_t QueryChannelRange_end_blocknum(const struct LDKQueryChannelRange *NONNULL_PTR this_arg);
16286
16287 /**
16288  * Read a QueryChannelRange from a byte array, created by QueryChannelRange_write
16289  */
16290 struct LDKCResult_QueryChannelRangeDecodeErrorZ QueryChannelRange_read(struct LDKu8slice ser);
16291
16292 /**
16293  * Serialize the QueryChannelRange object into a byte array which can be read by QueryChannelRange_read
16294  */
16295 struct LDKCVec_u8Z QueryChannelRange_write(const struct LDKQueryChannelRange *NONNULL_PTR obj);
16296
16297 /**
16298  * Read a ReplyChannelRange from a byte array, created by ReplyChannelRange_write
16299  */
16300 struct LDKCResult_ReplyChannelRangeDecodeErrorZ ReplyChannelRange_read(struct LDKu8slice ser);
16301
16302 /**
16303  * Serialize the ReplyChannelRange object into a byte array which can be read by ReplyChannelRange_read
16304  */
16305 struct LDKCVec_u8Z ReplyChannelRange_write(const struct LDKReplyChannelRange *NONNULL_PTR obj);
16306
16307 /**
16308  * Read a GossipTimestampFilter from a byte array, created by GossipTimestampFilter_write
16309  */
16310 struct LDKCResult_GossipTimestampFilterDecodeErrorZ GossipTimestampFilter_read(struct LDKu8slice ser);
16311
16312 /**
16313  * Serialize the GossipTimestampFilter object into a byte array which can be read by GossipTimestampFilter_read
16314  */
16315 struct LDKCVec_u8Z GossipTimestampFilter_write(const struct LDKGossipTimestampFilter *NONNULL_PTR obj);
16316
16317 /**
16318  * Frees any resources used by the IgnoringMessageHandler, if is_owned is set and inner is non-NULL.
16319  */
16320 void IgnoringMessageHandler_free(struct LDKIgnoringMessageHandler this_obj);
16321
16322 /**
16323  * Constructs a new IgnoringMessageHandler given each field
16324  */
16325 MUST_USE_RES struct LDKIgnoringMessageHandler IgnoringMessageHandler_new(void);
16326
16327 /**
16328  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
16329  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
16330  */
16331 struct LDKMessageSendEventsProvider IgnoringMessageHandler_as_MessageSendEventsProvider(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
16332
16333 /**
16334  * Constructs a new RoutingMessageHandler which calls the relevant methods on this_arg.
16335  * This copies the `inner` pointer in this_arg and thus the returned RoutingMessageHandler must be freed before this_arg is
16336  */
16337 struct LDKRoutingMessageHandler IgnoringMessageHandler_as_RoutingMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
16338
16339 /**
16340  * Frees any resources used by the ErroringMessageHandler, if is_owned is set and inner is non-NULL.
16341  */
16342 void ErroringMessageHandler_free(struct LDKErroringMessageHandler this_obj);
16343
16344 /**
16345  * Constructs a new ErroringMessageHandler
16346  */
16347 MUST_USE_RES struct LDKErroringMessageHandler ErroringMessageHandler_new(void);
16348
16349 /**
16350  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
16351  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
16352  */
16353 struct LDKMessageSendEventsProvider ErroringMessageHandler_as_MessageSendEventsProvider(const struct LDKErroringMessageHandler *NONNULL_PTR this_arg);
16354
16355 /**
16356  * Constructs a new ChannelMessageHandler which calls the relevant methods on this_arg.
16357  * This copies the `inner` pointer in this_arg and thus the returned ChannelMessageHandler must be freed before this_arg is
16358  */
16359 struct LDKChannelMessageHandler ErroringMessageHandler_as_ChannelMessageHandler(const struct LDKErroringMessageHandler *NONNULL_PTR this_arg);
16360
16361 /**
16362  * Frees any resources used by the MessageHandler, if is_owned is set and inner is non-NULL.
16363  */
16364 void MessageHandler_free(struct LDKMessageHandler this_obj);
16365
16366 /**
16367  * A message handler which handles messages specific to channels. Usually this is just a
16368  * [`ChannelManager`] object or an [`ErroringMessageHandler`].
16369  *
16370  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
16371  */
16372 const struct LDKChannelMessageHandler *MessageHandler_get_chan_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr);
16373
16374 /**
16375  * A message handler which handles messages specific to channels. Usually this is just a
16376  * [`ChannelManager`] object or an [`ErroringMessageHandler`].
16377  *
16378  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
16379  */
16380 void MessageHandler_set_chan_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKChannelMessageHandler val);
16381
16382 /**
16383  * A message handler which handles messages updating our knowledge of the network channel
16384  * graph. Usually this is just a [`NetGraphMsgHandler`] object or an
16385  * [`IgnoringMessageHandler`].
16386  *
16387  * [`NetGraphMsgHandler`]: crate::routing::network_graph::NetGraphMsgHandler
16388  */
16389 const struct LDKRoutingMessageHandler *MessageHandler_get_route_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr);
16390
16391 /**
16392  * A message handler which handles messages updating our knowledge of the network channel
16393  * graph. Usually this is just a [`NetGraphMsgHandler`] object or an
16394  * [`IgnoringMessageHandler`].
16395  *
16396  * [`NetGraphMsgHandler`]: crate::routing::network_graph::NetGraphMsgHandler
16397  */
16398 void MessageHandler_set_route_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKRoutingMessageHandler val);
16399
16400 /**
16401  * Constructs a new MessageHandler given each field
16402  */
16403 MUST_USE_RES struct LDKMessageHandler MessageHandler_new(struct LDKChannelMessageHandler chan_handler_arg, struct LDKRoutingMessageHandler route_handler_arg);
16404
16405 /**
16406  * Creates a copy of a SocketDescriptor
16407  */
16408 struct LDKSocketDescriptor SocketDescriptor_clone(const struct LDKSocketDescriptor *NONNULL_PTR orig);
16409
16410 /**
16411  * Calls the free function if one is set
16412  */
16413 void SocketDescriptor_free(struct LDKSocketDescriptor this_ptr);
16414
16415 /**
16416  * Frees any resources used by the PeerHandleError, if is_owned is set and inner is non-NULL.
16417  */
16418 void PeerHandleError_free(struct LDKPeerHandleError this_obj);
16419
16420 /**
16421  * Used to indicate that we probably can't make any future connections to this peer, implying
16422  * we should go ahead and force-close any channels we have with it.
16423  */
16424 bool PeerHandleError_get_no_connection_possible(const struct LDKPeerHandleError *NONNULL_PTR this_ptr);
16425
16426 /**
16427  * Used to indicate that we probably can't make any future connections to this peer, implying
16428  * we should go ahead and force-close any channels we have with it.
16429  */
16430 void PeerHandleError_set_no_connection_possible(struct LDKPeerHandleError *NONNULL_PTR this_ptr, bool val);
16431
16432 /**
16433  * Constructs a new PeerHandleError given each field
16434  */
16435 MUST_USE_RES struct LDKPeerHandleError PeerHandleError_new(bool no_connection_possible_arg);
16436
16437 /**
16438  * Creates a copy of the PeerHandleError
16439  */
16440 struct LDKPeerHandleError PeerHandleError_clone(const struct LDKPeerHandleError *NONNULL_PTR orig);
16441
16442 /**
16443  * Frees any resources used by the PeerManager, if is_owned is set and inner is non-NULL.
16444  */
16445 void PeerManager_free(struct LDKPeerManager this_obj);
16446
16447 /**
16448  * Constructs a new PeerManager with the given message handlers and node_id secret key
16449  * ephemeral_random_data is used to derive per-connection ephemeral keys and must be
16450  * cryptographically secure random bytes.
16451  */
16452 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);
16453
16454 /**
16455  * Get the list of node ids for peers which have completed the initial handshake.
16456  *
16457  * For outbound connections, this will be the same as the their_node_id parameter passed in to
16458  * new_outbound_connection, however entries will only appear once the initial handshake has
16459  * completed and we are sure the remote peer has the private key for the given node_id.
16460  */
16461 MUST_USE_RES struct LDKCVec_PublicKeyZ PeerManager_get_peer_node_ids(const struct LDKPeerManager *NONNULL_PTR this_arg);
16462
16463 /**
16464  * Indicates a new outbound connection has been established to a node with the given node_id.
16465  * Note that if an Err is returned here you MUST NOT call socket_disconnected for the new
16466  * descriptor but must disconnect the connection immediately.
16467  *
16468  * Returns a small number of bytes to send to the remote node (currently always 50).
16469  *
16470  * Panics if descriptor is duplicative with some other descriptor which has not yet been
16471  * [`socket_disconnected()`].
16472  *
16473  * [`socket_disconnected()`]: PeerManager::socket_disconnected
16474  */
16475 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);
16476
16477 /**
16478  * Indicates a new inbound connection has been established.
16479  *
16480  * May refuse the connection by returning an Err, but will never write bytes to the remote end
16481  * (outbound connector always speaks first). Note that if an Err is returned here you MUST NOT
16482  * call socket_disconnected for the new descriptor but must disconnect the connection
16483  * immediately.
16484  *
16485  * Panics if descriptor is duplicative with some other descriptor which has not yet been
16486  * [`socket_disconnected()`].
16487  *
16488  * [`socket_disconnected()`]: PeerManager::socket_disconnected
16489  */
16490 MUST_USE_RES struct LDKCResult_NonePeerHandleErrorZ PeerManager_new_inbound_connection(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor descriptor);
16491
16492 /**
16493  * Indicates that there is room to write data to the given socket descriptor.
16494  *
16495  * May return an Err to indicate that the connection should be closed.
16496  *
16497  * May call [`send_data`] on the descriptor passed in (or an equal descriptor) before
16498  * returning. Thus, be very careful with reentrancy issues! The invariants around calling
16499  * [`write_buffer_space_avail`] in case a write did not fully complete must still hold - be
16500  * ready to call `[write_buffer_space_avail`] again if a write call generated here isn't
16501  * sufficient!
16502  *
16503  * [`send_data`]: SocketDescriptor::send_data
16504  * [`write_buffer_space_avail`]: PeerManager::write_buffer_space_avail
16505  */
16506 MUST_USE_RES struct LDKCResult_NonePeerHandleErrorZ PeerManager_write_buffer_space_avail(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor *NONNULL_PTR descriptor);
16507
16508 /**
16509  * Indicates that data was read from the given socket descriptor.
16510  *
16511  * May return an Err to indicate that the connection should be closed.
16512  *
16513  * Will *not* call back into [`send_data`] on any descriptors to avoid reentrancy complexity.
16514  * Thus, however, you should call [`process_events`] after any `read_event` to generate
16515  * [`send_data`] calls to handle responses.
16516  *
16517  * If `Ok(true)` is returned, further read_events should not be triggered until a
16518  * [`send_data`] call on this descriptor has `resume_read` set (preventing DoS issues in the
16519  * send buffer).
16520  *
16521  * [`send_data`]: SocketDescriptor::send_data
16522  * [`process_events`]: PeerManager::process_events
16523  */
16524 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);
16525
16526 /**
16527  * Checks for any events generated by our handlers and processes them. Includes sending most
16528  * response messages as well as messages generated by calls to handler functions directly (eg
16529  * functions like [`ChannelManager::process_pending_htlc_forwards`] or [`send_payment`]).
16530  *
16531  * May call [`send_data`] on [`SocketDescriptor`]s. Thus, be very careful with reentrancy
16532  * issues!
16533  *
16534  * [`send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
16535  * [`ChannelManager::process_pending_htlc_forwards`]: crate::ln::channelmanager::ChannelManager::process_pending_htlc_forwards
16536  * [`send_data`]: SocketDescriptor::send_data
16537  */
16538 void PeerManager_process_events(const struct LDKPeerManager *NONNULL_PTR this_arg);
16539
16540 /**
16541  * Indicates that the given socket descriptor's connection is now closed.
16542  */
16543 void PeerManager_socket_disconnected(const struct LDKPeerManager *NONNULL_PTR this_arg, const struct LDKSocketDescriptor *NONNULL_PTR descriptor);
16544
16545 /**
16546  * Disconnect a peer given its node id.
16547  *
16548  * Set `no_connection_possible` to true to prevent any further connection with this peer,
16549  * force-closing any channels we have with it.
16550  *
16551  * If a peer is connected, this will call [`disconnect_socket`] on the descriptor for the
16552  * peer. Thus, be very careful about reentrancy issues.
16553  *
16554  * [`disconnect_socket`]: SocketDescriptor::disconnect_socket
16555  */
16556 void PeerManager_disconnect_by_node_id(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKPublicKey node_id, bool no_connection_possible);
16557
16558 /**
16559  * This function should be called roughly once every 30 seconds.
16560  * It will send pings to each peer and disconnect those which did not respond to the last
16561  * round of pings.
16562  *
16563  * May call [`send_data`] on all [`SocketDescriptor`]s. Thus, be very careful with reentrancy
16564  * issues!
16565  *
16566  * [`send_data`]: SocketDescriptor::send_data
16567  */
16568 void PeerManager_timer_tick_occurred(const struct LDKPeerManager *NONNULL_PTR this_arg);
16569
16570 /**
16571  * Build the commitment secret from the seed and the commitment number
16572  */
16573 struct LDKThirtyTwoBytes build_commitment_secret(const uint8_t (*commitment_seed)[32], uint64_t idx);
16574
16575 /**
16576  * Derives a per-commitment-transaction private key (eg an htlc key or delayed_payment key)
16577  * from the base secret and the per_commitment_point.
16578  *
16579  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
16580  * generated (ie our own).
16581  */
16582 struct LDKCResult_SecretKeyErrorZ derive_private_key(struct LDKPublicKey per_commitment_point, const uint8_t (*base_secret)[32]);
16583
16584 /**
16585  * Derives a per-commitment-transaction public key (eg an htlc key or a delayed_payment key)
16586  * from the base point and the per_commitment_key. This is the public equivalent of
16587  * derive_private_key - using only public keys to derive a public key instead of private keys.
16588  *
16589  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
16590  * generated (ie our own).
16591  */
16592 struct LDKCResult_PublicKeyErrorZ derive_public_key(struct LDKPublicKey per_commitment_point, struct LDKPublicKey base_point);
16593
16594 /**
16595  * Derives a per-commitment-transaction revocation key from its constituent parts.
16596  *
16597  * Only the cheating participant owns a valid witness to propagate a revoked
16598  * commitment transaction, thus per_commitment_secret always come from cheater
16599  * and revocation_base_secret always come from punisher, which is the broadcaster
16600  * of the transaction spending with this key knowledge.
16601  *
16602  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
16603  * generated (ie our own).
16604  */
16605 struct LDKCResult_SecretKeyErrorZ derive_private_revocation_key(const uint8_t (*per_commitment_secret)[32], const uint8_t (*countersignatory_revocation_base_secret)[32]);
16606
16607 /**
16608  * Derives a per-commitment-transaction revocation public key from its constituent parts. This is
16609  * the public equivalend of derive_private_revocation_key - using only public keys to derive a
16610  * public key instead of private keys.
16611  *
16612  * Only the cheating participant owns a valid witness to propagate a revoked
16613  * commitment transaction, thus per_commitment_point always come from cheater
16614  * and revocation_base_point always come from punisher, which is the broadcaster
16615  * of the transaction spending with this key knowledge.
16616  *
16617  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
16618  * generated (ie our own).
16619  */
16620 struct LDKCResult_PublicKeyErrorZ derive_public_revocation_key(struct LDKPublicKey per_commitment_point, struct LDKPublicKey countersignatory_revocation_base_point);
16621
16622 /**
16623  * Frees any resources used by the TxCreationKeys, if is_owned is set and inner is non-NULL.
16624  */
16625 void TxCreationKeys_free(struct LDKTxCreationKeys this_obj);
16626
16627 /**
16628  * The broadcaster's per-commitment public key which was used to derive the other keys.
16629  */
16630 struct LDKPublicKey TxCreationKeys_get_per_commitment_point(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
16631
16632 /**
16633  * The broadcaster's per-commitment public key which was used to derive the other keys.
16634  */
16635 void TxCreationKeys_set_per_commitment_point(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
16636
16637 /**
16638  * The revocation key which is used to allow the broadcaster of the commitment
16639  * transaction to provide their counterparty the ability to punish them if they broadcast
16640  * an old state.
16641  */
16642 struct LDKPublicKey TxCreationKeys_get_revocation_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
16643
16644 /**
16645  * The revocation key which is used to allow the broadcaster of the commitment
16646  * transaction to provide their counterparty the ability to punish them if they broadcast
16647  * an old state.
16648  */
16649 void TxCreationKeys_set_revocation_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
16650
16651 /**
16652  * Broadcaster's HTLC Key
16653  */
16654 struct LDKPublicKey TxCreationKeys_get_broadcaster_htlc_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
16655
16656 /**
16657  * Broadcaster's HTLC Key
16658  */
16659 void TxCreationKeys_set_broadcaster_htlc_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
16660
16661 /**
16662  * Countersignatory's HTLC Key
16663  */
16664 struct LDKPublicKey TxCreationKeys_get_countersignatory_htlc_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
16665
16666 /**
16667  * Countersignatory's HTLC Key
16668  */
16669 void TxCreationKeys_set_countersignatory_htlc_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
16670
16671 /**
16672  * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay)
16673  */
16674 struct LDKPublicKey TxCreationKeys_get_broadcaster_delayed_payment_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
16675
16676 /**
16677  * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay)
16678  */
16679 void TxCreationKeys_set_broadcaster_delayed_payment_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
16680
16681 /**
16682  * Constructs a new TxCreationKeys given each field
16683  */
16684 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);
16685
16686 /**
16687  * Creates a copy of the TxCreationKeys
16688  */
16689 struct LDKTxCreationKeys TxCreationKeys_clone(const struct LDKTxCreationKeys *NONNULL_PTR orig);
16690
16691 /**
16692  * Serialize the TxCreationKeys object into a byte array which can be read by TxCreationKeys_read
16693  */
16694 struct LDKCVec_u8Z TxCreationKeys_write(const struct LDKTxCreationKeys *NONNULL_PTR obj);
16695
16696 /**
16697  * Read a TxCreationKeys from a byte array, created by TxCreationKeys_write
16698  */
16699 struct LDKCResult_TxCreationKeysDecodeErrorZ TxCreationKeys_read(struct LDKu8slice ser);
16700
16701 /**
16702  * Frees any resources used by the ChannelPublicKeys, if is_owned is set and inner is non-NULL.
16703  */
16704 void ChannelPublicKeys_free(struct LDKChannelPublicKeys this_obj);
16705
16706 /**
16707  * The public key which is used to sign all commitment transactions, as it appears in the
16708  * on-chain channel lock-in 2-of-2 multisig output.
16709  */
16710 struct LDKPublicKey ChannelPublicKeys_get_funding_pubkey(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
16711
16712 /**
16713  * The public key which is used to sign all commitment transactions, as it appears in the
16714  * on-chain channel lock-in 2-of-2 multisig output.
16715  */
16716 void ChannelPublicKeys_set_funding_pubkey(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
16717
16718 /**
16719  * The base point which is used (with derive_public_revocation_key) to derive per-commitment
16720  * revocation keys. This is combined with the per-commitment-secret generated by the
16721  * counterparty to create a secret which the counterparty can reveal to revoke previous
16722  * states.
16723  */
16724 struct LDKPublicKey ChannelPublicKeys_get_revocation_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
16725
16726 /**
16727  * The base point which is used (with derive_public_revocation_key) to derive per-commitment
16728  * revocation keys. This is combined with the per-commitment-secret generated by the
16729  * counterparty to create a secret which the counterparty can reveal to revoke previous
16730  * states.
16731  */
16732 void ChannelPublicKeys_set_revocation_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
16733
16734 /**
16735  * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
16736  * spendable primary channel balance on the broadcaster's commitment transaction. This key is
16737  * static across every commitment transaction.
16738  */
16739 struct LDKPublicKey ChannelPublicKeys_get_payment_point(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
16740
16741 /**
16742  * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
16743  * spendable primary channel balance on the broadcaster's commitment transaction. This key is
16744  * static across every commitment transaction.
16745  */
16746 void ChannelPublicKeys_set_payment_point(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
16747
16748 /**
16749  * The base point which is used (with derive_public_key) to derive a per-commitment payment
16750  * public key which receives non-HTLC-encumbered funds which are only available for spending
16751  * after some delay (or can be claimed via the revocation path).
16752  */
16753 struct LDKPublicKey ChannelPublicKeys_get_delayed_payment_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
16754
16755 /**
16756  * The base point which is used (with derive_public_key) to derive a per-commitment payment
16757  * public key which receives non-HTLC-encumbered funds which are only available for spending
16758  * after some delay (or can be claimed via the revocation path).
16759  */
16760 void ChannelPublicKeys_set_delayed_payment_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
16761
16762 /**
16763  * The base point which is used (with derive_public_key) to derive a per-commitment public key
16764  * which is used to encumber HTLC-in-flight outputs.
16765  */
16766 struct LDKPublicKey ChannelPublicKeys_get_htlc_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
16767
16768 /**
16769  * The base point which is used (with derive_public_key) to derive a per-commitment public key
16770  * which is used to encumber HTLC-in-flight outputs.
16771  */
16772 void ChannelPublicKeys_set_htlc_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
16773
16774 /**
16775  * Constructs a new ChannelPublicKeys given each field
16776  */
16777 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);
16778
16779 /**
16780  * Creates a copy of the ChannelPublicKeys
16781  */
16782 struct LDKChannelPublicKeys ChannelPublicKeys_clone(const struct LDKChannelPublicKeys *NONNULL_PTR orig);
16783
16784 /**
16785  * Serialize the ChannelPublicKeys object into a byte array which can be read by ChannelPublicKeys_read
16786  */
16787 struct LDKCVec_u8Z ChannelPublicKeys_write(const struct LDKChannelPublicKeys *NONNULL_PTR obj);
16788
16789 /**
16790  * Read a ChannelPublicKeys from a byte array, created by ChannelPublicKeys_write
16791  */
16792 struct LDKCResult_ChannelPublicKeysDecodeErrorZ ChannelPublicKeys_read(struct LDKu8slice ser);
16793
16794 /**
16795  * Create per-state keys from channel base points and the per-commitment point.
16796  * Key set is asymmetric and can't be used as part of counter-signatory set of transactions.
16797  */
16798 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);
16799
16800 /**
16801  * Generate per-state keys from channel static keys.
16802  * Key set is asymmetric and can't be used as part of counter-signatory set of transactions.
16803  */
16804 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);
16805
16806 /**
16807  * A script either spendable by the revocation
16808  * key or the broadcaster_delayed_payment_key and satisfying the relative-locktime OP_CSV constrain.
16809  * Encumbering a `to_holder` output on a commitment transaction or 2nd-stage HTLC transactions.
16810  */
16811 struct LDKCVec_u8Z get_revokeable_redeemscript(struct LDKPublicKey revocation_key, uint16_t contest_delay, struct LDKPublicKey broadcaster_delayed_payment_key);
16812
16813 /**
16814  * Frees any resources used by the HTLCOutputInCommitment, if is_owned is set and inner is non-NULL.
16815  */
16816 void HTLCOutputInCommitment_free(struct LDKHTLCOutputInCommitment this_obj);
16817
16818 /**
16819  * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction).
16820  * Note that this is not the same as whether it is ountbound *from us*. To determine that you
16821  * need to compare this value to whether the commitment transaction in question is that of
16822  * the counterparty or our own.
16823  */
16824 bool HTLCOutputInCommitment_get_offered(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
16825
16826 /**
16827  * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction).
16828  * Note that this is not the same as whether it is ountbound *from us*. To determine that you
16829  * need to compare this value to whether the commitment transaction in question is that of
16830  * the counterparty or our own.
16831  */
16832 void HTLCOutputInCommitment_set_offered(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, bool val);
16833
16834 /**
16835  * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is
16836  * this divided by 1000.
16837  */
16838 uint64_t HTLCOutputInCommitment_get_amount_msat(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
16839
16840 /**
16841  * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is
16842  * this divided by 1000.
16843  */
16844 void HTLCOutputInCommitment_set_amount_msat(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, uint64_t val);
16845
16846 /**
16847  * The CLTV lock-time at which this HTLC expires.
16848  */
16849 uint32_t HTLCOutputInCommitment_get_cltv_expiry(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
16850
16851 /**
16852  * The CLTV lock-time at which this HTLC expires.
16853  */
16854 void HTLCOutputInCommitment_set_cltv_expiry(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, uint32_t val);
16855
16856 /**
16857  * The hash of the preimage which unlocks this HTLC.
16858  */
16859 const uint8_t (*HTLCOutputInCommitment_get_payment_hash(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr))[32];
16860
16861 /**
16862  * The hash of the preimage which unlocks this HTLC.
16863  */
16864 void HTLCOutputInCommitment_set_payment_hash(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
16865
16866 /**
16867  * The position within the commitment transactions' outputs. This may be None if the value is
16868  * below the dust limit (in which case no output appears in the commitment transaction and the
16869  * value is spent to additional transaction fees).
16870  */
16871 struct LDKCOption_u32Z HTLCOutputInCommitment_get_transaction_output_index(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
16872
16873 /**
16874  * The position within the commitment transactions' outputs. This may be None if the value is
16875  * below the dust limit (in which case no output appears in the commitment transaction and the
16876  * value is spent to additional transaction fees).
16877  */
16878 void HTLCOutputInCommitment_set_transaction_output_index(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val);
16879
16880 /**
16881  * Constructs a new HTLCOutputInCommitment given each field
16882  */
16883 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);
16884
16885 /**
16886  * Creates a copy of the HTLCOutputInCommitment
16887  */
16888 struct LDKHTLCOutputInCommitment HTLCOutputInCommitment_clone(const struct LDKHTLCOutputInCommitment *NONNULL_PTR orig);
16889
16890 /**
16891  * Serialize the HTLCOutputInCommitment object into a byte array which can be read by HTLCOutputInCommitment_read
16892  */
16893 struct LDKCVec_u8Z HTLCOutputInCommitment_write(const struct LDKHTLCOutputInCommitment *NONNULL_PTR obj);
16894
16895 /**
16896  * Read a HTLCOutputInCommitment from a byte array, created by HTLCOutputInCommitment_write
16897  */
16898 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ HTLCOutputInCommitment_read(struct LDKu8slice ser);
16899
16900 /**
16901  * Gets the witness redeemscript for an HTLC output in a commitment transaction. Note that htlc
16902  * does not need to have its previous_output_index filled.
16903  */
16904 struct LDKCVec_u8Z get_htlc_redeemscript(const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc, const struct LDKTxCreationKeys *NONNULL_PTR keys);
16905
16906 /**
16907  * Gets the redeemscript for a funding output from the two funding public keys.
16908  * Note that the order of funding public keys does not matter.
16909  */
16910 struct LDKCVec_u8Z make_funding_redeemscript(struct LDKPublicKey broadcaster, struct LDKPublicKey countersignatory);
16911
16912 /**
16913  * Builds an unsigned HTLC-Success or HTLC-Timeout transaction from the given channel and HTLC
16914  * parameters. This is used by [`TrustedCommitmentTransaction::get_htlc_sigs`] to fetch the
16915  * transaction which needs signing, and can be used to construct an HTLC transaction which is
16916  * broadcastable given a counterparty HTLC signature.
16917  *
16918  * Panics if htlc.transaction_output_index.is_none() (as such HTLCs do not appear in the
16919  * commitment transaction).
16920  */
16921 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);
16922
16923 /**
16924  * Frees any resources used by the ChannelTransactionParameters, if is_owned is set and inner is non-NULL.
16925  */
16926 void ChannelTransactionParameters_free(struct LDKChannelTransactionParameters this_obj);
16927
16928 /**
16929  * Holder public keys
16930  */
16931 struct LDKChannelPublicKeys ChannelTransactionParameters_get_holder_pubkeys(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
16932
16933 /**
16934  * Holder public keys
16935  */
16936 void ChannelTransactionParameters_set_holder_pubkeys(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelPublicKeys val);
16937
16938 /**
16939  * The contest delay selected by the holder, which applies to counterparty-broadcast transactions
16940  */
16941 uint16_t ChannelTransactionParameters_get_holder_selected_contest_delay(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
16942
16943 /**
16944  * The contest delay selected by the holder, which applies to counterparty-broadcast transactions
16945  */
16946 void ChannelTransactionParameters_set_holder_selected_contest_delay(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, uint16_t val);
16947
16948 /**
16949  * Whether the holder is the initiator of this channel.
16950  * This is an input to the commitment number obscure factor computation.
16951  */
16952 bool ChannelTransactionParameters_get_is_outbound_from_holder(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
16953
16954 /**
16955  * Whether the holder is the initiator of this channel.
16956  * This is an input to the commitment number obscure factor computation.
16957  */
16958 void ChannelTransactionParameters_set_is_outbound_from_holder(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, bool val);
16959
16960 /**
16961  * The late-bound counterparty channel transaction parameters.
16962  * These parameters are populated at the point in the protocol where the counterparty provides them.
16963  */
16964 struct LDKCounterpartyChannelTransactionParameters ChannelTransactionParameters_get_counterparty_parameters(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
16965
16966 /**
16967  * The late-bound counterparty channel transaction parameters.
16968  * These parameters are populated at the point in the protocol where the counterparty provides them.
16969  */
16970 void ChannelTransactionParameters_set_counterparty_parameters(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKCounterpartyChannelTransactionParameters val);
16971
16972 /**
16973  * The late-bound funding outpoint
16974  */
16975 struct LDKOutPoint ChannelTransactionParameters_get_funding_outpoint(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
16976
16977 /**
16978  * The late-bound funding outpoint
16979  */
16980 void ChannelTransactionParameters_set_funding_outpoint(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKOutPoint val);
16981
16982 /**
16983  * Constructs a new ChannelTransactionParameters given each field
16984  */
16985 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);
16986
16987 /**
16988  * Creates a copy of the ChannelTransactionParameters
16989  */
16990 struct LDKChannelTransactionParameters ChannelTransactionParameters_clone(const struct LDKChannelTransactionParameters *NONNULL_PTR orig);
16991
16992 /**
16993  * Frees any resources used by the CounterpartyChannelTransactionParameters, if is_owned is set and inner is non-NULL.
16994  */
16995 void CounterpartyChannelTransactionParameters_free(struct LDKCounterpartyChannelTransactionParameters this_obj);
16996
16997 /**
16998  * Counter-party public keys
16999  */
17000 struct LDKChannelPublicKeys CounterpartyChannelTransactionParameters_get_pubkeys(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr);
17001
17002 /**
17003  * Counter-party public keys
17004  */
17005 void CounterpartyChannelTransactionParameters_set_pubkeys(struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelPublicKeys val);
17006
17007 /**
17008  * The contest delay selected by the counterparty, which applies to holder-broadcast transactions
17009  */
17010 uint16_t CounterpartyChannelTransactionParameters_get_selected_contest_delay(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr);
17011
17012 /**
17013  * The contest delay selected by the counterparty, which applies to holder-broadcast transactions
17014  */
17015 void CounterpartyChannelTransactionParameters_set_selected_contest_delay(struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr, uint16_t val);
17016
17017 /**
17018  * Constructs a new CounterpartyChannelTransactionParameters given each field
17019  */
17020 MUST_USE_RES struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_new(struct LDKChannelPublicKeys pubkeys_arg, uint16_t selected_contest_delay_arg);
17021
17022 /**
17023  * Creates a copy of the CounterpartyChannelTransactionParameters
17024  */
17025 struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_clone(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR orig);
17026
17027 /**
17028  * Whether the late bound parameters are populated.
17029  */
17030 MUST_USE_RES bool ChannelTransactionParameters_is_populated(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
17031
17032 /**
17033  * Convert the holder/counterparty parameters to broadcaster/countersignatory-organized parameters,
17034  * given that the holder is the broadcaster.
17035  *
17036  * self.is_populated() must be true before calling this function.
17037  */
17038 MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionParameters_as_holder_broadcastable(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
17039
17040 /**
17041  * Convert the holder/counterparty parameters to broadcaster/countersignatory-organized parameters,
17042  * given that the counterparty is the broadcaster.
17043  *
17044  * self.is_populated() must be true before calling this function.
17045  */
17046 MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionParameters_as_counterparty_broadcastable(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
17047
17048 /**
17049  * Serialize the CounterpartyChannelTransactionParameters object into a byte array which can be read by CounterpartyChannelTransactionParameters_read
17050  */
17051 struct LDKCVec_u8Z CounterpartyChannelTransactionParameters_write(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR obj);
17052
17053 /**
17054  * Read a CounterpartyChannelTransactionParameters from a byte array, created by CounterpartyChannelTransactionParameters_write
17055  */
17056 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CounterpartyChannelTransactionParameters_read(struct LDKu8slice ser);
17057
17058 /**
17059  * Serialize the ChannelTransactionParameters object into a byte array which can be read by ChannelTransactionParameters_read
17060  */
17061 struct LDKCVec_u8Z ChannelTransactionParameters_write(const struct LDKChannelTransactionParameters *NONNULL_PTR obj);
17062
17063 /**
17064  * Read a ChannelTransactionParameters from a byte array, created by ChannelTransactionParameters_write
17065  */
17066 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ ChannelTransactionParameters_read(struct LDKu8slice ser);
17067
17068 /**
17069  * Frees any resources used by the DirectedChannelTransactionParameters, if is_owned is set and inner is non-NULL.
17070  */
17071 void DirectedChannelTransactionParameters_free(struct LDKDirectedChannelTransactionParameters this_obj);
17072
17073 /**
17074  * Get the channel pubkeys for the broadcaster
17075  */
17076 MUST_USE_RES struct LDKChannelPublicKeys DirectedChannelTransactionParameters_broadcaster_pubkeys(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
17077
17078 /**
17079  * Get the channel pubkeys for the countersignatory
17080  */
17081 MUST_USE_RES struct LDKChannelPublicKeys DirectedChannelTransactionParameters_countersignatory_pubkeys(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
17082
17083 /**
17084  * Get the contest delay applicable to the transactions.
17085  * Note that the contest delay was selected by the countersignatory.
17086  */
17087 MUST_USE_RES uint16_t DirectedChannelTransactionParameters_contest_delay(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
17088
17089 /**
17090  * Whether the channel is outbound from the broadcaster.
17091  *
17092  * The boolean representing the side that initiated the channel is
17093  * an input to the commitment number obscure factor computation.
17094  */
17095 MUST_USE_RES bool DirectedChannelTransactionParameters_is_outbound(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
17096
17097 /**
17098  * The funding outpoint
17099  */
17100 MUST_USE_RES struct LDKOutPoint DirectedChannelTransactionParameters_funding_outpoint(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
17101
17102 /**
17103  * Frees any resources used by the HolderCommitmentTransaction, if is_owned is set and inner is non-NULL.
17104  */
17105 void HolderCommitmentTransaction_free(struct LDKHolderCommitmentTransaction this_obj);
17106
17107 /**
17108  * Our counterparty's signature for the transaction
17109  */
17110 struct LDKSignature HolderCommitmentTransaction_get_counterparty_sig(const struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr);
17111
17112 /**
17113  * Our counterparty's signature for the transaction
17114  */
17115 void HolderCommitmentTransaction_set_counterparty_sig(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKSignature val);
17116
17117 /**
17118  * All non-dust counterparty HTLC signatures, in the order they appear in the transaction
17119  */
17120 void HolderCommitmentTransaction_set_counterparty_htlc_sigs(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKCVec_SignatureZ val);
17121
17122 /**
17123  * Creates a copy of the HolderCommitmentTransaction
17124  */
17125 struct LDKHolderCommitmentTransaction HolderCommitmentTransaction_clone(const struct LDKHolderCommitmentTransaction *NONNULL_PTR orig);
17126
17127 /**
17128  * Serialize the HolderCommitmentTransaction object into a byte array which can be read by HolderCommitmentTransaction_read
17129  */
17130 struct LDKCVec_u8Z HolderCommitmentTransaction_write(const struct LDKHolderCommitmentTransaction *NONNULL_PTR obj);
17131
17132 /**
17133  * Read a HolderCommitmentTransaction from a byte array, created by HolderCommitmentTransaction_write
17134  */
17135 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ HolderCommitmentTransaction_read(struct LDKu8slice ser);
17136
17137 /**
17138  * Create a new holder transaction with the given counterparty signatures.
17139  * The funding keys are used to figure out which signature should go first when building the transaction for broadcast.
17140  */
17141 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);
17142
17143 /**
17144  * Frees any resources used by the BuiltCommitmentTransaction, if is_owned is set and inner is non-NULL.
17145  */
17146 void BuiltCommitmentTransaction_free(struct LDKBuiltCommitmentTransaction this_obj);
17147
17148 /**
17149  * The commitment transaction
17150  */
17151 struct LDKTransaction BuiltCommitmentTransaction_get_transaction(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr);
17152
17153 /**
17154  * The commitment transaction
17155  */
17156 void BuiltCommitmentTransaction_set_transaction(struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKTransaction val);
17157
17158 /**
17159  * The txid for the commitment transaction.
17160  *
17161  * This is provided as a performance optimization, instead of calling transaction.txid()
17162  * multiple times.
17163  */
17164 const uint8_t (*BuiltCommitmentTransaction_get_txid(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr))[32];
17165
17166 /**
17167  * The txid for the commitment transaction.
17168  *
17169  * This is provided as a performance optimization, instead of calling transaction.txid()
17170  * multiple times.
17171  */
17172 void BuiltCommitmentTransaction_set_txid(struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
17173
17174 /**
17175  * Constructs a new BuiltCommitmentTransaction given each field
17176  */
17177 MUST_USE_RES struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_new(struct LDKTransaction transaction_arg, struct LDKThirtyTwoBytes txid_arg);
17178
17179 /**
17180  * Creates a copy of the BuiltCommitmentTransaction
17181  */
17182 struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_clone(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR orig);
17183
17184 /**
17185  * Serialize the BuiltCommitmentTransaction object into a byte array which can be read by BuiltCommitmentTransaction_read
17186  */
17187 struct LDKCVec_u8Z BuiltCommitmentTransaction_write(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR obj);
17188
17189 /**
17190  * Read a BuiltCommitmentTransaction from a byte array, created by BuiltCommitmentTransaction_write
17191  */
17192 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ BuiltCommitmentTransaction_read(struct LDKu8slice ser);
17193
17194 /**
17195  * Get the SIGHASH_ALL sighash value of the transaction.
17196  *
17197  * This can be used to verify a signature.
17198  */
17199 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);
17200
17201 /**
17202  * Sign a transaction, either because we are counter-signing the counterparty's transaction or
17203  * because we are about to broadcast a holder transaction.
17204  */
17205 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);
17206
17207 /**
17208  * Frees any resources used by the CommitmentTransaction, if is_owned is set and inner is non-NULL.
17209  */
17210 void CommitmentTransaction_free(struct LDKCommitmentTransaction this_obj);
17211
17212 /**
17213  * Creates a copy of the CommitmentTransaction
17214  */
17215 struct LDKCommitmentTransaction CommitmentTransaction_clone(const struct LDKCommitmentTransaction *NONNULL_PTR orig);
17216
17217 /**
17218  * Serialize the CommitmentTransaction object into a byte array which can be read by CommitmentTransaction_read
17219  */
17220 struct LDKCVec_u8Z CommitmentTransaction_write(const struct LDKCommitmentTransaction *NONNULL_PTR obj);
17221
17222 /**
17223  * Read a CommitmentTransaction from a byte array, created by CommitmentTransaction_write
17224  */
17225 struct LDKCResult_CommitmentTransactionDecodeErrorZ CommitmentTransaction_read(struct LDKu8slice ser);
17226
17227 /**
17228  * The backwards-counting commitment number
17229  */
17230 MUST_USE_RES uint64_t CommitmentTransaction_commitment_number(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
17231
17232 /**
17233  * The value to be sent to the broadcaster
17234  */
17235 MUST_USE_RES uint64_t CommitmentTransaction_to_broadcaster_value_sat(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
17236
17237 /**
17238  * The value to be sent to the counterparty
17239  */
17240 MUST_USE_RES uint64_t CommitmentTransaction_to_countersignatory_value_sat(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
17241
17242 /**
17243  * The feerate paid per 1000-weight-unit in this commitment transaction.
17244  */
17245 MUST_USE_RES uint32_t CommitmentTransaction_feerate_per_kw(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
17246
17247 /**
17248  * Trust our pre-built transaction and derived transaction creation public keys.
17249  *
17250  * Applies a wrapper which allows access to these fields.
17251  *
17252  * This should only be used if you fully trust the builder of this object.  It should not
17253  *\tbe used by an external signer - instead use the verify function.
17254  */
17255 MUST_USE_RES struct LDKTrustedCommitmentTransaction CommitmentTransaction_trust(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
17256
17257 /**
17258  * Verify our pre-built transaction and derived transaction creation public keys.
17259  *
17260  * Applies a wrapper which allows access to these fields.
17261  *
17262  * An external validating signer must call this method before signing
17263  * or using the built transaction.
17264  */
17265 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);
17266
17267 /**
17268  * Frees any resources used by the TrustedCommitmentTransaction, if is_owned is set and inner is non-NULL.
17269  */
17270 void TrustedCommitmentTransaction_free(struct LDKTrustedCommitmentTransaction this_obj);
17271
17272 /**
17273  * The transaction ID of the built Bitcoin transaction
17274  */
17275 MUST_USE_RES struct LDKThirtyTwoBytes TrustedCommitmentTransaction_txid(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
17276
17277 /**
17278  * The pre-built Bitcoin commitment transaction
17279  */
17280 MUST_USE_RES struct LDKBuiltCommitmentTransaction TrustedCommitmentTransaction_built_transaction(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
17281
17282 /**
17283  * The pre-calculated transaction creation public keys.
17284  */
17285 MUST_USE_RES struct LDKTxCreationKeys TrustedCommitmentTransaction_keys(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
17286
17287 /**
17288  * Get a signature for each HTLC which was included in the commitment transaction (ie for
17289  * which HTLCOutputInCommitment::transaction_output_index.is_some()).
17290  *
17291  * The returned Vec has one entry for each HTLC, and in the same order.
17292  */
17293 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);
17294
17295 /**
17296  * Commitment transaction numbers which appear in the transactions themselves are XOR'd with a
17297  * shared secret first. This prevents on-chain observers from discovering how many commitment
17298  * transactions occurred in a channel before it was closed.
17299  *
17300  * This function gets the shared secret from relevant channel public keys and can be used to
17301  * \"decrypt\" the commitment transaction number given a commitment transaction on-chain.
17302  */
17303 uint64_t get_commitment_transaction_number_obscure_factor(struct LDKPublicKey broadcaster_payment_basepoint, struct LDKPublicKey countersignatory_payment_basepoint, bool outbound_from_broadcaster);
17304
17305 /**
17306  * Checks if two InitFeaturess contain equal inner contents.
17307  * This ignores pointers and is_owned flags and looks at the values in fields.
17308  * Two objects with NULL inner values will be considered "equal" here.
17309  */
17310 bool InitFeatures_eq(const struct LDKInitFeatures *NONNULL_PTR a, const struct LDKInitFeatures *NONNULL_PTR b);
17311
17312 /**
17313  * Checks if two NodeFeaturess contain equal inner contents.
17314  * This ignores pointers and is_owned flags and looks at the values in fields.
17315  * Two objects with NULL inner values will be considered "equal" here.
17316  */
17317 bool NodeFeatures_eq(const struct LDKNodeFeatures *NONNULL_PTR a, const struct LDKNodeFeatures *NONNULL_PTR b);
17318
17319 /**
17320  * Checks if two ChannelFeaturess contain equal inner contents.
17321  * This ignores pointers and is_owned flags and looks at the values in fields.
17322  * Two objects with NULL inner values will be considered "equal" here.
17323  */
17324 bool ChannelFeatures_eq(const struct LDKChannelFeatures *NONNULL_PTR a, const struct LDKChannelFeatures *NONNULL_PTR b);
17325
17326 /**
17327  * Checks if two InvoiceFeaturess contain equal inner contents.
17328  * This ignores pointers and is_owned flags and looks at the values in fields.
17329  * Two objects with NULL inner values will be considered "equal" here.
17330  */
17331 bool InvoiceFeatures_eq(const struct LDKInvoiceFeatures *NONNULL_PTR a, const struct LDKInvoiceFeatures *NONNULL_PTR b);
17332
17333 /**
17334  * Creates a copy of the InitFeatures
17335  */
17336 struct LDKInitFeatures InitFeatures_clone(const struct LDKInitFeatures *NONNULL_PTR orig);
17337
17338 /**
17339  * Creates a copy of the NodeFeatures
17340  */
17341 struct LDKNodeFeatures NodeFeatures_clone(const struct LDKNodeFeatures *NONNULL_PTR orig);
17342
17343 /**
17344  * Creates a copy of the ChannelFeatures
17345  */
17346 struct LDKChannelFeatures ChannelFeatures_clone(const struct LDKChannelFeatures *NONNULL_PTR orig);
17347
17348 /**
17349  * Creates a copy of the InvoiceFeatures
17350  */
17351 struct LDKInvoiceFeatures InvoiceFeatures_clone(const struct LDKInvoiceFeatures *NONNULL_PTR orig);
17352
17353 /**
17354  * Frees any resources used by the InitFeatures, if is_owned is set and inner is non-NULL.
17355  */
17356 void InitFeatures_free(struct LDKInitFeatures this_obj);
17357
17358 /**
17359  * Frees any resources used by the NodeFeatures, if is_owned is set and inner is non-NULL.
17360  */
17361 void NodeFeatures_free(struct LDKNodeFeatures this_obj);
17362
17363 /**
17364  * Frees any resources used by the ChannelFeatures, if is_owned is set and inner is non-NULL.
17365  */
17366 void ChannelFeatures_free(struct LDKChannelFeatures this_obj);
17367
17368 /**
17369  * Frees any resources used by the InvoiceFeatures, if is_owned is set and inner is non-NULL.
17370  */
17371 void InvoiceFeatures_free(struct LDKInvoiceFeatures this_obj);
17372
17373 /**
17374  * Create a blank Features with no features set
17375  */
17376 MUST_USE_RES struct LDKInitFeatures InitFeatures_empty(void);
17377
17378 /**
17379  * Creates a Features with the bits set which are known by the implementation
17380  */
17381 MUST_USE_RES struct LDKInitFeatures InitFeatures_known(void);
17382
17383 /**
17384  * Create a blank Features with no features set
17385  */
17386 MUST_USE_RES struct LDKNodeFeatures NodeFeatures_empty(void);
17387
17388 /**
17389  * Creates a Features with the bits set which are known by the implementation
17390  */
17391 MUST_USE_RES struct LDKNodeFeatures NodeFeatures_known(void);
17392
17393 /**
17394  * Create a blank Features with no features set
17395  */
17396 MUST_USE_RES struct LDKChannelFeatures ChannelFeatures_empty(void);
17397
17398 /**
17399  * Creates a Features with the bits set which are known by the implementation
17400  */
17401 MUST_USE_RES struct LDKChannelFeatures ChannelFeatures_known(void);
17402
17403 /**
17404  * Create a blank Features with no features set
17405  */
17406 MUST_USE_RES struct LDKInvoiceFeatures InvoiceFeatures_empty(void);
17407
17408 /**
17409  * Creates a Features with the bits set which are known by the implementation
17410  */
17411 MUST_USE_RES struct LDKInvoiceFeatures InvoiceFeatures_known(void);
17412
17413 /**
17414  * Returns whether the `payment_secret` feature is supported.
17415  */
17416 MUST_USE_RES bool InitFeatures_supports_payment_secret(const struct LDKInitFeatures *NONNULL_PTR this_arg);
17417
17418 /**
17419  * Returns whether the `payment_secret` feature is supported.
17420  */
17421 MUST_USE_RES bool NodeFeatures_supports_payment_secret(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
17422
17423 /**
17424  * Returns whether the `payment_secret` feature is supported.
17425  */
17426 MUST_USE_RES bool InvoiceFeatures_supports_payment_secret(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
17427
17428 /**
17429  * Serialize the InitFeatures object into a byte array which can be read by InitFeatures_read
17430  */
17431 struct LDKCVec_u8Z InitFeatures_write(const struct LDKInitFeatures *NONNULL_PTR obj);
17432
17433 /**
17434  * Serialize the NodeFeatures object into a byte array which can be read by NodeFeatures_read
17435  */
17436 struct LDKCVec_u8Z NodeFeatures_write(const struct LDKNodeFeatures *NONNULL_PTR obj);
17437
17438 /**
17439  * Serialize the ChannelFeatures object into a byte array which can be read by ChannelFeatures_read
17440  */
17441 struct LDKCVec_u8Z ChannelFeatures_write(const struct LDKChannelFeatures *NONNULL_PTR obj);
17442
17443 /**
17444  * Serialize the InvoiceFeatures object into a byte array which can be read by InvoiceFeatures_read
17445  */
17446 struct LDKCVec_u8Z InvoiceFeatures_write(const struct LDKInvoiceFeatures *NONNULL_PTR obj);
17447
17448 /**
17449  * Read a InitFeatures from a byte array, created by InitFeatures_write
17450  */
17451 struct LDKCResult_InitFeaturesDecodeErrorZ InitFeatures_read(struct LDKu8slice ser);
17452
17453 /**
17454  * Read a NodeFeatures from a byte array, created by NodeFeatures_write
17455  */
17456 struct LDKCResult_NodeFeaturesDecodeErrorZ NodeFeatures_read(struct LDKu8slice ser);
17457
17458 /**
17459  * Read a ChannelFeatures from a byte array, created by ChannelFeatures_write
17460  */
17461 struct LDKCResult_ChannelFeaturesDecodeErrorZ ChannelFeatures_read(struct LDKu8slice ser);
17462
17463 /**
17464  * Read a InvoiceFeatures from a byte array, created by InvoiceFeatures_write
17465  */
17466 struct LDKCResult_InvoiceFeaturesDecodeErrorZ InvoiceFeatures_read(struct LDKu8slice ser);
17467
17468 /**
17469  * Frees any resources used by the RouteHop, if is_owned is set and inner is non-NULL.
17470  */
17471 void RouteHop_free(struct LDKRouteHop this_obj);
17472
17473 /**
17474  * The node_id of the node at this hop.
17475  */
17476 struct LDKPublicKey RouteHop_get_pubkey(const struct LDKRouteHop *NONNULL_PTR this_ptr);
17477
17478 /**
17479  * The node_id of the node at this hop.
17480  */
17481 void RouteHop_set_pubkey(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKPublicKey val);
17482
17483 /**
17484  * The node_announcement features of the node at this hop. For the last hop, these may be
17485  * amended to match the features present in the invoice this node generated.
17486  */
17487 struct LDKNodeFeatures RouteHop_get_node_features(const struct LDKRouteHop *NONNULL_PTR this_ptr);
17488
17489 /**
17490  * The node_announcement features of the node at this hop. For the last hop, these may be
17491  * amended to match the features present in the invoice this node generated.
17492  */
17493 void RouteHop_set_node_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
17494
17495 /**
17496  * The channel that should be used from the previous hop to reach this node.
17497  */
17498 uint64_t RouteHop_get_short_channel_id(const struct LDKRouteHop *NONNULL_PTR this_ptr);
17499
17500 /**
17501  * The channel that should be used from the previous hop to reach this node.
17502  */
17503 void RouteHop_set_short_channel_id(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val);
17504
17505 /**
17506  * The channel_announcement features of the channel that should be used from the previous hop
17507  * to reach this node.
17508  */
17509 struct LDKChannelFeatures RouteHop_get_channel_features(const struct LDKRouteHop *NONNULL_PTR this_ptr);
17510
17511 /**
17512  * The channel_announcement features of the channel that should be used from the previous hop
17513  * to reach this node.
17514  */
17515 void RouteHop_set_channel_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
17516
17517 /**
17518  * The fee taken on this hop (for paying for the use of the *next* channel in the path).
17519  * For the last hop, this should be the full value of the payment (might be more than
17520  * requested if we had to match htlc_minimum_msat).
17521  */
17522 uint64_t RouteHop_get_fee_msat(const struct LDKRouteHop *NONNULL_PTR this_ptr);
17523
17524 /**
17525  * The fee taken on this hop (for paying for the use of the *next* channel in the path).
17526  * For the last hop, this should be the full value of the payment (might be more than
17527  * requested if we had to match htlc_minimum_msat).
17528  */
17529 void RouteHop_set_fee_msat(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val);
17530
17531 /**
17532  * The CLTV delta added for this hop. For the last hop, this should be the full CLTV value
17533  * expected at the destination, in excess of the current block height.
17534  */
17535 uint32_t RouteHop_get_cltv_expiry_delta(const struct LDKRouteHop *NONNULL_PTR this_ptr);
17536
17537 /**
17538  * The CLTV delta added for this hop. For the last hop, this should be the full CLTV value
17539  * expected at the destination, in excess of the current block height.
17540  */
17541 void RouteHop_set_cltv_expiry_delta(struct LDKRouteHop *NONNULL_PTR this_ptr, uint32_t val);
17542
17543 /**
17544  * Constructs a new RouteHop given each field
17545  */
17546 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);
17547
17548 /**
17549  * Creates a copy of the RouteHop
17550  */
17551 struct LDKRouteHop RouteHop_clone(const struct LDKRouteHop *NONNULL_PTR orig);
17552
17553 /**
17554  * Serialize the RouteHop object into a byte array which can be read by RouteHop_read
17555  */
17556 struct LDKCVec_u8Z RouteHop_write(const struct LDKRouteHop *NONNULL_PTR obj);
17557
17558 /**
17559  * Read a RouteHop from a byte array, created by RouteHop_write
17560  */
17561 struct LDKCResult_RouteHopDecodeErrorZ RouteHop_read(struct LDKu8slice ser);
17562
17563 /**
17564  * Frees any resources used by the Route, if is_owned is set and inner is non-NULL.
17565  */
17566 void Route_free(struct LDKRoute this_obj);
17567
17568 /**
17569  * The list of routes taken for a single (potentially-)multi-part payment. The pubkey of the
17570  * last RouteHop in each path must be the same.
17571  * Each entry represents a list of hops, NOT INCLUDING our own, where the last hop is the
17572  * destination. Thus, this must always be at least length one. While the maximum length of any
17573  * given path is variable, keeping the length of any path to less than 20 should currently
17574  * ensure it is viable.
17575  */
17576 void Route_set_paths(struct LDKRoute *NONNULL_PTR this_ptr, struct LDKCVec_CVec_RouteHopZZ val);
17577
17578 /**
17579  * Constructs a new Route given each field
17580  */
17581 MUST_USE_RES struct LDKRoute Route_new(struct LDKCVec_CVec_RouteHopZZ paths_arg);
17582
17583 /**
17584  * Creates a copy of the Route
17585  */
17586 struct LDKRoute Route_clone(const struct LDKRoute *NONNULL_PTR orig);
17587
17588 /**
17589  * Serialize the Route object into a byte array which can be read by Route_read
17590  */
17591 struct LDKCVec_u8Z Route_write(const struct LDKRoute *NONNULL_PTR obj);
17592
17593 /**
17594  * Read a Route from a byte array, created by Route_write
17595  */
17596 struct LDKCResult_RouteDecodeErrorZ Route_read(struct LDKu8slice ser);
17597
17598 /**
17599  * Frees any resources used by the RouteHint, if is_owned is set and inner is non-NULL.
17600  */
17601 void RouteHint_free(struct LDKRouteHint this_obj);
17602
17603 /**
17604  * Checks if two RouteHints contain equal inner contents.
17605  * This ignores pointers and is_owned flags and looks at the values in fields.
17606  * Two objects with NULL inner values will be considered "equal" here.
17607  */
17608 bool RouteHint_eq(const struct LDKRouteHint *NONNULL_PTR a, const struct LDKRouteHint *NONNULL_PTR b);
17609
17610 /**
17611  * Creates a copy of the RouteHint
17612  */
17613 struct LDKRouteHint RouteHint_clone(const struct LDKRouteHint *NONNULL_PTR orig);
17614
17615 /**
17616  * Frees any resources used by the RouteHintHop, if is_owned is set and inner is non-NULL.
17617  */
17618 void RouteHintHop_free(struct LDKRouteHintHop this_obj);
17619
17620 /**
17621  * The node_id of the non-target end of the route
17622  */
17623 struct LDKPublicKey RouteHintHop_get_src_node_id(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
17624
17625 /**
17626  * The node_id of the non-target end of the route
17627  */
17628 void RouteHintHop_set_src_node_id(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKPublicKey val);
17629
17630 /**
17631  * The short_channel_id of this channel
17632  */
17633 uint64_t RouteHintHop_get_short_channel_id(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
17634
17635 /**
17636  * The short_channel_id of this channel
17637  */
17638 void RouteHintHop_set_short_channel_id(struct LDKRouteHintHop *NONNULL_PTR this_ptr, uint64_t val);
17639
17640 /**
17641  * The fees which must be paid to use this channel
17642  */
17643 struct LDKRoutingFees RouteHintHop_get_fees(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
17644
17645 /**
17646  * The fees which must be paid to use this channel
17647  */
17648 void RouteHintHop_set_fees(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
17649
17650 /**
17651  * The difference in CLTV values between this node and the next node.
17652  */
17653 uint16_t RouteHintHop_get_cltv_expiry_delta(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
17654
17655 /**
17656  * The difference in CLTV values between this node and the next node.
17657  */
17658 void RouteHintHop_set_cltv_expiry_delta(struct LDKRouteHintHop *NONNULL_PTR this_ptr, uint16_t val);
17659
17660 /**
17661  * The minimum value, in msat, which must be relayed to the next hop.
17662  */
17663 struct LDKCOption_u64Z RouteHintHop_get_htlc_minimum_msat(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
17664
17665 /**
17666  * The minimum value, in msat, which must be relayed to the next hop.
17667  */
17668 void RouteHintHop_set_htlc_minimum_msat(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
17669
17670 /**
17671  * The maximum value in msat available for routing with a single HTLC.
17672  */
17673 struct LDKCOption_u64Z RouteHintHop_get_htlc_maximum_msat(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
17674
17675 /**
17676  * The maximum value in msat available for routing with a single HTLC.
17677  */
17678 void RouteHintHop_set_htlc_maximum_msat(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
17679
17680 /**
17681  * Constructs a new RouteHintHop given each field
17682  */
17683 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);
17684
17685 /**
17686  * Checks if two RouteHintHops contain equal inner contents.
17687  * This ignores pointers and is_owned flags and looks at the values in fields.
17688  * Two objects with NULL inner values will be considered "equal" here.
17689  */
17690 bool RouteHintHop_eq(const struct LDKRouteHintHop *NONNULL_PTR a, const struct LDKRouteHintHop *NONNULL_PTR b);
17691
17692 /**
17693  * Creates a copy of the RouteHintHop
17694  */
17695 struct LDKRouteHintHop RouteHintHop_clone(const struct LDKRouteHintHop *NONNULL_PTR orig);
17696
17697 /**
17698  * Gets a keysend route from us (payer) to the given target node (payee). This is needed because
17699  * keysend payments do not have an invoice from which to pull the payee's supported features, which
17700  * makes it tricky to otherwise supply the `payee_features` parameter of `get_route`.
17701  */
17702 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);
17703
17704 /**
17705  * Gets a route from us (payer) to the given target node (payee).
17706  *
17707  * If the payee provided features in their invoice, they should be provided via payee_features.
17708  * Without this, MPP will only be used if the payee's features are available in the network graph.
17709  *
17710  * Private routing paths between a public node and the target may be included in `last_hops`.
17711  * Currently, only the last hop in each path is considered.
17712  *
17713  * If some channels aren't announced, it may be useful to fill in a first_hops with the
17714  * results from a local ChannelManager::list_usable_channels() call. If it is filled in, our
17715  * view of our local channels (from net_graph_msg_handler) will be ignored, and only those
17716  * in first_hops will be used.
17717  *
17718  * Panics if first_hops contains channels without short_channel_ids
17719  * (ChannelManager::list_usable_channels will never include such channels).
17720  *
17721  * The fees on channels from us to next-hops are ignored (as they are assumed to all be
17722  * equal), however the enabled/disabled bit on such channels as well as the
17723  * htlc_minimum_msat/htlc_maximum_msat *are* checked as they may change based on the receiving node.
17724  */
17725 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);
17726
17727 /**
17728  * Frees any resources used by the NetworkGraph, if is_owned is set and inner is non-NULL.
17729  */
17730 void NetworkGraph_free(struct LDKNetworkGraph this_obj);
17731
17732 /**
17733  * Creates a copy of the NetworkGraph
17734  */
17735 struct LDKNetworkGraph NetworkGraph_clone(const struct LDKNetworkGraph *NONNULL_PTR orig);
17736
17737 /**
17738  * Frees any resources used by the LockedNetworkGraph, if is_owned is set and inner is non-NULL.
17739  */
17740 void LockedNetworkGraph_free(struct LDKLockedNetworkGraph this_obj);
17741
17742 /**
17743  * Frees any resources used by the NetGraphMsgHandler, if is_owned is set and inner is non-NULL.
17744  */
17745 void NetGraphMsgHandler_free(struct LDKNetGraphMsgHandler this_obj);
17746
17747 /**
17748  * Creates a new tracker of the actual state of the network of channels and nodes,
17749  * assuming a fresh network graph.
17750  * Chain monitor is used to make sure announced channels exist on-chain,
17751  * channel data is correct, and that the announcement is signed with
17752  * channel owners' keys.
17753  */
17754 MUST_USE_RES struct LDKNetGraphMsgHandler NetGraphMsgHandler_new(struct LDKThirtyTwoBytes genesis_hash, struct LDKAccess *chain_access, struct LDKLogger logger);
17755
17756 /**
17757  * Creates a new tracker of the actual state of the network of channels and nodes,
17758  * assuming an existing Network Graph.
17759  */
17760 MUST_USE_RES struct LDKNetGraphMsgHandler NetGraphMsgHandler_from_net_graph(struct LDKAccess *chain_access, struct LDKLogger logger, struct LDKNetworkGraph network_graph);
17761
17762 /**
17763  * Adds a provider used to check new announcements. Does not affect
17764  * existing announcements unless they are updated.
17765  * Add, update or remove the provider would replace the current one.
17766  */
17767 void NetGraphMsgHandler_add_chain_access(struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg, struct LDKAccess *chain_access);
17768
17769 /**
17770  * Take a read lock on the network_graph and return it in the C-bindings
17771  * newtype helper. This is likely only useful when called via the C
17772  * bindings as you can call `self.network_graph.read().unwrap()` in Rust
17773  * yourself.
17774  */
17775 MUST_USE_RES struct LDKLockedNetworkGraph NetGraphMsgHandler_read_locked_graph(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg);
17776
17777 /**
17778  * Get a reference to the NetworkGraph which this read-lock contains.
17779  */
17780 MUST_USE_RES struct LDKNetworkGraph LockedNetworkGraph_graph(const struct LDKLockedNetworkGraph *NONNULL_PTR this_arg);
17781
17782 /**
17783  * Constructs a new RoutingMessageHandler which calls the relevant methods on this_arg.
17784  * This copies the `inner` pointer in this_arg and thus the returned RoutingMessageHandler must be freed before this_arg is
17785  */
17786 struct LDKRoutingMessageHandler NetGraphMsgHandler_as_RoutingMessageHandler(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg);
17787
17788 /**
17789  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
17790  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
17791  */
17792 struct LDKMessageSendEventsProvider NetGraphMsgHandler_as_MessageSendEventsProvider(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg);
17793
17794 /**
17795  * Frees any resources used by the DirectionalChannelInfo, if is_owned is set and inner is non-NULL.
17796  */
17797 void DirectionalChannelInfo_free(struct LDKDirectionalChannelInfo this_obj);
17798
17799 /**
17800  * When the last update to the channel direction was issued.
17801  * Value is opaque, as set in the announcement.
17802  */
17803 uint32_t DirectionalChannelInfo_get_last_update(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
17804
17805 /**
17806  * When the last update to the channel direction was issued.
17807  * Value is opaque, as set in the announcement.
17808  */
17809 void DirectionalChannelInfo_set_last_update(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, uint32_t val);
17810
17811 /**
17812  * Whether the channel can be currently used for payments (in this one direction).
17813  */
17814 bool DirectionalChannelInfo_get_enabled(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
17815
17816 /**
17817  * Whether the channel can be currently used for payments (in this one direction).
17818  */
17819 void DirectionalChannelInfo_set_enabled(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, bool val);
17820
17821 /**
17822  * The difference in CLTV values that you must have when routing through this channel.
17823  */
17824 uint16_t DirectionalChannelInfo_get_cltv_expiry_delta(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
17825
17826 /**
17827  * The difference in CLTV values that you must have when routing through this channel.
17828  */
17829 void DirectionalChannelInfo_set_cltv_expiry_delta(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, uint16_t val);
17830
17831 /**
17832  * The minimum value, which must be relayed to the next hop via the channel
17833  */
17834 uint64_t DirectionalChannelInfo_get_htlc_minimum_msat(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
17835
17836 /**
17837  * The minimum value, which must be relayed to the next hop via the channel
17838  */
17839 void DirectionalChannelInfo_set_htlc_minimum_msat(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, uint64_t val);
17840
17841 /**
17842  * The maximum value which may be relayed to the next hop via the channel.
17843  */
17844 struct LDKCOption_u64Z DirectionalChannelInfo_get_htlc_maximum_msat(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
17845
17846 /**
17847  * The maximum value which may be relayed to the next hop via the channel.
17848  */
17849 void DirectionalChannelInfo_set_htlc_maximum_msat(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
17850
17851 /**
17852  * Fees charged when the channel is used for routing
17853  */
17854 struct LDKRoutingFees DirectionalChannelInfo_get_fees(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
17855
17856 /**
17857  * Fees charged when the channel is used for routing
17858  */
17859 void DirectionalChannelInfo_set_fees(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
17860
17861 /**
17862  * Most recent update for the channel received from the network
17863  * Mostly redundant with the data we store in fields explicitly.
17864  * Everything else is useful only for sending out for initial routing sync.
17865  * Not stored if contains excess data to prevent DoS.
17866  */
17867 struct LDKChannelUpdate DirectionalChannelInfo_get_last_update_message(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr);
17868
17869 /**
17870  * Most recent update for the channel received from the network
17871  * Mostly redundant with the data we store in fields explicitly.
17872  * Everything else is useful only for sending out for initial routing sync.
17873  * Not stored if contains excess data to prevent DoS.
17874  */
17875 void DirectionalChannelInfo_set_last_update_message(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelUpdate val);
17876
17877 /**
17878  * Constructs a new DirectionalChannelInfo given each field
17879  */
17880 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);
17881
17882 /**
17883  * Creates a copy of the DirectionalChannelInfo
17884  */
17885 struct LDKDirectionalChannelInfo DirectionalChannelInfo_clone(const struct LDKDirectionalChannelInfo *NONNULL_PTR orig);
17886
17887 /**
17888  * Serialize the DirectionalChannelInfo object into a byte array which can be read by DirectionalChannelInfo_read
17889  */
17890 struct LDKCVec_u8Z DirectionalChannelInfo_write(const struct LDKDirectionalChannelInfo *NONNULL_PTR obj);
17891
17892 /**
17893  * Read a DirectionalChannelInfo from a byte array, created by DirectionalChannelInfo_write
17894  */
17895 struct LDKCResult_DirectionalChannelInfoDecodeErrorZ DirectionalChannelInfo_read(struct LDKu8slice ser);
17896
17897 /**
17898  * Frees any resources used by the ChannelInfo, if is_owned is set and inner is non-NULL.
17899  */
17900 void ChannelInfo_free(struct LDKChannelInfo this_obj);
17901
17902 /**
17903  * Protocol features of a channel communicated during its announcement
17904  */
17905 struct LDKChannelFeatures ChannelInfo_get_features(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
17906
17907 /**
17908  * Protocol features of a channel communicated during its announcement
17909  */
17910 void ChannelInfo_set_features(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
17911
17912 /**
17913  * Source node of the first direction of a channel
17914  */
17915 struct LDKPublicKey ChannelInfo_get_node_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
17916
17917 /**
17918  * Source node of the first direction of a channel
17919  */
17920 void ChannelInfo_set_node_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKPublicKey val);
17921
17922 /**
17923  * Details about the first direction of a channel
17924  */
17925 struct LDKDirectionalChannelInfo ChannelInfo_get_one_to_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
17926
17927 /**
17928  * Details about the first direction of a channel
17929  */
17930 void ChannelInfo_set_one_to_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKDirectionalChannelInfo val);
17931
17932 /**
17933  * Source node of the second direction of a channel
17934  */
17935 struct LDKPublicKey ChannelInfo_get_node_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
17936
17937 /**
17938  * Source node of the second direction of a channel
17939  */
17940 void ChannelInfo_set_node_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKPublicKey val);
17941
17942 /**
17943  * Details about the second direction of a channel
17944  */
17945 struct LDKDirectionalChannelInfo ChannelInfo_get_two_to_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
17946
17947 /**
17948  * Details about the second direction of a channel
17949  */
17950 void ChannelInfo_set_two_to_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKDirectionalChannelInfo val);
17951
17952 /**
17953  * The channel capacity as seen on-chain, if chain lookup is available.
17954  */
17955 struct LDKCOption_u64Z ChannelInfo_get_capacity_sats(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
17956
17957 /**
17958  * The channel capacity as seen on-chain, if chain lookup is available.
17959  */
17960 void ChannelInfo_set_capacity_sats(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
17961
17962 /**
17963  * An initial announcement of the channel
17964  * Mostly redundant with the data we store in fields explicitly.
17965  * Everything else is useful only for sending out for initial routing sync.
17966  * Not stored if contains excess data to prevent DoS.
17967  */
17968 struct LDKChannelAnnouncement ChannelInfo_get_announcement_message(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
17969
17970 /**
17971  * An initial announcement of the channel
17972  * Mostly redundant with the data we store in fields explicitly.
17973  * Everything else is useful only for sending out for initial routing sync.
17974  * Not stored if contains excess data to prevent DoS.
17975  */
17976 void ChannelInfo_set_announcement_message(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelAnnouncement val);
17977
17978 /**
17979  * Constructs a new ChannelInfo given each field
17980  */
17981 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);
17982
17983 /**
17984  * Creates a copy of the ChannelInfo
17985  */
17986 struct LDKChannelInfo ChannelInfo_clone(const struct LDKChannelInfo *NONNULL_PTR orig);
17987
17988 /**
17989  * Serialize the ChannelInfo object into a byte array which can be read by ChannelInfo_read
17990  */
17991 struct LDKCVec_u8Z ChannelInfo_write(const struct LDKChannelInfo *NONNULL_PTR obj);
17992
17993 /**
17994  * Read a ChannelInfo from a byte array, created by ChannelInfo_write
17995  */
17996 struct LDKCResult_ChannelInfoDecodeErrorZ ChannelInfo_read(struct LDKu8slice ser);
17997
17998 /**
17999  * Frees any resources used by the RoutingFees, if is_owned is set and inner is non-NULL.
18000  */
18001 void RoutingFees_free(struct LDKRoutingFees this_obj);
18002
18003 /**
18004  * Flat routing fee in satoshis
18005  */
18006 uint32_t RoutingFees_get_base_msat(const struct LDKRoutingFees *NONNULL_PTR this_ptr);
18007
18008 /**
18009  * Flat routing fee in satoshis
18010  */
18011 void RoutingFees_set_base_msat(struct LDKRoutingFees *NONNULL_PTR this_ptr, uint32_t val);
18012
18013 /**
18014  * Liquidity-based routing fee in millionths of a routed amount.
18015  * In other words, 10000 is 1%.
18016  */
18017 uint32_t RoutingFees_get_proportional_millionths(const struct LDKRoutingFees *NONNULL_PTR this_ptr);
18018
18019 /**
18020  * Liquidity-based routing fee in millionths of a routed amount.
18021  * In other words, 10000 is 1%.
18022  */
18023 void RoutingFees_set_proportional_millionths(struct LDKRoutingFees *NONNULL_PTR this_ptr, uint32_t val);
18024
18025 /**
18026  * Constructs a new RoutingFees given each field
18027  */
18028 MUST_USE_RES struct LDKRoutingFees RoutingFees_new(uint32_t base_msat_arg, uint32_t proportional_millionths_arg);
18029
18030 /**
18031  * Checks if two RoutingFeess contain equal inner contents.
18032  * This ignores pointers and is_owned flags and looks at the values in fields.
18033  * Two objects with NULL inner values will be considered "equal" here.
18034  */
18035 bool RoutingFees_eq(const struct LDKRoutingFees *NONNULL_PTR a, const struct LDKRoutingFees *NONNULL_PTR b);
18036
18037 /**
18038  * Creates a copy of the RoutingFees
18039  */
18040 struct LDKRoutingFees RoutingFees_clone(const struct LDKRoutingFees *NONNULL_PTR orig);
18041
18042 /**
18043  * Serialize the RoutingFees object into a byte array which can be read by RoutingFees_read
18044  */
18045 struct LDKCVec_u8Z RoutingFees_write(const struct LDKRoutingFees *NONNULL_PTR obj);
18046
18047 /**
18048  * Read a RoutingFees from a byte array, created by RoutingFees_write
18049  */
18050 struct LDKCResult_RoutingFeesDecodeErrorZ RoutingFees_read(struct LDKu8slice ser);
18051
18052 /**
18053  * Frees any resources used by the NodeAnnouncementInfo, if is_owned is set and inner is non-NULL.
18054  */
18055 void NodeAnnouncementInfo_free(struct LDKNodeAnnouncementInfo this_obj);
18056
18057 /**
18058  * Protocol features the node announced support for
18059  */
18060 struct LDKNodeFeatures NodeAnnouncementInfo_get_features(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
18061
18062 /**
18063  * Protocol features the node announced support for
18064  */
18065 void NodeAnnouncementInfo_set_features(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
18066
18067 /**
18068  * When the last known update to the node state was issued.
18069  * Value is opaque, as set in the announcement.
18070  */
18071 uint32_t NodeAnnouncementInfo_get_last_update(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
18072
18073 /**
18074  * When the last known update to the node state was issued.
18075  * Value is opaque, as set in the announcement.
18076  */
18077 void NodeAnnouncementInfo_set_last_update(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, uint32_t val);
18078
18079 /**
18080  * Color assigned to the node
18081  */
18082 const uint8_t (*NodeAnnouncementInfo_get_rgb(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr))[3];
18083
18084 /**
18085  * Color assigned to the node
18086  */
18087 void NodeAnnouncementInfo_set_rgb(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKThreeBytes val);
18088
18089 /**
18090  * Moniker assigned to the node.
18091  * May be invalid or malicious (eg control chars),
18092  * should not be exposed to the user.
18093  */
18094 const uint8_t (*NodeAnnouncementInfo_get_alias(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr))[32];
18095
18096 /**
18097  * Moniker assigned to the node.
18098  * May be invalid or malicious (eg control chars),
18099  * should not be exposed to the user.
18100  */
18101 void NodeAnnouncementInfo_set_alias(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
18102
18103 /**
18104  * Internet-level addresses via which one can connect to the node
18105  */
18106 void NodeAnnouncementInfo_set_addresses(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKCVec_NetAddressZ val);
18107
18108 /**
18109  * An initial announcement of the node
18110  * Mostly redundant with the data we store in fields explicitly.
18111  * Everything else is useful only for sending out for initial routing sync.
18112  * Not stored if contains excess data to prevent DoS.
18113  */
18114 struct LDKNodeAnnouncement NodeAnnouncementInfo_get_announcement_message(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
18115
18116 /**
18117  * An initial announcement of the node
18118  * Mostly redundant with the data we store in fields explicitly.
18119  * Everything else is useful only for sending out for initial routing sync.
18120  * Not stored if contains excess data to prevent DoS.
18121  */
18122 void NodeAnnouncementInfo_set_announcement_message(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeAnnouncement val);
18123
18124 /**
18125  * Constructs a new NodeAnnouncementInfo given each field
18126  */
18127 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);
18128
18129 /**
18130  * Creates a copy of the NodeAnnouncementInfo
18131  */
18132 struct LDKNodeAnnouncementInfo NodeAnnouncementInfo_clone(const struct LDKNodeAnnouncementInfo *NONNULL_PTR orig);
18133
18134 /**
18135  * Serialize the NodeAnnouncementInfo object into a byte array which can be read by NodeAnnouncementInfo_read
18136  */
18137 struct LDKCVec_u8Z NodeAnnouncementInfo_write(const struct LDKNodeAnnouncementInfo *NONNULL_PTR obj);
18138
18139 /**
18140  * Read a NodeAnnouncementInfo from a byte array, created by NodeAnnouncementInfo_write
18141  */
18142 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ NodeAnnouncementInfo_read(struct LDKu8slice ser);
18143
18144 /**
18145  * Frees any resources used by the NodeInfo, if is_owned is set and inner is non-NULL.
18146  */
18147 void NodeInfo_free(struct LDKNodeInfo this_obj);
18148
18149 /**
18150  * All valid channels a node has announced
18151  */
18152 void NodeInfo_set_channels(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
18153
18154 /**
18155  * Lowest fees enabling routing via any of the enabled, known channels to a node.
18156  * The two fields (flat and proportional fee) are independent,
18157  * meaning they don't have to refer to the same channel.
18158  */
18159 struct LDKRoutingFees NodeInfo_get_lowest_inbound_channel_fees(const struct LDKNodeInfo *NONNULL_PTR this_ptr);
18160
18161 /**
18162  * Lowest fees enabling routing via any of the enabled, known channels to a node.
18163  * The two fields (flat and proportional fee) are independent,
18164  * meaning they don't have to refer to the same channel.
18165  */
18166 void NodeInfo_set_lowest_inbound_channel_fees(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
18167
18168 /**
18169  * More information about a node from node_announcement.
18170  * Optional because we store a Node entry after learning about it from
18171  * a channel announcement, but before receiving a node announcement.
18172  */
18173 struct LDKNodeAnnouncementInfo NodeInfo_get_announcement_info(const struct LDKNodeInfo *NONNULL_PTR this_ptr);
18174
18175 /**
18176  * More information about a node from node_announcement.
18177  * Optional because we store a Node entry after learning about it from
18178  * a channel announcement, but before receiving a node announcement.
18179  */
18180 void NodeInfo_set_announcement_info(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKNodeAnnouncementInfo val);
18181
18182 /**
18183  * Constructs a new NodeInfo given each field
18184  */
18185 MUST_USE_RES struct LDKNodeInfo NodeInfo_new(struct LDKCVec_u64Z channels_arg, struct LDKRoutingFees lowest_inbound_channel_fees_arg, struct LDKNodeAnnouncementInfo announcement_info_arg);
18186
18187 /**
18188  * Creates a copy of the NodeInfo
18189  */
18190 struct LDKNodeInfo NodeInfo_clone(const struct LDKNodeInfo *NONNULL_PTR orig);
18191
18192 /**
18193  * Serialize the NodeInfo object into a byte array which can be read by NodeInfo_read
18194  */
18195 struct LDKCVec_u8Z NodeInfo_write(const struct LDKNodeInfo *NONNULL_PTR obj);
18196
18197 /**
18198  * Read a NodeInfo from a byte array, created by NodeInfo_write
18199  */
18200 struct LDKCResult_NodeInfoDecodeErrorZ NodeInfo_read(struct LDKu8slice ser);
18201
18202 /**
18203  * Serialize the NetworkGraph object into a byte array which can be read by NetworkGraph_read
18204  */
18205 struct LDKCVec_u8Z NetworkGraph_write(const struct LDKNetworkGraph *NONNULL_PTR obj);
18206
18207 /**
18208  * Read a NetworkGraph from a byte array, created by NetworkGraph_write
18209  */
18210 struct LDKCResult_NetworkGraphDecodeErrorZ NetworkGraph_read(struct LDKu8slice ser);
18211
18212 /**
18213  * Creates a new, empty, network graph.
18214  */
18215 MUST_USE_RES struct LDKNetworkGraph NetworkGraph_new(struct LDKThirtyTwoBytes genesis_hash);
18216
18217 /**
18218  * For an already known node (from channel announcements), update its stored properties from a
18219  * given node announcement.
18220  *
18221  * You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's
18222  * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
18223  * routing messages from a source using a protocol other than the lightning P2P protocol.
18224  */
18225 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_node_from_announcement(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKNodeAnnouncement *NONNULL_PTR msg);
18226
18227 /**
18228  * For an already known node (from channel announcements), update its stored properties from a
18229  * given node announcement without verifying the associated signatures. Because we aren't
18230  * given the associated signatures here we cannot relay the node announcement to any of our
18231  * peers.
18232  */
18233 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_node_from_unsigned_announcement(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR msg);
18234
18235 /**
18236  * Store or update channel info from a channel announcement.
18237  *
18238  * You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's
18239  * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
18240  * routing messages from a source using a protocol other than the lightning P2P protocol.
18241  *
18242  * If a `chain::Access` object is provided via `chain_access`, it will be called to verify
18243  * the corresponding UTXO exists on chain and is correctly-formatted.
18244  */
18245 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);
18246
18247 /**
18248  * Store or update channel info from a channel announcement without verifying the associated
18249  * signatures. Because we aren't given the associated signatures here we cannot relay the
18250  * channel announcement to any of our peers.
18251  *
18252  * If a `chain::Access` object is provided via `chain_access`, it will be called to verify
18253  * the corresponding UTXO exists on chain and is correctly-formatted.
18254  */
18255 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);
18256
18257 /**
18258  * Close a channel if a corresponding HTLC fail was sent.
18259  * If permanent, removes a channel from the local storage.
18260  * May cause the removal of nodes too, if this was their last channel.
18261  * If not permanent, makes channels unavailable for routing.
18262  */
18263 void NetworkGraph_close_channel_from_update(struct LDKNetworkGraph *NONNULL_PTR this_arg, uint64_t short_channel_id, bool is_permanent);
18264
18265 /**
18266  * For an already known (from announcement) channel, update info about one of the directions
18267  * of the channel.
18268  *
18269  * You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's
18270  * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
18271  * routing messages from a source using a protocol other than the lightning P2P protocol.
18272  */
18273 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg);
18274
18275 /**
18276  * For an already known (from announcement) channel, update info about one of the directions
18277  * of the channel without verifying the associated signatures. Because we aren't given the
18278  * associated signatures here we cannot relay the channel update to any of our peers.
18279  */
18280 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_unsigned(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedChannelUpdate *NONNULL_PTR msg);
18281
18282 /**
18283  * Frees any resources used by the FilesystemPersister, if is_owned is set and inner is non-NULL.
18284  */
18285 void FilesystemPersister_free(struct LDKFilesystemPersister this_obj);
18286
18287 /**
18288  * Initialize a new FilesystemPersister and set the path to the individual channels'
18289  * files.
18290  */
18291 MUST_USE_RES struct LDKFilesystemPersister FilesystemPersister_new(struct LDKStr path_to_channel_data);
18292
18293 /**
18294  * Get the directory which was provided when this persister was initialized.
18295  */
18296 MUST_USE_RES struct LDKStr FilesystemPersister_get_data_dir(const struct LDKFilesystemPersister *NONNULL_PTR this_arg);
18297
18298 /**
18299  * Writes the provided `ChannelManager` to the path provided at `FilesystemPersister`
18300  * initialization, within a file called \"manager\".
18301  */
18302 MUST_USE_RES struct LDKCResult_NoneErrorZ FilesystemPersister_persist_manager(struct LDKStr data_dir, const struct LDKChannelManager *NONNULL_PTR manager);
18303
18304 /**
18305  * Read `ChannelMonitor`s from disk.
18306  */
18307 MUST_USE_RES struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ FilesystemPersister_read_channelmonitors(const struct LDKFilesystemPersister *NONNULL_PTR this_arg, struct LDKKeysInterface keys_manager);
18308
18309 /**
18310  * Constructs a new Persist which calls the relevant methods on this_arg.
18311  * This copies the `inner` pointer in this_arg and thus the returned Persist must be freed before this_arg is
18312  */
18313 struct LDKPersist FilesystemPersister_as_Persist(const struct LDKFilesystemPersister *NONNULL_PTR this_arg);
18314
18315 /**
18316  * Frees any resources used by the BackgroundProcessor, if is_owned is set and inner is non-NULL.
18317  */
18318 void BackgroundProcessor_free(struct LDKBackgroundProcessor this_obj);
18319
18320 /**
18321  * Calls the free function if one is set
18322  */
18323 void ChannelManagerPersister_free(struct LDKChannelManagerPersister this_ptr);
18324
18325 /**
18326  * Start a background thread that takes care of responsibilities enumerated in the top-level
18327  * documentation.
18328  *
18329  * If `persist_manager` returns an error, then this thread will return said error (and
18330  * `start()` will need to be called again to restart the `BackgroundProcessor`). Users should
18331  * wait on [`thread_handle`]'s `join()` method to be able to tell if and when an error is
18332  * returned, or implement `persist_manager` such that an error is never returned to the
18333  * `BackgroundProcessor`
18334  *
18335  * `persist_manager` is responsible for writing out the [`ChannelManager`] to disk, and/or
18336  * uploading to one or more backup services. See [`ChannelManager::write`] for writing out a
18337  * [`ChannelManager`]. See [`FilesystemPersister::persist_manager`] for Rust-Lightning's
18338  * provided implementation.
18339  *
18340  * [`thread_handle`]: BackgroundProcessor::thread_handle
18341  * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
18342  * [`ChannelManager::write`]: lightning::ln::channelmanager::ChannelManager#impl-Writeable
18343  * [`FilesystemPersister::persist_manager`]: lightning_persister::FilesystemPersister::persist_manager
18344  */
18345 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);
18346
18347 /**
18348  * Stop `BackgroundProcessor`'s thread.
18349  */
18350 MUST_USE_RES struct LDKCResult_NoneErrorZ BackgroundProcessor_stop(struct LDKBackgroundProcessor this_arg);
18351
18352 /**
18353  * **Call this function on startup to ensure that all assumptions about the platform are valid.**
18354  *
18355  * Unfortunately we have to make assumptions about the upper bounds of the `SystemTime` type on
18356  * your platform which we can't fully verify at compile time and which isn't part of it's contract.
18357  * To our best knowledge our assumptions hold for all platforms officially supported by rust, but
18358  * since this check is fast we recommend to do it anyway.
18359  *
18360  * If this function fails this is considered a bug. Please open an issue describing your
18361  * platform and stating your current system time.
18362  *
18363  * # Panics
18364  * If the check fails this function panics. By calling this function on startup you ensure that
18365  * this wont happen at an arbitrary later point in time.
18366  */
18367 void check_platform(void);
18368
18369 /**
18370  * Frees any resources used by the Invoice, if is_owned is set and inner is non-NULL.
18371  */
18372 void Invoice_free(struct LDKInvoice this_obj);
18373
18374 /**
18375  * Checks if two Invoices contain equal inner contents.
18376  * This ignores pointers and is_owned flags and looks at the values in fields.
18377  * Two objects with NULL inner values will be considered "equal" here.
18378  */
18379 bool Invoice_eq(const struct LDKInvoice *NONNULL_PTR a, const struct LDKInvoice *NONNULL_PTR b);
18380
18381 /**
18382  * Creates a copy of the Invoice
18383  */
18384 struct LDKInvoice Invoice_clone(const struct LDKInvoice *NONNULL_PTR orig);
18385
18386 /**
18387  * Frees any resources used by the SignedRawInvoice, if is_owned is set and inner is non-NULL.
18388  */
18389 void SignedRawInvoice_free(struct LDKSignedRawInvoice this_obj);
18390
18391 /**
18392  * Checks if two SignedRawInvoices contain equal inner contents.
18393  * This ignores pointers and is_owned flags and looks at the values in fields.
18394  * Two objects with NULL inner values will be considered "equal" here.
18395  */
18396 bool SignedRawInvoice_eq(const struct LDKSignedRawInvoice *NONNULL_PTR a, const struct LDKSignedRawInvoice *NONNULL_PTR b);
18397
18398 /**
18399  * Creates a copy of the SignedRawInvoice
18400  */
18401 struct LDKSignedRawInvoice SignedRawInvoice_clone(const struct LDKSignedRawInvoice *NONNULL_PTR orig);
18402
18403 /**
18404  * Frees any resources used by the RawInvoice, if is_owned is set and inner is non-NULL.
18405  */
18406 void RawInvoice_free(struct LDKRawInvoice this_obj);
18407
18408 /**
18409  * data part
18410  */
18411 struct LDKRawDataPart RawInvoice_get_data(const struct LDKRawInvoice *NONNULL_PTR this_ptr);
18412
18413 /**
18414  * data part
18415  */
18416 void RawInvoice_set_data(struct LDKRawInvoice *NONNULL_PTR this_ptr, struct LDKRawDataPart val);
18417
18418 /**
18419  * Checks if two RawInvoices contain equal inner contents.
18420  * This ignores pointers and is_owned flags and looks at the values in fields.
18421  * Two objects with NULL inner values will be considered "equal" here.
18422  */
18423 bool RawInvoice_eq(const struct LDKRawInvoice *NONNULL_PTR a, const struct LDKRawInvoice *NONNULL_PTR b);
18424
18425 /**
18426  * Creates a copy of the RawInvoice
18427  */
18428 struct LDKRawInvoice RawInvoice_clone(const struct LDKRawInvoice *NONNULL_PTR orig);
18429
18430 /**
18431  * Frees any resources used by the RawDataPart, if is_owned is set and inner is non-NULL.
18432  */
18433 void RawDataPart_free(struct LDKRawDataPart this_obj);
18434
18435 /**
18436  * generation time of the invoice
18437  */
18438 struct LDKPositiveTimestamp RawDataPart_get_timestamp(const struct LDKRawDataPart *NONNULL_PTR this_ptr);
18439
18440 /**
18441  * generation time of the invoice
18442  */
18443 void RawDataPart_set_timestamp(struct LDKRawDataPart *NONNULL_PTR this_ptr, struct LDKPositiveTimestamp val);
18444
18445 /**
18446  * Checks if two RawDataParts contain equal inner contents.
18447  * This ignores pointers and is_owned flags and looks at the values in fields.
18448  * Two objects with NULL inner values will be considered "equal" here.
18449  */
18450 bool RawDataPart_eq(const struct LDKRawDataPart *NONNULL_PTR a, const struct LDKRawDataPart *NONNULL_PTR b);
18451
18452 /**
18453  * Creates a copy of the RawDataPart
18454  */
18455 struct LDKRawDataPart RawDataPart_clone(const struct LDKRawDataPart *NONNULL_PTR orig);
18456
18457 /**
18458  * Frees any resources used by the PositiveTimestamp, if is_owned is set and inner is non-NULL.
18459  */
18460 void PositiveTimestamp_free(struct LDKPositiveTimestamp this_obj);
18461
18462 /**
18463  * Checks if two PositiveTimestamps contain equal inner contents.
18464  * This ignores pointers and is_owned flags and looks at the values in fields.
18465  * Two objects with NULL inner values will be considered "equal" here.
18466  */
18467 bool PositiveTimestamp_eq(const struct LDKPositiveTimestamp *NONNULL_PTR a, const struct LDKPositiveTimestamp *NONNULL_PTR b);
18468
18469 /**
18470  * Creates a copy of the PositiveTimestamp
18471  */
18472 struct LDKPositiveTimestamp PositiveTimestamp_clone(const struct LDKPositiveTimestamp *NONNULL_PTR orig);
18473
18474 /**
18475  * Creates a copy of the SiPrefix
18476  */
18477 enum LDKSiPrefix SiPrefix_clone(const enum LDKSiPrefix *NONNULL_PTR orig);
18478
18479 /**
18480  * Checks if two SiPrefixs contain equal inner contents.
18481  * This ignores pointers and is_owned flags and looks at the values in fields.
18482  */
18483 bool SiPrefix_eq(const enum LDKSiPrefix *NONNULL_PTR a, const enum LDKSiPrefix *NONNULL_PTR b);
18484
18485 /**
18486  * Returns the multiplier to go from a BTC value to picoBTC implied by this SiPrefix.
18487  * This is effectively 10^12 * the prefix multiplier
18488  */
18489 MUST_USE_RES uint64_t SiPrefix_multiplier(const enum LDKSiPrefix *NONNULL_PTR this_arg);
18490
18491 /**
18492  * Creates a copy of the Currency
18493  */
18494 enum LDKCurrency Currency_clone(const enum LDKCurrency *NONNULL_PTR orig);
18495
18496 /**
18497  * Checks if two Currencys contain equal inner contents.
18498  * This ignores pointers and is_owned flags and looks at the values in fields.
18499  */
18500 bool Currency_eq(const enum LDKCurrency *NONNULL_PTR a, const enum LDKCurrency *NONNULL_PTR b);
18501
18502 /**
18503  * Frees any resources used by the Sha256, if is_owned is set and inner is non-NULL.
18504  */
18505 void Sha256_free(struct LDKSha256 this_obj);
18506
18507 /**
18508  * Checks if two Sha256s contain equal inner contents.
18509  * This ignores pointers and is_owned flags and looks at the values in fields.
18510  * Two objects with NULL inner values will be considered "equal" here.
18511  */
18512 bool Sha256_eq(const struct LDKSha256 *NONNULL_PTR a, const struct LDKSha256 *NONNULL_PTR b);
18513
18514 /**
18515  * Creates a copy of the Sha256
18516  */
18517 struct LDKSha256 Sha256_clone(const struct LDKSha256 *NONNULL_PTR orig);
18518
18519 /**
18520  * Frees any resources used by the Description, if is_owned is set and inner is non-NULL.
18521  */
18522 void Description_free(struct LDKDescription this_obj);
18523
18524 /**
18525  * Checks if two Descriptions contain equal inner contents.
18526  * This ignores pointers and is_owned flags and looks at the values in fields.
18527  * Two objects with NULL inner values will be considered "equal" here.
18528  */
18529 bool Description_eq(const struct LDKDescription *NONNULL_PTR a, const struct LDKDescription *NONNULL_PTR b);
18530
18531 /**
18532  * Creates a copy of the Description
18533  */
18534 struct LDKDescription Description_clone(const struct LDKDescription *NONNULL_PTR orig);
18535
18536 /**
18537  * Frees any resources used by the PayeePubKey, if is_owned is set and inner is non-NULL.
18538  */
18539 void PayeePubKey_free(struct LDKPayeePubKey this_obj);
18540
18541 /**
18542  * Checks if two PayeePubKeys contain equal inner contents.
18543  * This ignores pointers and is_owned flags and looks at the values in fields.
18544  * Two objects with NULL inner values will be considered "equal" here.
18545  */
18546 bool PayeePubKey_eq(const struct LDKPayeePubKey *NONNULL_PTR a, const struct LDKPayeePubKey *NONNULL_PTR b);
18547
18548 /**
18549  * Creates a copy of the PayeePubKey
18550  */
18551 struct LDKPayeePubKey PayeePubKey_clone(const struct LDKPayeePubKey *NONNULL_PTR orig);
18552
18553 /**
18554  * Frees any resources used by the ExpiryTime, if is_owned is set and inner is non-NULL.
18555  */
18556 void ExpiryTime_free(struct LDKExpiryTime this_obj);
18557
18558 /**
18559  * Checks if two ExpiryTimes contain equal inner contents.
18560  * This ignores pointers and is_owned flags and looks at the values in fields.
18561  * Two objects with NULL inner values will be considered "equal" here.
18562  */
18563 bool ExpiryTime_eq(const struct LDKExpiryTime *NONNULL_PTR a, const struct LDKExpiryTime *NONNULL_PTR b);
18564
18565 /**
18566  * Creates a copy of the ExpiryTime
18567  */
18568 struct LDKExpiryTime ExpiryTime_clone(const struct LDKExpiryTime *NONNULL_PTR orig);
18569
18570 /**
18571  * Frees any resources used by the MinFinalCltvExpiry, if is_owned is set and inner is non-NULL.
18572  */
18573 void MinFinalCltvExpiry_free(struct LDKMinFinalCltvExpiry this_obj);
18574
18575 /**
18576  * Checks if two MinFinalCltvExpirys contain equal inner contents.
18577  * This ignores pointers and is_owned flags and looks at the values in fields.
18578  * Two objects with NULL inner values will be considered "equal" here.
18579  */
18580 bool MinFinalCltvExpiry_eq(const struct LDKMinFinalCltvExpiry *NONNULL_PTR a, const struct LDKMinFinalCltvExpiry *NONNULL_PTR b);
18581
18582 /**
18583  * Creates a copy of the MinFinalCltvExpiry
18584  */
18585 struct LDKMinFinalCltvExpiry MinFinalCltvExpiry_clone(const struct LDKMinFinalCltvExpiry *NONNULL_PTR orig);
18586
18587 /**
18588  * Frees any resources used by the Fallback
18589  */
18590 void Fallback_free(struct LDKFallback this_ptr);
18591
18592 /**
18593  * Creates a copy of the Fallback
18594  */
18595 struct LDKFallback Fallback_clone(const struct LDKFallback *NONNULL_PTR orig);
18596
18597 /**
18598  * Checks if two Fallbacks contain equal inner contents.
18599  * This ignores pointers and is_owned flags and looks at the values in fields.
18600  */
18601 bool Fallback_eq(const struct LDKFallback *NONNULL_PTR a, const struct LDKFallback *NONNULL_PTR b);
18602
18603 /**
18604  * Frees any resources used by the InvoiceSignature, if is_owned is set and inner is non-NULL.
18605  */
18606 void InvoiceSignature_free(struct LDKInvoiceSignature this_obj);
18607
18608 /**
18609  * Checks if two InvoiceSignatures contain equal inner contents.
18610  * This ignores pointers and is_owned flags and looks at the values in fields.
18611  * Two objects with NULL inner values will be considered "equal" here.
18612  */
18613 bool InvoiceSignature_eq(const struct LDKInvoiceSignature *NONNULL_PTR a, const struct LDKInvoiceSignature *NONNULL_PTR b);
18614
18615 /**
18616  * Creates a copy of the InvoiceSignature
18617  */
18618 struct LDKInvoiceSignature InvoiceSignature_clone(const struct LDKInvoiceSignature *NONNULL_PTR orig);
18619
18620 /**
18621  * Frees any resources used by the PrivateRoute, if is_owned is set and inner is non-NULL.
18622  */
18623 void PrivateRoute_free(struct LDKPrivateRoute this_obj);
18624
18625 /**
18626  * Checks if two PrivateRoutes contain equal inner contents.
18627  * This ignores pointers and is_owned flags and looks at the values in fields.
18628  * Two objects with NULL inner values will be considered "equal" here.
18629  */
18630 bool PrivateRoute_eq(const struct LDKPrivateRoute *NONNULL_PTR a, const struct LDKPrivateRoute *NONNULL_PTR b);
18631
18632 /**
18633  * Creates a copy of the PrivateRoute
18634  */
18635 struct LDKPrivateRoute PrivateRoute_clone(const struct LDKPrivateRoute *NONNULL_PTR orig);
18636
18637 /**
18638  * Disassembles the `SignedRawInvoice` into its three parts:
18639  *  1. raw invoice
18640  *  2. hash of the raw invoice
18641  *  3. signature
18642  */
18643 MUST_USE_RES struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ SignedRawInvoice_into_parts(struct LDKSignedRawInvoice this_arg);
18644
18645 /**
18646  * The `RawInvoice` which was signed.
18647  */
18648 MUST_USE_RES struct LDKRawInvoice SignedRawInvoice_raw_invoice(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
18649
18650 /**
18651  * The hash of the `RawInvoice` that was signed.
18652  */
18653 MUST_USE_RES const uint8_t (*SignedRawInvoice_hash(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg))[32];
18654
18655 /**
18656  * InvoiceSignature for the invoice.
18657  */
18658 MUST_USE_RES struct LDKInvoiceSignature SignedRawInvoice_signature(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
18659
18660 /**
18661  * Recovers the public key used for signing the invoice from the recoverable signature.
18662  */
18663 MUST_USE_RES struct LDKCResult_PayeePubKeyErrorZ SignedRawInvoice_recover_payee_pub_key(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
18664
18665 /**
18666  * Checks if the signature is valid for the included payee public key or if none exists if it's
18667  * valid for the recovered signature (which should always be true?).
18668  */
18669 MUST_USE_RES bool SignedRawInvoice_check_signature(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
18670
18671 /**
18672  * Calculate the hash of the encoded `RawInvoice`
18673  */
18674 MUST_USE_RES struct LDKThirtyTwoBytes RawInvoice_hash(const struct LDKRawInvoice *NONNULL_PTR this_arg);
18675
18676 MUST_USE_RES struct LDKSha256 RawInvoice_payment_hash(const struct LDKRawInvoice *NONNULL_PTR this_arg);
18677
18678 MUST_USE_RES struct LDKDescription RawInvoice_description(const struct LDKRawInvoice *NONNULL_PTR this_arg);
18679
18680 MUST_USE_RES struct LDKPayeePubKey RawInvoice_payee_pub_key(const struct LDKRawInvoice *NONNULL_PTR this_arg);
18681
18682 MUST_USE_RES struct LDKSha256 RawInvoice_description_hash(const struct LDKRawInvoice *NONNULL_PTR this_arg);
18683
18684 MUST_USE_RES struct LDKExpiryTime RawInvoice_expiry_time(const struct LDKRawInvoice *NONNULL_PTR this_arg);
18685
18686 MUST_USE_RES struct LDKMinFinalCltvExpiry RawInvoice_min_final_cltv_expiry(const struct LDKRawInvoice *NONNULL_PTR this_arg);
18687
18688 MUST_USE_RES struct LDKThirtyTwoBytes RawInvoice_payment_secret(const struct LDKRawInvoice *NONNULL_PTR this_arg);
18689
18690 MUST_USE_RES struct LDKInvoiceFeatures RawInvoice_features(const struct LDKRawInvoice *NONNULL_PTR this_arg);
18691
18692 MUST_USE_RES struct LDKCVec_PrivateRouteZ RawInvoice_private_routes(const struct LDKRawInvoice *NONNULL_PTR this_arg);
18693
18694 MUST_USE_RES struct LDKCOption_u64Z RawInvoice_amount_pico_btc(const struct LDKRawInvoice *NONNULL_PTR this_arg);
18695
18696 MUST_USE_RES enum LDKCurrency RawInvoice_currency(const struct LDKRawInvoice *NONNULL_PTR this_arg);
18697
18698 /**
18699  * Create a new `PositiveTimestamp` from a unix timestamp in the Range
18700  * `0...SYSTEM_TIME_MAX_UNIX_TIMESTAMP - MAX_EXPIRY_TIME`, otherwise return a
18701  * `CreationError::TimestampOutOfBounds`.
18702  */
18703 MUST_USE_RES struct LDKCResult_PositiveTimestampCreationErrorZ PositiveTimestamp_from_unix_timestamp(uint64_t unix_seconds);
18704
18705 /**
18706  * Create a new `PositiveTimestamp` from a `SystemTime` with a corresponding unix timestamp in
18707  * the Range `0...SYSTEM_TIME_MAX_UNIX_TIMESTAMP - MAX_EXPIRY_TIME`, otherwise return a
18708  * `CreationError::TimestampOutOfBounds`.
18709  */
18710 MUST_USE_RES struct LDKCResult_PositiveTimestampCreationErrorZ PositiveTimestamp_from_system_time(uint64_t time);
18711
18712 /**
18713  * Returns the UNIX timestamp representing the stored time
18714  */
18715 MUST_USE_RES uint64_t PositiveTimestamp_as_unix_timestamp(const struct LDKPositiveTimestamp *NONNULL_PTR this_arg);
18716
18717 /**
18718  * Returns a reference to the internal `SystemTime` time representation
18719  */
18720 MUST_USE_RES uint64_t PositiveTimestamp_as_time(const struct LDKPositiveTimestamp *NONNULL_PTR this_arg);
18721
18722 /**
18723  * Transform the `Invoice` into it's unchecked version
18724  */
18725 MUST_USE_RES struct LDKSignedRawInvoice Invoice_into_signed_raw(struct LDKInvoice this_arg);
18726
18727 /**
18728  * Check that the invoice is signed correctly and that key recovery works
18729  */
18730 MUST_USE_RES struct LDKCResult_NoneSemanticErrorZ Invoice_check_signature(const struct LDKInvoice *NONNULL_PTR this_arg);
18731
18732 /**
18733  * Constructs an `Invoice` from a `SignedRawInvoice` by checking all its invariants.
18734  * ```
18735  * use lightning_invoice::*;
18736  *
18737  * let invoice = \"lnbc1pvjluezpp5qqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqypqdp\\
18738  * \tl2pkx2ctnv5sxxmmwwd5kgetjypeh2ursdae8g6twvus8g6rfwvs8qun0dfjkxaq8rkx3yf5tcsyz3d7\\
18739  * \t3gafnh3cax9rn449d9p5uxz9ezhhypd0elx87sjle52x86fux2ypatgddc6k63n7erqz25le42c4u4ec\\
18740  * \tky03ylcqca784w\";
18741  *
18742  * let signed = invoice.parse::<SignedRawInvoice>().unwrap();
18743  *
18744  * assert!(Invoice::from_signed(signed).is_ok());
18745  * ```
18746  */
18747 MUST_USE_RES struct LDKCResult_InvoiceSemanticErrorZ Invoice_from_signed(struct LDKSignedRawInvoice signed_invoice);
18748
18749 /**
18750  * Returns the `Invoice`'s timestamp (should equal it's creation time)
18751  */
18752 MUST_USE_RES uint64_t Invoice_timestamp(const struct LDKInvoice *NONNULL_PTR this_arg);
18753
18754 /**
18755  * Returns the hash to which we will receive the preimage on completion of the payment
18756  */
18757 MUST_USE_RES const uint8_t (*Invoice_payment_hash(const struct LDKInvoice *NONNULL_PTR this_arg))[32];
18758
18759 /**
18760  * Get the payee's public key if one was included in the invoice
18761  */
18762 MUST_USE_RES struct LDKPublicKey Invoice_payee_pub_key(const struct LDKInvoice *NONNULL_PTR this_arg);
18763
18764 /**
18765  * Get the payment secret if one was included in the invoice
18766  */
18767 MUST_USE_RES struct LDKThirtyTwoBytes Invoice_payment_secret(const struct LDKInvoice *NONNULL_PTR this_arg);
18768
18769 /**
18770  * Get the invoice features if they were included in the invoice
18771  */
18772 MUST_USE_RES struct LDKInvoiceFeatures Invoice_features(const struct LDKInvoice *NONNULL_PTR this_arg);
18773
18774 /**
18775  * Recover the payee's public key (only to be used if none was included in the invoice)
18776  */
18777 MUST_USE_RES struct LDKPublicKey Invoice_recover_payee_pub_key(const struct LDKInvoice *NONNULL_PTR this_arg);
18778
18779 /**
18780  * Returns the invoice's expiry time, if present, otherwise [`DEFAULT_EXPIRY_TIME`].
18781  */
18782 MUST_USE_RES uint64_t Invoice_expiry_time(const struct LDKInvoice *NONNULL_PTR this_arg);
18783
18784 /**
18785  * Returns the invoice's `min_final_cltv_expiry` time, if present, otherwise
18786  * [`DEFAULT_MIN_FINAL_CLTV_EXPIRY`].
18787  */
18788 MUST_USE_RES uint64_t Invoice_min_final_cltv_expiry(const struct LDKInvoice *NONNULL_PTR this_arg);
18789
18790 /**
18791  * Returns a list of all routes included in the invoice
18792  */
18793 MUST_USE_RES struct LDKCVec_PrivateRouteZ Invoice_private_routes(const struct LDKInvoice *NONNULL_PTR this_arg);
18794
18795 /**
18796  * Returns a list of all routes included in the invoice as the underlying hints
18797  */
18798 MUST_USE_RES struct LDKCVec_RouteHintZ Invoice_route_hints(const struct LDKInvoice *NONNULL_PTR this_arg);
18799
18800 /**
18801  * Returns the currency for which the invoice was issued
18802  */
18803 MUST_USE_RES enum LDKCurrency Invoice_currency(const struct LDKInvoice *NONNULL_PTR this_arg);
18804
18805 /**
18806  * Returns the amount if specified in the invoice as pico <currency>.
18807  */
18808 MUST_USE_RES struct LDKCOption_u64Z Invoice_amount_pico_btc(const struct LDKInvoice *NONNULL_PTR this_arg);
18809
18810 /**
18811  * Creates a new `Description` if `description` is at most 1023 __bytes__ long,
18812  * returns `CreationError::DescriptionTooLong` otherwise
18813  *
18814  * Please note that single characters may use more than one byte due to UTF8 encoding.
18815  */
18816 MUST_USE_RES struct LDKCResult_DescriptionCreationErrorZ Description_new(struct LDKStr description);
18817
18818 /**
18819  * Returns the underlying description `String`
18820  */
18821 MUST_USE_RES struct LDKStr Description_into_inner(struct LDKDescription this_arg);
18822
18823 /**
18824  * Construct an `ExpiryTime` from seconds. If there exists a `PositiveTimestamp` which would
18825  * overflow on adding the `EpiryTime` to it then this function will return a
18826  * `CreationError::ExpiryTimeOutOfBounds`.
18827  */
18828 MUST_USE_RES struct LDKCResult_ExpiryTimeCreationErrorZ ExpiryTime_from_seconds(uint64_t seconds);
18829
18830 /**
18831  * Construct an `ExpiryTime` from a `Duration`. If there exists a `PositiveTimestamp` which
18832  * would overflow on adding the `EpiryTime` to it then this function will return a
18833  * `CreationError::ExpiryTimeOutOfBounds`.
18834  */
18835 MUST_USE_RES struct LDKCResult_ExpiryTimeCreationErrorZ ExpiryTime_from_duration(uint64_t duration);
18836
18837 /**
18838  * Returns the expiry time in seconds
18839  */
18840 MUST_USE_RES uint64_t ExpiryTime_as_seconds(const struct LDKExpiryTime *NONNULL_PTR this_arg);
18841
18842 /**
18843  * Returns a reference to the underlying `Duration` (=expiry time)
18844  */
18845 MUST_USE_RES uint64_t ExpiryTime_as_duration(const struct LDKExpiryTime *NONNULL_PTR this_arg);
18846
18847 /**
18848  * Creates a new (partial) route from a list of hops
18849  */
18850 MUST_USE_RES struct LDKCResult_PrivateRouteCreationErrorZ PrivateRoute_new(struct LDKRouteHint hops);
18851
18852 /**
18853  * Returns the underlying list of hops
18854  */
18855 MUST_USE_RES struct LDKRouteHint PrivateRoute_into_inner(struct LDKPrivateRoute this_arg);
18856
18857 /**
18858  * Creates a copy of the CreationError
18859  */
18860 enum LDKCreationError CreationError_clone(const enum LDKCreationError *NONNULL_PTR orig);
18861
18862 /**
18863  * Checks if two CreationErrors contain equal inner contents.
18864  * This ignores pointers and is_owned flags and looks at the values in fields.
18865  */
18866 bool CreationError_eq(const enum LDKCreationError *NONNULL_PTR a, const enum LDKCreationError *NONNULL_PTR b);
18867
18868 /**
18869  * Get the string representation of a CreationError object
18870  */
18871 struct LDKStr CreationError_to_str(const enum LDKCreationError *NONNULL_PTR o);
18872
18873 /**
18874  * Creates a copy of the SemanticError
18875  */
18876 enum LDKSemanticError SemanticError_clone(const enum LDKSemanticError *NONNULL_PTR orig);
18877
18878 /**
18879  * Checks if two SemanticErrors contain equal inner contents.
18880  * This ignores pointers and is_owned flags and looks at the values in fields.
18881  */
18882 bool SemanticError_eq(const enum LDKSemanticError *NONNULL_PTR a, const enum LDKSemanticError *NONNULL_PTR b);
18883
18884 /**
18885  * Get the string representation of a SemanticError object
18886  */
18887 struct LDKStr SemanticError_to_str(const enum LDKSemanticError *NONNULL_PTR o);
18888
18889 /**
18890  * Frees any resources used by the SignOrCreationError
18891  */
18892 void SignOrCreationError_free(struct LDKSignOrCreationError this_ptr);
18893
18894 /**
18895  * Creates a copy of the SignOrCreationError
18896  */
18897 struct LDKSignOrCreationError SignOrCreationError_clone(const struct LDKSignOrCreationError *NONNULL_PTR orig);
18898
18899 /**
18900  * Checks if two SignOrCreationErrors contain equal inner contents.
18901  * This ignores pointers and is_owned flags and looks at the values in fields.
18902  */
18903 bool SignOrCreationError_eq(const struct LDKSignOrCreationError *NONNULL_PTR a, const struct LDKSignOrCreationError *NONNULL_PTR b);
18904
18905 /**
18906  * Get the string representation of a SignOrCreationError object
18907  */
18908 struct LDKStr SignOrCreationError_to_str(const struct LDKSignOrCreationError *NONNULL_PTR o);
18909
18910 /**
18911  * Utility to construct an invoice. Generally, unless you want to do something like a custom
18912  * cltv_expiry, this is what you should be using to create an invoice. The reason being, this
18913  * method stores the invoice's payment secret and preimage in `ChannelManager`, so (a) the user
18914  * doesn't have to store preimage/payment secret information and (b) `ChannelManager` can verify
18915  * that the payment secret is valid when the invoice is paid.
18916  */
18917 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);
18918
18919 /**
18920  * Read a SiPrefix object from a string
18921  */
18922 struct LDKCResult_SiPrefixNoneZ SiPrefix_from_str(struct LDKStr s);
18923
18924 /**
18925  * Read a Invoice object from a string
18926  */
18927 struct LDKCResult_InvoiceNoneZ Invoice_from_str(struct LDKStr s);
18928
18929 /**
18930  * Read a SignedRawInvoice object from a string
18931  */
18932 struct LDKCResult_SignedRawInvoiceNoneZ SignedRawInvoice_from_str(struct LDKStr s);
18933
18934 /**
18935  * Get the string representation of a Invoice object
18936  */
18937 struct LDKStr Invoice_to_str(const struct LDKInvoice *NONNULL_PTR o);
18938
18939 /**
18940  * Get the string representation of a SignedRawInvoice object
18941  */
18942 struct LDKStr SignedRawInvoice_to_str(const struct LDKSignedRawInvoice *NONNULL_PTR o);
18943
18944 /**
18945  * Get the string representation of a Currency object
18946  */
18947 struct LDKStr Currency_to_str(const enum LDKCurrency *NONNULL_PTR o);
18948
18949 /**
18950  * Get the string representation of a SiPrefix object
18951  */
18952 struct LDKStr SiPrefix_to_str(const enum LDKSiPrefix *NONNULL_PTR o);
18953
18954 #endif /* LDK_C_BINDINGS_H */
18955
18956 #include "ldk_ver.h"